/*
 * Dashboard themes. This file is the only place colors live.
 *
 * One theme for now: Dark. The server reads this file at start-up; every [data-theme="id"] block with a
 * --label is a theme. With two or more, a theme picker shows in the footer (the first block is the
 * default unless WEB_THEME names another). To change the look, edit the values below and restart the
 * web container.
 *
 * Tokens (all required):
 *   --bg            page background            --surface      cards, sidebar, top bar
 *   --raised        hover, chips, table heads  --inset        inputs, wells, code
 *   --line          hairline borders           --line-strong  control borders
 *   --ink           main text                  --ink-dim      secondary text
 *   --ink-muted     labels and hints           --accent       buttons, active items, links
 *   --on-accent     text on --accent           --ok --warn --bad --info   status colors
 *   --up --down     price rising and falling   --chart1..3     chart series
 *   --shadow-1 --shadow-2   depth
 *   color-scheme    light or dark, for native scrollbars and inputs
 *
 * Optional: --mc-0 .. --mc-f, the game's sixteen text colors (item rarity, perk text), set right below.
 */

:root {
  --mc-0: #7a7f87;
  --mc-1: #5b6cff;
  --mc-2: #2fbf4a;
  --mc-3: #23c4c4;
  --mc-4: #e04848;
  --mc-5: #c25ad6;
  --mc-6: #ffaa00;
  --mc-7: #aaaaaa;
  --mc-8: #8a8f98;
  --mc-9: #6f7dff;
  --mc-a: #55ff55;
  --mc-b: #55ffff;
  --mc-c: #ff5555;
  --mc-d: #ff55ff;
  --mc-e: #ffff55;
  --mc-f: #ffffff;
}

