/* =========================================================
   Pub Nights Trivia — poster-style theme (blue edition)
   ========================================================= */
:root {
  --blue: #1d4fd1;
  --blue-deep: #163fae;
  --blue-light: #3b6ff0;
  --ink: #0b1a3a;
  --ink-soft: #16295a;
  --cream: #f4ead2;
  --cream-dim: rgba(244, 234, 210, 0.7);
  --mustard: #ffc43d;
  --mint: #3ddc97;
  --coral: #ff5c7a;
  --radius: 14px;
  --font-display: "Bebas Neue", "Oswald", "Impact", "Arial Narrow", sans-serif;
  --font-cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 18px 40px rgba(5, 12, 35, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--blue-deep);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.08), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(0, 0, 0, 0.18), transparent 45%);
  color: var(--cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px 40px;
}

/* The "poster" frame that wraps every screen */
.poster {
  width: 100%;
  max-width: 440px;
  min-height: 760px;
  background: var(--blue);
  border: 2px solid var(--cream);
  outline: 10px solid var(--blue);
  box-shadow: var(--shadow);
  position: relative;
  /* `clip` (with `hidden` as the fallback) makes the frame non-scrollable, so a
     focused or animated child can never shove the whole poster sideways. */
  overflow: hidden;
  overflow: clip;
  padding: 22px 22px 26px;
}
.poster::before {
  /* halftone dots in the corner, like the poster */
  content: "";
  position: absolute;
  right: -40px;
  top: 140px;
  width: 190px;
  height: 190px;
  background-image: radial-gradient(var(--ink) 1.6px, transparent 1.8px);
  background-size: 9px 9px;
  opacity: 0.55;
  mask-image: radial-gradient(circle at 70% 30%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 70% 30%, #000 20%, transparent 70%);
  pointer-events: none;
}

.screen { display: none; animation: fade-in 0.35s ease both; position: relative; z-index: 1; }
.screen.is-active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- typography helpers ---------- */
h1, h2, h3 { margin: 0; font-weight: 400; }
.round-counter, .field-label, .pill, .tab, .foot-cell span, .stat span, .hud-progress, .timer-label, .hint, .price-tag-label {
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}

/* ---------- buttons ---------- */
.btn {
  display: block;
  width: 100%;
  border: 0;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.08em;
  padding: 14px 18px;
  border-radius: var(--radius);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn + .btn { margin-top: 10px; }
.btn:active { transform: translateY(2px); }
.btn-primary {
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 6px 0 var(--ink);
}
.btn-primary:hover { background: #fff6dc; }
.btn-primary:active { box-shadow: 0 3px 0 var(--ink); }
.btn-ghost {
  background: transparent;
  color: var(--cream);
  border: 2px solid var(--cream);
}
.btn-ghost:hover { background: rgba(244, 234, 210, 0.08); }
.btn-link {
  background: none;
  border: 0;
  color: var(--cream-dim);
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  cursor: pointer;
  padding: 10px;
  width: 100%;
}
.btn-link:hover { color: var(--cream); text-decoration: underline; }
.btn-back {
  background: var(--ink);
  color: var(--cream);
  border: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

/* =========================================================
   HOME
   ========================================================= */
.rounds-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 2px solid var(--cream);
  border-bottom: 2px solid var(--cream);
}
.rounds-strip div {
  padding: 8px 4px 7px;
  text-align: center;
  border-right: 2px solid var(--cream);
}
.rounds-strip div:last-child { border-right: 0; }
.rounds-strip b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1;
}
.rounds-strip span {
  display: block;
  font-family: var(--font-cond);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero { margin-top: 18px; position: relative; }
.hero-kicker {
  margin: 0 0 6px 6px;
  font-family: var(--font-cond);
  font-style: italic;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(5.5rem, 24vw, 7rem);
  line-height: 0.9;
  color: var(--cream);
  transform: rotate(-6deg);
  transform-origin: left bottom;
  display: inline-block;
  position: relative;
  margin-left: 4px;
}
.hero-title-word {
  position: relative;
  display: inline-block;
  padding-right: 10px;
}
.hero-title-word::after {
  /* halftone drop shadow */
  content: "";
  position: absolute;
  left: 12px;
  top: 14px;
  right: -4px;
  bottom: -8px;
  background-image: radial-gradient(var(--ink) 1.5px, transparent 1.7px);
  background-size: 7px 7px;
  z-index: -1;
  opacity: 0.9;
}
.hero-title-word { text-shadow: 3px 3px 0 var(--ink); }

.hero-art {
  position: relative;
  height: 250px;
  margin-top: -14px;
}
.pint {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  height: 250px;
  width: auto;
  filter: drop-shadow(0 14px 18px rgba(5, 12, 35, 0.35));
}
.pint-foam { fill: var(--cream); }
.pint-body { fill: var(--ink); }
.pint-bubble { fill: none; stroke: var(--cream); stroke-width: 4; }
.pint-bubble.small { stroke-width: 3; }
.pint-shine { fill: rgba(244, 234, 210, 0.12); }

.stamp {
  position: absolute;
  left: 6px;
  top: 70px;
  width: 112px;
  height: 112px;
  animation: spin 24s linear infinite;
}
.stamp-svg { width: 100%; height: 100%; }
.stamp-text { fill: var(--ink); font-family: var(--font-cond); font-weight: 800; }
.stamp-big {
  fill: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.06em;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .stamp { animation: none; } }

.price-tag {
  position: absolute;
  right: 6px;
  top: 60px;
  text-align: center;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  background: var(--blue);
  transform: rotate(6deg);
  box-shadow: 6px 6px 0 var(--ink);
}
.price-tag-label { display: block; font-size: 0.6rem; color: var(--ink); }
.price-tag-value {
  display: block;
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
  color: var(--ink);
}

.start-form { margin-top: 14px; }
.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 0.7rem; margin-bottom: 6px; }
.field-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 2px solid var(--cream);
  background: rgba(11, 26, 58, 0.35);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  outline: none;
}
.field-input::placeholder { color: var(--cream-dim); font-weight: 400; }
.field-input:focus { border-color: var(--mustard); box-shadow: 0 0 0 3px rgba(255, 196, 61, 0.35); }

.poster-foot {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid var(--cream);
  border-bottom: 2px solid var(--cream);
}
.foot-cell { text-align: center; padding: 8px 4px; border-right: 2px solid var(--cream); }
.foot-cell:last-child { border-right: 0; }
.foot-cell strong { display: block; font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }
.foot-cell span { display: block; font-size: 0.55rem; margin-top: 3px; }
.fine-print {
  margin: 10px 0 0;
  text-align: center;
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--cream-dim);
}

