/* nextplay: one dark, sharp page for people who watch a lot of sport, laid out for a tablet
   first (docs/BOARD.md, decision 12): touch targets of 40 px and more, nothing that needs hover.
   System fonts only, nothing is fetched from anywhere else. The board's own palette and tools
   are styled in board.css. */

:root {
  --bg: #090b0e;
  --bg1: #0f1318;
  --bg2: #151a21;
  --bg3: #1c232d;
  --bg4: #243040;
  --line: #242c37;
  --line2: #37424f;
  --tx: #e8edf3;
  --tx2: #9aa4b2;
  --tx3: #6b7686;
  --accent: #ffc531;      /* our team, Nylah, the recommended option, the chosen moment */
  --accent-ink: #1a1300;
  --geo: #59e0ff;         /* projected geometry: pitch lines, range rings */
  --good: #5fd08a;
  --warn: #ff9a4d;
  --bad: #ff5d5d;
  --goal: #3ddc84;        /* the shot went in */
  --miss: #ff6b5b;        /* it did not */
  --pass: #8fd3ff;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --top-h: 56px;
  --tap: 44px;
}

* { box-sizing: border-box; }
/* A finger pans what scrolls (the drawer, the rail, the clip strip) and never zooms the page:
   touch-action is the intersection along the ancestors, so pan-x pan-y here takes pinch and
   double-tap zoom off everything, and the board, the video and the scrubber say none. */
html, body { height: 100%; margin: 0; touch-action: pan-x pan-y; }
body {
  background: var(--bg);
  color: var(--tx);
  font: 13px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;           /* a long press is not the browser's menu (main.js too) */
}
input, textarea, .say, .chint, .about { -webkit-touch-callout: default; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
b { font-weight: 600; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--tx2); }
.dimmer { color: var(--tx3); }
.accent { color: var(--accent); }
.grow { flex: 1 1 0; }
svg { display: block; }

/* ------------------------------------------------------------------ frame */

#app { display: grid; grid-template-rows: var(--top-h) minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); height: 100vh; width: 100vw; overflow: hidden; }
#top {
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--bg1);
  height: var(--top-h); min-width: 0;
}
#brand { flex: none; padding-right: 4px; }
#brand b { font-size: 18px; font-weight: 800; font-style: italic; letter-spacing: -0.03em; white-space: nowrap; }
#brand b span { color: var(--accent); }
#settingsbtn {
  flex: none; height: var(--tap); display: inline-flex; align-items: center; gap: 8px; padding: 0 14px 0 11px;
  font-weight: 600; font-size: 13.5px; border-radius: 6px;
}
#settingsbtn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
#settingsbtn.on { border-color: var(--accent); color: var(--accent); }

/* The video, the timeline, the key moments and the coach's read on the left; the board takes
   the rest (main.js layout() sets the column widths and the video's height). */
