/* ══════════════════════════════════════════════════════════════════════════
   外汇模式 · 样式（2026-11-08）

   设计原则（与现实模式 real.css 同源，但有针对性差异）：
     ① 复用股市主站的设计令牌，两页切换不跳变。
     ② 深色模式是全套变量覆盖，不是打补丁。
     ③ 手机优先：先单栏，≥641px 再扩宽。
     ④ **外汇的视觉重点与股票不同**：股票关心「一股多少钱」，
        外汇关心「买入/卖出两个价」和「点差」——所以表格是
        名称 / 买入 / 卖出 / 涨跌 四列，中间价不占列（放单支详情里）。
     ⑤ 涨跌配色沿用本服口径：红涨绿跌。
   ══════════════════════════════════════════════════════════════════════════ */

: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;

  --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-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: #e8ebf2;
  --ink-2: #b6bdcb;
  --muted: #8b93a3;
  --line: #262b36;
  --line-2: #1e222b;
  --pill: #2a2f3a;
  --soft: #1a1e26;
  --panel: #141821;
  --page: #0e1117;

  --up: #ff6b6b;
  --up-soft: #2a1a1c;
  --down: #4ecb8b;
  --down-soft: #162822;

  --warn: #e0b04a;
  --warn-soft: #2a2317;

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

/* ── 基础 ───────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  transition: background var(--theme-switch-dur), color var(--theme-switch-dur);
  padding-bottom: env(safe-area-inset-bottom);
}

/* 汇率数字统一等宽，刷新时不跳 */
.fx-num, .c-ask, .c-bid, .c-chg, .fx-status-age {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--soft);
  color: var(--ink-2);
}

/* ── 顶栏 ───────────────────────────────────────────────────────── */
.fx-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.fx-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--fs-sm);
  padding: 6px 10px 6px 6px;
  border-radius: var(--r-pill);
  transition: background .18s, color .18s;
}
.fx-back:hover { background: var(--soft); color: var(--blue-deep); }
.fx-back:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.fx-title {
  flex: 1;
  font-size: var(--fs-md);
  font-weight: var(--fw-mid);
  letter-spacing: .01em;
}

.fx-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.fx-theme:hover { background: var(--soft); color: var(--blue-deep); border-color: var(--blue); }
.fx-theme:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── 主容器 ─────────────────────────────────────────────────────── */
/*
 * 主容器宽度（2026-11-08 改）
 *
 * 原为固定 880px —— 这是手机优先时代的写法。
 * 在 2560 宽的屏上，880px 只占 34%，两侧各空 840px。
 * 改成 90% 宽（上限 2400px），与股票页保持一致。
 */
.fx-main {
  width: 90%;
  max-width: 2400px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 小屏用满宽 */
@media (max-width: 900px) {
  .fx-main { width: 100%; }
}

/* ── 状态条 ─────────────────────────────────────────────────────── */
.fx-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.fx-status-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.fx-status-dot[data-state="open"] { background: var(--down); }
.fx-status-dot[data-state="closed"] { background: var(--muted); }
.fx-status-dot[data-state="stale"] { background: var(--warn); }

.fx-status-text { flex: 1; }
.fx-status-age {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}

/* ── 卡片 ───────────────────────────────────────────────────────── */
.fx-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-sm);
}

.fx-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.fx-h2 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-mid);
  color: var(--ink);
}

/* ── 排序 ───────────────────────────────────────────────────────── */
.fx-sort {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--soft);
  border-radius: var(--r-pill);
}

.fx-sort-btn {
  padding: 5px 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-family: inherit;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.fx-sort-btn:hover { color: var(--ink-2); }
.fx-sort-btn.is-on {
  background: var(--panel);
  color: var(--blue-deep);
  font-weight: var(--fw-mid);
  box-shadow: var(--sh-sm);
}
.fx-sort-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ── 表头 ─────────────────────────────────────────────────────────
   列宽说明（2026-11-08 修）：
     初版 `minmax(0,1fr) 84px 84px 66px` 在 390px 屏上名称列只剩约 100px，
     「澳元兑美元」折成两行、「新西兰元兑美元」被截断 —— 14 个货币对里 8 个显示不全。
     外汇的汇率数字最长 8 个字符（158.4897），给 76px 就够，
     把省下的空间给名称列，让它能完整显示 6 个汉字。  */
.fx-thead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 74px 58px;
  gap: 5px;
  padding: 0 8px 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
  border-bottom: 1px solid var(--line-2);
}
.fx-thead .c-ask,
.fx-thead .c-bid,
.fx-thead .c-chg { text-align: right; }

