:root {
  --ink: #142922;
  --ink-soft: #56645e;
  --cream: #f3efe5;
  --paper: #fffdf7;
  --green: #174f3c;
  --green-bright: #237757;
  --green-pale: #dceae2;
  --orange: #e9773b;
  --orange-pale: #fae7dc;
  --red: #b54b3b;
  --line: #d9d6ca;
  --shadow: 0 24px 70px rgba(29, 48, 39, 0.12);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 9%, rgba(233, 119, 59, 0.09), transparent 24rem),
    linear-gradient(rgba(20, 41, 34, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 41, 34, 0.018) 1px, transparent 1px),
    var(--cream);
  background-size: auto, 24px 24px, 24px 24px, auto;
  font-family: var(--sans);
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

button, a { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }

button { font: inherit; }

button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(233, 119, 59, 0.6);
  outline-offset: 3px;
}

.page-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  border-bottom: 1px solid rgba(20, 41, 34, 0.14);
}

.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.brand strong { font-family: var(--serif); font-size: 19px; letter-spacing: -0.2px; }
.brand small { color: var(--ink-soft); font-size: 10px; text-transform: uppercase; letter-spacing: 1.6px; font-weight: 700; }
.brand-mark {
  width: 39px;
  height: 39px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.brand-mark span { display: block; width: 3px; border-radius: 3px; background: var(--orange); }
.brand-mark span:nth-child(1) { height: 10px; }
.brand-mark span:nth-child(2) { height: 20px; }
.brand-mark span:nth-child(3) { height: 14px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .reference-button {
  color: var(--ink);
  border: 1px solid rgba(20, 41, 34, 0.2);
  background: rgba(255, 253, 247, 0.5);
  cursor: pointer;
}
.icon-button { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button .sound-off { display: none; }
.icon-button.is-muted .sound-on { display: none; }
.icon-button.is-muted .sound-off { display: block; }
.reference-button { height: 42px; padding: 0 16px 0 8px; border-radius: 24px; display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.7px; }
.reference-icon { display: grid; place-items: center; height: 28px; min-width: 38px; border-radius: 15px; color: var(--paper); background: var(--green); font-size: 9px; letter-spacing: 0.6px; }

main { padding-top: 66px; }
.hero { margin-bottom: 54px; }
.hero-copy { max-width: 650px; }
.eyebrow { margin: 0 0 17px; color: var(--green-bright); text-transform: uppercase; letter-spacing: 2.1px; font-size: 10px; font-weight: 850; }
.eyebrow > span { display: inline-block; width: 27px; height: 1px; margin: 0 9px 3px 0; background: currentColor; }
.hero h1 { margin: 0; font: 400 clamp(44px, 5vw, 65px)/0.98 var(--serif); letter-spacing: -2.7px; }
.hero h1 em { color: var(--orange); font-weight: 400; }
.hero-copy > p:last-child { max-width: 440px; margin: 24px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }

.game-card { position: relative; background: var(--paper); border: 1px solid rgba(20, 41, 34, 0.12); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.game-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--green) 0 64%, var(--orange) 64%); }
.game-stats { min-height: 84px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr 1.25fr; align-items: center; padding: 0 44px; }
.stat { display: flex; align-items: center; gap: 11px; }
.stat + .stat { border-left: 1px solid var(--line); padding-left: 42px; }
.stat > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; }
.stat small { color: var(--ink-soft); text-transform: uppercase; font-size: 9px; font-weight: 800; letter-spacing: 1.2px; }
.stat strong { font: 700 21px var(--serif); }
.stat-icon { width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center; background: var(--green-pale); color: var(--green); font-size: 19px; font-weight: 900; }
.stat-icon.flame { color: var(--orange); background: var(--orange-pale); font-size: 13px; transform: rotate(45deg); }
.answered-stat { justify-content: flex-end; }
.answered-icon { background: var(--orange-pale); color: var(--orange); font-size: 14px; }

