/* Predly — production skin (Robinhood Chain).
   A black surface over the DOM contract in docs/DOM-CONTRACT.md: rounded panels lifted off a
   true-black ground by three surface steps and hairline borders. One signature green for YES /
   up / live, red for NO / down / loss, amber for the honesty markers and nothing else — the
   binding rules live in docs/PALETTE.md. Numbers stay mono, tabular and high-contrast.
   Loaded after tokens.css; every token below deliberately overrides it.

   Layout notes that are easy to break:
   - The dashboard is a one-screen app shell: `body.app` is a 100dvh flex column and the page
     itself never scrolls. Every descendant that may overflow carries `min-height: 0` and its
     own `overflow-y: auto`, because a flex/grid child defaults to `min-height: auto` and would
     otherwise push the shell taller than the viewport instead of scrolling inside it.
   - `#markets-body` is a <tbody> the script fills with <tr>. It is `display: contents` so the
     rows become flex items of `.table`; that is the only way to paint the spotlight row ABOVE
     the column-header strip without touching dashboard.js.
   - `.odds` holds bar-then-percent in DOM order, so it is reversed with `column-reverse`.
   - `.odds__pct` text is overwritten by the script, so the "chance" label is a ::after. */

/* ============================================================ tokens */
:root {
  --bg: #000000;
  --bg-1: #0b0d0c;
  --bg-2: #131614;
  --bg-3: #1b1f1d;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .16);

  --fg: #ffffff;
  --fg-1: #d6dbd8;
  --fg-2: #969e9a;
  --fg-3: #667069;

  --green: #00c805;
  --green-2: #35e83a;
  --green-dim: rgba(0, 200, 5, .14);
  --green-line: rgba(0, 200, 5, .35);
  --red: #ff5000;
  --red-2: #ff7a3d;
  --red-dim: rgba(255, 80, 0, .14);
  --amber: #ffb62a;
  --amber-dim: rgba(255, 182, 42, .13);

  /* the retired category hues are replaced by white at three opacities: a panel, a chip or a
     rank medal may only differ from another one by how bright its neutral is */
  --neutral-1: rgba(255, 255, 255, .55);
  --neutral-2: rgba(255, 255, 255, .28);
  --neutral-3: rgba(255, 255, 255, .12);

  --yes: var(--green);
  --no: var(--red);

  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: var(--font-sans);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --fs-xs: 10px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 15px;
  --fs-xl: 22px;

  --pad: 14px;
  --gap: 14px;
  --page-x: 20px;
  --rail-l: 214px;
  --rail-r: 266px;

  /* market table geometry — the media queries only retune these */
  --c-meme: 116px;
  --c-spark: 36px;
  --c-cap: 98px;
  --c-odds: 70px;
  --c-yes: 44px;
  --c-no: 44px;
  --c-vol: 46px;
  --c-ends: 50px;
  --c-gap: 6px;

  color-scheme: dark;
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 500 var(--fs-md)/1.4 var(--font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* the dashboard shell: one screen, no page scroll — panels scroll inside themselves */
body.app {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
img { display: block; }
b, strong { font-weight: 700; }
h1, h2, h3 { margin: 0; }
::selection { background: rgba(0, 200, 5, .32); }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, .03); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .3); background-clip: padding-box; }

/* ---- text utilities ---- */
.mono { font-family: var(--font-mono); }
.up, .yes { color: var(--green); }
.down, .no { color: var(--red); }
.muted { color: var(--fg-2); }
.dim { color: var(--fg-3); }
.amber { color: var(--amber); }
.accent { color: var(--fg); }
.sep { color: var(--fg-3); opacity: .8; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============================================================ top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 58px;
  padding: 0 var(--page-x);
  background: rgba(0, 0, 0, .86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
/* the mark is drawn for a black ground and carries its own green: it sits on the bar as-is,
   with no plate and no colour filter behind it */
.brand__logo { width: 28px; height: 28px; flex: none; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; gap: 3px; line-height: 1.05; }
.brand__name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--fg);
}
/* the subtitle used to be 10px grey mono; it is a sentence, so it gets sentence type */
.brand__sub {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .005em;
  text-transform: none;
  color: var(--fg-1);
  white-space: nowrap;
}

/* ---- live block readout (grafted from v1) ---- */
.blockread {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg-1);
}
.blockread__top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-2);
  white-space: nowrap;
}
.blockread__id { color: var(--fg-3); }
.blockread__main { display: flex; align-items: baseline; gap: 9px; }
.blockread__hash { font-family: var(--font-mono); font-size: 14px; color: var(--fg-3); }
.blockread__n {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.1;
  color: var(--fg);
}
.blockread__lat {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-1);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  white-space: nowrap;
}
.chip__stale {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--amber-dim);
  border: 1px solid rgba(255, 182, 42, .4);
  color: var(--amber);
  letter-spacing: .06em;
}

.dot {
  flex: none;
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  animation: dot-pulse 1.8s ease-in-out infinite;
}
.dot--off { background: var(--fg-3); box-shadow: none; animation: none; }
.dot--warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-dim); }
.dot--bad { background: var(--red); box-shadow: 0 0 0 3px var(--red-dim); }
@keyframes dot-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.28); opacity: .75; } }

.topbar__right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--green-dim);
  border: 1px solid var(--green-line);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--green);
}

/* the owner's own accounts: icon-only buttons, so they never compete with the wallet CTA */
.social { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  color: var(--fg-2);
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: color .14s ease, background .14s ease, box-shadow .14s ease;
}
.iconbtn:hover { color: var(--fg); background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px var(--line-2); }
.iconbtn svg { display: block; }

.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: transform .1s ease, background .14s ease;
}
.wallet-btn .dot { background: var(--fg-3); box-shadow: none; animation: none; }
.wallet-btn:hover { background: var(--bg-3); }
.wallet-btn:active { transform: translateY(1px); }
.chain-badge { padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.chain-badge--ok { color: #001b00; background: var(--green); }
.chain-badge--bad { color: #1a0500; background: var(--red); }

/* ============================================================ strips */
/* The hazard strip must stay honest without out-shouting the page: muted amber wash,
   solid pill for the word DEMO, body text at full legibility. */
.strip {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  height: 30px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.strip--demo {
  color: #ffd79a;
  background: var(--amber-dim);
  border-bottom: 1px solid rgba(255, 182, 42, .26);
}
.strip__pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--amber);
  color: #241800;
  font-weight: 700;
  letter-spacing: .2em;
}
.strip__txt { color: #ffd79a; }

/* ---- price ticker: pills with a sans label and a mono figure ---- */
.ticker {
  flex: none;
  height: 34px;
  overflow: hidden;
  background: rgba(255, 255, 255, .028);
  border-bottom: 1px solid var(--line);
}
.ticker__track {
  display: flex;
  align-items: center;
  height: 34px;
  width: max-content;
  animation: marquee var(--ticker-dur, 60s) linear infinite;
  will-change: transform;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  height: 26px;
  margin: 0 4px;
  padding: 0 13px;
  border-radius: 999px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-2);
  transition: background .15s, color .15s;
}
.ticker__item:hover { background: rgba(255, 255, 255, .08); color: var(--fg); }
.ticker__item b {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--fg);
}
.ticker__item .up { color: var(--green); }
.ticker__item .down { color: var(--red); }
.ticker__item .yes { font-weight: 700; color: var(--green); }
.ticker__item.muted { color: var(--fg-3); }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ============================================================ page shell
   The board is one screen: `.page` takes whatever height the bars leave and hands it to the
   grid, which hands it to the columns. Nothing here may grow past the viewport. */
.page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: 100%;
  max-width: 2560px;
  margin: 0 auto;
  padding: 10px var(--page-x) 8px;
}
.grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--rail-l) minmax(0, 1fr) var(--rail-r);
  gap: var(--gap);
  align-items: stretch;
}
.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; min-height: 0; }
/* the three rails share the grid's height; each panel takes a slice and scrolls inside it */
.col--left > .panel { min-height: 0; display: flex; flex-direction: column; }
.col--left #panel-launches { flex: 1.5 1 0; }
.col--left #panel-positions { flex: 1 1 0; }
.col--left #panel-howto { flex: 1.2 1 0; }
.col--right > .panel { min-height: 0; display: flex; flex-direction: column; }
.col--right #panel-focus { flex: 3 1 0; }
.col--right #panel-book { flex: none; }
.col--right #panel-trades { flex: 1 1 0; }
.col--center > .panel { min-height: 0; display: flex; flex-direction: column; }
.col--center #panel-markets { flex: 1 1 0; }
/* the resolved tape is one row of cards under the table: it scrolls sideways, not down */
.col--center #panel-resolved { flex: none; }

