/* Layout: a header with the game switcher, a tab strip, then one working column of filters and tables;
   details open in a drawer on the right (a sheet from the bottom on phones). */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --sunken: #e9edf6;
  --ink: #131a2e;
  --ink-2: #474f6b;
  --muted: #69708b;
  --line: #dde2ee;
  --axis: #b9c0d3;
  --accent: #2747b8;
  --accent-wash: rgba(39, 71, 184, 0.12);
  --gold: #a87600;
  --gold-wash: rgba(168, 118, 0, 0.12);
  --foe: #b3263f;
  --foe-wash: rgba(179, 38, 63, 0.12);
  --ally: #1f6fbf;
  --ok: #217a55;
  --prejoin: rgba(115, 122, 149, 0.08);
  --win-bg: #101a4a;
  --win-edge: #c9d4ff;
  --win-ink: #f2f4ff;
  --win-dim: #9fb0ee;
  --shadow: 0 10px 34px rgba(16, 26, 74, 0.22);
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4;
  --t0: #dfe4ef; --t1: #cfe3b4; --t2: #e6d5ae; --t3: #a9d18e; --t4: #6fa66a; --t5: #c4a77c;
  --t6: #ecdc9a; --t7: #c9d6ec; --t8: #8db9e3; --tx: #59607a;
  --font-pixel: "Silkscreen", "Courier New", monospace;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --step--1: 0.9375rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.25rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1022; --surface: #121a35; --sunken: #0f1630; --ink: #eef1fb; --ink-2: #b6bdd8;
    --muted: #8a92b0; --line: #232c4f; --axis: #3a4470; --accent: #86a2ff;
    --accent-wash: rgba(134, 162, 255, 0.16); --gold: #e3b341; --gold-wash: rgba(227, 179, 65, 0.14);
    --foe: #ff7b8e; --foe-wash: rgba(255, 123, 142, 0.16); --ally: #6fb2ff; --ok: #6fd3a5;
    --prejoin: rgba(134, 142, 173, 0.08); --shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181;
    --t0: #262d45; --t1: #33452c; --t2: #4a4130; --t3: #2c4a29; --t4: #1e3a24; --t5: #4a3b28;
    --t6: #57502e; --t7: #2b3650; --t8: #1d3a5c; --tx: #070a16;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1022; --surface: #121a35; --sunken: #0f1630; --ink: #eef1fb; --ink-2: #b6bdd8;
  --muted: #8a92b0; --line: #232c4f; --axis: #3a4470; --accent: #86a2ff;
  --accent-wash: rgba(134, 162, 255, 0.16); --gold: #e3b341; --gold-wash: rgba(227, 179, 65, 0.14);
  --foe: #ff7b8e; --foe-wash: rgba(255, 123, 142, 0.16); --ally: #6fb2ff; --ok: #6fd3a5;
  --prejoin: rgba(134, 142, 173, 0.08); --shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181;
  --t0: #262d45; --t1: #33452c; --t2: #4a4130; --t3: #2c4a29; --t4: #1e3a24; --t5: #4a3b28;
  --t6: #57502e; --t7: #2b3650; --t8: #1d3a5c; --tx: #070a16;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: var(--step-0);
  line-height: 1.55; margin: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 64px;
}
div.wrap { max-width: 1440px; margin-inline: auto; display: grid; gap: 18px; min-width: 0; }
div.wrap > * { min-width: 0; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.2; margin: 0; }
h2 { font-size: var(--step-2); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: var(--step-1); font-weight: 600; }
h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
.prose { max-width: 75ch; color: var(--ink-2); }
div.prose, ul.prose { display: grid; gap: 10px; }
.prose strong { color: var(--ink); }
.eyebrow, .tag { font-family: var(--font-pixel); font-size: 0.78rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }

