:root {
  --ink: #18243a;
  --paper: #f3efe5;
  --white: #fffdf8;
  --blue: #245df5;
  --lime: #dcff57;
  --coral: #ff7057;
  --line: #c8c2b7;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  background-image: linear-gradient(rgba(24,36,58,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(24,36,58,.045) 1px, transparent 1px);
  background-size: 32px 32px;
  font-family: Arial, Helvetica, sans-serif;
}
button, textarea { font: inherit; }
.page-shell { min-height: 100vh; padding-top: 1px; }
.intro { max-width: 1120px; margin: auto; padding: 26px 22px 20px; }
.game-active .intro { display: none; }
.game-active .game { height: calc(100vh - 28px); max-height: none; margin-top: 14px; }
.eyebrow { margin: 0 0 12px; color: var(--blue); font-family: monospace; font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow.light { color: var(--lime); }
h1 { margin: 0; font-size: clamp(48px, 6.2vw, 78px); line-height: .88; letter-spacing: -.065em; text-transform: uppercase; }
.subtitle { max-width: 650px; margin: 12px 0 0; font: 18px/1.35 Georgia, serif; }
.game { max-width: 1120px; height: min(680px, calc(100vh - 190px)); min-height: 500px; margin: 0 auto 18px; display: flex; flex-direction: column; border: 2px solid var(--ink); background: var(--white); box-shadow: 8px 8px 0 var(--ink); }
.progress-row { height: 56px; padding: 0 22px; grid-template-columns: 90px 1fr 70px; gap: 16px; align-items: center; border-bottom: 1.5px solid var(--ink); font: 700 10px monospace; letter-spacing: .08em; }
.progress-row:not([hidden]) { display: grid; }
.progress-track { height: 7px; border-radius: 20px; overflow: hidden; background: #ddd8ce; }
#progress-bar { width: 25%; height: 100%; background: var(--blue); transition: width .3s; }
#average-label { text-align: right; }
.screen { display: none; min-height: 0; flex: 1; padding: clamp(30px, 5vw, 58px); }
.screen.active { display: block; }
.start-screen.active { display: grid; grid-template-columns: 170px 1fr; gap: clamp(30px, 6vw, 70px); align-items: center; }
.round-tile { height: 170px; display: grid; place-items: center; border: 2px solid var(--ink); color: white; background: var(--blue); box-shadow: 7px 7px 0 var(--lime), 9px 9px 0 2px var(--ink); font-size: 70px; font-weight: 900; letter-spacing: -.09em; transform: rotate(-2deg); }
h2 { margin: 0 0 13px; font-size: clamp(31px, 4.2vw, 49px); line-height: 1; letter-spacing: -.05em; }
.start-copy > p:not(.eyebrow), .answer-screen > p:not(.eyebrow) { max-width: 630px; font: 18px/1.55 Georgia, serif; }
.start-copy .button { margin-top: 18px; }
.button { min-height: 52px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 25px; border: 2px solid var(--ink); color: var(--ink); background: var(--lime); box-shadow: 4px 4px 0 var(--ink); font-weight: 900; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.button:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.button:focus-visible, textarea:focus-visible { outline: 4px solid rgba(36,93,245,.3); outline-offset: 3px; }
.question-screen { color: white; background: var(--blue); }
.question-screen.active { display: flex; flex-direction: column; justify-content: center; }
.question { min-height: 2.3em; max-width: 900px; margin: 0; font: clamp(36px, 6vw, 70px)/1.12 Georgia, serif; letter-spacing: -.035em; }
.question::after { content: "|"; color: var(--lime); animation: blink .7s step-end infinite; }
.timer { width: min(500px, 85%); height: 5px; margin-top: 32px; background: rgba(255,255,255,.22); }
#timer-bar { width: 100%; height: 100%; background: var(--lime); }
#timer-bar.running { animation: countdown 3s linear forwards; }
.hint { margin: 24px 0 0; font: 11px monospace; opacity: .75; }
.answer-screen label { display: block; margin: 28px 0 9px; font-weight: 800; }
textarea { width: 100%; max-width: 850px; padding: 17px; resize: vertical; border: 2px solid var(--ink); border-radius: 0; color: var(--ink); background: white; box-shadow: 5px 5px 0 #d7d2c8; font: 18px/1.5 Georgia, serif; }
.form-footer { max-width: 850px; margin-top: 18px; display: flex; align-items: center; justify-content: space-between; }
#word-count { color: #6e6b65; font: 11px monospace; }
.verdict { padding: 12px 15px; display: flex; align-items: center; gap: 11px; border: 2px solid var(--ink); background: var(--coral); font: 800 11px monospace; letter-spacing: .08em; }
.verdict.good { background: var(--lime); }
.verdict-mark { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; background: white; font-size: 16px; }
#verdict-type { margin-left: auto; font-weight: 900; }
.feedback-layout { display: grid; grid-template-columns: minmax(160px, .28fr) 1fr; gap: clamp(26px, 5vw, 58px); padding: 28px 0 20px; }
.score-box { border-right: 1.5px solid var(--line); }
.score-box strong { font-size: clamp(64px, 8vw, 98px); line-height: .8; letter-spacing: -.09em; }
.score-box span { font: 700 12px monospace; }
.score-box p { margin-top: 18px; font: 700 10px monospace; letter-spacing: .08em; }
.explanation h2 { max-width: 700px; font-size: clamp(27px, 4vw, 42px); }
.explanation > p:not(.eyebrow) { max-width: 720px; font: 17px/1.55 Georgia, serif; }
.rewrite { max-width: 720px; margin-top: 18px; padding: 14px 16px; border-left: 5px solid var(--blue); background: #e8eeff; font: 16px/1.45 Georgia, serif; }
.rewrite b { display: block; margin-bottom: 5px; font: 800 10px monospace; letter-spacing: .08em; text-transform: uppercase; }
.student-reply { margin: 0 0 20px; padding: 11px 14px; border-block: 1px solid var(--line); color: #64615c; font: 15px/1.35 Georgia, serif; }
.student-reply b { display: block; margin-bottom: 5px; color: var(--ink); font: 800 10px monospace; letter-spacing: .08em; text-transform: uppercase; }
.result-heading { display: grid; grid-template-columns: 170px 1fr; gap: clamp(26px, 5vw, 58px); align-items: center; margin-bottom: 26px; }
.final-score strong { color: var(--blue); font-size: 86px; letter-spacing: -.09em; }
.final-score span { font: 700 12px monospace; }
.result-heading p { margin: 0; font: 17px/1.45 Georgia, serif; }
.takeaways { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 24px; border: 1.5px solid var(--ink); }
.takeaways article { min-height: 125px; padding: 18px; }
.takeaways article + article { border-left: 1.5px solid var(--ink); }
.takeaways span { color: var(--blue); font: 800 10px monospace; }
.takeaways h3 { margin: 15px 0 5px; font-size: 19px; }
.takeaways p { margin: 0; font: 15px/1.45 Georgia, serif; }
.source { margin: 17px 0 0; color: #6e6b65; font-size: 10px; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes countdown { from { width: 100%; } to { width: 0; } }

@media (max-width: 720px) {
  .intro { padding-top: 20px; }
  h1 { font-size: clamp(42px, 13vw, 62px); }
  .subtitle { font-size: 16px; }
  .game { height: auto; min-height: 500px; }
  .game-active .game { height: auto; min-height: calc(100vh - 28px); }
  .game { margin-inline: 12px; box-shadow: 6px 6px 0 var(--ink); }
  .start-screen.active { display: block; }
  .round-tile { display: none; }
  .progress-row { padding-inline: 12px; grid-template-columns: 76px 1fr 52px; gap: 7px; font-size: 9px; }
  .screen { padding: 38px 23px; }
  .feedback-layout, .result-heading { grid-template-columns: 1fr; }
  .score-box { padding-bottom: 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .takeaways { grid-template-columns: 1fr; }
  .takeaways article { min-height: auto; }
  .takeaways article + article { border-left: 0; border-top: 1.5px solid var(--ink); }
  .form-footer { align-items: flex-end; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