[data-theme="dark"] {
  --label: "Dark";
  --bg: #0b0d10;
  --surface: #121519;
  --raised: #1a1e24;
  --inset: #08090b;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --ink: #e8ebef;
  --ink-dim: rgba(232, 235, 239, 0.74);
  --ink-muted: rgba(232, 235, 239, 0.5);
  --accent: #4d8dff;
  --on-accent: #ffffff;
  --up: #22b65e;
  --down: #e5484d;
  --ok: #22b65e;
  --warn: #e0a23a;
  --bad: #e5484d;
  --info: #38bdf8;
  --chart1: #4d8dff;
  --chart2: #f0a43a;
  --chart3: #a78bfa;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 10px 28px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

.swatch-dark{--sw-accent:#4d8dff;--sw-surface:#121519}
/*
 * SOVS dashboards. Colors come from themes.css (served first in the same file); this file only uses
 * the tokens. Motion is short and gentle, and turns off for people who ask their system for less.
 */

:root, [data-theme] {
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-border: color-mix(in srgb, var(--accent) 42%, transparent);
  --accent-ink: color-mix(in srgb, var(--accent) 84%, var(--ink));
  --ok-soft: color-mix(in srgb, var(--ok) 14%, transparent);
  --warn-soft: color-mix(in srgb, var(--warn) 14%, transparent);
  --bad-soft: color-mix(in srgb, var(--bad) 13%, transparent);
  --info-soft: color-mix(in srgb, var(--info) 14%, transparent);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --radius: 12px;
  --radius-ctl: 8px;
  --radius-sm: 6px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 120ms;
  --mid: 180ms;
  --slow: 260ms;
  --side-w: 256px;
  --top-h: 56px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* --- Base ------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; font: 14.5px/1.55 var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color var(--slow) var(--ease), color var(--slow) var(--ease);
}
a { color: var(--accent-ink); text-decoration-color: var(--accent-border); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 1.1rem; line-height: 1.2; }
h2 { font-size: .95rem; font-weight: 650; margin: 0 0 .85rem; letter-spacing: -0.005em; }
h3 { font-size: .92rem; font-weight: 650; margin: 1.1rem 0 .5rem; }
p { margin: 0 0 .8rem; }
::selection { background: var(--accent-soft); }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .9em; }
table, .num, .stat-value { font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.muted { color: var(--ink-muted); }
.small { font-size: .85rem; }
.break { word-break: break-all; }
.lede { color: var(--ink-dim); max-width: 62ch; margin-bottom: 1.25rem; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: .5rem .8rem; border-radius: var(--radius-ctl); }
.skip:focus { left: 8px; }

/* --- Shell: sidebar + frame ------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: .25rem;
  background: var(--surface); border-right: 1px solid var(--line); padding: 12px 12px 14px; overflow-y: auto; z-index: 40;
}
.side-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 4px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-mark {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; font-weight: 800; font-size: 15px;
  color: var(--on-accent); background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #000));
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-name { display: grid; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name small { font-weight: 500; font-size: 11.5px; color: var(--ink-muted); letter-spacing: .02em; }
.side-nav { display: grid; gap: 2px; }
.side-area { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); margin: 14px 0 4px; padding: 0 10px; }
.side-item {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 10px; border-radius: var(--radius-ctl);
  color: var(--ink-dim); text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.side-item:hover { background: var(--raised); color: var(--ink); }
.side-item:active { transform: scale(.985); }
.side-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.side-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
  animation: grow var(--slow) var(--ease-out);
}
.side-item .ic { flex: none; }
/* A page row that opens to list the page's sections. */
.side-row { position: relative; display: flex; align-items: center; }
.side-row > .side-item { flex: 1; min-width: 0; padding-right: 38px; }
.side-chev {
  position: absolute; right: 4px; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 30px; height: 30px; min-height: 0; padding: 0;
  border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); cursor: pointer;
}
.side-chev:hover { background: var(--raised); color: var(--ink); filter: none; box-shadow: none; }
.side-chev .ic { width: 15px; height: 15px; transition: transform var(--mid) var(--ease-out); }
.side-group.open .side-chev .ic { transform: rotate(90deg); }
.side-sub { display: none; gap: 1px; margin: 2px 0 6px 19px; padding-left: 10px; border-left: 1px solid var(--line); }
.side-group.open .side-sub { display: grid; animation: rise var(--mid) var(--ease-out); }
.side-subitem {
  display: flex; align-items: center; min-height: 32px; padding: 5px 10px; border-radius: 7px; color: var(--ink-muted); text-decoration: none; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.side-subitem:hover { background: var(--raised); color: var(--ink); }
.side-subitem[aria-current="location"] { color: var(--accent-ink); background: color-mix(in srgb, var(--accent-soft) 70%, transparent); font-weight: 600; }
.page-wide [id] { scroll-margin-top: calc(var(--top-h) + 14px); }
.side-label { display: grid; min-width: 0; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-label small { font-size: 11px; color: var(--ink-muted); font-weight: 500; }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.side-form { display: block; margin: 0; }
button.side-btn { width: 100%; background: none; border: 0; justify-content: flex-start; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink-dim); }
button.side-btn:hover { background: var(--bad-soft); color: var(--bad); }
.icon-btn.side-close { display: none; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.frame { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.scrim { display: none; }

/* --- Top bar ---------------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: var(--top-h); padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; flex: 1; }
.crumb-site { color: var(--ink-muted); white-space: nowrap; }
.crumb-sep { color: var(--ink-muted); opacity: .6; }
.crumb-here { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-search { position: relative; display: flex; align-items: center; width: min(280px, 32vw); }
.top-search .ic { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--ink-muted); pointer-events: none; }
.top-search input { width: 100%; padding-left: 34px; padding-right: 30px; min-height: 36px; background: var(--inset); }
.top-search kbd { position: absolute; right: 8px; font-size: 11px; color: var(--ink-muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; line-height: 17px; }
.top-search input:focus + kbd { opacity: 0; }
.top-links { display: flex; gap: .5rem; align-items: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: var(--radius-ctl);
  background: transparent; border: 1px solid transparent; color: var(--ink-dim); cursor: pointer;
}
.icon-btn:hover { background: var(--raised); color: var(--ink); }
.menu-btn { display: none; margin-left: -8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink-dim); white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-ok { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.chip-ok .dot { animation: pulse 2s var(--ease) infinite; }
.chip-warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip-bad { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* Top loading bar for in-app navigation. */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 90; background: var(--accent); box-shadow: 0 0 8px var(--accent); opacity: 0; transition: width 400ms var(--ease-out), opacity 300ms var(--ease); }
.progress.on { opacity: 1; width: 70%; transition: width 6s cubic-bezier(.1, .7, .2, 1), opacity var(--fast) var(--ease); }
.progress.done { opacity: 0; width: 100%; transition: width var(--mid) var(--ease), opacity 350ms var(--ease) 120ms; }

/* --- Page ------------------------------------------------------------------------------------- */
.page { width: 100%; max-width: 2200px; margin: 0 auto; padding: 18px clamp(10px, 1.6vw, 28px) 24px; flex: 1; }
.page-simple { max-width: 1120px; }
.page-wide { max-width: none; padding: 10px clamp(8px, 0.9vw, 18px) 16px; }
.page > * { animation: rise var(--slow) var(--ease-out) both; }
.page > :nth-child(2) { animation-delay: 30ms; }
.page > :nth-child(3) { animation-delay: 60ms; }
.page > :nth-child(4) { animation-delay: 90ms; }
.page > :nth-child(5) { animation-delay: 120ms; }
.page > :nth-child(n+6) { animation-delay: 150ms; }
.page.soft > * { animation: none; }
.foot { display: grid; gap: 8px; padding: 12px clamp(10px, 1.2vw, 22px) 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-muted); }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.foot-site strong { color: var(--ink); font-weight: 750; margin-right: 2px; }
.foot-legal { margin: 0; font-size: 11px; line-height: 1.5; opacity: .7; }
button.theme-opt { gap: 6px; }
.theme-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sw-accent); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; min-width: 0;
  box-shadow: var(--shadow-1); transition: border-color var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
}
.card:hover { border-color: var(--line-strong); }
.card > h2:first-child { display: flex; align-items: center; gap: .5rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 0 16px; }
/* Headline numbers: one open strip, a hairline above and below, no box around each number. */
.stats, .figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px 32px; margin: 2px 0 20px; padding: 14px 0 16px; border-block: 1px solid var(--line); }
.card .stats { border: 0; padding: 0; margin: 0; }
.stat { min-width: 0; }
.stat-label { color: var(--ink-muted); font-size: 12.5px; font-weight: 550; }
.stat-value { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-top: 2px; }
.stat-note { color: var(--ink-muted); font-size: 12px; margin-top: 2px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-muted); font-weight: 600; font-size: 12px; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background-color var(--fast) var(--ease); }
tbody tr:hover { background: color-mix(in srgb, var(--raised) 70%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
td a { font-weight: 550; }
.num { text-align: right; }

/* Badges and messages */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-bad { color: var(--bad); background: var(--bad-soft); }
.badge-info { color: var(--info); background: var(--info-soft); }
.flash { position: relative; padding: 11px 14px 11px 16px; border-radius: var(--radius-ctl); margin: 0 0 16px; border: 1px solid; animation: drop var(--slow) var(--ease-out) both; }
.flash::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: var(--radius-ctl) 0 0 var(--radius-ctl); background: currentColor; }
.flash-ok { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-error { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.flash a { color: inherit; font-weight: 650; }

/* --- Forms and buttons ------------------------------------------------------------------------ */
input, select, textarea, button, .button { font: inherit; font-size: 16px; }
input, select, textarea {
  background: var(--inset); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-ctl); padding: 8px 11px; min-height: 40px; max-width: 100%;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink) 28%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-border); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
select, .tool-select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%), linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
textarea { width: 100%; resize: vertical; }
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; min-height: 20px; padding: 0; border-radius: 5px; display: inline-grid; place-items: center; cursor: pointer;
}
input[type="checkbox"]::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) scale(0); margin-top: -2px; transition: transform var(--fast) var(--ease-out); }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { transform: rotate(-45deg) scale(1); }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; padding: 8px 16px; border-radius: var(--radius-ctl);
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 650; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), filter var(--fast) var(--ease);
}
button:hover, .button:hover { filter: brightness(1.08); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 22%, transparent); }
button:active, .button:active { transform: translateY(1px) scale(.985); }
button.secondary, .button.secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
button.secondary:hover, .button.secondary:hover { background: var(--raised); filter: none; }
.button.small, button.small { min-height: 36px; padding: 6px 13px; font-size: 13.5px; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.danger:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--bad) 25%, transparent); }
button.link { background: none; border: 0; color: var(--accent-ink); padding: 4px 6px; min-height: 32px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent-border); box-shadow: none; filter: none; }
button.link.danger { color: var(--bad); }
button:disabled { opacity: .55; cursor: default; transform: none; filter: none; box-shadow: none; }
button:focus-visible, a:focus-visible, .button:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--focus); }
.stack { display: grid; gap: 14px; max-width: 440px; }
.stack label { display: grid; gap: 6px; font-weight: 550; font-size: 13.5px; color: var(--ink-dim); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row label { display: inline-flex; gap: 6px; align-items: center; }
form.inline { display: inline; }
label.check { display: flex; gap: 9px; align-items: center; font-weight: 500; color: var(--ink); cursor: pointer; }
.narrow { max-width: 440px; margin: 4vh auto 2rem; }
.page-simple .narrow { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 28px 24px; box-shadow: var(--shadow-2); }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-muted); margin: 18px 0; font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.choices { display: grid; gap: 10px; margin: 16px 0; }
.qr { background: #fff; padding: 10px; border-radius: 12px; width: 220px; max-width: 100%; box-shadow: var(--shadow-2); }
.qr svg { display: block; width: 100%; height: auto; }
.codes { columns: 2; padding-left: 1.2rem; font-size: 1.02rem; font-family: var(--mono); }
details summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: .4rem; color: var(--ink-dim); font-weight: 550; }
details summary:hover { color: var(--ink); }
details[open] > :not(summary) { animation: rise var(--mid) var(--ease-out); }


