/* Colour roles only. Every theme shares the approved scoreboard grid, type,
   clocks, statistics, animation and nearly opaque broadcast surfaces. */
body[data-overlay-theme="heritage"] {
  --cream:#f7f4e9; --green:#e4c550; --gold:#e4c550;
  --muted:#becbdf; --black:rgba(17,37,68,.995);
}
body[data-overlay-theme="heritage"] .name-zone { background:#dbe4ef; }
body[data-overlay-theme="heritage"] .name,
body[data-overlay-theme="heritage"] .member.active-member { color:#102c50; }
body[data-overlay-theme="heritage"] .member { color:#53657d; }
body[data-overlay-theme="heritage"] .points { background:#173762;color:#fff9e8; }
body[data-overlay-theme="heritage"] .frames,
body[data-overlay-theme="heritage"] .timer-under { color:#172c49; }
body[data-overlay-theme="heritage"] .result-separator { color:#172c49; }
body[data-overlay-theme="heritage"] .interval .points { color:#aab8ca; }
body[data-overlay-theme="heritage"] .match-outcome { color:#becbdf; }
body[data-overlay-theme="heritage"] .match-outcome.won { color:#e4c550; }
body[data-overlay-theme="heritage"] .shot-time { color:#175c41; }
body[data-overlay-theme="heritage"] .shot-time.urgent { color:#b82739; }
body[data-overlay-theme="heritage"] .player.active::before { filter:brightness(.58) saturate(1.25); }
body[data-overlay-theme="heritage"] .ball-count { color:#f3f0e9; }

body[data-overlay-theme="purple"] {
  --cream:#f1edf5; --green:#b79bbd; --gold:#dfc68d;
  --muted:#c0b6ca; --black:rgba(34,24,56,.995);
}
body[data-overlay-theme="purple"] .name-zone { background:#291e4b; }
body[data-overlay-theme="purple"] .points { background:#44305f; }
body[data-overlay-theme="purple"] .frames,
body[data-overlay-theme="purple"] .timer-under,
body[data-overlay-theme="purple"] .result-separator { color:#241932; }
body[data-overlay-theme="purple"] .member { color:#b9adc8; }
body[data-overlay-theme="purple"] .player.active::before { filter:saturate(.3) brightness(1.35); }
body[data-overlay-theme="purple"] .metric-scale { background:#50415f; }
body[data-overlay-theme="purple"] .metric-scale-fill { background:#b79bbd; }

body[data-overlay-theme="blackgold"] {
  --cream:#efe7d1; --green:#b5a276; --gold:#dcc894;
  --muted:#b9b5a8; --black:rgba(18,19,17,.995);
}
body[data-overlay-theme="blackgold"] .name-zone { background:#161716; }
body[data-overlay-theme="blackgold"] .points { background:#272823; }
body[data-overlay-theme="blackgold"] .frames,
body[data-overlay-theme="blackgold"] .timer-under,
body[data-overlay-theme="blackgold"] .result-separator { color:#222218; }
body[data-overlay-theme="blackgold"] .player.active::before { filter:sepia(1) saturate(.6) brightness(1.2); }
body[data-overlay-theme="blackgold"] .metric-scale { background:#474739; }
body[data-overlay-theme="blackgold"] .metric-scale-fill { background:#b5a276; }

/* Ball counts and comparison accents retain the same neutral ink in all themes. */
body[data-overlay-theme]:not([data-overlay-theme="club"]) .ball-count { color:#f3f0e9; }

/* WSC-inspired colours and saved user palettes share our compact geometry.
   Only validated RGB roles enter CSS. Physical ball colours stay unchanged. */
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) {
  --green:var(--theme-match-bg);--black:var(--theme-stat-values-bg);
  --cream:var(--theme-name-text);--muted:var(--theme-secondary-text);
  --gold:var(--theme-comparison-accent);
}
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .name-zone { background:var(--theme-name-bg); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .name,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .member.active-member { color:var(--theme-name-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .points { background:var(--theme-points-bg);color:var(--theme-points-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .frames,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .result-separator { color:var(--theme-match-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .interval .points { color:color-mix(in srgb,var(--theme-points-text) 50%,var(--theme-points-bg)); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .match-outcome { color:var(--theme-secondary-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .match-outcome.won { color:var(--theme-comparison-accent); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .stat-caption { background:var(--theme-stat-title-bg); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .context-label { color:var(--theme-stat-title-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .stats-panel,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .metrics { color:var(--theme-stat-values-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .stat-side.better .context-value { color:var(--theme-comparison-accent); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .visit { color:var(--theme-break-text);background:var(--theme-break-bg,var(--theme-stat-values-bg)); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .clock-under,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .timer-under,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .context-under { background:var(--theme-timer-bg);color:var(--theme-timer-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .common-value,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .local-timer-value { color:var(--theme-timer-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .caption-detail,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .stat-value-detail,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .break-list,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .metric-label { color:var(--theme-secondary-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .player.active::before {
  background:var(--theme-pointer);filter:none;
}
/* Auxiliary plates follow the selected palette. WSC uses black with light ink;
   custom palettes keep their saved values. Physical balls remain unchanged. */
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .board .timer-under.shoot-out-label { background:var(--theme-timer-bg);color:var(--theme-timer-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .frame-number,
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .frame-result-dash { color:var(--theme-secondary-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .frame-result-points { color:var(--theme-stat-values-text); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .frame-result-points.won { color:var(--theme-comparison-accent); }
body:is([data-overlay-theme="wsc"],[data-overlay-theme="custom"]) .shot-time:not(.urgent) { color:var(--theme-name-text); }
/* WSC keeps its warm names, ivory frame points and teal match score.
   Upper/lower information uses the same quiet black surfaces as the app.
   Colour boundaries do the separating: no inset rails or painted dividers. */
body[data-overlay-theme="wsc"] .match-outcome { background:var(--theme-points-bg);color:#485651; }
body[data-overlay-theme="wsc"] .match-outcome.won { background:var(--theme-points-bg);color:#216845; }
/* Double-digit frame totals retain air around the best-of value in the fixed144px rail. */
body[data-overlay-theme="wsc"] .frames:not(.final-result):not(.shoot-out) { grid-template-columns:minmax(0,1fr) 48rem minmax(0,1fr); }
body[data-overlay-theme="wsc"] .frames:not(.final-result) .frame-count { font-size:25rem; }
body[data-overlay-theme="wsc"] .best-of { font-size:18rem; }
body[data-overlay-theme="wsc"] .context-value { color:var(--theme-stat-values-text); }
body[data-overlay-theme="wsc"] .board .stats-panel>.stat-caption :is(.context-label,.common-value) { color:var(--theme-stat-title-text); }
body[data-overlay-theme="wsc"] .board .stats-panel>.stat-caption .caption-detail { color:var(--theme-secondary-text); }
body[data-overlay-theme="wsc"] .board .timer-under.ready-status,
body[data-overlay-theme="wsc"] .board .timer-under.finished-status { color:#77BB91; }
body[data-overlay-theme="wsc"] .board .timer-under.interval-status { color:#C6B58C; }
body[data-overlay-theme="wsc"] .board .timer-under.in-play-status { color:#C7464A; }
body[data-overlay-theme="wsc"] .board .timer-under.paused-status,
body[data-overlay-theme="wsc"] .board .timer-under.canceled-status { color:#AEBBB2; }
body[data-overlay-theme="wsc"] .board .shot-slot .shot-time:not(.urgent):not(.amber):not(.idle) { color:#F3F0E9; }
body[data-overlay-theme="wsc"] .board .shot-slot .shot-time.urgent { color:#F35F64; }
body[data-overlay-theme="wsc"] .board .shot-slot .shot-time.amber { color:#E5BF54; }
body[data-overlay-theme="wsc"] .board .shot-slot .shot-time.idle { color:#787C80; }
body[data-overlay-theme="wsc"] .foul-cross,
body[data-overlay-theme="wsc"] .blue-lost { color:#F35F64; }
body[data-overlay-theme="wsc"] .blue-won { color:#79AD91; }
body[data-overlay-theme="wsc"] .shot-meter::before { background:#303432; }

/* WSC paints one continuous information rail per occupied row. The rail is
   behind all cells, so overlapping entering/leaving stories never darken it
   twice. Empty rows remain transparent and the fixed scoreboard does not move. */
body[data-overlay-theme="wsc"] .board { --wsc-aux-surface:rgba(6,9,8,.94); }
body[data-overlay-theme="wsc"] .board::before,
body[data-overlay-theme="wsc"] .board::after {
  content:'';position:absolute;left:0;right:0;pointer-events:none;z-index:0;
  background:var(--wsc-aux-surface);opacity:0;transition:opacity 240ms ease;
}
body[data-overlay-theme="wsc"] .board::before { bottom:100%;height:48rem; }
body[data-overlay-theme="wsc"] .board::after { top:48rem;height:var(--lower-plate-height); }
body[data-overlay-theme="wsc"] .board:has(>.aux-host:not(:empty),>.break-host:not(:empty))::before { opacity:1; }
body[data-overlay-theme="wsc"] .board:has(>.timer-under:not([hidden]),>.context-under,>.clock-under,>.shot-meter:not([hidden]),>.blue-progress)::after { opacity:1; }
body[data-overlay-theme="wsc"] .board.ready::before,
body[data-overlay-theme="wsc"] .board.ready::after { filter:brightness(.56); }
body[data-overlay-theme="wsc"] .board :is(.aux-layer,.visit,.metrics,.stats-panel,.stat-side,.context-value,.stat-side .balls,.break-list,.stat-timer,.clock-under,.timer-under,.context-under,.shot-meter,.blue-progress) { background:transparent; }
body[data-overlay-theme="wsc"] .board :is(.context-value,.break-label,.break-value,.metric-value,.common-value,.local-timer-value) { color:#F3F0E9; }
body[data-overlay-theme="wsc"] .board :is(.metric-label,.local-timer-label,.caption-detail,.stat-value-detail,.break-list) { color:#C7CDC9; }
body[data-overlay-theme="wsc"] .board .stats-panel>.stat-caption { background:#060908; }
body[data-overlay-theme="wsc"] .board .stats-panel>.stat-caption :is(.context-label,.common-value) { color:#F3F0E9; }
body[data-overlay-theme="wsc"] .board .stats-panel>.stat-caption .caption-detail { color:#C7CDC9; }
/* Match the full lower rail, rather than centring in its old 23px sub-row.
   The renderer keeps the label/value ink on one shared optical baseline. */
body[data-overlay-theme="wsc"] .board .context-under,
body[data-overlay-theme="wsc"] .board :is(.local-timer-label,.local-timer-value) { height:var(--lower-plate-height); }
body[data-overlay-theme="wsc"] .board .shot-time { font-size:19rem; }
/* Highest break stays on the black rail; timer dashes stay light on aqua. */
body[data-overlay-theme="wsc"] .board .stats-panel>.stat-caption[aria-label="Highest break"] { background:#060908; }
body[data-overlay-theme="wsc"] .board .time:is(.blue-decider,.expired) { color:#F3F5F2; }
body[data-overlay-theme="wsc"] .board .stats-panel>.stat-caption[aria-label="Highest break"] :is(.context-label,.common-value) { color:#F3F0E9; }
body[data-overlay-theme="wsc"] .board .stats-panel>.stat-caption[aria-label="Highest break"] .caption-detail { color:#C7CDC9; }
body[data-overlay-theme="wsc"] .board .stat-side.better .context-value { color:#F3F0E9; }
body[data-overlay-theme="wsc"] .board .metric-subject.secured .metric-value { color:#F3F0E9; }
body[data-overlay-theme="wsc"] .board .metric-subject.snookers .metric-value { color:#E58286; }
body[data-overlay-theme="wsc"] .board .frame-result-points.won { color:var(--theme-comparison-accent); }
/* Keep the lower rail position; the smaller clock is separated from its fill.
   Warning colours and the WSC rail position remain unchanged. */
body[data-overlay-theme="wsc"] .board .shot-meter::before,
body[data-overlay-theme="wsc"] .board .shot-meter>.shot-fill { bottom:6rem; }
body[data-overlay-theme="wsc"] .board .shot-meter>.shot-fill:not(.urgent):not(.amber) { background:#C7CDC9; }
/* Reuse the renderer's existing event classes and timing. Stronger dark
   sweeps remain visible on the warm name panels without covering the name. */
body[data-overlay-theme="wsc"] .name-zone::after { background:linear-gradient(110deg,transparent 5%,rgb(var(--event-tint) / .10) 27%,rgb(var(--event-tint) / .38) 46%,rgb(var(--event-tint) / .08) 63%,transparent 83%);background-size:180% 100%; }
body[data-overlay-theme="wsc"] .name-zone.event-highest::after,
body[data-overlay-theme="wsc"] .name-zone.event-frame-ball::after { --event-tint:35 40 38; }
body[data-overlay-theme="wsc"] .name-zone.event-foul::after { --event-tint:185 35 48; }
body[data-overlay-theme="wsc"] .name-zone.event-frame::after { --event-tint:30 105 65; }
@media(prefers-reduced-motion:reduce) {
  body[data-overlay-theme="wsc"] .board::before,body[data-overlay-theme="wsc"] .board::after { transition:none; }
}

/* 225: WSC typography and contrast share the main match-score treatment. */
body[data-overlay-theme="wsc"] .board .shot-slot .shot-time:not(.urgent):not(.amber):not(.idle) { color:#79AD91; }
body[data-overlay-theme="wsc"] .board .shot-meter>.shot-fill:not(.urgent):not(.amber) { background:#79AD91; }
body[data-overlay-theme="wsc"] .board .interval .points { color:#485651; }
body[data-overlay-theme="wsc"] .board.interval .points { color:#485651; }
body[data-overlay-theme="wsc"] .board .result-separator { color:#F3F5F2; }
body[data-overlay-theme="wsc"] .board .match-outcome { background:var(--theme-points-bg);color:#485651; }
body[data-overlay-theme="wsc"] .board .match-outcome.won { background:var(--theme-points-bg);color:#216845; }

/* Lower tactical notice follows the existing WSC rail. Caption typography remains the original cream treatment. */
body[data-overlay-theme="wsc"] .board .chance-under{height:var(--lower-plate-height);background:transparent}
body[data-overlay-theme="wsc"] .board:has(>.chance-under)::after{opacity:1}


/*253: darker, slightly larger outcome words on the existing ivory cells. */
body[data-overlay-theme="wsc"] .board .match-outcome{font-size:26rem;color:#242a27}
body[data-overlay-theme="wsc"] .board .match-outcome.won{color:#216845}
