/* ══════════════════════════════════════════════════════════════════════════
   风雪双币股市 · 样式（2026-10-31 重构）

   设计来源：**直接使用 www.fxmc.cc 的设计令牌**（--blue / --ink / --line / 圆角 / 字号），
   布局结构参考 FX 模拟交易台的"账户概览 + 工作台"骨架，按手机优先重排。

   三条硬规矩：
     ① 颜色一律走变量，**不允许写死 #fff / #000**（上一版深色模式下
        chip、input、select 全是刺眼白块，就是硬编码造成的）；
     ② 深色模式是全套变量覆盖，不是逐条打补丁；
     ③ 手机优先：先写手机规则，再在 ≥641px 用媒体查询扩成两栏。
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 设计令牌（取自 www.fxmc.cc/assets/style.css）───────────────── */
:root {
  /* 主色与渐变 */
  --blue: #6b8ff5;
  --blue-deep: #3558c8;
  --violet: #9db6fb;
  --cyan: #86cbe6;
  --grad: linear-gradient(100deg, #5a80ea 0%, #7c9df6 34%, #a8c0fb 68%, #c6e2f6 100%);

  /* 文字与表面 */
  --ink: #1a1a1a;
  --ink-2: #4a5160;
  --muted: #6b7280;
  --line: #ececec;
  --line-2: #f2f4f7;
  --pill: #e8e8e8;
  --soft: #f4f6fa;
  --panel: #ffffff;
  --page: #f7f9fc;

  /* 涨跌（沿用本服既有口径：红涨绿跌） */
  --up: #e04b4b;
  --up-soft: #fdeeee;
  --down: #2fa367;
  --down-soft: #eaf6ef;

  /* 语义色 */
  --warn: #b8860b;
  --warn-soft: #fff8e6;
  --danger: #c0392b;
  --danger-soft: #fdeeed;

  /* 字号 */
  --fs-xs: 12.5px;
  --fs-sm: 13.5px;
  --fs-base: 14.5px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-2xl: 26px;

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* 行高与字重 */
  --lh-tight: 1.35;
  --lh-body: 1.7;
  --fw-normal: 400;
  --fw-mid: 600;
  --fw-bold: 700;

  /* 阴影 */
  --sh-sm: 0 1px 2px rgba(20, 30, 50, .04);
  --sh-md: 0 2px 10px rgba(20, 30, 50, .06);
  --sh-lg: 0 8px 28px rgba(20, 30, 50, .10);

  /* 主题切换 */
  --theme-switch-dur: .28s;
}

/* ── 深色：全套变量覆盖（不是逐条补丁）───────────────────────── */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9edf7;
  --ink-2: #c6cddd;
  --muted: #8d97ae;
  --line: #262e3f;
  --line-2: #1e2636;
  --pill: #2b3346;
  --soft: #161c2a;
  --panel: #141a24;
  --page: #0c1119;
  --blue: #7c9bf7;
  --blue-deep: #a8bfff;
  --grad: linear-gradient(100deg, #6b8ff5 0%, #8aa6f8 34%, #a9bdfb 68%, #8fd0e8 100%);

  --up: #f07171;
  --up-soft: #2a1a1c;
  --down: #4fc78a;
  --down-soft: #14251d;

  --warn: #e0b34a;
  --warn-soft: #2a2417;
  --danger: #f07373;
  --danger-soft: #2a1a1c;

  --sh-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --sh-md: 0 2px 10px rgba(0, 0, 0, .38);
  --sh-lg: 0 8px 28px rgba(0, 0, 0, .5);
}

/* ── 基础 ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  transition: background var(--theme-switch-dur), color var(--theme-switch-dur);
}

h1, h2, h3 { margin: 0; line-height: var(--lh-tight); font-weight: var(--fw-bold); }
p { margin: 0; }
a { color: var(--blue-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: .92em; }

/* 所有表单控件默认走变量 —— 这是上一版深色下"白块"的根治点 */
input, select, textarea, button {
  font-family: inherit;
  font-size: var(--fs-md);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .16s, background var(--theme-switch-dur), color var(--theme-switch-dur);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(107, 143, 245, .16);
}
/* 下拉的选项列表在深色下也要跟（部分浏览器继承系统） */
select option { background: var(--panel); color: var(--ink); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--pill); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── 通用组件 ─────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--sh-sm);
  transition: background var(--theme-switch-dur), border-color var(--theme-switch-dur);
}

.cardhead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cardhead h2 { font-size: var(--fs-md); }
.cardhead .note { font-size: var(--fs-xs); color: var(--muted); }

.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }

.empty {
  padding: 22px 12px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* 按钮 */
button {
  cursor: pointer;
  min-height: 40px;
  padding: 0 16px;
  font-weight: var(--fw-mid);
}
button:disabled { opacity: .5; cursor: not-allowed; }

.primary-button,
.ghost,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-mid);
  transition: background .16s, border-color .16s, color .16s, transform .1s;
}
.primary-button {
  background: var(--grad);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(90, 128, 234, .28);
}
.primary-button:hover:not(:disabled) { filter: brightness(1.04); }
.primary-button:active:not(:disabled) { transform: translateY(1px); }

.ghost, .outline-button {
  background: var(--soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.ghost:hover, .outline-button:hover { border-color: var(--blue); color: var(--blue-deep); }

/* 分段控件（图表类型 / 周期 / 模式） */
.seg {
  display: flex;
  gap: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.seg::-webkit-scrollbar { display: none; }

.seg button,
.chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-mid);
  border-radius: calc(var(--r-md) - 5px);
  white-space: nowrap;
  transition: background .16s, color .16s;
}
.seg button.on,
.chip.on {
  background: var(--panel);
  color: var(--blue-deep);
  box-shadow: var(--sh-sm);
}

/* 徽标 */
.pricemode,
.account-chip,
.mode-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-mid);
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pricemode.lev {
  background: rgba(107, 143, 245, .12);
  color: var(--blue-deep);
  border-color: rgba(107, 143, 245, .3);
}

/* ══════════════════════════════════════════════════════════════
   顶栏：紧凑，复用官网导航观感
   ══════════════════════════════════════════════════════════════ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topnav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  color: var(--ink);
  flex: 0 0 auto;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--grad);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: var(--fw-bold);
}
.topnav-links {
  display: none;
  gap: 4px;
  margin-left: 8px;
}
.topnav-links a {
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.topnav-links a:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.topnav-spacer { flex: 1 1 auto; }
.topnav-actions { display: flex; align-items: center; gap: 8px; }

.icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 16px;
  color: var(--ink-2);
}
.icon-button:hover { background: var(--soft); }

/* 顶栏下的细状态条 */
.statusline {
  max-width: 1280px;
  margin: 0 auto;
  padding: 6px 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  /*
   * 手机不换行：这一条只是状态，占用两行会把图和下单往下推。
   * 超出部分横向滚动（滚动条隐藏），不折行。
   */
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.statusline::-webkit-scrollbar { display: none; }
.statusline > * { flex: 0 0 auto; }
.statusline .sep { opacity: .5; }
.statusline .live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--down); display: inline-block; margin-right: 4px;
}
.statusline select { height: 28px; min-height: 28px; font-size: var(--fs-xs); padding: 0 6px; }

/* ══════════════════════════════════════════════════════════════
   主容器：手机单列，桌面两栏
   ══════════════════════════════════════════════════════════════ */
.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 12px 40px;
}

/* ══════════════════════════════════════════════════════════════
   账户概览条（参考站骨架：一个总权益 + 若干指标）
   手机上横向紧凑排布，不占竖向空间
   ══════════════════════════════════════════════════════════════ */
.balance-strip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--sh-sm);
}
.balance-lead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.balance-lead .eyebrow {
  font-size: var(--fs-xs);
  color: var(--muted);
  letter-spacing: .04em;
}
.balance-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0;
}
.money-large {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
.metric {
  min-width: 0;
}
.metric span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric strong {
  display: block;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════════════
   工作区页签（交易台 / 我的）—— 两个，不再有三页签
   ══════════════════════════════════════════════════════════════ */
.areas {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 4px;
}
.areas .area {
  flex: 1 1 0;
  min-height: 42px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: var(--fw-mid);
  border-radius: calc(var(--r-md) - 5px);
  transition: background .16s, color .16s;
}
.areas .area.on {
  background: var(--panel);
  color: var(--blue-deep);
  box-shadow: var(--sh-sm);
}

/* ══════════════════════════════════════════════════════════════
   市场切换（金币 / 点券）：做成紧凑小段，不再占一整行大按钮
   ══════════════════════════════════════════════════════════════ */
.market-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.market-switch button {
  min-height: 36px;
  padding: 0 16px;
  font-size: var(--fs-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--muted);
}
.market-switch button.on {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
}

/* ══════════════════════════════════════════════════════════════
   标的条 + 模式切换（合并成紧凑一块，手机首屏少占高度）
   ══════════════════════════════════════════════════════════════ */
.symbolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px !important;
}
.symbolbar-main { min-width: 0; flex: 1 1 auto; }
.symbolbar-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.symbolbar-price {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.symbolbar-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}
.symbolbar-chg {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}
.symbolbar-chg.up { color: var(--up); }
.symbolbar-chg.down { color: var(--down); }
#btnPickSymbol { min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); }

/* 模式切换条 */
.modebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px !important;
  flex-wrap: wrap;
}
.modesw {
  display: flex;
  gap: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 4px;
  flex: 1 1 auto;
}
.modebtn {
  flex: 1 1 0;
  min-height: 40px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  border-radius: calc(var(--r-md) - 5px);
  transition: background .16s, color .16s;
}
.modebtn.on {
  background: var(--panel);
  color: var(--blue-deep);
  box-shadow: var(--sh-sm);
}
.modenote { font-size: var(--fs-xs); color: var(--muted); width: 100%; }

/* 模式面板显隐 */
body[data-mode="spot"] .mode-pane[data-mode-pane="lev"] { display: none !important; }
body[data-mode="lev"]  .mode-pane[data-mode-pane="spot"] { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   图表卡
   ══════════════════════════════════════════════════════════════ */
.chartcard { padding: 14px !important; }
.chartcard .cardhead { margin-bottom: 10px; }

.chartbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.chartgroup {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
  min-width: 0;
}
.chartgroup::-webkit-scrollbar { display: none; }
.chartgroup[hidden] { display: none !important; }
.chartgrouplabel {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}
.chartgrouplabel + .chartgroupnote,
.chartgroupnote { flex: 0 0 auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.chartwrap { position: relative; }
#chartHost, #chartHostMark {
  width: 100%;
  height: 240px;
  min-height: 240px;
  max-height: 240px;
  overflow: hidden;
}
#chartHost svg, #chartHostMark svg { display: block; width: 100%; height: 100%; }

.chartreadout {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--soft);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.chartreadout.is-default { color: var(--muted); }
.chartreadout[hidden] { display: none !important; }

.chartnotice {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.chartnotice:empty { display: none; }

/* 图下长说明：手机默认收起，桌面常显 */
.chartcomment {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.7;
  margin-top: 8px;
}
.chartexplain {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  font-size: var(--fs-xs);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--muted);
}

/* 悬浮提示框 */
.charttip {
  position: absolute;
  z-index: 20;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-md);
  font-size: var(--fs-xs);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s;
}
.charttip.show { opacity: 1; visibility: visible; }
.charttip .tiprow { display: flex; gap: 8px; align-items: baseline; white-space: nowrap; }
.charttip .tiprow-time { font-weight: var(--fw-bold); margin-bottom: 2px; }
.charttip .tipk { color: var(--muted); font-size: 11.5px; }
.charttip .tiprow b { font-weight: var(--fw-mid); }

/* ══════════════════════════════════════════════════════════════
   下单
   ══════════════════════════════════════════════════════════════ */
.ordercard .orderbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  align-items: end;
}
.ordercard .orderbar > label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--muted);
  min-width: 0;
}
.ordercard .orderbar > label:first-child { grid-column: 1 / -1; }
.ordercard .orderbar input,
.ordercard .orderbar select {
  min-height: 46px;
  padding: 0 12px;
  font-size: var(--fs-md);   /* 16px：iOS 聚焦不放大 */
  width: 100%;
}
#btnBuy, #btnSell {
  min-height: 50px;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  border: none;
  border-radius: var(--r-sm);
  color: #fff;
}
#btnBuy { background: linear-gradient(100deg, #5a80ea, #7c9df6); }
#btnSell { background: linear-gradient(100deg, #d9534f, #e57373); }
#btnBuy:active, #btnSell:active { filter: brightness(.95); }

.orderhint, .orderbar .orderhint {
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════════
   持仓 / 订单
   ══════════════════════════════════════════════════════════════ */
#myPosBox .posrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
#myPosBox .posrow:last-child { border-bottom: none; }
#myPosBox .posinfo { min-width: 0; flex: 1 1 auto; }
#myPosBox .postitle { font-size: var(--fs-base); font-weight: var(--fw-mid); }
#myPosBox .posmeta { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
#myPosBox .btn-sell-prefill {
  min-height: 40px;
  padding: 0 14px;
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink-2);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   行情列表（可折叠）
   ══════════════════════════════════════════════════════════════ */
.quotescard[data-collapsed="1"] #quotes { display: none; }
.quotescard[data-collapsed="0"] #quotes { display: block; }
#btnToggleQuotes { min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); }

#quotes .qrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s;
}
#quotes .qrow:hover { background: var(--soft); }
#quotes .qrow.qactive { border-color: var(--blue); background: var(--soft); }
#quotes .qrow .muted { font-size: var(--fs-xs); }

/* ══════════════════════════════════════════════════════════════
   折叠卡（行业 / 资讯 / 说明）
   ══════════════════════════════════════════════════════════════ */
/*
 * 折叠卡收起（2026-11-03 修）。
 *
 * 原来没有 !important，被 #newsBox { display:flex } 这类 ID 规则覆盖
 * （ID 特异性 1,0,0 高于本规则的 0,3,0），导致「市场资讯」卡明明
 * data-collapsed="1"，20 条新闻照样全部铺开、高 754px。
 *
 * 折叠是功能性显隐，必须压过组件级 display 声明，因此这里用 !important。
 */
.card.foldable[data-collapsed="1"] > *:not(.cardhead) { display: none !important; }
.foldbtn {
  min-height: 34px;
  padding: 0 12px;
  font-size: var(--fs-xs);
  margin-left: auto;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  flex-shrink: 0;
}
.card.foldable .cardhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════════
   杠杆交易室
   ══════════════════════════════════════════════════════════════ */
.room .roomgrid { display: flex; flex-direction: column; gap: 12px; }

.roomsum {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.roomsum-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--soft);
  border-radius: var(--r-sm);
  min-width: 0;
}
.roomsum-item .k { font-size: var(--fs-xs); color: var(--muted); }
.roomsum-item .v {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.roomsum-item .hint { font-size: 11px; color: var(--muted); }
.roomsum-more {
  grid-column: 1 / -1;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* 杠杆面板 */
.levpanel, .roomorder {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  background: var(--panel);
}
.levpanel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.levpanel-grid > * { min-width: 0; }
.levpanel label, .roomorder label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.levpanel input, .levpanel select,
.roomorder input, .roomorder select {
  min-height: 44px;
  padding: 0 12px;
  font-size: var(--fs-md);
  width: 100%;
}
.levgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 6px;
}
.levgrid button {
  min-height: 40px;
  padding: 0 8px;
  font-size: var(--fs-sm);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-2);
}
.levgrid button.on, .levgrid button.active {
  background: var(--blue);
  color: #fff;
  border-color: transparent;
}

