/* ClubDRS umpire app. Sightscreen white, pitch green for actions, ball orange for the track.
   System fonts only (offline): Bahnschrift (Windows DIN) for numbers and headings, Segoe UI for text. */
:root {
  --ground: #ffffff;
  --panel: #eef2ec;
  --line: #b9c4bb;
  --ink: #000000;
  --ink-2: #33433a;
  --act: #0a5c36;
  --act-ink: #ffffff;
  --track: #e2580b;
  --impact: #1747c2;
  --out: #a3101a;
  --notout: #12346b;
  --call-bg: #fff0c2;
  --call-ink: #6b4500;
  --hit-bg: #fde3e3;
  --hit-ink: #8f0d16;
  --miss-bg: #dcefe3;
  --miss-ink: #0a4d2c;
  --gap: 16px;
  --display: Bahnschrift, "DIN Alternate", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --text: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light only;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body { font: 18px/1.4 var(--text); min-height: 100vh; }
h1, h2 { font-family: var(--display); font-weight: 600; margin: 0; line-height: 1.1; }
h1 { font-size: 34px; }
h2 { font-size: 24px; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--impact); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.sub { color: var(--ink-2); margin-top: 6px; }
.hint { color: var(--ink-2); font-size: 17px; margin-top: 10px; }

/* header */
.bar { display: flex; align-items: center; gap: 24px; padding: 0 24px; min-height: 68px; border-bottom: 3px solid var(--ink); background: var(--ground); }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .name { font-family: var(--display); font-weight: 700; font-size: 26px; }
.brand .role { font-size: 18px; color: var(--ink-2); }
.match { font-size: 18px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clock { font-family: var(--display); display: flex; align-items: baseline; gap: 8px; }
#clock-time { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock-of { font-size: 18px; color: var(--ink-2); }
.clock.late #clock-time { color: var(--out); }
.middle { display: flex; flex-direction: column; align-items: flex-start; padding: 4px 0 4px 14px; border-left: 6px solid var(--ink); min-width: 200px; margin: 8px 0; }
.middle-label { font-size: 16px; color: var(--ink-2); }
.middle-state { font-family: var(--display); font-weight: 700; font-size: 20px; }
.who { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.link { background: none; border: 0; color: var(--act); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; }

.notice { margin: 12px 24px 0; padding: 14px 18px; border: 3px solid var(--out); background: var(--hit-bg); color: var(--hit-ink); font-weight: 600; border-radius: 6px; }

main { padding: 20px 24px 32px; }

/* buttons */
.btn { font: 600 20px/1.1 var(--text); min-height: 56px; padding: 0 22px; border-radius: 6px; border: 2px solid var(--ink); background: var(--ground); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:disabled { cursor: not-allowed; border-color: var(--line); color: #5f6b63; background: var(--panel); }
.btn.primary { background: var(--act); border-color: var(--act); color: var(--act-ink); }
.btn.primary:disabled { background: var(--panel); border-color: var(--line); color: #5f6b63; }
.btn.quiet { border-color: var(--line); color: var(--ink-2); font-size: 18px; min-height: 48px; }
.btn.small.quiet { font-size: 18px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* name */
.name-form { max-width: 620px; margin: 48px auto; display: grid; gap: 12px; }
.name-form label { font-weight: 600; margin-top: 12px; }
.row { display: flex; gap: 12px; }
input { font: 22px var(--text); min-height: 56px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 6px; flex: 1; min-width: 0; color: var(--ink); background: var(--ground); }

/* balls */
.balls-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 32px; align-items: start; }
.balls { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.ball { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 18px; padding: 12px 18px; min-height: 84px; border: 2px solid var(--line); border-radius: 6px; background: var(--ground); cursor: pointer; width: 100%; text-align: left; font: inherit; color: inherit; }
.ball:hover { border-color: var(--ink); }
.allow { margin-top: 14px; font-size: 18px; color: var(--ink-2); }
.allow.none { color: var(--hit-ink); font-weight: 700; }
.ball[aria-pressed="true"] { border: 3px solid var(--act); background: var(--miss-bg); }
.ball[aria-pressed="true"] .ball-state::before { content: "Selected"; display: block; color: var(--act); }
.ball-over { font-family: var(--display); font-weight: 700; font-size: 38px; font-variant-numeric: tabular-nums; }
.ball-label { font-size: 18px; }
.ball-meta { color: var(--ink-2); font-size: 17px; }
.ball-state { font-weight: 600; font-size: 17px; text-align: right; }
.side { background: var(--panel); border-radius: 6px; padding: 20px; display: grid; gap: 12px; align-content: start; }
.pick-ball { font-family: var(--display); font-size: 28px; font-weight: 700; }
.q { font-weight: 600; margin-top: 4px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-btn[aria-checked="true"] { background: var(--ink); color: var(--ground); }
.choice.big .choice-btn { min-height: 72px; font-family: var(--display); font-size: 30px; font-weight: 700; }
.choice.big .out[aria-checked="true"] { background: var(--out); border-color: var(--out); color: #fff; }
.choice.big .notout[aria-checked="true"] { background: var(--notout); border-color: var(--notout); color: #fff; }
.sent-h { margin-top: 18px; }
.sent-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 17px; }

/* evidence */
.ev-grid { display: grid; grid-template-columns: minmax(0, 748px) minmax(360px, 1fr); gap: 24px; align-items: start; }
.viewer-col { display: grid; gap: 10px; min-width: 0; }
.viewer-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.seg-btn { font: 600 17px var(--text); min-height: 48px; padding: 0 16px; border: 0; background: var(--ground); color: var(--ink); cursor: pointer; }
.seg-btn + .seg-btn { border-left: 2px solid var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.viewer { position: relative; background: #000; border: 2px solid var(--ink); aspect-ratio: 4 / 3; width: 100%; max-width: 748px; }
.viewer canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.viewer.tap canvas { cursor: crosshair; }
.viewer.small { max-width: 560px; }
.dec-back { display: flex; gap: 10px; flex-wrap: nowrap; }
#dec-title { white-space: nowrap; font-size: 28px; }
@media (max-width: 900px) { .dec-back { flex-wrap: wrap; } }
.viewer-say { position: absolute; left: 0; right: 0; top: 0; padding: 10px 14px; background: rgba(255,255,255,.94); color: var(--ink); font-weight: 600; font-size: 19px; border-bottom: 3px solid var(--act); pointer-events: none; }
.viewer-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; }
.stepper { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.btn.step { min-width: 150px; min-height: 64px; }
.frame-read { text-align: center; }
.frame-no { font-family: var(--display); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; display: block; }
.frame-tag { font-size: 16px; color: var(--ink-2); display: block; min-height: 22px; }
.strip { display: flex; gap: 2px; height: 22px; }
.strip i { flex: 1; background: var(--line); border-radius: 2px; cursor: default; }
.strip i.t { background: var(--track); }
.strip i.r { background: #d8ddd9; }
.strip i.p { background: var(--impact); }
.strip i.c { outline: 3px solid var(--ink); outline-offset: 1px; }
.key { font-size: 17px; color: var(--ink-2); }
.tracking { display: flex; align-items: center; gap: 12px; font-weight: 600; padding: 12px 14px; border-radius: 6px; background: var(--ground); border: 2px solid var(--line); }
.tracking.ok { border-color: var(--act); }
.tracking.bad { border-color: var(--out); color: var(--hit-ink); }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--track); animation: pulse 1s ease-in-out infinite; flex: none; }
.tracking.ok .pulse { animation: none; background: var(--act); }
.tracking.bad .pulse { animation: none; background: var(--out); }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.flow { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 12px; }
.flow-step { counter-increment: s; background: var(--ground); border: 2px solid var(--line); border-radius: 6px; padding: 14px 16px; display: grid; gap: 8px; }
.flow-step h2 { display: flex; gap: 10px; align-items: baseline; font-size: 22px; }
.flow-step h2::before { content: counter(s); font-size: 18px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid currentColor; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.flow-step.now { border-color: var(--act); border-width: 3px; }
.flow-step.done h2::before { background: var(--act); border-color: var(--act); color: #fff; }
.done-line { font-weight: 600; }
.done-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn.small { min-height: 48px; font-size: 18px; padding: 0 16px; }

/* decision */
.dec-grid { display: grid; grid-template-columns: minmax(0, 560px) minmax(420px, 1fr); gap: 28px; align-items: start; }
.dec-visual { display: grid; gap: 10px; min-width: 0; }
.stumps-fig { margin: 0; display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: center; }
.stumps-fig svg { width: 170px; height: 202px; background: var(--panel); border-radius: 6px; }
.stumps-fig figcaption { font-size: 17px; }
.dec-side { display: grid; gap: 14px; align-content: start; }
.legs { width: 100%; border-collapse: collapse; }
.legs th, .legs td { text-align: left; padding: 12px 8px; border-bottom: 2px solid var(--line); vertical-align: middle; }
.legs th { font-family: var(--display); font-size: 22px; width: 110px; }
.leg-val { font-family: var(--display); font-size: 26px; font-weight: 700; }
.leg-num { font-size: 18px; color: var(--ink-2); text-align: right; }
.result { display: inline-block; padding: 4px 12px; border-radius: 6px; border: 2px solid currentColor; }
.result.hit { background: var(--hit-bg); color: var(--hit-ink); }
.result.call { background: var(--call-bg); color: var(--call-ink); }
.result.miss { background: var(--miss-bg); color: var(--miss-ink); }
.runs { display: grid; gap: 6px; }
.run-row { display: grid; grid-template-columns: 180px 1fr 64px; gap: 10px; align-items: center; font-size: 18px; }
.run-head { display: grid; grid-template-columns: 180px 1fr 64px; gap: 10px; font-size: 17px; color: var(--ink-2); }
.run-head .thr-label { position: relative; height: 22px; }
.run-head .thr-label span { position: absolute; left: 90%; transform: translateX(-50%); font-weight: 700; color: var(--ink); }
.run-bar { height: 18px; background: var(--panel); border: 1px solid var(--line); position: relative; }
.run-bar b { position: absolute; inset: 0 auto 0 0; background: var(--ink-2); }
.run-bar .thr { position: absolute; top: -4px; bottom: -4px; left: 90%; width: 3px; background: var(--ink); }
.run-pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.rule { font-size: 18px; }
.advice { font-size: 19px; display: grid; gap: 6px; padding: 12px 14px; background: var(--panel); border-radius: 6px; }
.btn.send { min-height: 72px; font-size: 24px; }
.btn.send.out { background: var(--out); border-color: var(--out); }
.btn.send.notout { background: var(--notout); border-color: var(--notout); }

/* sent */
.sent-card { max-width: 760px; margin: 40px auto; display: grid; gap: 14px; justify-items: start; }
.sent-word { font-family: var(--display); font-size: 88px; font-weight: 700; line-height: 1; }
.sent-word.out { color: var(--out); }
.sent-word.notout { color: var(--notout); }
.sent-line { font-size: 22px; }

/* phone */
@media (max-width: 900px) {
  .bar { flex-wrap: wrap; gap: 8px 16px; padding: 10px 14px; }
  .match { order: 5; flex-basis: 100%; }
  main { padding: 14px; }
  .balls-grid, .ev-grid, .dec-grid { grid-template-columns: 1fr; }
  .stumps-fig { grid-template-columns: 1fr; }
  .btn.step { min-width: 0; }
  .ball { grid-template-columns: 64px minmax(0, 1fr); gap: 4px 14px; padding: 12px 14px; }
  .ball-over { font-size: 30px; grid-row: span 2; }
  .ball-state { grid-column: 2; text-align: left; }
  h1 { font-size: 28px; }
}
