:root {
  --paper: #faf7ef;
  --white: #fffcf5;
  --ink: #1a2a20;
  --muted: #4e6055;
  --leaf: #204c39;
  --leaf-light: #e7efe3;
  --clay: #963e24;
  --warm: #f2e7d6;
  --rule: #c2c6b5;
  font-family: system-ui, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }
button, select, input { font: inherit; }
a { color: var(--leaf); text-underline-offset: .2em; }
a:hover { color: var(--clay); }
button, label, summary, select { cursor: pointer; }
:is(a, button, input, select, summary):focus-visible { outline: 3px solid var(--clay); outline-offset: 4px; }
.wrap { width: min(100% - 46px, 1150px); margin-inline: auto; }
.sr, .skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(100%); white-space: nowrap; }
.skip:focus { z-index: 3; width: auto; height: auto; padding: 11px; clip-path: none; background: white; }

.identity { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 25px; padding-block: 15px; }
.identity span { color: var(--leaf); font-weight: 790; letter-spacing: .03em; }
.identity p { color: var(--muted); font-size: .87rem; }
.hero { position: relative; display: grid; align-items: center; overflow: hidden; isolation: isolate; min-height: clamp(390px, 42vw, 590px); background: #1d382b; color: white; }
.hero-copy { position: relative; padding-block: clamp(35px, 5vw, 75px); }
.hero::before { z-index: -1; position: absolute; inset: 0; content: ""; background: linear-gradient(90deg, #172d23 3%, #172d23ee 26%, #172d2380 49%, #172d2314 70%, transparent 100%); }
.hero-art, .hero-art img { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero-art img { object-fit: cover; object-position: center 58%; }
.hero-art figcaption { position: absolute; right: 12px; bottom: 9px; z-index: 2; padding: 4px 8px; border-radius: 4px; background: #182e25e6; color: white; font-size: .72rem; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; line-height: 1.03; letter-spacing: -.045em; }
h1 { font-size: clamp(3rem, 7.3vw, 6.8rem); }
h1 em { color: #f4d299; font-weight: 400; }
h2 { font-size: clamp(2.25rem, 4.8vw, 3.95rem); }
h3 { font-size: clamp(1.22rem, 2vw, 1.66rem); line-height: 1.18; }
.hero-copy p { max-width: 33ch; margin-top: 20px; color: #fff7ed; font-size: clamp(1.05rem, 2vw, 1.36rem); }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; gap: 13px; padding: 8px 16px; border: 1px solid var(--leaf); border-radius: 5px; background: var(--leaf); color: white; font-weight: 730; text-decoration: none; text-align: left; }
.primary:hover { background: #183a2b; color: white; }
.secondary { background: var(--white); color: var(--leaf); }
.secondary:hover { background: var(--leaf-light); }
.hero .primary { margin-top: 29px; border-color: #ffe5b5; background: #ffe5b5; color: #26372b; }
.hero .primary:hover { background: white; }
.hero .primary:focus-visible { outline-color: #ffe5b5; }
.primary:disabled { cursor: default; border-color: var(--rule); background: #ebece4; color: #536358; }

main { padding-top: clamp(45px, 6.5vw, 88px); scroll-margin-top: 15px; }
.section-head { display: grid; grid-template-columns: 1fr minmax(210px, 31ch); gap: 12px 35px; align-items: end; margin-bottom: 30px; }
.section-head p, .board-status, .chart-note, .source-note, .footer p, .result-note { color: var(--muted); }
.eyebrow { display: block; margin-bottom: 8px; color: var(--clay); font-weight: 780; letter-spacing: .07em; font-size: .8rem; }
.opening-film { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 15px; margin-bottom: 14px; padding: 3px 12px; border-left: 3px solid var(--leaf); background: var(--leaf-light); }
.opening-film a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 750; }
.opening-film p { color: var(--muted); font-size: .88rem; padding-bottom: 4px; }
.experiment { min-width: 0; }
.predict, .count-panel, .route-panel { display: grid; grid-template-columns: 1fr minmax(345px, 1.07fr); align-items: start; gap: 15px 35px; padding: clamp(16px, 2.6vw, 27px); border: 1px solid var(--rule); border-radius: 8px; background: var(--white); }
.predict p, .count-panel p, .route-panel p, .source-block p, .materials p, .paper-mode p { margin-top: 7px; }
.choice-set { display: flex; flex-wrap: wrap; min-width: 0; gap: 6px; padding: 0; border: 0; }
.choice-set label { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; gap: 7px; padding: 5px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); }
.choice-set label:has(input:checked) { border-color: var(--leaf); background: var(--leaf-light); }
.choice-set input { width: 16px; height: 16px; accent-color: var(--leaf); }
.predict button, .count-panel button, .route-panel button { margin-top: 12px; }
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.board { min-width: 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--white); overflow: hidden; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 15px 12px; border-bottom: 1px solid var(--rule); background: var(--leaf-light); }
.board + .board .board-head { background: var(--warm); }
.board h3 { display: flex; gap: 7px; align-items: center; margin-right: 3px; font-size: 1.02rem; }
.tile { display: inline-grid; place-items: center; width: 29px; height: 29px; border-radius: 4px; background: var(--leaf); color: white; }
.board + .board .tile { background: var(--clay); }
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .78rem; color: var(--muted); }
.svg-wrap { padding: 8px 11px 0; }
.svg-wrap svg { width: 100%; max-height: 245px; height: auto; vertical-align: middle; overflow: visible; }
.chart-grid { stroke: #d4dbcf; }
.chart-threshold { stroke: #7b3e2a; stroke-width: 1.6; stroke-dasharray: 4 4; }
.chart-track { stroke: #e8e9df; stroke-width: 8px; stroke-linecap: round; }
.chart-bar { stroke-width: 9px; stroke-linecap: round; stroke: #416948; }
.chart-bar.over { stroke: #9c4d2d; }
.chart-figure { font-size: 14px; fill: #304b3a; font-weight: 700; }
.chart-axis { font-size: 12px; fill: #495f4f; }
.chart-marker { fill: #963e24; font-weight: 750; }
.board-status { padding: 0 14px 13px; font-size: .88rem; min-height: 34px; }
.chart-note { display: flex; align-items: center; gap: 8px; margin: 8px 0 19px; font-size: .89rem; }
.chart-note span { width: 21px; border-top: 2px dotted var(--clay); }
.count-inputs { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.count-inputs > div { min-width: 95px; }
.count-inputs label { font-weight: 730; }
.count-inputs select { display: block; width: 100%; min-height: 44px; margin-top: 3px; padding: 4px 8px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); }
.notice { padding: 9px 11px; border-left: 3px solid var(--clay); background: var(--warm); }
.route-panel { margin-top: 12px; border-top: 3px solid var(--leaf); }
#reset { margin-top: 14px; }

.reflection, .source-block, .materials { margin-top: clamp(47px, 7vw, 88px); padding-top: 24px; border-top: 1px solid var(--rule); }
.reflection p { max-width: 72ch; margin-top: 12px; }
.source-block, .materials { display: grid; grid-template-columns: minmax(0, .83fr) minmax(0, 1fr); gap: 14px 38px; }
.source-block h2, .materials h2, .reflection h2 { font-size: clamp(2rem, 3.8vw, 3.22rem); }
.table-wrap { min-width: 0; }
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--rule); text-align: left; }
thead { background: var(--leaf-light); }
td { font-variant-numeric: tabular-nums; }
caption { margin-bottom: 5px; text-align: left; color: var(--muted); font-size: .82rem; }
.hdi td { font-size: 1.16rem; font-weight: 730; }
.source-note { font-size: .84rem; }
.links { list-style: none; padding-left: 0; }
.links li { border-bottom: 1px solid var(--rule); }
.links a { display: flex; min-height: 44px; gap: 10px; justify-content: space-between; align-items: center; padding-block: 8px; font-weight: 730; }
.footer { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; margin-top: 46px; padding-block: 14px 24px; border-top: 1px solid var(--rule); font-size: .82rem; }
.footer span { font-weight: 780; color: var(--leaf); }
.paper-mode { padding: 18px; border: 1px solid var(--rule); background: var(--white); }
details { margin-top: 11px; padding: 8px 11px; border: 1px solid var(--rule); background: var(--white); }
summary { min-height: 30px; font-weight: 750; }

@media (max-width: 750px) {
  .wrap { width: calc(100% - 30px); }
  .identity { flex-wrap: wrap; gap: 3px; padding-block: 10px; }
  .hero { display: flex; flex-direction: column; min-height: 0; align-items: stretch; }
  .hero::before { content: none; }
  .hero-copy { padding-block: 26px 28px; }
  .hero-copy p { margin-top: 12px; }
  .hero .primary { margin-top: 17px; }
  .hero-art { position: relative; aspect-ratio: 2.6; }
  .hero-art, .hero-art img { z-index: 0; }
  .hero-art figcaption { bottom: 5px; right: 6px; font-size: .65rem; }
  .section-head, .predict, .count-panel, .route-panel, .source-block, .materials { grid-template-columns: 1fr; }
  .boards { gap: 9px; }
  .board-head { padding: 9px; }
  .board h3 { font-size: .82rem; }
  .board-status { padding-inline: 9px; font-size: .78rem; }
}
@media (max-width: 520px) {
  .boards { grid-template-columns: 1fr; }
  .board-head { padding: 10px 13px; }
  .board h3 { font-size: .96rem; }
  th, td { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.identity > a { color: inherit; font-weight: 700; text-underline-offset: .24em; }
