/* wallstminer projector prototype. Tokens follow design/DESIGN.md §4. */
[hidden] { display: none !important; }
:root {
  --bg: #FAFAF7; --surface: #FFFFFF; --surface-2: #F3F3EF;
  --ink: #15171A; --ink-2: #5B6068; --ink-3: #868B93; --line: #E6E6E1;
  --btc: #E8890C; --btc-ink: #9A5300; --btc-soft: rgba(232,137,12,.14);
  --fund: #3A6FD8; --bench: #6B7280;
  --up: #127A55; --down: #B4232C;
  --zone-1: #EDEDE8; --zone-2: #D9D8D0; --zone-3: #B9B7AC;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  /* Compare series (validated: dataviz validate_palette.js, adjacent pairs, light on #fff / dark on #17191C) */
  --s1: #2a78d6; --s2: #1baf7a; --s3: #eda100; --s4: #e87ba4; --s5: #6250d6;
  --r-card: 12px; --ease: cubic-bezier(.2,.7,.2,1);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0F11; --surface: #17191C; --surface-2: #1F2226;
    --ink: #ECEDEE; --ink-2: #9AA0A8; --ink-3: #7A8088; --line: #2A2D31;
    --btc: #F7A23B; --btc-ink: #F7A23B; --btc-soft: rgba(247,162,59,.16);
    --fund: #7FA6FF; --bench: #A1A7B0; --up: #3FCB8E; --down: #FF6B72;
    --zone-1: #2A2D31; --zone-2: #3A3E44; --zone-3: #555A61;
    --s1: #3987e5; --s2: #199e70; --s3: #c98500; --s4: #d55181; --s5: #9085e9;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0F11; --surface: #17191C; --surface-2: #1F2226;
  --ink: #ECEDEE; --ink-2: #9AA0A8; --ink-3: #7A8088; --line: #2A2D31;
  --btc: #F7A23B; --btc-ink: #F7A23B; --btc-soft: rgba(247,162,59,.16);
  --fund: #7FA6FF; --bench: #A1A7B0; --up: #3FCB8E; --down: #FF6B72;
  --zone-1: #2A2D31; --zone-2: #3A3E44; --zone-3: #555A61;
  --s1: #3987e5; --s2: #199e70; --s3: #c98500; --s4: #d55181; --s5: #9085e9;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums; padding-bottom: env(safe-area-inset-bottom, 0px);
}
button { font: inherit; color: inherit; }
a { color: var(--btc-ink); }
.muted { color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--btc); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; max-width: 1120px; margin: 0 auto;
}
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-decoration: none; font-size: 17px; }
.wm-coin { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--btc); color: #fff; font-size: 15px; }
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: transparent; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#theme-btn svg { fill: currentColor; stroke: none; }
#share-btn svg { position: absolute; transition: opacity .18s var(--ease), transform .18s var(--ease); }
#share-btn .i-check { opacity: 0; transform: scale(.6); stroke: var(--up); stroke-width: 2.2; }
#share-btn.done .i-share { opacity: 0; transform: scale(.6); }
#share-btn.done .i-check { opacity: 1; transform: scale(1); }

/* ---------- Layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px 24px; display: grid; gap: 20px; }
.wrap > * { min-width: 0; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 0 16px; }
/* Mobile/tablet order per DESIGN.md §3: sentence → hero + chart → slider → assumptions.
   .inputs dissolves so its children interleave with .results; desktop keeps the sticky left column. */
@media (max-width: 1023.98px) {
  .wrap { gap: 0; }
  .inputs { display: contents; }
  .results { order: 1; margin: 18px 0; }
  .slider-block { order: 2; }
  .assumptions { order: 3; }
}
@media (min-width: 1024px) {
  .wrap { grid-template-columns: 380px 1fr; gap: 32px; align-items: start; }
  .inputs { position: sticky; top: 16px; }
}

