/* SimEx · Hyperliquid 风格配色：深青黑背景、薄荷绿主色、柔和的红 */
:root {
  --bg: #06141a;
  --bg2: #081a21;
  --panel: #0b1d24;
  --panel2: #11272f;
  --panel3: #16313a;
  --line: #1b3640;
  --line2: #24434e;
  --text: #e3efed;
  --text2: #b9cbc9;
  --muted: #7a9696;
  --mint: #97fce4;
  --mint-d: #50d2c1;
  --mint-ink: #032019;
  --up: #3fd1b0;
  --down: #ed7088;
  --warn: #f2b56b;
  --blue: #7cb7ff;
  --violet: #b9a2ff;
  --up-a: rgba(63, 209, 176, 0.14);
  --down-a: rgba(237, 112, 136, 0.14);
  --mint-a: rgba(151, 252, 228, 0.1);
  --radius: 8px;
  --radius-s: 6px;
  --top-h: 48px;
  --mbar-h: 52px;
  --sans: 'Inter Variable', Inter, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Source Han Sans SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'PingFang SC', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 var(--sans);
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: var(--mint); }
[hidden], .hide { display: none !important; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* 代码和数字不要连字（=> 不能显示成箭头） */
.num, .mono, #q-code, .doc pre, .doc code, .logs, .book, .tour-body .formula, .tour-body .calc, .ind-doc .formula { font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0, 'tnum'; }
.up { color: var(--up); }
.down { color: var(--down); }
.gold, .mint { color: var(--mint); }
.warn { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 18px; }
b { font-weight: 600; }
::selection { background: rgba(151, 252, 228, 0.25); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--mint-d); outline-offset: 1px; }