/* --- Charts ----------------------------------------------------------------------------------- */
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-muted); font-size: 11px; font-family: var(--font); }
.chart .line { stroke-width: 2.2; stroke: var(--chart1); stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.chart.draw .line { animation: draw 1100ms var(--ease-out) both; }
.chart .line-1, .chart .line-bad { stroke: var(--chart2); }
.chart .line-2 { stroke: var(--chart3); }
.chart figcaption { font-size: 12.5px; display: flex; gap: 1rem; flex-wrap: wrap; color: var(--ink-dim); margin-top: 6px; }
.key::before { content: ""; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--chart1); }
.key-1::before, .key-bad::before { background: var(--chart2); }
.key-2::before { background: var(--chart3); }
.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(74px, 28%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-dim); }
.bar-track { background: var(--raised); border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--chart1) 70%, transparent), var(--chart1)); transition: width 800ms var(--ease-out); }
.bar-value { color: var(--ink-muted); min-width: 3ch; text-align: right; }

/* --- Public dashboard: full width, bento grid ------------------------------------------------- */
body.wide {
  background:
    radial-gradient(1100px 520px at 8% -8%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 62%),
    radial-gradient(900px 480px at 96% -4%, color-mix(in srgb, var(--info) 9%, transparent), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
}
.top-anchors { display: flex; gap: 2px; margin: 0 auto 0 24px; }
.topbar-simple { padding: 0 clamp(10px, 1.2vw, 22px); height: 50px; }
.top-anchors a { color: var(--ink-dim); text-decoration: none; font-size: 13.5px; font-weight: 550; padding: 7px 12px; border-radius: var(--radius-ctl); transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.top-anchors a:hover { background: var(--raised); color: var(--ink); }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top-h) + 12px); }

