/* nuclear-fission-3d — dark-space shell stylesheet
   SCENARIO-013 (AC-04): 暗空主题、固定悬浮 UI、:focus-visible 键盘焦点、
   控件最小尺寸 ≥44×44px。SCENARIO-018/020 (AC-07): 导览面板与步骤高亮。 */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: #04060d;
  color: #e2e8f0;
  font-family: 'Outfit', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  user-select: none;
}

#stage { position: fixed; inset: 0; cursor: grab; }
#stage:active { cursor: grabbing; }
#stage canvas { display: block; }
#stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(2,4,10,.6) 100%);
}

/* ── 返回首页（共享样式） ── */
#homeBtn {
  position: fixed; top: 14px; left: 14px; z-index: 100;
  display: inline-flex; align-items: center; gap: 7px;
  height: 44px; padding: 0 18px 0 14px;
  background: rgba(15, 23, 42, 0.82); backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.22); border-radius: 22px;
  color: #e2e8f0; font-size: 0.85rem; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
#homeBtn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(148, 163, 184, 0.45); color: #fff; transform: translateY(-1px);
}
#homeBtn:active { transform: translateY(0); }

/* ── 顶部语言切换药丸 ── */
.lang-switch {
  position: fixed; top: 14px; left: 116px; z-index: 100;
  display: inline-flex; align-items: center; gap: 4px;
  height: 44px; padding: 0 4px;
  background: rgba(15, 23, 42, 0.82); backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.22); border-radius: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.lang-btn {
  min-width: 44px; min-height: 44px; padding: 0 10px;
  background: transparent; border: none; border-radius: 22px;
  color: #94a3b8; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.lang-btn:hover { color: #f8fafc; }
.lang-btn.active {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}
.i18n-loading [data-i18n] {
  visibility: hidden;
}

header {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  text-align: center; z-index: 10; pointer-events: none; width: 94vw;
}
h1 {
  font-size: 1.25rem; font-weight: 600;
  background: linear-gradient(135deg, #4ade80, #38bdf8, #fbbf24);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; text-shadow: none;
}
.subtitle { font-size: .72rem; color: #64748b; margin-top: 2px; }

/* ── 左侧工具栏（🎬 引导浏览） ── */
#tools {
  position: fixed; left: 14px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 10;
}
.tool-btn {
  min-width: 44px; min-height: 44px; width: 46px; height: 46px; border-radius: 13px;
  background: rgba(15,20,32,.72); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.08);
  color: #cbd5e1; font-size: 17px; cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.tool-btn:hover { background: rgba(30,41,59,.9); border-color: rgba(245,158,11,.45); transform: translateY(-1px); }
.tool-btn.active { background: rgba(245,158,11,.18); border-color: rgba(245,158,11,.6); }

/* ── SCENARIO-016: 相位字幕 + 解说 + 守恒验算 ── */
#narration {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%);
  width: min(680px, 92vw); z-index: 9; pointer-events: none;
  text-align: center;
}
#phaseTitle {
  display: inline-block; font-size: .95rem; font-weight: 700; letter-spacing: .06em;
  color: #f59e0b; background: rgba(8,12,22,.72); backdrop-filter: blur(10px);
  border: 1px solid rgba(245,158,11,.35); border-radius: 999px;
  padding: 4px 18px;
}
#phaseText {
  margin-top: 8px; font-size: .78rem; line-height: 1.75; color: #cbd5e1;
  background: rgba(8,12,22,.66); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.07); border-radius: 12px;
  padding: 9px 16px;
}
#ledgerPanel {
  margin-top: 8px; font-size: .8rem; font-weight: 600; color: #86efac;
  background: rgba(6,24,16,.78); backdrop-filter: blur(10px);
  border: 1px solid rgba(74,222,128,.3); border-radius: 12px;
  padding: 8px 16px;
}

/* ── SCENARIO-030 (AC-11): 常见问题 FAQ 面板（左侧，与聚变版物理小课堂同款）── */
#faqPanel {
  position: fixed; left: 14px; top: 74px; z-index: 10;
  width: 300px; max-height: calc(100vh - 200px); overflow-y: auto;
  background: rgba(13,17,28,.82); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.09); border-radius: 14px;
  padding: 12px 14px;
}
#faqPanel h3 { font-size: .8rem; color: #f1f5f9; font-weight: 700; margin: 0 0 8px; }
#faqPanel details.qa {
  border: 1px solid rgba(255,255,255,.07); border-radius: 10px;
  padding: 6px 10px; margin-top: 6px; background: rgba(255,255,255,.02);
}
#faqPanel summary {
  font-size: .71rem; font-weight: 600; color: #7dd3fc;
  cursor: pointer; list-style: revert; min-height: 24px;
}
#faqPanel summary:hover { color: #38bdf8; }
#faqPanel details.qa p {
  font-size: .69rem; color: #cbd5e1; line-height: 1.75; margin-top: 5px;
}
#faqPanel details.qa p b { color: #fbbf24; font-weight: 600; }

