/* BotFeud design system. Every BotFeud page loads site.css first, then this sheet, and puts
   class="bf" on <body>. Nothing here touches the rest of the site.

   The look: 90% ink, chalk and ash. Colour is a signal, never decoration:
     crimson = danger (heavy telegraphs, crits, low HP)     cyan = guard, parry, energy
     gold    = tokens (pot, streaks, gadgets)               violet = cage rules, hazards, debuffs

   Pieces other pages reuse:
     .bf-box        the white-bordered battle box (put a square canvas in it)
     .bf-card       a full overlay inside a .bf-box (walkout, decision, errors)
     .bf-say        the text box (filled by createTextBox in arena.js)
     .bf-panel      a quiet bordered panel; .bf-label is its small heading
     .bf-btn        a button; aria-pressed="true" or .is-on inverts it; .bf-btn-main is the big one
     .bf-badge      a small bordered tag; -gold -violet -cyan -crimson -live variants
     .bf-bar        a meter: set --v (0 to 1) on .bf-bar-fill; .bf-hp and .bf-en are the two kinds
     .bf-fighter    a fighter card (mask portrait, name, HP, energy, gadget pips)
     .bf-pips       gadget charges; .bf-pip.is-used is a spent one
     .bf-table      a three-column comparison table (left value, label, right value)
     .bf-mono       monospace readout text;  .bf-title  the Anton display line
   No inline styles anywhere: scripts set custom properties with style.setProperty. */

:root{
  --bf-ink:#0A0A0D;
  --bf-ink-2:#111116;      /* raised surface */
  --bf-chalk:#F5F5F7;
  --bf-ash:#2B2B33;
  --bf-ash-2:#3A3A46;      /* hairlines on ink */
  --bf-fog:#9A9AA6;        /* secondary text, 7:1 on ink */
  --bf-crimson:#FF2A4B;
  --bf-cyan:#00E5FF;
  --bf-gold:#FFB800;
  --bf-violet:#B84DFF;
  --bf-frame:4px;          /* battle-box border */
  --bf-line:2px;           /* text boxes, buttons */
  --bf-mono:var(--mono);
  --bf-gap:12px;
}

body.bf{background:var(--bf-ink);color:var(--bf-chalk)}
.bf :focus-visible{outline:2px solid var(--bf-chalk);outline-offset:3px;border-radius:0}
.bf ::selection{background:var(--bf-chalk);color:var(--bf-ink)}
.bf .bar{background:linear-gradient(to bottom,rgba(10,10,13,.96),rgba(10,10,13,.8) 70%,rgba(10,10,13,0))}
.bf .foot{position:relative;z-index:2}

/* ---------- type ---------- */
.bf-mono{font-family:var(--bf-mono);font-variant-numeric:tabular-nums}
.bf-title{font:400 var(--step-4)/.92 var(--display);text-transform:uppercase;letter-spacing:.01em}
.bf-label{font:600 12px/1.2 var(--label);letter-spacing:.16em;text-transform:uppercase;color:var(--bf-fog)}

/* ---------- buttons ---------- */
.bf-btn{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:0 14px;background:var(--bf-ink);color:var(--bf-chalk);border:var(--bf-line) solid var(--bf-chalk);border-radius:0;font:600 13px/1 var(--label);letter-spacing:.1em;text-transform:uppercase;text-decoration:none;white-space:nowrap;transition:background-color .12s,color .12s}
.bf-btn:hover,.bf-btn[aria-pressed="true"],.bf-btn.is-on{background:var(--bf-chalk);color:var(--bf-ink)}
.bf-btn:active{transform:translateY(1px)}
.bf-btn-main{min-width:92px}
.bf-btn-live{border-color:var(--bf-crimson);color:var(--bf-crimson)}
.bf-btn-live:hover{background:var(--bf-crimson);color:var(--bf-ink)}
.bf-btn[disabled]{opacity:.4;cursor:default}

