@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #0e1116;
  --surface: #151920;
  --raised: #1b2029;
  --ink: #eef0f3;
  --ink-2: #aab0bb;
  --muted: #737a87;
  --grid: #222834;
  --axis: #323a48;
  --border: rgba(255, 255, 255, 0.08);
  --wash: rgba(255, 255, 255, 0.04);
  --s-stay: #3987e5; /* "if no" series */
  --s-out: #c98500; /* "if yes" series */
  --bid: #2fbf71;
  --ask: #f05a4f;
  --fit: #a79cf5; /* our estimate, wherever it is drawn against a market */
  --warn: #f1c965;
  --warn-bg: rgba(241, 201, 101, 0.1);
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--axis); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, p { margin: 0; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.key { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.k-out { background: var(--s-out); }
.k-stay { background: var(--s-stay); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.note { color: var(--muted); font-size: 13px; margin-top: 8px; }
.table-scroll { overflow-x: auto; }

/* ---------- header ---------- */

.top { border-bottom: 1px solid var(--border); background: var(--surface); }
.top-row { display: flex; align-items: center; gap: 20px; height: 50px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 24px; height: 23px; flex: none; }
.page-nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.page-nav a { text-decoration: none; color: var(--ink-2); font-size: 14px; padding: 5px 10px; border-radius: 7px; white-space: nowrap; }
.page-nav a:hover { background: var(--wash); color: var(--ink); }
.page-nav a.is-current { background: var(--raised); color: var(--ink); }
.top-link { color: var(--ink-2); font-size: 14px; text-decoration: none; white-space: nowrap; margin-left: auto; }
.top-link:hover { color: var(--ink); }

/* ---------- home page ---------- */

.home-hero { padding: 36px 0 22px; }
.page-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 16px; padding-bottom: 32px; }
.ptile { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 14px; transition: border-color 0.15s, background-color 0.15s; }
.ptile:hover { border-color: rgba(255, 255, 255, 0.2); background: var(--raised); }
.ptile:focus-visible { outline: 2px solid var(--s-stay); outline-offset: 2px; }
.ptile-head { display: flex; align-items: center; gap: 12px; }
.ptile-head img { width: 34px; height: 34px; flex: none; }
.ptile h2 { font-size: 19px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.ptile-q { color: var(--ink-2); font-size: 13.5px; margin-top: 12px; }
.ptile-odds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.ptile-lab { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ptile-val { font-size: 42px; line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.ptile-spark { height: 64px; margin-top: 12px; }
.ptile-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.ptile:hover .ptile-open { color: var(--ink); }

/* ---------- headline ---------- */

.hero { padding: 28px 0 0; }
.hero-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.logo { width: 44px; height: 44px; flex: none; }
h1 { font-size: clamp(24px, 3.4vw, 34px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
.lede { color: var(--ink-2); margin-top: 4px; max-width: 90ch; }

.top-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
.over-time-row { margin-bottom: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.tile-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.tile-value { font-size: clamp(52px, 7vw, 76px); line-height: 1.02; font-weight: 700; letter-spacing: -0.04em; margin-top: 6px; }
.tile-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.tile-range { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }

.rangeplot { margin: 14px 0 4px; }
.rp-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; height: 26px; }
.rp-label { font-size: 12.5px; color: var(--ink-2); }
.rp-track { position: relative; height: 100%; margin: 0 34px 0 22px; }
.rp-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); }
.rp-bar { position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: 4px; opacity: 0.4; min-width: 2px; }
.rp-dot { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid var(--page); }
.rp-end { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-end-lo { margin-left: -6px; transform: translate(-100%, -50%); }
.rp-end-hi { margin-left: 6px; }
.rp-end-clear { margin-left: 12px; }
.rp-axis { height: 18px; }
.rp-tick { position: absolute; top: 2px; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.verdict { margin-top: 10px; }
.verdict h2 { font-size: 19px; letter-spacing: -0.01em; font-weight: 650; }
.verdict p { color: var(--ink-2); font-size: 14px; margin-top: 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-variant-numeric: tabular-nums; }
.badge { color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 1px 10px; font-size: 12.5px; white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 14px 0 0; border-top: 1px solid var(--border); }
.stat { padding: 10px 12px 0 0; cursor: help; }
.stat dd { margin: 0; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat dt { color: var(--muted); font-size: 12px; line-height: 1.3; margin-top: 1px; }
.card-foot { display: none; }

/* ---------- the grid ---------- */

.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; min-height: 28px; }
.panel-head h2 { font-size: 15px; font-weight: 650; }
.panel-head a { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.panel-head .chart-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.joint { width: 100%; min-width: 440px; border-collapse: separate; border-spacing: 6px; margin: 0 -6px; }
.joint thead th { text-align: left; padding: 0 12px; color: var(--ink-2); font-weight: 500; font-size: 13px; }
.joint th[scope="row"] { white-space: nowrap; font-weight: 600; font-size: 13.5px; text-align: left; padding-right: 6px; }
.joint th[scope="row"] .key { margin-right: 7px; }
.joint .margin-head { color: var(--muted); font-weight: 500; }
.joint td { width: 29%; padding: 10px 12px; border-radius: 8px; vertical-align: top; }
.joint td.cell { background: var(--raised); border: 1px solid var(--border); }
.joint td.margin { background: var(--wash); }
.cell-est { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.joint td.margin .cell-est { font-size: 18px; font-weight: 600; color: var(--ink-2); }
.cell-quote { display: inline-block; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-flag { margin-top: 5px; font-size: 11.5px; color: var(--warn); background: var(--warn-bg); border-radius: 5px; padding: 1px 6px; width: fit-content; white-space: nowrap; cursor: help; }
.formulas { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 8px; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.formula-row { display: flex; align-items: center; gap: 8px; }
.formula-row strong { color: var(--ink); }
.formula-key { flex-basis: 100%; color: var(--muted); font-size: 12px; }

/* ---------- sections ---------- */

section { margin-top: 36px; }
.hero { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2 { font-size: 18px; letter-spacing: -0.01em; font-weight: 650; }

.filter { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.filter button { appearance: none; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 12.5px; padding: 5px 11px; cursor: pointer; }
.filter button + button, .filter .filter-label + button { border-left: 1px solid var(--border); }
.filter-label { color: var(--muted); font-size: 12px; padding: 5px 9px 5px 10px; align-self: center; cursor: help; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.filter button:hover { background: var(--wash); }
.filter button[aria-pressed="true"] { background: var(--ink); color: var(--page); }
.filter button:focus-visible, .chart:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--s-stay); outline-offset: 2px; }

/* ---------- order books ---------- */

.market-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mcard { padding: 14px 16px 12px; min-width: 0; }
.mcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mcard-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mcard h3 { font-size: 15px; font-weight: 650; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; white-space: nowrap; }
.mcard-side { display: flex; align-items: baseline; gap: 12px; }
.mcard-price { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mcard-link { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.mcard-body { display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 14px; margin-top: 8px; align-items: start; }
.mcard-stats { color: var(--muted); font-size: 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }

.ladder { font-size: 12.5px; font-variant-numeric: tabular-nums; line-height: 1; }
.lv { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 4.5px 6px; }
.lv > span { position: relative; text-align: right; color: var(--ink-2); }
.lv > span:first-of-type { text-align: left; }
.lv-head > span { color: var(--muted); font-size: 11px; }
.lv-head { border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 2px; }
.lv-bar { position: absolute; top: 1px; bottom: 1px; right: 0; border-radius: 2px; }
.lv-ask .lv-bar { background: rgba(240, 90, 79, 0.16); }
.lv-bid .lv-bar { background: rgba(47, 191, 113, 0.16); }
.lv-ask .lv-price { color: var(--ask); font-weight: 600; }
.lv-bid .lv-price { color: var(--bid); font-weight: 600; }
.lv .lv-total { color: var(--muted); }
.lv-note { padding: 5px 6px; font-size: 11.5px; color: var(--muted); text-align: center; }
.lv-spread { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 2px 0; }
.lv-fit { color: var(--fit); cursor: help; }
.lv-fit:not(.lv-spread) { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.lv-fit:not(.lv-spread)::before, .lv-fit:not(.lv-spread)::after { content: ""; flex: 1; border-top: 1px dashed var(--fit); opacity: 0.7; }

/* ---------- charts ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 4px; font-size: 13.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-item strong { color: var(--ink); }
.legend-key { width: 18px; height: 2px; border-radius: 1px; }

.chart { position: relative; touch-action: pan-y; border-radius: 6px; }
.chart svg { display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .tick-y { text-anchor: end; dominant-baseline: middle; }
.chart .tick-x { text-anchor: middle; }
.chart .axis-title { fill: var(--ink-2); }
.chart .band { opacity: 0.16; stroke: none; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .cross-line { stroke: var(--axis); stroke-width: 1; }
.chart .ref-line { stroke: var(--fit); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.85; }
.chart .ref-label { text-anchor: end; fill: var(--fit); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--raised); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); padding: 7px 9px; font-size: 12.5px; white-space: nowrap; z-index: 2; }
.tip-time { color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.tip-row { display: flex; align-items: center; gap: 7px; }
.tip-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tip-name { color: var(--ink-2); }
.tip-range { color: var(--muted); margin-left: 4px; }

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.checks th, .checks td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
.checks thead th { color: var(--muted); font-weight: 500; font-size: 12px; }
.checks tbody tr:last-child td { border-bottom: 0; }
.checks td { white-space: nowrap; }
.result { font-weight: 600; }
.result.ok { color: var(--bid); }
.result.bad { color: var(--ask); }
.result-icon { display: inline-block; width: 1.1em; }

/* ---------- about page ---------- */

.prose { max-width: 720px; padding-top: 36px; }
.prose h1 { margin-bottom: 8px; }
.prose h2 { font-size: 18px; font-weight: 650; margin: 30px 0 8px; }
.prose p, .prose li { color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }
.prose p { margin-bottom: 12px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--ink); }
.prose .example { border-left: 2px solid var(--axis); padding: 2px 0 2px 14px; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px !important; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--ink) !important; overflow-x: auto; }

.foot { margin-top: 44px; padding-top: 16px; padding-bottom: 36px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }

/* ---------- smaller screens ---------- */

@media (max-width: 1020px) {
  .top-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
  .market-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  .wrap { padding: 0 16px; }
  .top-row { gap: 12px; }
  .hero { padding-top: 20px; }
  .logo { width: 36px; height: 36px; }
  .tile { padding: 12px 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mcard-body { grid-template-columns: minmax(0, 1fr); }
  .grid-panel { padding: 12px 10px; }
  .joint { min-width: 0; border-spacing: 4px; margin: 0 -4px; table-layout: fixed; }
  .joint th:first-child { width: 22%; }
  .joint thead th { padding: 0 4px; font-size: 11.5px; }
  .joint th[scope="row"] { white-space: normal; font-size: 12px; }
  .joint th[scope="row"] .key { display: block; margin: 0 0 4px; }
  .joint td { width: 26%; padding: 8px 6px; }
  .cell-est { font-size: 17px; }
  .joint td.margin .cell-est { font-size: 15px; }
  .cell-quote, .cell-flag { white-space: normal; font-size: 11px; }
  .checks td, .checks th { white-space: normal; padding: 7px 5px; font-size: 12.5px; }
  .rp-track { margin: 0 30px 0 22px; }
  section { margin-top: 30px; }
}

/* ---------- share-card mode (?card): just the headline, sized for a 1200x630 screenshot ---------- */

body.card { width: 1200px; height: 630px; overflow: hidden; }
body.card .top, body.card main > section:not(.hero), body.card .two-col, body.card .over-time-row, body.card .foot, body.card .top-right, body.card .stats { display: none; }
body.card .wrap { max-width: none; padding: 0 56px; }
body.card .hero { padding-top: 40px; }
body.card .logo { width: 56px; height: 56px; }
body.card h1 { font-size: 42px; }
body.card .lede { display: none; }
body.card .top-grid { grid-template-columns: 1fr; }
body.card .tile-value { font-size: 104px; }
body.card .tile-label { font-size: 20px; }
body.card .tile-sub, body.card .tile-range { font-size: 18px; }
body.card .tile { padding: 20px 26px; }
body.card .rangeplot { margin-top: 18px; }
body.card .verdict h2 { font-size: 26px; }
body.card .verdict p { font-size: 18px; }
body.card .card-foot { display: block; margin-top: 10px; color: var(--muted); font-size: 14px; }
