/* GexLevels — one restrained dark theme. Color carries meaning only:
   --pos / --neg for dealer gamma sign, --spot for the live price. */
:root {
  --bg: #101214;
  --panel: #16191c;
  --panel-2: #1b1f23;
  --line: #23272b;
  --line-2: #2d3237;
  --text: #e6e8ea;
  --text-2: #a9aeb4;
  --muted: #7a8188;
  --pos: #3aa57a;
  --neg: #db5a4a;
  --spot: #e3b341;
  --pos-soft: rgba(58, 165, 122, 0.12);
  --neg-soft: rgba(219, 90, 74, 0.12);
  --spot-soft: rgba(227, 179, 65, 0.08);
  /* brand accent: interface only. Data colours (pos/neg/spot) never change. */
  --brand: #2f8cff;
  --brand-2: #1d5fe0;
  --brand-ink: #5aa2ff;
  --brand-soft: rgba(47, 140, 255, 0.16);

  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --serif: 'IBM Plex Serif', Georgia, serif;

  --radius: 8px;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --z-header: 10;
  --z-panel: 20;
  --z-tooltip: 30;
  --z-gate: 40;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); }
.eyebrow { font-size: 12px; color: var(--muted); font-weight: 500; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Value ticks: a short tint when a number moves, then back to ink ── */
@keyframes tick-up   { from { color: var(--pos); } }
@keyframes tick-down { from { color: var(--neg); } }
.tick-up   { animation: tick-up 1.4s var(--ease); }
.tick-down { animation: tick-down 1.4s var(--ease); }

/* ── Header ───────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: 20px;
  height: 52px; padding: 0 24px;
  background: rgba(16, 18, 20, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; flex: none; }
.brand-word { font: 700 16px 'Saira', var(--sans); font-stretch: 125%; color: var(--text); }
.brand #brand-sym { color: var(--muted); font-weight: 400; }

.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
}
.seg button {
  border: 0; background: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  padding: 4px 11px; border-radius: 4px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.seg button:active { transform: translateY(1px); }
.seg.small button { font-size: 12px; padding: 3px 9px; }

.tabs { display: flex; gap: 2px; }
.tabs button {
  border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-size: 13px; font-weight: 500;
  padding: 15px 10px 14px; position: relative;
  transition: color 0.2s var(--ease);
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--brand);
}

.status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.status .dot.live { background: var(--pos); animation: breathe 2.6s ease-in-out infinite; }
.status .dot.warn { background: var(--spot); }
.status .dot.err  { background: var(--neg); }
@keyframes breathe { 50% { opacity: 0.45; } }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text-2); font-size: 13px; font-weight: 500; padding: 5px 10px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn .count { font-family: var(--mono); font-size: 11px; color: var(--brand-ink); }
.icon-btn .count:empty { display: none; }

/* ── Layout ───────────────────────────────────────────────── */
main { max-width: 1480px; margin: 0 auto; padding: 20px 24px 40px; }
.view[hidden] { display: none; }
.panel { background: var(--panel); border-radius: var(--radius); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px 10px;
}
.panel-head h2 { font-size: 13px; font-weight: 600; }
.panel-head .sub { color: var(--muted); font-size: 12px; }
.panel-head .controls { display: flex; gap: 8px; align-items: center; }

.levels-view { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.levels-view aside { display: flex; flex-direction: column; gap: 20px; }

/* ── Regime & desk note ───────────────────────────────────── */
.regime { padding: 18px 20px 0; overflow: hidden; }
.regime h1 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.015em;
  margin: 4px 0 8px; display: flex; align-items: center; gap: 10px;
}
.regime h1 i { width: 10px; height: 10px; border-radius: 2px; background: var(--muted); transition: background 0.4s var(--ease); }
.regime h1 i.positive { background: var(--pos); }
.regime h1 i.negative { background: var(--neg); }
.regime h1 i.transitional { background: var(--spot); }
.note {
  font: italic 15px/1.55 var(--serif); color: #c9cdd1;
  max-width: 40ch; text-wrap: pretty;
}
.note b { font: 500 13.5px var(--mono); font-style: normal; color: var(--text); }
.kpis {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border-top: 1px solid var(--line);
  margin: 18px -20px 0;
}
.kpis div { background: var(--panel); padding: 12px 20px; }
.kpis b { display: block; font: 500 17px var(--mono); margin-top: 2px; }

/* ── Key levels list ──────────────────────────────────────── */
.lv {
  display: grid; grid-template-columns: 1fr auto 72px; align-items: baseline;
  padding: 9px 20px; border-top: 1px solid var(--line);
}
.lv .name { color: var(--text-2); }
.lv .v { font: 500 15px var(--mono); }
.lv .d { text-align: right; font: 13px var(--mono); color: var(--muted); }
.lv.spot { background: var(--spot-soft); }
.lv.spot .name, .lv.spot .v { color: var(--spot); }

/* ── Session log ──────────────────────────────────────────── */
.log { max-height: 260px; overflow-y: auto; padding-bottom: 6px; }
.log-row { display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 7px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.log-row time { font: 12px var(--mono); color: var(--muted); padding-top: 1px; }
.log-row .t { color: var(--text-2); }
.log-row .t b { font-family: var(--mono); font-weight: 500; color: var(--text); }
.log-empty { padding: 4px 20px 16px; color: var(--muted); font-size: 13px; }

/* ── Ladder ───────────────────────────────────────────────── */
.ladder-panel { display: flex; flex-direction: column; }
.ladder {
  position: relative; display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 168px;
  height: calc(100dvh - 52px - 40px - 46px - 40px);
  min-height: 560px; max-height: 920px;
  margin: 0 20px 4px 0;
}
.strikes, .bars { display: flex; flex-direction: column; }
.strikes > div, .bars > div:not(.zero) { flex: 1 1 0; min-height: 0; display: flex; align-items: center; }
.strikes > div {
  justify-content: flex-end; padding-right: 10px;
  font: 11px var(--mono); color: var(--muted);
}
.strikes > div.key { color: var(--text); }
.strikes > div.hide { color: transparent; }
.bars { position: relative; }
.bars > div:not(.zero) { position: relative; cursor: crosshair; }
.bars > div:not(.zero):hover { background: rgba(255, 255, 255, 0.025); }
.bars .bar {
  position: absolute; top: 12%; bottom: 12%;
  border-radius: 2px; opacity: 0.85;
  transition: left 0.6s var(--ease), width 0.6s var(--ease), background 0.3s;
}
.bars .bar.key { opacity: 1; }
.zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-2); transition: left 0.6s var(--ease); }