/* Top of the public page: the bazaar index, the day's numbers, the mayor. */
.top { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; align-items: stretch; margin: 0 0 10px; }
.top > .card { margin: 0; display: flex; flex-direction: column; }
.top-index { grid-column: span 5; }
.top-stats { grid-column: span 4; }
.top > .mayor { grid-column: span 3; }
.top-index .tchart { flex: 1 0 240px; }
.top-foot { display: flex; gap: 14px; align-items: center; margin-top: 8px; font-size: 12.5px; }
.ledger { list-style: none; margin: 0; padding: 0; display: grid; }
.ledger-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label spark" "value spark" "note spark"; column-gap: 14px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.ledger-row:first-child { border-top: 0; padding-top: 0; }
.ledger-label { grid-area: label; color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.ledger-value { grid-area: value; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ledger-note { grid-area: note; color: var(--ink-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger-spark { grid-area: spark; width: 120px; height: 34px; }
.ledger-spark:empty { width: 0; }
/* The "i" next to a title: hover, focus or tap for what it shows and where the numbers come from. */
.info {
  display: inline-grid; place-items: center; width: 16px; height: 16px; min-height: 0; min-width: 0; flex: none; aspect-ratio: 1; margin: 0 0 0 7px; padding: 0; vertical-align: 2px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-muted); font: italic 700 10.5px/1 Georgia, serif; cursor: help;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.info:hover, .info:focus-visible, .info[aria-expanded="true"] { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft, transparent); }
.info::before { content: ""; position: absolute; inset: -12px; }
.info { position: relative; }
.tip-src { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 11.5px; }
.tip-src b { color: var(--ink-dim); font-weight: 650; }
.tip-text { white-space: normal; }
.map-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.seg-sm .seg-btn { padding: 4px 10px; font-size: 12px; min-height: 30px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; animation: pulse 2s var(--ease) infinite; }

.mayor {
  position: relative; overflow: hidden; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface) 55%);
  border: 1px solid var(--accent-border); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow-2);
}
.mayor::after { content: ""; position: absolute; right: -60px; top: -60px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent); pointer-events: none; }
.mayor-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ic-mayor { --ic: 50px; --rc: var(--accent); border-radius: 13px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), 0 4px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.ic-mayor > img { inset: 9%; width: 82%; height: 82%; border-radius: 4px; }
.mayor-kicker { font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.mayor-name { font-size: 1.35rem; font-weight: 750; letter-spacing: -0.01em; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.perks li { display: grid; gap: 1px; font-size: 12.5px; color: var(--ink-muted); padding-left: 12px; border-left: 2px solid var(--accent-border); }
.perks strong { color: var(--ink); font-size: 13px; font-weight: 650; }
.minister { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--ink-muted); }
.minister strong { color: var(--ink-dim); }

.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; align-items: start; }
.bento > .card { margin: 0; height: 100%; display: flex; flex-direction: column; }
.bento > * { animation: rise var(--slow) var(--ease-out) both; }
.bento > :nth-child(n+2) { animation-delay: 25ms; } .bento > :nth-child(n+4) { animation-delay: 50ms; } .bento > :nth-child(n+7) { animation-delay: 80ms; }
.bento > :nth-child(n+10) { animation-delay: 110ms; } .bento > :nth-child(n+14) { animation-delay: 140ms; }
.page.soft .bento > * { animation: none; }
.s2 { grid-column: span 2; } .s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s9 { grid-column: span 9; } .s12 { grid-column: 1 / -1; }
.section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 -2px; padding-bottom: 5px; border-bottom: 1px solid var(--line-strong); }
.section-head h2 { font-size: 1.02rem; font-weight: 800; letter-spacing: -0.01em; margin: 0; }
.section-head p { margin: 0; color: var(--ink-muted); font-size: 13px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { margin: 0; font-size: .82rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-dim); }
.card-sub { margin: 3px 0 0; color: var(--ink-muted); font-size: 12.5px; max-width: 72ch; }
.card .empty { margin: auto 0; padding: 18px 0; text-align: center; }
.list-head { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 4px 0 6px; }
.list-head ~ .list-head { margin-top: 14px; }
.big-read { display: flex; align-items: center; gap: 10px; }
.big-read strong { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.bento > .figures { margin: 0; grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1360px) { .bento > .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fig { min-width: 0; display: grid; grid-template: "label label" auto "value spark" auto "note note" auto / auto minmax(0, 1fr); column-gap: 14px; align-items: end; }
.fig-label { grid-area: label; color: var(--ink-muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig-value { grid-area: value; font-size: clamp(1.4rem, 1.6vw, 1.85rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.fig-spark { grid-area: spark; height: 28px; max-width: 120px; margin-bottom: 4px; }
.fig-note { grid-area: note; margin-top: 2px; color: var(--ink-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.state-fetching { color: var(--ok); } .state-paused { color: var(--warn); } .state-offline { color: var(--bad); }

/* Price change tags and sparklines */
/* Plain colored text with an arrow, no pill. */
.chg { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg-up { color: var(--up); } .chg-up::before { content: "\25B2"; font-size: .7em; }
.chg-down { color: var(--down); } .chg-down::before { content: "\25BC"; font-size: .7em; }
.chg-flat { color: var(--ink-muted); }
.spark { display: block; width: 100%; height: 100%; overflow: visible; }
.spark-line { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; stroke: var(--chart1); }
.spark-area { fill: var(--chart1); opacity: .13; stroke: none; }
.spark-up .spark-line { stroke: var(--up); } .spark-up .spark-area { fill: var(--up); }
.spark-down .spark-line { stroke: var(--down); } .spark-down .spark-area { fill: var(--down); }
.spark-flat .spark-line { stroke: var(--ink-muted); } .spark-flat .spark-area { fill: var(--ink-muted); opacity: .08; }

/* Item icons (src/web/icons.ts): a head picture over a letter badge, framed in the item's rarity color.
   Glowing (enchanted) items get the game's shimmer. */
.mc-0 { --rc: var(--mc-0); } .mc-1 { --rc: var(--mc-1); } .mc-2 { --rc: var(--mc-2); } .mc-3 { --rc: var(--mc-3); }
.mc-4 { --rc: var(--mc-4); } .mc-5 { --rc: var(--mc-5); } .mc-6 { --rc: var(--mc-6); } .mc-7 { --rc: var(--mc-7); }
.mc-8 { --rc: var(--mc-8); } .mc-9 { --rc: var(--mc-9); } .mc-a { --rc: var(--mc-a); } .mc-b { --rc: var(--mc-b); }
.mc-c { --rc: var(--mc-c); } .mc-d { --rc: var(--mc-d); } .mc-e { --rc: var(--mc-e); } .mc-f { --rc: var(--mc-f); }
.mc { color: var(--rc); }
.mc-bold { font-weight: 750; }
/* Item icons (spans). The menu's line icons are svg.ic and keep the plain look above. */
.ic:not(:where(svg)) {
  --ic: 28px; position: relative; flex: none; display: inline-grid; place-items: center; width: var(--ic); height: var(--ic); overflow: hidden; vertical-align: middle;
  border-radius: 8px; background: color-mix(in srgb, var(--rc, var(--ink-muted)) 13%, var(--raised)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc, var(--ink-muted)) 42%, transparent);
}
.ic > b { font-size: calc(var(--ic) * .48); font-weight: 800; line-height: 1; color: var(--rc, var(--ink-dim)); }
.ic > img { position: absolute; inset: 14%; width: 72%; height: 72%; image-rendering: pixelated; border-radius: 2px; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
/* Drawn item pictures have see-through edges: no frame shadow, a soft drop shadow instead, and the
   letter hides while the picture is there (it shows again if the picture fails and is removed). */
.ic-art > img { inset: 10%; width: 80%; height: 80%; border-radius: 0; box-shadow: none; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .45)); }
.ic-art:has(> img) > b { visibility: hidden; }
.ic-sm { --ic: 22px; border-radius: 6px; }
.ic-lg { --ic: 58px; border-radius: 15px; margin-bottom: 10px; }
/* The enchanted shimmer covers the item's own pixels only, as in the game: app.js hands the picture to
   the mask (--pic) once it has loaded. Without a picture there is no shimmer. */
.ic-glow::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; display: none;
  background: linear-gradient(115deg, transparent 32%, rgba(185, 110, 255, .42) 46%, rgba(255, 255, 255, .2) 50%, transparent 64%); background-size: 280% 100%;
  animation: glint 3.4s linear infinite;
  -webkit-mask: var(--pic) center / 72% 72% no-repeat; mask: var(--pic) center / 72% 72% no-repeat;
}
.ic-glow.glint::after { display: block; }
.ic-art.ic-glow::after { -webkit-mask-size: 80% 80%; mask-size: 80% 80%; }
.ic-mayor.ic-glow::after { -webkit-mask-size: 82% 82%; mask-size: 82% 82%; }
@keyframes glint { from { background-position: 135% 0; } to { background-position: -135% 0; } }
.ex-item { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; color: var(--ink); font-weight: 650; }

/* Movers */
.movers { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
button.mover {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 70px minmax(56px, auto) 68px; align-items: center; gap: 12px;
  min-height: 42px; padding: 6px 8px; border: 0; border-radius: var(--radius-ctl); background: transparent; color: var(--ink); font-weight: 500; font-size: 13.5px; text-align: left;
}
button.mover:hover { background: var(--raised); box-shadow: none; filter: none; }
.mover-item { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mover-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.mover .spark { height: 26px; }
.mover-price { text-align: right; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
button.mover .chg { justify-self: end; }

/* Market map */
.treemap { position: relative; height: clamp(480px, calc(100vh - 150px), 1000px); border-radius: 6px; overflow: hidden; background: var(--inset); }
.treemap svg { display: block; width: 100%; height: 100%; overflow: visible; transform-origin: 0 0; }
/* While a zoom or drag is under way the last drawing is scaled and moved on the graphics card. */
.treemap.moving svg { will-change: transform; }
.treemap.moving .tile, .treemap.moving .tm-hit { pointer-events: none; }
.tile-pct { font-weight: 650; }
.tile-price { font-weight: 550; opacity: .82; }
.tile { stroke: var(--bg); stroke-width: 1; cursor: pointer; }
/* A light edge on the tile under the pointer: no filters here, they make every repaint of a big map slow. */
.tile:hover, .tile:focus { stroke: color-mix(in srgb, var(--ink) 75%, transparent); stroke-width: 2; outline: none; }
.tile-ic { pointer-events: none; image-rendering: pixelated; }
/* A live update that moved the price: a short glow in the direction it moved. */
.tile.flash-up { animation: tile-up 1.4s var(--ease-out); }
.tile.flash-down { animation: tile-down 1.4s var(--ease-out); }
@keyframes tile-up { 0%, 30% { stroke: var(--up); stroke-width: 3; } 100% { stroke: var(--bg); stroke-width: 1; } }
@keyframes tile-down { 0%, 30% { stroke: var(--down); stroke-width: 3; } 100% { stroke: var(--bg); stroke-width: 1; } }
.tile-text { pointer-events: none; fill: var(--ink); font-family: var(--font); font-weight: 650; paint-order: stroke; stroke: rgba(0, 0, 0, .28); stroke-width: 2px; }
.tile-sub { font-weight: 700; opacity: .9; }
.tile-label { font-weight: 700; letter-spacing: .01em; fill: color-mix(in srgb, var(--ink) 92%, transparent); }
.t-n3 { fill: color-mix(in srgb, var(--down) 88%, var(--surface)); background: color-mix(in srgb, var(--down) 88%, var(--surface)); }
.t-n2 { fill: color-mix(in srgb, var(--down) 62%, var(--surface)); background: color-mix(in srgb, var(--down) 62%, var(--surface)); }
.t-n1 { fill: color-mix(in srgb, var(--down) 34%, var(--surface)); background: color-mix(in srgb, var(--down) 34%, var(--surface)); }
.t-0 { fill: color-mix(in srgb, var(--ink) 9%, var(--surface)); background: color-mix(in srgb, var(--ink) 9%, var(--surface)); }
.t-p1 { fill: color-mix(in srgb, var(--up) 34%, var(--surface)); background: color-mix(in srgb, var(--up) 34%, var(--surface)); }
.t-p2 { fill: color-mix(in srgb, var(--up) 62%, var(--surface)); background: color-mix(in srgb, var(--up) 62%, var(--surface)); }
.t-p3 { fill: color-mix(in srgb, var(--up) 88%, var(--surface)); background: color-mix(in srgb, var(--up) 88%, var(--surface)); }
.scale { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.scale span { padding: 0 4px; }
.scale i { display: inline-block; width: 22px; height: 10px; border-radius: 3px; }

/* Price explorer */
.ex-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ex-search { position: relative; }
.ex-search input { width: 230px; min-height: 36px; padding: 6px 11px; }
.ex-suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 260px; z-index: 20; list-style: none; margin: 0; padding: 4px; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-2); animation: drop var(--mid) var(--ease-out); }
.ex-suggest button { width: 100%; justify-content: flex-start; gap: 9px; min-height: 36px; padding: 6px 10px; background: none; border: 0; color: var(--ink); font-weight: 500; font-size: 14px; white-space: normal; text-align: left; }
.ex-suggest button:hover, .ex-suggest [aria-selected="true"] button { background: var(--raised); box-shadow: none; filter: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--inset); border: 1px solid var(--line); border-radius: 10px; }
button.seg-btn { min-height: 32px; padding: 4px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-dim); font-size: 13px; font-weight: 600; }
button.seg-btn:hover { background: var(--raised); color: var(--ink); box-shadow: none; filter: none; }
button.seg-btn[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line-strong); }
.explorer-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px 0; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.explorer-stats > div { padding: 0 14px; border-left: 1px solid var(--line); min-width: 0; }
.explorer-stats > div:first-child { padding-left: 0; border-left: 0; }
.explorer-stats span { display: block; color: var(--ink-muted); font-size: 11.5px; font-weight: 600; }
.explorer-stats strong { display: block; font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-explorer].loading [data-ex-chart] { opacity: .45; transition: opacity var(--mid) var(--ease); }

/* Ranked list (auction items) */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-rows: auto 4px; column-gap: 10px; row-gap: 5px; align-items: center; padding: 6px 4px; }
.rank-n { grid-row: 1 / 3; align-self: start; color: var(--ink-muted); font-weight: 700; font-size: 12px; text-align: right; padding-top: 2px; }
.rank-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rank-text { display: grid; min-width: 0; line-height: 1.25; }
.rank-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-meta { color: var(--ink-muted); font-size: 12px; }
.rank-val { font-weight: 750; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.rank-bar { grid-column: 2 / 4; height: 4px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.rank-bar .bar-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent), var(--accent)); }

/* Biggest sale */
.record { text-align: center; padding: 6px 0 20px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.record-price { font-size: clamp(2.2rem, 3vw, 3rem); font-weight: 850; letter-spacing: -0.03em; line-height: 1.1; color: var(--accent-ink); text-shadow: 0 0 34px color-mix(in srgb, var(--accent) 30%, transparent); }
.record-name { font-weight: 650; font-size: 1.05rem; margin-top: 4px; }
.record-meta { color: var(--ink-muted); font-size: 12.5px; margin-top: 2px; }

/* Columns (distributions) */
.cols { position: relative; display: flex; align-items: stretch; gap: clamp(3px, .5vw, 8px); height: 220px; margin-top: auto; padding-right: 40px; }
.cols-y { position: absolute; left: 0; right: 40px; top: 0; bottom: 20px; pointer-events: none; }
.cols-tick { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.cols-tick b { position: absolute; left: calc(100% + 6px); top: -7px; font-size: 10.5px; line-height: 14px; font-weight: 500; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.col { position: relative; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; outline: none; cursor: default; }
.col-bar-wrap { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line-strong); }
.col-bar { display: block; width: 100%; height: 0; border-radius: 5px 5px 1px 1px; transition: height 700ms var(--ease-out), filter var(--fast) var(--ease); background: linear-gradient(to top, color-mix(in srgb, var(--col) 45%, transparent), var(--col)); }
.cols-c1 { --col: var(--chart1); } .cols-c2 { --col: var(--chart2); } .cols-c3 { --col: var(--chart3); } .cols-c4 { --col: var(--info); }
.col:hover .col-bar, .col:focus .col-bar { filter: brightness(1.25); }
.col-hi .col-bar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--col), 0 0 22px color-mix(in srgb, var(--col) 45%, transparent); }
.col-label { margin-top: 6px; height: 14px; line-height: 14px; font-size: 11px; color: var(--ink-muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: clip; font-variant-numeric: tabular-nums; }
.col-hi .col-label { color: var(--ink); font-weight: 700; }

/* Donuts and rings */
.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin: auto 0; }
.donut-ring { position: relative; width: 168px; flex: none; }
.donut-ring svg { display: block; width: 100%; height: auto; }
.seg, .seg-track { fill: none; stroke-width: 5.4; }
.seg-track { stroke: var(--raised); }
.seg { transition: stroke-width var(--fast) var(--ease); cursor: default; }
.seg:hover { stroke-width: 6.6; }
.seg-0 { stroke: var(--chart1); } .seg-1 { stroke: var(--info); } .seg-2 { stroke: var(--chart3); } .seg-3 { stroke: var(--chart2); }
.seg-4 { stroke: var(--warn); } .seg-5 { stroke: color-mix(in srgb, var(--chart1) 55%, var(--ink)); } .seg-6 { stroke: color-mix(in srgb, var(--info) 55%, var(--ink)); } .seg-7 { stroke: var(--ink-muted); }
.seg-bg-0 { background: var(--chart1); } .seg-bg-1 { background: var(--info); } .seg-bg-2 { background: var(--chart3); } .seg-bg-3 { background: var(--chart2); }
.seg-bg-4 { background: var(--warn); } .seg-bg-5 { background: color-mix(in srgb, var(--chart1) 55%, var(--ink)); } .seg-bg-6 { background: color-mix(in srgb, var(--info) 55%, var(--ink)); } .seg-bg-7 { background: var(--ink-muted); }
.donut-center, .ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; pointer-events: none; }
.donut-center strong, .ring-center strong { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.donut-center span, .ring-center span { font-size: 11.5px; color: var(--ink-muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; flex: 1; min-width: 150px; }
.legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 9px; align-items: center; font-size: 13px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend-label { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.ring { position: relative; width: 132px; flex: none; }
.ring svg { display: block; width: 100%; height: auto; }
.ring-track, .ring-fill { fill: none; stroke-width: 4.2; }
.ring-track { stroke: var(--raised); }
.ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray 900ms var(--ease-out); }
.ring-ok .ring-fill { stroke: var(--ok); } .ring-warn .ring-fill { stroke: var(--warn); } .ring-bad .ring-fill { stroke: var(--bad); }
.rings { display: flex; flex-wrap: wrap; gap: 18px 26px; align-items: center; justify-content: space-around; margin: auto 0; }

/* Lorenz curve */
.lorenz-wrap { max-width: 230px; width: 100%; margin: 0 auto 12px; }
.lorenz { display: block; width: 100%; height: auto; }
.lorenz-frame { fill: var(--inset); stroke: var(--line); }
.lorenz-gap { fill: var(--accent-soft); }
.lorenz-eq { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 4; }
.lorenz-curve { fill: none; stroke: var(--chart1); stroke-width: 2.6; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.draw-in .lorenz-curve { animation: draw 1300ms var(--ease-out) both; }
.lorenz-read { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; margin-top: auto; }
.lorenz-read strong { display: block; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.lorenz-read span { font-size: 11.5px; color: var(--ink-muted); line-height: 1.25; display: block; }

/* Time charts (drawn by app.js) */
.tchart { position: relative; margin: 0; width: 100%; touch-action: pan-y; display: flex; flex-direction: column; }
.tchart-sm { height: 150px; } .tchart-md { height: 240px; } .tchart-lg { height: clamp(300px, 27vw, 480px); }
.tchart svg { display: block; width: 100%; height: auto; overflow: visible; }
.tchart-skel { position: absolute; inset: 0; border-radius: 10px; }
.tc-grid { stroke: var(--line); stroke-width: 1; }
.tc-ref { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.tc-axis { fill: var(--ink-muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.tc-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.tc-c1 { stroke: var(--chart1); fill: var(--chart1); } .tc-c2 { stroke: var(--chart2); fill: var(--chart2); }
.tc-c3 { stroke: var(--chart3); fill: var(--chart3); } .tc-c4 { stroke: var(--info); fill: var(--info); }
.tc-line.tc-c1, .tc-line.tc-c2, .tc-line.tc-c3, .tc-line.tc-c4 { fill: none; }
.tc-stop-c1 { stop-color: var(--chart1); } .tc-stop-c2 { stop-color: var(--chart2); } .tc-stop-c3 { stop-color: var(--chart3); } .tc-stop-c4 { stop-color: var(--info); }
.tc-bar { stroke: none; opacity: .85; transition: opacity var(--fast) var(--ease); }
.tc-bar.on { opacity: 1; }
.tc-cross { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tc-dot { stroke: var(--surface); stroke-width: 2.5; }
.tc-hover { opacity: 0; transition: opacity var(--fast) var(--ease); }
.tchart.hover .tc-hover { opacity: 1; }
.tchart.draw-in .tc-line { stroke-dasharray: 1; animation: draw 1100ms var(--ease-out) both; }
.tchart.draw-in .tc-area, .tchart.draw-in .tc-bars { animation: fade 900ms var(--ease) both; }

/* Hover card for charts, tiles and bars (one element, moved by app.js). */
.tip {
  position: fixed; left: 0; top: 0; z-index: 95; pointer-events: none; min-width: 120px; max-width: 300px; padding: 8px 11px; border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-2); font-size: 12.5px; line-height: 1.45; color: var(--ink);
  opacity: 0; transform: translateY(3px); transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.tip.on { opacity: 1; transform: none; }
.tip-title { font-weight: 700; margin-bottom: 2px; }
.tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.tip-k1 { background: var(--chart1); } .tip-k2 { background: var(--chart2); } .tip-k3 { background: var(--chart3); } .tip-k4 { background: var(--info); }
.tip-muted { color: var(--ink-muted); }
/* In-game tooltips: the picture is the game's own box, so the card around it goes away. Market-map
   numbers sit in a small card under it. */
.tip.tip-lore { max-width: none; min-width: 0; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.tip-lore img { display: block; max-width: min(92vw, 640px); max-height: 78vh; width: auto; height: auto; image-rendering: pixelated; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); }
.tip-lore .tip-extra {
  margin-top: 6px; width: max-content; min-width: 150px; max-width: 300px; padding: 7px 10px; border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2);
}
.ic[data-lore] { cursor: help; }

/* Admin: map labels */
.row-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-top: 12px; }
.row-form label:not(.check) { display: grid; gap: 4px; font-size: 13px; color: var(--ink-dim); }
.label-item { display: inline-flex; align-items: center; gap: 10px; line-height: 1.3; }
.label-input { width: 100%; max-width: 220px; min-height: 40px; }
.form-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 12px 0 2px; background: linear-gradient(transparent, var(--surface) 35%); }

@keyframes sheen { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }

@media (max-width: 1360px) {
  .top-index { grid-column: span 7; } .top-stats { grid-column: span 5; } .top > .mayor { grid-column: 1 / -1; }
  .m3 { grid-column: span 3; } .m4 { grid-column: span 4; } .m6 { grid-column: span 6; } .m8 { grid-column: span 8; } .m12 { grid-column: 1 / -1; }
  .explorer-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .top > * { grid-column: 1 / -1 !important; }
  .top { gap: 12px; }
}
@media (max-width: 760px) {
  .bento { gap: 12px; }
  .bento > * { grid-column: 1 / -1; }
  .stats, .figures, .bento > .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
  .fig-value, .stat-value { font-size: 1.3rem; }
  .explorer-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-tools, .ex-search, .ex-search input { width: 100%; }
  .treemap { height: 560px; }
  .cols { height: 180px; }
  button.mover { grid-template-columns: minmax(0, 1fr) 54px 64px; }
  button.mover .mover-price { display: none; }
  .perks span { display: none; }
  .ledger-spark { width: 90px; }
  .info { width: 22px; height: 22px; font-size: 12px; }
}

/* --- Skeletons (shown while a page loads) ----------------------------------------------------- */
.skel { border-radius: 7px; background: linear-gradient(90deg, var(--raised) 0%, color-mix(in srgb, var(--raised) 55%, var(--line-strong)) 40%, var(--raised) 80%); background-size: 300% 100%; animation: shimmer 1.3s linear infinite; }
.skel-h1 { width: 220px; height: 30px; margin: 2px 0 22px; }
.skel-line { height: 12px; margin: 6px 0; }
.skel-num { height: 26px; width: 55%; margin-top: 10px; }
.skel-block { height: 150px; margin-top: 14px; border-radius: 10px; }
.w30 { width: 30%; } .w45 { width: 45%; } .w60 { width: 60%; } .w80 { width: 80%; }
.skel-page { animation: fade var(--mid) var(--ease) both; }
.skel-page .stat::after { display: none; }

/* --- Motion ----------------------------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: none; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 60% { box-shadow: 0 0 0 5px transparent; } }

/* --- Phones and tablets ----------------------------------------------------------------------- */
@media (max-width: 960px) {
  .shell { display: block; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%; transform: translateX(-102%);
    transition: transform var(--slow) var(--ease-out), box-shadow var(--slow) var(--ease); box-shadow: none;
  }
  .side.open { transform: none; box-shadow: var(--shadow-2); }
  .icon-btn.side-close { display: inline-grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity var(--slow) var(--ease); }
  .side.open + .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 8px; }
  .page { padding: 20px 16px 28px; }
}
@media (max-width: 640px) {
  .top-search, .crumb-site, .crumb-sep { display: none; }
  .codes { columns: 1; }
  th, td { padding: 8px; }
  h1 { font-size: 1.35rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 13px; }
  .stat-value { font-size: 1.35rem; }
  .card { padding: 15px 14px; }
  .page-simple .narrow { padding: 22px 18px 18px; margin-top: 2vh; }
}
body.locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* --- Market map: the sector table, the zoom trail, title bars, search ------------------------------ */
.tm-wrap { display: grid; grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); gap: 10px; align-items: start; }
.tm-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tm-crumb { display: flex; align-items: center; gap: 2px; min-height: 26px; font-size: 12.5px; min-width: 0; }
button.tm-crumb-btn { min-height: 26px; padding: 2px 8px; border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--ink-dim); font-weight: 600; font-size: 12.5px; }
button.tm-crumb-btn:hover { background: var(--raised); color: var(--ink); box-shadow: none; filter: none; }
button.tm-crumb-btn[aria-current="true"], .tm-crumb-here { color: var(--ink); font-weight: 750; }
.tm-crumb-here { padding: 2px 8px; }
.tm-sep { color: var(--ink-muted); }
.tm-count { margin-left: auto; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-side { display: flex; flex-direction: column; min-width: 0; font-size: 12.5px; background: var(--inset); border-radius: 6px; padding: 4px 6px 6px; }
.tm-th, .tm-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) 54px 62px 34px; align-items: center; gap: 6px; }
.tm-th { position: sticky; top: -4px; z-index: 1; background: var(--inset); padding: 6px 4px; color: var(--ink-muted); font-size: 10.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.tm-th span:nth-child(n+3), .tm-row > span { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-list { list-style: none; margin: 0; padding: 2px 0 0; }
.tm-row { padding: 0 4px; border-radius: 5px; min-height: 30px; }
.tm-row:hover { background: var(--raised); }
.tm-row.cur { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.tm-row.off .tm-name, .tm-row.off > span { opacity: .38; }
.tm-row .chg { font-weight: 700; }
.tm-row .chg::before { display: none; }
.tm-vol { color: var(--ink-dim); }
.tm-n { color: var(--ink-muted); }
button.tm-name { display: block; min-height: 30px; padding: 0 4px; border: 0; background: none; box-shadow: none; color: var(--ink); font-weight: 600; font-size: 12.5px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: zoom-in; }
button.tm-name:hover { color: var(--accent); background: none; box-shadow: none; filter: none; }
button.tm-eye { position: relative; width: 15px; height: 15px; min-height: 15px; min-width: 0; padding: 0; border-radius: 4px; border: 1.5px solid var(--line-strong); background: transparent; box-shadow: none; cursor: pointer; }
button.tm-eye::before { content: ""; position: absolute; inset: -8px; }
button.tm-eye:hover { border-color: var(--accent); background: transparent; box-shadow: none; filter: none; }
button.tm-eye[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
button.tm-eye[aria-pressed="true"]::after { content: ""; position: absolute; left: 3.5px; top: 0.5px; width: 4px; height: 8px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tm-tf:empty { display: none; }
.tm-tf { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 6px 4px 0; margin-top: 4px; border-top: 1px solid var(--line); color: var(--ink-muted); }
button.tm-link { min-height: 26px; padding: 2px 6px; border: 0; background: none; box-shadow: none; color: var(--accent); font-weight: 700; font-size: 12.5px; }
button.tm-link:hover { background: var(--raised); box-shadow: none; filter: none; }
input.tm-find { width: 190px; min-height: 32px; padding: 4px 10px; font-size: 13px; }
.tm-hit { cursor: zoom-in; stroke: var(--bg); stroke-width: 1; }
.tm-hit.tm-sector { fill: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.tm-hit:hover, .tm-hit:focus-visible { filter: brightness(1.35); outline: none; }
.tm-head-text { pointer-events: none; fill: var(--ink); font-family: var(--font); font-weight: 800; letter-spacing: .05em; }
.tm-head-pct { font-weight: 750; letter-spacing: 0; }
.tile.dim, .tile-text.dim, .tile-ic.dim { opacity: .16; }
.tile.found { stroke: var(--ink); stroke-width: 2; }
.tm-empty { fill: var(--ink-muted); font-size: 13px; font-family: var(--font); }

/* --- Charts: the key, axes, the latest value and the crosshair's labels ---------------------------- */
.tc-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; height: 22px; overflow: hidden; font-size: 12px; color: var(--ink-muted); }
.tc-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tc-sw { width: 14px; height: 3px; border-radius: 2px; }
.tc-kv { color: var(--ink); font-weight: 750; font-variant-numeric: tabular-nums; }
.tc-fill-c1 { fill: var(--chart1); background: var(--chart1); } .tc-fill-c2 { fill: var(--chart2); background: var(--chart2); }
.tc-fill-c3 { fill: var(--chart3); background: var(--chart3); } .tc-fill-c4 { fill: var(--info); background: var(--info); }
.tc-axis-line, .tc-tick { stroke: var(--line-strong); stroke-width: 1; }
.tc-vgrid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.tc-axis-day { fill: var(--ink-dim); font-weight: 700; }
.tc-pill-text { fill: var(--on-accent); font-size: 10.5px; font-weight: 750; font-family: var(--font); font-variant-numeric: tabular-nums; pointer-events: none; }
.tc-pill { pointer-events: none; }
.tc-pill-hover { fill: color-mix(in srgb, var(--ink) 88%, var(--bg)); }
.tc-pill-hover + .tc-pill-text { fill: var(--bg); }
.tc-cross-h { stroke-dasharray: 3 3; }

@media (max-width: 900px) {
  .tm-wrap { grid-template-columns: minmax(0, 1fr); }
  .tm-side { order: 2; max-height: none; }
  .tm-row, button.tm-name { min-height: 36px; }
  input.tm-find { width: 100%; font-size: 16px; min-height: 40px; }
}
@media (max-width: 760px) {
  .topbar-simple .top-anchors { display: none; }
}
.tm-sub button.tm-name { padding-left: 14px; font-weight: 500; color: var(--ink-dim); font-size: 12px; }
.tm-sub { min-height: 26px; }
.tm-sub button.tm-name { min-height: 26px; }

/* A chart that is a card's only content grows with the card (rows in the grid share one height). */
.bento > .card > .tchart-md:last-child { flex: 1 0 240px; height: auto; }

/* --- Products slider on the market map (styled in full: never only accent-color) ------------- */
.tm-size { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-muted); }
.tm-size-out { min-width: 64px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
input.range { -webkit-appearance: none; appearance: none; width: 180px; height: 30px; margin: 0; padding: 0; background: transparent; border: 0; cursor: pointer; --fill: 0%; }
input.range:focus { outline: none; }
input.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--fill), var(--line-strong) var(--fill)); }
input.range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-strong); }
input.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent); box-shadow: var(--shadow-1); }
input.range::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent); box-shadow: var(--shadow-1); }
input.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
input.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }

