/* Interup. Colors and type are set once here; change them to restyle the whole game. */
:root {
  --stage: #2b3fe0;       /* the cobalt studio floor */
  --stage-deep: #1a2796;
  --ink: #12123a;
  --paper: #ffffff;
  --buzz: #ffd23f;        /* the buzzer */
  --buzz-deep: #d99a00;
  --no: #ff5a4f;
  --yes: #2fd08c;
  --soft: rgba(255, 255, 255, .72);
  --font: 'Bricolage Grotesque', ui-rounded, 'Avenir Next', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 17px; line-height: 1.4; color: var(--paper);
  background: var(--stage); -webkit-tap-highlight-color: transparent;
}
#backdrop {
  position: fixed; inset: 0; z-index: -1; background-color: var(--stage); background-size: cover; background-position: center;
  background-image: radial-gradient(120% 70% at 50% 0%, #4257ff 0%, var(--stage) 55%, var(--stage-deep) 100%);
}
#app { max-width: 560px; height: 100dvh; margin: 0 auto; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
.screen { display: none; height: 100%; flex-direction: column; }
body[data-screen="home"] #home, body[data-screen="game"] #game,
body[data-screen="between"] #between, body[data-screen="final"] #final { display: flex; }
p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--buzz); outline-offset: 3px; }

/* Buttons */
.big {
  border: 0; border-radius: 16px; padding: 16px 22px; font-weight: 800; font-size: 1.15rem; color: var(--ink);
  background: var(--buzz); box-shadow: 0 6px 0 var(--buzz-deep); transition: transform .06s, box-shadow .06s;
}
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--buzz-deep); }
.quiet { background: none; border: 0; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; padding: 10px; font-size: .95rem; }
.note { color: var(--soft); font-size: .95rem; text-align: center; min-height: 1.4em; }
.error { position: fixed; left: 16px; right: 16px; bottom: 16px; margin: 0 auto; max-width: 528px; background: var(--ink); padding: 12px 16px; border-radius: 12px; text-align: center; }

/* Start screen */
#home { justify-content: center; gap: 22px; overflow-y: auto; }
.wordmark { text-align: center; }
.wordmark img { max-width: 100%; max-height: 180px; }
.wordmark h1 {
  margin: 0; font-weight: 800; font-size: clamp(3rem, 15vw, 5.2rem); line-height: 1.1; padding-right: .35em; letter-spacing: -.04em;
  font-variation-settings: 'opsz' 96; white-space: nowrap;
}
/* The last two letters get knocked off the word: the game in one gesture. */
.knock { display: inline-block; color: var(--buzz); transform-origin: 0 90%; animation: knock .7s cubic-bezier(.3, 1.6, .5, 1) .5s both; }
.dash { display: inline-block; width: .5em; height: .13em; margin-left: -1.08em; background: var(--buzz); border-radius: 99px; vertical-align: .22em; transform: scaleX(0); transform-origin: 0 50%; animation: dash .25s ease-out .45s both; }
@keyframes knock { to { transform: translate(.2em, .12em) rotate(17deg); } }
@keyframes dash { to { transform: scaleX(1); } }
.pitch { text-align: center; font-size: 1.2rem; max-width: 26ch; margin: 0 auto; }
.rules { margin: 0; padding: 0 0 0 1.3em; display: grid; gap: 8px; color: var(--soft); }
.rules b { color: var(--paper); }
#home .big { align-self: center; min-width: 260px; }
#home .sound { align-self: center; margin-top: -14px; }

