/* Weekly word game. Builds on style.css tokens; the level colour is the stage. */
.game {
  --t0: #d9413e; --t1: #2f5fd0; --t2: #ffe14d; --t3: #1f8a7a;
  --t0-ink: #fff; --t1-ink: #fff; --t2-ink: #1d2b4f; --t3-ink: #fff;
  min-height: 100dvh; display: flex; flex-direction: column;
}
.game #app { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 36rem; margin: 0 auto; padding: 20px 16px 24px; }
.game h1, .game h2, .game .big { font-family: "Bricolage Grotesque", system-ui, sans-serif; }
.game .back { color: var(--ink-soft); font-size: 1rem; }

/* join */
.join h1 { font-size: clamp(2.2rem, 9vw, 3.2rem); line-height: 1; letter-spacing: -0.03em; margin: 28px 0 6px; font-weight: 800; }
.join h1 span { background: linear-gradient(transparent 55%, var(--marker) 55%, var(--marker) 92%, transparent 92%); color: var(--ink); }
.join .week { color: var(--ink-soft); margin: 0 0 28px; }
.field { display: block; margin-bottom: 18px; font-weight: 700; }
.field input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; font-weight: 400;
  color: var(--ink); background: var(--sheet); border: 2px solid var(--line); border-radius: var(--radius-s);
}
.field input:focus { border-color: var(--level); outline: none; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 22px; border: 0; padding: 0; }
.levels legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.lvl {
  appearance: none; cursor: pointer; padding: 12px 8px; border-radius: var(--radius-l); font: inherit;
  border: 2px solid color-mix(in srgb, var(--tab) 45%, transparent); color: var(--ink);
  background: color-mix(in srgb, var(--tab) 10%, var(--sheet)); text-align: center;
}
.lvl b { display: block; font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 1.4rem; }
.lvl small { color: var(--ink-soft); font-size: 0.8rem; }
.lvl[aria-pressed="true"] { background: var(--tab); border-color: var(--tab); color: var(--on-level); }
.lvl[aria-pressed="true"] small { color: inherit; }
.lvl:disabled { opacity: 0.4; cursor: not-allowed; }
.btn {
  appearance: none; cursor: pointer; border: 0; width: 100%; padding: 16px; border-radius: var(--radius-l);
  font: 700 1.2rem "Bricolage Grotesque", system-ui, sans-serif; background: var(--level); color: var(--on-level);
}
.btn.quiet { background: transparent; color: var(--level); padding: 12px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.error { color: var(--bad); background: var(--bad-bg); padding: 10px 14px; border-radius: var(--radius-s); margin: 0 0 16px; }
.rules { color: var(--ink-soft); font-size: 1rem; margin-top: 22px; }

/* countdown */
.count { flex: 1; display: grid; place-items: center; }
.count .big { font-size: 9rem; font-weight: 800; color: var(--level); line-height: 1; }
@media (prefers-reduced-motion: no-preference) { .count .big { animation: pop 0.9s ease-out; } }
@keyframes pop { from { transform: scale(1.6); opacity: 0; } 30% { transform: scale(1); opacity: 1; } }

/* question */
.q { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.bar { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--ink-soft); }
.bar .score { color: var(--ink); font-family: "Bricolage Grotesque", system-ui, sans-serif; font-size: 1.3rem; }
.stage { background: var(--level); color: var(--on-level); border-radius: var(--radius-l); padding: 22px 20px 26px; flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 11rem; }
.stage .ask { margin: 0 0 10px; font-size: 1rem; opacity: 0.9; }
.stage .prompt { margin: 0; font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 700; line-height: 1.2; font-size: 1.45rem; }
.stage .prompt.word { font-size: clamp(2.4rem, 11vw, 3.6rem); font-weight: 800; letter-spacing: -0.02em; }
.stage .hint { margin: 6px 0 0; font-style: italic; font-size: 1.05rem; color: inherit; opacity: 0.9; }
/* the timer is a highlighter stroke that dries up */
.timer { height: 14px; border-radius: 7px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: var(--t2); border-radius: 7px; transform-origin: left; }
.timer.low i { background: var(--t0); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  appearance: none; cursor: pointer; border: 0; border-radius: var(--radius-l); padding: 14px 12px; min-height: 5.5rem;
  display: flex; align-items: center; gap: 10px; text-align: left; font: 700 1.1rem/1.25 "Atkinson Hyperlegible", system-ui, sans-serif;
  background: var(--c); color: var(--c-ink); box-shadow: inset 0 -5px 0 rgb(0 0 0 / 0.18);
}
.tile svg { flex: none; width: 26px; height: 26px; fill: currentColor; }
.tile:nth-child(1) { --c: var(--t0); --c-ink: var(--t0-ink); }
.tile:nth-child(2) { --c: var(--t1); --c-ink: var(--t1-ink); }
.tile:nth-child(3) { --c: var(--t2); --c-ink: var(--t2-ink); }
.tile:nth-child(4) { --c: var(--t3); --c-ink: var(--t3-ink); }
.tile:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.18); }
.tiles.locked .tile { cursor: default; }
.tiles.locked .tile:not(.picked):not(.right) { opacity: 0.3; }
.tile.picked { outline: 4px solid var(--ink); outline-offset: 2px; }
.tile.right { outline: 4px solid var(--ok); outline-offset: 2px; }