/* ── 汇率列表 ───────────────────────────────────────────────────── */
.fx-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fx-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 74px 58px;
  gap: 5px;
  align-items: center;
  padding: 11px 8px;
  border-radius: var(--r-sm);
  transition: background .15s;
  animation: fx-fade-in .3s ease both;
}
.fx-row:hover { background: var(--soft); }
.fx-row + .fx-row { border-top: 1px solid var(--line-2); }

@keyframes fx-fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-row { animation: none; }
}

/* 名称列 */
.c-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.fx-name {
  font-size: var(--fs-base);
  color: var(--ink);
  font-weight: var(--fw-normal);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.fx-code {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
/* 点差：极小号，靠右，一眼能看到但不抢注意力 */
.fx-sp {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  opacity: .72;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--soft);
  line-height: 1.25;
}

/* 买入价（做多成交价）——用暖色暗示「买入要花钱」 */
.c-ask {
  text-align: right;
  font-size: var(--fs-sm);
  color: var(--ink);
  font-weight: var(--fw-mid);
}
/* 卖出价（做空/平多成交价） */
.c-bid {
  text-align: right;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* 涨跌 */
.c-chg {
  text-align: right;
  font-size: var(--fs-sm);
  font-weight: var(--fw-mid);
}
.c-chg.is-up   { color: var(--up); }
.c-chg.is-down { color: var(--down); }
.c-chg.is-flat { color: var(--muted); }

/* 空态 */
.fx-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  list-style: none;
}

/* 骨架屏 */
.fx-skel {
  padding: 13px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 74px 58px;
  gap: 5px;
  align-items: center;
}
.fx-skel i {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg,
      var(--line-2) 25%, var(--soft) 37%, var(--line-2) 63%);
  background-size: 400% 100%;
  animation: fx-shimmer 1.4s ease infinite;
}
@keyframes fx-shimmer {
  from { background-position: 100% 50%; }
  to   { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-skel i { animation: none; }
}

/* ── 点差说明 ───────────────────────────────────────────────────── */
.fx-spread-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.6;
}
.fx-spread-note svg {
  flex: none;
  margin-top: 3px;
  opacity: .7;
}

/* ── 说明卡 ─────────────────────────────────────────────────────── */
.fx-guide .fx-h2 { margin-bottom: 10px; }

.fx-dl {
  margin: 0;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px 14px;
  font-size: var(--fs-sm);
}
.fx-dl dt {
  color: var(--muted);
  font-size: var(--fs-xs);
  padding-top: 2px;
}
.fx-dl dd {
  margin: 0;
  color: var(--ink-2);
  line-height: var(--lh-body);
}
.fx-dl dd strong { color: var(--ink); font-weight: var(--fw-mid); }

/* ── 页脚 ───────────────────────────────────────────────────────── */
.fx-foot {
  padding: 4px 4px 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: var(--lh-body);
}
.fx-foot p { margin: 0 0 4px; }
.fx-foot-dim { opacity: .8; }

/* ── 宽屏 ───────────────────────────────────────────────────────── */
@media (min-width: 641px) {
  .fx-main { padding: 20px 20px 48px; gap: 16px; }
  .fx-card { padding: 20px; }
  .fx-thead,
  .fx-row,
  .fx-skel { grid-template-columns: minmax(0, 1fr) 96px 96px 76px; }
  .fx-dl { grid-template-columns: 84px 1fr; }
}

/* ── 超窄屏（≤360px）：把「卖出」列藏起来，保住买入与涨跌 ── */
@media (max-width: 360px) {
  .fx-thead,
  .fx-row,
  .fx-skel { grid-template-columns: minmax(0, 1fr) 70px 56px; }
  .fx-thead .c-bid,
  .fx-row .c-bid,
  .fx-skel .c-bid { display: none; }
}

/* ══════════════════════════════════════════════════════════════════
   2026-11-08 增强：刷新、强弱分布、搜索、分时、计算器、回到顶部
   ══════════════════════════════════════════════════════════════════ */

/* ── 刷新按钮 ───────────────────────────────────────────────────── */
.fx-refresh {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: 2px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .18s, color .18s;
}
.fx-refresh:hover { background: var(--panel); color: var(--blue-deep); }
.fx-refresh:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.fx-refresh.is-spin svg { animation: fx-spin .7s linear infinite; }
@keyframes fx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .fx-refresh.is-spin svg { animation: none; }
}