/* ---- stat band (no decorative mini charts: the accent underline carries the colour) ---- */
.statband {
  flex: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
/* One card is green because it counts what is live; the rest separate by neutral weight
   alone, so a green number keeps meaning something. */
.stat {
  --hue: var(--neutral-2);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 16px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-1);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease;
}
.stat::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--hue);
}
.stat:hover { transform: translateY(-3px); border-color: var(--line-2); }
.stat__label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-2);
  white-space: nowrap;
}
.stat__value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--fg);
}
.stat__value.up { color: var(--green); }
.stat__value.down { color: var(--red); }
.stat--live { --hue: var(--green); }
.stat--liq { --hue: var(--neutral-3); }
.stat--vol { --hue: var(--neutral-2); }
.stat--res { --hue: var(--neutral-3); }
.stat--pnl { --hue: var(--neutral-2); }
/* a qualifier on a KPI label ("listed pools"), never a badge: this number is real */
.stat__sub {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: none;
  color: var(--fg-3);
}

/* the honesty tags: solid fill, dark ink — they must read at 9px on a dark panel */
.tag {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1;
}
.tag--demo { color: #241800; background: var(--amber); }
/* paper is an honesty marker too, so it joins demo in amber instead of reading as a YES */
.tag--paper { color: var(--amber); background: var(--amber-dim); box-shadow: inset 0 0 0 1px rgba(255, 182, 42, .4); }

/* ============================================================ panel */
.panel {
  --panel-accent: var(--neutral-3);
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  overflow: hidden;
}
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  border-radius: 0 0 3px 3px;
  background: var(--panel-accent);
}
/* the only accented panel on the page: the live markets table it is built around */
.panel--green { --panel-accent: var(--green-line); }

.panel__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
}
/* a second header line for a panel that has to say more than its title (the launch feed's
   heartbeat): same weight as a table's column strip, never a place for data */
.panel__sub {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 24px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
}
.panel__sub b { color: var(--fg-1); font-weight: 700; }
.panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
}
.panel__title::before {
  content: '';
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--panel-accent);
}
.panel__title .sep { font-weight: 400; }
/* the symbol is the part that may be cut when a rail head runs out of room - never the badge,
   which is an honesty marker, and never the kind of panel it is */
.panel__title .accent { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.panel__head > .badges { flex: none; }
.panel__note {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 10px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col--left .panel__note { display: none; }
/* the book panel's note carries the paper disclaimer, which may never be half-shown:
   it wraps onto a second line rather than being cut off by the shared ellipsis rule */
#book-note {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.3;
}
.col--right .panel__head { flex-wrap: wrap; align-content: center; padding-top: 8px; padding-bottom: 8px; row-gap: 1px; }
.col--right .panel__note { flex: 1 0 100%; padding-left: 17px; text-align: left; }
.panel__body { min-width: 0; padding: 8px; }
/* the only kind of scrolling the board has: inside a panel, never on the page */
.panel__body--scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.panel__empty {
  padding: 14px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-3);
  text-align: center;
  line-height: 1.7;
}

/* ---- yes / no legend beside the markets header (grafted from v2) ---- */
.legendset { display: flex; align-items: center; gap: 14px; flex: none; }
.legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-2);
  white-space: nowrap;
}
.legend__sw { width: 10px; height: 10px; border-radius: 3px; }
.legend__sw--yes { background: var(--green); }
.legend__sw--no { background: var(--red); }
.legend--hint {
  padding-left: 14px;
  border-left: 1px solid var(--line-2);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg-3);
}

/* ============================================================ list rows (rails) */
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 9px;
  border-radius: 12px;
  font-size: 12.5px;
  overflow: hidden;
  transition: background .15s ease, transform .15s ease;
}
.row + .row { margin-top: 3px; }
.row:hover { background: rgba(255, 255, 255, .06); transform: translateX(3px); }
.row--hl {
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.row--hl:hover { background: rgba(255, 255, 255, .11); }
.row__rank {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}
.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.row__sym {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row__sym:hover { color: var(--fg); }
.row__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row__right {
  flex: none;
  max-width: 44%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
}
.row__right .row__sub { text-align: right; font-weight: 400; }

/* New launches: the ticker is the point of the row, so the age pill gives up width first
   and the symbol gets tight tracking rather than an ellipsis ($BITSHARK, $PICKLEPONS). */
#launches .row { gap: 8px; padding: 5px 7px; min-height: 42px; }
#launches .row__main { flex: 1 1 auto; }
#launches .row__sym { font-size: 12.5px; letter-spacing: -.04em; }
#launches .row__right { max-width: 48%; flex: 0 1 auto; }
/* the age pill is not a price move: it keeps the .up hook but never the up colour. It counts
   up every second, so it must never wrap - a two-line pill reads as a broken row. */
#launches .row__right > .up {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: var(--fg-2);
  font-size: 10px;
  letter-spacing: -.02em;
  white-space: nowrap;
}

/* a launch that arrived on this poll: the row lights up once, then settles into the feed.
   Green is allowed here because it means what the palette says it means - this one is live. */
#launches .row--hl {
  background: var(--green-dim);
  box-shadow: inset 2px 0 0 var(--green), inset 0 0 0 1px var(--green-line);
  animation: row-in .5s cubic-bezier(.22, 1, .36, 1);
}
/* symbol and its NEW badge on one line, so the badge cannot push the price out of the row */
.row__line { display: flex; align-items: center; gap: 5px; min-width: 0; }
.row__line .row__sym { min-width: 0; }
#launches .badge--new { height: 15px; padding: 0 6px; font-size: 8px; letter-spacing: .1em; }
@keyframes row-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
/* the feed's heartbeat: it beats once per snapshot, so a still panel is a stalled feed */
.pulse {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-3);
  transition: background .2s ease;
}
.pulse--beat { background: var(--green); animation: pulse-beat 1s ease-out; }
@keyframes pulse-beat {
  0% { box-shadow: 0 0 0 0 var(--green-line); }
  70% { box-shadow: 0 0 0 7px rgba(0, 200, 5, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 200, 5, 0); }
}

