/* Obenseuer Data Viewer — styled after the game's HUD (see ../docs/ui-style.md).
   Dark by default; [data-theme="light"] is a muted sepia paper variant.
   Fonts: Erika Ormig (the game's typewriter face, by Peter Wiegel, CC BY-ND) for display text only, never below 15 px;
   VT323 (Peter Hull, SIL OFL, licence in fonts/VT323-OFL.txt) for flip-counter digits; the system sans stack for everything dense
   (table cells, descriptions, labels). Both fonts are bundled so the viewer works offline. */
@font-face { font-family: "Erika Ormig"; src: url("fonts/ErikaOrmig-Regular.ttf") format("truetype"); font-weight: normal; font-style: normal; font-display: swap; }
@font-face { font-family: "VT323"; src: url("fonts/VT323-Regular.ttf") format("truetype"); font-weight: normal; font-style: normal; font-display: swap; }

:root {
  /* --fg-3 is the most muted text that still reads (≈5:1 on --bg and --bg-2, WCAG AA). */
  --bg: #0E0D0B; --bg-2: #171512; --bg-3: #1F1C18; --fg: #ECE6D8; --fg-2: #9A9283; --fg-3: #8A8272;
  --line: #2A2621; --line-2: #3A352E;
  --olive: #CBB83E; --olive-2: #D8C64A; --olive-dim: rgba(203, 184, 62, .14);
  --red: #C8352B; --orange: #E0632A; --green: #58C94A; --blue: #3A6FD8;
  --good: var(--green); --bad: #E4584C; --bad-2: #F2857A; --warn: var(--orange); --info: #7FA6F0; /* --bad-2: readable red for small labels (7.6:1 on --bg) */
  --sel: rgba(203, 184, 62, .12); --hover: rgba(255, 255, 255, .04);
  --counter-bg: #0A0A0A; --counter-hi: rgba(255, 255, 255, .06); --counter-fg: #F4F0E6; --counter-frame: #000; --counter-dim: #7A766C;
  --slot-bg: #0A0A0A; --slot-hi: #1E1A15; --slot-line: #000; --slot-edge: var(--line-2); --code-bg: #000; --code-fg: #CFC9BB;
  --shadow: 0 1px 2px rgba(0, 0, 0, .9); --panel-shadow: 0 8px 30px rgba(0, 0, 0, .6);
  --type: "Erika Ormig", "Special Elite", "Courier New", monospace;
  --lcd: "VT323", "Courier New", monospace;
  --sans: Roboto, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, Consolas, "Courier New", monospace;
  --radius: 3px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  /* All text tokens are ≥ 4.5:1 on --bg (#E6DDC6): fg-2 6.3, fg-3 4.9, olive 5.2, olive-2 4.6, green 5.0, orange 4.9, red 5.2, blue 5.6. */
  --bg: #E6DDC6; --bg-2: #F1EAD8; --bg-3: #E0D6BF; --fg: #2B2418; --fg-2: #554C3C; --fg-3: #655C4C;
  --line: #C9BDA3; --line-2: #B3A68B;
  --olive: #625A12; --olive-2: #6A6214; --olive-dim: rgba(98, 90, 18, .14);
  --red: #A62A22; --orange: #9E3E14; --green: #27682A; --blue: #2B4FA8;
  --good: var(--green); --bad: #A62A22; --bad-2: #8E2219; --warn: var(--orange); --info: #2B4FA8;
  --sel: rgba(98, 90, 18, .14); --hover: rgba(0, 0, 0, .04);
  /* The flip counter stays a dark device on paper, but warmer and with brighter digits so the dimmed zeros still read (≈6:1). */
  --counter-bg: #2A2219; --counter-hi: rgba(255, 255, 255, .08); --counter-fg: #FBF6EA; --counter-frame: #4A3F33; --counter-dim: #A89E8C;
  /* Inventory slots as framed parchment instead of the dark HUD cells */
  --slot-bg: #CFC3A6; --slot-hi: #DED3B8; --slot-line: #8A7F66; --slot-edge: #B3A68B; --code-bg: #F7F2E6; --code-fg: #2B2418;
  --shadow: none; --panel-shadow: 0 8px 30px rgba(60, 40, 10, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 13px/1.45 var(--sans); display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--olive-2); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 1px solid var(--olive); outline-offset: 1px; }
