/* SideQuest - sleek modern dark theme */
:root {
  color-scheme: dark; /* keeps form controls / scrollbars consistent on iOS & Android */
  --bg: #0d0a08;
  --bg-2: #1a1410;
  --surface: rgba(212, 168, 75, 0.04);
  --surface-2: rgba(212, 168, 75, 0.08);
  --border: rgba(212, 168, 75, 0.15);
  --border-strong: rgba(212, 168, 75, 0.32);
  --text: #f5e8c8;
  --text-dim: #b39e7a;
  --text-muted: #7a6b54;
  --accent: #d4a84b;        /* antique gold */
  --accent-2: #0e8a5f;      /* deep emerald */
  --accent-3: #b91c2b;      /* deep ruby */
  --success: #4ade80;       /* clean green for correct answers */
  --success-bg: rgba(74, 222, 128, 0.18);
  --danger: #b91c2b;
  --danger-bg: rgba(185, 28, 43, 0.22);
  --radius: 6px;
  --radius-sm: 4px;
  --pixel-font: 'Press Start 2P', monospace;
  --display-font: 'VT323', monospace;
}
body.light-theme { color-scheme: light; }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* Cross-platform consistency: iOS Safari and Android Chrome render
   default form/button colors differently — lock them to our palette.
   Using currentColor so per-button color rules (gold, etc) are respected. */
button, input, select, textarea {
  font-family: inherit;
  color: var(--text);
  -webkit-text-fill-color: currentColor;
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 1; /* Firefox/Android lower placeholder opacity by default */
  -webkit-text-fill-color: currentColor;
}
button:disabled, input:disabled {
  /* iOS auto-grays disabled controls with a different alpha than Android — pin it */
  opacity: 0.55;
  -webkit-text-fill-color: currentColor;
}
/* Universal correct/incorrect highlight — works on any tappable answer.
   -webkit-text-fill-color uses currentColor so the color rule cascades. */
.answer-correct, button.correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
  -webkit-text-fill-color: currentColor !important;
}
.answer-wrong, button.incorrect, button.wrong {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
  color: #ff8a96 !important;
  -webkit-text-fill-color: currentColor !important;
}

/* Bingo */
.bingo-called-card { text-align: center; }
.bingo-history-details { margin-top: 10px; }
.bingo-history-details summary {
  cursor: pointer; color: var(--text-dim); font-size: 13px; padding: 6px;
}
.bingo-called-list {
  list-style: none; margin-top: 8px; max-height: 180px; overflow-y: auto;
  text-align: left;
}
.bingo-called-list li {
  padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.bingo-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  margin-bottom: 14px;
}
.bingo-cell {
  aspect-ratio: 1; border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.04); border-radius: 10px;
  color: #f3f3ff;
  /* Scale with available width so 5×5 stays readable on small phones AND TVs */
  font-size: clamp(10px, 2.3vw, 14px);
  padding: 5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-align: center; line-height: 1.15; font-weight: 500;
  font-family: inherit; transition: transform 0.15s, background 0.15s;
  word-break: break-word; hyphens: auto;
}
.bingo-cell.free {
  background: rgba(212, 168, 75, 0.18); border-color: var(--accent);
  font-weight: 700; color: var(--accent);
  font-size: clamp(11px, 2.5vw, 15px);
}
.bingo-cell.available {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(212, 168, 75, 0.4);
}
.bingo-cell.marked {
  background: var(--accent); color: var(--bg); border-color: var(--accent);
  font-weight: 700;
}
.bingo-cell.winning {
  background: var(--accent-2); color: var(--bg); border-color: var(--accent-2);
  animation: pulse 1s ease-in-out infinite;
}
.bingo-cell:active { transform: scale(0.95); }

/* Charades picker */
.picker-list {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0;
  justify-content: center;
}
.picker-list button {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 999px; color: var(--text); padding: 10px 16px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.picker-list button:hover { background: var(--accent); color: var(--bg); }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 16px;
  line-height: 1.5;
}

body {
  position: relative;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Background atmosphere */
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(185, 28, 43, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(14, 138, 95, 0.16), transparent 60%),
    radial-gradient(ellipse 50% 30% at 50% 50%, rgba(212, 168, 75, 0.08), transparent 70%);
}
.bg-stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280' viewBox='0 0 280 280' shape-rendering='crispEdges'><rect x='30' y='40' width='2' height='2' fill='%23d4a84b' opacity='0.7'/><rect x='31' y='39' width='1' height='1' fill='%23f5e8c8' opacity='0.9'/><rect x='90' y='20' width='2' height='2' fill='%23d4a84b' opacity='0.5'/><rect x='150' y='70' width='2' height='2' fill='%23d4a84b' opacity='0.6'/><rect x='220' y='30' width='3' height='3' fill='%23d4a84b' opacity='0.4'/><rect x='221' y='29' width='1' height='1' fill='%23f5e8c8' opacity='0.8'/><rect x='60' y='130' width='2' height='2' fill='%230e8a5f' opacity='0.5'/><rect x='180' y='150' width='2' height='2' fill='%23d4a84b' opacity='0.5'/><rect x='250' y='180' width='2' height='2' fill='%23d4a84b' opacity='0.6'/><rect x='40' y='200' width='2' height='2' fill='%23d4a84b' opacity='0.4'/><rect x='110' y='240' width='2' height='2' fill='%23d4a84b' opacity='0.7'/><rect x='200' y='260' width='3' height='3' fill='%23d4a84b' opacity='0.3'/><rect x='130' y='100' width='1' height='1' fill='%23f5e8c8' opacity='0.6'/><rect x='80' y='80' width='1' height='1' fill='%23f5e8c8' opacity='0.5'/><rect x='240' y='110' width='1' height='1' fill='%23f5e8c8' opacity='0.5'/><rect x='20' y='160' width='1' height='1' fill='%23f5e8c8' opacity='0.5'/><rect x='160' y='220' width='1' height='1' fill='%23f5e8c8' opacity='0.6'/></svg>");
  background-size: 280px 280px;
  image-rendering: pixelated;
  opacity: 0.85;
  animation: starTwinkle 6s ease-in-out infinite;
}
@keyframes starTwinkle { 0%,100% { opacity: 0.85; } 50% { opacity: 0.55; } }