/* ============================================================ badges */
/* The demo/real badges are the honesty markers: solid fill, dark ink, never a pale outline. */
.badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 9px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  line-height: 1;
  vertical-align: middle;
  flex: none;
}
/* demo is amber and solid; real is deliberately quieter, so the honesty marker wins the eye */
.badge--demo {
  color: #241800;
  background: var(--amber);
}
.badge--real {
  color: var(--fg);
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.badge--new {
  color: #001b00;
  background: var(--green);
  animation: badge-pop 1.4s ease-in-out infinite;
}
.badge--yes { color: #001b00; background: var(--green); }
.badge--no { color: #1a0500; background: var(--red); }
.badge--muted { color: var(--fg-1); background: rgba(255, 255, 255, .1); }
@keyframes badge-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.09); } }

/* ============================================================ avatar */
.avatar {
  --size: 32px;
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size);
  height: var(--size);
  border-radius: 32%;
  border: 1.5px solid var(--line-2);
  background: var(--bg-3);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: calc(var(--size) * .36);
  font-weight: 700;
  letter-spacing: -.02em;
  overflow: hidden;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

#launches .avatar { --size: 26px !important; }
#markets-body .avatar { --size: 32px !important; }
#resolved .avatar { --size: 24px !important; }
.provider .avatar { --size: 26px !important; }

/* ============================================================ markets table */
/* `.table` is a flex column so the spotlight row can be pulled above the header strip with
   `order`; `#markets-body` is display:contents so its <tr> are the flex items. */
/* the 20 rows are the one list that always overflows: it scrolls here, not on the page */
.table-wrap { flex: 1; min-height: 0; padding: 6px 10px 10px; overflow: auto; overscroll-behavior: contain; }
.table {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}
.table colgroup, .table col { display: none; }
.table thead { display: block; order: 2; }
#markets-body { display: contents; }
#markets-body > tr { order: 3; }
#markets-body > tr:first-child:not(.sk-row) { order: 1; }

.table thead tr,
#markets-body > tr {
  display: grid;
  grid-template-columns:
    var(--c-meme) var(--c-spark) minmax(0, 1fr)
    var(--c-cap) var(--c-odds) var(--c-yes) var(--c-no) var(--c-vol) var(--c-ends);
  grid-template-areas: "meme spark q cap odds yes no vol ends";
  column-gap: var(--c-gap);
  align-items: center;
}

/* the column-header strip sits directly above the first ordinary row and shares its grid */
.table thead tr {
  padding: 0 11px;
  margin: 2px 0 5px;
  border-bottom: 1px solid var(--line);
}
.table th {
  display: block;
  padding: 0 0 6px;
  text-align: left;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-3);
  white-space: nowrap;
}
.table th:nth-child(1) { grid-area: meme; }
.table th:nth-child(2) { grid-area: spark; }
.table th:nth-child(3) { grid-area: q; color: var(--fg-2); }
.table th:nth-child(4) { grid-area: cap; }
.table th:nth-child(5) { grid-area: odds; }
.table th:nth-child(6) { grid-area: yes; }
.table th:nth-child(7) { grid-area: no; }
.table th:nth-child(8) { grid-area: vol; }
.table th:nth-child(9) { grid-area: ends; }
.table th.th-r, .td-r { text-align: right; }
.table th.th-c, .td-c { text-align: center; }

#markets-body > tr {
  position: relative;
  min-height: 56px;
  padding: 7px 11px;
  margin-bottom: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .022);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
/* the affordance the copy promises: a hover rail, and a solid white rail when focused */
#markets-body > tr::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background .16s ease;
}
#markets-body > tr:hover {
  background: rgba(255, 255, 255, .085);
  border-color: var(--line-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
#markets-body > tr:hover::before { background: var(--line-2); }
#markets-body > tr.is-focus {
  border-color: var(--line-2);
  background: var(--bg-2);
}
#markets-body > tr.is-focus::before { background: var(--fg); }
#markets-body > tr.is-focus .meme__sym { color: var(--fg); }

#markets-body > tr > td { display: block; padding: 0; min-width: 0; }
#markets-body > tr > td:nth-child(1) { grid-area: meme; }
#markets-body > tr > td:nth-child(2) { grid-area: spark; }
#markets-body > tr > td:nth-child(3) { grid-area: q; }
#markets-body > tr > td:nth-child(4) { grid-area: cap; }
#markets-body > tr > td:nth-child(5) { grid-area: odds; }
#markets-body > tr > td:nth-child(6) { grid-area: yes; }
#markets-body > tr > td:nth-child(7) { grid-area: no; }
#markets-body > tr > td:nth-child(8) { grid-area: vol; text-align: right; }
#markets-body > tr > td:nth-child(9) { grid-area: ends; text-align: right; }

.meme { display: flex; align-items: center; gap: 9px; min-width: 0; }
.meme__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.12; }
/* long tickers ($MONEROCKET) get a wide cell and tight tracking instead of an ellipsis */
.meme__sym {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meme__sym:hover { color: var(--fg); }
.meme__rank {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meme__rank.up { color: var(--green); }
.meme__rank.down { color: var(--red); }

.spark { display: block; line-height: 0; }
.spark svg { display: block; width: 100%; height: 24px; overflow: visible; }
.spark svg polyline { stroke-width: 2; }
.spark svg.spark-up polyline { stroke: var(--green); }
.spark svg.spark-up circle { fill: var(--green); }
.spark svg.spark-down polyline { stroke: var(--red); }
.spark svg.spark-down circle { fill: var(--red); }

/* the question keeps its own column, so every row is exactly one line tall */
.q {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-1);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#markets-body > tr:hover .q { color: var(--fg); }
.q--muted { color: var(--fg-3); font-style: italic; }

.captarget { line-height: 1.2; }
.captarget__vals {
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.captarget__vals .cap { font-weight: 700; color: var(--fg); }
.captarget__vals .sep { padding: 0 3px; }
.captarget__vals .tgt { color: var(--fg-2); }
/* cap progress is neutral on purpose: green is reserved for YES, red for NO */
.bar {
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--neutral-1);
  transition: width .8s cubic-bezier(.22, 1, .36, 1);
}
/* the hold template measures distance to a floor rather than to a target: dimmer, not redder */
.bar__fill--no { background: var(--neutral-2); }

/* ---- odds: the probability is the row's headline, the split bar is its footnote ---- */
.odds {
  display: flex;
  flex-direction: column-reverse;  /* runtime DOM order is bar, then percent */
  align-items: stretch;
  justify-content: center;
  gap: 5px;
}
.odds__pct {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.05em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.odds__pct::after {
  content: 'chance';
  display: block;
  margin-top: 3px;
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.odds__bar {
  width: 100%;
  height: 4px;
  display: flex;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 80, 0, .7);
}
.odds__yes {
  height: 100%;
  background: var(--green);
  transition: width .8s cubic-bezier(.22, 1, .36, 1);
}

#markets-body > tr > td:nth-child(8) > span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-1);
}

.ends {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--fg-1);
}
.ends--soon {
  color: var(--fg);
  background: rgba(255, 255, 255, .16);
  box-shadow: inset 0 0 0 1px var(--line-2);
  animation: soon 1s steps(2, end) infinite;
}
.ends--closed { color: var(--fg-3); background: rgba(255, 255, 255, .04); }
@keyframes soon { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---- HOTTEST MARKET spotlight: the first data row, restyled by CSS alone ---- */
#markets-body > tr:first-child:not(.sk-row) {
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr) minmax(0, .84fr) minmax(0, .84fr);
  grid-template-areas:
    "meme meme  spark flag"
    "q    q     q     q"
    "cap  odds  vol   ends"
    "yes  no    .     .";
  column-gap: 15px;
  row-gap: 6px;
  align-items: center;
  min-height: 0;
  padding: 10px 15px 12px;
  margin-bottom: 9px;
  border: 1.5px solid var(--green-line);
  border-radius: 20px;
  /* the single soft green glow the palette allows, and only behind this card */
  background:
    radial-gradient(70% 120% at 0% 0%, rgba(0, 200, 5, .10), transparent 68%),
    var(--bg-1);
  box-shadow: 0 0 48px rgba(0, 200, 5, .07);
}
#markets-body > tr:first-child:not(.sk-row)::before {
  content: 'hottest right now';
  position: static;
  grid-area: flag;
  justify-self: end;
  align-self: center;
  width: auto;
  top: auto;
  bottom: auto;
  padding: 5px 13px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}