/* ── 强弱分布条 ─────────────────────────────────────────────────── */
.fx-breadth {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 14px 12px;
  box-shadow: var(--sh-sm);
}
.fx-breadth-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: var(--fs-xs);
}
.fx-breadth-title { color: var(--muted); }
.fx-breadth-nums {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  font-weight: var(--fw-mid);
}
.fx-breadth-nums .up { color: var(--up); }
.fx-breadth-nums .down { color: var(--down); }
.fx-breadth-nums .flat { color: var(--muted); }

.fx-breadth-track {
  display: flex;
  height: 7px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--soft);
}
.fx-breadth-up   { background: var(--up); transition: width .35s ease; }
.fx-breadth-flat { background: var(--pill); transition: width .35s ease; }
.fx-breadth-down { background: var(--down); transition: width .35s ease; }
@media (prefers-reduced-motion: reduce) {
  .fx-breadth-up, .fx-breadth-flat, .fx-breadth-down { transition: none; }
}

/* ── 搜索 ───────────────────────────────────────────────────────── */
.fx-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--muted);
  transition: border-color .18s, background .18s;
}
.fx-search:focus-within { border-color: var(--blue); background: var(--panel); }
.fx-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-family: inherit;
  padding: 0;
}
.fx-search input::placeholder { color: var(--muted); }
.fx-search input::-webkit-search-cancel-button { display: none; }

.fx-search-clear {
  flex: none;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--pill);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fx-search-clear:hover { background: var(--line); color: var(--ink-2); }

/* ── 分时图卡片 ─────────────────────────────────────────────────── */
.fx-chart-card { padding-bottom: 12px; }
/* 未选货币对时收起图表区，避免首页一大块空白 */
.fx-chart-card:not(.is-ready) .fx-chart-wrap { display: none; }
.fx-chart-card:not(.is-ready) .fx-chart-legend { display: none; }
.fx-chart-card:not(.is-ready) { padding-bottom: 16px; }

.fx-chart-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.fx-chart-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fx-chart-wrap {
  position: relative;
  width: 100%;
  height: clamp(170px, 32vh, 280px);
  margin-top: 4px;
}
#fxCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}
.fx-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  color: var(--muted);
  background: var(--panel);
  border-radius: var(--r-sm);
}
.fx-chart-empty[hidden] { display: none; }

.fx-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.fx-lg-item { display: inline-flex; align-items: center; gap: 5px; }
.fx-dot-up, .fx-dot-down {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.fx-dot-up { background: var(--up); }
.fx-dot-down { background: var(--down); }
.fx-lg-hint { margin-left: auto; opacity: .8; }
@media (max-width: 360px) {
  .fx-lg-hint { margin-left: 0; width: 100%; }
}

/* ── 杠杆计算器 ─────────────────────────────────────────────────── */
.fx-calc-desc {
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: var(--lh-body);
}

.fx-calc-form {
  display: grid;
  grid-template-columns: 1fr 78px 78px;
  gap: 8px;
  margin-bottom: 12px;
}
@media (max-width: 400px) {
  .fx-calc-form { grid-template-columns: 1fr 1fr; }
  .fx-calc-form .fx-field:first-child { grid-column: 1 / -1; }
}

.fx-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.fx-field > span {
  font-size: 11.5px;
  color: var(--muted);
}
.fx-field select,
.fx-field input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .18s;
}
.fx-field select:focus,
.fx-field input:focus { border-color: var(--blue); }

.fx-calc-result {
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: var(--soft);
  font-size: var(--fs-sm);
  line-height: 1.9;
}
.fx-calc-hint { color: var(--muted); font-size: var(--fs-xs); }
.fx-calc-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.fx-calc-row > span { color: var(--muted); font-size: var(--fs-xs); }
.fx-calc-row > b {
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-mid);
  color: var(--ink);
}
.fx-calc-row > b.hl { color: var(--blue-deep); }
.fx-calc-row > b.down { color: var(--down); }
.fx-calc-note {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

/* 选中的货币对 */
.fx-row.is-sel {
  background: color-mix(in srgb, var(--blue) 9%, transparent);
  box-shadow: inset 2px 0 0 var(--blue);
}
.fx-row.is-sel .fx-name { color: var(--blue-deep); font-weight: var(--fw-mid); }

/* ── 回到顶部 ───────────────────────────────────────────────────── */
.fx-top {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 30;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink-2);
  box-shadow: var(--sh-md);
  cursor: pointer;
  transition: color .18s, border-color .18s;
}
.fx-top[hidden] { display: none; }
.fx-top:hover { color: var(--blue-deep); border-color: var(--blue); }
.fx-top:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* ══════════════════════════════════════════════════════════════════
   2026-11-08 打磨：外汇自选星标、汇率闪烁、键盘导航
   ══════════════════════════════════════════════════════════════════ */

