:root {
  color-scheme: light;
  --paper: #f8f0dd;
  --card: #fffbef;
  --ink: #20271a;
  --muted: #4e5745;
  --green: #183b2c;
  --line: #d4cbb2;
  --yellow: #ffcd53;
  --orange: #ab371b;
  --title-font: Georgia, "Times New Roman", serif;
  --body-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(#6c481b22 .65px, transparent .65px);
  background-size: 5px 5px;
  color: var(--ink);
  font: 16px/1.5 var(--body-font);
}

.shell { width: min(1040px, calc(100% - 64px)); margin-inline: auto; }
a { color: var(--green); }
.help-link { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; font-weight: 740; text-underline-offset: .28em; }
.studio {
  margin: 0 10px;
  padding: clamp(18px, 2.3vw, 36px) 16px clamp(24px, 3.4vw, 54px);
  background: #103b31 url("./studio.jpg") center / cover no-repeat;
  border-radius: 13px;
  color: var(--card);
}
.hero, .play-area { width: min(100%, 660px); margin-inline: auto; }
.hero { text-align: center; margin-bottom: 15px; }
.hero .returned-recap { color: var(--ink); text-align: left; }
.hero #return-game { color: var(--card); }
.topic {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: .875rem;
  font-weight: 850;
  letter-spacing: .095em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  color: #ffe6a5;
  font: italic 900 clamp(2.5rem, 5vw, 4.2rem)/1 var(--title-font);
  letter-spacing: -.055em;
  text-shadow: 0 3px #693811, 0 5px #152e21, 0 2px 12px #071c15;
}
.hero-summary { margin: 7px auto 0; width: fit-content; padding: 2px 12px; border-radius: 4px; background: #103027e6; color: #fff8df; font-size: .94rem; font-weight: 650; }
.mode-picker { display: inline-flex; margin-top: 12px; padding: 3px; border: 1px solid #e2c780; background: #112f28; border-radius: 9px; }
.mode-picker a { display: grid; place-items: center; min-height: 38px; padding: 3px 18px; color: #fff6dc; border-radius: 6px; font-size: .88rem; font-weight: 750; text-decoration: none; }
.mode-picker a[aria-current] { background: var(--yellow); color: var(--green); }
.mode-picker a:hover { text-decoration: underline; }
.mode-picker a:focus-visible { outline-offset: -3px; }
.game { color: var(--ink); border: 2px solid #d5af59; border-radius: 16px; overflow: hidden; background: var(--card); box-shadow: 0 5px 0 #17271c, 0 9px 28px #001c1b73; }
.game-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: var(--green); color: var(--card); }
.round-progress { display: flex; align-items: center; gap: 13px; font-size: .875rem; font-weight: 730; }
.marks { display: flex; gap: 5px; }
.marks i { width: 16px; height: 6px; border-radius: 10px; background: #ffffff47; }
.marks .current { background: var(--yellow); }
.marks .done { background: #efe2b8; }
.score-badge {
  flex-shrink: 0;
  min-width: 66px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--yellow);
  color: var(--ink);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.score-badge output { font-weight: 850; }
.score-badge span { font-size: .83rem; font-weight: 700; }
.game-inner { padding: 20px 24px 18px; }
.question-context { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.round-number { margin: 0 0 8px; color: var(--muted); font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.game h2, .rules h2, .feedback h3 { font-family: var(--title-font); color: var(--green); }
.game h2 { margin: 0 auto 17px; text-align: center; max-width: 27ch; font-size: clamp(1.9rem, 4vw, 2.55rem); line-height: 1.04; letter-spacing: -.04em; }
form label { display: block; margin: 0 0 5px; font-size: .875rem; font-weight: 750; }
.form-controls { display: flex; align-items: stretch; gap: 9px; }
.form-controls input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid #827b65;
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font: inherit;
}
.form-controls input::placeholder { color: #655e4e; }
.form-controls input[aria-invalid="true"] { border-color: var(--orange); }
button { font: inherit; cursor: pointer; }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 49px;
  padding: 8px 15px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--green);
  color: #fffbee;
  font-weight: 750;
}
.primary [aria-hidden="true"] { color: var(--yellow); font-size: 1.15rem; }
a.primary { text-decoration: none; }
@media (hover: hover) {
  .primary:hover { background: #28543e; }
  .text-button:hover { color: var(--orange); }
}
.primary:active { background: #102e23; }
.text-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: .875rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: .24em;
}
.pass { margin-top: 2px; }
:focus-visible { outline: 3px solid #a43619; outline-offset: 3px; }
h2:focus, h3:focus { scroll-margin-top: 20px; }
.error { margin: 7px 0 0; color: var(--orange); font-size: .875rem; font-weight: 740; }

.point-list, #answer-board, .recap { margin: 0; padding: 0; list-style: none; }
.point-list li, #answer-board li, .recap li { display: flex; justify-content: space-between; gap: 8px; }
.point-list li { padding: 6px 0; border-top: 1px solid #cfc1a2; font-size: .875rem; }
.point-list strong { color: var(--green); white-space: nowrap; }
.rules .round-maximum { margin: 5px 0 0; font-size: .875rem; font-weight: 750; }
.rules .small-note { margin-bottom: 0; padding-top: 8px; color: var(--muted); font-size: .875rem; }
.feedback h3 { margin: 0 0 2px; font-size: 1.48rem; line-height: 1.15; }
.feedback p, .result p { margin: 0 0 12px; overflow-wrap: anywhere; }
.result .topic { margin-bottom: 8px; }
.recap { display: grid; gap: 5px; margin-bottom: 15px; }
.recap li { padding: 7px 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); }
.recap li strong { white-space: nowrap; }
.card-rack, #answer-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(5px, 1vw, 10px);
  padding: 8px;
  margin: 0 0 14px;
  border: 2px solid #17392e;
  border-radius: 12px;
  background: #183d31;
  perspective: 800px;
  counter-reset: rank;
}
.covered i, #answer-board li {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: clamp(72px, 7vw, 94px);
  text-align: center;
  padding: 6px;
  border-radius: 6px;
}
.covered i {
  position: relative;
  isolation: isolate;
  border: 1px solid #9eae81;
  color: #ffe8ac;
  background: repeating-linear-gradient(135deg, #375c4a 0 4px, #315541 4px 8px);
  font: italic bold clamp(1.75rem, 4vw, 2.7rem)/1 var(--title-font);
  text-shadow: 1px 2px #183b2c;
}
.covered i::after { content: ""; position: absolute; inset: 4px; border: 1px solid #97a47691; border-radius: 3px; }
#answer-board li {
  counter-increment: rank;
  gap: 1px;
  background: #f2e6cb;
  color: var(--green);
  line-height: 1.16;
  overflow-wrap: anywhere;
}
#answer-board li::before { content: "#" counter(rank); font: 750 .76rem/1.3 var(--body-font); }
#answer-board li span { font: bold clamp(.98rem, 2vw, 1.35rem)/1.12 var(--title-font); }
#answer-board strong { font-size: .85rem; }
#answer-board .match { background: var(--yellow); outline: 2px solid #fff4cc; outline-offset: -4px; }
#answer-board .match strong::before { content: "✓ +"; }
@media (prefers-reduced-motion: no-preference) {
  #answer-board li { animation: unveil .28s ease-out backwards; }
  #answer-board li:nth-child(2) { animation-delay: .08s; }
  #answer-board li:nth-child(3) { animation-delay: .16s; }
}
@keyframes unveil {
  from { transform: rotateX(-84deg); opacity: .35; }
  to { transform: rotateX(0); opacity: 1; }
}
.result .result-total { margin: -7px 0 9px; }
.result-total strong { color: var(--green); font: 900 clamp(2.5rem, 8vw, 4rem)/1 var(--title-font); }
.result-total span { color: var(--muted); }
.result .daily-return { margin: 0; font-weight: 750; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 12px; }
.comparison { color: var(--green); font-weight: 750; }
#share-status:empty { display: none; }
#share-round-text {
  display: block;
  width: 100%;
  min-width: 0;
  margin-bottom: 12px;
  padding: 9px;
  font: inherit;
  line-height: 1.4;
  overflow-wrap: anywhere;
  overflow: hidden;
  resize: none;
}
.game-guide.shell {
  --guide-inset: clamp(16px, 4vw, 36px);
  width: min(720px, calc(100% - 24px));
  margin-block: clamp(24px, 4vw, 52px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(24px, 4vw, 40px);
  line-height: 1.55;
}
.game-guide h2, .sample h3 {
  margin: 0 0 10px;
  color: var(--green);
  font: 700 clamp(1.55rem, 3.2vw, 2rem)/1.15 var(--title-font);
  letter-spacing: -.03em;
  text-wrap: balance;
}
.game-guide p { margin: 0 0 12px; }
.game-guide p:last-child { margin-bottom: 0; }
.rules {
  overflow-wrap: anywhere;
  scroll-margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.rule-summary, .sample, .friend-example { padding: var(--guide-inset); }
.rule-summary .point-list { margin: 18px 0 12px; }
.rule-summary .point-list li { padding-block: 9px; font-variant-numeric: tabular-nums; }
.sample { border-top: 1px solid var(--line); background: #f4edda; border-radius: 0 0 14px 14px; }
.sample h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
.sample .game-definition { font-weight: 680; margin-bottom: 4px; }
.sample-prompt, .sample > p:last-child, .friend-example p:last-child {
  font-size: .91rem;
  line-height: 1.5;
}
.sample-prompt, .sample > p:last-child { color: var(--muted); }
.friend-example { background: var(--green); color: var(--card); border-radius: 14px; }
.friend-example h2 { color: var(--yellow); }
.friend-example .primary {
  margin: 2px 0 12px;
  background: var(--yellow);
  color: var(--green);
}
.friend-example .primary [aria-hidden] { color: inherit; }
.friend-example .primary:hover { background: #ffe39a; }
.friend-example p:last-child { color: #e1e9dc; }
.guide-topics { padding-inline: var(--guide-inset); }
.mode-list { margin: 16px 0 0; }
.mode-list dt { border-top: 1px solid var(--line); }
.mode-list dt { padding-top: 4px; }
.mode-list dd { margin: 0 0 12px; color: var(--muted); }
.mode-list dd:last-child { margin-bottom: 0; }
.guide-topics a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 750; text-underline-offset: .2em; }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-block: 24px 20px;
  padding-block: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .875rem;
}
.footer > :first-child { font-weight: 800; }

@media (max-width: 790px) {
  .shell { width: calc(100% - 40px); }
  .form-controls .primary { padding-inline: 11px; }
}

@media (max-width: 640px) {
  .shell { width: calc(100% - 32px); }
  .studio { margin: 0; border-radius: 0; padding: 18px 10px 25px; }
  .hero-summary { font-size: .875rem; }
  .mode-picker a { min-height: 40px; }
  .game { box-shadow: 3px 3px 0 var(--ink); }
  .game-bar { padding: 10px 14px; }
  .game-inner { padding: 16px 14px 12px; }
  .game h2 { margin-bottom: 13px; }
  .round-progress { gap: 9px; }
  .marks i { width: 12px; }
  .form-controls { gap: 6px; }
  .form-controls .primary { gap: 6px; }
  .footer { margin-block: 17px 10px; }
}

@media (max-width: 355px) {
  .marks { display: none; }
  .question-context .topic { font-size: .8125rem; letter-spacing: .055em; }
  .game h2 { font-size: 1.75rem; }
}

.duel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 14px;
  border: 1px solid #b9c3ac;
  border-radius: 8px;
  background: #eff2e6;
  color: var(--green);
  overflow: hidden;
}
.duel > b { grid-column: 1 / -1; background: var(--green); color: var(--card); padding: 4px 12px; font-size: .875rem; }
.duel > div { display: grid; align-content: start; padding: 8px 12px; overflow-wrap: anywhere; }
.duel > div + div { border-left: 1px solid #b9c3ac; }
.duel small { font-weight: 650; color: var(--muted); }
.duel span { font-variant-numeric: tabular-nums; font-size: .875rem; }
.recap.duel-recap > li { display: block; padding: 12px; }
.recap.duel-recap strong { white-space: normal; }
.duel-recap .duel { margin: 6px 0 0; }
.returned-recap { margin-top: 16px; }
.share-actions .share-note { width: 100%; margin: 0; color: var(--muted); font-size: .875rem; }
.sample-board { margin: 14px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.sample-board li { display: block; border: 0; padding: 0; }
.sample-board li > span { margin-right: .5em; }
.sample-board button {
  display: flex; flex-wrap: wrap; gap: 3px 7px; width: 100%; height: 100%; min-height: 44px;
  align-items: center; justify-content: space-between;
  border: 1px solid #b7ac8e; border-radius: 7px; padding: 9px 14px;
  background: var(--card); color: var(--ink); font-weight: 650; text-align: left;
}
.sample-board button[aria-pressed="false"] strong { visibility: hidden; }
.sample-board button:hover { background: var(--paper); }
.sample-board button[aria-pressed="true"] { background: var(--green); color: white; border-color: var(--green); }
.sample-board button[aria-pressed="true"] strong { color: var(--yellow); }
.sample-verdict:not(:empty) { border-left: 4px solid var(--orange); padding-left: 10px; font-weight: 700; }
.sample-verdict:empty { display: none; }

.form-controls .primary, .share-actions .primary { background: var(--yellow); color: var(--ink); }
.form-controls .primary:hover, .share-actions .primary:hover { background: #ffe190; }
.form-controls .primary [aria-hidden] { color: var(--green); }
#feedback-detail { font-size: .94rem; }
#feedback-title { scroll-margin-top: min(25vh, 150px); }
@media (max-width: 480px) {
  .game h2 { font-size: clamp(1.45rem, 6vw, 1.85rem); }
  .form-controls { flex-direction: column; }
  .form-controls input { min-height: 44px; }
  .form-controls .primary { min-height: 44px; justify-content: center; }
  .covered i, #answer-board li { min-height: 66px; }
}