/* Floating pixel-art decorations */
.pixel-decor {
  position: fixed; pointer-events: none; z-index: 1;
  image-rendering: pixelated;
  background-size: contain; background-repeat: no-repeat;
  opacity: 0.55;
}
.pd-moon {
  top: 24px; right: 18px; width: 48px; height: 48px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'><rect x='4' y='1' width='4' height='1' fill='%23d4a84b'/><rect x='2' y='2' width='3' height='1' fill='%23d4a84b'/><rect x='2' y='3' width='2' height='1' fill='%23d4a84b'/><rect x='1' y='4' width='2' height='4' fill='%23d4a84b'/><rect x='2' y='8' width='2' height='1' fill='%23d4a84b'/><rect x='2' y='9' width='3' height='1' fill='%23d4a84b'/><rect x='4' y='10' width='4' height='1' fill='%23d4a84b'/></svg>");
  filter: drop-shadow(0 0 10px rgba(212, 168, 75, 0.5));
  animation: floatY 7s ease-in-out infinite;
}
.pd-lantern {
  bottom: 100px; left: 14px; width: 40px; height: 56px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14' shape-rendering='crispEdges'><rect x='4' y='0' width='2' height='1' fill='%238a6818'/><rect x='3' y='1' width='4' height='1' fill='%238a6818'/><rect x='2' y='2' width='6' height='1' fill='%236b5012'/><rect x='1' y='3' width='8' height='1' fill='%23b91c2b'/><rect x='1' y='4' width='1' height='6' fill='%236b1019'/><rect x='8' y='4' width='1' height='6' fill='%236b1019'/><rect x='2' y='4' width='6' height='6' fill='%23d4a84b'/><rect x='3' y='5' width='1' height='4' fill='%23f5e8c8'/><rect x='5' y='6' width='1' height='2' fill='%23f5e8c8'/><rect x='1' y='10' width='8' height='1' fill='%236b1019'/><rect x='2' y='11' width='6' height='1' fill='%238a6818'/><rect x='4' y='12' width='2' height='2' fill='%236b5012'/></svg>");
  filter: drop-shadow(0 0 14px rgba(212, 168, 75, 0.7));
  animation: floatY 5s ease-in-out infinite;
  opacity: 0.7;
}
.pd-key {
  top: 38%; left: 8px; width: 36px; height: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' shape-rendering='crispEdges'><rect x='1' y='2' width='2' height='1' fill='%23d4a84b'/><rect x='0' y='3' width='4' height='2' fill='%23d4a84b'/><rect x='1' y='5' width='2' height='1' fill='%23d4a84b'/><rect x='1' y='3' width='2' height='2' fill='%230d0a08'/><rect x='4' y='3' width='6' height='1' fill='%23d4a84b'/><rect x='4' y='4' width='6' height='1' fill='%238a6818'/><rect x='8' y='5' width='1' height='1' fill='%23d4a84b'/><rect x='10' y='5' width='1' height='1' fill='%23d4a84b'/></svg>");
  opacity: 0.35;
  transform: rotate(-15deg);
  animation: floatY 8s ease-in-out infinite;
}
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.pd-key { animation-name: floatKey; }
@keyframes floatKey { 0%,100% { transform: translateY(0) rotate(-15deg); } 50% { transform: translateY(-6px) rotate(-12deg); } }

@media (max-width: 480px) {
  .pd-key { display: none; }
  .pd-lantern { width: 32px; height: 44px; bottom: 80px; }
}

.bg-grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' /%3E%3C/svg%3E");
}

#app { position: relative; z-index: 2; max-width: 540px; margin: 0 auto; padding: 24px 20px 60px; }

/* Desktop & laptop: let the app breathe on bigger screens without
   stretching the home/lobby card too wide. Game grids (bingo, codenames,
   quiz board, draw canvas) actually benefit from the extra room. */
@media (min-width: 900px) {
  #app { max-width: 760px; padding: 32px 28px 80px; }
}
@media (min-width: 1200px) {
  #app { max-width: 960px; padding: 36px 36px 100px; }
  /* Bingo, Codenames, Quiz Show board all get bigger cells for free
     since they use 1fr columns inside the wider container. */
  .qs-cell { font-size: 28px; min-height: 72px; }
  .qs-cat { min-height: 60px; font-size: 14px; }
  .bingo-cell { font-size: 14px; }
  .cn-cell { font-size: 15px; }
}
/* Home/landing card stays cozy even on very wide screens — looks weird
   when a name input is 900px wide. */
@media (min-width: 900px) {
  [data-screen="home"] .card,
  [data-screen="waiting"] .waiting-card { max-width: 480px; margin-left: auto; margin-right: auto; }
}

/* Screen */
/* .screen entrance is now handled by .screen:not([hidden]) → screenFadeIn (below). */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Hero */
.hero { text-align: center; margin: 36px 0 28px; }
.logo { display: inline-flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.logo-dot {
  width: 28px; height: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'><rect x='3' y='0' width='2' height='1' fill='%23f5e8c8'/><rect x='2' y='1' width='4' height='1' fill='%23d4a84b'/><rect x='1' y='2' width='6' height='1' fill='%23d4a84b'/><rect x='0' y='3' width='8' height='2' fill='%23b8902f'/><rect x='1' y='5' width='6' height='1' fill='%23a07a22'/><rect x='2' y='6' width='4' height='1' fill='%238a6818'/><rect x='3' y='7' width='2' height='1' fill='%236b5012'/></svg>");
  background-size: contain; background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px rgba(212, 168, 75, 0.6));
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.75; transform: scale(1.1); } }
.logo h1 {
  font-family: var(--display-font);
  font-weight: 400;
  font-size: 54px;
  letter-spacing: 0.02em;
  line-height: 0.9;
  color: var(--text);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.6);
}
.logo h1 span { color: var(--accent); }
.tagline {
  color: var(--text-dim); font-size: 14px;
  font-family: var(--display-font);
  letter-spacing: 0.05em;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
}
.card h3 {
  font-family: var(--display-font);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.count {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim); font-weight: 600;
}

.big-card { min-height: 200px; display: flex; flex-direction: column; justify-content: center; }

/* Fields & inputs */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 8px; font-weight: 500; }
input[type="text"], textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
input[type="text"]:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(212, 168, 75, 0.06);
}
textarea { min-height: 80px; resize: vertical; margin-bottom: 10px; }
#room-code { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 700; text-align: center; font-size: 22px; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn { box-shadow: 0 2px 0 rgba(0,0,0,0.4); }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 0 rgba(0,0,0,0.5); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.3); }
.btn.primary {
  background: var(--accent); color: var(--bg); border-color: var(--accent);
  font-weight: 700;
}
.btn.primary:hover:not(:disabled) { background: #d4ff5c; }
.btn.danger { background: var(--accent-2); color: white; border-color: var(--accent-2); font-weight: 700; }
.btn.danger:hover:not(:disabled) { background: #ff75ad; }
.btn.ghost { background: transparent; border-color: var(--border-strong); }
.btn.big { padding: 18px; font-size: 16px; }
.btn.small { padding: 8px 14px; font-size: 13px; width: auto; }
.btn .arrow { transition: transform 0.2s; }
.btn:hover .arrow { transform: translateX(4px); }

.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }

/* Divider */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; margin: 18px 0;
  text-transform: uppercase; letter-spacing: 0.15em;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Lobby */
.lobby-head { display: flex; align-items: flex-start; justify-content: space-between; margin: 24px 0 20px; }
.lobby-head .muted { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 4px; }
.code-display {
  font-family: var(--display-font);
  font-size: 48px; font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent);
  line-height: 1;
}

/* Collapsible "Joining a friend's room?" expander on the home page.
   Keeps the host's view clean while still giving manual-code-entry an escape hatch. */
.join-details { margin-top: 16px; border-top: 1px dashed var(--border); padding-top: 14px; }
.join-details summary {
  cursor: pointer; color: var(--text-muted);
  font-size: 13px; padding: 6px 0;
  list-style: none;
}
.join-details summary::-webkit-details-marker { display: none; }
.join-details summary::before { content: '▸ '; color: var(--accent); }
.join-details[open] summary::before { content: '▾ '; }

/* Joiner-specific lobby header — visually distinct from the host view.
   Joiners see the host's avatar + name instead of a big room code,
   plus a calmer emerald accent so the two devices feel different. */
