/* Ear Trainer: Tank Blueprint look (olive drab, khaki lines, signal yellow).
   System fonts for now; no outside font services, to keep kids' visits private. */

:root {
  --olive: #4B5320;
  --olive-dark: #3E4519;
  --olive-deep: #2A2E12;
  --khaki: #E8E2C8;
  --khaki-dim: #C9C6A8;
  --khaki-faint: #B8B699;
  --signal: #F2C14E;
  --grid: rgba(232, 226, 200, 0.09);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --head: "Arial Black", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background-color: var(--olive);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--khaki);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.45;
}

.staging-banner {
  background: var(--signal);
  color: var(--olive-deep);
  text-align: center;
  font-weight: 700;
  padding: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 13px;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 32px 20px 48px; }

.head { margin-bottom: 24px; }
.eyebrow { margin: 0; color: var(--signal); letter-spacing: 0.2em; text-transform: uppercase; font-size: 13px; }
h1 { margin: 4px 0 8px; font-family: var(--head); font-size: clamp(32px, 6vw, 48px); letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; }
.lede { margin: 0; color: var(--khaki-dim); max-width: 60ch; }

.panel {
  border: 2px solid var(--khaki);
  background: var(--olive-dark);
  padding: 20px;
  margin-bottom: 20px;
}
.panel__title { margin: 18px 0 10px; font-family: var(--head); font-size: 16px; letter-spacing: 0.08em; text-transform: uppercase; }
.panel__title:first-child { margin-top: 0; }