/* ---------- badges ---------- */
.bf-badge{display:inline-flex;align-items:center;gap:6px;min-height:22px;padding:0 7px;border:1px solid var(--bf-ash-2);color:var(--bf-fog);font:600 11px/1 var(--bf-mono);letter-spacing:.06em;text-transform:uppercase;white-space:nowrap}
.bf-badge-gold{border-color:var(--bf-gold);color:var(--bf-gold)}
.bf-badge-violet{border-color:var(--bf-violet);color:var(--bf-violet)}
.bf-badge-cyan{border-color:var(--bf-cyan);color:var(--bf-cyan)}
.bf-badge-crimson{border-color:var(--bf-crimson);color:var(--bf-crimson)}
.bf-badge-live{border-color:var(--bf-crimson);color:var(--bf-chalk)}
.bf-badge-live::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--bf-crimson);animation:bf-blink 1.2s steps(2,end) infinite}
@keyframes bf-blink{50%{opacity:.25}}

/* ---------- panels ---------- */
.bf-panel{border:1px solid var(--bf-ash-2);background:var(--bf-ink-2);padding:12px 14px}
.bf-panel>.bf-label{display:block;margin-bottom:10px}

/* ---------- meters ---------- */
.bf-bar{position:relative;height:12px;background:var(--bf-ash);overflow:hidden}
.bf-bar-fill,.bf-bar-lag{position:absolute;inset:0;transform-origin:left center;transform:scaleX(var(--v,1))}
.bf-bar-fill{background:var(--bf-chalk)}
.bf-bar-lag{background:var(--bf-crimson);transition:transform .7s .25s ease-out}
.bf-en{height:5px}
.bf-en .bf-bar-fill{background:var(--bf-cyan)}
.is-low .bf-hp .bf-bar-fill{background:var(--bf-crimson);animation:bf-pulse .7s ease-in-out infinite}
@keyframes bf-pulse{50%{opacity:.55}}

/* ---------- the battle box ---------- */
.bf-box{position:relative;width:100%;aspect-ratio:1;border:var(--bf-frame) solid var(--bf-chalk);background:var(--bf-ink);overflow:hidden}
.bf-arena{display:block;width:100%;height:100%;aspect-ratio:1;max-width:none;touch-action:pan-y}
.bf-card{position:absolute;inset:0;z-index:2;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:16px;background:rgba(10,10,13,.9);text-align:center;overflow:auto}
.bf-card-kicker{font:600 12px/1 var(--label);letter-spacing:.22em;text-transform:uppercase;color:var(--bf-fog)}
.bf-card-title{font:400 clamp(2rem,9cqw,4.2rem)/.92 var(--display);text-transform:uppercase;letter-spacing:.01em;text-wrap:balance}
.bf-box{container-type:inline-size}
.bf-card-sub{font:500 14px/1.4 var(--bf-mono);color:var(--bf-chalk)}
.bf-card-note{font:400 14px/1.5 var(--body);color:var(--bf-fog);max-width:34ch}
.bf-card-note a{color:var(--bf-chalk)}
.bf-card-face{width:clamp(64px,22cqw,120px);height:clamp(64px,22cqw,120px)}
.bf-card-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:6px}
.bf-card-vs{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:8px 14px;width:100%;max-width:460px}
.bf-card-vs .bf-card-face{justify-self:center}
.bf-card-vs-word{font:400 clamp(1.4rem,6cqw,2.4rem)/1 var(--display);color:var(--bf-fog)}
.bf-card-name{font:600 clamp(.95rem,3.6cqw,1.3rem)/1.1 var(--label);text-transform:uppercase;letter-spacing:.04em;overflow-wrap:anywhere}
.bf-card-rec{font:500 12px/1.3 var(--bf-mono);color:var(--bf-fog)}
.bf-card-count{font:700 clamp(1.6rem,8cqw,3rem)/1 var(--bf-mono);font-variant-numeric:tabular-nums}
.bf-score{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;width:100%;max-width:380px;font:700 15px/1 var(--bf-mono);font-variant-numeric:tabular-nums}
.bf-score-bar{position:relative;height:8px;background:var(--bf-ash)}
.bf-score-bar>span{position:absolute;inset:0;background:var(--bf-chalk);transform-origin:left center;transform:scaleX(var(--v,.5))}
.bf-card-stats{display:none;grid-template-columns:repeat(3,1fr);gap:6px 18px;width:100%;max-width:380px;margin-top:2px}
.bf-card-stats>div{display:flex;flex-direction:column;gap:3px;font:700 14px/1 var(--bf-mono);font-variant-numeric:tabular-nums}
.bf-card-stats small{font:500 10px/1 var(--label);letter-spacing:.14em;text-transform:uppercase;color:var(--bf-fog)}
@container (min-width:430px){.bf-card-stats{display:grid}}
.bf-card.is-error .bf-card-title{font-size:clamp(1.6rem,7cqw,2.8rem)}

