:root {
  --bg: #111214;
  --panel: #1a1c1f;
  --raised: #202327;
  --seam: #2a2d32;
  --row: #222529;
  --ink: #e6e6e6;
  --ink-2: #c4c7cc;
  --muted: #9a9fa8;
  --dim: #8a8f98;
  --sel: #7aa2f7;
  --sel-tint: #232a3a;
  --row-hot: #1f2533;
  --up: #9ece6a;
  --dn: #f7768e;
  --idle: #e0af68;
  --heat-0: #202327;
  --heat-1: #33373d;
  --heat-2: #4f545c;
  --heat-3: #80868f;
  --heat-4: #c9ccd1;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", ui-monospace, monospace;
  --r: 4px;
  color-scheme: dark;
  scrollbar-color: var(--seam) transparent;
}

* { box-sizing: border-box; }
/* `hidden` always wins over component display rules (.btn is inline-flex), so viewer-only hiding can't leak. */
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: #2f4366; color: #fff; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
input, textarea, button, select { font: inherit; color: inherit; caret-color: var(--sel); }
a { color: var(--sel); text-underline-offset: 3px; }
code { font: 12.5px var(--mono); color: var(--ink-2); }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .dn { color: var(--dn); } .muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -40px; z-index: 50; background: var(--sel); color: #0d1017; padding: 6px 10px; border-radius: var(--r); }
.skip:focus { top: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link {font-size: 20px;}

/* ---------- Bar ---------- */
.bar { position: sticky; top: 0; z-index: 20; height: 48px; display: flex; align-items: center; gap: 24px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--seam); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.brand svg { width: 16px; height: 16px; fill: var(--sel); }
.tabs { display: flex; align-self: stretch; }
.tabs a { display: flex; align-items: center; padding: 0 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--sel); }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.stamp { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stamp .num { color: var(--ink); }

.seg { display: inline-flex; border: 1px solid var(--seam); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: none; padding: 4px 10px; font: 12px var(--mono); color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--seam); }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--sel-tint); color: var(--sel); }
.seg[hidden] { display: none; }
.seg button[aria-disabled="true"] { color: #5d626b; cursor: not-allowed; }
.seg button[aria-disabled="true"]:hover { color: #5d626b; }
.ph-end { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ph-end .btn { font-variant: normal; letter-spacing: 0; font-weight: 400; }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--panel); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a3f47; background: var(--raised); }
.btn.primary { border-color: var(--sel); color: var(--sel); background: var(--sel-tint); }
.btn.primary:hover { background: #2a3550; }
.btn.danger { border-style: dashed; border-color: #6b3540; color: var(--dn); background: none; }
.btn.danger:hover { border-style: solid; border-color: var(--dn); background: #2a1c21; }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: progress; }
.btn .ico, .ico { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn.busy .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { border: 0; background: none; padding: 0; color: var(--sel); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Layout ---------- */
main { outline: none; }
.view[hidden] { display: none; }
main { min-height: calc(100vh - 48px - 33px); display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; }
.view > .grid { flex: 1; }
.statusline { position: sticky; bottom: 0; z-index: 15; height: 33px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--bg); border-top: 1px solid var(--seam); font-size: 12px; color: var(--muted); white-space: nowrap; }
.statusline .num { color: var(--ink-2); }
.statusline .ok i, .statusline .ro i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; background: var(--up); vertical-align: 1px; }
.statusline .ro i { background: var(--idle); }
.statusline kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--seam); border-radius: 3px; color: var(--ink-2); }
.statusline .keys { margin-left: auto; }
.grid { display: grid; gap: 1px; background: var(--seam); border-bottom: 1px solid var(--seam); }
.overview { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.players { grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 48px); }
.versus { grid-template-columns: 360px minmax(0, 1fr); min-height: calc(100vh - 48px); }
.settings { grid-template-columns: minmax(0, 1fr) 380px; min-height: calc(100vh - 48px); }
.panel { background: var(--panel); min-width: 0; display: flex; flex-direction: column; }
.ph { margin: 0; height: 38px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--seam); font-size: 13px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--ink-2); }
.ph small { font-size: 12.5px; font-weight: 400; font-variant: normal; letter-spacing: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb { padding: 16px; min-height: 0; }
.pb.flush { padding: 0; }
.pb.tight { padding: 12px 12px 8px; }
.note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); max-width: 62ch; }