#markets-body > tr:first-child:not(.sk-row):hover::before { background: rgba(255, 255, 255, .18); }
#markets-body > tr:first-child:not(.sk-row).is-focus {
  border-color: var(--green);
  box-shadow: 0 0 48px rgba(0, 200, 5, .12);
}
#markets-body > tr:first-child:not(.sk-row) .avatar { --size: 42px !important; border-radius: 26%; }
#markets-body > tr:first-child:not(.sk-row) .meme { gap: 14px; }
#markets-body > tr:first-child:not(.sk-row) .meme__sym { font-size: 22px; letter-spacing: -.03em; }
#markets-body > tr:first-child:not(.sk-row) .meme__rank { font-size: 12px; }
#markets-body > tr:first-child:not(.sk-row) .badge--new { height: 20px; font-size: 9.5px; }
/* the sparkline runs inline with the token title instead of floating full-height */
#markets-body > tr:first-child:not(.sk-row) .spark svg { height: 34px; }
#markets-body > tr:first-child:not(.sk-row) .q {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--fg);
  white-space: nowrap;
}
#markets-body > tr:first-child:not(.sk-row) .captarget__vals { font-size: 14px; }
#markets-body > tr:first-child:not(.sk-row) .bar { height: 6px; margin-top: 7px; }
#markets-body > tr:first-child:not(.sk-row) .odds { gap: 6px; }
#markets-body > tr:first-child:not(.sk-row) .odds__bar { height: 6px; }
#markets-body > tr:first-child:not(.sk-row) .odds__pct { font-size: 26px; }
#markets-body > tr:first-child:not(.sk-row) .odds__pct::after { font-size: 8.5px; }
#markets-body > tr:first-child:not(.sk-row) .ends { font-size: 12px; padding: 6px 11px; }

/* CSS-generated labels — the spotlight has room for them, the compact rows do not */
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(4)::before { content: 'cap vs target'; }
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(5)::before { content: 'odds'; }
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(6)::before { content: 'buy yes'; }
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(7)::before { content: 'buy no'; }
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(8)::before { content: 'volume 24h'; }
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(9)::before { content: 'ends in'; }
#markets-body > tr:first-child:not(.sk-row) > td::before {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-3);
  text-align: left;
}
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(6),
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(7),
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(8),
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(9) { text-align: left; }
#markets-body > tr:first-child:not(.sk-row) > td:nth-child(8) > span { font-size: 15px; font-weight: 700; color: var(--fg); }
/* equal-width buy pills, each sitting under its own label */
#markets-body > tr:first-child:not(.sk-row) .btn--yes,
#markets-body > tr:first-child:not(.sk-row) .btn--no {
  width: 100%;
  max-width: 170px;
  height: 32px;
  font-size: 14px;
  border-radius: 11px;
}

/* ============================================================ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32px;
  min-width: 44px;
  padding: 0 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  color: var(--fg-1);
  background: rgba(255, 255, 255, .07);
  transition: transform .09s ease, background .14s ease, color .14s ease;
}
.btn:hover { background: rgba(255, 255, 255, .13); color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .3; cursor: not-allowed; transform: none; }
.btn--yes {
  color: #001b00;
  background: var(--green);
}
.btn--yes:hover { color: #001b00; background: var(--green-2); }
.btn--yes:active { transform: translateY(1px); }
.btn--no {
  color: #1a0500;
  background: var(--red);
}
.btn--no:hover { color: #1a0500; background: var(--red-2); }
.btn--no:active { transform: translateY(1px); }
.btn--solid-yes { color: #001b00; background: var(--green); }
.btn--solid-no { color: #1a0500; background: var(--red); }
.btn--wide { width: 100%; }
.btn--sm { height: 28px; min-width: 0; width: auto; padding: 0 12px; font-size: 11px; }

/* In an ordinary row the cent pills are secondary: the probability leads, they follow. */
#markets-body > tr:not(:first-child) .btn--yes,
#markets-body > tr.sk-row .btn--yes,
#markets-body > tr:not(:first-child) .btn--no,
#markets-body > tr.sk-row .btn--no {
  height: 28px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
}
#markets-body > tr:not(:first-child) .btn--yes {
  color: var(--green);
  background: var(--green-dim);
  box-shadow: inset 0 0 0 1px var(--green-line);
}
#markets-body > tr:not(:first-child) .btn--yes:hover {
  color: #001b00;
  background: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}
#markets-body > tr:not(:first-child) .btn--no {
  color: var(--red-2);
  background: var(--red-dim);
  box-shadow: inset 0 0 0 1px rgba(255, 80, 0, .35);
}
#markets-body > tr:not(:first-child) .btn--no:hover {
  color: #1a0500;
  background: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}
#markets-body > tr:not(:first-child) .btn:active { transform: translateY(1px); }

/* ============================================================ skeleton */
#markets-body > tr.sk-row {
  border-color: transparent;
  background: rgba(255, 255, 255, .02);
}
.sk {
  display: inline-block;
  height: 12px;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .05) 0%, rgba(255, 255, 255, .13) 50%, rgba(255, 255, 255, .05) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.sk--round { width: 32px !important; height: 32px; border-radius: 32%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================ focus panel */
/* the canvas is the elastic part: the target strip, the readout and the stamp are fixed, so
   whatever height the rail hands this panel goes into the chart */
.focus { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.focus__target {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 7px;
  padding: 5px 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg);
}
.focus__target-l {
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.focus__canvas { display: block; flex: 1; width: 100%; min-height: 56px; border-radius: 13px; background: rgba(0, 0, 0, .22); }
.focus__readout {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 10px;
  padding: 7px 2px 2px;
}
.focus__big {
  flex: none;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.03em;
  color: var(--green);
}
.focus__big small {
  display: block;
  margin-top: 6px;
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 700;
  color: var(--fg-3);
  letter-spacing: .18em;
  text-transform: uppercase;
}
/* the compact stat cluster (cap / needs / sigma / ends) sits beside the big cents figure */
.focus__meta {
  flex: 1;
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .04);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-1);
  text-align: left;
  line-height: 1.5;
  white-space: pre-line;
}
.focus__stamp {
  flex: none;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 2px 8px;
  margin-top: 7px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .045);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--fg-3);
}
.focus__stamp > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================ order book
   Three stacked blocks inside one panel body: the ladder, the ticket, the resting
   orders. The ladder columns (price / shares / cumulative $) are shared by the row
   header, the levels and the spread row, so the three must be retuned together. */