/* feedback */
.verdict { border-radius: var(--radius-l); padding: 18px 20px; text-align: center; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.no { background: var(--bad-bg); color: var(--bad); }
.verdict .big { font-size: 2.4rem; font-weight: 800; margin: 0; line-height: 1.1; }
.verdict p { margin: 4px 0 0; }
.learn { margin: 0; text-align: center; color: var(--ink-soft); }
.learn b { color: var(--ink); }

/* results + podium */
.result h1 { font-size: 2.4rem; margin: 18px 0 0; line-height: 1.1; letter-spacing: -0.02em; }
.result .me { color: var(--ink-soft); margin: 6px 0 22px; }
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 8px; margin: 10px 0 18px; }
.step { text-align: center; }
.step .who { font-weight: 700; overflow-wrap: anywhere; line-height: 1.2; }
.step .pts { color: var(--ink-soft); font-size: 0.9rem; }
.step .block {
  margin-top: 6px; border-radius: var(--radius-s) var(--radius-s) 0 0; background: var(--level); color: var(--on-level);
  font: 800 2rem "Bricolage Grotesque", system-ui, sans-serif; display: grid; place-items: center;
}
.step.p1 .block { height: 8.5rem; }
.step.p2 .block { height: 6rem; opacity: 0.85; }
.step.p3 .block { height: 4.5rem; opacity: 0.7; }
@media (prefers-reduced-motion: no-preference) {
  .step .block { animation: rise 0.7s cubic-bezier(.2,.8,.3,1.2) backwards; transform-origin: bottom; }
  .step.p3 .block { animation-delay: 0.1s; } .step.p2 .block { animation-delay: 0.4s; } .step.p1 .block { animation-delay: 0.8s; }
}
@keyframes rise { from { transform: scaleY(0); } }
.board { list-style: none; padding: 0; margin: 0 0 22px; counter-reset: rank 3; }
.board li { display: flex; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); counter-increment: rank; }
.board li::before { content: counter(rank); width: 1.6rem; color: var(--ink-soft); font-weight: 700; }
.board li span { flex: 1; }
.board li.mine { background: color-mix(in srgb, var(--marker) 45%, transparent); border-radius: var(--radius-s); }
.empty { color: var(--ink-soft); }

/* teacher view */
.teacher .levels { margin-bottom: 14px; }
.board.all { counter-reset: rank 0; }
.board li .hide {
  appearance: none; cursor: pointer; font: inherit; font-size: 0.9rem; padding: 2px 12px; margin-left: 8px;
  border-radius: var(--radius-s); border: 1.5px solid var(--bad); background: transparent; color: var(--bad);
}
.notice { background: var(--ok-bg); color: var(--ok); padding: 10px 14px; border-radius: var(--radius-s); }
