:root {
  --bg: #f7f5f2; --panel: #ffffff; --ink: #1d1b19; --muted: #6b655e; --line: #e4dfd8;
  --accent: #c2410c; --accent-soft: #fde9dc; --code: #f1ede7;
  --tip: #0f766e; --warn: #b45309; --live: #7c3aed; --info: #2563eb;
  --r-common: #6b7280; --r-rare: #2563eb; --r-epic: #9333ea; --r-legendary: #d97706; --r-ultimate: #dc2626; --r-mythic: #db2777;
  --radius: 8px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151311; --panel: #1e1b18; --ink: #ece7e1; --muted: #a39b91; --line: #34302b;
    --accent: #fb923c; --accent-soft: #3a2416; --code: #2a2622;
    --tip: #2dd4bf; --warn: #fbbf24; --live: #a78bfa; --info: #60a5fa;
    --r-common: #9ca3af; --r-rare: #60a5fa; --r-epic: #c084fc; --r-legendary: #fbbf24; --r-ultimate: #f87171; --r-mythic: #f472b6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151311; --panel: #1e1b18; --ink: #ece7e1; --muted: #a39b91; --line: #34302b;
  --accent: #fb923c; --accent-soft: #3a2416; --code: #2a2622;
  --tip: #2dd4bf; --warn: #fbbf24; --live: #a78bfa; --info: #60a5fa;
  --r-common: #9ca3af; --r-rare: #60a5fa; --r-epic: #c084fc; --r-legendary: #fbbf24; --r-ultimate: #f87171; --r-mythic: #f472b6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; font-size: .88em; }

header.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 10px; align-items: center;
  padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 500; }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search input { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--ink); font: inherit; }
.search .results { position: absolute; top: 110%; left: 0; right: 0; max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px #0003; }
.search .results a { display: block; padding: 8px 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.search .results a:hover, .search .results a.sel { background: var(--accent-soft); text-decoration: none; }
.search .results small { display: block; color: var(--muted); }
select.lang, button.theme, button.nav-toggle { background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 8px; font: inherit; }
button.nav-toggle { display: none; }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); max-width: 1400px; margin: 0 auto; }
nav.side { position: sticky; top: 53px; height: calc(100vh - 53px); overflow: auto; padding: 12px 8px 40px 16px;
  border-right: 1px solid var(--line); font-size: 14px; }
nav.side summary { font-weight: 650; color: var(--muted); text-transform: uppercase; font-size: 11.5px;
  letter-spacing: .06em; padding: 10px 4px 4px; cursor: pointer; list-style: none; }