.panel__body--book { display: flex; flex-direction: column; }
.book { padding: 2px 0; }
.book__cols,
.book__row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 56px;
  align-items: center;
  padding: 0 8px;
}
.book__cols {
  height: 18px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.book__cols span + span { text-align: right; }
.book__row {
  position: relative;
  height: 24px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: background .12s ease;
}
.book__row:hover { background: rgba(255, 255, 255, .08); }
.book__row:focus-visible { outline: 1px solid var(--fg-2); outline-offset: -1px; }
.book__depth { position: absolute; top: 2px; bottom: 2px; right: 0; border-radius: 8px; opacity: .26; pointer-events: none; }
.book__row--ask .book__depth { background: linear-gradient(90deg, rgba(255, 80, 0, .12), var(--red)); }
.book__row--bid .book__depth { background: linear-gradient(90deg, rgba(0, 200, 5, .12), var(--green)); }
.book__c { position: relative; font-weight: 700; }
.book__row--ask .book__c { color: var(--red); }
.book__row--bid .book__c { color: var(--green); }
.book__size {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: var(--fg-1);
}
.book__usd { position: relative; text-align: right; color: var(--fg-3); font-size: 10px; }
/* the visitor's own resting size at that level — the dot is the "this is yours" marker */
.book__mine {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 5px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  color: var(--fg);
}
.book__spread {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  height: 26px;
  margin: 5px 6px;
  border-radius: 999px;
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-2);
}
/* one of your limits is on the wrong side of the touch and the next tick will take it */
/* amber is reserved for the honesty markers, so a crossed touch shouts in white instead */
.book__spread--crossed {
  background: var(--bg-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--fg);
}
.book__last { font-weight: 700; color: var(--fg); }
.book__last.up { color: var(--green); }
.book__last.down { color: var(--red); }
/* two lines high while it has something to say; in a mode that has nothing it collapses
   rather than reserving a void the honesty marker below it needs */
.book__hint {
  min-height: 26px;
  margin: 6px 2px 0;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  color: var(--fg-3);
}

/* ---- top of book: the board's compact quote. The ladder itself, the ticket and the resting
        orders live on the token page, so this strip only has to answer "what is it trading
        at" — best bid, best ask, the spread between them — and hand over the link. ---- */
