/* Crypto Predictor — "ledger" design system
   Ink-blue ledger surfaces, isometric blocks, a probability lattice for the future.
   Orange = now / brand (Bitcoin), mint = up, coral = down, violet = the AI. */

:root {
  --font-display: "Unbounded", "Instrument Sans", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hash: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.875rem;
  --step-4: clamp(2.25rem, 4.6vw, 3.5rem);
  --step-5: clamp(2.6rem, 6.4vw, 4.75rem);

  --r-s: 6px; --r-m: 12px; --r-l: 20px;
  --pad: clamp(16px, 3.2vw, 40px);
  --maxw: 1320px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
  --bg: #0A0E24;
  --bg-deep: #070A1B;
  --surface: #10163A;
  --surface-2: #162050;
  --line: #243066;
  --line-soft: #1A2452;
  --text: #ECEFFF;
  --muted: #9AA2CC;
  --faint: #626C9C;
  --now: #F7931A;
  --now-soft: rgba(247, 147, 26, .14);
  --up: #22D3A0;
  --up-soft: rgba(34, 211, 160, .14);
  --down: #FF5C7A;
  --down-soft: rgba(255, 92, 122, .14);
  --ai: #8B7BFF;
  --ai-soft: rgba(139, 123, 255, .16);
  --lattice: 139, 123, 255;
  --cube-top: #FFB347; --cube-left: #F7931A; --cube-right: #B8640A;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #EEF1FA;
  --bg-deep: #E3E8F6;
  --surface: #FFFFFF;
  --surface-2: #F4F6FD;
  --line: #CDD4EC;
  --line-soft: #DFE4F4;
  --text: #121838;
  --muted: #535D88;
  --faint: #8A93B8;
  --now: #D9740B;
  --now-soft: rgba(217, 116, 11, .12);
  --up: #0B9B72;
  --up-soft: rgba(11, 155, 114, .12);
  --down: #D33656;
  --down-soft: rgba(211, 54, 86, .1);
  --ai: #5B47E0;
  --ai-soft: rgba(91, 71, 224, .1);
  --lattice: 91, 71, 224;
  --cube-top: #FFC066; --cube-left: #F28C1B; --cube-right: #B4600C;
  --shadow: 0 24px 50px -28px rgba(18, 24, 56, .35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--step-0)/1.55 var(--font-body);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-image:
    radial-gradient(1200px 500px at 85% -10%, var(--ai-soft), transparent 60%),
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: auto, 56px 56px, 56px 56px;
  background-attachment: fixed;
}
[data-theme="light"] body { background-image: radial-gradient(1200px 500px at 85% -10%, var(--ai-soft), transparent 60%), linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px); }
svg { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--now); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--font-hash); font-feature-settings: normal; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.up { color: var(--up); } .down { color: var(--down); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--now); color: #000; padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 12px var(--pad);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.mark { width: 30px; height: 30px; }
.m-top { fill: var(--cube-top); } .m-left { fill: var(--cube-left); } .m-right { fill: var(--cube-right); }
.brand-name { font: 600 1rem/1 var(--font-display); letter-spacing: -.01em; white-space: nowrap; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 220px;
  padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: var(--step--1);
}
.search-trigger svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.search-trigger kbd { margin-left: auto; font: 500 11px var(--font-hash); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.search-trigger:hover { border-color: var(--faint); color: var(--text); }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: var(--step--1); white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.ask-btn {
  display: flex; align-items: center; gap: 8px; border: 0; border-radius: 999px;
  padding: 10px 16px; font-weight: 600; font-size: var(--step--1);
  background: var(--ai); color: #fff; box-shadow: 0 8px 24px -10px var(--ai);
}
.ask-btn:hover { filter: brightness(1.08); }
.ask-short { display: none; }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.pro-btn { border: 1px solid var(--now); color: var(--now); background: transparent; border-radius: 999px; padding: 9px 14px; font-weight: 600; font-size: var(--step--1); }

/* ---------------------------------------------------------------- chain strip */
.chain { display: flex; align-items: stretch; border-bottom: 1px solid var(--line-soft); background: var(--bg-deep); height: 46px; overflow: hidden; }
.chain-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 var(--pad); border-right: 1px solid var(--line-soft); font-size: var(--step--1); color: var(--muted); }
.chain-head .mono { color: var(--text); font-size: 13px; }
.block-cube { width: 14px; height: 14px; background: linear-gradient(135deg, var(--cube-top) 0 50%, var(--cube-left) 50%); transform: rotate(45deg) skew(-8deg, -8deg); border-radius: 2px; }
.chain.mined .block-cube { animation: mine 1.2s var(--ease); }
@keyframes mine { 0% { transform: translateY(-26px) rotate(45deg); opacity: 0; } 60% { transform: translateY(3px) rotate(45deg); opacity: 1; } 100% { transform: rotate(45deg) skew(-8deg,-8deg); } }
.chain-track { flex: 1; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.chain-rail { display: flex; align-items: center; height: 100%; width: max-content; animation: rail 90s linear infinite; }
.chain-rail:hover { animation-play-state: paused; }
@keyframes rail { to { transform: translateX(-50%); } }
.link { display: flex; align-items: center; gap: 8px; padding: 0 16px; height: 30px; text-decoration: none; font-size: var(--step--1); white-space: nowrap; position: relative; }
.link::after { content: ""; position: absolute; right: -6px; width: 12px; height: 2px; background: var(--line); }
.link b { font-weight: 600; }
.link img { width: 16px; height: 16px; border-radius: 50%; }
.link .stat-k { color: var(--muted); }

/* ---------------------------------------------------------------- layout */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad) 40px; outline: none; }
.view { animation: viewin .35s var(--ease); }
@keyframes viewin { from { opacity: 0; transform: translateY(6px); } }
.section { margin-top: clamp(40px, 6vw, 72px); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; line-height: 1.12; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
.lede { color: var(--muted); max-width: 62ch; margin: 6px 0 0; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-l); padding: clamp(16px, 2.4vw, 26px); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.page-head { padding-top: clamp(28px, 5vw, 56px); }
.page-head h1 { font-size: var(--step-4); max-width: 18ch; }

/* ---------------------------------------------------------------- forecast hero */
.hero > * { min-width: 0; }
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(20px, 3vw, 44px); padding-top: clamp(24px, 4vw, 48px); align-items: start; }
.coin-id { display: flex; align-items: center; gap: 12px; }
.coin-id img { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); }
.coin-id .name { font: 600 var(--step-1)/1.1 var(--font-display); }
.coin-id .sym { color: var(--muted); font-size: var(--step--1); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip.stance-bull { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); background: var(--up-soft); }
.chip.stance-bear { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); background: var(--down-soft); }
.spot { display: flex; align-items: baseline; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.spot .price { font: 500 var(--step-2)/1 var(--font-display); }
.spot .chg { font-weight: 600; }
.spot .label { color: var(--muted); font-size: var(--step--1); }

.horizons { display: flex; gap: 4px; padding: 4px; margin-top: 26px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-soft); width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.horizons button { border: 0; background: transparent; padding: 8px 13px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: var(--step--1); white-space: nowrap; }
.horizons button[aria-pressed="true"] { background: var(--now); color: #160C00; }
.horizons button:hover:not([aria-pressed="true"]) { color: var(--text); }

.verdict { margin-top: 26px; }
.verdict .q { color: var(--muted); font-size: var(--step-1); margin: 0; }
.verdict .target { font: 600 var(--step-5)/0.98 var(--font-display); letter-spacing: -.035em; margin: 8px 0 10px; font-variant-numeric: tabular-nums; }
.verdict .move { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: var(--step-1); }
.verdict .move .pct { font-weight: 700; }
.verdict .stance-line { margin: 14px 0 0; color: var(--muted); max-width: 46ch; }

.prob { margin-top: 22px; }
.prob-bar { position: relative; height: 10px; border-radius: 999px; background: var(--down-soft); overflow: hidden; }
.prob-bar span { position: absolute; inset: 0 auto 0 0; background: var(--up); border-radius: 999px; transition: width .8s var(--ease); }
.prob-label { display: flex; justify-content: space-between; font-size: var(--step--1); color: var(--muted); margin-top: 6px; }
.prob-label b { color: var(--text); }

/* three cases as isometric blocks */
.cases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.case { position: relative; padding: 14px 14px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-soft); }
.case::before { content: ""; position: absolute; left: 10px; right: -6px; top: -7px; height: 7px; background: var(--surface-2); transform: skewX(-40deg); transform-origin: bottom; border-radius: 3px 3px 0 0; border: 1px solid var(--line-soft); border-bottom: 0; }
.case::after { content: ""; position: absolute; top: -4px; right: -7px; bottom: 7px; width: 7px; background: var(--bg-deep); transform: skewY(-50deg); transform-origin: left; border: 1px solid var(--line-soft); border-left: 0; }
.case .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.case .k i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.case .v { font: 600 var(--step-1)/1.2 var(--font-display); margin-top: 6px; }
.case .p { font-size: var(--step--1); font-weight: 600; }
.case.base { border-color: color-mix(in srgb, var(--ai) 55%, transparent); }
.case.base .k i { background: var(--ai); } .case.bear .k i { background: var(--down); } .case.bull .k i { background: var(--up); }

/* chart */
.chart-wrap { position: relative; }
.chart-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--line-soft); background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.chart { width: 100%; height: clamp(320px, 42vw, 470px); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-l); overflow: hidden; touch-action: pan-y; }
.chart svg { width: 100%; height: 100%; }
.chart .grid-l { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-t { fill: var(--faint); font: 500 11px var(--font-body); }
.chart .hist { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; }
.chart .hist-area { fill: url(#histFill); }
.chart .sma50 { fill: none; stroke: var(--now); stroke-width: 1.1; opacity: .7; }
.chart .sma200 { fill: none; stroke: var(--ai); stroke-width: 1.1; opacity: .7; stroke-dasharray: 4 3; }
.chart .now-line { stroke: var(--now); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .cell { fill: rgb(var(--lattice)); }
.chart .band { fill: none; stroke-width: 1.4; }
.chart .band.bull { stroke: var(--up); } .chart .band.bear { stroke: var(--down); }
.chart .median { fill: none; stroke: var(--ai); stroke-width: 2.2; filter: drop-shadow(0 0 5px rgba(var(--lattice), .55)); }
.chart .end-label rect { fill: var(--surface-2); stroke: var(--line); }
.chart .end-label text { fill: var(--text); font: 600 11px var(--font-body); }
.chart .zone-t { fill: var(--muted); font: 600 11px var(--font-body); }
.chart .xhair { stroke: var(--faint); stroke-width: 1; }
.chart .now-dot { fill: var(--now); stroke: var(--bg); stroke-width: 2; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; transform: translate(-50%, -110%); }
.chart-tip b { font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---------------------------------------------------------------- driver chain */
.drivers { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 6px 2px 14px; scrollbar-width: thin; }
.dnode { flex: 1 0 150px; max-width: 220px; position: relative; padding: 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-soft); }
.dnode + .dnode { margin-left: 34px; }
.dnode + .dnode::before { content: ""; position: absolute; left: -35px; top: 50%; width: 34px; height: 10px; transform: translateY(-50%);
  background: radial-gradient(circle at 5px 5px, transparent 3px, var(--line) 3.5px 5px, transparent 5.5px) left/12px 10px repeat-x; }
.dnode .dk { font-size: 12px; color: var(--muted); }
.dnode .dv { font: 600 var(--step-2)/1.1 var(--font-display); margin-top: 4px; }
.dnode .dd { font-size: 12px; color: var(--faint); margin-top: 6px; line-height: 1.4; }
.dnode.ends { background: transparent; border-style: dashed; }
.dnode.ends.final { border: 1px solid var(--ai); background: var(--ai-soft); border-style: solid; }


/* ---------------------------------------------------------------- stat tiles */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-soft); border-radius: var(--r-l); overflow: hidden; background: var(--surface); }
.fact { padding: 16px 18px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.fact .fk { font-size: 12px; color: var(--muted); }
.fact .fv { font: 600 var(--step-1)/1.25 var(--font-display); margin-top: 4px; }
.fact .fs { font-size: 12px; color: var(--faint); margin-top: 2px; }

/* cycle clock */
.cycle { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: clamp(20px, 3vw, 40px); align-items: center; }
.clock svg { width: 100%; height: auto; }
.clock .ring { fill: none; stroke: var(--line); stroke-width: 14; }
.clock .ring-arc { fill: none; stroke: var(--now); stroke-width: 14; stroke-linecap: round; }
.clock .tick { stroke: var(--faint); stroke-width: 2; }
.clock .zone-bear { fill: none; stroke: var(--down-soft); stroke-width: 30; }
.clock .zone-bull { fill: none; stroke: var(--up-soft); stroke-width: 30; }
.clock text { fill: var(--muted); font: 500 10px var(--font-body); }
.clock .big { fill: var(--text); font: 600 26px var(--font-display); }
.analogs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.analogs .chip { font-family: var(--font-hash); }

/* signals mini */
.gauge svg { width: 100%; max-width: 220px; height: auto; }
.gauge .g-bg { fill: none; stroke: var(--line); stroke-width: 12; stroke-linecap: round; }
.gauge .g-val { fill: none; stroke-width: 12; stroke-linecap: round; }
.sig-v { font: 600 var(--step-3)/1 var(--font-display); }
.spark { width: 100%; height: 56px; }
.spark path { fill: none; stroke-width: 1.6; }

/* news */
.news { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.news a { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); text-decoration: none; }
.news a:hover .t { color: var(--now); }
.news .t { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.news a > * { min-width: 0; }
.news .s { color: var(--faint); font-size: 12px; white-space: nowrap; }

/* ---------------------------------------------------------------- markets */
.blockmap { position: relative; height: clamp(320px, 40vw, 460px); border-radius: var(--r-l); overflow: hidden; background: var(--bg-deep); border: 1px solid var(--line-soft); }
.tile { position: absolute; padding: 10px; border: 2px solid var(--bg-deep); border-radius: 8px; text-decoration: none; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; transition: filter .15s; }
.tile:hover { filter: brightness(1.15); z-index: 2; }
.tile b { font: 600 clamp(11px, 1.3vw, 18px)/1.1 var(--font-display); }
.tile span { font-size: 12px; font-weight: 600; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-l); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.tbl th { text-align: right; font-weight: 600; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl td { text-align: right; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child, .tbl th:nth-child(2), .tbl td:nth-child(2) { text-align: left; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .cn { display: flex; align-items: center; gap: 10px; }
.tbl .cn img { width: 22px; height: 22px; border-radius: 50%; }
.tbl .cn small { color: var(--muted); }
.tbl svg.spk { width: 96px; height: 28px; display: inline-block; vertical-align: middle; }
.outlook { font-weight: 700; }
.filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.input { padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: var(--step--1); min-width: 220px; }

/* ---------------------------------------------------------------- track record */
.score-row { display: grid; grid-template-columns: 170px repeat(6, 1fr); align-items: center; border-bottom: 1px solid var(--line-soft); }
.score-row > * { padding: 12px 10px; }
.score-row.head { color: var(--muted); font-size: 12px; font-weight: 600; }
.score-cell { font-weight: 700; }
.score-cell small { display: block; font-weight: 500; color: var(--faint); font-size: 11px; }
.bar-cell { height: 6px; border-radius: 4px; background: var(--line-soft); margin-top: 6px; overflow: hidden; }
.bar-cell span { display: block; height: 100%; background: var(--up); }

/* ---------------------------------------------------------------- how it works */
.layers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 24px; }
.layer { position: relative; padding: 22px; border: 1px solid var(--line-soft); background: var(--surface); }
.layer:first-child { border-radius: var(--r-l) 0 0 var(--r-l); }
.layer:last-child { border-radius: 0 var(--r-l) var(--r-l) 0; }
.layer + .layer { border-left: 0; }
.layer h3 { margin: 12px 0 8px; }
.layer p { color: var(--muted); margin: 0; }
.layer .iso { width: 44px; height: 44px; }
.prose { max-width: 70ch; }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); }
.sources { columns: 2; column-gap: 32px; padding-left: 18px; color: var(--muted); }

/* ---------------------------------------------------------------- palette */
.palette { position: fixed; inset: 0; z-index: 80; background: rgba(3, 5, 15, .55); backdrop-filter: blur(4px); display: grid; place-items: start center; padding-top: 12vh; }
.palette-box { width: min(620px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.palette-input svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; }
.palette-input input { flex: 1; border: 0; background: transparent; color: var(--text); font: 500 var(--step-1) var(--font-body); outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.palette-list li[aria-selected="true"], .palette-list li:hover { background: var(--surface-2); }
.palette-list img { width: 24px; height: 24px; border-radius: 50%; }
.palette-list .r { margin-left: auto; color: var(--faint); font-size: 12px; }

/* ---------------------------------------------------------------- drawer (AI) */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(480px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); animation: slidein .3s var(--ease); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(3, 5, 15, .45); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.drawer-title { display: flex; gap: 12px; align-items: center; }
.drawer-title strong { display: block; font-family: var(--font-display); font-weight: 600; }
.drawer-title span { font-size: 12px; color: var(--muted); }
.ai-orb { width: 34px; height: 34px; border-radius: 10px; background: conic-gradient(from 210deg, var(--ai), var(--now), var(--ai)); box-shadow: 0 0 24px -6px var(--ai); }
.msgs { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; line-height: 1.55; font-size: var(--step-0); }
.msg.user { align-self: flex-end; background: var(--ai); color: #fff; padding: 10px 14px; border-radius: 16px 16px 4px 16px; }
.msg.bot { align-self: flex-start; }
.msg.bot p { margin: 0 0 10px; } .msg.bot ul, .msg.bot ol { margin: 0 0 10px; padding-left: 20px; }
.msg.bot h3, .msg.bot h4 { font-size: var(--step-0); margin: 12px 0 6px; }
.msg.bot table { border-collapse: collapse; font-size: 13px; margin: 6px 0 12px; display: block; overflow-x: auto; }
.msg.bot td, .msg.bot th { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.msg.bot strong { color: var(--text); }
.msg.bot a { color: var(--ai); }
.msg.bot .cursor { display: inline-block; width: 8px; height: 16px; background: var(--ai); vertical-align: text-bottom; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.thinking i { width: 8px; height: 8px; background: var(--ai); border-radius: 2px; animation: hop 1s var(--ease) infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes hop { 50% { transform: translateY(-5px) rotate(45deg); } }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 12px; }
.suggest button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 7px 12px; font-size: 13px; text-align: left; }
.suggest button:hover { border-color: var(--ai); }
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); padding: 11px 14px; font: inherit; max-height: 160px; }
.composer textarea:focus { outline: none; border-color: var(--ai); }
.composer button { width: 46px; border: 0; border-radius: 14px; background: var(--ai); color: #fff; display: grid; place-items: center; }
.composer button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.composer button:disabled { opacity: .5; }
.drawer-foot { margin: 0; padding: 0 16px 14px; font-size: 11px; color: var(--faint); }

/* ---------------------------------------------------------------- modal / toast / misc */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(3, 5, 15, .6); padding: 20px; }
.modal-box { position: relative; width: min(460px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 28px; box-shadow: var(--shadow); }
.modal-x { position: absolute; right: 14px; top: 14px; }
.pro-price { font: 600 var(--step-3) var(--font-display); color: var(--now); margin: 8px 0 14px; }
.pro-list { padding-left: 18px; color: var(--muted); }
.cta { width: 100%; border: 0; border-radius: 999px; padding: 13px; font-weight: 700; background: var(--now); color: #160C00; margin-top: 10px; }
.cta.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); width: auto; padding: 10px 16px; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 95; background: var(--surface-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow); font-size: var(--step--1); }
.skeleton { background: linear-gradient(90deg, var(--surface) 0, var(--surface-2) 50%, var(--surface) 100%) 0 0/200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.err { padding: 16px; border-radius: var(--r-m); background: var(--down-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--down) 40%, transparent); }
.stable-note { margin-top: 30px; padding: 24px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line-soft); max-width: 60ch; }

.foot { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--pad) 110px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 12px; }
.foot p { margin: 0 0 6px; max-width: 90ch; }
.tabbar { display: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .nav a[data-route="how"] { display: none; }
  .search-trigger { min-width: 0; } .search-trigger span, .search-trigger kbd { display: none; }
}
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cycle { grid-template-columns: 1fr; }
  .clock { max-width: 320px; }
  .layers { grid-template-columns: 1fr; }
  .layer:first-child { border-radius: var(--r-l) var(--r-l) 0 0; } .layer:last-child { border-radius: 0 0 var(--r-l) var(--r-l); }
  .layer + .layer { border-left: 1px solid var(--line-soft); border-top: 0; }
  .score-row { grid-template-columns: 120px repeat(6, minmax(64px, 1fr)); font-size: 13px; }
}
@media (max-width: 760px) {
  .nav, .brand-name { display: none; }
  .ask-btn { padding: 10px 12px; } .ask-full { display: none; } .ask-short { display: inline; }
  .chain-label { display: none; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .cases { gap: 10px; } .case { padding: 12px 10px; } .case .v { font-size: var(--step-0); }
  .drivers { flex-direction: column; overflow: visible; }
  .dnode { max-width: none; flex: none; }
  .dnode + .dnode { margin-left: 0; margin-top: 22px; }
  .dnode + .dnode::before { left: 24px; top: -23px; width: 10px; height: 22px; transform: none; background: radial-gradient(circle at 5px 5px, transparent 3px, var(--line) 3.5px 5px, transparent 5.5px) top/10px 12px repeat-y; }
  .sources { columns: 1; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .fact { padding: 12px 14px; }
  .verdict .target { font-size: clamp(2.2rem, 11vw, 3rem); }
  .chart-tools .seg:last-child { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; justify-content: space-around; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; text-decoration: none; color: var(--muted); padding: 4px 10px; border-radius: 10px; }
  .tabbar a[aria-current="page"] { color: var(--now); }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .drawer { width: 100vw; }
  .toast { bottom: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .chain-rail { animation: none; }
}

/* ================================================================ motion layer
   Transform/opacity only, a handful of elements, all off for reduced motion. */

/* ambient: one slow scan line down the ledger grid + three data packets riding grid rows */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; contain: strict; }
.ambient .scan { position: absolute; left: 0; right: 0; top: 0; height: 160px; background: linear-gradient(180deg, transparent, rgba(var(--lattice), .07) 70%, rgba(var(--lattice), .16) 99%, transparent); transform: translateY(-200px); animation: scan 16s linear infinite; will-change: transform; }
@keyframes scan { to { transform: translateY(calc(100vh + 200px)); } }
.ambient .pkt { position: absolute; left: 0; width: 56px; height: 1px; background: linear-gradient(90deg, transparent, var(--now)); opacity: .55; transform: translateX(-80px); animation: pkt 11s linear infinite; will-change: transform; }
.ambient .p1 { top: 336px; animation-delay: 1s; }
.ambient .p2 { top: 560px; animation-duration: 15s; animation-delay: 6s; background: linear-gradient(90deg, transparent, var(--ai)); }
.ambient .p3 { top: 784px; animation-duration: 13s; animation-delay: 9s; }
@keyframes pkt { 0% { transform: translateX(-80px); } 60%, 100% { transform: translateX(calc(100vw + 80px)); } }
.top, .chain, main, .foot, .tabbar { position: relative; z-index: 1; }
.top { position: sticky; z-index: 40; }
.tabbar { position: fixed; z-index: 50; }

/* logo: faces assemble once, tilt on hover */
.mark path { transform-box: fill-box; transform-origin: center; animation: face .7s var(--ease) both; }
.mark .m-left { animation-delay: .08s; } .mark .m-right { animation-delay: .16s; }
@keyframes face { from { opacity: 0; transform: translateY(-6px) scale(.9); } }
.brand:hover .mark { transform: rotate(-8deg); transition: transform .4s var(--ease); }
.mark { transition: transform .4s var(--ease); }

/* AI button: slow orbit ring */
.ai-dot { position: relative; }
.ai-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid transparent; border-top-color: rgba(255,255,255,.85); animation: spin 2.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-orb { animation: hue 8s linear infinite; }
@keyframes hue { to { filter: hue-rotate(40deg); } }

/* live block counter ticks when a new block lands */
#blockHeight.tick { animation: tick .9s var(--ease); }
@keyframes tick { 0% { color: var(--now); text-shadow: 0 0 12px var(--now); } 100% { color: var(--text); text-shadow: none; } }

/* forecast hero */
.prob-bar span { transition: width 1.1s var(--ease) .2s; }
.prob-bar::after { content: ""; position: absolute; inset: 0; width: 30%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent); transform: translateX(-100%); animation: sheen 3.6s var(--ease) 1.2s infinite; }
@keyframes sheen { 0% { transform: translateX(-100%); } 45%, 100% { transform: translateX(360%); } }
.stack-in .case { animation: stack .6s var(--ease) both; }
.stack-in .case:nth-child(2) { animation-delay: .08s; } .stack-in .case:nth-child(3) { animation-delay: .16s; }
@keyframes stack { from { opacity: 0; transform: translateY(-14px); } }
@media (hover: hover) and (pointer: fine) {
  .case { transition: transform .35s var(--ease), border-color .35s; }
  .case:hover { transform: translateY(-3px); border-color: var(--line); }
  .dnode { transition: transform .35s var(--ease), border-color .35s; }
  .dnode:hover { transform: translateY(-3px); border-color: var(--line); }
}

/* chart: lines draw in, live price pulses, a faint beam sweeps the probability lattice */
.chart .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s var(--ease) .35s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .now-ring { fill: none; stroke: var(--now); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: ping 2.4s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .9; } 80%, 100% { transform: scale(4.2); opacity: 0; } }
.chart .beam { fill: url(#beamFill); animation: beam 7s ease-in-out 1.6s infinite; opacity: 0; }
@keyframes beam { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 85%, 100% { transform: translateX(var(--travel)); opacity: 0; } }

/* driver chain: data flows along the links once visible */
.drivers.in .dnode + .dnode::before { animation: flow 1.2s linear infinite; }
@keyframes flow { to { background-position: 12px 50%; } }
@keyframes flowy { to { background-position: 50% 12px; } }
@media (max-width: 760px) { .drivers.in .dnode + .dnode::before { animation-name: flowy; } }
.drivers.reveal .dnode { opacity: 0; transform: translateX(-8px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.drivers.in .dnode { opacity: 1; transform: none; }
.drivers.in .dnode:nth-child(2) { transition-delay: .08s; } .drivers.in .dnode:nth-child(3) { transition-delay: .16s; }
.drivers.in .dnode:nth-child(4) { transition-delay: .24s; } .drivers.in .dnode:nth-child(5) { transition-delay: .32s; }
.drivers.in .dnode:nth-child(6) { transition-delay: .40s; } .drivers.in .dnode:nth-child(7) { transition-delay: .48s; }

/* halving clock: arc sweeps to today's position, marker pings */
.clock .ring-arc { stroke-dasharray: 1; stroke-dashoffset: 1; }
.clock.in .ring-arc { transition: stroke-dashoffset 1.6s var(--ease); stroke-dashoffset: 0; }
.clock .pulse-ring { fill: none; stroke: var(--now); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ping 2.8s var(--ease) infinite; }

/* markets block map: tiles settle in once */
.blockmap .tile { animation: tilein .5s var(--ease) both; }
@keyframes tilein { from { opacity: 0; transform: scale(.96); } }

/* skeletons: block-shaped loading shimmer stays */

/* below-the-fold sections render lazily for a faster first paint */
.section { content-visibility: auto; contain-intrinsic-size: auto 600px; }

@media (prefers-reduced-motion: reduce) {
  .ambient { display: none; }
  .chart .draw, .clock .ring-arc { stroke-dasharray: none; stroke-dashoffset: 0; }
  .drivers.reveal .dnode { opacity: 1; transform: none; }
  .prob-bar::after, .chart .beam, .chart .now-ring, .clock .pulse-ring { display: none; }
}

/* ================================================================ responsive refinements */
.facts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.facts-fit { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
@media (max-width: 1180px) and (min-width: 761px) {
  .ask-full { display: none; } .ask-short { display: inline; }
  .section.grid.g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) and (min-width: 761px) {
  .brand-name { display: none; }
  .nav a { padding: 8px 10px; }
}
@media (pointer: coarse) {
  .seg button { min-height: 36px; padding: 8px 13px; }
  .horizons button { min-height: 40px; }
  .nav a, .tabbar a { min-height: 40px; }
}
@media (max-width: 380px) {
  .cases { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .case { padding: 10px 8px; } .case .v { font-size: 0.875rem; }
  .verdict .target { font-size: 2.1rem; }
  .fact .fv { font-size: 0.95rem; }
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .tabbar { padding-left: 2px; padding-right: 2px; } .tabbar a { padding: 4px 2px; flex: 1; min-width: 0; }
}
