/* ============================================================
   Backseat — styles
   Design tokens first: change these to re-theme the whole app.
   ============================================================ */
:root {
  --bg: #0a0614;
  --text: #fff4ee;
  --muted: rgba(255, 236, 230, 0.68);
  --faint: rgba(255, 236, 230, 0.42);
  --glass: rgba(24, 12, 42, 0.5);
  --glass-strong: rgba(28, 14, 48, 0.78);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-strong: rgba(255, 255, 255, 0.24);
  --accent: #ff7a8a;          /* overridden per screen by app.js */
  --on-accent: #1a0b1f;
  --good: #6dffb0;
  --bad: #ff5f6d;

  --radius-lg: 24px;
  --radius: 18px;
  --radius-sm: 12px;
  --blur: blur(18px) saturate(150%);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --font-display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  /* Fallback sky if WebGL is unavailable */
  background: var(--bg) linear-gradient(180deg, #120828 0%, #4a1646 50%, #ff7a6b 58%, #12061f 58.2%, #0a0614 100%) fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, a { font: inherit; color: inherit; text-decoration: none; }
button { border: 0; background: none; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

.icon {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon .fill { fill: currentColor; }

#bg { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

/* ---------- layout shell ---------- */
.app {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}

.topbar { display: flex; align-items: center; gap: 12px; min-height: 52px; margin-bottom: 12px; }
.topbar h2 { font: 700 1.15rem/1.2 var(--font-display); letter-spacing: 0.005em; }
.back {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  transition: transform 0.15s var(--ease), background 0.2s;
}
.back:active { transform: scale(0.92); }

.view {
  flex: 1;
  display: flex; flex-direction: column; gap: 14px;
  animation: enter 0.45s var(--ease) both;
}
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- type ---------- */
.eyebrow, .kicker {
  font: 700 0.72rem/1 var(--font-body);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
}
.lede { color: var(--muted); font-size: 1rem; max-width: 34ch; }
.hint { color: var(--faint); font-size: 0.88rem; text-align: center; }
.center { text-align: center; }
.big-text { font: 700 1.55rem/1.22 var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }

/* ---------- home ---------- */
.is-home { gap: 0; }
.hero { padding: 28px 4px 0; }
.hero .eyebrow { color: #ffc7a8; }
.logo {
  font: 800 clamp(3.4rem, 17vw, 4.8rem)/0.9 var(--font-display);
  letter-spacing: -0.045em;
  margin: 10px 0 12px;
  background: linear-gradient(180deg, #fff6d6 10%, #ffb36b 55%, #ff4d8d 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255, 90, 120, 0.35));
}
.hero .lede { color: rgba(255, 236, 230, 0.8); }

.tiles {
  margin-top: 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 132px; padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(24, 12, 42, 0.62); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  animation: rise 0.6s var(--ease) both;
  animation-delay: calc(var(--i) * 60ms + 120ms);
  transition: transform 0.18s var(--ease), border-color 0.2s;
}
.tile::after {             /* soft accent glow in the corner */
  content: ""; position: absolute; inset: auto -30% -60% auto;
  width: 120%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 28%, transparent), transparent);
  pointer-events: none;
}
.tile:active { transform: scale(0.97); }
.tile:hover { border-color: var(--stroke-strong); }
.tile-icon {
  width: 40px; height: 40px; margin-bottom: auto;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.tile-name { font: 700 1.08rem/1.15 var(--font-display); margin-top: 14px; }
.tile-sub { font-size: 0.8rem; line-height: 1.3; color: var(--muted); }

/* ---------- cards & buttons ---------- */
.card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; gap: 14px;
  animation: rise 0.5s var(--ease) both;
}
.card.stage { min-height: 280px; justify-content: center; }
.card.center { align-items: center; text-align: center; }

.actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 56px; padding: 0 20px;
  border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 1.02rem;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.15s var(--ease), filter 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.97); filter: brightness(1.1); }
.btn.ghost {
  background: var(--glass); color: var(--text);
  border: 1px solid var(--stroke); box-shadow: none;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.btn.ghost.confirm { border-color: var(--bad); color: #ffb3ba; }

/* ---------- reveal (riddles, rebus) ---------- */
.answer {
  display: grid; gap: 8px;
  padding-top: 16px; border-top: 1px dashed var(--stroke-strong);
  opacity: 0; transform: translateY(8px); filter: blur(8px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), filter 0.4s var(--ease);
}
.answer.show { opacity: 1; transform: none; filter: none; }
.answer-text { font: 800 1.9rem/1.1 var(--font-display); color: var(--accent); letter-spacing: -0.015em; }
.rebus { font-size: clamp(3.2rem, 16vw, 4.6rem); line-height: 1.15; text-align: center; letter-spacing: 0.08em; padding: 12px 0; }

/* ---------- lists (trivia categories, daily games) ---------- */
.row-list { display: flex; flex-direction: column; gap: 10px; }
.row-card {
  display: flex; align-items: center; gap: 14px;
  min-height: 72px; padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  animation: rise 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: transform 0.15s var(--ease), border-color 0.2s;
}
.row-card:active { transform: scale(0.98); }
.row-card:hover { border-color: var(--stroke-strong); }
.row-card.featured { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 12%, var(--glass)); }
.dot { width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--dot); box-shadow: 0 0 14px var(--dot); }
.badge {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  font: 800 1.1rem var(--font-display); color: var(--on-accent);
  background: var(--dot);
}
.row-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.row-name { font: 700 1.05rem/1.2 var(--font-display); }
.row-sub { font-size: 0.85rem; color: var(--muted); }
.row-meta { color: var(--faint); font-size: 0.8rem; flex: none; }
.row-meta .icon { width: 20px; height: 20px; }

/* ---------- trivia ---------- */
.progress { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.5s var(--ease); }
.meta-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 0.88rem; color: var(--muted); }
.meta-row b { color: var(--text); font-weight: 700; }

.options { display: grid; gap: 10px; }
.option {
  text-align: left;
  min-height: 58px; padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  font-weight: 500;
  animation: rise 0.45s var(--ease) both;
  animation-delay: calc(var(--i) * 50ms + 100ms);
  transition: transform 0.15s var(--ease), background 0.25s, border-color 0.25s, opacity 0.25s;
}
.option:active:not(:disabled) { transform: scale(0.98); }
.option:disabled { cursor: default; }
.option.correct { background: color-mix(in srgb, var(--good) 22%, transparent); border-color: var(--good); }
.option.correct::after { content: "  ✓"; color: var(--good); font-weight: 700; }
.option.wrong { background: color-mix(in srgb, var(--bad) 22%, transparent); border-color: var(--bad); animation: shake 0.4s; }
.option.dim { opacity: 0.45; }

.score-big { font: 800 5rem/1 var(--font-display); letter-spacing: -0.04em; color: var(--accent); }
.score-big span { font-size: 0.4em; color: var(--muted); letter-spacing: 0; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}

/* ---------- visual puzzles menu ---------- */
.puzzle-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  animation: rise 0.5s var(--ease) both;
  animation-delay: calc(var(--i) * 70ms);
  transition: transform 0.15s var(--ease);
}
.puzzle-card:active { transform: scale(0.98); }
.puzzle-art {
  height: 120px; margin-bottom: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  display: grid; place-items: center;
}
.rebus-art { font-size: 2.6rem; }
.swatch-art { grid-template-columns: repeat(3, 28px); grid-auto-rows: 28px; gap: 6px; place-content: center; }
.swatch-art i { border-radius: 7px; }