/* ---------- the text box ---------- */
.bf-say{display:flex;align-items:center;gap:12px;min-height:60px;padding:8px 14px;border:var(--bf-line) solid var(--bf-chalk);background:var(--bf-ink)}
.bf-say-face{flex:none;width:44px;height:44px}
.bf-say-face.is-empty{display:none}
.bf-say-text{margin:0;font:500 15px/1.35 var(--bf-mono);color:var(--bf-chalk);min-width:0;overflow-wrap:anywhere}
.bf-say-star{margin-right:.6ch}
.bf-say-who{color:var(--bf-fog)}
.bf-say.is-idle .bf-say-text{color:var(--bf-fog)}
.bf-say.is-empty .bf-say-star{visibility:hidden}

/* ---------- fighter card ---------- */
.bf-fighter{display:flex;gap:12px;align-items:flex-start;min-width:0;contain:layout style}
.bf-face{flex:none;width:72px;height:72px}
.bf-fighter-main{flex:1;min-width:0}
.bf-name-row{display:flex;align-items:baseline;gap:8px;margin:0 0 2px}
.bf-name{font:600 1.25rem/1.1 var(--label);letter-spacing:.03em;text-transform:uppercase;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.bf-streak{flex:none;font:700 11px/1 var(--bf-mono);color:var(--bf-gold);border:1px solid var(--bf-gold);padding:3px 5px}
.bf-record{margin:0 0 8px;font:500 12px/1.2 var(--bf-mono);color:var(--bf-fog);min-height:14px}
.bf-readout{display:flex;align-items:center;gap:8px;margin:4px 0 8px;font:700 13px/1 var(--bf-mono);font-variant-numeric:tabular-nums}
.bf-readout-k{color:var(--bf-fog);font-weight:500}
.bf-status-word{margin-left:auto;color:var(--bf-fog);font-weight:500;font-size:11px;letter-spacing:.06em;white-space:nowrap}
.bf-status-word[data-s="WINDUP_HEAVY"]{color:var(--bf-crimson)}
.bf-status-word[data-s="GUARDING"]{color:var(--bf-cyan)}
.bf-status-word[data-s="GADGET"]{color:var(--bf-gold)}
.bf-status-word[data-s="STUNNED"]{color:var(--bf-violet)}
.bf-readout-low{margin-bottom:0}
.bf-pips{display:inline-flex;gap:6px;margin-left:auto}
.bf-pip{display:inline-flex;align-items:center;gap:4px;padding:2px 5px;border:1px solid var(--bf-gold);color:var(--bf-gold);font:600 10px/1 var(--bf-mono);letter-spacing:.04em}
.bf-pip::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--bf-gold)}
.bf-pip.is-used{border-color:var(--bf-ash-2);color:var(--bf-ash-2);text-decoration:line-through}
.bf-pip.is-used::before{background:transparent;box-shadow:inset 0 0 0 1px var(--bf-ash-2)}
.bf-fighter-b{flex-direction:row-reverse;text-align:right}
.bf-fighter-b .bf-name-row{flex-direction:row-reverse}
.bf-fighter-b .bf-readout{flex-direction:row-reverse}
.bf-fighter-b .bf-status-word,.bf-fighter-b .bf-pips{margin-left:0;margin-right:auto}
.bf-fighter-b .bf-bar-fill,.bf-fighter-b .bf-bar-lag{transform-origin:right center}