nav.side ul { list-style: none; margin: 0; padding: 0; }
nav.side a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--ink); }
nav.side a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
main { padding: 20px 32px 60px; min-width: 0; }
h1 { margin: 4px 0 6px; font-size: 1.9rem; line-height: 1.2; }
.lede { color: var(--muted); margin-top: 0; font-size: 1.05rem; }
h2 { margin-top: 2.2rem; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 1.35rem; }
h3 { margin-top: 1.6rem; font-size: 1.1rem; }
.anchor { color: var(--line); margin-right: 6px; }
h2:hover .anchor { color: var(--accent); }
footer { margin-top: 48px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
caption { text-align: left; padding: 8px 10px; color: var(--muted); font-size: 13px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--code); font-weight: 650; white-space: nowrap; position: sticky; top: 0; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
table[data-sortable] th { cursor: pointer; user-select: none; }
table[data-sortable] th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
table[data-sortable] th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
tbody tr:hover { background: var(--accent-soft); }
table.kv thead { display: none; }
table.kv td:first-child { width: 40%; color: var(--muted); }
.table-filter { margin: 8px 0 -4px; padding: 6px 10px; width: 100%; max-width: 320px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; }

.callout { border-left: 4px solid var(--info); background: var(--panel); padding: 10px 14px; margin: 14px 0;
  border-radius: 0 var(--radius) var(--radius) 0; }
.callout-title { font-weight: 700; margin-bottom: 2px; }
.callout.tip { border-color: var(--tip); } .callout.tip .callout-title { color: var(--tip); }
.callout.warn { border-color: var(--warn); } .callout.warn .callout-title { color: var(--warn); }
.callout.live { border-color: var(--live); } .callout.live .callout-title { color: var(--live); }
.callout.info .callout-title { color: var(--info); }
.callout ul { margin: 6px 0 0; padding-left: 20px; }

.badge { display: inline-block; padding: 0 7px; border-radius: 99px; background: var(--code); font-size: 12px; color: var(--muted); }
.rarity { font-weight: 650; }
.r-common { color: var(--r-common); } .r-rare { color: var(--r-rare); } .r-epic { color: var(--r-epic); }
.r-legendary { color: var(--r-legendary); } .r-ultimate { color: var(--r-ultimate); } .r-mythic { color: var(--r-mythic); }
details { margin: 8px 0; }
details > summary { cursor: pointer; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); }
a.card:hover { border-color: var(--accent); text-decoration: none; }
.card b { display: block; margin-bottom: 2px; }
.card small { color: var(--muted); }
.stat { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  nav.side { display: none; position: fixed; inset: 53px 0 0 0; z-index: 15; background: var(--panel); border: 0; height: auto; }
  body.nav-open nav.side { display: block; }
  button.nav-toggle { display: inline-block; }
  .brand span { display: none; }
  main { padding: 14px 16px 48px; }
  header.top { padding: 8px 12px; gap: 6px; }
  select.lang { max-width: 92px; }
  h1 { font-size: 1.5rem; }
}

/* ===== Visual primitives (core.py: tldr, charts, calc, chips; see site/DESIGN.md) ===== */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --good: #15803d; --bad: #c62828;
  --seq: #184f95; --seq-on: #ffffff;
  --grid: #ece7e0; --axis: #cfc7bc; --track: #ece7e0; --hover: rgba(29, 27, 25, .06);
  --font-num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", "Ubuntu Sans", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --good: #34c759; --bad: #f87171;
    --seq: #7ab0f0; --seq-on: #0b1a2e;
    --grid: #2b2723; --axis: #48423b; --track: #2e2a26; --hover: rgba(255, 255, 255, .07);
  }
}
:root[data-theme="dark"] {
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --good: #34c759; --bad: #f87171;
  --seq: #7ab0f0; --seq-on: #0b1a2e;
  --grid: #2b2723; --axis: #48423b; --track: #2e2a26; --hover: rgba(255, 255, 255, .07);
}

/* TL;DR strip: the one loud thing on a page */
.tldr { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); margin: 18px 0 26px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tldr.n1 { --n: 1; } .tldr.n2 { --n: 2; } .tldr.n3 { --n: 3; }
.tldr-item { position: relative; padding: 16px 18px 14px; border-left: 1px solid var(--line); min-width: 0; }
.tldr-item:first-child { border-left: 0; }
.tldr-item::before { content: ""; position: absolute; left: 18px; top: 0; width: 28px; height: 4px; border-radius: 0 0 3px 3px;
  background: var(--accent); }
.tldr-item.t-good::before { background: var(--good); } .tldr-item.t-warn::before { background: var(--warn); }
.tldr-item.t-bad::before { background: var(--bad); } .tldr-item.t-info::before { background: var(--info); }
.tldr-big { display: flex; align-items: center; gap: 8px; font-family: var(--font-num); font-stretch: 85%;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 2.9rem); line-height: 1.05; font-weight: 750; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tldr-ico { display: inline-flex; font-size: .7em; line-height: 1; }
.tldr-ico .ico { width: 1em; height: 1em; }
.tldr-label { margin-top: 6px; font-size: .95rem; line-height: 1.3; font-weight: 550; }
.tldr-sub { margin-top: 3px; font-size: .8rem; color: var(--muted); }
@media (max-width: 560px) {
  .tldr { grid-template-columns: 1fr; }
  .tldr-item { border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(5.6rem, auto) 1fr;
    align-items: center; column-gap: 14px; padding: 12px 14px 12px 16px; }
  .tldr-item:first-child { border-top: 0; }
  .tldr-item::before { left: 0; top: 14px; bottom: 14px; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .tldr-big { font-size: 2rem; min-width: 4.2ch; }
  .tldr-label { margin: 0; }
  .tldr-sub { grid-column: 2; }
}

/* chips + footnotes */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px; font-size: 13px;
  line-height: 1.6; background: var(--code); color: var(--ink); white-space: nowrap; vertical-align: 1px; }