/* 搜索行（搜索框 + 自选筛选并排） */
.fx-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.fx-search-row .fx-search {
  flex: 1;
  margin-bottom: 0;
}

.fx-fav-filter {
  flex: none;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.fx-fav-filter:hover { color: var(--warn); border-color: var(--warn); }
.fx-fav-filter.is-on {
  color: var(--warn);
  border-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}
.fx-fav-filter.is-on svg { fill: currentColor; }
.fx-fav-filter:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* 星标列：从「涨跌」列扣 30px 出来 */
.fx-thead,
.fx-row,
.fx-skel {
  grid-template-columns: minmax(0, 1fr) 74px 74px 58px 28px;
}

.fx-star {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--line);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s, background .15s, transform .15s;
}
.fx-star:hover {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  transform: scale(1.15);
}
.fx-star.is-on { color: var(--warn); }
.fx-star:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* 自选行左侧金边 */
.fx-row.is-fav {
  box-shadow: inset 2px 0 0 var(--warn);
}

/* 汇率变化闪烁 */
.c-ask.flash-up { animation: fx-flash-up .85s ease-out; }
.c-ask.flash-down { animation: fx-flash-down .85s ease-out; }

@keyframes fx-flash-up {
  0%   { background: color-mix(in srgb, var(--up) 28%, transparent); }
  100% { background: transparent; }
}
@keyframes fx-flash-down {
  0%   { background: color-mix(in srgb, var(--down) 28%, transparent); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .c-ask.flash-up, .c-ask.flash-down { animation: none; }
}

/* 键盘光标 */
.fx-row.is-cursor {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--blue) 7%, transparent);
}

/* 窄屏：藏「卖出」列（比藏一手更重要，因为外汇两个价都重要，但只能舍一个） */
@media (max-width: 420px) {
  .fx-thead,
  .fx-row,
  .fx-skel {
    grid-template-columns: minmax(0, 1fr) 70px 56px 26px;
  }
  .fx-thead .c-bid,
  .fx-row .c-bid,
  .fx-skel .c-bid { display: none; }
}
/* ══════════════════════════════════════════════════════════════════
   2026-11-08 新增：图表周期切换（分时 / 日 / 周 / 月）
   ══════════════════════════════════════════════════════════════════ */

/*
 * 图表卡片的头部现在同时放「标题 + 周期按钮」，
 * 标题要能被压缩，按钮不许被挤下去。
 */
