/* 《三体 · 乱纪元》HUD — 深色观测台配色，纪元驱动的强调色。 */

:root {
  --bg: #04070f;
  --ink: #dceaf6;
  --dim: #7e93a8;
  --line: rgba(140, 180, 220, 0.14);
  --panel: rgba(8, 14, 26, 0.62);
  --panel-2: rgba(10, 18, 32, 0.82);
  --accent: #6fe3c0;
  --accent-2: #7ec8ff;
  --warn: #ffb35c;
  --bad: #ff6b7a;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --sans: 'Noto Sans SC', 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', system-ui, sans-serif;

  /* ——— 可调外观参数：默认值就是现在的观测台 —— */
  --site-bg: #04070f;
  --site-fg: #dceaf6;
  --site-surface: rgba(10, 18, 32, 0.82);
  --site-accent: var(--accent);
  --site-on-accent: #04120c;
  --site-muted: #7e93a8;
  --site-border: rgba(140, 180, 220, 0.14);
  --site-font: var(--sans);
  --site-radius: 12px;
  --site-space: 1;
  --site-type: 1;
  --site-motion: 1;
}

@media (prefers-reduced-motion: reduce) {
  :root { --site-motion: 0; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--site-bg);
  color: var(--site-fg);
  font-family: var(--site-font);
  -webkit-font-smoothing: antialiased;
}