/* ══════════════════════════════════════════════════════════════
   手机专属：紧凑、触摸友好
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .app-shell { padding: 8px 10px 32px; }
  .card { padding: 14px !important; border-radius: var(--r-md); margin-bottom: 10px; }

  /*
   * 手机图表高度：240 → 340（2026-11-06）。
   *
   * 原来这里是「任务单 220—280」定的 240。实际用下来，390 宽的手机上图宽 328、
   * 高只有 240，K 线挤成一条扁带，几乎看不出形状。
   * 提到 340 后宽高比约 0.96，看趋势清楚得多；卡片整体也才多 100px。
   *
   * ⚠️ 三行（height / min-height / max-height）必须一起改：
   *    少改任何一行都会被它夹回 240。
   * ⚠️ chart.js 里 `H = hostH >= 200 ? hostH : fallbackH` —— 只要这里 ≥200，
   *    脚本就直接用这个值，所以**调 chart.js 里的 fallbackH/maxH 是没用的**，
   *    要改就改这里。
   */
  #chartHost, #chartHostMark { height: 340px; min-height: 340px; max-height: 340px; }

  /* 长说明默认收起 */
  .chartcomment, .chartnotice { display: none !important; }
  .chartcomment.expanded, .chartnotice.expanded { display: block !important; }

  /* 账户概览压紧 */
  .balance-strip { padding: 10px 12px; }
  .money-large { font-size: var(--fs-xl); }
  .metrics { gap: 6px 12px; }

  /* 模式条吸顶，切模式不用往上翻 */
  .modebar {
    position: sticky;
    top: 52px;
    z-index: 30;
    background: var(--panel);
    box-shadow: var(--sh-sm);
  }

  /* 触摸尺寸 */
  .modebtn { min-height: 44px; }
  .areas .area { min-height: 44px; }
  #btnBuy, #btnSell { min-height: 52px; }

  /* 角色/身份一行，别铺大块 */
  .identitybar { font-size: var(--fs-xs); }

  /* 订单表单：两列 → 窄屏单列 */
  .ordercard .orderbar { grid-template-columns: 1fr 1fr; }
  .levpanel-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 340px) {
  .ordercard .orderbar { grid-template-columns: 1fr; }
  .levpanel-grid { grid-template-columns: 1fr; }
  .roomsum { grid-template-columns: 1fr; }
  .money-large { font-size: var(--fs-lg); }
}
/* ══════════════════════════════════════════════════════════════
   桌面 ≥901（2026-10-31 定稿，桌面版本第 5 次重写）

   ⚠️ 前四次的失败原因都记在这里，避免以后重犯：
     ① 手机单列拉伸到 1440px → 标的条/模式条成了整宽巨型色块；
     ② grid-template-areas 让右列两卡跨行 → chart 行被撑到 700px，
        持仓掉到行底、中间空 600px；
     ③ grid-auto-rows: min-content → 行高算乱，模式条与图之间空 100px；
     ④ 强制 grid-row 编号但 CSS 里同一选择器写了 3 遍，后写覆盖前写。

   还有两个藏在 DOM 里的坑（都不是 CSS 能想到的）：
     · `.room` 带内联 `style="grid-column:1/-1"`，优先级压过任何 CSS（已清除）；
     · 内联样式共 5 处，全部清理后才生效。

   ✅ 最终方案：只用 grid-row / grid-column 显式编号，不用 order 混排。
     row1 标的条（全宽）
     row2 模式条（全宽）
     row3 左＝图表 / 右＝下单 或 杠杆房间
     row4 左＝行情 / 右＝我的持仓与订单
     row5+ 行业 / 资讯 / 说明 / 我的
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 901px) {
  .app-shell { max-width: 1320px; padding: 20px 24px 56px; }
  .topnav-inner { max-width: 1320px; padding: 0 24px; }
  .statusline { max-width: 1320px; padding: 8px 24px 0; }
  .market-switch { justify-content: flex-start; }

  /* 账户概览横排 */
  .balance-strip { display: flex; align-items: center; gap: 28px; padding: 16px 20px; }
  .balance-lead { flex: 0 0 auto; margin-bottom: 0; flex-direction: column; align-items: flex-start; gap: 4px; }
  .balance-title { flex: 0 0 auto; }
  .metrics { flex: 1 1 auto; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; }
  .metric { text-align: right; }
  .metric strong { font-size: var(--fs-lg); }
  .money-large { font-size: 30px; }
  .balance-strip.is-guest { justify-content: flex-start; gap: 16px; }
  .balance-strip.is-guest .guest-hint { flex: 0 1 auto; }

  /* 页签靠左 */
  .areas {
    justify-content: flex-start; background: transparent; border: none;
    border-bottom: 1px solid var(--line); border-radius: 0;
    padding: 0; gap: 22px; margin-bottom: 14px;
  }
  .areas .area {
    flex: 0 0 auto; min-height: 40px; padding: 0 2px;
    background: transparent !important; box-shadow: none !important;
    border-radius: 0; position: relative; font-size: var(--fs-md);
  }
  .areas .area.on { color: var(--blue-deep); font-weight: var(--fw-bold); }
  .areas .area.on::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
    height: 2px; border-radius: 2px; background: var(--grad);
  }

  /* ── 主网格 ── */
  main.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px 20px;
    align-items: start;
    align-content: start;
  }
  main.grid > * { margin-bottom: 0; min-width: 0; }

  main.grid > #symbolBar    { grid-column: 1 / -1; grid-row: 1; }
  main.grid > #modeBar      { grid-column: 1 / -1; grid-row: 2; }
  main.grid > .chartcard    { grid-column: 1;        grid-row: 3; }
  main.grid > #orderCard    { grid-column: 2;        grid-row: 3; align-self: start; }
  main.grid > .room         { grid-column: 2;        grid-row: 3; align-self: start; }
  main.grid > #quotesCard   { grid-column: 1;        grid-row: 4; }
  main.grid > #myPosCard    { grid-column: 2;        grid-row: 4; align-self: start; }
  main.grid > #industryCard { grid-column: 1 / -1;   grid-row: 5; }
  main.grid > #newsCard     { grid-column: 1 / -1;   grid-row: 6; }
  main.grid > #helpCard     { grid-column: 1 / -1;   grid-row: 7; }
  /*
   * ⚠️ 「我的」卡片不能指定固定 grid-row（2026-10-31 修复）。
   *
   * 原来写的是 `grid-row: 8` —— 而「我的」工作区有 **6 张卡片**，
   * 全部被塞进同一行第 8 格 → **在桌面上互相重叠**，
   * 表现就是「已领取」按钮浮在金额框上、订单行和按钮压在一起（服主截图）。
   *
   * 改为 `grid-row: auto`：让它们按 DOM 顺序各自占一行，自动往下排。
   */
  main.grid > [data-area="me"] { grid-column: 1 / -1; grid-row: auto; }

  /* 标的条：紧凑横排 */
  main.grid > #symbolBar { display: flex; align-items: center; gap: 18px; padding: 14px 18px !important; }
  main.grid > #symbolBar .symbolbar-main { flex: 1 1 auto; }
  main.grid > #symbolBar .symbolbar-price { font-size: 27px; }
  main.grid > #symbolBar .symbolbar-side { flex-direction: row; align-items: center; gap: 12px; }

  /* 模式条 */
  main.grid > #modeBar { display: flex; align-items: center; gap: 12px; padding: 8px 14px !important; }
  main.grid > #modeBar .modesw { flex: 0 0 auto; }
  main.grid > #modeBar .modebtn { flex: 0 0 auto; min-width: 96px; min-height: 38px; }
  main.grid > #modeBar .modenote { width: auto; }

  /* 图表 */
  #chartHost, #chartHostMark { height: 480px; min-height: 480px; max-height: 480px; }
  .chartcard { padding: 18px !important; }
  .chartbar { flex-direction: row; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
  .chartgroup { flex: 0 0 auto; }
  .chartcomment, .chartnotice { display: block !important; }
  .chartexplain { display: none; }

  /* 下单纵向 */
  .ordercard .orderbar { grid-template-columns: 1fr; }
  #btnBuy, #btnSell { grid-column: 1 / -1; }
  .ordercard .orderbar input, .ordercard .orderbar select { min-height: 44px; }

  /* 杠杆摘要：右栏 380px 放四列会挤，两列 + 更多数据 */
  .roomsum { grid-template-columns: 1fr 1fr; }
  .roomsum[data-compact="1"] .roomsum-item:nth-child(n+3) { display: none; }
  .roomsum-more { display: block; }
  /*
   * ═══ 房间里不重复画标记价图（2026-11-01 修正）═══
   *
   * 原写法是 `.room .roommain { display: none; }` —— 想隐藏的是**旧的房间内嵌小图**，
   * 但 `.roommain` 是整个左栏内容区，里面除了那张废弃小图，
   * 还有「我的杠杆仓位」列表（#levPositions）与说明。
   *
   * 后果：**杠杆持仓列表在桌面上完全不显示**，
   * 玩家看不到自己的杠杆仓位，自然也看不到浮动盈亏 ——
   * 服主反馈的「杠杆的收益显示也没做」就是这个。
   *
   * 现在只隐藏那张废弃的小图容器，持仓区恢复正常显示。
   */
  .room .roomcharthead,
  .room .roomchartctl,
  .room #roomChartHost,
  .room #roomChartTip,
  .room #roomChartReadout,
  .room #roomChartNotice,
  .room #roomMarkLegend,
  .room .roomchartnote { display: none; }
  .room .roommain { display: block; }
  /* 图注块（旧小图的说明文字）一并隐藏，避免留下孤立段落 */
  .room .roomlegend { display: none; }
  /* 杠杆面板表单：右栏窄，单列 */
  .levpanel-grid { grid-template-columns: 1fr; }

  /*
   * 右列**不再粘顶**（2026-10-31 打磨）。
   *
   * 粘顶时，「我的持仓与订单」会浮在下单卡上方，两者在滚动中重叠
   *（服主截图：红框里下单卡与持仓卡叠在一起，代码下拉被切成两截）。
   * 桌面本来一屏就能同时看到图与右栏，粘顶带来的收益抵不过重叠的代价。
   */
  main.grid > #orderCard { position: static; }
  main.grid > #myPosCard { position: static; }
  /*
   * 杠杆房间在右栏：**不要**加 max-height + overflow。
   * 实测这样会把「最大钱包合计支出」与底部说明截断（滚动条藏在卡片里，很难发现）。
   * 房间内容本来就比一屏高，让它自然撑开、跟随页面滚动即可。
   */
  main.grid > .room { position: static; }
}

/* 超宽屏 */
@media (min-width: 1600px) {
  .app-shell, .topnav-inner, .statusline { max-width: 1520px; }
  main.grid { grid-template-columns: minmax(0, 1fr) 420px; }
}

/* ── 无障碍：减少动效 ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   官网导航（沿用主站结构：logo / nav-links / nav-more / nav-account）
   这些类名来自 www.fxmc.cc，本页沿用同一套 DOM，所以这里补齐样式，
   而不是把导航删掉 —— 删掉会丢官网入口，也会让玩家没法回主站。
   ══════════════════════════════════════════════════════════════ */
.topnav { padding: 0; }
.topnav .wrap,
.topnav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topnav .logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
  white-space: nowrap;
}
.topnav .logo:hover { text-decoration: none; }
.topnav .logo-mark {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--grad);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: var(--fw-bold);
  flex: 0 0 auto;
}
.topnav-links {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  min-width: 0;
}
.nav-links-wrap { display: flex; align-items: center; gap: 2px; }
.topnav-links a {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.topnav-links a:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.topnav-links a.active { color: var(--blue-deep); font-weight: var(--fw-mid); }

/* 「社区与工具」下拉 */
.nav-more { position: relative; }
.nav-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 10px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.nav-more-btn:hover { background: var(--soft); color: var(--ink); }
.nav-more-btn .caret { font-size: 10px; opacity: .7; }
.nav-more-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: 14px;
  min-width: 560px;
}
.nav-more.open .nav-more-panel { display: block; }
/* 六组、3 列 × 2 行（2026-11-05 与主站一致） */
.nav-more-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.nav-more-g { display: flex; flex-direction: column; gap: 2px; }
.nav-more-t {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.nav-more-g a {
  padding: 5px 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.nav-more-g a:hover { background: var(--soft); text-decoration: none; }
/*
 * 账号入口的**基础**样式（2026-11-06 调整）：
 *   原来这里是"渐变实心底 + 白字"，且 `color: #fff !important` ——
 *   那个 !important 压过一切普通声明，导致改成白底描边后文字仍是白的（白底白字、看不见）。
 *   现在去掉 !important 与渐变底，具体配色由文件末尾那段 `.topnav .topnav-links .nav-account` 统一决定。
 */
.nav-account {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  margin-left: 8px;
  border-radius: var(--r-pill);
  background: var(--grad);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-mid);
  white-space: nowrap;
}
.nav-account:hover { filter: brightness(1.05); text-decoration: none; }
.nav-toggle {
  margin-left: auto;
  width: 40px; height: 36px;
  min-height: 36px;
  padding: 0;
  display: grid; place-content: center; gap: 4px;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-sm);
}
.nav-toggle span { display: block; width: 16px; height: 2px; background: var(--ink-2); border-radius: 1px; }

@media (min-width: 641px) {
  .topnav-links { display: flex; }
  .nav-toggle { display: none; }
}
/* 手机：默认收起，展开时竖向列出 */
@media (max-width: 640px) {
  .topnav-links {
    display: none;
    position: absolute;
    top: 52px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-md);
    padding: 10px;
    max-height: 70vh;
    overflow-y: auto;
    margin-left: 0;
  }
  .topnav.open .topnav-links { display: flex; }
  .nav-links-wrap { flex-direction: column; align-items: stretch; }
  .topnav-links a { padding: 11px 12px; font-size: var(--fs-md); }
  .nav-more-btn { width: 100%; justify-content: space-between; min-height: 42px; }
  .nav-more-panel {
    position: static;
    min-width: 0;
    box-shadow: none;
    border: none;
    padding: 4px 0 8px;
  }
  .nav-more-groups { grid-template-columns: 1fr; gap: 10px; }
  .nav-account { margin: 8px 0 0; justify-content: center; height: 44px; }
}

/* ══════════════════════════════════════════════════════════════
   未登录：概览条收成一行提示，不摆空资产卡（2026-10-31）
   任务单要求"未登录只给一个清楚入口"。原来是六格「—」，占了一大块，
   既没信息又把图和下单往下推。
   ────────────────────────────────────────────────────────────── */
.balance-strip.is-guest {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
}
.balance-strip.is-guest .balance-title,
.balance-strip.is-guest .metrics { display: none; }
.balance-strip.is-guest .balance-lead { margin-bottom: 0; }
.balance-strip.is-guest .guest-hint {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.balance-strip.is-guest .guest-login {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  background: var(--grad);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-mid);
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.balance-strip.is-guest .guest-login:hover { filter: brightness(1.05); text-decoration: none; }

/* 已登录时才显示指标 */
.balance-strip:not(.is-guest) .guest-hint,
.balance-strip:not(.is-guest) .guest-login { display: none; }

/* ── 手机：状态条只留最关键两项，其余进导航 ── */
@media (max-width: 640px) {
  .statusline .opt-secondary { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   手机：两排页签合并观感（2026-10-31）

   问题：「交易台 / 我的」与「现货 / 杠杆」上下两排，看着像两个层级，
   实际一个是工作区、一个是交易模式，语义不同但视觉重复，占两行高度。

   做法：**不合并 DOM**（会破坏 reset/切换逻辑），只调整视觉权重 ——
     · 「交易台 / 我的」做成轻量文字页签（细、靠左、无大背景）；
     · 「现货 / 杠杆」保留为醒目的分段控件（它才是高频操作）。
   这样层级清楚，也不再像两排一样的按钮。
   ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .areas {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 0;
    margin-bottom: 8px;
    gap: 18px;
  }
  .areas .area {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 2px;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0;
    font-size: var(--fs-sm);
    color: var(--muted);
    position: relative;
  }
  .areas .area.on {
    color: var(--blue-deep);
    font-weight: var(--fw-bold);
  }
  .areas .area.on::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--grad);
  }

  /* 模式条去掉吸顶（已在页签下面，不需要再吸） */
  .modebar { position: static; box-shadow: none; }
  .modebar { margin-bottom: 10px; }
}

/* ══════════════════════════════════════════════════════════════
   平板 641—900：右栏收窄，避免下单卡只有 360px 却把左边留空
   （2026-10-31 实测 768px：图 392 + 下单 360，中间有缝）
   ────────────────────────────────────────────────────────────── */
@media (min-width: 641px) and (max-width: 900px) {
  main.grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 14px;
  }
  /* 平板上「我的持仓与订单」跟在下单下面，不留大空档 */
  main.grid > #myPosCard { order: 5; }
  #chartHost, #chartHostMark { height: 340px; min-height: 340px; max-height: 340px; }
  .chartbar { flex-direction: column; align-items: stretch; }
  .chartgroup { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════
   杠杆估值块 .levbox（2026-10-31 补）

   实测问题：这一组块（名义敞口 / 开仓标记价 / 预估强平价 / 本次费用 /
   最大钱包合计支出）**完全没有样式**，五块挤成一行、标签与数值互相重叠，
   在 380px 的右栏里根本读不出来。
   ────────────────────────────────────────────────────────────── */
.levbox {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--soft);
  border-radius: var(--r-sm);
  min-width: 0;
}
.levbox .k {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.levbox .v {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.levbox .hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* 估值块用两列网格（.levgrid 现在被估值块复用，需要区分） */
.levgrid:has(.levbox) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
/* 兼容不支持 :has 的浏览器：估值块本身也要能撑住 */
@supports not selector(:has(*)) {
  .levgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* 手机与窄栏：单列更易读 */
@media (max-width: 640px) {
  .levgrid:has(.levbox) { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════
   细节打磨（2026-10-31 第 6 轮）

   逐条对应服主反馈：
     ① 切股不方便            → .symnav 上一只/下一只
     ④ 市场资讯一塌糊涂      → .newsitem 重做
     ④b 最新新闻右侧滑入     → .newsdrawer
     ⑤ 刷新按钮移到底部之外  → .newsrefresh 在卡片头
     ⑥ 主题切换做成开关      → .theme-toggle
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 无障碍隐藏（保留可访问性，视觉不占位）──────────────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════
   ⑥ 主题开关：太阳/月亮滑块
   ══════════════════════════════════════════════════════════════ */
.theme-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--soft);
  cursor: pointer;
  transition: background var(--theme-switch-dur), border-color var(--theme-switch-dur);
  flex: 0 0 auto;
}
.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(20, 30, 50, .18);
  display: grid;
  place-items: center;
  transition: transform .26s cubic-bezier(.4, .1, .2, 1), background var(--theme-switch-dur);
}
.theme-icon-sun,
.theme-icon-moon {
  position: absolute;
  font-size: 12px;
  line-height: 1;
  transition: opacity .2s, transform .26s;
}
.theme-icon-sun { color: #e0a53a; opacity: 1; transform: scale(1); }
.theme-icon-moon { color: #7c9bf7; opacity: 0; transform: scale(.6); }

html[data-theme="dark"] .theme-toggle {
  background: rgba(124, 155, 247, .22);
  border-color: rgba(124, 155, 247, .4);
}
html[data-theme="dark"] .theme-toggle-knob {
  transform: translateX(24px);
  background: #1d2637;
}
html[data-theme="dark"] .theme-icon-sun { opacity: 0; transform: scale(.6); }
html[data-theme="dark"] .theme-icon-moon { opacity: 1; transform: scale(1); }

/* ══════════════════════════════════════════════════════════════
   ① 切股：上一只 / 下一只
   ══════════════════════════════════════════════════════════════ */
.symnav {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}
.symnav-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--ink-2);
  font-size: 20px;
  line-height: 1;
  font-weight: var(--fw-mid);
  transition: background .14s, border-color .14s, color .14s;
}
.symnav-btn:hover { border-color: var(--blue); color: var(--blue-deep); }
.symnav-btn:active { background: var(--pill); }

@media (max-width: 640px) {
  /* 手机上要够大才好点 */
  .symnav-btn { width: 44px; height: 44px; min-height: 44px; font-size: 22px; }

  /*
   * 手机标的条（2026-10-31，第 5 次也是最后一次）
   *
   * 前四次都在跟 flex 的折行规则较劲：右侧按钮组被压缩 → 内部被迫换行 →
   * 高度从 112 涨到 255，"换股票"单独掉一行。
   *
   * 定稿做法：**改 HTML 结构**，让两行各有明确的两个元素：
   *   行1  .symbolbar-name  |  .symbolbar-chg
   *   行2  .symbolbar-price |  .symbar-actions
   * 用 grid 两列两行，格位固定，不再依赖折行。
   */
  .symbolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name  chg"
      "price actions";
    align-items: center;
    gap: 6px 12px;
    padding: 12px 14px !important;
  }
  .symbolbar-main { grid-area: name; min-width: 0; }
  .symbolbar-name {
    font-size: var(--fs-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .symbolbar-chg {
    grid-area: chg;
    font-size: var(--fs-sm);
    white-space: nowrap;
    justify-self: end;
  }
  .symbolbar-price {
    grid-area: price;
    font-size: 22px;
    margin-top: 0;
    white-space: nowrap;
    min-width: 0;
  }
  .symbolbar-price .pricemode { display: none; }

  .symbar-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-self: end;
    flex: 0 0 auto;
  }
  .symnav-btn { width: 40px; height: 40px; min-height: 40px; font-size: 20px; }
  #btnPickSymbol { min-height: 40px; height: 40px; padding: 0 12px; font-size: var(--fs-xs); }
}

@media (max-width: 340px) {
  .symbolbar-price { font-size: 19px; }
  .symnav-btn { width: 36px; height: 36px; min-height: 36px; }
  #btnPickSymbol { padding: 0 9px; }
}

@media (max-width: 340px) {
  .symbolbar-price { font-size: 19px; }
  .symnav-btn { width: 36px; height: 36px; min-height: 36px; }
  #btnPickSymbol { padding: 0 9px; }
}

/* 极窄屏：再压一档字号，仍不换行 */
@media (max-width: 340px) {
  .symbolbar-price { font-size: 19px; }
  .symbolbar-name { font-size: 12px; }
  .symnav-btn { width: 36px; height: 36px; min-height: 36px; }
  #btnPickSymbol { padding: 0 9px; }
  .symbolbar-chg { font-size: 12px; }
}

/* 刷新按钮在卡片头（2026-10-31） */
.cardhead .newsrefresh {
  margin-left: auto;
  min-height: 32px;
  padding: 0 12px;
  font-size: var(--fs-xs);
  flex-shrink: 0;
}

.newsreadbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
  font-size: var(--fs-xs);
  color: var(--muted);
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   市场资讯 · 按真实 DOM 类名重做（2026-10-31 第 6 轮修正）

   ⚠️ 上一版我凭想象写了 .newstime/.newssummary/.newstag 等类名，
   实际渲染出来的是 .newsitem-head / .newsdir / .newstitle / .newsdetail /
   .newsfoot / .newstargets —— 所以那套样式一条都没生效，列表才显得"一塌糊涂"。
   这里按**实际输出的类名**重写。
   ══════════════════════════════════════════════════════════════════════════ */

/* 列表容器 */
#newsBox { display: flex; flex-direction: column; gap: 0; }

/* 单条资讯 */
#newsBox .newsitem {
  padding: 13px 10px;
  border-radius: var(--r-sm);
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background .14s;
}
#newsBox .newsitem:last-child { border-bottom: none; }
#newsBox .newsitem:hover { background: var(--soft); }
#newsBox .newsitem.newsread { opacity: .72; }

/* 头行：方向标签 + 标题 + 时间 */
#newsBox .newsitem-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

/* 方向标签（利好/利空/中性） */
#newsBox .newsdir {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: var(--fw-mid);
  padding: 1px 8px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.6;
}
#newsBox .newsdir.up   { color: var(--up);   background: var(--up-soft); }
#newsBox .newsdir.down { color: var(--down); background: var(--down-soft); }
#newsBox .newsdir.flat { color: var(--muted); background: var(--soft); border-color: var(--line); }
/* app.js 里方向类名可能是 dirup/dirdown/dirflat，一并兼容 */
#newsBox .newsdir.dirup   { color: var(--up);   background: var(--up-soft); }
#newsBox .newsdir.dirdown { color: var(--down); background: var(--down-soft); }
#newsBox .newsdir.dirflat { color: var(--muted); background: var(--soft); border-color: var(--line); }

