/* ── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0d1a;
  --surface:    #16162a;
  --surface-2:  #1f1f3a;
  --surface-3:  #2a2a4a;
  --accent:     #7c3aed;
  --accent-2:   #6d28d9;
  --accent-glow:#a78bfa44;
  --danger:     #ef4444;
  --success:    #10b981;
  --warning:    #f59e0b;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;
  --border:     #2d2d50;
  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  20px;
  --shadow:     0 4px 24px #0006;
  font-size: 16px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input, textarea, select {
  font: inherit;
}

button {
  color: inherit;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: 0;
  position: relative;
}

/* ── SCREENS ──────────────────────────────────────────────────────────────── */
.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 1.5rem 1.25rem;
  animation: fadeIn 0.2s ease;
}

.hidden { display: none !important; }
.screen.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── LOGO / HEADER ────────────────────────────────────────────────────────── */
.logo {
  text-align: center;
  margin-bottom: 0.5rem;
}

.logo-title {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.screen-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.screen-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ── CARDS ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s, opacity 0.1s, box-shadow 0.1s;
  text-decoration: none;
  min-height: 48px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-2); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  min-height: 40px;
}

.btn-icon {
  font-size: 1.2rem;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── INPUTS ───────────────────────────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 0.75rem 1rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  min-height: 48px;
}

.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-dim); }

.input-code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}

/* ── SEGMENTED CONTROL ────────────────────────────────────────────────────── */
.seg-control {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--border);
}

.seg-btn {
  flex: 1;
  padding: 0.5rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
  min-height: 40px;
}

.seg-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ── PLAYER LIST ──────────────────────────────────────────────────────────── */
.player-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.player-item.voted { border-color: var(--accent); }
.player-item.eliminated { border-color: var(--danger); }
.player-item.impostor-reveal { border-color: var(--warning); }

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(36, 31, 63, 0.96), rgba(23, 20, 40, 0.96));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.player-name {
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
}

