/*
  The look, in one stylesheet, from the Glacier & Cobalt brand kit (brand_kit/).
  To re-skin: the design tokens are the :root block below; fonts live in fonts/, brand art in brand/.

  Glacier and paper are the surfaces, navy is the type, cobalt is the one action colour (decision 54).
  Product output (a ticket, a table of positions, a log) sits in a white panel with a thin line, one
  small step from the paper page (about 1.07:1, research 31 and 34 to 36). Navy is a surface only in
  the landing page's one band, where the same token names are re-pointed so every rule works there.
  Sizes: 14, 16, 18, 20, 24 px and the display sizes. Spacing: 4, 8, 12, 16, 24, 32, 48, 64, 96.
  Two weights per face: DM Sans 400 and 600, Plex Mono 400 and 500. Durations: 120 and 240 ms.

  Type rules (docs/research/30-design-principles.md, and Kevin, 2026-11-21: "smaller thinner text looks
  vibecoded. dont use smaller than 14 unless necessarry"):
  - Nothing under 14 px (0.875rem). Every size is in rem, so it follows the reader's own text size.
  - No weight under 400. Small text is never also faint: labels are 14 px, weight 500, in the text face.
  - Mono is for figures only (prices, sizes, money), so columns of numbers line up.
  - No pills or tag boxes. Long and short are coloured words; states are words in their place.
  - Headlines are tracked no tighter than -0.025em, and wrap in balanced lines.
*/
@font-face { font-family: "DM Sans"; src: url("fonts/dm-sans-var-latin.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  /* the kit's palette */
  --glacier: #DCE9F4;
  --cobalt: #4159AC;
  --cobalt-hover: #324885;
  --navy: #18243E;
  --paper: #F5F8FC;
  --slate: #46566F;
  --rule: #BACBDC;

  /* roles */
  --page: var(--paper);
  --surface: #FFFFFF;
  --text: var(--navy);
  --text-2: var(--slate);
  --text-3: #5F6E86;
  --line: rgb(186 203 220 / 0.6);
  --line-2: var(--rule);
  /* The edge of anything you operate (inputs, the box, outline buttons): 3:1 on paper and on white. */
  --edge: #7E90A9;
  --wash: rgb(65 89 172 / 0.08);
  --gain: #17705A;
  --loss: #B4304A;
  --focus: var(--cobalt);
  /* Charts (ui/chart.ts): the line in ink, each level in its own colour, tags with light text on them. */
  --chart-line: var(--text);
  --chart-fill: rgb(24 36 62 / 0.05);
  --chart-entry: var(--slate);
  --chart-stop: var(--loss);
  --chart-tp: var(--gain);
  --chart-liq: #8E1F37;
  --chart-on-tag: #FFFFFF;
  --chart-zone-loss: rgb(180 48 74 / 0.06);
  --chart-zone-gain: rgb(23 112 90 / 0.06);
  --chart-bg: var(--page);

  --sans: "DM Sans", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --col: 760px;
  --radius: 8px;
  --panel-radius: 12px;
}

/* The landing page's navy band: the same roles, re-pointed. Scoped to the section, so the app's own
   answer holder (div.answer) is not painted by it. */
.tape, section.answer, .answer-desk article.ticket {
  --edge: #7C8DA8;
  --surface: #22304D;
  --text: var(--glacier);
  --text-2: #C9D4E4;
  --text-3: #A9B9D0;
  --line: #2F3E5B;
  --line-2: #52647E;
  --wash: rgb(220 233 244 / 0.09);
  --gain: #7FD6B4;
  --loss: #F4A3AE;
  --focus: var(--glacier);
  --chart-line: var(--glacier);
  --chart-fill: rgb(220 233 244 / 0.07);
  --chart-entry: #C9D4E4;
  --chart-stop: #F4A3AE;
  --chart-tp: #7FD6B4;
  --chart-liq: #F7C2C9;
  --chart-on-tag: var(--navy);
  --chart-zone-loss: rgb(244 163 174 / 0.10);
  --chart-zone-gain: rgb(127 214 180 / 0.10);
  --chart-bg: var(--surface);
  background: var(--navy);
  color: var(--text);
}

* { box-sizing: border-box; }
html { background: var(--page); color-scheme: light; }
body { margin: 0; background: var(--page); color: var(--text); font: 400 1rem/1.5 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.loss { color: var(--loss); }
.gain { color: var(--gain); }
/* Read by screen readers, not shown. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* The label used for column heads, section names and status: 14 px, weight 500, sentence case, in the text face. */
.cap, .side-label, table.legs th, .facts dt, .article th, h2.sec, .acct .dim, .docs-nav p, .toc p, .ticket .label, .take-col .meta, .meta {
  font: 400 0.875rem/1.25rem var(--sans); letter-spacing: 0;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; padding: 0 24px; border-radius: var(--radius); font-weight: 600; font-size: 1rem; white-space: nowrap;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.btn.solid { background: var(--cobalt); color: #fff; }
.btn.solid:hover { background: var(--cobalt-hover); }
.btn.solid:active { background: #2A3D72; }
.btn.line { border: 1px solid var(--edge); color: var(--text); background: var(--surface); }
.btn.line:active { background: var(--glacier); }
.btn.line:hover { border-color: var(--text-2); background: var(--wash); }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 0.875rem; }
/* The third tier: an underlined word. */
.btn.text { padding: 0 12px; color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.btn.text:active { background: var(--glacier); }
.btn.text:hover { color: var(--text); background: var(--wash); }

.logo { display: inline-flex; align-items: center; }
.logo img { display: block; width: 118px; height: auto; }

/* ---------- the composer: where you type ---------- */
.composer { position: relative; width: min(var(--col), 100% - 32px); margin: 0 auto; background: var(--surface); border: 1px solid var(--edge); border-radius: var(--panel-radius); padding: 12px; box-shadow: 0 8px 24px -16px rgb(24 36 62 / 0.06); transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease); }
.composer:focus-within { border-color: var(--cobalt); box-shadow: 0 0 0 3px rgb(65 89 172 / 0.16); }
.composer textarea { display: block; width: 100%; min-height: 48px; resize: none; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 1.125rem; padding: 4px 8px; }
.composer textarea::placeholder { color: var(--text-3); }
.composer .row { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
/* The mode control: a word with a chevron, not a pill. It opens a real menu (ui/composer.ts). */
.mode-wrap { position: relative; }
.mode { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px; margin-left: -4px; border-radius: var(--radius); color: var(--text-2); font: 400 0.875rem/1 var(--sans); }
button.mode:hover, button.mode[aria-expanded="true"] { background: var(--wash); color: var(--text); }
.mode svg { width: 12px; height: 12px; }
.mode-menu { position: absolute; left: -4px; bottom: calc(100% + 8px); z-index: 40; width: min(320px, 80vw); padding: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 32px -20px rgb(24 36 62 / 0.45); }
.mode-menu button { display: grid; gap: 2px; width: 100%; padding: 12px 12px; border-radius: var(--radius); text-align: left; }
.mode-menu button:hover { background: var(--wash); }
.mode-menu b { font-weight: 600; font-size: 1rem; }
.mode-menu [aria-checked="true"] b::before { content: "\2713\00a0"; color: var(--cobalt); }
.mode-menu span { font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.mode-menu .off b { color: var(--text-2); }
/* The model menu (ui/model-picker.ts): the mode control's word and chevron, and the mode menu's panel,
   anchored to the box rather than the button so it fits a phone. It opens toward the side with more
   room and scrolls inside itself; the search stays in view while the other models scroll under it. */
.composer .row .send { margin-left: auto; }
.pick-wrap { display: inline-flex; min-width: 0; }
.pick { min-width: 0; margin-left: 0; }
.pick .pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem; line-height: 1.25rem; }
.pick svg { flex: none; }
.mode-menu.pick-menu { left: 0; width: min(400px, 100%); overflow-y: auto; overscroll-behavior: contain; }
.mode-menu.pick-menu.below { bottom: auto; top: calc(100% + 8px); }
.pick-note { margin: 4px 12px 8px; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.pick-menu [aria-current="true"] b::before { content: "\2713\00a0"; color: var(--cobalt); }
.pick-menu .pick-more { border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); margin-top: 4px; }
.pick-menu .pick-more[aria-expanded="true"] { background: var(--wash); }
.pick-others { padding-top: 8px; }
.pick-search { position: sticky; top: -8px; z-index: 1; display: block; width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; box-shadow: 0 -8px 0 var(--surface); }
.pick-search:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.pick-none { margin: 12px; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.pick-list { padding-top: 4px; }
.send { width: 44px; height: 44px; border-radius: var(--radius); display: grid; place-items: center; background: var(--glacier); color: var(--text-3); transition: background-color 120ms var(--ease), color 120ms var(--ease); }
.send svg { width: 16px; height: 16px; }
.composer.has-text .send { background: var(--cobalt); color: #fff; }
.composer.has-text .send:hover { background: var(--cobalt-hover); }

/* ---------- the app frame ---------- */
body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.side { background: var(--glacier); border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 24px 12px 12px; min-height: 0; overflow-y: auto; }
.side .logo { padding: 0 8px; margin-bottom: 24px; }
.side-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--radius); font-size: 1rem; color: var(--text-2); width: 100%; text-align: left; transition: background-color 120ms var(--ease), color 120ms var(--ease); }
.side-row:hover { background: rgb(245 248 252 / 0.6); color: var(--text); }
.side-row.on { background: var(--paper); color: var(--text); font-weight: 600; }
.side-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-row .r { flex: none; font: 400 0.875rem/1 var(--mono); }
/* A conversation row: its title, an open position's result if any, and a small menu for Rename and Delete. */
.chat-row { position: relative; display: flex; align-items: center; }
.chat-row .side-row { flex: 1; min-width: 0; padding-right: 36px; }
.chat-more { position: absolute; right: 0; top: 0; width: 36px; height: 100%; border-radius: var(--radius); color: var(--text-2); font-size: 1.125rem; line-height: 1; opacity: 0; }
.chat-row:hover .chat-more, .chat-more:focus-visible, .chat-row:focus-within .chat-more { opacity: 1; }
.chat-row:hover .side-row .r, .chat-row:focus-within .side-row .r { visibility: hidden; }
.chat-more:hover { background: rgb(245 248 252 / 0.6); color: var(--text); }
.chat-row .menu { left: 12px; right: 12px; top: calc(100% + 4px); min-width: 0; }
.chat-input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
.chat-row.asking { display: block; padding: 8px 12px; background: var(--paper); border-radius: var(--radius); }
.chat-row.asking p { margin: 0 0 8px; font-size: 0.875rem; line-height: 1.375rem; }
.chat-acts { display: flex; gap: 8px; }
@media (hover: none) { .chat-more { opacity: 1; } .chat-row .side-row .r { margin-right: 4px; } }
.side-label { color: var(--text-2); padding: 0 12px 8px; margin: 24px 0 0; }
.side-label + div > .side-label { margin-top: 2px; }
.side .grow { flex: 1; min-height: 16px; }

.scrim { display: none; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; height: 100dvh; overflow: hidden; position: relative; }
.top { flex: none; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); }
.top .left { display: flex; align-items: center; gap: 16px; color: var(--text-2); }
.icon-btn { width: 44px; height: 44px; border-radius: var(--radius); display: grid; place-items: center; color: var(--text-2); }
.icon-btn:hover { background: var(--wash); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
.acct { display: flex; align-items: baseline; gap: 12px; color: var(--text); }
.acct span:last-child { font: 500 0.875rem/1rem var(--mono); }
.acct:hover span:last-child { text-decoration: underline; text-underline-offset: 4px; }

/* The strip along the bottom, as on a trading terminal: where the prices come from and what mode this is. */
.statusbar { background: var(--surface); border-top: 1px solid var(--line-2); order: 99; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 34px; padding: 0 16px; font: 400 0.875rem/1 var(--sans); color: var(--text-2); white-space: nowrap; overflow: hidden; }
.statusbar span { overflow: hidden; text-overflow: ellipsis; }
.statusbar .l { display: flex; gap: 24px; min-width: 0; }
.statusbar b { font-weight: 600; color: var(--text); }

.empty { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: 12vh; min-height: 0; }
.empty h1 { margin: 0 0 32px; text-align: center; font: 600 clamp(2rem, 1.4rem + 1.6vw, 2.875rem)/1.08 var(--sans); letter-spacing: -0.025em; }
/* Example views: a short list of rows to pick from, not a row of pills. */
.examples { width: min(var(--col), 100% - 32px); margin: 24px auto 0; display: grid; border-top: 1px solid var(--line-2); }
.examples button { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; padding: 12px 24px; text-align: left; font-size: 1rem; color: var(--text-2); border-bottom: 1px solid var(--line); border-radius: 0; transition: color 120ms var(--ease), background-color 120ms var(--ease); }
.examples button:hover, .examples button:focus-visible { color: var(--text); background: var(--wash); }
.foot-note { flex: none; text-align: center; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); padding: 0 16px 12px; margin: 0; }

/* The space under the last answer is the column's own, not the scroller's: a sticky row stops at the
   scroller's padding edge, so bottom padding here left a strip under a trade's stuck confirm row where
   the trade's chart and facts scrolled past, as if drawn over it (fixed 2026-11-21). */
.thread { flex: 1; overflow-y: auto; min-height: 0; padding: 12px 0 0; display: none; }
.thread .col { width: min(var(--col), 100% - 32px); margin: 0 auto; padding-bottom: 24px; }
.dock { flex: none; padding: 8px 0 12px; display: none; }
/* With a conversation open the box is one line: mode, text, send. It leaves the room to the ticket. */
.dock .composer { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.dock .composer textarea { min-height: 24px; flex: 1; order: 2; padding: 4px 4px; }
.dock .composer .row { display: contents; }
.dock .composer .mode-wrap, .dock .composer .pick-wrap { order: 1; }
.dock .composer .send { order: 3; }
body.has-thread .empty { display: none; }
body.has-thread .thread, body.has-thread .dock { display: block; }

.bubble { margin: 12px 0 24px auto; width: fit-content; max-width: 80%; background: var(--glacier); border-radius: var(--panel-radius); padding: 12px 16px; }
.status { color: var(--text-2); font: 400 0.875rem/1.25rem var(--sans); margin: 0 0 24px; }
.status span { background: linear-gradient(90deg, var(--text-3) 0%, var(--cobalt) 50%, var(--text-3) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- the ticket: a white panel with a thin line ---------- */
.ticket { margin-bottom: 32px; }
article.ticket { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); padding: 0 24px 16px; }
.ticket.arrive { animation: arrive 120ms var(--ease) both; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } }
.t-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; border-bottom: 1px solid var(--line-2); margin-bottom: 16px; }
.t-head .stand-in { margin: 0; flex: none; color: var(--text-2); }
.t-head strong { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .read { font-size: 1.125rem; line-height: 1.75rem; margin: 0 0 16px; max-width: 40em; }
.ticket .label { color: var(--text-2); margin: 0; }
.ticket .worst-note { font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); margin: 0 0 16px; max-width: none; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 48px; padding: 16px 0 0; margin: 0; }
.facts div { display: flex; align-items: baseline; gap: 12px; }
/* The picture on a trade (ui/ticket-chart.ts): the compact chart. */
.t-chart { margin: 0 0 16px; }
.t-chart .chart { margin: 0; }
.t-sparks { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.t-spark { display: flex; align-items: center; gap: 12px; }
/* The confirm row: the one risk line on the left, the buttons on the right. On a phone the line sits
   directly above the buttons. Rule 31: the risk is always in view with Confirm. */
/* It stays in view at the foot of the conversation while its ticket is on screen, so Confirm and the
   risk are never below the fold, on a phone either. */
.t-confirm { position: sticky; bottom: 0; z-index: 1; background: var(--surface); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 32px; align-items: center; margin: 16px 0 0; padding: 16px 0; border-top: 1px solid var(--line-2); }
.t-confirm > :only-child { grid-column: 1 / -1; }
.t-confirm .actions { margin: 0; justify-content: flex-end; }
.t-confirm .actions .note { margin-left: 0; flex-basis: 100%; text-align: right; }
.risk-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; font-size: 1rem; line-height: 1.5rem; }
.risk-label { color: var(--text-2); }
.risk-line b { font: 500 1.125rem/1.5rem var(--mono); margin-right: 12px; }
.t-sub { margin: 24px 0 8px; font: 600 1rem/1.5rem var(--sans); }
.t-details > .t-sub:first-child { margin-top: 0; }
.t-details .tools { margin-top: 16px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; font: 400 1rem/1.25rem var(--mono); }

table.legs { width: 100%; border-collapse: collapse; font-size: 0.875rem; line-height: 1.375rem; }
table.legs th { color: var(--text-2); text-align: right; padding: 12px 0 8px; border-bottom: 1px solid var(--line-2); border-top: 1px solid var(--line); white-space: nowrap; }
table.legs td { text-align: right; padding: 12px 0 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; font: 400 0.875rem/1.25rem var(--mono); }
table.legs th:first-child, table.legs td:first-child { text-align: left; padding-left: 0; font-family: var(--sans); }
table.legs td:first-child { font-size: 1rem; }
table.legs .venue { color: var(--text-3); margin-left: 8px; font: 400 0.875rem/1.25rem var(--sans); }
table.legs .pct { color: var(--text-3); margin-left: 8px; font: 400 0.875rem/1.25rem var(--mono); }
table.legs b { font-weight: 600; }
/* A leg's stop and take profit on a line of their own: phones only (ui/ticket.ts legsTable). */
table.legs tr.lv-row { display: none; }
table.legs .lv-row td { text-align: left; padding-top: 0; white-space: normal; }
table.legs .lv { display: inline-flex; align-items: baseline; gap: 8px; margin-right: 24px; white-space: nowrap; }
table.legs .lv .pct { margin-left: 0; }
table.legs .lv-label { font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); }
/* Long and short: a coloured word in the leg's own line. No box, no pill. */
.dir { display: inline-block; min-width: 3.25rem; margin-right: 8px; font: 600 1rem/1.25rem var(--sans); }
.dir.up { color: var(--gain); }
.dir.down { color: var(--loss); }

.key-line { font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); margin: 16px 0 0; max-width: 40em; }
details.disc { border-top: 1px solid var(--line); }
.actions + details.disc, div + details.disc { margin-top: 4px; }
details.disc + .tools { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 0; }
details.disc summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 48px; cursor: pointer; font-size: 1rem; font-weight: 600; color: var(--text); }
details.disc summary::-webkit-details-marker { display: none; }
details.disc summary span { flex: 1; }
details.disc summary svg { order: 2; width: 12px; height: 12px; color: var(--text-2); transition: transform 120ms var(--ease); }
details.disc[open] summary svg { transform: rotate(90deg); }
details.disc .body { padding: 0 0 16px; font-size: 0.875rem; line-height: 1.375rem; }
.rows { margin: 0; }
.rows div { display: flex; justify-content: space-between; gap: 24px; padding: 8px 0; border-top: 1px solid var(--line); }
.rows div:first-child { border-top: 0; }
.rows dt { color: var(--text-2); }
.rows dd { margin: 0; text-align: right; font: 400 0.875rem/1.25rem var(--mono); }
.rows .strong dt, .rows .strong dd { color: var(--text); font-weight: 600; }
.disc .note { color: var(--text-3); margin: 12px 0 0; max-width: 40em; }
.fill-leg { margin: 12px 0 4px; }
.fill-leg:first-child { margin-top: 0; }

.actions { display: flex; align-items: center; gap: 8px; margin: 24px 0 24px; flex-wrap: wrap; }
.actions .note { margin-left: auto; font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); }
.after { margin: 24px 0 24px; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.after a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.tools { display: flex; gap: 4px; margin-top: 12px; margin-left: -8px; }
.tools button { min-height: 44px; padding: 0 12px; border-radius: var(--radius); font: 600 0.875rem/1 var(--sans); color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.tools button:hover { background: var(--wash); color: var(--text); }
.sample-line { font: 400 0.875rem/1.25rem var(--sans); color: var(--text-3); margin: 12px 0 0; }

.key-line + div > .reasons { margin-top: 24px; }
/* The brush art at 5400 px for everything wider than a phone, and for sharp phone screens: the hero is
   taller than the 2700 px copy, so that one was being stretched. */
@media (min-width: 600px), (min-resolution: 1.5dppx) {
  .hero-art::before, .cta::before { background-image: url("brand/brush-2x.webp"); }
}

/* ---------- editing a ticket ---------- */
.edit { margin: 24px 0; border-top: 1px solid var(--line-2); padding-top: 4px; }
.edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 132px 96px 104px; gap: 12px; align-items: end; padding: 16px 0; border-bottom: 1px solid var(--line); }
.edit-leg { align-self: center; font-weight: 600; font-size: 1rem; }
.field { display: grid; gap: 8px; min-width: 0; }
.field > span { font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); }
.field input, .field select, .find {
  width: 100%; height: 44px; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: 400 0.875rem/1 var(--mono); padding: 0 12px; appearance: none; outline: 0;
}
.field select { padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 15px) 19px, calc(100% - 10px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.field select option { background: var(--surface); color: var(--text); }
.field input:focus-visible, .field select:focus-visible, .find:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 3px var(--wash); border-radius: var(--radius); }
.money { position: relative; display: block; }
.money i { position: absolute; left: 12px; top: 0; line-height: 2.75rem; font: 400 0.875rem/2.75rem var(--mono); color: var(--text-3); pointer-events: none; }
.money input { padding-left: 24px; }
.edit .actions { margin: 16px 0 8px; }
.edit-out .worst-note { margin: 8px 0 0; }
.edit-out .actions { margin: 12px 0 0; }