/* ---------- Sentence ---------- */
.sentence { font-size: clamp(22px, 5.6vw, 28px); line-height: 1.55; letter-spacing: -.015em; margin: 8px 0 14px; font-weight: 500; }
.tok {
  display: inline-block; border: 0; background: none; padding: 0 2px; margin: 0 -2px; cursor: pointer;
  font-weight: 700; color: var(--ink); border-radius: 8px;
  text-decoration: underline dotted var(--ink-3); text-decoration-thickness: 2px; text-underline-offset: 6px;
  transition: background .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.tok:hover { background: var(--surface); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration-color: transparent; }
.tok[aria-expanded="true"] { background: var(--btc-soft); text-decoration-color: transparent; }
.nw { white-space: nowrap; }
.tok.sm { font-size: inherit; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.tok.flash { animation: tokflash .5s var(--ease); }
@keyframes tokflash { 0% { background: var(--btc-soft); } 100% { background: transparent; } }

/* ---------- Chips ---------- */
.presets, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.presets { margin-bottom: 10px; }
.chip, .chips button, .presets button {
  min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-size: 14px; font-weight: 600; transition: background .15s var(--ease), border-color .15s var(--ease);
}
.chips button:hover, .presets button:hover { border-color: var(--ink-3); }
.chips button[aria-pressed="true"], .presets button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.presets button { position: relative; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2; }
.presets .pv {
  font-size: 11px; font-weight: 500; color: var(--btc-ink); max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height .18s var(--ease), opacity .18s var(--ease);
}
.presets button[aria-pressed="true"] .pv { color: inherit; }
.presets:hover .pv, .presets button:focus-visible .pv, .presets.peek .pv { max-height: 16px; opacity: .9; }
.data-chip {
  display: inline-block; font-size: 12px; color: var(--ink-2); background: var(--surface-2);
  padding: 3px 10px; border-radius: 999px; cursor: help;
}
.row-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 18px; }
.link-btn {
  border: 0; background: none; padding: 6px 2px; min-height: 36px; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 4px; cursor: pointer;
}
.link-btn:hover { text-decoration-color: currentColor; }
.presets button.in-cmp { box-shadow: inset 0 -3px 0 var(--c); }
.row-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; }
.link-btn.quiet { font-weight: 500; color: var(--ink-2); }
.presets.editing button[data-f] { border-style: dashed; }
.presets .fx { margin-left: 6px; font-weight: 500; color: var(--ink-3); }
.presets.editing button[data-f]:hover .fx { color: var(--ink); }
.presets .fav-add { border-style: dashed; color: var(--ink-2); font-weight: 500; }
.fav-empty { margin: 4px 0; font-size: 13px; color: var(--ink-3); }

