/* Hall display (Graphite). Loaded after feedback-view.css and before ui.css.
   The authority for the audience board's distance hierarchy, time-up and warning states, the exit control,
   the second-screen display window, and the operator's board settings. Colors come from the board's
   --tv-* variables (match-display.css) so both board themes work. */

/* ---------- Distance hierarchy: clock = score > names > match number ----------
   Sizes scale with the board width (cqw) so the in-page preview, a laptop and a hall TV keep the same order.
   The compact layout ("Match number first") lets the match number match the clock, never exceed it. */
.tv-scoreboard[class] .tv-display-content .tv-time output{font-size:clamp(48px,7cqw,150px);line-height:1;letter-spacing:-.02em}
.tv-scoreboard[class] .tv-display-content .tv-athlete>.tv-score{font-size:clamp(48px,7cqw,150px);line-height:1;margin:6px 0 10px}
.tv-scoreboard[class] .tv-display-content h3.tv-athlete-identity{font-size:clamp(20px,2.6cqw,56px);line-height:1.15}
.kata-tv-scoreboard[class] .tv-display-content h3.tv-athlete-identity{font-size:clamp(28px,4.4cqw,80px)}
.tv-scoreboard[class] .tv-display-content .tv-hero-number{font-size:clamp(40px,5cqw,110px);line-height:1}
.tv-scoreboard[class].tv-layout-compact .tv-display-content .tv-hero-number{font-size:clamp(48px,7cqw,150px)}
.tv-scoreboard[class] .tv-display-content .tv-time>span,.tv-scoreboard[class] .tv-display-content .tv-time>small{font-size:clamp(12px,1.3cqw,26px)}
.tv-scoreboard[class] .tv-display-content .tv-time>strong{font-size:clamp(13px,1.5cqw,30px)}

/* ---------- Time up: an amber clock plus a solid "TIME UP" block, so it never relies on color alone ---------- */
.tv-scoreboard[class] .tv-time{border-radius:10px;transition:box-shadow .2s}
.tv-scoreboard[class] .tv-time.time-expired{box-shadow:inset 0 0 0 3px var(--tv-warn)}
.tv-scoreboard[class] .tv-time.time-expired output{color:var(--tv-warn-text)}
.tv-scoreboard[class] .tv-time.time-expired>strong{background:var(--tv-warn);color:var(--tv-warn-fg);border-color:var(--tv-warn-edge);font-weight:700;letter-spacing:.08em;text-transform:uppercase}

/* ---------- Warnings: numbered pips, readable at distance and on the aka corner ---------- */
.tv-scoreboard[class] .tv-warnings{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:clamp(6px,.8cqw,14px)}
.tv-scoreboard[class] .tv-warnings .tv-warning-label{font-size:clamp(11px,1.2cqw,24px);font-weight:600;margin-right:2px}
.tv-scoreboard[class] .tv-warning-dot{display:inline-grid;place-items:center;flex:none;width:clamp(22px,2.6cqw,52px);height:clamp(22px,2.6cqw,52px);border:2px solid currentColor;border-radius:50%;background:transparent;color:inherit;opacity:.55;font:700 clamp(11px,1.3cqw,26px)/1 var(--font-head);font-variant-numeric:tabular-nums}
.tv-scoreboard[class] .tv-warning-dot.warning-active{opacity:1;background:var(--tv-warn);border-color:var(--tv-warn-fg);color:var(--tv-warn-fg);box-shadow:0 0 0 2px var(--tv-bg)}

/* ---------- Up next: readable from the stands ---------- */
.tv-scoreboard[class] .tv-next h3{font-size:clamp(11px,1.1cqw,22px)}
.tv-scoreboard[class] .tv-display-content .tv-next>div{grid-template-columns:minmax(3.2em,auto) minmax(0,1fr) auto;font-size:clamp(14px,1.6cqw,32px)}

/* ---------- Exit control: 48px, 3:1 outline, hidden after 3 s idle; a hint explains Esc / double-click ---------- */
.tv-scoreboard[class] .tv-exit-display{width:48px;height:48px;top:12px;right:12px;padding:0;opacity:1;border:1px solid var(--tv-muted);border-radius:10px;background:var(--tv-panel);color:var(--tv-fg);transition:opacity .2s,background-color .15s}
.tv-scoreboard[class] .tv-exit-display .ui-i{width:24px;height:24px}
html.af-display-idle .tv-scoreboard[class] .tv-exit-display:not(:focus-visible){opacity:0;pointer-events:none}
html.af-display-idle .tv-scoreboard[class]{cursor:none}
.tv-display-hint{display:none}
.tv-display-hint>span{display:none}
html.af-display-hint .tv-scoreboard[class] .tv-display-hint{display:block;position:absolute;left:50%;bottom:clamp(12px,2.5vmin,32px);transform:translateX(-50%);z-index:6;max-width:calc(100% - 32px);padding:10px 18px;border:1px solid var(--tv-line-strong);border-radius:999px;background:var(--tv-panel);color:var(--tv-fg);font:500 clamp(13px,1.8vmin,20px)/1.3 var(--font-body);text-align:center;pointer-events:none}
html.af-display-presenting .tv-display-hint>[data-hint="exit"]{display:inline}
html.af-display-window:not(.af-display-presenting) .tv-display-hint>[data-hint="enter"]{display:inline}
.tv-scoreboard:focus{outline:none}

/* ---------- Second-screen display window (?display=1): the board is the whole page ---------- */
html.af-display-window,html.af-display-window body{margin:0;background:#09090b;overflow:hidden}
html.af-display-window .tv-scoreboard[class]{position:fixed;inset:0;z-index:1;box-sizing:border-box;width:100vw;height:100dvh;max-width:none;margin:0;border:0;border-radius:0;padding:clamp(8px,1.5vmin,20px);overflow:hidden;align-items:center;justify-content:center}
html.af-display-window .tv-scoreboard[class] .tv-display-content{flex:0 0 auto;max-width:none;min-height:0;transform-origin:top center}

/* ---------- Operator board settings (outside the board; follows the app theme) ---------- */
.hall-controls{display:grid;gap:16px;margin-top:16px}
.hall-status{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-height:22px}
.hall-status:empty{display:none}
.hall-live{display:inline-flex;align-items:center;gap:8px;font-weight:500;color:var(--muted)}
.hall-live::before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor}
.hall-live[data-state="running"]{color:var(--ok)}
.hall-live[data-state="expired"]{color:var(--warn)}
.hall-hint{margin:0}
.hall-setting{display:grid;gap:6px}
.hall-setting-label{font-size:13px;font-weight:500;color:var(--fg)}
.ui-manager .hall-controls .graphite-segment{display:flex;width:100%;box-sizing:border-box}
.ui-manager .hall-controls .graphite-segment .tab{flex:1 1 0;min-width:0;white-space:normal;line-height:1.2}
.ui-manager .hall-controls .graphite-segment .tab:focus-visible{outline:2px solid var(--ring);outline-offset:1px}
.ui-manager .hall-controls select{width:100%}
[data-hall-status][hidden]{display:none!important}
.hall-link-field{width:100%;box-sizing:border-box;margin-top:8px;font-family:var(--font-head)}

/* Touch screens (tatami tablets): 44px targets for every hall control. */
@media (pointer:coarse){
 .ui-manager .page-head:has(+ .graphite-feedback) .btn,
 .ui-manager .hall-controls .graphite-segment .tab,
 .ui-manager .hall-controls select{min-height:44px}
}

@media (prefers-reduced-motion:reduce){
 .tv-scoreboard[class] .tv-exit-display,.tv-scoreboard[class] .tv-time{transition:none}
}