#body { display: grid; grid-template-columns: 44% minmax(0, 1fr); gap: 8px; padding: 8px; min-height: 0; min-width: 0; }
#left { display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; }
.pane { background: var(--bg1); border: 1px solid var(--line); border-radius: 6px; min-width: 0; overflow: hidden; }
.phead {
  margin: 0; padding: 0 10px; height: 32px; flex: none; display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tx2);
  border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden;
}
.phead .count { color: var(--tx3); letter-spacing: 0.02em; text-transform: none; font-weight: 500; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.phead .btn { text-transform: none; letter-spacing: 0; font-weight: 600; }
#vtag { color: var(--tx); font-size: 13.5px; letter-spacing: 0; text-transform: none; font-weight: 700; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 0 auto; max-width: 42%; }
/* how many players the board has, and how many are seen: it gives way first, and goes on a narrow column */
#vpane { container-type: inline-size; }
@container (max-width: 470px) { #vcount { display: none; } }
#voutcome:empty { display: none; }
#vpane { flex: none; }
#panel { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
#bpane { display: flex; flex-direction: column; min-height: 0; }
/* the board's header carries the GOAL pill (a finger-sized button), so it is taller */
#bpane > .phead { height: 46px; padding-right: 6px; }
#bcell { flex: 1 1 0; min-height: 0; border: 0; background: #0b0e0f; }
#bcanvas { touch-action: none; }
/* once the play is over, a bar in the result's colour along the board's top edge (moments.js) */
#bcell.over::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--goal); z-index: 5; pointer-events: none; }
#bcell.over[data-result="miss"]::after { background: var(--miss); }
#bcell.over[data-result="unknown"]::after, #bcell.over[data-result=""]::after { background: var(--tx2); }
/* GOAL (or MISS) from the moment the ball arrives; a tap goes back there */
#bgoal {
  flex: none; height: 40px; min-height: 40px; padding: 0 16px; border-radius: 20px; border: 0;
  font: italic 900 14px/1 var(--sans); letter-spacing: 0.05em; text-transform: none;
  background: var(--goal); color: #06140b; box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}
#bgoal:hover { background: #5be59a; }
#bgoal.r-miss { background: var(--miss); color: #1d0703; }
#bgoal.r-miss:hover { background: #ff8576; }
#bgoal.r-unknown { background: var(--tx); color: #0b0e12; }
#bpane .phead .tag { flex: none; }
#bnotes { cursor: help; }
/* the coach's read as a sheet, on a tablet held upright only */
#readbtn { display: none; position: relative; flex: none; height: 40px; min-height: 40px; font-size: 13px; }
#readbtn.has::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
#readbtn.on { border-color: var(--accent); color: var(--accent); }
#bmoment { color: var(--accent); letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#bmoment:empty { display: none; }
#bmoment::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 7px; vertical-align: 1px; }
#bmoment.k-goal, #bmoment.k-usergoal { color: var(--goal); }
#bmoment.k-miss { color: var(--miss); }
#bmoment.k-pass { color: var(--pass); }
#bmoment.k-shot, #bmoment.k-mark { color: var(--tx); }
#bmoment.after { color: var(--tx3); }
/* fine-tune is on: the way out sits on the board, where the dragging is done */
#bfine {
  position: absolute; right: 10px; top: 10px; z-index: 6; min-height: 44px; padding: 0 16px;
  border-color: var(--accent); color: var(--accent); background: rgba(15,19,24,0.94); font-weight: 700;
}
#bmode { border-style: dashed; }
/* Under the board, one line, never over the pitch: what is under the finger (the board writes
   it); else the measure, or what the tool in hand does (the board writes that too); else how the
   magnets are moved at the moment (main.js syncFoot). */
#bfoot {
  flex: none; height: 28px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-top: 1px solid var(--line); color: var(--tx2); font-size: 13px; white-space: nowrap; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
#bfoot > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#bfoot > span:empty { display: none; }
#bfoot #bhover:not(:empty) ~ span, #bfoot #mread:not(:empty) ~ #bhint { display: none; }
#bfoot #mread { color: var(--tx2); }
#bfoot #bhint { color: var(--tx3); }

/* ------------------------------------------------------------------ buttons, chips, fields */

.btn {
  background: var(--bg3); border: 1px solid var(--line2); border-radius: 5px;
  padding: 6px 14px; min-height: var(--tap); cursor: pointer; white-space: nowrap; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: #56657a; background: #232c38; }
.btn:active { background: #2a3442; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: #ffd155; }
.btn.small { padding: 4px 12px; min-height: 40px; font-size: 12.5px; }
.btn.ghost { background: transparent; }
.btn.on { background: #2b3644; border-color: #6b7c93; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.wide { width: 100%; padding: 8px 10px; font-size: 13px; }
.btn.icon { width: var(--tap); height: var(--tap); padding: 0; }
.btn.icon svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.seg { display: inline-flex; }
.seg .btn { border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: 5px 0 0 5px; margin-left: 0; }
.seg .btn:last-child { border-radius: 0 5px 5px 0; }
/* the choice in force: the accent fill, as the tool in hand on the palette */
.seg .btn.on, .seg .btn.on:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); position: relative; z-index: 1; font-weight: 700; }
.seg.fill { display: flex; }
.seg.fill .btn { flex: 1 1 0; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap);
  border: 1px solid var(--line2); border-radius: 5px; padding: 0 14px;
  background: transparent; cursor: pointer; color: var(--tx2); font-size: 13px; line-height: 1.3;
}
.chip:hover { color: var(--tx); border-color: #56657a; }
.chip.on { color: var(--tx); background: var(--bg3); border-color: #5c6b80; }
.chip .led { width: 8px; height: 8px; border-radius: 50%; background: var(--tx3); }
.chip.on .led { background: var(--good); box-shadow: 0 0 6px rgba(95,208,138,0.6); }

input[type="number"], input[type="text"], select {
  background: var(--bg); border: 1px solid var(--line2); border-radius: 5px;
  padding: 4px 8px; height: 36px; width: 72px; font-family: var(--mono); font-size: 13px;
  user-select: text; -webkit-user-select: text;
}
input[type="text"] { font-family: var(--sans); }
input[type="number"]:focus, input[type="text"]:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="number"]::-webkit-inner-spin-button { opacity: 0.35; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); margin: 0 6px 0 0; vertical-align: -2px; width: 16px; height: 16px; }
/* a slider a finger can hold: a 40 px tall row, a 28 px thumb */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 40px; margin: 0; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--bg4); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--bg4); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--accent-ink); box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); border: 2px solid var(--accent-ink); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* a team's swatch is its magnet: the shirt colour inside a light ring, so a dark kit still reads on the dark page */
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.7); vertical-align: -1px; flex: none; }
.sw.hollow { border-color: var(--tx2); }
.tag {
  display: inline-block; font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line2); color: var(--tx2); line-height: 1.4;
  font-weight: 700; white-space: nowrap;
}
.tag.goal { color: var(--goal); border-color: #2c6a45; }
.tag.miss { color: var(--miss); border-color: #7a3a2c; }
.tag.est { color: var(--tx2); border-style: dashed; }
.tag.ph { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tag.bad { color: var(--bad); border-color: #7a2c2c; }
.tag.robust { color: var(--good); border-color: #2c6a45; }
.tag.leans { color: var(--accent); border-color: #7a5f16; }
.tag.fragile { color: var(--tx2); border-style: dashed; }

/* ------------------------------------------------------------------ clip strip */

#strip { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; flex: 1 1 0; min-width: 0; align-items: center; height: 100%; padding: 6px 0; scrollbar-width: none; }
#strip::-webkit-scrollbar { display: none; }
.clip {
  display: flex; gap: 8px; align-items: center; flex: none; width: 178px; height: 44px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px 3px 3px;
  cursor: pointer; position: relative; text-align: left; overflow: hidden;
}
.clip:hover { border-color: var(--line2); }
.clip.sel { border-color: var(--accent); background: #1b1d1a; box-shadow: inset 3px 0 0 var(--accent); }
.clip .thumb { width: 64px; height: 36px; background: #000 center / cover no-repeat; flex: none; border-radius: 3px; }
.clip .meta { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; flex: 1; }
.clip .name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.clip .sub { color: var(--tx2); font-family: var(--mono); font-size: 11px; display: flex; gap: 6px; align-items: center; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.clip .sub .tag { font-family: var(--sans); font-size: 9.5px; padding: 0 5px; }
/* while a clip is analysed, its progress takes the place of the length */
.clip .meta:has(.lower:not(:empty)) .sub { display: none; }
.clip .state { font-size: 10.5px; color: var(--tx3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip .state.err { color: var(--bad); }
.clip .lower { display: flex; flex-direction: row; gap: 6px; align-items: center; min-width: 0; }
.clip .lower:empty { display: none; }
.clip .lower .btn { min-height: 22px; padding: 1px 8px; font-size: 11px; }
.clip .lower .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0; }
.clip .bar { height: 3px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.clip .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.25s linear; }
#addslot { flex: none; display: flex; align-items: center; }
#addslot:empty { display: none; }
.clip.add { width: auto; padding: 0 16px; border-style: dashed; border-color: var(--line2); background: transparent; justify-content: center; gap: 6px; color: var(--tx2); font-weight: 600; }
.clip.add:hover, .clip.add.drop { color: var(--tx); border-color: var(--accent); }
.clip.add .plus { font-size: 20px; line-height: 1; font-weight: 300; }
.clip.add small { font-size: 10px; color: var(--tx3); max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ stage */

.cell { position: relative; background: #000; border: 1px solid var(--line); overflow: hidden; }
#vcell video { position: absolute; display: block; background: #000; }
/* no size containment here: Chrome can stall a loading video under a contained parent that is laid out again */
#vcell { border-width: 0; }
#vcell canvas, #bcell canvas { position: absolute; left: 0; top: 0; display: block; }
#vcanvas { touch-action: none; }
.celltag {
  position: absolute; left: 6px; top: 5px; font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase;
  color: rgba(255,255,255,0.72); background: rgba(0,0,0,0.5); padding: 1px 6px; border-radius: 3px; pointer-events: none;
  font-weight: 700;
}
.cellread {
  position: absolute; left: 6px; bottom: 5px; right: 6px; font: 11px/1.3 var(--mono); color: rgba(255,255,255,0.82);
  pointer-events: none; text-shadow: 0 0 3px #000, 0 0 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.celltag.ph { left: auto; right: 6px; top: auto; bottom: 5px; background: var(--accent); color: var(--accent-ink); }
.empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(9,11,14,0.94); color: var(--tx2); text-align: center; padding: 20px; font-size: 13.5px; z-index: 2;
}
.empty b { color: var(--tx); font-size: 16px; }
.empty .bar { width: 240px; height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.empty .bar i { display: block; height: 100%; background: var(--accent); }
/* no goal yet: the prompt in the middle of the unplaced pitch */
.bnote {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, 80%); z-index: 3;
  background: rgba(15,19,24,0.95); border: 1px solid var(--accent); border-radius: 8px; padding: 18px 20px;
  color: var(--tx2); font-size: 13.5px; line-height: 1.45; display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.bnote b { color: var(--tx); font-size: 17px; }
.bnote .btn { min-height: var(--tap); padding: 0 20px; font-size: 14px; }

/* The moment the ball arrives on a played-through shot: GOAL or MISS in a band across the
   bottom fifth of the picture (placed and sized by videoview.js), so the ball going in is never
   covered. */
.vflash {
  position: absolute; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 0.45em;
  pointer-events: none; opacity: 0; z-index: 1; font-size: 40px;
  background: linear-gradient(to top, rgba(0,0,0,0.62), rgba(0,0,0,0.25) 70%, rgba(0,0,0,0));
}
.vflash b {
  display: block; padding: 0.06em 0.42em 0.04em; transform: skewX(-12deg);
  font: italic 900 1em/1 var(--sans); letter-spacing: 0.02em; color: #06140b;
  background: var(--goal); box-shadow: 0 6px 24px rgba(0,0,0,0.5), 0 0 0 2px rgba(0,0,0,0.35);
}
.vflash span { font: 800 max(11px, 0.3em)/1.2 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 6px #000, 0 0 2px #000; }
.vflash span:empty { display: none; }
.vflash.miss b { background: var(--miss); color: #1d0703; }
.vflash.unknown b { background: var(--tx); color: #0b0e12; }
.vflash.go { animation: vflash 1.8s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes vflash {
  0% { opacity: 0; transform: translateY(35%); }
  9% { opacity: 1; transform: none; }
  74% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(12%); }
}

/* ------------------------------------------------------------------ timeline */

#timeline { background: var(--bg1); border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px 3px; display: flex; flex-direction: column; gap: 4px; flex: none; container-type: inline-size; }
#timeline .tlrow { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; min-width: 0; }
#timeline .tgroup { display: flex; align-items: center; gap: 3px; flex: none; }
#timeline .tbtn { width: var(--tap); height: var(--tap); padding: 0; border-radius: 6px; flex: none; }
#timeline .tbtn.play { width: 52px; background: var(--tx); border-color: var(--tx); color: #0b0e12; }
#timeline .tbtn.play.on { background: var(--accent); border-color: var(--accent); }
#timeline .tbtn.jump { color: var(--accent); }
#timeline .speeds { flex: none; }
#timeline .speeds .btn { height: var(--tap); width: var(--tap); min-width: var(--tap); padding: 0; font: 700 14px var(--sans); }
#timeline .speedcyc { display: none; font: 700 14px var(--sans); }
#timeline .speedcyc.on { border-color: var(--accent); color: var(--accent); }
/* the time, at the row's right end (the frame number only with the debug marks on) */
#timeline .read {
  flex: 1 1 auto; min-width: 0; text-align: right; padding-right: 4px;
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#timeline .read b { color: var(--tx); font-size: 16px; font-weight: 700; }
#timeline .read .f { color: var(--tx3); font-size: 11px; }
@container (max-width: 560px) { #timeline .read .f { display: none; } }
@container (max-width: 530px) { #timeline .read .dur { display: none; } }
/* a narrow column: the three speeds become one button that steps through them */
@container (max-width: 479px) { #timeline .speeds { display: none; } #timeline .speedcyc { display: inline-flex; } }
@container (max-width: 360px) { #timeline .tbtn.ten { display: none; } }
#scrub { display: block; width: 100%; height: 66px; cursor: pointer; touch-action: none; }

/* the countdown to the shot, then how it ended: in the video's header, over the picture */
#cdslot { flex: none; display: flex; align-items: center; }
#cdslot:empty { display: none; }
.cd {
  flex: none; display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 13px;
  background: var(--bg3); border: 1px solid var(--line2); color: var(--tx); font-weight: 800; font-size: 13.5px;
  font-variant-numeric: tabular-nums; white-space: nowrap; text-transform: none; letter-spacing: 0;
}
.cd.soon { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); animation: cdpulse 0.6s ease-in-out infinite alternate; }
.cd.flight { background: #fff; border-color: #fff; color: #0b0e12; font-style: italic; }
.cd.goal, .cd.miss, .cd.unknown { font-style: italic; font-weight: 900; letter-spacing: 0.08em; font-size: 14px; padding: 0 14px; }
.cd.goal { background: var(--goal); border-color: var(--goal); color: #06140b; }
.cd.miss { background: var(--miss); border-color: var(--miss); color: #1d0703; }
.cd.none { background: transparent; border-style: dashed; color: var(--tx3); font-weight: 600; }
@keyframes cdpulse { from { box-shadow: 0 0 0 0 rgba(255,197,49,0.0); } to { box-shadow: 0 0 0 4px rgba(255,197,49,0.25); } }

/* ------------------------------------------------------------------ key moments rail */

/* The chips scroll (and always stop on a whole chip, just after the fade); how the play ends
   (or Goal here) and + Mark keep their place at the right end. */
#moments { flex: none; display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 3px 0 2px; background: var(--bg1); border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
#moments .btn svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mlist {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  padding: 0 2px; height: 100%; scroll-snap-type: x mandatory; scroll-padding-inline: 2px; overscroll-behavior-x: contain;
}
.mresult { flex: none; display: flex; align-items: center; gap: 6px; }
.mresult:empty { display: none; }
.mlist::-webkit-scrollbar { display: none; }
.mlist.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.mlist.more-l { -webkit-mask-image: linear-gradient(to right, transparent, #000 10px); mask-image: linear-gradient(to right, transparent, #000 10px); }
.mlist.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 28px), transparent); }
.mempty { color: var(--tx3); font-size: 12px; white-space: nowrap; padding: 0 6px; }
/* 46 px with its border, so the go and edit buttons inside are 44 */
.mchip {
  flex: none; display: inline-flex; align-items: stretch; height: 46px; border-radius: 6px; scroll-snap-align: start;
  background: var(--bg2); border: 1px solid var(--line2); box-shadow: inset 3px 0 0 var(--tx3); overflow: hidden;
}
.mchip .mgo {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 13px; border: 0; background: transparent; cursor: pointer;
  white-space: nowrap; font-size: 13.5px; min-height: var(--tap);
}
.mchip .mgo b { font-weight: 700; }
.mchip .mgo .t { font: 12px var(--mono); color: var(--tx3); font-variant-numeric: tabular-nums; }
.mchip .mgo .mine { color: var(--tx); font-weight: 600; }
.mchip .mgo .mine::before { content: "\00b7"; margin-right: 6px; color: var(--tx3); }
.mchip .mink svg { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; }
.mchip .mmine svg { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.mchip .medit { width: var(--tap); border: 0; border-left: 1px solid var(--line2); background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--tx2); padding: 0; }
.mchip .medit svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mchip .medit:hover, .mchip .mgo:hover { background: var(--bg3); }
.mchip.k-pass { box-shadow: inset 3px 0 0 var(--pass); }
.mchip.k-shot { box-shadow: inset 3px 0 0 #fff; }
.mchip.k-read { box-shadow: inset 3px 0 0 var(--accent); }
.mchip.k-read .mgo b { color: var(--accent); }
.mchip.k-mark { box-shadow: inset 3px 0 0 #fff; }
.mchip.k-ink { box-shadow: inset 3px 0 0 var(--accent); }
.mchip.k-goal, .mchip.k-miss, .mchip.k-unknown, .mchip.k-usergoal { border-color: transparent; box-shadow: none; }
.mchip.k-goal, .mchip.k-usergoal { background: var(--goal); color: #06140b; }
.mchip.k-miss, .mchip.k-usergoal.r-miss { background: var(--miss); color: #1d0703; }
.mchip.k-unknown { background: var(--tx); color: #0b0e12; }
.mchip.k-goal .mgo .mine, .mchip.k-miss .mgo .mine, .mchip.k-unknown .mgo .mine { color: inherit; }
.mchip.k-goal .mmine svg, .mchip.k-miss .mmine svg, .mchip.k-unknown .mmine svg { stroke: currentColor; }
.mchip.k-goal .medit, .mchip.k-miss .medit, .mchip.k-unknown .medit { color: inherit; border-left-color: rgba(0,0,0,0.25); }
.mchip.k-goal .mgo b, .mchip.k-miss .mgo b, .mchip.k-unknown .mgo b, .mchip.k-usergoal .mgo b { font-style: italic; font-weight: 900; letter-spacing: 0.06em; }
.mchip.k-goal .t, .mchip.k-miss .t, .mchip.k-unknown .t, .mchip.k-usergoal .t { color: inherit; opacity: 0.7; }
.mchip.k-usergoal { outline: 2px dashed rgba(0,0,0,0.45); outline-offset: -4px; }
.mchip.k-usergoal .medit { color: inherit; border-left-color: rgba(0,0,0,0.25); }
.mchip.k-goal .mgo:hover, .mchip.k-miss .mgo:hover, .mchip.k-usergoal .mgo:hover, .mchip.k-usergoal .medit:hover { background: rgba(255,255,255,0.18); }
.mchip.on:not(.k-goal):not(.k-miss):not(.k-unknown):not(.k-usergoal) { border-color: var(--accent); background: var(--bg4); }
.mchip.on .mgo .t { color: var(--tx); }
.mchip.k-goal.on, .mchip.k-miss.on, .mchip.k-usergoal.on, .mchip.k-unknown.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.35); }
#moments { container-type: inline-size; }
/* the worked-out chips name themselves (their time is on the flag and the pins); his keep theirs */
@container (max-width: 600px) { .mlist .mchip:not(.own) .mgo .t { display: none; } }
#moments .mmark { flex: none; height: var(--tap); padding: 0 14px 0 10px; font-weight: 700; border-color: var(--accent); color: var(--accent); background: transparent; }
#moments .mgoalbtn { flex: none; height: var(--tap); padding: 0 12px 0 9px; font-weight: 700; border-color: var(--goal); color: var(--goal); background: transparent; }
/* how it ends: the fixed chip a little bolder than the rest */
.mresult .mchip .mgo { font-size: 14px; padding: 0 14px; }
/* a narrow column: tighter chips, and how it ends says GOAL (its time is on the flag and the board) */
@container (max-width: 480px) {
  .mchip .mgo { padding: 0 9px 0 10px; gap: 5px; }
  .mresult .mchip:not(.own) .mgo .t { display: none; }
  .mresult .mchip .mgo { padding: 0 12px; }
  #moments .mmark { padding: 0 10px 0 7px; }
}

/* rename or remove one of his key moments */
.mpop {
  position: fixed; z-index: 55; width: 330px; max-width: calc(100vw - 12px); background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 8px; padding: 12px; box-shadow: 0 14px 40px rgba(0,0,0,0.6); display: flex; flex-direction: column; gap: 10px;
}
.mpop .mph { display: flex; align-items: baseline; gap: 8px; }
.mpop .mph b { font-size: 14px; }
.mpop .mph .t { color: var(--tx3); font: 11.5px var(--mono); margin-left: auto; }
.mpop .rowx { display: flex; gap: 8px; align-items: center; }
.mpop input[type="text"] { flex: 1; width: auto; height: 42px; font-size: 15px; }
.mpop .btn { min-height: var(--tap); }
.mpop .mquick { display: flex; flex-wrap: wrap; gap: 6px; }
.mpop .mquick .btn { min-height: 40px; }

/* ------------------------------------------------------------------ the panel: what the coach sees, how it went */

#notes { color: var(--tx2); font-size: 12px; display: flex; flex-direction: column; gap: 3px; padding: 10px 2px 0; margin-top: 10px; border-top: 1px solid var(--line); user-select: text; -webkit-user-select: text; }
#notes:empty { display: none; }
#notes details.more { margin-top: 0; }
#notes details.more .n { margin-top: 3px; color: var(--tx3); }
#notes .n { display: flex; gap: 6px; }
#notes .n::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--tx3); margin-top: 7px; flex: none; }
#notes .n.warn { color: var(--warn); }
#notes .n.warn::before { background: var(--warn); }

#tabs { display: flex; align-items: center; border-bottom: 1px solid var(--line); flex: none; padding-right: 10px; height: 42px; gap: 2px; }
#tabs button {
  background: transparent; border: 0; border-bottom: 3px solid transparent; padding: 0 14px; height: 42px;
  cursor: pointer; color: var(--tx2); font-weight: 700; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
}
#tabs button:hover { color: var(--tx); }
#tabs button.on { color: var(--tx); border-bottom-color: var(--accent); }
#tabs .grow { min-width: 6px; }
#phtag { flex: none; }
/* puts the read away where it is a sheet (a tablet held upright) */
#sheetx { display: none; position: absolute; top: 1px; right: 4px; width: 40px; height: 40px; min-height: 40px; border: 0; background: transparent; z-index: 2; }
@container (max-width: 480px) {
  #tabs { padding-right: 6px; }
  #tabs button { padding: 0 9px; letter-spacing: 0.04em; font-size: 11px; }
  #phtag { font-size: 9.5px; padding: 1px 5px; letter-spacing: 0.04em; }
  #tabbody { padding-top: 8px; }
  .coach .say { font-size: 16px; margin-bottom: 4px; }
  .coach .chint { margin-bottom: 6px; line-height: 1.38; }
  .coach li .what { font-size: 13.5px; }
}
#tabbody { overflow-y: auto; flex: 1 1 0; min-height: 0; padding: 10px 12px 14px; scrollbar-width: thin; }
/* more under the fold (the corrections under the options): the bottom edge fades (panel.js) */
#tabbody.more-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), rgba(0,0,0,0.25)); mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), rgba(0,0,0,0.25)); }

/* what the coach sees */
.coach .say { font-size: 17px; font-weight: 700; margin: 0 0 6px; line-height: 1.25; user-select: text; -webkit-user-select: text; }
.coach .say.none { color: var(--tx2); }
.coach .say .upd { font-size: 12px; font-weight: 400; }
.coach .chint { color: var(--tx2); margin: 0 0 8px; line-height: 1.45; user-select: text; -webkit-user-select: text; }
.coach .chint.dimmer { color: var(--tx3); font-size: 12px; }
/* The three options: a tap shows one on the board (pressed, ringed in its colour), a tap
   again lets it go; the mouse shows it while over the row. How often it comes off, and how often
   it stays best, on a line of its own that wraps rather than being cut. */
.coach ol { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.coach li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 44px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg2); cursor: pointer;
}
@media (hover: hover) { .coach li:hover { border-color: var(--line2); background: var(--bg3); } }
.coach li.on { border-color: var(--oc, var(--accent)); box-shadow: inset 0 0 0 1px var(--oc, var(--accent)); background: var(--bg3); }
.coach li .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #111; border: 1px solid rgba(0,0,0,0.5); }
.coach li .txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.coach li .what { font-size: 14px; font-weight: 700; line-height: 1.25; }
.coach li .meta { color: var(--tx2); font-size: 12.5px; line-height: 1.3; }
.coach li .meta .short { display: none; }
@container (max-width: 480px) { .coach li .meta .long { display: none; } .coach li .meta .short { display: inline; } }
.coach #rulesline { margin-top: 8px; }
.coach .edit { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.coach .chint.warnline { color: var(--warn); }
.coach .chint.onball { margin: 0 0 0 4px; }
.coach .edit .btn { display: inline-flex; align-items: center; gap: 5px; }
/* the corrections, under the options (never over one): a player of either kit added,
   everything put back, and with a magnet picked, what can be said about them (a second line
   where the column is narrow) */
#editrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 2px 0 6px; }
#editrow .btn { padding: 0 12px; }
#editrow .btn.add { padding: 0 12px 0 10px; gap: 6px; font-weight: 600; }
#editrow .btn.add .sw { width: 13px; height: 13px; }
#editrow #selname { flex: none; font-size: 14px; min-width: 34px; }
@container (max-width: 400px) { #editrow .btn.add .tn { display: none; } }
.coach .resnotes { margin: 6px 0 0; }
.coach .resnotes .chint { margin: 0 0 3px; font-size: 12px; }
#panel { container-type: inline-size; }
#tabs { min-width: 0; overflow: hidden; }
#tabs button { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* how it went: the replay's story and its players */
.play .say { font-size: 15px; font-weight: 700; margin: 0 0 4px; line-height: 1.3; }
.play .chint { color: var(--tx2); margin: 0 0 8px; line-height: 1.45; }
.play .chint.dimmer { color: var(--tx3); font-size: 12px; }
.play ol.story { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.play ol.story li { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg2); cursor: pointer; }
.play ol.story li:hover { border-color: var(--line2); background: var(--bg3); }
.play ol.story li.now { border-color: var(--accent); }
.play ol.story li.past { color: var(--tx2); }
.play ol.story .t { font-family: var(--mono); font-size: 12px; color: var(--tx3); }
.play ol.story li.now .t { color: var(--accent); }
.play ol.story .k { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx3); margin-left: 6px; }
.play ol.story li.end { border-style: dashed; font-weight: 700; }
.play table { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 0 0 8px; }
.play th { text-align: left; color: var(--tx3); font-weight: 700; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 6px 5px 0; border-bottom: 1px solid var(--line); }
.play td { padding: 0 6px 0 0; height: 36px; border-bottom: 1px solid var(--line); font-family: var(--mono); white-space: nowrap; }
.play td.who { font-family: var(--sans); font-weight: 700; cursor: pointer; }
.play td.who:hover { color: var(--accent); }
.play td.num { text-align: right; }
.play th.num { text-align: right; }
.play tr.ghosty td { color: var(--tx3); }
.play .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.5); vertical-align: -1px; margin-right: 6px; }
.play .edit { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; align-items: center; }

/* ------------------------------------------------------------------ the settings drawer */

#scrim {
  position: fixed; inset: 0; z-index: 45; background: rgba(4,6,8,0.55); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
#scrim.open { opacity: 1; pointer-events: auto; }
#settings {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 94vw); z-index: 50;
  background: var(--bg1); border-left: 1px solid var(--line2); box-shadow: -18px 0 50px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; transform: translateX(104%); visibility: hidden;
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1), visibility 0s linear 0.22s;
}
#settings.open { transform: none; visibility: visible; transition: transform 0.22s cubic-bezier(.2,.8,.2,1), visibility 0s; }
#settings .dhead { flex: none; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 8px 0 18px; border-bottom: 1px solid var(--line); }
#settings .dhead b { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
#settings .dtabs { flex: none; display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
#settings .dtabs button {
  flex: 1 1 0; height: var(--tap); background: transparent; border: 0; border-bottom: 3px solid transparent; cursor: pointer;
  color: var(--tx2); font-weight: 700; font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase;
}
#settings .dtabs button.on { color: var(--tx); border-bottom-color: var(--accent); }
#settings .dbody { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px 28px; scrollbar-width: thin; }
.dsec { margin-bottom: 20px; }
.dsec > h3, .sec > h3 {
  margin: 0 0 10px; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tx3); font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.dsec > h3::after, .sec > h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sec > h3 .tag { letter-spacing: 0.05em; }
/* One family of controls in the drawer: full-width segments with the choice in the accent,
   switch rows for everything that is on or off, finger-sized sliders. */
#settings .btn { min-height: var(--tap); }
#settings .btn.small { min-height: 40px; }
#settings .seg .btn { font-size: 13px; }
#settings .rowx { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#settings .rowx > .seg.grow { flex: 1 1 0; min-width: 0; }
#settings .lab { color: var(--tx2); font-size: 12.5px; min-width: 56px; }
#settings p.lab { margin: 0 0 8px; }
/* a choice of one (the scale) is a row as tall as a finger, the whole row its target */
#settings label.rowx.radio { min-height: var(--tap); gap: 10px; cursor: pointer; }
#settings label.rowx.radio input[type="radio"] { width: 20px; height: 20px; margin: 0; }
#settings .hint { margin-top: 8px; }
#settings select { height: 40px; font-family: var(--sans); width: 100%; }
#settings input[type="number"] { height: 44px; width: 78px; -moz-appearance: textfield; }
/* no tiny spinners: a slider or typing sets a number in the drawer */
#settings input[type="number"]::-webkit-inner-spin-button, #settings input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* a setting that is on or off: the whole row is the switch */
.togs { display: flex; flex-direction: column; margin-top: 10px; border-top: 1px solid var(--line); }
.tog { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tog.sub { cursor: default; padding-left: 56px; }
#settings .tog.sub select { width: 110px; margin-left: auto; }
.tog .tl { display: flex; flex-direction: column; gap: 1px; font-size: 14px; font-weight: 600; min-width: 0; }
.tog .tl.dim { font-weight: 500; font-size: 13px; color: var(--tx2); }
.tog .tl small { font-size: 12px; font-weight: 400; color: var(--tx3); }
.tog input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; margin: 0; border-radius: 13px;
  background: var(--bg3); border: 1px solid var(--line2); position: relative; cursor: pointer; transition: background 0.15s;
}
.tog input[type="checkbox"]::before {
  content: ""; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--tx2);
  transition: transform 0.15s, background 0.15s;
}
.tog input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.tog input[type="checkbox"]:checked::before { transform: translateX(18px); background: #1a1300; }
.tog input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sizes { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px 10px; align-items: center; }
.sizes .pair { display: flex; align-items: center; gap: 6px; }
.sizes .unit { color: var(--tx3); }
#settings .applyrow { margin-top: 10px; }
#settings #apply { min-width: 96px; }
#pmsg { color: var(--tx2); font-size: 12px; }
#settings .chips { display: flex; flex-wrap: wrap; gap: 8px; }
#bread { color: var(--tx2); }
/* clip setup and the playbook in the drawer */
#settings .kv { grid-template-columns: 92px minmax(0, 1fr); gap: 8px 10px; }
#settings .rule input[type="number"] { width: 78px; }
/* a playbook rule that is on or off: the same switch row as the Board tab's */
.rule .ctl.togs { margin-top: 2px; border-top: 0; }
.rule .ctl.togs .tog { border-bottom: 0; min-height: var(--tap); padding: 0 2px; }
.rule .ctl.togs .tog .val { font-size: 13px; font-weight: 600; color: var(--tx2); }
.rule .ctl input[type="range"] { flex: 1 1 auto; min-width: 90px; }

/* ------------------------------------------------------------------ setup and playbook (in the drawer) */

.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px 8px; align-items: center; }
.kv > .k { color: var(--tx2); }
.kv > .v { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.sec { margin-bottom: 18px; }
.hint { color: var(--tx3); font-size: 12px; margin-top: 6px; line-height: 1.45; }
.hint.warn { color: var(--warn); }
.hint.bad { color: var(--bad); }
.rowx { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.unit { color: var(--tx3); font-size: 12px; }
.ph-line { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--tx2); font-size: 12px; }
.resnotes { margin: -2px 0 10px; padding: 1px 0 5px 8px; border-left: 2px solid var(--warn); }
.resnotes .hint { color: var(--tx2); }
.callout { border: 1px dashed var(--line2); border-radius: 6px; padding: 10px; color: var(--tx2); line-height: 1.45; }
.callout.bad { border-color: #7a2c2c; color: #ffb0b0; }
.callout .btn { margin-top: 8px; }

.rule { padding: 9px 0 10px; border-bottom: 1px solid var(--line); }
.rule:last-child { border-bottom: 0; }
.rule .head { display: flex; align-items: center; gap: 8px; }
.rule .key { font: 12px var(--mono); color: var(--tx); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule .name { font-weight: 700; font-size: 13.5px; flex: 1; min-width: 0; }
.rule .key.sub { color: var(--tx3); font-size: 11px; margin-top: 1px; }
.rule .reset { visibility: hidden; min-height: 40px; }
.rule.changed .reset { visibility: visible; }
.rule.changed .name::after { content: " edited"; color: var(--accent); font-weight: 400; font-size: 11px; }
details.more { margin-top: 6px; }
details.more summary { color: var(--tx2); font-size: 12.5px; cursor: pointer; min-height: 40px; display: list-item; line-height: 40px; }
details.more summary:hover { color: var(--tx); }
.rule .about { color: var(--tx2); font-size: 12px; margin: 3px 0 6px; line-height: 1.4; user-select: text; -webkit-user-select: text; }
.rule .ctl { display: flex; align-items: center; gap: 10px; }
.rule .ctl label { display: inline-flex; align-items: center; min-height: var(--tap); }
.rule .ctl .rng { color: var(--tx3); font: 11px var(--mono); white-space: nowrap; }
.rule input[type="number"] { width: 78px; text-align: right; }
.rule input[type="text"], .rule select { width: 130px; }
.rule.changed .key:not(.sub)::after { content: " edited"; color: var(--accent); font-family: var(--sans); font-size: 11px; }
.rule.err input { border-color: var(--bad); }

/* ------------------------------------------------------------------ track menu */

.menu {
  position: fixed; z-index: 40; min-width: 240px; background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 8px; box-shadow: 0 12px 34px rgba(0,0,0,0.6); padding: 5px; font-size: 13px;
}
.menu .mh { padding: 6px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.menu .mh .t { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.menu .mh .s { color: var(--tx3); font-size: 11.5px; }
.menu .mrow { display: flex; gap: 4px; padding: 2px 3px 5px; }
.menu .mrow .btn { flex: 1; display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: var(--tap); padding: 4px 6px; }
.menu .mi {
  display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: 0; text-align: left;
  min-height: var(--tap); padding: 6px 9px; border-radius: 4px; cursor: pointer;
}
.menu .mi:hover { background: var(--bg3); }
.menu .mi .box { width: 14px; height: 14px; border: 1px solid var(--tx3); border-radius: 3px; flex: none; position: relative; }
.menu .mi.on .box { background: var(--accent); border-color: var(--accent); }
.menu .mi.on .box::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 7px; border: solid var(--accent-ink); border-width: 0 1.8px 1.8px 0; transform: rotate(40deg); }
.menu .mi .kbd { margin-left: auto; color: var(--tx3); font-size: 11px; }
.menu .msep { height: 1px; background: var(--line); margin: 4px 0; }
/* the board's line for the player (a finger has no hover); last, so its words never move a button */
.menu .mread { max-width: 300px; margin-top: 4px; padding: 7px 8px 4px; border-top: 1px solid var(--line); color: var(--tx2); font-size: 12px; line-height: 1.35; }
.menu .mread:empty { display: none; }

/* ------------------------------------------------------------------ set goal */

#goalset { position: fixed; inset: 0; z-index: 52; background: rgba(5,6,8,0.96); display: flex; flex-direction: column; }
#goalset .gs-head { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg1); flex-wrap: wrap; }
#goalset .gs-head b { font-size: 15px; }
#goalset .btn { min-height: var(--tap); }
#goalset .gs-steps { display: flex; gap: 4px; }
#goalset .gs-step { display: flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 3px 10px; border: 1px solid var(--line2); border-radius: 5px; color: var(--tx3); cursor: pointer; background: transparent; }
#goalset .gs-step .n { font: 700 11px/16px var(--mono); width: 16px; height: 16px; border-radius: 50%; background: var(--bg3); color: var(--tx2); text-align: center; }
#goalset .gs-step.cur { color: var(--tx); border-color: var(--accent); }
#goalset .gs-step.cur .n { background: var(--accent); color: var(--accent-ink); }
#goalset .gs-step.done { color: var(--tx2); }
#goalset .gs-step.done .n { background: var(--good); color: #062312; }
#goalset .grow { flex: 1; }
#goalset .gs-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
#goalset .gs-wrap { position: relative; border: 1px solid var(--line2); background: #000; }
#goalset canvas.gs-img { display: block; cursor: crosshair; touch-action: none; }
#goalset canvas.gs-loupe { position: absolute; pointer-events: none; border: 1px solid #fff; border-radius: 3px; box-shadow: 0 6px 22px rgba(0,0,0,0.7); background: #000; }
#goalset .gs-foot { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg1); color: var(--tx2); flex-wrap: wrap; }
#goalset .gs-foot .msg.bad { color: var(--bad); }
#goalset .gs-frame { font-family: var(--mono); color: var(--tx); min-width: 150px; }

/* ------------------------------------------------------------------ toasts */

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--bg3); border: 1px solid var(--line2); border-left: 3px solid var(--bad); padding: 9px 12px; border-radius: 5px; max-width: 420px; box-shadow: 0 8px 22px rgba(0,0,0,0.5); font-size: 13px; }
.toast.ok { border-left-color: var(--good); }
.toast.info { border-left-color: var(--tx2); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ narrow and portrait: stacked, and it scrolls */

@media (max-width: 1100px) {
  #brand b { font-size: 16px; }
  .clip { width: 160px; }
  .clip .thumb { width: 52px; height: 32px; }
}
@media (max-width: 640px) {
  #settingsbtn span { display: none; }
  #settingsbtn { padding: 0; width: var(--tap); justify-content: center; }
}
@media (orientation: portrait), (max-width: 900px) {
  html, body { height: auto; }
  body { overflow-x: hidden; overflow-y: auto; min-height: 100vh; }
  #app { height: auto; min-height: 100vh; overflow: visible; grid-template-rows: var(--top-h) auto; }
  #top { position: sticky; top: 0; z-index: 20; }
  #body { grid-template-columns: minmax(0, 1fr); }
  #left { display: contents; }
  #vpane { order: 1; }
  #timeline { order: 2; }
  #moments { order: 3; }
  #bpane { order: 4; }
  #panel { order: 5; flex: none; min-height: 220px; }
  #tabbody { flex: none; overflow: visible; }
}

/* A tablet held upright (main.js PORTRAIT, the same query): one screen, nothing scrolls. The
   video (about a third of the height), the timeline and the key moments on top, the board in
   everything under them, and the coach's read a sheet that slides up over the board from the
   Coach's read button in its header. */
@media (orientation: portrait) and (min-height: 900px) and (min-width: 700px) {
  html, body { height: 100%; }
  body { overflow: hidden; min-height: 0; }
  #app { height: 100vh; min-height: 0; overflow: hidden; grid-template-rows: var(--top-h) minmax(0, 1fr); }
  #top { position: static; }
  #body { grid-template-rows: auto auto auto minmax(0, 1fr); min-height: 0; }
  #bpane { min-height: 0; }
  #readbtn { display: inline-flex; }
  #panel {
    position: fixed; left: 8px; right: 8px; bottom: 0; z-index: 30; min-height: 0; max-height: min(64vh, 680px);
    border-radius: 14px 14px 0 0; border-bottom: 0; box-shadow: 0 -18px 50px rgba(0,0,0,0.6), 0 0 0 1px var(--line2);
    transform: translateY(102%); visibility: hidden;
    transition: transform 0.22s cubic-bezier(.2,.8,.2,1), visibility 0s linear 0.22s;
  }
  #panel.open { transform: none; visibility: visible; transition: transform 0.22s cubic-bezier(.2,.8,.2,1), visibility 0s; }
  #tabbody { flex: 0 1 auto; overflow-y: auto; overscroll-behavior: contain; }
  #sheetx { display: inline-flex; }
  #tabs { padding-right: 52px; }
}

/* Inside the kits page's Board tab (main.js, ?embed=kits): one game and the kits page's own bar
   above it, so no clip strip, no Add clip and no bar of this page's own; Settings sits at the end
   of the board's header instead (main.js moves it), and the video and the board take the room. */
html.embed #strip, html.embed #addslot, html.embed #top { display: none; }
html.embed #app { grid-template-rows: minmax(0, 1fr); }
html.embed #bpane > .phead #settingsbtn { height: 40px; min-height: 40px; padding: 0 12px 0 10px; font-size: 13px; }
@media (orientation: portrait), (max-width: 900px) {
  html.embed #app { grid-template-rows: auto; }
}
@media (orientation: portrait) and (min-height: 900px) and (min-width: 700px) {
  html.embed #app { grid-template-rows: minmax(0, 1fr); }
}

/* Following the kits page (?embed=kits&follow=1, main.js FOLLOW): the board alone fills its frame,
   whatever the frame's width (the kits page's Game screen gives it a column), so none of the
   narrow-screen stacking applies: no video column, no timeline, no key moments, no coach's read. */
html.follow, html.follow body { height: 100%; }
html.follow body { overflow: hidden; min-height: 0; }
html.follow #app { height: 100vh; min-height: 0; overflow: hidden; grid-template-rows: minmax(0, 1fr); }
html.follow #body { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); padding: 0; gap: 0; min-height: 0; }
html.follow #left, html.follow #vpane, html.follow #timeline, html.follow #moments, html.follow #panel { display: none !important; }
html.follow #bpane { order: 0; height: 100% !important; min-height: 0; border-radius: 0; border: 0; }
html.follow #bpane > .phead .bsize { flex: none; margin-right: 6px; }
html.follow #bpane > .phead .bsize .btn { min-height: 36px; height: 36px; padding: 0 11px; font-weight: 700; text-transform: none; letter-spacing: 0; }

/* The 3x3 game (sport.js): every made basket is a key moment, and the countdown chip is the score. */
.mchip.k-make { box-shadow: inset 3px 0 0 var(--goal); }
.mchip.k-make .mgo b { color: var(--goal); font-weight: 800; }
#bmoment.k-make { color: var(--goal); }
.cd.score { color: var(--tx); background: var(--bg3, #1c232d); font-variant-numeric: tabular-nums; }
