:root {
  --canvas: #0B0E14;
  --surface: #121722;
  --raised: #232A37;
  --line: #252C3A;
  --line-soft: #1C2230;
  --text: #E6E9EF;
  --muted: #9AA3B2;
  --mark: #FBE36A;
  --ok: #3DDC97;
  --ok-soft: #143327;
  --risk: #FF6B6B;
  --risk-soft: #3A1A1F;
  --thin: #9AA1AD;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 400 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
/* Tabular figures only where numbers line up: Schibsted's tabular set also widens . and , in prose. */
table, .stats b, .mono, .count, .chip, .kv2, .swap-q, .mv, .rate, .sc { font-variant-numeric: tabular-nums; }
a { color: var(--text); }
a:hover { color: var(--mark); }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); }
.wrap { max-width: 1360px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }

.bar { border-bottom: 1px solid var(--line); }
.bar-in { display: flex; align-items: center; gap: 22px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; text-decoration: none; }
.wordmark i { display: block; width: 22px; height: 9px; background: var(--mark); border-radius: 2px; }
.search { flex: 1 1 360px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px 7px 12px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: 500 14px var(--sans); }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--mark); }
.navl { display: flex; gap: 18px; font-size: 14px; flex-wrap: wrap; }
.navl a { text-decoration: none; color: var(--muted); }
.navl a[aria-current="page"] { color: var(--text); font-weight: 700; }

