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

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --accent: #6c63ff;
  --accent2: #ff6584;
  --text: #f0f0f5;
  --muted: #666680;
  --success: #00e676;
  --warn: #ffab00;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow-x: hidden;
}

/* ── Screens ── */
.screen {
  display: none;
  min-height: 100vh;
  padding: 24px 20px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

/* ── Home ── */
.logo {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.tagline {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 40px;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 14px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  width: 100%;
  max-width: 320px;
  justify-content: center;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid #2a2a3a; }
.btn-success { background: var(--success); color: #000; }
.btn-danger { background: var(--accent2); color: #fff; }
.btn + .btn { margin-top: 12px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  border: 1px solid #1e1e2e;
  margin-bottom: 20px;
}
.card h2 { font-size: 1.1rem; margin-bottom: 16px; color: var(--accent); }

/* ── Input ── */
input[type=text], input[type=url], select {
  width: 100%;
  padding: 12px 16px;
  background: #0d0d14;
  border: 1px solid #2a2a3a;
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus { border-color: var(--accent); }
label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 6px; }

/* ── Session Code ── */
.session-code {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 8px;
  text-align: center;
  color: var(--success);
  padding: 20px;
  background: #001a0d;
  border-radius: 14px;
  border: 2px solid var(--success);
  margin: 16px 0;
}

/* ── Device Grid ── */
.device-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}
.device-dot {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #1e1e2e;
  border: 2px solid #2a2a3a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.3s;
}
.device-dot.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.device-dot.self { border-color: var(--success); }

/* ── Position Display (client) ── */
.position-display {
  text-align: center;
  padding: 40px 20px;
}
.position-number {
  font-size: 6rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.position-label { color: var(--muted); margin-top: 8px; font-size: 0.9rem; }
.position-of { font-size: 1.4rem; color: var(--muted); margin-top: 4px; }

/* ── Canvas / Display ── */
#display-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  display: none;
  z-index: 10;
}
#wave-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 20;
  display: none;
}

/* ── Countdown ── */
.countdown {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  font-size: 8rem;
  font-weight: 900;
  color: var(--success);
  display: none;
}

/* ── Mode Selector ── */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.mode-btn {
  padding: 16px 10px;
  border-radius: 12px;
  border: 2px solid #2a2a3a;
  background: #0d0d14;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.mode-btn span { display: block; font-size: 1.6rem; margin-bottom: 4px; }
.mode-btn.selected { border-color: var(--accent); color: var(--text); background: #1a1a2e; }

/* ── Wave Controls ── */
.color-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.color-swatch {
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.2s;
}
.color-swatch.selected { border-color: #fff; }

/* ── Status bar ── */
.status-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid #1e1e2e;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  z-index: 100;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin-right: 6px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Home Explainer ── */
.home-explainer {
  background: var(--surface);
  border: 1px solid #1e1e2e;
  border-radius: 16px;
  padding: 18px 20px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 28px;
}
.explainer-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.4;
}
.explainer-step span {
  font-size: 1rem;
  flex-shrink: 0;
}
.explainer-step:last-of-type { margin-bottom: 0; }
.explainer-modes {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #1e1e2e;
  font-size: 1.5rem;
}
.home-footer {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}
.home-footer a {
  color: var(--accent);
  text-decoration: none;
}
.home-footer a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 380px) {
  .logo { font-size: 2rem; }
  .position-number { font-size: 5rem; }
}
