/* ===== Ref Board — what the referee version adds: FIBA-style court and tokens, referees, the overlays
   (rectangles 1–6, coverage, sight), the referee's-eye view, the whistle dialog and the pregame checklist ===== */
:root {
  --lead: #1c7fc9;
  --lead-2: #6bb8f0;
  --trail: #2a9440;
  --trail-2: #6fd083;
  --rect: #e5484d;
}

/* ----- court: as in the FIBA diagrams (hardwood on black), players white (team A) and yellow (team B) ----- */
.cv {
  --off: #f5f4ef;
  --def: #ffd43b;
  --arw-off: #f5f4ef;
  --arw-def: #ffd43b;
}
.cv[data-theme="wood"] {
  --floor: #e3c08f;
  --floor-out: #0b0d10;
  --paint: #d3a86f;
  --cline: rgba(48, 36, 22, .82);
  --off: #f5f4ef;
  --def: #ffd43b;
  --arw-off: #2b2118;
  --arw-def: #7a5c00;
  --draw: #b3261e;
}
.cv .c-line { stroke-width: 2; }
.cv .c-line.thin { stroke-width: 1.4; }
.cv[data-theme="wood"] .c-board { stroke: #2b2118; }
.cv .c-box { fill: #5d6470; }
.cv .c-box.table { fill: #8a909c; }
.cv .c-box-label { font: 700 10px var(--font-display); letter-spacing: .14em; fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }

.cv .tok .body { stroke: #14181f; stroke-width: 1.8; }
.cv .tok .lbl, .cv .tok.def .lbl { fill: #14181f; font-size: 13.5px; }
.cv .tok.holder .ring { stroke: var(--orange); stroke-width: 3; stroke-dasharray: 5 4; }

/* ----- rectangles 1–6 ----- */
.cv .rz { fill: none; stroke: rgba(229, 72, 77, .78); stroke-width: 3; pointer-events: none; }
.cv .rz.on { fill: rgba(229, 72, 77, .13); }
.cv .rz-n { font: 700 58px var(--font-display); fill: var(--rect); opacity: .78; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.cv .rz-n.on { opacity: 1; }
.cv .rz-low3 { stroke: rgba(31, 127, 196, .8); stroke-width: 1.2; opacity: .5; }
.cv .rz-low3.on { opacity: 1; }

/* ----- coverage areas and lines ----- */
.cv .ref-zone { stroke: none; pointer-events: none; }
.cv .ref-zone-label { text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.cv .cov-line { fill: none; stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; opacity: .92; pointer-events: none; }

/* ----- sight ----- */
.cv .fov { stroke-width: 1.4; stroke-linejoin: round; pointer-events: none; }
.cv .fov.role-L { fill: rgba(28, 127, 201, .09); stroke: none; }
.cv .fov.role-T { fill: rgba(42, 148, 64, .09); stroke: none; }
.cv .fov.role-L.eye { fill: rgba(28, 127, 201, .27); stroke: rgba(28, 127, 201, .9); }
.cv .fov.role-T.eye { fill: rgba(42, 148, 64, .27); stroke: rgba(42, 148, 64, .9); }
.cv .sightline { fill: none; stroke-width: 2.6; stroke-linecap: round; pointer-events: none; }
.cv .sightline.open { stroke: #12a150; }
.cv .sightline.narrow { stroke: #e0a100; }
.cv .sightline.stacked, .cv .sightline.blocked { stroke: var(--rect); stroke-dasharray: 5 6; }
.cv .sight-badge { pointer-events: none; }
.cv .sight-badge rect { stroke: #fff; stroke-width: 1.2; }
.cv .sight-badge.open rect { fill: #12a150; }
.cv .sight-badge.narrow rect { fill: #c98f00; }
.cv .sight-badge.stacked rect, .cv .sight-badge.blocked rect { fill: var(--rect); }
.cv .sight-badge text { font: 700 11px var(--font-display); fill: #fff; text-anchor: middle; dominant-baseline: central; }
.cv .blind { fill: rgba(229, 72, 77, .14); stroke: var(--rect); stroke-width: 2.6; stroke-dasharray: 4 5; animation: blind 1.3s ease-in-out infinite; }
@keyframes blind { 50% { stroke-opacity: .35; } }

/* ----- referees ----- */
.cv .ref { cursor: grab; }
.cv .ref .hit { fill: transparent; }
.cv .ref .cone { stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }
.cv .ref .disc { stroke: #fff; stroke-width: 2; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.cv .ref.eye .disc { stroke: var(--warn); stroke-width: 2.8; }
.cv .ref.pinned .disc { stroke-dasharray: 4 2.5; }
.cv .ref .lbl { font: 700 14px var(--font-display); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.cv .ref .lbl.two { font-size: 10.5px; }
.cv .ref .tag { font: 700 10px var(--font-display); letter-spacing: .06em; fill: #fff; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: rgba(0, 0, 0, .75); stroke-width: 2.8px; pointer-events: none; }
.cv .look-line { stroke: rgba(255, 255, 255, .85); stroke-width: 1.5; stroke-dasharray: 3 3; fill: none; pointer-events: none; }
.cv[data-theme="wood"] .look-line { stroke: rgba(20, 24, 31, .7); }
.cv .look-handle { cursor: grab; }
.cv .look-handle .hit { fill: transparent; }
.cv .look-handle .knob { fill: #fff; stroke: #14181f; stroke-width: 1.6; }
.cv .look-handle.pinned .knob { fill: var(--warn); }
.cv .look-handle .pupil { fill: #14181f; }
.cv.tool-draw .ref, .cv.tool-draw .look-handle, .cv.tool-erase .ref, .cv.tool-erase .look-handle { cursor: inherit; }

.cv .arw.R { stroke-width: 3.4; stroke-dasharray: 10 7; }
.cv .arw.R.role-L { stroke: var(--lead); }
.cv .arw.R.role-T { stroke: var(--trail); }
.cv .arw.R.role-N { stroke: #15181d; }
.cv[data-theme="dark"] .arw.R.role-N { stroke: #cfd6e4; }

/* the mark of a foul or violation, and the whistle */
.cv .mark { stroke-width: 1.5; stroke-linejoin: round; pointer-events: none; }
.cv .mark.foul { fill: var(--orange); stroke: #5a2000; }
.cv .mark.viol { fill: var(--warn); stroke: #5a4300; }
.cv .whistle { pointer-events: none; }
.cv .whistle circle { fill: none; stroke: var(--orange); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: whistle 1.1s ease-out infinite; }
.cv .whistle .w2 { animation-delay: .55s; }
@keyframes whistle { from { transform: scale(.8); opacity: 1; } to { transform: scale(2.1); opacity: 0; } }

/* ----- toolbar ----- */
.whistle-btn { height: 34px; padding: 0 12px; }
.scheme.off span { color: #e9e7df; }
.scheme.def span { color: var(--def, #ffd43b); }
.eye-role button[data-eye="L"].active { color: var(--lead-2); box-shadow: inset 0 0 0 1px var(--lead); }
.eye-role button[data-eye="T"].active { color: var(--trail-2); box-shadow: inset 0 0 0 1px var(--trail); }

/* ----- beside the court: the referee's-eye view and the texts (under the court on narrow or upright screens) ----- */
.board-main { flex: 1; min-height: 0; display: flex; }
.board-stage { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.board-side { flex: none; width: clamp(300px, 34%, 400px); min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.board-side .step-strip { border-top: 0; flex: 1 0 auto; min-height: 0; }
.board-side .ss-cols { grid-template-columns: 1fr; }
.board-side .ss-head { flex-wrap: wrap; gap: 2px 10px; }
body.court-focus .board-side { display: none; }
.ss-cols { align-items: start; }
.ss-col.lead { background: rgba(28, 127, 201, .14); border-color: rgba(28, 127, 201, .42); }
.ss-col.lead b { color: var(--lead-2); }
.ss-col.trail { background: rgba(42, 148, 64, .14); border-color: rgba(42, 148, 64, .42); }
.ss-col.trail b { color: var(--trail-2); }
.ss-col.crew { background: var(--bg-2); }
.ss-col.crew b { color: var(--text); }
.ss-col b i { font-style: normal; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--orange); color: #1b0d02; letter-spacing: .06em; }
.ss-sight { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.sight-chip { display: inline-block; padding: 0 7px; border-radius: 999px; font-weight: 700; color: #fff; background: var(--panel-3); }
.sight-chip.open { background: #12a150; }
.sight-chip.narrow { background: #c98f00; }
.sight-chip.stacked, .sight-chip.blocked { background: var(--rect); }
.ss-note { font-size: 12.5px; color: var(--warn); border-left: 3px solid var(--warn); padding: 1px 0 1px 9px; }

.eye-view { margin: 0; flex: none; padding: 10px 12px 2px; display: flex; flex-direction: column; gap: 5px; }
.eye-view svg { width: 100%; aspect-ratio: 420 / 168; display: block; border-radius: 10px; border: 1px solid var(--line-2); background: #0b0d10; }
.eye-view figcaption { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eye-label { font: 700 12px/1.5 var(--font-display); letter-spacing: .1em; text-transform: uppercase; padding: 0 8px; border-radius: 999px; color: #fff; white-space: nowrap; }
.eye-label.role-L { background: var(--lead); }
.eye-label.role-T { background: var(--trail); }
.eye-label.role-N { background: #2b303a; }
.eye-hint { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ev .ev-sky { fill: #141a24; }
.ev .ev-out { fill: #0b0d10; }
.ev .ev-floor { fill: #e3c08f; }
.ev .ev-paint { fill: #d3a86f; }
.ev .ev-line { fill: none; stroke: rgba(48, 36, 22, .85); stroke-width: 1.2; stroke-linejoin: round; }
.ev[data-theme="dark"] .ev-out { fill: #0b172c; }
.ev[data-theme="dark"] .ev-floor { fill: #10223f; }
.ev[data-theme="dark"] .ev-paint { fill: #173461; }
.ev[data-theme="dark"] .ev-line { stroke: rgba(214, 228, 252, .8); }
.ev .ev-post { fill: none; stroke: #59606c; stroke-width: 2.2; stroke-linecap: round; }
.ev .ev-board { fill: rgba(255, 255, 255, .78); stroke: #2b303a; stroke-width: .8; }
.ev .ev-rim { fill: none; stroke: #ff5a1f; stroke-width: 1.6; }
.ev .ev-body, .ev .ev-head { stroke: #14181f; stroke-width: .8; }
.ev .ev-body.off, .ev .ev-head.off { fill: #f5f4ef; }
.ev .ev-body.def, .ev .ev-head.def { fill: #ffd43b; }
.ev .ev-body.ref, .ev .ev-head.ref { fill: #6f7581; }
.ev .ev-body.ref.role-L, .ev .ev-head.ref.role-L { fill: var(--lead); }
.ev .ev-body.ref.role-T, .ev .ev-head.ref.role-T { fill: var(--trail); }
.ev .ev-label { font-family: var(--font-display); font-weight: 700; fill: #14181f; text-anchor: middle; }
.ev .ev-label.ref { fill: #fff; }
.ev .ev-ball { fill: #f07f1d; stroke: #2a1405; stroke-width: .7; }

/* ----- situation list ----- */
.play-card .thumb { background: #0b0d10; }
.thumb-cv .tok-dot { stroke: #14181f; stroke-width: 3; }
.thumb-cv .tok-dot.off { fill: #f5f4ef; }
.thumb-cv .tok-dot.def { fill: #ffd43b; }
.thumb-cv .ref-dot { stroke: #fff; stroke-width: 5; }
.thumb-cv .arw.R { stroke-width: 9; stroke-dasharray: 22 16; }
.thumb-cv .c-box-label { display: none; }
.manual-ref { font-size: 11.5px; color: var(--muted); margin: 0; align-self: center; }
.step-h { flex-wrap: wrap; }

/* ----- whistle dialog ----- */
.whistle-form { display: flex; flex-direction: column; gap: 10px; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1 1 0; padding: 10px 8px; white-space: normal; line-height: 1.2; }
.call-outcome { margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); display: flex; flex-direction: column; gap: 3px; }
.call-outcome b { font: 700 20px/1.1 var(--font-display); letter-spacing: .04em; text-transform: uppercase; }
.call-outcome b.switch { color: var(--orange-2); }
.call-outcome b.turn { color: var(--warn); }
.call-outcome b.stay { color: var(--ok); }
.call-outcome span { font-weight: 600; }
.call-outcome p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }

/* ----- pregame checklist ----- */
.pregame-head { flex-wrap: wrap; }
.pregame-head .count { margin-left: 0; white-space: nowrap; }
.pregame-head .btn { margin-left: auto; }
.progress { flex: 0 1 140px; height: 8px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); transition: width .2s ease; }
.pregame-body { overflow-y: auto; padding: 2px 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.game-line { width: 100%; height: 40px; }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; align-items: start; }
.topic { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.topic.done { border-color: rgba(47, 210, 127, .55); }
.topic-head { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.topic-head input { position: absolute; opacity: 0; width: 26px; height: 26px; margin: 0; cursor: pointer; }
.topic-head .check { width: 26px; height: 26px; flex: none; border-radius: 8px; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; }
.topic-head .check svg { width: 17px; height: 17px; }
.topic-head input:focus-visible + .check { outline: 2px solid var(--blue); outline-offset: 2px; }
.topic.done .check { background: var(--ok); border-color: var(--ok); color: #05210f; }
.topic h3 { margin: 0; font: 700 19px/1.15 var(--font-display); letter-spacing: .02em; }
.topic-text { margin: 0; color: var(--text-2); font-size: 13.5px; }
.topic-ask { margin: 0; padding-left: 18px; color: var(--warn); font-size: 13px; }
.topic-ask li { margin: 2px 0; }
.topic-sits { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-sits .btn { max-width: 100%; height: auto; min-height: 30px; padding: 5px 10px; white-space: normal; text-align: left; justify-content: flex-start; line-height: 1.2; }
.topic-note { width: 100%; min-height: 36px; resize: vertical; font-size: 13px; }

/* up to tablet width one view at a time: the court needs the room */
@media (max-width: 1100px) {
  .panel-switch .narrow-only { display: flex; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout .library, .layout .board { grid-column: 1; grid-row: 1; }
  .layout[data-panel="board"] .library,
  .layout[data-panel="library"] .board { display: none; }
  .lib-group-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
}
/* narrow or upright screens: the eye view and the texts go under the court, and the board scrolls */
@media (max-width: 860px), (max-height: 600px), (orientation: portrait) and (max-width: 1100px) {
  .board { overflow-y: auto; }
  .board > :not(.board-main) { flex-shrink: 0; }
  .board-main { flex: 1 0 auto; flex-direction: column; }
  .board-stage { flex: 1 0 auto; }
  .court-wrap { min-height: 300px; }
  .board-side { width: auto; overflow: visible; border-left: 0; border-top: 1px solid var(--line); }
  .board-side .ss-cols { grid-template-columns: 1fr 1fr; }
  .eye-view svg { max-height: 190px; }
}
@media (max-width: 860px) {
  .pregame-head .count { display: none; }
}
@media (max-width: 560px) {
  .whistle-btn span { display: none; }
  .topics { grid-template-columns: 1fr; }
  .eye-hint { display: none; }
  .board-side .ss-cols { grid-template-columns: 1fr; }
  .court-wrap { min-height: 0; }
}
@media (max-height: 800px) and (min-width: 861px) {
  .board-side .ss-hint { display: none; }
}