/* ---------- comparison table ---------- */
.bf-table{width:100%;border-collapse:collapse;font:500 13px/1.3 var(--bf-mono);font-variant-numeric:tabular-nums}
.bf-table td,.bf-table th{padding:5px 0;border-top:1px solid var(--bf-ash);vertical-align:top}
.bf-table tr:first-child td,.bf-table tr:first-child th{border-top:0}
.bf-table th{font:500 11px/1.5 var(--label);letter-spacing:.12em;text-transform:uppercase;color:var(--bf-fog);text-align:center;padding-inline:8px;white-space:nowrap}
.bf-table td{width:34%;overflow-wrap:anywhere}
.bf-table td:last-child{text-align:right}
.bf-table td.is-best{color:var(--bf-chalk);font-weight:700}
.bf-table td{color:var(--bf-fog)}

/* ---------- watch page layout ---------- */
.bf-watch{position:relative;z-index:2;max-width:1500px;margin:0 auto;padding:calc(var(--head-h) + 14px) var(--gutter) 36px}
.bf-stage{display:grid;gap:var(--bf-gap);grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-areas:"fa clock fb" "badges badges badges" "box box box" "say say say" "scrub scrub scrub" "ctrl ctrl ctrl" "status status status" "hint hint hint" "feed feed feed" "info info info"}
.bf-col{display:contents}
.bf-fighter-a{grid-area:fa}
.bf-fighter-b{grid-area:fb}
.bf-clock{display:contents}
.bf-clock-main{grid-area:clock}
.bf-badges{grid-area:badges}
.bf-box{grid-area:box}
.bf-say{grid-area:say}
.bf-scrub{grid-area:scrub}
.bf-controls{grid-area:ctrl}
.bf-status{grid-area:status}
.bf-hint{grid-area:hint}
.bf-feed{grid-area:feed}
.bf-info{grid-area:info;display:grid;gap:var(--bf-gap)}

.bf-clock-main{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center;min-width:64px;padding-top:6px;contain:layout style}
.bf-scrub,.bf-say,.bf-info,.bf-controls{contain:layout style}
.bf-round{font:600 11px/1 var(--label);letter-spacing:.16em;color:var(--bf-fog);white-space:nowrap}
.bf-time{font:700 1.5rem/1 var(--bf-mono);font-variant-numeric:tabular-nums}
.bf-badges{display:flex;flex-wrap:wrap;justify-content:center;gap:4px}

/* phones: the fighter cards shrink into a versus bar */
.bf-fighter{position:relative;display:block}
.bf-fighter .bf-face{position:absolute;top:0;left:0;width:34px;height:34px}
.bf-fighter-b .bf-face{left:auto;right:0}
.bf-fighter .bf-name-row{min-height:34px;align-items:center;padding-left:40px;margin-bottom:5px}
.bf-fighter-b .bf-name-row{padding-left:0;padding-right:40px}
.bf-fighter .bf-name{font-size:.92rem;line-height:1.05;white-space:normal;overflow-wrap:anywhere}
.bf-fighter .bf-record,.bf-fighter .bf-readout-low,.bf-fighter .bf-pip-name{display:none}
.bf-fighter .bf-hp{height:10px}
.bf-fighter .bf-en{position:relative;margin-top:2px;height:4px}
.bf-fighter .bf-fighter-main{display:flex;flex-direction:column}
.bf-fighter .bf-readout{order:5;margin:5px 0 0;font-size:12px}
.bf-fighter .bf-pip{padding:3px 4px}