/* ---------- markets ---------- */
.find { display: block; width: min(420px, 100%); height: 48px; font: 400 1rem/1 var(--sans); margin: 0 0 24px; }
.find::placeholder { color: var(--text-3); }
table.mk .mk-name { color: var(--text-2); margin-left: 12px; font-size: 0.875rem; }
table.mk td.mk-acts { width: 1%; }
table.mk td.mk-acts .btn + .btn { margin-left: 4px; }
table.mk tr[hidden] { display: none; }
.table-wrap table.mk tr td { border-bottom: 1px solid var(--line); }
.more { margin: 24px 0 0; }
.more a { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }

/* The Markets table: one row per market, the whole row a link to that market's page. */
.page-col.wide { width: min(1080px, 100% - 32px); }
.mk-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.mk-tools .find { margin: 0; flex: 0 1 420px; min-width: 0; }
.menu-wrap { position: relative; flex: none; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 220px; padding: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); box-shadow: 0 16px 32px -20px rgb(24 36 62 / 0.45); }
.menu-check { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 8px; border-radius: var(--radius); cursor: pointer; }
.menu-check:hover { background: var(--wash); }
.menu-check input { width: 18px; height: 18px; accent-color: var(--cobalt); }
/* Filters as plain words: the chosen one is full ink with a rule under it. No pills. */
.tabs { display: flex; flex-wrap: wrap; gap: 0 24px; margin: 0 0 8px; border-bottom: 1px solid var(--line-2); }
.tab { display: inline-flex; align-items: baseline; gap: 8px; min-height: 44px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab .num { font-size: 0.875rem; color: var(--text-3); }
.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.mk-meta { display: flex; justify-content: space-between; gap: 16px; margin: 0 0 8px; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.mk-meta .num { margin-left: auto; }
table.mk thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 0; }
table.mk thead th + th { padding-left: 16px; }
.sort { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; width: 100%; min-height: 44px; font: inherit; color: inherit; }
th:first-child .sort { justify-content: flex-start; }
.sort:hover { color: var(--text); }
/* The sort mark shows at rest as two faint points; the sorted column shows one in the action colour. */
.sort-mark { width: 8px; height: 12px; background: linear-gradient(var(--text-3), var(--text-3)) center 2px / 8px 1px no-repeat, linear-gradient(var(--text-3), var(--text-3)) center 9px / 8px 1px no-repeat; opacity: 0.6; }
.sort-mark.down, .sort-mark.up { background: none; opacity: 1; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
.sort-mark.down { border-top: 6px solid var(--cobalt); }
.sort-mark.up { border-bottom: 6px solid var(--cobalt); }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--text); }
table.mk tbody tr { position: relative; }
table.mk tbody tr:hover { background: var(--wash); }
table.mk td { height: 48px; padding-top: 0; padding-bottom: 0; }
table.mk td.mk-market { display: flex; align-items: center; gap: 16px; }
table.mk td.mk-word { font-family: var(--sans); }
.mk-link { display: inline-flex; align-items: baseline; gap: 8px; width: 11rem; flex: none; }
table.mk .venue { margin-left: 0; }
.mk-link::after { content: ""; position: absolute; inset: 0; }
.mk-link:focus-visible { outline: 0; }
.mk-link:focus-visible::after { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: 4px; }
.mk-spark { display: block; width: 96px; height: 28px; flex: none; }
/* The gear that opens the column menu: a 48 px square beside the search box, drawn in ui/dom.ts. */
.mk-tools .gear { width: 48px; height: 48px; border: 1px solid var(--edge); background: var(--surface); color: var(--text); }
.mk-tools .gear:hover, .mk-tools .gear[aria-expanded="true"] { background: var(--wash); border-color: var(--text-2); }
.mk-tools .gear svg { width: 22px; height: 22px; }

