/*
 * HulbKK 训练台样式。
 *
 * 两条原则：
 *  1. 强调色只有一个（--accent），涨跌色只用在行情与盈亏上，不用来装饰。
 *     之前琥珀/青/珊瑚/紫四套强调色互相打架，界面没有主次。
 *  2. 图表是主角。其余面板一律降权：更低的对比、更小的面积、更少的边框。
 *
 * 涨跌方向遵循 A 股习惯：红涨绿跌。看盘的肌肉记忆反了会直接读错方向。
 */

:root {
  --bg: #0b0d0f;
  --surface: #14171a;
  --surface-2: #1a1e23;
  --raised: #1f242a;
  --line: #23282e;
  --line-soft: #1a1e23;

  --text: #e6e8ea;
  --text-dim: #8b949e;
  --text-faint: #5c666f;

  --accent: #4c8dff;
  --accent-dim: #2c4c85;

  --up: #e5484d;
  --up-soft: rgba(229, 72, 77, 0.16);
  --down: #30a46c;
  --down-soft: rgba(48, 164, 108, 0.16);
  --warn: #e8a33d;
  --warn-soft: rgba(232, 163, 61, 0.14);

  --radius: 10px;
  --radius-sm: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.legal-page { min-height: 100vh; padding: 36px 18px; background: var(--bg); color: var(--text); }
.legal-page main { width: min(760px, 100%); margin: 0 auto; line-height: 1.85; }
.legal-page h1 { margin: 18px 0 8px; font-size: 26px; }
.legal-page h2 { margin: 28px 0 6px; font-size: 16px; }
.legal-page p { color: var(--text-dim); font-size: 13px; }
.legal-page a { color: var(--accent); }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand { font-size: 15px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.brand span { margin-left: 9px; color: var(--text-faint); font-size: 12px; font-weight: 400; }

.session-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 12px;
}
.session-chip b { color: var(--text); font-family: var(--mono); font-weight: 500; }
.session-chip .sep { color: var(--line); }

.spacer { flex: 1; }

.conn { display: flex; align-items: center; gap: 12px; }
.conn label { display: flex; align-items: center; gap: 7px; color: var(--text-faint); font-size: 12px; }
.conn input {
  width: 168px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 11px;
}
.conn input:focus { outline: none; border-color: var(--accent-dim); }

.dot { display: inline-flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 12px; }
.dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}
.dot.on::before { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }

/* ---------------- 纪律条 ---------------- */

.discipline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--warn);
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  animation: chip-in .28s ease-out;
}
.discipline::before { content: "⚠"; font-size: 11px; }

@keyframes chip-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 新建训练 ---------------- */

.setup {
  max-width: 680px;
  margin: 9vh auto 0;
  padding: 0 20px;
}
.setup h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -.015em; }
.setup .lede { margin: 14px 0 0; max-width: 52ch; color: var(--text-dim); line-height: 1.75; }

