/* Ladder pages, on top of the helper's shared tokens and components (style.css). */
body { padding-inline: 0; }
main { max-width: 1500px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left)) 48px; }
.brand { color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; padding: 5px 9px; border-radius: 6px; }
.nav a:hover { background: var(--chip-bg); }
form.inline { display: inline; margin: 0; }
.btn.small { font-size: 12px; padding: 2px 8px; }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.error { color: #c0392b; font-weight: 600; }
.notice { border-color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; min-width: 0; }
.panel.narrow { max-width: 440px; margin: 40px auto; }
.panel h2 { margin-top: 0; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; }
.form textarea { width: 100%; font: 12px/1.4 ui-monospace, Consolas, monospace; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-top: 10px; }
.row label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
label.check { flex-direction: row; align-items: center; gap: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; }
.copy-row { display: flex; gap: 6px; margin-top: 8px; }
.copy-row input { flex: 1; min-width: 0; font: 12px ui-monospace, Consolas, monospace; }

.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; font-size: 22px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 14px; align-items: start; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.data tr.group th { text-align: center; border-bottom: 2px solid var(--line); text-transform: uppercase; letter-spacing: .05em; font-size: 10.5px; }
table.data td.num, table.data th.num { text-align: right; }
table.data td input { width: 100%; min-width: 120px; }
table.sortable thead tr:last-child th { cursor: pointer; user-select: none; }
table.sortable th[data-dir="desc"]::after { content: " ▾"; }
table.sortable th[data-dir="asc"]::after { content: " ▴"; }
tr.link-row { cursor: pointer; }
tr.link-row:hover td { background: var(--chip-bg); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; background: var(--muted); }
.results { display: flex; flex-wrap: wrap; gap: 4px 14px; white-space: normal !important; }
.result.place-1 { font-weight: 700; }
.result.me { text-decoration: underline; text-underline-offset: 3px; }

/* Correlation cells: diverging fill, text stays in ink */
.corr-cell { background: color-mix(in srgb, var(--s1) calc(max(var(--r), 0) * 70%), color-mix(in srgb, var(--s2) calc(max(calc(var(--r) * -1), 0) * 70%), transparent)); }

/* Game page */
.kingdom { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.kingdom #kingdom { display: contents; }
.warnings-box { margin-top: 8px; font-size: 12px; }
.inline-menu { position: relative; }
.inline-menu > summary { list-style: none; }
.inline-menu .menu { position: absolute; right: 0; top: 110%; z-index: 4; width: max-content; max-width: 90vw; box-shadow: 0 6px 20px #0003; }
.turn-explorer .explorer-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.turn-explorer h2 { margin: 0; font-size: 18px; min-width: 9em; }
#turn-slider { flex: 1; min-width: 160px; accent-color: var(--accent); padding: 0; }
.turn-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.tp { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.tp-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.tp-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; margin-bottom: 6px; }
.tp-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0; }
.tp-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); width: 64px; flex: none; }
.tp-foot { font-size: 12px; margin-top: 4px; }
.turn-log { margin-top: 10px; }
.turn-log > summary { cursor: pointer; }
.turn-log .gamelog { max-height: 260px; }
.viz-marker { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
#charts { margin-bottom: 14px; }

.upload-results { margin: 0; padding-left: 18px; }
.upload-results li { margin: 4px 0; }
.status-added b { color: var(--accent); }
.status-duplicate b { color: var(--muted); }
.status-error b { color: #c0392b; }
/* A lone chart shouldn't stretch its SVG text across a wide screen. */
.viz-grid-cards > .viz-card:only-child { max-width: 820px; }
.row-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; align-items: center; }
.purge > summary { list-style: none; }
.status-restored b { color: var(--accent); }

/* Player page */
.tile-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.tile-sections .panel { margin-bottom: 0; }
.tile-sections { margin-bottom: 14px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.stat { background: var(--chip-bg); border-radius: 8px; padding: 7px 9px; }
.stat .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 11.5px; color: var(--muted); }
.form-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.form-chip { display: inline-flex; align-items: baseline; justify-content: center; min-width: 40px; padding: 5px 7px; border-radius: 8px;
  text-decoration: none; font-weight: 700; color: var(--ink); background: var(--chip-bg); border: 1px solid var(--line); }
.form-chip small { font-weight: 400; color: var(--muted); }
.form-chip.place-1 { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bars { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.bar-row { display: grid; grid-template-columns: 38px 1fr 32px; gap: 8px; align-items: center; font-size: 13px; }
.bar-track { height: 12px; background: var(--bar-bg); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }

/* Ladder tabs and spreadsheet-style shading */
:root { --heat-good: #1f9d3a; --heat-bad: #e34948; --heat-mid: #f0efec; --s7: #6250d6; --s8: #e34948; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --heat-good: #2fb24c; --heat-bad: #e66767; --heat-mid: #383835; --s7: #9085e9; --s8: #e66767; } }
:root[data-theme="dark"] { --heat-good: #2fb24c; --heat-bad: #e66767; --heat-mid: #383835; --s7: #9085e9; --s8: #e66767; }
.ladder-tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.ladder-tabs .tab { font: inherit; cursor: pointer; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); }
.ladder-tabs .tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.tab-key { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; }
.key-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.key-swatch.better { background: color-mix(in srgb, var(--heat-good) 60%, var(--heat-mid)); }
.key-swatch.worse { background: color-mix(in srgb, var(--heat-bad) 60%, var(--heat-mid)); margin-left: 8px; }
table.heat td.heat-cell { background: color-mix(in srgb, var(--heat) var(--amt), var(--heat-mid)); }
table.heat td { border-bottom: 2px solid var(--panel); }
table.heat td.databar { background: linear-gradient(90deg, color-mix(in srgb, var(--heat-good) 45%, transparent) var(--w), transparent var(--w)) no-repeat; font-weight: 700; }
table.heat td.player-cell { border-left: 5px solid var(--pc, var(--muted)); font-weight: 600; }
table.heat td.player-cell a { color: var(--ink); text-decoration: none; }
table.heat td.player-cell a:hover { text-decoration: underline; }

/* Header text may wrap onto two lines so wide tables can shrink */
table.data thead th { white-space: normal; line-height: 1.2; vertical-align: bottom; min-width: 5.6em; max-width: 9em; }
table.data thead th:first-child { min-width: 0; }
table.heat td.databar { background-image: linear-gradient(90deg, color-mix(in srgb, var(--s1) 45%, transparent) var(--w), transparent var(--w)); }

/* Player include/exclude + colours */
.player-filter > summary { cursor: pointer; }
.player-filter > summary .section-title { display: inline; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 10px; align-items: center; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 99px; background: var(--chip-bg); }
.filter-chip label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.filter-chip.off { opacity: .6; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.color-pop { position: absolute; z-index: 20; width: 230px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 24px #0004; }
.color-pop .swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.color-pop input[type="color"] { width: 40px; height: 26px; padding: 0; border: 0; background: none; }

/* Average deck donuts */
.donut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; }
.donut-name { font-weight: 600; margin-bottom: 4px; }

/* Over time + race */
.range-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.range-bar .section-title { margin: 0; }
.range-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.range-bar input[type="date"] { padding: 2px 6px; }
.over-time .viz-card { border: 0; padding: 0; }
.over-time .viz-head h3:empty { display: none; }
.over-time .viz-plot { max-width: 980px; }
#race-scrub { flex: 1; min-width: 140px; accent-color: var(--accent); padding: 0; }
.race-label { font-weight: 600; min-width: 10em; }
.race-bars { position: relative; transition: height .3s; }
.race-row { position: absolute; left: 0; right: 0; top: 0; height: 30px; display: grid; grid-template-columns: minmax(90px, 160px) 1fr 56px;
  gap: 8px; align-items: center; transition: transform .45s ease, opacity .3s; }
.race-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race-track { height: 22px; }
.race-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; transition: width .45s ease; min-width: 2px; }
.race-val { font-variant-numeric: tabular-nums; text-align: right; }
@media (prefers-reduced-motion: reduce) { .race-row, .race-fill { transition: none; } }
.over-time .viz-head { justify-content: flex-end; }
.over-time .viz-head h3:empty { display: none; }
.tab-note { display: none; }
.ladder-tabs:has(.tab[data-tab=decks][aria-selected=true]) .tab-note { display: inline; }

.game-notes { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.score-breakdown { margin-top: 8px; }
.score-breakdown > summary { cursor: pointer; }
.breakdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; margin-top: 6px; }
table.data.compact td { padding: 2px 6px; font-size: 12.5px; white-space: normal; }
fieldset.landmarks { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
fieldset.landmarks .checks { margin: 6px 0; }

.check-banner { margin-top: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid #d9a81e; background: color-mix(in srgb, #d9a81e 12%, var(--panel)); }
.check-banner ul { margin: 4px 0; padding-left: 18px; }
.check-inline { color: #9a5b00; }
.check-flag { font-size: 11px; color: #9a5b00; white-space: nowrap; }
.fixup { margin-top: 8px; }
.fixup > summary { cursor: pointer; }
.fixup-form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.score-inputs { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.score-inputs input { width: 5em; }
.merge-form { margin: 8px 0 12px; }
table.merged { margin-bottom: 14px; }
.status-skipped b { color: var(--muted); }

/* Time window: zoom presets, scrolling overview, smoothing */
.tw-bar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; }
.tw-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.tw-label { font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 14em; text-align: center; }
.tw-smooth { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; color: var(--muted); margin-left: auto; }
.tw-overview { width: 100%; height: 34px; display: block; cursor: grab; touch-action: none; background: var(--chip-bg); border-radius: 6px; margin-bottom: 8px; }
.tw-overview:active { cursor: grabbing; }
.tw-overview:focus-visible { outline: 2px solid var(--accent); }
.tw-tick { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .6; }
.tw-year { font-size: 10px; fill: var(--muted); }
.tw-window { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.tw-wrap { position: relative; margin-bottom: 8px; }
.tw-wrap .tw-overview { margin-bottom: 0; }
.tw-years { position: absolute; inset: 2px 0 auto 0; height: 14px; pointer-events: none; }
.tw-years span { position: absolute; font-size: 10px; color: var(--muted); padding-left: 3px; }

.set-filter > summary { cursor: pointer; }
.set-filter > summary .section-title { display: inline; }
.set-active { font-weight: 600; color: var(--accent); }
.set-form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.game-sets { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.set-tag { background: var(--chip-bg); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.sets-cell { white-space: normal !important; min-width: 10em; }

/* ---- Sidebar navigation ---------------------------------------------------------------------- */
:root { --side-w: 212px; --side-w-collapsed: 60px; }
body.with-sidebar main { margin-left: var(--side-w); max-width: none; transition: margin-left .2s; }
.nav-collapsed body.with-sidebar main { margin-left: 0; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); padding: max(10px, env(safe-area-inset-top)) 8px 10px;
  transition: width .2s, transform .2s; overflow: hidden; }
/* Hidden on a wide screen: the slim top bar's menu button slides the sidebar out over the page,
   exactly as on a phone; the pin docks it again. */
.nav-collapsed .sidebar { transform: translateX(-102%); width: min(260px, 82vw); box-shadow: none; visibility: hidden;
  transition: width .2s, transform .2s, visibility 0s .2s; }
.nav-collapsed body.drawer-open .sidebar { transform: none; box-shadow: 0 0 24px #0004; visibility: visible; transition: width .2s, transform .2s; }
.side-pin { display: none; margin-left: auto; }
.nav-collapsed body.drawer-open .side-pin { display: inline-flex; }
.nav-collapsed .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
.side-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-head .brand { white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.side-foot form { margin: 0; }
.side-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0;
  background: none; color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; text-align: left; white-space: nowrap; min-height: 40px; }
.side-link:hover { background: var(--chip-bg); }
.side-link:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.side-link.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 600; }
.nav-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
  border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--chip-bg); }
.mobile-bar { display: none; }
.side-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }

/* Phones and narrow windows: the sidebar slides out from the left over the page. */
@media (max-width: 800px) {
  body.with-sidebar main, .nav-collapsed body.with-sidebar main { margin-left: 0; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
  .sidebar, .nav-collapsed .sidebar { width: min(260px, 82vw); transform: translateX(-102%); box-shadow: none; visibility: hidden;
    transition: transform .2s, visibility 0s .2s; }
  body.drawer-open .sidebar { transform: none; box-shadow: 0 0 24px #0004; visibility: visible; transition: transform .2s; }
  .nav-collapsed body.drawer-open .side-pin { display: none; }  /* docking only makes sense on wide screens */
}
.viz-dot-faint { opacity: .32; stroke: none; }
/* Slim top bar hides while scrolling down and comes back on any scroll up. */
.mobile-bar { transition: transform .22s ease; will-change: transform; }
.mobile-bar.bar-hidden { transform: translateY(-110%); }
.seat-sizes { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 2px; }
.viz-tick-strong { fill: var(--ink); font-weight: 600; }
.seat-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.seat-pick { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font: inherit; font-size: 13px;
  cursor: pointer; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.seat-pick .viz-swatch { background: var(--pc); opacity: .35; }
.seat-pick.on { color: var(--ink); border-color: var(--pc); background: color-mix(in srgb, var(--pc) 12%, transparent); font-weight: 600; }
.seat-pick.on .viz-swatch { opacity: 1; }
.viz-small { font-size: 10.5px; }

/* ---- cards ---- */
.card-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.card-tools input[type=search] { flex: 1 1 200px; min-width: 0; }
.az-bar { display: flex; flex-wrap: wrap; gap: 2px; width: 100%; }
.az-bar button { font: inherit; font-size: 12px; font-weight: 600; min-width: 24px; padding: 3px 4px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
.az-bar button:hover:not(:disabled) { background: var(--chip-bg); }
.az-bar button:disabled { color: var(--muted); opacity: .4; cursor: default; }
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.card-row { display: flex; gap: 14px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  color: inherit; text-decoration: none; scroll-margin-top: 150px; }
.card-row:hover { border-color: var(--accent); }
.card-thumb { flex: none; width: 128px; aspect-ratio: 630 / 994; overflow: hidden; border-radius: 6px; }
.card-thumb.landscape { width: 170px; aspect-ratio: 994 / 630; }
.card-thumb .card-face { transform: scale(.42); transform-origin: top left; width: 238%; }
.card-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-weight: 700; font-size: 16px; }
.card-mini { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; font-size: 13px; }
.card-mini > div { display: contents; }
.card-mini dt { color: var(--muted); }
.card-mini dd { margin: 0; font-variant-numeric: tabular-nums; }
.card-nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.card-top { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 14px; align-items: start; margin-bottom: 14px; }
.card-big { width: 100%; max-width: 300px; cursor: zoom-in; }
.card-big.landscape { max-width: 420px; }
.card-top:has(.card-big.landscape) { grid-template-columns: minmax(0, 420px) 1fr; }
.card-headline { margin-bottom: 0; }
@media (max-width: 700px) {
  .card-top, .card-top:has(.card-big.landscape) { grid-template-columns: 1fr; }
  .card-big { max-width: 240px; margin: 0 auto; }
  .card-thumb { width: 104px; }
  .card-thumb.landscape { width: 140px; }
}
.pick-bar { display: inline-block; width: 60px; height: 8px; border-radius: 4px; vertical-align: middle;
  background: linear-gradient(90deg, var(--pc, var(--accent)) var(--w), color-mix(in srgb, var(--muted) 22%, transparent) var(--w)); }
.combo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 6px; }
.combo { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; padding: 3px; border-radius: 8px; }
.combo:hover { background: var(--chip-bg); }
.combo .chip { flex: none; }
.combo-n { font-variant-numeric: tabular-nums; font-size: 13px; }
.card-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-side .panel { margin-bottom: 0; }
.card-mini dt, .card-mini dd { white-space: nowrap; }
.combo-n { line-height: 1.3; }
.card-info { flex: 1; }
.card-mini { grid-template-columns: max-content max-content; }
[hidden] { display: none !important; }
.type-picks { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.type-pick { font: inherit; font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); cursor: pointer; }
.type-pick:hover { border-color: var(--accent); }
.type-pick.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
/* Card faces keep their layers to themselves, so the sticky search bar covers them cleanly. */
.card-thumb, .card-big { isolation: isolate; }
.card-tools { z-index: 15; background: var(--panel); box-shadow: 0 6px 12px -8px #0005; }
.viz-baseline { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 3; opacity: .55; }
.corr-matrix { width: auto; }
.corr-matrix th { font-weight: 600; }
.corr-matrix thead th { text-align: center; white-space: normal; max-width: 8em; vertical-align: bottom; }
.corr-matrix tbody th { text-align: left; }
.corr-matrix .swatch { margin-right: 5px; }
.cm-cell { min-width: 4.5em; text-align: center !important; font-variant-numeric: tabular-nums; cursor: default;
  background: color-mix(in srgb, var(--s1) calc(max(var(--d, 0), 0) * 85%), color-mix(in srgb, var(--s2) calc(max(calc(var(--d, 0) * -1), 0) * 85%), transparent)); }
.cm-self { background: repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--muted) 18%, transparent) 5px 6px); }
.cm-key { padding: 0 4px; border-radius: 3px; }
.cm-key.cm-neg { background: color-mix(in srgb, var(--s2) 55%, transparent); }
.cm-key.cm-pos { background: color-mix(in srgb, var(--s1) 55%, transparent); }
.corr-matrix tbody th, .corr-matrix thead th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }

/* ---- analysis ---- */
.analysis-filters { margin: 0 0 10px; }
.analysis-jump { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.analysis-jump a { white-space: nowrap; }
.analysis-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 14px; align-items: start; }
.analysis-usage td:first-child { white-space: normal; cursor: help; }
.winbar { display: inline-block; position: relative; width: 72px; height: 7px; margin-right: 6px; border-radius: 4px; vertical-align: middle;
  background: linear-gradient(90deg, var(--accent) var(--w), color-mix(in srgb, var(--muted) 22%, transparent) var(--w)); }
.winbar::after { content: ""; position: absolute; left: var(--f); top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }
.winners-tiles { margin-top: 14px; }
.heat-table th[scope=row] { font-weight: 500; text-align: left; white-space: nowrap; cursor: help; }
.heat-table thead th { text-align: center; white-space: nowrap !important; max-width: none !important; }
.heat-table .heat-group th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 10px; }
.heat-table td.heat { text-align: center !important; min-width: 4.2em; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--accent) calc(var(--s, 0) * 70%), transparent); }
.heat-table[data-mode=win] td.heat { background: color-mix(in srgb, #1baf7a calc(max(var(--d, 0), 0) * 75%),
  color-mix(in srgb, #e34948 calc(max(calc(var(--d, 0) * -1), 0) * 75%), transparent)); }
.heat-table[data-mode=share] .h-win, .heat-table[data-mode=win] .h-share { display: none; }
.heat-table tbody th[scope=row], .heat-table thead th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.player-analysis { scroll-margin-top: 12px; }
.pa-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.pa-head h2 { margin: 0; font-size: 19px; }
.pa-head h2 a { color: inherit; }
.pa-style, .pa-cards { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; }
.style-chip { padding: 2px 9px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--line); font-size: 13px; }
.style-chip.alt { background: transparent; }
.pa-findings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 6px 22px; margin-top: 12px; }
.pa-findings h3 { margin: 4px 0 6px; font-size: 14px; }
.findings { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.findings li { line-height: 1.4; }
.findings li { font-weight: 400; }
.findings.f-weak li::marker { color: #e34948; }
.findings.f-good li::marker { color: #1baf7a; }
.pa-details { margin-top: 10px; }
.pa-details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.defs { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 4px 14px; margin: 0 0 10px; font-size: 13px; }
.defs dt { font-weight: 600; }
.defs dd { margin: 0; }
@media (max-width: 600px) { .defs { grid-template-columns: 1fr; } .defs dd { margin-bottom: 6px; } }
.pa-recs { margin-top: 14px; padding: 10px 14px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.pa-recs h3 { margin: 2px 0 8px; font-size: 14px; }
.recs { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.recs li { line-height: 1.45; }
.recs li.rec-strength::marker { color: #1baf7a; }
.rec-why { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---- analysis: now and over time ---- */
.analysis-count { margin: 0 0 10px; }
.pa-now { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.pa-now-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.pa-now-head h3 { margin: 0; font-size: 16px; }
.pa-now h4, .pa-overtime h4 { margin: 8px 0 6px; font-size: 13.5px; }
.pa-alltime { margin: 18px 0 0; font-size: 15px; color: var(--muted); }
.status { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; vertical-align: 1px; white-space: nowrap; }
.st-worse { background: #e34948; color: #fff; }
.st-slipping { background: color-mix(in srgb, #e34948 22%, transparent); color: var(--ink); }
.st-persistent { border: 1px solid #e34948; color: var(--ink); }
.st-returning { border: 1px solid #eda100; color: var(--ink); }
.st-new { border: 1px solid var(--muted); color: var(--ink); }
.st-fixed { background: color-mix(in srgb, #1baf7a 25%, transparent); color: var(--ink); }
.fixed { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.fixed li::marker { content: "✓  "; color: #1baf7a; }
.pa-overtime { margin-top: 12px; }
.pa-overtime > summary { cursor: pointer; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.trend-table th[scope=row] { font-weight: 500; text-align: left; white-space: nowrap; }
.trend-table thead th { white-space: normal; min-width: 5.5em; vertical-align: bottom; }
.trend-table td.tcell { text-align: center !important; font-variant-numeric: tabular-nums; }
.trend-table td.better, .cell-key.better { background: color-mix(in srgb, #1baf7a 22%, transparent); }
.trend-table td.worse, .cell-key.worse { background: color-mix(in srgb, #e34948 20%, transparent); }
.cell-key { padding: 0 4px; border-radius: 3px; }
.trend-table tbody th[scope=row], .trend-table thead th:first-child, .history-table td:first-child, .history-table th:first-child {
  position: sticky; left: 0; background: var(--panel); z-index: 1; }
.verdict { white-space: nowrap; font-size: 12.5px; font-weight: 600; }
.v-improving { color: #12895f; }
.v-leaning_better { color: #12895f; opacity: .75; font-weight: 500; }
.v-steady { color: var(--muted); font-weight: 400; }
.v-leaning_worse { color: #c0392b; opacity: .8; font-weight: 500; }
.v-worse { color: #c0392b; }
:root[data-theme="dark"] .v-improving, :root[data-theme="dark"] .v-leaning_better { color: #3ccf98; }
:root[data-theme="dark"] .v-worse, :root[data-theme="dark"] .v-leaning_worse { color: #ff7a6e; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .v-improving, :root:not([data-theme="light"]) .v-leaning_better { color: #3ccf98; }
  :root:not([data-theme="light"]) .v-worse, :root:not([data-theme="light"]) .v-leaning_worse { color: #ff7a6e; }
}
.history-table td.dot { text-align: center !important; color: var(--muted); }
.history-table td.dot.on { color: #e34948; }
.trend-table th[scope=row] { white-space: normal; min-width: 9em; max-width: 15em; }
.trend-table .unit { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.trend-table thead th { min-width: 4.6em; font-size: 12px; }
.block-n { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.history-table thead th { font-size: 11.5px; white-space: nowrap; }
.history-table td:first-child { white-space: normal; min-width: 10em; max-width: 18em; }
@media (max-width: 600px) {
  .trend-table th[scope=row] { min-width: 7.5em; max-width: 8.5em; font-size: 12.5px; }
  .trend-table .unit { display: block; }
  .history-table td:first-child { min-width: 8em; max-width: 10em; font-size: 12.5px; }
}