/* =========================================================
   ROUND INTRO
   ========================================================= */
.round-intro { text-align: center; padding-top: 30px; }
.round-counter { font-size: 0.75rem; color: var(--cream-dim); margin: 0 0 14px; }
.round-icon { font-size: 3.4rem; line-height: 1; margin-bottom: 10px; }
.round-title {
  font-family: var(--font-display);
  font-size: 3.6rem;
  line-height: 0.95;
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--ink);
  margin-bottom: 10px;
}
.round-tagline { margin: 0; font-size: 1.05rem; color: var(--cream); }
.round-set {
  margin: 10px 0 0;
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  font-size: 0.72rem;
  color: var(--mustard);
}
.round-dots { display: flex; justify-content: center; gap: 8px; margin: 22px 0 30px; }
.round-dots i {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--cream);
  background: transparent;
}
.round-dots i.done { background: var(--cream); }
.round-dots i.now { background: var(--mustard); border-color: var(--mustard); transform: scale(1.25); }

/* =========================================================
   QUESTION
   ========================================================= */
.hud { display: flex; justify-content: space-between; align-items: center; }
.hud-left, .hud-right { display: flex; align-items: center; gap: 10px; }
.pill {
  background: var(--ink);
  color: var(--cream);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
}
.hud-progress { font-size: 0.75rem; }
.hud-score { font-family: var(--font-display); font-size: 1.6rem; line-height: 1; }
.hud-score small { font-family: var(--font-cond); font-size: 0.65rem; letter-spacing: 0.1em; color: var(--cream-dim); }
.hud-streak {
  background: var(--mustard);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: var(--font-cond);
  font-weight: 800;
  font-size: 0.8rem;
  animation: pop 0.3s ease;
}
@keyframes pop { from { transform: scale(0.6); } to { transform: scale(1); } }

.timer { margin-top: 16px; height: 10px; background: rgba(11, 26, 58, 0.45); border-radius: 999px; overflow: hidden; }
.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--mustard);
  border-radius: 999px;
  transform-origin: left center;
}
.timer-bar.running { transition: width linear; }
.timer-bar.urgent { background: var(--coral); }
.timer-label { margin: 6px 0 0; text-align: right; font-size: 0.7rem; color: var(--cream-dim); }

.question-card {
  margin-top: 14px;
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 22px 20px;
  min-height: 128px;
  display: flex;
  align-items: center;
  box-shadow: 6px 6px 0 var(--ink);
  position: relative;
}
.question-text {
  margin: 0;
  font-family: var(--font-cond);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.2;
}

