:root {
  --bg-0: #050011;
  --bg-1: #18002e;
  --magenta: #ff006e;
  --pink: #ff1493;
  --pink-hot: #ff2d92;
  --pink-soft: #ff6bb5;
  --purple: #7c2bff;
  --purple-deep: #3d0f6b;
  --violet: #5e1bc7;
  --fg: #ffe9f5;
  --muted: #c4a8d8;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse 70% 55% at 50% 8%, rgba(124, 43, 255, 0.30), transparent 70%),
    radial-gradient(ellipse 65% 45% at 50% 100%, rgba(255, 0, 110, 0.22), transparent 70%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  background-attachment: fixed;
  color: var(--fg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Drifting orbs (shared with landing) */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  mix-blend-mode: screen;
  will-change: transform;
  z-index: 0;
}
.orb-1 {
  width: 60vmax; height: 60vmax;
  background: radial-gradient(circle, var(--purple) 0%, transparent 70%);
  top: -22vmax; left: -22vmax;
  opacity: 0.55;
  animation: drift-1 22s ease-in-out infinite alternate;
}
.orb-2 {
  width: 55vmax; height: 55vmax;
  background: radial-gradient(circle, var(--magenta) 0%, transparent 70%);
  bottom: -20vmax; right: -20vmax;
  opacity: 0.5;
  animation: drift-2 26s ease-in-out infinite alternate;
}
@keyframes drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(15vw, 8vh) scale(1.18); }
}
@keyframes drift-2 {
  from { transform: translate(0, 0) scale(1.1); }
  to   { transform: translate(-12vw, -6vh) scale(0.9); }
}

/* Page chrome */
.page {
  position: relative;
  z-index: 2;
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0 0 2rem;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-decoration: none;
  background: linear-gradient(110deg, var(--magenta), var(--pink-hot), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 12px rgba(255, 0, 110, 0.35));
}

/* Glass eyebrow chip */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 1rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--pink);
  background: rgba(255, 20, 147, 0.07);
  border: 1px solid rgba(255, 20, 147, 0.28);
  border-radius: 100px;
  backdrop-filter: blur(10px);
}
.eyebrow .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--pink-hot);
  box-shadow: 0 0 12px var(--pink-hot);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