code, .mono { font-family: var(--mono); font-size: 12px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
h2 { font: 24px/1.2 var(--type); letter-spacing: .03em; text-shadow: var(--shadow); }
h3 { font: 15px/1.2 var(--type); color: var(--olive); text-transform: uppercase; letter-spacing: .12em; margin: 18px 0 6px; text-shadow: var(--shadow); }
h3:first-child { margin-top: 0; }
[hidden] { display: none !important; }

/* ---- "> Label" prompts (nav, buttons) ---- */
.prompt { font: 16px/1.2 var(--type); color: var(--fg); background: none; border: 0; padding: 4px 8px; letter-spacing: .03em; text-shadow: var(--shadow); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.prompt::before { content: ">"; color: var(--olive); }
.prompt:hover, .prompt.active { color: var(--olive-2); }
.prompt.muted { color: var(--fg-2); }

/* ---- flip counter ---- */
.counter { display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: var(--counter-frame); border: 1px solid var(--counter-frame); border-radius: 3px; vertical-align: middle; font-family: var(--lcd); line-height: 1; }
.counter .lbl, .stat-row .stat .counter .lbl { font: 15px/1 var(--type); color: var(--counter-fg); padding: 0 4px 0 4px; text-shadow: var(--shadow); letter-spacing: .05em; }
.counter .d { display: inline-block; min-width: 13px; padding: 1px 2px 0; text-align: center; background: var(--counter-bg); color: var(--counter-fg); font-size: 18px; border-radius: 2px; box-shadow: inset 0 1px 0 var(--counter-hi), inset 0 -1px 0 rgba(0, 0, 0, .8); }
.counter .d.z { color: var(--counter-dim); }
:root[data-theme="light"] .counter .lbl { text-shadow: 0 1px 1px rgba(0, 0, 0, .6); }
.counter.lg .d { min-width: 18px; font-size: 26px; padding: 2px 3px 0; }
.counter.lg .lbl { font-size: 18px; }

/* ---- status bar (white filled / red remainder) ---- */
.bar { display: inline-block; width: 100%; max-width: 220px; height: 3px; background: var(--red); position: relative; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: #F4F0E6; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; }
.bar-row .pct { font: 15px/1 var(--type); min-width: 84px; white-space: nowrap; text-shadow: var(--shadow); }
.bar-row .bar { flex: 0 1 200px; }
.bar-row .val { font: 18px/1 var(--lcd); white-space: nowrap; }
.bar-row .what { color: var(--fg-2); font-size: 12px; }

/* ---- olive tag ---- */
.tag { display: inline-block; border: 1px solid var(--olive); color: var(--olive-2); border-radius: 2px; padding: 0 6px; font: 11px/16px var(--sans); letter-spacing: .03em; white-space: nowrap; }
a.tag:hover { background: var(--olive-dim); }
.tag.on { background: var(--olive); color: var(--bg); } /* the active category filter; clicking it again clears the filter */
a.tag.on:hover { background: var(--olive-2); }

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 7px 16px; background: linear-gradient(var(--bg-2), var(--bg)); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { font: 22px/1 var(--type); color: var(--fg); letter-spacing: .06em; text-shadow: var(--shadow); margin-right: 8px; display: inline-flex; align-items: baseline; }
.brand span { color: var(--olive); margin-left: 7px; font: 11px var(--sans); letter-spacing: .18em; text-transform: uppercase; }
.tabs { display: flex; gap: 2px; }
/* Section tabs carry an item sprite instead of the "> " prompt marker, so each one has its own glyph. */
.tabs .tab::before { content: none; }
.tabs .tab { gap: 7px; padding: 3px 10px 3px 6px; border-bottom: 2px solid transparent; }
.tabs .tab.active { border-bottom-color: var(--olive); }
.nav-ico { width: 22px; height: 22px; object-fit: contain; opacity: .7; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .8)); transition: opacity .15s; }
.tab:hover .nav-ico, .tab.active .nav-ico { opacity: 1; }
.global-search { position: relative; flex: 1; max-width: 480px; margin-left: auto; }
.global-search input { width: 100%; }
input[type="search"], input[type="text"], select { background: rgba(0, 0, 0, .35); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 5px 9px; font: 13px var(--sans); color: var(--fg); }
:root[data-theme="light"] input[type="search"], :root[data-theme="light"] input[type="text"], :root[data-theme="light"] select { background: rgba(255, 255, 255, .5); }
input::placeholder { color: var(--fg-3); }
input[type="search"]:focus, select:focus { border-color: var(--olive); }
select option { background: var(--bg-2); color: var(--fg); }
.dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--panel-shadow); max-height: 60vh; overflow: auto; padding: 4px; }
.dropdown .dd-group { font: 11px var(--sans); text-transform: uppercase; letter-spacing: .14em; color: var(--olive); padding: 6px 10px 2px; }
.dropdown a { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 2px; color: var(--fg); font-size: 13px; }
.dropdown a:hover, .dropdown a.sel { background: var(--sel); color: var(--olive-2); }
.dropdown a small { color: var(--fg-3); margin-left: auto; }

