/* Go/No-Go — shared styles.
   The look is a grader's scorecard (DA Form 705): paper, black stencil, a GO stamp in
   green ink and a NO-GO stamp in red. Dark theme is the same card at night.
   Fonts are self-hosted so the native bundle works in Airplane Mode. */
@font-face { font-family: "Black Ops One"; src: url(/fonts/BlackOpsOne.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url(/fonts/IBMPlexSans-400.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url(/fonts/IBMPlexSans-600.woff) format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/fonts/IBMPlexMono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #f2eee3;
  --card: #faf8f1;
  --ink: #191a14;
  --muted: #6b6a5d;
  --rule: #cdc7b3;
  --rule-strong: #191a14;
  --coyote: #9a7b47;
  --coyote-ink: #7a5f30;
  --go: #2e7d32;
  --go-ink: #f2eee3;
  --nogo: #b3261e;
  --nogo-ink: #f2eee3;
  --tint: #e9e4d3;
  --tint-go: #e2eddf;
  --tint-nogo: #f1dcd9;
  --shadow: 0 1px 0 rgba(25,26,20,.08), 0 8px 24px -12px rgba(25,26,20,.25);
  --tab-h: 62px;
  --stencil: "Black Ops One", "Impact", "Arial Black", sans-serif;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131410; --card: #1c1d17; --ink: #ebe8dc; --muted: #a4a193; --rule: #33352b; --rule-strong: #ebe8dc;
    --coyote: #c9a86a; --coyote-ink: #d8bd85; --go: #4caf50; --go-ink: #0f1a10; --nogo: #e5534b; --nogo-ink: #1a0f0e;
    --tint: #23241d; --tint-go: #1c2a1d; --tint-nogo: #2c1b19;
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131410; --card: #1c1d17; --ink: #ebe8dc; --muted: #a4a193; --rule: #33352b; --rule-strong: #ebe8dc;
  --coyote: #c9a86a; --coyote-ink: #d8bd85; --go: #4caf50; --go-ink: #0f1a10; --nogo: #e5534b; --nogo-ink: #1a0f0e;
  --tint: #23241d; --tint-go: #1c2a1d; --tint-nogo: #2c1b19;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
a { color: var(--coyote-ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--coyote); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.1; text-wrap: balance; }
h1 { font-family: var(--stencil); font-weight: 400; font-size: 30px; letter-spacing: .01em; }
h2 { font-family: var(--stencil); font-weight: 400; font-size: 20px; letter-spacing: .01em; }
h3 { font-size: 14px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
p { margin: 0 0 12px; max-width: 62ch; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--coyote-ink); }
.hidden, [hidden] { display: none !important; }

/* ---- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--paper);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 2px solid var(--rule-strong);
  display: flex; align-items: center; gap: 12px;
}
.topbar .wordmark { font-family: var(--stencil); font-size: 18px; letter-spacing: .02em; text-decoration: none; color: var(--ink); white-space: nowrap; }
.topbar .wordmark b { color: var(--go); font-weight: 400; }
.topbar .wordmark i { color: var(--nogo); font-style: normal; }
.topbar .title { margin-left: auto; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---- page */
.page { max-width: 560px; margin: 0 auto; padding: 18px 16px 24px; }
.stack { display: grid; gap: 14px; }
.stack > * { min-width: 0; }   /* a grid item's auto min-width is its content's min-content; a wide table inside would widen the whole column */
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 16px; }
.card.lift { box-shadow: var(--shadow); }
.rule { border: 0; border-top: 1px solid var(--rule); margin: 8px 0; }

/* ---- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 6px; border: 2px solid var(--rule-strong);
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 16px;
  cursor: pointer; text-decoration: none; min-height: 50px; -webkit-tap-highlight-color: transparent;
}
.btn.big { width: 100%; font-family: var(--stencil); font-weight: 400; font-size: 22px; letter-spacing: .04em; min-height: 62px; }
.btn.go { background: var(--go); border-color: var(--go); color: var(--go-ink); }
.btn.nogo { background: var(--nogo); border-color: var(--nogo); color: var(--nogo-ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.quiet { background: transparent; color: var(--muted); border-color: var(--rule); font-weight: 500; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 38px; padding: 8px 12px; font-size: 14px; }

/* ---- stamps (the whole brand in one element) */
.stamp {
  display: inline-block; font-family: var(--stencil); letter-spacing: .06em; line-height: 1;
  padding: 6px 12px; border: 3px solid currentColor; border-radius: 4px; transform: rotate(-4deg);
  text-transform: uppercase;
}
.stamp.go { color: var(--go); }
.stamp.nogo { color: var(--nogo); }
.stamp.xl { font-size: 44px; padding: 10px 18px; border-width: 5px; }
.stamp.md { font-size: 22px; }
.stamp.sm { font-size: 13px; padding: 3px 7px; border-width: 2px; transform: none; }

/* ---- forms */
label.field { display: grid; gap: 6px; }
label.field > span { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
input, select {
  font: inherit; color: var(--ink); background: var(--card); border: 1.5px solid var(--rule); border-radius: 6px;
  padding: 12px 12px; width: 100%; min-width: 0; min-height: 48px;
}
label.field, .seg, .seg button { min-width: 0; }
.seg button { white-space: normal; line-height: 1.2; }
input.mono { font-family: var(--mono); font-size: 20px; }
input:focus, select:focus { border-color: var(--coyote); outline: none; }
.seg { display: flex; border: 1.5px solid var(--rule-strong); border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; padding: 11px 6px; background: transparent; border: 0; border-right: 1.5px solid var(--rule-strong); font-weight: 600; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---- scorecard table (DA 705 vibe) */
.scorecard { width: 100%; border-collapse: collapse; }
.scorecard th, .scorecard td { padding: 10px 6px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.scorecard th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--rule-strong); font-weight: 600; }
.scorecard td.pts { font-family: var(--stencil); font-size: 24px; text-align: right; width: 64px; }
.scorecard td.pts.fail { color: var(--nogo); }
.scorecard td.raw { font-family: var(--mono); font-size: 17px; }
.scorecard tr.total td { border-top: 2px solid var(--rule-strong); border-bottom: 0; font-weight: 600; }
.scorecard tr.total td.pts { font-size: 34px; }

/* ---- big numbers */
.bignum { font-family: var(--stencil); font-size: 96px; line-height: 1; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.bigtime { font-family: var(--mono); font-size: 64px; line-height: 1; font-variant-numeric: tabular-nums; }

/* ---- tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 2px solid var(--rule-strong);
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.tabbar a { display: grid; place-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.tabbar a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .dot { width: 18px; height: 3px; background: var(--go); border-radius: 2px; }
.tabbar a .dot { width: 18px; height: 3px; background: transparent; border-radius: 2px; }

/* ---- grader view */
.stage { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 3 / 4; border: 2px solid var(--rule-strong); }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage video.mirror, .stage canvas.mirror { transform: scaleX(-1); }
.stage .hud { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; padding: 12px; pointer-events: none; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.stage .hud .count { font-family: var(--mono); font-weight: 500; font-size: 128px; line-height: 1; text-align: center; align-self: center; font-variant-numeric: tabular-nums; }
.stage .hud .clock { font-family: var(--mono); font-size: 22px; }
.stage .hud .top { display: flex; justify-content: space-between; align-items: flex-start; }
.stage .hud .bottom { display: flex; justify-content: space-between; align-items: flex-end; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.stage .hud .flash { position: absolute; left: 50%; top: 22%; transform: translateX(-50%) rotate(-6deg); opacity: 0; transition: opacity .15s; }
.stage .hud .flash.on { opacity: 1; }
.stage .hud .flash .stamp { background: rgba(0,0,0,.45); }
.stage .hud .flash .why { margin-top: 8px; text-align: center; font-size: 14px; font-weight: 600; background: rgba(0,0,0,.55); padding: 6px 10px; border-radius: 4px; }
.reasons { display: grid; gap: 8px; }
.reasons .r { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-left: 3px solid var(--nogo); background: var(--tint-nogo); border-radius: 0 4px 4px 0; font-size: 14px; }
.reasons .r .n { font-family: var(--mono); color: var(--muted); }

/* ---- misc */
.pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; background: var(--tint); color: var(--muted); }
.pill.go { background: var(--tint-go); color: var(--go); }
.pill.nogo { background: var(--tint-nogo); color: var(--nogo); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.list li:last-child { border-bottom: 0; }
.note { font-size: 13px; color: var(--muted); border-left: 2px solid var(--coyote); padding-left: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 6px; font-size: 14px; z-index: 40; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