/* The table beside the map is always fully open. On desktop it is exactly as tall as the map: its rows
   share that height evenly (up to a normal row) and the text steps down on short screens, so every
   sector and group fits without scrolling. */
@media (min-width: 901px) {
  .tm-wrap { align-items: stretch; }
  .tm-side { min-height: 0; overflow-y: auto; padding-bottom: 3px; font-size: clamp(10.5px, 1.45vh, 12.5px); }
  .tm-list { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .tm-row { flex: 1 1 0; min-height: 15px; max-height: 32px; overflow: hidden; }
  button.tm-name, .tm-sub button.tm-name { min-height: 0; height: 100%; font-size: 1em; line-height: 1.15; }
  .tm-sub button.tm-name { font-size: .95em; }
  .tm-th { padding: 4px; }
  .tm-row > * { min-height: 0; max-height: 100%; padding-top: 0; padding-bottom: 0; line-height: 1.1; }

}

/* The map on its own page: on desktop the page is exactly one screen tall (header, the map card, the
   footer) and never scrolls; the map and the table stretch to fill it. Phones scroll as usual. */
@media (min-width: 901px) {
  body.fill { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
  body.fill > .topbar { flex: none; }
  body.fill > main.page { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-bottom: 8px; }
  body.fill .bento { flex: 1; min-height: 0; display: flex; }
  body.fill .map-full { flex: 1; min-height: 0; margin: 0; }
  body.fill .map-full .tm-wrap { flex: 1; min-height: 0; }
  body.fill .map-full .tm-main { min-height: 0; }
  body.fill .map-full .treemap { flex: 1; height: auto; min-height: 200px; }
  body.fill > .foot { flex: none; padding-top: 6px; padding-bottom: 8px; gap: 2px; }
}
@media (max-width: 900px) {
  .tm-size { flex: 1 1 100%; }
  input.range { flex: 1; width: auto; height: 40px; }
  .map-full .treemap { height: max(480px, calc(100vh - 200px)); }
}

/* --- Map zoom ------------------------------------------------------------------------------------ */
.treemap { touch-action: pan-y; }
.treemap.zoomed { touch-action: none; cursor: grab; }
.treemap.zoomed.panning { cursor: grabbing; }
.treemap.panning .tile, .treemap.panning .tm-hit { pointer-events: none; }
.treemap.hinting::after { content: "Hold Ctrl and scroll, or pinch, to zoom the map"; position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); color: var(--ink); font-weight: 700; font-size: 15px; pointer-events: none; }
.tm-zoom { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; }
button.tm-zbtn { width: 26px; min-width: 26px; height: 24px; min-height: 24px; padding: 0; border-radius: 6px; font-size: 15px; font-weight: 700; line-height: 1; }
button.tm-zbtn:disabled { opacity: .35; cursor: default; }
.tm-zk { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-dim); font-size: 12px; }
@media (max-width: 900px) { button.tm-zbtn { width: 36px; min-width: 36px; height: 36px; min-height: 36px; } }

