:root {
  --bg: #f5f4fb; --surface: #ffffff; --raised: #f0eff8; --line: #e4e2f0;
  --ink: #17152a; --muted: #5d5a75; --faint: #807d98;
  --up: #0a8f5b; --down: #d92d4a; --flat: #5b5bd6;
  --up-bg: #dff7ec; --down-bg: #fde4e8; --flat-bg: #e9e9fb;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0d1a; --surface: #191729; --raised: #242238; --line: #2d2a45;
    --ink: #f4f3fb; --muted: #aaa7c4; --faint: #8582a0;
    --up: #3fdc9c; --down: #ff7b90; --flat: #a5a5ff;
    --up-bg: #123a2c; --down-bg: #41192a; --flat-bg: #25254f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0d1a; --surface: #191729; --raised: #242238; --line: #2d2a45;
  --ink: #f4f3fb; --muted: #aaa7c4; --faint: #8582a0;
  --up: #3fdc9c; --down: #ff7b90; --flat: #a5a5ff;
  --up-bg: #123a2c; --down-bg: #41192a; --flat-bg: #25254f;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
:focus-visible { outline: 3px solid #8b5cf6; outline-offset: 2px; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }
.brand img { border-radius: 7px; }
.actions { display: flex; align-items: center; gap: 6px; }
.updated { font-size: 0.8rem; color: var(--faint); margin-right: 6px; white-space: nowrap; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; flex: none; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.icon-btn:hover { border-color: #8b5cf6; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
@media (max-width: 560px) { .updated { display: none; } }

.hero { position: relative; overflow: hidden; color: #fff; background:
  radial-gradient(circle at 12% 18%, #ff4d8d 0, transparent 45%),
  radial-gradient(circle at 85% 10%, #06b6d4 0, transparent 45%),
  radial-gradient(circle at 70% 95%, #f59e0b 0, transparent 40%),
  linear-gradient(120deg, #4f2bd9, #7c2bd9); }
.hero-in { max-width: 1240px; margin: 0 auto; padding: 2.25rem 16px 1.75rem; }
.hero-date { font-weight: 700; opacity: 0.92; }
.hero h1 { font-size: clamp(2.5rem, 8vw, 4.75rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 850; margin: 0.15rem 0 0.4rem; }
.hero-sub { font-size: 1.05rem; opacity: 0.95; max-width: 60ch; }
.movers-title { font-size: 0.85rem; letter-spacing: 0.02em; margin: 1.5rem 0 0.5rem; opacity: 0.95; }
.movers { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.75rem; }
.mover { display: flex; align-items: center; gap: 0.75rem; text-align: left; padding: 0.6rem 0.8rem; color: #17152a; background: rgba(255, 255, 255, 0.95); border: 0; border-radius: 14px; transition: transform .15s; min-width: 0; }
.mover:hover { transform: translateY(-2px); }
.mover span:first-child { font-size: 1.6rem; }
.mover b { display: block; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mover .pill { margin-left: auto; flex: none; }
.mover div { min-width: 0; }
.mover small { font-size: 0.78rem; color: #5d5a75; }
.mover .pill.up { background: #dff7ec; color: #0a7a4e; }
.mover .pill.down { background: #fde4e8; color: #c0223d; }
.mover .pill.flat { background: #e9e9fb; color: #4a4ac4; }

.filters { position: sticky; top: 57px; z-index: 15; display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; padding: 0.6rem 16px; background: var(--bg); justify-content: safe center; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; word-spacing: 0.15em; padding: 0.3rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 0.85rem; font-weight: 600; }
.filters button:hover { border-color: var(--c, #8b5cf6); }
.filters button[aria-pressed="true"] { background: var(--c, #17152a); border-color: var(--c, #17152a); color: #fff; }

.page { max-width: 1240px; margin: 0 auto; padding: 0.5rem 16px 2rem; }
.cat { margin-top: 1.5rem; }
.cat-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.cat-head span { display: grid; place-items: center; width: 36px; height: 36px; font-size: 1.2rem; border-radius: 11px; background: var(--c); }
.cat-head h2 { font-size: 1.4rem; letter-spacing: -0.02em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 0.9rem; }
.card { position: relative; display: flex; flex-direction: column; min-width: 0; text-align: left; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: transform .15s, box-shadow .15s, border-color .15s; }
.card:hover { transform: translateY(-3px); border-color: var(--c); box-shadow: 0 10px 24px -14px var(--c); }
.card-photo { position: relative; height: 104px; background: var(--c); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(10, 8, 25, 0.55)); }
.card-icon { position: absolute; left: 12px; bottom: -16px; z-index: 1; display: grid; place-items: center; width: 42px; height: 42px; font-size: 1.35rem; border-radius: 13px; background: var(--surface); border: 2px solid var(--c); }
.card-body { display: flex; flex-direction: column; gap: 0.15rem; padding: 1.35rem 0.85rem 0.7rem; flex: 1; }
.card-name { font-size: 0.86rem; font-weight: 650; color: var(--muted); }
.card-value { font-size: 1.85rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card-note { font-size: 0.76rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; margin-top: 0.3rem; }
.card-when { font-size: 0.72rem; color: var(--faint); white-space: nowrap; }
.spark { display: block; width: 100%; height: 34px; margin-top: auto; padding-top: 0.45rem; }
.spark polyline { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark polygon { fill: var(--c); opacity: 0.14; }

.pill { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.08rem 0.45rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.up { color: var(--up); background: var(--up-bg); }
.pill.down { color: var(--down); background: var(--down-bg); }
.pill.flat { color: var(--flat); background: var(--flat-bg); }
.pill.new { color: var(--muted); background: var(--raised); font-weight: 600; }

.foot { max-width: 1240px; margin: 0 auto; padding: 0.5rem 16px 2.5rem; font-size: 0.8rem; color: var(--faint); }
.foot summary { cursor: pointer; margin-top: 0.5rem; color: var(--muted); }
.foot ul { list-style: none; margin-top: 0.5rem; columns: 2 320px; }
.foot li { margin-bottom: 0.2rem; break-inside: avoid; }

dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 0; border: 0; border-radius: 20px; overflow-y: auto; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(12, 8, 30, 0.65); }
.d-photo { position: relative; height: 170px; background-color: var(--c); background-size: cover; background-position: center; }
.d-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 25%, rgba(10, 8, 25, 0.8)); }
.d-close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%; color: #fff; background: rgba(10, 8, 25, 0.6); }
.d-title { position: absolute; left: 18px; right: 18px; bottom: 14px; z-index: 1; display: flex; align-items: center; gap: 0.75rem; color: #fff; }
.d-icon { display: grid; place-items: center; flex: none; width: 52px; height: 52px; font-size: 1.7rem; border-radius: 15px; background: var(--c); }
.d-cat { font-size: 0.82rem; font-weight: 700; opacity: 0.92; }
.d-title h2 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.02em; }
.d-body { padding: 1rem 18px 1.25rem; }
.d-now { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.d-value { font-size: 2.4rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.d-blurb { margin-top: 0.3rem; font-size: 0.92rem; color: var(--muted); }
.d-ranges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.8rem; }
.d-ranges button { padding: 0.2rem 0.65rem; border-radius: 999px; border: 1px solid var(--line); background: none; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.d-ranges button[aria-pressed="true"] { color: #fff; background: var(--c); border-color: var(--c); }
.d-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-top: 0.7rem; }
.d-stats div { padding: 0.4rem 0.6rem; border-radius: 10px; background: var(--raised); min-width: 0; }
.d-stats small { display: block; font-size: 0.72rem; color: var(--muted); }
.d-stats b { font-size: 0.98rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.d-chart { position: relative; width: 100%; height: 250px; margin-top: 0.7rem; touch-action: pan-y; }
.d-chart svg { display: block; width: 100%; height: 100%; }
.d-chart text { font-size: 11.5px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.d-chart .grid { stroke: var(--line); stroke-width: 1; }
.d-chart .line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.d-chart .area { fill: var(--c); opacity: 0.13; }
.d-chart .cross { stroke: var(--faint); stroke-width: 1; }
.d-chart .hit { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.d-empty { display: grid; place-items: center; height: 100%; padding: 1rem; text-align: center; color: var(--muted); font-size: 0.92rem; }
.tooltip { position: absolute; top: 4px; z-index: 2; padding: 0.3rem 0.55rem; border-radius: 8px; font-size: 0.8rem; color: var(--ink); background: var(--raised); border: 1px solid var(--line); pointer-events: none; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.tooltip b { display: block; font-variant-numeric: tabular-nums; }
.d-table { margin-top: 0.6rem; font-size: 0.85rem; }
.d-table summary { cursor: pointer; color: var(--muted); }
.table-wrap { max-height: 240px; overflow-y: auto; margin-top: 0.4rem; }
.d-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.d-table th { position: sticky; top: 0; text-align: right; font-size: 0.74rem; font-weight: 600; color: var(--faint); background: var(--surface); padding: 0.2rem 0.4rem; }
.d-table td { text-align: right; padding: 0.22rem 0.4rem; border-top: 1px solid var(--line); }
.d-table th:first-child, .d-table td:first-child { text-align: left; }
.d-source { margin-top: 0.7rem; font-size: 0.78rem; color: var(--faint); }

@media (max-width: 560px) {
  .d-photo { height: 130px; }
  .d-value { font-size: 2rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .card-photo { height: 76px; }
  .card-value { font-size: 1.4rem; }
  .card-when { display: none; }
  .filters { justify-content: flex-start; }
  .mover:nth-child(n+3) { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