.lines { position: absolute; inset: 0 0 0 52px; pointer-events: none; }
.lline {
  position: absolute; left: 0; right: 160px; height: 0;
  border-top: 1px dashed rgba(169, 174, 180, 0.45);
  transition: top 0.6s var(--ease);
}
.lline.spot { border-top: 1.5px solid var(--spot); }
.ltag {
  position: absolute; right: 0; width: 160px; transform: translateY(-50%);
  font: 11.5px var(--mono); color: var(--text); white-space: nowrap;
  padding-left: 12px; transition: top 0.6s var(--ease);
}
.ltag .k { color: var(--text-2); font-family: var(--sans); font-size: 12px; margin-right: 6px; }
.ltag.spot, .ltag.spot .k { color: var(--spot); font-weight: 600; }
.ltag .ks { display: none; color: var(--text-2); margin-right: 5px; }

.legend { display: flex; flex-wrap: wrap; gap: 18px; padding: 8px 20px 14px 72px; color: var(--text-2); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ── Tooltip ──────────────────────────────────────────────── */
.tip {
  position: fixed; z-index: var(--z-tooltip); pointer-events: none;
  min-width: 190px; padding: 10px 12px;
  background: #1f2327; border: 1px solid var(--line-2); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(5, 7, 9, 0.5);
  font-size: 12px; opacity: 0; transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s var(--ease);
}
.tip.show { opacity: 1; transform: none; }
.tip h4 { font: 600 13px var(--mono); margin-bottom: 6px; display: flex; justify-content: space-between; gap: 12px; }
.tip h4 span { color: var(--muted); font-weight: 400; }
.tip dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 16px; }
.tip dt { color: var(--text-2); }
.tip dd { font-family: var(--mono); text-align: right; }