.stat-chip b { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.stat-chip.t-good b { color: var(--good); } .stat-chip.t-warn b { color: var(--warn); } .stat-chip.t-bad b { color: var(--bad); }
.chip .ico { width: 16px; height: 16px; }
.rarity-chip { background: color-mix(in oklab, var(--c) 14%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c) 35%, transparent); font-weight: 600; }
.rarity-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.fns { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.fn { display: inline-block; font-size: 12.5px; line-height: 1.45; color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; max-width: 100%; }
.fn-k { font-weight: 650; color: var(--ink); margin-right: 2px; }
.fn-k::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 6px;
  vertical-align: 1px; background: var(--info); }
.fn-interpretation .fn-k::before, .fn-assumption .fn-k::before, .fn-estimate .fn-k::before { background: var(--warn); border-radius: 50%; }
.fn-live .fn-k::before { background: var(--live); } .fn-apk .fn-k::before { background: var(--muted); }

/* show all data */
details.show-all { margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
details.show-all > summary { list-style: none; padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
details.show-all > summary::-webkit-details-marker { display: none; }
details.show-all > summary::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: 6px; background: var(--code); font-weight: 700; color: var(--muted); align-self: center; }
details.show-all[open] > summary::before { content: "−"; }
.sa-k { color: var(--accent); }
.sa-t { font-weight: 500; color: var(--muted); }
.sa-count { font-weight: 500; font-size: 12px; color: var(--muted); }
.sa-body { padding: 0 12px 6px; }
.sa-body > .table-wrap { margin-top: 0; }

/* steps */
ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 14px 0 20px; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
ol.steps > li { counter-increment: step; position: relative; padding: 12px 14px 12px 50px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); min-height: 56px; }
ol.steps > li::before { content: counter(step); position: absolute; left: 12px; top: 12px; width: 28px; height: 28px;
  border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--panel);
  font: 700 14px/1 var(--font-num); }
.step-title { font-weight: 650; line-height: 1.3; }
.step-body { color: var(--muted); font-size: .9rem; margin-top: 2px; line-height: 1.4; }
.step-ico { float: right; margin-left: 6px; }
@media (max-width: 560px) {
  ol.steps { gap: 0; grid-template-columns: 1fr; }
  ol.steps > li { border: 0; background: none; padding: 4px 0 14px 44px; min-height: 0; }
  ol.steps > li::before { left: 0; top: 2px; }
  ol.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 34px; bottom: 2px;
    width: 2px; background: var(--line); }
}

/* figure shell */
figure.viz { margin: 16px 0 20px; padding: 14px 16px 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; min-width: 0; }
.viz-head { margin-bottom: 10px; }
.viz-title { font-weight: 650; line-height: 1.3; }
.viz-sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
figure.viz figcaption { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; font-size: 13px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* horizontal bars */
.bars { container-type: inline-size; display: grid; gap: 7px; --lw: 9.5rem; }
.bar-row { display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); align-items: center; gap: 10px;
  border-radius: 6px; font-size: 14px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; height: 22px; }
.bar-fill { display: block; height: 18px; flex: none; width: calc(var(--p) * (100% - 4.8rem)); min-width: 2px;
  background: var(--c); border-radius: 0 4px 4px 0; }