/* 标题：占据剩余宽度，最多两行 */
#newsBox .newstitle {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-mid);
  color: var(--ink);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* 已读标记 */
#newsBox .newsreadtag {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--soft);
}

/* 时间：推到最右，等宽数字 */
#newsBox .newstime {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 正文摘要 */
#newsBox .newsdetail {
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/* 脚注：行业 / 影响 / 标的 */
#newsBox .newsfoot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: var(--fs-xs);
}

/* 受影响标的：做成小胶囊，允许换行，不挤成一坨 */
#newsBox .newstargets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
#newsBox .newstarget {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
}
#newsBox .newstarget:hover { border-color: var(--blue); color: var(--blue-deep); }
#newsBox .newstarget .muted { font-size: 11px; }

/* 手机：时间换到下一行，标题独占 */
@media (max-width: 640px) {
  #newsBox .newsitem { padding: 13px 4px; }
  #newsBox .newsitem-head { gap: 6px 8px; }
  #newsBox .newstitle { flex: 1 1 100%; order: 3; }
  #newsBox .newstime { margin-left: 0; order: 2; }
  #newsBox .newsdir { order: 1; }
  #newsBox .newsdetail { margin-top: 6px; }
  #newsBox .newsfoot { gap: 8px; }
}

/* ── 侧滑弹窗内也套用同一套（.newsdrawer-body 里）── */
.newsdrawer-body .newsitem {
  background: var(--soft);
  border-radius: var(--r-sm);
  border-bottom: none;
  margin-bottom: 6px;
  padding: 12px 12px;
}
.newsdrawer-body .newsitem:hover { background: var(--pill); }

/* ══════════════════════════════════════════════════════════════
   ④b 最新资讯：右侧滑入弹窗
   ══════════════════════════════════════════════════════════════ */
.newsdrawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  visibility: hidden;
}
.newsdrawer.open { visibility: visible; pointer-events: auto; }

.newsdrawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 26, .28);
  opacity: 0;
  transition: opacity .26s;
}
.newsdrawer.open .newsdrawer-mask { opacity: 1; }

.newsdrawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 88vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(10, 16, 26, .16);
  display: flex;
  flex-direction: column;
  /*
   * 从右侧滑入：初始 translateX(100%)，打开时归零。
   * 用 transform 而不是 right，避免触发布局重排。
   */
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.32, .72, 0, 1);
}
.newsdrawer.open .newsdrawer-panel { transform: translateX(0); }

.newsdrawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.newsdrawer-kicker {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .06em;
  margin-bottom: 2px;
}
.newsdrawer-head h3 { font-size: var(--fs-md); }
.newsdrawer-close {
  width: 34px; height: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
  flex: 0 0 auto;
}
.newsdrawer-close:hover { color: var(--ink); }

.newsdrawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 10px 16px;
  -webkit-overflow-scrolling: touch;
}
.newsdrawer-foot {
  flex: 0 0 auto;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.newsdrawer-foot button { width: 100%; min-height: 40px; }

/* 弹窗内条目沿用列表样式，但去掉分隔线改成卡片感 */
.newsdrawer-body .newsitem {
  grid-template-columns: 56px minmax(0, 1fr);
  padding: 12px 10px;
  border-radius: var(--r-sm);
  margin-bottom: 6px;
  background: var(--soft);
  border-bottom: none;
}
.newsdrawer-body .newsitem .newstitle,
.newsdrawer-body .newsitem b { grid-column: 2; }
.newsdrawer-body .newsitem .newssummary,
.newsdrawer-body .newsitem p { grid-column: 1 / -1; }
.newsdrawer-body .newsitem .newstag,
.newsdrawer-body .newsitem .tag { grid-column: 2; justify-self: start; }

/* 手机：底部弹出更顺手（从下往上），仍保留滑入观感 */
@media (max-width: 640px) {
  .newsdrawer-panel {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 78vh;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(100%);
  }
  .newsdrawer.open .newsdrawer-panel { transform: translateY(0); }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .newsdrawer-panel, .newsdrawer-mask, .theme-toggle-knob { transition: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   新手教程弹窗 + 轻提示（2026-10-31 第 6 轮）
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 轻提示 ── */
.fxtoast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 400;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--panel);
  font-size: var(--fs-sm);
  font-weight: var(--fw-mid);
  box-shadow: var(--sh-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  max-width: min(92vw, 420px);
  text-align: center;
}
.fxtoast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 教程弹窗 ── */
.fxtut {
  position: fixed;
  inset: 0;
  z-index: 300;
  visibility: hidden;
  pointer-events: none;
}
.fxtut.open { visibility: visible; pointer-events: auto; }

.fxtut-mask {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 26, .42);
  opacity: 0;
  transition: opacity .24s;
}
.fxtut.open .fxtut-mask { opacity: 1; }

.fxtut-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  transform: translate(-50%, -46%) scale(.97);
  opacity: 0;
  transition: opacity .24s, transform .24s cubic-bezier(.32, .72, 0, 1);
}
.fxtut.open .fxtut-panel {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.fxtut-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.fxtut-kicker {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .06em;
  margin-bottom: 3px;
}
.fxtut-head h3 { font-size: var(--fs-lg); }
.fxtut-close {
  width: 34px; height: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--muted);
  font-size: 14px;
  flex: 0 0 auto;
}
.fxtut-close:hover { color: var(--ink); }

.fxtut-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 22px;
  -webkit-overflow-scrolling: touch;
}

.fxtut-steps {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  counter-reset: step;
}
.fxtut-steps li {
  position: relative;
  padding: 10px 0 10px 40px;
  border-bottom: 1px solid var(--line-2);
  counter-increment: step;
}
.fxtut-steps li:last-child { border-bottom: none; }
.fxtut-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: var(--fw-bold);
  display: grid;
  place-items: center;
}
.fxtut-steps li b {
  display: block;
  font-size: var(--fs-base);
  margin-bottom: 2px;
}
.fxtut-steps li span {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.7;
}

.fxtut-note {
  background: var(--soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.fxtut-note > b {
  display: block;
  font-size: var(--fs-sm);
  margin-bottom: 6px;
}
.fxtut-note ul {
  margin: 0;
  padding-left: 18px;
}
.fxtut-note li {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.8;
}
.fxtut-note li b { color: var(--ink-2); }

.fxtut-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.fxtut-guide {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.fxtut-guide:hover { color: var(--blue-deep); }
.fxtut-go {
  min-height: 42px;
  padding: 0 26px;
  border: none;
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}

/* 手机：底部弹出，占满宽度 */
@media (max-width: 640px) {
  .fxtut-panel {
    left: 0; right: 0; top: auto; bottom: 0;
    width: 100%;
    max-height: 86vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(100%) scale(1);
  }
  .fxtut.open .fxtut-panel { transform: translateY(0) scale(1); }
  .fxtut-foot { flex-direction: row-reverse; }
  .fxtut-go { flex: 1 1 auto; }
}

/* 卡片闪烁（跳转到资讯时用） */
.card.flash { animation: fxflash 1.2s ease; }
@keyframes fxflash {
  0%, 100% { box-shadow: var(--sh-sm); }
  30% { box-shadow: 0 0 0 3px rgba(107, 143, 245, .35); }
}

@media (prefers-reduced-motion: reduce) {
  .fxtut-panel, .fxtut-mask, .fxtoast { transition: none !important; }
  .card.flash { animation: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   新资讯角标 + 弹窗遮罩安全（2026-10-31）

   ① 角标：替代"自动弹窗"，只在卡片头提示，不遮挡、不拦截点击。
   ② 遮罩安全：`.newsdrawer` 关闭时必须 visibility:hidden + pointer-events:none，
      否则全屏遮罩会**拦住整页的鼠标事件** ——
      本轮实测踩到：弹窗自动打开后，图表点不动、悬浮提示不出现，
      查了半天才发现是遮罩还在。
   ────────────────────────────────────────────────────────────── */
.newsbadge {
  margin-left: auto;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(107, 143, 245, .35);
  background: rgba(107, 143, 245, .12);
  color: var(--blue-deep);
  font-size: var(--fs-xs);
  font-weight: var(--fw-mid);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.newsbadge::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--blue);
  vertical-align: middle;
}
.newsbadge:hover { background: rgba(107, 143, 245, .2); }

/* 有角标时，刷新按钮不再抢 margin-left:auto */
.cardhead:has(.newsbadge) .newsrefresh { margin-left: 8px; }

/* 关闭态：彻底移出交互层 */
.newsdrawer:not(.open) {
  visibility: hidden !important;
  pointer-events: none !important;
}
.newsdrawer:not(.open) .newsdrawer-mask {
  opacity: 0 !important;
  pointer-events: none !important;
}
.newsdrawer:not(.open) .newsdrawer-panel {
  pointer-events: none !important;
}

/* ══════════════════════════════════════════════════════════════
   手机：资讯列表默认只显示 3 条（2026-10-31 发布前修正）

   实测问题：线上手机页面高 5138px —— 20 条资讯全展开，
   把「说明」挤到最底部，玩家要滑很久才到底。
   资讯是**次要信息**，不该占掉近一半页面。

   做法：手机上只显示前 3 条，其余隐藏；底部给「展开全部 N 条」按钮。
   桌面保持原样（空间够）。
   ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #newsBox .newsitem:nth-child(n+4) { display: none; }
  #newsBox.is-expanded .newsitem:nth-child(n+4) { display: block; }
}

/* 展开/收起按钮 */
.newsmore {
  display: none;
}
.newsmore[hidden] { display: none !important; }
@media (max-width: 640px) {
  /*
   * ⚠️ 必须带 !important：卡片若带 data-collapsed="1"，
   * `.card.foldable[data-collapsed="1"] > *:not(.cardhead) { display:none }` 会把它隐藏；
   * 而 .newsmore 正是插在 #newsBox 之后的、不属于 .cardhead 的子元素。
   */
  .newsmore:not([hidden]) {
    display: block !important;
    width: 100%;
    min-height: 38px;
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--soft);
    color: var(--muted);
    font-size: var(--fs-xs);
  }
}

/* ══════════════════════════════════════════════════════════════
   桌面两处发布前修正（2026-10-31）

   ① 资讯在桌面上 20 条全展开，页面被拉到 3915px —— 桌面也该折叠。
      桌面显示前 6 条（比手机多一倍，但仍不淹没页面）。
   ② 标的条右侧 ‹ › 变成竖排（因为 .symbar-actions 没有 flex-direction）。
   ────────────────────────────────────────────────────────────── */
#newsBox .newsitem:nth-child(n+7) { display: none; }
#newsBox.is-expanded .newsitem:nth-child(n+7) { display: block; }

@media (max-width: 640px) {
  /* 手机上更严：只留 3 条（覆盖上面的 6 条规则） */
  #newsBox .newsitem:nth-child(n+4) { display: none; }
  #newsBox.is-expanded .newsitem:nth-child(n+4) { display: block; }
}

/* 桌面的展开按钮也要能显示 */
.newsmore:not([hidden]) {
  display: block !important;
  width: 100%;
  min-height: 36px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--muted);
  font-size: var(--fs-xs);
  cursor: pointer;
}
.newsmore:not([hidden]):hover { border-color: var(--blue); color: var(--blue-deep); }

/* ② 标的条按钮组：必须是横排 */
.symbar-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   补回重构时遗漏的组件样式（2026-10-31 发布后补漏）

   ⚠️ 背景：重构 style.css 时只覆盖了"首屏看到的部分"，
   以下组件是 app.js 动态渲染的，"我的"页、资讯、杠杆仓位、行业、自选等
   全都**没有样式** —— 表现就是按钮叠在文字上、列表挤成一坨（服主截图红框）。

   本轮把 app.js 里出现的所有 class 与 CSS 做了交叉比对，
   找出 42 个缺失的类，逐个补齐。这一块以后**再改样式也要交叉比对一次**，
   避免又只改看得见的那几处。
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 通用行：我的页、排行、持仓、订单都用它 ─────────────────── */
.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: var(--fs-base);
  line-height: 1.6;
  min-width: 0;
}
.row:last-child { border-bottom: none; }
.row > span { min-width: 0; }
.row > span:first-child { flex: 1 1 auto; overflow-wrap: anywhere; }
.row > span:last-child { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; }
.row .muted { font-size: var(--fs-xs); }

/* ── 按钮补充 ───────────────────────────────────────────────── */
.warnbtn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(184, 134, 11, .4);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-xs);
  font-weight: var(--fw-mid);
  cursor: pointer;
  white-space: nowrap;
}
.warnbtn:hover { border-color: var(--warn); }

.linkbtn {
  background: transparent;
  border: none;
  color: var(--blue-deep);
  font-size: var(--fs-xs);
  padding: 0 4px;
  min-height: 24px;
  cursor: pointer;
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 11.5px;
  white-space: nowrap;
}
.badge.on { background: rgba(107, 143, 245, .14); color: var(--blue-deep); border-color: rgba(107, 143, 245, .3); }

/* ── 奖励列表 ───────────────────────────────────────────────── */
#rewardBox { display: flex; flex-direction: column; gap: 2px; }
.reward-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  min-width: 0;
}
.reward-row:last-child { border-bottom: none; }
.reward-row > span:first-child,
.reward-row .reward-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-base);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.reward-row .muted { font-size: var(--fs-xs); display: block; margin-top: 2px; }
.reward-row button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-mid);
  white-space: nowrap;
  cursor: pointer;
}
.reward-row button:not(:disabled):hover { border-color: var(--blue); color: var(--blue-deep); }
.reward-row button:disabled { opacity: .55; cursor: default; }

/* ── 自选 ───────────────────────────────────────────────────── */
.watchrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
  min-width: 0;
}
.watchrow:last-child { border-bottom: none; }
.watchrow-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-base);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watchrow-act { flex: 0 0 auto; display: flex; gap: 6px; }

/* ── 到价提醒 ───────────────────────────────────────────────── */
.alertlist { display: flex; flex-direction: column; gap: 2px; }
.alertrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: var(--fs-sm);
  flex-wrap: wrap;
  min-width: 0;
}
.alertrow:last-child { border-bottom: none; }
.alertrow > .muted { font-size: var(--fs-xs); }
.alertstate {
  font-size: 11.5px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.alertstate.on { color: var(--down); background: var(--down-soft); border-color: transparent; }
.alertstate.off { color: var(--muted); }
.alertfoot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ── 行业板块 ───────────────────────────────────────────────── */
.industrygrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}
.industrygroup {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--panel);
  min-width: 0;
}
.industrygroup-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  flex-wrap: wrap;
}
.industrygroup-head .muted { font-weight: var(--fw-normal); font-size: var(--fs-xs); }

.industryitem {
  border-top: 1px solid var(--line-2);
  padding: 10px 0;
  min-width: 0;
}
.industryitem:first-child { border-top: none; padding-top: 0; }
.industryitem-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--fs-base);
  font-weight: var(--fw-mid);
}
.industryitem-head .muted { font-size: var(--fs-xs); font-weight: var(--fw-normal); }
.industryitem-intro {
  margin-top: 3px;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.industryitem-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-size: var(--fs-xs);
}
.industryitem-act { display: flex; gap: 6px; flex-wrap: wrap; }
.industryitem-act button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.industryitem-act button:hover { border-color: var(--blue); color: var(--blue-deep); }

/* 涨跌标签 */
.voltag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.voltag.high { color: var(--up); background: var(--up-soft); border-color: transparent; }
.voltag.low { color: var(--down); background: var(--down-soft); border-color: transparent; }

/* ── 杠杆仓位 ───────────────────────────────────────────────── */
.levpos-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  min-width: 0;
}
.levpos-main:last-child { border-bottom: none; }
.levpos-id {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.levpos-dir {
  font-size: 11.5px;
  font-weight: var(--fw-bold);
  padding: 1px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.levpos-dir.long { color: var(--up); background: var(--up-soft); }
.levpos-dir.short { color: var(--down); background: var(--down-soft); }
.levpos-nums {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.levpos-act { flex: 0 0 auto; display: flex; gap: 6px; flex-wrap: wrap; }
.levpos-act button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.levpos-act button:hover { border-color: var(--blue); color: var(--blue-deep); }
.levpos-added { font-size: 11px; color: var(--muted); }
.levpos-closenote { font-size: 11px; color: var(--muted); }
.levpos-act button:disabled { opacity: .55; cursor: default; }

/* ── 杠杆面板补充 ───────────────────────────────────────────── */
.levpanel-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  flex-wrap: wrap;
}
.levpanel-note,
.levpanel-tip {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.7;
  margin-top: 8px;
}
.levpanel-warn {
  font-size: var(--fs-xs);
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin-top: 8px;
  line-height: 1.7;
}
.levpanel-cur {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  background: var(--soft);
  border-radius: var(--r-sm);
  margin-bottom: 10px;
  font-size: var(--fs-sm);
  flex-wrap: wrap;
}
.levpanel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.levpanel-actions button { min-height: 40px; }
.lev-guard {
  font-size: var(--fs-xs);
  color: var(--muted);
  background: var(--soft);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin-top: 10px;
  line-height: 1.7;
}

/* ── 结算 / 添加结果 ────────────────────────────────────────── */
.addresult, .add-result {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--soft);
  margin-top: 10px;
}
.addresult-head, .add-result .addresult-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  margin-bottom: 8px;
}
.addresult-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  font-size: var(--fs-xs);
}
.addresult-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.addresult-item span:first-child { color: var(--muted); flex: 0 0 auto; }
.addresult-item span:last-child { text-align: right; overflow-wrap: anywhere; }
.addresult-note {
  margin-top: 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.7;
}

/* ── 资讯过期提示 ───────────────────────────────────────────── */
.newsstale {
  font-size: var(--fs-xs);
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  margin-top: 8px;
}

/* ── small 按钮 ─────────────────────────────────────────────── */
button.small, .ghost.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: var(--fs-xs);
}

/* ── 手机：奖励/持仓/行业行更宽松 ───────────────────────────── */
@media (max-width: 640px) {
  .reward-row { flex-wrap: wrap; }
  .reward-row button { width: 100%; margin-top: 6px; }
  .industrygrid { gap: 8px; }
  .industrygroup { padding: 10px 12px; }
  .addresult-grid { grid-template-columns: 1fr; }
  .levpos-act { width: 100%; }
  .levpos-act button { flex: 1 1 auto; }
  .alertrow { gap: 6px; }
}

