:root {
  --bg: #0f1116;
  --bg-soft: #161a22;
  --card: #1a1f28;
  --card-2: #20262f;
  --line: #2a3140;
  --line-soft: #232935;
  --text: #e8ecf3;
  --text-dim: #98a2b3;
  --text-faint: #6b7484;
  --up: #f04b4b;
  --up-soft: rgba(240, 75, 75, .14);
  --up-line: rgba(240, 75, 75, .4);
  --up-fill: rgba(240, 75, 75, .10);
  --up-bar: rgba(240, 75, 75, .55);
  --up-hbar: rgba(240, 75, 75, .75);
  --down: #1eb980;
  --down-soft: rgba(30, 185, 128, .14);
  --down-line: rgba(30, 185, 128, .4);
  --down-fill: rgba(30, 185, 128, .10);
  --down-bar: rgba(30, 185, 128, .55);
  --down-hbar: rgba(30, 185, 128, .75);
  --flat: #98a2b3;
  /* 语义色：与涨跌配色无关，始终绿=正常/可用、红=异常/不可用 */
  --ok: #1eb980;
  --ok-soft: rgba(30, 185, 128, .14);
  --ok-line: rgba(30, 185, 128, .4);
  --bad: #f04b4b;
  --accent: #4b8bf5;
  --accent-soft: rgba(75, 139, 245, .14);
  --warn: #e8a33d;
  --ma5: #f5c542;
  --ma10: #4b8bf5;
  --ma20: #c07bf5;
  --ma60: #4dd0c8;
  /* 分钟级主图指标配色（用户指定，勿改）：三线 金 / 粉 / 紫 */
  --ind-c1: #f0b90b;
  --ind-c2: #ff7ab6;
  --ind-c3: #b06cf0;
  --ind-avl: #f0b90b;
  --ind-sar: #f0b90b;
  --ind-super-up: #5fd68f;
  --ind-super-down: #f56c6c;
  /* 成交量副图均线 */
  --vol-ma5: #f0b90b;
  --vol-ma10: #b06cf0;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* 欧美惯例：绿涨红跌 —— 只调换 --up / --down 一族，语义色（--ok/--bad）不变 */
html[data-palette="us"] {
  --up: #1eb980;
  --up-soft: rgba(30, 185, 128, .14);
  --up-line: rgba(30, 185, 128, .4);
  --up-fill: rgba(30, 185, 128, .10);
  --up-bar: rgba(30, 185, 128, .55);
  --up-hbar: rgba(30, 185, 128, .75);
  --down: #f04b4b;
  --down-soft: rgba(240, 75, 75, .14);
  --down-line: rgba(240, 75, 75, .4);
  --down-fill: rgba(240, 75, 75, .10);
  --down-bar: rgba(240, 75, 75, .55);
  --down-hbar: rgba(240, 75, 75, .75);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(15, 17, 22, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}

.logo {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--up), var(--accent));
  box-shadow: 0 0 12px rgba(75, 139, 245, .5);
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--card-2);
  border: 1px solid var(--line);
}
.badge.live { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.badge.closed { color: var(--text-dim); }

.status {
  flex: 1 1 240px;
  min-width: 180px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12.5px;
}
.status.err { color: var(--bad); }

.controls { display: flex; align-items: center; gap: 10px; }

.ctl {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12.5px;
}

select, .btn {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
select:hover, .btn:hover { border-color: #3b4657; background: #262d38; }
.btn.ghost { background: transparent; color: var(--text-dim); }
.btn:active { transform: translateY(1px); }

/* ---------------- 布局 ---------------- */
main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.card-head small { color: var(--text-faint); font-size: 12px; }
.card-head .btn { margin-left: auto; }

/* ---------------- 总览表 ---------------- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; white-space: nowrap; }

thead th {
  position: sticky;
  top: 0;
  background: var(--bg-soft);
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
thead th.col-name, thead th.col-src { text-align: left; }

tbody td {
  padding: 11px 14px;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--card-2); }
tbody tr.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }

td.col-name { text-align: left; font-family: inherit; }
.name-main { display: flex; flex-direction: column; gap: 1px; }
.name-main .nm { font-weight: 600; }
.name-main .cd { color: var(--text-faint); font-size: 11.5px; font-family: var(--mono); }
td.col-src { text-align: left; color: var(--text-faint); font-size: 12px; }

.price-cell { font-size: 14px; font-weight: 600; }
.pill {
  display: inline-block;
  min-width: 62px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.pill.up { background: var(--up-soft); }
.pill.down { background: var(--down-soft); }
.empty { color: var(--text-faint); text-align: center; padding: 26px 0; font-family: inherit; }

/* ---------------- 详情 ---------------- */
.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
  padding: 16px 18px 20px;
}

.panel {
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-width: 0;
}
.panel.wide { grid-column: 1 / -1; }
.panel-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .4px;
}
.panel-title small { color: var(--text-faint); font-weight: 400; margin-left: 8px; }

.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-svg .grid-strong { stroke: #333c4d; stroke-width: 1; stroke-dasharray: 4 4; }
.chart-svg .axis { fill: var(--text-faint); font-size: 11px; font-family: var(--mono); }
.chart-svg .axis.up { fill: var(--up); }
.chart-svg .axis.down { fill: var(--down); }
.chart-svg .line { fill: none; stroke-width: 1.6; stroke-linejoin: round; }
.chart-svg .line.up { stroke: var(--up); }
.chart-svg .line.down { stroke: var(--down); }
.chart-svg .line.avg { stroke: var(--warn); stroke-width: 1.3; stroke-dasharray: 5 4; }
.chart-svg .line.ma5 { stroke: var(--ma5); }
.chart-svg .line.ma10 { stroke: var(--ma10); }
.chart-svg .line.ma20 { stroke: var(--ma20); }
.chart-svg .line.ma60 { stroke: var(--ma60); }
.chart-svg .line.dif { stroke: var(--ma5); }
.chart-svg .line.dea { stroke: var(--ma10); }
.chart-svg .area.up { fill: var(--up-fill); }
.chart-svg .area.down { fill: var(--down-fill); }
.chart-svg .dot.up { fill: var(--up); }
.chart-svg .dot.down { fill: var(--down); }
.chart-svg .vbar.up { fill: var(--up-bar); stroke: var(--up-bar); }
.chart-svg .vbar.down { fill: var(--down-bar); stroke: var(--down-bar); }
.chart-svg .hbar.up { fill: var(--up-hbar); }
.chart-svg .hbar.down { fill: var(--down-hbar); }

/* 标尺（十字光标）：悬停显示价格，点击锁定该根K线明细 */
.chart-svg .xhair { pointer-events: none; }
.chart-svg .xh-v, .chart-svg .xh-h {
  stroke: var(--text-faint);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.chart-svg .xh-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 1.5; }
.chart-svg .xh-tag { fill: var(--bg-soft); stroke: var(--line); stroke-width: 1; }
.chart-svg .xh-tx { fill: var(--text); font-size: 11px; font-family: var(--mono); }

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-dim);
}
.legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 5px; }

