:root {
  color-scheme: dark;
  --ink: #e8ecf3;
  --muted: #9aa7bd;
  --line: #313c52;
  --panel: #222b3d;
  --card: #1a2233;
  --bg: #121826;
  --accent: #5b8def;
  --accent-soft: #26334d;
  --positive: #ff7b72;
  --negative: #56d364;
  --radius: 8px;
  /* 图表颜色（Canvas 通过 getComputedStyle 读取） */
  --chart-up: #ff7b72;
  --chart-down: #56d364;
  --chart-text: #9aa7bd;
  --chart-grid: #2b3548;
  --chart-axis: #46536c;
  --chart-line: #5b8def;
  --chart-ma: #e3b341;
  --chart-ma5: #8b97ab;
  --chart-ma20: #a78bfa;
  --chart-cost: #f0883e;
  --chart-cost-text: #f0883e;
  --chart-divider: #38445c;
  --chart-fill: #1a2233;
  --glow-1: rgba(70, 121, 246, .16);
  --glow-2: rgba(139, 107, 246, .12);
}



* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { overflow: hidden; color: var(--ink); font-family: system-ui, sans-serif; line-height: 1.5; }
/* 根元素底色与星空同色（深空黑）：任何层级失配时露出的都是夜空，而不是主题深蓝 */
html { background: #04060c; }
/* 全屏应用式布局：每个视图都是独立的全屏滚动容器，滚动条位置恒定不跳动。
   视图保持透明底——星空层贯穿所有页面；揭示过渡期间由路由层保证其余视图已退场 */
.app-view { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; background: transparent; isolation: isolate; }
/* 旧的网格/光晕底图已删除：主界面背景 = 星空贯穿 */
.view-body { padding: 0 1.25rem 0; }
h1 { margin: 1.5rem 0 .5rem; }
h2 { margin-top: 0; }
label { display: block; margin-top: 1rem; font-weight: 600; }
input, textarea, select, button { box-sizing: border-box; width: 100%; margin-top: .35rem; padding: .65rem; font: inherit; border-radius: var(--radius); color: var(--ink); background: var(--card); border: 1px solid var(--line); }
textarea { min-height: 8rem; resize: vertical; }
button { cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 700; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: not-allowed; }
section { margin-top: 1.5rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
details { margin-top: .75rem; background: var(--panel); padding: .75rem; border-radius: var(--radius); }
summary { cursor: pointer; font-weight: 600; }
.verdict { font-size: 1.35rem; font-weight: 700; }
.status-hint { font-size: .92rem; color: var(--muted); }
.status-hint.loading { color: var(--accent); }
.status-hint.success { color: var(--negative); }
.status-hint.error { color: var(--positive); }
.status-hint.empty { color: var(--muted); }
.simulation-actions { display: grid; gap: .85rem; }
.trade-group { border: 1px solid var(--line); padding: .75rem; background: var(--panel); border-radius: var(--radius); }
.trade-group h3 { margin: 0; }
.trade-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.trade-cap { color: var(--muted); font-size: .82rem; }
.trade-buttons { display: grid; grid-template-columns: repeat(5, 1fr); gap: .45rem; }
.trade-buttons button { margin-top: 0; }
.simulation-dashboard { display: none; }
.price-display { margin: 1.25rem 0 .5rem; font-size: clamp(2.8rem, 10vw, 5.5rem); font-weight: 800; line-height: 1; letter-spacing: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.price-change { font-weight: 700; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.pnl-line { margin: .25rem 0 .5rem; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.price-reference { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); }
.chart-tabs { display: flex; gap: .45rem; margin: .75rem 0 .35rem; }
.chart-tab { width: auto; margin-top: 0; padding: .35rem 1.1rem; background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.chart-tab.active { background: var(--accent); border-color: var(--accent); color: white; font-weight: 700; }
.price-chart { height: 240px; margin: 1rem 0 .75rem; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); }
.price-chart canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.simulation-meta { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; color: var(--muted); }
.simulation-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: 1rem 0; }
.speed-row { display: flex; align-items: center; gap: .65rem; margin: .75rem 0 .35rem; font-size: .88rem; color: var(--muted); }
.speed-tabs { display: flex; gap: .45rem; }
.speed-tab { width: auto; margin-top: 0; padding: .3rem .95rem; background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.speed-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.speed-total { margin-left: auto; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.simulation-metric { background: var(--panel); padding: .7rem; min-width: 0; border-radius: var(--radius); }
.simulation-metric small { display: block; color: var(--muted); }
.simulation-metric strong { display: block; margin-top: .2rem; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.simulation-history { width: 100%; border-collapse: collapse; margin-top: 0; font-size: .9rem; }
/* 进行中会话的「继续 / 结束上次」按钮组 */
.resume-row { display: flex; gap: .6rem; margin: .5rem 0 0; }
.resume-row button { flex: 1; margin-top: 0; }
.resume-hint { margin: 0 0 .45rem; color: var(--muted); font-size: .85rem; }
/* 成本线显示开关（右侧指标区下方） */
.costline-toggle { display: flex; align-items: center; gap: .5rem; margin: .55rem 0 0; font-size: .88rem; font-weight: 400; color: var(--ink); cursor: pointer; }
.costline-toggle input { width: auto; margin: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
/* 通用二次确认框按钮组 */
.confirm-actions { display: flex; gap: .6rem; margin-top: 1.1rem; }
.confirm-actions button { flex: 1; margin-top: 0; }
.simulation-history th, .simulation-history td { border-bottom: 1px solid var(--line); padding: .45rem; text-align: left; }
/* 操作记录固定表头：滚动时钉在容器顶部；bg 必须不透明（压住滚过的行），
   collapse 模式下单元格边框不跟随 sticky，分隔线改用内阴影画 */
.simulation-history thead th { position: sticky; top: 0; z-index: 1; background: var(--card); box-shadow: inset 0 -1px 0 var(--line); }
.simulation-history thead th:first-child { border-top-left-radius: calc(var(--radius) - 1px); }
.simulation-history thead th:last-child { border-top-right-radius: calc(var(--radius) - 1px); }
/* 操作记录：固定约 5 条高度，超出滚动查看 */
.history-scroll { max-height: 11.5rem; overflow-y: auto; margin-top: .75rem; border: 1px solid var(--line); border-radius: var(--radius); }
.op-buy { color: var(--positive); font-weight: 700; }
.op-sell { color: var(--accent); font-weight: 700; }
.judge-point { display: grid; gap: .35rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.judge-point:first-child { border-top: 0; padding-top: 0; }
.day-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.day-actions button { flex: 1; }
.pre-market-modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 1rem; background: rgba(23, 32, 51, .42); }
.pre-market-dialog { width: min(100%, 26rem); padding: 1.5rem; background: var(--card); border: 1px solid var(--line); box-shadow: 0 1rem 3rem rgba(0, 0, 0, .25); text-align: center; border-radius: var(--radius); }
.pre-market-dialog h3 { margin-top: 0; }
.pre-market-dialog button { margin-top: .75rem; }
.pre-market-countdown { color: var(--muted); }
.assessment-panel { margin-top: 1rem; }
.assessment-progress-row { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); }
.assessment-question-card { margin-top: .75rem; padding: 1rem; border: 1px solid var(--line); background: var(--panel); }
.assessment-scenario { color: var(--muted); }
.assessment-options { display: grid; gap: .55rem; }
.assessment-option { margin-top: 0; text-align: left; background: var(--card); }
.assessment-option.selected { border-color: var(--accent); background: var(--accent-soft); }
/* 选项不靠 hover/focus 变边框，避免换题后同一位置“残留”高亮 */
.assessment-option:hover:not(.selected) { border-color: var(--line); background: var(--panel); }
.assessment-option:focus:not(:focus-visible) { outline: none; }
.assessment-navigation { display: flex; gap: .6rem; margin-top: .75rem; }
.assessment-navigation button { flex: 1; }
.assessment-result-list { display: grid; gap: .6rem; }
.assessment-result-item { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: .7rem; border: 1px solid var(--line); background: var(--panel); }
.assessment-result-item small { grid-column: 1 / -1; color: var(--muted); }
.assessment-disclaimer { color: var(--muted); font-size: .9rem; }
.assessment-history { margin-top: .75rem; }
.history-score-row { display: flex; align-items: center; gap: .75rem; padding: .35rem 0; border-top: 1px solid var(--line); font-size: .88rem; }
.history-score-row > span:first-child { min-width: 8.5rem; }
.history-score-row strong { min-width: 4.6rem; text-align: right; }
.result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.result-head h3 { margin: 0; }
.score-hint { margin: 0; color: var(--muted); font-size: .88rem; }
.profile-updated { color: var(--muted); font-size: .85rem; }
.profile-center-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.4fr); gap: 1rem; }
.profile-source-panel, .profile-source-card { border: 1px solid var(--line); background: var(--panel); padding: .85rem; }
.profile-radar-chart { display: block; width: min(100%, 320px); height: 280px; margin: 0 auto; }
.profile-source-list { display: grid; gap: .7rem; }
.profile-source-card h4 { margin: 0; }
.profile-source-card p { color: var(--muted); margin: .3rem 0 .7rem; }
.profile-source-card small { display: block; color: var(--muted); margin-bottom: .6rem; }
/* 画像行：左侧名称 中间进度条 右侧数字（名称列宽以完整容纳最长维度名+i 提示钮，进度条保持对齐） */
.profile-bar-row { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr) 4.5rem; align-items: center; gap: .65rem; padding: .4rem 0; border-top: 1px solid var(--line); font-size: .86rem; }
.profile-bar-row > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-bar-row .meter { width: 100%; }
.profile-bar-row strong { text-align: right; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.profile-bar-name { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; }
.profile-bar-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-bar-row .info-tip { width: 1.15rem; height: 1.15rem; min-width: 1.15rem; flex: none; margin: 0; font-size: .72rem; }
/* 容器过窄（数据整合结果侧栏中窗格 / 手机端）时改两行：第一行维度名，第二行进度条+百分数 */
.profile-source-panel, .profile-source-card { container-type: inline-size; }
@container (max-width: 27rem) {
  .profile-bar-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: .3rem; }
  .profile-bar-row > .profile-bar-name { grid-column: 1 / -1; }
  .profile-bar-name-text { white-space: normal; overflow: visible; text-overflow: clip; }
}
/* 不支持容器查询的旧浏览器兜底：窄视口同样应用两行布局 */
@media (max-width: 480px) {
  .profile-bar-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: .3rem; }
  .profile-bar-row > .profile-bar-name { grid-column: 1 / -1; }
  .profile-bar-name-text { white-space: normal; overflow: visible; text-overflow: clip; }
}
.profile-legend { margin: .1rem 0 .55rem; color: var(--muted); font-size: .84rem; line-height: 1.65; }
.profile-legend .info-tip { width: 1.05rem; height: 1.05rem; min-width: 1.05rem; font-size: .68rem; margin: 0 .15rem; vertical-align: middle; cursor: pointer; }
.profile-source-card summary { cursor: pointer; font-weight: 700; }
.profile-source-card[open] summary { margin-bottom: .55rem; }
.profile-trend-chart { height: 240px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); }
.profile-trend-chart canvas { display: block; width: 100%; height: 100%; }
.profile-findings, .profile-trend { padding: .7rem; background: var(--panel); color: var(--muted); }
.profile-findings p, .profile-trend p { margin: .35rem 0; }
.profile-empty { color: var(--muted); text-align: center; }
/* ===== Agent 人性化面板 ===== */
.agent-body { display: grid; gap: .65rem; margin: .35rem 0 .75rem; }
.agent-summary { margin: 0; }
.agent-card { padding: .75rem .85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); display: grid; gap: .35rem; }
.agent-card strong { margin: 0; }
.agent-card p { margin: 0; color: var(--ink); font-size: .92rem; }
.agent-notice { padding: .75rem .85rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.meter-row { display: flex; align-items: center; gap: .55rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; color: var(--muted); }
.meter { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .25s ease; }
.risk-badge { margin: 0; font-weight: 700; }
.advice-box { padding: .75rem .85rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); }
.advice-box p { margin: .25rem 0; font-size: .92rem; }
.agent-tag { display: inline-block; width: fit-content; padding: .12rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.agent-tag-bull { background: var(--accent-soft); color: var(--accent); }
.agent-tag-bear { background: var(--panel); color: var(--positive); border: 1px solid var(--positive); }
.agent-tag-risk { background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.bias-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.bias-chip { padding: .22rem .65rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: .82rem; }
.profile-meta { color: var(--muted); }
.simulation-report { margin-top: 1.25rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.report-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: .75rem 0; }
.report-metric { background: var(--panel); padding: .6rem; }
.report-metric small { display: block; color: var(--muted); }
.report-metric strong { display: block; margin-top: .15rem; }
.report-chart { height: 220px; border: 1px solid var(--line); background: var(--card); margin: .5rem 0 1rem; }
.report-chart canvas { display: block; width: 100%; height: 100%; }
.report-moments p, .report-day-row { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.report-day-row { display: flex; justify-content: space-between; gap: 1rem; }
.report-disclaimer { color: var(--muted); font-size: .85rem; }
@media (max-width: 700px) {
  .report-metrics { grid-template-columns: repeat(2, 1fr); }
}
/* ===== 板块说明提示 ===== */
.info-tip { width: 1.5rem; height: 1.5rem; min-width: 1.5rem; min-height: 1.5rem; margin: 0 0 0 .45rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1.5px solid var(--line); background: var(--panel); color: var(--muted); font-size: .82rem; font-weight: 700; line-height: 1; vertical-align: middle; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.info-tip:hover { border-color: var(--accent); color: var(--accent); }
.info-tip-box { position: fixed; z-index: 40; max-width: 284px; padding: .65rem .85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); font-size: .84rem; line-height: 1.55; box-shadow: 0 10px 26px rgba(0, 0, 0, .16); }
@media (max-width: 700px) {
  .simulation-metrics { grid-template-columns: repeat(2, 1fr); }
  .trade-buttons { grid-template-columns: repeat(3, 1fr); }
  .profile-center-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  body { margin: 0 auto; }
  .trade-buttons { grid-template-columns: repeat(2, 1fr); }
  .simulation-history { font-size: .78rem; }
}

/* ===== 首页：醒思罗盘 ===== */
.home-hero { text-align: center; padding: clamp(2.5rem, 7vw, 5rem) 0 1rem; }
.home-kicker { margin: 0; letter-spacing: .28em; text-transform: uppercase; font-size: .78rem; color: var(--accent); font-weight: 700; }
.home-hero h1 { margin: .65rem 0 .35rem; font-size: clamp(2.5rem, 6vw, 4rem); letter-spacing: .06em; }
.home-sub { margin: 0; color: var(--muted); font-size: 1.12rem; }
.home-greeting { margin: 1.1rem 0 1.4rem; font-size: 1.02rem; color: var(--ink); }
.user-chip { width: auto; margin: 0 auto; padding: .5rem 1.15rem; border-radius: 999px; background: var(--card); }
.compass-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; margin: 2.5rem auto 1rem; max-width: 1020px; }
.compass-item { display: flex; flex-direction: column; align-items: center; gap: .95rem; text-decoration: none; color: var(--ink); }
.compass-circle { width: min(100%, 210px); aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--line); background: var(--card); box-shadow: 0 12px 28px rgba(23, 32, 51, .10); transition: transform .38s cubic-bezier(.16, 1, .3, 1), box-shadow .38s cubic-bezier(.16, 1, .3, 1); }
.compass-icon { font-size: clamp(2.6rem, 5vw, 3.5rem); line-height: 1; }
.compass-name { font-size: 1.14rem; letter-spacing: .06em; }
.compass-desc { max-width: 15rem; text-align: center; color: var(--muted); font-size: .88rem; }
.compass-item:hover .compass-circle { transform: translateY(-10px) scale(1.055); box-shadow: 0 22px 44px rgba(23, 32, 51, .18); }
.compass-item:active .compass-circle { transform: scale(1.02); transition-duration: .12s; }
.compass-item[data-tone="blue"] .compass-circle { background: linear-gradient(160deg, var(--card) 30%, var(--accent-soft)); }
.compass-item[data-tone="purple"] .compass-circle { background: linear-gradient(160deg, var(--card) 30%, var(--glow-2)); }
.compass-item[data-tone="amber"] .compass-circle { background: linear-gradient(160deg, var(--card) 30%, var(--glow-1)); }
.compass-item[data-tone="green"] .compass-circle { background: linear-gradient(160deg, var(--card) 30%, var(--panel)); }

/* ===== 昵称弹窗 =====
   z-index 45：高于圆形揭示层（30）与提示框（40），弹窗永不被子页盖住 */
.user-modal { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 1rem; background: rgba(15, 22, 36, .45); }
.user-dialog { position: relative; width: min(100%, 24rem); padding: 1.6rem 1.5rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, .28); text-align: center; }
/* 右上角关闭按钮：未登录也允许关闭弹窗自由浏览 */
.user-modal-close { position: absolute; top: .55rem; right: .55rem; width: 2rem; height: 2rem; min-width: 2rem; min-height: 2rem; margin: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.35rem; line-height: 1; }
.user-modal-close:hover { color: var(--ink); background: var(--panel); border-color: transparent; }
/* 已登录账号面板 */
.account-card { margin: .9rem 0 1rem; padding: 1.1rem .85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); display: grid; gap: .3rem; }
.account-card p { margin: 0; }
.account-avatar { font-size: 2rem; line-height: 1.2; }
.account-nickname { font-size: 1.18rem; font-weight: 700; color: var(--ink); }
.account-meta { color: var(--muted); font-size: .86rem; }
.user-dialog h3 { margin-top: 0; }
.user-dialog p { color: var(--muted); font-size: .92rem; }
.user-row { display: flex; gap: .55rem; align-items: stretch; margin: 1rem 0 .85rem; }
.user-row input { margin-top: 0; flex: 1; text-align: center; }
.user-row button { width: auto; margin-top: 0; white-space: nowrap; }
.auth-tabs { display: flex; gap: .5rem; justify-content: center; margin: .75rem 0 .25rem; }
.auth-tab { width: auto; margin-top: 0; padding: .4rem 1rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.auth-tab.active { border-color: var(--accent, #0fa3a3); color: inherit; font-weight: 600; }
.user-tip { font-size: .82rem; color: var(--muted); margin: .35rem 0 .85rem; }

/* ===== 模块页导航 ===== */
.module-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; margin: 0 -1.25rem 1.15rem; padding: .85rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line); }
.module-bar h2 { margin: 0; font-size: 1.15rem; }
.module-back { width: auto; margin-top: 0; padding: .42rem 1rem; border-radius: 999px; text-decoration: none; color: var(--accent); font-weight: 600; background: var(--panel); border: 1px solid var(--line); }
.module-back:hover { border-color: var(--accent); }

@media (max-width: 860px) {
  .compass-grid { grid-template-columns: repeat(2, 1fr); gap: 1.65rem; max-width: 30rem; }
  .compass-circle { width: min(100%, 180px); }
}
@media (hover: none) {
  .compass-item:hover .compass-circle { transform: none; box-shadow: 0 12px 28px rgba(23, 32, 51, .10); }
  .compass-item:active .compass-circle { transform: scale(1.07); transition-duration: .1s; }
}

/* ===== 分析历史 ===== */
#analysisHistorySection button { width: auto; margin-top: 0; }
.history-entry { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: .9rem 1rem; margin: .9rem 0; }
.history-entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; }
.history-entry-head strong { font-size: 1.02rem; }
.history-entry-head small { color: var(--muted); white-space: nowrap; }
.history-entry-idea { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; margin: .7rem 0; white-space: pre-wrap; line-height: 1.55; }
.history-entry-summary { font-weight: 600; margin: .55rem 0; }
.history-entry details { margin-top: .55rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .75rem; background: var(--panel); }
.history-entry summary { cursor: pointer; font-weight: 600; }
#loadMoreAnalysisHistory { margin: .8rem 0 1.4rem; }

