/* ============ 币安模拟盘 - 深色主题 ============ */
:root {
  --bg: #0B0E11;
  --panel: #181A20;
  --panel2: #1E2329;
  --panel3: #2B3139;
  --border: #2B3139;
  --t1: #EAECEF;
  --t2: #848E9C;
  --t3: #5E6673;
  --gold: #FCD535;
  --gold-d: #F0B90B;
  --green: #0ECB81;
  --green-bg: rgba(14, 203, 129, .12);
  --red: #F6465D;
  --red-bg: rgba(246, 70, 93, .12);
  --blue: #3DBAEB;
  --up: #0ECB81;
  --down: #F6465D;
  --up-bg: rgba(14, 203, 129, .12);
  --down-bg: rgba(246, 70, 93, .12);
  --radius: 8px;
  --nav-h: 56px;
  --bnav-h: 58px;
  --gold-toast: #2A2A1E;
  --hero-bg: linear-gradient(135deg, #20242C, #181A20);
  --mask: rgba(0, 0, 0, .65);
  --hole: rgba(0, 0, 0, .72);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 红涨绿跌模式:交换语义涨跌色(买卖按钮等固定色不受影响) */
html[data-swapup="1"] {
  --up: #F6465D;
  --down: #0ECB81;
  --up-bg: rgba(246, 70, 93, .12);
  --down-bg: rgba(14, 203, 129, .1);
}

/* ---- 亮色主题 ---- */
html[data-theme="light"] {
  --bg: #EAECEF;
  --panel: #FFFFFF;
  --panel2: #F5F6F7;
  --panel3: #EAECEF;
  --border: #EAECEF;
  --t1: #181A20;
  --t2: #707A8A;
  --t3: #9BA3AF;
  --green-bg: rgba(14, 203, 129, .1);
  --red-bg: rgba(246, 70, 93, .08);
  --gold-toast: #FFF6D6;
  --hero-bg: linear-gradient(135deg, #FFF6D9, #FFFFFF);
  --mask: rgba(16, 20, 26, .45);
  --hole: rgba(24, 26, 32, .5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--t1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; border: none; outline: none; background: none; color: var(--t1); }
a { color: inherit; text-decoration: none; }
svg { display: block; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

.up, .on-up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.muted { color: var(--t3); }
.hide-sm { display: initial; }

/* ---------- 通用按钮 ---------- */
.btn-gold {
  background: var(--gold); color: #1E2026; font-weight: 600;
  border-radius: var(--radius); padding: 10px 20px; font-size: 14px;
  transition: filter .15s;
}
.btn-gold:hover { filter: brightness(1.06); }
.btn-gold:disabled { background: var(--panel3); color: var(--t3); cursor: not-allowed; }
.btn-gold.big { width: 100%; padding: 13px; font-size: 16px; margin-top: 18px; }
.btn-ghost {
  border: 1px solid var(--panel3); color: var(--t1);
  border-radius: var(--radius); padding: 9px 18px; font-size: 14px;
}
.btn-ghost:hover { border-color: var(--t2); }
.btn-red { background: var(--red); color: #fff; font-weight: 600; border-radius: var(--radius); padding: 10px 20px; }
.btn-danger {
  background: var(--red-bg); color: var(--red); font-weight: 600;
  border-radius: var(--radius); padding: 7px 16px; font-size: 13px;
}
.btn-danger:active { filter: brightness(1.2); }
.link-btn { color: var(--t2); font-size: 12px; }
.link-btn:hover { color: var(--t1); }
.mini {
  border: 1px solid var(--panel3); color: var(--t1); border-radius: 6px;
  font-size: 12px; padding: 4px 10px; white-space: nowrap;
}
.mini.danger { color: var(--red); border-color: rgba(246, 70, 93, .4); }
.mini.gold { color: #1E2026; background: var(--gold); border: none; font-weight: 600; }
.mini:active { filter: brightness(1.2); }

.chip {
  font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 4px;
  display: inline-block; min-width: 64px; text-align: center;
}
.chip.up { color: var(--up); background: var(--up-bg); }
.chip.down { color: var(--down); background: var(--down-bg); }

/* 价格闪烁 */
@keyframes flUp { 0%, 60% { color: var(--up); } 100% { color: var(--t1); } }
@keyframes flDown { 0%, 60% { color: var(--down); } 100% { color: var(--t1); } }
.fl-up { animation: flUp .8s; }
.fl-down { animation: flDown .8s; }

/* ---------- 顶栏 ---------- */
#topnav {
  position: sticky; top: 0; z-index: 90;
  height: var(--nav-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
}
.nav-left { display: flex; align-items: center; gap: 28px; }
.logo { display: flex; align-items: center; gap: 8px; }
.logo-text { font-weight: 800; font-size: 17px; letter-spacing: .5px; color: var(--t1); }
.logo-badge {
  background: var(--gold); color: #1E2026; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px; transform: translateY(-1px);
}
.logo-badge.pro-badge { background: #7B61FF; color: #fff; }

/* 多币看板(专业模式) */
.wl-title { font-size: 12px; color: var(--t2); padding: 9px 12px 7px; display: block; border-bottom: 1px solid var(--border); }
.wl-scroll { flex: 1; overflow-y: auto; }
.wl-row {
  padding: 7px 12px; cursor: pointer;
  border-bottom: 1px solid rgba(43, 49, 57, .4);
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.wl-row:hover { background: var(--panel2); }
.wl-row.on { background: var(--panel2); box-shadow: inset 2px 0 0 var(--gold); }
.wl-row.on .wl-base { color: var(--gold); }
.wl-base { font-size: 12px; font-weight: 600; }
.wl-price { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; }
.wl-price i { font-style: normal; font-size: 12px; font-variant-numeric: tabular-nums; }
html[data-pro="1"] .trade-grid { grid-template-columns: 190px minmax(0, 1fr) 290px 320px; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--t2); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 6px; position: relative;
}
.nav-links a:hover { color: var(--gold); }
.nav-links a.on { color: var(--gold); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-author {
  display: flex; align-items: center; gap: 8px;
  color: var(--t2); font-size: 13px; white-space: nowrap;
}
.nav-author strong { color: var(--t1); font-weight: 600; }
.nav-author a {
  color: var(--gold); border: 1px solid rgba(252, 213, 53, .4);
  border-radius: 14px; padding: 2px 11px; font-size: 12px;
}
.nav-author a:hover { background: rgba(252, 213, 53, .1); }
.equity-chip {
  background: var(--panel2); border: 1px solid var(--border); color: var(--gold);
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 20px;
  font-variant-numeric: tabular-nums;
}
.icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--t2);
}
.icon-btn:hover { color: var(--t1); background: var(--panel2); }
.badge {
  position: absolute; top: 2px; right: 0;
  background: var(--red); color: #fff; font-size: 10px; line-height: 1;
  padding: 2px 5px; border-radius: 8px; font-weight: 700;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #E8A600);
  color: #1E2026; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* 下拉面板 */
.dropdown {
  position: absolute; top: calc(var(--nav-h) - 6px); right: 12px; z-index: 95;
  width: 320px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.dd-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.dd-body { max-height: 380px; overflow-y: auto; padding: 6px 0; }
.ev-row { display: flex; gap: 10px; padding: 8px 14px; align-items: flex-start; }
.ev-row:hover { background: var(--panel2); }
.ev-row .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--t3); }
.ev-row .dot.fill { background: var(--green); }
.ev-row .dot.fut { background: var(--red); }
.ev-row .dot.news { background: var(--gold); }
.ev-row .dot.ach { background: var(--gold); }
.ev-row .dot.system { background: var(--blue); }
.ev-txt p { font-size: 13px; color: var(--t1); }
.ev-txt time { font-size: 11px; color: var(--t3); }
.dd-up { padding: 14px; border-bottom: 1px solid var(--border); }
.dd-up small { color: var(--t2); display: block; font-size: 12px; }
.dd-up b { font-size: 18px; color: var(--gold); }
.dd-item {
  display: block; width: 100%; text-align: left; padding: 11px 14px;
  font-size: 14px; color: var(--t1);
}
.dd-item:hover { background: var(--panel2); }
.dd-foot { padding: 10px 14px; font-size: 11px; color: var(--t3); border-top: 1px solid var(--border); }

/* ---------- 底部导航(移动端) ---------- */
#bottomnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  height: calc(var(--bnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--panel); border-top: 1px solid var(--border);
}
#bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--t2); font-size: 10px;
}
#bottomnav a.on { color: var(--gold); }
#bottomnav { display: none; }

/* ---------- 页面容器 ---------- */
#view { min-height: calc(100vh - var(--nav-h)); }
.page { padding: 0 16px 40px; max-width: 1440px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; padding: 20px 0 14px; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.sim-tag {
  background: var(--panel2); border: 1px solid var(--border); color: var(--t2);
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
}
.panel { background: var(--panel); border-radius: var(--radius); }
.empty { padding: 36px 12px; text-align: center; color: var(--t3); font-size: 13px; }
.empty small { font-size: 12px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  color: var(--t2); font-size: 14px; padding: 10px 14px; position: relative;
  white-space: nowrap; font-weight: 500;
}
.tabs button.on { color: var(--gold); font-weight: 600; }
.tabs button.on::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px;
  height: 2px; background: var(--gold); border-radius: 1px;
}
.tabs.small button { font-size: 13px; padding: 9px 12px; }
.tabs.small button.on::after { left: 12px; right: 12px; }

/* ---------- 行情页 ---------- */
.search-box {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 20px;
  padding: 7px 14px; color: var(--t2); width: 240px;
}
.search-box input { flex: 1; font-size: 13px; color: var(--t1); }
.search-box input::placeholder { color: var(--t3); }
.mkt-table { margin-top: 12px; overflow: hidden; }
.mkt-head, .mkt-row {
  display: grid;
  grid-template-columns: 26px 32px minmax(110px, 1.3fr) 1.2fr 1fr 1fr .9fr;
  gap: 6px; align-items: center; padding: 0 12px;
}
.mkt-head { color: var(--t3); font-size: 12px; height: 38px; border-bottom: 1px solid var(--border); }
.mkt-head .num { text-align: right; }
.mkt-row { height: 54px; cursor: pointer; border-bottom: 1px solid rgba(43, 49, 57, .5); }
.mkt-row:last-child { border-bottom: none; }
.mkt-row:hover { background: var(--panel2); }
.mkt-row .star { color: var(--t3); width: 26px; }
.mkt-row .star.on { color: var(--gold); }
.coin-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.coin-icon svg { display: block; width: 100%; height: 100%; }
.coin-img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* 持有面板(现货) */
.hold-box { display: flex; align-items: center; gap: 20px; padding: 16px 14px; flex-wrap: wrap; }
.hold-cell label { font-size: 11px; color: var(--t3); display: block; margin-bottom: 2px; }
.hold-cell b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hold-cell.main b { font-size: 18px; font-weight: 700; }
.hold-cell b small { font-size: 11px; color: var(--t2); font-weight: 400; }
.mkt-name b { font-size: 14px; font-weight: 600; display: block; }
.mkt-name b i { font-style: normal; color: var(--t3); font-size: 11px; font-weight: 400; }
.mkt-name small { color: var(--t2); font-size: 11px; }
.mkt-price { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.mkt-row .chip { justify-self: end; }
.mkt-vol { color: var(--t2); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.mkt-spark { text-align: right; }
.mkt-spark svg { display: inline-block; }

/* ---------- 交易页 ---------- */
.trade-page {
  padding: 0; max-width: none;
  display: flex; flex-direction: column;
  height: calc(100vh - var(--nav-h)); overflow: hidden;
}
.ticker-bar {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.sym-sel { display: flex; align-items: center; gap: 10px; color: var(--t2); }
.sym-names b { font-size: 16px; color: var(--t1); display: block; line-height: 1.2; }
.sym-names small { font-size: 11px; color: var(--t2); }
.ticker-bar { position: relative; }
.sym-panel { top: calc(100% + 2px); left: 14px; right: auto; width: 300px; max-height: 60vh; overflow-y: auto; }
.sym-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; }
.sym-row:hover { background: var(--panel2); }
.sym-row.on { background: var(--panel2); box-shadow: inset 2px 0 0 var(--gold); }
.sym-row.on .sym-name b { color: var(--gold); }
.sym-name { flex: 1; min-width: 0; }
.sym-name b { font-size: 13px; display: block; line-height: 1.25; }
.sym-name small { color: var(--t2); font-size: 11px; }
.sym-p { text-align: right; font-variant-numeric: tabular-nums; }
.sym-p span { font-size: 13px; display: block; font-weight: 600; }
.sym-p small { font-size: 11px; }
.tk-price { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tk-stats { display: flex; gap: 22px; flex-wrap: wrap; }
.tk-stat label { display: block; font-size: 11px; color: var(--t3); }
.tk-stat b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.trade-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px 320px;
  gap: 1px; background: var(--border);
  flex: 1; min-height: 0;
}
.bottom-panel { background: var(--panel); border-top: 1px solid var(--border); flex: none; height: 244px; display: flex; flex-direction: column; }
.bottom-panel .bot-view { flex: 1; }
.panel { min-height: 0; }
.chart-panel { display: flex; flex-direction: column; background: var(--panel); }
.chart-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 10px; border-bottom: 1px solid var(--border); min-height: 38px;
}
.tf-group { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tf-group::-webkit-scrollbar { display: none; }
.tf-group button { color: var(--t2); font-size: 12px; padding: 6px 9px; border-radius: 4px; white-space: nowrap; }
.tf-group button.on { color: #1E2026; background: var(--gold); font-weight: 700; }
.chart-tools { display: flex; gap: 4px; }
.chart-tools button {
  color: var(--t2); font-size: 12px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 4px;
}
.chart-tools button.on { color: var(--gold); border-color: rgba(252, 213, 53, .4); }
.chart-wrap { flex: 1; position: relative; min-height: 0; }
.chart-wrap canvas { position: absolute; inset: 0; touch-action: none; }

.side-panel { display: flex; flex-direction: column; background: var(--panel); overflow: hidden; }
.book-top { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); flex: none; }
.book-top .tabs { flex: 1; border-bottom: none; }
.book-top .tabs button.on::after { bottom: 0; }
.fold-btn {
  width: 30px; height: 30px; margin-right: 6px; color: var(--t2); flex: none;
  display: flex; align-items: center; justify-content: center; border-radius: 6px;
}
.fold-btn:hover { background: var(--panel2); color: var(--t1); }
.fold-btn svg { transition: transform .25s; }
.book-panel.collapsed .book-scroll { display: none; }
.book-panel.collapsed .fold-btn svg { transform: rotate(180deg); }
.book-scroll { flex: 1; overflow-y: auto; padding: 4px 0 10px; }
.bk-head, .td-row {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr;
  padding: 0 12px; font-size: 11px; color: var(--t3);
}
.bk-head { height: 28px; align-items: center; border-bottom: 1px solid rgba(43, 49, 57, .4); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.bk-head span:not(:first-child), .bk-row span:not(:first-child), .td-row span:not(:first-child) { text-align: right; }
.bk-row {
  position: relative; display: grid; grid-template-columns: 1.1fr 1fr 1fr;
  font-size: 12px; height: 21px; align-items: center; padding: 0 12px;
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.bk-row i {
  position: absolute; right: 0; top: 1px; bottom: 1px; z-index: 0;
}
.bk-row.ask i { background: var(--down-bg); }
.bk-row.bid i { background: var(--up-bg); }
.bk-row span { position: relative; z-index: 1; }
.bk-row .p.ask, .td-row .p.down { color: var(--red); }
.bk-row .p.bid, .td-row .p.up { color: var(--green); }
.bk-row span:not(:first-child) { color: var(--t2); }
.bk-row:hover { background: var(--panel2); }
.bk-mid {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 12px; border-top: 1px solid rgba(43, 49, 57, .4); border-bottom: 1px solid rgba(43, 49, 57, .4);
}
.bk-mid b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bk-mid span { font-size: 11px; color: var(--t3); }
.td-row { height: 22px; align-items: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.td-row .t { color: var(--t3); }

/* 下单表单 */
.form-panel { overflow-y: auto; padding: 12px 14px 16px; }
.form-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.form-head b { font-size: 14px; }
.side-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.side-switch button {
  padding: 8px; border-radius: 6px; color: var(--t2); font-size: 14px; font-weight: 600;
  background: var(--panel2);
}
.side-switch button.on:first-child { background: var(--green-bg); color: var(--green); }
.side-switch button.on:last-child { background: var(--red-bg); color: var(--red); }
.type-tabs { display: flex; gap: 14px; margin-bottom: 8px; }
.type-tabs button { color: var(--t2); font-size: 13px; padding: 4px 0; position: relative; }
.type-tabs button.on { color: var(--t1); font-weight: 600; }
.type-tabs button.on::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--gold); border-radius: 1px;
}
.field { margin-bottom: 8px; }
.field label { font-size: 12px; color: var(--t2); display: block; margin-bottom: 4px; }
.field label span { color: var(--t3); }
.inp {
  display: flex; align-items: center; background: var(--panel2);
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.inp:focus-within { border-color: var(--gold-d); }
.inp input { flex: 1; padding: 9px 10px; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; }
.inp .step {
  width: 32px; height: 36px; color: var(--t2); font-size: 16px; flex: none;
}
.inp .step:active { background: var(--panel3); color: var(--t1); }
.pct-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.pct-row button {
  border: 1px solid var(--border); color: var(--t2); font-size: 12px;
  border-radius: 5px; padding: 5px 0;
}
.pct-row button:active { border-color: var(--gold-d); color: var(--gold); }
.hint-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--t2); padding: 2px 0; }
.hint-line b { color: var(--t1); font-variant-numeric: tabular-nums; font-weight: 600; }
.hint-line .fee { color: var(--t3); font-size: 11px; }
.sub-btn {
  width: 100%; padding: 12px; border-radius: 6px; font-size: 15px; font-weight: 700;
  margin-top: 10px; color: #fff;
}
.sub-btn.buy { background: var(--green); }
.sub-btn.sell { background: var(--red); }
.sub-btn:active { filter: brightness(1.1); }
.fee-note { font-size: 11px; color: var(--t3); margin-top: 10px; line-height: 1.6; }
.lev-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.lev-row label { font-size: 12px; color: var(--t2); }
.lev-chips { display: flex; gap: 6px; }
.lev-chips button {
  border: 1px solid var(--border); color: var(--t2); font-size: 12px; font-weight: 600;
  border-radius: 5px; padding: 4px 9px;
}
.lev-chips button.on { border-color: var(--gold); color: var(--gold); background: rgba(252, 213, 53, .08); }
.fut-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.fut-btns .sub-btn { margin-top: 0; font-size: 14px; padding: 11px 0; }

/* 挑战模式切换与仓位卡 */
.ch-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.ch-mode button {
  padding: 8px; border-radius: 6px; color: var(--t2); font-size: 13px; font-weight: 600;
  background: var(--panel2);
}
.ch-mode button.on { background: rgba(252, 213, 53, .12); color: var(--gold); }
.ch-pos {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-top: 12px; background: var(--panel2);
}
.chpos-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chpos-head b { font-size: 14px; margin-right: auto; }
.chpos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 6px; }
.chpos-grid label { font-size: 10px; color: var(--t3); display: block; }
.chpos-grid b { font-size: 12px; font-variant-numeric: tabular-nums; }

/* 资产页全部委托 */
.ao-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid rgba(43, 49, 57, .4); font-size: 13px;
}
.ao-row:last-child { border-bottom: none; }
.ao-sym { flex: 1.2; min-width: 0; }
.ao-sym b { font-size: 13px; display: block; line-height: 1.2; }
.ao-sym small { color: var(--t3); font-size: 11px; }
.ao-cell { flex: 1; }
.ao-cell label { font-size: 10px; color: var(--t3); display: block; }
.ao-cell b { font-size: 12px; font-variant-numeric: tabular-nums; }
.ao-row .mini { flex: none; }

/* 杠杆滑条 + 平仓比例滑条 */
input[type="range"] { accent-color: var(--gold-d); cursor: pointer; }
.lev-field { margin-bottom: 10px; }
.lev-field label b { color: var(--gold); font-size: 14px; margin-right: 2px; }
.lev-field label span { color: var(--t3); font-weight: 400; }
.lev-ctrl { display: flex; align-items: center; gap: 8px; }
.lev-ctrl input[type="range"] { flex: 1; min-width: 0; }
.lev-num { width: 72px; flex: none; }
.lev-num input { text-align: center; }
.pos-slider { display: inline-flex; align-items: center; gap: 4px; }
.pos-slider input[type="range"] { width: 86px; }
.pos-slider i { font-style: normal; font-size: 11px; color: var(--t2); width: 34px; text-align: right; flex: none; }
.b-act .mini { min-width: 52px; text-align: center; flex: none; }
.bot-row.pos { height: auto; min-height: 44px; padding: 7px 0; }

/* 底部面板(委托/持仓) */
.bottom-panel { background: var(--panel); border-top: 1px solid var(--border); }
.bot-view { overflow-y: auto; min-height: 80px; max-height: 210px; font-size: 12px; }
.bot-head, .bot-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr 1fr 1.2fr auto;
  gap: 8px; align-items: center; padding: 0 14px;
  font-variant-numeric: tabular-nums;
}
.bot-head { color: var(--t3); font-size: 11px; height: 32px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.bot-row { height: 44px; border-top: 1px solid rgba(43, 49, 57, .4); }
.bot-head span:last-child, .bot-row span:last-child { text-align: right; }
.b-sym { display: flex; align-items: center; gap: 8px; }
.b-sym b { font-size: 13px; display: block; line-height: 1.2; }
.b-sym small { color: var(--t2); display: flex; align-items: center; gap: 5px; }
.b-sym small i {
  font-style: normal; font-size: 10px; padding: 0 4px; border-radius: 3px; font-weight: 600;
}
.dirchip.up { color: var(--up); background: var(--up-bg); }
.dirchip.down { color: var(--down); background: var(--down-bg); }
.b-act { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- 资产页 ---------- */
.asset-cards { display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px; }
.a-card { background: var(--panel); border-radius: var(--radius); padding: 14px 16px; }
.a-card.main { grid-column: span 4; background: var(--hero-bg); border: 1px solid var(--border); }
.asset-cards > .a-card:not(.main) { grid-column: span 2; }
.a-card label { font-size: 12px; color: var(--t2); display: block; }
.a-card b { font-size: 20px; font-weight: 700; display: block; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.a-card.main b { font-size: 26px; color: var(--gold); }
.a-card small { font-size: 11px; color: var(--t3); }
.signin-card { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; margin-top: 12px; }
.si-left { display: flex; align-items: center; gap: 12px; }
.si-left b { display: block; font-size: 14px; }
.si-left small { color: var(--t2); font-size: 12px; }
.asset-sec { margin-top: 12px; padding: 14px 16px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sec-head h3 { font-size: 15px; }
.sec-hint { font-size: 12px; color: var(--t2); }
.w-row {
  display: grid; grid-template-columns: 32px 1.4fr 1.2fr 1.2fr auto;
  gap: 10px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid rgba(43, 49, 57, .4);
}
.w-row:last-child { border-bottom: none; }
.w-name b { font-size: 14px; display: block; line-height: 1.2; }
.w-name small, .w-amt small { color: var(--t2); font-size: 11px; }
.w-amt b { font-size: 13px; font-variant-numeric: tabular-nums; display: block; }
.w-val { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.w-val small { font-size: 11px; }
.ach-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ach {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 8px;
  text-align: center; opacity: .45; filter: grayscale(1);
}
.ach.on { opacity: 1; filter: none; border-color: rgba(252, 213, 53, .35); background: rgba(252, 213, 53, .04); }
.ach-ic { font-size: 22px; display: block; margin-bottom: 4px; }
.ach b { font-size: 12px; display: block; }
.ach small { font-size: 10px; color: var(--t2); display: block; line-height: 1.4; margin-top: 2px; }
.set-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid rgba(43, 49, 57, .4);
}
.set-row:last-child { border-bottom: none; }
.set-l { display: flex; align-items: center; gap: 10px; color: var(--t1); font-size: 14px; }
.set-l svg { color: var(--t2); }
.set-l small { color: var(--t3); font-size: 11px; display: block; }
.switch {
  width: 40px; height: 22px; border-radius: 11px; background: var(--panel3);
  position: relative; transition: background .2s; flex: none;
}
.switch::after {
  content: ''; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .2s;
}
.switch.on { background: var(--gold); }
.switch.on::after { transform: translateX(18px); }
/* ---------- 挑战模式 ---------- */
.ch-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; align-items: start; }
.ch-side { padding: 16px; }
.ch-hero { text-align: center; padding: 6px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.ch-trophy { font-size: 30px; display: block; }
.ch-hero b { font-size: 17px; display: block; margin: 4px 0 6px; }
.ch-hero small { color: var(--t2); font-size: 12px; line-height: 1.7; }
.ch-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ch-meta > div { background: var(--panel2); border-radius: 8px; padding: 8px 4px; text-align: center; }
.ch-meta label { font-size: 10px; color: var(--t3); display: block; }
.ch-meta b { font-size: 13px; font-variant-numeric: tabular-nums; }
.ch-coins > label { font-size: 12px; color: var(--t2); display: block; margin-bottom: 6px; }
.ch-coin-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ch-coin-chips button {
  border: 1px solid var(--border); color: var(--t2); font-size: 12px;
  padding: 4px 11px; border-radius: 14px;
}
.ch-coin-chips button.on {
  border-color: var(--gold); color: var(--gold);
  background: rgba(252, 213, 53, .08); font-weight: 600;
}
.ch-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.ch-main { padding: 12px; }
.ch-status {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.ch-eq label { font-size: 11px; color: var(--t3); display: block; }
.ch-eq b { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ch-eq.main b { font-size: 20px; color: var(--gold); }
.ch-status .btn-danger { margin-left: auto; }
.ch-chart { height: 380px; border-bottom: 1px solid var(--border); }
.ch-form { padding: 12px 4px 0; }
.ch-form .side-switch { margin-bottom: 10px; }
.rank-list { max-height: 320px; overflow-y: auto; }
.rank-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 4px; border-bottom: 1px solid rgba(43, 49, 57, .4); font-size: 13px;
}
.rank-row.me { color: var(--gold); border-bottom: none; padding-top: 10px; font-weight: 600; }

.disclaimer { font-size: 11px; color: var(--t3); text-align: center; padding: 18px 10px; line-height: 1.7; }

/* ---------- 吐司 / 弹窗 ---------- */
#toasts {
  position: fixed; top: calc(var(--nav-h) + 10px); left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  background: var(--panel3); color: var(--t1); font-size: 13px;
  padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
  border-left: 3px solid var(--t2); max-width: 92vw;
  animation: toastIn .25s ease-out;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.gold { border-left-color: var(--gold); background: var(--gold-toast); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.modal-mask {
  position: fixed; inset: 0; z-index: 300; background: var(--mask);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; width: 440px; max-width: 100%; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  animation: popIn .22s ease-out;
}
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(10px); } }
.modal h2 { font-size: 20px; margin-bottom: 4px; text-align: center; }
.modal h3 { font-size: 17px; margin-bottom: 10px; }
.modal h3.danger, .modal h2.danger { color: var(--red); }
.m-logo { display: flex; justify-content: center; margin-bottom: 8px; }
.m-sub { text-align: center; color: var(--t2); font-size: 13px; margin-bottom: 16px; }
.m-rules { list-style: none; }
.m-rules li { font-size: 13px; color: var(--t1); padding: 7px 0; line-height: 1.6; }
.m-foot { text-align: center; color: var(--t3); font-size: 11px; margin-top: 12px; }
.m-body { font-size: 14px; color: var(--t1); line-height: 1.7; margin: 8px 0 4px; }
.m-btns { display: flex; gap: 10px; margin-top: 18px; }
.m-btns button { flex: 1; }
.modal.small { width: 360px; }
.btn-ghost.big { display: block; width: 100%; padding: 12px; font-size: 15px; margin-top: 10px; }
.liq-icon { font-size: 40px; text-align: center; margin-bottom: 6px; }

/* ---------- 主题切换 ---------- */
.theme-seg { display: flex; gap: 6px; }
.theme-seg button {
  border: 1px solid var(--border); color: var(--t2); font-size: 12px;
  border-radius: 6px; padding: 5px 12px; white-space: nowrap;
}
.theme-seg button.on {
  border-color: var(--gold); color: var(--gold);
  background: rgba(252, 213, 53, .08); font-weight: 600;
}
.set-emoji { font-size: 15px; width: 18px; text-align: center; flex: none; }

/* ---------- 新手教程聚光灯 ---------- */
#tour-root { position: fixed; inset: 0; z-index: 400; }
.tour-hole {
  position: fixed; z-index: 0; border-radius: 12px;
  box-shadow: 0 0 0 9999px var(--hole);
  border: 2px dashed var(--gold);
  pointer-events: none;
  transition: top .25s, left .25s, width .25s, height .25s;
}
.tour-tip {
  position: fixed; z-index: 1;
  width: min(430px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--gold-d);
  border-radius: 12px; padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
  animation: tourIn .22s ease-out;
}
@keyframes tourIn { from { opacity: 0; transform: translateY(8px); } }
.tour-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tour-ic { font-size: 20px; }
.tour-tip h4 { font-size: 15px; }
.tour-tip p { font-size: 13px; color: var(--t2); line-height: 1.75; }
.tour-tip p b { color: var(--t1); }
.tour-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.tour-dots { display: flex; gap: 4px; flex: none; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--panel3); transition: background .2s; }
.tour-dots i.on { background: var(--gold); }
.tour-step { font-size: 11px; color: var(--t3); flex: none; }
.tour-btns { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tour-btns .btn-ghost, .tour-btns .btn-gold { padding: 7px 14px; font-size: 13px; }

/* ============ 移动端适配 ============ */
@media (max-width: 1100px) {
  body { font-size: 13px; }
  .nav-links, .equity-chip, .nav-author { display: none; }
  #topnav { height: 48px; --nav-h: 48px; padding: 0 12px; }
  .logo-text { font-size: 15px; }
  #bottomnav { display: flex; }
  #view { min-height: calc(100vh - 48px); padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom)); }
  .page { padding: 0 12px calc(var(--bnav-h) + 24px); }
  #toasts { top: 58px; width: calc(100vw - 24px); }
  .hide-sm { display: none !important; }

  /* 行情 */
  .page-head { padding: 14px 0 10px; flex-wrap: wrap; }
  .page-head h1 { font-size: 19px; }
  .search-box { width: 100%; margin-left: 0; order: 2; }
  .mkt-head, .mkt-row { grid-template-columns: 24px 30px minmax(90px, 1.4fr) 1.1fr 1fr .8fr; padding: 0 8px; }
  .mkt-row { height: 50px; }

  /* 交易页:纵向堆叠 图→表单→盘口→委托 */
  .trade-page { height: auto; display: block; overflow: visible; }
  .trade-grid { display: flex; flex-direction: column; background: var(--bg); gap: 8px; padding-bottom: 8px; }
  .bottom-panel { height: auto; }
  .trade-page > .trade-grid { height: auto; }
  .chart-panel { order: 1; border-radius: var(--radius); border: 1px solid var(--border); }
  .chart-wrap { height: 44vh; min-height: 280px; }
  .form-panel { order: 2; border-radius: var(--radius); border: 1px solid var(--border); }
  .book-panel { order: 3; border-radius: var(--radius); border: 1px solid var(--border); }
  .book-scroll { max-height: 320px; }
  .bottom-panel { border-radius: var(--radius); border: 1px solid var(--border); }
  .bot-view { max-height: none; }
  .bot-head, .bot-row { grid-template-columns: 1.2fr .9fr .9fr 1.1fr auto; padding: 0 10px; }
  .bot-head span:nth-child(n+6):not(:last-child), .bot-row span:nth-child(n+6):not(:last-child) { display: none; }

  .ticker-bar { gap: 12px; padding: 8px 12px; }
  .tk-price { font-size: 18px; }
  .tk-stats { gap: 14px; }
  .side-panel { padding: 0; }
  /* 专业看板:移动端为横向滚动条带 */
  .watchlist { order: 0; }
  .wl-scroll { display: flex; overflow-x: auto; overflow-y: hidden; gap: 6px; padding: 8px; }
  .wl-row { flex: none; display: block; border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; min-width: 96px; }
  .wl-price { flex-direction: row; align-items: center; gap: 6px; }
  .book-scroll { padding-bottom: 8px; }
  .form-panel { padding: 12px; }

  /* 挑战 */
  .ch-grid { display: block; }
  .ch-side { margin-bottom: 12px; }
  .ch-chart { height: 300px; }
  .ch-status { gap: 14px; }

  /* 资产 */
  .asset-cards { grid-template-columns: 1fr 1fr; }
  .a-card.main { grid-column: span 2; }
  .asset-cards > .a-card:not(.main) { grid-column: span 1; }
  .a-card b { font-size: 17px; }
  .a-card.main b { font-size: 22px; }
  .ach-grid { grid-template-columns: repeat(2, 1fr); }
  .w-row { grid-template-columns: 32px 1.3fr 1fr auto; gap: 8px; }
  .w-val { display: none; }
  .dropdown { right: 8px; }
}
@media (max-width: 380px) {
  .ach-grid { grid-template-columns: 1fr 1fr; }
  .mkt-head, .mkt-row { grid-template-columns: 22px 28px minmax(80px, 1.3fr) 1fr .7fr; }
  .mkt-spark { display: none; }
}

/* 小屏弹窗压缩:欢迎弹窗等保证按钮一屏可见 */
@media (max-width: 600px) {
  .modal { padding: 16px 14px; }
  .modal .m-logo { margin-bottom: 2px; }
  .modal .m-logo svg { width: 30px; height: 30px; }
  .modal h2 { font-size: 16px; }
  .modal.welcome h2 { font-size: 16px; }
  .modal .m-sub { font-size: 11px; margin-bottom: 8px; }
  .modal .m-rules li { font-size: 12px; padding: 3px 0; line-height: 1.5; }
  .modal .btn-gold.big { padding: 11px; font-size: 15px; margin-top: 12px; }
  .modal .btn-ghost.big { padding: 10px; font-size: 14px; margin-top: 8px; }
  .modal .m-foot { margin-top: 8px; font-size: 10px; }
  .modal .liq-icon { font-size: 30px; margin-bottom: 2px; }
  .modal h2 { margin-bottom: 2px; }
}
