/* ============================================================
 *  焦炭 15 分钟 K 线可视化 · 样式表
 * ------------------------------------------------------------
 *  职责：与 index.html + kline_app.js 配套，承载全部视觉样式（无 CSS 框架）。
 *  分区顺序（自上而下）：
 *    1. 设计变量（:root）—— 颜色 / 边框 / 强调色
 *    2. 基础重置与全局（*、html/body、页面栅格）
 *    3. 头部与 K 线图例
 *    4. 侧栏通用组件（标题、分组、按钮、提示、toast）
 *    5. 导航 Tab 与面板容器
 *    6. 行情策略面板（数据区间、策略类型、强调卡、交易所筛选、行情总览列表）
 *    7. 策略报告面板（账户资金、KPI 指标、交易明细表、分页、调参提示）
 *    8. 全屏欢迎层
 *  配色约定：红(#e63946)=涨/盈利，绿(#2ecc71)=跌/亏损；橙(#ff8a45)=交互强调。
 * ============================================================ */

:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --surface: #11161f;
  --surface-2: #161c28;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e8edf4;
  --muted: #9aa6b8;
  --dim: #69748a;
  --accent-a: #e63946;
  --accent-b: #ff8a45;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  overflow-x: auto;   /* 主界面 min-width:900px 撑开 body 后，允许横向滚动查看完整布局 */
  overflow-y: hidden;
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: .2px;
}

/* 页面布局：左列 = header(上) + chart-area(下)；右列 = sidebar 贯通到顶 */
body {
  display: grid;
  grid-template-columns: 1fr 324px;
  grid-template-rows: auto 1fr;
  height: 100vh;
  min-width: 1024px;  /* 主界面最小宽度：窄于 1024px 时横向滚动而非布局错乱，与欢迎页拦截阈值一致 */
  /* 整个页面背景图 + 半透明压暗层：直接叠加进 body 背景（非 ::before 伪元素），
     避免 fixed 伪元素 z-index:-1 被 body 背景图盖住的层级陷阱 */
  background:
    linear-gradient(rgba(11, 14, 20, 0.92), rgba(11, 14, 20, 0.92)),
    url('quant-bg.jpg') center -50px / cover no-repeat;
  background-attachment: fixed;
}

/* ---- 左面板头部：标题 + 图例（独立一格，不跨列，不固定） ---- */
.header {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 13.5px 18px;
  min-width: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), rgba(11, 14, 20, 0.5);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.header .title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.header h1 {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 20px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: .5px;
  white-space: nowrap;
}

.header .info {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: .3px;
}

/* K 线图例：与 K 线图同一层级，置于图表上方独立成行（不再悬浮覆盖） */
#series-legend {
  position: static;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  align-self: flex-start;
  padding: 8px 12px 2px;
}

.series-chip {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  transition: background .15s, color .15s;
  gap: 6px;
  border: 1px solid transparent;
}

.series-chip:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.series-chip.off {
  color: var(--dim);
  text-decoration: line-through;
}

.series-chip .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
  font-size: 7px;
  line-height: 1;
}

.legend-note {
  display: inline-flex;
  align-items: center;
  height: 26px;
  color: var(--dim);
  font-size: 11.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- 右面板头部：tab 导航（独立一格，与左头部同行等高） ---- */
.topbar {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: stretch;
  background: rgba(11, 14, 20, 0.5);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ---- Chart ---- */
.chart-area {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  position: relative;
}

#chart {
  flex: 1;
  width: 100%;
  min-height: 0;
  position: relative;
}

/* ---- Sidebar rail ---- */
.sidebar {
  grid-column: 2;
  grid-row: 2;
  background: rgba(11, 14, 20, 0.72);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sb-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

/* 回测面板三个标题与「策略类型」统一视觉：左橙条 + 白字。
   用 ::before 伪元素加橙条，绝不动 .sb-group 选择器，避免表单崩坏。 */
#panel-backtest .sb-title {
  position: relative;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .5px;
  text-transform: none;
  padding-left: 10px;
}
#panel-backtest .sb-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  bottom: 1px;
  width: 2px;
  background: var(--accent-b);
  border-radius: 1px;
}