/* The points ladder: seven steps, one per line the moderator reads. */
.ladder { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.ladder span {
  text-align: center; font-weight: 800; font-size: .95rem; padding: 7px 0; border-radius: 9px;
  background: rgba(255, 255, 255, .14); color: var(--paper); transition: background .2s, color .2s, transform .2s;
}
.ladder.demo span:first-child, .ladder span.now { background: var(--buzz); color: var(--ink); transform: translateY(-3px) scale(1.06); }
.ladder span.gone { background: rgba(0, 0, 0, .18); color: rgba(255, 255, 255, .38); text-decoration: line-through; }

/* A question in play */
#game { gap: 12px; }
.bar { display: flex; justify-content: space-between; align-items: flex-end; }
.bar span { display: block; font-size: .9rem; color: var(--soft); }
.bar strong { font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
.score { text-align: right; }
.stage { flex: 1; min-height: 0; display: flex; gap: 10px; align-items: flex-start; }
.moderator { flex: 0 0 60px; height: 60px; margin-top: 6px; }
.moderator img, .moderator svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.head { fill: var(--buzz); }
.lens { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.bridge, .brow { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; fill: none; }
.eye, .mouth { fill: var(--ink); }
.mouth, .brow { transform-box: fill-box; transform-origin: center; transition: transform .15s; }
.moderator[data-state="talking"] .mouth { animation: talk .32s ease-in-out infinite alternate; }
.moderator[data-state="interrupted"] .mouth { transform: scale(.55, 2.3); }
.moderator[data-state="interrupted"] .brow { transform: translateY(-4px); }
.moderator[data-state="interrupted"] { animation: jolt .3s; }
.moderator[data-state="wrong"] .mouth { transform: scale(1.2, .5); }
@keyframes talk { from { transform: scaleY(.5); } to { transform: scaleY(2.2); } }
@keyframes jolt { 30% { transform: translateX(-5px) rotate(-6deg); } 60% { transform: translateX(4px) rotate(4deg); } }

.bubble {
  position: relative; flex: 1; min-width: 0; max-height: 100%; overflow-y: auto; background: var(--paper); color: var(--ink);
  border-radius: 6px 20px 20px 20px; padding: 16px 18px; min-height: 96px; scroll-behavior: smooth;
}
.line { margin: 0 0 12px; font-size: .98rem; color: #5a5a7a; }
.line:last-child { margin-bottom: 0; font-size: 1.22rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.line .w { opacity: 0; }
.line .w.on { opacity: 1; }
.line .w.cut::after { content: '—'; color: var(--no); font-weight: 800; }
.stage-note { color: #5a5a7a; font-size: .98rem; }
.stage-note:empty { display: none; }
.stage-note b { color: var(--ink); font-size: 1.3rem; }

.dock { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#dockBuzz { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.buzzer {
  width: min(46vw, 190px); aspect-ratio: 1; border-radius: 50%; border: 0; color: var(--ink);
  background: radial-gradient(circle at 35% 28%, #fff3b8 0 10%, var(--buzz) 42%) center / cover;
  box-shadow: 0 12px 0 var(--buzz-deep), 0 12px 0 10px rgba(0, 0, 0, .22); margin-bottom: 14px;
  font-weight: 800; font-size: 1.9rem; letter-spacing: .02em; transition: transform .05s, box-shadow .05s; touch-action: manipulation;
}
.buzzer:active, .buzzer.down { transform: translateY(9px); box-shadow: 0 3px 0 var(--buzz-deep), 0 3px 0 10px rgba(0, 0, 0, .22); }
.buzzer.has-image span { visibility: hidden; }
.hint { color: var(--soft); font-size: .98rem; }
.hint #stake { color: var(--paper); font-weight: 800; }
.pips { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.pips i { width: 9px; height: 9px; border-radius: 50%; background: var(--buzz); }
.pips i.used { background: rgba(255, 255, 255, .25); }

#dockAnswer { width: 100%; display: flex; flex-direction: column; gap: 8px; }
#dockAnswer[hidden], #dockBuzz[hidden] { display: none; }
.timer { height: 10px; border-radius: 99px; background: rgba(0, 0, 0, .25); overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: var(--buzz); border-radius: 99px; transform-origin: 0 50%; }
.timer i.low { background: var(--no); }
#dockAnswer label { font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
#dockAnswer .row { flex-wrap: nowrap; }
#answer { flex: 1; min-width: 0; border: 3px solid var(--ink); border-radius: 14px; padding: 13px 14px; font-size: 1.15rem; font-weight: 600; color: var(--ink); background: var(--paper); }
.go { border: 0; border-radius: 14px; padding: 15px 18px; font-weight: 800; background: var(--buzz); color: var(--ink); box-shadow: 0 4px 0 var(--buzz-deep); }
.wrongs { min-height: 1.4em; color: var(--soft); font-size: .95rem; }
.wrongs s { color: #ffc0bb; margin-right: 10px; }
.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } }

/* Back on the page mid-question: one tap lets the sound play again. */
.resume { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; text-align: center; background: rgba(26, 39, 150, .92); }
.resume p { font-size: 1.2rem; }

/* After a question */
#between { justify-content: center; align-items: center; gap: 10px; text-align: center; overflow-y: auto; }
.art:empty { display: none; }
.art img { max-height: 150px; max-width: 100%; }
.verdict { font-size: 1.2rem; font-weight: 600; }
.gained { font-weight: 800; font-size: 5rem; line-height: 1; letter-spacing: -.03em; }
#between[data-correct="1"] .gained { color: var(--buzz); animation: pop .45s cubic-bezier(.3, 1.7, .5, 1); }
#between[data-correct="0"] .gained { color: rgba(255, 255, 255, .5); }
@keyframes pop { from { transform: scale(.4); } }
.answer-line { font-size: 1.15rem; }
.answer-line strong { font-weight: 800; background: var(--paper); color: var(--ink); padding: 2px 10px; border-radius: 8px; white-space: nowrap; }
.recap { list-style: none; margin: 8px 0 14px; padding: 0; text-align: left; display: grid; gap: 6px; font-size: .92rem; color: var(--soft); width: 100%; }
.recap li { display: grid; grid-template-columns: 2.6em 1fr; gap: 8px; align-items: baseline; }
.recap li b { text-align: right; color: rgba(255, 255, 255, .45); }
.recap li.hit { color: var(--paper); }
.recap li.hit b { color: var(--buzz); }
.recap li.miss b { color: var(--no); }
.recap li.unheard { opacity: .55; }

/* Final score */
#final { justify-content: center; align-items: center; gap: 12px; text-align: center; overflow-y: auto; }
.final-label { font-size: 1.2rem; font-weight: 600; }
.final-score strong { display: block; font-size: clamp(5rem, 28vw, 8rem); font-weight: 800; line-height: .9; letter-spacing: -.04em; color: var(--buzz); }
.final-score span { color: var(--soft); }
.final-rows { list-style: none; margin: 6px 0; padding: 0; width: 100%; display: grid; gap: 4px; text-align: left; }
.final-rows li { display: grid; grid-template-columns: 7.8em 1fr 2.4em; gap: 8px; padding: 7px 12px; border-radius: 10px; background: rgba(255, 255, 255, .1); }
.final-rows li span:nth-child(2) { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.final-rows li b { text-align: right; }
.share { margin: 4px 0; padding: 12px 16px; border-radius: 12px; background: var(--ink); text-align: left; font: inherit; font-size: .95rem; line-height: 1.5; user-select: all; max-width: 100%; overflow-x: auto; }

/* The burst of dots when an answer is right */
#burst { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#burst i { position: absolute; left: 50%; top: 42%; width: 12px; height: 12px; border-radius: 3px; animation: fly .9s ease-out forwards; }
@keyframes fly { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }

@media (max-height: 640px) {
  .buzzer { width: min(34vw, 130px); font-size: 1.4rem; }
  .rules { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