/* Live market prices (lib/live.ts, ui/live-cells.ts). A changed price or 24h change flashes a tint of
   its direction's colour that fades in 600 ms; the colours come from the element's own tokens, so the
   navy band uses its own. A figure with no fresh reading for 30 seconds loses its colour and says, on
   hover, when it was last read. Only market prices: a trade's and the account's figures never move. */
@keyframes flash-up { from { background-color: color-mix(in srgb, var(--gain) 24%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gain) 24%, transparent); } }
@keyframes flash-down { from { background-color: color-mix(in srgb, var(--loss) 24%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--loss) 24%, transparent); } }
.flash-up { animation: flash-up 600ms ease-in; border-radius: 3px; }
.flash-down { animation: flash-down 600ms ease-in; border-radius: 3px; }
.stale, .stale .gain, .stale .loss, .stale.gain, .stale.loss, .tape-item .num.stale { color: var(--text-3); }
.spark { display: block; width: 100%; height: 100%; }
.spark path { fill: none; stroke: var(--text); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* ---------- one market ---------- */
.crumb { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-2); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.crumb::before { content: "\2190\00a0"; }
.mkt-head .page-title { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.mkt-name { font: 400 1.125rem/1.5rem var(--sans); letter-spacing: 0; color: var(--text-2); }
/* Figures set straight on the page: a small label over its value. No tiles. */
.stat-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 48px; margin: 16px 0 8px; padding: 16px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line); }
.stat-row div { display: grid; gap: 4px; }
.stat-row dt { font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); }
.stat-row dd { margin: 0; font: 500 1.25rem/1.75rem var(--mono); }
.mkt-head .page-title { min-height: 2.75rem; }
.mkt-below { margin-top: 16px; }