.game-settings {
  min-height: 54px;
  padding: 9px 44px;
  border-bottom: 1px solid var(--line);
  background: rgba(220, 234, 226, 0.35);
  display: flex;
  align-items: center;
  gap: 12px;
}
.game-settings label { color: var(--ink-soft); font-size: 9px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; white-space: nowrap; }
.game-settings select {
  height: 34px;
  max-width: 245px;
  border: 1px solid rgba(20, 41, 34, 0.25);
  border-radius: 6px;
  padding: 0 30px 0 10px;
  color: var(--ink);
  background: var(--paper);
  font: 700 11px var(--sans);
  cursor: pointer;
}
.game-settings select:focus-visible { outline: 3px solid rgba(233, 119, 59, 0.45); outline-offset: 2px; }
.game-settings p { margin: 0 0 0 auto; color: var(--ink-soft); font-size: 10px; line-height: 1.4; text-align: right; }

.question-area { width: min(760px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 53px; text-align: center; }
.question-kicker { margin: 0; color: var(--ink-soft); font-size: 12px; text-transform: uppercase; font-weight: 750; letter-spacing: 1.8px; }
.prompt-wrap { min-height: 112px; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.prompt-wrap h2 { margin: 0; color: var(--green); font: 400 clamp(66px, 8vw, 98px)/1 var(--serif); letter-spacing: -3px; }
.typed-answer { width: min(590px, 100%); margin: 0 auto; text-align: left; }
.typed-answer > label { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.typed-answer-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.typed-answer input {
  width: 100%;
  min-width: 0;
  height: 59px;
  border: 1px solid #bdb9ac;
  border-radius: 7px;
  padding: 0 18px;
  color: var(--ink);
  background: white;
  font: 700 18px var(--serif);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.typed-answer input::placeholder { color: #aaa89f; font-weight: 400; }
.typed-answer input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35, 119, 87, 0.13); }
.typed-answer button { min-width: 132px; border: 0; border-radius: 7px; padding: 0 18px; color: white; background: var(--green); font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; }
.typed-answer button span { margin-left: 4px; color: #f0ad75; }
.typed-answer > p { margin: 8px 2px 0; color: #8b8c85; font-size: 10px; }
.typed-answer.is-correct input { border-color: var(--green-bright); background: #edf6f0; }
.typed-answer.is-wrong input { border-color: var(--red); background: #fbefec; }
.typed-answer input:disabled, .typed-answer button:disabled { opacity: 0.72; cursor: default; }

.feedback { display: none; grid-template-columns: 39px 1fr; align-items: center; gap: 13px; width: min(590px, 100%); margin: 18px auto 0; padding: 13px 14px; border-radius: 7px; text-align: left; }
.feedback.is-visible { display: grid; animation: feedback-in 230ms ease both; }
.feedback.is-correct { background: var(--green-pale); }
.feedback.is-wrong { background: var(--orange-pale); }
.feedback-mark { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 900; }
.feedback.is-correct .feedback-mark { background: var(--green-bright); }
.feedback.is-wrong .feedback-mark { background: var(--red); }
.feedback > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; }
.feedback strong { font: 700 15px var(--serif); }
.feedback small { color: var(--ink-soft); font-size: 11px; }
.keyboard-hint { border-top: 1px solid var(--line); min-height: 49px; display: flex; align-items: center; justify-content: center; color: #8b8c85; font-size: 10px; }
.keyboard-hint kbd { margin: 0 2px; border: 1px solid #cfccc2; border-bottom-width: 2px; border-radius: 3px; padding: 1px 5px; background: white; color: var(--ink-soft); font: 700 9px var(--sans); }
.keyboard-hint span { margin: 0 9px; }

.field-note { margin: 50px 0 0 35%; padding: 0 0 0 26px; border-left: 2px solid var(--orange); display: flex; align-items: flex-start; gap: 35px; }
.field-note-label { color: var(--orange); text-transform: uppercase; font-size: 9px; font-weight: 850; letter-spacing: 1.6px; white-space: nowrap; padding-top: 8px; }
.field-note > div { display: flex; gap: 13px; }
.quote-mark { color: var(--orange); font: 38px/1 var(--serif); }
.field-note p { margin: 7px 0 0; max-width: 410px; font: italic 16px/1.5 var(--serif); }

footer { min-height: 110px; margin-top: 66px; border-top: 1px solid rgba(20, 41, 34, 0.14); display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); font-size: 9px; text-transform: uppercase; font-weight: 800; letter-spacing: 1.4px; }
footer p:last-child { display: flex; gap: 11px; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 10; background: rgba(10, 29, 23, 0.38); backdrop-filter: blur(3px); }
.reference-drawer { position: fixed; z-index: 11; inset: 0 0 0 auto; width: min(520px, 100%); padding: 38px; background: var(--paper); box-shadow: -20px 0 70px rgba(9, 28, 21, 0.18); overflow-y: auto; transform: translateX(105%); visibility: hidden; transition: transform 260ms ease, visibility 260ms; }
.reference-drawer.is-open { transform: translateX(0); visibility: visible; }
.drawer-header { display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-header h2 { margin: 0; font: 400 38px var(--serif); letter-spacing: -1px; }
.drawer-header .eyebrow { margin-bottom: 8px; }
.close-button { font: 300 29px/1 var(--sans); }
.drawer-intro { color: var(--ink-soft); font-size: 13px; line-height: 1.6; margin: 17px 0 26px; }
.alphabet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.alphabet-item { min-height: 50px; border: 1px solid var(--line); border-radius: 5px; display: flex; align-items: center; gap: 13px; padding: 7px 10px; }
.alphabet-item span { width: 31px; height: 31px; border-radius: 4px; display: grid; place-items: center; color: white; background: var(--green); font: 700 16px var(--serif); }
.alphabet-item strong { font: 700 14px var(--serif); }
.drawer-footnote { margin: 23px 0 0; color: var(--ink-soft); font-size: 11px; font-style: italic; }

[hidden] { display: none !important; }

@keyframes feedback-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 760px) {
  .page-shell { width: min(100% - 24px, 620px); }
  .topbar { min-height: 62px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand strong { font-size: 17px; }
  .brand small { display: none; }
  .reference-button { width: 42px; padding: 0; justify-content: center; }
  .reference-button > .reference-icon { min-width: 28px; }
  .reference-button { font-size: 0; }
  main { padding-top: 12px; }
  .hero { display: none; }
  .game-stats { min-height: 62px; padding: 0 18px; grid-template-columns: 1fr 1fr 1fr; }
  .stat + .stat { padding-left: 14px; }
  .stat-icon { display: none; }
  .stat strong { font-size: 19px; }
  .answered-stat { justify-content: center; }
  .game-settings { min-height: 56px; padding: 8px 14px; gap: 8px; }
  .game-settings label { display: none; }
  .game-settings select { width: 100%; max-width: none; }
  .game-settings p { display: none; }
  .question-area { width: calc(100% - 28px); padding: 20px 0 18px; }
  .question-kicker { font-size: 10px; }
  .prompt-wrap { min-height: 76px; }
  .prompt-wrap h2 { font-size: 68px; }
  .typed-answer-row { grid-template-columns: 1fr; }
  .typed-answer input { height: 54px; }
  .typed-answer button { height: 46px; }
  .feedback { grid-template-columns: 35px 1fr; }
  .keyboard-hint { display: none; }
  .field-note { margin-left: 0; gap: 18px; }
  footer { margin-top: 50px; min-height: 90px; flex-direction: column; justify-content: center; gap: 10px; text-align: center; }
  .reference-drawer { padding: 28px 20px; }
}

@media (max-width: 420px) {
  .alphabet-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