/* ── Strikes table ────────────────────────────────────────── */
.table-wrap { max-height: calc(100dvh - 52px - 40px - 52px - 40px); min-height: 400px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  position: sticky; top: 0; background: var(--panel); z-index: 1;
  font-size: 12px; font-weight: 500; color: var(--muted); text-align: right;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
}
td { padding: 6px 14px; text-align: right; border-bottom: 1px solid var(--line); font-family: var(--mono); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; padding-left: 20px; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--panel-2); }
tr.spot-row td { background: var(--spot-soft); }
tr.spot-row td:first-child { color: var(--spot); }
td.netcell { width: 34%; }
.netbar { position: relative; height: 14px; }
.netbar i { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; opacity: 0.8; }
.netbar::before { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }
.tag { font: 500 11px var(--sans); color: var(--text-2); }

/* ── Heatmap: every strike, tinted by net GEX strength ────── */
.heat-head, .heat-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 110px 90px 150px; gap: 16px; align-items: center;
  padding: 0 20px;
}
.heat-head { font-size: 12px; font-weight: 500; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.heat-head span:nth-child(n+3), .heat-row > :nth-child(n+3) { text-align: right; }
.heat { max-height: calc(100dvh - 52px - 40px - 82px - 40px); }
.heat-row {
  height: 26px; font: 13px var(--mono); font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(16, 18, 20, 0.6); cursor: crosshair;
  transition: background-color 0.6s var(--ease);
}
.heat-row:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.heat-row .hb { position: relative; height: 10px; }
.heat-row .hb i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; transition: width 0.6s var(--ease); }
.heat-row .lvl { font: 500 12px var(--sans); color: var(--text); }
.heat-row .pc { color: var(--text-2); }
.heat-row.spot { box-shadow: inset 2px 0 0 var(--spot), inset 0 0 0 1px rgba(227, 179, 65, 0.35); }
.heat-row.spot > :first-child { color: var(--spot); font-weight: 600; }