/* ───────── 顶栏 ───────── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  height: var(--top-h); padding: 0 16px;
  background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; white-space: nowrap; flex: none; }
.brand svg { width: 22px; height: 22px; fill: var(--mint); }
.brand span { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand small { color: var(--muted); font-size: 12px; }
.conn { width: 7px; height: 7px; border-radius: 50%; background: var(--up); display: inline-block; box-shadow: 0 0 6px var(--up); }
.conn.off { background: var(--down); box-shadow: 0 0 6px var(--down); }
.nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav button { background: none; border: none; padding: 7px 11px; color: var(--muted); border-radius: var(--radius-s); font-weight: 500; white-space: nowrap; }
.nav button:hover { color: var(--text); background: var(--panel); }
.nav button.on { color: var(--mint); background: var(--mint-a); }
.top-right { display: flex; align-items: center; gap: 8px; flex: none; }
.acct { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.acct .eq { display: flex; flex-direction: column; align-items: flex-end; font-size: 11px; line-height: 1.15; }
.acct .eq b { font-size: 13px; font-family: var(--mono); }
.acct .role { border: 1px solid var(--line2); background: var(--panel); border-radius: 12px; padding: 2px 10px; font-size: 12px; }
.acct .role.maker { border-color: var(--mint-d); color: var(--mint); }
.acct .uname { max-width: 96px; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--text2); }
.acct .icon { background: none; border: none; color: var(--muted); font-size: 16px; padding: 2px 4px; }
.chip-btn { background: var(--panel); border: 1px solid var(--line2); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text2); white-space: nowrap; }
.chip-btn:hover { border-color: var(--mint-d); color: var(--mint); }
.tour-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel); color: var(--mint); font-weight: 700; flex: none; padding: 0; }
.tour-btn:hover { border-color: var(--mint-d); }

/* ───────── 行情条 ───────── */
.mbar {
  display: flex; align-items: center; gap: 14px;
  min-height: var(--mbar-h); padding: 6px 16px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.mkt-pick { position: relative; flex: none; }
.mkt-btn { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); padding: 6px 12px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.mkt-btn:hover, .mkt-btn[aria-expanded='true'] { border-color: var(--mint-d); }
.mkt-btn .coin-ic { width: 20px; height: 20px; }
.mkt-btn small { color: var(--muted); font-weight: 500; font-size: 12px; }
.mkt-btn .caret { color: var(--muted); font-size: 11px; }
.coin-ic { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 10px; font-weight: 700; flex: none; color: var(--mint-ink); background: var(--mint); font-family: var(--sans); }
.coin-ic.BTC { background: #f7a440; }
.coin-ic.ETH { background: #a3b3ff; }
.coin-ic.SIM { background: var(--mint); }
.coin-ic.listed { background: var(--violet); }
.mkt-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 40;
  width: 460px; max-width: calc(100vw - 32px); max-height: min(70vh, 520px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); padding: 6px;
}
.mkt-menu .mm-head { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr 0.8fr 1.2fr; gap: 8px; padding: 4px 10px; color: var(--muted); font-size: 11px; }
.mkt-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr 0.8fr 1.2fr; gap: 8px; align-items: center; padding: 8px 10px; border-radius: var(--radius-s); }
.mkt-row:hover, .mkt-row.on { background: var(--panel2); }
.mkt-row .nm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mkt-row .nm div { display: flex; flex-direction: column; min-width: 0; }
.mkt-row .nm b { font-size: 13px; }
.mkt-row .nm small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-row .px { font-family: var(--mono); text-align: right; font-size: 12px; }
.mkt-row .ch { text-align: right; font-size: 12px; font-family: var(--mono); }
.mkt-row .go { display: flex; gap: 4px; justify-content: flex-end; }
.mkt-row .go button { background: var(--panel3); border: 1px solid var(--line2); border-radius: 4px; padding: 2px 8px; font-size: 11px; color: var(--text2); }
.mkt-row .go button:hover, .mkt-row .go button.on { border-color: var(--mint-d); color: var(--mint); }
.badge { display: inline-block; font-size: 10px; padding: 0 5px; border-radius: 3px; margin-left: 4px; vertical-align: 1px; background: var(--mint-a); color: var(--mint); font-weight: 600; }
.badge.real { background: rgba(247, 164, 64, 0.14); color: #f7c47a; }
.badge.new { background: rgba(185, 162, 255, 0.14); color: var(--violet); }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 2px; gap: 2px; flex: none; }
.seg button { background: none; border: none; padding: 4px 10px; border-radius: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel3); color: var(--mint); }
.seg.small button { padding: 3px 8px; }
.ticker { display: flex; align-items: center; gap: 20px; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.ticker > div { display: flex; flex-direction: column; font-size: 12px; flex: none; }
.ticker > div span { color: var(--muted); font-size: 11px; }
.ticker > div b { font-family: var(--mono); font-weight: 500; }
.ticker .last { font-size: 20px; font-weight: 600; font-family: var(--mono); }
.feed { display: flex; align-items: center; gap: 10px; font-size: 12px; white-space: nowrap; flex: none; }
.feed .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.feed .pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--up); box-shadow: 0 0 6px var(--up); }
.feed .pill.off i { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.feed .dev b { font-family: var(--mono); }
body.no-mbar .mbar { display: none; }

/* ───────── 通用 ───────── */
main { padding: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.panel-title { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.panel-title small { font-weight: 400; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: none; padding: 6px 10px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--mint); }
.tabs.small button { padding: 4px 8px; font-size: 12px; }
.tabs.inline { border: none; margin: 0 0 0 auto; }
.btn { border: none; border-radius: var(--radius-s); padding: 9px 14px; font-weight: 600; white-space: nowrap; }
.btn.buy { background: var(--up); color: #032019; }
.btn.sell { background: var(--down); color: #2a0610; }
.btn.gold, .btn.primary { background: var(--mint); color: var(--mint-ink); }
.btn.ghost { background: var(--panel2); border: 1px solid var(--line2); color: var(--text2); }
.btn:hover { filter: brightness(1.08); }
.btn.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(151, 252, 228, 0.2); } }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.mini { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 2px 8px; font-size: 12px; white-space: nowrap; color: var(--text2); }
.mini:hover { border-color: var(--mint-d); color: var(--mint); }
.mini-in { width: 68px; background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; padding: 2px 6px; font-size: 12px; font-family: var(--mono); }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 3px; background: var(--mint-a); color: var(--mint); margin-left: 4px; white-space: nowrap; }
.tag.t2 { background: rgba(124, 183, 255, 0.14); color: var(--blue); }
.tag.up-bg { background: var(--up-a); color: var(--up); }
.tag.down-bg { background: var(--down-a); color: var(--down); }
.tag.warn-bg { background: rgba(242, 181, 107, 0.14); color: var(--warn); }
.empty { color: var(--muted); padding: 24px 12px; text-align: center; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.scroll-x { overflow-x: auto; max-width: 100%; }

.fld { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line2); border-radius: var(--radius-s); margin-bottom: 8px; padding: 0 8px; gap: 6px; min-width: 0; }
.fld:focus-within { border-color: var(--mint-d); }
.fld span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.fld input, .fld select { flex: 1; min-width: 0; width: 100%; background: transparent; border: none; outline: none; padding: 8px 0; text-align: right; font-family: var(--mono); }
.fld select { text-align: left; font-family: var(--sans); }
.fld select option { background: var(--panel); }
.fld em { font-style: normal; color: var(--muted); font-size: 12px; white-space: nowrap; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 4px 0; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--mint-d); }