/* ---- layout ---- */
.app { flex: 1; display: flex; min-height: 0; }
.loading { padding: 40px; color: var(--fg-2); }
.pane-list { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pane-detail { width: min(540px, 46vw); border-left: 1px solid var(--line); background: var(--bg-2); overflow: auto; padding: 18px 20px 40px; position: relative; }
/* Nothing selected: on a normal screen the pane stays open at full width so selecting an item does not shift the table. */
.pane-detail.empty { display: flex; align-items: center; justify-content: center; color: var(--fg-3); font: 18px var(--type); letter-spacing: .04em; text-shadow: var(--shadow); gap: 8px; }
.pane-detail.empty::before { content: ">"; color: var(--olive); }
/* Mid-size windows (table plus pane do not both fit): collapse to a thin vertical strip until an item is selected. */
@media (min-width: 901px) and (max-width: 1700px) {
  .pane-detail.empty { width: 34px; padding: 0; overflow: hidden; font-size: 15px; letter-spacing: .08em; writing-mode: vertical-rl; white-space: nowrap; }
  .pane-detail.empty::before { margin-bottom: 6px; }
}
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .pane-detail { width: auto; border-left: 0; border-top: 1px solid var(--line); max-height: 60vh; }
  .pane-detail.empty { display: none; }
  /* Selected item: the detail becomes its own full-screen page with the Close prompt as the way back. */
  .pane-detail:not(.empty) { position: fixed; inset: 0; z-index: 30; max-height: none; border: 0; box-shadow: var(--panel-shadow); }
  .topbar { flex-wrap: wrap; }
  .global-search { max-width: none; order: 5; flex-basis: 100%; }
  /* Side lists (stations, spawn tables) stack above the content instead of squeezing it. */
  .split { flex-direction: column; }
  .split .side-list { width: auto; max-height: 32vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .split .side-list a { padding: 4px 8px; }
  .split .content { padding: 12px 12px 40px; }
}
/* Top row of the detail pane: ID / sprite path left, Close prompt right. Keeping Close out of the title row means long
   single-word names ("Antidepressants") get the full pane width instead of running under the button. */
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -8px -10px 6px 0; min-height: 28px; }
.detail-top .sub { font-size: 11px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.close-btn { flex: none; }
.close-btn::before { content: "✕"; font-family: var(--sans); font-size: 13px; font-weight: 700; }
/* Theme toggle: sun to switch to the paper theme, moon to switch back. */
#theme-toggle::before { content: "☀"; font-family: "Segoe UI Symbol", "Noto Sans Symbols", var(--sans); font-size: 15px; }
:root[data-theme="light"] #theme-toggle::before { content: "☾"; color: var(--fg); }
.filters { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.filters input[type="search"] { min-width: 220px; flex: 1; max-width: 360px; }
.filters label.check { display: inline-flex; align-items: center; gap: 4px; color: var(--fg-2); white-space: nowrap; font-size: 12px; }
.filters label.check input { accent-color: var(--olive); }
.filters .count { color: var(--fg-2); margin-left: auto; white-space: nowrap; font-family: var(--lcd); font-size: 17px; }

/* ---- tables ---- */
.table-wrap { flex: 1; overflow: auto; }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th, table.grid td { padding: 2px 9px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
table.grid th { position: sticky; top: 0; background: var(--bg-3); color: var(--fg-2); font: 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; user-select: none; z-index: 1; border-bottom: 1px solid var(--line-2); }
table.grid th:hover { color: var(--olive-2); }
table.grid th.sorted { color: var(--olive); }
table.grid th.sorted::after { content: " ▲"; font-size: 8px; } table.grid th.sorted.desc::after { content: " ▼"; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.num { font-family: var(--lcd); font-size: 17px; line-height: 1; }
table.grid tr.row { cursor: pointer; }
table.grid tr.row:hover { background: var(--hover); }
table.grid tr.row.sel { background: var(--sel); box-shadow: inset 2px 0 0 var(--olive); }
table.grid td.name { font: 16px/1.1 var(--type); min-width: 200px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; text-shadow: var(--shadow); }
table.grid td.name a { color: var(--fg); }
table.grid td.name a:hover { color: var(--olive-2); }
table.grid td.cats { max-width: 300px; overflow: hidden; }
table.grid td.cats .tag { margin-right: 3px; }
table.grid td.dim { color: var(--fg-3); }
.pos { color: var(--good); } .neg { color: var(--bad); }

/* ---- icon slots ---- */
/* Inventory-slot look: sunken dark cell with a worn inner edge */
.icon { width: 28px; height: 28px; border: 1px solid var(--slot-line); background: radial-gradient(ellipse at 50% 35%, var(--slot-hi) 0%, var(--slot-bg) 72%); box-shadow: inset 0 0 0 1px var(--slot-edge), inset 0 3px 8px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .5); display: inline-flex; align-items: center; justify-content: center; color: var(--fg-2); font: 11px var(--type); overflow: hidden; flex-shrink: 0; vertical-align: middle; border-radius: 2px; }
:root[data-theme="light"] .icon { box-shadow: inset 0 0 0 1px var(--slot-edge), inset 0 2px 6px rgba(60, 40, 10, .35), 0 0 0 1px rgba(60, 40, 10, .15); }
.icon img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.icon.lg { width: 72px; height: 72px; font-size: 26px; }
.icon.lg img { padding: 4px; }
.icon.sm { width: 20px; height: 20px; font-size: 9px; }

/* ---- detail ---- */
.detail-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.detail-head > div { min-width: 0; }
.detail-head .title { font: 28px/1.1 var(--type); text-shadow: var(--shadow); letter-spacing: .02em; overflow-wrap: anywhere; }
.sub { color: var(--fg-3); font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.chip { display: inline-block; border: 1px solid var(--line-2); border-radius: 2px; padding: 0 7px; font: 12px/18px var(--sans); color: var(--fg-2); }
.chip.a { border-color: var(--olive); color: var(--olive-2); }
.chip.warn { border-color: var(--orange); color: var(--orange); }
.chip.info { border-color: var(--blue); color: var(--info); }
a.chip:hover { background: var(--olive-dim); }
.desc { font-style: italic; color: var(--fg-2); margin: 8px 0 12px; white-space: pre-wrap; font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: 13px; }
.kv .k { color: var(--fg-2); }
.kv .v { font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.kv .v .chip, .kv .v .tag { line-height: 16px; }
.found-list .chip { margin-left: 5px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 10px 0 8px; align-items: flex-end; }
.stat-row .stat { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.stat-row .stat .lbl { color: var(--fg-2); font: 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.stat-row .stat b { font: 28px/1 var(--lcd); font-weight: 400; height: 34px; display: flex; align-items: center; gap: 8px; }
.stat-row .stat b .chip { font: 11px/16px var(--sans); }
.fx { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.fx .eff { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--olive-2); }
/* HUD sprites from the game next to effect names, stat labels, block headings, table headers and recipe facts.
   They carry the game's own colours; the drop shadow lifts them off the dark surfaces as in the HUD. */
img.hud { height: 16px; width: auto; max-width: 20px; object-fit: contain; vertical-align: -3px; margin-right: 4px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .8)); }
.fx .eff img.hud { height: 18px; margin-right: 0; }
svg.hud { height: 16px; width: 16px; vertical-align: -3px; color: #E8E2D4; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .8)); }
.stat-row .stat .lbl svg.hud { height: 13px; width: 13px; vertical-align: -2px; margin-right: 3px; }
.fx .eff svg.hud { height: 17px; width: 17px; }
:root[data-theme="light"] svg.hud { color: #4A4136; filter: drop-shadow(0 1px 1px rgba(60, 40, 10, .25)); }
h3 img.hud { height: 15px; vertical-align: -2px; margin-right: 6px; }
.stat-row .stat .lbl img.hud { height: 13px; vertical-align: -2px; margin-right: 3px; }
:root[data-theme="light"] img.hud { filter: drop-shadow(0 1px 1px rgba(60, 40, 10, .25)); }

/* ---- detail pane sections: raised panels with a header strip, as on the in-game inventory screen ---- */
.sec { background: rgba(255, 255, 255, .025); border: 1px solid var(--line); border-radius: 3px; padding: 7px 12px 10px; margin: 10px 0; }
:root[data-theme="light"] .sec { background: rgba(0, 0, 0, .035); }
.sec > h3 { display: flex; align-items: center; margin: 0 0 8px; padding: 2px 0 6px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.sec > h3::after { content: "▲"; margin-left: auto; color: var(--olive); font-size: 9px; opacity: .8; transition: transform .15s; }
.sec.closed > h3 { margin-bottom: 0; padding-bottom: 2px; border-bottom: 0; }
.sec.closed > h3::after { transform: rotate(180deg); }
.sec.closed > :not(h3) { display: none; }
.sec .recipe-card:last-child { margin-bottom: 0; }
.fx .eff b { font: 18px/1 var(--lcd); font-weight: 400; color: var(--fg); }
.fx .eff.ok b { color: var(--green); } .fx .eff.bad b { color: var(--bad); }

.recipe-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; margin-bottom: 6px; background: rgba(0, 0, 0, .18); }
:root[data-theme="light"] .recipe-card { background: rgba(255, 255, 255, .25); }
.recipe-card.sel { border-color: var(--olive); box-shadow: inset 2px 0 0 var(--olive); }
.recipe-card .rc-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.recipe-card .rc-head a.rc-name { font: 16px/1.1 var(--type); color: var(--fg); text-shadow: var(--shadow); }
.recipe-card .rc-head a.rc-name:hover { color: var(--olive-2); }
.recipe-card .rc-head .station { font: 11px var(--sans); color: var(--olive); letter-spacing: .1em; text-transform: uppercase; }
.recipe-card .rc-head .rid { color: var(--fg-3); font-size: 11px; margin-left: auto; }
.rc-io { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin: 5px 0 4px; }
.rc-io .arrow { color: var(--olive); }
.rc-io .fail-sep { color: var(--bad-2); font-size: 13px; margin: 0 2px; }
.rc-io .io { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-2); border-radius: 2px; padding: 1px 6px 1px 2px; color: var(--fg); font-size: 12px; }
/* Result and fail outputs are two labelled groups: the result group gets the olive HUD colour and a solid frame,
   the fail group a red dashed frame and dimmed chips, so the two never read as the same kind of thing. */
.rc-io .io-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 3px 6px 3px 4px; border-radius: 3px; border: 1px solid transparent; }
.rc-io .io-group.ok { border-color: rgba(203, 184, 62, .35); background: var(--olive-dim); }
.rc-io .io-group.fail { border-color: var(--red); border-style: dashed; background: rgba(200, 53, 43, .08); }
.rc-io .io-lbl { font: 600 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; padding: 0 3px; }
.rc-io .io-group.ok .io-lbl { color: var(--olive-2); }
.rc-io .io-group.fail .io-lbl { color: var(--bad-2); }
.rc-io .io.out { border-color: var(--olive); }
.rc-io .io.fail { border-color: var(--bad); }
:root[data-theme="light"] .rc-io .io-group.ok { border-color: rgba(98, 90, 18, .4); }
.rc-io .io .q { color: var(--fg-2); font-family: var(--lcd); font-size: 15px; }
.rc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--fg-2); }
.rc-meta .ml { color: var(--fg-2); letter-spacing: .03em; }
.rc-meta .mv { color: var(--fg); }

.found-list { columns: 2; column-gap: 16px; font-size: 13px; }
.found-list div { break-inside: avoid; padding: 1px 0; }
.rarity { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; margin-left: 5px; }
.rarity.c { color: var(--olive); } .rarity.r { color: var(--bad); }
details.raw { margin-top: 18px; }
details.raw summary { color: var(--fg-2); cursor: pointer; }
details.raw pre { background: var(--code-bg); color: var(--code-fg); padding: 10px; border: 1px solid var(--line); overflow: auto; font-size: 11px; max-height: 400px; }

/* ---- side list (stations, spawn tables) ---- */
.split { display: flex; flex: 1; min-height: 0; }
.side-list { width: 300px; border-right: 1px solid var(--line); overflow: auto; background: var(--bg-2); padding: 6px; flex-shrink: 0; }
.side-list a { display: flex; justify-content: flex-start; align-items: center; gap: 4px; padding: 2px 8px; color: var(--fg); font: 15px/1.3 var(--type); text-shadow: var(--shadow); }
.side-list a::before { content: ">"; color: transparent; flex: none; text-shadow: none; }
.side-list a:hover { color: var(--olive-2); }
.side-list a:hover::before, .side-list a.active::before { color: var(--olive); }
.side-list a.active { color: var(--olive-2); background: var(--sel); }
.side-list a small { margin-left: auto; color: var(--fg-3); font: 15px var(--lcd); text-shadow: none; }
.side-list .group { font: 11px var(--sans); color: var(--olive); text-transform: uppercase; letter-spacing: .14em; padding: 10px 8px 2px; }
.content { flex: 1; min-width: 0; overflow: auto; padding: 14px 18px 40px; }
.content h2 { margin-bottom: 8px; }
.content h2 .h2-id { font: 12px var(--mono); color: var(--fg-3); text-shadow: none; }
.content .intro { margin-bottom: 10px; }
.filters.bare { padding: 0 0 10px; border: 0; background: none; }
.side-search { padding: 4px; }
.side-search input { width: 100%; }
.side-kinds { padding: 2px 0; display: flex; gap: 2px; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 5px; }
.item-grid a { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border: 1px solid var(--line); color: var(--fg); background: rgba(0, 0, 0, .18); font: 15px/1.2 var(--type); text-shadow: var(--shadow); }
:root[data-theme="light"] .item-grid a { background: rgba(255, 255, 255, .25); }
.item-grid a:hover { border-color: var(--olive); color: var(--olive-2); }
.item-grid a .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-grid a .v { margin-left: auto; color: var(--fg-3); font: 15px var(--lcd); white-space: nowrap; text-shadow: none; }
/* Loot weight: the same id repeated n times in the table's list */
.item-grid a .w, .found-list .w { font: 15px/1 var(--lcd); color: var(--olive-2); white-space: nowrap; text-shadow: none; }
.item-grid a .w { margin-left: 6px; }
.found-list .w { margin-left: 5px; }
.muted { color: var(--fg-3); }
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 6px 16px; border-top: 1px solid var(--line); color: var(--fg-2); font-size: 12px; background: var(--bg-2); }

/* ---- tenement upgrades: one card per tier, like a recipe card; money as the HUD's OC / RM flip counters ---- */
.upg-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 6px; background: rgba(0, 0, 0, .18); }
:root[data-theme="light"] .upg-card { background: rgba(255, 255, 255, .25); }
.upg-card.sel { border-color: var(--olive); box-shadow: inset 2px 0 0 var(--olive); }
.upg-card.off { border-style: dashed; } /* no contractor builds this tier */
.uc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.uc-head .tier-no { font: 22px/1 var(--lcd); color: var(--olive-2); min-width: 12px; }
.uc-head .uc-name { font: 18px/1.1 var(--type); color: var(--fg); text-shadow: var(--shadow); letter-spacing: .02em; }
.uc-head .uc-name:hover { color: var(--olive-2); }
.uc-head .rid { color: var(--fg-3); font-size: 11px; margin-left: auto; }
/* Tier progress as the HUD's thin bar: white = reached, red = still ahead */
.pips { display: inline-flex; gap: 3px; margin-left: 2px; }
.pips i { width: 14px; height: 3px; background: var(--red); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.pips i.on { background: #F4F0E6; }
:root[data-theme="light"] .pips i.on { background: var(--fg); }
.uc-cost { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 16px; margin: 7px 0 6px; }
.uc-cost .rc-io { margin: 0; align-self: center; }
.uc-money { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: flex-end; }
.uc-pay { display: inline-flex; flex-direction: column; gap: 2px; }
.uc-pay .cap { color: var(--fg-2); font: 10px var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.upg-total { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 4px 0 8px; }
.intro .mv { color: var(--fg); }
.upg-use { padding: 3px 0; }
.upg-use > a { font: 15px/1.2 var(--type); text-shadow: var(--shadow); }
.upg-use .chips { margin: 3px 0 2px; }
.upg-use .chip b { font: 15px/1 var(--lcd); font-weight: 400; color: var(--fg); }
/* Contractor matrix on the overview: a static table inside the scrolling content column */
.split { min-width: 0; } /* let wide content (the matrix) scroll inside .content instead of widening the page */
.content .table-wrap.static { flex: none; overflow-x: auto; margin-bottom: 10px; }
.matrix th { position: static; cursor: default; }
.matrix th:hover { color: var(--fg-2); }
.matrix td { font-size: 13px; }
.matrix tr.grp td { font: 11px var(--sans); color: var(--olive); text-transform: uppercase; letter-spacing: .14em; padding-top: 12px; border-bottom: 0; }
/* Four section tabs no longer fit one phone-width row: let them wrap instead of widening the page. */
@media (max-width: 900px) { .tabs { flex-wrap: wrap; min-width: 0; } }

/* ---- vendors (spawn-table view and item panel) ---- */
.side-list a.test, .side-list a.dev { opacity: .6; } /* vendors on the test map, the Debug recipe station */
.side-list a .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* long names: one line, full name in the tooltip */
.side-list a .tag { flex: none; font-size: 11px; }
.vendor-kv { margin: 8px 0 4px; }
.vendor-kv .day { white-space: nowrap; margin-right: 6px; }
.content h3 .h3-link { font: 12px var(--sans); text-transform: none; letter-spacing: 0; color: var(--fg-2); margin-left: 8px; text-shadow: none; }
.content h3 .h3-link:hover { color: var(--olive-2); }
.content h4 { font: 11px var(--sans); color: var(--fg-2); text-transform: uppercase; letter-spacing: .12em; margin: 10px 0 5px; }
.obj-path { margin-top: 18px; overflow-wrap: anywhere; }
.vendor-list { font-size: 13px; }
.vendor-list div { display: flex; align-items: baseline; gap: 6px; padding: 1px 0; flex-wrap: wrap; }
.vendor-list .vp { margin-left: auto; font: 16px/1 var(--lcd); color: var(--fg); white-space: nowrap; }
.side-kinds { flex-wrap: wrap; } /* four filters: all / vendors / containers / unused */
/* explained labels: a help cursor shows that hovering gives the tooltip */
.side-list .group[title], .tag[title], .content [title].mv, .kv .k[title], .h3-link[title] { cursor: help; }
.side-list .group[title] { text-decoration: underline dotted; text-underline-offset: 3px; }