.btn1 { border: 0; background: var(--mark); color: #0B0E14; border-radius: 10px; padding: 9px 15px; font: 700 14px var(--sans); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn1:hover { color: #0B0E14; filter: brightness(1.05); }
.btn2 { border: 1px solid #3A4252; background: transparent; color: var(--text); border-radius: 10px; padding: 8px 14px; font: 600 14px var(--sans); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn2:hover { border-color: var(--text); color: var(--text); }

main.wrap { padding-top: 22px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 16px; }
.pn { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.pn-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pn-t { margin: 0; font-size: 15px; font-weight: 700; }
.pn-b { padding: 14px 16px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.grow { flex: 999 1 620px; }
.side { flex: 1 1 320px; }

.head { padding: 18px 20px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.avatar { width: 56px; height: 56px; border-radius: 12px; background: var(--raised); flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; }
h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.sub { color: var(--muted); font-size: 14px; }
.labels { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--raised); color: var(--text); }
.lbl.ok { background: var(--ok-soft); color: var(--ok); }
.lbl.risk { background: var(--risk-soft); color: var(--risk); }
.lbl.mark { background: var(--mark); color: #0B0E14; }
.lbl.muted { color: var(--muted); }

.stats { display: flex; flex-wrap: wrap; }
.stats > div { flex: 1 1 150px; padding: 14px 18px; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; }
.stats span { color: var(--muted); font-size: 12px; display: block; }
.stats b { font-size: 22px; }
.stats small { color: var(--muted); font-size: 12px; margin-left: 4px; }

.dist { display: flex; height: 26px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.dist span { display: block; height: 100%; }

.tbl-wrap { overflow-x: auto; position: relative; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; white-space: nowrap; }
th.r, td.r { text-align: right; }
tr:last-child td { border-bottom: 0; }

.chart { position: relative; height: 320px; }
.chart svg { display: block; width: 100%; height: 300px; }
.mk { position: absolute; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; border: 0; cursor: pointer; color: #0B0E14; font: 700 12px var(--sans); box-shadow: 0 0 0 2px var(--surface); }
.mk[aria-pressed="true"] { width: 32px; height: 32px; margin-left: -16px; box-shadow: 0 0 0 2px var(--text); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin-right: 4px; }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.live { color: var(--ok); }
.skel { color: var(--muted); padding: 40px 0; text-align: center; }

footer.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 22px 0 36px; }
footer.foot p { margin: 0 0 8px; max-width: 110ch; }

/* Freshness banner (public.js Fen.freshness): discreet, under the header, only when ingest is stale. */
.fresh { margin: 0; border-bottom: 1px solid var(--line); background: #17150C; color: #D9CC86; font-size: 13px; }
.fresh-in { display: flex; align-items: center; gap: 8px; padding-top: 7px; padding-bottom: 7px; }
.fresh-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--mark); }

/* Buy (non-custodial swap via the user's wallet). Buttons stay hidden until /api/public/swap/config says enabled. */
.buy-btn { display: none; }
.fen-swap-on .buy-btn { display: inline-flex; }
.buy-btn.sm { padding: 4px 11px; font-size: 12px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
dialog.swap { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 0; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); }
dialog.swap::backdrop { background: rgba(5, 7, 11, 0.72); }
.swap-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.swap-h .pn-t { font-size: 17px; overflow-wrap: anywhere; }
.swap-x { padding: 4px 10px; }
.swap-b { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.swap-mint { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.swap-f { border: 0; margin: 0; padding: 0; min-width: 0; }
.swap-f legend { padding: 0; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: 6px 12px; font: 600 13px var(--sans); cursor: pointer; }
.chips button[aria-pressed="true"] { border-color: var(--mark); background: var(--mark); color: #0B0E14; }
.swap-amt { display: flex; align-items: center; gap: 8px; margin-top: 8px; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; }
.swap-amt:focus-within { border-color: var(--mark); }
.swap-amt input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: 600 16px var(--mono); }
.swap-amt input:focus { outline: none; }
.swap-f .note { margin-top: 6px; font-size: 12px; }
.swap-q { background: var(--canvas); border-radius: 10px; padding: 10px 12px; font-size: 14px; min-height: 44px; }
.swap-q.bad, .swap-res.bad { color: var(--risk); }
.swap-res.good { color: var(--ok); }
.kv2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.kv2 > div > span { display: block; font-size: 12px; color: var(--muted); }
.kv2 b { overflow-wrap: anywhere; }
.kv2 .wide { grid-column: 1 / -1; }
.swap-q .note { margin-top: 8px; font-size: 12px; }
.swap-q .swap-err { color: var(--risk); font-size: 13px; }
.swap-ctx { margin: 0; font-size: 13px; padding: 8px 10px; border-left: 3px solid var(--mark); background: var(--canvas); border-radius: 0 8px 8px 0; }
.swap-risk { margin: 0; font-size: 13px; color: var(--muted); }
.swap-act { display: flex; gap: 8px; flex-wrap: wrap; }
.swap-act .btn1 { flex: 1 1 auto; justify-content: center; }
.swap-act .btn1:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.swap-res { font-size: 14px; overflow-wrap: anywhere; }
.swap-res:empty { display: none; }
.swap-sig { font-size: 11px; }

/* Legal and trust pages (terms, privacy, methodology, disputes) and their footer links. */
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--mark); }
.legal { max-width: 860px; width: 100%; margin: 0 auto; }
.legal .head { display: block; }
.legal .updated { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.legal .draft { margin: 12px 0 0; font-size: 13px; padding: 8px 10px; border-left: 3px solid var(--mark); background: var(--canvas); border-radius: 0 8px 8px 0; }
.legal .toc { padding: 14px 20px; }
.legal .toc ol { margin: 0; padding-left: 20px; columns: 2 240px; font-size: 14px; }
.legal .toc li { margin: 2px 0; }
.legal .doc { padding: 6px 20px 20px; font-size: 15px; line-height: 1.6; }
.legal .doc h2 { font-size: 19px; margin: 26px 0 8px; letter-spacing: -0.01em; scroll-margin-top: 16px; }
.legal .doc h3 { font-size: 15px; margin: 18px 0 6px; }
.legal .doc p, .legal .doc li { max-width: 75ch; }
.legal .doc ul, .legal .doc ol { padding-left: 22px; }
.legal .doc li { margin: 4px 0; }
.legal .doc code { font-family: var(--mono); font-size: 13px; background: var(--raised); padding: 1px 5px; border-radius: 4px; }
.legal .doc table { min-width: 0; margin: 8px 0 12px; }
.legal .doc td { white-space: normal; vertical-align: top; }
.legal .doc .tbl-wrap table { min-width: 560px; }
.legal .callout { padding: 10px 12px; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; }
/* Candlestick chart (fenchart.js) */
.fc { display: flex; flex-direction: column; gap: 8px; }
.fc-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fc-tf { display: flex; gap: 4px; }
.fc-tf button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 8px; padding: 3px 10px; font: 600 12px var(--sans); cursor: pointer; }
.fc-tf button[aria-pressed="true"] { background: var(--text); color: #0B0E14; border-color: var(--text); }
.fc-src { font-size: 12px; }
.fc-canvas { position: relative; height: 380px; }
.fc-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; }
@media (max-width: 760px) { .fc-canvas { height: 300px; } }
.fc-tip { position: absolute; z-index: 3; pointer-events: none; min-width: 160px; max-width: 260px; padding: 8px 10px; border-radius: 10px; background: rgba(15, 18, 26, .96); border: 1px solid var(--line); font-size: 12px; line-height: 1.45; }
.fc-tip span { color: var(--muted, #9AA3B2); }
.fc-tip-hint { margin-top: 4px; color: var(--muted, #9AA3B2); font-size: 11px; }
/* Add-a-caller form */
.addc { display: flex; gap: 8px; max-width: 560px; }
.addc input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--canvas); color: var(--text); font: 500 14px var(--sans); }
.addc-msg { margin: 8px 0 0; font-size: 13px; min-height: 1em; }
.addc-msg.ok { color: var(--ok); }
.addc-msg.bad { color: var(--risk); }
.addc-slot { margin-top: 12px; }