body[data-era='scorch'] { --accent: #ff9d4d; }
body[data-era='freeze'] { --accent: #7fd4ff; }
body[data-era='rogue'] { --accent: #c58cff; }
body[data-era='chaos'] { --accent: #ff6b7a; }
body[data-era='steady'] { --accent: #5ce6a8; }

#stage { position: fixed; inset: 0; z-index: 0; }
#stage canvas { display: block; }

#hud {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.35s ease;
  display: grid;
  grid-template-columns: minmax(280px, 21vw) 1fr minmax(300px, 22vw);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: calc(14px * var(--site-space, 1));
  padding: calc(14px * var(--site-space, 1)) calc(16px * var(--site-space, 1)) calc(12px * var(--site-space, 1));
}
#hud > * { pointer-events: auto; }

/* ——— 顶栏 ——— */
.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 6px 10px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(4, 8, 16, 0.85), rgba(4, 8, 16, 0));
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 32%, #fff, var(--accent) 42%, rgba(0,0,0,0) 74%);
  box-shadow: 0 0 22px rgba(110, 220, 200, 0.45);
  transition: box-shadow 0.6s ease;
}
.brand h1 { margin: 0; font-size: 19px; letter-spacing: 3px; font-weight: 600; white-space: nowrap; }
.brand p { margin: 2px 0 0; font-size: 9.5px; letter-spacing: 2.4px; color: var(--dim); font-family: var(--mono); white-space: nowrap; }

.clock { display: flex; align-items: center; gap: 18px; }
.year { text-align: center; font-family: var(--mono); }
.year span { font-size: 26px; font-weight: 600; color: #fff; text-shadow: 0 0 18px rgba(120, 200, 255, 0.35); }
.year em { display: block; font-size: 9px; letter-spacing: 2px; color: var(--dim); font-style: normal; margin-top: -2px; }

.era-badge {
  padding: 7px 16px; border-radius: 999px; font-size: 13px; letter-spacing: 4px; font-weight: 600;
  border: 1px solid currentColor; color: var(--accent); background: rgba(255,255,255,0.03);
  transition: color 0.4s, box-shadow 0.4s;
  white-space: nowrap;
}
.era-badge.steady { color: #5ce6a8; box-shadow: 0 0 20px rgba(92,230,168,0.22) inset; }
.era-badge.scorch { color: #ff9d4d; box-shadow: 0 0 22px rgba(255,157,77,0.3); }
.era-badge.freeze { color: #7fd4ff; box-shadow: 0 0 22px rgba(127,212,255,0.3); }
.era-badge.rogue  { color: #c58cff; box-shadow: 0 0 22px rgba(197,140,255,0.3); }
.era-badge.chaos  { color: #ff6b7a; box-shadow: 0 0 26px rgba(255,107,122,0.36); animation: shudder 1.6s infinite; }
.era-badge.flash { animation: pop 0.7s ease; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes shudder { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-1.5px); } 75% { transform: translateX(1.5px); } }

.flux { width: 260px; }
.flux-bar { position: relative; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.07); overflow: visible; }
.flux-bar i { position: absolute; top: 0; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(92,230,168,0.35), rgba(92,230,168,0.85), rgba(255,157,77,0.6)); }
.flux-bar b { position: absolute; top: -4px; left: 0; width: 2px; height: 16px; background: #fff; box-shadow: 0 0 10px #fff; transition: transform 0.12s linear; }
.flux-legend { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px; color: var(--dim); margin-top: 5px; }
.flux-legend span:nth-child(2) { color: var(--ink); }

.objective { justify-self: end; width: min(320px, 26vw); }
.obj-chapter { font-size: 10px; letter-spacing: 3px; color: var(--accent); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.obj-label { font-size: 11px; letter-spacing: 1.5px; color: var(--dim); display: flex; justify-content: space-between; }
.obj-label b { color: var(--ink); font-family: var(--mono); }
.obj-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.07); margin-top: 6px; overflow: hidden; }
.obj-bar i { display: block; height: 6px; background: linear-gradient(90deg, #6fe3c0, #c58cff, #ff6b7a); box-shadow: 0 0 14px rgba(197,140,255,0.5); transition: width 0.4s; }
.obj-note { margin-top: 5px; font-size: 10px; color: #8ba2b6; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ——— 侧栏 ——— */
.panel {
  grid-row: 2;
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  padding: 14px 15px 18px;
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius);
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  scrollbar-width: thin;
  scrollbar-color: rgba(140,180,220,0.25) transparent;
}
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(140,180,220,0.22); border-radius: 3px; }
/* 中列留给星空本身：不显式声明 grid-column，自动放置会把右栏推进 1fr 观测窗。 */
.panel.left { grid-column: 1; }
.panel.right { grid-column: 3; }
.panel h2 { margin: 0 0 10px; font-size: 12px; letter-spacing: 3px; font-weight: 600; color: #cfe6f5; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel h2.mt { margin-top: 18px; }
.panel .sub { font-size: 9px; letter-spacing: 1.2px; color: var(--site-muted); font-weight: 400; text-align: right; }

table.bodies { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
table.bodies th { text-align: left; color: var(--dim); font-weight: 400; font-size: 9.5px; letter-spacing: 1px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
table.bodies td { padding: 6px 0; border-bottom: 1px solid rgba(140,180,220,0.07); }
table.bodies tr { cursor: pointer; }
table.bodies tr:hover td { color: #fff; }
table.bodies tr.sel td { background: rgba(110, 200, 255, 0.09); }
table.bodies tr.dead td { color: #4d5a68; text-decoration: line-through; }
table.bodies .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; box-shadow: 0 0 8px currentColor; }
table.bodies .tag { font-style: normal; font-size: 8.5px; color: #4d5a68; margin-left: 5px; }

.kv { margin-top: 12px; }
.kv-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; padding: 4.5px 0; border-bottom: 1px dashed rgba(140,180,220,0.09); }
.kv-row span { color: var(--dim); }
.kv-row b { font-family: var(--mono); font-weight: 500; text-align: right; }
.kv-row b.good { color: #5ce6a8; }
.kv-row b.bad { color: #ff6b7a; }
.chip { padding: 1px 6px; border-radius: 4px; font-size: 10px; margin-left: 6px; }
.chip.good { background: rgba(92,230,168,0.16); color: #5ce6a8; }
.chip.hot { background: rgba(255,157,77,0.16); color: #ff9d4d; }
.chip.cold { background: rgba(127,212,255,0.16); color: #7fd4ff; }

.forecast { font-size: 11px; }
.conf { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.conf span { color: var(--dim); white-space: nowrap; }
.conf-bar { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.conf-bar i { display: block; height: 5px; background: linear-gradient(90deg, #ff6b7a, #ffb35c 45%, #6fe3c0); transition: width 0.5s; }
.conf b { font-family: var(--mono); color: var(--ink); }
.fc-row { line-height: 1.7; color: #b9cfe0; }
.fc-row .warn, .warn { color: var(--warn); font-style: normal; font-size: 10px; }
.t.steady { color: #5ce6a8; } .t.scorch { color: #ff9d4d; } .t.freeze { color: #7fd4ff; }
.t.rogue { color: #c58cff; } .t.chaos { color: #ff6b7a; }
.conservation { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ——— 文明面板 ——— */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 9px 11px; border-radius: 9px; background: rgba(255,255,255,0.035); border: 1px solid rgba(140,180,220,0.1); }
.stat-k { font-size: 10px; letter-spacing: 2px; color: var(--dim); }
.stat-v { font-family: var(--mono); font-size: 17px; margin: 2px 0 6px; color: #fff; }
.stat-bar { height: 3px; background: rgba(255,255,255,0.09); border-radius: 2px; overflow: hidden; }
.stat-bar i { display: block; height: 3px; transition: width 0.5s; }
.resilience { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 10px; padding: 3px 8px; border-radius: 999px; background: rgba(111,227,192,0.12); color: #6fe3c0; border: 1px solid rgba(111,227,192,0.25); }
.pill.warn { background: rgba(255,179,92,0.12); color: var(--warn); border-color: rgba(255,179,92,0.3); }
.pill.bad { background: rgba(255,107,122,0.12); color: var(--bad); border-color: rgba(255,107,122,0.3); }

.sliders { display: grid; gap: 11px; }
.slider label { display: flex; justify-content: space-between; font-size: 11px; color: #b9cfe0; margin-bottom: 3px; }
.slider label b { font-family: var(--mono); color: var(--ink); }
input[type='range'] { width: 100%; height: 4px; -webkit-appearance: none; appearance: none; background: rgba(255,255,255,0.12); border-radius: 2px; outline: none; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); cursor: grab; }
input[type='range']::-moz-range-thumb { width: 13px; height: 13px; border: none; border-radius: 50%; background: var(--accent); cursor: grab; }

.impact { display: none; }
.impact.show { display: block; }
.imp-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 10px; }
.imp-chips.storm-chips { margin-top: -4px; padding: 5px 6px; border-radius: 7px; background: rgba(197,140,255,0.07); border: 1px dashed rgba(197,140,255,0.28); }
.imp-cap { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--dim); align-self: center; margin-right: 2px; white-space: nowrap; }
.storm-chips .imp-cap { color: #c58cff; }
.imp-chip {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 8px; border-radius: 7px;
  font-size: 10px; letter-spacing: 0.5px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--dim);
}
.imp-chip b { font-family: var(--mono); font-size: 10.5px; font-weight: 600; }
.imp-chip i { font-style: normal; font-size: 8.5px; opacity: 0.6; }
.imp-chip.up { border-color: rgba(111,227,192,0.36); }
.imp-chip.up b { color: #6fe3c0; }
.imp-chip.down { border-color: rgba(255,107,122,0.36); }
.imp-chip.down b { color: #ff8b96; }
.imp-chip.flat b { color: #9fb4c8; }

.imp-plot { position: relative; height: 92px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(180deg, rgba(126,200,255,0.05), rgba(4,8,16,0.35)); overflow: hidden; }
.imp-chart { display: block; width: 100%; height: 100%; }
.imp-chart .grid { stroke: rgba(255,255,255,0.22); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.imp-chart .deadline { stroke: rgba(255,107,122,0.65); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.imp-chart polyline { fill: none; stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.imp-chart .pri.tri { stroke: var(--accent); filter: drop-shadow(0 0 5px rgba(111,227,192,0.55)); }
.imp-chart .pri.terra { stroke: #ff8fa0; filter: drop-shadow(0 0 5px rgba(255,143,160,0.5)); }
.imp-chart .pop { stroke: #7ce0b0; stroke-dasharray: 5 3; opacity: 0.8; }
.imp-chart .storm { stroke: rgba(197,140,255,0.55); stroke-dasharray: 2 3; }
.imp-chart .hit { fill: #fff; stroke: var(--accent); stroke-width: 1.5; }
.imp-need, .imp-eta, .imp-zero { position: absolute; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.4px; white-space: nowrap; pointer-events: none; }
.imp-need { left: 4px; color: rgba(220,234,246,0.72); }
.imp-eta { top: 4px; color: #cfe6f5; }
.imp-zero { bottom: 4px; color: #ff8b96; }

.imp-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 7px; font-size: 9.5px; color: var(--dim); }
.imp-legend .lg { width: 14px; height: 2px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: middle; }
.imp-legend .pri-lg.tri { background: var(--accent); }
.imp-legend .pri-lg.terra { background: #ff8fa0; }
.imp-legend .pop-lg { background: repeating-linear-gradient(90deg, #7ce0b0 0 5px, transparent 5px 8px); }
.imp-legend .storm-lg { background: repeating-linear-gradient(90deg, rgba(197,140,255,0.7) 0 3px, transparent 3px 6px); }
.imp-verdict { margin: 9px 0 0; font-size: 10.5px; line-height: 1.65; padding: 8px 10px; border-radius: 8px; border-left: 2px solid currentColor; }
.imp-verdict.good { color: #6fe3c0; background: rgba(111,227,192,0.08); }
.imp-verdict.bad { color: #ff98a4; background: rgba(255,107,122,0.08); }
.imp-verdict.warn, .imp-verdict.flat { color: #ffc88a; background: rgba(255,179,92,0.08); }

.act-eff { display: block; font-style: normal; font-family: var(--mono); font-size: 9.5px; color: var(--accent-2); margin-top: 4px; line-height: 1.5; }
.act:disabled .act-eff { color: var(--dim); }

.policies { display: grid; gap: 8px; }
.policy { text-align: left; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--ink); cursor: pointer; transition: calc(200ms * var(--site-motion, 1)); display: block; }
.policy b { display: block; font-size: 12px; letter-spacing: 1px; }
.policy span { display: block; font-size: 10px; color: var(--dim); margin-top: 3px; line-height: 1.5; }
.policy:hover { border-color: rgba(140,200,255,0.4); }
.policy.on { background: rgba(111,227,192,0.13); border-color: rgba(111,227,192,0.5); box-shadow: 0 0 20px rgba(111,227,192,0.12) inset; }
.policy.on b { color: #6fe3c0; }

.nudge { margin-top: 18px; }
.nudge.dim { opacity: 0.4; }
.nudge-row, .sb-row { display: flex; gap: 6px; flex-wrap: wrap; }
select, .nudge button, .sandbox-tools button {
  font-family: var(--sans); font-size: 11px; color: var(--ink); background: rgba(255,255,255,0.05);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; cursor: pointer;
}
.nudge button:hover, .sandbox-tools button:hover { border-color: var(--accent-2); color: #fff; }
.nudge button:disabled { opacity: 0.35; cursor: not-allowed; }
.hint { font-size: 10px; color: var(--dim); line-height: 1.6; margin: 8px 0 0; }
.sandbox-tools { display: none; }
.sandbox-tools.show { display: block; }

/* 战役读数（人类方）：把「倒计时」这件事放在最显眼的位置。 */
.war { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(126,200,255,0.05); border: 1px solid rgba(126,200,255,0.16); }
.war:empty { display: none; }
.war .kv-row:last-child { border-bottom: none; }
.war .kv-row b.hot { color: #ff6b7a; }
.war .kv-row b.warm { color: var(--warn); }
.war .kv-row b.good { color: #5ce6a8; }
.countdown { font-family: var(--mono); font-size: 22px; letter-spacing: 1px; color: #fff; }
.countdown.warn { color: var(--warn); }
.countdown.crit { color: #ff6b7a; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

/* 战略工程按钮：人类推不动太阳，只能买时间。 */
.actions { margin-top: 18px; display: none; }
.actions.show { display: block; }
.act-row { display: grid; gap: 7px; }
.act { text-align: left; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--ink); cursor: pointer; transition: calc(180ms * var(--site-motion, 1)); }
.act b { display: block; font-size: 11.5px; letter-spacing: 0.5px; }
.act span { display: block; font-size: 10px; color: var(--dim); margin-top: 3px; line-height: 1.5; }
.act em { float: right; font-style: normal; font-family: var(--mono); font-size: 9.5px; color: var(--accent-2); }
.act:hover:not(:disabled) { border-color: var(--accent-2); background: rgba(126,200,255,0.08); }
.act:disabled { opacity: 0.4; cursor: not-allowed; }
.nudge.hide { display: none; }

/* ——— 底栏 ——— */
.bottombar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(420px, auto) 1fr 34px;
  gap: 14px;
  align-items: end;
}
.timectl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); backdrop-filter: blur(14px); }
.timectl button, .icon { font-family: var(--sans); font-size: 11px; color: #b9cfe0; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; cursor: pointer; transition: 0.18s; }
.timectl button:hover, .icon:hover { color: #fff; border-color: var(--accent-2); }
.timectl button.on { background: rgba(126,200,255,0.16); border-color: rgba(126,200,255,0.5); color: #fff; }
.timectl .play { min-width: 82px; letter-spacing: 1px; }
.timectl .speeds, .timectl .cams, .timectl .modes { display: flex; gap: 4px; }
.timectl .modes { margin-left: auto; }
.timectl em { font-family: var(--mono); font-style: normal; font-size: 9px; color: var(--dim); margin-left: 4px; }
.icon { width: 30px; height: 30px; border-radius: 50%; font-family: var(--mono); }

.log {
  height: 96px; overflow-y: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px;
  background: linear-gradient(180deg, rgba(6,10,20,0.25), rgba(8,14,26,0.8)); backdrop-filter: blur(10px);
  font-size: 11.5px; line-height: 1.75; scrollbar-width: thin;
}
.log::-webkit-scrollbar { width: 5px; }
.log::-webkit-scrollbar-thumb { background: rgba(140,180,220,0.2); }
.log .line { color: #9db3c6; }
.log .line .yr { display: inline-block; min-width: 44px; font-family: var(--mono); font-size: 10px; color: #4f6274; }
.log .line.good { color: #8fe9c3; }
.log .line.bad { color: #ffd0a0; }
.log .line.disaster { color: #ff8fa0; }
.log .line.quote { color: #6f8497; font-style: italic; }
.log .line.victory { color: #bfe8ff; }
.log .line.info { color: #a9c6dc; }

/* ——— 模态 ——— */
#overlay { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(3,6,12,0.72); backdrop-filter: blur(9px); transition: opacity calc(300ms * var(--site-motion, 1)); }
#overlay.hidden { opacity: 0; pointer-events: none; }
.inner { width: min(940px, 92vw); max-height: 92vh; overflow-y: auto; padding: 30px 34px 32px; border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-surface); box-shadow: 0 30px 90px rgba(0,0,0,0.6); }
#overlay.as-title { background: radial-gradient(120% 90% at 50% 42%, rgba(8,16,30,0.32), rgba(2,4,9,0.88)); backdrop-filter: blur(2px); }
/* 菜单四段（标题 / 阵营 / 构型 / 图鉴）用一张画出来的星野垫底：不透明，星图不再从毛玻璃后面透出来。 */
#overlay { --menu-sky: none; }
#overlay.as-menu { background: linear-gradient(rgba(3,6,13,0.34), rgba(2,4,10,0.62)), var(--menu-sky) center / cover no-repeat #04070f; backdrop-filter: none; }
.start.title { width: min(1000px, 94vw); text-align: center; animation: rise 0.7s ease both; }
.wordmark { margin: 0; font-size: calc(clamp(42px, 6.4vw, 78px) * var(--site-type, 1)); letter-spacing: clamp(8px, 1.4vw, 20px); font-weight: 600; color: var(--site-fg); text-shadow: 0 0 44px rgba(126,200,255,0.35); }
.wordmark em { font-style: normal; color: var(--accent); margin: 0 0.12em; font-size: 0.6em; vertical-align: 0.18em; }
.wordmark-sub { margin: 10px 0 0; font-family: var(--mono); font-size: 9.5px; letter-spacing: 5px; color: var(--site-muted); }
.title-lead { margin: 22px 0 0; font-size: 12.5px; line-height: 2.2; color: #9fb6c9; }
.title-sky { position: relative; width: 260px; height: 58px; margin: 0 auto 14px; }
.title-sky i { position: absolute; top: 20px; width: 18px; height: 18px; border-radius: 50%; }
.title-sky i:nth-child(1) { left: 24px; background: #9dc6ff; box-shadow: 0 0 26px 6px rgba(157,198,255,0.6); animation: waltz 11s ease-in-out infinite; }
.title-sky i:nth-child(2) { left: 118px; background: #ffd37a; box-shadow: 0 0 30px 8px rgba(255,211,122,0.55); animation: waltz 8s ease-in-out infinite reverse; }
.title-sky i:nth-child(3) { left: 208px; background: #ff8b53; box-shadow: 0 0 22px 5px rgba(255,139,83,0.5); animation: waltz 14s ease-in-out infinite; }
.title-sky b { position: absolute; left: 126px; top: 46px; width: 6px; height: 6px; border-radius: 50%; background: #7ec8ff; box-shadow: 0 0 14px 2px rgba(126,200,255,0.8); }
@keyframes waltz { 0%,100% { transform: translate(0,0); } 33% { transform: translate(-14px,-12px); } 66% { transform: translate(12px,10px); } }
.menu { display: grid; gap: 8px; width: min(430px, 84vw); margin: 36px auto 0; }
.menu-item { display: grid; grid-template-columns: 30px 1fr auto; align-items: baseline; gap: 4px 12px; text-align: left; padding: 12px 16px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.03); color: var(--ink); cursor: pointer; transition: 0.2s ease; }
.menu-item .mi-no { grid-column: 1; grid-row: 1; font-family: var(--mono); font-size: 10px; color: var(--dim); }
.menu-item b { grid-column: 2; grid-row: 1; font-size: 15px; letter-spacing: 3px; }
.menu-item i { grid-column: 2; grid-row: 2; font-style: normal; font-size: 10.5px; letter-spacing: 1px; color: var(--dim); }
.menu-item em { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-style: normal; font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: #9fb6c9; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.menu-item:hover { border-color: var(--accent); background: rgba(111,227,192,0.07); transform: translateX(6px); box-shadow: 0 0 30px rgba(0,0,0,0.4); }
.menu-item:hover b { color: #fff; }
.menu-item:focus-visible, .pick:focus-visible { outline: 1px solid var(--accent-2); outline-offset: 2px; }
.title-foot { margin: 34px 0 0; font-family: var(--mono); font-size: 9px; letter-spacing: 1.6px; color: rgba(126,147,168,0.7); }

.start.stage { width: min(1000px, 94vw); max-height: 92vh; overflow-y: auto; padding: 22px 26px 26px; border: 1px solid rgba(140,190,230,0.2); border-radius: 16px; background: var(--panel-2); box-shadow: 0 30px 90px rgba(0,0,0,0.6); animation: rise 0.4s ease both; }
.crumbs { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.crumb-back { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: #b9cfe0; font-size: 13px; cursor: pointer; transition: 0.2s; }
.crumb-back:hover { border-color: var(--accent-2); color: #fff; }
.crumb-steps { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 9px; letter-spacing: 2px; color: rgba(126,147,168,0.6); }
.crumb-steps em { font-style: normal; opacity: 0.45; }
.crumb-steps span.on { color: var(--accent); border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.crumbs h4 { margin: 0 0 0 auto; font-size: 11.5px; letter-spacing: 4px; font-weight: 500; color: #cfe6f5; }

.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pick { position: relative; text-align: left; padding: 0 0 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.03); color: var(--ink); cursor: pointer; transition: 0.22s ease; overflow: hidden; }
.pick:hover { border-color: var(--fac); transform: translateY(-3px); box-shadow: 0 20px 46px rgba(0,0,0,0.45); }
.pick.sel { border-color: var(--fac); background: rgba(255,255,255,0.06); }
.pick-sky { position: relative; height: 84px; border-bottom: 1px solid var(--line); background: radial-gradient(120% 160% at 50% 120%, rgba(30,52,84,0.5), rgba(4,8,16,0.9)); overflow: hidden; }
.pick-sky i { position: absolute; top: 30px; width: 15px; height: 15px; border-radius: 50%; }
.pick-sky i:nth-child(1) { left: 26px; background: #9dc6ff; box-shadow: 0 0 22px 5px rgba(157,198,255,0.55); animation: waltz 12s ease-in-out infinite; }
.pick-sky i:nth-child(2) { left: 108px; background: #ffd37a; box-shadow: 0 0 24px 6px rgba(255,211,122,0.5); animation: waltz 9s ease-in-out infinite reverse; }
.pick-sky i:nth-child(3) { left: 190px; background: #ff8b53; box-shadow: 0 0 20px 5px rgba(255,139,83,0.45); animation: waltz 15s ease-in-out infinite; }
.pick-sky b { position: absolute; left: 112px; top: 62px; width: 5px; height: 5px; border-radius: 50%; background: #7ec8ff; box-shadow: 0 0 12px 2px rgba(126,200,255,0.75); }
.pick-sky.terra i:nth-child(2), .pick-sky.terra i:nth-child(3) { display: none; }
.pick-sky.terra i:nth-child(1) { left: 112px; top: 20px; width: 22px; height: 22px; background: #ffd9a0; box-shadow: 0 0 30px 9px rgba(255,217,160,0.5); animation: none; }
.pick-sky.terra b { left: 176px; top: 52px; }
.pick-body { padding: 14px 18px 0; }
.pick-tag { display: inline-block; font-size: 9.5px; letter-spacing: 2px; color: var(--fac); border: 1px solid currentColor; border-radius: 999px; padding: 2px 9px; }
.pick h3 { margin: 10px 0 2px; font-size: 18px; letter-spacing: 4px; font-weight: 600; }
.pick-sub { margin: 0 0 12px; font-family: var(--mono); font-size: 9px; letter-spacing: 2px; color: var(--dim); }
.pick-pitch { margin: 0 0 14px; font-size: 11.5px; line-height: 1.95; color: #93a9bd; }
.pick-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.pick-facts li { display: grid; grid-template-columns: 82px 1fr; gap: 10px; font-size: 10.5px; line-height: 1.75; color: #8ba2b6; }
.pick-facts b { color: var(--fac); font-weight: 500; letter-spacing: 1px; white-space: nowrap; }
.pick-go { display: block; margin-top: 14px; font-size: 10px; letter-spacing: 2px; color: var(--fac); }
.pick-foot { margin: 18px 0 0; text-align: center; font-size: 10.5px; line-height: 1.85; color: var(--dim); }

.setup { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); gap: 22px; align-items: start; }
.setup-fac { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; border-left: 2px solid var(--fac, var(--accent)); background: rgba(255,255,255,0.03); border-radius: 0 10px 10px 0; }
.setup-fac b { font-size: 14px; letter-spacing: 3px; }
.setup-fac i { font-style: normal; font-family: var(--mono); font-size: 8.5px; letter-spacing: 1.6px; color: var(--dim); }
.setup-fac em { margin-left: auto; font-style: normal; font-size: 9.5px; letter-spacing: 1.5px; color: var(--fac, var(--accent)); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; }
.setup-side .fac-detail { margin: 14px 0 0; }
.setup-main .sec-title { margin-top: 0; }
.preset-grid { display: grid; gap: 12px; }
.card.sel .card-head b { color: #fff; }
.fac-detail { margin: 14px 0 20px; padding: 14px 18px; border-left: 2px solid var(--line); background: rgba(255,255,255,0.02); border-radius: 0 10px 10px 0; }
.fac-detail p { margin: 0 0 8px; font-size: 12px; line-height: 2; color: #9fb6c9; }
.fac-detail p:last-child { margin-bottom: 0; color: #cfe6f5; }
.sec-title { margin: 22px 0 10px; font-size: 11px; letter-spacing: 4px; color: var(--dim); font-weight: 500; }
.card { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--site-radius); background: rgba(255,255,255,0.03); cursor: pointer; transition: calc(200ms * var(--site-motion, 1)); }
.card input { accent-color: var(--accent); margin-top: 3px; }
.card.sel { border-color: var(--accent); background: rgba(111,227,192,0.08); box-shadow: 0 0 26px rgba(111,227,192,0.1) inset; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card-head b { font-size: 13.5px; letter-spacing: 1px; }
.card-head span { font-size: 10px; color: var(--warn); }
.card p { margin: 6px 0 0; font-size: 11.5px; line-height: 1.85; color: #8ba2b6; }
.start-actions { display: flex; justify-content: flex-end; align-items: center; gap: 20px; margin-top: 22px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; }
button.primary { padding: 11px 26px; border-radius: calc(var(--site-radius) * 0.75); border: none; background: var(--site-accent); color: var(--site-on-accent); font-size: 13px; font-weight: 700; letter-spacing: 2px; cursor: pointer; box-shadow: 0 0 26px rgba(111,227,192,0.35); }
button.primary:hover { filter: brightness(1.15); }
button.ghost { padding: 11px 20px; border-radius: calc(var(--site-radius) * 0.75); border: 1px solid var(--site-border); background: transparent; color: #b9cfe0; font-size: 12px; letter-spacing: 1px; cursor: pointer; }
button.ghost:hover { border-color: var(--accent-2); color: #fff; }

/* ——— 全结局图鉴 ——— */
/* 连接线全部由伪元素画：li 之间不留 margin，竖干才能首尾相接；
   最后一个 li 的竖干只画到横枝那一线为止，树才不会一直往下长。 */
.start.codex { width: min(1180px, 95vw); }
.codex-lead { margin: 0 0 18px; font-size: 11.5px; line-height: 1.95; color: #9fb6c9; }
.codex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 26px; align-items: start; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree li { position: relative; padding-left: 17px; }
.tree li::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tree li::before { content: ''; position: absolute; left: 0; top: 15px; width: 13px; height: 1px; background: var(--line); }
.tree li:last-child::after { bottom: auto; height: 15px; }
.node.root { margin: 0 0 10px; padding: 11px 14px; border: 1px solid var(--line); border-left: 2px solid var(--fac); border-radius: 0 12px 12px 0; background: rgba(255,255,255,0.03); }
.node.root b { display: block; font-size: 13.5px; letter-spacing: 3px; color: var(--fac); }
.node.root i { display: block; margin-top: 5px; font-style: normal; font-size: 10.5px; line-height: 1.8; color: var(--site-muted); }
.node.br { display: flex; align-items: baseline; gap: 9px; padding: 3px 0 9px; }
.node.br b { font-size: 12px; letter-spacing: 1.4px; color: #d9e9f6; }
.node.br em { font-style: normal; font-family: var(--mono); font-size: 8.5px; letter-spacing: 1.2px; color: rgba(126,147,168,0.85); }
.node.br .cnt { margin-left: auto; font-family: var(--mono); font-size: 8.5px; color: var(--fac); opacity: 0.8; }
.leaf { padding: 0 0 13px; }
.leaf:last-child { padding-bottom: 3px; }
.leaf-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.leaf-head b { font-size: 12.5px; letter-spacing: 1.6px; color: #eaf4ff; }
.leaf-head b::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 8px; vertical-align: 2px; background: var(--tone); box-shadow: 0 0 9px var(--tone); }
.leaf-head i { font-style: normal; font-size: 9px; letter-spacing: 1px; color: var(--dim); }
.leaf-head .bdg { font-size: 8.5px; letter-spacing: 1px; color: #9fb6c9; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.leaf-cond { margin: 4px 0 0; font-size: 11px; line-height: 1.8; color: #b7cbdb; }
.leaf-cond::before { content: '触发'; margin-right: 6px; font-family: var(--mono); font-size: 8.5px; letter-spacing: 1px; color: var(--tone); border-bottom: 1px solid currentColor; }
.leaf-body { margin: 4px 0 0; font-size: 10.5px; line-height: 1.75; color: rgba(126,147,168,0.85); }
.leaf.good { --tone: var(--accent); }
.leaf.warn { --tone: var(--warn); }
.leaf.bad { --tone: var(--bad); }
.leaf.sys { --tone: #8ea6bc; }
.leaf-fx { margin-top: 7px; padding: 3px 10px; font: 9px/1.6 var(--mono); letter-spacing: 1.2px; color: var(--dim); background: none; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: color calc(180ms * var(--site-motion, 1)), border-color calc(180ms * var(--site-motion, 1)); }
.leaf-fx:hover, .leaf-fx:focus-visible { color: var(--tone); border-color: currentColor; }
.pause-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.pause-grid button { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pause-grid button em { font-family: var(--mono); font-style: normal; font-size: 9px; letter-spacing: 1px; color: rgba(4,18,12,0.6); }
.pause-grid button.ghost em { color: var(--dim); }
button.danger { padding: 11px 20px; border-radius: 9px; border: 1px solid rgba(255,107,122,0.45); background: rgba(255,107,122,0.07); color: #ffb3bd; font-size: 12px; letter-spacing: 1px; cursor: pointer; }
button.danger:hover { border-color: #ff6b7a; background: rgba(255,107,122,0.16); color: #fff; }
.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.rules div { font-size: 11px; line-height: 1.8; color: #8ba2b6; }
.rules b { display: block; color: var(--ink); letter-spacing: 2px; font-size: 10px; margin-bottom: 4px; }

.modal-kicker { font-size: 10px; letter-spacing: 4px; color: var(--warn); }
.modal h2 { margin: 8px 0 14px; font-size: 26px; letter-spacing: 4px; }
.modal .body { font-size: 13px; line-height: 2.1; color: #a9c0d2; margin: 0 0 22px; }
.choices { display: grid; gap: 10px; }
.choice { text-align: left; padding: 14px 16px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--ink); cursor: pointer; transition: 0.2s; }
.choice b { display: block; font-size: 13px; letter-spacing: 0.5px; }
.choice span { display: block; margin-top: 5px; font-size: 11px; color: var(--dim); font-family: var(--mono); }
.choice:hover { border-color: var(--accent); background: rgba(111,227,192,0.07); }
.choice:hover b { color: #fff; }
.final-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 22px 0; }
.final-grid div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,0.03); }
.final-grid span { display: block; font-size: 10px; color: var(--dim); letter-spacing: 1px; }
.final-grid b { display: block; font-family: var(--mono); font-size: 16px; margin-top: 4px; }
.end.lose h2 { color: #ff8fa0; }
.end.win h2 { color: #8fe9c3; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 26px; margin-top: 6px; }
.help-grid section { border-left: 1px solid var(--line); padding-left: 14px; }
.help-grid h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: 2px; color: var(--accent-2); }
.help-grid p { margin: 0; font-size: 11.5px; line-height: 1.95; color: #9fb6c9; }
.help-grid b { color: var(--ink); }
.keys kbd { font-family: var(--mono); font-size: 10px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,0.05); color: #cfe6f5; margin: 0 2px; }

.toasts { position: fixed; left: 50%; bottom: 160px; transform: translateX(-50%); z-index: 6; display: grid; gap: 7px; justify-items: center; pointer-events: none; }
.banner { position: fixed; top: 86px; left: 50%; transform: translate(-50%, -18px); z-index: 4; pointer-events: none; opacity: 0; transition: opacity 0.55s ease, transform 0.55s ease; }
.banner.show { opacity: 1; transform: translate(-50%, 0); }
.bn-in { display: grid; justify-items: center; gap: 3px; padding: 14px 34px; border-radius: 12px; border: 1px solid rgba(140,190,230,0.22); background: linear-gradient(180deg, rgba(10,18,32,0.86), rgba(6,10,20,0.7)); backdrop-filter: blur(10px); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.bn-in em { font-style: normal; font-size: 9.5px; letter-spacing: 4px; color: var(--warn); }
.bn-in b { font-size: 19px; letter-spacing: 6px; color: #fff; }
.bn-in span { font-size: 11.5px; color: #9fb6c9; max-width: 62vw; line-height: 1.8; }
.toast { padding: 8px 16px; border-radius: 999px; font-size: 12px; letter-spacing: 1px; background: rgba(10,20,34,0.9); border: 1px solid var(--accent); color: #dff5ec; box-shadow: 0 0 24px rgba(0,0,0,0.5); animation: rise 0.28s ease; transition: opacity 0.5s, transform 0.5s; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1180px) {
  #hud { grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 10px 8px; }
  .panel.left { grid-column: 1; }
  .panel.right { grid-column: 2; }
  .bottombar { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .rules, .help-grid, .final-grid { grid-template-columns: 1fr 1fr; }
  .codex-grid { grid-template-columns: 1fr; }
  .brand h1 { font-size: 15px; letter-spacing: 2px; }
  .brand p { display: none; }
  .year span { font-size: 20px; }
  .era-badge { font-size: 11px; letter-spacing: 2px; padding: 5px 11px; }
  .flux { width: 150px; }
  .flux-legend span:first-child, .flux-legend span:last-child { display: none; }
  .objective { width: 130px; }
  .timectl { gap: 5px; }
  .timectl .cams { display: none; }
}

@media (max-width: 1000px) {
  .pick-grid, .setup { grid-template-columns: 1fr; }
  .wordmark { letter-spacing: 8px; }
  .title-foot { display: none; }
}

@media (max-width: 760px) {
  #hud { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr) auto; }
  .panel.left, .panel.right { grid-column: 1; }
  .panel.left { grid-row: 2; }
  .panel.right { grid-row: 3; }
  .clock { gap: 10px; }
  .flux { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
}

/* ——— 结局演出 ——— */
/* 演出画在结局面板之上：先看清「怎么没的」，面板再淡进来给出史书。 */
#endfx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 8; pointer-events: none; opacity: 0; transition: opacity calc(220ms * var(--site-motion, 1)) ease; }
#endfx.on { opacity: 1; }
.modal.end.fx-in { animation: endIn 0.8s ease 0.8s both; }
@keyframes endIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal.end.fx-in { animation: none; }
}
