:root {
  --bg: #000;
  --panel: #0c0c0e;
  --panel-2: #17171b;
  --line: #26262c;
  --text: #e6e8ec;
  --dim: #a3a7b0;
  --faint: #868a94;
  --accent: #5b8def;
  --up: #22b38a;
  --down: #f2545b;
  --warn: #f5923e;
  --radius: 16px;
  --header-height: 60px;
  --font: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--header-height) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1440px; margin-inline: auto; padding-inline: clamp(16px, 2.5vw, 32px); }
.num, td, .glance .v, .tile .v, .quote { font-variant-numeric: tabular-nums; }
.skip-link {
  position: fixed; top: 12px; left: 16px; z-index: 30;
  padding: 10px 14px; background: var(--panel-2); border-radius: 8px;
  transform: translateY(calc(-100% - 16px));
}
.skip-link:focus { transform: none; }

h1, h2, h3 { margin: 0 0 6px; line-height: 1.25; }
h1 { font-size: clamp(24px, 2.4vw, 30px); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
h3 { font-size: 15px; font-weight: 650; margin-top: 24px; }
.sub { color: var(--dim); margin: 0 0 16px; font-size: 14px; max-width: 78ch; }

/* Header and section navigation */
.site-header { position: sticky; top: 0; z-index: 10; background: #000000f0; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: var(--header-height); }
.wordmark { display: inline-flex; align-items: center; color: var(--text); font-weight: 750; font-size: 20px; letter-spacing: -0.03em; }
.wordmark img { margin-right: 9px; flex: none; }
.wordmark span { color: var(--accent); margin-left: 3px; }
.wordmark:hover { text-decoration: none; }
.mast-links { display: flex; align-items: center; gap: 4px; margin-inline: auto; }
.mast-links a { padding: 8px 14px; border-radius: 999px; color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap; transition: background-color .2s; }
.mast-links a:hover { background: var(--panel-2); text-decoration: none; }
.nav-current { display: none; }
.nav-toggle {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px;
  padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
  transition: background-color .2s, transform .15s var(--ease);
}
.nav-toggle:hover, .nav-toggle[aria-expanded="true"] { background: var(--panel-2); }
.menu-icon { width: 14px; height: 10px; border-block: 1.5px solid currentColor; position: relative; }
.menu-icon::after { content: ""; position: absolute; inset: 50% 0 auto; border-top: 1.5px solid currentColor; }
#section-nav {
  display: none; position: fixed; inset: calc(var(--header-height) + 7px) clamp(16px, 2.5vw, 32px) auto auto;
  z-index: 9; width: min(290px, calc(100vw - 32px));
  max-height: calc(100dvh - var(--header-height) - 24px); overflow: auto;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); box-shadow: 0 14px 45px #000c;
}
body:has(.nav-toggle[aria-expanded="true"]) #section-nav { display: block; }
.nav-group { list-style: none; padding: 0; margin: 0; }
.nav-label { margin: 18px 0 5px; padding-inline: 11px; color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
#section-nav a { display: block; padding: 10px; border-radius: 8px; color: var(--dim); font-size: 13px; font-weight: 600; transition: color .15s, background-color .15s; }
#section-nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
#section-nav a[aria-current] { color: var(--text); background: #5b8def26; }

/* Page title row */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; padding-block: 28px 4px; }
.page-head h1 { margin: 0 0 4px; }
.lead { max-width: 70ch; margin: 0; color: var(--dim); font-size: 14px; }
.seg button:active, #retry-load:active, .nav-toggle:active { transform: scale(.97); }
@media (prefers-reduced-motion: no-preference) {
  .page-head > * { animation: rise .6s var(--ease) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* Cards */
main { min-width: 0; padding-block: 20px 42px; }
main > *, .panel > * { min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 1.8vw, 24px); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.badge { padding: 2px 7px; border-radius: 6px; background: var(--panel-2); color: var(--dim); font-size: 11px; font-weight: 650; letter-spacing: .03em; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 6px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.sub-head { margin-top: 24px; }
.notice { background: #f2545b1a; border: 1px solid var(--down); color: var(--text); padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; }
.updated { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.board-status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
#source-status { color: var(--accent); font-size: 12px; text-decoration: underline; }
#data-sources { scroll-margin-top: calc(var(--header-height) + 16px); }
#retry-load { margin-left: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; transition: background-color .2s, transform .15s var(--ease); }
.empty { color: var(--faint); font-size: 14px; padding: 12px 0; }

/* Notes fill their card in two balanced columns instead of leaving the right half empty. */
.panel p.sub { max-width: none; }
.panel p.sub:not([id], .wide), #turns-misses { columns: 2 36ch; column-gap: 40px; }

/* Summary row: the big chart beside the signal board, like a market overview. */
.summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 30%); gap: 16px; margin-bottom: 16px; }
.summary > .panel { margin: 0; }
.chart-card { display: flex; flex-direction: column; }
.quote { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; width: 100%; margin: 4px 0 0; }
.q-v { font-size: clamp(26px, 2.4vw, 32px); font-weight: 700; letter-spacing: -0.02em; }
.q-c { font-size: 16px; font-weight: 650; }
.q-d { color: var(--faint); font-size: 12px; }
.chart-title { margin: 0 0 10px; color: var(--dim); font-size: 13px; font-weight: 600; }
.chart-card .wk { margin: auto 0 0; border: 0; border-radius: 0; background: none; }
.chart-card .plot-legend, .chart-card .plot-readout { padding-inline: 0; }
@media (max-width: 1100px) { .summary { grid-template-columns: minmax(0, 1fr); } }

/* Signal board as a list: name and context on the left, the reading on the right. */
.overview { display: flex; flex-direction: column; }
.glance { display: flex; flex-direction: column; flex: 1; }
.glance .g {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "k v" "d v"; column-gap: 16px; align-items: center;
  flex: 1; padding: 9px 10px; margin-inline: -10px; border-radius: 8px; color: var(--text);
  transition: background-color .15s;
}
.glance .g + .g { box-shadow: 0 -1px 0 var(--line); }
.glance .g:hover { background: var(--panel-2); text-decoration: none; box-shadow: none; }
.glance .g:hover + .g { box-shadow: none; }
.glance .k { grid-area: k; font-size: 13px; font-weight: 600; }
.glance .v { grid-area: v; max-width: 20ch; text-align: right; font-size: 15px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.glance .d { grid-area: d; color: var(--faint); font-size: 12px; line-height: 1.4; }
/* Stacked under the chart on a tablet, one long list would leave a wide gap between names and readings: two columns. */
@media (min-width: 681px) and (max-width: 1100px) {
  .glance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
  .glance .g + .g { box-shadow: none; }
  .glance .g:nth-child(n+3) { box-shadow: 0 -1px 0 var(--line); }
  .glance .g:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.glance .primary .k { font-size: 14px; }
.glance .primary .v { font-size: 22px; font-weight: 700; }

/* Tables */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: 10px;
  /* Scroll cue: a right-edge shadow, covered by a panel-colored patch that travels with the last column. */
  background: linear-gradient(to left, var(--panel) 40%, transparent) right / 36px 100% no-repeat local,
    linear-gradient(to left, #000c, transparent) right / 14px 100% no-repeat scroll;
}
.table-wrap:has(table:empty) { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { background: var(--panel-2); text-align: left; color: var(--dim); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { transition: background-color .15s; }
tbody tr:hover { background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
tfoot td { background: var(--panel-2); color: var(--dim); }
tfoot tr:first-child td { border-top: 2px solid var(--line); }
tfoot td:first-child { font-weight: 500; }
td.r, th.r { text-align: right; }
td.few { color: var(--faint); font-style: italic; }
.good { color: var(--up); }
.bad { color: var(--down); }
.warn { color: var(--warn); }
.muted { color: var(--faint); }

/* Tiles */
.tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.tiles > .tile { flex: 1 1 180px; min-width: 0; }
.tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .k { color: var(--dim); font-size: 12px; }
.tile .v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.tile .d { font-size: 12px; color: var(--faint); }
.tile .r { font-size: 13px; }
.tile progress { display: block; width: 100%; height: 6px; margin: 6px 0; accent-color: var(--accent); }
/* A bar takes its label's tone, so it says the same good or bad as the text beside it. */
.tile progress.good { accent-color: var(--up); }
.tile progress.bad { accent-color: var(--down); }
.tile progress.warn { accent-color: var(--warn); }
.tile progress.muted { accent-color: var(--faint); }
.tile .spark { display: block; width: 100%; max-width: 160px; height: 34px; margin: 2px 0; }
.tile .spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

/* Bottom and top scores */
.turns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; margin-bottom: 16px; }
.turn .v small { font-size: 14px; color: var(--faint); font-weight: 500; }
.turn .v span { font-size: 15px; font-weight: 600; }
.turn .d { font-size: 13px; margin: 4px 0 8px; }
.turn .live { font-size: 15px; margin: 8px 0 4px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 6px; }
.factors { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.factors li { display: grid; grid-template-columns: minmax(0, 1fr) 4ch 9ch; gap: 8px; padding: 3px 0; border-top: 1px solid var(--line); }
.factors b { text-align: right; }
.factors small { color: var(--faint); text-align: right; }
.legend-bot { color: var(--up); }
.legend-top { color: var(--down); }

/* Weekly charts */
.wk { margin: 0 0 16px; min-width: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.wk:empty { display: none; }
/* Reserve the height of the data-filled blocks near the top so they don't push the page down when signals.json
   arrives (layout shift). :empty drops the reservation once content renders. Measured at 1440, 1024, 768 and 390px
   wide with the usual 10 board cards. */
.glance:empty { min-height: 560px; }
.turns:empty { min-height: 350px; }
#turns-chart:empty { display: block; min-height: 595px; }
@media (max-width: 1279px) { .turns:empty { min-height: 369px; } }
@media (max-width: 1100px) { #turns-chart:empty { min-height: 477px; } }
@media (max-width: 680px) {
  .glance:empty { min-height: 530px; }
  .turns:empty { min-height: 830px; }
  #turns-chart:empty { min-height: 500px; }
}
main:has(#load-error:not([hidden])) :is(.glance, .turns, #turns-chart):empty { display: none; }
.wk svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.wk .grid { stroke: #1d1d23; stroke-width: .8; }
.wk .lvl { stroke: var(--faint); stroke-dasharray: 4 4; }
.wk .axis { fill: var(--faint); font-size: 12px; font-family: var(--font); }
.wk .price { fill: none; stroke: var(--text); stroke-width: 1.5; }
.wk .pct { fill: none; stroke: var(--accent); stroke-width: 1.7; }
.wk .avg { fill: none; stroke: #6fd3d0; stroke-width: 1.8; stroke-dasharray: 5 3; }
.wk .dot { fill: var(--down); }
.wk .bot { fill: none; stroke: var(--up); stroke-width: 2; }
.wk .top { fill: none; stroke: var(--down); stroke-width: 2; }
.wk .diamond { fill: var(--warn); }
.wk .dot.open, .wk .diamond.open { fill: none; stroke-width: 1.5; }  /* run still open: the marker can move */
.wk .dot.open { stroke: var(--down); }
.wk .diamond.open { stroke: var(--warn); }
.wk .up { fill: var(--up); }
.wk .down { fill: var(--down); }
.wk rect { opacity: .6; }
.wk .pane-label { fill: var(--text); font: 600 13px var(--font); }
.wk .cross { stroke: var(--dim); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.plot-legend { display: flex; flex-wrap: wrap; gap: 5px 20px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.plot-legend span { display: inline-flex; gap: 7px; align-items: center; }
.plot-legend i { width: 17px; border-top: 2px solid; }
.plot-legend .pct { color: var(--accent); }
.plot-legend .avg { color: #6fd3d0; border-top-style: dashed; }
.plot-legend .bot { color: var(--up); }
.plot-legend .top { color: var(--down); }
.plot-legend .lvl { color: var(--faint); border-top-style: dashed; }
.plot-legend .dot, .plot-legend .diamond { width: 7px; height: 7px; border: 0; }
.plot-legend .dot { background: var(--down); border-radius: 50%; }
.plot-legend .diamond { background: var(--warn); transform: rotate(45deg); }
.plot-legend .bars { height: 9px; width: 12px; border: 0; border-left: 5px solid var(--up); border-right: 5px solid var(--down); }
.plot-note { margin: 0; padding: 0 14px 10px; font-size: 12px; color: var(--dim); }
.plot-readout { margin: 0; padding: 8px 14px; min-height: 2.6em; border-top: 1px solid var(--line); color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Ticker switch */
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.seg button {
  min-height: 38px; min-width: 56px; padding: 0 14px; border: 0; border-radius: 999px;
  background: none; color: var(--dim); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
  transition: color .2s, background-color .2s, transform .15s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }
.seg button:focus-visible { outline-offset: -3px; }

/* Collapsed derivations */
details.more { margin: -8px 0 16px; }
details.more summary { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; list-style: none; color: var(--accent); font-size: 13px; font-weight: 600; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease); }
details.more[open] summary::before { transform: rotate(45deg); }
details.more[open] summary { margin-bottom: 6px; }
details.more summary:hover { text-decoration: underline; }

/* Method */
.method { columns: 2 40ch; column-gap: 40px; }
.method p { margin: 0 0 14px; color: var(--dim); font-size: 14px; break-inside: avoid; }
.method strong { color: var(--text); }
.disclaimer { column-span: all; border-top: 1px solid var(--line); padding-top: 12px; }
.sources { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sources li { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--dim); }
.sources li.fail { border-color: var(--down); color: var(--down); }

/* Footer */
.site-footer { color: var(--faint); font-size: 12px; padding: 20px 0 28px; border-top: 1px solid var(--line); }

@media (max-width: 1000px) {
  .mast-links { display: none; }
  /* Section name next to Menu, filled by app.js; auto margin keeps it and Menu on the right. */
  .nav-current { display: block; margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 13px; font-weight: 600; }
  .nav-current:empty { display: none; }
}
@media (max-width: 680px) {
  :root { --header-height: 56px; }
  .header-inner { gap: 8px; }
  .site-header .wordmark { font-size: 18px; }
  .site-header .wordmark img { width: 48px; height: auto; margin-right: 6px; }
  .nav-current { font-size: 12px; }
  .page-head { padding-top: 20px; }
  .seg button { min-height: 44px; }
  .wordmark { min-height: 44px; }
  main { padding-top: 16px; }
  .panel { padding: 16px 12px; margin-bottom: 12px; }
  .summary { gap: 12px; margin-bottom: 12px; }
  td:first-child { position: sticky; left: 0; background: var(--panel); }
  th:first-child { position: sticky; left: 0; }
}

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