.lobby-head-joiner { max-width: 75%; }
.joiner-room-title {
  font-family: var(--display-font);
  font-size: 22px; font-weight: 700;
  color: var(--accent-2, #4ade80);
  line-height: 1.2;
  display: flex; align-items: center; gap: 10px;
  margin: 2px 0 6px;
}
.joiner-host-avatar {
  font-size: 32px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
body.is-joiner .lobby-head { border-left: 3px solid var(--accent-2, #4ade80); padding-left: 12px; }
body.is-joiner .guest-msg {
  border: 1px solid var(--accent-2, #4ade80);
  background: linear-gradient(180deg, rgba(74,222,128,0.08), transparent);
}

.players { list-style: none; }
.players li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.players li:last-child { border-bottom: none; }
.player-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
}
.player-name { flex: 1; font-weight: 500; }
.host-badge {
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  background: var(--accent); color: var(--bg); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* Game cards grid */
.games { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.game-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all 0.2s;
  color: var(--text); font-family: inherit;
}
.game-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.game-card.selected {
  border-color: var(--accent);
  background: rgba(212, 168, 75, 0.1);
  box-shadow: 0 0 0 1px var(--accent);
}
.game-emoji { font-size: 28px; }
.game-icon {
  width: 40px; height: 40px;
  background-size: contain; background-repeat: no-repeat; background-position: center;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.4));
}
.px-book {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='1' y='1' width='8' height='8' fill='%23b91c2b'/><rect x='1' y='1' width='8' height='1' fill='%23d4a84b'/><rect x='1' y='8' width='8' height='1' fill='%236b1019'/><rect x='4' y='1' width='1' height='8' fill='%23d4a84b'/><rect x='2' y='3' width='2' height='1' fill='%23f5e8c8'/><rect x='2' y='5' width='2' height='1' fill='%23f5e8c8'/><rect x='6' y='3' width='2' height='1' fill='%23f5e8c8'/><rect x='6' y='5' width='2' height='1' fill='%23f5e8c8'/></svg>");
}
.px-mask {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='2' y='2' width='6' height='1' fill='%23d4a84b'/><rect x='1' y='3' width='8' height='3' fill='%23d4a84b'/><rect x='2' y='6' width='6' height='1' fill='%23d4a84b'/><rect x='3' y='7' width='4' height='1' fill='%23b8902f'/><rect x='2' y='4' width='2' height='1' fill='%230d0a08'/><rect x='6' y='4' width='2' height='1' fill='%230d0a08'/><rect x='4' y='4' width='2' height='1' fill='%23b91c2b'/></svg>");
}
.px-scroll {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='1' y='1' width='8' height='1' fill='%23a07a22'/><rect x='1' y='2' width='8' height='6' fill='%23f5e8c8'/><rect x='1' y='8' width='8' height='1' fill='%23a07a22'/><rect x='2' y='4' width='6' height='1' fill='%23b91c2b'/><rect x='2' y='6' width='4' height='1' fill='%230e8a5f'/></svg>");
}
.px-flame {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='4' y='1' width='2' height='1' fill='%23f5e8c8'/><rect x='3' y='2' width='4' height='1' fill='%23d4a84b'/><rect x='3' y='3' width='1' height='1' fill='%23b91c2b'/><rect x='4' y='3' width='2' height='2' fill='%23d4a84b'/><rect x='6' y='3' width='1' height='1' fill='%23b91c2b'/><rect x='2' y='4' width='1' height='3' fill='%23b91c2b'/><rect x='3' y='5' width='4' height='3' fill='%23b91c2b'/><rect x='7' y='4' width='1' height='3' fill='%23b91c2b'/><rect x='3' y='8' width='4' height='1' fill='%236b1019'/></svg>");
}
.px-brush {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='1' y='1' width='2' height='2' fill='%230e8a5f'/><rect x='2' y='2' width='2' height='2' fill='%230e8a5f'/><rect x='3' y='3' width='2' height='2' fill='%23a07a22'/><rect x='4' y='4' width='3' height='2' fill='%23d4a84b'/><rect x='5' y='5' width='3' height='2' fill='%23d4a84b'/><rect x='6' y='6' width='2' height='2' fill='%23f5e8c8'/></svg>");
}
.px-crown {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='1' y='3' width='1' height='4' fill='%23d4a84b'/><rect x='8' y='3' width='1' height='4' fill='%23d4a84b'/><rect x='4' y='2' width='2' height='5' fill='%23d4a84b'/><rect x='2' y='5' width='6' height='2' fill='%23d4a84b'/><rect x='2' y='7' width='6' height='1' fill='%23b8902f'/><rect x='1' y='2' width='1' height='1' fill='%23b91c2b'/><rect x='8' y='2' width='1' height='1' fill='%23b91c2b'/><rect x='4' y='1' width='2' height='1' fill='%230e8a5f'/></svg>");
}
.px-spy {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='2' y='1' width='6' height='1' fill='%230d0a08'/><rect x='1' y='2' width='8' height='2' fill='%230d0a08'/><rect x='2' y='4' width='2' height='1' fill='%23f5e8c8'/><rect x='6' y='4' width='2' height='1' fill='%23f5e8c8'/><rect x='3' y='5' width='4' height='2' fill='%23b91c2b'/><rect x='2' y='7' width='6' height='2' fill='%23d4a84b'/></svg>");
}
.px-board {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='1' y='1' width='8' height='8' fill='%230e8a5f'/><rect x='1' y='1' width='8' height='1' fill='%23d4a84b'/><rect x='3' y='3' width='1' height='1' fill='%23d4a84b'/><rect x='5' y='3' width='1' height='1' fill='%23d4a84b'/><rect x='7' y='3' width='1' height='1' fill='%23d4a84b'/><rect x='3' y='5' width='1' height='1' fill='%23d4a84b'/><rect x='5' y='5' width='1' height='1' fill='%23d4a84b'/><rect x='7' y='5' width='1' height='1' fill='%23d4a84b'/><rect x='3' y='7' width='1' height='1' fill='%23d4a84b'/><rect x='5' y='7' width='1' height='1' fill='%23d4a84b'/><rect x='7' y='7' width='1' height='1' fill='%23d4a84b'/></svg>");
}
.px-gem {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'><rect x='2' y='2' width='6' height='1' fill='%23d4a84b'/><rect x='1' y='3' width='8' height='1' fill='%230e8a5f'/><rect x='2' y='4' width='6' height='1' fill='%230e8a5f'/><rect x='3' y='5' width='4' height='1' fill='%230e8a5f'/><rect x='4' y='6' width='2' height='1' fill='%230a6647'/><rect x='3' y='3' width='1' height='1' fill='%23f5e8c8'/></svg>");
}
.game-name { font-weight: 700; font-size: 14px; }
.game-desc { font-size: 11px; color: var(--text-muted); text-align: center; }

/* Mode toggle */
.mode-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 14px; color: var(--text-dim); }
.toggle { display: flex; background: var(--bg-2); border-radius: 999px; padding: 3px; gap: 2px; }
.toggle-btn {
  background: transparent; border: none; color: var(--text-dim);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; transition: all 0.2s;
}
.toggle-btn.active { background: var(--surface-2); color: var(--text); }

/* Custom details */
.custom-details { margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.custom-details summary { cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-dim); }
.custom-details[open] summary { margin-bottom: 12px; color: var(--text); }
.custom-details textarea { margin-top: 8px; }

/* Guest waiting */
.guest-msg { text-align: center; padding: 30px 22px; color: var(--text-dim); }

/* Game screens */
.game-head { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 18px; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-dim);
}
.pill.timer { color: var(--accent); font-variant-numeric: tabular-nums; }

.question {
  font-family: var(--display-font);
  font-size: 22px; font-weight: 700; line-height: 1.3;
  text-align: center; margin-bottom: 20px;
}
.center { text-align: center; }
.muted { color: var(--text-dim); }
.muted.small { font-size: 13px; margin-top: 8px; }

.options { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--text); font-family: inherit; font-size: 15px; font-weight: 500;
  text-align: left; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 12px;
}
.option-btn:hover:not(:disabled) { border-color: var(--border-strong); }
.option-btn.selected { border-color: var(--accent); background: rgba(212, 168, 75, 0.1); }
.option-btn.correct { border-color: #4ade80; background: rgba(74, 222, 128, 0.1); }
.option-btn.incorrect { border-color: var(--danger); background: rgba(185, 28, 43, 0.15); }
.option-btn:disabled { cursor: default; }
.option-letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}

