:root {
  --brand: #6366f1;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0d0d12;
  --muted: #6b7280;
  --border: #e5e7eb;
  --input: #ffffff;
  --radius: 22px;
  --shadow: 0 30px 60px -20px rgba(15, 15, 30, 0.25);
}

[data-theme="dark"] {
  --bg: #08080b;
  --card: #121217;
  --text: #f5f5f7;
  --muted: #9aa0ac;
  --border: #25262d;
  --input: #1a1b21;
  --shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Aurora background */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg::before, .bg::after {
  content: "";
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
}
.bg::before {
  background: var(--brand);
  top: -25%; left: -15%;
  animation: float 10s ease-in-out infinite;
}
.bg::after {
  background: #ec4899;
  bottom: -25%; right: -15%;
  animation: float 13s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-30px) translateX(20px); }
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 10;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
}
.theme-toggle:hover { transform: scale(1.08); }
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* Card */
.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 30px 30px;
  text-align: center;
  animation: rise 0.6s cubic-bezier(0.21, 0.68, 0.32, 0.98);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

h1 {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-top: 6px;
}
.muted { color: var(--muted); font-size: 0.92rem; margin-top: 8px; line-height: 1.5; }

/* Wi-Fi orb */
.orb {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orb .ring {
  position: absolute;
  width: 72px; height: 72px;
  border: 2px solid var(--brand);
  border-radius: 50%;
  opacity: 0;
  animation: pulse 2.4s ease-out infinite;
}
.orb .ring:nth-child(2) { animation-delay: 0.6s; }
.orb .ring:nth-child(3) { animation-delay: 1.2s; }
@keyframes pulse {
  0% { transform: scale(0.7); opacity: 0.55; }
  100% { transform: scale(2.6); opacity: 0; }
}
.orb .glow {
  position: absolute;
  width: 100px; height: 100px;
  background: var(--brand);
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.35;
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.45; }
}
.orb .core {
  position: relative;
  z-index: 2;
  width: 78px; height: 78px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #a855f7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 30px -8px rgba(99, 102, 241, 0.6);
}
.core .check-icon { display: none; }

/* connecting state: faster pulse */
body.is-connecting .orb .ring { animation-duration: 1.1s; }
body.is-connecting .orb .core { animation: bob 0.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* connected state */
body.is-connected .orb .ring { animation-play-state: paused; opacity: 0; }
body.is-connected .core .wifi-icon { display: none; }
body.is-connected .core .check-icon { display: block; animation: pop 0.4s ease; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

/* Fields */
.field { margin-top: 18px; }
.field input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--input);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
.gdpr {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}
.gdpr input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }

.error { color: #ef4444; font-size: 0.82rem; margin-top: 12px; font-weight: 500; }

/* Connect button */
.connect-btn {
  width: 100%;
  margin-top: 22px;
  padding: 16px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), #a855f7);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 14px 32px -10px rgba(99, 102, 241, 0.7);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.connect-btn:hover { transform: translateY(-2px); }
.connect-btn:active { transform: translateY(0); }
.connect-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

.secure {
  margin-top: 16px;
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.continue {
  display: inline-block;
  margin-top: 22px;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.7;
}
.brand-dot {
  width: 18px; height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand), #ec4899);
  display: inline-block;
}

.hidden { display: none !important; }