.fx-chart-card .fx-card-head {
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.fx-chart-card .fx-chart-title {
  flex: 1 1 auto;
  min-width: 0;
}

/* 周期按钮组：四个按钮，比排序按钮更紧凑 */
.fx-chart-card .fx-sort {
  flex: 0 0 auto;
}
.fx-chart-card .fx-sort-btn {
  padding-left: 8px;
  padding-right: 8px;
}

/* 窄屏：按钮组换到下一行并占满宽度 */
@media (max-width: 380px) {
  .fx-chart-card .fx-sort {
    width: 100%;
  }
  .fx-chart-card .fx-sort-btn {
    flex: 1;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
  }
}

/* ══════════════════════════════════════════════════════════════════
   2026-11-08 三栏布局（与股票页对齐）

   左：实时汇率列表（14 个货币对）
   中：走势图
   右：杠杆计算器

   手机（<768px）单列，顺序为 列表 → 图表 → 计算器。
   ══════════════════════════════════════════════════════════════════ */

.fx-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* 平板：两栏，计算器跨两列放到下面 */
@media (min-width: 768px) {
  .fx-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .fx-col-side {
    grid-column: 1 / -1;
  }
  .fx-col-list .fx-thead,
  .fx-col-list .fx-row,
  .fx-col-list .fx-skel {
    grid-template-columns: minmax(84px, 1fr) 58px 54px;
  }
}

/* 桌面：三栏 */
@media (min-width: 1280px) {
  .fx-workspace {
    grid-template-columns: 360px minmax(0, 1fr) 360px;
  }
  .fx-col-side {
    grid-column: auto;
  }

  /* 三栏各自的间距与高度 */
  .fx-col-list,
  .fx-col-chart,
  .fx-col-side {
    padding: 14px;
    min-height: 420px;
  }

  .fx-col-chart {
    position: sticky;
    top: 16px;
  }

  /*
   * 左栏列表：固定区块不许被压缩（flex 压缩坑，股票页已踩过）。
   * 只有列表本身允许收缩并滚动。
   */
  .fx-col-list {
    max-height: calc(100vh - 240px);
    display: flex;
    flex-direction: column;
  }
  .fx-col-list > .fx-card-head,
  .fx-col-list > .fx-search-row,
  .fx-col-list > .fx-thead {
    flex: 0 0 auto;
  }
  .fx-col-list > .fx-list {
    flex: 1 1 auto;
    min-height: 120px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .fx-col-list > .fx-spread-note {
    flex: 0 0 auto;
  }

  /* 左栏列宽：名称 / 买入 / 卖出 / 涨跌 */
  .fx-col-list .fx-thead,
  .fx-col-list .fx-row,
  .fx-col-list .fx-skel {
    grid-template-columns: minmax(76px, 1fr) 58px 58px 52px 20px;
    gap: 5px;
    padding-left: 6px;
    padding-right: 6px;
    min-width: 0;
  }
  .fx-col-list .fx-row > *,
  .fx-col-list .fx-thead > * {
    min-width: 0;
    overflow: hidden;
  }
  .fx-col-list .fx-pair-name {
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .fx-col-list .fx-num { font-size: 12px; }

  /* 图表高度 */
  .fx-chart-wrap {
    height: clamp(260px, 38vh, 420px);
  }

  /* 右栏计算器：表单纵向排，输入框占满 */
  .fx-col-side .fx-calc-form {
    flex-direction: column;
    align-items: stretch;
  }
  .fx-col-side .fx-field {
    width: 100%;
  }
  .fx-col-side .fx-field input,
  .fx-col-side .fx-field select {
    width: 100%;
  }
}

/* 窄屏：市场/货币对列表列宽收紧 */
@media (max-width: 420px) {
  .fx-thead,
  .fx-row,
  .fx-skel {
    grid-template-columns: minmax(0, 1fr) 64px 60px 54px 22px;
  }
}

/* 三栏下「空态」不要塌（与股票页同样的处理） */
@media (min-width: 1280px) {
  .fx-chart-card:not(.is-ready) .fx-chart-wrap {
    display: block;
    position: relative;
    min-height: 320px;
    background: var(--soft);
    border-radius: var(--r-sm);
  }
  .fx-chart-card:not(.is-ready) .fx-chart-empty {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

/* ══════════════════════════════════════════════════════════════════
   2026-11-08 修手机端列表轻微溢出（88 < 92）

   诊断：手机上 .c-name 与 .fx-code 各 88px 但内容要 92px。
   原因：列宽用固定像素，没考虑 gap 与 padding。
   修法：改 minmax(0,1fr) 并允许省略号。
   ══════════════════════════════════════════════════════════════════ */
.fx-row > *,
.fx-thead > * {
  min-width: 0;
  overflow: hidden;
}

.fx-row .c-name,
.fx-row .fx-code,
.fx-thead .c-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fx-row .fx-pair-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ══════════════════════════════════════════════════════════════════
   2026-11-08 修外汇列表名称溢出（110 < 116、88 < 102）

   现象：「澳元兑美元」4 个汉字 + 货币对代码，名称列装不下。
   原因：列宽给的是固定像素，中文名比英文长。
   修法：名称列再放宽，并把「代码」从 name 里拆出来单独省略。
   ══════════════════════════════════════════════════════════════════ */

/* 名称单元格：两行结构（名 + 代码），都不许撑破 */
.fx-row .c-name,
.fx-thead .c-name {
  min-width: 0;
  overflow: hidden;
}

.fx-row .fx-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.fx-row .fx-code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 左栏（三栏布局）里名称列再宽一点 */
@media (min-width: 1280px) {
  .fx-col-list .fx-thead,
  .fx-col-list .fx-row,
  .fx-col-list .fx-skel {
    /* 名称 1fr；买入 56；卖出 56；涨跌 50；星标 20 */
    grid-template-columns: minmax(92px, 1fr) 56px 56px 50px 20px;
  }
}

/* 手机：名称列也放宽 */
@media (max-width: 767px) {
  .fx-thead,
  .fx-row,
  .fx-skel {
    grid-template-columns: minmax(92px, 1fr) 60px 58px 52px 22px;
    gap: 4px;
  }
}
/* ══════════════════════════════════════════════════════════════════
   2026-11-08 修中栏图表下方大片空白

   现象：三栏布局下，中栏卡片被 grid 拉到与左栏等高，
        但 .fx-chart-wrap 是固定高度（clamp 260–420px），
         于是图表下面空出一大片。

   修法：让图表区**撑满卡片剩余高度**（flex:1），
        卡片自身用 flex column。
   ══════════════════════════════════════════════════════════════════ */

@media (min-width: 1280px) {
  .fx-col-chart {
    display: flex;
    flex-direction: column;
    /* 与左栏同高（左栏 max-height 是 100vh-240） */
    min-height: 420px;
  }

  /* 卡片头、图例固定，不许压缩 */
  .fx-col-chart > .fx-card-head,
  .fx-col-chart > .fx-chart-legend {
    flex: 0 0 auto;
  }

  /* 图表区占满剩余高度 */
  .fx-col-chart > .fx-chart-wrap {
    flex: 1 1 auto;
    min-height: 240px;
    height: auto;
  }

  /* 画布铺满容器 */
  .fx-col-chart > .fx-chart-wrap > canvas {
    width: 100%;
    height: 100%;
    display: block;
  }
}

/* ══════════════════════════════════════════════════════════════════
   2026-11-09 杠杆滑杆

   布局：数值输入框在上（带「倍」单位），滑杆在中，刻度按钮在下。
   纵向排而不是横排：右栏只有 360px，横排会把输入框挤得很窄。
   ══════════════════════════════════════════════════════════════════ */

.fx-lev-field {
  gap: 6px;
}

.fx-lev-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fx-lev-row input {
  flex: 1;
  min-width: 0;
  /* 数字用等宽，输入时不跳动 */
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.fx-lev-unit {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
}

/* ── 滑杆 ─────────────────────────────────────────────────────── */
.fx-lev-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

/* 轨道 */
.fx-lev-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  /* 左侧已选部分用蓝色，右侧灰色 */
  background: linear-gradient(
    to right,
    var(--blue) 0%,
    var(--blue) var(--fill, 20%),
    var(--line) var(--fill, 20%),
    var(--line) 100%
  );
}
.fx-lev-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.fx-lev-range::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--blue);
}

/* 滑块 */
.fx-lev-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--blue);
  box-shadow: var(--sh-sm);
  transition: transform .12s;
}
.fx-lev-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--blue);
  box-shadow: var(--sh-sm);
}
.fx-lev-range:hover::-webkit-slider-thumb {
  transform: scale(1.12);
}
.fx-lev-range:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── 刻度按钮 ─────────────────────────────────────────────────── */
.fx-lev-ticks {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.fx-lev-ticks button {
  padding: 3px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--muted);
  font-size: 10.5px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
}
.fx-lev-ticks button:hover {
  color: var(--blue);
  border-color: var(--blue);
}
.fx-lev-ticks button.is-on {
  background: color-mix(in srgb, var(--blue) 14%, var(--panel));
  border-color: var(--blue);
  color: var(--blue-deep);
  font-weight: 600;
}