/* ── SCENARIO-009 ~ 012: 底部控制条（≥44×44px 原生按钮） ── */
#bottomBar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; z-index: 20;
  background: rgba(13,17,28,.82); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.09); border-radius: 16px;
  padding: 8px 12px;
  max-width: 96vw; flex-wrap: wrap; justify-content: center;
}
.ctrl-btn {
  min-width: 44px; min-height: 44px; padding: 0 14px;
  border-radius: 11px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(30,41,59,.55); color: #e2e8f0;
  font-size: .78rem; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.ctrl-btn:hover { background: rgba(51,65,85,.85); border-color: rgba(148,163,184,.4); }
.ctrl-btn:active { transform: translateY(1px); }
.vsep { width: 1px; height: 26px; background: rgba(148,163,184,.25); }

/* ── SCENARIO-029 (AC-11): ①②③ 幕标签（与 nuclear-fusion-3d 同款交互）── */
.phase-tab {
  min-width: 44px; min-height: 44px; padding: 0 14px;
  border-radius: 11px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(22,35,58,.55); color: #94a3b8;
  font-size: .78rem; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.phase-tab:hover { background: rgba(30,50,82,.85); color: #e2e8f0; }
.phase-tab.active {
  background: rgba(56,189,248,.18); border-color: rgba(56,189,248,.6); color: #7dd3fc;
  box-shadow: 0 0 12px rgba(56,189,248,.25);
}
.phase-tab:active { transform: translateY(1px); }

/* ── SCENARIO-013 (AC-04): 键盘可达的清晰焦点态 ── */
:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 6px;
}
.ctrl-btn:focus-visible, .tool-btn:focus-visible, .tour-close:focus-visible, .tour-step:focus-visible, .phase-tab:focus-visible {
  background: rgba(56,189,248,.18);
}

/* ── SCENARIO-018/019/020: 四步导览面板 ── */
#tourPanel {
  position: fixed; right: 14px; top: 74px; z-index: 30;
  width: min(360px, 92vw);
  background: rgba(13,17,28,.92); backdrop-filter: blur(16px);
  border: 1px solid rgba(56,189,248,.28); border-radius: 16px;
  padding: 18px 16px 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transform: translateX(12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
#tourPanel.open { opacity: 1; visibility: visible; transform: translateX(0); }
#tourTitle { font-size: .92rem; font-weight: 700; color: #7dd3fc; }
#tourText { margin-top: 8px; font-size: .78rem; line-height: 1.8; color: #cbd5e1; }
#tourSteps { list-style: none; margin-top: 12px; display: grid; gap: 6px; }
.tour-step {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  background: rgba(30,41,59,.4);
  font-size: .72rem; color: #94a3b8; cursor: pointer;
}
.tour-step b { color: #e2e8f0; }
.tour-step span { color: #64748b; }
.tour-step:hover { border-color: rgba(245,158,11,.4); }
.tour-step.active {
  border-color: rgba(245,158,11,.65); background: rgba(245,158,11,.14);
}
.tour-step.active b { color: #f59e0b; }
.tour-close {
  position: absolute; top: 8px; right: 8px;
  min-width: 44px; min-height: 44px; width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.1);
  background: rgba(30,41,59,.6); color: #cbd5e1;
  font-size: .85rem; cursor: pointer;
}
.tour-close:hover { background: rgba(51,65,85,.9); color: #fff; }

/* ── SCENARIO-028: WebGL 降级提示层 ── */
#fallback {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at center, #0a1120 0%, #04060d 100%);
  color: #e2e8f0; font-size: .95rem; line-height: 2;
}
#fallback[hidden] { display: none; }

#hint {
  position: fixed; right: 16px; bottom: 84px; z-index: 8; pointer-events: none;
  font-size: .66rem; line-height: 1.9; color: #64748b; text-align: right;
}

/* ── 弹窗浮层公共样式 (Hud Popovers) ── */
.hud-popover {
  position: fixed; left: 70px; top: 50%; transform: translateY(-50%);
  z-index: 100; width: min(390px, 92vw); max-height: 82vh; overflow-y: auto;
  background: rgba(15,23,42,.92); backdrop-filter: blur(18px);
  border: 1px solid rgba(245,158,11,.28); border-radius: 16px;
  padding: 16px 18px; box-shadow: 0 16px 48px rgba(0,0,0,.65);
}
.hud-popover[hidden] { display: none; }
.hud-popover__title { font-size: 0.88rem; font-weight: 700; color: #f59e0b; margin-bottom: 8px; }
.hud-popover__desc { font-size: 0.72rem; color: #94a3b8; line-height: 1.6; margin-bottom: 10px; }

/* 质量产额双峰曲线与选择 */
.yield-chart { background: rgba(8,12,22,0.65); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 6px; margin-bottom: 10px; }
.curve-svg { width: 100%; height: 75px; display: block; }
.split-options { display: flex; flex-direction: column; gap: 8px; }
.split-btn {
  min-height: 44px; text-align: left; background: #16233a; border: 1px solid #26364f;
  border-radius: 10px; padding: 8px 12px; color: #cbd5e1; cursor: pointer;
  font-family: inherit; display: flex; flex-direction: column; gap: 3px;
  transition: all 0.2s ease;
}
.split-btn:hover { background: #1e3252; border-color: rgba(245,158,11,.4); color: #fff; }
.split-btn.active {
  background: rgba(245,158,11,.16); border-color: #f59e0b; color: #fff;
  box-shadow: 0 0 12px rgba(245,158,11,.25);
}
.split-btn b { font-size: 0.76rem; color: #f8fafc; }
.split-btn span { font-size: 0.68rem; color: #94a3b8; }

/* 200 MeV 能量分配 */
.energy-list { display: flex; flex-direction: column; gap: 6px; }
.e-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: #cbd5e1; }
.e-row.highlight { color: #f59e0b; font-weight: 700; font-size: 0.76rem; }
.e-bar-wrap { width: 100%; height: 4px; background: #1e293b; border-radius: 2px; overflow: hidden; margin: 1px 0 4px; }
.e-bar { height: 100%; background: linear-gradient(90deg, #f59e0b, #ef4444); border-radius: 2px; }
.e-val { font-weight: 600; color: #f8fafc; font-variant-numeric: tabular-nums; }
.e-pct { font-size: 0.66rem; color: #64748b; width: 44px; text-align: right; }
.e-footer { font-size: 0.68rem; color: #94a3b8; line-height: 1.6; margin-top: 8px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 8px; }

/* 慢化剂与链式反应 */
.mod-grid { display: flex; flex-direction: column; gap: 8px; }
.mod-card {
  background: rgba(8,12,22,0.65); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 8px 12px;
}
.mod-card.highlight { border-color: rgba(74,222,128,0.35); background: rgba(6,24,16,0.6); }
.mod-tag { font-size: 0.76rem; font-weight: 700; color: #f8fafc; margin-bottom: 2px; }
.mod-spec { font-size: 0.68rem; color: #7dd3fc; }
.mod-cross { font-size: 0.74rem; margin-top: 3px; }
.mod-note { font-size: 0.64rem; color: #94a3b8; margin-top: 3px; }
.mod-arrow { font-size: 0.68rem; color: #f59e0b; text-align: center; font-weight: 600; }
.keff-section { margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 8px; }
.keff-title { font-size: 0.72rem; color: #7dd3fc; font-weight: 600; margin-bottom: 6px; }
.keff-controls { display: flex; gap: 6px; }
.keff-btn {
  min-height: 44px; flex: 1; background: #16233a; border: 1px solid #26364f;
  border-radius: 8px; color: #cbd5e1; font-size: 0.68rem; cursor: pointer;
  font-family: inherit; transition: all 0.2s;
}
.keff-btn:hover { background: #1e3252; color: #fff; }
.keff-btn.active {
  background: rgba(74,222,128,0.2); border-color: #4ade80; color: #86efac; font-weight: 600;
}
.keff-desc { font-size: 0.66rem; color: #94a3b8; line-height: 1.5; margin-top: 6px; }

.split-btn:focus-visible, .keff-btn:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }

/* ── 响应式断点：8px 栅格体系下 640 / 768 / 1024 三档 ── */
@media (max-width: 1024px) {
  #narration { width: min(620px, 90vw); }
  #tourPanel { width: min(330px, 90vw); }
}

@media (max-width: 768px) {
  #narration { top: 70px; }
  #bottomBar { bottom: 10px; padding: 6px 8px; gap: 6px; }
  .ctrl-btn { padding: 0 10px; font-size: .74rem; }
  #faqPanel {
    left: 8px; right: 8px; width: auto; top: auto; bottom: 84px;
    max-height: 30vh;
  }
}

@media (max-width: 640px) {
  #narration { top: 66px; }
  #tourPanel { top: auto; bottom: 84px; right: 50%; transform: translate(50%, 8px); }
  #tourPanel.open { transform: translate(50%, 0); }
  #hint { display: none; }
  #homeBtn { padding: 0 12px 0 10px; }
}
