/* Wyckoff Theory — a tape-reader's desk: slate ground, brass accent, stage colours
   for the four cycle phases. Layout: one column on phones (sticky top bar, bottom
   tabs), scanner controls beside results on wide screens. */
:root {
  /* dark (default) */
  --bg: #0f141c;
  --bg2: #121923;
  --surface: #161e29;
  --surface2: #1b2532;
  --field: #111821;
  --line: #243041;
  --line2: #2f3d52;
  --text: #e5e9f0;
  --muted: #93a0b4;
  --dim: #66748a;
  --accent: #d9a648;
  --accent-ink: #1d1404;
  --accent-soft: rgba(217, 166, 72, 0.14);
  --up: #55d38a;
  --up-soft: rgba(85, 211, 138, 0.13);
  --down: #f2647c;
  --down-soft: rgba(242, 100, 124, 0.13);
  --warn: #f0b84f;
  --warn-soft: rgba(240, 184, 79, 0.13);
  --acc: #39c2a4;
  --acc-soft: rgba(57, 194, 164, 0.14);
  --dist: #f08a4b;
  --dist-soft: rgba(240, 138, 75, 0.14);
  --flat: #7d8aa0;
  --chart-grid: #1c2633;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  --sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-s: 10px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1f4; --bg2: #e6eaef; --surface: #ffffff; --surface2: #f4f6f9; --field: #f7f8fa;
    --line: #d6dde6; --line2: #c3ccd8; --text: #18202b; --muted: #556275; --dim: #7a8699;
    --accent: #9a6a10; --accent-ink: #ffffff; --accent-soft: rgba(154, 106, 16, 0.12);
    --up: #18864a; --up-soft: rgba(24, 134, 74, 0.11); --down: #c4304b; --down-soft: rgba(196, 48, 75, 0.1);
    --warn: #9a6a00; --warn-soft: rgba(154, 106, 0, 0.12); --acc: #0f8a72; --acc-soft: rgba(15, 138, 114, 0.12);
    --dist: #b8561a; --dist-soft: rgba(184, 86, 26, 0.12); --flat: #6b7789; --chart-grid: #e7ebf0;
    --shadow: 0 10px 28px rgba(20, 30, 45, 0.14);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eef1f4; --bg2: #e6eaef; --surface: #ffffff; --surface2: #f4f6f9; --field: #f7f8fa;
  --line: #d6dde6; --line2: #c3ccd8; --text: #18202b; --muted: #556275; --dim: #7a8699;
  --accent: #9a6a10; --accent-ink: #ffffff; --accent-soft: rgba(154, 106, 16, 0.12);
  --up: #18864a; --up-soft: rgba(24, 134, 74, 0.11); --down: #c4304b; --down-soft: rgba(196, 48, 75, 0.1);
  --warn: #9a6a00; --warn-soft: rgba(154, 106, 0, 0.12); --acc: #0f8a72; --acc-soft: rgba(15, 138, 114, 0.12);
  --dist: #b8561a; --dist-soft: rgba(184, 86, 26, 0.12); --flat: #6b7789; --chart-grid: #e7ebf0;
  --shadow: 0 10px 28px rgba(20, 30, 45, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; min-height: 100vh;
  padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }
h1, h2, h3 { text-wrap: balance; }

/* ---------- top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); flex: 0 0 auto; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.brand-name b { color: var(--accent); font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line2); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--down); box-shadow: 0 0 0 2px var(--surface); }
.icon-btn .dot.ok { background: var(--up); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.pill.open { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); }
.pill.demo { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tabs { display: none; gap: 4px; }
.tab { background: none; border: 0; padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.tab.active { color: var(--text); background: var(--surface2); }

/* ---------- layout */
main { max-width: 1240px; margin: 0 auto; padding: 14px 16px 24px; }
.view { display: none; }
.view.active { display: block; }
.stack { display: grid; gap: 14px; }
.stack > *, .row > *, .scan-layout > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: 0.02em; margin: 0 0 4px; }
.card h3, .label { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.help { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

/* ---------- controls */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--field); border: 1px solid var(--line2); border-radius: 13px; padding: 4px; }
.mode { border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 9px 4px 8px; display: grid; gap: 2px; text-align: center; }
.mode b { font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode span { font-family: var(--mono); font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.mode.active { background: var(--surface2); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
.mode.active span { color: var(--accent); }
.ladder { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.ladder .step { display: inline-flex; gap: 6px; align-items: baseline; padding: 5px 9px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line); }
.ladder .step b { font-family: var(--mono); color: var(--text); font-size: 13px; }
.ladder .arrow { color: var(--dim); }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.select, .input { width: 100%; appearance: none; -webkit-appearance: none; background: var(--field); border: 1px solid var(--line2); border-radius: 11px; padding: 11px 12px; color: var(--text); font-size: 15px; outline: none; }
.select { padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.select:focus, .input:focus { border-color: var(--accent); }
textarea.input { font-family: var(--mono); font-size: 13px; resize: vertical; }
.seg { display: flex; background: var(--field); border: 1px solid var(--line2); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 8px 6px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.seg button.active { background: var(--surface2); color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; padding: 11px 16px; font-weight: 700; font-size: 15px; background: var(--surface2); color: var(--text); border: 1px solid var(--line2); }
.btn.primary { width: 100%; background: var(--accent); color: var(--accent-ink); border: 0; font-family: var(--display); font-size: 20px; letter-spacing: 0.06em; text-transform: uppercase; padding: 13px; }
.btn.primary.stop { background: var(--surface2); color: var(--text); border: 1px solid var(--line2); }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.progress { height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.25s; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---------- summary strip */
.tally { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tally button { background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 2px; min-width: 0; display: grid; gap: 0; text-align: center; color: var(--muted); }
.tally button b { font-family: var(--display); font-size: 26px; line-height: 1.1; color: var(--text); }
.tally button span { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tally button.active { border-color: var(--accent); }
.tally .READY b { color: var(--up); }
.tally .BORDERLINE b { color: var(--accent); }
.tally .WATCH b { color: var(--warn); }
.tally .TRAIL b { color: var(--acc); }
.breadth { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--bg2); gap: 2px; }
.breadth span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }

.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.active { color: var(--text); background: var(--surface2); border-color: var(--accent); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 40px; }

/* ---------- result cards */
.results { display: grid; gap: 10px; }
.empty { color: var(--muted); padding: 22px 6px; text-align: center; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; cursor: pointer; }
.rcard:hover { border-color: var(--line2); }
.rhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rsym { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; min-width: 0; }
.rsym .sym { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: 0.02em; line-height: 1; word-break: break-word; }
.mini { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line2); color: var(--muted); }
.mini.fno { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.mini.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.rsub { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-top: 5px; }
.status { font-size: 11.5px; font-weight: 800; letter-spacing: 0.08em; padding: 4px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.status.READY { color: var(--up); border-color: color-mix(in srgb, var(--up) 55%, transparent); background: var(--up-soft); }
.status.BORDERLINE { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.status.WATCH { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-soft); }
.status.TRAIL { color: var(--acc); border-color: color-mix(in srgb, var(--acc) 55%, transparent); background: var(--acc-soft); }
.status.AVOID { color: var(--dim); border-color: var(--line2); }

.stage { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; padding: 3px 9px; border-radius: 7px; }
.stage.acc { color: var(--acc); background: var(--acc-soft); }
.stage.up { color: var(--up); background: var(--up-soft); }
.stage.dist { color: var(--dist); background: var(--dist-soft); }
.stage.down { color: var(--down); background: var(--down-soft); }
.stage.flat { color: var(--flat); background: var(--bg2); }
.stage em { font-style: normal; font-weight: 600; opacity: 0.8; }

/* Phase strip: A..E cells, the current phase filled */
.phases { display: inline-grid; grid-template-columns: repeat(5, 22px); gap: 3px; }
.phases i { font-style: normal; font-family: var(--mono); font-size: 11px; text-align: center; padding: 2px 0; border-radius: 5px; color: var(--dim); background: var(--bg2); border: 1px solid var(--line); }
.phases i.past { color: var(--muted); }
.phases i.now { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }

/* Range position: ice (support) .. creek (resistance) */
.rangebar { display: grid; gap: 4px; }
.rangebar .track { position: relative; height: 10px; border-radius: 99px; background: linear-gradient(90deg, var(--acc-soft), var(--bg2) 35%, var(--bg2) 65%, var(--dist-soft)); border: 1px solid var(--line); }
.rangebar .mid { position: absolute; top: 0; bottom: 0; left: 25%; right: 25%; border-left: 1px dashed var(--line2); border-right: 1px dashed var(--line2); }
.rangebar .dot { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.rangebar .ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

.setupline { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.setupline b { font-family: var(--display); font-size: 18px; letter-spacing: 0.02em; }
.setupline .long { color: var(--up); }
.setupline .short { color: var(--down); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.metric .k { font-size: 10.5px; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric .v.sl { color: var(--down); }
.metric .v.tg { color: var(--up); }
.mtf { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.mtf span { padding: 3px 8px; border-radius: 7px; border: 1px solid var(--line2); color: var(--muted); font-family: var(--mono); }
.mtf span.u { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); }
.mtf span.d { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.ck { font-size: 12.5px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); }
.ck.ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.ck.no { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.ck.exit { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); background: var(--down-soft); font-weight: 600; }
.ck.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.ck.info { color: var(--dim); }
.act-EXIT { color: var(--down) !important; }
.act-TIGHTEN { color: var(--warn) !important; }
.act-HOLD { color: var(--up) !important; }
.note { font-size: 13px; color: var(--muted); padding: 8px 10px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--line); }
.note.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

/* ---------- detail sheet */
.sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: color-mix(in srgb, var(--bg) 95%, transparent); border-bottom: 1px solid var(--line); }
.sheet-body { max-width: 980px; margin: 0 auto; padding: 14px 16px; display: grid; gap: 14px; }
.sheet-body > * { min-width: 0; }
.chart { height: 360px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.tfbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.events { display: grid; gap: 8px; }
.ev { display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: start; font-size: 14px; }
.ev .tag { font-family: var(--mono); font-size: 12px; font-weight: 700; text-align: center; padding: 3px 0; border-radius: 6px; background: var(--bg2); border: 1px solid var(--line2); }
.ev .tag.b { color: var(--acc); border-color: color-mix(in srgb, var(--acc) 40%, transparent); }
.ev .tag.s { color: var(--dist); border-color: color-mix(in srgb, var(--dist) 40%, transparent); }
.ev small { display: block; color: var(--muted); font-size: 12.5px; }
.checklist { display: grid; gap: 10px; }
.checklist .it { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; font-size: 14px; }
.checklist .it .pts { font-family: var(--mono); color: var(--muted); font-size: 13px; }
.checklist .it small { display: block; color: var(--muted); font-size: 12.5px; }
.scorebar { height: 8px; border-radius: 99px; background: var(--bg2); overflow: hidden; }
.scorebar span { display: block; height: 100%; background: var(--accent); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 14px; }
.kv .k { color: var(--muted); }
.kv .v { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.bigline { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.05; letter-spacing: 0.01em; margin: 4px 0 6px; }

/* ---------- cycle board */
.board { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.board th { text-align: left; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 6px 6px; font-weight: 700; }
.board td { padding: 7px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
.board td.name { font-weight: 600; min-width: 84px; }
.board td:not(.name) { white-space: nowrap; }
.board .stage { font-size: 11.5px; padding: 2px 5px; white-space: nowrap; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cyclewheel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cyclewheel div { border-radius: 11px; padding: 10px; border: 1px solid var(--line); background: var(--bg2); display: grid; gap: 2px; }
.cyclewheel b { font-family: var(--display); font-size: 26px; line-height: 1; }
.cyclewheel span { font-size: 12px; color: var(--muted); }

/* ---------- guide */
.guide p, .guide li { color: var(--text); max-width: 68ch; }
.guide p { margin: 0 0 8px; }
.guide ol, .guide ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.guide dl { display: grid; grid-template-columns: 76px 1fr; gap: 8px 12px; margin: 0; }
.guide dt { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.guide dd { margin: 0; }
.phaserow { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.phaserow b { font-family: var(--display); font-size: 26px; line-height: 1; color: var(--accent); text-align: center; }

/* ---------- settings */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.switch input { width: 44px; height: 24px; appearance: none; background: var(--line2); border-radius: 99px; position: relative; transition: background 0.2s; cursor: pointer; flex: 0 0 auto; }
.switch input::after { content: ''; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: var(--surface); transition: transform 0.2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.diag { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: var(--muted); max-height: 240px; overflow: auto; }

/* ---------- login overlay */
.overlay { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.login { width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.login h2 { font-size: 28px; margin: 8px 0 4px; }
.login .stack { gap: 12px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; letter-spacing: 0.14em; font-size: 12px; text-transform: uppercase; }
.section-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.err { color: var(--down); font-size: 14px; background: var(--down-soft); border: 1px solid color-mix(in srgb, var(--down) 35%, transparent); padding: 9px 11px; border-radius: 10px; }
.ok-msg { color: var(--up); font-size: 14px; }
details.howto { color: var(--muted); font-size: 14px; }
details.howto summary { cursor: pointer; color: var(--accent); }
details.howto ol { padding-left: 18px; }

/* ---------- toast + bottom nav */
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--surface2); border: 1px solid var(--line2); color: var(--text); padding: 9px 14px; border-radius: 11px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: color-mix(in srgb, var(--bg) 96%, transparent); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); backdrop-filter: blur(10px); }
.bn { display: grid; justify-items: center; gap: 2px; background: none; border: 0; color: var(--dim); font-size: 12px; font-weight: 600; padding: 5px; border-radius: 10px; }
.bn.active { color: var(--accent); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } .progress > div { transition: none; } }

@media (min-width: 720px) {
  .results { grid-template-columns: 1fr 1fr; }
  .controls { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1040px) {
  body { padding-bottom: 24px; }
  .bottom-nav { display: none; }
  .tabs { display: flex; }
  .scan-layout { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
  .scan-layout > .left { position: sticky; top: 76px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .chart { height: 460px; }
}
@media (max-width: 440px) {
  .mode b { font-size: 15px; letter-spacing: 0; }
  .mode { padding-inline: 2px; }
}
@media (max-width: 400px) {
  .brand-name { font-size: 19px; }
  .metric .v { font-size: 13.5px; }
  .tally button b { font-size: 22px; }
  .cyclewheel { grid-template-columns: repeat(2, 1fr); }
  .pill.market { display: none; }
}