.sb-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px 11px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.sb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.sb-row input {
  width: 98px;
  background: #0d1119;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  padding: 7px 11px;
  border-radius: 6px;
  text-align: right;
  transition: border-color .15s, box-shadow .15s;
}

.sb-row input:focus {
  outline: none;
  border-color: var(--accent-b);
  box-shadow: 0 0 0 3px rgba(255, 138, 69, 0.12);
}

.run-btn {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: block;
  width: 100%;
  cursor: pointer;
  margin-top: 16px;
  padding: 12px 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 3px;
  box-shadow: 0 8px 22px rgba(230, 57, 70, 0.22);
  transition: filter .15s, transform .1s;
}

.run-btn:hover {
  filter: brightness(1.06);
}

.run-btn:active {
  transform: translateY(1px);
}

.run-btn:disabled {
  filter: grayscale(0.6) brightness(0.7);
  cursor: default;
  box-shadow: none;
}

.zone-stat {
  font-size: 12.5px;
  color: var(--muted);
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  line-height: 1.6;
  transition: background .2s, border-color .2s;
}

.zone-stat b {
  color: var(--text);
  font-weight: 600;
}

.zone-stat b.up {
  color: var(--accent-a);
}

.zone-stat b.dn {
  color: #2ecc71;
}

.zone-stat.flash {
  animation: zoneFlash .7s ease;
}

@keyframes zoneFlash {
  0% {
    background: rgba(90, 200, 250, 0.22);
    border-color: rgba(90, 200, 250, 0.55);
    box-shadow: 0 0 0 3px rgba(90, 200, 250, 0.14);
  }

  100% {
    background: rgba(255, 255, 255, 0.025);
    border-color: var(--border);
    box-shadow: none;
  }
}

/* toast：页面垂直居中，1 秒后淡出 */
#toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(-8px);
  background: rgba(17, 22, 31, 0.96);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 9999;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0);
}

.sb-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* panel-market 顶部说明块与上方内容拉开大间距 */
.sb-block.note-block {
  margin-top: 30px;
}

#panel-backtest {
  min-height: 100%;
  gap: 16px;
}

.sb-note {
  font-size: 12px;
  line-height: 1.7;
  color: var(--dim);
  padding: 5px 2px 0;
}

.sb-note b {
  color: var(--muted);
  font-weight: 600;
}

/* 导航 tab：顶部导航条，当前项底部高亮 */
.tabs {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  position: relative;
}

.tab {
  cursor: pointer;
  padding: 0 24px;
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--dim);
  font-size: 14px;
  font-weight: 600;
  border-radius: 0;
  transition: color .15s;
  position: relative;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
}

.tab:hover {
  color: var(--muted);
}

.tab.active {
  color: var(--text);
  background: transparent;
}

.tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
}

.tab.active span::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  border-radius: 1px 1px 0 0;
}

.sb-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sb-panel[hidden] {
  display: none;
}

/* 行情策略：右侧面板撑满侧栏高度，底部「进入策略」按钮吸底（样式复用 .run-btn） */
.sb-panel#panel-market {
  flex: 1 1 auto;
  min-height: 0;
  padding-top: 0;
}

.dt-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.dt-summary .dt-cell {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
}
.dt-summary .dt-l { flex: none; font-size: 12px; color: var(--muted); font-weight: 400; }
.dt-summary .dt-v { flex: 1 1 auto; font-size: 12px; color: var(--text); font-weight: 400; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-sec {
  display: flex;
  align-items: baseline;
  margin-top: 24px;
  padding-left: 8px;
  border-left: 2px solid var(--accent-b);
}
.dt-sec-t { font-size: 12.5px; font-weight: 600; color: var(--text); letter-spacing: .5px; }
.dt-grid.w3 { grid-template-columns: 1fr 1fr 1fr; }

.dt-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 18px; font-weight: 700; color: var(--text); margin-top: 30px;
}
.dt-code { font-size: 14px; color: var(--muted); font-weight: 400; }
.dt-tag {
  font-size: 11px; color: #ffd700; background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.4); border-radius: 6px; padding: 1px 7px; font-weight: 600;
}
.dt-note { margin-top: 8px; font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.dt-sub {
  margin-top: 14px; font-size: 12px; color: var(--muted); letter-spacing: .6px;
  border-left: 2px solid var(--accent-b); padding-left: 8px;
}
.dt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 11px; }