/* scrubber */
.bf-scrub{display:flex;align-items:center;gap:10px}
.bf-scrub-bar{position:relative;flex:1;min-width:0}
.bf-scrub-time{flex:none;font-size:12px;color:var(--bf-fog);min-width:4ch}
.bf-scrub-time:last-child{text-align:right}
.bf-track{position:relative;height:22px;border:1px solid var(--bf-ash-2);background:var(--bf-ink-2);overflow:hidden}
.bf-track-fill{position:absolute;inset:0;background:var(--bf-ash);transform-origin:left center;transform:scaleX(var(--v,0))}
.bf-track-breaks{position:absolute;inset:0}
.bf-break{position:absolute;top:0;bottom:0;left:calc(var(--x) * 100%);width:calc(var(--w) * 100%);background:repeating-linear-gradient(135deg,transparent 0 4px,rgba(245,245,247,.12) 4px 6px)}
.bf-pins{position:absolute;inset:0}
.bf-pin{position:absolute;top:3px;bottom:3px;width:2px;margin-left:-1px;left:calc(var(--x) * 100%);background:var(--bf-crimson)}
.bf-pin-parry{background:var(--bf-cyan);top:9px}
.bf-pin-plan{background:var(--bf-chalk);top:auto;bottom:0;height:6px;width:3px}   /* a coach sent a plan: a short chalk notch on the floor of the track */
.bf-pin-ko{background:var(--bf-gold);width:4px;margin-left:-2px;top:0;bottom:0}
.bf-range{position:absolute;left:0;right:0;top:-11px;width:100%;height:44px;margin:0;background:transparent;-webkit-appearance:none;appearance:none;cursor:pointer;touch-action:none}
.bf-range::-webkit-slider-runnable-track{height:44px;background:transparent}
.bf-range::-moz-range-track{height:44px;background:transparent}
.bf-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:6px;height:30px;margin-top:7px;background:var(--bf-chalk);border:0;border-radius:0;box-shadow:0 0 0 2px var(--bf-ink)}
.bf-range::-moz-range-thumb{width:6px;height:30px;background:var(--bf-chalk);border:0;border-radius:0;box-shadow:0 0 0 2px var(--bf-ink)}
.bf-range:focus-visible{outline-offset:-6px}
.bf-range:disabled{cursor:default;opacity:.4}
.bf-legend{display:inline-flex;gap:12px;margin-right:10px;font:500 11px/1 var(--label);letter-spacing:.1em;text-transform:uppercase}
.bf-key::before{content:"";display:inline-block;width:3px;height:10px;margin-right:5px;vertical-align:-1px;background:var(--bf-crimson)}
.bf-key-parry::before{background:var(--bf-cyan)}
.bf-key-ko::before{background:var(--bf-gold)}
.bf-key-plan::before{background:var(--bf-chalk);height:5px;vertical-align:-1px}

/* controls */
.bf-controls{display:flex;flex-wrap:wrap;gap:8px}
.bf-speed{display:flex}
.bf-speed .bf-btn{padding:0 11px;margin-left:calc(var(--bf-line) * -1)}
.bf-speed .bf-btn:first-child{margin-left:0}
.bf-status{margin:0;min-height:1.2em;font:500 13px/1.3 var(--bf-mono);color:var(--bf-fog)}
.bf-status:empty{display:none}
.bf-status.is-warn{color:var(--bf-gold)}
.bf-hint{margin:0;font:400 13px/1.5 var(--body);color:var(--bf-fog)}
.bf-hint a{color:var(--bf-chalk)}

/* play-by-play */
.bf-feed>summary{cursor:pointer;margin:-12px -14px;padding:14px;min-height:44px;list-style-position:inside}
.bf-feed[open]>summary{margin-bottom:0;border-bottom:1px solid var(--bf-ash)}
.bf-feed-list{list-style:none;margin:0;padding:8px 0 0;height:300px;overflow-y:auto;overscroll-behavior:contain;contain:strict;font:400 13px/1.4 var(--bf-mono)}
.bf-feed-list li{display:flex;gap:8px;padding:3px 0;color:var(--bf-fog)}
.bf-feed-list li>time{flex:0 0 5ch}
.bf-feed-list li>time{color:var(--bf-ash-2);font-variant-numeric:tabular-nums}
.bf-feed-list li.is-big{color:var(--bf-chalk)}
.bf-feed-list li.is-crit>span{color:var(--bf-crimson)}
.bf-feed-list li.is-parry>span{color:var(--bf-cyan)}
.bf-feed-list li.is-gold>span{color:var(--bf-gold)}
.bf-feed-list li.is-violet>span{color:var(--bf-violet)}
.bf-feed-list li.is-say>span{color:var(--bf-chalk);font-weight:700}
.bf-feed-list li.is-taunt>span{font-style:italic}
.bf-feed-list li.is-plan>span::before{content:"";display:inline-block;width:3px;height:9px;margin-right:6px;background:var(--bf-chalk)}