.tbl-wrap { overflow-x: auto; max-width: 100%; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 400; padding: 6px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 6px 7px; border-bottom: 1px solid rgba(27, 54, 64, 0.6); white-space: nowrap; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.num { font-family: var(--mono); }
.tbl tr.me td { background: var(--mint-a); }
.tbl .acts { display: flex; gap: 4px; align-items: center; }
.tbl.compact td, .tbl.compact th { padding: 4px 6px; }
.kv-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed rgba(36, 67, 78, 0.7); font-size: 12px; }
.kv-list span { color: var(--muted); }
.kv-list b { text-align: right; font-weight: 500; }
.ok-box, .warn-box, .info-box { border-radius: var(--radius-s); padding: 8px 10px; font-size: 12px; margin-bottom: 8px; }
.ok-box { background: var(--up-a); color: var(--up); }
.warn-box { background: rgba(242, 181, 107, 0.1); color: var(--warn); display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.info-box { background: var(--mint-a); color: var(--text2); }
.edu { margin-top: 16px; background: var(--panel2); border-radius: var(--radius-s); padding: 10px 12px; font-size: 12px; color: var(--muted); }
.edu p { margin: 6px 0; }
.edu b { color: var(--text); }

/* ───────── 交易页布局 ───────── */
.tv-grid {
  display: grid; gap: 8px;
  grid-template-columns: minmax(0, 1fr) 256px 292px;
  grid-template-rows: minmax(460px, calc(100vh - var(--top-h) - var(--mbar-h) - 16px - 248px - 8px)) 248px;
  grid-template-areas: 'chart book form' 'bottom bottom side';
}
.chart-panel { grid-area: chart; display: flex; flex-direction: column; padding: 6px 8px; position: relative; }
.book-panel { grid-area: book; overflow: hidden; display: flex; flex-direction: column; }
.form-panel { grid-area: form; overflow: auto; }
.bottom-panel { grid-area: bottom; overflow: hidden; display: flex; flex-direction: column; }
.side-panel { grid-area: side; overflow: hidden; display: flex; flex-direction: column; }
.bottom, .side { overflow: auto; flex: 1; min-height: 0; }
.book { flex: 1; min-height: 0; overflow: hidden; }

.chart-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; position: relative; }
.chart-toolbar .seg button { padding: 3px 7px; }
.ind-toggles { display: flex; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.ind-toggles label { display: flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.ind-toggles label:hover { color: var(--text); }
.sig-btn { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 1px 8px; font-size: 12px; color: var(--text2); }
.sig-btn.on { border-color: var(--mint-d); color: var(--mint); }
.tb-right { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.tb-right .chip-btn { padding: 2px 8px; }
#sub-select { position: absolute; top: 3px; right: 78px; z-index: 4; background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 1px 4px; font-size: 11px; color: var(--text2); }
.ind-toggles .chip-btn { padding: 1px 8px; }
.sig-menu { position: absolute; top: 100%; left: 0; z-index: 12; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); padding: 10px 12px; width: 300px; max-width: calc(100vw - 48px); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); font-size: 12px; }
.sig-menu label { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; cursor: pointer; }
.sig-menu label small { display: block; color: var(--muted); }
.sig-menu .sw { width: 10px; height: 10px; border-radius: 2px; margin-top: 4px; flex: none; }
.chart-wrap { position: relative; flex: 1; min-height: 0; }
#chart-main { position: absolute; inset: 0; }
#chart-overlay { position: absolute; inset: 0; pointer-events: none; }
.sub-wrap { position: relative; height: 120px; border-top: 1px solid var(--line); flex: none; }
#chart-sub { position: absolute; inset: 0; }
.sub-wrap.collapsed { height: 26px; }
.sub-wrap.collapsed #chart-sub { visibility: hidden; }
.legend { position: absolute; top: 4px; left: 6px; right: 80px; z-index: 3; font-size: 11px; color: var(--muted); pointer-events: none; font-family: var(--mono); }
.legend b { color: var(--text); font-weight: 500; }
.legend div { margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sig-tip { position: absolute; z-index: 8; pointer-events: none; background: rgba(11, 29, 36, 0.97); border: 1px solid var(--line2); border-radius: var(--radius-s); padding: 8px 10px; width: 270px; max-width: calc(100% - 16px); font-size: 12px; line-height: 1.55; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.sig-tip b { display: block; margin-bottom: 2px; }
.sig-tip p { margin: 4px 0 0; color: var(--text2); }
.sig-tip .muted { font-size: 11px; }

/* 订单簿 */
.book { font-family: var(--mono); font-size: 12px; }
.bk-head, .bk-row, .tr-head, .tr-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr; padding: 1px 4px; gap: 4px; }
.bk-head, .tr-head { color: var(--muted); font-family: var(--sans); font-size: 11px; padding-bottom: 4px; }
.bk-head span:not(:first-child), .bk-row span:not(:first-child), .tr-head span:not(:first-child), .tr-row span:not(:first-child) { text-align: right; }
.bk-row span, .tr-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-row { position: relative; cursor: pointer; line-height: 19px; }
.bk-row:hover { background: var(--panel2); }
.bk-row i { position: absolute; right: 0; top: 0; bottom: 0; z-index: 0; }
.bk-row span { position: relative; z-index: 1; }
.bk-row.sell .p { color: var(--down); }
.bk-row.buy .p { color: var(--up); }
.bk-row.sell i { background: var(--down-a); }
.bk-row.buy i { background: var(--up-a); }
.bk-row.wall { font-weight: 700; }
.bk-row.wall i { filter: brightness(1.7); }
.bk-row em { font-style: normal; font-size: 10px; color: var(--mint); margin-left: 3px; font-family: var(--sans); }
.bk-row .dot { color: var(--mint); font-size: 8px; margin-right: 3px; vertical-align: middle; }
.bk-mid { display: flex; align-items: baseline; gap: 10px; padding: 6px 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 3px 0; flex-wrap: wrap; font-family: var(--sans); }
.bk-mid b { font-size: 16px; font-family: var(--mono); }
.bk-mid span { font-size: 11px; }
.tr-row { font-family: var(--mono); font-size: 12px; line-height: 19px; }
.tr-row span:last-child { color: var(--muted); }
.tr-row.liq { background: rgba(242, 181, 107, 0.12); }

/* 下单面板 */
.lev-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.lev-btns { display: flex; gap: 3px; flex-wrap: wrap; }
.lev-btns button { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 2px 6px; font-size: 11px; color: var(--text2); }
.lev-btns button.on { border-color: var(--mint-d); color: var(--mint); }
.pct-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.pct-row button { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 3px 0; font-size: 11px; color: var(--muted); }
.pct-row button:hover { color: var(--text); }
.chk-row { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.chk-row label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.f-info { font-size: 12px; }
.f-info div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.f-info span { color: var(--muted); }
.f-info b { font-weight: 500; font-family: var(--mono); text-align: right; }
.f-tip { margin-top: 12px; font-size: 12px; color: var(--muted); background: var(--panel2); border-radius: var(--radius-s); padding: 8px 10px; border-left: 2px solid var(--mint-d); }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.kv { background: var(--panel2); border-radius: var(--radius-s); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv span { color: var(--muted); font-size: 11px; }
.kv b { font-family: var(--mono); font-weight: 500; overflow-wrap: anywhere; }

/* 关键位 & 事件 */
.lv-now { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.lv-now b { color: var(--text); font-family: var(--mono); }
.lv { border-left: 3px solid; padding: 6px 8px; margin-bottom: 6px; background: var(--panel2); border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.lv.res { border-color: var(--down); }
.lv.sup { border-color: var(--up); }
.lv-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lv-h b { font-family: var(--mono); font-size: 14px; }
.lv-h .muted { margin-left: auto; font-size: 11px; }
.lv ul { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--muted); }
.ev-list { font-size: 12px; }
.ev { display: flex; gap: 8px; padding: 5px 2px; border-bottom: 1px solid rgba(27, 54, 64, 0.6); }
.ev .t { color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap; padding-top: 1px; }
.ev span:last-child { overflow-wrap: anywhere; }
.ev-news span:last-child { color: var(--mint); }
.ev-liquidation span:last-child { color: var(--warn); }
.ev-whale span:last-child { color: var(--blue); }
.ev-listing span:last-child { color: var(--violet); }

/* ───────── 做市页 ───────── */
.mm-grid { display: grid; gap: 8px; grid-template-columns: 330px minmax(0, 1fr) 340px; align-items: start; }
.mm-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mm-center { display: flex; flex-direction: column; gap: 10px; }
#mm-depth { width: 100%; height: 260px; background: var(--bg); border-radius: var(--radius-s); display: block; }
.mm-book-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.l-preview { background: var(--bg); border-radius: var(--radius-s); padding: 8px; font-size: 12px; max-height: 220px; overflow: auto; }
.l-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; font-family: var(--mono); font-size: 11px; }
.fld .mini { flex: none; }
.quotes { font-family: var(--mono); font-size: 12px; }
.quotes div { display: grid; grid-template-columns: 1.4fr 1fr 1fr; padding: 2px 0; gap: 4px; }
.quotes span:not(:first-child) { text-align: right; }
#mm-reset { margin-top: 8px; }
.ledger-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.ledger-note { font-size: 11px; color: var(--muted); margin-top: 6px; }
.oi-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.oi-card { background: var(--panel2); border-radius: var(--radius-s); padding: 10px 12px; min-width: 0; }
.oi-card .h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.oi-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 6px 0 4px; background: var(--bg); }
.oi-bar i { display: block; height: 100%; }
.oi-bar i.l { background: var(--up); }
.oi-bar i.s { background: var(--down); }
.oi-card .row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 2px 0; }
.oi-card .row span { color: var(--muted); }
.oi-card .row b { font-family: var(--mono); font-weight: 500; text-align: right; }
.liq-feed { max-height: 260px; overflow: auto; font-size: 12px; }
.liq-feed > div { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 8px; padding: 4px 0; border-bottom: 1px dashed rgba(36, 67, 78, 0.7); }
.liq-feed .t { font-family: var(--mono); color: var(--muted); font-size: 11px; }
.liq-feed b { font-family: var(--mono); font-weight: 500; }
.list-form .fld input { text-align: left; font-family: var(--sans); }
.list-form .fld input[type='number'] { text-align: right; font-family: var(--mono); }
.listing { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 8px 0; border-bottom: 1px dashed rgba(36, 67, 78, 0.7); font-size: 12px; }
.listing .nm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.listing .nm b { font-size: 13px; }
.listing .meta { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }

/* ───────── 量化页 ───────── */
.q-grid { display: grid; gap: 8px; grid-template-columns: 280px minmax(0, 1fr) 360px; height: calc(100vh - var(--top-h) - 16px); }
.q-list, .q-side { overflow: auto; }
.q-item { padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; border: 1px solid transparent; margin-bottom: 4px; background: var(--panel2); }
.q-item.on { border-color: var(--mint-d); }
.q-item .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.q-item .dot.run { background: var(--up); box-shadow: 0 0 6px var(--up); }
.q-tpl { padding: 8px 10px; border-radius: var(--radius-s); border: 1px solid var(--line); margin-bottom: 6px; cursor: pointer; }
.q-tpl:hover { border-color: var(--mint-d); }
.q-tpl p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.q-editor { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.q-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-toolbar input, .q-toolbar select { background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; padding: 6px 8px; min-width: 0; }
#q-name { width: 180px; max-width: 100%; }
.q-iv { color: var(--muted); font-size: 12px; white-space: nowrap; }
.q-iv input { width: 56px; }
.q-toolbar .grow { flex: 1; }
.q-toolbar .btn { padding: 6px 12px; }
.q-desc { font-size: 12px; color: var(--muted); }
#q-code { flex: 1; min-height: 300px; background: var(--bg); border: 1px solid var(--line2); border-radius: var(--radius-s); padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; resize: none; outline: none; tab-size: 2; white-space: pre; overflow: auto; width: 100%; }
#q-code:focus { border-color: var(--mint-d); }
.logs { font-family: var(--mono); font-size: 11.5px; }
.logs div { padding: 2px 0; border-bottom: 1px solid rgba(27, 54, 64, 0.5); word-break: break-all; }
.logs .t { color: var(--muted); margin-right: 8px; }
.doc { font-size: 12px; }
.doc pre { background: var(--bg); border-radius: var(--radius-s); padding: 8px; font-family: var(--mono); font-size: 11.5px; overflow-x: auto; }
.doc h4 { margin: 12px 0 4px; color: var(--mint); }
.doc code { background: var(--bg); padding: 0 4px; border-radius: 3px; font-family: var(--mono); }

/* ───────── 排行榜 / 学院 ───────── */
.board { max-width: 1200px; margin: 0 auto; }
.ac-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 8px; align-items: start; }
.ac-main, .ac-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ac-side { position: sticky; top: calc(var(--top-h) + 8px); }
.ac-events { max-height: 420px; overflow: auto; }
.lessons details { border-bottom: 1px solid var(--line); }
.lessons summary { padding: 10px 4px; cursor: pointer; font-weight: 600; font-size: 14px; }
.lessons summary:hover { color: var(--mint); }
.lesson { padding: 0 8px 12px; color: var(--text2); line-height: 1.75; }
.lesson ul { padding-left: 20px; }
.kind { padding: 10px 0; border-bottom: 1px solid var(--line); }
.kind-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.kind p { margin: 4px 0 6px; color: var(--muted); font-size: 12px; }
.kind-list { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.kind-list span { background: var(--panel2); border-radius: 4px; padding: 2px 8px; }

/* 指标说明抽屉 */
.drawer-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 55; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100vw; background: var(--panel); border-left: 1px solid var(--line2); z-index: 56; display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4); }
.drawer-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { margin: 0; font-size: 15px; flex: 1; }
.drawer-b { overflow: auto; padding: 4px 16px 24px; flex: 1; }
.ind-doc { padding: 14px 0; border-bottom: 1px solid var(--line); }
.ind-doc h4 { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.ind-doc p { margin: 6px 0; color: var(--text2); line-height: 1.7; }
.ind-doc .formula { background: var(--bg); border-left: 3px solid var(--mint-d); padding: 6px 10px; border-radius: 0 6px 6px 0; font-family: var(--mono); font-size: 12px; color: var(--text); margin: 8px 0; overflow-x: auto; }
.ind-doc .params { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin: 8px 0; }
.ind-doc .params .fld { margin: 0; }
.ind-doc .ptable { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.ind-doc .ptable td { padding: 4px 6px; border-bottom: 1px dashed var(--line); vertical-align: top; color: var(--text2); }
.ind-doc .ptable td:first-child { white-space: nowrap; color: var(--mint); font-family: var(--mono); width: 1%; }

/* ───────── 复盘 ───────── */
.rp-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; gap: 8px; align-items: start; }
.rp-list { display: flex; flex-direction: column; gap: 6px; }
.rp-case { padding: 10px 12px; border-radius: var(--radius-s); border: 1px solid var(--line); cursor: pointer; background: var(--panel2); }
.rp-case:hover { border-color: var(--line2); }
.rp-case.on { border-color: var(--mint-d); background: var(--mint-a); }
.rp-case b { display: block; font-size: 13px; }
.rp-case small { color: var(--muted); font-size: 11px; }
.rp-case .badge { margin-left: 0; margin-right: 4px; }
.rp-chart-panel { display: flex; flex-direction: column; gap: 8px; }
.rp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-head h3 { margin: 0; font-size: 15px; }
#rp-chart { height: 440px; position: relative; }
.rp-ctl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rp-ctl .btn { flex: 1; min-width: 92px; }
.rp-stat { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rp-prog { height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.rp-prog i { display: block; height: 100%; background: var(--mint-d); }
.rp-stage { padding: 10px 12px; border-left: 3px solid var(--line2); background: var(--panel2); border-radius: 0 var(--radius-s) var(--radius-s) 0; margin-bottom: 8px; font-size: 12px; line-height: 1.7; color: var(--text2); }
.rp-stage.cur { border-left-color: var(--mint); }
.rp-stage.locked { opacity: 0.55; }
.rp-stage h4 { margin: 0 0 4px; font-size: 13px; color: var(--text); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.rp-stage h4 small { color: var(--muted); font-weight: 400; }
.rp-stage .facts { font-family: var(--mono); font-size: 11.5px; color: var(--text); background: var(--bg); padding: 6px 8px; border-radius: 4px; margin: 6px 0; overflow-wrap: anywhere; }
.rp-stage .you { font-size: 12px; margin-top: 4px; }
.rp-result { padding: 12px; border-radius: var(--radius-s); background: var(--mint-a); border: 1px solid rgba(151, 252, 228, 0.25); margin-bottom: 8px; }
.rp-src { font-size: 11px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.rp-pos { display: inline-flex; gap: 6px; align-items: center; }

/* ───────── 弹窗 & 提示 ───────── */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; padding: 22px 24px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.role-pick label { display: flex; gap: 8px; border: 1px solid var(--line2); border-radius: var(--radius-s); padding: 10px; cursor: pointer; }
.role-pick label:has(input:checked) { border-color: var(--mint-d); background: var(--mint-a); }
.role-pick p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
#toasts { position: fixed; top: calc(var(--top-h) + var(--mbar-h) + 10px); right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 6px; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--blue); border-radius: var(--radius-s); padding: 9px 12px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); transition: opacity 0.4s, transform 0.4s; overflow-wrap: anywhere; }
.toast.ok { border-left-color: var(--up); }
.toast.err { border-left-color: var(--down); }
.toast.news { border-left-color: var(--mint); }
.toast.out { opacity: 0; transform: translateX(20px); }

/* ───────── 新手引导 ───────── */
#tour { position: fixed; inset: 0; z-index: 70; }
.tour-hole { position: fixed; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.68); outline: 2px solid var(--mint); transition: all 0.3s ease; pointer-events: none; }
.tour-card { position: fixed; width: 400px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--mint-d); border-radius: 12px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); transition: left 0.3s ease, top 0.3s ease; }
.tour-card h3 { margin: 6px 0 8px; font-size: 16px; }
.tour-body { color: var(--text2); line-height: 1.7; font-size: 13px; }
.tour-body p { margin: 6px 0; }
.tour-body .formula { background: var(--bg); border-left: 3px solid var(--mint-d); padding: 6px 10px; border-radius: 0 6px 6px 0; font-family: var(--mono); font-size: 12px; color: var(--text); }
.tour-body .calc { background: rgba(124, 183, 255, 0.08); border: 1px dashed rgba(124, 183, 255, 0.4); padding: 6px 10px; border-radius: 6px; font-family: var(--mono); font-size: 12px; word-break: break-word; }
.tour-prog { position: relative; font-size: 11px; color: var(--muted); padding-bottom: 6px; }
.tour-prog i { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--mint); border-radius: 2px; }
.tour-btns { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.tour-btns .grow { flex: 1; }
.tour-btns .btn { padding: 7px 14px; }
.tour-svg { width: 100%; max-width: 260px; display: block; margin: 4px auto 8px; overflow: visible; }
.tour-svg text { fill: var(--muted); font-size: 11px; }
.tour-svg text.h { fill: var(--text); font-weight: 600; }

/* ───────── 借贷页 ───────── */
.lend-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 8px; align-items: start; max-width: 1440px; margin: 0 auto; }
.lend-main, .lend-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pools { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pool { background: var(--panel2); border-radius: var(--radius-s); padding: 12px; min-width: 0; }
.pool-h { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 15px; flex-wrap: wrap; }
.util-bar { height: 6px; background: var(--bg); border-radius: 3px; margin: 10px 0 6px; overflow: hidden; }
.util-bar i { display: block; height: 100%; background: var(--mint-d); }
.curve { width: 100%; max-height: 130px; display: block; margin-top: 4px; }
.curve .rate { fill: none; stroke: var(--blue); stroke-width: 2; }
.curve .kink { stroke: var(--line2); stroke-dasharray: 3 3; }
.curve .now { fill: var(--mint); }
.curve text { fill: var(--muted); font-size: 10px; }
.risk { margin-top: 12px; }
.risk-h { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.risk-h span { color: var(--muted); }
.risk-bar { position: relative; height: 8px; background: var(--bg); border-radius: 4px; margin-bottom: 6px; }
.risk-bar i { display: block; height: 100%; border-radius: 4px; }
.risk-bar em { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--mint); }
.risk-bar em.liq { background: var(--down); }
.risk-bar i.up-bg { background: var(--up); }
.risk-bar i.warn-bg { background: var(--warn); }
.risk-bar i.down-bg { background: var(--down); }
.btn.wide { width: 100%; margin-top: 10px; }
#lend-assets { margin-top: -2px; flex-wrap: wrap; }

/* ───────── 风险实验室 ───────── */
.rk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; max-width: 1440px; margin: 0 auto; align-items: start; }
.rk-wide { grid-column: 1 / -1; }
.lev-btns.big { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 8px 0 10px; }
.lev-btns.big button { padding: 6px 0; font-size: 13px; }
.rk-verdict { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--panel2); border-left: 3px solid currentColor; line-height: 1.7; }
.rk-verdict b { color: inherit; }
.rk-verdict .small { color: var(--muted); margin-top: 4px; }
.rk-total { font-size: 14px; margin-bottom: 8px; }
.flow-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 90px; gap: 8px; align-items: center; font-size: 12px; padding: 4px 0; }
.flow-row span { color: var(--muted); }
.flow-row b { text-align: right; font-family: var(--mono); font-weight: 500; }
.flow-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.flow-bar i { display: block; height: 100%; }
.flow-bar i.pos { background: var(--up); }
.flow-bar i.neg { background: var(--down); }
.cps > div { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed rgba(36, 67, 78, 0.7); font-size: 12px; }
.cps em { font-style: normal; }
.rk-ledger { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.rk-ledger .tbl { align-self: start; }
.rk-why { font-size: 12px; color: var(--text2); line-height: 1.7; }
.rk-why ol { padding-left: 18px; margin: 6px 0; }
.rk-why .kv-list { margin-bottom: 10px; }

/* ───────── 竞技 ───────── */
.gm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; max-width: 1440px; margin: 0 auto; align-items: start; }
.gm-wide { grid-column: 1 / -1; }
.pd-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; flex-wrap: wrap; }
.pd-head .grow { flex: 1; }
.pd-price { display: flex; gap: 24px; align-items: flex-end; margin-bottom: 12px; flex-wrap: wrap; }
.pd-price > div { display: flex; flex-direction: column; }
.pd-price b { font-size: 20px; font-family: var(--mono); font-weight: 500; }
.pd-pools { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.pd-side { display: flex; flex-direction: column; font-size: 12px; min-width: 0; }
.pd-side.up { color: var(--up); }
.pd-side.down { color: var(--down); text-align: right; }
.pd-side em { font-style: normal; font-size: 16px; font-weight: 700; }
.pd-side span { color: var(--muted); }
.pd-bar { height: 10px; background: var(--down); border-radius: 5px; overflow: hidden; }
.pd-bar i { display: block; height: 100%; background: var(--up); }
.pd-hist { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 8px; }
.pd-hist span { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; background: var(--panel2); font-size: 11px; }
.pd-hist .up-chip { background: var(--up-a); color: var(--up); }
.pd-hist .down-chip { background: var(--down-a); color: var(--down); }
.tbl tr.out td { opacity: 0.5; }
.ar-rules { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.7; }
.ar-rules b { color: var(--text); }
.ar-hist > div { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 4px 0; border-bottom: 1px dashed rgba(36, 67, 78, 0.7); flex-wrap: wrap; }
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.ms { background: var(--panel2); border-radius: var(--radius-s); padding: 10px 12px; border: 1px solid transparent; display: flex; flex-direction: column; gap: 6px; }
.ms.done { border-color: var(--mint-d); }
.ms.claimed { opacity: 0.6; }
.ms-h { display: flex; justify-content: space-between; gap: 8px; }
.ms p { margin: 0; font-size: 12px; color: var(--muted); flex: 1; }
.ms .btn { padding: 6px 10px; align-self: flex-start; }
.warn-btn { border-color: var(--mint-d); color: var(--mint); }
.acct .btn { padding: 5px 12px; }
.modal form { margin-top: 4px; }

/* ───────── 响应式 ───────── */
@media (max-width: 1360px) {
  .ticker > div:nth-child(n+6) { display: none; }
  .mm-grid { grid-template-columns: 320px minmax(0, 1fr); }
  .mm-grid > .mm-col:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
  .rp-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .rp-grid > .rp-side { grid-column: 1 / -1; }
  .q-grid { grid-template-columns: 240px minmax(0, 1fr); height: auto; }
  .q-side { grid-column: 1 / -1; max-height: 400px; }
  #q-code { min-height: 480px; }
}
@media (max-width: 1180px) {
  .brand small { display: none; }
  .acct .eq { display: none; }
  .tv-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: 560px auto 300px 300px;
    grid-template-areas: 'chart form' 'chart book' 'bottom bottom' 'side side';
  }
  .book-panel { max-height: 420px; }
  .ac-grid { grid-template-columns: minmax(0, 1fr); }
  .ac-side { position: static; }
  .lend-grid, .rk-grid, .gm-grid, .rk-ledger { grid-template-columns: minmax(0, 1fr); }
  .rk-ledger { overflow-x: auto; }
}
@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 6px 12px 0; gap: 6px 10px; }
  .nav { order: 5; flex-basis: 100%; padding-bottom: 4px; }
  .acct .eq { display: flex; }
  .nav { -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
  .top-right { margin-left: auto; }
  .mbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px 12px; }
  .ticker { order: 5; flex-basis: 100%; gap: 16px; overflow-x: auto; scrollbar-width: none; }
  .ticker::-webkit-scrollbar { display: none; }
  .ticker > div:nth-child(n+6) { display: flex; }
  .feed { margin-left: auto; }
  .tv-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 520px auto 300px 300px;
    grid-template-areas: 'chart chart' 'form book' 'bottom bottom' 'side side';
  }
  .book-panel { max-height: none; }
  .mm-grid, .rp-grid { grid-template-columns: minmax(0, 1fr); }
  .mm-grid > .mm-col:last-child { grid-column: auto; display: flex; }
  .rp-grid > .rp-side { grid-column: auto; }
  .q-grid { grid-template-columns: minmax(0, 1fr); }
  .q-side { grid-column: auto; }
}
@media (max-width: 640px) {
  main { padding: 8px; }
  .topbar { padding: 6px 8px 0; }
  .brand span { font-size: 15px; }
  .acct .role, .acct .uname { display: none; }
  .mbar { padding: 8px; }
  .feed { margin-left: 0; flex-basis: 100%; flex-wrap: wrap; gap: 6px; white-space: normal; }
  .tv-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 460px auto auto 320px 300px;
    grid-template-areas: 'chart' 'form' 'book' 'bottom' 'side';
  }
  .book-panel { max-height: none; }
  .ind-toggles { gap: 8px; }
  .tb-right { margin-left: 0; }
  .sub-wrap { height: 110px; }
  .legend { right: 64px; }
  #chart-legend div:nth-child(2) { display: none; }
  #sub-legend { right: 140px; }
  .legend div { white-space: normal; overflow: visible; }
  .legend div span { display: inline-block; margin-right: 4px; }
  .ticker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; overflow: visible; white-space: normal; }
  .ticker > div { min-width: 0; }
  .ticker > div span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ticker .last { font-size: 18px; }
  .mm-book-wrap { grid-template-columns: minmax(0, 1fr); }
  .mkt-menu .mm-head, .mkt-row { grid-template-columns: minmax(0, 1.4fr) 1fr 0.9fr; }
  .mkt-menu .mm-head span:nth-child(3), .mkt-row .ch { display: none; }
  .rp-stat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #rp-chart { height: 340px; }
  .pd-pools { grid-template-columns: 1fr 1fr; }
  .pd-bar { grid-column: 1 / -1; grid-row: 2; }
  .flow-row { grid-template-columns: minmax(0, 1fr) 70px; }
  .flow-row .flow-bar { grid-column: 1 / -1; grid-row: 2; }
  .lev-btns.big { grid-template-columns: repeat(3, 1fr); }
  .role-pick { grid-template-columns: 1fr; }
  .modal { padding: 18px 16px; }
  .liq-feed > div { grid-template-columns: 56px minmax(0, 1fr); }
  .liq-feed > div > :last-child { grid-column: 2; }
}
