@font-face { font-family: 'Fraunces'; src: url('../fonts/fraunces.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../fonts/plexmono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../fonts/plexmono-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --paper: #f2ead9;
  --paper-2: #e6dcc6;
  --ink: #1c1a17;
  --mute: #6f675a;
  --red: #c63d24;
  --blue: #1f4467;
  --ochre: #d59a1c;
  --line: rgba(28, 26, 23, 0.22);
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --mono: 'Plex Mono', ui-monospace, 'DejaVu Sans Mono', monospace;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--serif); font-size: 18px; line-height: 1.4;
  background: radial-gradient(circle at 1px 1px, rgba(28, 26, 23, 0.055) 1px, transparent 0) 0 0 / 5px 5px, var(--paper);
}
#app { max-width: 1180px; margin: 0 auto; padding: 22px 24px 40px; }
h1, h2, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; }

.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); }
.note { font-family: var(--mono); font-size: 13px; color: var(--mute); min-height: 1.4em; }
.center { text-align: center; justify-content: center; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.btn {
  font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  padding: 10px 16px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; border-radius: 0;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active:not(:disabled) { transform: none; box-shadow: none; }
.btn:focus-visible, .field:focus-visible, .tile:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover:not(:disabled) { box-shadow: 3px 3px 0 var(--red); }
.btn.alt { background: var(--red); border-color: var(--red); }
.btn.alt:hover:not(:disabled) { box-shadow: 3px 3px 0 var(--ink); }
.btn:disabled { opacity: 0.45; cursor: default; }

.field {
  font-family: var(--serif); font-size: 22px; color: var(--ink); background: transparent; border: 0; border-bottom: 2px solid var(--ink);
  padding: 6px 2px; min-width: 0; border-radius: 0;
}
.field::placeholder { color: var(--mute); opacity: 0.7; font-style: italic; }
.field:focus { outline: none; border-bottom-color: var(--red); }

.combo { position: relative; flex: 1 1 260px; }
.combo-in { width: 100%; }
.combo-list { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.combo-list li { padding: 7px 10px; font-size: 16px; cursor: pointer; }
.combo-list li.on, .combo-list li:hover { background: var(--ink); color: var(--paper); }

/* ---- front page */
.masthead { text-align: center; border-top: 4px solid var(--ink); border-bottom: 1.5px solid var(--ink); padding: 10px 0 12px; position: relative; }
.masthead::after { content: ''; position: absolute; left: 0; right: 0; bottom: -6px; border-bottom: 1.5px solid var(--ink); }
.masthead h1 { font-size: clamp(64px, 11vw, 120px); line-height: 1; margin: 2px 0 20px; font-weight: 900; letter-spacing: -0.04em; font-variation-settings: 'opsz' 144; }
.masthead h1::first-letter { color: var(--red); }
.tally { margin-left: 14px; padding-left: 14px; border-left: 1.5px solid var(--line); color: var(--ink); }

.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 34px; }
.tile {
  position: relative; flex: 0 1 262px; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 12px; text-decoration: none;
  border: 1.5px solid var(--ink); background: var(--paper); transition: transform 0.1s, box-shadow 0.1s;
}
.tile:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--ink); }
.tile-no { position: absolute; top: 14px; right: 16px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); }
.tile h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.tile-tag { font-size: 15px; color: var(--mute); font-style: italic; min-height: 2.8em; }
.tile-state { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.glyph { width: 46px; height: 46px; margin: 2px 0 4px; }
.stamp { color: var(--red); border: 2px solid var(--red); padding: 1px 7px; font-weight: 600; transform: rotate(-4deg); display: inline-block; }
.streak { color: var(--mute); }
.tile.done { background: var(--paper-2); }

.g-fill { fill: var(--ink); }
.g-accent { fill: var(--red); }
.g-paper { fill: var(--paper); }
.g-line { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.g-stroke { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.g-stroke.thick { stroke-width: 5; stroke-linecap: butt; }
.g-stroke.accent { stroke: var(--red); }
.g-stroke.ochre { stroke: var(--ochre); }
.g-stroke.paper { stroke: var(--paper); }

/* ---- game frame */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; border-top: 4px solid var(--ink); border-bottom: 1.5px solid var(--ink); padding: 10px 0; }
.back { font-weight: 900; font-size: 26px; letter-spacing: -0.03em; text-decoration: none; }
.back::before { content: '← '; font-weight: 400; color: var(--red); }
.bar-title { text-align: center; }
.bar-title h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.bar-title p { font-size: 14px; color: var(--mute); font-style: italic; max-width: 520px; }
.modes { justify-self: end; display: flex; border: 1.5px solid var(--ink); }
.modes a { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; padding: 7px 12px; }
.modes a.on { background: var(--ink); color: var(--paper); }
.stage { max-width: 720px; margin: 28px auto 0; display: flex; flex-direction: column; gap: 18px; }
.stage-landfall { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) 270px; align-items: start; }
.stage-dossier { max-width: 940px; }

.verdict { border: 1.5px solid var(--ink); border-left: 10px solid var(--blue); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.verdict.lost { border-left-color: var(--red); }
.verdict-head { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.verdict-detail { color: var(--mute); }

/* ---- Quint */
.q-grid { display: grid; gap: 6px; justify-content: center; }
.q-row { display: grid; grid-template-columns: repeat(5, 58px); gap: 6px; }
.q-cell { height: 58px; display: grid; place-items: center; border: 1.5px solid var(--line); font-size: 30px; font-weight: 800; text-transform: uppercase; }
.q-cell.typed { border-color: var(--ink); }
.q-cell.hit { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.q-cell.near { background: var(--ochre); border-color: var(--ochre); }
.q-cell.miss { background: var(--paper-2); border-color: var(--paper-2); color: var(--mute); }
.stage-quint .note { text-align: center; }
.q-keys { display: grid; gap: 6px; justify-content: center; }
.q-keyrow { display: flex; gap: 5px; justify-content: center; }
.q-key { font-family: var(--mono); font-size: 15px; font-weight: 600; text-transform: uppercase; width: 40px; height: 48px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; padding: 0; }
.q-key.wide { width: 62px; font-size: 11px; letter-spacing: 0.06em; }
.q-key.hit { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.q-key.near { background: var(--ochre); border-color: var(--ochre); }
.q-key.miss { background: var(--paper-2); border-color: var(--line); color: var(--mute); }

/* ---- Needle Drop */
.n-player { display: flex; flex-direction: column; gap: 12px; }
.n-bar { position: relative; height: 22px; border: 1.5px solid var(--ink); overflow: hidden; }
.n-bar span { position: absolute; left: 0; top: 0; bottom: 0; }
.n-open { background: var(--paper-2); }
.n-fill { background: var(--red); width: 0; }
.n-bar i { position: absolute; top: 0; bottom: 0; border-left: 1.5px solid var(--ink); }
.n-clock { font-family: var(--mono); font-size: 13px; color: var(--mute); }
.n-play { min-width: 96px; }
.n-body { display: flex; flex-direction: column; gap: 12px; }
.n-tries { display: grid; gap: 6px; }
.n-try { min-height: 38px; border: 1.5px solid var(--line); padding: 6px 10px; display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.n-try.skip { color: var(--mute); font-style: italic; }
.n-try.no { border-color: var(--red); color: var(--red); }
.n-try.near { border-color: var(--ochre); }
.n-try.ok { border-color: var(--blue); background: var(--blue); color: var(--paper); }
.n-try em { font-family: var(--mono); font-size: 11px; font-style: normal; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- Dictation */
.d-dots { display: flex; gap: 8px; justify-content: center; }
.d-dots li { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; padding: 4px 10px; border: 1.5px solid var(--line); color: var(--mute); }
.d-dots li.now { border-color: var(--ink); color: var(--ink); }
.d-dots li.ok { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.d-dots li.no { background: var(--red); border-color: var(--red); color: var(--paper); }
.d-streak { text-align: center; font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.d-card { border: 1.5px solid var(--ink); padding: 26px 22px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.d-card.ok { border-left: 10px solid var(--blue); }
.d-card.no { border-left: 10px solid var(--red); }
.d-input { font-size: 34px; text-align: center; width: min(100%, 460px); }
.d-word { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; }
.d-typed { color: var(--mute); font-style: italic; }

/* ---- Over/Under */
.ou-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 24px; font-weight: 800; }
.ou-head span { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.ou-pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; }
.ou-vs { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); }
.ou-card { border: 1.5px solid var(--ink); padding: 18px 14px; text-align: center; min-height: 210px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.ou-card.ok { border-left: 10px solid var(--blue); }
.ou-card.no { border-left: 10px solid var(--red); }
.ou-flag { font-size: 40px; line-height: 1; }
.ou-card h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.ou-value { font-size: 34px; font-weight: 300; font-variant-numeric: tabular-nums; }
.ou-unit { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); }

/* ---- Dossier */
.ds-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.ds-file { border: 1.5px solid var(--ink); }
.ds-file li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: baseline; }
.ds-file li:last-child { border-bottom: 0; }
.ds-file li.shut { color: var(--mute); background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(28, 26, 23, 0.06) 6px 12px); font-style: italic; }
.ds-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); font-style: normal; }
.ds-side { display: flex; flex-direction: column; gap: 14px; }
.ds-log li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ds-log span { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.ds-log li.ok { color: var(--blue); font-weight: 800; }

/* ---- Landfall */
.lf-frame { position: relative; border: 1.5px solid var(--ink); }
.lf-map { display: block; width: 100%; aspect-ratio: 12 / 5; cursor: crosshair; touch-action: none; }
.lf-sea { fill: #dbe2de; }
.lf-land path { fill: var(--paper); stroke: var(--ink); stroke-width: 0.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.lf-pin { stroke: var(--paper); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.lf-pin.guess { fill: var(--red); }
.lf-pin.truth { fill: var(--blue); }
.lf-line { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.lf-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.lf-zoom .btn { width: 36px; padding: 6px 0; font-size: 16px; }
.lf-panel { display: flex; flex-direction: column; gap: 16px; padding-left: 18px; }
.lf-panel > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.lf-ask { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.lf-tally li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--mute); }
.lf-tally li.done, .lf-tally li.now { color: var(--ink); }
.lf-tally span { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.lf-total { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.lf-total strong { font-family: var(--serif); font-size: 28px; letter-spacing: 0; margin-left: 6px; }

/* ---- Ballpark */
.bp-q { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; text-align: center; }
.bp-gauge { width: min(100%, 340px); margin: 0 auto; display: block; }
.bp-band { fill: none; stroke-width: 20; }
.bp-band.b0 { stroke: #9fb1bb; }
.bp-band.b1 { stroke: #c9cfc0; }
.bp-band.b2 { stroke: #e6c25c; }
.bp-band.b3 { stroke: #de8a2f; }
.bp-band.b4 { stroke: var(--red); }
.bp-needle { transform-origin: 100px 100px; transition: transform 0.8s cubic-bezier(0.2, 1.3, 0.4, 1); }
.bp-needle path { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.bp-needle circle { fill: var(--ink); }
.bp-band-name { text-align: center; font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.bp-input { width: 190px; text-align: center; font-size: 28px; font-variant-numeric: tabular-nums; }
.bp-unit { font-style: italic; color: var(--mute); }
.bp-answer { border: 1.5px solid var(--ink); border-left: 10px solid var(--blue); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; }
.bp-answer.no { border-left-color: var(--red); }
.bp-log { display: grid; gap: 0; max-width: 420px; width: 100%; margin: 0 auto; }
.bp-log li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.bp-log span { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.bp-log li.ok { color: var(--blue); font-weight: 800; }

@media (max-width: 860px) {
  .bar { grid-template-columns: 1fr; justify-items: center; }
  .modes { justify-self: center; }
  .stage-landfall, .ds-cols { grid-template-columns: 1fr; }
  .lf-panel { padding-left: 0; }
  .ou-pair { grid-template-columns: 1fr; }
  .q-row { grid-template-columns: repeat(5, 50px); }
  .q-cell { height: 50px; }
  .q-key { width: 30px; }
}