/* 标尺读数（点击分钟K线后显示） */
.xhair-read {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12.5px;
}
.xhair-read.empty { color: var(--text-faint); font-family: inherit; line-height: 1.5; }
.xhair-read b { color: var(--text-dim); font-weight: 500; margin-right: 5px; }

/* ---------------- 技术面卡片 ---------------- */
.analysis { display: flex; flex-direction: column; gap: 14px; }

.score-block {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.score { font-size: 34px; font-weight: 700; font-family: var(--mono); line-height: 1; }
.score-meta { display: flex; flex-direction: column; gap: 2px; }
.verdict { font-size: 15px; font-weight: 600; }
.hint { font-size: 11.5px; color: var(--text-faint); }
.gauge { flex: 1; min-width: 80px; }
.gauge-track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--down) 0%, #3b4250 50%, var(--up) 100%);
  opacity: .8;
}
.gauge-dot {
  position: absolute;
  top: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--card);
  box-shadow: 0 0 8px rgba(0,0,0,.5);
  transform: translateX(-7px);
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.chip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.chip .k { color: var(--text-faint); white-space: nowrap; }
.chip .v { font-family: var(--mono); text-align: right; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--accent-soft);
  color: #a8c6ff;
  border: 1px solid rgba(75,139,245,.3);
}

.kv-note { font-size: 12px; color: var(--text-faint); }
.sources { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }
.disclaimer {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ---------------- 策略回测 / 决策卡 ---------------- */
.strategy { display: flex; flex-direction: column; gap: 14px; }

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.plan-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.plan-action {
  font-size: 17px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--card-2);
  border: 1px solid var(--line);
}
.plan-action.up { color: var(--up); border-color: var(--up-line); background: var(--up-soft); }
.plan-action.down { color: var(--down); border-color: var(--down-line); background: var(--down-soft); }
.plan-action.flat { color: var(--text-dim); }
.plan-score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.plan-score .score { font-size: 26px; }
.plan-score .verdict { font-size: 14px; }