.setup-card {
  margin-top: 30px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field { flex: 1 1 150px; display: flex; flex-direction: column; gap: 7px; }
.field span { color: var(--text-dim); font-size: 12px; }
.field select, .field input {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.field select:focus, .field input:focus { outline: none; border-color: var(--accent-dim); }

.btn {
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--raised); border-color: #2e343b; }
.btn-primary { border-color: transparent; background: var(--accent); color: #fff; font-weight: 500; }
.btn-primary:hover { background: #5f9aff; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.setup-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.setup-note { color: var(--text-faint); font-size: 12px; }

.history { margin-top: 26px; }
.history h2 { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.history-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
}
.history-row b { color: var(--text); font-weight: 500; }
.history-empty { color: var(--text-faint); font-size: 12px; }

/* ---------------- 训练台布局 ---------------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 14px;
  padding: 14px 18px 18px;
  height: calc(100vh - 52px);
}

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

/* 行情条 */
.quote-bar {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  padding: 2px 2px 0;
}
.quote-price { font-family: var(--mono); font-size: 27px; font-weight: 600; letter-spacing: -.02em; }
.quote-change { font-family: var(--mono); font-size: 13px; }
.quote-items { display: flex; gap: 18px; margin-left: auto; }
.quote-items div { display: flex; gap: 6px; align-items: baseline; }
.quote-items span { color: var(--text-faint); font-size: 11px; }
.quote-items b { font-family: var(--mono); font-size: 12px; font-weight: 500; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-dim); }

/* 图表 */
.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.chart-wrap canvas { display: block; width: 100%; height: 100%; }

.chart-tools { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 0 2px; }
.chart-tools button {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 11px;
  transition: background .12s, border-color .12s, color .12s;
}
.chart-tools button:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.chart-tools button[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(76, 141, 255, .13);
  color: #a8c8ff;
}
.chart-tools button:disabled { opacity: .35; cursor: not-allowed; }
.tool-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
.tool-note { margin-left: auto; color: var(--text-faint); font-size: 11px; }

.chart-wrap canvas { cursor: crosshair; }
.chart-wrap.grabbing canvas { cursor: grabbing; }
.chart-wrap.drawing canvas { cursor: cell; }

.chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
  color: var(--text-faint);
  font-size: 11px;
}
.chart-foot #viewRange { font-family: var(--mono); margin-left: auto; }
.foot-hint kbd { margin: 0 2px; }

/* 指标开关 */
.ind-chips { display: flex; gap: 4px; }
.ind-chips button {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  transition: color .12s, border-color .12s, background .12s;
}
.ind-chips button:hover { color: var(--text-dim); }
.ind-chips button[aria-pressed="true"] { color: var(--text); border-color: currentColor; }
.ind-chips button[data-overlay="ma5"][aria-pressed="true"] { color: #4c8dff; }
.ind-chips button[data-overlay="ma10"][aria-pressed="true"] { color: #e8a33d; }
.ind-chips button[data-overlay="ma20"][aria-pressed="true"] { color: #9aa5b1; }
.ind-chips button[data-overlay="boll"][aria-pressed="true"] { color: #a78bfa; }

.chip-sep { width: 1px; height: 14px; margin: 0 4px; background: var(--line); }
.ind-chips button[data-chan][aria-pressed="true"] { color: #d8b4fe; border-color: currentColor; }

/* 复盘面板 */
.review-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  z-index: 50;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -12px 0 40px rgba(0, 0, 0, .5);
  animation: slide-in .22s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.review-panel header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.review-panel header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.review-body { flex: 1; overflow-y: auto; padding: 16px; }
.review-body .field { margin-bottom: 11px; }
.review-actions { display: flex; gap: 8px; }
.review-hint { margin: 12px 0 0; color: var(--text-faint); font-size: 11px; line-height: 1.7; }
.review-body section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.review-body h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: var(--text-dim); }
.review-body h3 small { margin-left: 8px; color: var(--text-faint); font-weight: 400; }

.check-row { padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.check-row:last-child { border-bottom: none; }
.check-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.check-head b { font-weight: 500; }
.check-verdict { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.check-verdict.ok { color: var(--down); }
.check-verdict.bad { color: var(--up); }
.check-verdict.na { color: var(--text-faint); }
.check-row p { margin: 6px 0 0; padding-left: 10px; border-left: 2px solid var(--up); color: var(--text-dim); font-size: 11px; line-height: 1.7; }

.perf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.perf-col {
  display: flex; flex-direction: column; gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.perf-col span { color: var(--text-faint); font-size: 11px; }
.perf-col b { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.perf-col small { color: var(--text-faint); font-family: var(--mono); font-size: 10px; }
.perf-col.good { border-color: rgba(48, 164, 108, .4); }
.perf-col.good b { color: var(--down); }
.perf-col.bad { border-color: rgba(232, 163, 61, .45); }
.perf-col.bad b { color: var(--warn); }
.perf-verdict { margin: 11px 0 0; color: var(--text-dim); font-size: 12px; line-height: 1.75; }
.perf-note { margin: 6px 0 0; color: var(--text-faint); font-size: 11px; }
.warn { color: var(--warn); }

.lifetime { margin-top: 12px; padding: 10px 12px; border-left: 2px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-dim); font-size: 11px; line-height: 1.85; }
.lifetime b { color: var(--text); }
.lifetime i { color: var(--text-faint); font-style: normal; }

.struct-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px 14px; }
.struct-grid div { display: flex; flex-direction: column; gap: 2px; }
.struct-grid span { color: var(--text-faint); font-size: 11px; }
.struct-grid b { font-family: var(--mono); font-size: 12px; font-weight: 500; }

.ai-text { color: var(--text-dim); font-size: 12px; line-height: 1.85; white-space: pre-wrap; }
.ai-text.streaming::after {
  content: '▌';
  color: var(--accent);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 5, 6, .7);
}
.modal-card {
  width: min(560px, 92vw); max-height: 88vh; overflow-y: auto;
  padding: 22px 24px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
}
.modal-card h2 { margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.modal-card .field { margin-bottom: 14px; }
.modal-card textarea, .modal-card input {
  width: 100%; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); font-size: 12px; line-height: 1.6; resize: vertical;
}
.modal-card textarea:focus, .modal-card input:focus { outline: none; border-color: var(--accent-dim); }
.modal-actions { display: flex; gap: 9px; margin-top: 18px; }

.auth-card { width: min(460px, 92vw); }
.auth-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
  margin: -4px 0 18px; padding: 4px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg);
}
.auth-tabs button {
  padding: 7px 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-faint); font-size: 12px;
}
.auth-tabs button[aria-pressed="true"] { background: var(--raised); color: var(--text); }
.auth-code-row { display: flex; align-items: end; gap: 9px; }
.auth-code-row .field { margin-bottom: 14px; }
.auth-code-row > button { flex: 0 0 auto; margin-bottom: 14px; white-space: nowrap; }
.auth-hint { margin: 0; color: var(--text-faint); font-size: 11px; line-height: 1.7; }
.auth-consent { display: flex; align-items: flex-start; gap: 8px; color: var(--text-dim); font-size: 11px; line-height: 1.7; }
.auth-consent input { width: auto !important; margin-top: 2px; accent-color: var(--accent); }
.auth-consent a { color: var(--accent); }

.check-builder { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.check-opt { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-dim); }
.check-opt input[type="checkbox"] { accent-color: var(--accent); }
.check-opt input[type="number"] { width: 74px; padding: 4px 7px; font-family: var(--mono); font-size: 11px; }
.check-opt small { color: var(--text-faint); font-size: 10px; }

/* 副图页签 */
.sub-tabs {
  position: absolute;
  top: 7px; left: 9px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.sub-tabs button {
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  font-size: 10px;
  transition: color .12s, background .12s;
}
.sub-tabs button:hover { color: var(--text-dim); }
.sub-tabs button[aria-pressed="true"] { background: var(--raised); color: var(--text); }
.sub-tabs b { margin-left: 6px; font-family: var(--mono); font-size: 11px; font-weight: 500; }

.lock-badge {
  position: absolute;
  top: 10px; right: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(11, 13, 15, .78);
  color: var(--text-faint);
  font-size: 11px;
  pointer-events: none;
}

.readout {
  position: absolute;
  top: 10px; left: 12px;
  display: flex;
  gap: 13px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(11, 13, 15, .9);
  font-family: var(--mono);
  font-size: 11px;
  pointer-events: none;
}
.readout span { color: var(--text-faint); }
.readout b { font-weight: 500; margin-left: 4px; }

/* 副图 */
.sub-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; height: 132px; }
.sub-pane {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.sub-pane canvas { display: block; width: 100%; height: 100%; }
.sub-title {
  position: absolute;
  top: 8px; left: 11px;
  color: var(--text-faint);
  font-size: 11px;
  pointer-events: none;
}
.sub-title b { margin-left: 8px; font-family: var(--mono); font-weight: 500; }

/* ---------------- 侧栏 ---------------- */

.side { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.side::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.card h2 {
  margin: 0 0 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

/* 账户 */
.equity-value { font-family: var(--mono); font-size: 23px; font-weight: 600; letter-spacing: -.02em; }
.equity-sub { margin-top: 3px; font-family: var(--mono); font-size: 12px; }
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 12px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.stat-grid div { display: flex; flex-direction: column; gap: 2px; }
.stat-grid span { color: var(--text-faint); font-size: 11px; }
.stat-grid b { font-family: var(--mono); font-size: 12px; font-weight: 500; }

/* 进度 */
.progress-head {
  display: flex; justify-content: space-between; align-items: baseline;
  color: var(--text-faint); font-size: 11px;
}
.progress-head b { color: var(--text); font-family: var(--mono); font-size: 12px; font-weight: 500; }
.progress-track { height: 3px; margin-top: 7px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width .22s ease-out; }

/* 下单 */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.seg button {
  padding: 7px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 12px;
}
.seg button[aria-pressed="true"] { border-color: currentColor; }
.seg button.long[aria-pressed="true"] { color: var(--up); background: var(--up-soft); }
.seg button.short[aria-pressed="true"] { color: var(--down); background: var(--down-soft); }

.size-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 9px; }
.size-row button {
  padding: 6px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}
.size-row button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: rgba(76, 141, 255, .1); }

.trade-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 11px; }
.trade-btn {
  padding: 11px 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: filter .12s;
}
.trade-btn:hover:not(:disabled) { filter: brightness(1.12); }
.trade-btn small { display: block; margin-top: 2px; font-size: 10px; font-weight: 400; opacity: .72; }
.buy { background: var(--up-soft); border-color: rgba(229, 72, 77, .45); color: #ff8f92; }
.sell { background: var(--down-soft); border-color: rgba(48, 164, 108, .45); color: #57cf94; }

.advance-row { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 7px; margin-top: 7px; }
.advance-row .btn { padding: 8px 0; }
#playBtn[aria-pressed="true"] { border-color: var(--accent); color: #a8c8ff; background: rgba(76, 141, 255, .14); }

.keys div span:last-child { display: inline-flex; gap: 3px; }

.keys { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.keys div { display: flex; justify-content: space-between; padding: 2px 0; color: var(--text-faint); font-size: 11px; }
kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* 执行记录 */
.log { display: flex; flex-direction: column; gap: 1px; max-height: 178px; overflow-y: auto; }
.log-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 9px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.log-row time { color: var(--text-faint); font-family: var(--mono); font-size: 11px; }
.log-row em { font-style: normal; color: var(--text); }
.log-row b { font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--text-dim); }
.log-empty { color: var(--text-faint); font-size: 12px; line-height: 1.7; }

/* 笔记 */
.note textarea {
  width: 100%;
  min-height: 66px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  resize: vertical;
  font-size: 12px;
  line-height: 1.6;
}
.note textarea:focus { outline: none; border-color: var(--accent-dim); }
.note textarea::placeholder { color: var(--text-faint); }
.note-status { margin-top: 7px; color: var(--text-faint); font-size: 11px; }

/* 消息条 */
.message {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
  animation: chip-in .2s ease-out;
  z-index: 40;
}
.message.error { border-color: rgba(229, 72, 77, .5); color: #ff9296; }

/* ---------------- 揭晓幕布 ---------------- */

.reveal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 6, .74);
  backdrop-filter: blur(3px);
}

.curtain {
  position: absolute;
  top: 0; bottom: 0;
  width: 50.2%;
  background: linear-gradient(var(--surface-2), var(--surface));
  transition: transform .78s cubic-bezier(.62, .03, .2, 1);
  z-index: 2;
}
.curtain.left { left: 0; border-right: 1px solid var(--line); }
.curtain.right { right: 0; border-left: 1px solid var(--line); }
.reveal-overlay.open .curtain.left { transform: translateX(-100%); }
.reveal-overlay.open .curtain.right { transform: translateX(100%); }

.reveal-card {
  position: relative;
  z-index: 1;
  width: min(680px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  opacity: 0;
  transform: translateY(10px) scale(.985);
  transition: opacity .4s ease-out .42s, transform .4s ease-out .42s;
}
.reveal-overlay.open .reveal-card { opacity: 1; transform: none; }

.reveal-eyebrow { color: var(--text-faint); font-size: 12px; }
.reveal-card h2 { margin: 9px 0 0; font-size: 25px; font-weight: 600; letter-spacing: -.015em; }
.reveal-range { margin-top: 6px; color: var(--text-dim); font-family: var(--mono); font-size: 12px; }

.reveal-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line);
  overflow: hidden;
}
.reveal-stats div { padding: 12px; background: var(--surface-2); }
.reveal-stats span { display: block; color: var(--text-faint); font-size: 11px; }
.reveal-stats b { display: block; margin-top: 5px; font-family: var(--mono); font-size: 18px; font-weight: 600; }

/* 买入持有基准对比 */
.benchmark {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-dim);
}
.benchmark b { font-family: var(--mono); font-weight: 600; }
.benchmark .verdict { flex-basis: 100%; color: var(--text-faint); line-height: 1.7; }

.reveal-section { margin-top: 18px; }
.reveal-section h3 { margin: 0 0 9px; font-size: 12px; font-weight: 500; color: var(--text-dim); }

.fills-table { max-height: 176px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fills-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.fills-table th {
  position: sticky; top: 0;
  padding: 7px 9px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--text-faint);
  font-weight: 400;
  text-align: right;
}
.fills-table th:first-child, .fills-table td:first-child { text-align: left; }
.fills-table td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  text-align: right;
  color: var(--text-dim);
}
.fills-table tr:last-child td { border-bottom: none; }
.fills-table .empty { padding: 16px; color: var(--text-faint); text-align: center; font-family: var(--sans); }

/* 历史汇总 */
.history-summary {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 11px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.history-summary div { display: flex; flex-direction: column; gap: 3px; }
.history-summary span { color: var(--text-faint); font-size: 11px; }
.history-summary b { font-family: var(--mono); font-size: 15px; font-weight: 600; }

.reveal-note {
  margin-top: 16px;
  padding: 10px 13px;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.7;
}
.reveal-warning {
  margin-top: 14px;
  color: var(--warn);
  font-size: 12px;
  line-height: 1.7;
}
.reveal-actions { display: flex; gap: 9px; margin-top: 20px; }

@media (prefers-reduced-motion: reduce) {
  .curtain, .reveal-card, .progress-fill, .discipline, .message { transition: none; animation: none; }
  .curtain { display: none; }
}

@media (max-width: 1080px) {
  .stage { grid-template-columns: 1fr; height: auto; }
  .side { flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .side .card { flex: 1 1 240px; }
  .chart-wrap { height: 380px; flex: none; }
}

/* 结构面板的说明文字：级别差异必须写在界面上，光靠两个数字读不出轻重 */
.struct-note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-faint);
}

/* ── 实时进场判读 ──────────────────────────────────────────────
   配色上刻意**不用红绿**。A 股习惯里红 = 涨 = 好，拿红色标「违反规则」
   会和用户脑子里的映射直接打架——看到红的第一反应是"涨"而不是"错"。
   所以判定用蓝（通过）与琥珀（警示），红绿只留给行情与盈亏。 */
#adviceCard h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#adviceStrategy {
  flex: 0 1 auto;
  max-width: 58%;
  font-size: 11px;
  padding: 3px 6px;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.advice-verdict {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-dim);
}
.advice-verdict.ok {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: rgba(76, 141, 255, 0.1);
}
.advice-verdict.bad {
  color: var(--warn);
  border-color: rgba(232, 163, 61, 0.4);
  background: var(--warn-soft);
}

.advice-rules {
  list-style: none;
  margin: 9px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.advice-rules li {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  font-size: 11px;
  line-height: 1.5;
}
.advice-rules i {
  font-style: normal;
  font-family: var(--mono);
  flex: 0 0 12px;
  text-align: center;
  padding-top: 1px;
}
.advice-rules li.ok i { color: var(--accent); }
.advice-rules li.bad i { color: var(--warn); }
.advice-rules li.na i { color: var(--text-faint); }
.advice-rules b {
  display: block;
  font-weight: 500;
  color: var(--text);
}
.advice-rules li.na b { color: var(--text-dim); }
.advice-rules span {
  display: block;
  color: var(--text-faint);
}

.advice-invalid {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  line-height: 1.55;
}
.advice-invalid .k {
  color: var(--text-faint);
  margin-right: 7px;
}
.advice-invalid b {
  font-family: var(--mono);
  color: var(--warn);
  font-size: 13px;
}
.advice-invalid .none {
  color: var(--text-dim);
  font-family: var(--mono);
}
.advice-invalid i {
  display: block;
  margin-top: 3px;
  font-style: normal;
  color: var(--text-faint);
}

.advice-context {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.advice-context div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
}
.advice-context span { color: var(--text-faint); flex: 0 0 auto; }
.advice-context b {
  font-family: var(--mono);
  font-weight: 400;
  color: var(--text-dim);
  text-align: right;
}

.advice-foot {
  margin: 10px 0 0;
  font-size: 10px;
  line-height: 1.55;
  color: var(--text-faint);
}
.advice-foot b { color: var(--text-dim); font-weight: 600; }

/* AI 判读的输出区。等宽 + 保留换行：模型会用 T+N 和数字，
   等宽字体下这些能对齐着读。 */
.advise-ai {
  margin-top: 9px;
  padding: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-height: 340px;
  overflow-y: auto;
}
.advise-ai pre {
  margin: 0;
  font-family: var(--sans);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.advise-ai pre.streaming::after {
  content: '▋';
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

/* ── 建局模式（双盲随机 / 自己选） ───────────────────────────── */
.mode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.seg-mode {
  flex: 0 0 auto;
  width: 220px;
}
.mode-note {
  flex: 1 1 260px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-faint);
}
.field-wide { flex: 2 1 260px; }

#pickSymbol,
#pickFrom {
  font-family: var(--mono);
}
/* 深色主题下日期选择器的原生图标默认是黑的，看不见 */
#pickFrom::-webkit-calendar-picker-indicator { filter: invert(0.7); }

/* 自选局的长期战绩压暗一档：它和双盲局不是同一种证据，
   视觉上就要能看出主次，不能并排摆成两个平等的数字 */
.life-picked {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--text-faint);
}
.life-picked b { color: var(--text-dim); }