/* ===== 星空背景层：开场与主界面共用，全程贯穿 ===== */
/* 不透明深空底色：即使画布尚未绘制，根元素的 --bg 底色也绝不可能透出 */
#universeLayer { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: #04060c; }
#universeLayer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* 开场期间主界面隐藏（由 intro.js 在开场结束时解除） */
body.intro-active .app-view { visibility: hidden; }

/* ===== 宇宙开场：星空银河 + 黄铜罗盘校准 → 标题+开始使用 → 穿入表镜进主界面 ===== */
/* 开场为固定深色舞台，不跟随应用主题；色彩变量以 cv- 前缀避免与应用变量混淆 */
.cosmos {
  --cv-ivory: #e9e4d6;
  --cv-dim: #9a988c;
  --cv-brass: #c8a870;
  --cv-gold: #e8cf9e;
  --cv-line: rgba(200, 190, 160, .18);
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  color: var(--cv-ivory);
  font-family: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
}
.cosmos .cosmos-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 2, .62) 100%); }
.cosmos #fxsvg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
@keyframes dashGrow { to { stroke-dashoffset: 0; } }
@keyframes fxOut { to { opacity: 0; } }

.cosmos .compass-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.55);
  opacity: 0;
  z-index: 4;
  /* 只过渡 transform/opacity（GPU 合成），过渡 left/top 会逐帧重排导致卡顿 */
  transition: opacity .55s ease, transform .9s cubic-bezier(.6, 0, .2, 1);
}
.cosmos .compass-wrap.revealed { opacity: 1; transform: translate(-50%, -50%) scale(1); }
/* 校准完成后罗盘向左停靠：位移全部走 transform（-33vw ≈ 停靠到左侧留白区的居中点） */
.cosmos .compass-wrap.parked { transform: translate(calc(-50% - 33vw), -50%) scale(1); }
.cosmos .compass-wrap.zooming {
  transition: transform 1.05s cubic-bezier(.7, 0, .25, 1), opacity .45s ease .6s, filter 1.05s ease;
  transform: translate(-50%, -50%) scale(9);
  filter: blur(2px) brightness(1.18);
  opacity: 0;
}
.cosmos .compass-wrap.lit .compass { filter: drop-shadow(0 14px 34px rgba(0, 0, 0, .75)) brightness(1.45); transition: filter .45s ease; }
.cosmos .compass-shell { width: clamp(190px, 22vw, 270px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cosmos .compass { width: 100%; height: auto; filter: drop-shadow(0 14px 34px rgba(0, 0, 0, .75)); }
.cosmos .dial-text { fill: #a2977c; font-size: 11px; letter-spacing: 3px; }
.cosmos .dial-text-sm { font-size: 6.5px; letter-spacing: 1.6px; opacity: .8; }
.cosmos .dial-numeral { fill: #ddd2b0; font-size: 13px; }
.cosmos .readout { display: flex; align-items: baseline; gap: 16px; font-variant-numeric: tabular-nums; color: var(--cv-ivory); }
.cosmos .readout-hour { font-size: 20px; letter-spacing: .1em; }
.cosmos .readout-hour b { font-weight: 700; }
.cosmos .readout-deg { font-size: 12px; color: var(--cv-dim); letter-spacing: .12em; }
.cosmos .compass-wrap.zooming .readout { opacity: 0; transition: opacity .3s ease; }

.cosmos .intro-title {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; pointer-events: none; opacity: 0; transition: opacity .5s ease;
  /* 覆盖全局 section 卡片样式：开场标题是全屏舞台，不是内容卡片（否则深蓝底+圆角+上边距会盖住星空） */
  margin: 0; padding: 0; border: none; border-radius: 0; background: transparent;
}
.cosmos .intro-title.show { opacity: 1; }
.cosmos .intro-kicker { margin: 0; font-size: 11px; letter-spacing: .6em; text-indent: .6em; color: var(--cv-dim); opacity: 0; }
.cosmos .intro-brand { display: flex; gap: .28em; margin: 0; font-size: clamp(46px, 7.6vw, 96px); font-weight: 600; color: var(--cv-ivory); text-shadow: 0 2px 30px rgba(0, 0, 0, .8); }
.cosmos .intro-brand span { opacity: 0; }
.cosmos .intro-title.show .intro-brand span { animation: cosmosCharUp .7s cubic-bezier(.19, 1.15, .3, 1) both; }
/* 交错入场：第 1/3 字自下而上，第 2/4 字自上而下 */
.cosmos .intro-title.show .intro-brand span:nth-child(odd) { animation-name: cosmosCharUp; }
.cosmos .intro-title.show .intro-brand span:nth-child(even) { animation-name: cosmosCharDown; }
.cosmos .intro-title.show .intro-brand span:nth-child(1) { animation-delay: .05s; }
.cosmos .intro-title.show .intro-brand span:nth-child(2) { animation-delay: .2s; }
.cosmos .intro-title.show .intro-brand span:nth-child(3) { animation-delay: .35s; }
.cosmos .intro-title.show .intro-brand span:nth-child(4) { animation-delay: .5s; }
@keyframes cosmosCharUp { from { opacity: 0; transform: translateY(34px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cosmosCharDown { from { opacity: 0; transform: translateY(-34px); } to { opacity: 1; transform: translateY(0); } }
.cosmos .intro-rule { display: flex; align-items: center; gap: 18px; margin-top: 6px; color: var(--cv-dim); font-size: 13px; letter-spacing: .3em; opacity: 0; }
.cosmos .intro-rule i { width: 72px; height: 1px; background: linear-gradient(90deg, transparent, var(--cv-line)); }
.cosmos .intro-rule i:last-child { background: linear-gradient(270deg, transparent, var(--cv-line)); }
.cosmos .intro-title.show .intro-kicker { animation: cosmosFadeIn .9s ease 1.3s both; }
.cosmos .intro-title.show .intro-rule { animation: cosmosFadeIn .9s ease 1.3s both; }
@keyframes cosmosFadeIn { to { opacity: 1; } }
.cosmos .intro-start {
  pointer-events: auto; width: auto; margin-top: 4.5vh; padding: .6rem 1.1rem;
  font-family: inherit; font-size: 14px; letter-spacing: .22em; text-indent: .22em;
  color: var(--cv-ivory); background: rgba(200, 168, 112, .08);
  border: 1px solid rgba(200, 168, 112, .5); border-radius: 999px;
  cursor: pointer; opacity: 0;
  transition: color .3s ease, border-color .3s ease, box-shadow .3s ease, transform .3s ease;
}
.cosmos .intro-title.show .intro-start { animation: cosmosFadeIn .9s ease 1.3s both; }
.cosmos .intro-start:hover { color: #fff7e6; border-color: rgba(232, 207, 158, .9); box-shadow: 0 0 24px rgba(200, 168, 112, .35); transform: translateY(-2px); }
.cosmos .intro-hint { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); margin: 0; font-size: 11px; letter-spacing: .22em; color: #6f6d62; transition: opacity .4s ease; }
/* 点击开始使用：文字与提示淡出的同时罗盘移回正中 */
.cosmos.leaving .intro-title { opacity: 0; }
.cosmos.leaving .intro-hint { opacity: 0; }
/* 点「开始使用」：开场层整体快速淡出，直接进主界面（星空常驻，视觉无缝） */
.cosmos.app-fade { opacity: 0; transition: opacity .38s ease; pointer-events: none; }

@media (max-width: 860px) {
  .cosmos .compass-wrap { left: 50%; top: 22%; transform: translate(-50%, -50%) scale(.55); }
  .cosmos .compass-wrap.revealed { transform: translate(-50%, -50%) scale(1); }
  .cosmos .compass-wrap.parked { transform: translate(-50%, -50%) scale(1); }
  .cosmos .compass-wrap.zooming { transform: translate(-50%, -50%) scale(9); }
  .cosmos .intro-title { justify-content: flex-end; padding-bottom: 9vh; }
  .cosmos .intro-brand { font-size: clamp(40px, 11vw, 64px); }
}

/* ===== 首页圆钮呼吸浮动（外层浮、内层悬停缩放，互不覆盖） ===== */
.compass-float { display: flex; justify-content: center; width: 100%; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes compassFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
  .compass-float { animation: compassFloat 3.6s ease-in-out infinite; }
  .compass-item:nth-child(2) .compass-float { animation-delay: .3s; }
  .compass-item:nth-child(3) .compass-float { animation-delay: .6s; }
  .compass-item:nth-child(4) .compass-float { animation-delay: .9s; }
  .compass-item:hover .compass-float, .compass-item:active .compass-float { animation-play-state: paused; }
}

/* ===== 主页入场（开场动画结束后错峰浮现） ===== */
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } }
.home-enter .home-hero > *, .home-enter .compass-item { animation: riseIn .55s cubic-bezier(.16, 1, .3, 1) both; }
.home-enter .home-kicker { animation-delay: .02s; }
.home-enter .home-hero h1 { animation-delay: .08s; }
.home-enter .home-sub { animation-delay: .14s; }
.home-enter .home-greeting { animation-delay: .2s; }
.home-enter .user-chip { animation-delay: .26s; }
.home-enter .compass-item:nth-child(1) { animation-delay: .22s; }
.home-enter .compass-item:nth-child(2) { animation-delay: .32s; }
.home-enter .compass-item:nth-child(3) { animation-delay: .42s; }
.home-enter .compass-item:nth-child(4) { animation-delay: .52s; }

/* ===== 页面切换：圆形揭示 ===== */
.view-fade-in { animation: viewFadeIn .22s ease; }
@keyframes viewFadeIn { from { opacity: 0; } }

/* ===== 模拟交易布局：桌面两栏，移动端保持原单列顺序 ===== */
.simulation-dashboard.is-active { display: flex; flex-direction: column; }
/* 移动端：两列容器溶解为单列流，视觉顺序由下方 order 决定
   （更新速度 + 成本线开关在顶部，行情图切换紧贴盘面上方） */
.sim-col-main, .sim-col-side, .top-controls { display: contents; }
@media (max-width: 1023px) {
  .simulation-meta { order: 1; }
  .speed-row { order: 2; }
  .costline-toggle { order: 3; }
  .price-display { order: 4; }
  .price-reference { order: 5; }
  .price-change { order: 6; }
  .pnl-line { order: 7; }
  .chart-tabs { order: 8; }
  .price-chart { order: 9; }
  .simulation-actions { order: 10; }
  .day-actions { order: 11; }
  .simulation-metrics { order: 12; }
  .sim-history-block { order: 13; }
}
.sim-history-block h3 { margin-bottom: .35rem; }
@media (min-width: 1024px) {
  .simulation-dashboard.is-active { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 1.25rem; align-items: start; }
  .sim-col-main { display: grid; gap: .5rem; min-width: 0; }
  /* 右栏交易区 sticky 固定：滚动看盘时买卖按钮始终可见 */
  .sim-col-side { display: grid; gap: .75rem; min-width: 0; align-content: start; position: sticky; top: .75rem; }
  /* 左列收紧行距：元素自带 margin 与栅格 gap 叠加会显得松散，桌面端统一交给 gap 控制 */
  .sim-col-main .price-display { margin: 0; font-size: clamp(2.6rem, 5vw, 4.25rem); }
  .sim-col-main .pnl-line, .sim-col-main .price-chart { margin: 0; }
  .sim-col-main .sim-history-block h3 { margin: .2rem 0 .35rem; }
  .sim-col-main .history-scroll { margin-top: 0; }
  /* 顶部控制组：更新速度居左、成本线开关居右，一行排布 */
  .sim-col-main .top-controls { display: flex; align-items: center; gap: 1.25rem; }
  .sim-col-main .top-controls .speed-row { margin: 0; }
  .sim-col-main .top-controls .speed-total { margin-left: auto; }
  .sim-col-main .top-controls .costline-toggle { margin: 0; }
  /* 行情图切换紧贴盘面上方 */
  .sim-col-main .chart-tabs { margin: 0; }
  .price-chart { height: clamp(320px, 46vh, 460px); }
  .simulation-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 无障碍：偏好减少动态效果时统一降级 ===== */
@media (prefers-reduced-motion: reduce) {
  .compass-float, .home-enter .home-hero > *, .home-enter .compass-item, .view-fade-in { animation: none !important; }
  /* 宇宙开场在 reduced-motion 下由 intro.js 直接移除，星空层一并隐藏 */
  #universeLayer { display: none; }
}

/* ===== ICP 备案页脚：内容少时贴视口底部，内容多时跟随内容 ===== */
/* 经典 sticky-footer：视图改为纵向 flex，内容区 flex:1 撑满，footer 永远排最后 */
.app-view { display: flex; flex-direction: column; }
.view-body { flex: 1 0 auto; }
.icp-footer { padding: 16px 0; text-align: center; font-size: 12px; color: rgba(154, 167, 189, .72); }
.icp-footer p { margin: 0; }
.icp-footer a { color: inherit; text-decoration: none; transition: color .2s ease; }
.icp-footer a:hover { color: #c8a870; text-decoration: underline; }