/* ---------- the chart (ui/chart.ts, research 41) ----------
   One SVG per chart: the line and its levels on the left, a price axis on the right, times along the
   bottom in UTC. The plot box has its height from the first paint, so nothing moves when prices
   arrive. Figures in the mono face, names in the text face, all 14 px. Nothing animates. */
.chart { margin: 16px 0 0; }
/* What the chart sits on, for the halo behind names and the ring round dots: the paper page, or a white panel. */
.ticket, .block { --chart-bg: var(--surface); }
.chart-read { margin: 0 0 8px; min-height: 1.5rem; font-size: 1rem; line-height: 1.5rem; }
.chart-plot { position: relative; width: 100%; height: 320px; touch-action: pan-y; cursor: crosshair; border-radius: 4px; font-size: 0.875rem; }
.chart.compact .chart-plot { height: 168px; }
.chart-plot:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.chart-svg { display: block; position: absolute; inset: 0; overflow: visible; }
.chart-svg text { font: 400 0.875rem/1 var(--mono); fill: var(--text-2); }
.chart-msg { position: absolute; inset: 0 0 32px; display: grid; place-items: center; margin: 0; padding: 0 16px; text-align: center; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.chart-msg[hidden] { display: none; }
.chart[aria-busy="true"] .chart-svg { opacity: 0.45; }
.chart-grid line { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart-grid .chart-base { stroke: var(--line-2); }
.chart-fill { fill: var(--chart-fill); stroke: none; }
.chart-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-zone.stop { fill: var(--chart-zone-loss); }
.chart-zone.tp { fill: var(--chart-zone-gain); }
.chart-level { stroke-width: 1; shape-rendering: crispEdges; }
.chart-level.entry { stroke: var(--chart-entry); stroke-dasharray: 8 4; }
.chart-level.stop { stroke: var(--chart-stop); stroke-dasharray: 4 4; }
.chart-level.tp { stroke: var(--chart-tp); stroke-dasharray: 4 4; }
.chart-level.liq { stroke: var(--chart-liq); stroke-dasharray: 2 3; stroke-width: 2; }
.chart-level.base { stroke: var(--text-3); stroke-dasharray: 1 3; }
.chart-level.stub { stroke-dasharray: none; stroke-width: 2; }
.chart-elbow { fill: none; stroke-width: 1; }
.chart-elbow.entry { stroke: var(--chart-entry); }
.chart-elbow.stop { stroke: var(--chart-stop); }
.chart-elbow.tp { stroke: var(--chart-tp); }
.chart-elbow.liq { stroke: var(--chart-liq); }
.chart-elbow.base { stroke: var(--text-3); }
.chart-svg .chart-name { font-family: var(--sans); paint-order: stroke; stroke: var(--chart-bg); stroke-width: 4px; stroke-linejoin: round; }
.chart-svg .chart-name.entry { fill: var(--chart-entry); }
.chart-svg .chart-name.stop { fill: var(--chart-stop); }
.chart-svg .chart-name.tp { fill: var(--chart-tp); }
.chart-svg .chart-name.liq { fill: var(--chart-liq); }
.chart-svg .chart-name.base { fill: var(--text-2); }
.chart-tag rect { fill: var(--chart-line); }
.chart-tag.entry rect { fill: var(--chart-entry); }
.chart-tag.stop rect { fill: var(--chart-stop); }
.chart-tag.tp rect { fill: var(--chart-tp); }
.chart-tag.liq rect { fill: var(--chart-liq); }
.chart-tag.base rect { fill: var(--text-3); }
.chart-svg .chart-tag text { font-weight: 500; fill: var(--chart-on-tag); }
.chart-arrow { fill: var(--chart-on-tag); }
.chart-lead { stroke: var(--chart-line); stroke-width: 1; }
.chart-dot { fill: var(--chart-line); stroke: var(--chart-bg); stroke-width: 2; }
.chart-svg .chart-utc { fill: var(--text-3); }
.chart-cross-x, .chart-cross-y { stroke: var(--text-2); stroke-width: 1; shape-rendering: crispEdges; }
.chart-cross-y { stroke-dasharray: 3 3; }
.chart-cross-dot { fill: var(--chart-bg); stroke: var(--chart-line); stroke-width: 2; }
.chart-cross-tag { fill: var(--chart-bg); stroke: var(--text); stroke-width: 1; }
.chart-svg .chart-cross-text { font-weight: 500; fill: var(--text); }
.chart.is-stale .chart-tag.last rect, .chart.is-stale .chart-dot { fill: var(--text-3); }
.chart-cap, .chart-none { margin: 8px 0 0; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.chart-data { margin: 8px 0 0; font-size: 0.875rem; }
.chart-data summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; cursor: pointer; }
.chart-table-wrap { max-height: 320px; overflow-y: auto; }
.chart-levels-list { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 24px; }

/* ---------- a choice under a table: take profit, reset ---------- */
.row-acts { display: inline-flex; gap: 4px; }
.row-acts .btn.text.small { margin-right: 0; }
.row-acts .btn.text.small:last-child { margin-right: -12px; }
.choice { margin: 16px 0 0; padding: 16px 24px; border: 1px solid var(--line-2); border-radius: var(--panel-radius); background: var(--surface); }
.choice p { margin: 0; font-size: 1rem; }
.choice .actions { margin: 12px 0 0; }
.choice .note { margin-top: 12px; font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); }
.choice.quiet { margin-top: 64px; padding: 0; border: 0; background: none; }
.choice.quiet > .btn { margin-left: -12px; }

/* ---------- portfolio: figures, positions, exposure, risk ---------- */
.stat-row .meter { width: 120px; }
/* A thin bar for "how much is used". The words beside it carry the figures. */
.meter { height: 4px; background: var(--glacier); border-radius: 2px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--cobalt); }
.empty-line { display: flex; align-items: center; gap: 16px; margin: 0; color: var(--text-2); }
/* Positions: one grid, a ticket's line then its positions under it. On a phone each row stacks. */
.plist { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); padding: 0 24px; }
.prow { display: grid; grid-template-columns: minmax(120px, 1.5fr) repeat(7, minmax(0, 1fr)) 132px; gap: 0 16px; align-items: center; min-height: 48px; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; }
.phead { min-height: 44px; font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); border-bottom: 1px solid var(--line-2); }
.phead span:not(:first-child) { text-align: right; }
.pgroup { background: none; }
.pgroup .take-link b { font-weight: 600; }
.pcell { text-align: right; font-size: 0.875rem; white-space: nowrap; }
.pwait { grid-column: 2 / 9; font-family: var(--sans); color: var(--text-2); }
.pname { display: inline-flex; align-items: baseline; padding-left: 16px; }
.pname:hover b { text-decoration: underline; text-underline-offset: 4px; }
.pname .dir { font-size: 0.875rem; min-width: 2.75rem; }
.pacts { display: flex; justify-content: flex-end; margin-right: -12px; }
.pacts .btn.text.small { padding: 0 8px; }
.pacts .menu { min-width: 180px; }
.menu-item { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--radius); text-align: left; }
.menu-item:hover { background: var(--wash); }
.expo { display: grid; gap: 8px; }
.expo-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: center; min-height: 32px; }
.expo-row .num { font-size: 0.875rem; color: var(--text-2); }
.expo-track { position: relative; height: 12px; background: linear-gradient(var(--line-2), var(--line-2)) center / 1px 100% no-repeat; }
.expo-short, .expo-long { position: absolute; top: 2px; height: 8px; border-radius: 2px; }
.expo-long { left: 50%; background: var(--text); }
.expo-short { right: 50%; background: var(--surface); border: 1px solid var(--text); }
.rlist { border-top: 1px solid var(--line-2); }
.rrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto; gap: 8px 24px; align-items: center; min-height: 56px; border-bottom: 1px solid var(--line); }
.ruse { display: flex; align-items: center; gap: 16px; }
.ruse .meter { flex: 1; max-width: 220px; }
.ruse .num { font-size: 1rem; white-space: nowrap; }
.stepper { display: flex; gap: 8px; }
.stepper .btn { width: 44px; padding: 0; font: 500 1.125rem/1 var(--mono); }
.stepper .btn:disabled { opacity: 0.35; cursor: default; }
.risk-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; margin: 12px 0 0; }
.risk-foot p { margin: 0; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.risk-foot .btn.text.small { margin: 0 -12px; }
/* Results (research 45): range tabs, the account value line, four figures, one row of facts. Nothing animates. */
.res-tabs { margin: 0 0 4px; }
.res-chart { margin-top: 12px; }
.res-chart .chart-plot { height: 240px; }
.res-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 32px; margin: 16px 0 0; padding: 16px 0; border-top: 1px solid var(--line-2); }
.res-figs div { display: grid; gap: 4px; align-content: start; min-width: 0; }
.res-figs dt { font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); }
.res-figs dd { margin: 0; font: 500 1.25rem/1.75rem var(--mono); }
.res-figs dd.why { font: 400 1rem/1.75rem var(--sans); color: var(--text-2); }
.res-figs .pair { display: inline-flex; flex-wrap: wrap; gap: 0 12px; }
.res-figs .sub { margin: 0; font-size: 0.875rem; line-height: 1.25rem; color: var(--text-2); }
.res-facts { padding: 0 0 16px; }
.page-col > .res-body + details.disc { margin-top: 0; }
.page-col > details.disc { margin-top: 32px; border-bottom: 1px solid var(--line); }
.page-col > details.disc .body p { margin: 0 0 8px; max-width: 66ch; color: var(--text-2); }