.tob { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding: 2px 0; }
.tob__cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 8px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .04);
  box-shadow: inset 0 0 0 1px var(--line);
  min-width: 0;
}
.tob__l {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tob__v {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tob__s {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tob__cell--bid .tob__v { color: var(--green); }
.tob__cell--ask .tob__v { color: var(--red); }
/* the way to the real book: one link, sized like a primary action */
.btn--trade {
  flex: none;
  width: 100%;
  height: 32px;
  margin-top: 0;
  color: var(--fg);
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-family: var(--font-sans);
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.btn--trade:hover { color: #001b00; background: var(--green); box-shadow: none; }

/* ============================================================ ticket */
.ticket {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--bg-2);
}
.ticket--flash { animation: ticket-flash .9s ease; }
@keyframes ticket-flash {
  0% { border-color: var(--fg); box-shadow: 0 0 0 0 rgba(255, 255, 255, .35); }
  60% { border-color: var(--fg); box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
.ticket__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ticket__title {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket__q {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--fg-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(0, 0, 0, .3);
  box-shadow: inset 0 0 0 1px var(--line);
}
.seg__b {
  height: 26px;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-3);
  transition: color .14s ease, background .14s ease, box-shadow .14s ease;
}
.seg__b:hover { color: var(--fg-1); background: rgba(255, 255, 255, .07); }
.seg__b.is-on { color: var(--fg); background: rgba(255, 255, 255, .12); }
.seg--side .seg__b.is-on { color: var(--fg); background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg--outcome .seg__b[data-v="YES"].is-on { color: #001b00; background: var(--green); }
.seg--outcome .seg__b[data-v="NO"].is-on { color: #1a0500; background: var(--red); }
/* order type is not an outcome, so the selected chip stays neutral */
.seg--type .seg__b.is-on { color: var(--fg); background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px var(--line-2); }
/* label above value: two side-by-side fields in a 250px rail have no room for a label
   beside the number, and a clipped amount is a lie about what the ticket will do */
.ticket__fields { display: flex; gap: 6px; }
.ticket__fields .field {
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  height: auto;
  padding: 5px 10px 6px;
  border-radius: 11px;
}
.ticket__fields .field__pre { font-size: 8.5px; letter-spacing: .14em; }
.ticket__fields .field input { width: 100%; text-align: left; font-size: 16px; }
.ticket__preview {
  padding: 6px 10px;
  border-radius: 11px;
  background: rgba(0, 0, 0, .24);
}
.ticket__preview .kv { padding: 3px 0; font-size: 10.5px; }
.ticket__why {
  min-height: 13px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  color: var(--fg-1);
}
.ticket__why.is-ok { color: var(--fg-3); }
.ticket__actions { display: flex; gap: 7px; }
.ticket__actions .btn { flex: 1; height: 38px; font-size: 13px; }
.ticket__actions .btn:first-child { flex: 0 0 58px; font-size: 11px; }
.ticket__hint {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--amber);
  text-align: center;
}

/* ============================================================ resting orders */
.orders__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 11px 2px 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.orders__note {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: .02em;
  text-transform: none;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .04);
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.order + .order { margin-top: 5px; }
.order__top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.order__sym { font-weight: 700; color: var(--fg); }
.order__sub { grid-column: 1; color: var(--fg-3); line-height: 1.35; }
.order__x { grid-column: 2; grid-row: 1 / span 2; }
.order__tag {
  display: inline-flex;
  align-items: center;
  height: 15px;
  padding: 0 6px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  flex: none;
}
.order__tag--buy { color: var(--green); background: var(--green-dim); box-shadow: inset 0 0 0 1px var(--green-line); }
.order__tag--sell { color: var(--red); background: var(--red-dim); box-shadow: inset 0 0 0 1px rgba(255, 80, 0, .35); }
.order__tag--yes { color: #001b00; background: var(--green); }
.order__tag--no { color: #1a0500; background: var(--red); }

/* ============================================================ swaps */
.trade {
  display: grid;
  grid-template-columns: 54px 44px minmax(0, 1fr) auto 16px;
  gap: 8px;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  transition: background .14s ease, transform .14s ease;
}
.trade:hover { background: rgba(255, 255, 255, .07); transform: translateX(3px); }
.trade__time { color: var(--fg-3); }
.trade__side {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .08em;
}
.trade__side.up { color: var(--green); background: var(--green-dim); box-shadow: inset 0 0 0 1px var(--green-line); }
.trade__side.down { color: var(--red); background: var(--red-dim); box-shadow: inset 0 0 0 1px rgba(255, 80, 0, .35); }
.trade__size { color: var(--fg-1); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trade__price { color: var(--fg-2); white-space: nowrap; }
.trade__link { color: var(--fg-3); text-align: right; }
.trade:hover .trade__link { color: var(--fg); }

/* ============================================================ resolved */
/* under the table the resolved feed is a tape: one row of cards, scrolled sideways */
.resolved {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.resolved .panel__empty { padding: 8px 4px; text-align: left; }
.rcard {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  font-family: var(--font-mono);
  font-size: 11px;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.rcard:hover { transform: translateY(-2px); border-color: var(--line-2); background: rgba(255, 255, 255, .075); }
.rcard b { font-size: 12.5px; color: var(--fg); }
.rcard__q {
  flex: 1;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rcard__time { color: var(--fg-3); white-space: nowrap; }

/* ============================================================ how it works (left rail) */
.howto { display: flex; flex-direction: column; gap: 3px; }
.howto__card {
  --c: var(--fg-2);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px;
  border-radius: 12px;
  overflow: hidden;
  transition: background .16s ease, transform .16s ease;
}
.howto__card:hover { background: rgba(255, 255, 255, .05); transform: translateX(3px); }
.howto__n {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  color: var(--c);
}
.howto__t { margin: 0 0 3px; font-size: 12.5px; font-weight: 700; letter-spacing: -.01em; color: var(--fg); }
.howto__p { margin: 0; font-size: 11px; line-height: 1.5; color: var(--fg-2); font-weight: 400; }

/* ============================================================ footer
   One line on a one-screen board: the rules, what is real, the disclaimer and the author's
   accounts. The four explainer cards it replaced now live in the left rail's "how it works". */
.footer { flex: none; }
.footer__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 0 2px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.footer__brand { color: var(--fg); font-weight: 700; letter-spacing: .16em; }
.footer__bar .real { color: var(--fg); font-weight: 700; }
.footer__bar .demo { color: var(--amber); font-weight: 700; }
.footer__bar a { color: var(--fg-1); }
.footer__bar a:hover { color: var(--fg); }
.footer__soc { display: inline-flex; align-items: center; gap: 5px; }
.footer__soc svg { display: block; }

/* ============================================================ form fields */
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(0, 0, 0, .3);
}
.field:focus-within { border-color: var(--fg-2); box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
.field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
}
.field__pre { color: var(--fg-3); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.kv {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-2);
}
.kv b { color: var(--fg); }

/* ============================================================ modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 16px;
}
.modal {
  width: 400px;
  max-width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: var(--bg-1);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  overflow: hidden;
}
.modal .panel__head { min-height: 54px; }
.modal__body { padding: 16px; display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; }
.provider {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .05);
  width: 100%;
  text-align: left;
  transition: border-color .14s, background .14s, transform .14s;
}
.provider:hover { border-color: var(--line-2); background: var(--bg-3); transform: translateY(-2px); }
.provider img { width: 26px; height: 26px; border-radius: 8px; }
.provider__name { flex: 1; font-weight: 700; font-size: 14px; }
.modal__hint {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-3);
  text-align: center;
  line-height: 1.8;
}

/* ============================================================ toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 13px 18px;
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--line-2);
  border-radius: 13px;
  background: var(--bg-2);
  font-size: 12.5px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
  animation: toast-in .22s cubic-bezier(.22, 1, .36, 1);
  transition: opacity .2s, transform .2s;
}
.toast--warn { border-left-color: var(--fg-2); }
.toast--out { opacity: 0; transform: translateY(10px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ============================================================ paper / live switch
   The two-segment control in the top bar and everything its LIVE half turns on: the pool
   ladder, the modelled-depth marker, the read-only quote ticket, the wallet balance rows
   and the paper tape that the PAPER half shows instead of the chain's swaps.
   Green marks only the live half - the palette's "live" - and amber only the honesty
   markers (MODELLED, and the line that says nothing is ever sent). */
.modeswitch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, .4);
  box-shadow: inset 0 0 0 1px var(--line);
}
/* the switch names what it switches: the visitor must never read the green LIVE half as
   "my money is live" - it changes which book is quoted, and nothing else */
.modeswitch__l {
  align-self: center;
  padding: 0 8px 0 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.modeswitch__b {
  height: 28px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-3);
  transition: color .14s ease, background .14s ease, box-shadow .14s ease;
}
.modeswitch__b:hover { color: var(--fg-1); background: rgba(255, 255, 255, .07); }
.modeswitch__b.is-on { color: var(--fg); background: rgba(255, 255, 255, .13); box-shadow: inset 0 0 0 1px var(--line-2); }
/* the live half is the one place this control may be green: it names the live market */
.modeswitch__b[data-mode="live"].is-on { color: #001b00; background: var(--green); box-shadow: none; }

/* ---- the live ladder: price / tokens / usd / impact, over the paper ladder's chrome ---- */
.book--live .book__cols,
.book--live .book__row { grid-template-columns: 78px minmax(0, 1fr) 48px 42px; gap: 6px; }
.book--live .book__c { font-size: 10.5px; letter-spacing: -.03em; }
.book--live .book__size { font-size: 10.5px; }
.book__imp { position: relative; text-align: right; font-size: 10px; color: var(--fg-2); }
/* the mid row carries the three real numbers: price, the pool's TVL, the fee tier */
.book__spread--live { gap: 7px; letter-spacing: .04em; }
.book__spread--live b { color: var(--fg); font-weight: 700; }
.book__mid { font-weight: 700; color: var(--fg); }

/* ---- the modelled-depth marker: amber, because it is an honesty marker ---- */
.modelled {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 6px 2px 0;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--amber-dim);
  box-shadow: inset 0 0 0 1px rgba(255, 182, 42, .26);
  font-size: 9.5px;
  line-height: 1.35;
  color: #ffd79a;
}
.badge--modelled { color: var(--amber); background: var(--amber-dim); box-shadow: inset 0 0 0 1px rgba(255, 182, 42, .45); }
.badges { display: inline-flex; align-items: center; gap: 5px; }

/* ---- the live ticket: a quote, never an order ---- */
.ticket--live .ticket__preview .kv b { letter-spacing: -.02em; }
.impact { display: flex; align-items: center; gap: 8px; }
.impact__bar {
  flex: 1;
  min-width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .09);
  overflow: hidden;
}
/* the fill is neutral: price impact is a cost, not an outcome, and green/red are spoken for */
.impact__fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--neutral-1); transition: width .2s ease; }
/* the submit control in LIVE mode: permanently disabled, and it says why in full */
.btn--blocked {
  height: auto;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg-3);
  color: var(--fg-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.4;
  white-space: normal;
  cursor: not-allowed;
}
.btn--blocked:hover { background: var(--bg-3); color: var(--fg-2); }
.btn--blocked:active { transform: none; }
.btn:disabled.btn--blocked { opacity: 1; }

/* ---- the paper tape: your own fills, in the swaps panel's grid ---- */
.trade--paper { grid-template-columns: 38px 38px minmax(0, 1fr) 30px auto; gap: 7px; cursor: default; }
.trade--paper:hover { transform: none; }
.trade--paper .trade__size { font-weight: 500; }
.trade__c { color: var(--fg-1); text-align: right; }
.trade__usd { color: var(--fg-2); text-align: right; white-space: nowrap; }

/* ---- wallet balances (LIVE positions) ---- */
.bal__err { color: var(--fg-3); font-style: normal; }

/* ============================================================ wide screens */
@media (min-width: 1660px) {
  :root {
    --gap: 16px;
    --page-x: 26px;
    --rail-l: 264px;
    --rail-r: 348px;
    --c-meme: 158px;
    --c-spark: 64px;
    --c-cap: 116px;
    --c-odds: 104px;
    --c-yes: 60px;
    --c-no: 60px;
    --c-vol: 68px;
    --c-ends: 70px;
    --c-gap: 12px;
  }
  .statband { gap: 14px; }
  .stat { padding: 13px 20px 16px; }
  .stat__value { font-size: 32px; }
  .focus__big { font-size: 40px; }
  .focus__meta { font-size: 10.5px; line-height: 1.85; }
  .focus__target { padding: 7px 13px; font-size: 13.5px; }
  #markets-body > tr { padding: 8px 14px; min-height: 60px; }
  .q { font-size: 14px; }
  .odds__pct { font-size: 23px; }
  #markets-body > tr:not(:first-child) .btn--yes,
  #markets-body > tr:not(:first-child) .btn--no { height: 32px; font-size: 13px; }
  .ends { font-size: 11.5px; padding: 6px 10px; }
  .meme__sym { font-size: 15px; }
  #markets-body .avatar { --size: 36px !important; }
  #markets-body > tr:first-child:not(.sk-row) .q { font-size: 25px; }
  #markets-body > tr:first-child:not(.sk-row) .meme__sym { font-size: 30px; }
  #markets-body > tr:first-child:not(.sk-row) .avatar { --size: 58px !important; }
  #markets-body > tr:first-child:not(.sk-row) .odds__pct { font-size: 36px; }
  #markets-body > tr:first-child:not(.sk-row) .btn--yes,
  #markets-body > tr:first-child:not(.sk-row) .btn--no { max-width: 190px; height: 46px; font-size: 19px; }
  .resolved { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
}

/* ---- ultrawide: the right rail becomes two columns, so the extra width buys the focus chart
        height instead of stretching four panels into ribbons. The page still never scrolls. ---- */
@media (min-width: 1920px) {
  :root { --gap: 18px; --page-x: 32px; --rail-l: 288px; }
  .grid { grid-template-columns: var(--rail-l) minmax(0, 1fr) minmax(560px, .52fr); }
  .col--right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: var(--gap);
  }
  #panel-focus { grid-column: 1 / -1; grid-row: 1; }
  #panel-book { grid-column: 1; grid-row: 2; }
  #panel-trades { grid-column: 2; grid-row: 2; }
  .col--right > .panel { min-height: 0; }
  .trade { height: 34px; font-size: 11.5px; }
  .book__hint { font-size: 11px; }
  .tob__v { font-size: 20px; }

  #panel-focus .panel__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 272px;
    grid-template-areas:
      "tgt    tgt"
      "canvas readout"
      "canvas stamp";
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 9px;
  }
  .focus__target { grid-area: tgt; margin: 0; }
  .focus__canvas { grid-area: canvas; height: 100%; min-height: 0; }
  .focus__readout {
    grid-area: readout;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 14px;
    padding: 0;
  }
  .focus__big { font-size: 52px; }
  .focus__meta { flex: none; font-size: 11px; line-height: 2; }
  .focus__stamp { grid-area: stamp; margin: 0; }
}

@media (min-width: 2200px) {
  :root {
    --c-meme: 176px;
    --c-spark: 76px;
    --c-cap: 130px;
    --c-odds: 116px;
    --c-yes: 68px;
    --c-no: 68px;
    --c-vol: 80px;
    --c-ends: 80px;
    --c-gap: 14px;
  }
  .q { font-size: 15px; }
  .odds__pct { font-size: 25px; }
  #markets-body > tr { min-height: 64px; padding: 9px 16px; }
  .stat__value { font-size: 38px; }
  .resolved { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
}

/* ============================================================ narrow screens */
@media (max-width: 1340px) {
  :root { --rail-l: 200px; --rail-r: 272px; --page-x: 14px; --gap: 12px; }
  .legend--hint { display: none; }
  .panel__head--markets .panel__note { display: none; }
}
@media (max-width: 1500px) {
  .brand__sub { display: none; }
}
/* under three rails the one-screen rule is dropped: two columns and an ordinary page scroll
   beat cramming four rail panels into a 200px slice */
@media (max-width: 1180px) {
  body.app { height: auto; min-height: 100dvh; overflow: visible; }
  .page { padding-bottom: 20px; }
  .grid { grid-template-columns: var(--rail-l) minmax(0, 1fr); }
  .col--left > .panel,
  .col--center > .panel,
  .col--right > .panel { flex: none; }
  .col--right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
  .table-wrap { overflow: visible; }
  .panel__body--scroll { max-height: 420px; }
  .focus__canvas { min-height: 200px; }
  .statband { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat--opt { display: none; }
}
/* below the desktop breakpoint the one-screen rule is dropped: a phone scrolls */
@media (max-width: 900px) {
  body.app { height: auto; min-height: 100dvh; overflow: visible; }
  .topbar { height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topbar__right { margin-left: auto; }
  .page { padding: 12px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .col--left > .panel,
  .col--center > .panel,
  .col--right > .panel { flex: none; }
  .col--center { overflow: visible; }
  .col--right { grid-column: auto; grid-row: auto; display: flex; }
  .table-wrap { overflow: visible; }
  .statband { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticker { display: none; }
  .legendset { display: none; }
}

/* ============================================================ reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ticker__track,
  .dot,
  .badge--new,
  .ends--soon,
  .sk { animation: none !important; }
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
  .row:hover, .trade:hover, .stat:hover, .howto__card:hover, .rcard:hover { transform: none; }
  /* contrast markers must survive: hover and focus stay legible without movement */
  #markets-body > tr:hover { background: rgba(255, 255, 255, .1); }
}

/* ============================================================ portfolio page (/portfolio)
   Scoped to `.page-pf` so nothing here reaches the board or the token page. Same one-screen
   rule as the board (docs/DOM-CONTRACT.md section 0): the bars are `flex: none`, `.pf-grid`
   takes the rest, and every panel scrolls inside its own slice. Palette rules are unchanged:
   green only on a profit, red only on a loss, amber only on the demo markers. */
.page-pf .pf-back {
  flex: none;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-2);
  transition: color .14s, border-color .14s, background .14s;
}
.page-pf .pf-back:hover { color: var(--fg); border-color: var(--line-2); background: var(--bg-2); }
.page-pf .pf-stamp {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-3);
  white-space: nowrap;
}

/* ---- summary row: seven figures, so the type is one step down from the board's band ---- */
.page-pf .pf-summary {
  flex: none;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.page-pf .pf-stat { padding: 8px 13px 10px; border-radius: 14px; }
.page-pf .pf-stat .stat__label { font-size: 9px; letter-spacing: .1em; gap: 6px; }
.page-pf .pf-stat .stat__value { font-size: 21px; }
.page-pf .pf-stat .stat__sub { font-size: 8.5px; letter-spacing: .04em; }
/* the headline card separates by neutral weight, never by hue: green here would be
   decoration, and docs/PALETTE.md keeps green for YES, up and live only */
.page-pf .pf-stat--equity { --hue: var(--neutral-1); }

/* ---- the one-line "nothing traded yet" banner ---- */
.page-pf .pf-start {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--bg-1);
}
.page-pf .pf-start__pill {
  flex: none;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .12);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-1);
}
.page-pf .pf-start__txt { flex: 1; min-width: 0; font-size: 12px; color: var(--fg-1); }
.page-pf .pf-start__cta { flex: none; }

/* ---- the two rails ---- */
.page-pf .pf-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: stretch;
}
.page-pf .pf-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; min-height: 0; }
.page-pf .pf-col > .panel { min-height: 0; display: flex; flex-direction: column; }
.page-pf #panel-curve { flex: 1 1 0; }
.page-pf #panel-positions { flex: 1.15 1 0; }
.page-pf #panel-orders { flex: .85 1 0; }
.page-pf #panel-history { flex: 1.45 1 0; }

/* ---- equity curve ---- */
.page-pf .pf-curve { position: relative; flex: 1; min-height: 70px; padding: 2px 12px 0; }
.page-pf .pf-curve canvas { display: block; width: 100%; height: 100%; }
.page-pf .pf-curve__empty {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 26%;
  text-align: center;
  font-size: 11px;
  color: var(--fg-3);
  pointer-events: none;
}
.page-pf .pf-curve__foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 3px 16px 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.page-pf .pf-curve__legend { text-transform: none; letter-spacing: 0; color: var(--fg-3); opacity: .85; }

/* ---- the two data tables ---- */
.page-pf .pf-tablewrap { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 10px 8px; }
.page-pf .pftable { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.page-pf .pftable thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 6px 5px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-3);
  text-align: left;
  white-space: nowrap;
}
.page-pf .pftable th.th-r { text-align: right; }
.page-pf .pftable td { padding: 6px; border-bottom: 1px solid rgba(255, 255, 255, .05); vertical-align: middle; }
/* `max-width: 0` is what lets the question ellipsize inside an auto-layout table cell */
.page-pf .pftable td:first-child { width: 44%; max-width: 0; }
.page-pf .pftable tbody tr { cursor: pointer; transition: background .14s; }
.page-pf .pftable tbody tr:hover { background: rgba(255, 255, 255, .06); }
.page-pf .pftable .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.page-pf .pftable tbody tr:last-child td { border-bottom: 0; }
.page-pf .pf-close:disabled { opacity: .3; }

.page-pf .pf-market { display: flex; align-items: center; gap: 8px; min-width: 0; }
.page-pf .pf-market__txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.15; }
.page-pf .pf-market__sym { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: var(--fg); }
.page-pf .pf-market__q { font-size: 10.5px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.page-pf .pf-chip {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
}
.page-pf .pf-chip--yes { color: var(--green); background: var(--green-dim); box-shadow: inset 0 0 0 1px var(--green-line); }
.page-pf .pf-chip--no { color: var(--red); background: var(--red-dim); box-shadow: inset 0 0 0 1px rgba(255, 80, 0, .35); }

/* ---- settled history: one block per UTC day, with the day's own P&L ---- */
.page-pf #pf-history { padding: 0 10px 8px; }
.page-pf .pf-day + .pf-day { margin-top: 12px; }
.page-pf .pf-day__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 6px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
}
.page-pf .pf-day__d { font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-2); }
.page-pf .pf-day__sum { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: var(--fg); }
.page-pf .pf-hrow {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 40px 54px 52px 52px 60px 34px;
  align-items: center;
  gap: 7px;
  padding: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  font-size: 11px;
}
.page-pf .pf-hrow:last-child { border-bottom: 0; }
.page-pf .pf-hrow__t { font-size: 10px; color: var(--fg-3); }
.page-pf .pf-hrow__m { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.page-pf .pf-hrow__m b { font-family: var(--font-mono); font-size: 11px; color: var(--fg); }
.page-pf .pf-hrow__q { min-width: 0; font-size: 10px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-pf .pf-hrow__n { text-align: right; }
.page-pf .pf-hrow .badge { justify-self: end; }

/* ---- the reset strip ---- */
.page-pf .pf-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-1);
}
.page-pf .pf-foot__txt { font-size: 11px; color: var(--fg-3); }
.page-pf .pf-foot__acts { display: flex; align-items: center; gap: 10px; }
.page-pf .pf-confirm { display: flex; align-items: center; gap: 9px; }
.page-pf .pf-confirm__q { font-size: 11px; font-weight: 600; color: var(--fg-1); }

/* ---- the header entry that links here from the board and the token page ---- */
.navpf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg-1);
  transition: border-color .14s, background .14s;
}
.navpf:hover { border-color: var(--line-2); background: var(--bg-2); }
.navpf__l { font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.navpf__v { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; }
.navpf__v.up { color: var(--green); }
.navpf__v.down { color: var(--red); }

/* the value alone reads as a stray number, so the word survives down to the breakpoint
   where the board stops being one screen anyway */
@media (max-width: 1180px) {
  .navpf__l { display: none; }
}
@media (max-width: 1420px) {
  .page-pf .pf-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .page-pf .pf-stat .stat__value { font-size: 19px; }
}
/* under two comfortable rails the one-screen rule is dropped, exactly as on the board */
@media (max-width: 1080px) {
  body.page-pf { height: auto; min-height: 100dvh; overflow: visible; }
  .page-pf .pf-grid { flex: none; grid-template-columns: minmax(0, 1fr); }
  /* the id selectors that give each panel its slice of the screen outrank a class here, so
     the stacked layout has to release them by id or the panels stay squashed */
  .page-pf #panel-curve,
  .page-pf #panel-positions,
  .page-pf #panel-orders,
  .page-pf #panel-history,
  .page-pf .pf-col > .panel { flex: none; }
  /* the panels are sized by their content here, so every scroller has to size itself too:
     a `flex: 1` child of a content-height flex column collapses and clips its rows */
  .page-pf .pf-curve { flex: none; height: 220px; }
  .page-pf .pf-tablewrap,
  .page-pf #pf-history { flex: none; max-height: 380px; }
  .page-pf .pf-summary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .page-pf .pf-start { flex-wrap: wrap; }
  .page-pf .pf-foot { flex-wrap: wrap; }
}
@media (min-width: 2200px) {
  .page-pf .pf-stat .stat__value { font-size: 30px; }
  .page-pf .pf-stat .stat__label { font-size: 10.5px; }
  .page-pf .pftable { font-size: 13px; }
  .page-pf .pf-market__sym { font-size: 13px; }
  .page-pf .pf-market__q { font-size: 12px; }
  .page-pf .pf-hrow { grid-template-columns: 48px minmax(0, 1fr) 52px 74px 72px 72px 82px 44px; font-size: 12.5px; }
  .page-pf .pf-hrow__q { font-size: 11.5px; }
}
