:root {
  --ink: #17202e;
  --muted: #5b6676;
  --paper: #eef1f5;
  --surface: #ffffff;
  --rule: #cdd4de;
  --rule-soft: #e2e7ee;
  --cobalt: #2945c9;
  --long: #0b7a57;
  --short: #b3362c;
  --warn: #9a5a00;
  --warn-bg: #fff4e0;
  --danger-zone: rgba(179, 54, 44, .10);
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6eaf0; --muted: #9aa5b5; --paper: #12161e; --surface: #1a202b;
    --rule: #333c4b; --rule-soft: #262d39; --cobalt: #7d93ff; --long: #3fbf8f; --short: #f0776b;
    --warn: #f0b45a; --warn-bg: #2d2414; --danger-zone: rgba(240, 119, 107, .14);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--font); font-variant-numeric: tabular-nums;
}
a { color: var(--cobalt); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; gap: 4px 28px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.wordmark { font-weight: 700; font-size: 19px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.wordmark span { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-weight: 500; font-size: 15px; }
.nav a:hover { color: var(--ink); background: var(--rule-soft); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--rule-soft); }

.sample-banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--rule); font-size: 14px; padding: 8px 0; }

/* Page heading */
.page-head { padding: 40px 0 24px; }
.page-head h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.12; letter-spacing: -.025em; margin: 0 0 10px; font-weight: 700; max-width: 22ch; }
.page-head p { margin: 0; color: var(--muted); max-width: 62ch; font-size: 17px; }