/* ── 桌面：行业网格两列 ─────────────────────────────────────── */
@media (min-width: 641px) {
  .industrygrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .industrygrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ══════════════════════════════════════════════════════════════
   概览条「转入转出」快捷跳转（2026-10-31）

   服主反馈：资金转入转出卡在页面最底下，要滑很久。
   在账户概览右侧给一个直接跳过去的按钮。
   ────────────────────────────────────────────────────────────── */
.balance-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.balance-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-mid);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .16s, color .16s, background .16s;
}
.balance-jump:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
  background: rgba(107, 143, 245, .08);
}
.balance-jump-ico { font-size: 15px; line-height: 1; }

/* 跳转目标高亮一下，让玩家知道"跳到了这里" */
.card.flash-target {
  animation: fxflashTarget 1.4s ease;
}
@keyframes fxflashTarget {
  0%, 100% { box-shadow: var(--sh-sm); }
  25% { box-shadow: 0 0 0 3px rgba(107, 143, 245, .38); }
}

/* 手机：概览条里按钮换行放下，别把指标挤扁 */
@media (max-width: 640px) {
  .balance-actions { width: 100%; margin-top: 8px; }
  .balance-jump { width: 100%; justify-content: center; min-height: 42px; }
}

/* 桌面：概览条 flex 布局里，按钮靠右 */
@media (min-width: 901px) {
  .balance-strip { display: flex; align-items: center; gap: 24px; }
  .balance-actions { margin-left: auto; }
}

/* ── 手机：转账表单一行排下（2026-10-31）───────────────────────
   截图里「转入股市」与「转出到游戏」被拆成两行，金额框也窄。
   改成：金额独占一行 → 两个按钮并排各占一半。
   ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #transferCard .orderbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: end;
  }
  #transferCard .orderbar > label {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  #transferCard #transferAmount { width: 100% !important; }
  #transferCard #btnTransferIn,
  #transferCard #btnTransferOut {
    min-height: 44px;
    font-size: var(--fs-sm);
    border-radius: var(--r-sm);
    white-space: nowrap;
  }
}

/* ══════════════════════════════════════════════════════════════
   手机：按模式排顺序（2026-10-31 补回）

   ⚠️ 这个规则之前有，在我重写桌面区块时被一起删掉了。
   实测后果：手机杠杆模式下，杠杆房间排在
   「图表 → 行情 → 行业 → 资讯」**之后**（y=1999），
   玩家要滑过四张卡才能开仓/平仓。

   修法：用 CSS order 按模式重排。**不动 DOM**，切模式不重建节点、不丢表单状态。
   main.grid 在手机上不是 grid（块级流），order 对块级子元素同样有效。
   ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  main.grid { display: flex; flex-direction: column; }

  /* 现货：标的 → 模式 → 图 → 下单 → 持仓 → 行情 → 行业 → 资讯 → 说明 */
  body[data-mode="spot"] #symbolBar    { order: 1; }
  body[data-mode="spot"] #modeBar      { order: 2; }
  body[data-mode="spot"] .chartcard    { order: 3; }
  body[data-mode="spot"] #orderCard    { order: 4; }
  body[data-mode="spot"] #myPosCard    { order: 5; }
  body[data-mode="spot"] #quotesCard   { order: 6; }
  body[data-mode="spot"] #industryCard { order: 7; }
  body[data-mode="spot"] #newsCard     { order: 8; }
  body[data-mode="spot"] #helpCard     { order: 9; }

  /* 杠杆：标的 → 模式 → 图 → 杠杆房间（仓位/平仓/开仓）→ 行情 → 行业 → 资讯 */
  body[data-mode="lev"] #symbolBar    { order: 1; }
  body[data-mode="lev"] #modeBar      { order: 2; }
  body[data-mode="lev"] .chartcard    { order: 3; }
  body[data-mode="lev"] .room         { order: 4; }
  body[data-mode="lev"] #quotesCard   { order: 5; }
  body[data-mode="lev"] #industryCard { order: 6; }
  body[data-mode="lev"] #newsCard     { order: 7; }
  body[data-mode="lev"] #helpCard     { order: 8; }

  /* 「我的」卡片跟在最后 */
  main.grid > [data-area="me"] { order: 20; }
}

/* ══════════════════════════════════════════════════════════════
   手机：杠杆房间压缩（2026-10-31）

   实测房间高 2192px，其中：
     · 开仓表单 roomorder 1206px —— 杠杆倍数网格 levgrid 独占 477px
       （8 个倍数排成两行大按钮，每个 44px 高 + 间距）
     · 摘要 roomsum 333px

   压缩点：
     ① 倍数网格改成「一行四列」，8 个 = 2 行紧凑按钮；
     ② 估值块 levbox 两列；
     ③ 摘要保持两格 + 更多数据。
   ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* 倍数：4 列紧凑 */
  .levgrid:has(.levbox) { grid-template-columns: 1fr 1fr; }
  .roomorder .levgrid,
  .levform .levgrid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }
  .roomorder .levgrid button,
  .levform .levgrid button {
    min-height: 38px !important;
    padding: 0 4px !important;
    font-size: var(--fs-xs) !important;
  }

  /* 摘要：只留两格 + 更多数据，别铺 333px */
  #roomSummary[data-compact="1"] .roomsum-item:nth-child(n+3) { display: none !important; }

  /* 开仓表单字段间距收紧 */
  .roomorder .levfield,
  .levform .levfield { margin-bottom: 8px !important; }
  .levloss { font-size: var(--fs-xs); line-height: 1.65; }
}

/* ══════════════════════════════════════════════════════════════
   盈亏醒目化（2026-11-01）

   服主反馈：「感觉现在玩家赚了还是亏了不够明显」。

   原来概览条只有静态余额，浮动盈亏根本没显示。现在：
     · 浮动盈亏与总权益**并列为主指标**，字号接近总权益；
     · 赚用红、亏用绿（本服口径：红涨绿跌）；
     · 带正负号与百分比，缺口一眼能看出方向；
     · 有背景色块，在深色/浅色下都醒目。
   ────────────────────────────────────────────────────────────── */
.balance-main {
  display: flex;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
}

.balance-pnl {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-md);
  background: var(--soft);
  border: 1px solid var(--line);
  transition: background var(--theme-switch-dur), border-color var(--theme-switch-dur);
}
.balance-pnl-k {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}
.balance-pnl-v {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}
.balance-pnl-pct {
  font-size: var(--fs-md);
  font-weight: var(--fw-mid);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 赚：红；亏：绿；持平：灰 */
.balance-pnl.is-up {
  background: var(--up-soft);
  border-color: transparent;
}
.balance-pnl.is-up .balance-pnl-v,
.balance-pnl.is-up .balance-pnl-pct { color: var(--up); }

.balance-pnl.is-down {
  background: var(--down-soft);
  border-color: transparent;
}
.balance-pnl.is-down .balance-pnl-v,
.balance-pnl.is-down .balance-pnl-pct { color: var(--down); }

.balance-pnl.is-flat .balance-pnl-v { color: var(--muted); }
.balance-pnl.is-flat .balance-pnl-pct { color: var(--muted); }

/* 手机：两块上下排，盈亏块占满宽度更好读 */
@media (max-width: 640px) {
  .balance-main { flex-direction: column; align-items: stretch; gap: 10px; }
  .balance-pnl { justify-content: space-between; width: 100%; padding: 10px 14px; }
  .balance-pnl-v { font-size: var(--fs-xl); }
  .balance-pnl-pct { font-size: var(--fs-sm); }
}

/* 桌面：盈亏块靠右一点，与总权益同一行 */
@media (min-width: 901px) {
  .balance-main { flex: 0 0 auto; gap: 20px; }
  .balance-pnl { padding: 4px 12px; }
  .balance-pnl-v { font-size: 24px; }
}

/* ── 持仓行盈亏强化：把数字做大、带符号与百分比 ────────────── */
.pos-row-pnl {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pos-row-pnl .pnl-num {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}
.pos-row-pnl .pnl-pct {
  font-size: var(--fs-xs);
  font-weight: var(--fw-mid);
  opacity: .9;
}
.pos-row-pnl.up .pnl-num, .pos-row-pnl.up .pnl-pct { color: var(--up); }
.pos-row-pnl.down .pnl-num, .pos-row-pnl.down .pnl-pct { color: var(--down); }
.pos-row-pnl.muted .pnl-num, .pos-row-pnl.muted .pnl-pct { color: var(--muted); }

/* 我的页持仓行：整行给一点底色，赚亏更明显 */
#mePositions .row.pos-up { background: linear-gradient(90deg, var(--up-soft) 0%, transparent 60%); }
#mePositions .row.pos-down { background: linear-gradient(90deg, var(--down-soft) 0%, transparent 60%); }

/* ── 排行榜盈亏列强化 ───────────────────────────────────── */
#ranking .row .profit,
#ranking .row .profitPct {
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-mid);
}

/* ══════════════════════════════════════════════════════════════
   周期组按模式互斥显示（2026-11-01）

   服主反馈「杠杆点上面的周期不会切换」。根因不是按钮没绑事件，
   而是杠杆模式下显示的是**现货那组周期按钮**：
   点了只改隐藏的现货图，标记价图纹丝不动。

   现在图卡里有两组：现货周期组 / 标记价周期组，按 body[data-mode] 只显示一组。
   ────────────────────────────────────────────────────────────── */
body[data-mode="spot"] #periodGroup { display: flex; }
body[data-mode="spot"] #markPeriodGroup { display: none; }

body[data-mode="lev"] #periodGroup { display: none; }
body[data-mode="lev"] #markPeriodGroup { display: flex; }

/* 兜底：data-mode 尚未写入时（首屏极短瞬间），两组都先不显示第二组 */
#markPeriodGroup[hidden] { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   桌面：消除图表卡下方的大片空位（2026-11-01）

   问题（服主截图）：杠杆模式下，右侧「杠杆交易室」高约 1270px，
   而左侧图表卡只有约 550px。两者在**同一网格行**，grid 行高取较高者，
   于是图表卡下方留出 700px 空白。

   两处一起处理：
     ① 压缩交易室高度：估值块 5 个从竖排改**两列网格**，
        说明段落收紧行距、按钮行内联；
     ② 左栏自身不再被行高撑开：让图表卡 `align-self: start`，
        空白改由网格背景承担，不会在卡片内部画出一大块空白边框。
   ────────────────────────────────────────────────────────────── */
@media (min-width: 901px) {
  /*
   * ⚠️ 这里**不要**再给 #chartCard 写 align-self: start。
   * 那是 ID 选择器，优先级高于后面 .chartcard 的 align-self: stretch，
   * 会让"图表卡拉伸填满整行"失效（本轮实测踩到：空位 565px 一直不消）。
   * 图表卡的最终对齐由文件末尾的「桌面：消除左栏大空位」一节统一决定。
   */
  main.grid > .room { align-self: start; }
  main.grid > #orderCard { align-self: start; }
  main.grid > #myPosCard { align-self: start; }

  /*
   * ① 交易室高度压缩
   *
   * ⚠️ 上一版这里给 `.room .levpanel-grid` 写了两列，可那其实是**倍数按钮**的容器，
   * 结果 8 个倍数被压成 5 列、估值块标签被截成「名义...」「持仓...」（服主截图）。
   * 倍数与估值块是两个不同的容器：
   *   · `.levgrid:has(.levbox)`  → 估值块，本来就是两列（下方原有规则已处理）
   *   · 倍数按钮容器             → 保持 5 列是**正确**的
   * 所以这里**不再覆盖列数**，只压缩内边距与字号。
   */
  .room .levbox {
    padding: 9px 10px;
  }
  .room .levbox .k { font-size: 11.5px; }
  .room .levbox .v { font-size: var(--fs-md); }

  /* 倍数按钮：保持 5 列，只压高度 */
  .room .levgrid {
    gap: 6px;
  }
  .room .levgrid button { min-height: 36px; }

  /* 风险说明收紧 */
  .room .levloss,
  .room .levguardnote {
    font-size: 11.5px;
    line-height: 1.6;
  }
  .room .levpanel-note,
  .room .levpanel-tip { line-height: 1.6; margin-top: 6px; }

  /* 底部按钮行内联，不占整行 */
  .room .levpanel-actions { flex-wrap: wrap; gap: 8px; margin-top: 8px; }
}

/* ══════════════════════════════════════════════════════════════
   桌面杠杆/交易布局（2026-11-01 重做）

   <h3>服主反馈</h3>
   「为什么要把 ui 做成这样？重构一下杠杆的 ui，这个 K 线图这样太抽象了」

   <h3>上一版错在哪</h3>
   为了解决"图表卡下方空 450px"，我让图表卡 `align-self: stretch`
   拉到与右栏同高（实测 1418px），再把图表 `flex: 1` 撑满 ——
   结果 SVG 变成 **994×1179（高大于宽）**，
   K 线被纵向拉长成"心电图"，横轴时间点被压得极密，完全没法看盘。

   **图表必须保持宽扁比例**，这是看盘图的基本要求。

   <h3>正确做法</h3>
   ① 图表高度**固定上限**（不随右栏拉伸），保持宽:高 ≈ 2.2:1 以上；
   ② 卡片不再 stretch，改为按内容高度；
   ③ 右栏比左栏高出来的部分，由**页面继续向下排**吸收，
      而不是把左栏硬撑到同高。

   <h3>宽屏利用率</h3>
   `.app-shell` 的 max-width 在超宽屏下也会放宽（见文件末尾的超宽屏一节），
   避免 2560px 屏上左右各空 520px。
   ────────────────────────────────────────────────────────────── */
@media (min-width: 901px) {
  /* ① 图表卡按内容高度，不参与把行撑满 */
  main.grid > .chartcard {
    grid-column: 1;
    grid-row: 3;
    align-self: start;
    display: flex;
    flex-direction: column;
  }

  /* ② 图表主体：固定高度上限，保持宽扁 */
  main.grid > .chartcard > .chartwrap {
    flex: 0 0 auto;
    height: 420px;
    min-height: 420px;
    max-height: 420px;
    display: flex;
    flex-direction: column;
  }
  main.grid > .chartcard > .chartwrap > #chartHost,
  main.grid > .chartcard > .chartwrap > #chartHostMark {
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  /* ③ 右栏贴顶；比左栏高出来的部分让页面自然往下排 */
  main.grid > .room,
  main.grid > #orderCard { grid-column: 2; grid-row: 3; align-self: start; }
  main.grid > #quotesCard { grid-column: 1; grid-row: 4; }
  main.grid > #myPosCard { grid-column: 2; grid-row: 4; align-self: start; }
}

/* ══════════════════════════════════════════════════════════════
   超宽屏利用率（2026-11-01）

   实测 2560px 屏：`.app-shell` 被限制在 1520px，左右各空 520px，
   合计浪费 1040px —— 这就是服主截图里"整个页面挤在中间一条"的观感。

   现在按屏幕宽度分档放宽，同时保证正文不被拉得过宽（超过 1800px
   时图表本身也会变形）：
     · 1600—1999px → 1760px
     · 2000px 以上 → 1920px，并让左栏多分一些宽度
   ────────────────────────────────────────────────────────────── */
@media (min-width: 1600px) {
  .app-shell, .topnav-inner, .statusline { max-width: 1760px; }
}
@media (min-width: 2000px) {
  .app-shell, .topnav-inner, .statusline { max-width: 1920px; }
  /* 超宽屏：右栏固定 460px，其余全部给图表 */
  main.grid { grid-template-columns: minmax(0, 1fr) 460px; }
  main.grid > .chartcard > .chartwrap { height: 480px; min-height: 480px; max-height: 480px; }
}


/* ══════════════════════════════════════════════════════════════
   平板宽度（641—900px）账户概览条（2026-11-01 补）

   <h3>问题</h3>
   服主截图（757px 宽）：概览条里「账户总权益 / 浮动盈亏 / 可用余额 /
   冻结 / 持仓市值 / 持仓 / 转入转出」**全部挤在一行**，数字互相叠着，
   完全读不出来。

   <h3>根因</h3>
   `.balance-strip` 的横排 flex 只写在 `@media (min-width: 901px)` 里；
   641—900px 这个区间**没有任何布局规则**，
   于是 `.balance-main` / `.metrics` / `.balance-actions` 都退化成默认块级，
   在 flex 容器缺失的情况下挤成一团。
   （手机 ≤640 有单独规则，桌面 ≥901 有单独规则，偏偏中间这段是空的。）

   <h3>修法</h3>
   平板按「两行」排：
     行1：小账本标签 + 总权益 + 浮动盈亏 + 转入转出按钮
     行2：四个指标（可用/冻结/市值/持仓）横向等分
   既不放不下也不挤，也不用滚横向。
   ────────────────────────────────────────────────────────────── */