/* Headlines */
h1, h2, h3 { letter-spacing: -0.04em; }
.headline {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(110deg, var(--magenta) 0%, var(--pink-hot) 28%, var(--purple) 62%, var(--magenta) 100%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 18px rgba(255, 0, 110, 0.35));
  animation: gradient-shift 10s ease-in-out infinite;
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* Buttons */
.cta {
  position: relative;
  display: inline-block;
  padding: 1rem 2.5rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  background: linear-gradient(135deg, var(--purple) 0%, var(--magenta) 100%);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(255, 0, 110, 0.35),
    0 0 60px rgba(124, 43, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.cta:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 12px 48px rgba(255, 0, 110, 0.55),
    0 0 100px rgba(124, 43, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.cta:disabled { opacity: 0.4; cursor: not-allowed; }
.cta-ghost {
  background: transparent;
  border: 1px solid var(--glass-border);
  box-shadow: none;
  color: var(--muted);
}
.cta-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  transform: none;
  box-shadow: none;
}

/* Glass card */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 1.25rem;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

/* Inputs */
.input {
  width: 100%;
  padding: 1rem 1.25rem;
  font: inherit;
  font-size: 1.1rem;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  border-color: var(--pink-hot);
  box-shadow: 0 0 0 3px rgba(255, 45, 146, 0.15);
}
.input.large {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.5em;
  padding: 1.25rem 1rem;
}

/* Quiz card grid */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  width: 100%;
  margin-top: 2rem;
}
.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.quiz-card:hover {
  transform: translateY(-2px);
  border-color: var(--pink-hot);
}
.quiz-card .emoji { font-size: 2.5rem; }
.quiz-card .title { font-size: 1.25rem; font-weight: 700; }
.quiz-card .desc { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.quiz-card .meta { color: var(--pink-soft); font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase; }

/* Game code display */
.code-display {
  font-size: clamp(3.5rem, 14vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.3em;
  text-align: center;
  background: linear-gradient(110deg, var(--magenta), var(--pink-hot), var(--purple), var(--magenta));
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 24px rgba(255, 0, 110, 0.4));
  animation: gradient-shift 8s ease-in-out infinite;
  font-variant-numeric: tabular-nums;
}
.code-label {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.join-url {
  text-align: center;
  color: var(--pink-soft);
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.5rem;
  word-break: break-all;
}
.copy-link-btn {
  margin-left: 0.4rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.copy-link-btn:hover {
  background: rgba(255, 45, 146, 0.15);
  border-color: var(--pink-hot);
  transform: translateY(-1px);
}

/* "How to play" disclosure (lobby) */
.how-to-play {
  margin-top: 1.25rem;
  width: 100%;
  max-width: 36rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  padding: 0.4rem 0.85rem;
  backdrop-filter: blur(8px);
}
.how-to-play summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--pink-soft);
  list-style: none;
  padding: 0.35rem 0;
  user-select: none;
}
.how-to-play summary::-webkit-details-marker { display: none; }
.how-to-play summary::after {
  content: " ▾";
  opacity: 0.7;
  transition: transform 0.2s;
  display: inline-block;
}
.how-to-play[open] summary::after { transform: rotate(180deg); }
.how-to-play ul {
  margin: 0.5rem 0 0.6rem 1.25rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.how-to-play li { margin-bottom: 0.3rem; }
.how-to-play strong { color: var(--fg); font-weight: 700; }

/* Player list */
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  width: 100%;
  margin-top: 1.5rem;
}
.player-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  animation: tile-in 0.3s ease;
}
.player-tile img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}
.player-tile .name {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  word-break: break-word;
}
@keyframes tile-in {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* Avatar picker */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  width: 100%;
  margin: 1.5rem 0;
}
.avatar-grid button {
  background: var(--glass);
  border: 2px solid var(--glass-border);
  border-radius: 50%;
  padding: 0.4rem;
  cursor: pointer;
  aspect-ratio: 1;
  transition: transform 0.15s, border-color 0.15s;
}
.avatar-grid button:hover { transform: scale(1.05); }
.avatar-grid button.selected {
  border-color: var(--pink-hot);
  box-shadow: 0 0 20px rgba(255, 45, 146, 0.5);
  transform: scale(1.05);
}
.avatar-grid button img { width: 100%; height: 100%; display: block; }
.avatar-grid button .avatar { width: 100%; height: 100%; display: block; }

/* Question prompt */
.prompt {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 900;
  text-align: center;
  margin: 2rem 0;
  color: var(--fg);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Answer tiles (4-color grid) */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 7rem;
  padding: 1.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  text-align: center;
  border: none;
  border-radius: 1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, opacity 0.2s, filter 0.2s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.tile:hover:not(:disabled) { transform: translateY(-2px); }
.tile:disabled { cursor: default; }
.tile .icon { font-size: 1.5rem; opacity: 0.85; }
.tile-0 { background: linear-gradient(135deg, #ff006e, #ff2d92); }
.tile-1 { background: linear-gradient(135deg, #7c2bff, #5e1bc7); }
.tile-2 { background: linear-gradient(135deg, #ff2d92, #ff6bb5); }
.tile-3 { background: linear-gradient(135deg, #5e1bc7, #3d0f6b); }
.tile.dim { opacity: 0.25; filter: grayscale(0.5); }
.tile.correct {
  outline: 4px solid #fff;
  outline-offset: -4px;
  box-shadow: 0 0 32px rgba(255, 255, 255, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Timer ring */
.timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--glass);
  border: 2px solid var(--pink-hot);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--pink-hot);
  box-shadow: 0 0 20px rgba(255, 45, 146, 0.35);
  font-variant-numeric: tabular-nums;
}
.timer.urgent { color: var(--magenta); border-color: var(--magenta); animation: urgent 0.6s ease-in-out infinite; }
@keyframes urgent {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

/* Tally */
.tally {
  text-align: center;
  font-size: 1.1rem;
  color: var(--muted);
  margin: 1rem 0;
}
.tally strong { color: var(--fg); font-weight: 800; font-size: 1.5rem; }

/* Leaderboard */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}
.leaderboard .row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  transition: transform 0.3s, background 0.3s;
}
.leaderboard .row.you {
  border-color: var(--pink-hot);
  background: rgba(255, 45, 146, 0.1);
}
.leaderboard .rank {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--pink-hot);
  min-width: 2rem;
  text-align: center;
}
.leaderboard .row.rank-1 .rank { color: gold; text-shadow: 0 0 12px rgba(255, 215, 0, 0.6); }
.leaderboard .row.rank-2 .rank { color: silver; }
.leaderboard .row.rank-3 .rank { color: #cd7f32; }
.leaderboard img.avatar { width: 40px; height: 40px; border-radius: 50%; }
.leaderboard .nickname { flex: 1; font-weight: 600; }
.leaderboard .score {
  font-weight: 800;
  color: var(--pink-soft);
  font-variant-numeric: tabular-nums;
}

/* End-screen podium */
.winner-banner {
  display: inline-block;
  margin: 0.5rem 0 1rem;
  padding: 0.6rem 1.5rem;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #ffd700, #ffae42, #ff2d92);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.4));
  animation: gradient-shift 4s ease-in-out infinite, banner-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes banner-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.podium-row {
  animation: podium-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.podium-row.rank-1 { animation-delay: 0.4s; }
.podium-row.rank-2 { animation-delay: 0.2s; }
.podium-row.rank-3 { animation-delay: 0.0s; }
.podium-row.rank-1 .nickname,
.podium-row.rank-1 .score { font-weight: 900; font-size: 1.15em; }
.podium-row.rank-1 {
  border-color: gold !important;
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.35);
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.18), rgba(255, 215, 0, 0.05)) !important;
}
.podium-row.rank-2 {
  border-color: silver !important;
  background: rgba(192, 192, 192, 0.10) !important;
}
.podium-row.rank-3 {
  border-color: #cd7f32 !important;
  background: rgba(205, 127, 50, 0.10) !important;
}
.podium-row.rank-1 .rank,
.podium-row.rank-2 .rank,
.podium-row.rank-3 .rank {
  font-size: 1.6rem;
}
@keyframes podium-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.end-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* Personal feedback (player view) */
.feedback {
  text-align: center;
  padding: 3rem 1rem;
}
.feedback .emoji { font-size: 5rem; }
.feedback .title { font-size: 2rem; font-weight: 900; margin: 1rem 0 0.5rem; }
.feedback .points { color: var(--pink-soft); font-size: 1.5rem; font-weight: 700; }
.feedback.correct .title { color: #5cffaa; }
.feedback.wrong .title { color: var(--muted); }

/* Section visibility */
[hidden] { display: none !important; }
section.view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ===================== Avatar sprite ===================== */
/* Single sprite sheet at /avatars/sheet.jpg arranged as a 5×2 grid (5 cols × 2 rows).
   Each cell holds one of the 10 character avatars. Background-size of 550%/220%
   zooms each cell ~10% (so the dark space around each halo gets cropped out by the
   border-radius mask, but no character feature is clipped); position percentages
   below center each zoomed cell in the avatar circle.
   Per-avatar SVG is layered behind as a graceful fallback for when sheet.jpg is absent. */
.avatar {
  display: inline-block;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  background-repeat: no-repeat, no-repeat;
  background-size: 550% 220%, contain;
  background-position: 1.1% 4.2%, center;
  vertical-align: middle;
}
.avatar-01 { background-image: url("/avatars/sheet.jpg"), url("/avatars/01.svg"); background-position:  1.1%  4.2%, center; }
.avatar-02 { background-image: url("/avatars/sheet.jpg"), url("/avatars/02.svg"); background-position: 25.6%  4.2%, center; }
.avatar-03 { background-image: url("/avatars/sheet.jpg"), url("/avatars/03.svg"); background-position:   50%  4.2%, center; }
.avatar-04 { background-image: url("/avatars/sheet.jpg"), url("/avatars/04.svg"); background-position: 74.4%  4.2%, center; }
.avatar-05 { background-image: url("/avatars/sheet.jpg"), url("/avatars/05.svg"); background-position: 98.9%  4.2%, center; }
.avatar-06 { background-image: url("/avatars/sheet.jpg"), url("/avatars/06.svg"); background-position:  1.1% 95.8%, center; }
.avatar-07 { background-image: url("/avatars/sheet.jpg"), url("/avatars/07.svg"); background-position: 25.6% 95.8%, center; }
.avatar-08 { background-image: url("/avatars/sheet.jpg"), url("/avatars/08.svg"); background-position:   50% 95.8%, center; }
.avatar-09 { background-image: url("/avatars/sheet.jpg"), url("/avatars/09.svg"); background-position: 74.4% 95.8%, center; }
.avatar-10 { background-image: url("/avatars/sheet.jpg"), url("/avatars/10.svg"); background-position: 98.9% 95.8%, center; }
.avatar-xs { width: 28px; height: 28px; }
.avatar-sm { width: 36px; height: 36px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 96px; height: 96px; }

/* Mute button (top-left corner — out of the way of the profile chip on the right) */
.mute-btn {
  position: fixed;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 61;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(10, 0, 20, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 0.15s, transform 0.15s, opacity 0.15s;
}
.mute-btn:hover { border-color: var(--pink-hot); transform: translateY(-1px); }
.mute-btn.muted { opacity: 0.55; }

/* Profile chip (top-right anywhere) */
.profile-chip {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem 0.35rem 0.35rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  background: rgba(10, 0, 20, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.profile-chip:hover {
  border-color: var(--pink-hot);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 45, 146, 0.3);
}
.profile-chip img,
.profile-chip .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
}
.profile-chip > span {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Host setup page */
.setup-stack {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 56rem;
  margin-top: 2rem;
}
.setup-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
}
.setup-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--pink-soft);
  margin-bottom: 0.25rem;
}
.setup-section .duration-options { align-self: flex-start; }
.quiz-card.selectable { user-select: none; }
.quiz-card.selectable.selected {
  border-color: var(--pink-hot);
  box-shadow: 0 0 24px rgba(255, 45, 146, 0.35), inset 0 0 0 1px var(--pink-hot);
  background: rgba(255, 45, 146, 0.06);
}

/* Mode picker grid (host page) */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  width: 100%;
}
.mode-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.mode-card:hover { transform: translateY(-1px); border-color: var(--pink-hot); }
.mode-card.selected {
  border-color: var(--pink-hot);
  box-shadow: 0 0 18px rgba(255, 45, 146, 0.3), inset 0 0 0 1px var(--pink-hot);
  background: rgba(255, 45, 146, 0.06);
}
.mode-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.mode-card .emoji { font-size: 2rem; }
.mode-card .mode-meta {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--pink-soft);
  background: rgba(255, 107, 181, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
}
.mode-card .title { font-size: 1.05rem; font-weight: 800; }
.mode-card .desc { color: var(--muted); font-size: 0.85rem; line-height: 1.35; }

/* Duration picker (host page) */
.duration-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.duration-label {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}
.duration-options {
  display: inline-flex;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 0.25rem;
  gap: 0.25rem;
}
.dur-btn {
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dur-btn:hover { color: var(--fg); }
.dur-btn.selected {
  color: white;
  background: linear-gradient(135deg, var(--purple), var(--magenta));
  box-shadow: 0 4px 16px rgba(255, 0, 110, 0.35);
}

/* ===================== Self-paced gameplay ===================== */

/* Top game bar */
.game-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  backdrop-filter: blur(10px);
}
.game-bar-left { display: flex; align-items: center; gap: 0.75rem; }
.game-bar-right { display: flex; justify-content: flex-end; }

.me-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.6rem;
}
.me-chip img,
.me-chip .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--pink-hot);
}
.me-name { font-size: 0.85rem; font-weight: 700; line-height: 1; }
.me-score {
  font-size: 1rem;
  font-weight: 800;
  color: var(--pink-soft);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.me-score.flash-good { animation: flash-good 0.5s ease; }
.me-score.flash-bad  { animation: flash-bad 0.5s ease; }
@keyframes flash-good {
  0%   { color: var(--pink-soft); transform: scale(1); }
  40%  { color: #5cffaa;          transform: scale(1.25); }
  100% { color: var(--pink-soft); transform: scale(1); }
}
@keyframes flash-bad {
  0%   { color: var(--pink-soft); transform: scale(1); }
  40%  { color: var(--magenta);   transform: scale(0.9); }
  100% { color: var(--pink-soft); transform: scale(1); }
}

.streak {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  background: rgba(255, 0, 110, 0.12);
  border: 1px solid rgba(255, 0, 110, 0.35);
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--pink-hot);
}
.streak-icon { font-size: 1rem; }

.game-timer {
  font-size: 1.6rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--fg);
  padding: 0.5rem 1rem;
  background: rgba(124, 43, 255, 0.15);
  border: 2px solid var(--purple);
  border-radius: 0.75rem;
  box-shadow: 0 0 20px rgba(124, 43, 255, 0.25);
}
.game-timer.urgent {
  color: var(--magenta);
  border-color: var(--magenta);
  box-shadow: 0 0 24px rgba(255, 0, 110, 0.5);
  animation: urgent 0.6s ease-in-out infinite;
}

.bonk-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: white;
  background: linear-gradient(135deg, var(--magenta), var(--pink-hot));
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 0, 110, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: bonk-pulse 1.4s ease-in-out infinite;
}
.bonk-btn:hover { transform: scale(1.05); }
.bonk-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.4rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 900;
}
@keyframes bonk-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(255, 0, 110, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
  50%      { box-shadow: 0 0 36px rgba(255, 0, 110, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
}

/* Play grid: main + side leaderboard */
.play-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  width: 100%;
  align-items: start;
}
.play-main { display: flex; flex-direction: column; gap: 1rem; }
.play-side {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1rem;
  position: sticky;
  top: 1rem;
}
.side-header {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.side-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.side-row {
  display: grid;
  grid-template-columns: 2rem 28px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s;
}
.side-row.you { background: rgba(255, 0, 110, 0.15); }
.side-rank { font-weight: 800; color: var(--pink-hot); text-align: center; }
.side-row.rank-1 .side-rank { color: gold; }
.side-row.rank-2 .side-rank { color: silver; }
.side-row.rank-3 .side-rank { color: #cd7f32; }
.side-avatar { width: 28px; height: 28px; border-radius: 50%; }
.side-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-score { font-weight: 800; color: var(--pink-soft); font-variant-numeric: tabular-nums; }

.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.answer-feedback {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.answer-feedback.good { color: #5cffaa; }
.answer-feedback.bad  { color: var(--magenta); }

.tile.picked {
  outline: 4px solid #fff;
  outline-offset: -4px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: grid;
  place-items: center;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.modal-card {
  background: linear-gradient(180deg, #1a0035, #0a0014);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.5rem;
  width: min(28rem, 92vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 0, 110, 0.2);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.modal-header h3 { font-size: 1.4rem; font-weight: 900; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.modal-close:hover { color: var(--fg); }

.bonk-targets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}
.bonk-target {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.bonk-target:hover {
  background: rgba(255, 0, 110, 0.15);
  border-color: var(--pink-hot);
  transform: translateY(-1px);
}
.bonk-target img { width: 40px; height: 40px; border-radius: 50%; }
.bonk-target-info { flex: 1; }
.bonk-target-name { font-weight: 700; }
.bonk-target-score { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.bonk-target-icon { font-size: 1.5rem; }

/* Toasts */
.toast-stack {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--glass-border);
  color: var(--fg);
  font-weight: 700;
  font-size: 0.95rem;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  max-width: 92vw;
  text-overflow: ellipsis;
  overflow: hidden;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-good { border-color: #5cffaa; box-shadow: 0 0 20px rgba(92, 255, 170, 0.3); }
.toast-bad  { border-color: var(--magenta); box-shadow: 0 0 20px rgba(255, 0, 110, 0.4); }

/* Responsive tweaks */
@media (max-width: 720px) {
  .play-grid { grid-template-columns: 1fr; }
  .play-side { position: static; order: 2; }
  .play-main { order: 1; }
  .game-bar { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .game-bar-center { grid-column: 1 / -1; order: -1; justify-self: center; }
  .game-bar-right  { justify-content: flex-end; }
}
@media (max-width: 540px) {
  .avatar-grid { grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
  .tile { min-height: 5.5rem; font-size: 1.2rem; padding: 1rem; }
  .input.large { font-size: 1.5rem; letter-spacing: 0.4em; }
  .me-chip img { width: 32px; height: 32px; }
  .me-name { font-size: 0.78rem; }
  .me-score { font-size: 0.9rem; }
  .game-timer { font-size: 1.3rem; padding: 0.4rem 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