.bar-val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; font-size: 14px; }
.bar-row.hl .bar-label { font-weight: 700; }
.bars.has-hl .bar-row:not(.hl) .bar-fill { background: color-mix(in oklab, var(--c) 45%, var(--panel)); }
.bars.has-hl .bar-row:not(.hl) .bar-val { font-weight: 500; color: var(--muted); }
.bar-row:hover { background: var(--hover); }
@container (max-width: 460px) {
  .bar-row { grid-template-columns: min(var(--lw), 34cqi) minmax(0, 1fr); gap: 8px; font-size: 13px; }
  .bar-fill { width: calc(var(--p) * (100% - 4.2rem)); height: 16px; }
  .bar-val { font-size: 13px; }
}
@container (max-width: 260px) {
  .bar-row { grid-template-columns: 1fr; gap: 0; }
  .bar-label { color: var(--muted); }
}

/* meter */
.meter { margin: 8px 0; }
.meter-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.meter-top b { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.meter-track { height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; }
.meter-track > span { display: block; height: 100%; background: var(--c); border-radius: 99px; transition: width .25s ease; }

/* stacked bars */
.stk { display: grid; gap: 4px; container-type: inline-size; }
.stk-row { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); align-items: center; gap: 10px; font-size: 13px; }
.stk-label { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stk-track { display: flex; gap: 2px; height: 20px; min-width: 0; }
.seg { display: grid; place-items: center; min-width: 2px; background: var(--c); color: #fff; font-size: 11px; font-weight: 650;
  overflow: hidden; white-space: nowrap; text-shadow: 0 0 2px rgba(0, 0, 0, .55), 0 0 1px rgba(0, 0, 0, .7); }
.seg:first-child { border-radius: 4px 0 0 4px; } .seg:last-child { border-radius: 0 4px 4px 0; }
.seg:only-child { border-radius: 4px; }
.stk-row:hover .stk-label { color: var(--ink); }

/* heatmap */
.heat-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.heat { border-collapse: separate; border-spacing: 2px; width: 100%; font-size: 12.5px; }
table.heat th, table.heat td { border: 0; padding: 5px 6px; text-align: center; white-space: nowrap; }
table.heat thead th { background: none; color: var(--muted); font-weight: 600; position: static; font-size: 12px; }
table.heat tbody th { text-align: right; color: var(--muted); font-weight: 600; background: var(--panel);
  position: sticky; left: 0; z-index: 1; }
table.heat td { font-variant-numeric: tabular-nums; border-radius: 4px; }
table.heat td.c { background: color-mix(in oklab, var(--seq) var(--a), var(--panel)); }
table.heat td.on { color: var(--seq-on); font-weight: 600; }
table.heat td.z { color: var(--axis); }
table.heat tr.hl th { color: var(--accent); }
table.heat tr.hl td { box-shadow: inset 0 0 0 2px var(--accent); }
table.heat tbody tr:hover { background: none; }
table.heat td.c:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.corner { text-align: right !important; }

/* donut + sparkline */
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
svg.donut { flex: none; }
svg.donut circle[stroke] { transition: opacity .15s; }
svg.donut .d-big { font: 750 19px var(--font-num); fill: var(--ink); }
svg.donut .d-lbl { font-size: 9px; fill: var(--muted); }
ul.donut-lg { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; min-width: 160px; flex: 1; }
ul.donut-lg li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
ul.donut-lg i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
ul.donut-lg b { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
svg.spark { vertical-align: middle; overflow: visible; }
svg.spark path { fill: none; stroke: var(--c); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
svg.spark circle { fill: var(--c); }

/* line chart */
svg.lc { display: block; overflow: visible; font-size: 12px; }
svg.lc .grid { stroke: var(--grid); stroke-width: 1; }
svg.lc .axis { stroke: var(--axis); stroke-width: 1; }
svg.lc text { fill: var(--muted); font-variant-numeric: tabular-nums; }
svg.lc .ytick { paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
svg.lc .line { fill: none; stroke: var(--c); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
svg.lc .area { fill: var(--c); opacity: .1; stroke: none; }
svg.lc .dot { fill: var(--c); stroke: var(--panel); stroke-width: 2px; }
svg.lc .hl-rule { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }
svg.lc .hl-lbl { fill: var(--ink); font-weight: 650; paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
svg.lc .hit { fill: transparent; }
svg.lc .hit:hover, svg.lc .hit.on { fill: var(--hover); }
.x-title { text-align: center; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* tooltip (app.js) */
.viz-tip { position: fixed; z-index: 50; pointer-events: none; max-width: 260px; padding: 6px 9px; border-radius: 8px;
  background: var(--ink); color: var(--panel); font-size: 12.5px; line-height: 1.4; white-space: pre-line;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18); font-variant-numeric: tabular-nums; }
.viz-tip::first-line { font-weight: 650; }
[data-tip] { cursor: default; }

/* calculator */
.calc { margin: 18px 0 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.calc-head { padding: 12px 16px 0; }
.calc-title { font-weight: 700; font-size: 1.05rem; }
.calc-title::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px;
  background: var(--accent); vertical-align: 1px; }
.calc-sub { color: var(--muted); font-size: 13px; }
.calc-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 0; }
.calc-in { padding: 12px 16px 14px; display: grid; gap: 12px; align-content: start; }
.calc-field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.calc-ctl { display: flex; align-items: center; gap: 10px; }
.calc-ctl input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; margin: 0; }
.calc-ctl input[type=number], .calc-ctl select { font: 650 15px var(--font-num); font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.calc-ctl input[type=number] { width: 5.2em; text-align: right; }
.calc-ctl select { flex: 1; font-family: var(--font); font-weight: 500; }
.calc-unit { color: var(--muted); font-size: 13px; margin-left: -4px; }
.calc input:focus-visible, .calc select:focus-visible, .calc button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.calc-reset { justify-self: start; background: none; border: 0; padding: 2px 0; color: var(--muted); font: inherit;
  font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.calc-out { display: block; padding: 14px 16px 16px; background: var(--bg); border-left: 1px solid var(--line); min-width: 0; }
.calc-row { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-bottom: 10px; }
.calc-stat { min-width: 0; }
.calc-stat .v { display: flex; align-items: center; gap: 6px; font: 750 2.1rem/1.05 var(--font-num); font-stretch: 85%;
  font-variant-numeric: tabular-nums; }
.calc-stat .v .ico { width: 26px; height: 26px; }
.calc-stat .l { color: var(--muted); font-size: 13px; }
.calc-stat.t-good .v { color: var(--good); } .calc-stat.t-warn .v { color: var(--warn); } .calc-stat.t-bad .v { color: var(--bad); }
.calc-note { margin: 8px 0 0; font-size: 13.5px; line-height: 1.45; }
.calc-note.t-warn { color: var(--warn); } .calc-note.t-good { color: var(--good); }
.calc-out .bars { margin-top: 6px; }
@media (max-width: 700px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-out { border-left: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { .meter-track > span { transition: none; } }
@media (forced-colors: active) {
  .bar-fill, .seg, .meter-track > span, .legend i, ul.donut-lg i { forced-color-adjust: none; border: 1px solid CanvasText; }
}

/* ===== Home page (pages/home.py) ===== */
.hero-search { max-width: none; margin: 6px 0 22px; }
.hero-search input { font-size: 1.1rem; padding: 14px 16px; border-width: 2px; border-radius: 12px; }
.hero-search input:focus { border-color: var(--accent); outline: none; }
.home-h { font-size: 1.05rem; margin: 26px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.glyph { display: inline-flex; align-items: center; justify-content: center; width: 1.6em; height: 1.6em;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
a.qa { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ico q" "big big" "sub sub";
  gap: 4px 10px; align-items: center; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; color: var(--ink); min-width: 0; }
a.qa:hover, a.qa:focus-visible { border-color: var(--accent); text-decoration: none; box-shadow: 0 0 0 1px var(--accent); }
.qa-ico { grid-area: ico; display: inline-flex; }
.qa-q { grid-area: q; font-weight: 650; line-height: 1.25; }
.qa-big { grid-area: big; font-family: var(--font-num); font-stretch: 85%; font-size: 1.9rem; font-weight: 750;
  line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.qa-sub { grid-area: sub; font-size: .82rem; color: var(--muted); }
.hl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
a.hl { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); min-width: 0; }
a.hl:hover { border-color: var(--accent); text-decoration: none; }
a.hl b { font-family: var(--font-num); font-size: 1.5rem; line-height: 1; }
a.hl span { font-size: .85rem; color: var(--muted); }
.tt { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.tt-col { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.tt-h { font-weight: 700; margin-bottom: 6px; }
.tt-row { display: flex; flex-direction: column; gap: 6px; }
.tt-items { display: flex; flex-wrap: wrap; gap: 8px; }
a.tt-item { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.sec-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
a.sec-h { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.05rem; }
a.sec-h b { flex: 1; }
.sec-n { font-size: .75rem; color: var(--muted); background: var(--code); border-radius: 999px; padding: 1px 8px; }
.sec-links { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
.sec-links a { font-size: .82rem; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
@media (max-width: 560px) {
  .qa-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  a.qa { padding: 10px 12px; grid-template-columns: 1fr; grid-template-areas: "ico" "q" "big" "sub"; }
  .qa-big { font-size: 1.5rem; }
  .qa-q { font-size: .9rem; }
  .hl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* phone header: search gets its own full-width row instead of shrinking to a few characters */
@media (max-width: 560px) {
  header.top { flex-wrap: wrap; row-gap: 6px; }
  header.top .brand { flex: 1; }
  header.top .search { order: 10; flex: 1 0 100%; max-width: none; margin-left: 0; }
}
.sec-more { margin: 4px 0 0; }
.sec-more > summary { font-size: .82rem; font-weight: 600; color: var(--accent); list-style: none; display: inline-block;
  padding: 2px 8px; border: 1px dashed var(--line); border-radius: 999px; }
.sec-more > summary::-webkit-details-marker { display: none; }
.sec-more[open] > summary { margin-bottom: 4px; }

/* ===== My profile (pages/profile.py, assets/profile.js) ===== */
.profile-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 14px; }
.profile .calc-ctl input[type=text] { width: 100%; min-width: 0; font: 650 15px var(--font-num); font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.profile .calc-ctl input.scan-ok { border-color: var(--good); box-shadow: 0 0 0 1px var(--good); }
.profile .calc-ctl input.scan-check { border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn); }
.profile .calc-ctl input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-more summary { cursor: pointer; font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.scan { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.scan-btn { justify-self: start; display: inline-block; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: var(--panel); font-weight: 650; }
.scan-btn { position: relative; }
.scan-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.scan-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.scan-status { margin: 0; color: var(--muted); }
.scan-thumb { max-height: 140px; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.profile-card + .profile-card { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.profile-card h3 { margin: 0 0 8px; font-size: 1rem; }
.profile .calc-ctl input::placeholder { color: var(--muted); opacity: .55; font-weight: 400; }

/* server picker (pages/live.py live/leaderboards): one tab per server, [data-wpanel] shows the picked one */
.wpick { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.wpick a { display: flex; flex-direction: column; min-width: 7.5rem; min-height: 44px; justify-content: center;
  padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  color: var(--ink); line-height: 1.25; }
.wpick a:hover { border-color: var(--accent); text-decoration: none; }
.wpick a small { color: var(--muted); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.wpick a[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent); }
.wpick a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) { .wpick a { flex: 1 1 0; min-width: 0; } }
