/* Layout: BDST scoreboard — logo header, stat strip, one ranked deck board.
   Brand: the logo's black plate, white lettering and red edge; a single dark look by choice. */
:root {
  --bg: #0a0a0b;
  --surface: #151517;
  --ink: #f7f7f7;
  --muted: #a3a3ab;
  --line: #2c2c31;
  --red: #ff1418;                        /* BDST red: actions, bars, accents */
  --focus: #ffffff;
  --scrim: rgba(0, 0, 0, .78);
  --vig: #4f8fe0; --com: #3fae5e; --agg: #e8603f; --cun: #e6b93a; --her: #ece8da; --vil: #000000; --pip-ring: rgba(255, 255, 255, .5);
  --f-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-data: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.wrap { max-width: 1000px; margin: 0 auto; padding-inline: 20px; padding-block: 28px 64px; display: grid; gap: 28px; }
h1, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
.eyebrow { font: 600 12px/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
section { display: grid; gap: 14px; min-width: 0; }
button { font-family: var(--f-body); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Header + upload */
header { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: end; justify-content: space-between; }
header .titles { display: grid; gap: 8px; min-width: 0; flex: 1 1 320px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand .logo { width: clamp(140px, 30vw, 200px); height: auto; display: block; }
.brand .eyebrow { line-height: 1.5; border-left: 2px solid var(--red); padding-left: 14px; }
h1 { font-size: clamp(34px, 6vw, 52px); font-weight: 800; font-style: italic; line-height: .95; letter-spacing: .01em; text-transform: uppercase; }
.evname { font: 600 22px/1.2 var(--f-display); letter-spacing: .02em; color: var(--ink); background: transparent; border: 0; border-bottom: 1.5px dashed var(--line); padding: 2px 0; width: min(100%, 26rem); }
.evname::placeholder { color: var(--muted); }
.evname:hover { border-bottom-color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.drop { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1.5px dashed var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; transition: border-color .15s; max-width: 100%; }
.drop:hover, .drop:focus-within, .drop.over { border-color: var(--ink); }
.drop:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong { font-family: var(--f-display); font-size: 18px; letter-spacing: .03em; text-transform: uppercase; }
.drop small { display: block; color: var(--muted); font-size: 13px; }
.icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: var(--ink); flex: none; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; border: 0; background: var(--red); color: #fff; font: italic 800 17px/1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn:hover { filter: brightness(1.08); }
.notice { font-size: 13px; color: var(--muted); }
.notice b { color: var(--ink); font-weight: 600; }
.notice.err { color: var(--agg); }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.stat { padding: 16px 18px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat .v { font: 700 34px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.stat .v.sm { font-size: 24px; line-height: 1.05; }
.stat .s { color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* Art + aspect pips */
.thumb { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; flex: none; background: var(--line); display: grid; place-items: center; font: 700 15px var(--f-display); color: var(--muted); }
.bthumb { width: 70px; height: 27px; border-radius: 5px; object-fit: cover; flex: none; background: var(--line); }
.bthumb.gen { display: grid; place-items: center; font: italic 800 12px/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: #fff; }
.bthumb.gen.a-cunning { color: #141414; }
.pair { display: flex; gap: 6px; align-items: center; flex: none; }
.pips { display: inline-flex; gap: 3px; flex: none; }
.pip { width: 11px; height: 11px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--pip-ring); display: inline-block; }
.a-vigilance { background: var(--vig); } .a-command { background: var(--com); } .a-aggression { background: var(--agg); }
.a-cunning { background: var(--cun); } .a-heroism { background: var(--her); } .a-villainy { background: var(--vil); }

/* Controls */
.bar-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { font: 600 13px/1 var(--f-body); color: var(--muted); background: none; border: 0; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.hint { margin: 0; color: var(--muted); font-size: 13px; max-width: 60ch; }

/* Deck board */
.board { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px 8px; display: grid; gap: 4px; min-width: 0; }
.board h3 { font-size: 24px; font-style: italic; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.board h3 small { font: 500 13px var(--f-body); font-style: normal; color: var(--muted); text-transform: none; letter-spacing: 0; }
.cols, details.row summary { display: grid; grid-template-columns: 2rem minmax(0, 1fr) 4.4rem 4rem; gap: 12px; align-items: center; }
.cols { padding: 10px 0 6px; border-bottom: 1px solid var(--line); }
.cols span { font: 600 11px/1 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: right; }
.cols span:nth-child(2) { text-align: left; }
details.row { border-bottom: 1px solid var(--line); }
details.row:last-child { border-bottom: 0; }
details.row summary { list-style: none; cursor: pointer; padding: 10px 0; }
details.row summary::-webkit-details-marker { display: none; }
details.row summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.no { font: 600 14px/1 var(--f-data); color: var(--red); text-align: right; }
.who { min-width: 0; display: flex; gap: 12px; align-items: center; }
.who .info { min-width: 0; flex: 1; display: grid; gap: 6px; }
.who .nm { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.who .nm b { font: 600 19px/1.1 var(--f-display); letter-spacing: .02em; min-width: 0; }
.who .nm em { font-style: normal; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 6rem; }
.track { height: 10px; border-radius: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.track div { height: 100%; background: var(--red); border-radius: 3px; }
.num { text-align: right; font: 600 17px/1 var(--f-data); font-variant-numeric: tabular-nums; }
.num.share { font-weight: 400; font-size: 15px; color: var(--muted); }
.pilots { margin: 0 0 12px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; font-size: 13px; }
.pilots li { padding: 5px 8px; border-radius: 6px; background: rgba(255, 255, 255, .04); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilots .muted { color: var(--muted); }
.foot { font-size: 12px; color: var(--muted); max-width: 75ch; margin: 0; }

/* Collapsible sections */
.sec { display: grid; gap: 12px; min-width: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sec-toggle { display: inline-flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 2px 0; text-align: left; min-width: 0; flex-wrap: wrap; }
.sec-toggle .sec-title { font: italic 800 26px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.sec-toggle .sec-meta { font: 500 13px var(--f-body); color: var(--muted); }
.sec-toggle .chev { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--muted); transition: transform .18s ease; flex: none; }
.sec-toggle:hover .chev { color: var(--ink); border-color: var(--muted); }
.sec-toggle[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.sec-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { .sec-toggle .chev { transition: none; } }

/* Live tournament */
.live-box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; }
.live-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.live.on .dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 20, 24, .2); }
.live-bar input { flex: 1 1 260px; min-width: 0; font: 15px var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.live-bar input::placeholder { color: var(--muted); }
.live-bar .btn { padding: 9px 14px; font-size: 16px; }
.live-bar .btn[disabled] { opacity: .6; cursor: progress; }
.linkbtn { background: none; border: 0; color: var(--muted); font: 600 13px var(--f-body); text-decoration: underline; cursor: pointer; padding: 4px; }
.live-status { font-size: 13px; color: var(--muted); }
.live-status b { color: var(--ink); font-weight: 600; }
.live-status.err { color: var(--agg); }

/* Standings table */
.filter { font: 14px var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; width: min(100%, 18rem); }
.tbl-wrap { overflow-x: auto; }
table.st { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 600px; }
table.st th { font: 600 11px/1 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.st td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.st tr:last-child td { border-bottom: 0; }
table.st .r { text-align: right; }
table.st .rk { font: 600 14px var(--f-data); color: var(--red); width: 3rem; }
table.st .rec, table.st .pts { font: 600 14px var(--f-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.st .pl { font-weight: 600; }
table.st .deck { display: flex; align-items: center; gap: 10px; min-width: 0; }
table.st .deck .thumb { width: 32px; height: 32px; }
table.st .deck .bthumb { width: 52px; height: 20px; }
table.st .deck b { font: 600 16px/1.1 var(--f-display); letter-spacing: .02em; }
table.st .none { color: var(--muted); }
table.st tr.dropped td { opacity: .5; }
.tag { font: 600 10px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; padding: 3px 6px; border-radius: 4px; background: rgba(255, 255, 255, .1); color: var(--muted); margin-left: 6px; }

/* Top 8 bracket */
.bracket { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 18px; }
.bcol { display: grid; grid-template-rows: auto 1fr; gap: 10px; min-width: 0; }
.bstack { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; }
.bcol h4 { margin: 0; font: italic 800 15px/1 var(--f-display); letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
.match { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.mrow { display: grid; grid-template-columns: 1.6rem 42px minmax(0, 1fr) 1.4rem; gap: 10px; align-items: center; padding: 8px 10px; }
.mrow + .mrow { border-top: 1px solid var(--line); }
.mrow.win { box-shadow: inset 4px 0 0 var(--red); }
.mrow.lose { opacity: .45; }
.mrow .seed { font: 600 13px var(--f-data); color: var(--red); text-align: right; }
.mrow .who2 { min-width: 0; display: grid; gap: 2px; }
.mrow .who2 b { font: 600 17px/1.1 var(--f-display); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .who2 span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .score { font: 700 18px var(--f-data); text-align: right; }
.mrow.tbd .who2 b { color: var(--muted); font-style: italic; }
.champ { border: 1px solid var(--red); border-radius: 10px; padding: 12px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; background: rgba(255, 20, 24, .08); }
.champ .thumb { width: 64px; height: 64px; }
.champ small { font: italic 800 13px/1 var(--f-display); letter-spacing: .08em; color: var(--red); text-transform: uppercase; }
.champ b { display: block; font: 700 22px/1.1 var(--f-display); }
.champ span { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .bracket { grid-template-columns: minmax(0, 1fr); } }

/* Player match history */
.plink { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.plink:hover { text-decoration-color: var(--red); }
.phead { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center; }
.phead .thumb { width: 64px; height: 64px; }
.phead b { display: block; font: italic 800 28px/1.05 var(--f-display); text-transform: uppercase; }
.phead span { font-size: 14px; color: var(--muted); }
.phead .rec { font: 600 14px var(--f-data); color: var(--red); }
.hist { list-style: none; margin: 0; padding: 0; display: grid; }
.hist li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.hist .rnd { font: 600 12px/1.2 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hist .opp { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hist .opp .thumb { width: 36px; height: 36px; }
.hist .opp .bthumb { width: 52px; height: 20px; }
.hist .opp > div { min-width: 0; display: grid; gap: 2px; }
.hist .opp .plink { font: 600 17px/1.1 var(--f-display); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .opp small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .none { color: var(--muted); font-style: italic; }
.res { font: 700 13px/1 var(--f-data); padding: 6px 8px; border-radius: 6px; white-space: nowrap; text-align: center; min-width: 4.6rem; }
.res.W { background: var(--red); color: #fff; }
.res.L { background: rgba(255, 255, 255, .08); color: var(--muted); }
.res.D { background: rgba(255, 255, 255, .18); color: var(--ink); }
.res.P { border: 1px dashed var(--line); color: var(--muted); }
@media (max-width: 480px) { .hist li { grid-template-columns: minmax(0, 1fr) auto; } .hist .rnd { grid-column: 1 / -1; } }

/* Share modal */
.modal { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 16px; z-index: 10; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 14px; width: min(920px, 100%); max-height: calc(100% - 32px); overflow: auto; }
.sheet .hdr { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet h3 { font-size: 22px; font-style: italic; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.sheet img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); display: block; }
.sheet p { margin: 0; font-size: 13px; color: var(--muted); }
.x { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px; }

/* ---------- Tournament assistant additions ---------- */
.wrap { max-width: 1080px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 20; }
.skip:focus { left: 8px; }
.evname { font-size: clamp(26px, 4.4vw, 40px); font-style: italic; font-weight: 800; text-transform: uppercase; width: 100%; }
.sec-head > .sec-title { font: italic 800 26px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em; }
.sec-head > .sec-meta { font: 500 13px var(--f-body); color: var(--muted); margin-right: auto; }
.sec-head { flex-wrap: wrap; }
.sec-head .btn.sm, .btn.sm { padding: 7px 12px; font-size: 14px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
select, .selectl input { font: 14px var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.selectl { display: inline-flex; align-items: center; gap: 8px; font: 600 13px var(--f-body); color: var(--muted); }
.selectl input { width: 9rem; }
select:focus-visible, .selectl input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 8px; font: 600 13px var(--f-body); color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track-sw { width: 34px; height: 20px; border-radius: 10px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.track-sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + .track-sw { background: var(--red); }
.switch input:checked + .track-sw::after { transform: translateX(14px); background: #fff; }
.switch input:focus-visible + .track-sw { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch:has(input:checked) { color: var(--ink); }

/* Live box extras */
.recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.recent button { font: 600 12px var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.recent button:hover { border-color: var(--muted); }
.asof { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.organiser summary { cursor: pointer; font: 600 13px var(--f-body); color: var(--muted); width: max-content; }
.organiser summary:hover { color: var(--ink); }
.organiser[open] summary { color: var(--ink); margin-bottom: 10px; }
.org-body { display: grid; gap: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.org-body p { margin: 0; font-size: 13px; color: var(--muted); max-width: 70ch; }
.org-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.org-row input { font: 14px var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 14rem; }
.org-row .btn { padding: 8px 12px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.org-state { font-size: 13px; color: var(--muted); }
.org-state.ok { color: var(--com); }
.org-msg { font-size: 13px; color: var(--muted); }
.org-msg.err { color: var(--agg); }
.replay { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 10px; background: rgba(255, 20, 24, .1); border: 1px solid rgba(255, 20, 24, .45); font-size: 14px; }
.replay b { font-weight: 700; }

/* Tabs */
.tabs { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; background: var(--bg); padding: 8px 0; margin-block: -8px; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; font: italic 800 17px/1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 12px 9px; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }
.tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 6px; }
.tabs button .badge { font: 700 10px/1 var(--f-data); background: var(--red); color: #fff; border-radius: 999px; padding: 2px 5px; margin-left: 6px; vertical-align: 2px; font-style: normal; }
main { display: grid; }
.panel { display: grid; gap: 28px; min-width: 0; }
.needs-live { display: grid; gap: 12px; justify-items: start; padding: 28px; border: 1.5px dashed var(--line); border-radius: 12px; color: var(--muted); }
.needs-live p { margin: 0; max-width: 60ch; }
.empty-note { color: var(--muted); font-size: 14px; padding: 10px 0; }

/* Decks: win rate column */
.has-win .cols, .has-win details.row summary { grid-template-columns: 2rem minmax(0, 1fr) 4.4rem 4rem 4.6rem; }
.wr { text-align: right; font: 600 14px/1 var(--f-data); }
.wr.hi { color: var(--red); }
.wr.na { color: var(--muted); font-weight: 400; }

/* Aspects */
.asp-split { display: flex; height: 30px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.asp-split div { display: flex; align-items: center; padding-inline: 10px; font: 700 14px/1 var(--f-display); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; min-width: 0; }
.asp-split .her { background: var(--her); color: #2a2a2e; }
.asp-split .vil { background: #000; color: #f1efe6; justify-content: flex-end; }
.asp-split .oth { background: var(--line); color: var(--muted); justify-content: center; }
.asp-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) { .asp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 460px) { .asp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.asp { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 8px; min-width: 0; }
.asp .t { display: flex; align-items: center; gap: 8px; font: 600 16px/1 var(--f-display); letter-spacing: .05em; text-transform: uppercase; }
.asp .t .pip { width: 16px; height: 16px; }
.asp .big { font: 700 30px/1 var(--f-display); }
.asp .s { font-size: 12px; color: var(--muted); }

/* Pairings */
.pairings { display: grid; gap: 10px; }
.pr { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) 4.6rem minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.pr.team { box-shadow: inset 4px 0 0 var(--red); }
.pr .tbl { display: grid; gap: 4px; justify-items: center; font: 600 11px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pr .tbl b { font: 700 20px/1 var(--f-data); color: var(--ink); letter-spacing: 0; }
.pr .feat { font: italic 800 10px/1 var(--f-display); letter-spacing: .08em; color: var(--red); }
.pside { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pside.right { flex-direction: row-reverse; text-align: right; }
.pside .info { min-width: 0; display: grid; gap: 2px; }
.pside .plink { font: 600 18px/1.1 var(--f-display); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pside.right .plink { text-align: right; }
.pside small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pside small .r2 { font-family: var(--f-data); color: var(--ink); }
.pside.lost { opacity: .5; }
.pside .thumb { width: 40px; height: 40px; }
.pside .bthumb { display: none; }
.pscore { text-align: center; font: 700 22px/1 var(--f-data); }
.pscore.live { font: 600 11px/1.2 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pr .bye { color: var(--muted); font-style: italic; }
@media (max-width: 680px) {
  .pr { grid-template-columns: 2.6rem minmax(0, 1fr) auto; grid-template-areas: "t a s" "t b s" "t x x"; row-gap: 8px; }
  .pr .tbl { grid-area: t; } .pr .pside:nth-of-type(1) { grid-area: a; } .pr .pscore { grid-area: s; } .pr .pside.right { grid-area: b; flex-direction: row; text-align: left; } .pr .pside.right .plink { text-align: left; } .pr .pimg { grid-area: x; justify-self: start; }
}

/* Top 8 race */
.race-sum { display: flex; flex-wrap: wrap; gap: 8px; }
.race-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.race-chip b { font: 700 20px/1 var(--f-display); color: var(--ink); }
.st-chip { font: 700 11px/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; padding: 4px 7px; border-radius: 5px; white-space: nowrap; }
.st-chip.locked { background: var(--red); color: #fff; }
.st-chip.alive { background: rgba(255, 255, 255, .14); color: var(--ink); }
.st-chip.out { background: transparent; color: var(--muted); border: 1px solid var(--line); }
table.st tr.cutline td { border-bottom: 2px dashed var(--red); }
table.st tr.is-out td { opacity: .5; }
table.st tr.team td:first-child { box-shadow: inset 4px 0 0 var(--red); }

/* Matchups */
table.mx { border-collapse: separate; border-spacing: 3px; font-size: 13px; }
table.mx th { font: 600 12px/1.1 var(--f-display); letter-spacing: .02em; color: var(--muted); padding: 4px; text-align: center; vertical-align: bottom; max-width: 7rem; }
table.mx th.rowh { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 11rem; max-width: 14rem; }
table.mx th.rowh .deck { display: flex; align-items: center; gap: 8px; }
table.mx th.rowh .thumb { width: 28px; height: 28px; }
table.mx th.rowh b { font: 600 15px/1.1 var(--f-display); color: var(--ink); }
table.mx th.colh { height: 92px; }
table.mx th.colh span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 86px; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-size: 13px; }
table.mx td { min-width: 3.6rem; height: 40px; text-align: center; border-radius: 6px; font: 600 12px/1.15 var(--f-data); cursor: pointer; background: rgba(255, 255, 255, .03); }
table.mx td small { display: block; font-weight: 400; opacity: .75; }
table.mx td.mirror { cursor: default; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .04) 0 6px, transparent 6px 12px); color: var(--muted); }
table.mx td.empty { cursor: default; color: var(--line); }
table.mx td:focus-visible { outline: 2px solid var(--focus); }
table.mx td.sel { outline: 2px solid var(--ink); }
.mx-total { font-weight: 700; }
.mu-detail { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.mu-detail h4 { margin: 0; font: italic 800 20px/1.1 var(--f-display); text-transform: uppercase; }
.mu-detail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.mu-detail li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mu-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .mu-lists { grid-template-columns: minmax(0, 1fr); } }
.mu-list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; align-content: start; }
.mu-list h4 { margin: 0; font: italic 800 18px/1 var(--f-display); text-transform: uppercase; }
.mu-list ol { margin: 0; padding-left: 1.4rem; display: grid; gap: 6px; font-size: 14px; }
.mu-list ol b { font: 600 15px var(--f-display); letter-spacing: .02em; }
.mu-list .num2 { font-family: var(--f-data); color: var(--muted); font-size: 13px; }

/* Team */
.team-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); }
@media (max-width: 760px) { .team-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.team-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start; }
.tcard .thumb { width: 56px; height: 56px; }
.tcard .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tcard .plink { font: italic 800 20px/1.05 var(--f-display); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard .rk { font: 700 14px var(--f-data); color: var(--red); white-space: nowrap; }
.tcard .meta { font-size: 13px; color: var(--muted); display: grid; gap: 3px; }
.tcard .meta .r2 { font-family: var(--f-data); color: var(--ink); }
.tcard .now { font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Season */
.season-events { display: grid; gap: 8px; }
.sev { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.sev b { font: 600 17px var(--f-display); letter-spacing: .02em; }
.sev .muted { color: var(--muted); font-size: 13px; }
.sev .spacer { margin-left: auto; }
.spark { display: block; }

/* Stream overlays (links) */
.overlays { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ovl { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; align-content: start; }
.ovl h4 { margin: 0; font: italic 800 19px/1 var(--f-display); text-transform: uppercase; }
.ovl p { margin: 0; font-size: 13px; color: var(--muted); }
.ovl code { font: 12px var(--f-data); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere; user-select: all; }
.ovl .row2 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ovl a { color: var(--ink); font-size: 13px; }

/* Images modal */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font: 600 13px/1 var(--f-body); color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.shot-wrap { position: relative; }
.shot-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 10, 11, .6); border-radius: 8px; font: italic 800 20px var(--f-display); text-transform: uppercase; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); }
.toast button { background: var(--red); color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; font: italic 800 14px var(--f-display); text-transform: uppercase; cursor: pointer; }

/* Overlay mode (OBS browser source): transparent page, just the overlay */
body.overlay { background: transparent; }
body.overlay #app, body.overlay .modal, body.overlay .toast { display: none !important; }
#overlay { padding: 24px; display: grid; gap: 12px; color: #fff; }
.ov-card { background: rgba(10, 3, 5, .86); border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px; padding: 14px 16px; backdrop-filter: blur(6px); }
.ov-title { display: flex; align-items: center; gap: 12px; font: italic 800 22px/1 var(--f-display); text-transform: uppercase; letter-spacing: .03em; }
.ov-title img { height: 34px; width: auto; }
.ov-title small { font: 600 13px var(--f-body); color: #d9b9ba; text-transform: none; font-style: normal; letter-spacing: 0; margin-left: auto; }
.ov-list { display: grid; gap: 6px; margin-top: 10px; }
.ov-row { display: grid; grid-template-columns: 2.2rem 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.ov-row .thumb { width: 38px; height: 38px; }
.ov-row .rk { font: 700 16px var(--f-data); color: var(--red); text-align: right; }
.ov-row b { font: 700 19px/1.05 var(--f-display); letter-spacing: .02em; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-row span { font-size: 12px; color: #d9b9ba; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-row .rec { font: 700 16px var(--f-data); }
.ov-vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 18px; }
.ov-side { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ov-side.right { flex-direction: row-reverse; text-align: right; }
.ov-side .thumb { width: 84px; height: 84px; border-radius: 10px; }
.ov-side b { display: block; font: italic 800 30px/1 var(--f-display); text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-side span { display: block; font-size: 15px; color: #d9b9ba; }
.ov-side .r2 { font: 700 16px var(--f-data); color: #fff; }
.ov-mid { text-align: center; font: italic 800 34px/1 var(--f-display); color: var(--red); }
.ov-mid small { display: block; font: 600 12px var(--f-body); color: #d9b9ba; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.ov-empty { font-size: 14px; color: #d9b9ba; }
.ov-side > div { min-width: 0; flex: 1; }
.ov-side span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .ov-side .thumb { width: 56px; height: 56px; } .ov-side b { font-size: 22px; } .ov-mid { font-size: 26px; } }

/* Feature match banner (1920 × 1080 OBS canvas): tall at the ends, raking in to a thin centre strip.
   Every size is in --u (1/1920 of the width), so it scales with the browser source. */
#overlay.fm-mode { padding: 0; }
.fm { --u: calc(100vw / 1920); position: fixed; left: 0; right: 0; top: 0; height: calc(120 * var(--u)); color: #fff; }
.fm.bottom { top: auto; bottom: 0; }
.fm-shape { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 calc(6 * var(--u)) calc(14 * var(--u)) rgba(0, 0, 0, .45)); }
.fm.bottom .fm-shape { transform: scaleY(-1); }
.fm-side { position: absolute; top: 0; height: calc(116 * var(--u)); display: flex; align-items: center; gap: calc(12 * var(--u)); padding-inline: calc(14 * var(--u)) calc(8 * var(--u)); }
.fm.bottom .fm-side { top: auto; bottom: 0; }
.fm-side.left { left: 0; }
.fm-side.right { right: 0; flex-direction: row-reverse; text-align: right; padding-inline: calc(8 * var(--u)) calc(14 * var(--u)); }
.fm-art { position: relative; flex: none; width: calc(84 * var(--u)); height: calc(84 * var(--u)); border-radius: calc(10 * var(--u)); overflow: hidden; border: calc(2 * var(--u)) solid rgba(255, 255, 255, .25); background: #2a0a0c; }
.fm-art .fm-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.fm-strip { position: absolute; left: 0; right: 0; bottom: 0; height: calc(12 * var(--u)); background: #2a0a0c center / cover no-repeat; border-top: calc(2 * var(--u)) solid rgba(10, 3, 5, .9); }
.fm-info { flex: 1; min-width: 0; display: grid; gap: calc(4 * var(--u)); }
.fm-info b { font: italic 800 calc(30 * var(--u))/1 var(--f-display); text-transform: uppercase; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-deck { font: 600 calc(15 * var(--u))/1.15 var(--f-body); color: #e6cfd0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-rec { font: 700 calc(15 * var(--u))/1 var(--f-data); color: var(--red); }
.fm-pips { flex: none; display: flex; gap: calc(9 * var(--u)); }
.fm-side.right .fm-pips { flex-direction: row-reverse; }
.fm-pips i { width: calc(18 * var(--u)); height: calc(18 * var(--u)); border-radius: 50%; border: calc(3 * var(--u)) solid rgba(255, 255, 255, .5); box-sizing: border-box; }
.fm-pips i.on { background: var(--red); border-color: var(--red); box-shadow: 0 0 calc(10 * var(--u)) rgba(255, 20, 24, .7); }
.fm-mid { position: absolute; top: 0; height: calc(40 * var(--u)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: calc(12 * var(--u)); }
.fm.bottom .fm-mid { top: auto; bottom: 0; }
.fm-hp { display: flex; align-items: center; gap: calc(10 * var(--u)); }
.fm-hp.right { justify-content: flex-end; }
.fm-hp b { font: 700 calc(30 * var(--u))/1 var(--f-data); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; }
.fm-bsw { width: calc(30 * var(--u)); height: calc(16 * var(--u)); border-radius: calc(4 * var(--u)); background: #2a0a0c center / cover no-repeat; border: calc(2 * var(--u)) solid rgba(255, 255, 255, .3); }
.fm-round { text-align: center; font: italic 800 calc(16 * var(--u))/1 var(--f-display); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.fm-round small { display: block; margin-top: calc(3 * var(--u)); font: 600 calc(11 * var(--u))/1 var(--f-body); letter-spacing: .1em; color: #d9b9ba; }
.fm-live { display: none; width: calc(8 * var(--u)); height: calc(8 * var(--u)); border-radius: 50%; margin-left: calc(6 * var(--u)); vertical-align: middle; background: #777; }
.fm-live[data-state="live"] { display: inline-block; background: #3fae5e; box-shadow: 0 0 calc(6 * var(--u)) #3fae5e; }
.fm-live[data-state="reconnecting"], .fm-live[data-state="stopped"] { display: inline-block; background: #e6b93a; }
.fm-hp.hit b { animation: fm-hit .6s ease-out; }
.fm-hp.low b { color: var(--red); }
@keyframes fm-hit { 0% { transform: scale(1.35); color: var(--red); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .fm-hp.hit b { animation: none; } }
.ovl.t30 { grid-column: 1 / -1; }
.ovl.t30 input[type="url"] { flex: 1 1 280px; min-width: 0; font: 14px var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.t30-result { display: grid; gap: 6px; font-size: 13px; }
.t30-result p { margin: 0; }
.t30-result .ok { color: var(--com); }
.t30-result .ok b { color: var(--ink); }
.t30-result .err { color: var(--agg); }
.t30-result pre { max-height: 260px; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 12px var(--f-data); white-space: pre-wrap; }
.t30-result summary { cursor: pointer; color: var(--muted); }
.overlays { margin-top: 12px; }
.fm-dmg { display: inline-flex; align-items: baseline; font-variant-numeric: tabular-nums; }
.fm-dmg b { font: 700 calc(30 * var(--u))/1 var(--f-data); display: inline-block; min-width: 0; }
.fm-dmg small { font: 600 calc(16 * var(--u))/1 var(--f-data); color: #d9b9ba; margin-left: calc(2 * var(--u)); }
.fm-hp.low .fm-dmg b, .fm-hp.low .fm-dmg small { color: var(--red); }

.fm-line { display: flex; align-items: center; gap: calc(10 * var(--u)); }
.fm-side.right .fm-line { flex-direction: row-reverse; }
.fm-round { display: flex; align-items: baseline; justify-content: center; gap: calc(8 * var(--u)); }
.fm-round small { display: inline; margin-top: 0; }
.fm-mid { position: absolute; }
.fm-flash { position: absolute; inset: 0; display: grid; place-items: center; background: var(--red); color: #fff; font: italic 800 calc(26 * var(--u))/1 var(--f-display); letter-spacing: .12em; text-transform: uppercase; z-index: 2; clip-path: polygon(calc(18 * var(--u)) 0, calc(100% - 18 * var(--u)) 0, 100% 100%, 0 100%); }
.fm-flash.show { animation: fm-flash 4s ease-out forwards; }
@keyframes fm-flash { 0% { opacity: 0; transform: scaleY(.3); } 8%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fm-flash.show { animation: none; } }
.pr { grid-template-columns: 3.4rem minmax(0, 1fr) 4.6rem minmax(0, 1fr) auto; }
.pbtns { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.pr.live { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.pr .feat.on { background: var(--red); color: #fff; padding: 3px 5px; border-radius: 4px; }
.fp-now { margin: 0; font-size: 14px; }
.fp-now b { font-weight: 700; }
#feature-picker { display: grid; gap: 10px; }
#feature-picker select { max-width: 100%; }
@media (max-width: 680px) { .pbtns { grid-area: x; flex-direction: row; justify-self: start; } }
#feature-picker .row2 { display: grid; gap: 8px; }
#feature-picker .selectl { display: grid; grid-template-columns: auto minmax(0, 1fr); width: 100%; }
#feature-picker select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.ovl { min-width: 0; }
.overlays { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.team-cards { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.pilots { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.brand { min-width: 0; flex-wrap: wrap; }
.team-head { display: flex; align-items: center; gap: 14px; }
.team-head img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface); }
.team-head b { display: block; font: italic 800 26px/1.05 var(--f-display); text-transform: uppercase; }
.team-head span { font-size: 13px; color: var(--muted); }
.team-head a { color: var(--ink); }
.tcard .hri { font: 600 12px var(--f-data); color: var(--cun); }
#team-pick { max-width: min(24rem, calc(100vw - 110px)); min-width: 0; }
.hint a { color: var(--ink); }
.selectl { max-width: 100%; min-width: 0; flex-wrap: wrap; }
.selectl select, .selectl input { min-width: 0; max-width: min(24rem, calc(100vw - 110px)); text-overflow: ellipsis; }