/* ---------- portfolio, limits, activity ---------- */
.page { flex: 1; overflow-y: auto; min-height: 0; }
.page-col { width: min(920px, 100% - 32px); margin: 0 auto; padding: 32px 0 96px; }
.page-title { font: 600 clamp(1.875rem, 1.4rem + 1.2vw, 2.5rem)/1.08 var(--sans); letter-spacing: -0.025em; margin: 0 0 12px; }
.page-note { font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); margin: 0 0 32px; max-width: 44em; }
.page-note.after-table { margin-top: 16px; }
.big { font: 500 2.75rem/3.25rem var(--mono); letter-spacing: -0.02em; margin: 0 0 8px; }
.sec-row { display: flex; align-items: baseline; justify-content: space-between; margin: 48px 0 12px; }
/* A section heading is a real heading: louder than the rows under it. */
h2.sec { font: 600 1.125rem/1.5rem var(--sans); letter-spacing: -0.01em; color: var(--text); margin: 0; }
.sec-row .btn.text.small { min-height: 44px; margin: -12px -12px -12px 0; }
.table-wrap { overflow-x: auto; }
.page .table-wrap, .take-col .table-wrap { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); padding: 8px 24px 8px; }
.table-wrap table.legs th { border-top: 0; }
.table-wrap table.legs tr:last-child td { border-bottom: 0; }
.take-link:hover b { text-decoration: underline; text-underline-offset: 4px; }
table.legs td .btn.text.small { min-height: 44px; margin: -12px -12px -12px 0; font-family: var(--sans); }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 150px; gap: 16px; align-items: center; min-height: 54px; border-top: 1px solid var(--line-2); }
.set-row:first-child, .key-row:first-child { border-top: 0; }
.set-row .num { font-size: 0.875rem; }
.set-acts { display: flex; justify-content: flex-end; margin-right: -16px; }
.key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line-2); }
.key-name { margin: 0 0 2px; font-weight: 600; }
.key-what { margin: 0; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); max-width: 40em; }
ol.log { background: var(--surface); border: 1px solid var(--line-2); list-style: none; margin: 0; padding: 8px 24px; border-radius: var(--panel-radius); font-size: 0.875rem; line-height: 1.375rem; }
.log li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log .num { font-size: 0.875rem; color: var(--text-2); }

/* ---------- landing ---------- */
.wrap { width: min(100% - 2 * clamp(1.25rem, 5vw, 5rem), 1280px); margin-inline: auto; }
.nav { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1.25rem, 5vw, 5rem); background: var(--glacier); border-bottom: 1px solid var(--rule); }
.nav .logo img { width: 130px; }
.nav .links { display: flex; align-items: center; gap: 32px; font-size: 0.875rem; }
.nav .links a.navlink:hover { text-decoration: underline; text-underline-offset: 4px; }
/* On the landing page there is no bar: the logo and links sit on the hero, over its plain top edge
   (the brush art fades out before it reaches them), and scroll away with it. */
body.landing .nav { position: absolute; top: 0; left: 0; right: 0; z-index: 30; background: none; border-bottom: 0; }

/* The price tape: Hyperliquid marks, read when the page opened. */
.tape { overflow: hidden; height: 44px; display: flex; align-items: center; font-size: 0.875rem; line-height: 1; }
.tape-run { display: flex; width: max-content; animation: tape 60s linear infinite; }
.tape:hover .tape-run, .tape:focus-within .tape-run, .tape.paused .tape-run { animation-play-state: paused; }
a.tape-item { min-height: 44px; align-items: center; }
a.tape-item:hover b { text-decoration: underline; text-underline-offset: 4px; }
.tape-pause { flex: none; align-self: stretch; padding: 0 16px; font: 600 0.875rem/1 var(--sans); color: var(--text); background: var(--navy); border-right: 1px solid var(--line); position: relative; z-index: 1; }
.tape-group { display: flex; flex: none; }
.tape-item { display: inline-flex; align-items: baseline; gap: 12px; padding: 0 24px; border-right: 1px solid var(--line); white-space: nowrap; }
.tape-item b { font: 600 0.875rem/1 var(--sans); color: var(--text); }
.tape-item .num { color: var(--text-2); }
.tape-item .gain { color: var(--gain); }
.tape-item .loss { color: var(--loss); }
@keyframes tape { to { transform: translateX(-50%); } }