/* Site header */
.site {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px;
  padding-block: 18px 12px; border-bottom: 1px solid var(--line);
}
.site .brand { font-family: var(--font-pixel); font-size: 1rem; color: var(--ink); text-decoration: none; letter-spacing: 0.02em; }
.site .brand span { color: var(--gold); }
.site nav { display: flex; flex-wrap: wrap; gap: 4px; }
.site nav a {
  font-size: var(--step--1); font-weight: 500; color: var(--ink-2); text-decoration: none;
  padding: 6px 11px; border-radius: 6px;
}
.site nav a:hover { background: var(--sunken); color: var(--ink); }
.site nav a[aria-current="page"] { background: var(--win-bg); color: var(--win-ink); }

/* Page head */
.head { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: end; padding-top: 18px; }
.head h1 { font-family: var(--font-pixel); font-weight: 400; font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.08; margin-block: 6px 12px; }
.head h1 span { color: var(--gold); }
.head .deck { color: var(--ink-2); max-width: 62ch; }
.window {
  background: var(--win-bg); color: var(--win-ink); border: 3px double var(--win-edge); border-radius: 6px;
  padding: 14px 18px; font-family: var(--font-pixel); font-size: 0.84rem; line-height: 1.7; box-shadow: var(--shadow);
}
.window .row { display: flex; justify-content: space-between; gap: 12px; }
.window .dim { color: var(--win-dim); }
.window .grid { display: grid; grid-template-columns: repeat(3, auto); gap: 2px 16px; margin-top: 6px; justify-content: start; }
.window figcaption { font-family: var(--font-sans); font-size: var(--step--1); color: var(--win-dim); margin-top: 8px; line-height: 1.4; }
.window figure { margin: 0; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 5; }
.tabs a {
  font-size: var(--step--1); font-weight: 500; color: var(--ink-2); text-decoration: none;
  padding: 10px 12px 9px; border-bottom: 2px solid transparent;
}
.tabs a[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a .n { font-family: var(--font-mono); color: var(--muted); font-size: 0.85em; margin-left: 4px; }
section.panel { display: grid; gap: 16px; min-width: 0; }
section.panel > * { min-width: 0; }

/* Toolbars */
.bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.bar input[type="search"], .bar select, select.pick {
  font: inherit; font-size: var(--step--1); color: var(--ink); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 6px; padding: 6px 10px; min-width: 0; max-width: 100%;
}
.bar input[type="search"] { flex: 1 1 220px; max-width: 360px; }
.count { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--axis); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; font-size: var(--step--1); border: 0; background: var(--surface); color: var(--ink-2); padding: 6px 11px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--surface); font-weight: 600; }

