/*
 * TrueGE palettes. "pistachio" (default) and "classic", each with a day and a night variant.
 * theme.js sets data-palette and data-theme on <html>; plain :root is pistachio day.
 * Brand colours stay away from the profit green/loss red so they never read as a number.
 */
:root {
  color-scheme: light;
  --radius: 10px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --head: var(--serif);
  --bg: #f3f5ea;
  --paper: #fdfdf8;
  --paper-2: #f3f5e9;
  --paper-3: #e6ebd6;
  --rule: #d9dfc6;
  --rule-strong: #b8c39c;
  --ink: #222a19;
  --ink-soft: #525e45;
  --ink-faint: #6d7962;
  --brand: #b3cf8b;
  --brand-2: #a2c278;
  --brand-ink: #1e2812;
  --brand-soft: #3d4d29;
  --brand-line: rgb(30 40 18 / 0.2);
  --brand-edge: #86a65b;
  --brand-word: #4a6a1f;
  --brand-input: rgb(255 255 255 / 0.6);
  --pulse: #2f7d32;
  --foot-link: #2f4a12;
  --btn-bg: #3f5524;
  --btn-ink: #f4f8ec;
  --btn-hover: #4d6630;
  --th-rule: #a2c278;
  --gold: #8a6a10;
  --gold-bright: #e9c15a;
  --pos: #18733a;
  --pos-wash: rgb(24 115 58 / 0.11);
  --neg: #b0332c;
  --neg-wash: rgb(176 51 44 / 0.1);
  --warn: #965800;
  --warn-wash: rgb(196 120 0 / 0.12);
  --info: #285d87;
  --info-wash: rgb(40 93 135 / 0.1);
  --slot: #e7ecd8;
  --slot-edge: #bcc79f;
  --overlay: rgb(20 28 12 / 0.4);
  --shadow: 0 1px 0 rgb(255 255 255 / 0.6) inset, 0 6px 18px rgb(40 56 20 / 0.12);
  --tint: rgb(40 56 20 / 0.18);
  /* names the chart reads */
  --text: var(--ink);
  --muted: var(--ink-soft);
  --buy: #1f7f3e;
  --sell: #b23a2f;
  --bad: #c0392b;
  --chart-grid: #e4e9d6;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151c10;
  --paper: #1c2616;
  --paper-2: #222e1b;
  --paper-3: #2b3a22;
  --rule: #34442a;
  --rule-strong: #4b5f3c;
  --ink: #e8eedf;
  --ink-soft: #b3bfa3;
  --ink-faint: #8d9a7e;
  --brand: #2a3a1c;
  --brand-2: #3a4f27;
  --brand-ink: #eef5e2;
  --brand-soft: #c1d6a0;
  --brand-line: rgb(255 255 255 / 0.12);
  --brand-edge: #a9c87f;
  --brand-word: #b9d68f;
  --brand-input: #1e2a15;
  --pulse: #a9c87f;
  --foot-link: #b9d68f;
  --btn-bg: #b3cf8b;
  --btn-ink: #1a2410;
  --btn-hover: #c2dba0;
  --th-rule: #6f8a4c;
  --gold: #e2b44f;
  --pos: #6fd08a;
  --pos-wash: rgb(111 208 138 / 0.13);
  --neg: #f08b80;
  --neg-wash: rgb(240 139 128 / 0.13);
  --warn: #f0b050;
  --warn-wash: rgb(240 176 80 / 0.13);
  --info: #8cbbe6;
  --info-wash: rgb(140 187 230 / 0.12);
  --slot: #26331e;
  --slot-edge: #46593a;
  --overlay: rgb(0 0 0 / 0.55);
  --shadow: 0 8px 24px rgb(0 0 0 / 0.35);
  --tint: rgb(0 0 0 / 0.3);
  --buy: #6fd08a;
  --sell: #f08b80;
  --bad: #ff6b5e;
  --chart-grid: #26321f;
}
:root[data-palette="classic"] {
  --head: var(--sans);
  --bg: #f4f5f7;
  --paper: #ffffff;
  --paper-2: #f6f7f9;
  --paper-3: #eceef2;
  --rule: #e0e3e9;
  --rule-strong: #c4c9d2;
  --ink: #1b1f24;
  --ink-soft: #545c66;
  --ink-faint: #737b85;
  --brand: #1e2228;
  --brand-2: #2b3038;
  --brand-ink: #f3f4f6;
  --brand-soft: #aab1bb;
  --brand-line: rgb(255 255 255 / 0.14);
  --brand-edge: #e0b24a;
  --brand-word: #e9c15a;
  --brand-input: #2b3038;
  --pulse: #6fd08a;
  --foot-link: #e9c15a;
  --btn-bg: #1e2228;
  --btn-ink: #f3f4f6;
  --btn-hover: #333943;
  --th-rule: #1e2228;
  --gold: #8f6a10;
  --slot: #eef0f3;
  --slot-edge: #cbd0d8;
  --overlay: rgb(12 14 18 / 0.45);
  --shadow: 0 1px 2px rgb(16 20 26 / 0.06), 0 6px 18px rgb(16 20 26 / 0.08);
  --tint: rgb(16 20 26 / 0.16);
  --chart-grid: #e8eaee;
}
:root[data-palette="classic"][data-theme="dark"] {
  --bg: #0f1114;
  --paper: #16191d;
  --paper-2: #1c2025;
  --paper-3: #23282e;
  --rule: #2a2f36;
  --rule-strong: #3c434c;
  --ink: #e8eaed;
  --ink-soft: #aab1bb;
  --ink-faint: #858d97;
  --brand: #0a0b0d;
  --brand-2: #1a1d22;
  --brand-ink: #e8eaed;
  --brand-soft: #a3aab4;
  --brand-input: #1a1d22;
  --btn-bg: #e9c15a;
  --btn-ink: #1b1f24;
  --btn-hover: #f1cf78;
  --th-rule: #e0b24a;
  --gold: #e2b44f;
  --slot: #1f2328;
  --slot-edge: #39404a;
  --overlay: rgb(0 0 0 / 0.55);
  --shadow: 0 8px 24px rgb(0 0 0 / 0.4);
  --tint: rgb(0 0 0 / 0.3);
  --chart-grid: #22262c;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); font-weight: 400; letter-spacing: -0.005em; }
.muted { color: var(--ink-soft); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold-bright); color: var(--brand); padding: 6px 10px; border-radius: 6px; z-index: 30; }
.skip:focus { left: 8px; }
s { opacity: 0.75; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--brand); color: var(--brand-ink); border-bottom: 3px solid var(--brand-edge); }
.top-inner { max-width: 1320px; margin: 0 auto; padding: 10px 22px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--brand-ink); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; flex: none; }
.brand .word { font-family: var(--head); font-size: 22px; letter-spacing: 0.01em; }
.brand .word b { color: var(--brand-word); font-weight: 400; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--brand-soft); padding: 6px 10px; border-radius: 6px; }
.nav a:hover, .nav a.active { color: var(--brand-ink); background: var(--brand-2); text-decoration: none; }
.jump { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.jump svg, .search svg {
  position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%);
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; pointer-events: none; opacity: 0.7;
}
.jump input {
  width: 100%; background: var(--brand-input); border: 1px solid var(--brand-line); color: var(--brand-ink);
  border-radius: 8px; padding: 8px 12px 8px 34px; outline: none;
}
.jump input::placeholder { color: var(--brand-soft); }
.jump input:focus { border-color: var(--brand-edge); }
.jump-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 4px; list-style: none; z-index: 20;
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 10px; box-shadow: var(--shadow);
}
.jump-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.jump-list li[aria-selected="true"], .jump-list li:hover { background: var(--paper-3); }
.live { display: flex; align-items: center; gap: 7px; color: var(--brand-soft); font-size: 12px; white-space: nowrap; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--pulse); animation: pulse 2.4s infinite; }
.live.stale .pulse { background: var(--gold-bright); animation: none; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.theme-toggle {
  background: none; border: 1px solid var(--brand-line); border-radius: 8px; color: var(--brand-soft);
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
}
.theme-toggle:hover { color: var(--brand-ink); border-color: var(--brand-edge); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 1320px; margin: 0 auto; padding: 0 22px 48px; min-height: 70vh; outline: none; }
.loading { color: var(--ink-soft); padding: 60px 0; text-align: center; font-family: var(--head); font-size: 17px; }

/* ---------- hero ---------- */
.hero { padding: 34px 0 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero h1 { margin: 0; font-size: 38px; line-height: 1.1; }
.hero p { margin: 8px 0 0; color: var(--ink-soft); max-width: 640px; }
.ornament { display: flex; align-items: center; gap: 10px; color: var(--rule-strong); margin: 0 0 18px; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.ornament span { font-family: var(--head); color: var(--ink-faint); font-size: 13px; letter-spacing: 0.12em; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.filters {
  position: sticky; top: 76px; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px;
  padding: 6px 16px 14px; max-height: calc(100vh - 92px); overflow: auto;
}
.filters section { padding: 12px 0; border-bottom: 1px dashed var(--rule); }
.filters section:last-of-type { border-bottom: 0; }
.filters h3 { margin: 0 0 8px; font-size: 15px; color: var(--ink); }
.check { display: flex; align-items: center; gap: 9px; padding: 3px 0; cursor: pointer; color: var(--ink); }
.check input { accent-color: var(--gold); width: 16px; height: 16px; margin: 0; }
.check .count { margin-left: auto; color: var(--ink-faint); font-size: 12px; }
.seg { display: flex; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px; padding: 2px; }
.seg button { flex: 1; background: none; border: 0; border-radius: 6px; padding: 5px 6px; color: var(--ink-soft); font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px var(--tint); font-weight: 600; }
.field-label { display: block; font-size: 13px; color: var(--ink-soft); margin: 8px 0 4px; }
.field-label:first-of-type { margin-top: 0; }
.input {
  width: 100%; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px; padding: 7px 10px; outline: none; color: var(--ink);
}
.input:focus { border-color: var(--gold); background: var(--paper); }
.input::placeholder { color: var(--ink-faint); }
.hint { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.ghost-btn {
  width: 100%; margin-top: 12px; background: none; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 7px; color: var(--ink-soft);
}
.ghost-btn:hover { color: var(--ink); background: var(--paper-2); }
.filters-toggle, .filters-done { display: none; }
.filters-done { width: 100%; margin-top: 8px; }

/* ---------- results header ---------- */
.results-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.search { position: relative; flex: 1 1 260px; color: var(--ink-soft); }
.search input {
  width: 100%; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px 10px 36px; outline: none; color: var(--ink);
}
.search input:focus { border-color: var(--gold); }
.sort { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 14px; }
.sort select { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 9px 10px; color: var(--ink); }
.icon-btn {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink-soft);
}
.icon-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.preset {
  background: none; border: 1px solid var(--rule-strong); border-radius: 999px; padding: 4px 12px; color: var(--ink-soft); font-size: 13px;
}
.preset:hover { color: var(--ink); background: var(--paper); }
.preset[aria-pressed="true"] { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.summary { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; color: var(--ink-soft); font-size: 14px; margin: 0 0 12px; scroll-margin-top: 80px; }
.summary b { color: var(--ink); font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--info); }
.link:hover { text-decoration: underline; }

/* ---------- recipe cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card {
  position: relative; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 14px 12px;
  display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.card:hover { border-color: var(--rule-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.card:focus-visible { outline-offset: 3px; }
.flow { display: flex; align-items: center; gap: 6px; min-height: 40px; padding-right: 30px; flex-wrap: wrap; }
.flow .arrow { color: var(--ink-faint); font-size: 15px; margin: 0 1px; }
.slot {
  position: relative; width: 38px; height: 38px; flex: none; border-radius: 7px; background: var(--slot);
  border: 1px solid var(--slot-edge); box-shadow: inset 0 1px 2px var(--tint); display: grid; place-items: center;
}
.slot img { width: 32px; height: 32px; object-fit: contain; }
.slot .qty {
  position: absolute; left: 2px; top: 0; font-size: 10px; font-weight: 700; color: #f6e27a; line-height: 1.2;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000;
}
.slot.big { width: 54px; height: 54px; border-radius: 9px; }
.slot.big img { width: 46px; height: 46px; }
.slot.sm { width: 30px; height: 30px; border-radius: 6px; }
.slot.sm img { width: 24px; height: 24px; }
.coins {
  display: inline-flex; align-items: center; height: 24px; font-size: 12px; font-weight: 600; color: var(--gold);
  border: 1px dashed var(--rule-strong); border-radius: 6px; padding: 0 6px;
}
.card h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.card .sub { color: var(--ink-soft); font-size: 13px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.card .money { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-top: 1px dashed var(--rule); padding-top: 10px; margin-top: auto; }
.card .profit { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.card .profit small { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.roi { font-size: 13px; font-weight: 600; border-radius: 999px; padding: 1px 9px; background: var(--paper-3); color: var(--ink-soft); white-space: nowrap; }
.roi.pos { background: var(--pos-wash); color: var(--pos); }
.roi.neg { background: var(--neg-wash); color: var(--neg); }
.card .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; color: var(--ink-soft); font-size: 13px; }
.fav {
  position: absolute; top: 10px; right: 10px; background: none; border: 0; width: 30px; height: 30px; border-radius: 7px;
  color: var(--ink-faint); font-size: 18px; line-height: 1;
}
.fav:hover { background: var(--paper-2); color: var(--gold); }
.fav[aria-pressed="true"] { color: var(--gold); }
.mem { font-size: 11px; font-weight: 700; border-radius: 5px; padding: 0 6px; letter-spacing: 0.02em; }
.mem.f2p { color: var(--ink-soft); border: 1px solid var(--rule-strong); }
.mem.p2p { color: var(--gold); border: 1px solid var(--gold); }
.skill { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink); }
.skill img { width: 15px; height: 15px; }
.skill.miss { color: var(--neg); }
.skill.miss img { opacity: 0.55; }
.lv-form { display: flex; gap: 6px; }
.lv-form .input { min-width: 0; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.hint.err { color: var(--neg); }
.lv-who { margin-bottom: 4px; }
:root[data-theme="dark"] .skill img { filter: drop-shadow(0 0 1px rgb(255 240 210 / 0.7)); }
.seal { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.seal .dots { display: inline-flex; gap: 2px; }
.seal .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--rule); }
.seal.high .dots i.on { background: var(--pos); }
.seal.ok .dots i.on { background: var(--info); }
.seal.low .dots i.on { background: var(--warn); }
.seal.poor .dots i.on { background: var(--neg); }
.checked {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--info); background: var(--info-wash);
  border-radius: 999px; padding: 1px 8px 1px 6px; white-space: nowrap;
}
.checked svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.checked.warn { color: var(--warn); background: var(--warn-wash); }
a.slot { text-decoration: none; transition: border-color 0.12s, transform 0.12s; }
a.slot:hover { border-color: var(--gold); transform: translateY(-1px); text-decoration: none; }
.ico-line { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.view-seg { flex: none; }
.view-seg button { display: grid; place-items: center; padding: 6px 9px; }

/* ---------- list (table) ---------- */
.table-wrap { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; overflow-x: auto; container-type: inline-size; }
table.list { width: 100%; border-collapse: collapse; }
.list th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 10px 8px; white-space: nowrap;
  background: var(--paper-2); border-bottom: 2px solid var(--th-rule);
}
.list th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; display: inline-flex; gap: 4px; }
.list th button:hover, .list th.active { color: var(--ink); }
.list th.num button { margin-left: auto; }
.list td { padding: 9px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover td { background: var(--paper-2); }
.list tbody tr:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.list .num { text-align: right; white-space: nowrap; }
.list .c-fav { width: 36px; padding-right: 0; }
.list .fav { position: static; }
.rc { display: flex; gap: 10px; align-items: center; min-width: 190px; }
.list .seal-word { display: none; }
.list td:first-child, .list th:first-child { padding-left: 12px; }
.list td:last-child, .list th:last-child { padding-right: 12px; }
.rc-text { min-width: 0; }
.rc .nm { font-weight: 600; line-height: 1.3; }
.rc .sub { font-size: 12px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; margin-top: 2px; }
.list .flow { min-height: 0; padding: 0; flex-wrap: nowrap; gap: 4px; }
.list .c-profit b { font-size: 16px; }
.list .c-profit .mark { margin-top: 3px; }
.list .c-cost .short { display: none; }
.list .sub-num { font-size: 12px; color: var(--ink-faint); }
.mini {
  display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 0 6px; vertical-align: 1px;
  letter-spacing: 0.02em; cursor: help;
}
.mini.warn { background: var(--warn-wash); color: var(--warn); }
.mini.info { background: var(--info-wash); color: var(--info); }
.hist { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; }

.more { display: flex; justify-content: center; margin: 18px 0 0; }
.btn {
  background: var(--btn-bg); color: var(--btn-ink); border: 0; border-radius: 9px; padding: 9px 18px; font-weight: 600;
}
.btn:hover { background: var(--btn-hover); }
.btn-gold { background: var(--gold-bright); color: #2b2206; }
.btn-gold:hover { background: #f5d47c; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--ink-soft); padding: 50px 10px; font-family: var(--serif); font-size: 17px; }

/* ---------- why section ---------- */
.why { margin-top: 44px; }
.why h2 { font-size: 24px; margin: 0 0 6px; }
.why > p { color: var(--ink-soft); margin: 0 0 14px; max-width: 720px; }
.why-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.why-card { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; }
.why-card h3 { margin: 0 0 4px; font-size: 17px; }
.why-card p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.why-example { margin-top: 14px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--paper-2); border: 1px dashed var(--rule-strong); border-radius: 12px; padding: 12px 16px; }
.why-example .nums { display: flex; gap: 18px; align-items: baseline; margin-left: auto; }
.why-example .nums span { color: var(--ink-soft); font-size: 13px; }
.why-example .nums b { font-size: 18px; margin-left: 6px; }

/* ---------- drawer ---------- */
.backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 40; animation: fade 0.15s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 41; background: var(--bg);
  border-left: 3px solid var(--brand-edge); overflow-y: auto; animation: slide 0.18s ease-out; outline: none;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .backdrop, .drawer { animation: none; } }
.drawer-head { background: var(--paper); border-bottom: 1px solid var(--rule); padding: 16px 18px 14px; position: sticky; top: 0; z-index: 1; }
.drawer-head .top-row { display: flex; align-items: center; gap: 8px; }
.drawer-head h2 { margin: 10px 0 2px; font-size: 24px; line-height: 1.2; }
.drawer-head .sub { color: var(--ink-soft); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.drawer-head .actions { margin-left: auto; display: flex; gap: 6px; }
.drawer-body { padding: 16px 18px 28px; display: grid; gap: 14px; }
.tally { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.tally > div { padding: 10px 12px; border-right: 1px solid var(--rule); }
.tally > div:last-child { border-right: 0; }
.tally span { display: block; font-size: 12px; color: var(--ink-soft); }
.tally b { font-size: 20px; }
.note-box { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 11px 13px; font-size: 14px; border: 1px solid; }
.note-box.info { background: var(--info-wash); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.note-box.warn { background: var(--warn-wash); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.note-box .ico { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--paper); }
.note-box.info .ico { background: var(--info); }
.note-box.warn .ico { background: var(--warn); }
.ledger { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.ledger h3 { margin: 0; padding: 10px 14px; font-size: 17px; display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--rule); }
.ledger h3 .mode { font-family: var(--sans); font-size: 12px; color: var(--ink-soft); }
.lines { list-style: none; margin: 0; padding: 0; }
.line { display: flex; gap: 11px; padding: 10px 14px; border-bottom: 1px dashed var(--rule); }
.line:last-child { border-bottom: 0; }
.line-body { min-width: 0; flex: 1; }
.line-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.line-top a { color: var(--ink); font-weight: 600; }
.line .price { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.line .note { color: var(--warn); font-size: 13px; margin-top: 3px; }
.line .note.soft { color: var(--ink-soft); }
.line .meta { color: var(--ink-faint); font-size: 12px; margin-top: 2px; }
.chip { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.chip.bad { background: var(--neg-wash); color: var(--neg); }
.chip.warn { background: var(--warn-wash); color: var(--warn); }
.chip.info { background: var(--info-wash); color: var(--info); }
.totals { padding: 10px 14px; display: grid; gap: 3px; background: var(--paper-2); border-top: 1px solid var(--rule); font-size: 14px; }
.totals > div { display: flex; justify-content: space-between; gap: 10px; }
.totals .grand { border-top: 1px solid var(--rule-strong); margin-top: 4px; padding-top: 6px; font-weight: 700; font-size: 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; }

/* ---------- item page ---------- */
.crumbs { padding: 20px 0 4px; color: var(--ink-soft); display: flex; gap: 8px; font-size: 14px; }
.item-hero { display: flex; gap: 16px; align-items: center; padding: 10px 0 18px; }
.item-hero h1 { margin: 0; font-size: 34px; line-height: 1.15; }
.item-hero .tags { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--ink-soft); font-size: 14px; margin-top: 4px; }
.book { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.book > div { padding: 14px 16px; border-right: 1px solid var(--rule); }
.book > div:last-child { border-right: 0; }
.book h3 { margin: 0 0 4px; font-size: 15px; color: var(--ink-soft); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.book .big { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.book .big small { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.book .note { color: var(--warn); font-size: 13px; margin-top: 6px; }
.book .note.soft { color: var(--ink-soft); }
.book .meta { color: var(--ink-faint); font-size: 12px; margin-top: 6px; }
.chart-card { margin-top: 14px; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; }
.chart-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tabs { display: flex; gap: 2px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px; padding: 2px; }
.tabs button { background: none; border: 0; padding: 4px 11px; border-radius: 6px; color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px var(--tint); }
.legend { display: flex; gap: 12px; color: var(--ink-soft); font-size: 13px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot.buy { background: var(--buy); }
.dot.sell { background: var(--sell); }
.dot.spike { background: var(--bad); }
.chart-bar .check { margin-left: auto; font-size: 13px; color: var(--ink-soft); }
.chart-box { position: relative; height: 380px; }
.chart canvas { display: block; touch-action: pan-y; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 2; min-width: 220px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 9px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow);
}
.tip-when { color: var(--ink-soft); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row b { margin-left: auto; }
.tip-vol { color: var(--ink-soft); min-width: 64px; text-align: right; }
.tip-spike { color: var(--neg); font-weight: 700; }
.chart-note { color: var(--ink-soft); font-size: 13px; margin: 8px 2px 0; }
.section-title { font-size: 24px; margin: 30px 0 12px; }

/* ---------- prose ---------- */
.prose { max-width: 760px; padding: 30px 0; font-size: 16px; line-height: 1.65; }
.prose h1 { font-size: 36px; line-height: 1.15; margin: 0 0 12px; }
.prose h2 { font-size: 24px; margin: 30px 0 8px; }
.prose li { margin-bottom: 9px; }
.example { margin: 18px 0; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 18px; }
.example figcaption { color: var(--ink-faint); font-size: 13px; font-family: var(--head); letter-spacing: 0.06em; }
.example p { margin: 8px 0; }
.notfound { max-width: 600px; margin: 80px auto; text-align: center; padding: 0 20px; }
.notfound h1 { font-size: 34px; }

/* ---------- footer ---------- */
.foot { background: var(--brand); color: var(--brand-soft); font-size: 13px; border-top: 3px solid var(--brand-edge); }
.foot-inner { max-width: 1320px; margin: 0 auto; padding: 22px; display: grid; grid-template-columns: 1.2fr 2fr; gap: 20px; }
.foot a { color: var(--foot-link); }
.foot p { margin: 4px 0; }
.foot .brand .word { font-size: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .book { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book > div:nth-child(2) { border-right: 0; }
  .book > div:nth-child(-n + 2) { border-bottom: 1px solid var(--rule); }
  .why-grid { grid-template-columns: 1fr; }
}
/* Columns give way to the space the table actually has, not the window: the sidebar takes its share. */
@container (max-width: 1000px) {
  .recipes-list .c-flow { display: none; }
}
@container (max-width: 860px) {
  .prices-list .c-limit { display: none; }
}
@container (max-width: 620px) {
  .list td, .list th { padding: 8px 6px; }
  .recipes-list .c-fav, .recipes-list .c-roi, .recipes-list .c-vol, .recipes-list .c-trust { display: none; }
  .prices-list .c-perlimit, .prices-list .c-vol, .prices-list .c-trust { display: none; }
  .list .c-cost .full { display: none; }
  .list .c-cost .short { display: inline; }
  .rc { min-width: 0; }
  .rc .slot.sm { display: none; }
  .rc .nm { font-size: 14px; }
  .list .c-profit b { font-size: 15px; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; display: none; }
  .filters.open { display: block; }
  .filters-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .filters-done { display: block; }
  .foot-inner { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top-inner { gap: 10px; padding: 8px 14px; flex-wrap: wrap; }
  .jump { order: 3; flex-basis: 100%; max-width: none; }
  .live { margin-left: auto; }
  main { padding: 0 14px 36px; }
  .hero { padding: 22px 0 14px; }
  .hero h1 { font-size: 28px; }
  .cards { grid-template-columns: 1fr; }
  .book { grid-template-columns: 1fr; }
  .book > div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .book > div:last-child { border-bottom: 0; }
  .item-hero h1 { font-size: 26px; }
  .chart-box { height: 300px; }
  .chart-bar .check { margin-left: 0; }
  .tally b { font-size: 17px; }
  .drawer { border-left: 0; border-top: 3px solid var(--brand-edge); }
  .sort span { display: none; }
  .hist { margin-left: 0; }
}

/* ---------- tools ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; flex-direction: column; gap: 6px; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px;
  padding: 16px 18px; color: var(--ink); transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.tool-card:hover { text-decoration: none; border-color: var(--rule-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-card h2 { margin: 0; font-size: 20px; }
.tool-card p { margin: 0; color: var(--ink-soft); font-size: 14px; flex: 1; }
.tool-card .go { color: var(--info); font-size: 14px; font-weight: 600; }
.tool-panel {
  display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; background: var(--paper); border: 1px solid var(--rule);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
}
.tool-panel.col { flex-direction: column; align-items: stretch; gap: 6px; margin: 0; }
.tool-field { display: flex; flex-direction: column; min-width: 150px; }
.tool-field.grow { flex: 1 1 260px; }
.tool-field .field-label { margin: 0 0 4px; }
.tool-checks { flex-direction: row; gap: 14px; align-items: center; min-width: 0; padding-bottom: 6px; }
.input.big { font-size: 20px; font-weight: 600; padding: 9px 12px; }
.rule { border: 0; border-top: 1px dashed var(--rule); margin: 10px 0; width: 100%; }
.tax-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; align-items: start; }
.tax-tally b { font-size: 22px; }
.bar { width: 140px; max-width: 100%; height: 5px; border-radius: 3px; background: var(--paper-3); margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--btn-bg); }
.list .c-alch, .list .c-hour { white-space: nowrap; }
@container (max-width: 900px) {
  .alch-list .c-vol, .alch-list .c-perlimit { display: none; }
}
@container (max-width: 620px) {
  .alch-list .c-alch, .alch-list .c-trust { display: none; }
}
@media (max-width: 900px) {
  .top .nav { display: flex; order: 5; flex-basis: 100%; overflow-x: auto; gap: 2px; margin: 0 -4px; scrollbar-width: none; }
  .top .nav a { white-space: nowrap; padding: 4px 10px; font-size: 14px; }
  .tax-grid { grid-template-columns: 1fr; }
}
.tool-panel .seg button { white-space: nowrap; padding: 5px 10px; }
.slow { color: var(--warn); white-space: nowrap; cursor: help; }
.slow i { font-style: normal; font-size: 10px; font-weight: 700; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--warn-wash); vertical-align: 1px; }
.sub-num.old { color: var(--warn); }
.tool-hint { margin: -4px 2px 12px; }