/* ---------- States ---------- */
.notice { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #2a1c21; border-bottom: 1px solid #6b3540; color: #f3b8c3; }
.notice[hidden] { display: none; }
.notice .btn { margin-left: auto; }
.empty { padding: 28px 16px; color: var(--muted); font-size: 13px; }
.empty b { color: var(--ink); font-weight: 600; }
.empty .btn { margin-top: 12px; }
.skel { display: grid; gap: 10px; }
.skel i { display: block; height: 12px; border-radius: 2px; background: var(--raised); animation: pulse 1.4s ease-in-out infinite; }
.skel i:nth-child(2n) { width: 70%; } .skel i:nth-child(3n) { width: 85%; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- Session ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px 16px; margin-bottom: 18px; }
.kpis div { display: flex; flex-direction: column; }
.kpis em { font: 600 22px/1.15 var(--mono); font-style: normal; font-variant-numeric: tabular-nums; }
.kpis em small { font-size: 13px; color: var(--muted); }
.kpis span { font-size: 12px; color: var(--muted); }
.bars { display: grid; grid-template-columns: minmax(84px, 128px) 1fr 1fr 48px; row-gap: 4px; align-items: center; }
.bars > * { min-width: 0; }
.bar-row { display: contents; }
.bar-row .n { padding: 3px 8px 3px 0; color: var(--ink-2); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; text-align: left; }
.bars .l, .bars .r { height: 20px; display: flex; align-items: center; }
.bars .l { justify-content: flex-end; border-right: 1px solid #4a4f57; }
.bars .l i, .bars .r i { display: block; height: 12px; min-width: 2px; }
.bars .l i { background: var(--dn); border-radius: 2px 0 0 2px; }
.bars .r i { background: var(--up); border-radius: 0 2px 2px 0; }
.bars .v { text-align: right; font: 13px var(--mono); }
.bars .flat { height: 1px; width: 100%; }
.axis { display: grid; grid-template-columns: minmax(84px, 128px) 1fr 1fr 48px; margin-top: 6px; font: 11.5px var(--mono); color: var(--dim); }
.axis span { display: flex; justify-content: space-between; }
.idle-line { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--seam); font-size: 12.5px; color: var(--muted); }
.idle-line b { color: var(--idle); font-weight: 600; }
.idle-line button { border: 0; background: none; padding: 0; color: var(--ink-2); cursor: pointer; }

/* Shared selection: hovering or picking a player lights them up in every panel. */
tr.is-hot td.name a, .tbl tr.is-idle.is-hot td.name a { color: var(--sel); }
.bars.has-hot .bar-row:not(.is-hot) i { opacity: .35; }
.bar-row.is-hot .n { color: var(--sel); }
tr.is-sel td { background: var(--row-hot); }

/* ---------- Charts ---------- */
.chart-wrap { padding: 8px 12px 10px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; overflow: visible; }
.chart text { font: 11.5px var(--mono); fill: var(--dim); }
.chart .grid-line { stroke: #26292e; }
.chart .band { fill: #ffffff; opacity: .045; }
.chart .band.alt { opacity: .075; }
.chart .band-edge { stroke: #34383e; stroke-width: 1; }
.chart .band-label { font: 600 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.chart .prev { stroke: #4a4f57; stroke-dasharray: 3 3; }
.chart .prev-label { font-size: 11px; fill: var(--muted); }
.race-legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; font-size: 12.5px; }
.race-legend li { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-2); cursor: pointer; }
.race-legend li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race-legend li span:last-child { font-family: var(--mono); }
.race-legend li.is-hot span:first-child { color: var(--sel); }
.chart .line { fill: none; stroke: #5a5f68; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; transition: stroke .15s, opacity .15s; }
.chart .hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.chart .end { fill: #c4c7cc; font: 12px var(--sans); }
.chart .end tspan { font-family: var(--mono); }
.chart.has-hot .line:not(.is-hot) { opacity: .45; }
.chart .line.is-hot { stroke: var(--sel); stroke-width: 2.25; opacity: 1; }
.chart .end.is-hot { fill: var(--sel); }
.chart .dot { fill: var(--sel); }
.chart .cursor { stroke: #3a3e45; stroke-dasharray: 2 3; }
/* Race: leaders join crowded names to their lines; a dotted end means no matches since, so MMR held. */
.chart .leader { fill: none; stroke: #3a3e45; stroke-width: 1; }
.chart .leader.is-hot { stroke: var(--sel); }
.chart.has-hot .leader:not(.is-hot), .chart.has-hot .end:not(.is-hot) { opacity: .45; }
.chart .line.carry { stroke-dasharray: 1.5 4; }
.race-legend.many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Projection fan: neutral ink, since colour here would read as a gain or a loss. */
.chart .fan80 { fill: var(--ink); opacity: .06; }
.chart .fan50 { fill: var(--ink); opacity: .09; }
.chart .proj-line { fill: none; stroke: var(--ink-2); stroke-width: 1.75; stroke-dasharray: 5 4; stroke-linecap: round; }
.chart .proj-end { fill: var(--ink); }
.chart .today { stroke: #4a4f57; stroke-dasharray: 3 3; }
.chart.proj .line { stroke-width: 2; }
.chart .end-sub { font: 11.5px var(--sans); }
.chart .bar-up { fill: var(--up); } .chart .bar-dn { fill: var(--dn); } .chart .bar-n { fill: #4f6ea8; }
.chart-foot { margin-top: 6px; font-size: 11.5px; color: var(--dim); }
.tooltip { position: fixed; z-index: 40; pointer-events: none; min-width: 170px; background: #0d0e10; border: 1px solid var(--seam); border-radius: var(--r); padding: 8px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.tooltip b { display: block; margin-bottom: 4px; font-weight: 600; color: var(--ink); }
.tooltip div { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); }
.tooltip div span:last-child { font-family: var(--mono); color: var(--ink); }
.tooltip div.is-hot span { color: var(--sel); }

/* ---------- Heatmap ---------- */
.heat { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.heat th { font: 11px var(--mono); color: var(--dim); font-weight: 400; text-align: center; height: 18px; }
.heat th.wk { color: var(--muted); }
.heat td { height: 24px; border-radius: 2px; background: var(--heat-0); }
.heat col.cp { width: 128px; } .heat col.ct { width: 44px; }
.heat td.p { background: none; padding-right: 6px; color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.heat td.t { background: none; width: 42px; text-align: right; font: 12px var(--mono); color: var(--muted); }
.heat td.h1 { background: var(--heat-1); } .heat td.h2 { background: var(--heat-2); } .heat td.h3 { background: var(--heat-3); } .heat td.h4 { background: var(--heat-4); }
.heat tr.is-hot td.p { color: var(--sel); }
.heat tr.is-hot td:not(.p):not(.t) { box-shadow: inset 0 0 0 1px var(--sel); }
.legend { display: inline-flex; align-items: center; gap: 3px; font: 11px var(--mono); font-variant: normal; letter-spacing: 0; color: var(--dim); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: block; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { height: 34px; padding: 0 12px; font-size: 12px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); text-align: right; border-bottom: 1px solid var(--seam); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; text-align: left; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl th.l, .tbl td.l { text-align: left; }
.tbl th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tbl th button:hover, .tbl th[aria-sort] button { color: var(--ink); }
.tbl th[aria-sort="ascending"] button::after { content: ""; border: 4px solid transparent; border-bottom-color: currentColor; margin-top: -4px; }
.tbl th[aria-sort="descending"] button::after { content: ""; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.tbl td { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--row); text-align: right; white-space: nowrap; }
.tbl td.num { font-size: 13px; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: #1e2024; }
.tbl tr.is-idle td { color: var(--dim); }
.tbl tr.is-idle td.name a { color: var(--muted); }
.tbl td.name { max-width: 180px; }
.tbl td.name a { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); text-decoration: none; }
.tbl td.name a:hover .ellipsis { text-decoration: underline; }
.tbl.static tbody tr { cursor: default; }
.tbl.static tbody tr:hover td { background: none; }
.rank { display: inline-flex; align-items: center; gap: 6px; }
.rank img { width: 18px; height: 18px; object-fit: contain; }
.is-idle .rank img, .is-idle .av img { filter: grayscale(1); opacity: .6; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.st i { width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.st.idle i { background: var(--idle); }
.st.idle { color: var(--idle); }

/* ---------- Avatars ---------- */
/* Steam pictures only. Everyone else gets an empty slot in lists so names line up, and nothing in headers. */
.av { flex: none; display: inline-block; width: 22px; height: 22px; border-radius: 50%; overflow: hidden; background: var(--raised); box-shadow: inset 0 0 0 1px var(--seam); }
.av img { display: block; width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 48px; height: 48px; box-shadow: 0 0 0 1px var(--seam); }
.av.av-empty { background: var(--row); }

/* ---------- Players ---------- */
.field { width: 100%; height: 30px; padding: 0 10px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--bg); }
textarea.field { height: auto; padding: 10px; resize: vertical; font-size: 12.5px; line-height: 1.5; }
.field::placeholder { color: #7d828b; }
.field:focus { border-color: var(--sel); outline: none; }
.plist { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }
.plist a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 8px 16px; color: var(--ink-2); text-decoration: none; }
.plist .av { grid-row: span 2; }
.plist a:hover { background: #1e2024; }
.plist a[aria-current="true"] { background: var(--row-hot); color: var(--ink); }
.plist a[aria-current="true"] .nm { color: var(--sel); }
.plist .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .mm { font: 13px var(--mono); text-align: right; }
.plist .meta { grid-column: 2 / -1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .meta .idle { color: var(--idle); }
.plist .none { padding: 12px 16px; color: var(--muted); font-size: 13px; }
.archived { margin-top: auto; border-top: 1px solid var(--seam); padding: 10px 16px 14px; }
.archived summary { cursor: pointer; font-size: 13px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); }
.archived ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.archived li { display: grid; gap: 6px; }
.archived .row { display: flex; gap: 8px; flex-wrap: wrap; }
.archived .who { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archived .who small { display: block; font-size: 12px; color: var(--muted); }

.detail { min-height: 0; }
.dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px; border-bottom: 1px solid var(--seam); }
.dhead h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dhead h2 a { color: inherit; text-decoration: none; }
.dhead h2 a:hover { color: var(--sel); text-decoration: underline; }
.dhead-main { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.dhead-text { min-width: 0; }
.dhead p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.dhead .dlinks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 12.5px; }
.dhead .nick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; }
.dhead .nick label { color: var(--muted); }
.dhead .nick .field { width: 200px; height: 26px; }
.dhead .danger-zone { padding-left: 24px; margin-left: 8px; border-left: 1px solid var(--seam); }
.dsec { padding: 14px 16px 16px; border-bottom: 1px solid var(--seam); }
.dsec h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--ink-2); }
.dsec h3 small { margin-left: 8px; font: 12px var(--mono); font-variant: normal; letter-spacing: 0; color: var(--muted); }
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.multiples h4 { margin: 0 0 4px; font: 12px var(--mono); color: var(--muted); font-weight: 400; display: flex; justify-content: space-between; }
.multiples h4 b { color: var(--ink); font-weight: 400; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; }
.mix { display: grid; gap: 8px; }
.mix div { display: grid; grid-template-columns: 40px 1fr 56px; align-items: center; gap: 10px; font-size: 12.5px; }
.mix span:first-child { font-family: var(--mono); color: var(--muted); }
.mix .track { height: 8px; background: var(--raised); border-radius: 2px; overflow: hidden; }
.mix .track i { display: block; height: 100%; background: var(--sel); transform-origin: left center; }
/* Player-switch motion scales bars from their baseline. */
.chart .bar-n { transform-box: fill-box; transform-origin: 50% 100%; }
.mix span:last-child { font-family: var(--mono); text-align: right; }

/* ---------- Projection ---------- */
.proj-head { flex-wrap: wrap; }
.proj-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; }
.proj-controls .lbl { margin-bottom: 6px; }
.pace { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 26px; }
.pace input[type=range] { width: 168px; margin: 0; accent-color: var(--sel); cursor: pointer; }
.pace input[type=range]:disabled { cursor: not-allowed; opacity: .5; }
.pace output { font: 12.5px var(--mono); color: var(--ink-2); min-width: 21ch; }
.link.small { font-size: 12.5px; }
.proj-body { transition: opacity .2s ease-out; }
.proj-body.is-loading { opacity: .55; }
.proj-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.kpis em.rng { font-size: 18px; line-height: 1.4; white-space: nowrap; }
.kpis em.rank-kpi { font: 600 16px/1.6 var(--sans); }
.headline { margin: 0 0 16px; font-size: 13.5px; color: var(--ink-2); }
.sub-h { margin-top: 4px !important; }
.ladder .tier { font-weight: 600; }
.ladder tr.is-reached td { color: var(--muted); }
.ladder tr.is-reached .tier { opacity: .7; }
.method { margin: 0; max-width: 90ch; }
.switch-pl { display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; }
.avatar-row { margin: 4px 0 16px; }
.avatar-row .note { margin-bottom: 8px; }

/* ---------- Checklists ---------- */
.checks { border: 0; margin: 0 0 16px; padding: 0; display: grid; gap: 2px; max-height: 52vh; overflow-y: auto; }
.checks label { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r); cursor: pointer; }
.checks label:hover { background: #1e2024; }
.checks input { width: 15px; height: 15px; accent-color: var(--sel); margin: 0; }
.checks .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks small { font: 12px var(--mono); color: var(--muted); }
.checks small.idle { color: var(--idle); }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status { font-size: 12.5px; color: var(--muted); }
.status.err { color: var(--dn); }
.status.ok { color: var(--up); }

/* ---------- Import dialog ---------- */
.dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--seam); border-radius: var(--r); background: var(--panel); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }
.dialog.narrow { width: min(420px, calc(100vw - 32px)); }
.login-fields { padding: 14px 16px 4px; }
.login-fields .note { margin: 8px 0 0; }
.dialog::backdrop { background: rgba(8, 9, 11, .72); }
.dialog-body { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 16px 12px; border-bottom: 1px solid var(--seam); }
.dialog-head h2 { margin: 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.dialog-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.btn.icon { padding: 0 7px; }
.dialog-hint { margin: 12px 16px 0; }
.imp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 12px 16px 16px; overflow-y: auto; }
.imp-slot { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.imp-slot h3 { margin: 0; font-size: 13px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--ink-2); }
.imp-slot h3 small { margin-left: 6px; font-size: 12.5px; font-weight: 400; font-variant: normal; letter-spacing: 0; color: var(--muted); }
.imp-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12.5px; }
.imp-link[hidden] { display: none; }
.drop.small { min-height: 76px; margin: 0; padding: 12px; font-size: 13px; }
.drop .link { font-size: inherit; }
.dialog.dragging .drop { border-color: #4a5a7a; }
.imp-slot textarea { min-height: 96px; }
.slot-note { margin: 0; min-height: 18px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.slot-note.ok { color: var(--up); }
.slot-note.err { color: var(--dn); }
.dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--seam); }
.dialog-foot .status { margin-right: auto; }
.chart .hit-col { fill: transparent; }
.season-form { display: grid; gap: 6px; max-width: 320px; }
.season-form .lbl { margin: 8px 0 0; }
.season-form .note { margin: 6px 0 4px; }
.season-form input[type=date] { color-scheme: dark; }

/* ---------- Drop zones ---------- */
.drop { display: grid; place-items: center; text-align: center; gap: 4px; min-height: 150px; margin-bottom: 16px; padding: 20px; border: 1px dashed #3a3f47; border-radius: var(--r); background: var(--bg); transition: border-color .15s, background .15s; }
.drop p { margin: 0; }
.drop.over { border-color: var(--sel); background: var(--sel-tint); }
.stack { display: grid; gap: 6px; margin-bottom: 14px; }
.stack .actions { margin-top: 8px; }
.lbl { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
.actions + .results { margin-top: 14px; }
.results { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--seam); }
.results:empty { display: none; }
.results li { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--row); font-size: 13px; }
.results b { font: 11.5px var(--mono); letter-spacing: .04em; }
.results .imported b { color: var(--up); } .results .duplicate b { color: var(--idle); } .results .error b { color: var(--dn); }
.results span { overflow-wrap: anywhere; color: var(--ink-2); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-family: var(--mono); }

/* ---------- Team filter (top bar) ---------- */
.team-filter select { height: 28px; max-width: 180px; padding: 0 26px 0 10px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6.5 3.5 3.5 3.5-3.5' fill='none' stroke='%239a9fa8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 6px center / 14px; color: var(--ink-2); font: 12px var(--mono); appearance: none; cursor: pointer; text-overflow: ellipsis; }
.team-filter select:hover { color: var(--ink); }
.team-filter.is-on select { border-color: var(--sel); background-color: var(--sel-tint); color: var(--sel); }

/* ---------- Teams ---------- */
.new-team { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-bottom: 1px solid var(--seam); }
.new-team .field { flex: 1 1 140px; height: 28px; }
.new-team .status { flex-basis: 100%; }
.rename { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rename .field { width: min(320px, 100%); height: 32px; font-size: 16px; font-weight: 600; }
.member-editor { background: var(--bg); }
.checks.wide { max-height: none; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; margin: 0; }
.dsec .kpis { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); margin-bottom: 0; }
.dsec.flush-x { padding-left: 0; padding-right: 0; }
.dsec.flush-x h3 { padding: 0 16px; }
.share { display: inline-block; width: 72px; height: 6px; margin-right: 8px; vertical-align: middle; border-radius: 2px; background: var(--raised); overflow: hidden; }
.share i { display: block; height: 100%; background: var(--sel); }
.share-v { font-size: 12.5px; color: var(--muted); }
.teams-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; }
.lbl-inline { margin-right: 4px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; height: 26px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--bg); }
.chip a { padding: 0 8px; color: var(--ink-2); text-decoration: none; }
.chip a:hover { color: var(--sel); }
.chip button { display: grid; place-items: center; width: 24px; height: 100%; border: 0; border-left: 1px solid var(--seam); background: none; color: var(--muted); cursor: pointer; }
.chip button:hover { color: var(--dn); }
.chip-add { width: auto; height: 26px; padding: 0 8px; font-size: 12.5px; color: var(--muted); }


/* ---------- Share dialog ---------- */
.dialog.share-modal { width: min(860px, calc(100vw - 32px)); }
.share-stage { padding: 16px; overflow-y: auto; }
/* Held at the image's own 1200×630 shape while it renders, so the dialog doesn't jump. */
.share-stage .share-img, .share-stage .share-wait { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; border: 1px solid var(--seam); border-radius: var(--r); background: var(--bg); }
.share-stage .share-wait { display: grid; place-items: center; color: var(--muted); font-size: 13px; animation: pulse 1.4s ease-in-out infinite; }
.share-stage .empty { padding: 28px 0; }
.dialog.share-modal .dialog-foot .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---------- Versus ---------- */
/* Two team inks (from the series palette) mark the sides; state colours keep their meanings. */
.vs-setup { display: flex; flex-direction: column; gap: 14px; }
.vs-basis .seg button { padding: 4px 12px; }
.vs-side { border: 1px solid var(--seam); border-radius: var(--r); background: var(--bg); }
.vs-side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--seam); }
.vs-team { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.vs-dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--team, var(--dim)); }
.vs-dot.none { background: none; box-shadow: inset 0 0 0 1.5px var(--heat-2); }
.vs-strength { font-size: 12.5px; color: var(--muted); }
.vs-strength .num { color: var(--ink); font-weight: 600; margin-left: 4px; }
.vs-slots { list-style: none; margin: 0; padding: 6px 0; }
.vs-slot { display: grid; grid-template-columns: 22px minmax(0, 1fr) 84px; align-items: center; column-gap: 10px; padding: 4px 12px; }
.vs-slot .field { height: 30px; padding: 0 6px; background: var(--panel); text-overflow: ellipsis; }
.vs-rate { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.vs-rate img { width: 20px; height: 20px; }
.vs-rate .num { font-size: 13px; font-weight: 600; }
.vs-from { grid-column: 2 / -1; font-size: 12px; color: var(--muted); padding-top: 2px; }
.vs-fill { display: block; width: calc(100% - 24px); margin: 2px 12px 12px; height: 28px; font-size: 12.5px; color: var(--ink-2); }
.vs-mid { display: flex; justify-content: center; gap: 8px; margin: -4px 0; }
.vs-odds { min-height: 40px; }
.vs-odds-bar { display: flex; height: 6px; border-radius: 2px; overflow: hidden; background: var(--raised); }
.vs-odds-bar i { display: block; background: #7dcfff; transition: width .5s cubic-bezier(.16, 1, .3, 1); }
.vs-odds-bar i + i { flex: 1; background: #ff9e64; margin-left: 2px; }
.vs-odds-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.vs-odds-row b { color: var(--ink); font-size: 15px; }
.vs-odds-row small { color: var(--muted); font-size: 12px; text-align: center; }
.vs-go { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vs-go .btn.primary { height: 34px; padding: 0 16px; }
.vs-setup .note { margin: 0; }

.vs-board { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--seam); }
.vs-score-side { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; min-width: 0; }
.vs-score-side.right { grid-template-columns: auto minmax(0, 1fr); text-align: right; }
.vs-side-id { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vs-score-side.right .vs-side-id { align-items: flex-end; }
.vs-side-id .vs-team { font-size: 15px; }
.vs-roster { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.vs-score-side.right .vs-roster { flex-direction: row-reverse; }
.vs-avs { display: inline-flex; flex: none; }
.vs-avs .av + .av { margin-left: -6px; }
.vs-avs .av { box-shadow: 0 0 0 2px var(--panel); }
.vs-roster-names { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Score tiles: a tint of the side's ink, its ink along the top, the figure in mono. */
.vs-goals { display: grid; place-items: center; min-width: 76px; height: 64px; padding: 0 12px; border-radius: var(--r); background: color-mix(in srgb, var(--team) 10%, var(--bg)); box-shadow: inset 0 2px 0 var(--team), inset 0 0 0 1px color-mix(in srgb, var(--team) 22%, var(--seam)); font-size: 40px; line-height: 1; color: var(--ink); transition: background .3s; }
.vs-score-side.leads .vs-goals { background: color-mix(in srgb, var(--team) 20%, var(--bg)); }
.vs-score-side.flash .vs-goals { animation: vs-goal 1.2s cubic-bezier(.16, 1, .3, 1); }
@keyframes vs-goal { 0% { color: var(--team); transform: scale(1.18); } 60% { color: var(--team); } 100% { color: var(--ink); transform: scale(1); } }
.vs-clock { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 112px; padding: 0 14px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--bg); }
.vs-clock .num { font-size: 26px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.vs-clock small { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); }
.vs-clock[data-phase="live"] small::before, .vs-clock[data-phase="ot"] small::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-2); animation: pulse 1.4s ease-in-out infinite; }
.vs-clock[data-phase="ot"] .num, .vs-clock[data-phase="final"] .num { color: var(--ink-2); }
#vs-chat[aria-pressed="true"], #vs-trail[aria-pressed="true"] { border-color: var(--sel); color: var(--sel); background: var(--sel-tint); }
.vs-ctls { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.vs-pitch { position: relative; background: var(--panel); overflow: hidden; }
.vs-pitch canvas { display: block; width: 100%; transform-origin: 50% 60%; }
/* Goal: the pitch tips toward the net that was scored in. Demo: a short jolt. */
.vs-pitch canvas.tilt-goal { animation: vs-tilt .75s cubic-bezier(.16, 1, .3, 1); }
.vs-pitch canvas.tilt-demo { animation: vs-jolt .38s ease-out; }
@keyframes vs-tilt {
  0% { transform: none; }
  22% { transform: perspective(1100px) rotateY(calc(var(--dir) * -5deg)) rotate(calc(var(--dir) * .9deg)) scale(1.012); }
  100% { transform: none; }
}
@keyframes vs-jolt {
  0%, 100% { transform: none; }
  20% { transform: translateX(calc(var(--dir) * 4px)) rotate(calc(var(--dir) * .5deg)); }
  45% { transform: translateX(calc(var(--dir) * -3px)) rotate(calc(var(--dir) * -.35deg)); }
  70% { transform: translateX(calc(var(--dir) * 1px)) rotate(calc(var(--dir) * .12deg)); }
}

/* Chat log: a card in the pitch's bottom-left corner, like an in-game chat; under the pitch on phones. */
.vs-chatlog { position: absolute; left: 12px; bottom: 12px; width: min(340px, 42%); max-height: 46%; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; padding: 6px 0; border: 1px solid var(--seam); border-radius: var(--r); background: rgba(13, 14, 16, .86); overflow: hidden; pointer-events: none; }
.vs-chatlog:empty { display: none; }
.vs-chatline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; margin: 0; padding: 1px 10px; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); animation: vs-in .3s cubic-bezier(.16, 1, .3, 1); }
.vs-chatline:not(:nth-last-child(-n+4)) { opacity: .55; }
.vs-chatline b { font-weight: 600; }
.vs-chatline b::after { content: ":"; color: var(--muted); }
.vs-chat-t { font-size: 11px; color: var(--dim); }
.vs-chat-text { color: var(--ink); }
.vs-chat-fx { font-size: 11px; color: var(--muted); }
.vs-chat-fx.tilt { color: var(--dn); }
/* Boost in the box score: a 40px meter and its value. */
.vs-box td.boost { white-space: nowrap; }
.vs-boost { display: inline-block; width: 40px; height: 4px; margin-right: 8px; vertical-align: middle; border-radius: 2px; background: var(--raised); overflow: hidden; }
.vs-boost i { display: block; height: 100%; width: 33%; background: var(--ink-2); transition: width .2s linear; }
.vs-box td.boost b { display: inline-block; min-width: 3ch; font-size: 13px; font-weight: 400; text-align: right; }
.vs-box td.boost.low .vs-boost i { background: var(--dn); }
.vs-box td.boost.low b { color: var(--dn); }

/* Event cards, broadcast-overlay style but in the graphite world: each side's plays stack on its side. */
.vs-cards { position: absolute; top: 12px; display: flex; flex-direction: column; gap: 6px; width: min(244px, 34%); pointer-events: none; }
.vs-cards[data-side="0"] { left: 12px; }
.vs-cards[data-side="1"] { right: 12px; align-items: flex-end; }
.vs-cards[data-side="mid"] { left: 50%; transform: translateX(-50%); align-items: center; width: min(260px, 40%); }
.vs-card { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 0 9px; width: 100%; padding: 6px 10px 6px 6px; border: 1px solid var(--seam); border-radius: var(--r); background: rgba(13, 14, 16, .9); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: vs-card-in .32s cubic-bezier(.16, 1, .3, 1); transition: opacity .26s, transform .26s; }
.vs-cards[data-side="1"] .vs-card { --from: 14px; }
.vs-cards[data-side="0"] .vs-card { --from: -14px; }
.vs-card.out { opacity: 0; transform: translateY(-4px); }
.vs-card-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 2px; background: color-mix(in srgb, var(--team, #9a9fa8) 16%, transparent); color: var(--team, var(--ink-2)); }
.vs-card-ico .ico { width: 16px; height: 16px; }
.vs-card-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.vs-card-text b { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.vs-card-text b .num { margin-left: 4px; color: var(--team, var(--ink)); }
.vs-card-text span { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-card-t { align-self: start; padding-top: 1px; font-size: 11px; color: var(--muted); }
.vs-card.goal { border-color: color-mix(in srgb, var(--team) 55%, var(--seam)); }
.vs-card.goal .vs-card-ico { background: var(--team); color: var(--bg); }
@keyframes vs-card-in { from { opacity: 0; transform: translateX(var(--from, 0)) translateY(var(--from-y, 0)); } }
.vs-cards[data-side="mid"] .vs-card { --from-y: -8px; }
.vs-track { height: 2px; background: var(--raised); }
.vs-track i { display: block; height: 100%; background: var(--ink-2); transform-origin: left; transform: scaleX(0); }
.vs-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--seam); }
.vs-controls #vs-skip { margin-left: auto; }
.vs-controls .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.vs-result { border-bottom: 1px solid var(--seam); }
.vs-result-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 16px; }
.vs-result-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.vs-result-head h3 .vs-dot { width: 11px; height: 11px; }
.vs-result-head h3 .num { font-size: 20px; }
.vs-result-head p { grid-column: 1; margin: 0; font-size: 13px; color: var(--ink-2); }
.vs-result-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 8px; }
.vs-boxwrap { border-bottom: 1px solid var(--seam); }
.vs-box td.name { display: flex; align-items: center; gap: 8px; height: 36px; }
.vs-box td.name span:not(.vs-mvp) { overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.vs-box td.bump { animation: vs-bump .7s cubic-bezier(.16, 1, .3, 1); }
@keyframes vs-bump { 0% { color: var(--team); } 100% { color: inherit; } }
/* Mood: a small chip with an icon; up moods in gain green, down moods in loss rose, steady in ink. */
.vs-mood { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 6px; border-radius: 2px; background: var(--raised); font-size: 12px; color: var(--ink-2); white-space: nowrap; animation: vs-in .35s cubic-bezier(.16, 1, .3, 1); }
.vs-mood .ico { width: 13px; height: 13px; }
.vs-mood.up .ico { color: var(--up); }
.vs-mood.dn .ico { color: var(--dn); }
.vs-tipped { text-decoration: underline dotted var(--heat-2); text-underline-offset: 4px; }
.vs-strength, .vs-rate[tabindex] { cursor: help; border-radius: 2px; }
.tooltip.vs-tip { max-width: 300px; }
.tooltip.vs-tip div { align-items: baseline; padding: 2px 0; }
.tooltip.vs-tip div small { display: block; font-size: 11.5px; color: var(--muted); }
.tooltip.vs-tip div.sep, .tooltip.vs-tip div.total { border-top: 1px solid var(--seam); margin-top: 4px; padding-top: 5px; }
.tooltip.vs-tip div.total span { color: var(--ink); font-weight: 600; }
.tooltip.vs-tip p { margin: 6px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.vs-box tr.is-mvp td.name { font-weight: 600; }
.vs-mvp { font: 600 11px var(--mono); color: var(--ink); border: 1px solid var(--heat-2); border-radius: 2px; padding: 1px 5px; }
.vs-sub-h { margin: 0; height: 36px; display: flex; align-items: center; padding: 0 16px; font-size: 12px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); }
.vs-feed-empty { margin: 0; padding: 0 16px 16px; font-size: 12.5px; color: var(--muted); max-width: 62ch; }
.vs-feed { list-style: none; margin: 0; padding: 0 0 12px; max-height: 340px; overflow-y: auto; }
.vs-ev { display: grid; grid-template-columns: 52px 9px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; min-height: 30px; padding: 3px 16px; border-top: 1px solid var(--row); font-size: 13px; color: var(--ink-2); animation: vs-in .35s cubic-bezier(.16, 1, .3, 1); }
.vs-ev-t { font-size: 12px; color: var(--muted); }
.vs-ev.goal { color: var(--ink); font-weight: 600; background: var(--raised); }
.vs-ev.big { color: var(--ink); }
.vs-ev.odd .vs-ev-text { font-style: italic; }
.vs-ev-score { font-size: 13px; }
@keyframes vs-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Live ranks ---------- */
/* Current ranks and presence from the ranks service. Online is a status dot in gain green (like "played");
   progress bars are neutral ink, since time to the next check is neither a gain nor a loss. */
.tab-count { display: inline-flex; align-items: center; gap: 5px; margin-left: 7px; font: 11.5px var(--mono); color: var(--ink-2); }
.tab-count::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.status-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 18px; overflow-x: auto; scrollbar-width: none; }
.live-status { flex: none; display: flex; align-items: center; gap: 8px; align-self: stretch; padding-left: 14px; border-left: 1px solid var(--seam); color: var(--ink-2); cursor: default; }
.lv-ico { display: grid; place-items: center; width: 14px; height: 14px; }
.lv-ico i { width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.live-status[data-state="idle"] .lv-ico i { background: var(--heat-2); }
.live-status[data-state="off"] .lv-ico i { background: none; box-shadow: inset 0 0 0 1.5px var(--heat-2); }
.live-status[data-state="off"] { color: var(--muted); }
.live-status[data-state="down"] .lv-ico i { background: var(--dn); }
.live-status[data-state="down"] .lv-text { color: #f3b8c3; }
.lv-spin { width: 14px; height: 14px; fill: none; stroke-width: 1.8; stroke-linecap: round; animation: spin .8s linear infinite; }
.lv-spin circle { stroke: var(--seam); }
.lv-spin path { stroke: var(--ink-2); }
.lv-text .num { color: var(--ink); }
.lv-next { display: inline-flex; align-items: center; gap: 8px; color: var(--dim); }
.lv-next .num { min-width: 4ch; font-size: 11.5px; text-align: right; color: var(--dim); }
.lv-bar { display: block; width: 56px; height: 2px; border-radius: 1px; background: var(--raised); overflow: hidden; }
.lv-bar i, .ph-progress i, .lv-line i { display: block; height: 100%; background: var(--heat-3); transform: scaleX(0); transform-origin: left center; transition: transform .5s linear; }
.is-fetching i { background: var(--ink-2); animation: lv-fetch 1.1s ease-in-out infinite; }
@keyframes lv-fetch { 50% { opacity: .35; } }
.lv-when { flex: none; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.lv-when .num { color: var(--ink-2); }

/* Presence: a dot on the avatar when online; offline stays quiet in lists and is spelled out on the player page. */
.avp { position: relative; display: inline-flex; flex: none; }
.pslot { position: absolute; right: -3px; bottom: -3px; display: flex; }
.pdot { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 2px var(--panel); transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.pdot.off, .pdot.unk { transform: scale(0); }
.pchip { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.pchip i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--up); }
.pchip.off { color: var(--muted); }
.pchip.off i { background: none; box-shadow: inset 0 0 0 1.5px var(--heat-2); }
.pchip.unk { color: var(--dim); }
.now-v { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.now-v img { width: 18px; height: 18px; object-fit: contain; }

/* Change flares: a figure that moved glows in the direction it moved, then settles. */
.fl-up { animation: fl-up 1.2s cubic-bezier(.16, 1, .3, 1); }
.fl-dn { animation: fl-dn 1.2s cubic-bezier(.16, 1, .3, 1); }
@keyframes fl-up { 0%, 30% { color: var(--up); fill: var(--up); } }
@keyframes fl-dn { 0%, 30% { color: var(--dn); fill: var(--dn); } }
img.fl-up, img.fl-dn { animation: fl-icon .9s cubic-bezier(.16, 1, .3, 1); }
@keyframes fl-icon { 0% { transform: scale(1.3); } }
.rank.fl-up { border-radius: 2px; animation-name: fl-rank-up; }
.rank.fl-dn { border-radius: 2px; animation-name: fl-rank-dn; }
@keyframes fl-rank-up { 0%, 30% { background: rgba(158, 206, 106, .16); box-shadow: 0 0 0 3px rgba(158, 206, 106, .16); } }
@keyframes fl-rank-dn { 0%, 30% { background: rgba(247, 118, 142, .16); box-shadow: 0 0 0 3px rgba(247, 118, 142, .16); } }

/* Player page: the live block above the stored history. */
.live-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lv-line { height: 2px; margin: -2px 0 8px; border-radius: 1px; background: var(--raised); overflow: hidden; }
.live-sec .tbl-wrap { margin: 0 -16px; }

/* Live page */
.live { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-content: start; }
.live-now { grid-column: 1 / -1; overflow: hidden; }
.live-now .ph { border-bottom: 0; }
.ph-progress { height: 2px; background: var(--seam); }
.live-cards { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); margin: 0 -1px -1px 0; min-height: 120px; }
.lcard { position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 14px 16px 12px; background: var(--panel); box-shadow: inset -1px 0 0 var(--seam), inset 0 -1px 0 var(--seam); cursor: pointer; transition: background .15s; }
.lcard:hover { background: #1e2024; }
.lcard.is-hot { background: var(--row-hot); }
.lcard.is-hot .lc-name { color: var(--sel); }
.lcard.leaving { position: absolute; z-index: 1; pointer-events: none; }
.lc-top { display: flex; flex-direction: column; gap: 12px; }
.lc-head { display: flex; align-items: center; gap: 8px; min-width: 0; height: 22px; }
.lc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; text-decoration: none; }
.lc-name:hover { color: var(--sel); text-decoration: underline; }
.lc-head .pchip { margin: 0; max-width: 50%; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.lc-rank { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lc-rank img, .lc-noicon { flex: none; width: 34px; height: 34px; object-fit: contain; }
.lc-noicon { border-radius: 50%; background: var(--row); }
.lc-rank div { min-width: 0; }
.lc-rank b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lc-rank small { display: block; font-size: 12px; color: var(--muted); }
.lc-fig { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
.lc-fig em { font: 600 28px/1.05 var(--mono); font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink); }
.lc-d { font-size: 15px; font-weight: 600; }
.lc-fig small { font-size: 12px; color: var(--muted); }
.lc-spark { min-height: 46px; }
.lc-spark svg { display: block; width: 100%; height: auto; overflow: visible; }
.sp-line { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.sp-base { stroke: #3a3e45; stroke-dasharray: 2 3; }
.sp-tail { fill: none; stroke: var(--ink-2); stroke-width: 1.4; stroke-dasharray: 2.5 3; stroke-linecap: round; }
.lc-foot { display: flex; align-items: baseline; gap: 4px 14px; padding-top: 10px; border-top: 1px solid var(--row); font-size: 12px; color: var(--muted); white-space: nowrap; }
.lc-foot b { font-weight: 400; font-size: 12.5px; color: var(--ink-2); }
.lc-asof { margin-left: auto; font: 11.5px var(--mono); color: var(--dim); }
.lc-asof.stale { color: #f3b8c3; }
.live-empty { grid-column: 1 / -1; background: var(--panel); box-shadow: inset 0 -1px 0 var(--seam); }
.live-empty .empty { padding: 40px 16px; }
.live-empty .skel { padding: 18px 16px; }

/* Live marks in charts: a dashed tail from the last daily point to a dot at MMR now; one pulsing ring per chart at most. */
.live-dot { fill: var(--c, var(--sel)); stroke: var(--panel); stroke-width: 1.5; }
.live-ring { fill: none; stroke: var(--c, var(--sel)); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: live-ring 2.4s cubic-bezier(.16, 1, .3, 1) infinite; }
@keyframes live-ring { 0% { transform: scale(1); opacity: .75; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
.chart .live-tail { fill: none; stroke: #5a5f68; stroke-width: 1.5; stroke-dasharray: 3 3; stroke-linecap: round; }
.chart.race .live-ring, .chart.mv .live-ring { animation: none; opacity: 0; }
.chart.race .live-pt.is-hot .live-ring, .chart.mv .mv-row.is-hot .live-ring { animation: live-ring 2.4s cubic-bezier(.16, 1, .3, 1) infinite; opacity: 1; }
.chart .live-tail.is-hot { stroke: var(--sel); }
.chart .live-pt.is-hot .live-dot { fill: var(--sel); }
.chart.has-hot .live-pt:not(.is-hot), .chart.has-hot .live-tail:not(.is-hot) { opacity: .45; }
.chart.mv .mv-name { font: 12.5px var(--sans); fill: var(--ink-2); }
.chart.mv .mv-hit { fill: transparent; cursor: pointer; }
.chart.mv .mv-row:hover .mv-hit { fill: #1e2024; }
.chart.mv .mv-row.is-hot .mv-name { fill: var(--sel); }
.chart.mv.has-hot .mv-row:not(.is-hot) { opacity: .45; }
.mv-seg { fill: none; stroke: #5a5f68; stroke-width: 2; stroke-linecap: round; opacity: .8; }
.mv-seg.up { stroke: var(--up); }
.mv-seg.dn { stroke: var(--dn); }
.mv-from { fill: var(--panel); stroke: #8a8f98; stroke-width: 1.5; }
.chart.mv .mv-d { font: 12.5px var(--mono); fill: var(--muted); }
.chart.mv .mv-d.up { fill: var(--up); }
.chart.mv .mv-d.dn { fill: var(--dn); }
.chart.mv .band-label { font-size: 10px; }

/* ---------- Player titles ---------- */
/* A medal shelf of rank-bearing titles, a group switch, then every title in its in-game colour in a scrolling grid
   with sticky group headers. The fade at the bottom edge only shows while there is more below. */
.ttl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ttl-head h3 { margin: 0; }
.ttl-filter { width: 220px; height: 28px; }
.ttl-medals { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-bottom: 12px; }
.ttl-shelf { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.ttl-shelf-l { margin-right: 2px; }
.ttl-medal { display: inline-flex; align-items: center; gap: 5px; cursor: default; }
.ttl-medal img { width: 22px; height: 22px; object-fit: contain; }
.ttl-medal b { font-size: 13px; font-weight: 600; color: var(--ink); }
.ttl-groups { display: flex; width: max-content; max-width: 100%; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.ttl-groups button { display: inline-flex; align-items: baseline; gap: 6px; flex: none; font: 12.5px var(--sans); white-space: nowrap; }
.ttl-groups button .num { font-size: 11.5px; color: var(--dim); }
.ttl-groups button[aria-checked="true"] .num { color: var(--sel); }
.ttl-groups button.none { color: #5d626b; }
.ttl-scroll { max-height: 320px; margin: 0 -16px -16px; padding: 0 16px 8px; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--seam); scrollbar-width: thin; scrollbar-color: var(--heat-2) transparent; }
.ttl-scroll:focus-visible { outline-offset: -2px; }
.ttl-scroll.more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }
.ttl-gh { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; height: 32px; margin: 0; background: var(--panel); border-bottom: 1px solid var(--seam); font-size: 12px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); }
.ttl-gh .num { font-weight: 400; font-variant: normal; letter-spacing: 0; color: var(--dim); }
.ttl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); column-gap: 20px; margin: 0 0 6px; padding: 0; list-style: none; }
.ttl { display: flex; align-items: center; min-width: 0; height: 30px; border-bottom: 1px solid var(--row); font-size: 13px; color: var(--ink-2); }
.ttl-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttl.glow .ttl-t { text-shadow: 0 0 10px color-mix(in srgb, var(--glow) 45%, transparent); }
.ttl.unknown .ttl-t { color: var(--muted); font-style: italic; }
.ttl-rank { width: 18px; height: 18px; margin: 0 1px; vertical-align: -4px; object-fit: contain; }
.ttl.is-new { animation: ttl-new 2.4s cubic-bezier(.16, 1, .3, 1); }
@keyframes ttl-new { 0%, 30% { background: rgba(158, 206, 106, .12); } }
.ttl-none { margin: 0; padding: 18px 0; font-size: 13px; color: var(--muted); }
.ttl-skel { padding: 4px 0 8px; }

/* ---------- Replays ---------- */
/* Library: the Players layout, with an upload drop zone and the player's matches. */
.rp-upload .drop { min-height: 112px; margin-bottom: 0; cursor: pointer; }
.rp-upload .drop .note { margin: 4px 0 0; }
.rp-queue { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 1px; background: var(--seam); border: 1px solid var(--seam); border-radius: var(--r); overflow: hidden; }
.rp-q { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 16px; padding: 9px 12px; background: var(--bg); font-size: 13px; }
.rp-q-file { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.rp-q-file b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-q-file .num { font-size: 12px; color: var(--muted); }
.rp-q-state { color: var(--ink-2); text-align: right; }
.rp-q.busy .rp-q-state { color: var(--muted); }
.rp-q.ok .rp-q-state { color: var(--up); }
.rp-q.err .rp-q-state, .rp-q.warn .rp-q-state { color: var(--dn); }
.rp-q.ask { box-shadow: inset 2px 0 0 var(--sel); }
.rp-q.ask .rp-q-state { color: var(--sel); font-weight: 600; }
.rp-roster-line { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--muted); }
.rp-q-actions, .rp-pick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.rp-pick .btn small { color: var(--muted); font-size: 11.5px; }
.rp-pick .btn:hover small { color: var(--ink-2); }
.rp-pick .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.rp-linked { font-weight: 600; color: var(--ink); }
.rp-games td small { font-size: 12px; }
.rp-res { display: inline-flex; align-items: center; gap: 7px; }
.rp-res .num { color: var(--ink-2); }
.rp-st { font-size: 12.5px; color: var(--ink-2); }
.rp-st.busy, .rp-st.warn { color: var(--muted); }
.rp-st.busy::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--ink-2); vertical-align: 1px; animation: pulse 1.4s ease-in-out infinite; }
.rp-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.rp-actions .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.rp-games tbody tr { cursor: default; }

/* Viewer: the match panel beside a 340px side panel of players and moments. */
.replay { grid-template-columns: minmax(0, 1fr) 340px; min-height: calc(100vh - 48px); }
.rv-main { min-width: 0; }
.rv-stage { position: relative; height: clamp(340px, calc(100vh - 350px), 820px); background: var(--panel); overflow: hidden; border-bottom: 1px solid var(--seam); }
.rv-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
.rv-canvas:active { cursor: grabbing; }
.rv-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rv-label { position: absolute; left: 0; top: 0; padding: 1px 6px 1px 5px; border-left: 2px solid var(--team); border-radius: 2px; background: rgba(13, 14, 16, .78); font-size: 11.5px; line-height: 1.5; color: var(--ink-2); white-space: nowrap; will-change: transform; }
.rv-label.is-student { color: var(--sel); font-weight: 600; }
.rv-status { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 0; padding: 24px; font-size: 13px; color: var(--muted); text-align: center; }
.rv-status b { color: var(--ink); }
.rv-stage[data-state="ready"] .rv-status { display: none; }
.rv-stage[data-state="loading"] .rv-status::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid var(--seam); border-top-color: var(--ink-2); animation: spin .8s linear infinite; }
.rv-stage .vs-cards { z-index: 2; }
/* Goal stamp: the new score in the scorer's ink, revealed from its centre (driven by match time from the script). */
.rv-goal { position: absolute; left: 50%; bottom: 18px; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 22px 12px; border: 1px solid color-mix(in srgb, var(--team) 45%, var(--seam)); border-radius: var(--r); background: rgba(13, 14, 16, .9); box-shadow: inset 0 2px 0 var(--team), 0 8px 24px rgba(0, 0, 0, .5); pointer-events: none; white-space: nowrap; will-change: clip-path, transform, opacity; }
.rv-goal-score { display: flex; align-items: baseline; gap: 14px; font-size: 56px; font-weight: 600; line-height: 1; color: var(--ink-2); }
.rv-goal-score .on { color: var(--team); }
.rv-goal-score i { font-style: normal; color: var(--heat-2); }
.rv-goal-line { font-size: 13px; color: var(--ink-2); }
.rv-goal-line b { font-weight: 600; color: var(--team); }
/* Heatmap card, bottom-left of the stage. */
.rv-heat { position: absolute; left: 12px; bottom: 12px; z-index: 3; width: 268px; max-height: calc(100% - 24px); display: flex; flex-direction: column; border: 1px solid var(--seam); border-radius: var(--r); background: rgba(13, 14, 16, .92); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); overflow: hidden; }
.rv-heat-head { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px 0 12px; border-bottom: 1px solid var(--seam); font-size: 13px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--ink-2); }
.rv-heat-head small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 400; font-variant: normal; letter-spacing: 0; color: var(--muted); }
.rv-heat-head .btn { border-color: transparent; background: none; }
.rv-heat-players { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; padding: 6px; overflow-y: auto; }
.rv-heat-players button { display: flex; align-items: center; gap: 7px; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--r); background: none; font-size: 12.5px; color: var(--ink-2); text-align: left; cursor: pointer; }
.rv-heat-players button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-heat-players button:hover { background: var(--raised); }
.rv-heat-players button[aria-checked="true"] { border-color: var(--sel); background: var(--sel-tint); color: var(--sel); }
.rv-heat-players button.is-student:not([aria-checked="true"]) span { color: var(--sel); }
.rv-heat-thirds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px 12px 4px; border-top: 1px solid var(--seam); }
.rv-heat-thirds div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rv-heat-thirds span { font-size: 11.5px; color: var(--muted); }
.rv-heat-thirds b { font-size: 18px; font-weight: 600; color: var(--ink); }
.rv-third-bar { height: 2px; background: var(--raised); }
.rv-third-bar i { display: block; height: 100%; background: var(--heat-3); }
.rv-heat-note { margin: 0; padding: 6px 12px 10px; font-size: 11.5px; color: var(--muted); }
.rv-timeline { position: relative; height: 64px; background: var(--panel); border-bottom: 1px solid var(--seam); }
.rv-timeline canvas { position: absolute; left: 0; top: 0; display: block; width: 100%; }
.rv-scrub { cursor: pointer; touch-action: none; }
.rv-scrub:focus-visible { outline-offset: -2px; }
.rv-scrub-head { pointer-events: none; }
.rv-controls { gap: 8px 14px; }
.rv-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rv-cam { margin-left: auto; }
.rv-play { min-width: 76px; justify-content: center; }
.rv-controls .btn[aria-pressed="true"] { border-color: var(--sel); color: var(--sel); background: var(--sel-tint); }
.rv-keys { margin: 0; padding: 10px 16px 14px; max-width: none; }
.rv-keys kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--seam); border-radius: 3px; color: var(--ink-2); background: var(--bg); }
.vs-roster-names .is-student { color: var(--sel); }

.rv-side { min-width: 0; }
.rv-players { border-bottom: 1px solid var(--seam); }
.rv-box tbody tr { cursor: pointer; }
.rv-box { width: 100%; table-layout: fixed; }
.rv-box th, .rv-box td { padding: 0 6px; }
.rv-box th:first-child, .rv-box td:first-child { padding-left: 16px; }
.rv-box th:last-child, .rv-box td:last-child { padding-right: 16px; }
.rv-box col.c-name { width: auto; }
.rv-box col.c-boost { width: 82px; }
.rv-box col.c-pts { width: 46px; }
.rv-box col.c-n { width: 28px; }
.rv-box col.c-n:last-child { width: 38px; }
.rv-box .vs-boost { width: 34px; margin-right: 6px; }
.rv-box td.name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rv-box td.name span { overflow: hidden; text-overflow: ellipsis; }
.rv-box td.boost { white-space: nowrap; }
.rv-box td.boost b { display: inline-block; min-width: 3ch; font-size: 13px; font-weight: 400; text-align: right; }
.rv-box td.boost.low .vs-boost i { background: var(--dn); }
.rv-box td.boost.low b { color: var(--dn); }
.rv-box .vs-boost i { transition: none; }
.rv-box tr.is-student td.name span { color: var(--sel); font-weight: 600; }
.rv-box tr.is-followed td { background: var(--row-hot); }
.rv-box tr.is-gone td { color: var(--dim); }
.rv-moments-h { border-top: 0; }
.rv-filter { flex-wrap: wrap; }
.rv-filter button { padding: 4px 8px; }
.rv-moments { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; min-height: 0; max-height: calc(100vh - 48px - 33px - 330px); }
.rv-moments .none { padding: 12px 8px; color: var(--muted); font-size: 13px; }
.rv-moment { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 0 9px; width: 100%; padding: 5px 8px 5px 5px; border: 1px solid transparent; border-radius: var(--r); background: none; text-align: left; cursor: pointer; }
.rv-moment:hover { background: var(--raised); }
.rv-moment.is-now { border-color: var(--seam); background: var(--row-hot); }
.rv-moment.goal .vs-card-ico { background: var(--team); color: var(--bg); }
.rv-moment.kickoff:not([style]) .vs-card-ico, .rv-moment.fifty:not([style]) .vs-card-ico { color: var(--ink-2); }

/* Coach tools: a telestrator rail on the stage's right edge. Coach ink is Ink; the chosen tool is Selection Blue. */
.rv-tools { position: absolute; right: 12px; top: 50%; z-index: 3; display: flex; flex-direction: column; gap: 2px; padding: 4px; border: 1px solid var(--seam); border-radius: var(--r); background: rgba(13, 14, 16, .9); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); transform: translateY(-50%); }
.rv-stage[data-state="loading"] .rv-tools, .rv-stage[data-state="error"] .rv-tools { display: none; }
.rv-tool { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s; }
.rv-tool .ico { width: 16px; height: 16px; }
.rv-tool:hover { background: var(--raised); color: var(--ink); }
.rv-tool[aria-pressed="true"] { border-color: var(--sel); background: var(--sel-tint); color: var(--sel); }
.rv-tools-sep { height: 1px; margin: 3px 4px; background: var(--seam); }
.rv-canvas.is-drawing { cursor: crosshair; }
.rv-stage[data-tool]:not([data-tool=""]) .rv-labels { opacity: .7; }

/* Composer: words for a drawing, pinned beside it. */
.rv-composer { position: absolute; z-index: 4; width: 300px; display: flex; flex-direction: column; border: 1px solid var(--seam); border-radius: var(--r); background: var(--panel); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.rv-composer header { display: flex; align-items: center; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--seam); font-size: 13px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--ink-2); }
.rv-composer header .num { margin-left: 6px; font-size: 12.5px; font-variant: normal; letter-spacing: 0; color: var(--ink); }
.rv-composer textarea { display: block; width: calc(100% - 24px); min-height: 72px; margin: 12px 12px 8px; padding: 8px 10px; resize: vertical; font: 13.5px/1.45 var(--sans); }
.rv-composer-todo { display: flex; align-items: center; gap: 8px; padding: 0 12px 10px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.rv-composer-todo input, .rv-todo-link input { width: 15px; height: 15px; margin: 0; accent-color: var(--sel); }
.rv-composer footer { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--seam); }
.rv-composer-keys { margin-right: auto; font-size: 11.5px; color: var(--muted); }
.rv-composer kbd { font: 10.5px var(--mono); padding: 0 4px; border: 1px solid var(--seam); border-radius: 3px; color: var(--ink-2); background: var(--bg); }

/* Words on the field: a note floats over its pin, an arrow's head or a circle's top. */
.rv-note { position: absolute; left: 0; top: 0; max-width: 220px; padding: 4px 8px; border: 1px solid #3a3f47; border-radius: var(--r); background: rgba(13, 14, 16, .92); font-size: 12.5px; line-height: 1.35; color: var(--ink); white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; will-change: transform; }
.rv-note.is-selected { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); }
.rv-measure { position: absolute; left: 0; top: 0; padding: 2px 7px; border: 1px solid var(--seam); border-radius: var(--r); background: rgba(13, 14, 16, .9); font: 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; will-change: transform; }
.rv-label.is-last::after { content: " · last back"; color: var(--muted); }

/* Side panel tabs, the top bar's text tabs at panel scale. */
.rv-tabs { display: flex; height: 38px; flex: none; padding: 0 8px; border-bottom: 1px solid var(--seam); }
.rv-tabs button { display: flex; align-items: center; gap: 6px; padding: 0 10px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; font-size: 13px; color: var(--muted); cursor: pointer; }
.rv-tabs button:hover { color: var(--ink); }
.rv-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--sel); }
.rv-tabs .num { font-size: 11.5px; color: var(--muted); }
.rv-tabpanel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.rv-notes, .rv-todos { list-style: none; margin: 0; padding: 4px 8px 12px; overflow-y: auto; max-height: calc(100vh - 48px - 33px - 360px); }
.rv-notes .none, .rv-todos .none { padding: 12px 8px; color: var(--muted); font-size: 13px; }
.rv-notes-add { padding: 12px 12px 4px; }
.rv-notes-add .note { margin: 8px 0 0; }

.rv-note-row { position: relative; display: flex; align-items: center; gap: 2px; border: 1px solid transparent; border-radius: var(--r); }
.rv-note-row:hover { background: var(--raised); }
.rv-note-row.is-selected { border-color: var(--seam); background: var(--row-hot); }
.rv-note-open { flex: 1; min-width: 0; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 0 9px; padding: 5px 4px 5px 5px; border: 0; background: none; text-align: left; cursor: pointer; }
.rv-note-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 2px; background: var(--raised); color: var(--ink-2); }
.rv-note-row.is-selected .rv-note-ico { background: var(--sel-tint); color: var(--sel); }
.rv-note-ico .ico { width: 16px; height: 16px; }
.rv-note-text { font-size: 12.5px; line-height: 1.35; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rv-note-t { align-self: start; padding-top: 2px; font-size: 11px; color: var(--muted); }
.rv-row-actions { display: flex; gap: 2px; padding-right: 4px; opacity: 0; transition: opacity .15s; }
.rv-note-row:hover .rv-row-actions, .rv-note-row:focus-within .rv-row-actions, .rv-note-row.is-selected .rv-row-actions { opacity: 1; }
.rv-row-actions .btn.icon { border-color: transparent; background: none; }
.rv-row-actions .btn.icon:hover { border-color: #3a3f47; background: var(--panel); }
.rv-row-actions .btn.danger { border-style: solid; }
.rv-note-row.is-editing { display: block; padding: 6px 4px; }
.rv-note-row.is-editing textarea { display: block; width: 100%; min-height: 64px; padding: 6px 8px; resize: vertical; font: 13px/1.45 var(--sans); }
.rv-note-row.is-editing .rv-row-actions { opacity: 1; justify-content: flex-end; padding: 6px 0 0; }

/* To-do list: the player's coaching plan. */
.rv-todo-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 6px; padding: 12px 12px 6px; }
.rv-todo-add .field { height: 30px; min-width: 0; }
.rv-todo-link { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.rv-todo { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 7px 4px 7px 6px; border-bottom: 1px solid var(--row); }
.rv-check { display: grid; place-items: center; height: 20px; cursor: pointer; }
.rv-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--sel); cursor: pointer; }
.rv-check input:disabled { cursor: default; }
.rv-todo-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 1px; }
.rv-todo-text { font-size: 13px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.rv-todo.is-done .rv-todo-text { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--heat-2); }
.rv-todo-moment { align-self: flex-start; padding: 0; border: 0; background: none; font-size: 12px; color: var(--sel); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.rv-todo .btn.icon { border-color: transparent; background: none; opacity: 0; transition: opacity .15s; }
.rv-todo:hover .btn.icon, .rv-todo:focus-within .btn.icon { opacity: 1; }
.rv-todo-sep { padding: 12px 6px 4px; font-size: 12px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); }
.rv-todo-sep .num { margin-left: 4px; font-weight: 400; font-variant: normal; }
.rp-plan .rv-todo-add { padding: 0 0 8px; max-width: 560px; }
.rp-plan .rv-todos { padding: 0; max-height: none; max-width: 760px; }
@media (pointer: coarse) {
  .rv-row-actions, .rv-todo .btn.icon { opacity: 1; }
  .rv-tool { width: 44px; height: 44px; }
}

/* ---------- Full screen: the match look, a broadcast overlay, and controls that step aside ---------- */
.rv-theatre { display: flex; flex-direction: column; min-width: 0; }
.rv-hud { display: none; }
.rv-theatre.is-full { width: 100%; height: 100%; background: #0b0d10; }
.rv-theatre.is-full #rv-board { display: none !important; }
.rv-theatre.is-full .rv-stage { flex: 1; height: auto; border: 0; }
.rv-theatre.is-full .rv-dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; background: rgba(13, 14, 16, .94); border-top: 1px solid var(--seam); transition: opacity .25s cubic-bezier(.16, 1, .3, 1), transform .25s cubic-bezier(.16, 1, .3, 1); }
.rv-theatre.is-full .rv-dock .rv-timeline { background: transparent; }
.rv-theatre.is-full .rv-dock .rv-controls { border-bottom: 0; }
.rv-theatre.is-full.is-idle .rv-dock { opacity: 0; transform: translateY(14px); pointer-events: none; }
.rv-theatre.is-full.is-idle { cursor: none; }
.rv-theatre.is-full.is-idle .rv-canvas { cursor: none; }
.rv-theatre.is-full .rv-stage > .vs-cards { display: none; }
.rv-theatre.is-full .rv-tools { top: auto; bottom: 150px; transform: none; }
.rv-theatre.is-full .rv-heat { bottom: 150px; }
.rv-theatre.is-full .rv-goal { bottom: 150px; }
.rv-theatre.is-full .rv-goal-score { font-size: 64px; }
.rv-theatre.is-full .rv-hud { display: block; position: absolute; inset: 0; z-index: 2; pointer-events: none; }

/* Score bug: the two scores either side of the clock plate, on one graphite strip. */
.rv-hud-bug { position: absolute; left: 50%; top: 16px; display: grid; grid-template-columns: auto auto auto auto auto; align-items: stretch; border: 1px solid var(--seam); border-radius: var(--r); background: rgba(13, 14, 16, .9); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); transform: translateX(-50%); overflow: hidden; animation: rv-hud-drop .5s cubic-bezier(.16, 1, .3, 1); }
.rv-hud-team { display: flex; align-items: center; padding: 0 16px; font-size: 13px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .1em; color: var(--team); }
.rv-hud-score { display: grid; place-items: center; min-width: 64px; padding: 0 14px; font-size: 34px; font-weight: 600; line-height: 52px; color: var(--ink); background: color-mix(in srgb, var(--team) 14%, transparent); box-shadow: inset 0 2px 0 var(--team); }
.rv-hud-score.flash { animation: vs-goal 1.2s cubic-bezier(.16, 1, .3, 1); }
.rv-hud-clock { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 104px; padding: 0 14px; border-left: 1px solid var(--seam); border-right: 1px solid var(--seam); }
.rv-hud-clock b { font-size: 22px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.rv-hud-clock small { font-size: 11px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .1em; color: var(--muted); }

/* Player cards down each side; chips for their plays open towards the middle. */
.rv-hud-side { position: absolute; top: 92px; display: flex; flex-direction: column; gap: 6px; }
.rv-hud-side[data-side="0"] { left: 16px; }
.rv-hud-side[data-side="1"] { right: 16px; align-items: flex-end; }
.rv-hud-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "boost n" "stats stats"; align-items: center; gap: 4px 8px; width: 212px; padding: 8px 10px 8px 12px; border: 1px solid var(--seam); border-radius: var(--r); background: rgba(13, 14, 16, .88); box-shadow: inset 0 2px 0 var(--team), 0 8px 24px rgba(0, 0, 0, .45); animation: rv-hud-in-left .45s cubic-bezier(.16, 1, .3, 1) both; transition: opacity .3s; }
.rv-hud-side[data-side="1"] .rv-hud-card { animation-name: rv-hud-in-right; }
.rv-hud-side .rv-hud-card:nth-child(2) { animation-delay: 60ms; }
.rv-hud-side .rv-hud-card:nth-child(3) { animation-delay: 120ms; }
.rv-hud-side .rv-hud-card:nth-child(4) { animation-delay: 180ms; }
.rv-hud-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.rv-hud-card.is-student .rv-hud-name { color: var(--sel); }
.rv-hud-boost { grid-area: boost; height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.rv-hud-boost i { display: block; height: 100%; width: 0; background: var(--ink-2); }
.rv-hud-card.low .rv-hud-boost i { background: var(--dn); }
.rv-hud-boost-n { grid-area: n; min-width: 3ch; text-align: right; font-size: 12px; color: var(--ink-2); }
.rv-hud-card.low .rv-hud-boost-n { color: var(--dn); }
.rv-hud-stats { grid-area: stats; font-size: 11.5px; color: var(--muted); }
.rv-hud-card.is-gone { opacity: .45; }
.rv-hud-chips { position: absolute; top: 6px; display: flex; flex-direction: column; gap: 4px; }
.rv-hud-side[data-side="0"] .rv-hud-chips { left: calc(100% + 8px); }
.rv-hud-side[data-side="1"] .rv-hud-chips { right: calc(100% + 8px); align-items: flex-end; }
.rv-hud-chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px 0 3px; border: 1px solid var(--seam); border-radius: var(--r); background: rgba(13, 14, 16, .92); box-shadow: 0 6px 18px rgba(0, 0, 0, .45); white-space: nowrap; font-size: 12.5px; color: var(--ink); animation: rv-chip-in-left .36s cubic-bezier(.16, 1, .3, 1) both; transition: opacity .22s, transform .22s; }
.rv-hud-side[data-side="1"] .rv-hud-chip { flex-direction: row-reverse; padding: 0 3px 0 10px; animation-name: rv-chip-in-right; }
.rv-hud-chip.still { animation: none; }
.rv-hud-chip.out { opacity: 0; transform: scale(.96); }
.rv-hud-chip b { font-weight: 600; }
.rv-hud-chip .num { font-size: 11.5px; color: var(--muted); }
.rv-hud-chip-ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 2px; background: color-mix(in srgb, var(--team) 18%, transparent); color: var(--team); }
.rv-hud-chip-ico .ico { width: 14px; height: 14px; }
.rv-hud-chip.goal { border-color: color-mix(in srgb, var(--team) 55%, var(--seam)); }
.rv-hud-chip.goal .rv-hud-chip-ico { background: var(--team); color: var(--bg); }
.rv-hud-chip.demoed { color: var(--muted); }
.rv-hud-chip.demoed .rv-hud-chip-ico { background: var(--raised); color: var(--muted); }
@keyframes rv-hud-drop { from { opacity: 0; transform: translate(-50%, -12px); } }
@keyframes rv-hud-in-left { from { opacity: 0; transform: translateX(-18px); } }
@keyframes rv-hud-in-right { from { opacity: 0; transform: translateX(18px); } }
@keyframes rv-chip-in-left { from { opacity: 0; transform: translateX(-12px); clip-path: inset(0 100% 0 0 round 4px); } to { clip-path: inset(0 0 0 0 round 4px); } }
@keyframes rv-chip-in-right { from { opacity: 0; transform: translateX(12px); clip-path: inset(0 0 0 100% round 4px); } to { clip-path: inset(0 0 0 0 round 4px); } }
@media (max-width: 720px) {
  .rv-hud-card { width: 150px; padding: 6px 8px; }
  .rv-hud-stats { display: none; }
  .rv-hud-score { min-width: 44px; font-size: 24px; line-height: 40px; }
  .rv-hud-team { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rv-hud-bug, .rv-hud-card, .rv-hud-chip { animation: none; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 45; max-width: min(420px, calc(100vw - 32px)); background: #0d0e10; border: 1px solid var(--seam); border-radius: var(--r); padding: 10px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.toast.err { border-color: #6b3540; color: #f3b8c3; }

/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
  /* The last-import stamp repeats the status line; it gives way so the bar's controls never overflow. */
  .stamp { display: none; }
  /* Eight tabs and the switches share the bar: tabs tighten and Refresh keeps only its icon (R still works). */
  .bar { gap: 16px; }
  .tabs a { padding: 0 10px; }
  #refresh span { display: none; }
  #refresh { padding: 0 8px; }
}
/* Below this the tabs and the switches no longer share one row: the tabs move to their own row, as on phones. */
@media (max-width: 1420px) {
  .bar { height: auto; flex-wrap: wrap; gap: 0 16px; padding: 0 12px; }
  .brand { height: 44px; }
  .bar-end { margin-left: auto; min-height: 44px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--seam); }
  .tabs a { height: 42px; flex: 1; justify-content: center; padding: 0 8px; }
}
@media (max-width: 1100px) {
  .overview, .settings, .versus, .live, .replay { grid-template-columns: minmax(0, 1fr); }
  .rv-stage { height: clamp(300px, 58vw, 640px); }
  .rv-moments, .rv-notes, .rv-todos { max-height: none; }
  .rv-cam { margin-left: 0; }
  .multiples { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .bar { height: auto; flex-wrap: wrap; gap: 0 16px; padding: 0 12px; }
  .brand { height: 44px; }
  .bar-end { margin-left: auto; }
  .stamp { display: none; }
  .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--seam); }
  .tabs a { height: 42px; flex: 1; justify-content: center; padding: 0 8px; }
  .bar-end .btn span { display: none; }
  .bar-end .btn { padding: 0 9px; }
  .players { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .statusline .keys { display: none; }
  .lv-bar { width: 36px; }
  #live-sub { display: none; }
  .players aside .plist { max-height: 40vh; }
  .dhead { flex-direction: column; }
  .dhead .danger-zone { padding: 12px 0 0; margin: 0; border-left: 0; border-top: 1px solid var(--seam); width: 100%; }
  .heat col.cp { width: 96px; }
  .race-legend.many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proj-controls { width: 100%; }
  .heat .old { display: none; }
}
@media (max-width: 720px) {
  .imp-grid { grid-template-columns: minmax(0, 1fr); }
  .team-filter select { max-width: 130px; }
}
@media (max-width: 520px) {
  .dialog.share-modal .dialog-foot { flex-wrap: wrap; }
  .dialog.share-modal .dialog-foot .status { flex-basis: 100%; }
  .bar-end { width: 100%; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 0 0 8px; }
  /* Refresh moves up beside the brand so the period and playlist switches share one row. */
  .bar-end #refresh { position: absolute; top: 4px; right: 12px; }
  .bar-end .seg button { padding: 4px 7px; }
  .pb { padding: 14px 12px; }
  .tbl .opt { display: none; }
  .kpis { gap: 8px 10px; }
  .kpis em { font-size: 18px; }
  .kpis span { font-size: 11.5px; line-height: 1.3; }
  .pace input[type=range] { width: 100%; }
  .proj-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pace output { min-width: 0; }
  .vs-board { gap: 6px; padding: 10px 12px; }
  .vs-goals { min-width: 48px; height: 48px; font-size: 28px; padding: 0 8px; }
  .vs-roster-names { display: none; }
  .vs-clock { min-width: 72px; padding: 0 6px; }
  .vs-clock .num { font-size: 20px; }
  .vs-controls { padding: 10px 12px; }
  .vs-controls #vs-skip { margin-left: 0; }
  .vs-result-head { grid-template-columns: minmax(0, 1fr); }
  .vs-result-actions { grid-column: 1; grid-row: auto; padding-top: 8px; }
  .vs-ev { grid-template-columns: 44px 9px minmax(0, 1fr) auto; padding: 3px 12px; }
  .vs-chatlog { position: static; width: auto; max-height: none; margin: 0; border-width: 1px 0 0; border-radius: 0; background: var(--bg); }
  .vs-cards { top: 8px; width: 46%; }
  .vs-cards[data-side="0"] { left: 8px; }
  .vs-cards[data-side="1"] { right: 8px; }
  .vs-cards[data-side="mid"] { top: auto; bottom: 8px; width: 70%; }
  .vs-card { grid-template-columns: 22px minmax(0, 1fr); padding: 4px 8px 4px 4px; }
  .vs-card-ico { width: 22px; height: 22px; }
  .vs-card-t { display: none; }
  .rv-keys { display: none; }
  .rv-goal { bottom: 10px; padding: 8px 16px 10px; }
  .rv-goal-score { font-size: 38px; }
  .rv-goal-line { font-size: 12px; }
  .rv-heat { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .rv-tools { right: 6px; }
  .rv-composer { width: calc(100% - 24px); }
  .rv-label { font-size: 10.5px; }
  .rv-controls { padding: 10px 12px; }
  .rp-q { grid-template-columns: minmax(0, 1fr); }
  .rp-q-state { text-align: left; }
}
@media (pointer: coarse) {
  .tabs a, .btn, .seg button, .field { min-height: 44px; }
  .checks label { min-height: 44px; }
  .bars .l, .bars .r { height: 28px; }
}

/* ---------- Tour ---------- */
/* A spotlight walks the page: the hole's 1px Selection Blue ring says "this one", the rest sits under the dialog backdrop. */
.tour { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.tour.is-opening .tour-spot { animation: tour-dim .32s ease-out; }
.tour.is-opening .tour-card { animation: tour-card-in .36s cubic-bezier(.16, 1, .3, 1); }
.tour.is-closing .tour-spot { transition: opacity .26s ease-in; opacity: 0; }
.tour-veil { position: fixed; inset: 0; pointer-events: auto; }
.tour.is-closing .tour-veil { pointer-events: none; }
.tour-spot { position: fixed; left: 0; top: 0; border-radius: var(--r); box-shadow: 0 0 0 max(200vw, 200vh) rgba(8, 9, 11, .66); outline: 1px solid var(--sel); outline-offset: 0; }
.tour-spot.is-empty { outline-color: transparent; }
.tour-spot.is-gliding { transition: transform .46s cubic-bezier(.16, 1, .3, 1), width .46s cubic-bezier(.16, 1, .3, 1), height .46s cubic-bezier(.16, 1, .3, 1); }
.tour-spot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; outline: 1px solid var(--sel); opacity: 0; }
.tour-spot.is-arriving:not(.is-empty)::after { animation: tour-ping .9s .34s cubic-bezier(.16, 1, .3, 1); }
@keyframes tour-ping { from { opacity: .9; outline-offset: 0; } to { opacity: 0; outline-offset: 12px; } }
@keyframes tour-dim { from { box-shadow: 0 0 0 max(200vw, 200vh) rgba(8, 9, 11, 0); } }
@keyframes tour-card-in { from { opacity: 0; scale: .97; } }

.tour-card, .tour-welcome { position: fixed; left: 0; top: 0; width: 340px; max-width: calc(100vw - 16px); background: var(--panel); border: 1px solid var(--seam); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); color: var(--ink); pointer-events: auto; outline: none; }
.tour-card.is-wide { width: 400px; }
.tour-card.is-gliding { transition: transform .46s cubic-bezier(.16, 1, .3, 1); }
.tour-card[aria-busy="true"] .tour-body { opacity: .55; transition: opacity .2s .15s; }
.tour-head { height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--seam); font-size: 13px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--ink-2); }
.tour-head-end { display: flex; align-items: center; gap: 10px; }
.tour-lang { font-variant: normal; letter-spacing: 0; }
.tour-lang button { padding: 2px 7px; font-size: 11px; }
.tour-meta { padding-right: 6px; font: 12px var(--mono); font-variant: normal; letter-spacing: 0; color: var(--dim); }
.tour-meta > .num:first-child { color: var(--ink-2); }
.tour-body { padding: 12px 14px 4px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); max-height: min(52vh, 420px); overflow-y: auto; scrollbar-width: thin; }
.tour-body p { margin: 0 0 10px; }
.tour-body b { color: var(--ink); font-weight: 600; }
.tour-body .idle { color: var(--idle); }
.tour-body.is-in { animation: tour-swap .3s cubic-bezier(.16, 1, .3, 1); }
@keyframes tour-swap { from { opacity: 0; transform: translateX(var(--from, 8px)); } }
.tour kbd, .tour-note kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--seam); border-radius: 3px; color: var(--ink-2); background: var(--bg); }
.tour-dl { display: grid; grid-template-columns: minmax(0, 132px) minmax(0, 1fr); gap: 8px 14px; margin: 2px 0 12px; font-size: 12.5px; }
.tour-dl dt { color: var(--ink); }
.tour-dl dd { margin: 0; color: var(--muted); }
.tour-dl .num { color: var(--ink-2); }
.tour-dl .ok i, .tour-dl .ro i, .tour-lv i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--up); }
.tour-dl .ro i { background: var(--idle); }
.tour-foot { border-top: 1px solid var(--seam); margin-top: 6px; }
.tour-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; padding: 4px 14px 0; }
.tour-rail button { height: 14px; padding: 0; border: 0; background: none; cursor: pointer; display: flex; align-items: center; }
.tour-rail i { display: block; width: 100%; height: 2px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.tour-rail b { display: block; height: 100%; background: var(--heat-3); transform: scaleX(0); transform-origin: left; transition: transform .46s cubic-bezier(.16, 1, .3, 1); }
.tour-rail [aria-current] b { background: var(--sel); }
.tour-rail button:hover i { background: var(--heat-1); }
.tour-actions { display: flex; align-items: center; gap: 8px; padding: 6px 14px 12px; }
.tour-skip { margin-right: auto; padding: 4px 0; border: 0; background: none; font-size: 12.5px; color: var(--muted); cursor: pointer; text-decoration: underline; text-decoration-color: var(--seam); text-underline-offset: 3px; }
.tour-skip:hover { color: var(--ink); text-decoration-color: currentColor; }

/* Versus briefing: the card takes the score bug's language, a two-ink top line and a clock counting down to kick-off. */
.tour-card.is-game { border-top-color: transparent; }
.tour-card.is-game::before { content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 2px; border-radius: var(--r) var(--r) 0 0; background: linear-gradient(90deg, var(--team-blue) 50%, var(--team-orange) 50%); }
.tour-card.is-whistle::before { animation: tour-wipe .6s cubic-bezier(.16, 1, .3, 1); }
.tour-card.is-whistle { animation: tour-whistle .5s cubic-bezier(.16, 1, .3, 1); }
@keyframes tour-wipe { from { transform: scaleX(0); } }
@keyframes tour-whistle { 30% { scale: 1.025; } }
.tour-clock { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 9px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--bg); }
.tour-clock b { font: 600 15px var(--mono); color: var(--ink); min-width: 4ch; text-align: right; }
.tour-clock i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-2); animation: pulse 1.4s ease-in-out infinite; }
.tour-clock[data-phase="kickoff"] i { background: var(--up); }
.tour-card.is-game .tour-rail [aria-current] b { background: linear-gradient(90deg, var(--team-blue) 50%, var(--team-orange) 50%); }
.tour { --team-blue: #7dcfff; --team-orange: #ff9e64; }

/* Kick-off: 3, 2, 1 over the pitch, then the real match starts underneath. */
.tour-kick { position: fixed; z-index: 58; display: grid; place-items: center; pointer-events: none; background: rgba(13, 14, 16, .8); }
.tour-kick b { font: 600 96px/1 var(--mono); color: var(--ink); animation: tour-count .62s cubic-bezier(.16, 1, .3, 1); }
.tour-kick b.go { font: 600 34px/1.2 var(--sans); letter-spacing: -.01em; animation: tour-go .7s cubic-bezier(.16, 1, .3, 1); }
.tour-kick.is-leaving { transition: opacity .34s ease-out; opacity: 0; }
@keyframes tour-count { from { opacity: 0; transform: scale(1.5); } 70% { opacity: 1; } }
@keyframes tour-go { from { opacity: 0; letter-spacing: .3em; } }

/* First visit: a quiet corner card that never blocks the page. */
.tour-welcome { z-index: 46; left: auto; top: auto; right: 16px; bottom: 49px; width: 320px; animation: tour-rise .42s cubic-bezier(.16, 1, .3, 1); }
.tour-welcome .tour-head { padding-right: 6px; }
.tour-est { font-size: 12.5px; color: var(--muted); }
.tour-est .num { color: var(--ink-2); }
.tour-welcome .tour-actions { padding-top: 4px; }
@keyframes tour-rise { from { opacity: 0; transform: translateY(12px); } }

/* The ? button: where the tour lives once it's skipped. */
#tour-btn.is-beacon { position: relative; border-color: var(--sel); color: var(--sel); }
#tour-btn.is-beacon::after { content: ""; position: absolute; inset: -1px; border-radius: var(--r); outline: 1px solid var(--sel); opacity: 0; animation: tour-beacon 1.1s cubic-bezier(.16, 1, .3, 1) 2; pointer-events: none; }
@keyframes tour-beacon { from { outline-offset: 0; opacity: 1; } to { outline-offset: 9px; opacity: 0; } }
.tour-note { position: fixed; z-index: 46; max-width: 260px; padding: 8px 10px; background: #0d0e10; border: 1px solid var(--seam); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); font-size: 12.5px; color: var(--ink-2); animation: tour-rise .36s cubic-bezier(.16, 1, .3, 1); }
.tour-note::before { content: ""; position: absolute; top: -5px; left: calc(var(--tip, 50%) - 4px); width: 8px; height: 8px; background: #0d0e10; border-left: 1px solid var(--seam); border-top: 1px solid var(--seam); transform: rotate(45deg); }
.tour-note.is-leaving { transition: opacity .2s ease-in; opacity: 0; }
.tour-on .tooltip { z-index: 70; }

@media (max-width: 640px) {
  .ttl-head { flex-wrap: wrap; }
  .ttl-filter { width: 100%; }
  .ttl-scroll { max-height: 360px; }
  .tour-card, .tour-card.is-wide { width: calc(100vw - 16px); }
  .tour-body { max-height: 34vh; }
  .tour-welcome { left: 8px; right: 8px; bottom: 41px; width: auto; }
}
@media (max-width: 520px) {
  .bar-end #tour-btn { position: absolute; top: 4px; right: 12px; }
  .bar-end #refresh { right: 48px; }
}
@media (pointer: coarse) {
  #tour-btn { min-width: 44px; justify-content: center; }
  .tour-rail button { height: 24px; }
  .tour-lang button { min-height: 30px; padding: 2px 10px; }
}
@media (max-width: 520px) and (pointer: coarse) {
  .bar-end #refresh { right: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Search: any player's ranks and titles right now ---------- */
.sr-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--seam); }
.sr-plat button { padding: 0 12px; height: 32px; font: 13px var(--sans); color: var(--ink-2); }
.sr-ask { display: flex; gap: 8px; flex: 0 1 540px; min-width: 0; }
.sr-field { height: 34px; font-size: 14px; }
.sr-go { height: 34px; }
.sr-limit { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sr-limit .num { color: var(--ink-2); }
.sr-wait { position: relative; width: 56px; height: 2px; background: var(--seam); }
.sr-wait i { position: absolute; inset: 0 auto 0 0; background: var(--heat-3); transition: width 1s linear; }
.sr-recent { display: flex; align-items: center; gap: 6px; margin-left: auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.sr-recent-l { font-size: 12px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); margin-right: 2px; }
.sr-chip { display: inline-flex; align-items: center; height: 26px; border: 1px solid var(--seam); border-radius: var(--r); background: var(--bg); }
.sr-chip:hover { border-color: #3a3f47; }
.sr-chip button { display: inline-flex; align-items: center; gap: 5px; height: 100%; border: 0; background: none; cursor: pointer; color: var(--ink-2); font-size: 12.5px; }
.sr-chip button:first-child { padding: 0 4px 0 9px; max-width: 170px; }
.sr-chip button small { font-size: 11px; color: var(--dim); }
.sr-chip button:first-child:hover { color: var(--ink); }
.sr-chip .sr-chip-x { padding: 0 6px 0 3px; color: var(--dim); }
.sr-chip .sr-chip-x:hover { color: var(--ink); }
.sr-chip-x .ico { width: 11px; height: 11px; }

.search { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto minmax(0, 1fr); }
.sr-who { grid-column: 1; grid-row: 1; }
.sr-cmp { grid-column: 1; grid-row: 2; }
.sr-who:has(~ .sr-cmp[hidden]) { grid-row: 1 / span 2; }
.sr-titles { grid-column: 2; grid-row: 1 / span 2; }
/* The cabinet stays in view while the left column scrolls past it. */
.sr-cab { position: sticky; top: var(--bar-h, 48px); display: flex; flex-direction: column; max-height: calc(100vh - var(--bar-h, 48px) - 33px); min-height: min(640px, calc(100vh - var(--bar-h, 48px) - 33px)); }
.sr-cab .ph-end { gap: 12px; }
.sr-cab .ttl-filter { font: 400 13px var(--sans); font-variant: normal; letter-spacing: 0; }
.sr-cab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sr-list { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sr-facets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px 10px; }
.sr-facets .ttl-groups { margin: 0; }
.sr-sets { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.sr-sets button { display: inline-flex; flex: none; align-items: baseline; gap: 6px; max-width: 200px; font: 12.5px var(--sans); white-space: nowrap; }
.sr-sets button .num { font-size: 11.5px; color: var(--dim); }
.sr-sets button[aria-checked="true"] .num { color: var(--sel); }
.sr-scroll { flex: 1; max-height: none; min-height: 220px; margin: 0; padding: 0 16px 8px; }
.sr-scroll .ttl-grid { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.sr-scroll .ttl { height: 32px; font-size: 13.5px; }
.sr-scroll .ttl-rank { width: 20px; height: 20px; vertical-align: -5px; }
.sr-pad { margin: 0; padding: 14px 16px; }

/* The medal shelf: the ranks a player has earned, counted like a trophy case. */
.sr-shelf { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--seam); }
.sr-shelf-g { padding: 14px 20px 14px 16px; }
.sr-shelf-g + .sr-shelf-g { border-left: 1px solid var(--seam); padding-left: 20px; }
.sr-shelf-l { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); }
.sr-medals { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0 -6px; }
.sr-medal { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 6px 6px 4px; border-radius: var(--r); cursor: default; transition: background .15s; }
.sr-medal:hover, .sr-medal.is-hot { background: var(--sel-tint); }
.sr-medal:focus-visible { outline-offset: 0; }
.sr-medal img { width: 44px; height: 44px; object-fit: contain; }
.sr-medal b { margin-top: 4px; font-size: 22px; font-weight: 600; line-height: 1.15; color: var(--ink); }
.sr-medal.is-hot b { color: var(--sel); }
.sr-medal small { margin-top: 1px; font-size: 12px; white-space: nowrap; }
.sr-shelf-skel { gap: 18px; padding: 0 0 16px; border: 0; }
.sr-shelf-skel i { width: 44px; height: 44px; border-radius: 50%; background: var(--raised); animation: pulse 1.4s ease-in-out infinite; }

/* Player */
.sr-id { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border-bottom: 1px solid var(--seam); }
.sr-id-text { min-width: 0; }
.sr-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.sr-id p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.sr-id p .pchip { margin: 0; }
.sr-club { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.sr-club b { font-weight: 600; color: var(--ink); }
.sr-swatch { display: inline-flex; gap: 2px; }
.sr-swatch i { width: 8px; height: 8px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.sr-id p.sr-season { margin-top: 2px; }
.sr-ranks td { height: 42px; }
.sr-ranks td.num { font-size: 13.5px; }
.sr-rk .rank img { width: 24px; height: 24px; }
.sr-rkw { display: inline-flex; align-items: center; white-space: nowrap; }
.sr-div { margin-left: 8px; font-size: 12.5px; color: var(--muted); }
.sr-ranks tr.unplaced td { color: var(--muted); }
.sr-skel { padding-top: 4px; }
.sr-msg .sr-lead, .sr-empty .sr-lead { margin: 0 0 6px; font-size: 15px; color: var(--ink); max-width: 52ch; }
.sr-msg .btn { margin-top: 4px; }
.sr-empty { max-width: 620px; }
.sr-how { margin: 16px 0 0; border-top: 1px solid var(--row); }
.sr-how div { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; min-height: 34px; border-bottom: 1px solid var(--row); font-size: 13px; }
.sr-how dt { color: var(--ink-2); }
.sr-how dd { margin: 0; color: var(--muted); }
.sr-h3 { margin: 22px 0 4px; font-size: 12px; font-weight: 600; font-variant: all-small-caps; letter-spacing: .08em; color: var(--muted); }
.sr-recent-list { margin: 0; padding: 0; list-style: none; }
.sr-recent-list button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: calc(100% + 16px); height: 36px; padding: 0 8px; margin: 0 -8px; border: 0; border-bottom: 1px solid var(--row); background: none; color: var(--ink); text-align: left; cursor: pointer; }
.sr-recent-list button:hover { background: var(--raised); }
.sr-recent-list small { flex: none; font-size: 12px; color: var(--muted); }

/* Compare */
.sr-pick { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--seam); font-size: 12.5px; color: var(--muted); }
.sr-select { width: auto; min-width: 200px; max-width: 280px; height: 28px; }
.sr-cmp-t th .ellipsis, .sr-medal-t th .ellipsis { display: inline-block; max-width: 130px; vertical-align: bottom; }
.sr-side { color: var(--ink-2); }
.sr-side img { width: 18px; height: 18px; margin-right: 6px; vertical-align: -4px; object-fit: contain; }
.sr-side.ahead { color: var(--ink); font-weight: 600; }
.sr-side.behind { color: var(--muted); }
.sr-gap { color: var(--ink-2); }
.sr-shared { display: flex; gap: 1px; background: var(--seam); border-bottom: 1px solid var(--seam); }
.sr-count { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 10px 16px; border: 0; background: var(--panel); color: var(--muted); font-size: 12px; text-align: left; cursor: pointer; }
.sr-count b { font-size: 18px; font-weight: 600; color: var(--ink); }
.sr-count span { max-width: 100%; overflow-wrap: anywhere; line-height: 1.3; }
.sr-count:hover { background: var(--raised); }
.sr-count.on { background: var(--sel-tint); color: var(--sel); }
.sr-count.on b { color: var(--sel); }
.sr-medal-t tr.sr-sub th { height: 30px; padding-top: 6px; font-size: 11.5px; color: var(--dim); border-bottom: 1px solid var(--row); }
.sr-medal-t .rank img { width: 18px; height: 18px; }
.sr-more { color: var(--ink); font-weight: 600; }
.sr-zero { color: var(--heat-2); }

/* Shared selection: a medal or a queue pointed at lights up wherever it appears. */
#view-search tr[data-hl].is-hot td { background: var(--row-hot); }
#view-search tr[data-hl].is-hot td:first-child { color: var(--sel); }
.sr-scroll .ttl { transition: opacity .15s, background .15s; }
.sr-scroll.hl-on .ttl:not(.is-hot) { opacity: .32; }
.sr-scroll .ttl.is-hot { background: var(--row-hot); }

@media (max-width: 1420px) {
  :root { --bar-h: 87px; }
}
@media (max-width: 1100px) {
  .search { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .sr-who, .sr-cmp, .sr-titles, .sr-who:has(~ .sr-cmp[hidden]) { grid-column: 1; grid-row: auto; }
  .sr-cmp { order: 2; }
  .sr-titles { order: 3; }
  .sr-cab { position: static; max-height: none; min-height: 0; }
  .sr-scroll { max-height: 440px; }
  .sr-recent { margin-left: 0; justify-content: flex-start; width: 100%; }
}
@media (max-width: 860px) {
  .sr-strip { padding: 10px 12px; }
  .sr-plat { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .sr-plat button { flex: 1; }
  .sr-ask { flex: 1 1 100%; }
  .sr-recent { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sr-id { padding: 12px; }
  .sr-cab .ph { height: auto; min-height: 38px; flex-wrap: wrap; padding: 8px 12px; }
  .sr-cab .ph-end { flex: 1 1 100%; }
  .sr-cab .ttl-filter { flex: 1; width: auto; }
}
@media (max-width: 520px) {
  .sr-ranks .opt { display: none; }
  .sr-ranks th, .sr-ranks td { padding: 0 8px; }
  .sr-ranks th:first-child, .sr-ranks td:first-child { padding-left: 12px; }
  .sr-ranks th:last-child, .sr-ranks td:last-child { padding-right: 12px; }
  .sr-div { margin-left: 6px; font-size: 11.5px; }
  .sr-shelf-g { width: 100%; }
  .sr-shelf-g + .sr-shelf-g { border-left: 0; border-top: 1px solid var(--seam); padding-left: 16px; }
  .sr-medals { gap: 4px 4px; }
  .sr-medal { min-width: 58px; }
  /* With the playlist and period switches gone, the controls row would only hold empty space. */
  .bar.no-switches .bar-end { min-height: 0; padding-bottom: 0; }
  .sr-scroll .ttl-grid { grid-template-columns: minmax(0, 1fr); }
  .sr-pick { flex-wrap: wrap; }
  .sr-select { flex: 1; min-width: 0; max-width: none; }
  .sr-go { padding: 0 10px; }
}
@media (pointer: coarse) {
  .sr-plat button, .sr-field, .sr-go { height: 44px; }
  .sr-chip { height: 36px; }
  .sr-chip .sr-chip-x { padding: 0 10px 0 6px; }
}