@media (min-width: 641px) and (max-width: 900px) {
  /*
   * 平板（641—900px）账户概览条 —— 定稿
   *
   * <h3>为什么反复失败</h3>
   * · 第一版用 flex + flex-wrap：三块各自 flex:1 1 100%，堆成四行，按钮掉底；
   * · 第二版用 grid + `display: contents` 想让 lead 与 main 合并：
   *   子元素反而各自变成 grid 项，把 main 区域占满，布局完全没变。
   *
   * <h3>定稿：只用**一层 grid**，不做 contents、不做嵌套折行</h3>
   * 概览条的直接子元素与控制项按固定格位摆放：
   *   行1 │ 总权益+盈亏 │ 转入转出 │
   *   行2 │ 四个指标（等分四列）    │
   * ⚠️ `.balance-lead`（"我的交易小账本 / 已绑定"）在平板上**隐藏**——
   * 它只是标签，占地方且不提供信息；桌面与手机仍保留。
   */
  .balance-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main    actions"
      "metrics metrics";
    align-items: center;
    gap: 12px 20px;
    padding: 14px 16px;
  }

  /* 小账本标签在平板隐藏，避免挤占第一行 */
  .balance-lead { display: none; }

  .balance-main {
    grid-area: main;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px 18px;
    flex-wrap: wrap;
    min-width: 0;
  }
  .balance-title { flex: 0 0 auto; }
  .money-large { font-size: 26px; }
  .balance-pnl { padding: 4px 10px; flex: 0 0 auto; }
  .balance-pnl-v { font-size: 19px; }
  .balance-pnl-pct { font-size: var(--fs-sm); }

  .balance-actions { grid-area: actions; margin-left: 0; justify-self: end; }
  .balance-jump { min-height: 40px; }

  .metrics {
    grid-area: metrics;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 16px;
  }
  .metric { text-align: left; min-width: 0; }
  .metric span { font-size: var(--fs-xs); }
  .metric strong { font-size: var(--fs-md); }

  /* 未登录态：提示与登录按钮同行 */
  .balance-strip.is-guest {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .balance-strip.is-guest .balance-lead { display: flex; flex-direction: row; align-items: center; gap: 10px; }
  .balance-strip.is-guest .guest-hint { flex: 1 1 auto; min-width: 180px; }
  .balance-strip.is-guest .guest-login { flex: 0 0 auto; }
  .balance-strip.is-guest .balance-main,
  .balance-strip.is-guest .metrics { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   杠杆持仓：收益醒目化（2026-11-01）

   <h3>问题</h3>
   服主反馈「杠杆的收益显示也没做」。实际上后端早就返回了
   pnl / equity / markPrice / liqPrice，前端也渲染了，
   但全部塞在 `.levpos-nums` 这一行 **灰色 xs 小字**里：
     保证金 100 <span>开仓均价 12.00</span> <span>强平价 10.5</span> 标记价 11.2 浮动盈亏 +12.5 权益 112.5
   赚和亏混在同一片灰字里，玩家根本看不出自己在赚还是在亏。

   <h3>现在的结构</h3>
     · `.levpnl-row` —— 收益条：浮动盈亏**大字 + 涨跌色 + 收益率**，权益靠右
     · `.levmeta`    —— 明细行：保证金 / 开仓均价 / 标记价 / 强平价，灰色小字
   ────────────────────────────────────────────────────────────── */

/* 持仓行改纵向排列，给收益条留出整行 */
.levpos {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.levpos-main { flex-wrap: wrap; }
.levpos-nums {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* ── 收益条 ─────────────────────────────────────────────── */
.levpnl-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--soft);
  border: 1px solid var(--line);
  transition: background var(--theme-switch-dur), border-color var(--theme-switch-dur);
}
.levpnl-k {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}
.levpnl-v {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
}
.levpnl-pct {
  font-size: var(--fs-sm);
  font-weight: var(--fw-mid);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 权益：推到右侧，弱化一点 */
.levpnl-eq {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 赚：红；亏：绿；平：灰（与全站口径一致） */
.levpnl-v.up, .levpnl-pct.up { color: var(--up); }
.levpnl-v.down, .levpnl-pct.down { color: var(--down); }
.levpnl-v.muted, .levpnl-pct.muted { color: var(--muted); }

/* 收益条底色随涨跌，让整行都在提示方向 */
.levpos-nums:has(.levpnl-v.up) .levpnl-row { background: var(--up-soft); border-color: transparent; }
.levpos-nums:has(.levpnl-v.down) .levpnl-row { background: var(--down-soft); border-color: transparent; }

/* 已了结的仓位整体弱化 */
.levpnl-closed .levpnl-v { font-size: var(--fs-md); }

/* ── 明细行 ─────────────────────────────────────────────── */
.levmeta {
  display: flex;
  align-items: baseline;
  gap: 6px 14px;
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}
.levmeta > span { white-space: nowrap; }
.levmeta .muted { color: var(--muted); font-style: normal; }

/* ── 手机：收益条更宽松 ─────────────────────────────────── */
@media (max-width: 640px) {
  .levpnl-row { padding: 9px 12px; gap: 6px 8px; }
  .levpnl-v { font-size: var(--fs-xl); }
  .levpnl-eq { flex: 1 1 100%; margin-left: 0; }
  .levmeta { gap: 4px 12px; }
}

/* ══════════════════════════════════════════════════════════════
   宽屏：右栏内容拆两列，消除左栏空白（2026-11-01）

   <h3>问题</h3>
   宽屏下右栏「杠杆交易室」高约 1400px，左栏图表卡只有约 680px，
   左栏下方空出 690—797px。

   <h3>为什么不能拉高图表</h3>
   上一版试过，SVG 会变成竖长条（994×1179），K 线成"心电图"，
   横向时间被压得极密 —— 服主明确反馈"太抽象"。

   <h3>做法：把交易室内部拆成左右两栏（宽屏才有）</h3>
   交易室里本来有两块内容：
     · roompos —— 我的杠杆仓位（宽一些才好读）
     · roomorder —— 开仓表单（窄一点就够）
   宽屏下让它们**并排**，交易室高度立刻减半，
   左栏空白随之消失。

   ⚠️ 只对超宽屏生效（≥1600px）；1440 屏右栏只有 380—420px，
   拆两列会把表单压得读不出来。
   ────────────────────────────────────────────────────────────── */
@media (min-width: 1600px) {
  /* 右栏放宽，容得下两列 */
  main.grid { grid-template-columns: minmax(0, 1fr) 640px; }

  /* 交易室内部：仓位 | 开仓表单 并排 */
  .room .roomgrid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
    gap: 14px;
    align-items: start;
  }
  .room .roommain { grid-column: 1; min-width: 0; }
  .room .roomorder { grid-column: 2; min-width: 0; }

  /* 表单里的倍数按钮在窄列下排 4 列 */
  .room .levgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  /* 摘要块两列已经够用，不要再压 */
  .room .roomsum { grid-template-columns: 1fr 1fr; }
}

/* 2000px 以上再放宽一点 */
@media (min-width: 2000px) {
  main.grid { grid-template-columns: minmax(0, 1fr) 720px; }
  .room .roomgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 320px); }
}

/* ══════════════════════════════════════════════════════════════
   宽屏：开仓表单内估值块不要被压成窄条（2026-11-01）

   宽屏把右栏拆成两列后，开仓表单列只有约 280—320px，
   而原先估值块是「两列网格」，每格约 130px，
   「名义敞口」「最大钱包合计支出」这些标签被截成「名义...」「最大钱...」。

   修法：表单列内估值块改**单列**（每个占满整行），
   标签与数值都有足够宽度；5 个块纵向排列也不会太高。
   ────────────────────────────────────────────────────────────── */
@media (min-width: 1600px) {
  .room .roomorder .levgrid:has(.levbox),
  .room .roomorder .levgrid {
    grid-template-columns: 1fr;
  }
  .room .roomorder .levbox .k,
  .room .roomorder .levbox .v {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  /* 单列后每个块更扁一些，避免表单过长 */
  .room .roomorder .levbox { padding: 8px 10px; }
  .room .roomorder .levbox .hint { font-size: 10.5px; }
}

/* ══════════════════════════════════════════════════════════════
   K 线下方「交易控制台」横条（2026-11-01）

   服主原话：「为什么不在 k 线下面横着做一条控制台呢」

   原来是「左栏看盘、右栏下单」，视线要横向来回跳。
   现在把下单控件做成一条与图表同宽的横条，紧贴 K 线下方 ——
   这也是交易软件的通行做法（图下即操作）。

   结构：
     .tradebar-row   ── 代码 / 股数 / 限价 / 买入 / 卖出，横向一排
     .tradebar-tip   ── 提示与状态（原来的 #orderTip）
   ────────────────────────────────────────────────────────────── */
.tradebar {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--soft);
  border: 1px solid var(--line);
  transition: background var(--theme-switch-dur), border-color var(--theme-switch-dur);
}

.tradebar-row {
  display: flex;
  align-items: flex-end;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.tradebar-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.tradebar-field > span { white-space: nowrap; }
.tradebar-field select,
.tradebar-field input {
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
}
/* 代码列宽一些（股票名较长），股数与限价窄一些 */
.tradebar-field:first-child { flex: 1 1 200px; max-width: 280px; }
.tradebar-field:nth-child(2) { flex: 0 1 110px; }
.tradebar-field:nth-child(3) { flex: 0 1 130px; }

.tradebar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}
.tradebar-btn {
  min-height: 40px;
  min-width: 96px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: var(--fs-base);
  font-weight: var(--fw-mid);
  cursor: pointer;
  white-space: nowrap;
}
.tradebar-btn.buy {
  background: var(--blue);
  color: #fff;
}
.tradebar-btn.buy:hover { background: var(--blue-deep); }
.tradebar-btn.sell {
  background: var(--down);
  color: #fff;
}
.tradebar-btn.sell:hover { filter: brightness(1.06); }
.tradebar-btn:disabled { opacity: .55; cursor: default; }

.tradebar-tip {
  margin-top: 8px;
  font-size: var(--fs-xs);
  line-height: 1.6;
  min-height: 18px;
}

/* ── 手机：控件两行排布，买卖按钮占满一行 ──────────────── */
@media (max-width: 640px) {
  .tradebar { padding: 12px; margin-top: 10px; }
  .tradebar-row { gap: 10px; }
  .tradebar-field:first-child { flex: 1 1 100%; max-width: none; }
  .tradebar-field:nth-child(2),
  .tradebar-field:nth-child(3) { flex: 1 1 0; }
  .tradebar-field select,
  .tradebar-field input { min-height: 44px; font-size: 16px; }
  .tradebar-actions { flex: 1 1 100%; margin-left: 0; }
  .tradebar-btn { flex: 1 1 0; min-height: 46px; }
}

/* ── 宽屏：一条排开，不换行 ─────────────────────────────── */
@media (min-width: 1200px) {
  .tradebar-row { flex-wrap: nowrap; }
  .tradebar-field:first-child { flex: 0 1 240px; }
  .tradebar-field:nth-child(2) { flex: 0 0 110px; }
  .tradebar-field:nth-child(3) { flex: 0 0 130px; }
}

/* ══════════════════════════════════════════════════════════════
   K 线控制条移到图下，并压成一行（2026-11-01）

   <h3>服主原话</h3>
   「为什么不在 k 线下面横着做一条控制台呢」—— 指的是**图表自己的控制条**
   （图表类型 / K线周期 / 当前标的），不是下单控件。

   <h3>原来什么样</h3>
   控制条压在 K 线上方，占掉整行高度：
     图表类型：K线 涨幅折线 价格折线
     K线周期：1分钟 5分钟 15分钟 1小时 日线
     折线时间范围：近1小时 近6小时 近24小时
     当前标的：FX001
   四组挤在一起、字号小、还在图上，看图时要先跨过这一整条。

   <h3>现在</h3>
   · 移到 K 线**下方**（图下即操作，和交易软件一致）；
   · 用 flex 排成**一行**，组与组之间用细分隔线，不再各占一行；
   · 放不下时横向滚动（不换行，避免高度忽高忽低）；
   · 「当前标的」推到最右，弱化显示。
   ────────────────────────────────────────────────────────────── */
.chartbar {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--soft);
  border: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  transition: background var(--theme-switch-dur), border-color var(--theme-switch-dur);
}

/* 每组：去掉原来的整行宽度，改为按内容排 */
.chartbar .chartgroup {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  min-height: 32px;
}
.chartbar .chartgroup:first-child {
  border-left: none;
  padding-left: 2px;
}