/* ── Line charts (Flow / Drift) ───────────────────────────── */
.charts { display: grid; gap: 20px; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.chart { position: relative; padding: 0 20px 14px 0; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.chart-tip { position: absolute; top: 4px; pointer-events: none; font-size: 12px; background: #1f2327; border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 10px; white-space: nowrap; opacity: 0; transition: opacity 0.12s; }
.chart-tip.show { opacity: 1; }
.chart-tip div { display: flex; gap: 10px; justify-content: space-between; }
.chart-tip .num { color: var(--text); }
.stats { display: flex; flex-direction: column; }
.stat { display: flex; justify-content: space-between; align-items: baseline; padding: 11px 20px; border-top: 1px solid var(--line); }
.stat .eyebrow { font-size: 13px; color: var(--text-2); }
.stat b { font: 500 15px var(--mono); }
.side-note { padding: 14px 20px 18px; }
.side-note .note { font-size: 14px; }

/* ── Banner (market closed / errors) ──────────────────────── */
.banner {
  display: flex; gap: 10px; align-items: baseline;
  padding: 10px 16px; margin-bottom: 16px; border-radius: var(--radius);
  background: var(--panel); border-left: 2px solid var(--spot);
  color: var(--text-2); font-size: 13px;
}
.banner[hidden] { display: none; }
.banner b { color: var(--text); font-weight: 600; }

/* ── Skeleton ─────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--panel-2) 0%, #20252a 50%, var(--panel-2) 100%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; border-radius: 3px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Alerts slide-over ────────────────────────────────────── */
.drawer {
  position: fixed; top: 52px; right: 0; bottom: 0; width: 360px; max-width: 100vw; z-index: var(--z-panel);
  background: var(--panel); border-left: 1px solid var(--line);
  transform: translateX(100%); visibility: hidden;
  transition: transform 0.3s var(--ease), visibility 0.3s;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; visibility: visible; }
.drawer form { display: grid; gap: 10px; padding: 4px 20px 16px; border-bottom: 1px solid var(--line); }
.drawer select, .drawer input {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 7px 10px; font: 13px var(--sans);
}
.drawer input { font-family: var(--mono); }
.drawer input.invalid { border-color: var(--neg); }
.btn {
  border: 0; border-radius: 6px; padding: 8px 12px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 13px;
  transition: background 0.2s;
}
.btn:hover { background: var(--brand-ink); }
.btn:active { transform: translateY(1px); }
.alert-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--line); font-size: 13px; }
.alert-row small { display: block; color: var(--muted); font-size: 12px; }
.alert-row.fired { opacity: 0.6; }
.alert-row button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; }
.alert-row button:hover { color: var(--text); }
.drawer .log-empty { padding: 16px 20px; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-tooltip); display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2327; border: 1px solid var(--line-2); border-left: 2px solid var(--spot);
  border-radius: 6px; padding: 10px 14px; font-size: 13px; max-width: 340px;
  box-shadow: 0 8px 24px rgba(5, 7, 9, 0.5);
  animation: toast-in 0.3s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Login gate ───────────────────────────────────────────── */