/* Tool layout */
.tool { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; padding-bottom: 40px; }
@media (max-width: 860px) { .tool { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.tool > * { min-width: 0; }

.form { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 20px; display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-size: 14px; font-weight: 500; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; color: var(--muted); }

input[type="text"], input[type="number"], select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 6px; padding: 9px 11px; min-height: 42px; min-width: 0;
}
input:hover, select:hover { border-color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--short); }
.unit-input { display: grid; grid-template-columns: 1fr auto; }
.unit-input input { border-radius: 6px 0 0 6px; }
.unit-input select { width: auto; border-radius: 0 6px 6px 0; border-left: 0; background: var(--rule-soft); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: 9px 8px; cursor: pointer; font-weight: 500; color: var(--muted); background: var(--paper); }
.seg label + input + label, .seg input + label ~ label { border-left: 1px solid var(--rule); }
.seg input:checked + label { background: var(--ink); color: var(--surface); }
.seg input:focus-visible + label { outline: 2px solid var(--cobalt); outline-offset: -2px; }
.seg.side input[value="long"]:checked + label { background: var(--long); color: #fff; }
.seg.side input[value="short"]:checked + label { background: var(--short); color: #fff; }

.symbol-meta { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--cobalt); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* Results */
.results { border-top: 3px solid var(--ink); padding-top: 18px; }
.headline-label { font-size: 15px; color: var(--muted); font-weight: 500; }
.headline { font-size: clamp(40px, 6vw, 60px); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; margin: 4px 0 6px; overflow-wrap: anywhere; }
.headline .unit { font-size: .4em; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.headline.pos { color: var(--long); } .headline.neg { color: var(--short); }
.sub { color: var(--muted); font-size: 16px; }
.sub strong { color: var(--ink); font-weight: 600; }
.empty { color: var(--muted); padding: 24px 0; }

/* Price ladder — the one visual moment */
.ladder { position: relative; height: 128px; margin: 28px 0 8px; }
.ladder .track { position: absolute; left: 0; right: 0; top: 63px; height: 2px; background: var(--rule); }
.ladder .zone { position: absolute; top: 52px; height: 24px; background: var(--danger-zone); border-radius: 3px; }
.ladder .zone.gain { background: rgba(11, 122, 87, .10); }
.ladder .mk { position: absolute; top: 0; height: 128px; width: 0; }
.ladder .mk::before { content: ""; position: absolute; left: -1px; top: 46px; width: 2px; height: 36px; background: currentColor; }
.ladder .mk .tag { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: 13px; line-height: 1.25; text-align: center; }
.ladder .mk.up .tag { bottom: 88px; } .ladder .mk.down .tag { top: 88px; }
.ladder .mk .tag b { display: block; font-size: 15px; font-weight: 600; color: var(--ink); }
.ladder .mk.edge-l .tag { transform: none; left: -1px; text-align: left; }
.ladder .mk.edge-r .tag { transform: translateX(-100%); left: 1px; text-align: right; }
.mk.entry { color: var(--ink); } .mk.liq { color: var(--short); } .mk.stop { color: var(--warn); }
.mk.exit { color: var(--cobalt); } .mk.be { color: var(--muted); } .mk.mark { color: var(--muted); }

.details { margin: 18px 0 0; display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--rule); }
.details dt, .details dd { padding: 10px 0; border-bottom: 1px solid var(--rule-soft); margin: 0; }
.details dt { color: var(--muted); }
.details dd { text-align: right; font-weight: 500; padding-left: 16px; }

.warnings { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.warnings li { background: var(--warn-bg); color: var(--ink); border-left: 3px solid var(--warn); padding: 10px 12px; border-radius: 0 6px 6px 0; font-size: 15px; }
.warnings li.bad { border-left-color: var(--short); }

/* Tier table */
.tiers { margin-top: 28px; }
.tiers summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; margin-top: 8px; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 500; color: var(--muted); border-bottom-color: var(--rule); }
tr.current td { background: var(--rule-soft); font-weight: 600; }

/* Affiliate */
.affiliate { margin-top: 28px; padding: 14px 16px; border: 1px dashed var(--rule); border-radius: 8px; font-size: 15px; color: var(--muted); }
.affiliate a { font-weight: 600; }

/* Article */
.article { max-width: 68ch; padding: 8px 0 56px; }
.article h2 { font-size: 24px; letter-spacing: -.015em; margin: 40px 0 10px; line-height: 1.25; }
.article h3 { font-size: 18px; margin: 26px 0 6px; }
.article p, .article li { color: var(--ink); }
.formula { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; overflow-x: auto; font-size: 15px; line-height: 1.7; }
.formula code { font-family: inherit; font-weight: 600; white-space: nowrap; }
.example { border-left: 3px solid var(--cobalt); padding: 2px 0 2px 16px; }

/* Home */
.hero { padding: 56px 0 24px; }
.hero h1 { font-size: clamp(34px, 5.5vw, 58px); line-height: 1.04; letter-spacing: -.035em; margin: 0 0 16px; max-width: 18ch; }
.hero p { font-size: 19px; color: var(--muted); max-width: 58ch; margin: 0; }
.tool-list { list-style: none; padding: 0; margin: 32px 0 48px; border-top: 1px solid var(--rule); }
.tool-list li { border-bottom: 1px solid var(--rule); }
.tool-list a { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px 32px; padding: 22px 0; text-decoration: none; color: var(--ink); }
.tool-list a:hover .t { color: var(--cobalt); }
.tool-list .t { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.tool-list .d { color: var(--muted); }
@media (max-width: 700px) { .tool-list a { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: grid; gap: 10px; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .row2 { grid-template-columns: 1fr; }
  .details { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ladder .mk .tag { font-size: 12px; } .ladder .mk .tag b { font-size: 13px; }
}

/* Exchange tabs on per-exchange pages */
.ex-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: -8px 0 24px; }
.ex-tabs a { text-decoration: none; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 500; }
.ex-tabs a:hover { color: var(--ink); border-color: var(--muted); }
.ex-tabs a[aria-current="page"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* Text tables: models, exchange grid, comparison */
table.models td, table.models th, table.ex-grid td, table.ex-grid th { text-align: left; white-space: normal; }
table.ex-grid td:last-child a { margin-right: 14px; }
table.compare td:first-child a { font-weight: 600; }
table.compare small { color: var(--muted); }
.pos-num { color: var(--long); } .neg-num { color: var(--short); }

/* Comparison page */
.compare-form { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; margin-bottom: 28px; }
@media (max-width: 960px) { .compare-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .compare-form { grid-template-columns: minmax(0, 1fr); } }
.compare-results { padding-bottom: 32px; }
.compare-results .hint { margin-top: 12px; }
