:root {
  /* Trivia at Home palette, shared with the channel logo and the quiz videos. */
  --bg: #111b2e;          /* logo background */
  --bg-2: #18305c;
  --fg: #f6eedc;          /* foam */
  --muted: #a7b4c8;
  --card: #1e589e;        /* house walls */
  --card-press: #2768b5;
  --accent: #f15a22;      /* roof */
  --amber: #f7a623;       /* beer */
  --good: #22be6e;
  --bad: #e62832;
  --line: #26344f;
  --font: "Nunito Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg) linear-gradient(165deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100%;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(28px + env(safe-area-inset-bottom, 0px));
}

.screen { display: flex; flex-direction: column; gap: 16px; }
.screen[hidden] { display: none; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: default; }

/* Home */
.brand { font-size: 2.4rem; font-weight: 900; margin: 12px 0 0; }
.tagline { margin: 0 0 8px; color: var(--muted); }

.hero {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; padding: 28px 24px; border-radius: 14px; text-align: left;
  background: var(--accent);
}
.hero:disabled { opacity: 0.5; }
.hero:not(:disabled):active { filter: brightness(1.12); }
.hero-title { font-size: 2.2rem; font-weight: 900; line-height: 1.1; }
.hero-best { color: var(--fg); margin-top: 10px; font-size: 0.95rem; opacity: 0.9; min-height: 1.3em; }

.section-title {
  margin: 16px 0 0; font-size: 0.85rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.specials { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.special {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; border-radius: 10px;
  background: var(--card); text-align: left; min-width: 0;
}
.special:disabled { opacity: 0.5; }
.special:not(:disabled):active { background: var(--card-press); }
.special-title { font-size: 1.15rem; font-weight: 900; }
.special-sub { font-size: 0.82rem; line-height: 1.25; opacity: 0.9; }
.special-best { font-size: 0.8rem; opacity: 0.85; margin-top: 6px; min-height: 1.2em; }
.status { color: var(--muted); font-size: 0.9rem; min-height: 1.3em; margin: 4px 0 0; }

.consent {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--line); font-size: 0.95rem;
}
.consent[hidden] { display: none; }
.consent p { margin: 0; color: var(--muted); }
.consent-actions { display: flex; align-items: center; gap: 18px; }
.consent-yes { padding: 8px 18px; border-radius: 999px; background: var(--card); font-weight: 800; }
.privacy { align-self: flex-start; font-size: 0.85rem; padding: 0; }

/* Game */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.bar-mode { color: var(--muted); font-size: 0.95rem; }
.bar-right { display: flex; align-items: center; gap: 14px; }
.link { background: none; padding: 6px 0; color: var(--muted); font-size: 1rem; }
.lives { display: inline-flex; gap: 6px; }
.life { width: 12px; height: 12px; border-radius: 50%; background: var(--fg); }
.life.lost { background: transparent; box-shadow: inset 0 0 0 2px var(--bad); }
.score { color: var(--amber); font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 1.6ch; text-align: right; }

.question { font-size: 1.5rem; font-weight: 900; line-height: 1.2; margin: 14px 0 6px; text-wrap: balance; outline: none; }
.answers { display: flex; flex-direction: column; gap: 10px; }

.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px;
  padding: 12px 16px; border-radius: 10px; background: var(--card); text-align: left;
  font-size: 1.1rem; font-weight: 800; line-height: 1.2;
}
.opt:not(:disabled):active { background: var(--card-press); }
.opt.selected { box-shadow: inset 0 0 0 3px var(--fg); }
.opt.right { background: var(--good); }
.opt.wrong { background: var(--bad); }
.opt.dim { opacity: 0.55; }
.opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt-note { font-size: 0.85rem; opacity: 0.95; white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.95rem; font-weight: 900; background: rgba(0, 0, 0, 0.28);
}
.badge:empty { background: transparent; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.3); }

/* Year slider */
.year-box { display: flex; flex-direction: column; gap: 10px; padding: 18px 16px; border-radius: 10px; background: var(--card); }
.year-value { font-size: 2.6rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; line-height: 1; }
.year-range { width: 100%; height: 44px; margin: 0; accent-color: var(--fg); }
.year-ends { display: flex; justify-content: space-between; font-size: 0.9rem; opacity: 0.9; font-variant-numeric: tabular-nums; }
.year-box.right { background: var(--good); }
.year-box.wrong { background: var(--bad); }

.feedback { min-height: 1.4em; margin: 2px 0 0; color: var(--muted); }

/* After a mistake: a hint that a tap skips the wait. */
.wait { margin: 0; font-size: 0.85rem; color: var(--muted); }
.wait[hidden] { display: none; }
.primary {
  width: 100%; min-height: 56px; border-radius: 999px; background: var(--accent);
  font-size: 1.15rem; font-weight: 900;
}
.primary:disabled { opacity: 0.45; }
.primary[hidden] { display: none; }

/* Game over */
#over { align-items: center; text-align: center; padding-top: 12vh; gap: 10px; }
.over-mode { color: var(--muted); margin: 0; }
.over-title { font-size: 2.2rem; font-weight: 900; margin: 0; }
.over-score { font-size: 1.5rem; margin: 6px 0 0; }
.over-score span { font-size: 3.4rem; font-weight: 900; font-variant-numeric: tabular-nums; margin-right: 6px; }
.over-best { color: var(--muted); margin: 0 0 18px; min-height: 1.4em; }
#over .primary { max-width: 340px; }

@media (max-width: 420px) {
  body { font-size: 16px; }
  .specials { grid-template-columns: 1fr; }
  .special { flex-direction: row; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .special-best { margin: 0 0 0 auto; }
  .question { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .opt, .special, .hero, .year-box { transition: background-color 0.15s, filter 0.15s; }
}