.answers { margin-top: 20px; display: grid; gap: 10px; }
.answer {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: rgba(11, 26, 58, 0.35);
  border: 2px solid var(--cream);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.answer:hover:not(:disabled) { background: rgba(244, 234, 210, 0.14); transform: translateX(3px); }
.answer:disabled { cursor: default; }
.answer-key {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.answer.is-correct { background: var(--mint); border-color: var(--mint); color: var(--ink); }
.answer.is-correct .answer-key { background: var(--ink); color: var(--mint); }
.answer.is-wrong { background: var(--coral); border-color: var(--coral); color: var(--ink); animation: shake 0.3s ease; }
.answer.is-wrong .answer-key { background: var(--ink); color: var(--coral); }
.answer.is-dim { opacity: 0.45; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.feedback {
  margin: 16px 0 0;
  min-height: 1.6em;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.06em;
}
.feedback.good { color: var(--mint); }
.feedback.bad { color: #ffd0d9; }
.hint { margin: 6px 0 0; text-align: center; font-size: 0.62rem; color: var(--cream-dim); }
.hint kbd {
  font-family: var(--font-display);
  border: 1px solid var(--cream-dim);
  border-radius: 4px;
  padding: 0 5px;
  margin: 0 1px;
}
@media (hover: none) { .hint { display: none; } }

/* =========================================================
   SUMMARY / RESULTS
   ========================================================= */
.summary, .results { text-align: center; padding-top: 20px; }
.summary-title, .results-title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  line-height: 0.95;
  color: var(--cream);
  text-shadow: 3px 3px 0 var(--ink);
}
.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 20px 0;
  border: 2px solid var(--cream);
}
.stat { padding: 12px 6px; border-right: 2px solid var(--cream); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1; }
.stat span { display: block; font-size: 0.6rem; margin-top: 4px; color: var(--cream-dim); }

.summary-review {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  text-align: left;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}
.summary-review li {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--coral);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 0.9rem;
}
.summary-review li.ok { background: var(--mint); }

.results-score {
  margin: 0;
  font-family: var(--font-display);
  font-size: 6rem;
  line-height: 0.9;
  color: var(--cream);
}
.results-sub { margin: 10px 0 0; color: var(--cream); font-size: 1rem; }

/* =========================================================
   LEADERBOARD
   ========================================================= */
.lb-head { display: flex; align-items: center; gap: 12px; }
.lb-title { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; }
.tabs {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  background: rgba(11, 26, 58, 0.35);
  padding: 5px;
  border-radius: 999px;
}
.tab {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 9px 0;
  background: transparent;
  color: var(--cream);
  font-size: 0.72rem;
  cursor: pointer;
}
.tab.is-active { background: var(--cream); color: var(--ink); }

.podium {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: end;
  gap: 8px;
  margin-top: 22px;
  min-height: 150px;
}
.podium-slot { text-align: center; }
.podium-slot.empty { opacity: 0.35; }
.avatar {
  width: 58px; height: 58px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1.6rem;
  border: 3px solid var(--cream);
  position: relative;
}
.podium-slot.first .avatar { width: 74px; height: 74px; font-size: 2rem; border-color: var(--mustard); box-shadow: 0 0 0 4px rgba(255, 196, 61, 0.35); }
.podium-slot.first .avatar::before { content: "👑"; position: absolute; top: -26px; font-size: 1.3rem; }
.avatar-rank {
  position: absolute;
  bottom: -10px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.9rem;
  display: grid; place-items: center;
  border: 2px solid var(--ink);
}
.podium-slot.first .avatar-rank { background: var(--mustard); }
.podium-name {
  margin: 14px 0 0;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.podium-score { margin: 0; font-family: var(--font-display); font-size: 1.3rem; color: var(--mustard); }
.podium-base {
  margin-top: 8px;
  background: var(--ink);
  border-radius: 8px 8px 0 0;
  height: 22px;
}
.podium-slot.first .podium-base { height: 40px; }
.podium-slot.third .podium-base { height: 14px; }

.you-row {
  margin-top: 14px;
  border: 2px dashed var(--mustard);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.you-row .lb-rank { color: var(--mustard); }

.lb-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(11, 26, 58, 0.35);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-weight: 600;
}
.lb-row.is-you { outline: 2px solid var(--mustard); }
.lb-rank { font-family: var(--font-display); font-size: 1.3rem; width: 28px; text-align: center; }
.lb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--cream); color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.1rem;
  flex: none;
}
.lb-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name small { display: block; font-weight: 400; font-size: 0.72rem; color: var(--cream-dim); }
.lb-score {
  background: var(--ink);
  color: var(--cream);
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}
.lb-empty { text-align: center; margin: 30px 0; color: var(--cream-dim); font-weight: 600; }
.lb-actions { margin-top: 22px; }

/* ---------- small screens ---------- */
@media (max-width: 400px) {
  body { padding: 12px 10px 24px; }
  .poster { padding: 18px 16px 22px; outline-width: 6px; }
  .round-title { font-size: 3rem; }
  .results-score { font-size: 5rem; }
}