/* 窄屏：刻度按钮小一点 */
@media (max-width: 420px) {
  .fx-lev-ticks button {
    font-size: 10px;
    padding: 2px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fx-lev-range::-webkit-slider-thumb { transition: none; }
  .fx-lev-ticks button { transition: none; }
}

/* ══════════════════════════════════════════════════════════════════
   2026-11-09 修杠杆刻度按钮溢出

   诊断：.fx-lev-ticks 高 78px 但内容要 90px，溢出 12px。
   原因：6 个按钮在 330px 宽的容器里，每个至少 55px 才放得下，
        而按钮内边距 + 字体宽度超了。

   修法：缩小内边距与字号，并允许极窄时换行。
   ══════════════════════════════════════════════════════════════════ */

.fx-lev-ticks {
  /* 允许内容超出时收缩，而不是撑破容器 */
  min-width: 0;
}

.fx-lev-ticks button {
  /* 按钮最小宽度 0，靠 grid 均分 */
  min-width: 0;
  padding: 3px 2px;
  font-size: 10px;
  /* 数字不换行 */
  white-space: nowrap;
  overflow: hidden;
}

/* 右栏（三栏桌面）只有 360px，内边距再紧一点 */
@media (min-width: 1280px) {
  .fx-col-side .fx-lev-ticks {
    gap: 2px;
  }
  .fx-col-side .fx-lev-ticks button {
    padding: 3px 0;
    font-size: 9.5px;
  }
}

/* 表单整体也不许撑破 */
.fx-calc-form {
  min-width: 0;
}
.fx-field {
  min-width: 0;
}
/* ══════════════════════════════════════════════════════════════════
   2026-11-09 修刻度按钮内文字溢出（9 < 15）

   诊断：按钮宽 9px 但「100」三个字需要 15px。
   在 360px 右栏里 6 个按钮均分，每个只有 9px 可用 —— 装不下「100」。

   修法：改成 3 列 × 2 行。每行 3 个按钮，每个约 18px 宽。
         虽然多了一行，但文字能完整显示，比挤成一团好。
   ══════════════════════════════════════════════════════════════════ */

.fx-lev-ticks {
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

/* 更宽的布局（非三栏时）仍可 6 列 */
@media (min-width: 768px) and (max-width: 1279px) {
  .fx-lev-ticks {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 420px) {
  .fx-lev-ticks {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* ══════════════════════════════════════════════════════════════════
   2026-11-09 滑杆太小（服主反馈）

   诊断：
     .fx-calc-form 是 3 列 grid（158px / 78px / 78px），
     「杠杆倍数」是第三列，只分到 78px —— 滑杆也只有 78px 宽，
     拖动精度极差；而货币对占 158px，右侧大片空间浪费。

   修法：
     杠杆字段**横跨整行**（grid-column: 1 / -1），
     滑杆就能用满 330px，拖动精度提升 4 倍。
   ══════════════════════════════════════════════════════════════════ */

/* 杠杆字段独占一行 */
.fx-lev-field {
  grid-column: 1 / -1;
}

/* 滑杆加高加大，更容易点 */
.fx-lev-range {
  height: 28px;
}

.fx-lev-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
}

.fx-lev-range::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border-width: 2.5px;
}

.fx-lev-range::-moz-range-track {
  height: 6px;
  border-radius: 3px;
}
.fx-lev-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-width: 2.5px;
}

/* 数值行：输入框不再挤，加宽一点 */
.fx-lev-row input {
  max-width: 120px;
}

/* 刻度按钮回到 6 列（现在整行 330px，放得下） */
.fx-lev-ticks {
  grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 420px) {
  /* 手机上仍 3 列，否则按钮太窄 */
  .fx-lev-ticks {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ══════════════════════════════════════════════════════════════════
   2026-11-09 上线前修外汇移动端溢出
   ══════════════════════════════════════════════════════════════════ */

/* ── ③ 手机 360：货币对名称列放宽 ── */
@media (max-width: 380px) {
  .fx-thead,
  .fx-row,
  .fx-skel {
    grid-template-columns: minmax(78px, 1fr) 52px 50px 46px 18px;
    gap: 3px;
    padding-left: 4px;
    padding-right: 4px;
  }
  .fx-row .fx-name { font-size: 11.5px; }
  .fx-row .fx-code { font-size: 9.5px; }
  .fx-row .fx-num { font-size: 11px; }
  .fx-thead { font-size: 10px; }
}

/* ── ④ 平板 768：搜索行溢出（258 < 266） ── */
.fx-search-row {
  /* 搜索框与收藏按钮的总宽不能超过容器 */
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.fx-search-row > .fx-search {
  flex: 1 1 auto;
  min-width: 0;
}
.fx-search-row > .fx-fav-filter {
  flex: 0 0 auto;
}

/* 所有尺寸兜底 */
.fx-row > *,
.fx-thead > * {
  min-width: 0;
  overflow: hidden;
}


/* 页头账号入口（2026-11-09 新增，同现实模式） */
.fx-account {
  margin-left: auto;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--panel);
  color: var(--ink-2);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.fx-account:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.fx-account.is-signed {
  color: var(--blue-deep);
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  background: color-mix(in srgb, var(--blue) 8%, var(--panel));
}


/* 页脚操作指引（2026-11-09 新增，同现实模式） */
.fx-foot-guide {
  margin: 14px 0 10px;
  padding: 12px 14px;
  background: var(--soft);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
}
.fx-foot-guide-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.fx-foot-guide-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}
.fx-foot-guide-list li code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
}
.fx-foot-guide-note {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}
.fx-foot-guide-note strong { color: var(--ink-2); }
@media (max-width: 480px) {
  .fx-foot-guide-list { padding-left: 16px; font-size: 11.5px; }
  .fx-foot-guide-list li code { font-size: 11px; white-space: normal; word-break: break-all; }
}


/* ═══ 点券购买说明（2026-11-09 新增），与现实模式 rn-buy-hint 同一套视觉 ═══ */
.fx-buy-hint {
  margin-top: 10px !important;
  padding: 10px 14px;
  background: rgba(242, 201, 76, .1);
  border-left: 3px solid #f2c94c;
  border-radius: 6px;
  font-size: 13px !important;
  line-height: 1.7;
}
.fx-buy-hint b {
  color: #b8860b;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .fx-buy-hint {
  background: rgba(242, 201, 76, .12);
}
html[data-theme="dark"] .fx-buy-hint b {
  color: #f2c94c;
}


/* ═══ 交易面板（2026-11-09 新增）═════════════════════════════════════
 *
 * 服主原话「我本意就是让玩家能在网页玩的」——
 * 原来外汇网页只能看汇率，开仓必须进游戏。
 *
 * 布局：接在「杠杆计算器」下方，共用它的货币对/手数/杠杆三个控件，
 * 这里只加「方向 + 开仓 + 资金 + 持仓」。
 */
.fx-trade-wrap {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--fx-line, #e3e6ec);
}

/* 未登录 */
.fx-trade-login {
  padding: 16px 4px;
  text-align: center;
  color: var(--fx-muted, #8b93a1);
  font-size: 13px;
  line-height: 1.8;
}
.fx-trade-login-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 22px;
  border-radius: 8px;
  background: var(--fx-blue, #4078ff);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.fx-trade-login-btn:hover { opacity: .9; }

/* 账户四宫格 */
.fx-trade-account {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.fx-trade-account > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  background: rgba(64, 120, 255, .05);
  border-radius: 7px;
}
.fx-trade-account span {
  font-size: 11.5px;
  color: var(--fx-muted, #8b93a1);
}
.fx-trade-account b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--fx-ink, #1a1f29);
}

/* 资金操作 */
.fx-trade-cash {
  margin-bottom: 14px;
}
.fx-trade-cash-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.fx-cash-in,
.fx-cash-out {
  padding: 9px;
  border: 1px solid var(--fx-line, #e3e6ec);
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--fx-ink2, #4a5160);
}
.fx-cash-in:hover { background: rgba(26, 158, 92, .08); border-color: rgba(26, 158, 92, .35); }
.fx-cash-out:hover { background: rgba(224, 75, 75, .08); border-color: rgba(224, 75, 75, .35); }

/* 方向 */
.fx-trade-dir {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.fx-dir-long,
.fx-dir-short {
  padding: 11px;
  border: 1.5px solid var(--fx-line, #e3e6ec);
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: var(--fx-ink2, #4a5160);
  transition: all .15s;
}
.fx-dir-long.is-on {
  background: rgba(224, 75, 75, .1);
  border-color: #e04b4b;
  color: #b91c1c;
}
.fx-dir-short.is-on {
  background: rgba(26, 158, 92, .1);
  border-color: #1a9e5c;
  color: #15803d;
}

/* 开仓按钮 */
.fx-open-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 9px;
  background: var(--fx-blue, #4078ff);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 12px;
  transition: opacity .15s;
}
.fx-open-btn:hover { opacity: .9; }
.fx-open-btn:disabled { background: #c8ccd4; cursor: not-allowed; }

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

/* 持仓 */
.fx-trade-positions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--fx-line, #e3e6ec);
}
.fx-trade-pos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fx-ink2, #4a5160);
}
.fx-quick {
  padding: 4px 11px;
  border: 1px solid var(--fx-line, #e3e6ec);
  border-radius: 6px;
  background: transparent;
  font-size: 11.5px;
  cursor: pointer;
  color: var(--fx-ink2, #4a5160);
}
.fx-quick:hover { background: rgba(64, 120, 255, .08); }

.fx-pos-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 11px;
  border-radius: 7px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.fx-pos-item:nth-child(odd) { background: rgba(0, 0, 0, .022); }
.fx-pos-item .fx-pos-top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  flex-wrap: wrap;
}
.fx-pos-item .fx-pos-tag {
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.fx-pos-tag.long { background: rgba(224, 75, 75, .12); color: #b91c1c; }
.fx-pos-tag.short { background: rgba(26, 158, 92, .12); color: #15803d; }
.fx-pos-item .fx-pos-meta {
  color: var(--fx-muted, #8b93a1);
  font-size: 11.5px;
  margin-top: 3px;
}
.fx-pos-close {
  padding: 5px 12px;
  border: 1px solid var(--fx-line, #e3e6ec);
  border-radius: 6px;
  background: transparent;
  font-size: 11.5px;
  cursor: pointer;
  color: #b91c1c;
}
.fx-pos-close:hover { background: rgba(224, 75, 75, .08); }

/* 深色模式 */
html[data-theme="dark"] .fx-trade-account > div { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .fx-pos-item:nth-child(odd) { background: rgba(255, 255, 255, .035); }
html[data-theme="dark"] .fx-cash-in,
html[data-theme="dark"] .fx-cash-out { border-color: rgba(255, 255, 255, .14); }


/* ═══ 移动端触控与字号（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-10）—— 避免被触控 min-height 规则撑变形 */
@media (max-width: 640px) {
  [id="themeBtn"],
  [class*="rn-theme"],
  [class*="fx-theme"] {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    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;
  }
}