/* 策略类型选择（打勾单选，当前选中项复用 dt-summary 朴素卡片风格） */
.strat-list { display: flex; flex-direction: column; gap: 10px; margin-top: 11px; }
.strat-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.strat-item:hover { border-color: rgba(255, 255, 255, 0.15); }
/* 橙腔强调卡（accent-card）：左侧 3px 加粗橙色竖条 + 橙色渐变底，用于"当前选中"强调；下次直接说此名即可复用 */
.strat-item.on,
.accent-card {
  background: linear-gradient(90deg, rgba(255, 176, 46, 0.10), rgba(255, 138, 69, 0.03));
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-b);
}
.strat-item.on .strat-name { color: var(--accent-b); font-weight: 700; }
.strat-item .mi-check { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.strat-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.strat-name { font-size: 14px; color: var(--text); font-weight: 400; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strat-item.on .strat-name { color: var(--text); }
.strat-desc { font-size: 11.5px; color: var(--dim); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 红腔强调卡（accent-card.red）：accent-card 的红色系变体，用于策略报告「累计收益/年化收益」等正向收益 KPI 强调；与数字红色 #e63946 保持一致 */
/* 注：.report-metrics .kpi 特异性相同且定义靠后，会覆盖背景/边框，故加 .kpi.accent-card.red 提高特异性 */
.accent-card.red,
.report-metrics .kpi.accent-card.red {
  background: linear-gradient(90deg, rgba(230, 57, 70, 0.12), rgba(230, 57, 70, 0.03));
  border: 1px solid rgba(230, 57, 70, 0.35);
  border-left: 3px solid #e63946;
}
.accent-card.red span,
.accent-card.red b,
.report-metrics .kpi.accent-card.red span,
.report-metrics .kpi.accent-card.red b { color: #e63946; }

.dt-cell {
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(255, 255, 255, 0.025); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px;
}
.dt-l { font-size: 11px; color: var(--muted); }
.dt-v { font-size: 14px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dt-v.up { color: #e63946; }
.dt-v.dn { color: #2ecc71; }

.sb-hint {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--dim);
  padding: 2px 2px;
}

/* 策略报告：右上首行「账户总资金 / 初始资金」大数字（两个并列、样式完全一致） */
.report-capitals {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-capital {
  flex: none;
  width: 100%;
  background: linear-gradient(180deg, var(--surface-2), #0f1420);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.report-capital .cap-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .6px;
}

.report-capital b {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* 策略报告区：整体可垂直滚动，不再把上下两部分钉死在视口 */
.report-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
}

.report-area[hidden] {
  display: none;
}

.market-area[hidden] {
  display: none;
}

.report-top {
  flex: none;
  height: 380px;
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.report-chart {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* 资金曲线揭幕动画：从左到右擦除显示（与 ECharts 内部动画解耦，必定可见） */
@keyframes reportWipe {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

/* 策略报告：KPI 指标网格（两列；.accent-card / .accent-card.red 为强调变体） */
.report-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

#panel-report .sb-hint {
  margin-top: 12px;
}

.report-metrics .kpi {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.report-metrics .kpi span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .3px;
}

.report-metrics .kpi b {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.report-bottom {
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.report-subtabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  gap: 4px;
}

.subtab {
  flex: none;
  cursor: pointer;
  padding: 12px 17px;
  border: none;
  background: transparent;
  color: var(--dim);
  font-size: 13px;
  font-weight: 600;
  border-radius: 0;
  transition: color .15s;
  position: relative;
  letter-spacing: .5px;
}

.subtab:hover {
  color: var(--muted);
}

.subtab.active {
  color: var(--text);
}

.subtab.active::after {
  content: '';
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  border-radius: 3px;
}

.trade-wrap {
  flex: none;
  overflow: visible;
  min-height: 0;
}

table.trades {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #c5cfde;
}

table.trades th {
  position: sticky;
  top: 0;
  background: #0f1420;
  color: var(--muted);
  font-weight: 500;
  padding: 12px 15px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
  z-index: 2;
}

table.trades td {
  padding: 12px 15px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

table.trades tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

/* 点击曲线圆点 → 定位到「交易明细」对应行并高亮（圆点↔明细一一对应） */
tr.row-flash td {
  animation: rowFlash 1.6s ease;
}

@keyframes rowFlash {
  0% {
    background: rgba(255, 215, 0, 0.55);
  }

  60% {
    background: rgba(255, 215, 0, 0.30);
  }

  100% {
    background: transparent;
  }
}

.dir-long {
  color: #e63946;
  font-weight: 600;
}

.dir-short {
  color: #2ecc71;
  font-weight: 600;
}

.pnl-pos {
  color: #e63946;
}

.pnl-neg {
  color: #2ecc71;
}

.pager {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}

.pager button {
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 12px;
  transition: background .15s;
}

.pager button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pager .pg-info {
  min-width: 120px;
  text-align: center;
}

/* 调参区：实时手数预览提示 */
.sb-hint {
  margin: 4px 2px 2px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.5;
  color: #9aa6b8;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 5px;
  border-left: 2px solid #3a4456;
}

.sb-hint.warn {
  color: #ffd479;
  background: rgba(255, 196, 0, 0.08);
  border-left-color: #ffc400;
}

/* 策略报告：无交易警告黄条 */
.empty-warn {
  margin: 0 0 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #ffd479;
  background: rgba(255, 196, 0, 0.10);
  border: 1px solid rgba(255, 196, 0, 0.35);
  border-radius: 8px;
}

.empty-warn[hidden] {
  display: none;
}

/* ===== 全屏欢迎层 ===== */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.6s ease;
}

.welcome.hide {
  opacity: 0;
  pointer-events: none;
}

.welcome-bg {
  position: absolute;
  inset: 0;
  background: url('quant-bg.jpg') center / cover no-repeat;
  background-color: #0b0e14;
}

.welcome-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.5);
}

.welcome-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
  animation: welcomeIn 0.9s ease both;
}

@keyframes welcomeIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-title {
  margin: 0;
  font-size: clamp(34px, 6vw, 68px);
  font-weight: 400;
  color: #ffffff;
}

.welcome-sub {
  margin: 16px 0 38px;
  font-size: clamp(13px, 1.6vw, 17px);
  letter-spacing: 3px;
  color: #c7d0de;
}

.welcome-enter {
  cursor: pointer;
  padding: 13px 46px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #fff;
  /* 与「智能回测」按钮一致 */
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(230, 57, 70, 0.22);
  transition: filter .15s, transform .1s;
}

.welcome-enter:hover {
  filter: brightness(1.06);
}

.welcome-enter:active {
  transform: translateY(1px);
}

/* ---- 移动端拦截提示 ---- */
.mobile-tip {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 11, 18, 0.97);
}

.mobile-tip-card {
  max-width: 360px;
  width: 100%;
  text-align: center;
  padding: 44px 30px 40px;
  background: #141925;
  border: 1px solid #2a3342;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: welcomeIn 0.6s ease both;
}

.mobile-tip-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 22px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #0b0e14;
  background: linear-gradient(90deg, #ffb84d, #e63946);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(230, 57, 70, 0.25);
}

.mobile-tip-title {
  margin: 0 0 16px;
  font-size: 21px;
  font-weight: 600;
  color: #ffffff;
}

.mobile-tip-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #c7d0de;
}

/* ---- 行情策略：行情总览 ---- */
.market-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 16px 18px 26px;
  box-sizing: border-box;
}
.market-filters {
  display: flex;
  flex-direction: column;
  gap: 11px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border, #2a3447);
}
.filter-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 9px;
}
/* 交易所筛选按钮：两行（名字+字母 / 定位小字），加大且等高 */
.exch-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  height: 72px;
  padding: 0 16px;
  min-width: 0;
  text-align: left;
  line-height: 1.3;
}
/* 交易所排铺满整行：每个按钮均分宽度 */
#filterExch { width: 100%; gap: 10px; }
#filterExch .fchip { flex: 1 1 0; min-width: 0; text-align: left; }
.exch-name { font-size: 14px; font-weight: 600; color: #e6ecf5; }
.exch-code { font-size: 11px; color: #8b97a8; font-weight: 500; letter-spacing: 0.5px; }
.exch-chip.on .exch-name { color: var(--accent-b); }
.exch-chip.on .exch-code { color: var(--accent-b); }
.exch-pos { font-size: 11px; color: #8b97a8; white-space: normal; }
.exch-chip.on .exch-pos { color: var(--accent-b); }
/* 交易所选中详情卡 */
.exch-detail {
  display: none;
  margin-top: 14px;
  padding: 12px 15px;
  background: linear-gradient(90deg, rgba(255, 138, 69, 0.10), rgba(255, 138, 69, 0.03));
  border: 1px solid var(--border, #2a3447);
  border-radius: 10px;
}
.exd-head { display: flex; align-items: baseline; gap: 8px; font-size: 15px; font-weight: 700; color: #fff; }
.exd-code { font-size: 12px; color: var(--accent-b); font-weight: 600; }
.exd-full { font-size: 12px; color: #8b97a8; font-weight: 400; }
.exd-pos { margin-top: 5px; font-size: 12.5px; color: #c3ccda; }
.exd-vars { margin-top: 9px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.exd-label { font-size: 12px; color: #8b97a8; margin-right: 2px; }
.exd-var {
  font-size: 12px; color: #e6ecf5;
  padding: 3px 9px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border, #2a3447);
}
/* 筛选后列表为空提示 */
.market-empty { padding: 30px 10px; text-align: center; color: #8b97a8; font-size: 13px; }
/* 交易所 / 数据状态 文字标签已不渲染（仅保留筛选按钮与选中详情卡） */
.fchip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, #2a3447);
  color: #c3ccda;
  font-size: 12.5px;
  padding: 5px 13px;
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.fchip:hover { border-color: rgba(255, 138, 69, 0.45); color: #fff; }
.fchip.on {
  background: rgba(255, 138, 69, 0.14);
  border-color: var(--accent-b);
  color: var(--accent-b);
  font-weight: 600;
}
.market-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.market-item {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
  border-radius: 12px;
  transition: border-color .15s, background .15s;
}
.market-item.selected {
  border-color: rgba(255, 138, 69, 0.7);
  background: linear-gradient(135deg, rgba(255, 138, 69, 0.16), rgba(255, 138, 69, 0.05));
  box-shadow: 0 0 0 1px rgba(255, 138, 69, 0.3) inset, 0 6px 22px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.market-item:not(.no-data) { cursor: pointer; }
.market-item.no-data { opacity: 0.82; }
.market-item.no-data .mi-head b { color: #d8dde4; }
.market-item.no-data .mi-code { color: #a6b2c3; }
.market-item.no-data .spark-empty { color: #9aa6b8; border-color: rgba(255, 255, 255, 0.20); }
.market-item.no-data .stat-muted { color: #9aa6b8; }
.mi-check {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-b); font-size: 14px; font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
}
.mi-check.on { border-color: rgba(255, 138, 69, 0.7); background: rgba(255, 138, 69, 0.15); }
.mi-head {
  flex: none;
  width: 128px;
  display: flex; flex-direction: column; gap: 3px;
}
.mi-head b { font-size: 17px; color: #f5f5f7; font-weight: 700; }
.mi-code { font-size: 12px; color: #8b97a8; }
.mi-years {
  flex: none;
  min-width: 84px;
  align-self: center;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #f5f5f7;
  white-space: nowrap;
}
.mi-years.years-muted { color: #8b97a8; }
.mi-spark {
  flex: 3 1 260px;
  min-width: 220px;
  max-width: 340px;
  height: 48px;
  display: flex; align-items: center;
}
.spark { display: block; will-change: clip-path; }
/* 进入行情页时，各列表缩略图从左向右「生长」展开（stagger 瀑布式） */
@keyframes sparkGrow {
  from { -webkit-clip-path: inset(0 100% 0 0); clip-path: inset(0 100% 0 0); opacity: .25; }
  to   { -webkit-clip-path: inset(0 0 0 0);     clip-path: inset(0 0 0 0);     opacity: 1; }
}
.spark-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #6b7280;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}
.mi-stats {
  flex: 1 1 300px;
  min-width: 240px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px 14px;
}
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat-l { font-size: 11px; color: #7d8aa0; }
.stat-v { font-size: 13px; color: #e8edf4; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-v.up { color: #e63946; }
.stat-v.dn { color: #2ecc71; }
.stat-muted { font-size: 12px; color: #6b7280; }