/* Hero: one line, one sentence, the box. The brush is the only picture. */
.hero { position: relative; isolation: isolate; overflow: hidden; background: var(--glacier); }
.hero-art { position: absolute; z-index: -1; inset: -4% 0 -8%; }
/* The art fades in below the header, so the logo and links sit on the plain hero colour. */
.hero-art::before { content: ""; position: absolute; inset: 0; background: url("brand/brush.webp") 62% center / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent 72px, #000 168px); mask-image: linear-gradient(to bottom, transparent 72px, #000 168px); }
/* On wide screens the hero shows the whole brush as one stroke crossing it, close to the artwork's own
   size, instead of enlarging it to fill the hero: enlarged, the strokes went soft. Its edges fade into
   the hero, whose colour here is the artwork's own paper. */
@media (min-width: 1001px) {
  .hero { background: #D6EBFD; }
  /* The art's box starts under the 72 px header, so the stroke never reaches the logo or links. */
  .hero-art { inset: 72px 0 0; }
  .hero-art::before {
    inset: auto 0 auto auto; top: 53%; width: min(118%, 2100px); aspect-ratio: 3 / 1; margin-top: calc(min(118vw, 2100px) / -6);
    background-size: 100% 100%; background-position: 0 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent), linear-gradient(to right, transparent, #000 12%);
    mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent), linear-gradient(to right, transparent, #000 12%);
    -webkit-mask-composite: source-in; mask-composite: intersect;
  }
}
/* The header (72 px) sits inside the hero's top, so the copy starts below it. */
.hero-copy { padding-block: calc(72px + clamp(56px, 9vh, 104px)) clamp(56px, 9vh, 96px); }
.hero h1 { margin: 0; font-size: clamp(3.25rem, 1rem + 6.2vw, 7rem); font-weight: 500; line-height: 0.98; letter-spacing: -0.025em; }
.hero h1 span { display: block; }
.hero .sub { margin: 32px 0 0; font-size: clamp(1.0625rem, 0.8rem + 0.6vw, 1.3125rem); line-height: 1.45; max-width: 36ch; }
.hero .composer { width: min(560px, 100%); margin: 32px 0 0; }

/* The answer: a navy band. Steps on the left, a real ticket pinned on the right, over the brush drawn
   live (ui/field.ts). The canvas sits in a full-height layer and sticks to the window, so the ribbon
   stays in view while the steps scroll past. */
.answer { position: relative; isolation: isolate; }
.field-wrap { position: absolute; z-index: -1; inset: 44px 0 0; overflow: hidden; pointer-events: none; }
.field-wrap .field { position: sticky; top: 0; display: block; width: 100%; height: 100vh; }
/* The lines stay faint behind the words on the left and come up to full strength beside the ticket. */
@media (min-width: 1001px) {
  .field-wrap .field { -webkit-mask-image: linear-gradient(to right, rgb(0 0 0 / 0.34), rgb(0 0 0 / 0.34) 30%, #000 54%); mask-image: linear-gradient(to right, rgb(0 0 0 / 0.34), rgb(0 0 0 / 0.34) 30%, #000 54%); }
}
.answer .tape { border-bottom: 1px solid var(--line); }
.walk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: clamp(2rem, 6vw, 6rem); align-items: start; padding-block: clamp(3.5rem, 7vw, 6rem) clamp(4rem, 8vw, 7rem); }
.walk-copy h2 { color: var(--text); }
.chapters { list-style: none; margin: 32px 0 0; padding: 0; counter-reset: ch; max-width: 30rem; }
.chapters li { counter-increment: ch; position: relative; padding: 4px 0 4px 64px; }
.chapters li::before { content: counter(ch); position: absolute; left: 0; top: 4px; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; font: 500 0.875rem/1 var(--mono); color: var(--text-2); transition: background-color 240ms var(--ease), color 240ms var(--ease), border-color 240ms var(--ease); }
.chapters h3 { margin: 0 0 8px; font-size: clamp(1.375rem, 1rem + 0.9vw, 1.75rem); line-height: 1.2; font-weight: 500; letter-spacing: -0.02em; color: var(--text); }
.chapters p { margin: 0; max-width: 40ch; color: var(--text-2); }
.stage { min-width: 0; }
.answer-desk { min-width: 0; }
.answer-desk .ticket { margin: 0; border: 1px solid var(--line); }
.answer-desk .ticket .read { font-size: 1.125rem; line-height: 1.5rem; margin-bottom: 16px; }
.answer-desk .chart.compact .chart-plot { height: 140px; }
.answer-desk article.ticket { padding-inline: 24px; }
.answer-desk table.legs td { padding-left: 12px; }
.answer-desk table.legs td:first-child { padding-left: 0; }
/* The order type is words, so it is in the text face (a trade and the example, ui/ticket.ts legsTable); the example's last leg needs no rule under it. */
table.legs td.order-type { font-family: var(--sans); }
.ticket.example table.legs tr:last-child td { border-bottom: 0; padding-bottom: 4px; }
.answer-desk > .meta { margin: 12px 0 0; color: var(--text-2); }
.answer-desk .ticket.arrive { animation: arrive 400ms var(--ease) both; }

/* The steps are three short rows beside the example trade, so the whole band reads in one screen. */
.chapters li { border-top: 1px solid var(--line); padding: 16px 0 16px 56px; }
.chapters li:last-child { border-bottom: 1px solid var(--line); }
.chapters li + li { margin-top: 0; }
.chapters li::before { top: 16px; }

/* Below the band: Markets, its heading over its rows, then the cost in two columns. */
.landing h2 { font-size: clamp(2rem, 1rem + 2.6vw, 3.375rem); letter-spacing: -0.025em; font-weight: 500; line-height: 1.04; margin: 0; }
.markets { padding-block: clamp(4.5rem, 9vw, 8rem) 0; }
.markets h2 { margin-bottom: 32px; }
.mlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(2rem, 6vw, 6rem); min-height: 240px; border-top: 1px solid var(--navy); }
.mrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(48px, 96px) 84px 72px auto; align-items: center; column-gap: 12px; min-height: 60px; border-bottom: 1px solid var(--line); }
.mrow-acts { display: flex; justify-content: flex-end; margin-right: -12px; }
.mrow-acts .btn.text.small { padding: 0 12px; }
.mrow b { font-weight: 600; }
.mrow-name { font-size: 0.875rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow-px, .mrow-ch { text-align: right; font-size: 0.875rem; }
.mrow-px { font-size: 1rem; }
.mrow .spark { height: 28px; }
.js .mrow .spark { clip-path: inset(0 100% 0 0); transition: clip-path 1200ms var(--ease) 120ms; }
.js .mrow.in .spark { clip-path: inset(0 0 0 0); }
.markets .more { display: flex; justify-content: flex-end; align-items: baseline; gap: 16px; margin: 16px 0 0; }
.markets .more a { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }

.cost { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); column-gap: 6%; align-items: start; padding-block: clamp(4.5rem, 9vw, 8rem); }

.cost { padding-bottom: clamp(4.5rem, 9vw, 8rem); }
.plain p { margin: 0 0 16px; color: var(--text-2); max-width: 38em; }
.plain p:first-child { margin-top: 8px; }
.plain p b { color: var(--text); font-weight: 600; }

.cta { position: relative; isolation: isolate; overflow: hidden; background: var(--glacier); }
.cta::before { content: ""; position: absolute; z-index: -1; inset: 0; background: url("brand/brush.webp") 40% 60% / cover no-repeat; transform: scaleX(-1); opacity: 0.9; }
.cta .wrap { padding-block: clamp(4.5rem, 9vw, 8rem); }
.cta h2 { font-size: clamp(2.75rem, 1rem + 4.8vw, 5.5rem); font-weight: 500; letter-spacing: -0.025em; line-height: 0.98; max-width: 9em; margin-left: auto; text-align: right; }
.cta p { margin: 24px 0 32px auto; font-size: clamp(1rem, 0.8rem + 0.5vw, 1.25rem); text-align: right; }
.cta .btn { float: right; }
.footer { padding-block: 32px 64px; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.footer p { margin: 0 0 8px; max-width: 62em; }
.footer .links { display: flex; gap: 24px; margin: 24px 0 0; font-size: 0.875rem; color: var(--text); }
.footer .links a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- docs ---------- */
/* Three columns as in Whisp's docs: the side menu, an article held to under 75 characters a line, and
   "On this page". Both side columns stick, and both mark the section being read (pages/docs.ts). */
body.docs .nav, body.take .nav { height: 60px; padding: 0 24px; }
.docs-grid { display: grid; grid-template-columns: 240px minmax(0, 40rem) 208px; gap: 48px; justify-content: center; padding: 48px 24px 120px; }
.docs-nav { font-size: 1rem; line-height: 1.25rem; position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow-y: auto; }
.docs-nav p { margin: 24px 0 8px; color: var(--text-2); }
.docs-nav p:first-child { margin-top: 0; }
.docs-nav a { display: block; padding: 8px 12px; margin-left: -12px; border-radius: var(--radius); color: var(--text-2); }
.docs-nav a:hover { color: var(--text); background: var(--wash); }
.docs-nav a.on { color: var(--text); font-weight: 600; background: var(--glacier); box-shadow: inset 2px 0 0 var(--cobalt); }
.docs-main { min-width: 0; }
.docs-contents { display: none; }
.article { font-size: 1.125rem; line-height: 1.7; }
.article h1 { font: 600 clamp(2.125rem, 1.6rem + 1.4vw, 3rem)/1.08 var(--sans); letter-spacing: -0.025em; margin: 0 0 16px; }
.article .dek { font-size: 1.25rem; line-height: 1.5; color: var(--text); margin: 0 0 16px; max-width: 34em; }
.article .updated { font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); margin: 0 0 48px; padding-bottom: 32px; border-bottom: 1px solid var(--line-2); }
.article h2 { font-size: 1.5rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.02em; margin: 64px 0 16px; scroll-margin-top: 24px; }
.article p { margin: 0 0 16px; color: var(--text-2); max-width: 66ch; }
.article p b, .article li b { color: var(--text); font-weight: 600; }
.article ul { margin: 0 0 16px; padding-left: 24px; color: var(--text-2); }
.article li { margin: 8px 0; }
.article table { width: 100%; border-collapse: collapse; font-size: 1rem; line-height: 1.4; margin: 8px 0 24px; }
.article th { text-align: left; color: var(--text-2); padding: 8px 16px 8px 0; border-bottom: 1px solid var(--line-2); }
.article td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.article td:first-child { color: var(--text); }
.toc { font-size: 0.875rem; line-height: 1.375rem; position: sticky; top: 24px; align-self: start; }
.toc p { margin: 0 0 12px; color: var(--text-2); }
.toc a { display: block; padding: 8px 0 8px 16px; color: var(--text-2); box-shadow: inset 1px 0 0 var(--line-2); }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--cobalt); }