/* Big prompt */
.big-prompt {
  font-family: var(--display-font);
  font-size: 28px; font-weight: 700; line-height: 1.2;
  text-align: center; margin: 16px 0; color: var(--text);
}

/* WYR */
.wyr-options { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.wyr-option {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 22px 18px 22px 60px;
  color: var(--text); font-family: inherit; font-size: 16px; font-weight: 500;
  text-align: left; cursor: pointer; transition: all 0.2s; line-height: 1.4;
}
.wyr-option:hover:not(:disabled) { transform: translateY(-2px); }
.wyr-option:disabled { cursor: default; }
.wyr-option.selected { border-color: var(--accent); background: rgba(212, 168, 75, 0.1); }
.wyr-letter {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  font-family: var(--display-font);
}
.wyr-option[data-choice="a"] .wyr-letter { background: var(--accent-3); color: white; }
.wyr-option[data-choice="b"] .wyr-letter { background: var(--accent-2); color: white; }
.wyr-or {
  text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.3em;
}

.vote-bar {
  display: flex; height: 50px; border-radius: var(--radius-sm); overflow: hidden;
  margin: 16px 0; background: var(--bg-2);
}
.vote-a, .vote-b {
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; transition: flex 0.6s ease-out;
  font-size: 14px;
}
.vote-a { background: var(--accent-3); }
.vote-b { background: var(--accent-2); }

/* Results lists */
.results-list, .final-list { list-style: none; }
.results-list li, .final-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.results-list li:last-child, .final-list li:last-child { border-bottom: none; }
.points { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.points.zero { color: var(--text-muted); }

.final-list li {
  padding: 14px 0;
  font-size: 17px;
}
.final-list .rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-2); font-weight: 700; margin-right: 12px;
  font-family: var(--display-font);
}
.final-list li:first-child .rank { background: var(--accent); color: var(--bg); }
.final-list li:nth-child(2) .rank { background: #c5c5d8; color: var(--bg); }
.final-list li:nth-child(3) .rank { background: #c08a5a; color: var(--bg); }
.final-list li:first-child .player-name { font-weight: 700; }
.final-list .score-big { font-family: var(--display-font); font-weight: 700; font-size: 22px; color: var(--accent); }

.final-title {
  font-family: var(--display-font);
  font-size: 36px; font-weight: 800;
  letter-spacing: -0.03em; text-align: center;
}

.reveal-line { margin-bottom: 14px; color: var(--text-dim); }
.reveal-line strong { color: var(--text); }

.foot { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 28px; }

/* Toast */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--border-strong);
  padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  z-index: 100;
  animation: toastIn 0.3s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Quiz Show editor */
.quiz-config {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.quiz-editor-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 4px;
}
#quiz-csv-text {
  width: 100%; min-height: 130px; resize: vertical;
  font-family: monospace; font-size: 12px;
  margin-top: 6px;
}
.csv-actions { display: flex; gap: 8px; margin-top: 8px; }
#csv-error { color: var(--ruby, #ff4d6d); min-height: 16px; }
.qs-round-badge {
  display: inline-block;
  background: var(--accent);
  color: #000;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--display-font);
  font-size: 13px;
  margin-left: 8px;
}
.quiz-editor-actions-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px;
}
.qe-cat {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.qe-cat > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-family: var(--display-font);
  font-size: 16px;
  color: var(--accent);
  background: rgba(0,0,0,0.2);
}
.qe-cat > summary::-webkit-details-marker { display: none; }
.qe-cat[open] > summary { border-bottom: 1px solid var(--border); }
.qe-cat-body { padding: 12px 14px; }
.qe-cat-name {
  width: 100%; margin-bottom: 12px;
}
.qe-q {
  border-top: 1px dashed var(--border);
  padding: 10px 0;
}
.qe-q:first-of-type { border-top: none; padding-top: 4px; }
.qe-q-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.qe-q-value {
  font-family: var(--display-font);
  color: var(--gold, #f5c443);
  font-size: 15px;
}
.qe-q-text {
  width: 100%; margin-bottom: 8px;
  min-height: 44px; resize: vertical;
}
.qe-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.qe-opt {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.25);
  padding: 6px 8px;
  border-radius: 8px;
}
.qe-opt input[type="text"] {
  flex: 1; background: transparent; border: none; color: var(--text);
  font-size: 13px; padding: 4px;
}
.qe-opt input[type="radio"] { flex-shrink: 0; }
.qe-opt.correct { background: rgba(60, 180, 90, 0.18); }
.quiz-editor-footer {
  display: flex; gap: 10px; align-items: center;
  position: sticky; bottom: 0;
}
@media (max-width: 480px) {
  .qe-options { grid-template-columns: 1fr; }
}

/* Make-host button */
.btn.xs {
  font-size: 11px; padding: 4px 9px;
  border-radius: 999px;
}
.make-host-btn {
  margin-left: auto;
}

/* How To Play card */
.howto-card {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.howto-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.howto-icon {
  width: 36px; height: 36px;
  flex-shrink: 0;
}
.howto-head h4 {
  font-family: var(--display-font);
  font-size: 15px; margin: 0;
  color: var(--accent);
}
.howto-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.howto-list li {
  position: relative;
  padding-left: 22px;
  font-size: 13.5px; line-height: 1.45;
  color: var(--text);
}
.howto-list li::before {
  content: '▸';
  position: absolute; left: 4px; top: 0;
  color: var(--accent);
  font-weight: 700;
}

/* Live Chat */
.chat-fab {
  position: fixed;
  bottom: 28px; right: 20px;
  z-index: 200;
}
.chat-fab-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-3);
  border: none; font-size: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(185, 28, 43, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.chat-fab-btn:hover { transform: scale(1.1); }
.chat-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--accent-2); color: white;
  font-size: 10px; font-weight: 800;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.chat-panel {
  position: fixed;
  bottom: 90px; right: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: 480px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  z-index: 200;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: fadeUp 0.2s ease-out;
}
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.chat-title {
  font-family: var(--display-font);
  font-weight: 700; font-size: 15px;
}
.chat-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; padding: 4px;
  transition: color 0.2s;
}
.chat-close:hover { color: var(--text); }

.chat-feed {
  flex: 1; overflow-y: auto;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 120px;
}
.chat-msg {
  display: flex; gap: 8px; align-items: flex-start;
  animation: fadeUp 0.2s ease-out;
}
.chat-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.chat-bubble {
  background: var(--surface-2);
  border-radius: 0 10px 10px 10px;
  padding: 7px 11px;
  max-width: 80%;
}
.chat-bubble .chat-name {
  font-size: 11px; font-weight: 700;
  color: var(--accent); margin-bottom: 2px;
}
.chat-bubble .chat-text {
  font-size: 14px; line-height: 1.4; color: var(--text);
  word-break: break-word;
}
.chat-msg.is-me { flex-direction: row-reverse; }
.chat-msg.is-me .chat-bubble {
  border-radius: 10px 0 10px 10px;
  background: rgba(14, 138, 95, 0.18);
  border: 1px solid rgba(14, 138, 95, 0.32);
}
.chat-msg.is-me .chat-name { color: var(--accent-3); }
.chat-msg.is-reaction .chat-bubble {
  background: none; border: none; padding: 0;
  font-size: 26px; line-height: 1;
}
.chat-empty {
  text-align: center; color: var(--text-muted);
  font-size: 13px; margin: auto; padding: 20px 0;
}