/* cage rules */
.bf-rules{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.bf-rule{font:400 14px/1.45 var(--body);color:var(--bf-chalk);border-left:3px solid var(--bf-violet);padding-left:10px}
.bf-rule b{display:block;font:600 13px/1.3 var(--label);letter-spacing:.1em;color:var(--bf-violet)}
.bf-rule.is-empty{border-left-color:var(--bf-ash-2);color:var(--bf-fog)}

/* desktop: fighters and panels beside the arena */
@media (min-width:1000px){
  .bf-watch{padding-top:calc(var(--head-h) + 10px)}
  .bf-stage{--bf-arena:clamp(380px,calc(100svh - var(--head-h) - 262px),680px);grid-template-columns:minmax(230px,1fr) var(--bf-arena) minmax(230px,1fr);grid-template-areas:"a mid b";gap:22px;align-items:start}
  .bf-col{display:flex;flex-direction:column;gap:var(--bf-gap);min-width:0}
  .bf-col-a{grid-area:a}
  .bf-col-mid{grid-area:mid}
  .bf-col-b{grid-area:b}
  .bf-fighter{display:flex;flex-direction:row;gap:12px;padding-top:4px}
  .bf-fighter-b{flex-direction:row-reverse}
  .bf-fighter .bf-face{position:static;width:72px;height:72px}
  .bf-fighter .bf-name-row{min-height:0;padding:0;margin-bottom:2px;align-items:baseline}
  .bf-fighter .bf-name{font-size:1.3rem;line-height:1.1;white-space:nowrap}
  .bf-fighter .bf-record,.bf-fighter .bf-pip-name{display:revert}
  .bf-fighter .bf-readout-low{display:flex}
  .bf-fighter .bf-hp{height:12px}
  .bf-fighter .bf-en{margin-top:0;height:5px}
  .bf-fighter .bf-fighter-main{display:block}
  .bf-fighter .bf-readout{margin:5px 0 8px;font-size:13px}
  .bf-fighter .bf-readout-low{margin-bottom:0}
  .bf-fighter .bf-pip{padding:2px 5px}
  .bf-btn-more{display:none}
  .bf-controls{flex-wrap:nowrap;gap:6px}
  .bf-controls .bf-btn{padding:0 9px;min-width:0;letter-spacing:.08em}
  .bf-controls .bf-btn-main{flex:0 0 78px}
  .bf-controls #copy,.bf-controls #sound{flex:1 1 0}
  .bf-clock{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px 16px;min-height:34px}
  .bf-clock-main{flex-direction:row;align-items:baseline;gap:12px;padding-top:0}
  .bf-round{font-size:13px}
  .bf-time{font-size:1.7rem}
  .bf-feed-list{height:calc(var(--bf-arena) - 20px)}
  .bf-hint{font-size:12px}
}
@media (max-width:999px){
  .bf-controls .bf-btn{flex:1 1 auto}
  .bf-controls .bf-btn-main{flex:0 0 30%}
  .bf-controls .bf-speed{flex:1 1 60%}
  .bf-controls .bf-speed .bf-btn{flex:1}
  .bf-say{min-height:74px}
}
@media (max-width:999px){
  /* the site's floating shop link would sit on the controls: on phones it joins the page flow */
  .bf .store-link{position:static;display:flex;width:max-content;margin:0 auto 22px}
}
@media (max-width:380px){
  .bf-watch{padding-inline:12px}
  .bf-fighter .bf-name{font-size:.8rem}
  .bf-time{font-size:1.25rem}
  .bf-say-text{font-size:13px}
}

/* motion off: nothing loops */
@media (prefers-reduced-motion:reduce){
  .bf-badge-live::before,.is-low .bf-hp .bf-bar-fill{animation:none}
  .bf-bar-lag{transition:none}
}
html[data-motion="off"] .bf-badge-live::before,html[data-motion="off"] .is-low .bf-hp .bf-bar-fill{animation:none}
html[data-motion="off"] .bf-bar-lag{transition:none}
