/* =====================================================================
   Nerve Trader — style.css
   Layout hierarchy
     body (100vh flex column, never scrolls)
       └ .app (flex column)
           ├ .topbar   — fixed-height single row (52px mobile / 50px desktop)
           ├ .layout   — workspace
           │    < 1024px : single-pane views routed by body[data-view]
           │   >= 1024px : 3-col × 2-row docking grid
           │               ┌────────────┬────────┬────────┐
           │               │ chart      │ book   │ side   │
           │               ├────────────┤        │        │
           │               │ dock       │        │        │
           │               └────────────┴────────┴────────┘
           └ .bottom-nav — fixed (mobile only)
   ===================================================================== */

:root {
  --bg: #101115;
  --bg-2: #101115;
  --panel: #101115;
  --panel-2: #191b21;
  --panel-3: #23262e;
  --border: #23262e;
  --border-2: #30343d;
  --text: #d1d4dc;
  --text-2: #a7abb5;
  --muted: #737884;
  --green: #26a69a;
  --green-2: #1f8a80;
  --green-bg: rgba(38, 166, 154, 0.12);
  --red: #ef5350;
  --red-2: #d64541;
  --red-bg: rgba(239, 83, 80, 0.12);
  --accent: #f0b90b;
  --accent-bg: rgba(240, 185, 11, 0.12);
  --blue: #4c8dff;
  --violet: #a78bfa;
  --orange: #ff8a3d;

  /* Latin/Cyrillic come from Inter / JetBrains Mono; Hebrew & Arabic glyphs fall through to Noto */
  --font-ui: 'Inter', 'Noto Sans Hebrew', 'Noto Sans Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Inter', 'Noto Sans Hebrew', 'Noto Sans Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; /* tabular figures, not a code font */

  --radius: 10px;
  --radius-sm: 7px;

  --topbar-h: 52px;
  --nav-h: 56px;
  --actionbar-h: 65px;          /* measured at runtime by app.js */
  --book-row-h: 19px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { height: 100%; background: var(--bg); }

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
@supports (height: 100dvh) {
  body { height: 100dvh; }
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.up { color: var(--green); }
.down { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================== APP SHELL ============================== */
.app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transition: filter 0.35s ease;
}
body.locked .app {
  filter: blur(7px) saturate(0.6) brightness(0.7);
  pointer-events: none;
  user-select: none;
}

/* ============================== TOP BAR ============================== */
.topbar {
  flex: 0 0 auto;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  min-width: 0;
  position: relative;
  z-index: 50;
}
.brand { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; display: block; }
.brand-name { display: none; font-weight: 800; letter-spacing: -0.02em; font-size: 15px; white-space: nowrap; }
.brand-name b { color: var(--accent); margin-left: 2px; }

.market {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.asset-select-wrap { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; }
.asset-select {
  appearance: none;
  -webkit-appearance: none;
  height: 32px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding-block: 0;
  padding-inline: 10px 26px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.asset-select:focus-visible { border-color: var(--accent); }
.asset-select option { background: var(--panel); color: var(--text); }
.asset-select-wrap .caret { position: absolute; inset-inline-end: 8px; width: 12px; height: 12px; pointer-events: none; color: var(--muted); }
.asset-name {
  display: none;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
}

.ticker {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
}
.last-price {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  border-radius: 4px;
  padding: 0 3px;
  margin-inline-start: -3px;
  white-space: nowrap;
  transition: color 0.2s;
}
.last-price.tick-up { color: var(--green); }
.last-price.tick-down { color: var(--red); }
.last-price.flash-up { animation: flashUp 0.6s ease-out; }
.last-price.flash-down { animation: flashDown 0.6s ease-out; }
@keyframes flashUp { 0% { background: rgba(22, 199, 132, 0.35); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: rgba(234, 57, 67, 0.35); } 100% { background: transparent; } }

.chip {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}
.chip-up { background: var(--green-bg); color: var(--green); }
.chip-down { background: var(--red-bg); color: var(--red); }
.chip-flat { background: var(--panel-3); color: var(--muted); }

.stats-24h { display: none; flex: 0 0 auto; gap: 18px; margin-inline-start: 6px; }
.stats-24h div { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.stats-24h span { font-size: 10px; color: var(--muted); }
.stats-24h b { font-size: 12px; font-weight: 500; }

/* rank: ring-badge always; name + progress bar when there's room */
.rank-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  cursor: pointer;
  outline: none;
  border-radius: 8px;
}
.rank-strip:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.rank-ring {
  --prog: 0;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) calc(var(--prog) * 1%), var(--panel-3) 0);
}
.rank-ring .rank-badge { width: 30px; height: 30px; box-shadow: 0 0 0 2px var(--bg-2); }
.rank-info { display: none; width: 150px; min-width: 0; }
.rank-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.rank-name { font-weight: 700; font-size: 12px; white-space: nowrap; }
.rank-next { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier-progress { height: 5px; background: var(--panel-3); border-radius: 5px; overflow: hidden; }
.tier-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--tier-c, #cd7f32), var(--tier-c2, #f0b90b));
  transition: width 0.6s cubic-bezier(.2,.8,.2,1);
}

.rank-badge {
  --tier-c: #cd7f32;
  --tier-c2: #e8a865;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: radial-gradient(circle at 30% 25%, var(--tier-c2), var(--tier-c) 60%, rgba(0,0,0,0.45) 140%);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.08), 0 0 12px -2px var(--tier-c);
  color: #0b0e14;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: -0.03em;
}
.rank-badge-lg { width: 56px; height: 56px; font-size: 20px; }
.tier-bronze   { --tier-c: #b06a2b; --tier-c2: #e8a865; }
.tier-silver   { --tier-c: #8d97a8; --tier-c2: #e9eef5; }
.tier-gold     { --tier-c: #d49b0a; --tier-c2: #ffe17a; }
.tier-platinum { --tier-c: #3fb8b3; --tier-c2: #c8fbf8; }
.tier-mm       { --tier-c: #7c4dff; --tier-c2: #e0b3ff; }
.tier-mm.rank-badge { color: #fff; }

.equity-mini {
  display: none;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}
.equity-mini span { font-size: 10px; color: var(--muted); line-height: 1; }
.equity-mini b { font-size: 13px; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.stress-mini { width: 74px; height: 3px; background: var(--panel-3); border-radius: 3px; overflow: hidden; }
.stress-mini div { height: 100%; width: 0; background: var(--green); transition: width 0.25s, background 0.25s; }

.icon-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* language picker: a native <select> laid invisibly over a compact chip (native picker on phones) */
.lang-picker {
  position: relative;
  flex: 0 0 auto;
  height: 32px;
  min-width: 32px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
}
.lang-picker:hover { color: var(--text); border-color: var(--border-2); }
.lang-picker:focus-within { border-color: var(--accent); }
.lang-picker svg { display: none; width: 15px; height: 15px; flex-shrink: 0; }
.lang-code { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.lang-picker select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
}
.lang-picker select option { background: var(--panel); color: var(--text); }
.ic-sound-off { display: none; }
body.muted-sound .ic-sound-on { display: none; }
body.muted-sound .ic-sound-off { display: block; }

/* ============================== PANELS (shared) ============================== */
.layout { min-width: 0; }
.panel {
  display: none;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}
.panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px 8px;
  height: 36px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.panel-head h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.panel-head .muted { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================== CHART PANE ============================== */
.panel-chart {
  flex-direction: column;
  overflow: hidden;
  container: chartpane / inline-size;
}
.chart-toolbar {
  flex: 0 0 auto;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 6px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
/* timeframe: one compact button; a native <select> laid invisibly over it opens the list */
.tf-pick {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--accent);
  cursor: pointer;
}
.tf-pick:hover { border-color: var(--border-2); }
.tf-pick:focus-within { border-color: var(--accent); }
.tf-ic { width: 14px; height: 14px; color: var(--text-2); }
.tf-label { min-width: 22px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; text-align: center; }
.tf-chev { width: 11px; height: 11px; color: var(--muted); }
.tf-pick select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
}
.tf-pick select option { background: var(--panel); color: var(--text); }

.chart-tools { flex: 0 1 auto; min-width: 0; display: flex; gap: 4px; align-items: center; }
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  white-space: nowrap;
}
.tool-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.tool-btn:hover { color: var(--text); border-color: var(--border-2); }
.tool-btn.active { color: #0b0e14; background: var(--accent); border-color: var(--accent); }
.tool-btn:disabled { opacity: 0.4; }

@container chartpane (max-width: 600px) {
  .tool-btn .lbl:not(.lbl-keep) { display: none; }
}
@container chartpane (max-width: 480px) {
  /* phones: icon-only tools; undo / clear appear only once there are lines to undo */
  .tool-btn .lbl { display: none; }
  .chart-tools { gap: 3px; }
  .tool-btn { padding: 0 7px; }
}
@container chartpane (max-width: 330px) {
  .tool-btn .lbl { display: none; }
}

.sim-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.sim-toggle.sim { border-color: rgba(167, 139, 250, 0.5); color: var(--violet); background: rgba(167, 139, 250, 0.1); }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.conn-dot.live { background: var(--green); animation: pulseDot 1.8s infinite; }
.conn-dot.connecting { background: var(--accent); animation: blink 0.9s infinite; }
.conn-dot.sim { background: var(--violet); }
.conn-dot.down { background: var(--red); }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(22,199,132,0.55); } 70% { box-shadow: 0 0 0 6px rgba(22,199,132,0); } 100% { box-shadow: 0 0 0 0 rgba(22,199,132,0); } }
@keyframes blink { 50% { opacity: 0.3; } }

/* main 72% / RSI 28% — flex-basis 0 makes the ratio exact */
.chart-stack {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chart-main, .chart-rsi {
  position: relative;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
}
.chart-main { flex: 72 1 0; }
.chart-rsi { flex: 28 1 0; border-top: 1px solid var(--border); }
/* The chart canvas lives in an absolutely positioned host so it can never
   influence (or fight) the size of its pane. app.js sizes the chart to it. */
.chart-host { position: absolute; inset: 0; overflow: hidden; background: var(--bg); }

.legend {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 3;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-2);
  max-width: calc(100% - 100px);
  text-shadow: 0 0 4px var(--bg), 0 0 2px var(--bg);
}
.legend .lg-row { display: flex; flex-wrap: wrap; gap: 0 9px; }
.legend .lg-title { color: var(--text); font-weight: 700; font-family: var(--font-ui); }
.legend .lg-k { color: var(--muted); margin-right: 3px; }
.legend .lg-ema { color: #f0b90b; }
.legend .lg-sma20 { color: #4c8dff; }
.legend .lg-sma50 { color: #c084fc; }
.legend .lg-rsi { color: var(--violet); }
.rsi-legend { top: 3px; }
@container chartpane (max-width: 520px) {
  .legend { font-size: 10.5px; line-height: 1.45; }
  .legend .lg-f { display: none; }
}

.draw-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%) translateY(6px);
  max-width: calc(100% - 90px);
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(41, 98, 255, 0.92);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.draw-hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.chart-loading {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  text-align: center;
  background: rgba(11, 14, 20, 0.82);
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.chart-loading.show { opacity: 1; pointer-events: auto; }
.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--border-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== ORDER BOOK ============================== */
.panel-book {
  flex-direction: column;
  overflow: hidden;
  container: book / inline-size;
}
.book-cols, .book-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 4px;
  padding: 0 10px;
}
.book-cols {
  flex: 0 0 auto;
  height: 24px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}
.book-cols span:not(:first-child) { text-align: end; }
.col-total, .book-row .t { display: none; }
@container book (min-width: 230px) {
  .book-cols, .book-row { grid-template-columns: 1.1fr 1fr 1fr; }
  .col-total, .book-row .t { display: block; }
}
/* asks and bids split the remaining height equally; app.js fills them with as many rows as fit */
.book-side {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.book-asks { justify-content: flex-end; }
.book-bids { justify-content: flex-start; }
.book-row {
  position: relative;
  flex: 0 0 auto;
  height: var(--book-row-h);
  line-height: var(--book-row-h);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  cursor: pointer;
}
.book-row:hover { background: rgba(255,255,255,0.03); }
.book-row span { position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.book-row .q, .book-row .t { text-align: end; color: var(--text-2); }
.book-asks .book-row .p { color: var(--red); }
.book-bids .book-row .p { color: var(--green); }
.book-row .depth {
  position: absolute;
  top: 1px;
  bottom: 1px;
  inset-inline-end: 0;
  width: 100%;
  transform-origin: right center;
  transform: scaleX(0);
  transition: transform 0.35s ease;
}
.book-asks .depth { background: rgba(234, 57, 67, 0.13); }
.book-bids .depth { background: rgba(22, 199, 132, 0.13); }
.book-mid {
  flex: 0 0 auto;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  margin: 2px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 15px;
  font-weight: 700;
}
.book-mid.up { color: var(--green); }
.book-mid.down { color: var(--red); }
.mid-arrow { font-size: 12px; }

/* ============================== RIGHT COLUMN: ORDER TICKET ============================== */
.panel-ticket { padding: 12px; }

/* numbers: monospaced tabular figures, always laid out left-to-right */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Market | Limit */
.seg {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.seg-btn {
  height: 30px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }

.field { margin-bottom: 12px; min-width: 0; }
.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--text-2);
}
.field-label > * { min-width: 0; }
.field-label .muted { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-btn { color: var(--accent); font-size: 11px; font-weight: 600; white-space: nowrap; }

.input-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.12); }
.input-tp:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 199, 132, 0.12); }
.input-sl:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(234, 57, 67, 0.12); }
.input-wrap.flash { animation: fieldFlash 0.7s ease-out; }
@keyframes fieldFlash { 0% { box-shadow: 0 0 0 4px rgba(240, 185, 11, 0.45); } 100% { box-shadow: 0 0 0 0 rgba(240, 185, 11, 0); } }
.input-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 10px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.input-wrap input::placeholder { color: #4d5568; font-family: var(--font-ui); font-size: 12px; font-weight: 500; }
.input-wrap .unit { flex: 0 0 auto; padding-inline-end: 10px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.clear-x { flex: 0 0 auto; height: 100%; padding: 0 10px; font-size: 16px; line-height: 1; color: var(--muted); }
.clear-x:hover { color: var(--text); }

/* quick-pick pills: leverage, size %, TP/SL % */
.pills { display: grid; gap: 4px; }
.pills-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pills-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 6px; }
.pills-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 6px; }
.pill {
  min-width: 0;
  height: 30px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
.pill:hover { border-color: var(--border-2); color: var(--text); }
.pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.pills-xs .pill { height: 26px; font-size: 11px; }
[data-target="tpInput"] .pill:hover { border-color: var(--green); color: var(--green); }
[data-target="slInput"] .pill:hover { border-color: var(--red); color: var(--red); }

/* notional · qty · fee */
.ticket-calc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 10px;
  margin-bottom: 12px;
  border: 1px dashed var(--border-2);
  border-radius: 8px;
  background: var(--bg);
  font-size: 10.5px;
}
.ticket-calc div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ticket-calc div:not(:first-child) { text-align: end; }
.ticket-calc span { color: var(--muted); }
.ticket-calc b { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* collapsible TP / SL row */
.tpsl { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.tpsl-head {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 0;
}
.tpsl-head > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpsl-head:hover { color: var(--text); }
.tpsl-summary { margin-inline-start: auto; font-size: 11px; color: var(--accent); white-space: nowrap; }
.tpsl-chev { flex: 0 0 auto; width: 12px; height: 12px; color: var(--muted); transition: transform 0.2s; }
.tpsl.open .tpsl-chev { transform: rotate(180deg); }
.tpsl-body { display: none; padding: 0 10px 10px; }
.tpsl.open .tpsl-body { display: block; }
.tpsl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tpsl-grid .field { margin-bottom: 0; }
.tpsl .btn-ghost { margin-top: 10px; }

.btn-ghost {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-sm { height: 30px; font-size: 11px; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #0b0e14;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.45; filter: grayscale(0.5); }
.btn-primary svg { width: 16px; height: 16px; }
.btn-lg { width: 100%; padding: 14px 18px; font-size: 15px; }

/* ============================== ACTION BAR: BUY / SELL (+ close) ============================== */
.action-bar { min-width: 0; }
.action-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.btn-trade {
  height: 54px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  overflow: hidden;
  touch-action: manipulation;
  transition: transform 0.08s ease, filter 0.15s, opacity 0.15s;
}
.btn-trade small {
  max-width: 100%;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-buy {
  background: linear-gradient(180deg, #22dc97 0%, #16c784 55%, #0fa86e 100%);
  box-shadow: 0 6px 18px -8px rgba(22, 199, 132, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-sell {
  background: linear-gradient(180deg, #f45a64 0%, #ea3943 55%, #c92a34 100%);
  box-shadow: 0 6px 18px -8px rgba(234, 57, 67, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-trade:hover:not(:disabled) { filter: brightness(1.07); }
.btn-trade:active:not(:disabled) { transform: scale(0.98); }
.btn-trade:disabled { opacity: 0.38; box-shadow: none; cursor: not-allowed; }

/* open-position bar: [side · PnL ›  → manage]  [Close position] — only while a position is open */
.close-row {
  display: flex;
  height: 40px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid rgba(240, 185, 11, 0.45);
  background: var(--panel-2);
  overflow: hidden;
  font-size: 12px;
}
.cp-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-align: start;
}
.cp-info .num { font-size: 12px; font-weight: 600; }
.cp-info .cp-go { margin-inline-start: auto; color: var(--muted); font-size: 14px; line-height: 1; }
.cp-info:hover { background: var(--panel-3); }
.cp-info:hover .cp-go { color: var(--text); }
.cp-close {
  flex: 0 0 auto;
  padding: 0 12px;
  border-inline-start: 1px solid rgba(240, 185, 11, 0.3);
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}
.cp-close:hover:not(:disabled) { background: var(--accent-bg); }
.cp-close:disabled { opacity: 0.4; }
[dir="rtl"] .cp-go { transform: scaleX(-1); }

/* exit orders on the position card: TP / SL editor + limit exit */
.pos-body { display: grid; grid-template-columns: minmax(0, 1fr); }
.pos-exits { border-top: 1px solid var(--border); padding-top: 10px; margin-bottom: 10px; min-width: 0; }
.pe-title { font-size: 11px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.pe-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.pe-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 8px; }
.pos-exits .input-wrap { height: 36px; }
.pos-exits .input-wrap input { font-size: 14px; padding-inline-start: 8px; }
/* field name sits inside the input ("TP", "SL", "Limit exit") instead of a label row above it */
.pe-pfx { flex: 0 0 auto; padding-inline-start: 10px; font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pe-pfx.up { color: var(--green); }
.pe-pfx.down { color: var(--red); }
.pos-exits .btn-ghost { width: auto; height: 36px; padding: 0 12px; }
.pe-active { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11.5px; min-width: 0; }
.pe-active .mini-btn { margin-inline-start: auto; }
@container dock (max-width: 460px) {
  .pe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pe-grid .btn-ghost { grid-column: 1 / -1; width: 100%; }
  /* the limit-exit field gets the full width so its prefix never squeezes the price */
  .pe-row { grid-template-columns: minmax(0, 1fr); }
  .pe-row .btn-ghost { width: 100%; }
}
/* wide dock: details and exit orders side by side, tightened to fit the fixed 220px dock */
@container dock (min-width: 860px) {
  .dock-pane[data-pane="positions"] { padding: 8px; }
  .pos-card { padding: 8px 12px; }
  .pos-body { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }
  .pos-card-head { margin-bottom: 6px; }
  .pos-pnl { display: flex; align-items: baseline; gap: 8px; }
  .pos-pnl b { font-size: 15px; }
  .kv-grid { gap: 5px 12px; margin-bottom: 8px; }
  .pos-actions .btn-ghost { height: 30px; }
  .pos-exits { border-top: 0; padding-top: 0; margin-bottom: 0; padding-inline-start: 14px; border-inline-start: 1px solid var(--border); }
  .pe-title { margin-bottom: 6px; }
  .pos-exits .input-wrap, .pos-exits .btn-ghost { height: 34px; }
  .pe-row, .pe-active { margin-top: 6px; }
}

.side-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.side-long { background: var(--green-bg); color: var(--green); }
.side-short { background: var(--red-bg); color: var(--red); }

/* ============================== ACCOUNT / RISK ============================== */
.panel-account { overflow: hidden; }
.acct-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 10px 12px;
}
.acct-grid div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-grid span { font-family: var(--font-ui); font-size: 10.5px; color: var(--muted); }
.acct-grid b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stress { padding: 0 12px 12px; }
.stress-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2); margin-bottom: 5px; }
.stress-head b { font-size: 12px; }
.stress-track {
  position: relative;
  height: 8px;
  border-radius: 8px;
  background: var(--panel-3);
  overflow: hidden;
}
.stress-fill {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  background: linear-gradient(90deg, #16c784 0%, #f0b90b 55%, #ff8a3d 75%, #ea3943 100%);
  background-size: calc(100% * 100 / var(--w, 100)) 100%;
  transition: width 0.25s ease;
}
.stress-tick { position: absolute; top: 0; bottom: 0; inset-inline-start: 80%; width: 2px; background: rgba(255,255,255,0.35); }
.stress-foot { font-size: 10.5px; margin-top: 5px; }
.stress.critical .stress-head b { color: var(--red); animation: blink 0.6s infinite; }
.stress.warn .stress-head b { color: var(--orange); }

/* Screen-edge red glow when stress > 80% */
.stress-glow {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 0 2px rgba(234,57,67,0.9), inset 0 0 70px 10px rgba(234,57,67,0.55);
}
body.stress-critical .stress-glow { animation: glowPulse 0.9s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ============================== DOCK ============================== */
.panel-dock {
  flex-direction: column;
  overflow: hidden;
  container: dock / inline-size;
}
.dock-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
  height: 38px;
  padding: 0 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.dock-tabs::-webkit-scrollbar { display: none; }
.dock-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.dock-tab i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--panel-3);
  padding: 1px 5px;
  border-radius: 8px;
  margin-inline-start: 3px;
  color: var(--text-2);
}
.dock-tab.active { color: var(--text); }
.dock-tab.active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.dock-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.dock-pane { display: none; padding: 10px; }
.dock-pane.active { display: block; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.empty svg { width: 34px; height: 34px; opacity: 0.4; }

/* position card */
.pos-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.pos-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-width: 0; }
.pos-card-head .sym { font-weight: 700; font-size: 14px; white-space: nowrap; }
.pos-card-head .lev { font-family: var(--font-mono); font-size: 11px; color: var(--accent); background: var(--accent-bg); padding: 2px 6px; border-radius: 4px; }
.pos-card-head .spacer { flex: 1; }
.pos-pnl { text-align: end; white-space: nowrap; }
.pos-pnl b { display: block; font-size: 16px; font-family: var(--font-mono); }
.pos-pnl span { font-size: 11px; font-family: var(--font-mono); }
.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-bottom: 10px;
}
.kv-grid div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kv-grid span { font-size: 10px; color: var(--muted); }
.kv-grid b { font-family: var(--font-mono); font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-actions { display: flex; gap: 6px; }
.pos-actions .btn-ghost { flex: 1 1 0; min-width: 0; }
.btn-danger { border-color: rgba(234,57,67,0.5) !important; color: var(--red) !important; }

/* list rows */
.row-list { display: flex; flex-direction: column; gap: 6px; }
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11.5px;
}
.list-row .l1 { display: flex; align-items: center; gap: 6px; font-weight: 600; min-width: 0; flex-wrap: wrap; }
.list-row .l2 { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .r { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 8px; text-align: end; }
.list-row .pnl { font-family: var(--font-mono); font-weight: 600; font-size: 12px; white-space: nowrap; }
.list-row .pnl small { display: block; font-size: 10px; font-weight: 500; }
.mini-btn {
  height: 26px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  background: var(--panel-3);
  white-space: nowrap;
}
.mini-btn:hover { color: var(--text); border-color: var(--muted); }
.mini-btn.share { color: var(--accent); border-color: rgba(240,185,11,0.4); }
.reason-tag { font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: var(--panel-3); color: var(--text-2); letter-spacing: 0.02em; white-space: nowrap; }
.reason-tag.mc { background: var(--red-bg); color: var(--red); }
.reason-tag.tp { background: var(--green-bg); color: var(--green); }
.reason-tag.sl { background: rgba(255,138,61,0.14); color: var(--orange); }
.list-toolbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }

@container dock (min-width: 640px) {
  .kv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pos-actions { justify-content: flex-end; }
  .pos-actions .btn-ghost { flex: 0 0 auto; width: 160px; }
}

/* ============================== SEASON ============================== */
.season-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
@container dock (min-width: 560px) {
  .season-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leaderboard-card { grid-column: 1 / -1; }
}
@container dock (min-width: 920px) {
  .season-grid { grid-template-columns: minmax(240px, 1fr) minmax(200px, 0.8fr) minmax(320px, 1.4fr); }
  .leaderboard-card { grid-column: auto; }
}
.season-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
}
.card-title { font-size: 12px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.rank-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; min-width: 0; }
.rank-name-lg { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.tier-progress-lg { height: 7px; margin-bottom: 12px; }
.season-timer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}
.season-timer b { font-size: 14px; color: var(--accent); }
.season-timer .muted { font-size: 11px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.stat-grid div { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 9px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-grid span { font-family: var(--font-ui); font-size: 10px; color: var(--muted); }
.stat-grid b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tier-ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tier-ladder li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  opacity: 0.55;
}
.tier-ladder li.reached { opacity: 1; }
.tier-ladder li.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(240,185,11,0.25); opacity: 1; }
.tier-ladder .rank-badge { width: 26px; height: 26px; font-size: 10.5px; }
.tier-ladder .t-name { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier-ladder .t-min { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.tier-ladder .t-check { color: var(--green); font-size: 12px; width: 14px; text-align: center; }

.live-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; font-weight: 800; color: var(--red); letter-spacing: 0.06em; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: blink 1.2s infinite; }
.lb-head, .lb-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 54px 96px;
  gap: 6px;
  align-items: center;
}
.lb-head { font-size: 10px; color: var(--muted); padding: 0 8px 6px; }
.lb-head span:nth-child(3), .lb-head span:nth-child(4) { text-align: end; }
.leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.lb-row {
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid transparent;
  font-size: 12px;
  transition: background 0.4s;
}
.lb-row.moved-up { animation: lbUp 1s ease-out; }
.lb-row.moved-down { animation: lbDown 1s ease-out; }
@keyframes lbUp { 0% { background: rgba(22,199,132,0.22); } 100% { background: var(--bg); } }
@keyframes lbDown { 0% { background: rgba(234,57,67,0.18); } 100% { background: var(--bg); } }
.lb-row.you { border-color: var(--accent); background: rgba(240,185,11,0.07); }
.lb-rank { font-family: var(--font-mono); font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 2px; }
.lb-rank .mv { font-size: 8px; }
.lb-rank .mv.up { color: var(--green); }
.lb-rank .mv.down { color: var(--red); }
.lb-row:nth-child(1) .lb-rank { color: #ffd54a; }
.lb-row:nth-child(2) .lb-rank { color: #d9dee8; }
.lb-row:nth-child(3) .lb-rank { color: #e0965a; }
.lb-name { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 600; }
.lb-name .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name .rank-badge { width: 18px; height: 18px; font-size: 8px; box-shadow: none; }
.lb-wr, .lb-eq { font-family: var(--font-mono); text-align: end; font-size: 11.5px; white-space: nowrap; }
.lb-wr { color: var(--text-2); }
.lb-sep { text-align: center; color: var(--muted); font-size: 11px; padding: 2px 0; list-style: none; }

/* ============================== BOTTOM NAV ============================== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(14, 18, 26, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.nav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  touch-action: manipulation;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-badge {
  position: absolute;
  top: 6px;
  inset-inline-start: calc(50% + 6px);
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #0b0e14;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
}

/* =====================================================================
   MOBILE & TABLET  (< 1024px) — single-pane views
   ===================================================================== */
@media (max-width: 1023px) {
  .layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: none;
    padding-bottom: calc(var(--actionbar-h) + var(--nav-h) + var(--safe-b));
  }
  .layout::-webkit-scrollbar { display: none; }
  body[data-view="orders"] .layout,
  body[data-view="season"] .layout { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }

  /* the right-column wrapper dissolves so its parts route individually */
  .side-col { display: contents; }
  .panel { border-bottom: 1px solid var(--border); }

  /* thumb-zone BUY / SELL bar, pinned above the nav (Trade + Chart views) */
  .action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--nav-h) + var(--safe-b));
    z-index: 99;
    padding: 8px 10px;
    background: rgba(11, 14, 20, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
  }
  body[data-view="orders"] .action-bar,
  body[data-view="season"] .action-bar { display: none; }

  /* 44px minimum tap targets for every ticket control */
  .seg-btn { height: 44px; font-size: 13px; }
  .input-wrap { height: 44px; }
  .input-wrap input { font-size: 16px; } /* >=16px also stops iOS focus-zoom */
  .pill { height: 44px; font-size: 13px; }
  .pills-xs .pill { height: 40px; font-size: 12px; }
  .tpsl-head { height: 44px; font-size: 13px; }
  .link-btn { padding: 6px 0; }
  .close-row { height: 44px; }
  .pos-exits .input-wrap, .pos-exits .btn-ghost { height: 44px; }
  .pos-exits .input-wrap input { font-size: 16px; }
  .btn-trade { height: 56px; font-size: 17px; }
  .field-label { font-size: 12px; }

  /* ---- [Trade]: chart 40vh + order ticket + risk card ---- */
  body[data-view="trade"] .panel-chart {
    display: flex;
    flex: 0 0 auto;
    height: calc(var(--m-chart, 40) * 1vh);
    height: calc(var(--m-chart, 40) * 1dvh);
    min-height: 220px;
  }
  body[data-view="trade"] .panel-ticket { display: block; flex: 0 0 auto; }
  body[data-view="trade"] .panel-account { display: block; flex: 0 0 auto; }

  /* ---- [Chart]: fullscreen chart ---- */
  body[data-view="chart"] .layout { overflow: hidden; }
  body[data-view="chart"] .panel-chart { display: flex; flex: 1 1 auto; border-bottom: 0; }

  /* ---- [Orders] / [Season]: fullscreen dock with internal scroll ---- */
  body[data-view="orders"] .layout,
  body[data-view="season"] .layout { overflow: hidden; }
  body[data-view="orders"] .panel-dock,
  body[data-view="season"] .panel-dock { display: flex; flex: 1 1 auto; border-bottom: 0; }
  body[data-view="season"] .dock-tabs { display: none; }
  body[data-view="orders"] .dock-tab-season { display: none; }
}

/* tablets: ticket and risk card side by side under the chart */
@media (min-width: 640px) and (max-width: 1023px) {
  body[data-view="trade"] .layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
  }
  body[data-view="trade"] .panel-chart { grid-column: 1 / -1; }
  body[data-view="trade"] .panel-ticket { grid-column: 1; grid-row: 2; border-inline-end: 1px solid var(--border); }
  body[data-view="trade"] .panel-account { grid-column: 2; grid-row: 2; }
  .rank-info { display: block; }
  .action-bar { padding-left: 16px; padding-right: 16px; }
}

@media (min-width: 460px) {
  .equity-mini { display: flex; }
}
@media (max-width: 359px) {
  .last-price { font-size: 13.5px; }
  .asset-select { padding-inline-end: 22px; font-size: 12px; }
  .btn-trade { font-size: 15px; }
}

/* =====================================================================
   DESKTOP TERMINAL  (>= 1024px)
   48px topbar · [chart + 220px dock | 240px order book | 320px execution column]
   ===================================================================== */
@media (min-width: 1024px) {
  :root {
    --topbar-h: 48px;
    --nav-h: 0px;
    --book-row-h: 18px;
  }
  body { height: 100vh; overflow: hidden; font-size: 12.5px; }

  .topbar { height: 48px; padding: 0 14px; gap: 14px; }
  .brand-mark { width: 26px; height: 26px; }
  .market { gap: 12px; }
  .asset-select { height: 30px; }
  .ticker { flex-direction: row; align-items: center; gap: 8px; }
  .last-price { font-size: 18px; }
  .chip { font-size: 11px; padding: 2px 6px; }
  .icon-btn, .lang-picker { height: 30px; }
  .icon-btn { width: 30px; }

  /* rank pill: badge + tier + progress in one rounded capsule */
  .rank-strip {
    height: 36px;
    padding: 0 12px 0 3px;
    gap: 8px;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--border);
  }
  .rank-strip:hover { border-color: var(--border-2); }
  .rank-ring { width: 30px; height: 30px; }
  .rank-ring .rank-badge { width: 26px; height: 26px; font-size: 11px; }
  .rank-info { display: block; width: 150px; }
  .rank-line { margin-bottom: 3px; }
  .tier-progress { height: 4px; }

  .layout {
    flex: 0 0 auto;
    height: calc(100vh - 48px);
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--book-w, 240px) 320px;
    grid-template-rows: minmax(0, 1fr) var(--dock-h, 220px);
    grid-template-areas:
      "chart book side"
      "dock  book side";
    gap: 1px;
    background: var(--border);   /* 1px #1e2533 rules between every pane */
    overflow: hidden;
    padding: 0;
  }

  .panel { display: flex; flex-direction: column; border: 0; }
  .panel-chart { grid-area: chart; }
  .panel-dock  { grid-area: dock; }
  .panel-book  { grid-area: book; }

  /* execution column: ticket → BUY/SELL → risk card pinned to the bottom.
     Sized to fit a 1080p screen; scrolls only as a fallback on short windows. */
  .side-col {
    grid-area: side;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    background: var(--panel);
  }
  .panel-ticket { display: block; flex: 0 0 auto; padding-bottom: 4px; }
  .action-bar { flex: 0 0 auto; padding: 8px 12px 12px; }
  .panel-account {
    display: block;
    flex: 0 0 auto;
    margin-top: auto;
    border-top: 1px solid var(--border);
  }

  .bottom-nav { display: none; }
  .stress-glow { box-shadow: inset 0 0 0 2px rgba(234,57,67,0.9), inset 0 0 110px 16px rgba(234,57,67,0.5); }
  .modal-root { padding: 24px; }
  .lang-picker svg { display: block; }
}

@media (min-width: 1180px) {
  .brand-name { display: inline; }
  .asset-name { display: inline-block; }
}

@media (min-width: 1360px) {
  .stats-24h { display: flex; }
}

@media (max-width: 399px) {
  .brand { display: none; } /* frees room for the language chip on small phones */
}

/* =====================================================================
   RIGHT-TO-LEFT (Hebrew, Arabic)
   Layout mirrors automatically via flex/grid + logical properties.
   These rules cover what can't be expressed logically. Charts stay LTR.
   ===================================================================== */
[dir="rtl"] body { letter-spacing: 0; }
[dir="rtl"] .mono { letter-spacing: 0; }
/* the brand lockup and prices read left-to-right in every language */
[dir="rtl"] .brand-name { direction: ltr; unicode-bidi: isolate; }
/* fills grow from the inline-start edge, so flip their color ramps */
[dir="rtl"] .tier-fill { background: linear-gradient(270deg, var(--tier-c, #cd7f32), var(--tier-c2, #f0b90b)); }
[dir="rtl"] .stress-fill {
  background-image: linear-gradient(270deg, #16c784 0%, #f0b90b 55%, #ff8a3d 75%, #ea3943 100%);
  background-position: right center;
}
[dir="rtl"] .ad-fill { background: linear-gradient(270deg, var(--accent), #ffe17a); }
/* numeric inputs stay LTR (dir="ltr") but sit at the RTL start edge, away from the unit label */
[dir="rtl"] .input-wrap input[dir="ltr"] { text-align: right; }
[dir="rtl"] .input-wrap input[dir="ltr"]::placeholder { direction: rtl; }
/* order-book depth bars grow from the mirrored edge */
[dir="rtl"] .book-row .depth { transform-origin: left center; }
/* directional icons */
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
/* Arabic script needs a touch more line height in dense UI */
[lang="ar"] body { line-height: 1.45; }
[lang="ar"] .btn-trade { letter-spacing: 0; }
[lang="he"] .btn-trade { letter-spacing: 0; }

/* ============================== TOASTS ============================== */
.toasts {
  position: fixed;
  top: calc(10px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(92vw, 380px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(26, 32, 48, 0.97);
  border: 1px solid var(--border-2);
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.7);
  font-size: 12.5px;
  font-weight: 500;
  animation: toastIn 0.28s cubic-bezier(.2,.9,.3,1.2);
}
.toast.out { animation: toastOut 0.22s ease-in forwards; }
.toast .t-ic { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }
.toast.success .t-ic { background: var(--green); }
.toast.error .t-ic { background: var(--red); }
.toast.warn .t-ic { background: var(--orange); }
.toast.gold { border-color: rgba(240,185,11,0.6); background: linear-gradient(135deg, rgba(60,46,8,0.97), rgba(26,32,48,0.97)); }
.toast.gold .t-ic { background: var(--accent); }
.toast .t-msg { flex: 1; min-width: 0; }
.toast .t-act { color: var(--accent); font-weight: 700; font-size: 12px; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(0.97); } }

/* ============================== MODALS ============================== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(16px + var(--safe-t));
  padding-bottom: calc(16px + var(--safe-b));
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 11, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.25s ease;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.85);
  animation: modalIn 0.32s cubic-bezier(.2,.9,.3,1.15);
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.95); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 14px; }

.mc-root .modal-backdrop { background: rgba(40, 4, 8, 0.55); }
.mc-modal {
  border-color: rgba(234,57,67,0.65);
  box-shadow: 0 0 0 1px rgba(234,57,67,0.25), 0 0 80px -10px rgba(234,57,67,0.55), 0 30px 80px -20px rgba(0,0,0,0.9);
}
.mc-stage { padding: 22px 20px 20px; text-align: center; }
.mc-siren {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: radial-gradient(circle, #ff4d57 0%, #b01822 70%);
  box-shadow: 0 0 0 0 rgba(234,57,67,0.7);
  animation: siren 1s infinite;
  display: grid;
  place-items: center;
}
.mc-siren span { width: 6px; height: 26px; background: #fff; border-radius: 3px; position: relative; top: -4px; }
.mc-siren span::after { content: ''; position: absolute; left: 0; bottom: -12px; width: 6px; height: 6px; background: #fff; border-radius: 50%; }
@keyframes siren { 0% { box-shadow: 0 0 0 0 rgba(234,57,67,0.7); } 70% { box-shadow: 0 0 0 22px rgba(234,57,67,0); } 100% { box-shadow: 0 0 0 0 rgba(234,57,67,0); } }
.mc-title {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--red);
  text-shadow: 0 0 24px rgba(234,57,67,0.5);
  animation: shake 0.5s 2;
}
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.mc-sub { margin: 0 0 12px; color: var(--text-2); font-size: 12.5px; }
.mc-loss { font-size: 26px; font-weight: 700; color: var(--red); }
.mc-detail { font-size: 11px; color: var(--muted); margin: 4px 0 14px; }
.mc-lock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 16px;
  padding: 9px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 12.5px;
}
.mc-lock svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }

.ad-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #1b1430, #0d2a2a 60%, #2a1f05);
  background-size: 200% 200%;
  animation: adBg 4s ease infinite;
  border: 1px solid var(--border-2);
  padding: 18px 14px;
  margin-bottom: 14px;
}
@keyframes adBg { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.ad-tag { position: absolute; top: 8px; inset-inline-start: 8px; font-size: 9px; font-weight: 800; padding: 2px 5px; border-radius: 3px; background: rgba(255,255,255,0.85); color: #000; }
.ad-art { position: relative; height: 90px; display: grid; place-items: center; }
.ad-orb { position: absolute; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(240,185,11,0.5), transparent 70%); animation: orb 2s ease-in-out infinite; }
@keyframes orb { 50% { transform: scale(1.25); opacity: 0.6; } }
.ad-art svg { position: relative; width: 140px; height: 70px; stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw 2.4s ease forwards infinite; }
@keyframes draw { 70%, 100% { stroke-dashoffset: 0; } }
.ad-copy { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ad-copy b { font-size: 20px; font-weight: 900; letter-spacing: -0.02em; }
.ad-copy span { color: var(--text-2); font-size: 12px; min-height: 16px; }
.ad-progress { height: 6px; border-radius: 6px; background: var(--panel-3); overflow: hidden; margin-bottom: 8px; }
.ad-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #ffe17a); border-radius: 6px; }
.ad-count { font-size: 12px; color: var(--muted); margin-bottom: 14px; }

.receipt-modal { max-width: 440px; }
.receipt-canvas-wrap { padding: 14px; display: flex; justify-content: center; background: var(--bg); }
.receipt-canvas-wrap canvas { width: 100%; max-width: 360px; height: auto; border-radius: 12px; display: block; }
.receipt-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 14px 14px; }
.receipt-actions .btn-ghost { width: auto; }
.receipt-actions .btn-primary { min-width: 0; padding: 0 10px; height: 34px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* =====================================================================
   ACCOUNTS · PROFILE · LEADERBOARD · ACHIEVEMENTS · TUTORIAL
   ===================================================================== */

/* ---------- avatars ---------- */
.av {
  --av: #f0b90b;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--av);
  background: radial-gradient(circle at 32% 26%, color-mix(in srgb, var(--av) 45%, #fff) 0%, var(--av) 58%, color-mix(in srgb, var(--av) 72%, #000) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 16px;
  line-height: 1;
  user-select: none;
}
.av-guest { background: var(--panel-3); color: var(--muted); }
.av-guest svg { width: 64%; height: 64%; }
.av-xs { width: 20px; height: 20px; font-size: 11px; }
.av-sm { width: 30px; height: 30px; font-size: 17px; }
.av-top { width: 30px; height: 30px; font-size: 17px; }
.av-lg { width: 52px; height: 52px; font-size: 29px; }
.av-xl { width: 68px; height: 68px; font-size: 38px; }
.tier-ring { box-shadow: 0 0 0 1.5px var(--tier-c2), inset 0 0 0 1px rgba(255, 255, 255, 0.14); }

.avatar-btn {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  transition: border-color 0.15s, transform 0.1s;
}
.avatar-btn:hover { border-color: var(--accent); }
.avatar-btn:active { transform: scale(0.95); }
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-btn .dot {
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--bg-2);
  animation: pulseDot 1.8s infinite;
}
/* sound + language live in Settings on phones */
@media (max-width: 1023px) {
  #soundBtn { display: none; }
}

/* small chips */
.cc {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--panel-3);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  letter-spacing: 0.04em;
}
.you-tag, .dev-tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  line-height: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.you-tag { background: var(--accent); color: #0b0e14; }
.dev-tag { background: rgba(76, 141, 255, 0.16); color: var(--blue); }
.lb-name .you-tag { margin-inline-start: 2px; flex-shrink: 0; }

/* chart: jump back to the live candle */
.to-latest {
  position: absolute;
  bottom: 30px;
  right: 70px;
  z-index: 6;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(26, 32, 48, 0.92);
  border: 1px solid var(--border-2);
  color: var(--text);
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.2s ease;
}
.to-latest:hover { border-color: var(--accent); color: var(--accent); }
.to-latest svg { width: 14px; height: 14px; }

/* season pane: "view all" under the top 10 */
.lb-all {
  width: 100%;
  margin-top: 8px;
  height: 34px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.lb-all:hover { border-color: var(--accent); color: var(--text); }
.lb-all .num { color: var(--accent); font-size: 12px; }
.lb-all-go { display: inline-flex; align-items: center; gap: 6px; }
.lb-all-go i { font-style: normal; font-size: 15px; line-height: 1; }

/* ---------- sheets (centered on desktop, bottom sheets on phones) ---------- */
.sheet {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.sheet-head { flex: 0 0 auto; gap: 10px; min-height: 52px; }
.sheet-head h2 { flex: 1 1 auto; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sheet-x { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; }
.auth-sheet { max-width: 440px; }
.profile-sheet { max-width: 540px; height: min(88vh, 860px); }
.lb-sheet { max-width: 780px; height: min(90vh, 900px); container: lbsheet / inline-size; }
.modal:focus { outline: none; }

@media (max-width: 1023px) {
  .sheet-root { align-items: flex-end; padding: 0; padding-top: calc(28px + var(--safe-t)); }
  .sheet-root .modal.sheet {
    max-width: none;
    width: 100%;
    max-height: 100%;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    padding-bottom: var(--safe-b);
    animation: sheetUp 0.32s cubic-bezier(.2, .9, .3, 1);
  }
  .sheet-root .profile-sheet, .sheet-root .lb-sheet { height: 100%; }
  .sheet-root .sheet::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 2px;
    background: var(--border-2);
    z-index: 3;
  }
  /* sign-in / welcome takes the whole phone screen */
  #authModal.sheet-root { padding-top: 0; }
  #authModal .auth-sheet { height: 100%; border-radius: 0; }
  #authModal .auth-sheet::before { display: none; }
  .sheet-x { top: calc(12px + var(--safe-t)); }
}
@keyframes sheetUp { from { transform: translateY(100%); } }

/* ---------- auth ---------- */
.auth-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 22px 22px 20px; display: flex; flex-direction: column; }
@media (max-width: 1023px) {
  .auth-body { padding: calc(22px + var(--safe-t)) 20px 20px; }
}
.auth-body[data-view="welcome"] { justify-content: center; text-align: center; min-height: 100%; }
.auth-hero { padding: 16px 0 6px; }
.auth-logo { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 20px; box-shadow: 0 12px 40px -10px rgba(240, 185, 11, 0.55); animation: logoIn 0.6s cubic-bezier(.2, .9, .3, 1.3); }
.auth-logo svg { width: 100%; height: 100%; display: block; border-radius: 20px; }
@keyframes logoIn { from { transform: scale(0.6) rotate(-8deg); opacity: 0; } }
.auth-brand { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: -0.03em; direction: ltr; unicode-bidi: isolate; }
.auth-brand b { color: var(--accent); margin-left: 2px; }
.auth-tag { margin: 10px 0 6px; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.auth-pitch { margin: 0 auto; max-width: 340px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.auth-tiers { display: flex; align-items: center; justify-content: center; gap: 0; margin: 18px 0 8px; direction: ltr; }
.auth-tiers .rank-badge { width: 32px; height: 32px; font-size: 12px; }
.auth-tiers i { width: 14px; height: 2px; background: linear-gradient(90deg, var(--border-2), var(--accent)); opacity: 0.6; }
.auth-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; width: 100%; max-width: 360px; align-self: center; }
.btn-tall { height: 46px; font-size: 14px; font-weight: 700; color: var(--text); }
.auth-guest { padding: 10px; font-size: 13px; color: var(--text-2); }
.auth-guest:hover { color: var(--text); }
.auth-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px 0 0; font-size: 11.5px; color: var(--muted); }
.auth-note svg { width: 13px; height: 13px; color: var(--accent); flex-shrink: 0; }

.auth-head { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding-inline-end: 40px; }
.auth-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.auth-form { display: flex; flex-direction: column; }
.fld { display: block; margin-bottom: 12px; min-width: 0; }
.fld-l { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.fld-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .fld-row { grid-template-columns: minmax(0, 1fr); gap: 0; } }
.auth-form .input-wrap { height: 44px; }
.auth-form .input-wrap input { font-family: var(--font-ui); font-weight: 500; font-size: 14.5px; font-variant-numeric: normal; }
.auth-form .input-wrap input::placeholder { font-size: 13px; }
.pfx { flex: 0 0 auto; padding-inline-start: 12px; color: var(--muted); font-weight: 700; }
.pfx + input { padding-inline-start: 3px; }
.eye { flex: 0 0 auto; height: 100%; padding: 0 12px; color: var(--muted); display: grid; place-items: center; }
.eye svg { width: 18px; height: 18px; }
.eye.on, .eye:hover { color: var(--accent); }
.sel {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 34px 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%237d8597' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center / 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
[dir="rtl"] .sel { padding: 0 12px 0 34px; background-position: left 12px center; }
.sel:focus { border-color: var(--accent); }
.sel option { background: var(--panel); color: var(--text); }
.sel-sm { width: auto; min-width: 130px; height: 34px; font-size: 13px; }
.chk { display: flex; align-items: flex-start; gap: 10px; margin: 2px 0 12px; font-size: 12.5px; color: var(--text-2); cursor: pointer; line-height: 1.45; }
.chk input { width: 18px; height: 18px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.form-err { min-height: 18px; margin: 0 0 10px; color: var(--red); font-size: 12.5px; font-weight: 600; }
.form-err:empty { min-height: 0; margin: 0; }
.form-err.shake { animation: shake 0.4s; }
.auth-form .btn-lg { margin-top: 4px; }
.auth-form .btn-primary:disabled { opacity: 0.6; cursor: progress; }
.auth-switch { margin: 14px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.auth-switch .link-btn { font-size: 12.5px; }

.auth-profiles { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.auth-profiles .eyebrow { margin-bottom: 2px; }
.prof-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  text-align: start;
}
.prof-pick:hover { border-color: var(--accent); }
.prof-pick span { display: flex; flex-direction: column; min-width: 0; }
.prof-pick b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-pick small { color: var(--muted); font-size: 11px; text-align: start; }

/* avatar picker */
.av-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.av-preview { flex: 0 0 auto; }
.av-opts { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.av-emojis { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.av-e {
  aspect-ratio: 1;
  min-height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 18px;
  line-height: 1;
  border: 1px solid transparent;
  transition: transform 0.1s, background 0.15s;
}
.av-e:hover { background: var(--panel-3); transform: scale(1.08); }
.av-e.on { background: var(--accent-bg); border-color: var(--accent); }
.av-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.av-c { width: 24px; height: 24px; border-radius: 50%; background: var(--av); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); transition: transform 0.1s; }
.av-c:hover { transform: scale(1.1); }
.av-c.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
@media (max-width: 460px) {
  .av-pick { flex-direction: column; }
  .av-emojis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .av-e { min-height: 40px; font-size: 21px; }
  .av-c { width: 30px; height: 30px; }
  .av-colors { justify-content: center; }
}

/* ---------- profile & settings ---------- */
.profile-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 22px; }
.profile-body > .btn-ghost { margin-bottom: 4px; }
.prof-card { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; min-width: 0; }
.prof-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prof-name { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-handle { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.prof-hint { color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.prof-tier { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.prof-tier .rank-badge { width: 20px; height: 20px; font-size: 8.5px; box-shadow: none; }
.prof-cta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 4px; }
.prof-cta .btn-primary { height: 46px; font-size: 14px; }
.p-sec { margin-top: 20px; }
.p-sec h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; }
.p-sec h3 .num { font-size: 11px; letter-spacing: 0; }
.pstat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .pstat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pstat-grid div { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 9px 10px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border); }
.pstat-grid span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pstat-grid b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 519px) { .pstat-grid div:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.streak-chip { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 6px; padding: 1px 7px; border-radius: 10px; background: rgba(255, 138, 61, 0.14); color: var(--orange); font-size: 11px; }
.streak-chip b { font-size: 11px; }

.ach-prog { height: 5px; border-radius: 5px; background: var(--panel-3); overflow: hidden; margin-bottom: 10px; }
.ach-prog i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--violet), var(--accent)); }
[dir="rtl"] .ach-prog i { background: linear-gradient(270deg, var(--violet), var(--accent)); }
.ach-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .ach-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ach {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
  min-width: 0;
}
.ach-ic {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-3);
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 21px;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.4;
  margin-bottom: 2px;
}
.ach b { font-size: 11.5px; line-height: 1.25; color: var(--text-2); }
.ach small { font-size: 10px; line-height: 1.3; color: var(--muted); }
.ach.on { border-color: rgba(167, 139, 250, 0.45); background: linear-gradient(180deg, rgba(167, 139, 250, 0.1), var(--bg)); }
.ach.on .ach-ic { filter: none; opacity: 1; background: radial-gradient(circle, rgba(240, 185, 11, 0.28), rgba(167, 139, 250, 0.18)); box-shadow: 0 0 18px -4px rgba(240, 185, 11, 0.6); }
.ach.on b { color: var(--text); }

.set-list { border-radius: 12px; border: 1px solid var(--border); background: var(--bg); overflow: hidden; }
.set-row {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: start;
}
.set-row + .set-row { border-top: 1px solid var(--border); }
.set-row > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-row small { font-size: 11px; font-weight: 500; color: var(--muted); }
.set-btn:hover { background: var(--panel-2); }
.set-btn.danger { color: var(--red); }
.chev { font-style: normal; font-size: 18px; color: var(--muted); line-height: 1; }
.switch {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 28px;
  border-radius: 14px;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  transition: background 0.2s, border-color 0.2s;
}
.switch i { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-2); transition: transform 0.2s cubic-bezier(.3, .9, .3, 1.2), background 0.2s; }
.switch[aria-checked="true"] { background: var(--green); border-color: var(--green); }
.switch[aria-checked="true"] i { background: #fff; transform: translateX(18px); }
[dir="rtl"] .switch[aria-checked="true"] i { transform: translateX(-18px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.small { font-size: 12px; line-height: 1.5; }
.p-sec .btn-danger { margin-top: 8px; }
.about-txt { margin: 10px 0 6px; font-size: 12px; line-height: 1.6; color: var(--text-2); }
.p-sec .btn-primary.btn-tall { width: 100%; }
@media (hover: none), (max-width: 1023px) { .keys-hint { display: none; } }

/* ---------- leaderboard sheet ---------- */
.lb-season { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px 0; }
.lb-season b { color: var(--accent); font-size: 13px; }
.podium {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  padding: 14px 16px 0;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}
.pod { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; text-align: center; }
.pod-av { position: relative; margin-bottom: 4px; }
.pod-medal {
  position: absolute;
  bottom: -4px;
  inset-inline-end: -4px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: #0b0e14;
  box-shadow: 0 0 0 2px var(--panel);
}
.pod-1 .pod-medal { background: linear-gradient(135deg, #ffe17a, #d49b0a); }
.pod-2 .pod-medal { background: linear-gradient(135deg, #f1f4f9, #8d97a8); }
.pod-3 .pod-medal { background: linear-gradient(135deg, #f0b27a, #b06a2b); }
.pod-1 .av-lg { width: 62px; height: 62px; font-size: 34px; box-shadow: 0 0 0 2px #ffd54a, 0 0 26px -4px rgba(255, 213, 74, 0.7); }
.pod-name { max-width: 100%; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod.you .pod-name { color: var(--accent); }
.pod-eq { font-size: 12px; font-weight: 700; }
.pod-pnl { font-size: 10.5px; font-weight: 600; }
.pod-step { width: 100%; margin-top: 6px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--panel-3), rgba(26, 32, 48, 0)); }
.pod-1 .pod-step { height: 30px; background: linear-gradient(180deg, rgba(240, 185, 11, 0.28), rgba(240, 185, 11, 0)); }
.pod-2 .pod-step { height: 20px; }
.pod-3 .pod-step { height: 12px; }
.lb-tools { flex: 0 0 auto; padding: 4px 16px 10px; border-bottom: 1px solid var(--border); }
.search-wrap { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border); cursor: text; }
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.search-wrap input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; color: var(--text); font-size: 14px; }
.search-wrap input::-webkit-search-cancel-button { filter: invert(0.6); }

.lbt { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.lbt-head, .lbt-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px 92px 74px 62px 58px;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
}
.lbt-head { flex: 0 0 auto; height: 34px; font-size: 10.5px; color: var(--muted); font-weight: 600; background: var(--panel); border-bottom: 1px solid var(--border); }
.lbt-head > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbt-head button { height: 100%; font-size: 10.5px; font-weight: 600; color: var(--muted); text-align: inherit; }
.lbt-head button:hover, .lbt-head button.on { color: var(--text); }
.lbt-head i { font-style: normal; font-size: 8px; margin-inline-start: 3px; color: var(--accent); }
.lbt-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 8px; }
.lbt-row { min-height: 50px; border-bottom: 1px solid rgba(30, 37, 51, 0.6); font-size: 12px; }
.lbt-row:hover { background: rgba(255, 255, 255, 0.02); }
.lbt-row.you { background: rgba(240, 185, 11, 0.08); box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .lbt-row.you { box-shadow: inset -3px 0 0 var(--accent); }
.lbt-row.flash { animation: rowFlash 1.4s ease-out; }
@keyframes rowFlash { 0%, 30% { background: rgba(240, 185, 11, 0.32); } }
.lbt-row.moved-up { animation: lbUp 1s ease-out; }
.lbt-row.moved-down { animation: lbDown 1s ease-out; }
.c-rank { font-family: var(--font-mono); font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 3px; }
.c-rank .mv { font-size: 8px; }
.c-rank .mv.up, .lb-rank .mv.up { color: var(--green); }
.c-rank .mv.down, .lb-rank .mv.down { color: var(--red); }
.top1 .c-rank { color: #ffd54a; }
.top2 .c-rank { color: #d9dee8; }
.top3 .c-rank { color: #e0965a; }
.c-trader { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tr-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tr-id b { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-id small { display: flex; gap: 4px; align-items: center; min-height: 14px; }
.c-tier .rank-badge { width: 24px; height: 24px; font-size: 9px; box-shadow: none; }
.c-eq, .c-pnl, .c-wr, .c-tr, .lbt-head .c-eq, .lbt-head .c-pnl, .lbt-head .c-wr, .lbt-head .c-tr { text-align: end; justify-content: flex-end; }
.c-eq { font-weight: 700; }
.c-wr, .c-tr { color: var(--text-2); }
.lbt-empty { padding: 30px 16px; text-align: center; color: var(--muted); }
.lb-me {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin: 8px 12px 0;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(240, 185, 11, 0.5);
  background: linear-gradient(135deg, rgba(240, 185, 11, 0.14), rgba(26, 32, 48, 0.9));
  text-align: start;
}
.lb-me:hover { border-color: var(--accent); }
.me-rank { display: flex; flex-direction: column; min-width: 0; }
.me-rank small { font-size: 10px; color: var(--muted); }
.me-rank b { font-size: 14px; }
.me-eq { font-weight: 700; font-size: 13px; }
.me-pnl { font-size: 12px; font-weight: 600; }
.lb-note { flex: 0 0 auto; margin: 8px 16px 12px; font-size: 10.5px; line-height: 1.45; color: var(--muted); text-align: center; }
@container lbsheet (max-width: 620px) {
  .lbt-head, .lbt-row { grid-template-columns: 38px minmax(0, 1fr) 84px 66px 54px; gap: 6px; padding: 0 12px; }
  .lbt-head .c-tier, .lbt-row .c-tier, .lbt-head .c-tr, .lbt-row .c-tr { display: none; }
}
@container lbsheet (max-width: 400px) {
  .lbt-head, .lbt-row { grid-template-columns: 34px minmax(0, 1fr) 80px 60px; }
  .lbt-head .c-wr, .lbt-row .c-wr { display: none; }
}

/* ---------- confirm dialog ---------- */
.confirm-root { z-index: 230; }
.confirm-modal { max-width: 380px; padding: 18px 18px 16px; }
.cf-title { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.cf-body { font-size: 13px; line-height: 1.55; color: var(--text-2); margin-bottom: 14px; }
.cf-sum { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.cf-rows { margin: 0; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); overflow: hidden; }
.cf-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 12.5px; }
.cf-rows div + div { border-top: 1px solid var(--border); }
.cf-rows dt { color: var(--muted); }
.cf-rows dd { margin: 0; font-weight: 600; color: var(--text); white-space: nowrap; }
.cf-input { height: 44px; margin-bottom: 8px; }
.cf-input input { font-family: var(--font-ui); font-size: 15px; font-weight: 500; }
.cf-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cf-actions .btn-primary { height: 46px; font-size: 14px; }
.tone-buy { background: linear-gradient(180deg, #22dc97, #16c784 55%, #0fa86e); color: #fff; }
.tone-sell, .tone-danger { background: linear-gradient(180deg, #f45a64, #ea3943 55%, #c92a34); color: #fff; }

/* ---------- achievement toast ---------- */
.toast.ach { border-color: rgba(167, 139, 250, 0.65); background: linear-gradient(135deg, rgba(44, 28, 84, 0.97), rgba(26, 32, 48, 0.97)); box-shadow: 0 12px 34px -10px rgba(124, 77, 255, 0.6); }
.toast .t-emoji { flex-shrink: 0; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-size: 24px; line-height: 1; animation: achPop 0.6s cubic-bezier(.2, .9, .3, 1.6); }
@keyframes achPop { from { transform: scale(0.2) rotate(-30deg); } }
.toast .t-title { display: block; font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--violet); }
.toast .t-body { display: block; font-size: 13.5px; font-weight: 700; }

/* ---------- tutorial ---------- */
.tour { position: fixed; inset: 0; z-index: 240; }
.tour-spot {
  position: fixed;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(5, 7, 11, 0.74), 0 0 0 2px var(--accent), 0 0 30px 4px rgba(240, 185, 11, 0.35);
  transition: top 0.35s cubic-bezier(.2, .8, .2, 1), left 0.35s cubic-bezier(.2, .8, .2, 1), width 0.35s cubic-bezier(.2, .8, .2, 1), height 0.35s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}
.tour-card {
  position: fixed;
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.9);
  transition: top 0.35s cubic-bezier(.2, .8, .2, 1), left 0.35s cubic-bezier(.2, .8, .2, 1);
  animation: modalIn 0.3s cubic-bezier(.2, .9, .3, 1.15);
}
.tour-card h3 { margin: 8px 0 4px; font-size: 15px; font-weight: 800; }
.tour-card p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--border-2); transition: width 0.25s, background 0.25s; }
.tour-dots i.done { background: rgba(240, 185, 11, 0.5); }
.tour-dots i.on { width: 18px; background: var(--accent); }
.tour-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.tour-actions .link-btn { color: var(--muted); font-size: 12.5px; }
.tour-actions .btn-primary { min-width: 96px; }

.mc-root { z-index: 250; }

/* =====================================================================
   ARENA FEED · COACH · SEASON GEMS · XP & QUESTS
   ===================================================================== */
.sim-toggle.arena { border-color: rgba(240, 185, 11, 0.45); color: var(--accent); background: var(--accent-bg); cursor: default; opacity: 1; }
.sim-toggle:disabled { cursor: default; }
.conn-dot.arena { background: var(--accent); box-shadow: 0 0 0 0 rgba(240, 185, 11, 0.5); animation: pulseGold 1.8s infinite; }
@keyframes pulseGold { 0% { box-shadow: 0 0 0 0 rgba(240, 185, 11, 0.55); } 70% { box-shadow: 0 0 0 6px rgba(240, 185, 11, 0); } 100% { box-shadow: 0 0 0 0 rgba(240, 185, 11, 0); } }
.asset-select optgroup { background: var(--panel); color: var(--muted); font-style: normal; font-weight: 700; }

/* coach bubble on the chart */
.coach {
  position: absolute;
  left: 8px;
  bottom: 30px;
  z-index: 7;
  max-width: min(78%, 460px);
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(20, 25, 38, 0.95);
  border: 1px solid rgba(167, 139, 250, 0.55);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.45;
  text-align: start;
  direction: inherit;
}
.chart-stack .coach { direction: ltr; }
[dir="rtl"] .chart-stack .coach { direction: rtl; }
.coach.in { animation: coachIn 0.35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes coachIn { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
.coach-ic { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-size: 15px; line-height: 1.2; }
.coach-k { font-weight: 800; color: var(--violet); white-space: nowrap; }
@media (max-width: 1023px) { .coach { bottom: 26px; font-size: 11.5px; max-width: 88%; } }

/* ---------- gems & trophies ---------- */
.gem { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)); }
.trophy {
  --ring: var(--border-2);
  position: relative;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #1d2436, #0d1118);
  box-shadow: 0 0 0 2px var(--ring), inset 0 0 8px rgba(0, 0, 0, 0.6);
  vertical-align: middle;
}
.tr-champion { --ring: #f0b90b; box-shadow: 0 0 0 2px #f0b90b, 0 0 14px -2px rgba(255, 213, 74, 0.8), inset 0 0 8px rgba(0, 0, 0, 0.6); }
.tr-champion::after { content: '👑'; position: absolute; top: -0.62em; left: 50%; transform: translateX(-50%); font-size: 0.5em; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.tr-podium { --ring: #cfd6e2; }
.tr-top10 { --ring: #c0844a; }
.tr-finisher { --ring: #39425a; }
.tr-none { --ring: #2a3245; opacity: 0.55; filter: grayscale(0.4); }
.tb-xs { width: 16px; height: 16px; padding: 2px; font-size: 16px; box-shadow: 0 0 0 1.5px var(--ring); }
.tb-xs.tr-champion { box-shadow: 0 0 0 1.5px #f0b90b, 0 0 8px -1px rgba(255, 213, 74, 0.8); }
.tb-sm { width: 30px; height: 30px; font-size: 30px; }
.tb-md { width: 44px; height: 44px; padding: 8px; font-size: 44px; }
.tb-xl { width: 96px; height: 96px; padding: 18px; font-size: 96px; box-shadow: 0 0 0 3px var(--ring), 0 0 40px -6px var(--ring), inset 0 0 18px rgba(0, 0, 0, 0.6); }
.tb-xl.tr-champion { box-shadow: 0 0 0 3px #f0b90b, 0 0 50px -4px rgba(255, 213, 74, 0.9), inset 0 0 18px rgba(0, 0, 0, 0.6); }
.lb-name .trophy, .tr-id .trophy { margin-inline-start: 2px; }

/* season card: return + gem */
.season-roi {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(240, 185, 11, 0.1), rgba(26, 32, 48, 0.4));
  border: 1px solid rgba(240, 185, 11, 0.3);
}
.season-roi > span:first-child { font-size: 11px; color: var(--text-2); font-weight: 600; }
.season-roi b { font-size: 18px; font-weight: 800; }
.season-roi #stPlace { margin-inline-start: auto; font-size: 11.5px; }
.season-name-row { display: inline-flex; align-items: center; gap: 6px; }
.season-gem { width: 16px; height: 16px; display: inline-block; }
.lb-eq.up { color: var(--green); }
.lb-eq.down { color: var(--red); }
.tab-dot { display: inline-block; width: 7px; height: 7px; margin-inline-start: 6px; border-radius: 50%; background: var(--red); vertical-align: middle; animation: pulseDot 1.8s infinite; }

/* ---------- XP & quests ---------- */
.lvl-row, .prof-lvl { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.prof-lvl { margin: -2px 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.lvl-badge {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #a78bfa, #6d4dff);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 6px 16px -6px rgba(124, 77, 255, 0.8);
}
.lvl-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.lvl-txt b { font-size: 12.5px; }
.lvl-bar { height: 6px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.lvl-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #a78bfa, #f0b90b); transition: width 0.5s cubic-bezier(.2, .8, .2, 1); }
[dir="rtl"] .lvl-bar i { background: linear-gradient(270deg, #a78bfa, #f0b90b); }
.lvl-xp { flex-shrink: 0; font-size: 10.5px; color: var(--muted); }
.q-reset { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.quest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.quest {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.quest.done:not(.claimed) { border-color: rgba(240, 185, 11, 0.6); background: linear-gradient(135deg, rgba(240, 185, 11, 0.12), var(--bg)); animation: questGlow 1.6s ease-in-out infinite; }
@keyframes questGlow { 50% { box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.12); } }
.quest.claimed { opacity: 0.55; }
.q-ic { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-size: 18px; line-height: 1; }
.q-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.q-main b { font-size: 12px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-bar { height: 4px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.q-bar i { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.quest.done .q-bar i { background: var(--accent); }
.q-prog { font-size: 10.5px; color: var(--text-2); white-space: nowrap; }
.q-xp { font-size: 10.5px; font-weight: 700; color: var(--violet); white-space: nowrap; }
.q-ok { color: var(--green); font-weight: 800; font-size: 14px; }
.q-claim {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--accent);
  color: #0b0e14;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.q-claim:hover { filter: brightness(1.08); }
@media (max-width: 1023px) { .q-claim { height: 36px; padding: 0 12px; font-size: 12px; } .quest { padding: 10px 12px; } }

/* topbar avatar: level chip */
.avatar-btn .lvl-chip {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 18px;
  height: 14px;
  padding: 0 4px;
  border-radius: 7px;
  background: linear-gradient(135deg, #a78bfa, #6d4dff);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  font-style: normal;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-2);
}
.xp-float {
  position: fixed;
  z-index: 320;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, #a78bfa, #6d4dff);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
  animation: xpFloat 1.4s ease-out forwards;
}
@keyframes xpFloat { 0% { opacity: 0; transform: translate(-50%, 6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, 34px); } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 310; pointer-events: none; }

/* avatar picker: level-locked premium avatars */
.av-e.locked { position: relative; filter: grayscale(1); opacity: 0.4; }
.av-e.locked i { position: absolute; bottom: 1px; inset-inline-end: 2px; font-style: normal; font-family: var(--font-mono); font-size: 8.5px; font-weight: 800; color: var(--text); }
.av-e.locked:hover { transform: none; }

/* leaderboard sheet: season gem + prize */
.lb-season-name { display: inline-flex; align-items: center; gap: 7px; }
.lb-season-name .gem { width: 18px; height: 18px; }
.lb-prize { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 16px 0; font-size: 11.5px; color: var(--text-2); font-weight: 600; text-align: center; }

/* profile: season gems cabinet */
.trophy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.trophy-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); min-width: 0; }
.trophy-card > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.trophy-card b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trophy-card small { font-size: 11px; color: var(--muted); }
.trophy-empty { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--border-2); }
.trophy-empty p { margin: 0; }

/* season results sheet */
.season-root { z-index: 225; }
.season-modal { max-width: 400px; padding: 26px 22px 20px; text-align: center; background: radial-gradient(circle at 50% 0%, rgba(240, 185, 11, 0.16), transparent 55%), var(--panel); }
.se-hero { display: flex; justify-content: center; margin: 8px 0 16px; animation: logoIn 0.7s cubic-bezier(.2, .9, .3, 1.3); }
.se-title { margin: 0 0 6px; font-size: 19px; font-weight: 900; letter-spacing: -0.01em; }
.se-place { margin: 0 0 12px; font-size: 14px; color: var(--text-2); font-weight: 600; }
.se-roi { display: inline-flex; align-items: baseline; gap: 8px; margin-bottom: 14px; padding: 8px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.se-roi span { font-size: 11.5px; color: var(--muted); }
.se-roi b { font-size: 20px; }
.se-reward { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px; border-radius: 12px; background: linear-gradient(135deg, rgba(167, 139, 250, 0.14), rgba(240, 185, 11, 0.1)); border: 1px solid rgba(167, 139, 250, 0.4); }
.se-reward .eyebrow { width: 100%; }
.se-reward b { font-size: 13px; }
.xp-pill { padding: 2px 8px; border-radius: 10px; background: linear-gradient(135deg, #a78bfa, #6d4dff); color: #fff; font-size: 11px; font-weight: 800; font-family: var(--font-mono); }
.se-next { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); text-align: start; line-height: 1.45; }
.se-next .gem { width: 28px; height: 28px; flex-shrink: 0; }

/* numbers + "XP" stay in left-to-right order inside Hebrew / Arabic text */
.q-xp, .lvl-xp, .xp-pill, .xp-float, .q-prog, .season-roi b, .me-pnl { direction: ltr; unicode-bidi: isolate; }

/* =====================================================================
   LAYOUT CONTROL · HELP · RISK PREVIEW · CONNECTION GATE · REFILL
   ===================================================================== */
.chart-rsi { position: relative; }
body.no-rsi .chart-rsi { display: none; }
.ic-shrink { display: none; }
body.chart-focus .ic-expand { display: none; }
body.chart-focus .ic-shrink { display: block; }

/* drag handles between panels (desktop) */
.split { position: absolute; z-index: 8; touch-action: none; }
.split::after { content: ''; position: absolute; background: var(--accent); opacity: 0; transition: opacity 0.15s; border-radius: 2px; }
.split:hover::after, body.resizing .split:active::after { opacity: 0.8; }
.split-h { left: 0; right: 0; top: 0; height: 8px; cursor: row-resize; }
.split-h::after { left: 0; right: 0; top: 0; height: 2px; }
.split-v { top: 0; bottom: 0; inset-inline-start: 0; width: 8px; cursor: col-resize; }
.split-v::after { top: 0; bottom: 0; inset-inline-start: 0; width: 2px; }
.panel-book, .panel-dock { position: relative; }
body.resizing, body.resizing * { user-select: none !important; }
body.resizing iframe, body.resizing canvas { pointer-events: none; }
/* phone: grab bar under the chart in the Trade view */
.split-m { display: none; }

@media (max-width: 1023px) {
  #splitBook, #splitDock { display: none; }
  body[data-view="trade"] .split-m {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 18px;
    margin-top: -1px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    cursor: row-resize;
    touch-action: none;
  }
  .split-m i { width: 42px; height: 4px; border-radius: 2px; background: var(--border-2); }
  .split-m:active i { background: var(--accent); }
  body[data-view="trade"] .panel-chart { border-bottom: 0; }
  .layout-menu .desk-only { display: none; }
  /* full screen chart on phones: no top bar, no navigation */
  body.chart-focus .topbar, body.chart-focus .bottom-nav, body.chart-focus .action-bar, body.chart-focus .net-banner { display: none !important; }
  body.chart-focus .layout { padding-bottom: var(--safe-b); }
  body.chart-focus .panel-chart { padding-top: var(--safe-t); }
}

@media (min-width: 1024px) {
  body.no-book .layout { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "chart side" "dock side"; }
  body.no-book .panel-book { display: none; }
  body.no-dock .layout { grid-template-rows: minmax(0, 1fr); grid-template-areas: "chart book side"; }
  body.no-dock .panel-dock { display: none; }
  body.no-book.no-dock .layout { grid-template-areas: "chart side"; }
  body.chart-focus .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "chart"; }
  body.chart-focus .panel-book, body.chart-focus .side-col, body.chart-focus .panel-dock { display: none; }
  body.offline .layout { height: calc(100vh - 48px - 34px); }
}

/* layout menu */
.layout-menu {
  position: fixed;
  z-index: 260;
  padding: 12px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.85);
  animation: modalIn 0.2s ease;
}
.lm-title { font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.lm-sec { margin-bottom: 8px; }
.lm-sec .eyebrow { margin: 6px 0 4px; }
.lm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; font-size: 12.5px; font-weight: 600; }
.lm-row .switch { width: 40px; height: 24px; }
.lm-row .switch i { width: 16px; height: 16px; }
.lm-row .switch[aria-checked="true"] i { transform: translateX(16px); }
[dir="rtl"] .lm-row .switch[aria-checked="true"] i { transform: translateX(-16px); }
.lm-hint { margin: 6px 0 10px; font-size: 11px; color: var(--muted); line-height: 1.45; }
.desk-only { }
@media (max-width: 1023px) { .lm-row { min-height: 44px; } }

/* "?" help buttons + popover */
.help-btn {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}
.help-btn:hover, .help-btn:focus-visible { color: var(--accent); border-color: var(--accent); }
@media (max-width: 1023px) {
  .help-btn { width: 24px; height: 24px; font-size: 12px; }
  .help-btn::before { content: ''; position: absolute; inset: -10px; }
  .help-btn { position: relative; }
}
.fl-help { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.seg-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.seg-row .seg { flex: 1 1 auto; margin-bottom: 0; }
.tpsl { position: relative; }
.tpsl > .help-btn { position: absolute; top: 8px; inset-inline-end: 32px; z-index: 1; }
.tpsl-head { padding-inline-end: 56px; }
@media (max-width: 1023px) { .tpsl > .help-btn { top: 10px; } }
.help-pop {
  position: fixed;
  z-index: 330;
  display: flex;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 12px;
  background: #1f2638;
  border: 1px solid rgba(240, 185, 11, 0.45);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.85);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  animation: modalIn 0.18s ease;
}
.help-ic { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }

/* risk preview under the ticket math */
.risk-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  margin: -4px 0 12px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px dashed var(--border-2);
  font-size: 11.5px;
  color: var(--text-2);
  text-align: center;
}
.risk-preview i { font-style: normal; color: var(--muted); }

/* refill card (replaces BUY / SELL when the balance is empty) */
.refill-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(240, 185, 11, 0.55);
  background: linear-gradient(135deg, rgba(240, 185, 11, 0.14), rgba(26, 32, 48, 0.9));
}
.refill-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.refill-txt b { font-size: 13px; }
.refill-txt span { font-size: 11px; color: var(--text-2); line-height: 1.4; }
.refill-card .btn-primary { flex: 0 0 auto; height: 44px; padding: 0 14px; font-size: 12.5px; white-space: normal; max-width: 52%; line-height: 1.2; }
@media (max-width: 400px) { .refill-card { flex-direction: column; align-items: stretch; } .refill-card .btn-primary { max-width: none; } }

/* connection gate */
.net-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px;
  background: linear-gradient(90deg, rgba(234, 57, 67, 0.22), rgba(234, 57, 67, 0.12));
  border-bottom: 1px solid rgba(234, 57, 67, 0.5);
  color: #ffb4b9;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}
.net-banner svg { width: 18px; height: 18px; flex-shrink: 0; }
body.offline .btn-trade { filter: grayscale(0.8); }

/* =====================================================================
   CALM THEME — chart first, flat surfaces, quiet controls, one accent.
   Separation comes from 1px lines and spacing, not from boxes and colors.
   ===================================================================== */
.mono, .num { letter-spacing: 0; font-feature-settings: 'tnum' 1; }
body { font-size: 13px; }

/* top bar */
.topbar { background: var(--bg); }
.asset-name { display: none !important; }
.asset-select { background: transparent; border-color: transparent; font-size: 14px; }
.asset-select:hover { background: var(--panel-2); }
.chip { background: none !important; padding: 0 !important; font-weight: 600; }
.chip-flat { color: var(--muted); }
.last-price { font-weight: 600; }
.last-price.flash-up, .last-price.flash-down { animation: none; }
.icon-btn, .lang-picker, .avatar-btn { background: transparent; border-color: transparent; }
.icon-btn:hover, .lang-picker:hover, .avatar-btn:hover { background: var(--panel-2); border-color: transparent; }
.stats-24h b { font-weight: 500; color: var(--text-2); }
@media (min-width: 1024px) {
  .rank-strip { background: transparent; border-color: transparent; }
  .rank-strip:hover { background: var(--panel-2); }
}

/* chart toolbar: icons and words, no boxes */
.tf-pick { background: transparent; border-color: transparent; color: var(--text); }
.tf-pick:hover { background: var(--panel-2); }
.tf-label { font-family: var(--font-ui); font-weight: 600; }
.tool-btn { background: transparent; border-color: transparent; color: var(--text-2); font-weight: 500; }
.tool-btn:hover { background: var(--panel-2); border-color: transparent; color: var(--text); }
.tool-btn.active { background: var(--panel-3); border-color: transparent; color: var(--text); }
.tool-btn.active svg { color: var(--accent); }
.sim-toggle, .sim-toggle.sim, .sim-toggle.arena { background: transparent !important; border-color: transparent !important; color: var(--text-2); }
.conn-dot.live, .conn-dot.arena, .conn-dot.connecting { animation: none; }
.conn-dot.arena { background: var(--green); }

/* chart overlays */
.legend { font-family: var(--font-ui); font-size: 11.5px; color: var(--text-2); text-shadow: none; top: 8px; left: 10px; line-height: 1.6; }
.legend .lg-row { gap: 0 12px; align-items: baseline; }
.legend .lg-title { font-weight: 600; color: var(--text); }
.legend .lg-k { color: var(--muted); margin-right: 4px; }
.legend .lg-ohlc .lg-k { margin-left: 2px; }
.legend .up { color: var(--green); }
.legend .down { color: var(--red); }
.legend .lg-ema { color: #f0b90b; }
.legend .lg-sma20 { color: #c77ddb; }
.legend .lg-sma50 { color: #ff8a65; }
.chart-rsi { border-top-color: var(--border); }

/* order book (when shown) */
.book-asks .depth { background: rgba(239, 83, 80, 0.08); }
.book-bids .depth { background: rgba(38, 166, 154, 0.08); }
.book-row { font-family: var(--font-ui); }
.book-mid { font-family: var(--font-ui); }

/* order ticket: flat controls */
.panel-ticket { padding: 14px; }
.seg { background: var(--panel-2); border-color: transparent; }
.seg-btn { font-weight: 500; }
.seg-btn.active { background: var(--panel-3); box-shadow: none; font-weight: 600; }
.field-label { color: var(--text-2); }
#levValue { color: var(--text); }
.pill { border-color: transparent; background: var(--panel-2); font-family: var(--font-ui); font-weight: 500; color: var(--text-2); }
.pill:hover { border-color: transparent; background: var(--panel-3); color: var(--text); }
.pill.active { border-color: transparent; background: var(--panel-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
[data-target="tpInput"] .pill:hover, [data-target="slInput"] .pill:hover { border-color: transparent; }
.input-wrap { background: var(--panel-2); border-color: transparent; }
.input-wrap:focus-within, .input-tp:focus-within, .input-sl:focus-within { border-color: var(--border-2); box-shadow: none; }
.input-wrap input { font-family: var(--font-ui); font-weight: 600; }
.ticket-calc { border: 0; background: transparent; padding: 0 2px; margin-bottom: 8px; }
.ticket-calc b { font-weight: 600; color: var(--text); }
.risk-preview { border: 0; background: transparent; padding: 0; margin: 0 0 12px; color: var(--muted); font-size: 11.5px; }
.tpsl { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; }
.tpsl-head { padding-inline-start: 0; color: var(--text-2); }
.tpsl-body { padding-inline: 0; }
.tpsl-summary { color: var(--text-2); }
.help-btn { border: 0; background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-2); width: 16px; height: 16px; font-size: 10px; font-weight: 700; }
.help-btn:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--muted); }
.link-btn { color: var(--text-2); }

/* BUY / SELL: flat, no glow */
.btn-trade { border-radius: 6px; font-weight: 700; letter-spacing: 0.02em; }
.btn-buy { background: var(--green); box-shadow: none; }
.btn-sell { background: var(--red); box-shadow: none; }
.btn-trade:hover:not(:disabled) { filter: brightness(1.07); }
.btn-trade small { font-weight: 500; opacity: 0.9; }
.close-row { border-color: var(--border); }

/* account card */
.panel-account .panel-head h2, .panel-book .panel-head h2 { font-weight: 600; color: var(--text-2); }
.acct-grid b { font-weight: 600; }
.stress-track { height: 4px !important; }

/* bottom panel */
.dock-tab { font-weight: 500; }
.dock-tab.active { font-weight: 600; }
.dock-tab i { background: transparent; color: var(--muted); padding: 0 2px; }
.dock-tab.active::after { background: var(--text); }
.empty { font-size: 12px; }
.empty svg { opacity: 0.22; }
.dock-min-btn { flex: 0 0 auto; margin-inline-start: auto; width: 32px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; }
.dock-min-btn:hover { color: var(--text); background: var(--panel-2); }
.dock-min-btn svg { width: 16px; height: 16px; transition: transform 0.2s; }
body.dock-min .dock-min-btn svg { transform: rotate(180deg); }
@media (max-width: 1023px) { .dock-min-btn { display: none; } }
@media (min-width: 1024px) {
  body.dock-min .layout { grid-template-rows: minmax(0, 1fr) 38px; }
  body.dock-min.no-book .layout { grid-template-rows: minmax(0, 1fr) 38px; }
  body.dock-min .dock-body, body.dock-min #splitDock { display: none; }
  body.dock-min .dock-tabs { border-bottom: 0; }
}

/* less motion */
.quest.done:not(.claimed) { animation: none; }
.live-pill i { animation: none; }
.tier-fill { transition: none; }

/* phones: the coach is a compact two-line note at the bottom of the chart */
@media (max-width: 1023px) {
  .coach { left: 6px; right: 6px; max-width: none; bottom: 24px; padding: 6px 9px; gap: 6px; font-size: 11px; line-height: 1.35; }
  .coach #coachText { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .coach-k { display: none; }
}

/* =====================================================================
   TRADINGVIEW-STYLE WORKSPACE (v3.4)
   drawing toolbar · chart toolbar · footer ranges · icon rail · watchlist · alerts
   ===================================================================== */
:root { --tv-blue: #2962ff; --tv-blue-2: #5b8cff; --tv-blue-bg: rgba(41, 98, 255, 0.15); }

/* chart body: [drawing tools | chart + footer] */
.chart-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.chart-col { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.draw-bar {
  flex: 0 0 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: none;
}
.draw-bar::-webkit-scrollbar { display: none; }
.db-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s;
}
.db-btn svg { width: 26px; height: 26px; }
.db-btn:hover { background: var(--panel-2); color: var(--text); }
.db-btn.active { background: var(--tv-blue-bg); color: var(--tv-blue-2); }
.db-btn:disabled { opacity: 0.35; pointer-events: none; }
.db-sep { flex: 0 0 auto; width: 24px; height: 1px; margin: 5px 0; background: var(--border-2); }
#hideDrawBtn .ic-eye-off, #hideDrawBtn.active .ic-eye { display: none; }
#hideDrawBtn.active .ic-eye-off { display: block; }

/* top chart toolbar */
.chart-toolbar { gap: 4px; padding: 0 4px; }
.tb-left { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.tb-sep { flex: 0 0 1px; width: 1px; height: 20px; margin: 0 4px; background: var(--border-2); }
.chart-toolbar .tool-btn { height: 30px; padding: 0 7px; font-size: 12.5px; font-weight: 500; }
.chart-toolbar .tool-btn svg { width: 18px; height: 18px; }
.chart-toolbar .tool-btn:disabled { opacity: 0.35; }
.tf-quick { display: none; align-items: center; gap: 1px; }
.tfq {
  height: 30px;
  min-width: 30px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.tfq:hover { background: var(--panel-2); color: var(--text); }
.tfq.on { color: var(--tv-blue-2); background: var(--tv-blue-bg); }
.tf-pick { height: 30px; }
.tb-ct { gap: 1px; padding: 0 5px; }
.tb-ct .tb-chev { width: 10px !important; height: 10px !important; color: var(--muted); }
@container chartpane (min-width: 760px) {
  .tf-quick { display: flex; }
  .tf-pick { padding: 0 5px; gap: 3px; }
  .tf-pick .tf-ic { display: none; }
  .tf-pick.in-quick .tf-label { display: none; }
}
@container chartpane (max-width: 940px) {
  .chart-toolbar .tool-btn .lbl { display: none; }
}
@container chartpane (max-width: 480px) {
  .tb-undo:disabled, .tb-snap { display: none; }
  .tb-sep-undo { display: none; }
  .chart-toolbar .tool-btn { padding: 0 6px; }
}
@container chartpane (max-width: 360px) {
  .tb-left .tb-sep { margin: 0 1px; }
}
@media (min-width: 1024px) { .m-only { display: none !important; } }
@media (max-width: 1023px) { .chart-toolbar .desk-only { display: none !important; } }

/* chart footer: ranges · clock · % log auto */
.chart-footer {
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
}
.rng-btns { display: flex; align-items: center; gap: 1px; min-width: 0; }
.rng, .ft-btn {
  flex: 0 0 auto;
  height: 22px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.rng:hover, .ft-btn:hover { background: var(--panel-2); color: var(--text); }
.ft-btn.on { color: var(--tv-blue-2); }
.cf-space { flex: 1 1 auto; }
.chart-clock { flex: 0 0 auto; padding: 0 4px; color: var(--text-2); font-size: 11.5px; white-space: nowrap; }
.chart-footer .tb-sep { height: 16px; }
@container chartpane (max-width: 560px) {
  .chart-clock, .chart-footer .tb-sep { display: none; }
  .rng, .ft-btn { padding: 0 5px; }
}

/* legend: indicator rows can be removed (×) or clicked to open the list */
.legend .lg-head { pointer-events: none; }
.legend .lg-ind {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  margin-left: -4px;
  padding: 0 4px;
  border-radius: 4px;
  pointer-events: auto;
}
.legend .lg-ind:hover { background: rgba(255, 255, 255, 0.05); }
.lg-name { padding: 0; font: inherit; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.lg-name:hover { color: var(--text); }
.lg-v { white-space: nowrap; }
.lg-x { display: none; width: 16px; height: 16px; border-radius: 3px; color: var(--muted); font-size: 14px; line-height: 15px; text-align: center; }
.lg-ind:hover .lg-x { display: inline-block; }
.lg-x:hover { background: var(--panel-3); color: var(--text); }
@media (hover: none) { .lg-x { display: inline-block; } }
.legend .lg-sma200 { color: #00bcd4; }
.legend .lg-bb { color: var(--tv-blue-2); }
.legend .lg-bbm, .legend .lg-macds { color: #ff6d00; }
.legend .lg-macd { color: var(--tv-blue-2); }
.rsi-legend .lg-rsi { color: var(--violet); }

/* chart cursors (the chart library sets its own inline; ours wins while a tool is active) */
.chart-main.drawing canvas { cursor: crosshair !important; }
.chart-main.cursor-over canvas { cursor: var(--hover-cursor, crosshair) !important; }

/* floating bar of the selected drawing */
.draw-sel {
  position: absolute;
  z-index: 9;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.85);
}
.ds-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.ds-btn svg { width: 16px; height: 16px; }
.ds-btn:hover { background: var(--panel-3); color: var(--text); }
.ds-use { color: var(--tv-blue-2); }

/* pop-up menu (chart type) */
.pop-menu {
  position: fixed;
  z-index: 260;
  min-width: 200px;
  padding: 6px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.85);
  animation: modalIn 0.18s ease;
}
.menu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-align: start;
}
.menu-row svg { flex: 0 0 auto; width: 20px; height: 20px; }
.menu-row:hover { background: var(--panel-3); color: var(--text); }
.menu-row.on { color: var(--tv-blue-2); }

/* indicators sheet */
.ind-modal { max-width: 480px; display: flex; flex-direction: column; max-height: min(640px, calc(100dvh - 48px)); overflow: hidden; }
.ind-search { flex: 0 0 auto; margin: 12px 14px 6px; gap: 8px; padding: 0 10px; height: 40px; }
.ind-search svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--muted); }
.ind-search input { flex: 1 1 auto; min-width: 0; height: 100%; background: transparent; border: 0; outline: none; color: var(--text); font-size: 14px; }
.ind-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 8px; }
.ind-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 8px; border-radius: 8px; }
.ind-row:hover { background: var(--panel-2); }
.ind-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.ind-name small { font-size: 11.5px; font-weight: 400; color: var(--muted); line-height: 1.4; }
.ind-row .switch { flex: 0 0 auto; }
.ind-hint { flex: 0 0 auto; margin: 0; padding: 8px 16px 14px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--border); }

/* watchlist */
.wl-head, .wl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 66px; gap: 10px; align-items: center; padding: 0 12px; }
.wl-head { position: sticky; top: 0; z-index: 1; height: 28px; font-size: 11px; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--border); }
.wl-head span:not(:first-child), .wl-last, .wl-chg { text-align: end; }
.wl-group { padding: 10px 12px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.wl-row { width: 100%; min-height: 44px; color: var(--text); text-align: start; border-inline-start: 2px solid transparent; }
.wl-row:hover { background: var(--panel-2); }
.wl-row.on { background: rgba(41, 98, 255, 0.08); border-inline-start-color: var(--tv-blue); }
.wl-sym { display: flex; flex-direction: column; min-width: 0; }
.wl-sym b { font-size: 12.5px; font-weight: 600; }
.wl-sym small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-last { font-size: 12.5px; font-weight: 500; }
.wl-chg { font-size: 12px; font-weight: 600; color: var(--text-2); }
.wl-chg.up { color: var(--green); }
.wl-chg.down { color: var(--red); }

/* alerts */
.al-list { list-style: none; margin: 0; padding: 0; }
.al-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.al-ic { color: #ff9800; font-size: 10px; text-align: center; }
.al-main { display: flex; flex-direction: column; min-width: 0; }
.al-main b { font-size: 12.5px; font-weight: 600; }
.al-main small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-price { font-size: 12.5px; font-weight: 600; }
.panel-alerts .panel-head .link-btn { font-size: 12px; font-weight: 600; color: var(--tv-blue-2); }
.panel-watch, .panel-alerts { display: none; }

/* right icon rail (desktop) */
.side-rail { display: none; }
@media (min-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr) var(--book-w, 240px) 320px 46px; grid-template-areas: "chart book side rail" "dock book side rail"; }
  body.no-book .layout { grid-template-columns: minmax(0, 1fr) 320px 46px; grid-template-areas: "chart side rail" "dock side rail"; }
  body.no-dock .layout { grid-template-areas: "chart book side rail"; }
  body.no-book.no-dock .layout { grid-template-areas: "chart side rail"; }
  body.chart-focus .layout,
  body.chart-focus.no-book .layout,
  body.chart-focus.no-dock .layout,
  body.chart-focus.no-book.no-dock .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "chart"; }
  body.chart-focus .side-rail { display: none; }

  .side-rail { grid-area: rail; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; background: var(--panel); }
  .rail-btn { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); }
  .rail-btn svg { width: 22px; height: 22px; }
  .rail-btn:hover { background: var(--panel-2); color: var(--text); }
  .rail-btn.active { background: var(--tv-blue-bg); color: var(--tv-blue-2); }
  .rail-badge {
    position: absolute;
    top: 1px;
    inset-inline-end: 1px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 8px;
    background: #ff9800;
    color: #101115;
    font-size: 9.5px;
    font-weight: 800;
    font-style: normal;
    line-height: 15px;
    text-align: center;
  }

  body[data-side="watch"] .side-col > :not(.panel-watch),
  body[data-side="alerts"] .side-col > :not(.panel-alerts) { display: none !important; }
  body[data-side="watch"] .panel-watch,
  body[data-side="alerts"] .panel-alerts { display: flex; flex: 1 1 auto; min-height: 0; }
  .panel-watch .wl, .panel-alerts .al { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
  .dock-tab-m { display: none; }
}

/* phones & tablets: the drawing tools float over the chart when the pencil is on */
@media (max-width: 1023px) {
  .draw-bar {
    display: none;
    position: absolute;
    z-index: 12;
    top: 6px;
    left: 6px;
    right: 6px;
    flex-direction: row;
    gap: 2px;
    padding: 4px;
    background: rgba(25, 27, 33, 0.97);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.9);
  }
  body.draw-open .draw-bar { display: flex; }
  .draw-bar .db-btn { width: 40px; height: 40px; }
  .draw-bar .db-sep { width: 1px; height: 24px; margin: 0 3px; align-self: center; }
  body.draw-open #legend { top: 60px; }
  .chart-footer { display: none; }
  body[data-view="chart"] .chart-footer { display: flex; flex-basis: 34px; }
  body[data-view="chart"] .rng, body[data-view="chart"] .ft-btn { height: 28px; }
  .dock-pane .wl-row { min-height: 52px; }
}
/* narrow charts: indicator legend collapses to names (× still removes); values stay on wider screens */
@container chartpane (max-width: 520px) {
  .legend .lg-ind { display: inline-flex; margin: 0 6px 0 -4px; }
  .legend .lg-ind .lg-v { display: none; }
  .rsi-legend .lg-ind .lg-v { display: inline; }
}

/* another window is playing: this one waits */
.tab-pause { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: rgba(10, 11, 14, 0.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tab-pause[hidden] { display: none; }
.tab-pause-card { max-width: 380px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tab-pause-card svg { width: 44px; height: 44px; color: var(--accent); }
.tab-pause-card h2 { margin: 0; font-size: 18px; }
.tab-pause-card p { margin: 0 0 6px; color: var(--text-2); line-height: 1.5; }
/* a repeated message nudges the toast that is already showing */
.toast.bump { animation: toastBump 0.32s ease; }
@keyframes toastBump { 30% { transform: scale(1.04); } }

/* =====================================================================
   PHONE IN LANDSCAPE — chart beside the order ticket, slimmer bars
   ===================================================================== */
@media (max-width: 1023px) and (orientation: landscape) and (max-height: 540px) {
  :root { --topbar-h: 42px; --nav-h: 44px; }
  .nav-btn { flex-direction: row; gap: 6px; font-size: 11.5px; }
  .nav-btn svg { width: 19px; height: 19px; }
  .action-bar { padding: 6px 10px; }
  .btn-trade { height: 44px; font-size: 15px; }

  body[data-view="trade"] .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: minmax(0, 1fr);
    grid-auto-rows: auto;
    align-content: stretch;
    overflow: hidden;
    padding-bottom: calc(var(--nav-h) + var(--safe-b));
  }
  body[data-view="trade"] .panel-chart { grid-column: 1; grid-row: 1; height: auto; min-height: 0; border-bottom: 0; border-inline-end: 1px solid var(--border); }
  body[data-view="trade"] .split-m { display: none; }
  body[data-view="trade"] .panel-ticket { grid-column: 2; grid-row: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(var(--actionbar-h) + 8px); border-inline-end: 0; }
  body[data-view="trade"] .panel-account { display: none; }
  body[data-view="trade"] .action-bar { left: auto; right: auto; inset-inline-end: 0; width: 300px; }
  /* Chart tab: the chart gets the height; BUY / SELL shrink to one slim row */
  body[data-view="chart"] .chart-footer { display: none; }
  body[data-view="chart"] .action-bar { padding: 4px 10px; }
  body[data-view="chart"] .btn-trade { height: 34px; font-size: 14px; flex-direction: row; gap: 8px; }
  body[data-view="chart"] .btn-trade small { font-size: 11px; }
}

/* the open trade's market, when the chart shows another one */
.cp-sym { font-weight: 700; color: var(--text); white-space: nowrap; }

/* =====================================================================
   BAR REPLAY
   ===================================================================== */
.replay-bar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 8;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 24px);
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(25, 27, 33, 0.96);
  border: 1px solid var(--border-2);
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}
.replay-bar[hidden] { display: none; }
.rb-tag { padding: 0 6px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.05em; color: var(--tv-blue-2); }
.rb-btn { flex: 0 0 auto; min-width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 7px; color: var(--text-2); font-size: 12px; font-weight: 700; }
.rb-btn svg { width: 18px; height: 18px; }
.rb-btn:hover { background: var(--panel-3); color: var(--text); }
#rbPlay { color: #fff; background: var(--tv-blue); }
#rbPlay:hover { filter: brightness(1.1); }
#rbPlay .ic-pause, #rbPlay.on .ic-play { display: none; }
#rbPlay.on .ic-pause { display: block; }
.rb-time { padding: 0 6px; font-size: 11.5px; color: var(--text-2); }
.rb-score { padding: 0 6px; font-size: 12px; font-weight: 700; color: var(--text); }
.rb-exit { color: var(--muted); }
@container chartpane (max-width: 520px) {
  .rb-time, .rb-tag { display: none; }
  .replay-bar { bottom: 8px; }
}
.sim-toggle.replay, .sim-toggle.replay:disabled { color: var(--tv-blue-2) !important; }
.conn-dot.replay { background: var(--tv-blue-2); }
body.replaying .to-latest { display: none; }
body.replaying .draw-hint { bottom: 56px; }
/* the narrowest phones: the feed badge keeps only its coloured dot */
@container chartpane (max-width: 360px) {
  .chart-toolbar #simLabel { display: none; }
  .chart-toolbar .sim-toggle { padding: 0 9px; }
}
@container chartpane (max-width: 480px) {
  body.replaying .chart-toolbar #simLabel { display: none; }
}

/* colour swatches on the selected drawing */
.ds-colors { display: flex; align-items: center; gap: 3px; padding: 0 4px; }
.ds-colors[hidden] { display: none; }
.ds-col { width: 20px; height: 20px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25); }
.ds-col.on { box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 4px var(--c); }
.ds-col:hover { transform: scale(1.12); }

/* keyboard focus: one clear ring everywhere (mouse and touch clicks don't show it) */
:where(button, a, select, summary, [tabindex]):focus-visible { outline: 2px solid #5b8cff; outline-offset: 1px; }

/* what's new */
.news-modal { max-width: 420px; padding: 22px 20px 20px; text-align: center; display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.news-hero { font-size: 34px; line-height: 1; }
.news-modal h2 { margin: 0; font-size: 19px; }
.news-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: start; }
.news-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); line-height: 1.45; color: var(--text-2); }
.news-ic { flex: 0 0 auto; font-size: 20px; line-height: 1.2; }

/* keyboard shortcuts */
.keys-modal { max-width: 460px; display: flex; flex-direction: column; max-height: min(640px, calc(100dvh - 48px)); overflow: hidden; }
.keys-list { margin: 0; padding: 8px 16px 16px; overflow-y: auto; }
.keys-list > div { display: flex; align-items: center; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.keys-list dt { flex: 0 0 104px; display: flex; align-items: center; gap: 4px; }
.keys-list dt i { font-style: normal; color: var(--muted); font-size: 11px; }
.keys-list dd { margin: 0; color: var(--text-2); font-size: 13px; }
kbd { display: inline-block; min-width: 22px; padding: 2px 6px; border-radius: 5px; background: var(--panel-3); border: 1px solid var(--border-2); border-bottom-width: 2px; color: var(--text); font: 600 11.5px/1.3 var(--font-ui); text-align: center; }
.lm-keys { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
@media (hover: none), (max-width: 1023px) { .lm-keys { display: none; } }

.set-note { margin: 12px 2px 6px; line-height: 1.45; }

.legend .lg-vwap { color: #f06292; }
.legend .lg-stochk { color: var(--tv-blue-2); }
.legend .lg-stochd { color: #ff6d00; }

/* chart context menu (right-click / long-press) */
.ctx-menu .menu-row svg { width: 18px; height: 18px; }
.ctx-menu .ctx-buy { color: var(--green); }
.ctx-menu .ctx-sell { color: var(--red); }
.ctx-menu .ctx-alert svg { color: #ff9800; }
@media (max-width: 1023px) { .ctx-menu .menu-row { height: 44px; } }

.ord-dist { font-size: 11.5px; color: var(--muted); margin-inline-end: 8px; white-space: nowrap; }

/* ===================== v3.6 — online: AI rivals, cloud status ===================== */
.ai-tag {
  display: inline-flex; align-items: center; height: 15px; padding: 0 5px; margin-inline-start: 5px;
  border-radius: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; line-height: 1;
  color: var(--muted, #8b93a7); background: rgba(139, 147, 167, .14); border: 1px solid rgba(139, 147, 167, .28);
  vertical-align: middle; flex: none; white-space: nowrap;
}
.pod-name .ai-tag { margin-inline-start: 3px; }
.sync-line { display: block; font-size: 11.5px; color: var(--up, #26a69a); margin-top: 2px; }
.sync-line.off { color: var(--warn, #f0b90b); }
.about-links a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* compact board: the AI mark sits on the avatar's corner so names keep their room */
.av-wrap { position: relative; display: inline-flex; flex: none; }
.ai-tag.ai-corner {
  position: absolute; bottom: -4px; inset-inline-end: -7px; margin: 0; height: 12px; padding: 0 3px;
  font-size: 7.5px; border-radius: 3px; background: var(--bg-2, #1e222d); border-color: rgba(139, 147, 167, .45);
}
.pills-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* v3.8 — Nerve Pro */
.pro-tag { display: inline-flex; align-items: center; height: 15px; padding: 0 5px; margin-inline-start: 5px; border-radius: 4px;
  font-size: 9.5px; font-weight: 800; color: #1a1300; background: linear-gradient(135deg, #ffd65c, #f0b90b); }
.pro-card { border: 1px solid rgba(240, 185, 11, .35); border-radius: 10px; padding: 10px 12px; background: rgba(240, 185, 11, .06); }
.pro-list { margin: 6px 0; padding-inline-start: 18px; font-size: 13px; }
.pro-on { color: var(--up, #26a69a); font-weight: 700; font-size: 13px; }