/* 组标签弱化，与按钮同排 */
.chartbar .chartgrouplabel {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  margin-right: 2px;
}
.chartbar .chartgroupnote {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* 按钮压扁一些，一行能排下更多 */
.chartbar .chip {
  min-height: 30px;
  padding: 0 10px;
  font-size: var(--fs-xs);
  white-space: nowrap;
}

/* 「当前标的」推到最右，弱化 */
.chartbar .chartgroup-stock {
  margin-left: auto;
  border-left: 1px solid var(--line);
}
.chartbar .chartstock {
  font-size: var(--fs-xs);
  font-weight: var(--fw-mid);
  color: var(--ink-2);
  white-space: nowrap;
}

/* ── 手机：允许横向滚动，不换行 ────────────────────────── */
@media (max-width: 640px) {
  .chartbar {
    padding: 6px 8px;
    margin-top: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .chartbar .chartgroup { padding: 0 8px; gap: 5px; }
  .chartbar .chip { min-height: 32px; padding: 0 8px; font-size: 11.5px; }
  .chartbar .chartgrouplabel { display: none; }   /* 手机上省宽度，靠按钮自解释 */
  .chartbar .chartgroup-stock { display: none; }
}

/* ── 宽屏：全排开，无需滚动 ─────────────────────────────── */
@media (min-width: 1200px) {
  .chartbar { overflow-x: visible; }
  .chartbar .chip { min-height: 32px; padding: 0 12px; }
}

/* ══════════════════════════════════════════════════════════════
   K 线控制台：合成一条（2026-11-01）

   <h3>服主原话</h3>
   「为什么不在 k 线下面横着做一条控制台呢」

   <h3>原来</h3>
   K 线下方有**三条**各占一行：
     ① 读数条（时间/开/高/低/收）
     ② 控制条（图表类型/K线周期/当前标的）
     ③ 下单条（代码/股数/限价/买入卖出）
   合计约 200px，把 K 线压得很矮，看着很碎。

   <h3>现在：一条</h3>
   ┌────────────────────────────────────────────────────────────┐
   │ 时间…开高低收 │ 类型 K线涨幅价格 │ 周期 1分5分… │ 代码 股数 限价 买 卖 │
   └────────────────────────────────────────────────────────────┘
   读数在左、操作在右，符合「先看盘、再下单」的视线顺序。
   ────────────────────────────────────────────────────────────── */
.klineconsole {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--soft);
  border: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  transition: background var(--theme-switch-dur), border-color var(--theme-switch-dur);
  min-height: 54px;
}

/* ── 左：读数 ─────────────────────────────────────────── */
.klineconsole-readout {
  flex: 0 0 auto;
  min-width: 0;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}
.klineconsole .chartreadout {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-height: 0;
  box-shadow: none;
}

/* ── 中：类型 / 周期 / 范围 ────────────────────────────── */
.klineconsole .chartbar {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0 6px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  min-height: 0;
  flex: 0 0 auto;
}
.klineconsole .chartgroup {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  min-height: 0;
}
.klineconsole .chartgroup:first-child {
  border-left: none;
  padding-left: 2px;
}
.klineconsole .chartgrouplabel {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.klineconsole .chartgroupnote { display: none; }
.klineconsole .chartgroup-stock {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.klineconsole .chartstock {
  font-size: var(--fs-xs);
  font-weight: var(--fw-mid);
  color: var(--ink-2);
  white-space: nowrap;
}
.klineconsole .chip {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
  border-radius: var(--r-pill);
}

/* ── 右：下单 ─────────────────────────────────────────── */
.klineconsole .tradebar {
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.klineconsole .tradebar-row {
  flex-flow: row nowrap;
  align-items: center;
  gap: 6px;
}
.klineconsole .tradebar-field {
  flex-direction: row;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}
.klineconsole .tradebar-field > span { color: var(--muted); }
.klineconsole .tradebar-field:first-child { flex: 0 0 auto; max-width: none; }
.klineconsole .tradebar-field:nth-child(2) { flex: 0 0 auto; }
.klineconsole .tradebar-field:nth-child(3) { flex: 0 0 auto; }
.klineconsole .tradebar-field select,
.klineconsole .tradebar-field input {
  min-height: 32px;
  padding: 0 8px;
  font-size: 12.5px;
  border-radius: var(--r-sm);
}
.klineconsole .tradebar-field select { max-width: 150px; }
.klineconsole .tradebar-field input:not([type="number"]) { width: 92px; }
.klineconsole .tradebar-field input[type="number"] { width: 62px; }
.klineconsole .tradebar-actions {
  gap: 6px;
  margin-left: 4px;
}
.klineconsole .tradebar-btn {
  min-height: 32px;
  min-width: 64px;
  padding: 0 14px;
  font-size: 12.5px;
}
.klineconsole .tradebar-tip {
  display: none;   /* 提示改为悬浮显示，不占高度 */
}

/* ── 中等宽度：允许横向滚动，不换行 ────────────────────── */
@media (max-width: 1439px) {
  .klineconsole { overflow-x: auto; }
  .klineconsole .chartgrouplabel { display: none; }
}

/* ── 手机：两行 —— 上行控制、下行下单 ─────────────────── */
@media (max-width: 640px) {
  .klineconsole {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px;
    overflow-x: visible;
  }
  .klineconsole-readout {
    border-right: none;
    padding-right: 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    width: 100%;
    overflow-x: auto;
  }
  .klineconsole .chartreadout { font-size: 11px; }

  .klineconsole .chartbar {
    overflow-x: auto;
    padding: 0;
    width: 100%;
  }
  .klineconsole .chartgroup { padding: 0 6px; }
  .klineconsole .chartgroup:first-child { padding-left: 0; }
  .klineconsole .chartgroup-stock { display: none; }
  .klineconsole .chip { min-height: 30px; padding: 0 8px; font-size: 11.5px; }

  .klineconsole .tradebar {
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 8px;
    width: 100%;
    margin-left: 0;
  }
  .klineconsole .tradebar-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .klineconsole .tradebar-field:first-child { flex: 1 1 100%; }
  .klineconsole .tradebar-field:first-child select { width: 100%; max-width: none; }
  .klineconsole .tradebar-field:nth-child(2),
  .klineconsole .tradebar-field:nth-child(3) { flex: 1 1 0; }
  .klineconsole .tradebar-field input[type="number"],
  .klineconsole .tradebar-field input:not([type="number"]) { width: 100%; }
  .klineconsole .tradebar-actions { flex: 1 1 100%; }
  .klineconsole .tradebar-btn { flex: 1 1 0; min-height: 44px; font-size: 14px; }
  .klineconsole .tradebar-tip {
    display: block;
    margin-top: 6px;
    font-size: 11px;
  }
}

/* ══════════════════════════════════════════════════════════════
   K 线控制台：一条放不下时**换行**，不要横向滚动把下单藏掉
   （2026-11-01 修正）

   实测 1440px：合并后一条宽约 1094px，但内容总宽超过它，
   结果右侧「代码/股数/限价/买入/卖出」被横向滚动藏起来 ——
   玩家看不到下单按钮，等于白做。

   修法：允许换行（flex-wrap），并让下单区在换行后**独占一行右对齐**。
   桌面 1440 下会变成两行：上行读数+类型+周期，下行下单，
   总高约 100px，仍比原来的三条（200px）紧凑得多。
   ────────────────────────────────────────────────────────────── */
.klineconsole {
  flex-wrap: wrap;
  overflow-x: visible;
  gap: 6px 0;
  padding: 8px 10px;
}

/* 下单区换行后独占一行，右对齐 */
.klineconsole .tradebar {
  flex: 1 1 100%;
  margin-left: 0;
  border-left: none;
  border-top: 1px solid var(--line);
  padding-left: 0;
  padding-top: 7px;
  margin-top: 2px;
  display: flex;
  justify-content: flex-end;
}
.klineconsole .tradebar-row {
  justify-content: flex-end;
  width: auto;
}
.klineconsole .tradebar-field:first-child select { max-width: 170px; }

/* 超宽屏：真的能一行排下，就不换行 */
@media (min-width: 1800px) {
  .klineconsole { flex-wrap: nowrap; }
  .klineconsole .tradebar {
    flex: 0 0 auto;
    border-top: none;
    border-left: 1px solid var(--line);
    padding-left: 12px;
    padding-top: 0;
    margin-top: 0;
    margin-left: auto;
    justify-content: flex-start;
  }
  .klineconsole .tradebar-row { justify-content: flex-start; }
}

/* ══════════════════════════════════════════════════════════════
   杠杆交易室：开仓表单横向紧凑化（2026-11-01 重构）

   <h3>问题链</h3>
   1. 右栏「开仓表单」roomorder 高 948—1138px，
      因为 300—380px 宽只能把每个字段竖着排；
   2. 右栏高 → 左栏图表下方空出 676—822px；
   3. 试过"把图表拉高"→ K 线变竖条（服主：太抽象）；
   4. 试过"三栏"→ 图表被挤到 620px，更窄。

   <h3>真正的解法：把开仓表单**内部**改成两列</h3>
   表单里的字段本来可以并排：
     · 保证金 + 标的（同一行）
     · 7 个倍数按钮（一行 7 个，或两行）
     · 5 个估值块（两列）
     · 风险说明（通栏）
   这样右栏高度大约能砍掉三分之一，不需要动整体分栏。

   <h3>为什么之前没这么写</h3>
   早期右栏只有 380px，字段并排会挤；现在右栏可以给到 420px，
   且倍数按钮本身很窄（1×/2×/5×…），并排完全放得下。
   ────────────────────────────────────────────────────────────── */
@media (min-width: 901px) {
  /* 右栏给到 420px，给表单并排留出空间 */
  main.grid { grid-template-columns: minmax(0, 1fr) 420px; }

  /* 交易室内部：不再左右分栏，改成上下（摘要/仓位 在上，开仓表单 在下） */
  .room .roomgrid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .room .roommain,
  .room .roomorder { width: 100%; min-width: 0; }

  /* ── 开仓表单：字段两列 ─────────────────────────── */
  .room .levform {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .room .levform > label { min-width: 0; }

  /* 倍数按钮：一行 7 个（每个约 50px） */
  .room .levs {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
  }
  .room .levbtn {
    min-height: 34px;
    padding: 0 2px;
    font-size: 12px;
  }

  /* 自定义倍数：输入框 + 按钮并排 */
  .room .levcust {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
  }
  .room .levcust label { min-width: 0; }

  /* 估值块：两列（原来这个宽度是单列，5 块占了 500px+） */
  .room .levgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .room .levbox { padding: 8px 10px; }
  .room .levbox .k,
  .room .levbox .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .room .levbox .hint { font-size: 10.5px; }

  /* 方向按钮更紧凑 */
  .room .levdirs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .room .levdir { min-height: 38px; }

  /* 风险说明收紧 */
  .room .levloss,
  .room .levguardnote { font-size: 11.5px; line-height: 1.6; }
  .room .levpanel-actions { margin-top: 8px; }
}

/* 更宽屏：右栏再宽一点，表单更舒展 */
@media (min-width: 1600px) {
  main.grid { grid-template-columns: minmax(0, 1fr) 460px; }
}

/* ══════════════════════════════════════════════════════════════
   图卡内的「我的杠杆仓位」（2026-11-01 方案 A）

   仓位列表从右栏交易室搬到图卡内、K 线控制台下方。
   搬过来后需要单独定样式：
     · 与上方控制台之间留分隔；
     · 与下方口径说明拉开距离（原来贴在一起了）；
     · 手机端不撑高。
   ────────────────────────────────────────────────────────────── */
.klineconsole + .roompos,
.chartcard .roompos {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}

.chartcard .roompos .roomposhead {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chartcard .roompos .levlabel {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--ink);
}
.chartcard .roompos .roomposfilter {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.chartcard .roompos .roomposfilter .chip {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
}
.chartcard .roompos #btnLevPosRefresh {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
}

/* 仓位列表 */
.chartcard .roompos #levPositions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chartcard .roompos .empty {
  padding: 14px 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* 仓位下方紧接的口径说明：拉开距离，避免连读 */
.chartcard .roompos + .chartnotice,
.chartcard .roompos ~ .chartnotice {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}
.chartcard .roompos ~ .chartcomment {
  margin-top: 8px;
}

/* 仓位里的风险说明（搬过来后仍要小字） */
.chartcard .roompos .levguardnote {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
}

/* 手机：仓位区紧凑 */
@media (max-width: 640px) {
  .chartcard .roompos { margin-top: 10px; padding-top: 10px; }
  .chartcard .roompos .roomposhead { gap: 8px; }
  .chartcard .roompos #btnLevPosRefresh { flex: 1 1 100%; }
}

/* ── 杠杆仓位区：只在杠杆模式显示（2026-11-01）────────────
   仓位区已搬到图卡内，但它仍是杠杆专用内容。
   原来靠 `.mode-pane[data-mode-pane="lev"]` 的祖先控制显隐，
   搬到图卡后不再处于那个祖先内，因此要显式按 body[data-mode] 控制。
   ────────────────────────────────────────────────────────────── */
body[data-mode="spot"] #chartCard .roompos { display: none !important; }
body[data-mode="lev"]  #chartCard .roompos { display: block; }

/* 手机端杠杆模式：仓位区宽度自适应 */
@media (max-width: 640px) {
  body[data-mode="lev"] #chartCard .roompos { display: block; }
}

/* ══════════════════════════════════════════════════════════════
   开仓表单：保持单列，只做适度紧凑（2026-11-02 修正）

   <h3>上一版教训</h3>
   我尝试把开仓表单内部改成两列，想把右栏高度压下来。
   结果右栏在 460—520px 宽时，每个格子只有 200px 左右，
   **「做多（看涨）」被压成竖排**、估值块的「填入保证金后显示」
   与数值重叠 —— 比原来更难读（线上实拍确认）。

   <h3>结论：表单必须单列</h3>
   表单里有 7 个倍数按钮、5 个估值块、风险说明，
   在 460—520px 宽里强行两列只会更糟。
   高度换可读性，这个取舍不值得。

   <h3>本版：单列 + 适度收紧</h3>
   · 估值块保持两列（160px+ 的格子放得下短标签）；
   · 倍数按钮一行 4 个；
   · 其余保持竖排，字号与间距略收紧。
   ────────────────────────────────────────────────────────────── */
@media (min-width: 901px) {
  .room .levPanel,
  .room .roomorder { display: block; }

  /* 方向按钮：一行两个，文字不折行 */
  .room .levdirs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .room .levdir {
    min-height: 40px;
    white-space: nowrap;
    font-size: var(--fs-sm);
    padding: 0 6px;
  }

  /* 保证金 + 标的：保持竖排（原来就是竖排，别动） */
  .room .levform { display: flex; flex-direction: column; gap: 10px; }

  /* 倍数：一行 4 个 */
  .room .levs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }
  .room .levbtn { min-height: 34px; padding: 0 2px; font-size: 12px; }

  /* 自定义倍数：输入 + 按钮并排 */
  .room .levcust {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
    margin-top: 8px;
  }

  /* 估值块：两列（短标签放得下） */
  .room .levgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .room .levbox { padding: 8px 10px; }
  .room .levbox .k { font-size: 11px; }
  .room .levbox .v { font-size: var(--fs-sm); }
  .room .levbox .hint { font-size: 10px; line-height: 1.45; }

  /* 风险说明收紧 */
  .room .levloss,
  .room .levguardnote { font-size: 11px; line-height: 1.6; }
  .room .levpanel-actions { margin-top: 6px; }
}

/* 超宽屏：右栏 520px，倍数一行 7 个 */
@media (min-width: 1600px) {
  main.grid { grid-template-columns: minmax(0, 1fr) 520px; }
  .room .levs { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* ══════════════════════════════════════════════════════════════
   右栏限价下单 + 智能填价（2026-11-02）

   服主反馈：现货买入卖出改回右栏，并加一些发布操作的功能，
   比如更智能的输入价格。

   原来下单控件被搬到 K 线下方（上一轮），现在移回右栏：
     · 代码 / 股数 / 限价 三行
     · 快速填价：±0.5% / ±0.1% / 现价 / 最新成交
     · 预估金额
     · 买入 / 卖出
   ────────────────────────────────────────────────────────────── */

/* ── 表单 ─────────────────────────────────────────────── */
.ordercard .orderbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* 2026-11-03：让子项横向撑满，否则按内容宽度收缩、右对齐 */
  align-items: stretch;
}
.ordercard .orderfield {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--muted);
  /*
   * 2026-11-03：原缺这一行，三个字段宽度 146/194/194，
   * 而卡片宽 386，导致左边空白、输入框挤在右侧。
   */
  width: 100%;
  min-width: 0;
}
.ordercard .orderfield > span { white-space: nowrap; }
.ordercard .orderfield select,
.ordercard .orderfield input {
  min-height: 42px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
}

/* ── 快速填价 ─────────────────────────────────────────── */
.pricequick {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.pricequick-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-right: 2px;
}
.pricequick .chip {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.pricequick .chip.on {
  background: var(--blue-soft);
  color: var(--blue-deep);
  border-color: transparent;
}

/* ── 预估金额 ─────────────────────────────────────────── */
.ordervalue {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--soft);
  font-size: var(--fs-sm);
}
.ordervalue b {
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.ordervalue .muted { font-size: var(--fs-xs); }

/* ── 买卖按钮 ─────────────────────────────────────────── */
.ordercard .orderactions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.ordercard .orderbtn {
  min-height: 48px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  cursor: pointer;
  white-space: nowrap;
}
.ordercard .orderbtn.buy {
  background: var(--blue);
  color: #fff;
}
.ordercard .orderbtn.buy:hover { background: var(--blue-deep); }
.ordercard .orderbtn.sell {
  background: var(--down);
  color: #fff;
}
.ordercard .orderbtn.sell:hover { filter: brightness(1.06); }
.ordercard .orderbtn:disabled { opacity: .5; cursor: default; }

.ordercard .ordertip {
  margin-top: 10px;
  font-size: var(--fs-xs);
  line-height: 1.65;
  min-height: 18px;
}

/* ── 手机：按钮加大，输入框 16px 防缩放 ───────────────── */
@media (max-width: 640px) {
  .ordercard .orderfield select,
  .ordercard .orderfield input { min-height: 46px; font-size: 16px; }
  .ordercard .orderbtn { min-height: 52px; font-size: var(--fs-base); }
  .pricequick .chip { min-height: 34px; padding: 0 10px; }
}

/* ══════════════════════════════════════════════════════════════
   K 线控制台：移除下单后不再需要横向滚动（2026-11-02）
   下单搬走后，控制台只剩读数 + 类型 + 周期，1440px 下能排下。
   ────────────────────────────────────────────────────────────── */
.klineconsole {
  flex-wrap: nowrap;
  overflow-x: auto;
}
@media (min-width: 1100px) {
  .klineconsole { overflow-x: visible; }
}

/* ══════════════════════════════════════════════════════════════
   市场资金状况（2026-11-02）

   展示全体玩家现金、手续费累计、做市净收、与游戏金币净流。
   目的是让经济状况**透明可见** —— 之前这些数据只存在于服务端，
   玩家和服主都看不到，出了问题（比如异常印钞）也无法及时发现。
   ────────────────────────────────────────────────────────────── */
.marketstats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.marketstat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--soft);
  min-width: 0;
}
.marketstat .k {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}
.marketstat .v {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.marketstat .hint {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
}
.marketnote {
  margin-top: 10px;
  font-size: var(--fs-xs);
  line-height: 1.65;
}

@media (max-width: 900px) {
  .marketstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .marketstats { grid-template-columns: 1fr; }
  .marketstat { padding: 10px 12px; }
}

/* ══════════════════════════════════════════════════════════════
   交易记录 / 杠杆风险提示 / 异常价格告警（2026-11-02）
   ────────────────────────────────────────────────────────────── */

/* ── ① 交易记录表 ──────────────────────────────────────── */
.tradelist {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
}
.tradelist .empty {
  padding: 18px 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-xs);
}
.traderow {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 84px 92px 96px 84px 118px;
  gap: 8px;
  align-items: baseline;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line-2);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.traderow:last-child { border-bottom: none; }
.traderow:hover { background: var(--soft); }
.traderow .tid { color: var(--muted); }
.traderow .tsym { font-weight: var(--fw-mid); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traderow .tside {
  font-weight: var(--fw-mid);
  padding: 1px 8px;
  border-radius: var(--r-pill);
  text-align: center;
  white-space: nowrap;
}
.traderow .tside.buy { color: var(--up); background: var(--up-soft); }
.traderow .tside.sell { color: var(--down); background: var(--down-soft); }
.traderow .tnum { text-align: right; color: var(--ink-2); }
.traderow .tfee { text-align: right; color: var(--muted); }
.traderow .ttime { text-align: right; color: var(--muted); white-space: nowrap; }

.tradehead {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 84px 92px 96px 84px 118px;
  gap: 8px;
  padding: 4px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.tradehead span:nth-child(n+4) { text-align: right; }

@media (max-width: 900px) {
  .traderow, .tradehead {
    grid-template-columns: 46px minmax(0, 1fr) 60px 80px;
  }
  .traderow .tfee, .traderow .tprice, .tradehead span:nth-child(6),
  .tradehead span:nth-child(5) { display: none; }
  .traderow .ttime { display: none; }
}
@media (max-width: 480px) {
  .traderow, .tradehead { grid-template-columns: 40px minmax(0, 1fr) 52px 76px; gap: 5px; }
}

/* ── ② 杠杆风险提示 ────────────────────────────────────── */
.levrisk {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  line-height: 1.65;
  border: 1px solid transparent;
}
.levrisk.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(184, 134, 11, .3);
}
.levrisk.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(200, 60, 60, .3);
  font-weight: var(--fw-mid);
}
.levrisk b { font-weight: var(--fw-bold); }

/* ── ③ 异常价格告警横条 ────────────────────────────────── */
/*
 * ⚠️ display:flex 会**覆盖 hidden 属性**（HTML 规范里 hidden 只是 display:none 的弱声明）。
 * 少了下面这条 [hidden]，告警条会一直显示、且文字是 HTML 里的默认「检测到价格异常」。
 * 2026-11-02 实测踩到：明明 bar.hidden=true，页面照样显示。
 */
.pricealert[hidden] { display: none !important; }

.pricealert {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1520px;
  margin: 8px auto 0;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  border: 1px solid rgba(184, 134, 11, .35);
  color: var(--warn);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.pricealert-ico { font-size: 15px; flex-shrink: 0; }
/* 文字要能换行，不能被截断（原来只显示半句） */
.pricealert #priceAlertText { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .pricealert { margin: 8px 10px 0; padding: 9px 12px; font-size: var(--fs-xs); }
}
/* ── 转账卡：明确标出当前市场与币种（2026-11-03）─────────────── */
.tx-market {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0 4px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--soft, #f4f6fa);
  color: var(--ink-2, #4a4a4a);
  font-size: 14px;
}
.tx-market b {
  color: var(--ink, #1a1a1a);
}

/* ── 顶部持仓速览（2026-11-03）─────────────────────────────── */
.posstrip {
  margin-top: 10px;
}
.posstrip-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.posstrip-head h2 {
  margin: 0;
  font-size: var(--fs-md);
}
.posstrip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.psrow {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) 80px 1fr 1fr 1.2fr;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--soft);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.psrow .psname b { font-weight: var(--fw-bold); }
.psrow .psshares b { font-size: var(--fs-md); }
.psrow .psmeta { color: var(--muted); font-size: var(--fs-xs); }
.psrow .pspnl { text-align: right; font-weight: var(--fw-bold); }
.psrow .pspnl.up { color: var(--up); }
.psrow .pspnl.down { color: var(--down); }
.psrow .pspnl.muted { color: var(--muted); }
.psrow .pspct { font-weight: normal; font-size: var(--fs-xs); }

@media (max-width: 640px) {
  .psrow {
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
  }
  .psrow .psname { grid-column: 1 / -1; }
  .psrow .pspnl { text-align: left; }
}

/* ── 双余额实时对比（2026-11-03）────────────────────────────── */
.tx-compare {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 4px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--soft);
}
.txc-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.txc-k {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.txc-v {
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.txc-arrow {
  font-size: var(--fs-md);
  color: var(--muted);
}
.txc-note {
  flex-basis: 100%;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ── 转账额度提示（2026-11-04）────────────────────────────── */
.tx-quota {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--soft);
  font-size: var(--fs-xs);
  color: var(--muted);
}


/* ══════════════════════════════════════════════════════════════
   对齐官网版式（2026-11-05）
   ══════════════════════════════════════════════════════════════
   服主：「把股市的界面风格重做一些，做成官网的子界面」。

   改前：股市页是一套自成体系的仪表盘 —— 1280 起、大屏一路放到 1920，
        灰底、卡片带阴影，顶部直接顶到导航下面，没有页头。
   改后：取主站子页面的口径 —— 页头（面包屑 + 大标题）、容器 1120、白底、
        卡片 1px 细边 + 16px 圆角 + 无阴影。

   ⚠️ 这里只覆盖"外观"。交易台的三栏结构、app.js 依赖的选择器一个都没动 ——
      股市页的脚本按 id/class 取了几十个元素，改结构必崩。
      本段之所以放在文件末尾，是靠"同样权重、后写生效"覆盖前面的规则；
      以后若要再调，继续往这段里加，不要去改前面那些老规则。
   ══════════════════════════════════════════════════════════════ */

/* 底色跟主站一致：浅色白底、深色 #0c1119 */
body { background: #fff; }
html[data-theme="dark"] body { background: #0c1119; }

/* 页头 */
.stock-hero { padding: 84px 0 0; background: transparent; }
.stock-hero .wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px; }
.stock-hero .crumb { font-size: 13.5px; color: #6b7280; margin-bottom: 16px; }
.stock-hero .crumb a { color: #6b7280; text-decoration: none; }
.stock-hero .crumb a:hover { color: #3558c8; }
.stock-hero h1 {
  margin: 0; font-weight: 700; line-height: 1.2; letter-spacing: .08em;
  font-size: clamp(34px, 4.2vw, 50px); color: #1a1a1a;
}
html[data-theme="dark"] .stock-hero h1 { color: #e9edf7; }
.stock-hero h1 .bar {
  display: block; width: 56px; height: 4px; border-radius: 2px; margin: 16px 0 0;
  background: linear-gradient(100deg, #5a80ea 0%, #7c9df6 34%, #a8c0fb 68%, #c6e2f6 100%);
}
.stock-hero .lead { margin: 16px 0 0; max-width: 46em; font-size: 16px; line-height: 1.8; color: #6b7280; }
.stock-hero .lead a { color: #3558c8; text-decoration: none; border-bottom: 1px solid rgba(53, 88, 200, .3); }
html[data-theme="dark"] .stock-hero .lead { color: #8d97ae; }
html[data-theme="dark"] .stock-hero .lead a { color: #a8bfff; border-bottom-color: rgba(168, 191, 255, .35); }

/* 状态条与主容器收到 1120（原来 1280，大屏还会放到 1920） */
.statusline { max-width: 1120px; padding: 16px 32px 0; font-size: 13.5px; color: #6b7280; }
.app-shell { max-width: 1120px; padding: 14px 32px 56px; }

/* 卡片对齐主站方块 */
.card {
  background: #fcfdff; border: 1px solid #ececec; border-radius: 16px;
  padding: 20px; margin-bottom: 14px; box-shadow: none;
}
html[data-theme="dark"] .card { background: #141b28; border-color: #262e3f; }
.cardhead h2, .cardhead h3 { font-size: 16px; font-weight: 700; color: #1a1a1a; }
html[data-theme="dark"] .cardhead h2, html[data-theme="dark"] .cardhead h3 { color: #e9edf7; }

/* 市场切换做成主站的胶囊 */
.market-switch button {
  border-radius: 999px; border: 1px solid #ececec; background: #fff;
  color: #4a4a4a; font-size: 14px; padding: 8px 20px;
}
.market-switch button.on { background: #6b8ff5; border-color: #6b8ff5; color: #fff; }
html[data-theme="dark"] .market-switch button { background: #141b28; border-color: #262e3f; color: #c6cddd; }
html[data-theme="dark"] .market-switch button.on { background: #6b8ff5; border-color: #6b8ff5; color: #fff; }

/* 账户概览条：灰底条改成主站那块浅卡片 */
.balance-strip { background: #fcfdff; border: 1px solid #ececec; border-radius: 16px; box-shadow: none; }
html[data-theme="dark"] .balance-strip { background: #141b28; border-color: #262e3f; }

/* 交易台 / 我的 页签 */
.areas { border-bottom: 1px solid #ececec; }
html[data-theme="dark"] .areas { border-bottom-color: #262e3f; }

/* 买卖按钮圆角统一（颜色仍是红涨绿跌口径，不动） */
.buy, .sell { border-radius: 999px; }

/* 收尾行：与主站页脚同款 */
.stock-foot {
  max-width: 1120px; margin: 0 auto; padding: 20px 32px 40px;
  border-top: 1px solid #ececec; font-size: 13px; color: #6b7280;
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
}
html[data-theme="dark"] .stock-foot { border-top-color: #262e3f; color: #8d97ae; }
.stock-foot a { color: #4a4a4a; text-decoration: none; }
.stock-foot a:hover { color: #3558c8; }
html[data-theme="dark"] .stock-foot a { color: #c6cddd; }

@media (max-width: 900px) {
  .stock-hero { padding: 88px 0 0; }
  .stock-hero .wrap, .statusline, .app-shell, .stock-foot { padding-left: 16px; padding-right: 16px; }
  .app-shell { padding-bottom: 44px; }
  .stock-hero .lead { font-size: 14.5px; }
  .stock-hero h1 { font-size: 32px; }
}


/* ══════════════════════════════════════════════════════════════
   顶栏对齐主站 + K 线放大（2026-11-06）
   ══════════════════════════════════════════════════════════════
   服主：「这3面的不一样」——主站、股市页、教程页的顶栏确实三样：
     主站：高 68、容器 1120、字号 14.5、导航带渐变色下划线、账号钮白底描边；
     股市页（改前）：高 53、容器 1280、字号 13.5、账号钮渐变实心；
     教程页（改前）：完全没有顶栏。
   这一段把股市页顶栏改成主站那套（数值取自主站 style.css 的实测计算值）。
   ══════════════════════════════════════════════════════════════ */

/*
 * ⚠️ 必须写成 `.topnav .topnav-inner`（两个类）：
 * 这条规则要压过 `.topnav .wrap, .topnav-inner{…height:52px…}` ——
 * 浏览器按选择器列表里**最具体的那一段**给整条规则定权重，那条实际是 0,2,0，
 * 只写 `.topnav-inner` 是 0,1,0，写得再晚也压不过。
 */
.topnav .topnav-inner { max-width: 1120px; padding: 0 32px; height: 68px; }
/* 同上：`.topnav-links` 也有更具体的写法压着，一并提到两个类 */
.topnav .topnav-links { gap: 30px; font-size: 14.5px; }
/* 同样提到两个类，压过 `.topnav-links a`（老规则里字号是 13.5px） */
.topnav .topnav-links a { position: relative; padding: 0 0 4px; color: var(--ink-2); font-size: 14.5px; }

/*
 * 主导航那四项目（首页 / 玩法 / 加入指南 / 公告）包在 `.nav-links-wrap` 里，
 * 它自己的 gap 是 2px —— 只改外层的 `.topnav-links` 管不到里面，
 * 表现就是四个字挤成一排。主站那边内层写的是 `gap: inherit`，这里给同样的 30px。
 */
.nav-links-wrap { gap: 30px; }
.topnav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 2px; border-radius: 8px;
  background: var(--grad);
  transform: scaleX(0); transform-origin: left;
  transition: transform .32s cubic-bezier(.2,.7,.3,1);
}
.topnav-links a.active { color: var(--ink); font-weight: 600; }
.topnav-links a.active::after { transform: scaleX(1); }
.topnav-links a:hover { background: transparent; color: var(--ink); }
html[data-theme="dark"] .topnav-links a.active { color: #e9edf7; }
html[data-theme="dark"] .topnav-links a:hover { color: #e9edf7; }
.logo { font-size: 16px; letter-spacing: .08em; font-weight: 700; }
.logo-mark { width: 22px; height: 22px; border-radius: 8px; font-size: 12.5px; font-weight: 800; }

/* 「更多」按钮：跟主站一样是纯文字 + 下划线反馈 */
.nav-more-btn {
  padding: 0 0 4px; min-height: 0; border-radius: 0;
  font-size: 14.5px; color: var(--ink-2);
}
.nav-more-btn:hover { background: transparent; color: var(--ink); }
.nav-more.open .nav-more-btn { color: var(--blue-deep); }

/*
 * 账号按钮：主站是白底描边，不是渐变实心。
 *
 * ⚠️⚠️ 选择器必须写成 `.topnav .topnav-links .nav-account`（三个类 = 0,3,0）。
 *    这个链接同时命中三组规则：
 *      · `.nav-account{…padding:0 14px; background:var(--grad); color:#fff}`（0,1,0，原设计是渐变实心）
 *      · `.topnav .topnav-links a{…padding:0 0 4px; color:var(--ink-2)}`（0,2,1）
 *      · 本条（0,3,0）
 *    用 `.topnav .nav-account`（0,2,0）是不够的 —— 2026-11-06 就是这样踩的：
 *    背景改成了白底，padding 和 color 却仍被压成旧值，
 *    表现为「按钮里只有一片白、文字看不见」（白字白底）。
 *
 * 这里把背景、边框、内边距、文字色、高度**一次写全**，不再分两处，
 * 免得下次只改一处又被别的规则压回去。
 */
/*
 * ⚠️ 选择器列表里**不要**混进 `:link` / `:visited`：
 *    浏览器对 `:visited` 允许改的属性和普通选择器不一样，混在同一条列表里会让整条规则被丢弃。
 *    2026-11-06 就是这样：这条明明是 0,3,0、排在最后，却一点没生效，
 *    表现为 `background` 改成了白底、`color` 却还是旧的白字（白底白字，按钮里一片空白）。
 */
.topnav .topnav-links .nav-account {
  display: inline-flex; align-items: center; justify-content: center;
  height: auto; min-height: 32px; line-height: 1.2;
  padding: 7px 14px; margin-left: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 400; white-space: nowrap;
  text-decoration: none;
}
.topnav .topnav-links .nav-account:hover { background: #fff; border-color: #c9d6f5; color: var(--blue-deep); }
html[data-theme="dark"] .topnav .topnav-links .nav-account { background: #141b28; border-color: #262e3f; color: #c6cddd; }
html[data-theme="dark"] .topnav .topnav-links .nav-account:hover { border-color: #3a4763; color: #a8bfff; }
.nav-account:hover { border-color: #c9d6f5; color: var(--blue-deep); }
/* dark 配色已并入上面那条 0,3,0 的规则 */

/* K 线放大（2026-11-06）：容器高度 420 → 560。
   ⚠️ 选择器必须写成 `main.grid > .chartcard > .chartwrap`——
      原规则就是这个写法（三个类 + 元素），只写 `.chartcard .chartwrap` 优先级不够，
      写得再多也会被压回 420。max-height 也要一起给，原规则里钉了 420。
   图表是 canvas，尺寸由 app.js 按容器算，改容器即可。 */
main.grid > .chartcard > .chartwrap {
  height: 560px; min-height: 560px; max-height: 560px;
}

@media (max-width: 900px) {
  .topnav .topnav-inner { padding: 0 14px; height: 60px; }
  .topnav .topnav-links { gap: 16px; font-size: 14px; }
  .nav-links-wrap { gap: 0; flex-direction: column; align-items: stretch; }
  /* 手机上保持竖向菜单的内边距，别把点击区压扁 */
  .topnav-links a { padding: 11px 12px; }
  .nav-more-btn { padding: 0; min-height: 42px; }
  /*
   * 手机端的图表高度**不要钉死**。
   *
   * 2026-11-06 踩过：这里原来写 380px，而 chart.js 在手机上最多只画 320px
   * （`maxH = innerWidth <= 640 ? 320 : 620`），图与容器差出来的那一截
   * 就是服主截图里的「一大片空白」。
   *
   * 现在按内容撑开：SVG 是 display:block 且带明确 height，容器给 auto
   * 就正好等于图的高度；以后调画布上限也不用再改这里。
   * min-height 只作兜底，防止数据没到时卡片塌成一条。
   */
  /*
   * ⚠️ 这里**不能写 min-height ≥ 200**。
   * chart.js 取值是 `H = hostH >= 200 ? hostH : fallbackH`：
   * 只要容器高度达到 200，就按容器高度画图，`fallbackH`（手机 320）永远轮不到。
   * 2026-11-06 写了 min-height:240，结果手机图永远是 240、高度调不上去。
   * 现在放开下限，让它先算成 0 走 fallbackH，再由内容把容器撑开。
   */
  main.grid > .chartcard > .chartwrap { height: auto; min-height: 0; max-height: none; }
}


/* ══════════════════════════════════════════════════════════════
   交易台正文恢复宽版（2026-11-06）
   ══════════════════════════════════════════════════════════════
   服主：「把 k 线的界面整体调整一下，现在 k 线就这么短一点了，要不这个还是恢复成之前那样吧」。

   上一轮把整页收到 1120，图表跟着变窄。现在只把**正文区**放回原来的宽度：
     901px 起 1320、1600px 起 1520、2000px 起 1920 —— 与改版前完全一致。
   **顶栏保持 1120**（那是与主站统一的部分，服主说要继续统一）。

   为什么只放宽 .app-shell 以及它上面的头部内容，不动 .topnav-inner：
   导航是"全站同一个"的部分，宽度跟着主站；看盘区是功能页自己的事，宽一点更有用。
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 901px) {
  .app-shell { max-width: 1320px; padding: 20px 24px 56px; }
  .statusline { max-width: 1320px; padding: 14px 24px 0; }
  .stock-hero .wrap { max-width: 1320px; padding: 0 24px; }
  .stock-foot { max-width: 1320px; padding-left: 24px; padding-right: 24px; }
}
@media (min-width: 1600px) {
  .app-shell, .statusline, .stock-hero .wrap, .stock-foot { max-width: 1520px; }
}
@media (min-width: 2000px) {
  .app-shell, .statusline, .stock-hero .wrap, .stock-foot { max-width: 1920px; }
}

/* ── 页头工具栏（主题开关 + 新手教程）───────────────────────
   2026-11-06：主题开关从状态条移到页头时，只塞了 <div class="hero-tools">，
   忘了给它样式 —— 里面那个 52px 宽的开关被 flex 压成了 3px 的一条缝。
   这里明确：横向排列、不收缩、与标题左对齐、与副标题留一点距离。
   ─────────────────────────────────────────────────────────── */
.hero-tools {
  display: flex; align-items: center; gap: 14px;
  margin-top: 20px;
}
.hero-tools > * { flex: 0 0 auto; }
.hero-tools .theme-toggle { width: 52px; height: 28px; min-height: 28px; }
.hero-guide {
  font-size: 13.5px; color: var(--blue-deep); text-decoration: none;
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; white-space: nowrap;
}
.hero-guide:hover { border-color: #c9d6f5; }
html[data-theme="dark"] .hero-guide { background: #141b28; border-color: #262e3f; color: #a8bfff; }
@media (max-width: 900px) {
  .hero-tools { margin-top: 16px; gap: 10px; }
  .hero-guide { font-size: 13px; padding: 5px 10px; }
}

/*
 * 图表高度：宽度跟着正文走之后，桌面再抬一档更耐看。
 *
 * ⚠️⚠️ 必须套在 `@media (min-width: 901px)` 里。
 *    2026-11-06 这里漏了媒体查询，结果手机上也被钉成 620px ——
 *    而手机画布实际只有 240px 高，容器下方空出 362px（服主截图反馈"一大片空白"）。
 *    原始那条 620 是照抄桌面那段规则写的，本来就该和它一样受 901px 限制。
 *    手机端沿用文件里既有的 380px，不要在这里另写。
 */
@media (min-width: 901px) {
  main.grid > .chartcard > .chartwrap { height: 620px; min-height: 620px; max-height: 620px; }
}
@media (min-width: 1600px) {
  main.grid > .chartcard > .chartwrap { height: 680px; min-height: 680px; max-height: 680px; }
}

/* ══════════════════════════════════════════════════════════════
   账户概览条：数字不再被省略号截断（2026-11-06）
   ══════════════════════════════════════════════════════════════
   服主截图：「可用…」「冻结」「持仓…」—— 数值被截成省略号，完全读不出余额。

   原因：`.metrics` 在桌面是四等分，每一项又写了
   `white-space:nowrap; overflow:hidden; text-overflow:ellipsis`，
   而 `.metric` 自己只有 `min-width:0` —— 宽度不够就整段省略。
   改法：标签与数值都允许按内容撑开（`min-width: max-content`），
   数值用等宽数字、字号略收，四条并排也能读全。
   ══════════════════════════════════════════════════════════════ */

.balance-strip .metrics {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 26px;
  flex: 0 1 auto; min-width: 0;
}
.balance-strip .metric { min-width: max-content; flex: 0 0 auto; }
.balance-strip .metric span {
  overflow: visible; text-overflow: clip; white-space: nowrap;
}
.balance-strip .metric strong {
  overflow: visible; text-overflow: clip; white-space: nowrap;
  font-variant-numeric: tabular-nums; font-size: 15px;
}
/* 总权益那个大数字与盈亏也允许撑开，不再挤 */
.balance-strip .balance-title { min-width: max-content; }
.balance-strip .money-large { white-space: nowrap; }

@media (max-width: 900px) {
  .balance-strip .metrics { gap: 6px 18px; }
  .balance-strip .metric strong { font-size: 14px; }
}

/* ── 历史仓位折叠区（2026-11-06 新增）────────────────────────────
 * 已平仓 / 已强平的仓位只用于回看，默认收起；展开后每页 20 笔。
 * 目的是让「杠杆交易室」不必为上百条历史记录留出整屏高度。
 */
.levhistory {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.levhistory[hidden] { display: none; }
.levhistory-note { font-size: var(--fs-xs); }
.levhistory-list {
  flex: 1 0 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.levhistory .levpos-history {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--soft);
  opacity: .96;
}
.levhistory .levpos-history .levpos-main {
  padding: 0 0 4px;
  border-bottom: none;
}

/* ══════════════════════════════════════════════════════════════════
   新玩法入口（2026-11-08 新增）

   市场切换（金币/点券）右边加「现实模式 / 外汇模式」两个入口。
   这三者在逻辑上同级，都是「到哪里看行情」，所以放在同一行。
   ══════════════════════════════════════════════════════════════════ */

.market-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

/* 市场切换本身在 .market-bar 里不再自带下边距 */
.market-bar .market-switch {
  margin-bottom: 0;
}

.mode-entries {
  display: flex;
  gap: 8px;
  /* 收起时不占位，避免空 div 影响对齐 */
  flex: 0 0 auto;
}

.mode-entry {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px 6px 10px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--panel);
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color .18s, background .18s, transform .15s;
}

.mode-entry:hover {
  transform: translateY(-1px);
}

.mode-entry .me-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.mode-entry .me-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  white-space: nowrap;
}

.mode-entry .me-text b {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.mode-entry .me-text i {
  font-size: 11px;
  font-style: normal;
  color: var(--muted);
}

/* 现实模式：红（本服红涨口径），呼应股票 */
.mode-entry.is-real .me-icon {
  background: color-mix(in srgb, #e04b4b 14%, transparent);
  color: #e04b4b;
}
.mode-entry.is-real:hover {
  border-color: #e04b4b;
  background: color-mix(in srgb, #e04b4b 5%, var(--panel));
}

/* 外汇：青绿，与股票区分 */
.mode-entry.is-fx .me-icon {
  background: color-mix(in srgb, #26adad 14%, transparent);
  color: #26adad;
}
.mode-entry.is-fx:hover {
  border-color: #26adad;
  background: color-mix(in srgb, #26adad 5%, var(--panel));
}

/* ── 窄屏：入口换到下一行并占满宽度 ── */
@media (max-width: 640px) {
  .market-bar {
    /* 手机上竖排，两个入口平分整行更好点 */
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .mode-entries {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .mode-entry {
    justify-content: center;
    padding: 8px 10px;
  }
  /* 手机上前一行市场切换保持不变，仍是胶囊并排 */
  .market-bar .market-switch {
    justify-content: flex-start;
  }
}

/* ── 超窄屏：隐藏副标题，只留主名称 ── */
@media (max-width: 380px) {
  .mode-entry .me-text i {
    display: none;
  }
  .mode-entry {
    padding: 7px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mode-entry { transition: none; }
  .mode-entry:hover { transform: none; }
}
/* ══════════════════════════════════════════════════════════════════
   2026-11-09 服务不可用提示条

   固定在页面顶部居中，连续两次接口失败时出现。
   告诉玩家「服务器暂时不可用」，而不是让页面停在半加载状态。
   ══════════════════════════════════════════════════════════════════ */

.svc-banner {
  position: fixed;
  left: 50%;
  /* ???????????????2026-11-09 ?? */
  top: 72px;
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 20px;
  background: rgba(217, 119, 6, .96);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  max-width: calc(100vw - 32px);
}

.svc-banner[hidden] {
  display: none !important;
}

.svc-banner .svc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  flex: 0 0 auto;
  animation: svcPulse 1.2s ease-in-out infinite;
}

@keyframes svcPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

[data-theme='dark'] .svc-banner {
  background: rgba(180, 83, 9, .96);
}

@media (prefers-reduced-motion: reduce) {
  .svc-banner .svc-dot { animation: none; }
}

@media (max-width: 480px) {
  .svc-banner {
    font-size: 12px;
    padding: 8px 14px;
    top: 64px;
  }
}

/* ??????????????????????????????????????????????????????????????????
   2026-11-09 ????????

   ???768px ??? .newsdrawer ?? 768px???? 1148px?
   ?????????????????????????????????????????????????????????????????? */

.newsdrawer {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.newsdrawer > * {
  min-width: 0;
}

@media (max-width: 900px) {
  .newsdrawer {
    width: 100%;
    box-sizing: border-box;
  }
}


/* ═══ 游客体验（2026-11-09 新增）═════════════════════════════════════
 *
 * 未登录玩家的本地模拟账户面板。
 * 定位是体验 —— 想长期玩必须绑定账号。
 * 已登录时整块 hidden，不影响正常玩家。
 */
.guest-banner {
  padding: 11px 13px;
  margin-bottom: 14px;
  background: rgba(242, 201, 76, .1);
  border-left: 3px solid #f2c94c;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.75;
  color: #4a5160;
}
.guest-banner b { color: #b8860b; }
.guest-banner a {
  color: #4078ff;
  font-weight: 600;
  text-decoration: none;
}
.guest-banner a:hover { text-decoration: underline; }

/* 四宫格 */
.guest-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.guest-stats > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(64, 120, 255, .05);
  border-radius: 8px;
}
.guest-stats span {
  font-size: 11.5px;
  color: #8b93a1;
}
.guest-stats b {
  font-size: 15.5px;
  font-variant-numeric: tabular-nums;
  color: #1a1f29;
}

/* 下单区 */
.guest-order {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.guest-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.guest-field span {
  font-size: 12px;
  color: #8b93a1;
}
.guest-field select,
.guest-field input {
  padding: 9px 11px;
  border: 1px solid #e3e6ec;
  border-radius: 8px;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  background: #fff;
  color: #1a1f29;
  outline: none;
}
.guest-field select:focus,
.guest-field input:focus {
  border-color: #4078ff;
  box-shadow: 0 0 0 3px rgba(64, 120, 255, .12);
}
.guest-btns {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.guest-buy,
.guest-sell {
  padding: 11px;
  border: none;
  border-radius: 9px;
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.guest-buy { background: #e04b4b; }
.guest-sell { background: #1a9e5c; }
.guest-buy:hover, .guest-sell:hover { opacity: .88; }

/* 提示 */
.guest-msg {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.7;
}
.guest-msg.ok { background: rgba(26, 158, 92, .1); border-left: 3px solid #1a9e5c; color: #15803d; }
.guest-msg.err { background: rgba(224, 75, 75, .1); border-left: 3px solid #e04b4b; color: #b91c1c; }
.guest-msg.info { background: rgba(64, 120, 255, .08); border-left: 3px solid #4078ff; color: #1d4ed8; }

/* 持仓 / 成交 */
.guest-pos,
.guest-trades {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e3e6ec;
}
.guest-subhead {
  font-size: 12.5px;
  font-weight: 600;
  color: #4a5160;
  margin-bottom: 9px;
}
.guest-row {
  display: grid;
  grid-template-columns: 1.6fr 1.4fr 0.9fr 0.9fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.guest-row:nth-child(odd) { background: rgba(0, 0, 0, .022); }
.guest-row .g-sym { font-weight: 600; }
.guest-row .g-px,
.guest-row .g-pnl { text-align: right; }
.guest-row .up { color: #e04b4b; }
.guest-row .down { color: #1a9e5c; }
.guest-row .g-time,
.guest-row .g-qty { color: #8b93a1; }

.guest-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e3e6ec;
  text-align: right;
}
.guest-reset {
  padding: 6px 14px;
  border: 1px solid #e3e6ec;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  color: #8b93a1;
  cursor: pointer;
}
.guest-reset:hover { background: rgba(224, 75, 75, .06); color: #b91c1c; }

/* 深色 */
html[data-theme="dark"] .guest-stats > div { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .guest-field select,
html[data-theme="dark"] .guest-field input {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .12);
  color: #e3e6ec;
}
html[data-theme="dark"] .guest-row:nth-child(odd) { background: rgba(255, 255, 255, .035); }

/* 手机 */
@media (max-width: 560px) {
  .guest-stats { grid-template-columns: repeat(2, 1fr); }
  .guest-order { grid-template-columns: 1fr; }
  .guest-row { grid-template-columns: 1.4fr 1fr 0.8fr; font-size: 12px; }
  .guest-row .g-px { display: none; }
}

/* ═══ 游客悬浮提示条（2026-11-09 新增）══════════════════════════════
 *
 * 未登录玩家打开模拟盘时钉在页面顶部。
 * 因为游客面板在「交易台」里排得较靠下（概览条+标签+标的条之后），
 * 首屏看不到 —— 这条提示把玩家带过去。
 *
 * 可关闭：关一次在本会话内不再弹（sessionStorage 记一下）。
 */
.guest-float {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 76px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(720px, calc(100vw - 32px));
  padding: 11px 14px 11px 16px;
  background: #1a9e5c;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  font-size: 13.5px;
  line-height: 1.5;
  animation: guestFloatIn .28s ease-out;
}
@keyframes guestFloatIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.guest-float-txt { flex: 1 1 auto; }
.guest-float-txt b { font-weight: 700; }
.guest-float-btn {
  flex: 0 0 auto;
  padding: 6px 16px;
  border: none;
  border-radius: 7px;
  background: #fff;
  color: #15803d;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.guest-float-btn:hover { background: #e8fff2; }
.guest-float-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.guest-float-close:hover { background: rgba(255, 255, 255, .3); }

@media (max-width: 640px) {
  .guest-float {
    top: 64px;
    left: 8px;
    right: 8px;
    transform: none;
    max-width: none;
    padding: 10px 12px;
    font-size: 12.5px;
    gap: 8px;
  }
  @keyframes guestFloatIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .guest-float-btn { padding: 5px 12px; font-size: 12.5px; }
}

/* ═══ 移动端触控与字号（2026-11-09 新增）═══════════════════════════
 *
 * 实测（390×844 真机视口）发现的问题：
 *   · 「登录」「股市」这类小按钮只有 51×33 / 65×35，手指不好点；
 *   · 排序按钮 49×26、刷新按钮 26×26 更小；
 *   · 部分说明文字只有 10.5px，手机上看着吃力。
 *
 * Apple HIG / Material 都建议触摸目标 ≥ 44×44。
 * 这里在窄屏下统一放大，不动桌面布局。
 */
@media (max-width: 640px) {
  /* 主要按钮至少 44px 高 */
  button,
  a[href].btn,
  a[href][class*="btn"],
  select,
  input[type="text"],
  input[type="number"],
  input[type="search"] {
    min-height: 44px;
  }

  /* 图标按钮 / 小排序按钮：给足点击区域但不撑大视觉 */
  button[class*="theme"],
  button[class*="refresh"],
  button[class*="fav-filter"],
  button[class*="sort-btn"],
  button[class*="top"],
  .nav-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  /* 导航链接也给足高度（原来是 27×18，几乎点不到） */
  nav a,
  header a,
  .nav a,
  [class*="nav"] > a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  /* 最小字号：正文类不能小于 12px */
  p, li, td, th, dt, dd,
  [class*="desc"], [class*="note"], [class*="hint"], [class*="tip"] {
    font-size: max(12px, 1em);
  }
}


/* ═══ 移动端补修（2026-11-09 第二轮）═══════════════════════════════
 *
 * 第一轮之后实测还剩这几类：
 *   · 星标 ☆ 26×44 —— 高度够了但宽度不够，手指横着点容易错；
 *   · 搜索清除 ✕ 18×44 —— 同上；
 *   · 页头「首页」链接 27×18 —— 完全没覆盖到；
 *   · 涨跌幅数字 10.5px —— 表格里的数字，手机上费眼。
 */
@media (max-width: 640px) {
  /* 星标 / 清除 / 自选筛选：给足方形点击区 */
  button[class*="star"],
  button[class*="fav"],
  button[class*="clear"],
  [class*="star"] {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 页头全部链接（含「首页」「股市」面包屑） */
  header a,
  nav a,
  .crumb a,
  .rn-nav a,
  .fx-nav a,
  [class*="nav"] a,
  [class*="crumb"] a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  /* 表格里的数字与涨跌幅：10.5px 太小 */
  td,
  th,
  [class*="chg"],
  [class*="pct"],
  [class*="num"] {
    font-size: 12px !important;
  }

  /* 市场切换胶囊（金币/点券 98×37） */
  [class*="market-switch"] button,
  [class*="mk"] {
    min-height: 40px;
  }
}


/* ═══ 移动端补修（2026-11-09 第三轮）═══════════════════════════════
 *
 * 前两轮之后，把阈值降到 36px 复查，剩下的基本都是**文本链接**
 * （教程目录 105×20、页头「首页」27×40）—— 那些高度够、只是窄，
 * 点起来没问题，不再动。
 *
 * 真正需要修的是这三类：
 *   · 正文里的行内链接（「登录并绑定角色」88×16）—— 16px 太矮；
 *   · 图表工具栏的小按钮（K线/涨幅 35×30）—— 手指容易点错；
 *   · 迷你「跟随系统」等主题选项（1×44，宽度塌了）。
 */
@media (max-width: 640px) {
  /* 正文 inline 链接：撑起行高，别让它贴字 */
  p a,
  li a,
  td a,
  [class*="banner"] a,
  [class*="note"] a,
  [class*="hint"] a,
  [class*="desc"] a {
    display: inline-block;
    padding-top: 6px;
    padding-bottom: 6px;
    line-height: 1.6;
  }

  /* 图表工具栏 / 周期按钮 / 视图切换：至少 36×36 */
  [class*="chart"] button,
  [class*="period"] button,
  [class*="ymode"] button,
  [class*="view"] button,
  [class*="mode-pane"] button {
    min-width: 36px;
    min-height: 36px;
  }

  /* 主题选择组：宽度不能塌成 1px */
  [class*="theme"] button,
  [class*="theme"] label,
  [class*="theme"] span {
    min-width: 40px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-left: 6px;
    padding-right: 6px;
  }
}


/* ═══ 模式切换条（2026-11-09 新增）══════════════════════════════════
 *
 * 🔴 为什么加：实测发现现实模式与外汇页**没有任何通往其他模式的入口**，
 * 玩家想从「现实模式」去看「外汇」只能手动改地址栏。
 *
 * 这条切换条放在页头下面，三个模式互跳。
 */
.mode-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.mode-switch-label {
  color: var(--rn-muted, #8b93a1);
  margin-right: 2px;
}
.mode-switch-link {
  padding: 5px 12px;
  border: 1px solid var(--rn-line, #e3e6ec);
  border-radius: 7px;
  color: var(--rn-ink2, #4a5160);
  text-decoration: none;
  transition: all .15s;
}
.mode-switch-link:hover {
  background: rgba(64, 120, 255, .08);
  border-color: rgba(64, 120, 255, .35);
  color: #4078ff;
}
.mode-switch-cur {
  padding: 5px 12px;
  border: 1px solid rgba(64, 120, 255, .4);
  border-radius: 7px;
  background: rgba(64, 120, 255, .1);
  color: #4078ff;
  font-weight: 600;
}
html[data-theme="dark"] .mode-switch-link { border-color: rgba(255, 255, 255, .14); }
html[data-theme="dark"] .mode-switch-cur {
  background: rgba(64, 120, 255, .2);
  border-color: rgba(64, 120, 255, .5);
}
@media (max-width: 640px) {
  .mode-switch { font-size: 12.5px; gap: 5px; }
  .mode-switch-link, .mode-switch-cur { padding: 8px 12px; min-height: 40px; display: inline-flex; align-items: center; }
}


/* ═══ 修复：主题开关被触控规则撑变形（2026-11-10）═══════════════════
 *
 * 🔴 问题：2026-11-09 加的移动端触控规则里有
 *     button[class*="theme"] { min-width: 44px; min-height: 44px; }
 *  但 .theme-toggle 是一个**固定尺寸的滑块开关**：
 *     width: 52px; height: 28px;
 *   内部圆点靠 translateX(24px) 滑动，太阳/月亮图标绝对定位。
 *
 *   min-height:44px 把高度撑到 44，而宽度仍是 52，
 *   于是 28px 的滑块被拉成 44px 高，图标 ☀ ☾ 被挤成两行，滑块动画错位。
 *
 * 修法：主题开关保持它自己的尺寸，用透明外扩来满足点击面积，
 *   不改变可见形状 —— 这样既好点，又不破坏开关外观。
 */
@media (max-width: 640px) {
  .theme-toggle,
  .hero-tools .theme-toggle {
    min-width: 52px;
    min-height: 28px;
    width: 52px;
    height: 28px;
    /* 用 padding 撑出点击面积，但 box-sizing 保持 content-box 不会影响可见尺寸 */
    position: relative;
  }
  /*
   * 伪元素外扩点击热区：视觉不变，手指更容易点到。
   * 上下各扩 8px、左右各扩 4px，覆盖到 60×44 的可点区域。
   */
  .theme-toggle::after {
    content: '';
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: -4px;
    right: -4px;
    /* 不挡孩子的事件，只做热区 */
    z-index: -1;
  }

  /* 图标不得折行 */
  .theme-toggle,
  .theme-icon-sun,
  .theme-icon-moon {
    white-space: nowrap;
  }
}


/* ═══ 修复：图形元素被触控尺寸规则撑变形（2026-11-10）═══════════════
 *
 * 🔴 背景：2026-11-09 为手机端加了三轮触控优化，选择器写得过宽
 * （button / [class*="theme"] / [class*="refresh"] 等），
 * 把这些**靠固定尺寸画出来的图形元素**也一起撑了：
 *
 *   .theme-toggle-knob   22×22   主题开关里的滑块圆点
 *   .nav-toggle span     16×2    汉堡菜单的三条横线
 *   .theme-icon-sun/moon 12px    太阳/月亮图标
 *   .rn-refresh          26×26   刷新图标
 *   .icon-button         38×38   图标按钮
 *
 * 它们的尺寸是**图形的一部分**，一旦被 min-height 撑开，
 * 滑块会错位、汉堡线会变形、图标会跑偏 —— 玩家看到的就是「按钮变形」。
 *
 * 正确做法：交互尺寸与视觉尺寸分离 ——
 *   视觉元素保持原尺寸，用伪元素或透明 padding 撑出可点区域。
 */
@media (max-width: 640px) {
  /* ── 主题开关的滑块与图标：保持原位尺寸 ── */
  .theme-toggle-knob {
    min-width: 22px;
    min-height: 22px;
    width: 22px;
    height: 22px;
  }
  .theme-icon-sun,
  .theme-icon-moon {
    min-width: 0;
    min-height: 0;
    width: auto;
    height: auto;
    line-height: 1;
  }

  /* ── 汉堡菜单的三条横线：16×2，绝对不能被撑开 ── */
  .nav-toggle span,
  .nav-toggle i,
  .nav-toggle::before,
  .nav-toggle::after {
    min-width: 0;
    min-height: 0;
  }
  .nav-toggle span {
    width: 16px;
    height: 2px;
  }

  /* ── 图标按钮内的小图标 ── */
  .icon-button svg,
  .icon-button i,
  [class*="refresh"] svg,
  [class*="theme"] svg {
    min-width: 0;
    min-height: 0;
    flex: 0 0 auto;
  }

  /* ── 刷新类图标按钮：视觉保持，热区靠伪元素 ── */
  [class*="refresh"] {
    position: relative;
  }
  [class*="refresh"]::after {
    content: '';
    position: absolute;
    top: -9px;
    bottom: -9px;
    left: -9px;
    right: -9px;
    z-index: -1;
  }

  /* ── 回到顶部：保持 40×40，用伪元素扩热区 ── */
  [class*="-top"],
  [id="topBtn"],
  [id="btnTop"] {
    position: relative;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }
  [id="topBtn"]::before,
  [id="btnTop"]::before {
    content: '';
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: -4px;
    right: -4px;
    z-index: -1;
  }
}


/* ═══ 精准修复：滑块圆点与刷新按钮（2026-11-10）═══════════════════════
 *
 * 实测数据（390px 手机视口）：
 *
 * ① .theme-toggle 本身已是 52×28（正确），
 *    但内部的 .theme-toggle-knob 被撑成 **40×36**（应为 22×22）——
 *    原因是我加的 button[class*="theme"] { min-width:44px; min-height:44px }
 *    命中了圆点（它虽然只是 span，但父级按钮的规则在个别路径上传染）。
 *    结果 scrollHeight 38 > clientHeight 26，太阳/月亮被挤出盒子。
 *
 * ② .newsrefresh 等「刷新」按钮：
 *       btnNewsRefresh   51×32  padding 0 12px  scrollW 58 > clientW 49
 *       tradeRefreshBtn  51×44  padding 0 12px  scrollW 58 > clientW 49
 *     「刷新」两字 12.5px 约需 26px，加左右 padding 24px = 50px，
 *     min-width:44px 撑不出足够空间 → 文字溢出。
 *     （原本桌面端没问题，因为桌面按钮有其他 padding 规则。）
 *
 * 修法：
 *   · 圆点用更高优先级 + 明确尺寸钉死；
 *   · 刷新类按钮改用 padding 决定宽度，并允许自适应内容。
 */
@media (max-width: 640px) {
  /* ── ① 主题开关滑块：钉死 22×22，绝对定位不受父级 min-* 影响 ── */
  .theme-toggle .theme-toggle-knob,
  .hero-tools .theme-toggle .theme-toggle-knob {
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 22px !important;
    max-height: 22px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: grid !important;
    place-items: center !important;
    box-sizing: border-box !important;
  }

  /* 开关内的图标：不参与布局撑高 */
  .theme-toggle .theme-icon-sun,
  .theme-toggle .theme-icon-moon {
    position: absolute !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    font-size: 12px !important;
    line-height: 1 !important;
  }

  /* 开关本身：内容不得撑开 */
  button.theme-toggle,
  .hero-tools .theme-toggle {
    overflow: hidden !important;
  }

  /* ── ② 刷新类按钮：靠内边距定宽，文字不溢出 ── */
  .newsrefresh,
  .rn-news-refresh,
  .rn-trade-refresh,
  .rn-refresh,
  .fx-refresh,
  [id="btnNewsRefresh"],
  [id="newsRefresh"],
  [id="tradeRefreshBtn"] {
    width: auto !important;
    min-width: 44px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 纯图标刷新按钮（无文字）：保持方形 */
  [id="refreshBtn"],
  [id="newsRefresh"],
  [class*="-refresh"][aria-label] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}


/* ═══ 修复：刷新按钮文字溢出（2026-11-10 第三版）══════════════════════
 *
 * 实测：390px 视口下
 *     #btnNewsRefresh  47×32  scrollWidth 54 > clientWidth 45
 *     「刷新」两字 12.5px 约 26px + 左右 padding 20px = 46px，
 *     而按钮被压到 47px 还差一点 → 文字被挤。
 *
 * 🔴 前两版没修好，原因是我用的选择器特指度不够：
 *     原样式  .cardhead .newsrefresh { padding: 0 12px; min-height: 32px; }
 *     我的    .newsrefresh           { padding-left: 10px; ... }
 *   后者只有 1 个类，前者有 2 个，所以被压住。
 *
 * 这一版用同等特指度 + 明确的 width:auto，让按钮按内容撑开。
 */
@media (max-width: 640px) {
  /* 卡片头里的刷新按钮：按内容撑开，别被压窄 */
  .cardhead .newsrefresh,
  .cardhead .ghost.small,
  .rn-cardhead .rn-news-refresh,
  .rn-cardhead .rn-trade-refresh,
  .fx-card-head [class*="refresh"] {
    width: auto;
    min-width: max-content;
    padding-left: 12px;
    padding-right: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
  }

  /* 兜底：所有带 refresh 的按钮都允许按内容撑开 */
  button[class*="refresh"] {
    width: auto;
    min-width: max-content;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* 纯图标按钮例外（无文字，保持方形） */
  button[class*="refresh"]:empty,
  button[class*="refresh"]:has(> svg:only-child),
  button[class*="refresh"]:has(> i:only-child) {
    min-width: 44px;
    width: 44px;
    padding-left: 0;
    padding-right: 0;
  }
}


/* ═══ 修复：卡片标题栏在手机上被挤得换行（2026-11-10）════════════════
 *
 * 🔴 实测（390px 视口，模拟盘）：
 *     资讯卡片   需要 445px，实际 328px，差 117px → 挤成 3 行
 *     市场资金   需要 391px，差 63px              → 挤成 2 行
 *     行业板块   需要 332px，差 4px
 *     走势图 / 说明 / 行情                         → 也都换行
 *
 * 标题栏里塞了「标题 + 说明 + 徽标 + 刷新 + 展开」五个元素，
 * 桌面宽度够；手机上 328px 放不下，于是折成两三行，
 * 看起来就像「按钮被挤变形」。
 *
 * 修法（按优先级）：
 *   1. 说明文字在手机上隐藏 —— 它对手机玩家价值最低；
 *   2. 徽标与按钮保持单行、不换行、不收缩；
 *   3. 标题栏允许横向滚动而不是折行（极端情况兜底）。
 */
@media (max-width: 640px) {
  /* ── 标题栏本身：不折行，超出时横向滚动 ── */
  .cardhead {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px !important;
    /* 隐藏滚动条但保留功能 */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .cardhead::-webkit-scrollbar {
    display: none;
  }

  /* ── 说明文字：手机上隐藏，把空间让给按钮 ── */
  .cardhead > .note,
  .cardhead > .muted,
  .cardhead > .sub,
  .cardhead > p {
    display: none !important;
  }

  /* ── 标题：不收缩、不换行 ── */
  .cardhead > h2,
  .cardhead > h3 {
    flex: 0 0 auto;
    white-space: nowrap;
    margin: 0;
  }

  /* ── 按钮：不收缩、不换行 ── */
  .cardhead > button,
  .cardhead > .ghost,
  .cardhead > a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* ── 徽标（有新资讯等）：保留但不占太多 ── */
  .cardhead > .newsbadge {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 11.5px;
  }

  /* ── 现实模式与外汇的标题栏同样处理 ── */
  .rn-cardhead,
  .fx-card-head {
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  .rn-cardhead > .rn-note,
  .fx-card-head > .fx-note {
    display: none !important;
  }
  .rn-cardhead > h2,
  .fx-card-head > h2 {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .rn-cardhead > button,
  .fx-card-head > button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}