/* ---------- activity: a statement, newest first ---------- */
h2.sec.day { margin: 32px 0 8px; }
.tabs + div > h2.sec.day:first-child { margin-top: 16px; }
.log.act li { grid-template-columns: 88px 72px minmax(0, 1fr) auto; align-items: center; min-height: 48px; padding: 4px 0; }
.log.act .who { color: var(--text-2); }
.log.act .btn.text.small { margin-right: -12px; }
.take-col .t-chart { margin: 24px 0 0; }

/* ---------- a take's own page ---------- */
.take-col { width: min(var(--col), 100% - 32px); margin: 0 auto; padding: 48px 0 96px; }
.take-col .meta { color: var(--text-2); margin: 0 0 12px; }
.take-col h1 { font: 600 clamp(2.125rem, 1.6rem + 1.4vw, 3rem)/1.08 var(--sans); letter-spacing: -0.025em; margin: 0 0 12px; }
.take-col .view { font-size: 1.25rem; line-height: 1.75rem; margin: 0 0 48px; color: var(--text-2); }
.take-col .result { font: 500 4rem/4.25rem var(--mono); letter-spacing: -0.02em; margin: 8px 0 12px; }
.take-col .result-note { font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); margin: 0 0 32px; max-width: 38em; }
.take-col .actions .note { margin-left: 0; }

/* ---------- states the real product needs, from the pieces above ---------- */
[hidden] { display: none !important; }
.btn:disabled, .send:disabled { cursor: progress; opacity: 0.6; }
.notice { flex: none; width: min(var(--col), 100% - 32px); margin: 12px auto 0; padding: 12px 16px; border-radius: var(--radius); background: var(--glacier); font-size: 0.875rem; line-height: 1.375rem; color: var(--text); }
body.app:not([data-view="home"]) .notice { width: min(920px, 100% - 32px); }
.ticket .read + .worst-note { margin-top: -12px; }
.ticket .worst-note.expired { margin: 16px 0 0; }
.reason-list { margin: 0 0 16px; padding-left: 24px; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); max-width: 40em; }
.reason-list li { margin: 4px 0; }
.partial { margin: 0 0 8px; }
.partial .table-wrap { margin-bottom: 4px; }
article.ticket .table-wrap { padding: 0; border: 0; border-radius: 0; background: none; }
.log.events li { grid-template-columns: 208px minmax(0, 1fr); }
.take-col .sec-row { margin-top: 48px; }
.take-col .result-note:empty { display: none; }