/* ---------- spot the shade ---------- */
.lives { display: flex; gap: 4px; }
.heart .icon { width: 20px; height: 20px; color: var(--bad); fill: var(--bad); transition: opacity 0.3s, transform 0.3s; }
.heart.lost .icon { fill: none; opacity: 0.4; transform: scale(0.85); }

.shade-wrap { position: relative; }
.shade-grid {
  --n: 2;
  display: grid; grid-template-columns: repeat(var(--n), 1fr);
  gap: calc(14px - var(--n) * 1px);
  aspect-ratio: 1;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  transition: filter 0.4s, opacity 0.4s;
}
.shade-grid.done { filter: blur(6px); opacity: 0.5; }
.shade-tile {
  border-radius: calc(20px - var(--n) * 1.5px);
  animation: tile-in 0.35s var(--ease) both;
  transition: transform 0.15s var(--ease);
}
.shade-tile:active { transform: scale(0.94); }
.shade-tile.miss { animation: shake 0.4s; outline: 3px solid var(--bad); outline-offset: -3px; }
.shade-tile.reveal { outline: 3px solid #fff; outline-offset: -3px; animation: pulse-ring 0.9s var(--ease); }
@keyframes tile-in { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse-ring { 50% { transform: scale(1.06); } }

.shade-over {
  position: absolute; inset: 12% 8%;
  align-items: center; justify-content: center; text-align: center;
}
.shade-over .btn { margin-top: 8px; }
.shade-over .score-big { font-size: 3.6rem; }

/* ---------- road bingo ---------- */
.bingo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bingo-cell {
  aspect-ratio: 1;
  display: grid; place-items: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  font-size: clamp(0.58rem, 2.6vw, 0.74rem); line-height: 1.15; font-weight: 500;
  text-align: center; hyphens: auto; overflow-wrap: anywhere;
  transition: transform 0.2s var(--ease), background 0.2s, color 0.2s, box-shadow 0.3s;
}
.bingo-cell:active { transform: scale(0.93); }
.bingo-cell.on {
  background: color-mix(in srgb, var(--accent) 80%, transparent);
  color: var(--on-accent); border-color: transparent; font-weight: 700;
  animation: stamp 0.3s var(--ease);
}
.bingo-cell.free { font-family: var(--font-display); font-weight: 800; }
.bingo-cell.win { background: #fff3c4; color: var(--on-accent); box-shadow: 0 0 18px rgba(255, 220, 120, 0.7); }
@keyframes stamp { 0% { transform: scale(0.8); } 60% { transform: scale(1.08); } 100% { transform: none; } }

.toast {
  position: fixed; left: 50%; top: 42%; z-index: 5;
  transform: translate(-50%, -50%);
  font: 800 4rem/1 var(--font-display); letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff6d6, #b8ff6b); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 8px 30px rgba(184, 255, 107, 0.5));
  pointer-events: none;
}
.toast.pop { animation: toast 2.2s var(--ease) both; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(-8deg); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(2deg); }
  25% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* ---------- would you rather ---------- */
.wyr { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.wyr-opt {
  min-height: 140px; padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong); border: 1px solid var(--stroke);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  font: 700 1.35rem/1.2 var(--font-display); text-wrap: balance;
  animation: rise 0.5s var(--ease) both;
  transition: transform 0.25s var(--ease), background 0.25s, color 0.25s, opacity 0.25s;
}
.wyr-opt + .wyr-or + .wyr-opt { animation-delay: 80ms; }
.wyr-opt.picked { background: var(--accent); color: var(--on-accent); transform: scale(1.02); }
.wyr-opt.unpicked { opacity: 0.45; transform: scale(0.97); }
.wyr-or {
  align-self: center;
  font: 800 0.8rem var(--font-body); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent);
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* Wider screens: a little more breathing room */
@media (min-width: 600px) {
  .app { padding-top: 32px; }
  .tile { min-height: 150px; }
}