.gate {
  position: fixed; inset: 0; z-index: var(--z-gate);
  display: grid; place-items: center; padding: 16px;
  background: var(--bg);
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}
.gate.out { opacity: 0; visibility: hidden; }
.gate[hidden] { display: none; }
.gate-card { width: 100%; max-width: 380px; padding: 32px; background: var(--panel); border-radius: 12px; }
.gate-card .brand { margin-bottom: 28px; }
.gate-card .brand-mark { width: 30px; height: 30px; }
.gate-card .brand-word { font-size: 20px; }
.gate-card h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 8px; }
.gate-card p { color: var(--text-2); margin-bottom: 24px; }
.gate-card .btn { width: 100%; padding: 11px; font-size: 14px; display: flex; gap: 8px; align-items: center; justify-content: center; }
.gate-card .fine { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
.gate-card .fine a { color: var(--text-2); }
.gate-error { color: var(--neg); font-size: 13px; margin-top: 12px; min-height: 1em; }
.gate-wait { display: flex; gap: 10px; align-items: center; color: var(--text-2); }
.gate-wait[hidden], .gate-login[hidden] { display: none; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--text-2); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1100px) {
  .top { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 10px 16px; }
  .tabs { order: 5; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs button { padding: 8px 10px; }
  .status { margin-left: 0; }
  main { padding: 16px 16px 32px; }
  .levels-view, .chart-grid { grid-template-columns: minmax(0, 1fr); }
  /* phone/tablet order: regime → ladder → key levels → log */
  .levels-view aside { display: contents; }
  .levels-view .regime { order: 1; }
  .levels-view .ladder-panel { order: 2; }
  .levels-view aside > .panel:not(.regime) { order: 3; }
  .panel-head { flex-wrap: wrap; }
  .ladder { height: 620px; min-height: 0; }
  .drawer { top: 0; }
}
@media (max-width: 560px) {
  .status { order: 6; width: 100%; }
  .seg button { padding: 4px 9px; }
  .ladder { grid-template-columns: 44px minmax(0, 1fr) 118px; }
  .lines { left: 44px; }
  .lline { right: 112px; }
  .ltag { width: 112px; padding-left: 6px; }
  .ltag .k { display: none; }
  .ltag .ks { display: inline; }
  .legend { padding-left: 20px; }
  td, th { padding: 6px 8px; }
  .heat-head, .heat-row { grid-template-columns: 62px minmax(0, 1fr) 80px 64px; gap: 8px; padding: 0 12px; }
  .heat-head span:last-child, .heat-row > :last-child { display: none; }
}
/* ── Volatility ───────────────────────────────────────────── */
.vol-view { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.vol-main { display: grid; gap: 20px; }
.vol-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 4px 20px 0; }
.vol-big b { font: 600 52px/1 var(--mono); letter-spacing: -0.04em; }
.vol-big span { color: var(--text-2); font: 500 16px var(--mono); }
.vol-flag { margin-left: 6px; font: 600 12px var(--sans) !important; padding: 4px 10px; border-radius: 999px; align-self: center; }
.vol-flag.wild { color: var(--spot) !important; background: var(--spot-soft); box-shadow: inset 0 0 0 1px rgba(227, 179, 65, 0.35); }
.vol-flag.calm { color: var(--brand-ink) !important; background: var(--brand-soft); }
.vol-sub { padding: 10px 20px 0; color: var(--text-2); font-size: 14px; }
.vol-sub b { color: var(--text); font-family: var(--mono); font-weight: 500; }
.vol-scale { position: relative; height: 10px; margin: 26px 20px 30px; border-radius: 5px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
.vol-scale i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.vol-scale .band { background: var(--brand-soft); box-shadow: inset 0 0 0 1px rgba(47, 140, 255, 0.35); }
.vol-scale .used { left: 0; background: linear-gradient(90deg, rgba(227, 179, 65, 0.35), rgba(227, 179, 65, 0.75)); transition: width 0.8s var(--ease); }
.vol-scale .mark { width: 2px; top: -5px; bottom: -5px; margin-left: -1px; background: var(--brand-ink); border-radius: 1px; }
.vol-scale span { position: absolute; top: 16px; transform: translateX(-50%); font: 11px var(--mono); color: var(--muted); }
.vol-scale span.exp { color: var(--brand-ink); top: -22px; }
.vol-used { padding: 0 20px 18px; color: var(--text-2); font-size: 13px; }
.vol-used b { color: var(--spot); font-family: var(--mono); }
.vol-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vol-table th { text-align: right; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 20px; }
.vol-table th:first-child, .vol-table td:first-child { text-align: left; }
.vol-table td { text-align: right; padding: 9px 20px; border-top: 1px solid var(--line); font-family: var(--mono); }
.vol-table td:first-child { font-family: var(--sans); color: var(--text-2); }
.vol-table tr.up td:first-child { color: var(--pos); } .vol-table tr.down td:first-child { color: var(--neg); }
.vol-table tr.open td { color: var(--spot); font-weight: 600; }
.vol-table tr.exp td { background: rgba(255, 255, 255, 0.015); }
.vol-table .hit { font-size: 12px; color: var(--text-2); }
.vol-how { list-style: none; padding: 4px 20px 16px; margin: 0; display: grid; gap: 10px; }
.vol-how li { position: relative; padding-left: 14px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.vol-how li::before { content: ''; position: absolute; left: 0; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.vol-how b { color: var(--text); font-family: var(--mono); }
.vol-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 0 2px 64px; font-size: 12px; color: var(--text-2); }
.vol-legend span { display: inline-flex; align-items: center; gap: 7px; }
.vol-legend i { display: inline-block; flex: none; }
.vol-legend .band { width: 10px; height: 14px; border-radius: 2px; background: var(--brand-soft); }
.vol-legend .exp { width: 12px; height: 2px; background: var(--brand-ink); }
.vol-legend .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text); }
.vol-legend .dot.miss { background: var(--spot); }
.vol-legend .count { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.lline[data-k^="v80"] { border-top: 1px dashed rgba(90, 162, 255, 0.7); }
.ltag[data-k^="v80"], .ltag[data-k^="v80"] .k { color: var(--brand-ink); }
@media (max-width: 1100px) { .vol-view { grid-template-columns: minmax(0, 1fr); } }

/* ── Motion ───────────────────────────────────────────────── */
:root { --spring: cubic-bezier(0.34, 1.4, 0.64, 1); }

/* segmented controls + tabs: the selection glides instead of jumping */
.has-glide { position: relative; isolation: isolate; }
.glide { position: absolute; left: 0; top: 0; z-index: -1; width: 0; border-radius: 4px; background: var(--brand-soft); pointer-events: none; }
.glide.ready { transition: transform 0.45s var(--spring), width 0.45s var(--spring); }
.seg.has-glide button[aria-pressed="true"] { background: none; }
.seg button { transition: color 0.25s var(--ease), transform 0.2s var(--spring); }
.seg button:active { transform: scale(0.94); }
.glide.line { top: auto; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); z-index: 1; }
.tabs.has-glide button[aria-selected="true"]::after { display: none; }

/* a newly opened view: panels rise in one after another */
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }
.view.enter.panel, .view.enter .panel { animation: view-in 0.5s var(--ease) backwards; }
.view.enter .panel:nth-child(2) { animation-delay: 70ms; }
.view.enter .panel:nth-child(3) { animation-delay: 140ms; }
.view.enter .ladder-panel, .view.enter aside.panel { animation-delay: 110ms; }

