@font-face { font-family: "Barlow SC"; src: url(fonts/barlow-semi-condensed-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url(fonts/barlow-semi-condensed-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url(fonts/barlow-semi-condensed-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #EEF3F0; --sheet: #F7FAF8; --ink: #15302A; --ink-2: #49625B; --ink-3: #6B827B;
  --rule: #CBD9D2; --grid: #DCE6E1; --band: #DDE8E9;
  --up: #0F6AA6; --down: #B8326B; --neutral: #55706A;
  --good: #1F7A4A; --warn: #8F5E00; --bad: #B3261E;
  --d3n: #E9A9C2; --d2n: #F2C8D8; --d1n: #F8E3EB; --d0: #E8EEEB; --d1p: #DCEBF6; --d2p: #BBD9EE; --d3p: #93C2E3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #12211D; --sheet: #182A25; --ink: #E5EFEA; --ink-2: #A9BDB6; --ink-3: #86A097;
    --rule: #2F4640; --grid: #233732; --band: #1F3433;
    --up: #3F97D0; --down: #DD5A85; --neutral: #8FA9A1;
    --good: #5CC48C; --warn: #E0AC4B; --bad: #F2857D;
    --d3n: #7A2F4E; --d2n: #5A2A40; --d1n: #3C2A33; --d0: #22332F; --d1p: #20394B; --d2p: #1F4A66; --d3p: #1E5E86;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #12211D; --sheet: #182A25; --ink: #E5EFEA; --ink-2: #A9BDB6; --ink-3: #86A097;
  --rule: #2F4640; --grid: #233732; --band: #1F3433;
  --up: #3F97D0; --down: #DD5A85; --neutral: #8FA9A1;
  --good: #5CC48C; --warn: #E0AC4B; --bad: #F2857D;
  --d3n: #7A2F4E; --d2n: #5A2A40; --d1n: #3C2A33; --d0: #22332F; --d1p: #20394B; --d2p: #1F4A66; --d3p: #1E5E86;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.45 "Barlow SC", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--up); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 22px; line-height: 1.2; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }

/* Masthead: one line of navigation and one line of truth about the recorder */
.top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 28px; padding: 14px clamp(16px, 3vw, 36px) 12px; border-bottom: 1px solid var(--rule); }
.mark { font-weight: 600; font-size: 21px; letter-spacing: .01em; }
.nav { display: flex; flex-wrap: wrap; gap: 2px 20px; }
.nav a { text-decoration: none; color: var(--ink-2); font-weight: 500; padding: 2px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.top-right { margin-left: auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; font-size: 14px; color: var(--ink-2); }
main { padding: 22px clamp(16px, 3vw, 36px) 64px; max-width: 1400px; }
.section { margin-top: 36px; }
.section > h2 { margin-bottom: 10px; }
.lede { max-width: 72ch; color: var(--ink-2); margin-bottom: 12px; }

/* The one loud thing: a sentence that reads the market, over the trace */
.reading { font-size: clamp(28px, 4.2vw, 50px); line-height: 1.08; font-weight: 500; max-width: 26ch; letter-spacing: -.005em; }
.subreading { font-size: clamp(16px, 1.7vw, 20px); color: var(--ink-2); margin-top: 8px; max-width: 62ch; }
.dir-up { color: var(--up); }
.dir-down { color: var(--down); }

/* Status: always a word and a glyph, never colour alone */
.state { font-weight: 600; white-space: nowrap; }
.state::before { display: inline-block; width: 1em; margin-right: .15em; }
.state.good { color: var(--good); } .state.good::before { content: "\25CF"; }
.state.warn { color: var(--warn); } .state.warn::before { content: "\25B2"; }
.state.bad { color: var(--bad); } .state.bad::before { content: "\25A0"; }
.state.idle { color: var(--ink-2); } .state.idle::before { content: "\25CB"; }
.banner { border-left: 3px solid var(--warn); padding: 8px 12px; margin: 0 0 16px; background: var(--sheet); max-width: 80ch; }
.banner.bad { border-left-color: var(--bad); }

/* Charts sit on graph paper */
.chart { position: relative; margin-top: 18px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .plot-bg { fill: var(--sheet); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .band { fill: var(--band); }
.chart .zero { stroke: var(--ink); stroke-width: 1.5; }
.chart .ax { fill: var(--ink-3); font-size: 13px; }
.chart .tag { fill: var(--ink-2); font-size: 13px; }
.chart .tag.strong { fill: var(--ink); font-weight: 600; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.dashed { stroke-dasharray: 5 4; }
.c-up { stroke: var(--up); } .c-down { stroke: var(--down); } .c-neutral { stroke: var(--neutral); } .c-ink { stroke: var(--ink); }
.f-up { fill: var(--up); } .f-down { fill: var(--down); } .f-neutral { fill: var(--neutral); } .f-ink { fill: var(--ink); }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; }
.chart .dot { stroke: var(--sheet); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--paper); padding: 5px 9px; border-radius: 3px; font-size: 13px; line-height: 1.35; white-space: nowrap; z-index: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 5px; background: var(--neutral); }
.legend i.up { background: var(--up); } .legend i.down { background: var(--down); } .legend i.ink { background: var(--ink); }

/* Tables do the work; no cards */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 4px 14px 4px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 4px 14px 4px 0; border-bottom: 1px solid var(--grid); vertical-align: top; }
th.n, td.n { text-align: right; }
tr.pick { cursor: pointer; }
tr.pick:hover td { background: var(--sheet); }
tr.selected td { background: var(--sheet); font-weight: 500; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--up); }
.data td { white-space: nowrap; max-width: 44ch; overflow: hidden; text-overflow: ellipsis; }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 28px 48px; margin-top: 26px; }

/* Outcome tape: a mark per market, most recent first */
.tape { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.tape a { display: block; min-width: 26px; padding: 1px 4px; text-align: center; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--paper); border-radius: 2px; }
.tape .Up { background: var(--up); } .tape .Down { background: var(--down); }

/* Heat grid: the robustness plateau from the spec, at a glance */
.heat { width: auto; }
.heat th, .heat td { padding: 5px 10px; border-bottom: 0; }
.heat td.n button { all: unset; display: block; cursor: pointer; text-align: right; min-width: 66px; }
.heat td.cell { padding: 0; border: 2px solid var(--paper); }
.heat td.cell button { padding: 5px 10px; box-sizing: border-box; width: 100%; }
.heat td.cell button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.heat td.cell.on { outline: 2px solid var(--ink); outline-offset: -2px; }
.d-3 { background: var(--d3n); } .d-2 { background: var(--d2n); } .d-1 { background: var(--d1n); } .d0 { background: var(--d0); } .d1 { background: var(--d1p); } .d2 { background: var(--d2p); } .d3 { background: var(--d3p); }

/* Controls */
button, .btn { font: inherit; font-weight: 500; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); padding: 6px 14px; border-radius: 3px; cursor: pointer; }
button.quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
button.quiet:hover { border-color: var(--ink); }
button.link { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button.link:focus-visible { outline: 2px solid var(--up); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; padding: 6px 9px; width: 100%; }
textarea { min-height: 130px; resize: vertical; line-height: 1.4; }
label { display: block; font-size: 14px; color: var(--ink-2); }
label > input, label > select { margin-top: 3px; color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 16px; max-width: 900px; margin-top: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; }
.error { color: var(--bad); margin-top: 8px; }
pre { font: 13.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--sheet); padding: 12px; margin: 8px 0 0; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word; }
meter { width: 100%; max-width: 420px; height: 10px; display: block; margin: 6px 0; }
.empty { padding: 26px 0; color: var(--ink-2); max-width: 62ch; }

/* Sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin form { width: min(340px, 100%); display: grid; gap: 14px; }
.signin .mark { font-size: 34px; }
.signin button { margin-top: 2px; padding: 9px; }

@media (prefers-reduced-motion: no-preference) {
  .heat td.cell button { transition: filter .1s; }
}
@media (max-width: 640px) {
  .top-right { margin-left: 0; width: 100%; }
  .chart .ax, .chart .tag { font-size: 18px; }
}