.chat-reactions {
  display: flex; gap: 6px; padding: 8px 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.react-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 10px;
  font-size: 18px; cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.react-btn:hover { transform: scale(1.2); background: var(--surface-2); }

.chat-input-row {
  display: flex; gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
}
.chat-input-row input { flex: 1; margin: 0; padding: 10px 14px; font-size: 14px; }
.chat-input-row .btn { flex-shrink: 0; width: auto; }

/* QR Code card */
.qr-card h3 { justify-content: flex-start; }
.qr-wrap {
  display: flex; justify-content: center;
  margin: 16px 0 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.qr-wrap img { width: 180px; height: 180px; display: block; border-radius: 10px; }

/* Draw & Guess */
.draw-word-card { padding: 16px 22px; margin-bottom: 12px; }
.draw-canvas-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #11112a;
  margin-bottom: 12px;
  touch-action: none;
  position: relative;
}
.draw-canvas-wrap canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
}
.draw-canvas-wrap.readonly canvas { cursor: default; }

.draw-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.color-swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer; transition: transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: white; transform: scale(1.2); }
.swatch.eraser {
  background: var(--bg-2) !important;
  border-color: var(--border-strong);
  color: var(--text-dim);
}
.swatch.eraser.active { border-color: var(--accent); color: var(--accent); }

.size-btns { display: flex; gap: 6px; margin-left: auto; }
.size-btn {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; width: 32px; height: 32px;
  color: var(--text-dim); font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.size-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(196,245,66,0.08); }

.draw-hint-card { padding: 16px 22px; margin-bottom: 12px; }
.draw-blanks {
  font-family: var(--display-font);
  font-size: 26px; font-weight: 700; letter-spacing: 0.15em;
  text-align: center; margin-top: 10px; color: var(--accent);
}

.draw-guess-log {
  max-height: 80px; overflow-y: auto;
  margin-bottom: 10px; padding: 0 4px;
  display: flex; flex-direction: column; gap: 4px;
}
.draw-guess-log .guess-item {
  font-size: 13px; color: var(--text-dim);
  animation: fadeUp 0.25s ease-out;
}
.draw-guess-log .guess-item.correct {
  color: var(--accent); font-weight: 700;
}

.draw-guess-row {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 12px;
}
.draw-guess-row input { flex: 1; margin: 0; }
.draw-guess-row .btn { width: auto; white-space: nowrap; flex-shrink: 0; }

/* Quiz Show board */
.qs-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}
.qs-cat {
  background: var(--accent);
  color: var(--bg);
  padding: 10px 4px;
  text-align: center;
  font-weight: 800;
  font-size: clamp(11px, 2.6vw, 14px);
  line-height: 1.15;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  min-height: 52px;
  display: flex; align-items: center; justify-content: center;
  word-break: break-word; hyphens: auto;
}
.qs-cell {
  background: linear-gradient(180deg, #1a4a3a, #0d2820);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 16px 4px;
  text-align: center;
  font-family: var(--display-font);
  font-size: 24px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  min-height: 56px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}
.qs-cell:hover:not(.qs-done):not(:disabled) {
  background: linear-gradient(180deg, #2a6a4f, #155030);
  transform: translateY(-1px);
}
.qs-cell.qs-done {
  background: var(--bg-2);
  border-color: var(--border);
  color: var(--text-muted);
  cursor: default;
  opacity: 0.3;
}
.qs-cell:disabled:not(.qs-done) { opacity: 0.6; cursor: not-allowed; }
#btn-qs-buzz { margin-top: 14px; font-size: 18px; padding: 18px; }
#btn-qs-buzz:disabled { background: var(--bg-2); border-color: var(--border); color: var(--text-muted); }

/* Quiz Show question text — was using pixel font at 22px which got hard to read.
   Use the readable Inter family at a comfortable size, scale for mobile. */
#qs-q.question {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(18px, 4.5vw, 26px);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: 0;
  padding: 4px 6px;
}
#qs-cat { color: var(--accent); font-weight: 700; }
#qs-val { color: var(--accent); font-weight: 800; }

/* Quiz Show answer options — these buttons had NO CSS, just inherited defaults. */
#qs-options { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
#qs-options .opt {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(15px, 3.8vw, 17px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  min-height: 52px;
  width: 100%;
}
#qs-options .opt:not(:disabled):hover {
  background: var(--surface);
  border-color: var(--border-strong);
}
#qs-options .opt:not(:disabled):active { transform: scale(0.98); }
#qs-options .opt.selected {
  border-color: var(--accent);
  background: rgba(212, 168, 75, 0.15);
}
/* .correct / .incorrect inherit from the universal rules above with !important */

/* Spyfall */
#sf-role-card .big-prompt { color: var(--accent); }
#sf-role-card.is-spy .big-prompt { color: var(--accent-3); }
#sf-locations-list { columns: 2; column-gap: 18px; padding: 6px 0; }
#sf-locations-list li { padding: 4px 0; font-size: 14px; color: var(--text-dim); }
@media (max-width: 420px) {
  #sf-locations-list { columns: 1; }
}

@media (max-width: 480px) {
  .qs-cell { font-size: 18px; padding: 12px 2px; min-height: 44px; }
  /* Was 9px — unreadable. Keep clamp() from base rule but tighten padding. */
  .qs-cat { padding: 8px 2px; letter-spacing: 0; }
}

@media (max-width: 380px) {
  .logo h1 { font-size: 32px; }
  .code-display { font-size: 40px; }
  .big-prompt { font-size: 24px; }
}