/* ladder: bars grow out of the zero line, level lines fade in, spot pings softly */
@keyframes bar-grow { from { transform: scaleX(0); } }
.bars .bar.grow { animation: bar-grow 0.75s var(--ease) backwards; }
@keyframes fade-in { from { opacity: 0; } }
.lline, .ltag { animation: fade-in 0.6s var(--ease) 0.25s backwards; }
.lline.spot::before {
  content: ''; position: absolute; left: -4px; top: -4.5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--spot); animation: spot-ping 2.4s ease-out infinite;
}
@keyframes spot-ping { 0% { box-shadow: 0 0 0 0 rgba(227, 179, 65, 0.55); } 70%, 100% { box-shadow: 0 0 0 9px rgba(227, 179, 65, 0); } }

/* charts draw their lines in when first shown */
@keyframes draw-line { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.chart svg.draw polyline { stroke-dasharray: 1; animation: draw-line 1.2s var(--ease) var(--dd, 0.1s) backwards; }
.chart svg.draw path { animation: fade-in 0.9s var(--ease) calc(var(--dd, 0.1s) + 300ms) backwards; }

/* panels and rows answer the pointer */
.panel { transition: box-shadow 0.3s var(--ease); }
.panel:hover { box-shadow: inset 0 0 0 1px var(--line); }
.icon-btn { transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--spring); }
.icon-btn:active, .btn:active { transform: scale(0.96); }

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