/* ---------- Fund search ---------- */
.fund-search { position: relative; margin-bottom: 12px; scroll-margin-top: 12px; }
.search-field {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: text;
  transition: border-color .15s var(--ease);
}
.search-field:focus-within { border-color: var(--ink-3); }
.search-field svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.search-field input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; padding: 12px 0; outline: none;
}
.search-field input::placeholder { color: var(--ink-3); }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }
.fs-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 35; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.18); overflow: hidden;
  animation: popin .14s var(--ease);
}
.fs-cats { flex-wrap: nowrap; overflow-x: auto; padding: 10px 10px 8px; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.fs-cats::-webkit-scrollbar { display: none; }
.fs-cats button, .sheet .fs-cats button { flex: none; min-height: 32px; padding: 4px 11px; font-size: 13px; }
.fs-cats .n { font-weight: 500; opacity: .6; margin-left: 2px; font-variant-numeric: tabular-nums; }
.fs-cats .dim { opacity: .5; }
.fs-list { list-style: none; margin: 0; padding: 4px; max-height: min(52vh, 420px); overflow-y: auto; overscroll-behavior: contain; }
.fs-list [role=option] {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 32px 36px; align-items: center; gap: 6px 8px;
  padding: 8px 6px 8px 10px; border-radius: 10px; cursor: pointer; min-height: 52px;
}
.fs-list [role=option].act { background: var(--surface-2); }
.fs-list [role=option][aria-selected="true"] .fs-tk::after { content: " ✓"; color: var(--btc-ink); }
.fs-id { min-width: 0; }
.fs-tk { font-weight: 700; }
.fs-nm { margin-left: 8px; font-size: 13px; color: var(--ink-2); }
.fs-meta { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-id { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-yl { font-size: 14px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.fs-yl small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.fs-fav {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 17px;
  color: var(--ink-3); transition: color .12s var(--ease), background .12s var(--ease);
}
.fs-fav:hover { background: var(--surface-2); color: var(--ink); }
.fs-fav.on { color: var(--btc-ink); }
.fs-add {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 700;
  border: 1px solid var(--line); color: var(--ink-2); transition: background .12s var(--ease);
}
.fs-add:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fs-add.on { background: var(--btc-soft); color: var(--btc-ink); border-color: transparent; font-size: 14px; }
.fs-empty { padding: 16px 10px; font-size: 14px; color: var(--ink-2); }
.fs-foot { margin: 0; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.fs-foot kbd { font: inherit; font-weight: 700; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; }
@media (pointer: coarse) { .fs-foot { display: none; } }

/* ---------- Compare tray ---------- */
.tray { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.tray-h { width: 100%; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.tchip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 2px 0 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 700;
}
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tx { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.tx:hover { background: var(--surface-2); color: var(--ink); }
.tx svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tadd {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px dashed var(--ink-3); background: none; color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tadd:hover { border-style: solid; }

/* ---------- Compare results ---------- */
body.comparing #nav-block, body.comparing .translate, body.comparing #delta, body.comparing .compare, body.comparing #cmp-hint { display: none !important; }
.board { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; }
.board li {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; grid-template-areas: "r id v" ". bar bar" ". m t";
  align-items: center;
  column-gap: 8px; row-gap: 3px; padding: 8px 6px; border-radius: 10px; cursor: default;
}
.board li:hover { background: var(--surface-2); }
.b-rank { grid-area: r; font-size: 12px; color: var(--ink-3); font-weight: 600; padding-top: 2px; font-variant-numeric: tabular-nums; }
.b-id { grid-area: id; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-nm { margin-left: 8px; font-size: 12px; color: var(--ink-3); }
.b-v { grid-area: v; font-weight: 700; font-variant-numeric: tabular-nums; }
.b-bar { grid-area: bar; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.b-bar i { display: block; height: 100%; border-radius: 3px; transition: width .3s var(--ease); }
.b-m { grid-area: m; font-size: 12px; color: var(--ink-2); }
.b-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--btc-soft); color: var(--btc-ink); font-weight: 600; font-size: 11px; }
.b-tune {
  grid-area: t; justify-self: end; display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.b-tune:hover, .b-tune[aria-expanded="true"] { border-color: var(--ink-3); background: var(--surface-2); }
.b-tune svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.slider-wrap.tune-wrap { padding-top: 10px; }
.sheet .slider-head { margin-top: 4px; }
.chart .line.cmp { stroke-width: 2; transition: opacity .15s var(--ease); }
.chart .end-dot.cmp { stroke: var(--surface); stroke-width: 2; }
.chart .end-lbl.cmp { fill: var(--ink); font-size: 11px; font-weight: 700; transition: opacity .15s var(--ease); }
.chart.focus [data-t]:not(.on) { opacity: .18; }
.chart.focus .line.cmp.on { stroke-width: 3; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.tooltip .tt-row i { width: 8px; height: 8px; border-radius: 2px; }
.tooltip .tt-row b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
#bd-cmp table { font-size: 13px; margin-top: 10px; }
#bd-cmp td:first-child { white-space: nowrap; }
#bd-cmp .sw { margin-right: 6px; vertical-align: 0; }
.fund-list .check { width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--line); }
.sheet .fs-cats { border: 0; padding: 0; }

/* ---------- Tooltip "i" ---------- */
.tip {
  position: relative; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--ink-3); background: none;
  font: italic 600 11px/16px Georgia, serif; color: var(--ink-2); padding: 0; cursor: help; vertical-align: 1px; margin-left: 2px;
}
.tip::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px);
  width: min(280px, 80vw); padding: 10px 12px; border-radius: 10px; background: var(--ink); color: var(--bg);
  font: 400 13px/1.45 var(--font); text-align: left; opacity: 0; pointer-events: none; z-index: 20;
  transition: opacity .15s var(--ease), transform .15s var(--ease); box-shadow: var(--shadow);
}
.tip:hover::after, .tip:focus-visible::after, .tip.open::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Zoned slider ---------- */
.slider-block { background: var(--surface); border-radius: var(--r-card); padding: 14px 16px 10px; box-shadow: var(--shadow); margin-bottom: 18px; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; color: var(--ink-2); }
.slider-val { color: var(--ink); }
.val-in {
  display: inline-flex; align-items: baseline; gap: 2px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); cursor: text; transition: border-color .15s var(--ease);
}
.val-in:hover, .val-in:focus-within { border-color: var(--ink-3); }
.val-in input {
  width: 3.3ch; border: 0; padding: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 700;
  text-align: right; font-variant-numeric: tabular-nums; outline: none;
}
.val-in span { font-weight: 600; }
.zone-word { display: inline-block; font-weight: 600; }
.zone-word.swap { animation: zoneswap .22s var(--ease); }
@keyframes zoneswap { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.slider-wrap { position: relative; padding-top: 30px; }
.bubble {
  position: absolute; top: 0; transform: translateX(-50%) scale(.85); padding: 2px 8px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity .12s var(--ease), transform .12s var(--ease); white-space: nowrap;
}
.slider-wrap.dragging .bubble { opacity: 1; transform: translateX(-50%) scale(1); }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 0; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: var(--track, var(--zone-2)); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 999px; background: var(--track, var(--zone-2)); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--ink); box-shadow: var(--shadow); transition: transform .12s var(--ease);
}
input[type=range]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); transition: transform .12s var(--ease);
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.06); }
input[type=range].detent::-webkit-slider-thumb { transform: scale(1.16); }
input[type=range].detent::-moz-range-thumb { transform: scale(1.16); }
.zone-labels { position: relative; height: 18px; font-size: 12px; color: var(--ink-2); }
.zone-labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

/* ---------- Assumptions ---------- */
.assumptions h2, .breakdown summary, .table-view summary { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; margin: 0 0 6px; }
.assumptions ul { list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--ink-2); }
.assumptions li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.remember { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 36px; font-size: 14px; color: var(--ink); cursor: pointer; }
.remember input {
  appearance: none; flex: none; width: 36px; height: 22px; margin: 0; border-radius: 999px; background: var(--line); position: relative;
  cursor: pointer; transition: background .18s var(--ease);
}
.remember input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .18s var(--ease);
}
.remember input:checked { background: var(--btc); }
.remember input:checked::after { transform: translateX(14px); }
.remember input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (forced-colors: active) { .remember input { appearance: auto; } .remember input::after { display: none; } }
.remember-note { margin: 2px 0 0 46px; font-size: 12px; color: var(--ink-3); }
.assumptions li b, .assumptions .tok { color: var(--ink); }