.warn-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(232,163,61,.12);
  border: 1px solid rgba(232,163,61,.35);
  color: var(--warn);
  font-size: 12.5px;
}

.sub-title { margin: 4px 0 0; font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.sub-title small { color: var(--text-faint); font-weight: 400; margin-left: 8px; }

table.mini { width: 100%; border-collapse: collapse; white-space: normal; }
table.mini thead th {
  background: transparent;
  padding: 7px 10px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-bottom: 1px solid var(--line);
  text-align: right;
}
table.mini tbody td {
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: var(--mono);
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
}
table.mini th.l, table.mini td.l { text-align: left; font-family: inherit; }
table.mini tbody tr:last-child td { border-bottom: none; }
table.mini tbody tr { cursor: default; }
table.mini tbody tr:hover { background: transparent; }
table.mini td.now-cell {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
  border-radius: 6px;
}

.risk { font-size: 11.5px; color: var(--text-faint); display: flex; flex-direction: column; gap: 3px; }
/* 表格容器：内容比卡片宽时整表横向滑动，不再被 .card/.panel 的 overflow:hidden 裁掉 */
.bt { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bt-note { margin-top: 8px; font-size: 12px; color: var(--warn); }
.chart-svg .line.eq-bh { stroke: var(--text-dim); stroke-width: 1.4; stroke-dasharray: 5 4; }
.chart-svg .line.eq-fwd { stroke: var(--accent); stroke-width: 1.8; }
.chart-svg .line.eq-rev { stroke: var(--warn); stroke-width: 1.8; }
.chart-svg .line.eq-band { stroke: #b06cf0; stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart-svg .line.eq-reg { stroke: var(--up); stroke-width: 2.0; }

/* ---------------- 顶部页签 ---------------- */
.tabs { display: flex; gap: 8px; margin: 0 auto 14px; max-width: 1500px; padding: 0 20px; }
.tabs .btn.tab { border-radius: 8px; }
.tabs .btn.tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------------- 币种切换 ---------------- */
.coin-switch { display: flex; gap: 6px; margin-left: auto; }
.coin-switch .btn { margin-left: 0; padding: 4px 14px; border-radius: 999px; font-size: 12.5px; }
.coin-switch .btn.ghost { color: var(--text-dim); }
.coin-switch .btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------------- 分钟级数据的粒度选择 ---------------- */
.iv-switch { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.iv-switch .btn { padding: 4px 12px; border-radius: 999px; font-size: 12.5px; }
.iv-switch .btn.ghost { color: var(--text-dim); }
.iv-switch .btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* 主图指标设置（指标配色为固定色，不随涨跌配色翻转） */
.ind-switch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ind-switch-label { font-size: 12.5px; color: var(--text-faint); margin-right: 2px; }
.ind-switch .btn { padding: 4px 12px; border-radius: 999px; font-size: 12.5px; }
.ind-switch .btn.ghost { color: var(--text-dim); }
.ind-switch .btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.ind-switch-hint { font-size: 11.5px; color: var(--text-faint); }

/* 指标线配色：1=金 2=粉 3=紫 */
.chart-svg .ind { pointer-events: none; }
.chart-svg .ind-c1 { stroke: var(--ind-c1); stroke-width: 1.4; }
.chart-svg .ind-c2 { stroke: var(--ind-c2); stroke-width: 1.4; }
.chart-svg .ind-c3 { stroke: var(--ind-c3); stroke-width: 1.4; }
.chart-svg .ind-avl { stroke: var(--ind-avl); stroke-width: 2; }
.chart-svg .ind-sar { fill: var(--ind-sar); }
.chart-svg .ind-super-up { stroke: var(--ind-super-up); stroke-width: 1.6; }
.chart-svg .ind-super-down { stroke: var(--ind-super-down); stroke-width: 1.6; }
.chart-svg .ind-super-fill-up { fill: #7ee787; opacity: .16; }
.chart-svg .ind-super-fill-down { fill: #ff8a8a; opacity: .16; }
/* 副图（VOL / MACD / RSI / KDJ / OBV）：基准线（零轴、30 / 70）与骨架占位 */
.chart-svg .sub-ref { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 3; }
.chart-skeleton .sk-sub { fill: none; stroke: var(--line-soft); stroke-dasharray: 4 4; }
.legend .ind-legend { color: var(--text-faint); }
.legend .ind-legend b { color: var(--text-dim); font-weight: 500; }

/* ---------------- 币安式：币种信息条 ---------------- */
.ticker-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 26px;
  padding: 12px 18px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line-soft);
}
.ticker-bar:empty { display: none; }
.tk-cell { display: flex; flex-direction: column; gap: 2px; min-width: 92px; }
.tk-cell.tk-pair { min-width: 140px; }
.tk-k { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.tk-v { font-family: var(--mono); font-size: 13px; color: var(--text); }
.tk-cell.tk-big .tk-v { font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.tk-v.up { color: var(--up); }
.tk-v.down { color: var(--down); }

/* ---------------- 币安式：图表区（深色底 + 左上图例 + 上方 OHLC 条） ---------------- */
.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 6px 2px 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.chart-stats .cs-dt { color: var(--text-dim); }
.chart-stats b { color: var(--text-faint); font-weight: 500; margin-right: 4px; }
.chart-stats .cs.up { color: var(--up); }
.chart-stats .cs.down { color: var(--down); }

.chart-wrap {
  position: relative;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.chart-skeleton { opacity: .55; }
.chart-skeleton .axis { font-size: 13px; }
.chart-legend {
  position: absolute;
  top: 6px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  max-width: 68%;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  pointer-events: none;
}
.chart-legend .cl { white-space: nowrap; }
.chart-legend i {
  display: inline-block;
  width: 12px;
  height: 2px;
  vertical-align: middle;
  margin-right: 4px;
  border-radius: 1px;
}

/* 竖网格 / 最新价线 / 成交量均线 */
.chart-svg .grid-v { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .last-line { stroke-width: 1; stroke-dasharray: 4 3; }
.chart-svg .last-line.up { stroke: var(--up); }
.chart-svg .last-line.down { stroke: var(--down); }
.chart-svg .last-tag.up { fill: var(--up); }
.chart-svg .last-tag.down { fill: var(--down); }
.chart-svg .last-tx { fill: #fff; font-size: 11px; font-family: var(--mono); font-weight: 600; }
.chart-svg .vol-ma { stroke-width: 1; }
.chart-svg .vol-ma5 { stroke: var(--vol-ma5); }
.chart-svg .vol-ma10 { stroke: var(--vol-ma10); }

/* ---------------- 粒度可用性 ---------------- */
.gran { display: flex; gap: 8px; flex-wrap: wrap; }
.gran .g-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--line-soft);
  font-size: 12px; min-width: 96px;
}
.gran .g-item .g-k { color: var(--text-faint); }
.gran .g-item .g-v { font-family: var(--mono); }
.gran .g-item.on .g-v { color: var(--ok); }
.gran .g-item.off .g-v { color: var(--bad); }

/* ---------------- 消息面 / 情绪面 ---------------- */
.tone-bar {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--card-2); border: 1px solid var(--line);
}
.tone-bar span { display: block; height: 100%; }
.tone-bar .b { background: var(--up); }
.tone-bar .r { background: var(--down); }
.tone-bar .n { background: var(--line); }

table.news-table td.news-time { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
table.news-table td.news-src { color: var(--accent); font-size: 11.5px; white-space: nowrap; }
table.news-table td.news-title { white-space: normal; line-height: 1.45; max-width: 900px; }
table.news-table td.news-title a { color: var(--text); text-decoration: none; }
table.news-table td.news-title a:hover { color: var(--accent); text-decoration: underline; }
table.news-table .news-sum { color: var(--text-faint); font-size: 11.5px; margin-top: 3px; }

/* ---------------- 页脚 ---------------- */
.foot {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 20px 30px;
  color: var(--text-faint);
  font-size: 11.5px;
  text-align: center;
}

/* ---------------- 币安式：币种信息（Profile） ---------------- */
.pf .pf-main { display: flex; flex-wrap: wrap; gap: 18px 28px; }
.pf .pf-rows { flex: 1 1 320px; min-width: 300px; }
.pf .pf-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 8px 2px; border-bottom: 1px solid var(--line-soft);
}
.pf .pf-row:last-child { border-bottom: 0; }
.pf .pf-k { color: var(--text-faint); font-size: 12.5px; white-space: nowrap; }
.pf .pf-v { font-family: var(--mono); font-size: 13.5px; color: var(--text); text-align: right; }
.pf .pf-v i { color: var(--text-faint); font-style: normal; font-size: 11.5px; }
.pf .pf-na { color: var(--text-faint); }
.pf .pf-side { flex: 1 1 260px; min-width: 240px; }
.pf .pf-h, .pf .pf-desc-h { color: var(--text-dim); font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.pf .pf-desc-h { margin-top: 16px; }
.pf .pf-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pf .pf-link {
  display: inline-block; padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px solid var(--line-soft);
  color: var(--text); font-size: 12.5px; text-decoration: none;
}
.pf .pf-link:hover { border-color: var(--accent); color: var(--accent); }
.pf .pf-note { color: var(--text-faint); font-size: 11.5px; line-height: 1.6; }
.pf .pf-desc {
  color: var(--text-dim); font-size: 12.5px; line-height: 1.7;
  max-height: 260px; overflow: auto;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 14px;
}

/* ---------------- 币安式：数据（Data） ---------------- */
.dt-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.dt-card {
  background: var(--card-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.dt-grid > .dt-flow { flex: 1 1 420px; min-width: 340px; }
.dt-side { flex: 1 1 380px; min-width: 320px; display: flex; flex-direction: column; gap: 14px; }
.dt-card-h { color: var(--text); font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }
.dt-card-h small { color: var(--text-faint); font-weight: 400; font-size: 11.5px; margin-left: 6px; }
.dt-switch { display: flex; gap: 6px; margin-bottom: 12px; }
.dt-switch .btn { padding: 4px 12px; font-size: 12px; }
.dt-switch .btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.dt-chart { margin-top: 4px; }
.dt-note { color: var(--text-faint); font-size: 11.5px; line-height: 1.6; }

/* 环形图 */
.donut-svg { width: 168px; height: 168px; flex: 0 0 auto; }
.donut-svg .donut-t { fill: var(--text); font-family: var(--mono); font-size: 20px; font-weight: 700; }
.donut-svg .donut-s { fill: var(--text-faint); font-size: 11px; }

/* 资金流向明细 */
.ff-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 12px; }
.ff-mini { flex: 1 1 320px; min-width: 260px; }
.ff-mini-h { color: var(--text-faint); font-size: 11.5px; margin-bottom: 2px; }
table.ff-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.ff-table th, table.ff-table td {
  padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); white-space: nowrap;
}
table.ff-table th:first-child, table.ff-table td:first-child { text-align: left; }
table.ff-table th { color: var(--text-faint); font-weight: 500; font-size: 11.5px; font-family: inherit; }
table.ff-table tr.ff-buy td:first-child { color: var(--ok); }
table.ff-table tr.ff-sell td:first-child { color: var(--bad); }
table.ff-table tr.ff-net td { border-bottom: 0; }
table.ff-table tr.ff-net td:first-child { color: var(--text); font-weight: 600; font-family: inherit; }
.ff-note { color: var(--text-faint); font-size: 11.5px; line-height: 1.6; margin-top: 10px; }
.ff-table .up { color: var(--up); }
.ff-table .down { color: var(--down); }

/* 迷你折线（数据页右列小卡） */
.spark-svg { width: 100%; height: auto; display: block; }

@media (max-width: 720px) {
  /* ---- 页面留白：手机上不再保留桌面的 20px 侧边距 ---- */
  main { padding: 10px 10px 26px; gap: 12px; }
  .tabs { margin: 0 0 10px; padding: 0; gap: 6px; }
  .tabs .btn { flex: 1 1 0; padding: 7px 8px; font-size: 12.5px; }
  .panels { grid-template-columns: 1fr; gap: 12px; padding: 10px 10px 16px; }
  .panel { padding: 12px 10px; }
  .card-head { padding: 12px 12px; gap: 8px; }
  .card-head h2 { font-size: 14px; }
  .card-head small { font-size: 11px; }
  .ticker-bar { padding: 10px 12px; gap: 10px 14px; }
  .foot { padding: 0 12px 22px; font-size: 11px; }

  /* ---- 顶栏：控件允许换行，刷新按钮独占一行 ---- */
  /* 手机屏幕矮，三行顶栏常驻吸附会吃掉近两成高度，改成随页面滚走 */
  .topbar { position: static; padding: 8px 10px; gap: 8px 10px; }
  .brand { font-size: 14.5px; gap: 6px; }
  .controls { flex-wrap: wrap; gap: 8px; width: 100%; }
  .ctl { flex: 0 0 auto; white-space: nowrap; font-size: 12px; }
  .ctl select { max-width: 150px; padding: 5px 7px; font-size: 12px; }
  #refresh { flex: 1 1 100%; padding: 7px 10px; }
  .status { order: 3; flex-basis: 100%; min-width: 0; font-size: 11.5px; line-height: 1.4; }

  /* ---- 表格：压缩内边距，超宽由 .table-wrap / .bt 横向滑动 ---- */
  thead th { padding: 8px 8px; font-size: 11px; }
  tbody td { padding: 8px 8px; font-size: 12px; }
  .price-cell { font-size: 12.5px; }
  .name-main .cd { font-size: 10.5px; }
  table.ff-table th, table.ff-table td { padding: 6px 7px; font-size: 11.5px; }
  table.news-table td.news-title { max-width: 240px; }
  table.news-table td.news-time, table.news-table td.news-src { font-size: 10.5px; }

  /* ---- 弹性布局：把写死的桌面最小宽度归零，避免横向溢出被裁 ---- */
  .dt-grid > .dt-flow { flex: 1 1 100%; min-width: 0; }
  .dt-side { flex: 1 1 100%; min-width: 0; }
  .dt-card { padding: 11px 10px; }
  .pf .pf-rows, .pf .pf-side { flex: 1 1 100%; min-width: 0; }
  .pf .pf-main { gap: 12px 18px; }
  .pf .pf-desc { max-height: 200px; padding: 10px 11px; }
  .ff-mini { flex: 1 1 100%; min-width: 0; }
  .coin-switch { margin-left: 0; }
  .gran .g-item { flex: 1 1 46%; min-width: 0; }
  .donut-svg { width: 132px; height: 132px; }

  /* ---- 按钮行：紧凑排列 ---- */
  .iv-switch { gap: 5px; }
  .iv-switch .btn, .ind-switch .btn { padding: 3px 8px; font-size: 11.5px; }
  .ind-switch { gap: 5px; }
  .ind-switch-label { font-size: 11.5px; }
  .ind-switch-hint { flex: 1 1 100%; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dt-switch .btn { padding: 4px 9px; font-size: 11.5px; }

  /* ---- 图表：保持可读尺寸横向滑动，不把 SVG 压成看不清的小图 ---- */
  .chart { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart > .chart-wrap .chart-svg,
  .chart > .chart-svg { min-width: 720px; }
  /* OHLC 条 / 图例 / 标尺读数固定在可视区，不跟着横向滑动跑出屏幕
     （图例由 app.js 在手机上移到滚动容器外层，见 drawIntraday） */
  .chart-stats, .chart-legend, .legend, .xhair-read { position: sticky; left: 0; z-index: 2; }
  .chart-stats { gap: 4px 10px; font-size: 11px; padding-right: 38px; }
  .chart-legend {
    position: sticky; top: auto; left: 0;
    max-width: 100%; font-size: 10.5px;
    margin: 6px 0 2px; padding-right: 8px;
  }
  .legend { gap: 8px; font-size: 11px; }
  .xhair-read { font-size: 11.5px; gap: 4px 12px; padding: 7px 8px; }
  .xhair-read b { margin-right: 3px; }
}

/* ---------------- 主图最大化浮窗 / 右上角按钮 ---------------- */
.chart-host { position: relative; }
.chart-max {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 3;
  padding: 2px 7px;
  font-size: 14px;
  line-height: 1.25;
  color: var(--text-dim);
  background: rgba(26, 31, 40, .85);
}
.chart-max:hover { color: var(--text); background: var(--card-2); }
.chart-stats { padding-right: 44px; }        /* 右侧留出最大化按钮的位置，避免压住数值 */

.chart-modal { position: fixed; inset: 0; z-index: 60; display: none; }
.chart-modal.on { display: block; }
.chart-modal .cm-mask {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, .74);
}
.chart-modal .cm-box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1400px, 94vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.chart-modal .cm-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.chart-modal .cm-title { font-weight: 600; }
.chart-modal .cm-hint { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.chart-modal .cm-body { padding: 12px 14px 14px; overflow: auto; }
@media (max-width: 720px) {
  .chart-modal .cm-box { width: 98vw; max-height: 96vh; }
  .chart-modal .cm-hint { display: none; }
}