/* Tables */
.tablebox { overflow: auto; max-height: 85vh; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
/* A table no wider than its content: short tables don't stretch across the page. */
.tablebox.fit { width: fit-content; max-width: 100%; max-height: none; }
td .lo { color: var(--ok); font-weight: 600; }
td .hi { color: var(--foe); font-weight: 600; }
tr.dim td { color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
th, td { padding: 6px 9px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  position: sticky; top: 0; z-index: 1; background: var(--sunken); color: var(--ink-2); font-weight: 600;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; user-select: none;
}
thead th.sort { cursor: pointer; }
thead th.sort:hover { color: var(--ink); }
th.num, td.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
td.nw { white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.row { cursor: pointer; }
tbody tr.row:hover td { background: var(--accent-wash); }
tbody tr.on td { background: var(--accent-wash); }
td .sub { color: var(--muted); font-size: 0.92em; }
td.wrap { min-width: 220px; }

/* References and chips */
a.ref { color: var(--ink); text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 2px; }
a.ref:hover { color: var(--accent); text-decoration-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.chip {
  font-family: var(--font-mono); font-size: 0.85rem; background: var(--sunken); color: var(--ink);
  border-radius: 4px; padding: 1px 6px; white-space: nowrap; text-decoration: none;
}
a.chip:hover { background: var(--accent-wash); }
.chip b { font-weight: 600; color: var(--muted); margin-right: 4px; }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 1.6; white-space: nowrap; }
.pill.rare { background: var(--gold-wash); color: var(--gold); }
.pill.cursed { background: var(--foe-wash); color: var(--foe); }
.pill.opt { background: var(--accent-wash); color: var(--accent); }
.pill.story { background: var(--sunken); color: var(--ink-2); }
.pill.odds { background: var(--gold-wash); color: var(--gold); }
.addr { font-family: var(--font-mono); font-size: 0.8em; color: var(--muted); }

/* Cards and notes */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.card h3 { font-size: 1rem; }
.note { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 0 6px 6px 0; padding: 12px 14px; display: grid; gap: 6px; max-width: 80ch; color: var(--ink-2); }
.note strong { color: var(--ink); }
.formula { font-family: var(--font-mono); font-size: 0.9rem; background: var(--sunken); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 4px 4px 0; overflow-x: auto; white-space: pre; line-height: 1.7; }
.card .formula { white-space: pre-wrap; }
.card thead th { white-space: normal; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: var(--step--1); }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; }

/* Two-column workbench: list and detail */
.split { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.list { display: grid; gap: 2px; max-height: 78vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 4px; }
.list button {
  all: unset; display: grid; grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 8px; align-items: baseline;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: var(--step--1);
}
.list button:hover { background: var(--sunken); }
.list button[aria-current="true"] { background: var(--accent-wash); }
.list button:focus-visible { outline: 2px solid var(--accent); }
.list .no { font-family: var(--font-mono); color: var(--muted); text-align: right; }
.list .meta { color: var(--muted); font-size: 0.85em; white-space: nowrap; }
.detail { display: grid; gap: 14px; min-width: 0; }

/* Battle map */
.map { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; }
.map svg { display: block; max-width: 100%; height: auto; }
.nogrid .map svg path.grid { display: none; }
.map.zoomable svg:not(.full) { width: 100%; }
.map.zoomable { box-sizing: content-box; scrollbar-width: none; }
.map.zoomable::-webkit-scrollbar { display: none; }
.map svg text { font-family: var(--font-mono); fill: var(--ink); }
.map svg image.px, .map image.px { image-rendering: pixelated; }
.map.zoomed { cursor: grab; }
.map svg.full { max-width: none; }
.map.panning { cursor: grabbing; }
.map svg { user-select: none; -webkit-user-select: none; }
.map svg text.lbl { fill: var(--foe); font-family: var(--font-sans); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.map svg text.badge { fill: #fff; font-family: var(--font-mono); font-weight: 600; paint-order: stroke; stroke: #000; stroke-width: 3px; stroke-linejoin: round; }
.map svg text.num { fill: var(--ink); font-family: var(--font-mono); font-weight: 600; }
.map g.area:hover rect { stroke-width: 5; }
.spr { display: inline-block; vertical-align: middle; image-rendering: pixelated; flex: none; }
tr.goto { cursor: pointer; }
.map g.person .hov { opacity: 0; transition: opacity 0.12s; }
.map g.person:hover .hov, .map g.person.hl .hov, .map g.person.sel .hov { opacity: 1; }
.map svg .chain { visibility: hidden; }
.map svg .chain.hl, .map svg .chain.sel { visibility: visible; }
.map svg g.slink { opacity: 0.5; transition: opacity 0.12s; }
.map svg g.slink.hl, .map svg g.slink.sel { opacity: 1; }
.map g.person.hidden image { opacity: 0.55; }
.map image.edge { filter: drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000) drop-shadow(0 1px 0 #000) drop-shadow(0 -1px 0 #000); }
button.linkish { all: unset; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
button.linkish:hover { color: var(--accent); }
button.linkish:focus-visible { outline: 2px solid var(--accent); }
table.things td.cells { font-family: var(--font-mono); white-space: nowrap; }
table.things td:first-child { white-space: nowrap; }
ul.tree { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; }
a.pin { white-space: nowrap; font-variant-numeric: tabular-nums; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 0 6px 0 4px; }
a.pin::before { content: "\25C9"; margin-right: 3px; color: var(--accent); }
a.pin:hover { border-color: var(--accent); }
.backchip { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); }
ul.tree ul.tree { border-left: 1px dashed var(--line); padding-left: 14px; }
ul.tree.then { border-left: 2px solid var(--accent); }
.gives { color: var(--gold); white-space: nowrap; }
ul.dests { margin: 0; padding-left: 16px; display: grid; gap: 2px; }
tr.goto:hover td { background: var(--accent-wash); }
.map svg circle.pulse { fill: none; stroke: var(--gold); stroke-width: 4; opacity: 0; transform-box: fill-box; transform-origin: center; animation: pulse 0.9s ease-out both; }
.map svg rect.flash { fill: none; stroke: #fff; stroke-width: 3; animation: flash 0.3s ease-in-out 4 alternate both; }
@keyframes pulse { from { transform: scale(0.5); opacity: 1; } to { transform: scale(3); opacity: 0; } }
@keyframes flash { from { opacity: 1; } to { opacity: 0.15; } }
.gallery { display: grid; gap: 12px; }
.artset { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunken); }
.sprites { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.talk { display: grid; gap: 6px; }
.talk p { margin: 0; }
.talk .when { font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.talk .does { color: var(--ink-2); font-size: var(--step--1); }
.talk .opts { display: grid; gap: 10px; }
.talk .ladder > .opt > .when { color: var(--accent); }
.talk .ladder > .opt.else > .body { padding-left: 8px; margin-left: 0; }
.talk .ladder > .opt > .body > .ladder { margin-top: 6px; }
.talk .times { color: var(--accent); font-weight: 600; }
.talk .opt { display: grid; gap: 4px; }
.talk .opt > .body { display: grid; gap: 6px; border-left: 2px solid var(--line); padding-left: 12px; margin-left: 3px; }
q.msg { font-style: italic; color: var(--ink-2); }
q.msg::before { content: "“"; } q.msg::after { content: "”"; }
details.card > summary { cursor: pointer; list-style-position: inside; }
details.card > summary h3 { display: inline; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--step--1); color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

/* Rules tab: a contents list beside one reading column; the list goes on top on narrow screens. */
.rules { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 36px; align-items: start; }
.rules .toc { position: sticky; top: 56px; display: grid; gap: 2px; max-height: calc(100vh - 72px); overflow: auto; padding: 4px 0; }
.rules .toc a { color: var(--ink-2); text-decoration: none; padding: 4px 10px; border-left: 2px solid var(--line); font-size: var(--step--1); }
.rules .toc a:hover { color: var(--accent); border-left-color: var(--accent); }
.rules .toc .eyebrow { padding: 0 10px 6px; }
.rules .doc { display: grid; gap: 44px; min-width: 0; max-width: 1040px; }
.rules .doc > section { display: grid; gap: 14px; min-width: 0; scroll-margin-top: 64px; }
.rules .doc > section > * { min-width: 0; }
.rules .doc h2 { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.rules ol.steps { display: grid; gap: 8px; padding-left: 1.4em; margin: 0; }
.rules .formula { white-space: pre-wrap; }
.rules table:not(.land):not(.num-cols) td + td { min-width: 11em; }
.rules table td:first-child { white-space: nowrap; }
.rules table.num-cols td { text-align: right; font-family: var(--font-mono); }
.rules table.num-cols td:first-child { text-align: left; }
ul.gifts { max-width: none; }
@media (max-width: 960px) {
  .rules { grid-template-columns: 1fr; gap: 18px; }
  .rules .toc { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .rules .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
  .rules .toc .eyebrow { width: 100%; }
}

/* Drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); z-index: 20;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.drawer header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer header .title { flex: 1; min-width: 0; font-weight: 600; }
/* A column of blocks that never shrink: in a fixed-height grid, scrolling boxes such as tables could
   collapse to nothing once the content outgrew the drawer. */
.drawer .body { overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.drawer .body > * { flex-shrink: 0; min-width: 0; }
.btn {
  font: inherit; font-size: var(--step--1); border: 1px solid var(--axis); background: var(--surface); color: var(--ink);
  border-radius: 6px; padding: 5px 10px; cursor: pointer;
}
.btn:hover { background: var(--sunken); }

/* Charts (growth page) */
.chart { position: relative; min-width: 0; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart svg text { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(10, 16, 40, 0.18);
  padding: 8px 10px; font-size: 12px; line-height: 1.45; min-width: 150px;
}
.tip .t-head { color: var(--muted); font-size: 11px; margin-bottom: 4px; font-family: var(--font-mono); }
.tip .t-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .t-row .k { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip .t-row .v { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.tip .key { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.tip .key.band { height: 8px; }

footer.foot { color: var(--muted); font-size: var(--step--1); border-top: 1px solid var(--line); padding-top: 14px; max-width: 90ch; display: grid; gap: 6px; }

@media (max-width: 860px) {
  .head { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .list { max-height: 40vh; }
  .drawer { top: auto; width: 100%; height: 82vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; padding-left: env(safe-area-inset-left, 0px); }
}
@media (prefers-reduced-motion: no-preference) {
  .drawer { animation: slide 0.16s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
}
i.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* Hover previews and linked highlights */
.hovertip {
  position: fixed; z-index: 40; pointer-events: none; max-width: min(400px, calc(100vw - 16px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 10px 12px; font-size: var(--step--1); line-height: 1.45; display: grid; gap: 6px;
}
.hovertip.pinned { pointer-events: auto; border-color: var(--accent); }
.hovertip .tt { font-weight: 600; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.hovertip .tt .sub { color: var(--muted); font-weight: 400; font-size: 0.9em; }
.hovertip .stats { display: grid; grid-template-columns: repeat(4, auto); gap: 1px 12px; font-family: var(--font-mono); font-size: 0.92em; justify-content: start; }
.hovertip .stats span b { color: var(--muted); font-weight: 500; margin-right: 4px; }
.hovertip .ln { color: var(--ink-2); }
.hovertip .ln b { color: var(--muted); font-weight: 500; }
tr.hl td { background: var(--gold-wash); }
#battle-detail tr.sel td { background: var(--gold-wash); }
.map svg .mk.sel:not(.person) rect { stroke: var(--gold) !important; stroke-width: 3px !important; }
.map svg .hl rect, .map svg rect.hl { stroke: var(--gold) !important; stroke-width: 3px !important; }
.map svg [data-tip] { cursor: pointer; }
.map svg .mk text { pointer-events: none; }

/* Compact page head for the data pages */
.head.compact { padding-top: 10px; }
.head.compact h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-block: 4px 6px; }
.head.compact .deck { font-size: var(--step--1); }

/* Battle list tags */
.list .tags { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: 1px; }
.tg { font-style: normal; font-family: var(--font-mono); font-size: 0.68rem; border-radius: 3px; padding: 0 4px; background: var(--sunken); color: var(--muted); }
.tg.drop { background: var(--gold-wash); color: var(--gold); }
.tg.join { background: var(--accent-wash); color: var(--accent); }
.tg.replay { background: var(--foe-wash); color: var(--foe); }
.tg.item { background: var(--gold-wash); color: var(--gold); }
.tg.spawn { background: var(--foe-wash); color: var(--foe); }
p.ln, .ln { color: var(--ink-2); font-size: var(--step--1); }
.ln b { color: var(--muted); font-weight: 500; margin-right: 4px; }
td .sub, .ln .sub { color: var(--muted); font-size: 0.9em; }