/* ========= Light theme ========= */
body[data-theme="light"] {
  --bg: #f5ecd6;
  --bg-2: #ece1c4;
  --surface: rgba(120, 80, 20, 0.06);
  --surface-2: rgba(120, 80, 20, 0.12);
  --border: rgba(120, 80, 20, 0.20);
  --border-strong: rgba(120, 80, 20, 0.40);
  --text: #2a1d0a;
  --text-dim: #5c4523;
  --text-muted: #8a7350;
  --accent: #a37615;
  --accent-2: #0a6647;
  --accent-3: #8a1320;
}
body[data-theme="light"] .bg-glow,
body[data-theme="light"] .bg-stars,
body[data-theme="light"] .bg-grain { opacity: 0.25; mix-blend-mode: multiply; }
body[data-theme="light"] .draw-canvas-wrap { background: #fdf6e3; }
body[data-theme="light"] .bingo-cell {
  background: rgba(120, 80, 20, 0.06);
  border-color: rgba(120, 80, 20, 0.18);
  color: var(--text);
}
body[data-theme="light"] .bingo-cell.marked,
body[data-theme="light"] .bingo-cell.free { color: var(--bg); }
body[data-theme="light"] .bingo-cell.winning { color: white; }
body[data-theme="light"] .swatch.eraser { background: var(--bg-2) !important; }
body[data-theme="light"] .chat-bubble { background: var(--surface-2); color: var(--text); }
body[data-theme="light"] .toast { color: var(--text); }
body[data-theme="light"] .qs-cell {
  background: linear-gradient(180deg, #e8d39a, #c6a25a);
  color: #2a1d0a;
  text-shadow: none;
}
body[data-theme="light"] .qs-cell:hover:not(.qs-done):not(:disabled) {
  background: linear-gradient(180deg, #f0dba8, #d6b06a);
}

/* ========= Theme toggle button ========= */
.theme-toggle {
  position: fixed; top: 14px; right: 14px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 18px; cursor: pointer;
  z-index: 250; display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.theme-toggle:hover { transform: scale(1.08); background: var(--surface-2); }

/* ========= Floating leave button (game screens) ========= */
.floating-leave {
  position: fixed; top: 14px; left: 14px;
  background: var(--bg-2); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 12px; font-family: inherit;
  padding: 7px 12px; border-radius: 999px;
  cursor: pointer; z-index: 250;
  transition: background 0.15s;
}
.floating-leave:hover { background: var(--accent-3); color: white; border-color: var(--accent-3); }

/* ========= Lobby tabs ========= */
.lobby-tabs {
  display: flex; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--border);
  padding: 4px; border-radius: var(--radius);
  margin-bottom: 14px;
}
.lobby-tab {
  flex: 1; background: transparent; border: none;
  color: var(--text-dim); font-family: inherit;
  padding: 10px 8px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.lobby-tab.active {
  background: var(--accent); color: var(--bg);
}
.lobby-tab:not(.active):hover { background: var(--surface-2); color: var(--text); }

/* ========= Trivia category chips ========= */
.trivia-cats {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.cat-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.cat-chip {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-dim); font-family: inherit;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.cat-chip.active {
  background: var(--accent); color: var(--bg);
  border-color: var(--accent);
}

/* ========= QR Fullscreen / TV mode ========= */
.qr-tv-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  padding: clamp(12px, 2vmin, 32px);
  overflow: hidden;
}
.qr-tv-screen[hidden] { display: none !important; }
.qr-tv-close {
  position: absolute; top: 16px; left: 16px;
  z-index: 310;
}
.qr-tv-inner {
  text-align: center;
  width: 100%;
  max-width: min(96vw, 1600px);
  max-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(8px, 1.5vmin, 20px);
}
.qr-tv-label {
  text-transform: uppercase; letter-spacing: 0.3em;
  color: var(--text-muted);
  font-size: clamp(12px, 1.6vmin, 20px);
  margin: 0;
}
.qr-tv-code {
  font-family: var(--display-font);
  /* Cap by viewport height so landscape TVs don't get a code taller than the screen */
  font-size: clamp(64px, 14vmin, 180px);
  color: var(--accent);
  letter-spacing: 0.1em;
  line-height: 1;
  margin: 0;
  text-shadow: 0 4px 0 rgba(0,0,0,0.4);
}
.qr-tv-img-wrap {
  display: inline-block;
  background: white; padding: clamp(8px, 1.2vmin, 16px);
  border-radius: 12px;
  margin: 0;
  /* Take remaining vertical space so the QR is as large as possible without clipping */
  flex: 1 1 auto;
  min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.qr-tv-img-wrap img {
  display: block;
  width: auto; height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}
.qr-tv-hint {
  color: var(--text-dim);
  font-size: clamp(14px, 1.8vmin, 22px);
  margin: 0;
}
.qr-tv-count {
  color: var(--accent);
  font-size: clamp(16px, 2vmin, 26px);
  font-weight: 700;
  font-family: var(--display-font);
  margin: 0;
}

/* Landscape TVs/monitors: split layout so the QR can be huge without pushing text off-screen */
@media (orientation: landscape) and (min-width: 900px) {
  .qr-tv-inner {
    flex-direction: row;
    gap: clamp(24px, 4vmin, 80px);
    text-align: left;
  }
  .qr-tv-inner > .qr-tv-text {
    display: flex; flex-direction: column;
    justify-content: center; gap: clamp(8px, 1.5vmin, 20px);
    flex: 0 1 auto;
  }
  .qr-tv-img-wrap {
    flex: 0 1 auto;
    height: min(86vh, 720px);
    width: min(86vh, 720px);
  }
  .qr-tv-img-wrap img { height: 100%; width: 100%; }
  .qr-tv-code { font-size: clamp(72px, 12vmin, 200px); }
}

/* ===== Mafia ===== */
#mf-role-card { border-color: var(--ruby, #e94560); }
#mf-role-text { letter-spacing: 2px; }
#mf-mates { color: var(--ruby, #e94560); font-weight: 700; }
#mf-status { color: var(--text-dim); font-style: italic; margin-top: 8px; }
#mf-action { border-color: var(--gold, #f4c542); }
#mf-action-result { font-size: 18px; margin-top: 12px; padding: 10px; background: rgba(0,0,0,.2); border-radius: 8px; }
body.light-theme #mf-action-result { background: rgba(0,0,0,.05); }
#mf-vote .btn.pick.selected,
#mf-action .btn.pick.selected { background: var(--gold, #f4c542); color: #000; border-color: var(--gold, #f4c542); }
#mf-reveal-title { margin: 4px 0 8px; }
#mf-log { max-height: 180px; overflow-y: auto; }
#mf-winner-text { color: var(--accent, #f4c542); margin: 8px 0 16px; }
#mf-reveal-all li { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px dashed var(--border, #333); }

/* ===== QoL additions: sounds, avatars, settings, ticker, spectator ===== */
.sound-toggle {
  position: fixed; top: 12px; right: 60px; z-index: 100;
  background: var(--surface, #1a1a2e); color: var(--text, #e0e0e0);
  border: 2px solid var(--border, #333); border-radius: 50%;
  width: 40px; height: 40px; cursor: pointer;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.sound-toggle:hover { transform: scale(1.08); background: var(--surface-2); }

.avatar-picker {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  margin-top: 8px;
}
.avatar-opt {
  background: var(--surface-2, #16213e); border: 2px solid transparent;
  border-radius: 8px; cursor: pointer; padding: 6px;
  font-size: 22px; line-height: 1; transition: transform .12s, border-color .12s;
  aspect-ratio: 1 / 1;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.avatar-opt:hover { transform: scale(1.1); }
.avatar-opt.active { border-color: var(--accent, #f4c542); background: var(--surface, #1a1a2e); }
.avatar-opt.has-img { padding: 0; }
.avatar-opt .avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; }
.avatar-opt.avatar-upload {
  font-size: 22px; color: var(--accent, #f4c542); font-weight: 700;
  border-style: dashed; border-color: var(--accent, #f4c542); opacity: 0.85;
}
.avatar-opt.avatar-upload:hover { opacity: 1; }
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent, #f4c542); text-decoration: underline;
  font: inherit;
}
.link-btn:hover { opacity: 0.8; }

/* ===== Round transitions & screen entrance ===== */
@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.screen:not([hidden]) { animation: screenFadeIn 0.32s ease-out both; }

/* ===== Winner reveal pulse + confetti ===== */
@keyframes winnerPulse {
  0%   { transform: scale(0.85); opacity: 0; letter-spacing: 0.1em; }
  40%  { transform: scale(1.15); opacity: 1; letter-spacing: 0.04em; }
  70%  { transform: scale(0.96); }
  100% { transform: scale(1); letter-spacing: 0.02em; }
}
.final-title { animation: winnerPulse 1.1s ease-out both; }
@keyframes goldGlow {
  0%, 100% { text-shadow: 0 0 0 rgba(244,197,66,0); }
  50%      { text-shadow: 0 0 18px rgba(244,197,66,0.9), 0 0 36px rgba(244,197,66,0.5); }
}
.final-list li:first-child .score-big,
.final-list li:first-child .player-name { animation: goldGlow 1.6s ease-in-out infinite; color: var(--accent, #f4c542); }

.confetti-layer {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 9999;
}
.confetti-piece {
  position: absolute; top: -20px; width: 10px; height: 14px; opacity: 0.92;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(720deg); }
}

/* ===== Floating help (?) button ===== */
.help-fab {
  position: fixed; right: 16px; bottom: 84px; z-index: 1000;
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--accent, #f4c542);
  background: var(--surface, #1a1a2e); color: var(--accent, #f4c542);
  font-size: 22px; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.help-fab:hover { transform: scale(1.08); }
.help-fab:active { transform: scale(0.95); }

/* ===== Modal (used for How-to-play) ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: screenFadeIn 0.2s ease-out;
}
.modal-card {
  background: var(--surface, #1a1a2e); border: 2px solid var(--accent, #f4c542);
  border-radius: 14px; padding: 18px; max-width: 480px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.modal-head h3 { margin: 0 0 2px 0; }
.modal-head > div { flex: 1; }
.modal-close {
  background: none; border: none; color: var(--text, #fff); font-size: 22px;
  cursor: pointer; padding: 0 6px; line-height: 1;
}
.modal-close:hover { opacity: 0.7; }

/* ===== Last-night card on home ===== */
.lastnight-card { padding: 14px; }
.lastnight-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lastnight-head > div { flex: 1; }
.lastnight-head h4 { margin: 0; font-size: 14px; }
.lastnight-icon { font-size: 22px; }
.lastnight-list { list-style: none; padding: 0; margin: 0; }
.lastnight-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 13px; border-bottom: 1px dashed rgba(255,255,255,0.08);
}
.lastnight-list li:last-child { border-bottom: none; }
.lastnight-list .crown { color: var(--accent, #f4c542); margin-right: 4px; }

/* ===== Recent rooms card on home ===== */
.recent-rooms-card { padding: 14px; }
.recent-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.recent-head > div { flex: 1; }
.recent-head h4 { margin: 0; font-size: 14px; }
.recent-head p { margin: 2px 0 0; }
.recent-icon { font-size: 22px; }
.recent-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.recent-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; font-size: 13px;
  background: rgba(255,255,255,0.04); border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.recent-list .recent-meta { display: flex; flex-direction: column; gap: 2px; }
.recent-list .recent-code { font-weight: 700; letter-spacing: 0.08em; color: var(--accent, #f4c542); }
.recent-list .recent-when { font-size: 11px; opacity: 0.65; }
.recent-list .btn-rejoin {
  background: var(--accent, #f4c542); color: #1a1a2e; border: none;
  padding: 6px 12px; border-radius: 6px; font-weight: 700; cursor: pointer;
  font-size: 12px;
}
.recent-list .btn-rejoin:hover { filter: brightness(1.1); }

/* ===== First-time host tour ===== */
.tour-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: transparent;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; pointer-events: none;
  animation: screenFadeIn 0.25s ease-out;
}
.tour-card {
  background: var(--surface, #1a1a2e); border: 2px solid var(--accent, #f4c542);
  border-radius: 14px; padding: 16px 18px; max-width: 420px; width: 100%;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
  pointer-events: auto;
  margin-bottom: 24px;
}
.tour-card h3 { margin: 4px 0 8px; font-size: 17px; }
.tour-card .tour-step { margin: 0; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.tour-card .tour-body { margin: 0 0 14px; font-size: 14px; line-height: 1.5; }
.tour-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tour-highlight {
  position: relative; z-index: 3001;
  outline: 3px solid var(--accent, #f4c542);
  outline-offset: 4px;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 24px rgba(244,197,66,0.6);
  animation: tourPulse 1.6s ease-in-out infinite;
}
@keyframes tourPulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 24px rgba(244,197,66,0.55); }
  50%      { box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 36px rgba(244,197,66,0.95); }
}

/* Image avatars inside any .player-avatar slot fill the circle perfectly */
.player-avatar { overflow: hidden; }
.player-avatar .avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Inline avatars next to a name (history rows, player lists) */
.avatar-inline { display: inline-flex; align-items: center; justify-content: center;
  width: 1.2em; height: 1.2em; vertical-align: -0.2em; overflow: hidden; border-radius: 50%; }
.avatar-inline .avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 480px) {
  .avatar-picker { grid-template-columns: repeat(8, 1fr); }
  .avatar-opt { font-size: 18px; padding: 4px; }
}

.player-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
}
.player-avatar.small-avatar { font-size: 18px; width: auto; height: auto; }

.game-settings {
  margin-top: 10px; padding: 10px;
  background: var(--surface-2, rgba(0,0,0,.15));
  border-radius: 8px;
}
.game-settings .mode-row { margin: 0; }
.toggle-btn.setting-btn.active {
  background: var(--accent, #f4c542); color: #000; border-color: var(--accent, #f4c542);
}

.tip-ticker {
  margin-top: 8px;
  font-style: italic; font-size: 14px;
  color: var(--text-dim, #aaa);
  transition: opacity .25s ease;
  min-height: 20px;
}

.spectator-msg {
  border-color: var(--accent-2, #5cb8b2);
  background: rgba(92, 184, 178, 0.06);
}

.final-list.party-totals { margin-top: 12px; }
#party-total-label { margin-top: 6px; opacity: .85; }
.muted.small.center { text-align: center; }

.btn.ghost.small { font-size: 13px; padding: 8px 12px; margin-top: 4px; }

/* ===== Quiz pack share/import panel ===== */
#quiz-pack-panel .pack-share-row,
#quiz-pack-panel .pack-import-row { display: flex; gap: 8px; margin-top: 8px; }
#quiz-pack-panel input[type="text"] { flex: 1; }
.pack-code-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.pack-code {
  font-family: 'VT323', monospace; font-size: 1.6rem;
  background: rgba(212, 168, 75, 0.12); color: var(--gold, #d4a84b);
  padding: 6px 14px; border-radius: 6px; letter-spacing: 2px;
  border: 1px dashed rgba(212, 168, 75, 0.4);
}
#quiz-pack-error:not(:empty) { color: var(--ruby, #c44); margin-top: 6px; }

/* ===== Pack library list ===== */
.pack-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.pack-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px; text-align: left;
  background: rgba(212, 168, 75, 0.06); border: 1px solid rgba(212, 168, 75, 0.25);
  border-radius: 6px; cursor: pointer; color: inherit; font: inherit;
  transition: background 120ms, transform 80ms;
}
.pack-row:hover { background: rgba(212, 168, 75, 0.14); }
.pack-row:active { transform: scale(0.99); }
.pack-row.featured { border-color: rgba(212, 168, 75, 0.55); }
.pack-row-name { font-weight: 600; }
.pack-row-meta { color: var(--muted, #998); font-size: 0.85em; }
.pack-row-meta code { background: rgba(212, 168, 75, 0.12); padding: 0 4px; border-radius: 3px; }

/* ===== Home intro + lobby invite button ===== */
.hero .intro {
  margin: 6px auto 0; max-width: 30em; line-height: 1.45;
  color: var(--muted, #998);
}
.invite-btn {
  margin-top: 8px;
  display: inline-flex; align-items: center; gap: 6px;
}
.invite-btn:hover { background: rgba(212, 168, 75, 0.15); }

/* ===== Host approval flow ===== */
.pending-card { border: 1px solid rgba(212, 168, 75, 0.55); background: rgba(212, 168, 75, 0.08); }
.pending-card h3 { color: #d4a84b; }
.pending-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed rgba(255,255,255,0.08); }
.pending-list li:last-child { border-bottom: 0; }
.pending-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.btn.xs { padding: 4px 10px; font-size: 0.85em; }
.waiting-card { max-width: 26em; margin: 14vh auto 0; text-align: center; padding: 28px 22px; }
.waiting-spinner { font-size: 48px; animation: waitspin 2s ease-in-out infinite; display: inline-block; }
@keyframes waitspin { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.waiting-card h2 { margin: 12px 0 6px; }
.waiting-you { display: inline-flex; align-items: center; gap: 8px; margin: 18px 0; padding: 8px 14px; background: rgba(255,255,255,0.04); border-radius: 999px; }
.waiting-you .player-avatar { font-size: 24px; }
.waiting-card .btn { margin-top: 10px; }

/* ===== Truth or Dare: actor + history ===== */
.tod-actor-line { font-size: 0.95em; margin-bottom: 6px; }
.tod-history-card { margin-top: 14px; }
.tod-history-card h4 { margin: 0 0 8px; color: var(--text-muted); font-size: 0.9em; text-transform: uppercase; letter-spacing: 1px; }
.tod-history { list-style: none; padding: 0; margin: 0; max-height: 280px; overflow-y: auto; }
.tod-history li { padding: 8px 0; border-bottom: 1px dashed var(--border); color: var(--text); }
.tod-history li:last-child { border-bottom: 0; }
.tod-h-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.tod-h-prompt { color: var(--text-dim); font-size: 0.92em; line-height: 1.35; }

/* ===== Remote-play tip banner (lobby) ===== */
.remote-tip {
  background: linear-gradient(135deg, rgba(212,168,75,0.14), rgba(212,168,75,0.06));
  border: 1px dashed var(--border-strong);
  color: var(--text);
  font-size: 0.92em;
  line-height: 1.4;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.remote-tip b { color: var(--accent); }

/* Remote-tip toggle (always visible in Game setup) */
.remote-tip-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9em; color: var(--text);
}
.remote-tip-toggle .switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.remote-tip-toggle .switch input { opacity: 0; width: 0; height: 0; }
.remote-tip-toggle .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #555; border-radius: 22px; transition: 0.2s;
}
.remote-tip-toggle .slider::before {
  content: ''; position: absolute; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s;
}
.remote-tip-toggle input:checked + .slider { background: var(--accent); }
.remote-tip-toggle input:checked + .slider::before { transform: translateX(16px); }
.remote-tip-toggle #remote-tip-state { margin-left: auto; color: var(--text-muted); }

/* ===== Light-theme corrections for elements that use hardcoded whites ===== */
body[data-theme="light"] .pending-list li,
body[data-theme="light"] .tod-history li { border-bottom-color: var(--border); }
body[data-theme="light"] .waiting-you { background: var(--surface-2); color: var(--text); }
body[data-theme="light"] .btn:hover:not(:disabled) { background: var(--surface-2); }
body[data-theme="light"] .remote-tip-toggle .slider { background: rgba(120,80,20,0.30); }
body[data-theme="light"] .remote-tip-toggle .slider::before { background: #fff8e6; }

/* ============ Bingo & LLL deck pickers ============ */
/* Matches the trivia category chip style — pill buttons that wrap into rows. */
.bingo-deck-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px;
}
.bingo-deck-btn {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text-dim); font-family: inherit;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.bingo-deck-btn:hover { color: var(--text); border-color: var(--border-strong, var(--accent)); }
.bingo-deck-btn.active {
  background: var(--accent); color: var(--bg);
  border-color: var(--accent);
}

/* ============ Two Truths & a Lie ============ */
.ttal-statements { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.ttal-stmt { display: flex; flex-direction: column; gap: 4px; }
.ttal-stmt span { font-size: 0.85rem; opacity: 0.75; }
.ttal-input {
  padding: 10px; border-radius: 8px; border: 2px solid var(--border, #6a4b2c);
  background: var(--input-bg, #1a1410); color: inherit; font-size: 1rem;
}
.ttal-input:disabled { opacity: 0.6; }
.ttal-lie-toggle { display: flex; justify-content: center; gap: 6px; margin: 6px 0; }
.ttal-lie-toggle .toggle-btn { min-width: 60px; }

/* ============ Story Builder ============ */
.story-scroll {
  max-height: 320px; overflow-y: auto;
  padding: 8px; border-radius: 8px;
  background: rgba(0,0,0,0.15);
}
.story-starter { font-style: italic; opacity: 0.9; margin: 4px 0 10px; }
.story-lines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.story-line {
  background: rgba(255,255,255,0.05);
  padding: 8px 10px; border-radius: 6px;
  line-height: 1.45;
}
.story-byline {
  display: inline-block; margin-right: 6px;
  font-weight: 600; font-size: 0.85rem; opacity: 0.85;
}
#story-input {
  width: 100%; min-height: 70px; padding: 10px; margin: 6px 0;
  border-radius: 8px; border: 2px solid var(--border, #6a4b2c);
  background: var(--input-bg, #1a1410); color: inherit;
  font-family: inherit; font-size: 1rem; resize: vertical;
}

/* Light-mode tweaks */
.light .story-scroll { background: rgba(0,0,0,0.05); }
.light .story-line { background: rgba(0,0,0,0.04); }
.light .ttal-input, .light #story-input {
  background: #fff8ec; border-color: #c9a878; color: #2a1d10;
}

/* ============ WORD CHAIN ============ */
#wc-input {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: rgba(255,255,255,0.05);
  color: var(--fg);
  text-align: center;
  text-transform: lowercase;
}
#wc-letter { font-size: 64px; font-weight: bold; color: var(--accent); }
#wc-error { color: var(--accent-3); }

/* ============ LIVE LAUGH LOSE ============ */
#lll-prompt-text {
  font-size: 22px;
  font-style: italic;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  margin-top: 8px;
}
.light #lll-prompt-text { background: rgba(0,0,0,0.04); }

/* ============ CODENAMES ============ */
.cn-teams { display: flex; gap: 12px; }
.cn-team { flex: 1; padding: 8px; border-radius: 8px; }
.cn-team h4 { margin: 0 0 6px; text-align: center; }
.cn-team ul { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.cn-team ul li { padding: 3px 0; }
.cn-team-red { background: rgba(220, 60, 60, 0.15); }
.cn-team-blue { background: rgba(60, 100, 220, 0.15); }
.cn-spy-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--accent); color: var(--bg); margin-left: 4px;
}
.cn-pill-red { background: rgba(220, 60, 60, 0.3); }
.cn-pill-blue { background: rgba(60, 100, 220, 0.3); }

.cn-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.cn-cell {
  aspect-ratio: 1.4 / 1;
  padding: 4px;
  /* Scales with grid width so codename words stay legible on phones */
  font-size: clamp(10px, 2.4vw, 14px);
  font-weight: bold;
  border: 2px solid var(--accent);
  background: #f5e7c5;
  color: #2a1d10;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.1;
  transition: transform 0.1s;
}
@media (max-width: 480px) {
  .cn-board { gap: 3px; }
  .cn-cell { aspect-ratio: 1.2 / 1; padding: 2px; border-width: 1px; }
}
.cn-cell:not(:disabled):hover { transform: scale(1.04); }
.cn-cell:disabled { cursor: default; }
.cn-cell.cn-role-red { background: #d65656; color: #fff; border-color: #8a2020; }
.cn-cell.cn-role-blue { background: #4870d6; color: #fff; border-color: #1f3a8a; }
.cn-cell.cn-role-neutral { background: #d4c5a0; color: #2a1d10; border-color: #8a7340; }
.cn-cell.cn-role-assassin { background: #1a1a1a; color: #d65656; border-color: #d65656; }
.cn-cell.revealed { opacity: 0.55; }
.cn-cell.revealed.cn-role-assassin { opacity: 1; animation: pulse-assassin 0.6s ease-out 3; }
@keyframes pulse-assassin {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 86, 86, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(214, 86, 86, 0); }
}
@media (max-width: 480px) {
  .cn-cell { font-size: 10px; padding: 2px; }
  .cn-teams { flex-direction: column; }
}


/* LLL CSV import row */
.lll-csv-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0 4px;
}
.lll-csv-row label.btn { cursor: pointer; }
#lll-csv-status { margin: 4px 0 0; }