.player-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-host { background: var(--accent); color: #fff; }
.badge-ready { background: var(--success); color: #fff; }
.badge-impostor { background: var(--danger); color: #fff; }
.badge-crewmate { background: var(--success); color: #fff; }
.badge-offline { background: var(--surface-3); color: var(--text-muted); }

/* ── ROOM CODE ────────────────────────────────────────────────────────────── */
.room-code-display {
  text-align: center;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.room-code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
}

.room-code-value {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ── WORD REVEAL ──────────────────────────────────────────────────────────── */
.word-reveal-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.5rem;
}

.word-card {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  box-shadow: 0 0 40px var(--accent-glow);
}

.word-card.impostor {
  border-color: var(--danger);
  box-shadow: 0 0 40px #ef444440;
}

.word-card.blank-word {
  border-color: var(--text-dim);
  box-shadow: none;
}

.word-role-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.word-role-label.is-impostor { color: var(--danger); }
.word-role-label.is-crewmate { color: var(--success); }

.word-text {
  font-size: clamp(2rem, 10vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--text);
}

.word-text.is-blank {
  font-size: 2rem;
  color: var(--text-dim);
  font-style: italic;
}

.word-category {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface-2);
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.word-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 300px;
}

.tap-to-reveal {
  font-size: 1.1rem;
  color: var(--text-muted);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  width: 100%;
  cursor: pointer;
  touch-action: manipulation;
  text-align: center;
  transition: border-color 0.15s;
}

.tap-to-reveal:active { border-color: var(--accent); }

/* ── DISCUSSION ───────────────────────────────────────────────────────────── */
.phase-banner {
  text-align: center;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.phase-banner.discussion { background: #1d4ed820; color: #93c5fd; border: 1px solid #1d4ed850; }
.phase-banner.voting { background: #7c3aed20; color: #a78bfa; border: 1px solid #7c3aed50; }
.phase-banner.results { background: #05966920; color: #6ee7b7; border: 1px solid #05966950; }

.ack-progress {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* ── VOTING ───────────────────────────────────────────────────────────────── */
.vote-player-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s;
  text-align: left;
  min-height: 56px;
}

.vote-player-btn:hover, .vote-player-btn:active { border-color: var(--accent); background: var(--surface-3); }
.vote-player-btn.selected { border-color: var(--accent); background: #7c3aed20; }
.vote-player-btn.disabled { opacity: 0.4; pointer-events: none; }

.answer-input {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.answer-vote-card {
  align-items: flex-start;
  flex-direction: column;
}

.answer-vote-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.answer-vote-text {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: normal;
}

.answer-vote-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.vote-count-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  margin-top: 0.4rem;
  overflow: hidden;
}

.vote-count-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* ── RESULTS ──────────────────────────────────────────────────────────────── */
.result-hero {
  text-align: center;
  padding: 2rem 1rem;
}

.result-emoji {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  display: block;
}

.result-title {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 0.4rem;
}

.result-title.win { color: var(--success); }
.result-title.lose { color: var(--danger); }
.result-title.tie { color: var(--warning); }

.result-sub { color: var(--text-muted); font-size: 0.9rem; }

.word-reveal-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.word-pill {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.word-pill-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.word-pill-value { font-size: 1.1rem; font-weight: 700; margin-top: 0.2rem; }
.word-pill.civilian { border-color: var(--success); background: #05966910; }
.word-pill.impostor-word { border-color: var(--danger); background: #ef444410; }

/* ── PASS-THE-PHONE SPECIFIC ──────────────────────────────────────────────── */
.handoff-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.5rem;
  padding: 2rem 1.25rem;
}

.handoff-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(30, 27, 53, 0.98), rgba(17, 15, 31, 0.98));
  border: 2px solid rgba(139, 92, 246, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px var(--accent-glow);
  overflow: hidden;
}

.avatar-svg {
  width: 88%;
  height: 88%;
  display: block;
  overflow: visible;
}

.handoff-avatar .avatar-svg {
  width: 90%;
  height: 90%;
}

.handoff-name {
  font-size: 1.5rem;
  font-weight: 800;
}

.handoff-instruction {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ── CLUE PHASE ───────────────────────────────────────────────────────────── */
.speaker-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.speaker-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: all 0.2s;
  opacity: 0.5;
}

.speaker-item.done {
  opacity: 0.35;
  text-decoration: line-through;
  color: var(--text-muted);
}

.speaker-item.active {
  opacity: 1;
  border-color: var(--accent);
  background: #7c3aed18;
  box-shadow: 0 0 16px var(--accent-glow);
}

.speaker-item.upcoming { opacity: 0.65; }

.speaker-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
}

.speaker-item.active .speaker-number {
  background: var(--accent);
  color: #fff;
}

.speaker-item.done .speaker-number {
  background: var(--success);
  color: #fff;
}

.your-turn-banner {
  text-align: center;
  padding: 1.25rem;
  background: #7c3aed18;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 12px var(--accent-glow); }
  50% { box-shadow: 0 0 28px #a78bfa66; }
}

.your-turn-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.your-turn-instruction {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.hint-banner {
  background: #f59e0b18;
  border: 1px solid #f59e0b60;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #fbbf24;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

/* ── TOAST / ERRORS ───────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(4rem);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 100;
  transition: transform 0.25s ease;
  white-space: nowrap;
  max-width: 90vw;
  box-shadow: var(--shadow);
  pointer-events: none;
}

#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { border-color: var(--danger); color: var(--danger); }
#toast.success { border-color: var(--success); color: var(--success); }

/* ── MISC UTILS ───────────────────────────────────────────────────────────── */
.spacer { flex: 1; }
.mt-auto { margin-top: auto; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.back-btn { background: none; border: none; color: var(--text-muted); font-size: 0.9rem; cursor: pointer; padding: 0.25rem 0; display: flex; align-items: center; gap: 0.3rem; margin-bottom: 1rem; }
.language-switch {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px) + 8px);
  left: 12px;
  z-index: 150;
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.22rem;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.22);
  background: rgba(20, 18, 38, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}
.language-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}
.language-btn.active {
  background: rgba(124, 58, 237, 0.22);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.3);
}
.global-home-btn {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px) + 8px);
  right: 12px;
  z-index: 150;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(20, 18, 38, 0.92);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.global-home-btn:hover { border-color: rgba(139, 92, 246, 0.7); transform: translateY(-1px); }
.global-home-btn:active { transform: translateY(0); }

.dot-pulse {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.dot-pulse span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 1rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── HERO & RESULT BANNERS ────────────────────────────────────────────────── */
.hero-banner svg {
  border-radius: 16px;
  border: 1px solid var(--border);
}

.result-banner {
  width: 100%;
  display: block;
  border-radius: 14px;
  border: 1px solid;
  margin-bottom: 1.25rem;
}
.win-banner  { border-color: #10b98140; box-shadow: 0 0 30px #10b98118; }
.lose-banner { border-color: #ef444440; box-shadow: 0 0 30px #ef444418; }
.tie-banner  { border-color: #f59e0b40; box-shadow: 0 0 30px #f59e0b18; }

/* ── HOME SPLASH SCREEN ───────────────────────────────────────────────────── */
.splash-scene {
  width: 100%;
  flex-shrink: 0;
}

.splash-info {
  text-align: center;
  padding: 1rem 1.25rem 0;
}

.splash-title {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.splash-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.splash-desc {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  line-height: 1.5;
}

.splash-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.25rem 2rem;
}

/* ── HOW TO PLAY SCREEN ───────────────────────────────────────────────────── */
.how-to-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.how-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.how-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.how-step strong { display: block; font-size: 0.95rem; margin-bottom: 0.2rem; }
.how-step p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; margin: 0; }

/* ── SETTINGS CARDS (redesigned) ─────────────────────────────────────────── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.settings-card-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.settings-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.settings-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  flex: 1;
}

.settings-inline-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0.25rem 0 0.4rem;
}

.game-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.game-mode-card {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.85rem;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.55rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.game-mode-card:active { transform: scale(0.98); }
.game-mode-card:hover { border-color: var(--accent); background: var(--surface); }
.game-mode-card.selected { border-color: var(--accent); background: #7c3aed18; }

.game-mode-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid currentColor;
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.game-mode-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.game-mode-desc {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* category picker row */
.category-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s;
  margin-bottom: 0.75rem;
  width: 100%;
  text-align: left;
}

.category-row:active { transform: scale(0.98); }
.category-row:hover { border-color: var(--accent); }

.category-emoji { font-size: 1.6rem; flex-shrink: 0; }

.category-row-info { flex: 1; }
.category-row-name { font-size: 0.95rem; font-weight: 700; }
.category-row-sub  { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }

.category-row-arrow { color: var(--text-dim); font-size: 1.1rem; }

/* ── CATEGORY SELECTION SCREEN ────────────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.category-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
}

.category-card:active { transform: scale(0.96); }
.category-card:hover  { border-color: var(--accent); background: var(--surface-2); }
.category-card.selected { border-color: var(--accent); background: #7c3aed18; }
.category-card.random-card { grid-column: span 2; flex-direction: row; justify-content: center; gap: 0.75rem; }

.category-card-emoji { font-size: 2rem; line-height: 1; }
.category-card-name  { font-size: 0.85rem; font-weight: 700; }
.category-card-count { font-size: 0.7rem; color: var(--text-muted); }
.category-card-age   { font-size: 0.65rem; background: var(--surface-3); color: var(--text-muted); padding: 0.1rem 0.4rem; border-radius: 99px; margin-top: 0.1rem; }

/* ── HOME SCREEN MODE CARDS ───────────────────────────────────────────────── */
.mode-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, transform 0.1s;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.mode-card:active { transform: scale(0.98); }
.mode-card:hover, .mode-card.selected { border-color: var(--accent); background: var(--surface-2); }

.mode-icon {
  font-size: 2rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.mode-card-content { flex: 1; }
.mode-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.3rem; }
.mode-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; }

/* ── PIXEL PERFECT MODE ───────────────────────────────────────────────────── */
.pixel-sprite-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0.5rem 0;
}

.pixel-reveal-grid-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem 0;
  gap: 0.5rem;
}

.pixel-reveal-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pixel-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pixel-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid #ffffff20;
}

.pixel-legend-unknown {
  background: #2a2a4a;
  border: 1.5px dashed #64748b;
}

/* Grid layouts */
.pixel-grid {
  display: inline-grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 4px;
}

.pixel-row {
  display: flex;
  gap: 4px;
}

.pixel-grid-large .pixel-cell,
.pixel-grid-large .pixel-cell-sm {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  border: 1.5px solid #ffffff10;
  transition: transform 0.1s, border-color 0.15s;
}

.pixel-grid-small .pixel-cell,
.pixel-grid-small .pixel-cell-sm {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid #ffffff10;
}

/* Cell states */
.pixel-bg {
  background: var(--surface);
}

.pixel-known {
  box-shadow: inset 0 0 0 1px #ffffff18;
}

.pixel-unknown {
  background: #1f1f3a;
  border: 1.5px dashed #64748b !important;
  position: relative;
}

.pixel-unknown::after {
  content: '?';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #64748b;
}

/* Canvas grid (during draw phase) */
.pixel-canvas-grid .pixel-empty {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
}

.pixel-canvas-grid .pixel-filled {
  box-shadow: 0 0 8px #00000040;
}

.pixel-interactive {
  cursor: pointer;
  border-color: #7c3aed !important;
}

.pixel-interactive:hover {
  transform: scale(1.08);
  border-color: #a78bfa !important;
  box-shadow: 0 0 10px #7c3aed50;
}

.pixel-interactive:active {
  transform: scale(0.96);
}

/* Wrong placement in results */
.pixel-wrong {
  outline: 2.5px solid #ef4444;
  outline-offset: -2px;
}

.pixel-wrong-item {
  background: #ef444410;
  border-radius: var(--radius-sm);
}

/* Draw phase layout */
.pixel-progress-bar-wrap {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  margin-bottom: 0.4rem;
  overflow: hidden;
}

.pixel-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.pixel-progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.75rem;
}

.pixel-canvas-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}

.pixel-ref-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.5rem;
}

.pixel-section-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Results grids side by side */
.pixel-results-grids {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.pixel-results-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