/* ---------- Result card ---------- */
.card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; container: card / inline-size; }
@media (min-width: 640px) { .card { padding: 24px; } }
.seg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.hero-what { margin: 14px 0 -6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.b-bar.neg i { opacity: .45; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; min-height: 32px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: background .18s var(--ease), color .18s var(--ease); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.hero { padding: 18px 0 8px; }
.hero-num {
  display: flex; align-items: flex-end; font-weight: 700; letter-spacing: -.03em; line-height: 1;
  font-size: clamp(46px, 13vw, 72px); height: 1.05em; color: var(--ink);
}
.glyph { display: inline-block; transition: opacity .18s var(--ease), transform .18s var(--ease); }
.glyph.morph { opacity: 0; transform: translateY(.15em) scale(.9); }
#hero-pre { color: var(--btc-ink); margin-right: .06em; }
.glyph.suf { font-size: .38em; font-weight: 600; margin-left: .25em; padding-bottom: .12em; letter-spacing: 0; color: var(--ink-2); }
.odo { display: inline-flex; align-items: flex-end; }
.odo .d { display: inline-block; width: 1ch; height: 1em; overflow: hidden; text-align: center; }
.odo .strip { display: flex; flex-direction: column; transform: translateY(calc(var(--d) * -1em)); transition: transform .18s var(--ease); }
.odo .strip span { display: block; height: 1em; line-height: 1em; }
.odo .c { display: inline-block; height: 1em; line-height: 1em; }
.odo .fr { font-size: .6em; color: var(--ink-2); }
.odo.instant .strip { transition: none; }
.hero-sub { margin: 10px 0 0; color: var(--ink-2); font-size: 15px; }
.hero-cap { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.hero.scrubbing .hero-cap { color: var(--btc-ink); }
.translate {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 12px 6px 10px; border-radius: 10px;
  border: 0; background: var(--btc-soft); color: var(--ink); font-size: 14px; cursor: pointer; text-align: left;
}
.translate::before { content: "↻"; color: var(--btc-ink); font-weight: 700; }
.translate span { transition: opacity .15s var(--ease); }
.translate.fade span { opacity: 0; }
.delta { margin: 10px 0 0; font-size: 14px; font-weight: 600; }
.delta .up { color: var(--up); } .delta .down { color: var(--down); }

/* ---------- Chart ---------- */
.chart-head { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; min-height: 22px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
.legend i.band { height: 8px; border: 0; border-radius: 2px; background: var(--btc-soft); }
.legend i.dash { border-top-style: dashed; }
.chart { position: relative; margin: 6px -4px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; border-radius: 8px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-t { fill: var(--ink-3); font-size: 11px; }
.chart .comb { stroke: var(--ink-3); stroke-width: 1; opacity: .55; }
.chart .comb-hit { stroke: var(--btc); opacity: 1; stroke-width: 2; }
.chart .band { fill: var(--btc-soft); }
.chart .area { fill: url(#areaGrad); }
.chart .line { fill: none; stroke: var(--btc); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.bench { stroke: var(--bench); stroke-dasharray: 5 4; stroke-width: 2; }
.chart .line.drip { stroke: var(--fund); stroke-dasharray: 5 4; stroke-width: 2; }
.chart .end-dot { fill: var(--btc); stroke: var(--surface); stroke-width: 2; }
.chart .end-lbl { fill: var(--ink); font-size: 12px; font-weight: 700; }
.chart .end-lbl.sub { fill: var(--ink-2); font-weight: 500; }
.chart .rule { stroke: var(--ink-2); stroke-width: 1; }
.chart .scrub-dot { fill: var(--surface); stroke: var(--btc); stroke-width: 2.5; }
.chart .flag { transition: transform .32s var(--ease), opacity .2s var(--ease); }
.chart .flag line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 2; }
.chart .flag circle { fill: var(--surface); stroke: var(--btc); stroke-width: 2; }
.chart .flag text { fill: var(--ink-2); font-size: 11px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .flag.whole circle { fill: var(--btc); }
.chart .flag.whole text { fill: var(--btc-ink); }
.chart .flag .glow { fill: var(--btc); opacity: 0; }
.chart .flag.pulse .glow { animation: glow 1.1s var(--ease) 1; }
@keyframes glow { 0% { opacity: .55; r: 5; } 100% { opacity: 0; r: 22; } }
.chart .flag.hidden { opacity: 0; }
.tooltip {
  position: absolute; top: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 10px;
  font-size: 12px; line-height: 1.4; white-space: nowrap; box-shadow: var(--shadow); transform: translateX(-50%); z-index: 5;
}
.tooltip b { font-weight: 700; }
.tooltip .tt-dim { opacity: .7; }

.chart-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 10px; }
.chart-controls .chips button { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.compare { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cmp-hint { font-size: 13px; margin: 10px 0 0; }

.breakdown, .table-view { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.breakdown summary, .table-view summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.breakdown summary::after, .table-view summary::after { content: "▾"; transition: transform .18s var(--ease); }
details[open] > summary::after { transform: rotate(180deg); }
summary::-webkit-details-marker { display: none; }
.breakdown dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 10px 0 0; font-size: 14px; }
.breakdown dt { color: var(--ink-2); }
.breakdown dt.sub { padding-left: 14px; }
.breakdown dd { margin: 0; text-align: right; font-weight: 600; }
.breakdown .total { border-top: 1px solid var(--line); padding-top: 8px; }
.table-scroll { overflow-x: auto; margin-top: 10px; }
table { border-collapse: collapse; font-size: 13px; width: 100%; }
th, td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--ink-2); font-weight: 600; }
.card-note { font-size: 13px; color: var(--ink-2); margin: 16px 0 0; }

.how { padding-block: 24px 8px; color: var(--ink-2); font-size: 14px; }
.how h2 { color: var(--ink); font-size: 17px; }
.foot { text-align: center; font-size: 12px; color: var(--ink-3); padding: 24px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Sticky bar (mobile) ---------- */
.sticky {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 18px;
  background: var(--ink); color: var(--bg); border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: rise .22s var(--ease);
}
.sticky-num { font-weight: 700; font-size: 17px; }
.sticky-btn { border: 0; border-radius: 999px; background: var(--btc); color: #1a1205; font-weight: 700; padding: 10px 16px; min-height: 44px; cursor: pointer; }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 1024px) { .sticky { display: none !important; } }

/* ---------- Sheet / popover ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); color: var(--ink);
  border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.2); max-height: 85vh; overflow: auto;
  padding: 6px 16px calc(20px + env(safe-area-inset-bottom, 0px)); animation: sheetup .26s var(--ease);
}
@keyframes sheetup { from { transform: translateY(100%); } }
.sheet.pop {
  left: auto; right: auto; bottom: auto; width: 380px; border-radius: 16px; padding: 6px 16px 18px; animation: popin .16s var(--ease);
  box-shadow: 0 12px 40px rgba(0,0,0,.22); border: 1px solid var(--line);
}
@keyframes popin { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.sheet.pop .grabber { display: none; }
.grabber { width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 6px auto 4px; cursor: grab; touch-action: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-size: 17px; margin: 8px 0; }
.sheet-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.big {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 12px;
}
.big input {
  width: 100%; min-width: 0; border: 0; background: transparent; text-align: center; color: var(--ink);
  font: 700 34px/1.1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.big input:focus { outline: none; }
.big.spring input { animation: spring .4s var(--ease); }
@keyframes spring { 30% { transform: translateX(-6px); } 60% { transform: translateX(4px); } 100% { transform: none; } }
.step { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 22px; font-weight: 600; cursor: pointer; }
.bound-note { font-size: 13px; color: var(--ink-2); margin: -4px 0 0; min-height: 0; }
.bound-note:empty { display: none; }
.help { font-size: 13px; color: var(--ink-2); margin: 0; }

/* Ruler picker */
.ruler { position: relative; }
.ruler-track {
  display: flex; align-items: flex-end; gap: 0; overflow-x: auto; scroll-snap-type: x mandatory; height: 64px;
  padding: 0 50%; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
.ruler-track::-webkit-scrollbar { display: none; }
.ruler-track .t { flex: none; width: 12px; height: 100%; scroll-snap-align: center; position: relative; }
.ruler-track .t::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 2px; height: 16px; background: var(--ink-3); border-radius: 1px; transform: translateX(-50%); }
.ruler-track .t.major::after { height: 28px; background: var(--ink-2); }
.ruler-track .t span { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.ruler-needle { position: absolute; left: 50%; bottom: 0; width: 3px; height: 40px; background: var(--btc); border-radius: 2px; transform: translateX(-50%); pointer-events: none; }

/* Fund list */
.search { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); padding: 0 14px; font: inherit; }
.fund-list { list-style: none; margin: 0; padding: 0; }
.fund-list button {
  width: 100%; display: grid; grid-template-columns: 1fr auto 22px; align-items: center; gap: 12px; text-align: left;
  border: 0; border-bottom: 1px solid var(--line); background: none; padding: 12px 2px; cursor: pointer; min-height: 56px;
}
.fund-list .tk { font-weight: 700; }
.fund-list .nm { display: block; font-size: 12px; color: var(--ink-2); }
.fund-list .yl { font-size: 13px; color: var(--ink-2); text-align: right; }
.fund-list .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); }
.fund-list [aria-checked="true"] .radio { border: 6px solid var(--btc); }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow);
  animation: rise .2s var(--ease); max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Loading: placeholders hold every slot at its final size so nothing jumps when the engine arrives ---------- */
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.loading .tok:empty, .loading .sk-chip, .loading #odo:empty, .loading .hero-sub:empty, .loading .hero-cap:empty,
.loading .translate, .loading .legend:empty, .loading .chart, .loading #band-note:empty {
  background: linear-gradient(90deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 50%, var(--surface-2) 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px; color: transparent;
}
.loading .tok:empty { display: inline-block; height: 1.05em; vertical-align: -.12em; text-decoration: none; }
.loading .tok[data-edit="amt"]:empty { width: 6.6ch; }
.loading .tok[data-edit="fund"]:empty { width: 4.4ch; }
.loading .tok[data-edit="sw"]:empty { width: 4.3ch; }
.loading .tok[data-edit="y"]:empty { width: 5.6ch; }
.loading .tok[data-edit="d"]:empty { width: 4.6ch; }
.loading .tok.sm:empty { width: 4ch; }
.loading #band-note:empty { display: inline-block; width: 11ch; height: 1em; vertical-align: -.1em; margin-left: 4px; }
.sk-chip { display: inline-block; width: 72px; height: 36px; border-radius: 999px !important; }
.loading #odo:empty { display: inline-block; width: 3.6em; height: .86em; border-radius: 14px; }
.loading .hero-sub:empty { width: 72%; height: 22.5px; }
.loading .hero-cap:empty { width: 46%; height: 1.2em; margin-top: 4px; }
.loading .translate { width: 86%; height: 33px; }
.loading .translate::before { visibility: hidden; }
.loading .legend:empty { width: 60%; height: 18px; }
.loading .chart { height: 230px; }
@container card (min-width: 608px) { .loading .chart { height: 300px; } }
@media (max-width: 519.98px) { .loading .translate { height: 54px; } }
@media (prefers-reduced-motion: reduce) { .loading * { animation: none !important; } }

/* ---------- Start-date picker ---------- */
.cal-quick { margin-bottom: 12px; }
.cal-quick button { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.cal-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; margin-bottom: 6px; }
.cal-nav, .cal-title { border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; border-radius: 10px; min-height: 40px; }
.cal-nav { font-size: 22px; line-height: 1; }
.cal-nav:hover:not(:disabled), .cal-title:hover:not(:disabled) { background: var(--surface-2); }
.cal-nav:disabled { opacity: .3; cursor: default; }
.cal-title { font-size: 15px; font-weight: 700; }
.cal-title span { color: var(--ink-3); font-size: 12px; }
.cal-title:disabled { cursor: default; }
.cal-grid [role=row] { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 4px 0; }
.cal-grid [role=gridcell] { display: grid; place-items: center; padding: 1px; }
.cal-grid button {
  width: 100%; max-width: 44px; aspect-ratio: 1; border: 0; border-radius: 50%; background: none; color: var(--ink);
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; position: relative;
  transition: background .12s var(--ease);
}
.cal-grid button:hover:not(:disabled) { background: var(--surface-2); }
.cal-grid button.other { color: var(--ink-3); }
.cal-grid button.past:not(.other) { color: var(--ink-2); }
.cal-grid button.today::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--btc); }
.cal-grid [aria-selected="true"] button, .cal-grid [aria-selected="true"] button.past:not(.other), .cal-grid [aria-selected="true"] button.other { background: var(--ink); color: var(--bg); font-weight: 700; }
.cal-grid [aria-selected="true"] button.today::after { background: var(--bg); }
.cal-grid button:disabled { opacity: .25; cursor: default; }
.cal button:focus-visible { outline: 2px solid var(--btc); outline-offset: 1px; }
.cal-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0; }
.cal-tiles button {
  min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.cal-tiles button:hover:not(:disabled) { border-color: var(--ink-3); }
.cal-tiles button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cal-tiles button.today:not([aria-pressed="true"]) { border-color: var(--btc); }
.cal-tiles button:disabled { opacity: .3; cursor: default; }
.cal-note { min-height: 1.4em; margin-top: 10px; }
.cal-note .link-btn { min-height: 0; padding: 0; font-size: inherit; }
@media (forced-colors: active) { .cal-grid [aria-selected="true"] button { outline: 2px solid CanvasText; } }

/* ---------- Embed card (?embed=1) ---------- */
body.embed { background: var(--surface); min-height: 100vh; }
body.embed > :not(.em):not(script) { display: none !important; }
body.embed { padding: 0; }
.em { box-sizing: border-box; height: 100vh; padding: 14px 16px 12px; display: flex; flex-direction: column; color: var(--ink); font-size: 14px; overflow: hidden; }
.em p { margin: 0; }
.em-brand { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-weight: 700; font-size: 13px; color: var(--ink); text-decoration: none; }
.em-brand .wm-coin { width: 20px; height: 20px; font-size: 12px; }
.em-what { margin-top: 10px !important; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.em-num { font-size: 36px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.em-sub { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-spark { flex: 1; width: 100%; min-height: 40px; margin: 8px 0 4px; overflow: visible; }
.em-spark path { fill: none; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.em-spark .zero { stroke: var(--line); stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.em-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; color: var(--ink-2); margin-bottom: 4px !important; }
.em-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.em-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.em-foot { font-size: 12px; color: var(--ink-3); }
.em-foot a { color: var(--btc-ink); font-weight: 600; }
/* The Embed sheet */
.em-preview { display: block; width: 100%; border: 1px solid var(--line); border-radius: 16px; margin: 10px 0 12px; background: var(--surface); }
.em-code {
  width: 100%; box-sizing: border-box; margin: 12px 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; resize: none;
  background: var(--surface-2); color: var(--ink); font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.em-copy {
  width: 100%; min-height: 44px; border: 0; border-radius: 12px; background: var(--ink); color: var(--bg); font: inherit; font-weight: 700; cursor: pointer;
}