/* Heatmap: the symbols side by side */
.quad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.q-col { background: var(--panel); min-width: 0; display: flex; flex-direction: column; }
.q-col header { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.q-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font: 500 12.5px var(--mono); }
.q-top b { font: 600 15px var(--mono); }
.q-spot { color: var(--text); }
.q-top .pos { color: var(--pos); } .q-top .neg { color: var(--neg); }
.q-max { color: var(--spot); font: 500 12.5px var(--mono); }
.q-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font: 12px var(--mono); }
.q-rows { position: relative; height: calc(100vh - 262px); min-height: 420px; overflow-y: auto; }
.q-row { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: stretch; height: 26px; border-bottom: 1px solid var(--line); font: 12.5px var(--mono); }
.q-k { display: flex; align-items: center; padding-left: 12px; color: var(--text-2); }
.q-cell { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; transition: background-color 0.5s; }
.q-cell i { font-style: normal; font-size: 11px; color: var(--text-2); }
.q-cell b { font-weight: 500; color: var(--text); }
.q-row.spot .q-k { color: var(--brand-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-ink); }
.q-row.max .q-cell { background: var(--spot) !important; }
.q-row.max .q-cell b, .q-row.max .q-cell i { color: #1a1408; font-weight: 600; }
@media (max-width: 1400px) { .quad { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .quad { grid-template-columns: repeat(2, minmax(0, 1fr)); } .q-rows { height: 460px; min-height: 0; } }
@media (max-width: 560px) { .quad { grid-template-columns: minmax(0, 1fr); } }

/* strength: faint strikes recede, the strongest ones on each side read first */
.q-row.faint .q-cell b, .q-row.faint .q-k { color: var(--muted); }
.q-row.strong .q-cell b { color: #fff; font-weight: 600; }
.q-row.strong .q-k { color: var(--text); font-weight: 600; }
.heat-row.faint { color: var(--muted); }
.heat-row.strong > :first-child, .heat-row.strong > :nth-child(3) { color: #fff; font-weight: 600; }
/* local levels: a dot before the strike, bright value */
.q-row.peak .q-cell b, .heat-row.peak > :nth-child(3) { color: #fff; font-weight: 600; }
.q-row.peak .q-k, .heat-row.peak > :first-child { color: var(--text); }
.q-row.peak .q-k::after { content: '•'; margin-left: 4px; color: var(--spot); }

/* TradingView panel */
.drawer.tv { width: 400px; }
.tv-body { overflow-y: auto; padding: 4px 20px 24px; display: grid; gap: 12px; align-content: start; font-size: 13px; color: var(--muted); }
.tv-body p { margin: 0; line-height: 1.5; }
.tv-body .btn:disabled { opacity: 0.5; cursor: default; }
.tv-body .btn.ghost { display: inline-block; text-decoration: none; background: none; border: 1px solid var(--line-2); color: var(--text); }
.tv-status { font-family: var(--mono); font-size: 12px; min-height: 1em; }
#tv-code { width: 100%; height: 70px; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px; font: 11px var(--mono); }
.tv-steps { margin: 0; padding-left: 18px; line-height: 1.55; }
.tv-steps b { color: var(--text); font-weight: 600; }
.tv-mkt h3 { display: flex; justify-content: space-between; margin: 8px 0 6px; font-size: 12px; font-weight: 600; color: var(--text); letter-spacing: 0.04em; }
.tv-mkt h3 small { font: 12px var(--mono); color: var(--muted); }
.tv-lv { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font: 12px var(--mono); }
.tv-lv i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tv-lv.p1 { opacity: 0.6; }
.tv-lv.p3 span { color: var(--text); font-weight: 600; }
.tv-lv em { margin-left: auto; font-style: normal; font-size: 10px; color: var(--muted); white-space: nowrap; }

/* NQ / ES prices */
.fut-note { margin: 10px 0 0; padding: 8px 10px; border-left: 2px solid var(--spot); background: var(--panel-2); font-size: 12px; line-height: 1.5; color: var(--muted); }
.q-fut { margin-right: 8px; padding: 1px 5px; border-radius: 3px; background: var(--panel-2); color: var(--muted); font-size: 10px; letter-spacing: 0.04em; }

/* First-visit tour */
.tour-btn { font-weight: 600; min-width: 30px; justify-content: center; }
.tour-spot {
  position: fixed; z-index: calc(var(--z-gate) + 1); pointer-events: none; border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(5, 7, 9, 0.72), 0 0 0 1px var(--brand-ink, #5aa2ff);
  transition: left 0.35s var(--ease), top 0.35s var(--ease), width 0.35s var(--ease), height 0.35s var(--ease);
}
.tour-card {
  position: fixed; z-index: calc(var(--z-gate) + 2); width: min(360px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 16px 18px 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); transition: left 0.35s var(--ease), top 0.35s var(--ease);
}
.tour-card h3 { margin: 4px 0 6px; font-size: 15px; font-weight: 600; }
.tour-card p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.tour-card p b { color: var(--text); font-weight: 600; }
.tour-count { font: 11px var(--mono); color: var(--muted); }
.tour-btns { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-skip { margin-right: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 4px 0; }
.tour-skip:hover { color: var(--text); }