/* ---------- the conversation (decision 51): prose on the page, pictures in hairline panels ---------- */
/* The model's own words sit straight on the paper page, no box; who said it is one 14 px line under the turn. */
.turn { margin: 0 0 32px; }
.prose { margin: 0; font-size: 1rem; line-height: 1.625rem; max-width: 40em; color: var(--text); }
.turn-label { margin: 12px 0 0; font: 400 0.875rem/1.25rem var(--sans); color: var(--text-2); }
.ticket .turn-label { margin-top: 16px; }
.t-head .planner { margin: 0; flex: none; color: var(--text-2); }
.blocks { display: grid; gap: 12px; margin: 16px 0 0; }
.block { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); padding: 16px; cursor: pointer; transition: border-color 120ms var(--ease); }
.block:hover { border-color: var(--edge); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.block-title { font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.block-asof { font-size: 0.875rem; color: var(--text-2); white-space: nowrap; }
.block-body .chart { margin: 8px 0 0; }
.block-body .stat-row { margin: 12px 0 0; padding: 12px 0 0; border-bottom: 0; }
.block-foot { margin: 8px 0 0; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.memory-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: -16px 0 32px; font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.turn + .memory-line, .ticket + .memory-line { margin-top: -16px; }
.key-failed { margin: 0 0 32px; color: var(--text); font-size: 1rem; line-height: 1.5rem; max-width: 40em; }
.inline-link { font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; white-space: nowrap; }

/* Choices docked above the box: full width rows with hairlines, a number key at the left. */
.ask { width: min(var(--col), 100% - 32px); margin: 0 auto 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); padding: 12px 16px 4px; }
.ask-title { margin: 0 0 4px; font-weight: 600; font-size: 1rem; line-height: 1.5rem; }
.ask-rows { display: grid; }
.ask-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 8px; margin: 0 -8px; border-top: 1px solid var(--line); border-radius: var(--radius); text-align: left; transition: background-color 120ms var(--ease); }
.ask-row:hover, .ask-row:focus-visible { background: var(--wash); }
.ask-n { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 6px; font-size: 0.875rem; color: var(--text-2); }
.ask-other .ask-n { border-color: transparent; }
.ask-text { display: grid; gap: 2px; }
.ask-label { font-size: 1rem; line-height: 1.5rem; }
.ask-other .ask-text { color: var(--text-2); }
.ask-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); margin: 0 -8px; }
.ask-unlock { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.ask-unlock input { flex: 1 1 220px; height: 44px; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; padding: 0 12px; }
.ask .worst-note { margin: 0 0 8px; font-size: 0.875rem; color: var(--text-2); }
.ask .worst-note:empty { display: none; }

/* ---------- the Model page (decision 55) ---------- */
.model { max-width: 760px; }
.model .sec-row:first-child { margin-top: 16px; }
.page-note.tight { margin: 0 0 16px; }
.model-now { padding: 16px 24px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); }
.model-now p { margin: 0; font-size: 1rem; line-height: 1.5rem; }
.model-now p + p { margin-top: 8px; }
.model-now .warn { color: var(--loss); font-size: 0.875rem; line-height: 1.375rem; }
.model-keys { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); padding: 0 24px; }
.model-key { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.model-key:first-child { border-top: 0; }
.model-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.model-row-out { grid-column: 1 / -1; }
.model-row-out:empty { display: none; }
.model-row-out > .worst-note { margin: 0; font-size: 0.875rem; line-height: 1.375rem; color: var(--text); }
.model-paste { display: grid; gap: 16px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.model-paste .actions { margin: 0; }
.model-keyline { display: flex; align-items: center; gap: 8px; }
.model-keyline input { flex: 1; }
.field .hint { font: 400 0.875rem/1.375rem var(--sans); color: var(--text-2); }
.field input[type="password"], .field input[type="text"] { font-family: var(--mono); }
.model-check p { margin: 0; font-size: 0.875rem; line-height: 1.375rem; }
.model-check .warn { margin-top: 4px; color: var(--loss); }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: 1rem; }
.check-row input { width: 18px; height: 18px; accent-color: var(--cobalt); flex: none; }
/* The on and off control: a real checkbox drawn as a switch, with its words beside it. */
.switch { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; position: relative; width: 44px; height: 24px; margin: 0; border-radius: 12px; background: var(--rule); border: 1px solid var(--edge); cursor: pointer; transition: background-color 120ms var(--ease); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(24 36 62 / 0.3); transition: transform 120ms var(--ease); }
.switch input:checked { background: var(--cobalt); border-color: var(--cobalt); }
.switch input:checked::after { transform: translateX(20px); }
.model-group { margin: 0 0 24px; padding: 8px 24px 16px; border: 1px solid var(--line-2); border-radius: var(--panel-radius); background: var(--surface); }
.model-group legend { padding: 0 8px; margin-left: -8px; font-weight: 600; font-size: 1rem; }
.model-choice { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.model-choice:first-of-type { border-top: 0; }
.model-choice input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--cobalt); flex: none; }
.model-text { display: grid; gap: 2px; min-width: 0; }
.model-text b { font-weight: 600; }
.model-sub { font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); }
.model-id { font-size: 0.875rem; line-height: 1.375rem; color: var(--text-2); overflow-wrap: anywhere; }
.model-group .check-row { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.plain-list p { margin: 0 0 12px; max-width: 44em; color: var(--text-2); }
.model-facts { margin: 0 0 12px; padding-left: 24px; max-width: 44em; }
.model-facts li { margin: 4px 0; }
.memory-list { list-style: none; margin: 0 0 16px; padding: 0 24px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--panel-radius); }
.memory-list .empty-line { min-height: 52px; }
.memory-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--line); }
.memory-row:first-child { border-top: 0; }
.memory-text { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.memory-input { margin: 0; flex: 1; width: auto; }
.memory-add { display: grid; gap: 8px; margin: 0 0 32px; }
.memory-add .find { margin: 0; width: 100%; }
.memory-add .actions { margin: 0; }
.memory-add .worst-note { margin: 0; font-size: 0.875rem; color: var(--text); }

/* ---------- smaller screens ---------- */
@media (max-width: 1200px) {
  .docs-grid { grid-template-columns: 220px minmax(0, 40rem); gap: 48px; }
  .toc { display: none; }
}
@media (max-width: 1000px) {
  .walk, .cost, .mlist { grid-template-columns: minmax(0, 1fr); row-gap: 32px; }
  .mlist { row-gap: 0; }
  .walk { row-gap: 48px; }
  .answer-desk { max-width: 560px; }
}
@media (max-width: 760px) {
  .chart.full .chart-plot { height: 264px; }
  body.app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 20; transform: translateX(-100%); transition: transform 240ms var(--ease); }
  body.side-open .side { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgb(24 36 62 / 0.45); z-index: 10; }
  body.side-open .scrim { display: block; }
  .menu-btn { display: grid; }
  .top { padding: 0 12px; }
  .top .left { gap: 8px; }
  .acct .dim { display: none; }
  .top .btn.small { padding: 0 12px; }
  .side-row { height: 44px; }
  .statusbar .r { display: none; }
  .empty { justify-content: flex-end; padding-bottom: 8px; }
  .empty h1 { margin-bottom: auto; margin-top: 22vh; }
  .examples { margin: 0 auto 12px; order: 1; }
  .empty .composer { order: 2; }
  /* With the model menu beside Practice, the docked box puts the text on its own line on a phone. */
  .dock .composer { flex-wrap: wrap; row-gap: 0; }
  .dock .composer textarea { order: 0; flex-basis: 100%; padding: 6px 4px; }
  .dock .composer .send { margin-left: auto; }
  /* Practice, the model and Send share one line at 390 px: the name gives way first. */
  .pick .pick-name { max-width: 8.5rem; }
  article.ticket { padding: 0 16px 16px; }
  .t-confirm { grid-template-columns: minmax(0, 1fr); }
  .t-confirm .actions { justify-content: flex-start; }
  .t-confirm .actions .note { text-align: left; }
  .t-head { flex-wrap: wrap; padding: 12px 0; gap: 0 16px; }
  table.legs .venue, table.legs .pct { display: block; margin-left: 0; }
  table.legs .lv-col { display: none; }
  table.legs tr.lv-row { display: table-row; }
  table.legs tr.has-lv td { border-bottom: 0; padding-bottom: 8px; }
  table.legs .lv .pct { display: inline; }
  .thread article.ticket table.legs .dir { min-width: 0; }
  table.legs td { padding-left: 12px; }
  .actions .note { margin-left: 0; width: 100%; order: 3; }
  .page .table-wrap, .take-col .table-wrap, ol.log { padding-inline: 16px; }
  /* A trade's page: the fees row's long label wraps, so the Result column fits a phone instead of scrolling out of view. */
  .take-col table.legs td:first-child { white-space: normal; }
  .set-row { grid-template-columns: minmax(0, 1fr) auto; }
  .edit-row { grid-template-columns: 1fr 1fr 1fr; }
  .edit-leg { grid-column: 1 / -1; }
  .log.act li { grid-template-columns: 80px minmax(0, 1fr); gap: 0 12px; padding: 8px 0; }
  .log.act li > :nth-child(3), .log.act li > :nth-child(4) { grid-column: 1 / -1; }
  .log.act li > span:empty { display: none; }
  .plist { padding: 0 16px; }
  .phead { display: none; }
  .prow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 16px; padding: 12px 0; }
  .prow > span:empty { display: none; }
  .pname { padding-left: 0; grid-column: 1 / -1; }
  .pgroup .take-link { grid-column: 1 / -1; }
  .pcell { text-align: left; white-space: normal; }
  .pcell::before { content: attr(data-label) "  "; font-family: var(--sans); color: var(--text-2); }
  .pwait { grid-column: 1 / -1; }
  .pacts { grid-column: 1 / -1; justify-content: flex-start; margin: 0 0 0 -8px; }
  .expo-sec { display: none; }
  .rrow { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 0; }
  .rrow .rname { grid-column: 1 / -1; }
  .res-chart .chart-plot { height: 200px; }
  .res-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .res-facts { gap: 4px 24px; }
  .stat-row .meter { width: 96px; }
  .mk-spark { width: 56px; }
  /* The table scrolls sideways inside its box; the market column stays put, so a row's name is always in view. */
  .page .table-wrap.mk-wrap { padding-inline: 0; }
  table.mk th:first-child, table.mk td:first-child { padding-left: 16px; }
  table.mk th:last-child, table.mk td:last-child { padding-right: 16px; }
  table.mk td.mk-market { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  table.mk thead th:first-child { left: 0; z-index: 3; }
  table.mk tbody tr:hover td.mk-market { background: linear-gradient(var(--wash), var(--wash)) var(--surface); }
  table.mk thead th + th { padding-left: 12px; }
  .mk-link { flex-direction: column; gap: 0; width: 5.25rem; }
  table.mk td.mk-market { gap: 8px; }
  table.mk td { height: 56px; }
  table.mk .sort-mark { display: none; }
  table.mk th .sort { min-width: 0; }
  .stat-row { gap: 16px 32px; }
  table.mk td { padding-left: 12px; }
  table.mk td:first-child { white-space: normal; }
  /* On a phone the two sides stack, each its own 36 px target, instead of two words touching. */
  table.mk td.mk-acts { padding-left: 4px; }
  table.mk td.mk-acts .btn.text.small { display: flex; justify-content: flex-end; min-height: 44px; padding: 0; margin: 0; }
  table.mk td.mk-acts .btn + .btn { margin-left: 0; }
  .row-acts { flex-direction: column; align-items: flex-end; gap: 0; }
  .row-acts .btn.text.small, .row-acts .btn.text.small:last-child { margin: 0 -12px 0 0; }
  .set-acts { grid-column: 1 / -1; justify-content: flex-start; margin: -8px 0 8px -16px; }
  .key-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .key-row .btn { justify-self: start; }
  .big { font-size: 2.125rem; line-height: 2.625rem; }
  .nav { height: 60px; }
  .hero-copy { padding-block: calc(60px + 48px) 48px; }
  .hero-art::before { background-position: 78% center; opacity: 0.38; }
  .hero .sub { margin-top: 16px; }
  .hero .composer { margin-top: 24px; }
  .field-wrap { opacity: 0.6; }
  .mrow { grid-template-columns: 56px minmax(0, 1fr) 68px auto; column-gap: 8px; min-height: 56px; }
  .mrow .spark, .mrow .mrow-name, .mrow .mrow-name + span:not(.num) { display: none; }
  .mrow-acts .btn.text.small { padding: 0 8px; }
  .markets .more { flex-direction: column-reverse; gap: 12px; }
  .chapters li { padding-left: 48px; }
  .cta h2, .cta p { text-align: left; margin-left: 0; }
  .cta .btn { float: none; }
  .nav .logo img { width: 103px; }
  .nav .links { gap: 16px; }
  .nav .links .hide-s { display: none; }
  .docs-grid { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 72px; }
  .docs-nav { display: none; }
  /* Phones get the section list as a Contents menu at the top, instead of no navigation at all. */
  .docs-contents { display: block; position: sticky; top: 0; z-index: 5; margin: 0 -16px 24px; padding: 0 16px; background: var(--page); border-bottom: 1px solid var(--line-2); }
  .docs-contents summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 48px; font-weight: 600; cursor: pointer; }
  .docs-contents summary::-webkit-details-marker { display: none; }
  .docs-contents summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg) translateY(-3px); transition: transform 120ms var(--ease); }
  .docs-contents[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
  .docs-contents nav { display: grid; padding: 0 0 12px; }
  .docs-contents a { display: flex; align-items: center; min-height: 44px; color: var(--text-2); border-top: 1px solid var(--line); }
  .article h2 { scroll-margin-top: 64px; }
  .take-col .result { font-size: 2.875rem; line-height: 3.25rem; }
  .log.events li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .model-now, .model-keys, .model-group, .memory-list { padding-inline: 16px; }
  .model-key { grid-template-columns: minmax(0, 1fr); }
  .model-acts { justify-content: flex-start; }
  .memory-row { flex-wrap: wrap; }
  .ask { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .status span { color: var(--text-2); background: none; }
  .tape { overflow-x: auto; }
  .tape-group[aria-hidden] { display: none; }
  .js .mrow .spark { clip-path: none; }
}