/* A product's own page (/item/:id): header, a big chart with its tools, numbers down the side. */
.ip { display: flex; flex-direction: column; gap: 10px; }
.ip-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "id price chgs" "live live live"; align-items: center; gap: 6px 28px; margin: 0; }
.ip-id { grid-area: id; display: flex; align-items: center; gap: 14px; min-width: 0; }
.ic-xl { --ic: 54px; border-radius: 14px; flex: none; }
.ip-name { margin: 0; font-size: 1.6rem; line-height: 1.15; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.ip-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; color: var(--ink-muted); font-size: 12.5px; }
.ip-crumb a { color: var(--ink-dim); }
.ip-code { font-size: 11.5px; opacity: .8; }
.ip-price { grid-area: price; display: flex; gap: 24px; }
.ip-price > div { display: flex; flex-direction: column; }
.ip-price span, .ip-chg-label { color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.ip-price strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ip-chgs { grid-area: chgs; list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; }
.ip-chgs li { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-weight: 700; }
.ip-live { grid-area: live; margin: 0; }
.ip-flash { animation: ip-flash 1.2s var(--ease-out); }
@keyframes ip-flash { from { color: var(--accent); } }
.ip-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 10px; align-items: start; }
.ip-chart-card { margin: 0; display: flex; flex-direction: column; min-width: 0; }
.ip-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.ip-compare { position: relative; flex: 1 1 170px; max-width: 260px; }
.ip-compare input { width: 100%; min-height: 32px; padding: 5px 10px; font-size: 13px; }
.ip-readout { display: flex; flex-wrap: wrap; gap: 4px 14px; min-height: 22px; margin: 10px 0 4px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.ip-readout b { color: var(--ink-muted); font-weight: 600; }
.ip-r-time { color: var(--ink); font-weight: 650; }
.stock { position: relative; height: clamp(380px, calc(100vh - 330px), 900px); touch-action: pan-y; cursor: crosshair; user-select: none; }
.stock svg { display: block; width: 100%; height: 100%; overflow: visible; }
.stock-skel { position: absolute; inset: 0; }
.stock .empty { padding: 40px 0; text-align: center; }
.ip-hint { margin: 8px 0 0; }
.tc-vgrid { stroke: var(--line); stroke-width: 1; opacity: .55; }
.tc-axis-line { stroke: var(--line-strong); stroke-width: 1; }
.tc-axis-day { fill: var(--ink-dim); font-weight: 650; }
.tc-pill-text { fill: var(--bg); font-size: 11px; font-weight: 750; font-family: var(--font); font-variant-numeric: tabular-nums; }
.st-up { stroke: var(--up); fill: var(--up); } .st-down { stroke: var(--down); fill: var(--down); }
.st-wick { stroke-width: 1; }
.st-body { stroke: none; }
.st-line { fill: none; stroke: var(--chart1); stroke-width: 2; stroke-linejoin: round; }
.st-sell { fill: none; stroke: var(--chart2); stroke-width: 1.4; stroke-dasharray: 5 3; opacity: .9; }
.st-cmp { fill: none; stroke: var(--chart2); stroke-width: 2; stroke-linejoin: round; }
.st-ma { fill: none; stroke-width: 1.4; }
.st-ma1 { stroke: var(--chart3); } .st-ma2 { stroke: var(--info); } .st-ma3 { stroke: var(--accent); }
.st-bb { fill: none; stroke: var(--ink-muted); stroke-width: 1; opacity: .8; }
.st-bb-area { fill: var(--ink-muted); stroke: none; opacity: .08; }
.st-last { stroke-width: 1; stroke-dasharray: 2 3; opacity: .8; }
.st-pill { stroke: none; }
.st-vol { fill: var(--chart1); opacity: .45; stroke: none; }
.st-low1 { fill: none; stroke: var(--chart1); stroke-width: 1.5; }
.st-low2 { fill: none; stroke: var(--chart2); stroke-width: 1.5; }
.st-lab { fill: var(--ink-muted); font-size: 11px; font-family: var(--font); }
.st-cross { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.st-cross-pill { fill: var(--ink-dim); stroke: none; }
.st-cross-text { fill: var(--bg); font-size: 11px; font-weight: 750; font-family: var(--font); font-variant-numeric: tabular-nums; }
[data-cross-p] { pointer-events: none; }
.st-k-sell { color: var(--chart2); } .st-k-ma1 { color: var(--chart3); } .st-k-ma2 { color: var(--info); } .st-k-ma3 { color: var(--accent); } .st-k-cmp { color: var(--chart2); }
.ip-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ip-side > .card { margin: 0; }
.ip-side .ledger-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "note note"; padding: 7px 0; }
.ip-side .ledger-value { font-size: 1rem; text-align: right; }
.ip-side .ledger-note:empty { display: none; }
.ip-lore img { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
a.mover { display: grid; grid-template-columns: minmax(0, 1fr) 0 minmax(56px, auto) 68px; align-items: center; gap: 10px; min-height: 40px; padding: 6px 8px; border-radius: var(--radius-ctl); color: var(--ink); font-size: 13.5px; text-decoration: none; }
a.mover:hover { background: var(--raised); }
a.mover .chg { justify-self: end; }
@media (max-width: 1100px) {
  .ip-grid { grid-template-columns: minmax(0, 1fr); }
  .ip-head { grid-template-columns: minmax(0, 1fr); grid-template-areas: "id" "price" "chgs" "live"; }
}
@media (max-width: 640px) {
  .ip-price { gap: 16px; } .ip-price strong { font-size: 1.2rem; }
  .ip-chgs { gap: 14px; flex-wrap: wrap; }
  .ip-name { font-size: 1.3rem; }
  .ip-compare { max-width: none; flex-basis: 100%; }
  .ip-compare input { font-size: 16px; min-height: 40px; }
  .ip-tools .seg { flex-wrap: wrap; max-width: 100%; }
  .ip-tools .seg-btn { min-height: 36px; flex: 1 0 auto; }
  .stock { height: 360px; }
  a.mover { min-height: 44px; }
}
