/* Fonts are served by the game itself (1.45): no request to Google, no IP sent elsewhere.
   Heebo and JetBrains Mono, SIL Open Font License 1.1 (public/fonts/OFL-*.txt), from Fontsource 5.3.0. */
@font-face { font-family: 'Heebo'; font-style: normal; font-display: swap; font-weight: 400; src: url('fonts/heebo-hebrew-400-normal.woff2') format('woff2'); unicode-range: U+0307-0308,U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-style: normal; font-display: swap; font-weight: 400; src: url('fonts/heebo-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Heebo'; font-style: normal; font-display: swap; font-weight: 500; src: url('fonts/heebo-hebrew-500-normal.woff2') format('woff2'); unicode-range: U+0307-0308,U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-style: normal; font-display: swap; font-weight: 500; src: url('fonts/heebo-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Heebo'; font-style: normal; font-display: swap; font-weight: 700; src: url('fonts/heebo-hebrew-700-normal.woff2') format('woff2'); unicode-range: U+0307-0308,U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-style: normal; font-display: swap; font-weight: 700; src: url('fonts/heebo-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url('fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 600; src: url('fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* Whisper Number terminal (GDD 24.1): dark, dense, monospaced numbers, colour only for meaning. */
:root {
  --bg: #07090c; --pn: #0d1015; --pn2: #12161c; --line: #1f252e; --text: #d6d9df; --muted: #7c828d;
  --amber: #ffb000; --green: #3fcf8e; --red: #ff5f56; --cyan: #5ccfe6; --flash-up: rgba(63, 207, 142, .22); --flash-dn: rgba(255, 95, 86, .22);
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: "Heebo", system-ui, "Segoe UI", sans-serif;
  --row: 20px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); overflow: hidden; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num, .mono, .tk { font-family: var(--mono); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.tk { color: var(--cyan); font-weight: 600; cursor: pointer; }
.up { color: var(--green); } .dn { color: var(--red); } .muted { color: var(--muted); } .amber { color: var(--amber); }
.flash-up { animation: fu 300ms linear; } .flash-dn { animation: fd 300ms linear; }
/* Tick colour of the last price in the watchlist (1.29): the direction of its last move. */
#pn-watch td.tick-up { color: var(--green); } #pn-watch td.tick-dn { color: var(--red); }
@keyframes fu { from { background: var(--flash-up); } to { background: transparent; } }
@keyframes fd { from { background: var(--flash-dn); } to { background: transparent; } }

/* --- screens (login, lobby) --- */
.screen { height: 100%; display: grid; place-items: center; padding: 16px; overflow: auto; }
.card { width: min(420px, 100%); background: var(--pn); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.card.wide { width: min(620px, 100%); }
.brand { font: 600 20px var(--mono); color: var(--amber); letter-spacing: .12em; margin-bottom: 6px; direction: ltr; text-align: start; }
.tagline, .hello { color: var(--muted); margin: 0 0 18px; }
.card h2 { font-size: 14px; color: var(--amber); margin: 20px 0 10px; font-weight: 600; }
.card label { display: block; color: var(--muted); margin: 10px 0 4px; }
.card input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; }
.card input:focus { outline: 1px solid var(--cyan); }
.row { display: flex; gap: 8px; margin: 12px 0; }
.lang-btn { flex: 1; background: var(--pn2); border: 1px solid var(--line); border-radius: 6px; padding: 7px; cursor: pointer; }
.lang-btn.on { border-color: var(--amber); color: var(--amber); }
.primary { width: 100%; background: var(--amber); color: #111; border: 0; border-radius: 6px; padding: 10px; font-weight: 700; cursor: pointer; margin-top: 8px; }
.primary:disabled { opacity: .5; cursor: wait; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; margin-top: 14px; padding: 0; text-decoration: underline; }
.err { color: var(--red); min-height: 1.4em; margin: 8px 0 0; }
.fine { color: var(--muted); font-size: 12px; margin: 16px 0 0; }
.install { margin: 10px 0 0; }
.install .link { color: var(--amber); padding: 0; }
.install .muted { margin: 6px 0 0; font-size: 12.5px; }
.offline-card .guide { max-height: 55vh; overflow: auto; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode { text-align: start; background: var(--pn2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; cursor: pointer; }
.mode:hover { border-color: var(--amber); }
.mode b { display: block; color: var(--amber); margin-bottom: 4px; }
.mode span { color: var(--muted); font-size: 12.5px; }
.adv { margin-top: 12px; color: var(--muted); }
.adv input { width: 160px; margin-top: 6px; }
@media (max-width: 520px) { .modes { grid-template-columns: 1fr; } }

/* --- terminal layout (GDD 24.4) --- */
#term { display: grid; grid-template-rows: auto 1fr auto auto; height: 100%; }
.status { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; background: #11151b; border-bottom: 1px solid var(--line); padding: 6px 12px; font-family: var(--mono); white-space: nowrap; direction: ltr; }
.status .lbl { color: var(--amber); margin-inline-end: 6px; }
.status .tag { background: #123826; color: var(--green); padding: 0 6px; border-radius: 3px; font-weight: 600; }
.status .tag.CORRECTION { background: #3a2e0c; color: var(--amber); } .status .tag.BEAR, .status .tag.SHOCK { background: #3b1513; color: var(--red); }
.status .tag.NEUTRAL { background: #1b2129; color: var(--text); }
.status .grow { flex: 1; }
.status .conn { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.status .conn.off { background: var(--red); }
.status button { background: var(--pn2); border: 1px solid var(--line); border-radius: 4px; padding: 0 8px; cursor: pointer; }
.grid { display: grid; grid-template-columns: minmax(220px, .9fr) 6px minmax(220px, 1.55fr) 6px minmax(220px, 1.15fr); grid-template-rows: minmax(0, 1fr); padding: 6px; min-height: 0; }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pn { position: relative; background: var(--pn); border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
/* Layout (1.23): dividers, minimise, maximise. */
.split-v, .split-h { background: transparent; border-radius: 3px; transition: background .15s; touch-action: none; }
.split-v { cursor: col-resize; }
.split-h { cursor: row-resize; height: 6px; flex: none; }
.split-v:hover, .split-h:hover, body.dragging .split-v:active, body.dragging .split-h:active { background: rgba(255, 176, 0, .35); }
.split-h.off { visibility: hidden; }
body.dragging { user-select: none; }
.pn-ctl { position: absolute; top: 3px; right: 4px; display: flex; gap: 2px; z-index: 2; }
.pn-ctl button { background: var(--pn); border: 1px solid transparent; border-radius: 3px; color: var(--muted); font: 11px var(--mono); line-height: 1; padding: 2px 5px; cursor: pointer; opacity: .55; }
.pn:hover .pn-ctl button { opacity: 1; }
.pn-ctl button:hover { color: var(--amber); border-color: var(--line); }
.pn > h5 { padding-right: 50px !important; } /* titles are left-to-right; the buttons sit on the right */
.pn.min > :not(h5):not(.pn-ctl) { display: none !important; }
.pn.min > h5 { border-bottom: 0; cursor: pointer; }
.grid.maxed { grid-template-columns: minmax(0, 1fr) !important; }
.grid.maxed > .split-v, .grid.maxed .split-h { display: none; }
.grid.maxed > .col:not(:has(.pn.maxed)) { display: none; }
.grid.maxed .col > .pn:not(.maxed) { display: none; }
.grid.maxed .pn.maxed { flex: 1 1 0 !important; }
.pn > h5 { margin: 0; padding: 5px 8px; font: 600 11px var(--mono); color: var(--amber); letter-spacing: .06em; display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); direction: ltr; }
.pn > h5 .k { color: var(--muted); font-weight: 400; }
.pn .body { overflow: auto; padding: 4px 8px 8px; flex: 1; min-height: 0; contain: layout paint; } /* a change inside one panel does not lay out the others (1.29) */
.tabs { display: none; }

table.t { width: 100%; border-collapse: collapse; direction: ltr; }
table.t th, table.t td { height: var(--row); padding: 0 6px; text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.t th { color: var(--muted); font-weight: 400; font-size: 11px; position: sticky; top: 0; background: var(--pn); text-align: right; cursor: default; }
table.t th.sort { cursor: pointer; }
table.t th.sort.on { color: var(--amber); }
table.t th .arrow { font-size: 9px; }
table.t td:first-child, table.t th:first-child { text-align: left; }
table.t tr.sel td { background: #17202a; }
table.t tbody tr:hover td { background: #121a22; cursor: pointer; }
table.t td.txt { font-family: var(--sans); white-space: normal; }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 14px; direction: ltr; font-family: var(--mono); }
.kv div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #1a2029; height: var(--row); align-items: center; }
.kv b { color: var(--muted); font-weight: 400; }
.quote-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; direction: ltr; padding: 4px 0; }
.quote-head .big { font: 600 22px var(--mono); }
.quote-head .name { font-family: var(--sans); color: var(--muted); }
.bidask { display: flex; gap: 14px; direction: ltr; font-family: var(--mono); color: var(--muted); }
.hook { color: var(--muted); margin: 4px 0; unicode-bidi: plaintext; }
.chart { width: 100%; height: 150px; display: block; }
.actions { display: flex; gap: 6px; margin: 6px 0; direction: ltr; }
.actions button { background: var(--pn2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 12px; cursor: pointer; font-family: var(--mono); }
.actions button.buy { border-color: #1f5a3f; color: var(--green); } .actions button.sell { border-color: #5a2320; color: var(--red); }
.actions button:hover { background: #1a2029; }
.actions button.primary { background: var(--amber); color: #111; border-color: var(--amber); font-weight: 700; width: auto; margin: 0; }
.actions button.primary:hover { background: #ffc233; }

/* WHY (GDD 9.2) */
.why-head { display: flex; justify-content: space-between; align-items: baseline; direction: ltr; gap: 8px; flex-wrap: wrap; }
.why-head .big { font: 600 20px var(--mono); }
.why-narr { margin: 6px 0 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 130px) 1fr 58px; gap: 8px; align-items: center; height: 22px; }
.bar-row .lab { text-align: end; }
.bar-track { height: 10px; background: #151a21; border-radius: 5px; position: relative; overflow: hidden; direction: ltr; }
.bar-track::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: #3a4450; }
.bar-track i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.bar-track i.p { background: var(--green); left: 50%; } .bar-track i.n { background: var(--red); right: 50%; }
.bar-v { font-family: var(--mono); direction: ltr; text-align: left; }
.why-basis { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--muted); }
.ranges { display: flex; gap: 4px; }
.ranges button { background: none; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); padding: 0 6px; cursor: pointer; font: 11px var(--mono); }
.ranges button.on { color: var(--amber); border-color: var(--amber); }

/* news & chat-like lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 3px 0; border-bottom: 1px solid #151a21; }
.list li .d { font: 11px var(--mono); color: var(--muted); margin-inline-end: 6px; }
.list li.material { border-inline-start: 2px solid var(--amber); padding-inline-start: 6px; }
.list li.major { border-inline-start: 2px solid var(--red); padding-inline-start: 6px; }
.list li.mine { background: rgba(92, 207, 230, .16); box-shadow: inset 0 0 0 1px rgba(92, 207, 230, .35); border-radius: 3px; padding-inline: 6px; margin: 2px 0; }
.list li.mine > span[dir] { color: #e6f6fa; }
.list li .pos-tag { font: 600 10px var(--mono); color: var(--bg); background: var(--cyan); border-radius: 3px; padding: 0 4px; margin-inline-end: 6px; }
.list li.fresh { animation: newsFresh 2.4s ease-out; }
@keyframes newsFresh { 0% { background: rgba(92, 207, 230, .45); } 100% { background: rgba(92, 207, 230, .16); } }
@media (prefers-reduced-motion: reduce) { .list li.fresh { animation: none; } }
.pf-sum { display: flex; flex-wrap: wrap; gap: 4px 16px; direction: ltr; font-family: var(--mono); margin: 2px 0 6px; }
.pf-sum b { color: var(--muted); font-weight: 400; margin-inline-end: 4px; }
.x { background: none; border: 0; color: var(--red); cursor: pointer; padding: 0 4px; }
.empty { color: var(--muted); padding: 10px 0; }
.help code { color: var(--cyan); font-family: var(--mono); }
.help td.txt { color: var(--text); }

/* command line (GDD 24.3, 25.4) */
.cmd { background: #11151b; border-top: 1px solid var(--line); padding: 4px 12px 6px; min-width: 0; overflow: hidden; }
.cmdrow { display: flex; align-items: center; gap: 8px; direction: ltr; }
.prompt { color: var(--amber); font-family: var(--mono); }
#cmd { flex: 1; background: transparent; border: 0; outline: 0; color: var(--amber); font: 14px var(--mono); padding: 4px 0; }
.go { color: var(--muted); font: 11px var(--mono); }
.shadow { color: var(--muted); opacity: .6; font: 12px var(--mono); direction: ltr; min-height: 16px; }
/* Bottom row (1.15): market tape by default, command line while typing. */
#foot:not(.typing) .cmdrow { display: none; }
#foot.typing .taperow { display: none; }
.taperow { display: flex; align-items: center; gap: 8px; direction: ltr; height: 22px; min-width: 0; overflow: hidden; }
.open-cmd { flex: none; background: var(--pn2); border: 1px solid var(--line); border-radius: 4px; color: var(--amber); font: 600 11px var(--mono); padding: 1px 7px; cursor: pointer; }
.open-cmd:hover { border-color: var(--amber); }
.tape { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; position: relative; }
/* Edge fades as static overlays: a mask over moving content is repainted every frame (1.29). */
.tape::before, .tape::after { content: ''; position: absolute; top: 0; bottom: 0; width: 24px; z-index: 1; pointer-events: none; }
.tape::before { left: 0; background: linear-gradient(90deg, #11151b, transparent); }
.tape::after { right: 0; background: linear-gradient(270deg, #11151b, transparent); }
.tape-track { display: inline-flex; will-change: transform; }
.tape-run { display: inline-flex; align-items: center; }
.tape .ti { font: 12px var(--mono); padding: 0 2px; }
.tape .ti b { color: var(--amber); font-weight: 500; }
.tape .ti[data-tk] { cursor: pointer; }
.tape .ti[data-tk]:hover b { text-decoration: underline; }
.tape .ti.news b { color: var(--muted); }
.tape .ti.news bdi { font-family: var(--sans); font-size: 12.5px; }
.tape .sep { color: #3a4450; padding: 0 10px; }
.confirm { background: #1a1608; border: 1px solid #4a3b10; border-radius: 4px; padding: 4px 8px; margin-bottom: 4px; direction: ltr; font-family: var(--mono); }
.confirm .h { color: var(--muted); margin-inline-start: 12px; }
.toasts { position: fixed; inset-inline-end: 12px; bottom: 90px; display: flex; flex-direction: column; gap: 6px; z-index: 5; max-width: min(420px, 90vw); }
.toast { background: var(--pn2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.toast.bad { border-color: #5a2320; } .toast.good { border-color: #1f5a3f; }

/* reveal */
dialog#reveal { background: var(--pn); color: var(--text); border: 1px solid var(--amber); border-radius: 10px; padding: 22px; width: min(820px, 95vw); max-height: 90vh; overflow: auto; }
dialog#reveal::backdrop { background: rgba(0, 0, 0, .7); }
dialog#reveal h2 { color: var(--amber); font: 600 16px var(--mono); margin: 0 0 12px; }
dialog#reveal h3 { color: var(--amber); font-size: 13px; margin: 16px 0 6px; }
dialog#reveal tr.me td { color: var(--amber); }

/* single-panel mode below 1440px (GDD 24.4) */
@media (max-width: 1439px) {
  .grid { grid-template-columns: 1fr !important; grid-template-rows: 1fr; }
  .grid .col { display: contents; }
  .grid .split-v, .grid .split-h, .grid .pn-ctl { display: none !important; }
  .grid .pn { display: none; flex: 1 1 0 !important; }
  .pn > h5 { padding-right: 8px !important; }
  .pn.min > :not(h5):not(.pn-ctl) { display: revert !important; }
  .grid .pn.active { display: flex; }
  .tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; background: #11151b; border-top: 1px solid var(--line); padding: 3px 4px; }
  .tabs button { position: relative; background: none; border: 0; border-top: 2px solid transparent; color: var(--muted); padding: 8px 2px 7px; cursor: pointer; font: 600 12px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tabs button.on { color: var(--amber); border-top-color: var(--amber); background: rgba(255, 176, 0, .07); }
  .tabs button .dot { display: none; position: absolute; top: 5px; inset-inline-end: 18%; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
  .tabs button.has .dot { display: block; }
  .tabs button.mine .dot { background: var(--cyan); box-shadow: 0 0 0 2px rgba(92, 207, 230, .25); }
}
@media (max-width: 600px) {
  .status { font-size: 11px; gap: 2px 10px; } body { font-size: 12.5px; }
  /* Phone: the top bar keeps what you check every few seconds; MFX, the rate and the next event are on the tape and in ECO. */
  .status [data-f="xMfx"], .status [data-f="xRate"], .status [data-x="next"], .status [data-f="day"], .status [data-f="pace"] { display: none; }
}
.gap-top { margin-top: 8px; }
.ranges.bar { margin: 4px 0 6px; flex-wrap: wrap; }
.muted.cap { margin: 0 0 4px; }
.pn .body h5.sub { margin: 10px 0 4px; padding: 0; border: 0; font: 600 11px var(--mono); color: var(--amber); letter-spacing: .06em; direction: ltr; text-align: left; }

/* Running text follows the interface language (GDD 24.7); numeric panels stay LTR. */
html[dir="rtl"] .why-narr, html[dir="rtl"] .why-basis, html[dir="rtl"] .list li, html[dir="rtl"] .empty, html[dir="rtl"] .toast, html[dir="rtl"] table.t td.txt, html[dir="rtl"] .muted.cap { direction: rtl; text-align: right; }
html[dir="ltr"] .why-narr, html[dir="ltr"] .why-basis, html[dir="ltr"] .list li, html[dir="ltr"] .empty, html[dir="ltr"] .toast, html[dir="ltr"] table.t td.txt, html[dir="ltr"] .muted.cap { direction: ltr; text-align: left; }
.pf-sum b, .pf-sum span, .kv b, .kv span { unicode-bidi: isolate; }
.pf-sum > span { display: inline-flex; gap: 4px; }
/* Player guide (GDD 37) */
dialog#guideDlg { background: var(--pn); color: var(--text); border: 1px solid var(--amber); border-radius: 10px; padding: 22px; width: min(760px, 95vw); max-height: 88vh; overflow: auto; }
dialog#guideDlg::backdrop { background: rgba(0, 0, 0, .7); }
dialog#guideDlg h2 { color: var(--amber); font: 600 16px var(--mono); margin: 0 0 10px; }
.guide { line-height: 1.6; }
.guide-intro { color: var(--text); margin: 0 0 10px; }
.guide h4 { color: var(--amber); font-size: 13px; margin: 14px 0 4px; }
.guide ul { margin: 0; padding-inline-start: 20px; }
.guide li { margin: 3px 0; }
.guide-link { display: block; color: var(--cyan); }
#fbLobby { display: block; }
/* View tabs in the main panel header, speed selector, game clock, player tags (1.5) */
.vtabs, .speeds { display: inline-flex; gap: 3px; }
.vtabs button, .speeds button { background: none; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); padding: 0 6px; cursor: pointer; font: 11px var(--mono); }
.vtabs button:hover, .speeds button:hover { color: var(--text); border-color: #3a4450; }
.vtabs button.on, .speeds button.on { color: var(--amber); border-color: var(--amber); }
.status .speeds button { padding: 0 6px; }
.status .clock { display: inline-flex; align-items: center; gap: 6px; }
.status .prog { width: 70px; height: 5px; background: #1b2129; border-radius: 3px; overflow: hidden; display: inline-block; }
.status .prog i { display: block; height: 100%; width: 0; background: var(--amber); }
.bot { font: 10px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.you { font: 10px var(--sans); color: var(--amber); border: 1px solid var(--amber); border-radius: 3px; padding: 0 4px; }
.hook b { color: var(--muted); font-weight: 500; }
.hook .tk { cursor: pointer; }

/* Hover explanations and explain mode (GDD 25.4) */
#tip { position: fixed; z-index: 60; max-width: 340px; background: #1a2029; color: var(--text); border: 1px solid var(--amber);
  border-radius: 6px; padding: 8px 10px; font: 12.5px/1.5 var(--sans); white-space: pre-line; pointer-events: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .55); }
#tip[hidden] { display: none; }
#explainBanner { position: fixed; z-index: 55; top: 0; inset-inline: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px);
  background: var(--amber); color: #111; font-weight: 600; padding: 5px 14px; border-radius: 0 0 8px 8px; cursor: pointer; text-align: center; }
#explainBanner[hidden] { display: none; }
body.explain [data-x] { outline: 1px dashed rgba(255, 176, 0, .65); outline-offset: 1px; cursor: help; }
body.explain [data-x]:hover { outline-style: solid; background: rgba(255, 176, 0, .08); }
#status [data-act="explain"].on { background: var(--amber); color: #111; }

/* Guided first game (D54) */
.mode.tut { grid-column: 1 / -1; }
.mode.rec { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
#coach { position: fixed; z-index: 50; inset-inline-start: 16px; bottom: 92px; width: min(430px, calc(100% - 32px));
  background: var(--pn2); border: 1px solid var(--amber); border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6); font-size: 13.5px; line-height: 1.55; }
#coach[hidden] { display: none; }
#coach .coach-head { display: flex; justify-content: space-between; font: 600 12px var(--mono); letter-spacing: .08em; margin-bottom: 6px; }
#coach .coach-body code, #coach .coach-body kbd { font: 12.5px var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; direction: ltr; unicode-bidi: isolate; color: var(--amber); }
#coach .coach-body ul { margin: 6px 0; padding-inline-start: 18px; }
#coach .coach-btns { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
#coach .coach-btns .primary { width: auto; margin: 0; padding: 7px 16px; }
#coach .coach-btns button:not(.primary):not(.link) { background: var(--pn); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; cursor: pointer; }
#coach .coach-btns .link { margin: 0; }
#coach .coach-wait { font-size: 12px; }
.coach-hl { outline: 2px solid var(--amber) !important; outline-offset: 2px; animation: coachPulse 1.4s ease-in-out infinite; }
@keyframes coachPulse { 50% { outline-color: rgba(255, 176, 0, .25); } }
@media (prefers-reduced-motion: reduce) { .coach-hl { animation: none; } }
@media (max-width: 700px) { #coach { bottom: 120px; font-size: 13px; } }

/* Leaving the game (EXIT) */
dialog#exitDlg { background: var(--pn); color: var(--text); border: 1px solid var(--amber); border-radius: 10px; padding: 22px; width: min(460px, 92vw); }
dialog#exitDlg::backdrop { background: rgba(0, 0, 0, .7); }
dialog#exitDlg h2 { color: var(--amber); font: 600 16px var(--mono); margin: 0 0 14px; }
dialog#exitDlg .exit-opt { display: block; width: 100%; text-align: start; background: var(--pn2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; color: var(--text); }
dialog#exitDlg .exit-opt:hover, dialog#exitDlg .exit-opt:focus-visible { border-color: var(--amber); }
dialog#exitDlg .exit-opt.danger:hover, dialog#exitDlg .exit-opt.danger:focus-visible { border-color: var(--red); }
dialog#exitDlg .exit-opt b { display: block; color: var(--amber); margin-bottom: 3px; }
dialog#exitDlg .exit-opt.danger b { color: var(--red); }
dialog#exitDlg .exit-opt span { color: var(--muted); font-size: 12.5px; }
dialog#exitDlg .actions { display: flex; justify-content: flex-end; }
dialog#exitDlg .actions button { background: var(--pn2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 14px; cursor: pointer; }

/* Tester feedback (D56) */
dialog#fbDlg { background: var(--pn); color: var(--text); border: 1px solid var(--amber); border-radius: 10px; padding: 20px 22px; width: min(520px, 94vw); max-height: 92vh; overflow: auto; }
dialog#fbDlg::backdrop { background: rgba(0, 0, 0, .7); }
dialog#fbDlg h2 { color: var(--amber); font: 600 16px var(--mono); margin: 0 0 6px; }
dialog#fbDlg fieldset { border: 0; padding: 0; margin: 14px 0 0; }
dialog#fbDlg legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
dialog#fbDlg .req { color: var(--amber); }
dialog#fbDlg .seg { display: flex; gap: 6px; flex-wrap: wrap; }
dialog#fbDlg .seg label { flex: 1; min-width: 44px; }
dialog#fbDlg .seg input { position: absolute; opacity: 0; pointer-events: none; }
dialog#fbDlg .seg span { display: block; text-align: center; padding: 8px 6px; background: var(--pn2); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
dialog#fbDlg .seg input:checked + span { border-color: var(--amber); color: var(--amber); background: rgba(255, 176, 0, .08); }
dialog#fbDlg .seg input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 1px; }
dialog#fbDlg .scale-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
dialog#fbDlg label { display: block; margin-top: 12px; }
dialog#fbDlg textarea { display: block; width: 100%; margin-top: 4px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: inherit; resize: vertical; }
dialog#fbDlg .actions { display: flex; gap: 10px; margin-top: 14px; }
dialog#fbDlg .actions .primary { width: auto; margin: 0; padding: 8px 18px; }
dialog#fbDlg .actions button:not(.primary) { background: var(--pn2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; cursor: pointer; }
.link.inline { margin: 0; font-size: inherit; }

/* Chart mode: line or candles (GDD 26.2) */
.chart-modes { display: flex; gap: 4px; justify-content: flex-end; direction: ltr; margin: 2px 0 2px; }
.chart-modes button { background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font: 10.5px var(--mono); padding: 1px 8px; cursor: pointer; }
.chart-modes button.on { border-color: var(--amber); color: var(--amber); }
.chart.tall { height: clamp(210px, 30vh, 360px); touch-action: pan-y; cursor: crosshair; user-select: none; }
.chart.tall.grabbing { cursor: grabbing; }
.chart-modes button.zoom { padding: 1px 6px; }

/* Portfolio: row buttons and trade history (1.13) */
#pn-port td.qty { color: var(--amber); font-weight: 600; }
#pn-port .row-acts { white-space: nowrap; text-align: end; }
button.mini { font: 600 10px var(--mono); background: var(--pn2); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; margin-inline-start: 3px; cursor: pointer; }
button.mini.buy { color: var(--green); border-color: #1f5a3f; } button.mini.sell { color: var(--red); border-color: #5a2320; }
#pn-port table.hist td { font-size: 11.5px; }

/* Order ticket (1.13) */
dialog#ticketDlg { background: var(--pn); color: var(--text); border: 1px solid var(--amber); border-radius: 10px; padding: 18px 20px; width: min(440px, 94vw); max-height: 94vh; overflow: auto; }
dialog#ticketDlg::backdrop { background: rgba(0, 0, 0, .65); }
dialog#ticketDlg .tk-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
dialog#ticketDlg h2 { color: var(--amber); font: 600 15px var(--mono); margin: 0; }
dialog#ticketDlg .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
dialog#ticketDlg .row > span { color: var(--muted); white-space: nowrap; }
dialog#ticketDlg select, dialog#ticketDlg input[type=number] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: 13px var(--mono); width: 62%; }
dialog#ticketDlg .tk-br { display: flex; align-items: center; gap: 8px; margin: 6px 0; color: var(--muted); cursor: pointer; font-size: 13px; }
dialog#ticketDlg .tk-br input { width: auto; margin: 0; accent-color: var(--amber); }
dialog#ticketDlg .seg { display: flex; gap: 4px; }
dialog#ticketDlg .seg input { position: absolute; opacity: 0; pointer-events: none; }
dialog#ticketDlg .seg span { display: block; padding: 5px 12px; font: 600 12px var(--mono); background: var(--pn2); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
dialog#ticketDlg .seg input:checked + span { border-color: var(--amber); color: var(--amber); }
dialog#ticketDlg .seg input:checked + span.b { background: rgba(63, 207, 142, .15); border-color: var(--green); color: var(--green); }
dialog#ticketDlg .seg input:checked + span.s { background: rgba(255, 95, 86, .15); border-color: var(--red); color: var(--red); }
dialog#ticketDlg .seg input:focus-visible + span { outline: 2px solid var(--amber); }
dialog#ticketDlg .tk-quote { display: flex; gap: 14px; flex-wrap: wrap; font: 12px var(--mono); color: var(--muted); direction: ltr; justify-content: flex-end; }
dialog#ticketDlg .tk-quote b { color: var(--text); }
dialog#ticketDlg .quick { display: flex; gap: 5px; justify-content: flex-end; direction: ltr; }
dialog#ticketDlg .quick button { font: 11px var(--mono); background: var(--pn2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 9px; cursor: pointer; }
dialog#ticketDlg .quick button:hover { border-color: var(--amber); }
dialog#ticketDlg .tk-typehelp { font-size: 12px; margin: 4px 0 6px; min-height: 2.6em; }
dialog#ticketDlg .tk-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; background: var(--pn2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-top: 8px; }
dialog#ticketDlg .tk-preview div { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
dialog#ticketDlg .tk-preview span { color: var(--muted); } dialog#ticketDlg .tk-preview b { font-family: var(--mono); direction: ltr; }
dialog#ticketDlg .tk-cmd { margin-top: 8px; font-size: 12px; }
dialog#ticketDlg .tk-cmd code { color: var(--amber); font: 12px var(--mono); }
dialog#ticketDlg .actions { display: flex; gap: 10px; margin-top: 12px; direction: inherit; }
dialog#ticketDlg .actions button { padding: 8px 16px; border-radius: 6px; font: 700 13px var(--mono); cursor: pointer; }
dialog#ticketDlg .actions .go-buy { background: var(--green); color: #07140d; border: 0; }
dialog#ticketDlg .actions .go-sell { background: var(--red); color: #1a0706; border: 0; }
dialog#ticketDlg .actions button:disabled { opacity: .5; }

/* Scrollbars in the terminal's colours (owner request, 1.14): thin, dark, amber on hover.
   Firefox uses scrollbar-color; Chromium/Edge/Safari use the ::-webkit-scrollbar rules. */
* { scrollbar-width: thin; scrollbar-color: #2a323d transparent; }
*:hover { scrollbar-color: #3a4450 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a323d; border-radius: 8px; border: 2px solid var(--pn); }
::-webkit-scrollbar-thumb:hover { background: var(--amber); }
::-webkit-scrollbar-corner { background: transparent; }

/* Status bar on medium screens: keep it on one line (1.14). The day count is in the clock
   explanation too, so it is the first thing to go. */
@media (max-width: 1800px) and (min-width: 601px) { .status { gap: 4px 11px; font-size: 12.5px; } .status .speeds button { padding: 0 5px; } }
@media (max-width: 1700px) and (min-width: 601px) { .status [data-f="day"] { display: none; } .status .prog { width: 60px; } }

/* Chart indicators (1.20) */
.chart-modes .gap { flex: 1; }
.chart-modes button.ind.on { border-color: var(--cyan); color: var(--cyan); }
.chart-modes button[hidden] { display: none; }
.chart.tall.rsi { height: clamp(260px, 38vh, 440px); }

/* Lobby additions (1.24): hall of fame, continue code */
.mode.span { grid-column: 1 / -1; }
.mode.tut { grid-column: 1 / -1; }
.hof { margin-top: 14px; }
.hof h2 { margin-bottom: 6px; }
.hof-modes { display: flex; gap: 6px; margin-bottom: 6px; }
.hof-modes button { background: var(--pn2); border: 1px solid var(--line); border-radius: 5px; color: var(--muted); padding: 3px 10px; cursor: pointer; font-size: 12.5px; }
.hof-modes button.on { border-color: var(--amber); color: var(--amber); }
.hof table.t td, .hof table.t th { font-size: 12.5px; }
.hof tr.me td { color: var(--amber); }
.hof .me-tag { font-size: 10.5px; border: 1px solid var(--amber); border-radius: 3px; padding: 0 3px; color: var(--amber); }
.code-out { font: 600 16px var(--mono); letter-spacing: .12em; color: var(--amber); margin: 6px 0 0; }
#codeForm input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; font: 15px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.hof-line { margin: 10px 0 0; }

/* Phone refinements from the new-tester run (1.24) */
@media (max-width: 600px) {
  .status { gap: 3px 8px; }
  .status button { padding: 0 6px; }
  .status .speeds { gap: 1px; }
  .status .speeds button { padding: 0 4px; }
  table.t .opt { display: none; }
  #pn-port table.t td, #pn-port table.t th, dialog#reveal table.t td, dialog#reveal table.t th { font-size: 11.5px; padding-inline: 3px; }
  dialog#reveal { padding: 16px 12px; }
}

/* Visual round (1.26): value line, race, sparklines, news by direction */
.nav-line { margin: 4px 0 6px; }
.nav-line canvas { display: block; width: 100%; height: 46px; }
canvas.race { display: block; width: 100%; height: 170px; margin: 4px 0 8px; }
#pn-watch td.spark { width: 64px; padding: 0 6px; }
#pn-watch td.spark canvas { display: block; width: 58px; height: 18px; }
.list li.pos { border-inline-start: 3px solid rgba(63, 207, 142, .75); padding-inline-start: 6px; }
.list li.neg { border-inline-start: 3px solid rgba(255, 95, 86, .75); padding-inline-start: 6px; }
.list li.neu { border-inline-start: 3px solid transparent; padding-inline-start: 6px; }
.list li.light.pos, .list li.light.neg, .list li.noise { border-inline-start-width: 2px; }
.list li.major { border-inline-start-width: 5px; }
.list li .kind { font: 600 9.5px var(--mono); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-inline-end: 6px; color: var(--muted); }
.list li .kind.earn { color: var(--amber); border-color: rgba(255, 176, 0, .45); }
.list li .kind.macro { color: var(--cyan); border-color: rgba(92, 207, 230, .4); }
.list li.split { border: 0; color: var(--muted); font: 600 10.5px var(--mono); letter-spacing: .08em; padding: 8px 0 2px; }
@media (max-width: 600px) { #pn-watch td.spark { width: 50px; padding: 0 3px; } #pn-watch td.spark canvas { width: 46px; } }

/* Watchlist with 76 stocks (1a) */
.wl-bar { padding: 4px 8px 2px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); }
.wl-search { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; color: var(--text); padding: 4px 8px; font: 12px var(--mono); }
.wl-search:focus { outline: 1px solid var(--amber); }
.wl-secs { display: flex; gap: 3px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; direction: ltr; }
.wl-secs button { background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font: 10.5px var(--mono); padding: 1px 5px; flex: none; cursor: pointer; }
.wl-secs button.on { border-color: var(--amber); color: var(--amber); }
.wl-count { font-weight: 400; margin-inline-start: 4px; }
#pn-watch tr[hidden] { display: none; }

/* Short and margin (1b) */
.lic { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; cursor: pointer; }
.lic input { margin-top: 3px; accent-color: var(--amber); }
.lic b { display: block; color: var(--text); font-size: 13px; }
.lic .muted { font-size: 12px; }
#status .mg .tag { margin-inline-start: 4px; }
#status .mg-warn .num, .tag.mg-warn { color: var(--amber); }
#status .mg-call .num, #status .mg-liq .num, .tag.mg-call, .tag.mg-liq { color: var(--red); }
.tag.mg-call, .tag.mg-liq { animation: mgblink 1s steps(2, start) infinite; }
@keyframes mgblink { to { opacity: 0.35; } }
.pf-sum.mg { border-top: 1px dashed var(--line); padding-top: 4px; }
.pf-sum .st-warn { color: var(--amber); }
.pf-sum .st-call, .pf-sum .st-liq { color: var(--red); font-weight: 600; }
.short-tag { font-size: 10px; color: var(--red); border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; margin-inline-start: 4px; }
.tk-preview .short-row b { color: var(--red); }

/* Black Swan (1c) */
.list li.swan { border-inline-start: 3px solid var(--red); background: rgba(255, 95, 86, .08); padding-block: 5px; font-weight: 600; }
.list li.swan.pos { border-inline-start-color: var(--green); background: rgba(63, 207, 142, .08); }
/* A swan that touches your holdings keeps its own colour; the POS tag says it is yours. */
.list li.swan.mine { background: rgba(255, 95, 86, .14); box-shadow: inset 0 0 0 1px rgba(255, 95, 86, .45); }
.list li.swan.fresh { animation: none; }
.list li.swan.pos.mine { background: rgba(63, 207, 142, .14); box-shadow: inset 0 0 0 1px rgba(63, 207, 142, .45); }
.list li .kind.swan { color: #fff; background: #5a2320; border-color: #5a2320; }
.list li.swan.pos .kind.swan { background: #1f5a3f; border-color: #1f5a3f; }
.list li .kind.rumor { color: var(--amber); border-color: #4a3b10; }
.status .tag.halt { animation: mgblink 1s steps(2, start) infinite; }
.swan-moment { font-weight: 600; }

/* Analysts (1c, part 2) */
.list li .kind.note { color: var(--cyan); border-color: rgba(92, 207, 230, .5); }
.list li .kind.anl { color: #c9a7ff; border-color: rgba(201, 167, 255, .45); }
.list li.note-item { font-style: normal; }
table.anr td.txt { white-space: normal; }
table.anr .small, .muted.small { font-size: 11px; }
table.anr tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }
.team-tag { color: var(--cyan); }
/* ANR summary: a wrapping row of label/value pairs, readable in a narrow panel */
.anr-sum { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 4px 0 8px; }
.anr-sum > div { display: flex; gap: 8px; align-items: baseline; white-space: nowrap; }
.anr-sum b { color: var(--muted); font-weight: 500; font-size: 11px; }

/* Rooms (1d) */
.friends { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--pn2); }
.friends h2 { margin: 0 0 4px; font-size: 15px; }
.friends-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.friends-row select, .friends-row input { flex: 1; min-width: 120px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: 6px 8px; font: 14px var(--mono); }
.friends-row button { width: auto; margin: 0; }
#roomCode { text-transform: uppercase; letter-spacing: 2px; }
.room-code { font: 700 38px var(--mono); letter-spacing: 8px; color: var(--amber); text-align: center; margin: 10px 0; }
.room-link { display: flex; gap: 8px; }
.room-link input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); padding: 6px 8px; font: 12px var(--mono); }
.room-link button { width: auto; margin: 0; }
.room-players { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.room-players li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; }
.room-players li.off { opacity: .55; }
.room-players .muted { margin-inline-start: auto; font-size: 12px; }
.room-players .tag { font-size: 10px; color: var(--amber); border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3a4450; margin-inline-end: 6px; vertical-align: middle; }
.dot.ready, .dot.on { background: var(--green); }
#pn-lb tr.away td { opacity: .6; }
.chat { list-style: none; margin: 0; padding: 4px 6px; max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; }
.chat li { padding: 2px 0; overflow-wrap: anywhere; }
.chat li.me b { color: var(--amber); }
.chat .d { color: var(--muted); font: 10px var(--mono); }
.chat-form { display: flex; gap: 6px; margin-top: 6px; }
.chat-form input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: 5px 8px; }
.chat-form button { width: auto; margin: 0; padding: 4px 12px; }
.status button:disabled { opacity: .35; cursor: not-allowed; }
.room-link button, .chat-form button, .friends-row button:not(.primary) { background: var(--pn2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: 5px 12px; cursor: pointer; font: inherit; }
.room-link button:hover, .chat-form button:hover, .friends-row button:not(.primary):hover { border-color: var(--amber); color: var(--amber); }
.lic input[type="checkbox"] { width: auto; flex: none; margin: 3px 0 0; }
/* The licence choice is a row: checkbox beside its text (.card label is a block otherwise). */
.card label.lic { display: flex; flex-direction: row; color: var(--text); margin: 12px 0 0; }
.card .lic input[type="checkbox"] { width: 16px; height: 16px; padding: 0; flex: none; margin-top: 3px; }

/* The coach on phones (1.36): compact on short screens, and keyboard tips only where there is a keyboard. */
@media (max-height: 760px) {
  #coach { font-size: 13px; line-height: 1.45; padding: 10px 12px; max-height: 44vh; overflow: auto; }
  #coach .coach-btns { margin-top: 6px; }
}
@media (pointer: coarse) {
  #coach .coach-body .muted { display: none; }
}

/* Index trackers (1.37) */
.etf-tag { font: 600 9px var(--mono); color: #c9a7ff; border: 1px solid rgba(201, 167, 255, .5); border-radius: 3px; padding: 0 3px; margin-inline-start: 4px; vertical-align: middle; }
.etf-members { line-height: 1.8; }
.etf-members .tk { cursor: pointer; }

/* 1e: spotlight, alert digest, Rookie layout (1.38) */
.spot-line { margin: 2px 0 6px; color: var(--amber); font-size: 12.5px; }
.spot-line b { color: var(--amber); }
#pn-watch .h.spot { color: var(--amber); }
.toast.digest { border-color: var(--line); max-width: min(460px, 92vw); }
.toast ul.digest { margin: 4px 0 0; padding-inline-start: 18px; font-size: 12.5px; }
.toast ul.digest li { margin: 2px 0; }
.toast ul.digest li.bad { color: #ffb3ae; } .toast ul.digest li.good { color: #a8ecc9; }
body.rookie #status [data-x="mfx"], body.rookie #status [data-x="rate"], body.rookie #status [data-x="next"], body.rookie #status [data-x="pace"] { display: none; }
body.rookie #tabs [data-p="lb"] { display: none; }

/* Campaign (stage 1g): lobby list, the mentor's card, the end screen; presenter display (GDD 1.6) */
.camp { margin: 18px 0 6px; }
.camp-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; }
.camp-m { display: flex; flex-direction: column; gap: 3px; text-align: start; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--text); cursor: pointer; font: inherit; }
.camp-m b { font-size: 13px; }
.camp-m .muted { font-size: 11.5px; }
.camp-m.boss { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.camp-m.locked { opacity: .5; cursor: default; }
.camp-m:not(.locked):hover { border-color: var(--amber); }
.stars { color: var(--amber); letter-spacing: 2px; font-size: 14px; }
#mentor { position: fixed; z-index: 60; inset-inline-start: 16px; bottom: 56px; width: min(380px, calc(100vw - 32px)); background: var(--pn); border: 1px solid var(--amber); border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 13.5px; }
#mentor .m-head { display: flex; align-items: baseline; gap: 8px; }
#mentor .m-head b { color: var(--amber); }
#mentor .m-fold { margin-inline-start: auto; color: var(--muted); }
#mentor .m-text { margin: 8px 0; line-height: 1.5; }
#mentor .m-note { margin: 6px 0; color: var(--cyan); }
#mentor .m-goals, .m-reveal .m-goals { list-style: none; padding: 0; margin: 6px 0; font-size: 12.5px; color: var(--muted); }
#mentor .m-goals li.ok, .m-reveal .m-goals li.ok { color: var(--green); }
#mentor .m-goals li.req { font-weight: 600; }
#mentor .m-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#mentor .m-foot .muted { margin-inline-end: auto; font-size: 12px; }
#mentor .quiz { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
#mentor .quiz button:not(.link) { text-align: start; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; color: var(--text); cursor: pointer; font: inherit; }
#mentor .quiz button:not(.link):hover { border-color: var(--amber); }
#mentor.folded .m-text, #mentor.folded .m-note, #mentor.folded .quiz, #mentor.folded .m-goals { display: none; }
@media (max-width: 700px) { #mentor { bottom: 96px; inset-inline-start: 8px; width: calc(100vw - 16px); font-size: 13px; } }
.m-reveal .big { font-size: 30px; margin: 6px 0; }
.m-reveal .big .stars { font-size: 30px; }
.m-reveal .whisper { border-inline-start: 3px solid var(--amber); padding-inline-start: 10px; color: var(--text); font-style: italic; }
/* The whole page scales, as with the browser's zoom: the layout stays the same, only larger. */
@media (min-width: 1100px) { body.present { zoom: 1.25; } }

/* Private leagues and the account box (stage 1h); the legal pages */
.league { margin: 18px 0 6px; }
.lg { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: var(--bg); }
.lg-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lg-head .muted { font-size: 12px; }
.lg-code { margin-inline-start: auto; font: 12px var(--mono); color: var(--amber); letter-spacing: .1em; }
.lg-table { margin: 6px 0; font-size: 12.5px; }
.lg-table tr.me td { color: var(--amber); }
.lg-acts { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lg-acts a.link { color: var(--cyan); }
#lgCreate input#lgName { width: 100%; margin: 8px 0 6px; }
.lg-adv { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.lg-adv input { width: auto; margin: 0; }
#accountBox a.link, #accountBox button.link { color: var(--cyan); }
#accountBox .danger { color: var(--red); }
.legal-links a { color: var(--muted); }
body.legal-page { overflow: auto; height: auto; }
.legal { width: min(760px, 100%); margin: 0 auto; padding: 28px 16px 60px; line-height: 1.65; }
.legal h1 { color: var(--amber); font-size: 22px; }
.legal h2 { color: var(--text); font-size: 16px; margin-top: 22px; }
.legal .draft { border: 1px dashed var(--amber); border-radius: 8px; padding: 10px 12px; color: var(--amber); font-size: 13px; }
.legal a { color: var(--cyan); }
.legal table { font-size: 13px; }
.legal td { vertical-align: top; }

/* The mentor after a game (1.46) */
.list.coach li { line-height: 1.55; margin: 6px 0; }
.list.coach li.tip { border-inline-start: 3px solid var(--amber); padding-inline-start: 10px; }
.list.coach li.good { border-inline-start: 3px solid var(--green); padding-inline-start: 10px; }
.toast.hint { border-inline-start: 3px solid var(--amber); }
.toast.hint .muted { font-size: 11.5px; }

/* Campaign chapters (1.47) */
.camp-ch { font-size: 13px; color: var(--text); margin: 14px 0 6px; font-weight: 600; }
.camp-ch .muted { font-weight: 400; font-size: 12px; }

/* Lobby tabs (1.49): one subject a tab; on a phone the tabs are a bottom bar */
.card.lobby-card { width: min(760px, 100%); padding-top: 22px; }
.lobby-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lobby-head .hello { margin: 0; }
.lobby-tabs { display: flex; gap: 4px; margin: 16px 0 6px; border-bottom: 1px solid var(--line); }
.lobby-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 12px; cursor: pointer; font: inherit; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; margin-bottom: -1px; }
.lobby-tabs button:hover { color: var(--text); }
.lobby-tabs button.on { color: var(--amber); border-bottom-color: var(--amber); }
.lobby-tabs .ico { font-size: 13px; opacity: .85; }
.lobby-pane { padding-top: 6px; }
.lobby-pane > h2:first-child, .lobby-pane section > h2:first-child { margin-top: 12px; }
.pane-desc { margin: -4px 0 12px; font-size: 13px; line-height: 1.55; }
.next-box h2 { margin-top: 12px; }
.next-card { display: flex; align-items: center; gap: 14px; justify-content: space-between; background: var(--pn2); border: 1px solid var(--amber); border-radius: 10px; padding: 14px 16px; margin-bottom: 8px; }
.next-card p { margin: 0; line-height: 1.5; }
.next-card .primary { flex: none; width: auto; margin: 0; padding: 9px 18px; }
.more-list { display: grid; gap: 8px; margin-top: 12px; }
#lobby .more-list .more-item { display: flex; flex-direction: column; gap: 3px; text-align: start; background: var(--pn2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: var(--text); font: inherit; cursor: pointer; }
button.more-item:hover { border-color: var(--amber); }
.more-item b { color: var(--text); font-weight: 600; }
.more-item .muted { font-size: 12.5px; }
details.more-item { cursor: default; }
details.more-item summary { cursor: pointer; color: var(--text); font-weight: 600; }
.more-item.install .link { text-align: start; font-weight: 600; padding: 0; }
#lobby .guide-link { color: inherit; }
@media (max-width: 700px) {
  #lobby { padding-bottom: 76px; }
  .card.lobby-card { padding: 18px 16px; }
  #lgCreate .friends-row { flex-wrap: wrap; }
  #lgCreate .lg-adv { flex: 1 1 auto; }
  .lobby-tabs { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; margin: 0; background: var(--pn); border-top: 1px solid var(--line); border-bottom: 0; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .lobby-tabs button { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; border-bottom: 0; border-top: 2px solid transparent; margin: 0; flex: 1; }
  .lobby-tabs button.on { border-top-color: var(--amber); }
  .lobby-tabs .ico { font-size: 17px; }
  .next-card { flex-direction: column; align-items: stretch; }
  .next-card .primary { width: 100%; }
}
/* The lobby card stays put when the tabs change height. */
#lobby.screen { align-items: start; padding-top: 32px; }
@media (max-width: 700px) { #lobby.screen { padding-top: 12px; } }
/* The Advanced box (1.50): what a seed is, what the demo is for. */
#advBox .adv-desc { font-size: 12.5px; line-height: 1.55; margin: 6px 0 0; }
#advBox .adv-demo { display: block; margin-top: 16px; color: var(--amber); font-weight: 600; padding: 0; }
#advBox #seed { width: 100%; margin-top: 4px; }

/* New version ready (1.60): a bar at the top, above everything, until the player refreshes or closes it. */
#updateBar { position: fixed; z-index: 9999; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px;
  background: var(--pn2); border: 1px solid var(--amber); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); }
#updateBar span { flex: 1 1 auto; min-width: 0; font-size: 13.5px; line-height: 1.4; }
#updateBar button.primary { flex: none; width: auto; margin: 0; padding: 6px 14px; white-space: nowrap; }
#updateBar button.link { flex: none; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; }

/* Background music (1.61): the switch in the status bar and in the lobby; dimmed and struck when off. */
.status [data-act=music].music-off, .music-btn.music-off { opacity: .45; text-decoration: line-through; }
.music-btn { font-size: 13px; color: var(--muted); margin: -4px 0 6px; padding: 2px 0; }

/* Phone (1.64): the company panel fills its own tab, so the candle chart can be much taller. On a
   ~280 px chart a normal day was 3-4 px high next to a crash day; the extra height makes candles readable. */
@media (max-width: 600px) {
  .chart.tall { height: clamp(300px, 46vh, 460px); }
  .chart.tall.rsi { height: clamp(360px, 56vh, 540px); }
}

/* Price scale controls (1.66): the toolbar may wrap on a phone; a stretched chart takes the finger. */
.chart-modes { flex-wrap: wrap; }
.chart.tall.ymanual { touch-action: none; }
.chart-modes button.yz { min-width: 30px; }
/* The measuring tool (1.67): a finger measures instead of scrolling the page. */
.chart.tall.measuring { touch-action: none; cursor: crosshair; }

/* "Why?" on an alert (1.69): the way into WHY when a holding moves hard. */
.toast .why-offer { margin-inline-start: 8px; background: none; border: 1px solid var(--amber); color: var(--amber); border-radius: 4px; padding: 1px 9px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.toast .why-offer:hover { background: rgba(255, 176, 0, .12); }

/* Opening (1.70, D91): the logo draws itself, the dot pops, the name rises; then it fades away. */
#splash { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; background: var(--bg); opacity: 1; transition: opacity .45s ease; }
#splash[hidden] { display: none; }
#splash.out { opacity: 0; pointer-events: none; }
#splash .splash-in { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 16px; text-align: center; }
#splash svg { width: 120px; height: 120px; }
#splash .sp-path { stroke-dasharray: 80; stroke-dashoffset: 80; animation: sp-draw 1.4s .2s ease-out forwards; }
#splash .sp-dot { transform-box: fill-box; transform-origin: center; transform: scale(0); animation: sp-pop .4s 1.5s ease-out forwards; }
#splash .sp-word { font: 600 26px var(--mono); letter-spacing: .3em; color: var(--amber); direction: ltr; opacity: 0; animation: sp-rise .7s 1.4s ease-out forwards; }
#splash .sp-sub { color: var(--muted); font-size: 14px; opacity: 0; animation: sp-rise .7s 1.8s ease-out forwards; }
@keyframes sp-draw { to { stroke-dashoffset: 0; } }
@keyframes sp-pop { 0% { transform: scale(0); } 70% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes sp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 420px) { #splash .sp-word { font-size: 20px; letter-spacing: .24em; } #splash svg { width: 100px; height: 100px; } }

/* Living background "network" (1.71, D92): behind the login, the lobby and the waiting room. */
#backdrop { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; display: block; }
#backdrop[hidden] { display: none; }
#login, #lobby, #room { position: relative; z-index: 1; }
