:root {
  --board: #17302a;
  --board-deep: #0f2420;
  --board-line: #2b4a42;
  --chalk: #f2efe4;
  --chalk-dim: #a9b8ae;
  --ribbon: #e3b23c;
  --ribbon-dark: #b8862a;
  --ink: #1d1a12;
  --red: #d2453a;
  --blue: #2c69d4;
  --gold: #e3a92b;
  --violet: #7a4bcb;
  --right: #2e9e62;
  --wrong: #c23b32;
  --half: #d98e1f;
  --sans: "Archivo", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--chalk);
  background: var(--board-deep);
  background-image: radial-gradient(ellipse at 50% 30%, var(--board) 0%, var(--board-deep) 75%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--ribbon); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- shared pieces ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }

.brand {
  font-weight: 800; font-stretch: 112%; letter-spacing: -0.01em;
  display: inline-flex; align-items: baseline; gap: .35em;
}
.brand .q { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--ribbon); font-size: 1.35em; line-height: 0; }

/* ribbon: the stužka band with folded ends */
.ribbon {
  position: relative; background: var(--ribbon); color: var(--ink);
  padding: .35em 1.2em; font-weight: 900; font-stretch: 125%;
  clip-path: polygon(0 0, 100% 0, calc(100% - .6em) 50%, 100% 100%, 0 100%, .6em 50%);
}

.field {
  width: 100%; padding: 16px 18px; border-radius: 10px;
  background: var(--board-deep); border: 2px solid var(--board-line);
  font-size: 20px; text-align: center; font-weight: 600;
}
.field:focus { border-color: var(--ribbon); outline: none; }
.field.code { font-size: 34px; font-weight: 800; font-stretch: 125%; letter-spacing: .12em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: 14px 28px; border-radius: 10px; font-weight: 800; font-size: 19px;
  background: var(--ribbon); color: var(--ink);
  box-shadow: 0 4px 0 var(--ribbon-dark);
  transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ribbon-dark); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--chalk); box-shadow: inset 0 0 0 2px var(--board-line); }
.btn.wide { width: 100%; }

.err { color: #ff9d94; min-height: 1.4em; font-weight: 600; margin-top: 10px; }
.muted { color: var(--chalk-dim); }

/* answer tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: 12px; text-align: left;
  color: #fff; font-weight: 700; line-height: 1.2; min-height: 84px;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.22);
  transition: opacity .25s, transform .25s;
}
.tile:nth-child(1) { background: var(--red); }
.tile:nth-child(2) { background: var(--blue); }
.tile:nth-child(3) { background: var(--gold); color: var(--ink); }
.tile:nth-child(4) { background: var(--violet); }
.tile svg { flex: none; width: 34px; height: 34px; fill: currentColor; }
.tile .txt { flex: 1; overflow-wrap: anywhere; }
.tile.quote .txt { font-family: var(--serif); font-style: italic; font-weight: 500; }
.tile.dim { opacity: .28; }
.tile .mark {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.95); color: var(--right);
  display: grid; place-items: center; font-weight: 900; font-size: 20px;
}

/* timer ring */
.timer { position: relative; width: 84px; height: 84px; flex: none; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 7; }
.timer .bg { stroke: var(--board-line); }
.timer .fg { stroke: var(--ribbon); stroke-linecap: round; }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-stretch: 115%; font-size: 30px; }
.timer.low .fg { stroke: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