.grid { display: grid; gap: 8px; }
.grid--intervals { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.chip, .btn, .select {
  font: inherit;
  color: var(--khaki);
  background: transparent;
  border: 2px solid var(--khaki);
  min-height: 48px;
  cursor: pointer;
}
.chip { padding: 8px 10px; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.chip__name { font-weight: 700; }
.chip__sub { font-size: 13px; color: var(--khaki-faint); }
.chip[aria-pressed="true"] { background: var(--signal); color: var(--olive-deep); border-color: var(--signal); }
.chip[aria-pressed="true"] .chip__sub { color: var(--olive-deep); }
#directions .chip { align-items: center; justify-content: center; font-weight: 700; }

.select { width: 100%; max-width: 320px; padding: 0 10px; background: var(--olive-deep); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.btn { padding: 0 22px; font-family: var(--head); text-transform: uppercase; letter-spacing: 0.06em; }
.btn--go { background: var(--signal); color: var(--olive-deep); border-color: var(--signal); font-size: 20px; padding: 0 36px; min-height: 60px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.is-playing .btn--go { opacity: 0.7; }

.chip:focus-visible, .btn:focus-visible, .select:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
}

.readout { margin: 16px 0 0; min-height: 1.5em; font-size: 18px; color: var(--khaki); }
.hint { margin: 0; color: var(--khaki-dim); }
.footnote { color: var(--khaki-dim); font-size: 14px; max-width: 70ch; }

/* ---------- Game (stage 1) ---------- */
a { color: inherit; }
.muted { color: var(--khaki-dim); }
.note { border: 2px dashed var(--khaki-dim); padding: 10px 14px; margin: 14px 0 0; }
.note--good { border-color: var(--signal); color: var(--signal); }

.head--row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.tally { border: 2px solid var(--khaki); background: var(--olive-dark); padding: 8px 14px; display: flex; flex-direction: column; }
.tally__label { font-size: 13px; color: var(--khaki-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.tally__value { display: flex; align-items: center; gap: 6px; font-family: var(--head); font-size: 22px; }

.stars { display: inline-flex; gap: 3px; vertical-align: middle; }
.star path { fill: none; stroke: var(--khaki-faint); stroke-width: 1.6; }
.star--on path { fill: var(--signal); stroke: var(--signal); }

.sector { margin-bottom: 28px; }
.sector__title { font-family: var(--head); font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 120px; padding: 14px;
  border: 2px solid var(--khaki); background: var(--olive-dark); text-decoration: none; color: var(--khaki);
}
a.card:hover { background: #46501f; }
a.card:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.card--next { border: 3px solid var(--signal); }
.card--locked { border-style: dashed; border-color: var(--khaki-dim); color: var(--khaki-dim); background: transparent; }
.card__id { font-family: var(--head); font-size: 26px; line-height: 1; }
.card__title { font-weight: 700; }
.card__lock { font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; margin-top: auto; }
.card .stars { margin-top: auto; }
.card__flag { position: absolute; top: 10px; right: 10px; background: var(--signal); color: var(--olive-deep); font-size: 12px; font-weight: 700; padding: 2px 8px; text-transform: uppercase; letter-spacing: 0.1em; }

.briefing__kicker { margin: 0; color: var(--signal); letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
.briefing h1, .results h1 { margin-top: 8px; }
.briefing__answers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.tag { border: 2px solid var(--khaki); padding: 2px 10px; font-weight: 700; }
.briefing__best { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn--ghost { font-family: var(--mono); text-transform: none; letter-spacing: 0; }
.btn--small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.actions--end { justify-content: flex-end; }

/* Radio check */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar__progress { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.topbar__count { font-size: 14px; color: var(--khaki-dim); }
.topbar__mission { font-size: 14px; color: var(--khaki-dim); }
.blocks { display: flex; gap: 4px; }
.block { width: 22px; height: 12px; border: 1.5px solid var(--khaki-faint); }
.block--right { background: var(--khaki); border-color: var(--khaki); }
.block--half { background: linear-gradient(90deg, var(--khaki) 50%, transparent 50%); border-color: var(--khaki); }
.block--miss { border-color: var(--khaki-faint); background: repeating-linear-gradient(45deg, transparent 0 3px, var(--khaki-faint) 3px 4px); }
.block--now { background: var(--signal); border-color: var(--signal); }

.radio { display: flex; border: 2px solid var(--khaki); background: #353B1A; min-height: 170px; }
.replay {
  flex: 0 0 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--signal); color: var(--olive-deep); border: none; border-right: 2px solid var(--khaki);
  font-family: var(--head); text-transform: uppercase; letter-spacing: 0.06em; font-size: 16px; cursor: pointer;
}
.replay:disabled { opacity: 0.6; cursor: default; }
.replay:focus-visible { outline: 3px solid var(--khaki); outline-offset: -6px; }
.replay__icon { width: 0; height: 0; border-top: 18px solid transparent; border-bottom: 18px solid transparent; border-left: 30px solid var(--olive-deep); margin-left: 8px; }
.radio__screen { flex: 1; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.radio__label { font-size: 13px; letter-spacing: 0.14em; color: var(--signal); text-transform: uppercase; }
.lamps { display: flex; justify-content: center; align-items: center; gap: clamp(28px, 8vw, 90px); flex: 1; padding: 6px 0; }
.lamp { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lamp__light { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--khaki-dim); background: #2A2E12; transition: background 0.08s, box-shadow 0.08s; }
.lamp__label { font-size: 13px; color: var(--khaki-dim); letter-spacing: 0.1em; text-transform: uppercase; }
.lamp--on .lamp__light { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 18px rgba(242, 193, 78, 0.7); }
.lamp--on .lamp__label { color: var(--signal); }
@media (max-width: 560px) { .lamp__light { width: 44px; height: 44px; } }

.prompt { font-size: clamp(24px, 4.5vw, 34px); margin: 24px 0 14px; }
.crates { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.crates--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.crates--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .crates--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 480px) { .crates--3 { grid-template-columns: 1fr; } }
.crate {
  min-height: 110px; padding: 14px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  background: var(--olive-dark); color: var(--khaki); border: 2px solid var(--khaki); cursor: pointer; font: inherit; text-align: left;
}
.crate:disabled { cursor: default; }
.crate:not(:disabled):hover { background: #46501f; }
.crate:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.crate__tag { font-size: 13px; color: var(--khaki-dim); }
.crate__label { font-family: var(--head); font-size: clamp(20px, 3.4vw, 26px); text-transform: uppercase; letter-spacing: 0.02em; }
.crate--right { background: var(--signal); color: var(--olive-deep); border-color: var(--signal); }
.crate--right .crate__tag { color: var(--olive-deep); }
.crate--reveal { border: 3px solid var(--signal); box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.25); }
.crate--reveal:not(:disabled) { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: 0 0 0 7px rgba(242, 193, 78, 0.35); } }
@media (prefers-reduced-motion: reduce) { .crate--reveal:not(:disabled) { animation: none; } }
.crate--wrong { opacity: 0.45; border-style: dashed; }
.crate--removed { visibility: hidden; }
.feedback { min-height: 1.6em; font-size: 18px; margin: 16px 0 0; }

/* Results */
.results__stars { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 12px 0; }
.results__label { font-family: var(--head); font-size: 28px; text-transform: uppercase; }
.results__score { font-size: 20px; margin: 0; }
.results__tricky { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .topbar__progress { order: 3; width: 100%; align-items: flex-start; }
  .replay { flex-basis: 96px; font-size: 14px; }
  .radio { min-height: 130px; }
  .crate { min-height: 76px; }
  .wrap { padding-top: 20px; }
}


.feedback--old { opacity: 0.55; }
.radio__screen { position: relative; }
/* Caption floats over the bottom of the radio panel so it never moves anything. */
.radio__caption { position: absolute; top: 14px; right: 18px; font-size: 13px; letter-spacing: 0.08em; color: var(--khaki); text-align: right; pointer-events: none; }

.test-switch { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 10px 14px; border: 2px dashed var(--signal); color: var(--signal); font-size: 15px; cursor: pointer; width: fit-content; }
.test-switch input { width: 22px; height: 22px; accent-color: #F2C14E; }

.actions--split { justify-content: space-between; align-items: center; }
.diff[hidden] { display: none; }
.crate--playing { outline: 4px solid var(--signal); outline-offset: 2px; }

@media (max-width: 560px) { .radio__caption { top: auto; bottom: 6px; font-size: 12px; } }

/* ---- Recon: keyboard ---- */
.block:not(.block--recon) + .block--recon { margin-left: 10px; }
.block--recon { width: 16px; border-radius: 6px; }
.stage[hidden], .intro[hidden], .radio[hidden], .confirm[hidden], .intel[hidden] { display: none; }
.actions__right { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }

.kb {
  --whites: 11;
  position: relative;
  display: flex;
  height: clamp(150px, 26vw, 210px);
  padding: 10px 10px 12px;
  background: var(--olive-deep);
  border: 2px solid var(--khaki-faint);
  border-radius: 10px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.key { cursor: pointer; padding: 0; font: inherit; -webkit-tap-highlight-color: transparent; transition: background 0.08s; }
.key:disabled { cursor: default; }
.key:focus-visible { outline: 3px solid var(--signal); outline-offset: -3px; z-index: 3; }
.key--white {
  flex: 1 1 0;
  min-width: 0;
  margin: 0 1px;
  background: var(--khaki);
  border: 1px solid #8f8c70;
  border-radius: 0 0 6px 6px;
  position: relative;
}
.key--black {
  position: absolute;
  top: 10px;
  z-index: 2;
  --pad: 10px;
  left: calc(var(--pad) + (100% - 2 * var(--pad)) * var(--pos, 0));
  width: calc((100% - 2 * var(--pad)) / var(--whites) * 0.6);
  height: 60%;
  background: #1c1f0b;
  border: 1px solid #000;
  border-radius: 0 0 4px 4px;
}
.key--white.key--playing { background-color: #fff6d6; }
.key--black.key--playing { background-color: #4a4f26; }

/* Note 1: a yellow dot, never a label */
.key--start::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: var(--signal);
  border: 2px solid var(--olive-deep);
}
.key--black.key--start::after { bottom: 8px; width: 12px; height: 12px; margin-left: -6px; }

.key--selected { box-shadow: inset 0 0 0 4px var(--olive); }
.key--white.key--selected { background-color: #d6d0ad; }
.key--black.key--selected { box-shadow: inset 0 0 0 3px var(--khaki); }
.key--wrong { background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(120, 30, 20, 0.35) 5px 7px); }
.key--right, .key--white.key--right, .key--black.key--right { background: var(--signal); }
.key--black.key--wrong { background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(232, 226, 200, 0.4) 5px 7px); }
.key--hint, .key--reveal { box-shadow: inset 0 0 0 4px var(--signal), 0 0 14px 3px rgba(242, 193, 78, 0.75); }
.key--white.key--hint, .key--white.key--reveal { background-color: #fbe7a6; }
.key--black.key--hint, .key--black.key--reveal { background-color: #6f6420; }
.key--reveal:not(:disabled) { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: inset 0 0 0 4px var(--signal), 0 0 22px 6px rgba(242, 193, 78, 0.9); } }
@media (prefers-reduced-motion: reduce) { .key--reveal:not(:disabled) { animation: none; } }

.kb__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.kb__legend { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 15px; color: var(--khaki-dim); }
.kb__dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--signal); }
.results__split { margin-top: -6px; }
.briefing__recon { margin: 10px 0 0; }

@media (max-width: 560px) {
  .kb { padding: 8px 6px 10px; height: 170px; }
  .key--white { margin: 0 0.5px; }
  .key--black { --pad: 6px; top: 8px; }
  .block { width: 16px; }
  .key--start::after { width: 12px; height: 12px; margin-left: -6px; bottom: 10px; }
  .block--recon { width: 12px; }
}

/* ---- Stage 3: Who's playing? ---- */
.head--center { text-align: center; }
.footnote--center { text-align: center; margin: 28px auto 0; }
.stage[hidden], .intro[hidden] { display: none; }

.avatar {
  --size: 64px;
  width: var(--size); height: var(--size); flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--khaki); border-radius: 50%; background: var(--olive-deep);
}
.avatar svg { fill: var(--signal); }
.avatar .avatar__ring { fill: none; stroke: var(--signal); stroke-width: 3; }
.avatar .avatar__cut { fill: var(--olive-deep); }
.avatar .tank { fill: var(--signal); }

.players { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 220px)); justify-content: center; gap: 18px; margin-top: 10px; }
.player { position: relative; display: flex; flex-direction: column; }
.player__btn, .player--new {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 210px; padding: 18px 12px; border: 2px solid var(--khaki); background: var(--olive-dark);
  color: var(--khaki); font: inherit; cursor: pointer; text-decoration: none;
}
.player__btn:hover, .player--new:hover { background: #46501f; }
.player__btn:focus-visible, .player--new:focus-visible, .player__edit:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.player__name { font-family: var(--head); font-size: 22px; text-transform: uppercase; letter-spacing: 0.03em; text-align: center; overflow-wrap: anywhere; }
.player__meta { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--khaki-dim); }
.player__edit { position: absolute; top: 8px; right: 8px; font-size: 14px; color: var(--khaki-dim); padding: 6px 8px; }
.player--new { border-style: dashed; }
.player__plus { font-family: var(--head); font-size: 54px; line-height: 1; color: var(--signal); }

.form { max-width: 560px; }
.form__label { display: block; margin: 0 0 8px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--signal); }
.form__label + .input { margin-bottom: 20px; }
.input {
  width: 100%; min-height: 54px; padding: 0 14px; font: inherit; font-size: 22px;
  color: var(--khaki); background: var(--olive-deep); border: 2px solid var(--khaki);
}
.input:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.badge-picks { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-pick { padding: 4px; border: 3px solid transparent; border-radius: 50%; background: none; cursor: pointer; }
.badge-pick[aria-pressed="true"] { border-color: var(--signal); }
.badge-pick:focus-visible { outline: 3px solid var(--khaki); outline-offset: 2px; }
.form__error { min-height: 1.4em; margin: 10px 0 0; color: var(--signal); }

/* ---- Field map ---- */
.who { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--khaki); padding: 4px 12px 4px 4px; border: 2px solid var(--khaki); border-radius: 30px; }
.who:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
.who__name { font-family: var(--head); text-transform: uppercase; letter-spacing: 0.04em; }

.maphead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.maphead__title { font-size: clamp(28px, 5vw, 42px); }
.maphead__nav { display: flex; gap: 8px; }
.maphead__nav .btn { min-width: 52px; font-size: 22px; }

.strip { display: flex; gap: 6px; margin: 16px 0 14px; flex-wrap: wrap; }
.strip__btn {
  width: 42px; height: 42px; font-family: var(--head); font-size: 17px; cursor: pointer;
  color: var(--khaki); background: var(--olive-dark); border: 2px solid var(--khaki);
}
.strip__btn--locked { border-style: dashed; border-color: var(--khaki-faint); color: var(--khaki-faint); background: transparent; }
.strip__btn--done { background: var(--khaki); color: var(--olive-deep); }
.strip__btn--on { outline: 3px solid var(--signal); outline-offset: 2px; }
.strip__btn:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }

.map {
  position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 340px;
  border: 2px solid var(--khaki-faint); background: rgba(42, 46, 18, 0.25); overflow: hidden;
}
.map--narrow { aspect-ratio: auto; min-height: 0; }
.map__art { position: absolute; inset: 0; width: 100%; height: 100%; }
.map__terrain ellipse { fill: none; stroke: rgba(232, 226, 200, 0.18); stroke-width: 1.5; }
.map__leg { stroke: #A9A88A; stroke-width: 2.5; stroke-dasharray: 7 7; }
.map__leg--done { stroke: var(--khaki); stroke-dasharray: none; }

.marker {
  position: absolute; transform: translate(-50%, -50%);
  width: 116px; min-height: 84px; padding: 7px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 2.5px solid var(--khaki); background: var(--olive-dark); color: var(--khaki); text-decoration: none; text-align: center;
}
a.marker:hover { background: #46501f; }
a.marker:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; z-index: 3; }
.marker__id { font-family: var(--head); font-size: 24px; line-height: 1; }
.marker__title { font-size: 12.5px; line-height: 1.2; overflow-wrap: anywhere; }
.marker--next .marker__title { font-size: 13px; }
.marker__kicker { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--khaki-dim); }
.marker--test { width: 140px; min-height: 92px; border-width: 3px; }
.marker--test .marker__id { font-size: 19px; text-transform: uppercase; }
.marker--locked { border-style: dashed; border-color: #A9A88A; color: #A9A88A; background: #3B4117; }
.marker--locked .marker__kicker { color: #A9A88A; }
.marker--next { width: 170px; min-height: 150px; border: 3px solid var(--signal); background: #4a4d1f; z-index: 2; box-shadow: 0 0 0 6px rgba(242, 193, 78, 0.12); }
.marker--next .marker__id { font-size: 28px; }
.marker__flag { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 3px 9px; background: var(--signal); color: var(--olive-deep); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; }
.marker--next .tank { margin-top: 6px; }
.marker .stars { margin-top: 2px; }

.map--narrow .marker--next { width: 160px; min-height: 130px; }
@media (max-width: 640px) {
  .marker { width: 108px; }
  .marker--test { width: 130px; }
}

.mapfoot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border: 2px solid var(--khaki); background: var(--olive-dark); min-width: min(100%, 400px); }
.status > div { padding: 8px 12px; border-right: 1px solid var(--khaki); border-bottom: 1px solid var(--khaki); }
.status > div:nth-child(2n) { border-right: none; }
.status > div:nth-last-child(-n + 2) { border-bottom: none; }
.status dt { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #A9A88A; }
.status dd { margin: 0; font-family: var(--head); text-transform: uppercase; overflow-wrap: anywhere; }
.mapfoot__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Tanks and New tank spotted ---- */
/* Tanks: blueprint (dashed outline), built (plain paint), camo, gold trim. */
.tank { overflow: visible; display: block; }
.tank * { vector-effect: non-scaling-stroke; }
.tank__track { fill: #23260f; stroke: #14160a; stroke-width: 1.2; }
.tank__tyre { fill: #3a3f1c; stroke: #14160a; stroke-width: 1; }
.tank__spoke { stroke: #14160a; stroke-width: 1; }
.tank__gun { fill: #2c301a; stroke: #14160a; stroke-width: 1; }
.tank__hull { fill: #a8a99f; stroke: #14160a; stroke-width: 1.3; stroke-linejoin: round; }
.tank__skirt { fill: #9c9d93; stroke: #14160a; stroke-width: 1.2; }
.tank__strut { stroke: #14160a; stroke-width: 2.5; }
.tank__outline * { fill: none; stroke: #14160a; stroke-width: 1.3; stroke-linejoin: round; }
/* Classified: a sealed crate with a stamp, until the mission is passed. */
.tank--classified .crate__box { fill: #3a3f1a; stroke: var(--khaki-faint); stroke-width: 1.6; }
.tank--classified .crate__plank, .tank--classified .crate__brace { stroke: rgba(232, 226, 200, 0.28); stroke-width: 1.4; }
.tank--classified .crate__stamp { fill: rgba(42, 46, 18, 0.7); stroke: #d9604c; stroke-width: 2.2; }
.tank--classified .crate__word { fill: #e0705b; font-family: var(--head); font-size: 15px; letter-spacing: 2px; }
.tank__gold-line { fill: none; stroke: #f2c94c; stroke-width: 2; stroke-linejoin: round; }
.tank__gold-stripe { stroke: #f2c94c; stroke-width: 2.4; }
.tank__gold-fill { fill: #f2c94c; stroke: #a07b12; stroke-width: 0.8; }
.tank__mast { stroke: #14160a; stroke-width: 1.6; }
.tank__flag { fill: var(--signal); stroke: #8a6a12; stroke-width: 0.8; }
.tank__wheel { transform-box: fill-box; transform-origin: center; }

.arrivals { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 18px; }
.arrival { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px 14px; border: 3px solid var(--signal); background: rgba(242, 193, 78, 0.08); position: relative; min-width: 190px; }
.arrival__flag { position: absolute; top: -13px; padding: 3px 10px; background: var(--signal); color: var(--olive-deep); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.arrival__name { font-family: var(--head); text-transform: uppercase; text-align: center; }
.arrival__sub { font-size: 14px; }
.arrival__badge { display: flex; align-items: center; justify-content: center; width: 86px; height: 86px; border: 3px solid var(--khaki); border-radius: 50%; font-family: var(--head); font-size: 22px; color: var(--signal); margin: 6px 0; }
.intro-card .arrival { margin: 22px 0 18px; width: fit-content; min-width: 240px; }
.intro-card .kb { margin-top: 16px; }

/* ---- Play screen extras ---- */
.lamps--many { gap: clamp(10px, 3vw, 36px); }
.lamps--many .lamp__light { width: 48px; height: 48px; }
@media (max-width: 560px) { .lamps--many .lamp__light { width: 32px; height: 32px; } .lamps--many .lamp__label { font-size: 11px; } }
.crates--route .crate__label { font-size: clamp(28px, 5vw, 38px); letter-spacing: 0.12em; }

.slots { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.slot {
  width: 54px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px dashed var(--khaki-faint); font-family: var(--head); font-size: 18px; color: var(--khaki-dim);
}
.slot--home { width: auto; padding: 0 10px; border: 2px solid var(--signal); color: var(--signal); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--mono); }
.slot--filled { border-style: solid; border-color: var(--khaki); color: var(--khaki); background: var(--olive-dark); }
.slot--wrong { border-color: #c98b6b; background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(201, 139, 107, 0.35) 5px 7px); }
.slot--right { background: var(--signal); border-color: var(--signal); color: var(--olive-deep); }
.slots__undo { margin-left: auto; }
.results__rank { margin-top: 6px; }

/* ---- Stage 4: Today's mission, warm-ups, Skip ahead, streak ---- */
.status > .status__wide { grid-column: 1 / -1; border-right: none; }
.status--five > div:nth-last-child(2) { border-bottom: 1px solid var(--khaki); }

.todos { list-style: none; padding: 0; margin: 18px 0 6px; display: grid; gap: 10px; }
.todo { display: flex; gap: 14px; align-items: center; border: 2px dashed var(--khaki-dim); padding: 10px 14px; background: var(--olive-dark); }
.todo--now { border-style: solid; border-color: var(--signal); }
.todo--done { opacity: 0.75; }
.todo__num { flex: none; width: 34px; height: 34px; border: 2px solid currentColor; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); }
.todo--now .todo__num { color: var(--signal); }
.todo__body { display: grid; }
.todo__title { font-family: var(--head); text-transform: uppercase; letter-spacing: 0.03em; }
.todo__sub { font-size: 14px; }

.skipban { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 16px; border-color: var(--signal); }
.skipban__text { margin: 0; }
.skipban__text strong { color: var(--signal); }

.marker__skipped { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--khaki-dim); }
.test-switch input[type="date"] { width: auto; height: auto; font: inherit; padding: 2px 6px; }

/* ======================================================================
   Stage 5: tanks everywhere, Motor Pool, celebrations, break games
   ====================================================================== */
.avatar .tank * { fill: var(--signal) !important; stroke: var(--olive-deep) !important; }
.marker .tank { margin: 2px auto 0; }
.marker--locked .tank { opacity: 0.6; }

/* Briefing: the tank this mission earns */
.earns { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px 14px; border: 3px solid var(--khaki); background: rgba(42, 46, 18, 0.35); position: relative; min-width: 220px; color: var(--khaki); text-decoration: none; }
.earns:hover { background: rgba(42, 46, 18, 0.6); }
.earns__kicker { position: absolute; top: -13px; padding: 3px 10px; background: var(--khaki); color: var(--olive-deep); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.earns__name { font-family: var(--head); text-transform: uppercase; text-align: center; }
.earns__sub { font-size: 14px; text-align: center; }

/* Field map: Motor Pool bar, break banner */
.poolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.poolbar__btn { display: inline-flex; align-items: center; gap: 10px; padding: 4px 16px 4px 8px; text-decoration: none; font-family: var(--head); text-transform: uppercase; letter-spacing: 0.04em; }
.breakban { border-color: var(--signal); background: rgba(242, 193, 78, 0.1); }
.test-link { color: var(--signal); margin-right: 12px; }

/* Results: the lane the tank drives through */
.results__best { padding: 4px 10px; background: var(--signal); color: var(--olive-deep); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 14px; }
.lanewrap { margin: 6px 0 14px; }
.lane { position: relative; height: 112px; overflow: hidden; border-bottom: 3px solid #5d6230; display: flex; align-items: flex-end; justify-content: center; }
.lane__tank, .lane__parked { position: relative; }
.lane__parked { animation: lane-in 0.3s ease-out; }
.lane__layers { position: relative; }
.lane__over { position: absolute; inset: 0; }
.lane__dust { position: absolute; left: 6px; bottom: 2px; width: 46px; height: 22px; border-radius: 50%; background: radial-gradient(closest-side, rgba(201, 198, 168, 0.55), rgba(201, 198, 168, 0)); opacity: 0; }
.driving .lane__dust { animation: dust 0.5s ease-out infinite; }
.driving .tank__wheel { animation: wheel-turn 0.45s linear infinite; }
.lane__column { position: absolute; left: 50%; bottom: 0; display: flex; align-items: flex-end; gap: 18px; white-space: nowrap; }
.lane--parade { height: 130px; }
.lane__caption { margin: 8px 0 0; text-align: center; font-family: var(--head); text-transform: uppercase; letter-spacing: 0.04em; min-height: 1.4em; }
.lane__badges { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.lane__badge { display: inline-block; padding: 6px 14px; border: 3px solid var(--signal); color: var(--signal); font-family: var(--head); text-transform: uppercase; letter-spacing: 0.06em; }
.lane__badge--promo { background: var(--signal); color: var(--olive-deep); }
@keyframes wheel-turn { to { transform: rotate(360deg); } }
@keyframes dust { 0% { opacity: 0.8; transform: translateX(0) scale(0.6); } 100% { opacity: 0; transform: translateX(-30px) scale(1.4); } }
@keyframes lane-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .driving .tank__wheel, .driving .lane__dust, .lane__parked { animation: none; }
}

/* Motor Pool */
.pool__status { margin-bottom: 20px; }
.awards { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.medal { --size: 34px; display: inline-flex; align-items: center; justify-content: center; width: var(--size); height: var(--size); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe9a0, #d9a426 60%, #a07612); border: 2px solid #6e5210; color: var(--olive-deep); font-family: var(--head); font-size: calc(var(--size) * 0.42); box-shadow: 0 2px 0 #2a2e12; }
.ribbon { display: inline-block; padding: 4px 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; border-left: 8px solid; }
.ribbon--perfect { background: #7a2b25; color: #f6e7c8; border-color: var(--signal); }
.ribbon--streak { background: #24406b; color: #e7eef8; border-color: #e7eef8; }
.pool__sector { margin: 26px 0; }
.pool__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--khaki-faint); padding-bottom: 6px; margin-bottom: 12px; }
.pool__title { margin: 0; font-family: var(--head); font-size: 18px; text-transform: uppercase; letter-spacing: 0.04em; }
.pool__years { font-size: 14px; }
.pool__sector--locked { opacity: 0.75; }
.pool__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.bay { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border: 2px solid var(--khaki); background: var(--olive-dark); color: var(--khaki); text-decoration: none; text-align: center; }
.bay:hover { background: #46501f; }
.bay:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.bay--classified { border-style: dashed; border-color: var(--khaki-faint); background: rgba(42, 46, 18, 0.3); }
.bay--test { border-width: 3px; }
.bay__name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.bay__meta { font-size: 13px; display: flex; align-items: center; gap: 6px; }

/* Fact card */
.factcard__art { display: flex; justify-content: center; margin: 8px 0 12px; }
.factcard__art .tank { width: min(100%, 420px); height: auto; }
.factcard__meta { font-family: var(--head); text-transform: uppercase; letter-spacing: 0.04em; margin: 12px 0 6px; }
.facts { margin: 0; padding-left: 1.2em; }
.facts li { margin: 6px 0; }
.ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 0; margin: 10px 0; list-style: none; }
.ladder__item { display: flex; }
.ladder__step { flex: 1; font: inherit; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 2px dashed var(--khaki-faint); color: var(--khaki-faint); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; text-align: center; }
.ladder__step--on { border-style: solid; border-color: var(--khaki); color: var(--khaki); }
.ladder__step--now { border-color: var(--signal); color: var(--signal); background: rgba(242, 193, 78, 0.08); }
.ladder__sub { font-size: 11px; text-transform: none; letter-spacing: 0; }

/* Break games */
.game__prompt { font-family: var(--head); text-transform: uppercase; letter-spacing: 0.03em; font-size: 18px; margin: 0 0 12px; min-height: 1.4em; }
.game__count { margin: 12px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip--small { min-height: 40px; padding: 6px 12px; flex-direction: row; font-weight: 700; }
.actions--end { justify-content: flex-end; }
.crates--5 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-top: 14px; }
.sky { position: relative; height: 260px; border: 2px solid var(--khaki-faint); background: linear-gradient(#1d2110, #2f3416 70%, #3E4519); overflow: hidden; }
.sky__done { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; margin: 0; }
.flare { position: absolute; width: 64px; height: 64px; margin-left: -32px; border: none; background: transparent; padding: 0; cursor: pointer; transform: translateY(260px); opacity: 0; }
.flare--up { transform: translateY(0); opacity: 1; transition: transform 0.7s cubic-bezier(.2,.8,.3,1), opacity 0.3s; }
.flare__glow { display: block; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle, #fff6cf 0, var(--signal) 30%, rgba(242, 193, 78, 0.35) 55%, rgba(242, 193, 78, 0) 72%); }
.flare:disabled { cursor: default; }
.flare:focus-visible { outline: 3px solid var(--khaki); }
.flare--ping .flare__glow { transform: scale(1.25); transition: transform 0.15s; }
.flare--burst .flare__glow { background: radial-gradient(circle, #ffffff 0, #9fe08a 30%, rgba(159, 224, 138, 0.35) 55%, rgba(159, 224, 138, 0) 72%); transform: scale(1.3); transition: transform 0.2s; }
@media (prefers-reduced-motion: reduce) { .flare--up { transition: opacity 0.3s; } }
.relay__dots { display: flex; gap: 8px; margin: 0 0 12px; min-height: 18px; }
.relay__dots--big .relay__dot { width: 22px; height: 22px; }
.relay__dot { width: 16px; height: 16px; border: 2px solid var(--khaki); border-radius: 50%; }
.relay__dot--on { background: var(--signal); border-color: var(--signal); }
.calls { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }

/* Sound effects switch, in the corner on every screen */
body { padding-bottom: 40px; }
.fxswitch { position: fixed; right: 10px; bottom: 10px; z-index: 20; font: inherit; font-size: 13px; padding: 6px 10px; color: var(--khaki); background: var(--olive-deep); border: 2px solid var(--khaki-faint); cursor: pointer; }
.fxswitch[aria-pressed="false"] { color: var(--khaki-faint); border-style: dashed; }
[hidden] { display: none !important; }
.crates--5 .crate { min-height: 64px; padding: 8px 6px; }
.crates--5 .crate__label { font-size: 16px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  body { padding-bottom: 0; }
  .fxswitch { position: static; display: block; margin: 0 auto 24px; }
  .pool__grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .bay .tank { width: 130px; height: auto; }
}
.lane__again { display: block; margin: 10px auto 0; }
button.ladder__step { cursor: pointer; font-size: 13px; }
button.ladder__step:hover { background: rgba(232, 226, 200, 0.08); }
button.ladder__step:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.factcard__art { overflow: hidden; }
.factcard__drive { display: block; margin: -4px auto 12px; }
.tank__body--gloss .tank__hull { filter: brightness(1.12) saturate(1.1); }

/* ---- Field map: arrows in the sector strip; wide two-column layout ---- */
.navrow { display: flex; align-items: center; gap: 8px; margin: 10px 0 12px; }
.navrow .strip { margin: 0; flex: 1; min-width: 0; }
.navrow__arrow { min-width: 48px; font-size: 22px; flex: none; }
.fieldmap .maphead { display: block; }
.fieldmap .maphead__title { margin: 2px 0 0; }
.fieldmap__side { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.sideacts { display: flex; flex-wrap: wrap; gap: 12px; }
.fieldmap__side .skipban, .fieldmap__side .breakban { margin: 0; }
.status--side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.status--side > div:last-child { grid-column: 1 / -1; border-right: none; }

.wrap--wide { max-width: 1340px; }
@media (min-width: 900px) {
  .wrap--wide { padding-top: 12px; padding-bottom: 16px; }
  .wrap--wide .topbar { margin-bottom: 4px; }
  .fieldmap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
  .fieldmap .maphead__title { font-size: clamp(26px, 3.2vw, 38px); }
  /* The map takes whatever height is left on the screen. */
  .fieldmap .map:not(.map--narrow) { aspect-ratio: auto; height: clamp(330px, calc(100dvh - 232px), 660px); min-height: 0; }
  .fieldmap__side { margin-top: 0; padding-top: 4px; }
  .sideacts { flex-direction: column; }
  .sideacts .btn { width: 100%; justify-content: center; text-align: center; }
  .poolbar__btn { justify-content: center; }
  .status--side { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
  .fieldmap__side .skipban { flex-direction: column; align-items: stretch; text-align: center; }
}
@media (max-width: 640px) {
  /* Phones: arrows on their own row (left and right), the strip below. */
  .navrow { display: grid; grid-template-columns: auto 1fr auto; row-gap: 10px; }
  .navrow .strip { grid-column: 1 / -1; grid-row: 2; }
  .navrow__arrow:last-child { grid-column: 3; grid-row: 1; }
}
.intro-card__head { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 16px; }
.intro-card__head .arrival { min-width: 150px; padding: 16px 14px 10px; margin-top: 10px; }
.intro-card__head .arrival__badge { width: 64px; height: 64px; margin: 2px 0; }
.intro-card__head { margin-bottom: 8px; }
.intro-card .kb { margin-top: 8px; height: clamp(140px, min(26vw, calc(100dvh - 540px)), 210px); }
.mainbtn { flex-direction: column; gap: 2px; padding-top: 10px; padding-bottom: 10px; min-height: 72px; text-align: center; }

/* The keyboard keeps piano proportions: white keys about 1 wide to 4 tall,
   so a wide screen centres a keyboard instead of stretching its keys. */
.kb { width: 100%; max-width: calc(var(--whites) * 54px + 24px); margin-left: auto; margin-right: auto; }
@media (max-width: 560px) { .kb { max-width: calc(var(--whites) * 46px + 16px); } }
/* A tapped or focused white key never rises above the black keys. */
.key--white:focus-visible { z-index: 1; outline-offset: -4px; }
