/* ============================================================
   《熵潮彼岸 · 提灯远航录》 全局样式
   主题: 深空黑 + 琥珀灯火 + 青蓝辉光 / 移动端优先
   ============================================================ */
:root {
  --bg: #070b16;
  --bg2: #0b1224;
  --panel: rgba(16, 24, 46, .82);
  --panel2: rgba(22, 32, 60, .65);
  --line: rgba(127, 178, 255, .16);
  --line2: rgba(255, 180, 84, .35);
  --ink: #e8edf8;
  --dim: #93a2c3;
  --faint: #5a6a8f;
  --amber: #ffb454;
  --amber-deep: #c97e2a;
  --cyan: #7fd8e8;
  --gold: #ffd98a;
  --red: #ff6b6b;
  --green: #7de8a2;
  --purple: #b18cff;
  --radius: 14px;
  --font-ui: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-story: "Kaiti SC", "KaiTi", "STKaiti", "Noto Serif SC", "SimSun", serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- 星空背景 ---------- */
.nebula, .stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.nebula {
  background:
    radial-gradient(60vmax 40vmax at 85% -10%, rgba(255, 160, 70, .10), transparent 60%),
    radial-gradient(50vmax 40vmax at -10% 30%, rgba(80, 140, 255, .10), transparent 60%),
    radial-gradient(40vmax 40vmax at 60% 110%, rgba(150, 90, 255, .08), transparent 60%),
    linear-gradient(180deg, #05070f 0%, #0a1122 55%, #070b16 100%);
  animation: drift 60s ease-in-out infinite alternate;
}
.stars {
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, #ffffffcc, transparent 55%),
    radial-gradient(1.1px 1.1px at 64% 12%, #ffe9c4bb, transparent 55%),
    radial-gradient(1.7px 1.7px at 83% 47%, #ffffffbb, transparent 55%),
    radial-gradient(1px 1px at 33% 68%, #cfe6ffcc, transparent 55%),
    radial-gradient(1.3px 1.3px at 51% 86%, #ffffffaa, transparent 55%),
    radial-gradient(1px 1px at 91% 76%, #ffd9a8bb, transparent 55%),
    radial-gradient(1.2px 1.2px at 8% 55%, #ffffffaa, transparent 55%),
    radial-gradient(1px 1px at 42% 38%, #9fd4ffcc, transparent 55%);
  background-size: 520px 520px;
  animation: twinkle 7s ease-in-out infinite alternate;
}
.stars.s2 {
  background-image:
    radial-gradient(1px 1px at 22% 82%, #ffffffaa, transparent 55%),
    radial-gradient(1px 1px at 74% 33%, #ffd9a899, transparent 55%),
    radial-gradient(1px 1px at 48% 8%, #ffffff99, transparent 55%),
    radial-gradient(1.2px 1.2px at 90% 88%, #cfe6ffaa, transparent 55%),
    radial-gradient(1px 1px at 5% 8%, #ffffffaa, transparent 55%);
  background-size: 300px 300px;
  animation-delay: -3s;
}
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }
@keyframes drift { from { transform: translate3d(0,0,0) } to { transform: translate3d(-1.5%, 1%, 0) } }

/* ---------- 布局 ---------- */
#app { position: fixed; inset: 0; z-index: 1; }
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  overflow: hidden;
}
.screen.active { display: flex; animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
.scroll::-webkit-scrollbar { width: 4px; }
.scroll::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 2px; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
}
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--line2);
  background: linear-gradient(180deg, rgba(255, 180, 84, .16), rgba(255, 180, 84, .06));
  color: var(--gold);
  font-size: 15px;
  letter-spacing: 1px;
  transition: transform .08s, filter .15s, opacity .15s;
  text-align: center;
}
.btn:active { transform: scale(.97); filter: brightness(1.25); }
.btn.primary {
  background: linear-gradient(180deg, #ffb454, #d0832f);
  color: #241300; font-weight: 700;
  border-color: rgba(255, 220, 160, .7);
  box-shadow: 0 4px 18px rgba(255, 170, 60, .35), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn.ghost { border-color: var(--line); background: rgba(127, 178, 255, .06); color: var(--ink); }
.btn.danger { border-color: rgba(255, 107, 107, .5); background: rgba(255, 107, 107, .10); color: var(--red); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled, .btn.disabled { opacity: .38; pointer-events: none; filter: grayscale(.6); }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; letter-spacing: .5px;
  border: 1px solid var(--line);
  background: rgba(127, 178, 255, .07);
  color: var(--dim);
}
.tag.amber { border-color: var(--line2); color: var(--amber); background: rgba(255, 180, 84, .08); }
.tag.red { border-color: rgba(255,107,107,.4); color: var(--red); background: rgba(255,107,107,.07); }
.tag.green { border-color: rgba(125,232,162,.4); color: var(--green); background: rgba(125,232,162,.07); }
.tag.cyan { border-color: rgba(127,216,232,.4); color: var(--cyan); background: rgba(127,216,232,.07); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.hr-glow { height: 1px; margin: 14px 0; background: linear-gradient(90deg, transparent, var(--line2), transparent); }

/* ---------- 顶栏(资源) ---------- */
.topbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  z-index: 5;
}
.res {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--ink);
  padding: 3px 9px; border-radius: 999px;
  background: rgba(127, 178, 255, .07);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.res b { font-weight: 600; font-variant-numeric: tabular-nums; }
.res.warn b { color: var(--red); }
.res .lb { color: var(--faint); font-size: 11px; }
.res.ember { border-color: var(--line2); background: rgba(255, 180, 84, .08); }
.res.ember b { color: var(--amber); }
.topbar .spacer { flex: 1; }
.iconbtn {
  width: 34px; height: 34px; border-radius: 10px; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: rgba(127, 178, 255, .07);
}
.iconbtn:active { transform: scale(.92); }

/* ---------- 标题页 ---------- */
#screen-title { align-items: center; justify-content: center; text-align: center; gap: 0; }
.title-flame { font-size: 64px; animation: flicker 3.2s ease-in-out infinite; filter: drop-shadow(0 0 22px rgba(255, 170, 60, .55)); }
@keyframes flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  42% { opacity: .82; transform: scale(.985) rotate(-1.2deg); }
  46% { opacity: 1; transform: scale(1.01); }
  70% { opacity: .9; }
}
.game-title {
  font-family: var(--font-story);
  font-size: clamp(38px, 11vw, 64px);
  font-weight: 700; letter-spacing: 10px; text-indent: 10px;
  margin: 6px 0 2px;
  background: linear-gradient(180deg, #fff3dd 15%, var(--amber) 55%, #a35b12 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 34px rgba(255, 170, 60, .25);
}
.game-sub { color: var(--dim); letter-spacing: 6px; font-size: 13px; margin-bottom: 6px; }
.title-quote { font-family: var(--font-story); color: var(--faint); font-size: 14px; margin: 14px 18px 30px; line-height: 2; }
.title-menu { display: flex; flex-direction: column; gap: 11px; width: min(320px, 84vw); }
.title-foot { position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); font-size: 11px; color: var(--faint); letter-spacing: 1px; }

/* ---------- 叙事页(序章/过场) ---------- */
.story-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 720px; width: 100%; margin: 0 auto; }
.story-card { padding: 26px 22px; }
.story-icon { font-size: 46px; text-align: center; margin-bottom: 14px; filter: drop-shadow(0 0 16px rgba(255,170,60,.4)); }
.story-text {
  font-family: var(--font-story);
  font-size: 17.5px; line-height: 2.15; color: var(--ink);
  min-height: 200px; white-space: pre-wrap;
}
.story-text.dim { color: var(--dim); }
.story-text .hl { color: var(--amber); }
.story-text .cy { color: var(--cyan); }
.story-text .rd { color: var(--red); }
.story-actions { display: flex; gap: 10px; margin-top: 20px; }
.story-actions .btn { flex: 1; }
.caret { display: inline-block; width: 2px; height: 1.05em; background: var(--amber); vertical-align: -0.15em; animation: caret 1s steps(1) infinite; margin-left: 2px; }
@keyframes caret { 50% { opacity: 0; } }

/* ---------- 出身选择 ---------- */
.origin-list { display: flex; flex-direction: column; gap: 12px; max-width: 720px; width: 100%; margin: 0 auto; }
.origin-card { padding: 16px; text-align: left; transition: transform .1s, border-color .2s; }
.origin-card:active { transform: scale(.98); }
.origin-card.sel { border-color: var(--amber); box-shadow: 0 0 24px rgba(255, 170, 60, .18); }
.origin-head { display: flex; align-items: center; gap: 12px; }
.origin-ico { font-size: 34px; }
.origin-name { font-size: 17px; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.origin-desc { font-size: 13px; color: var(--dim); margin-top: 8px; line-height: 1.75; }
.origin-perk { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.locked { opacity: .55; }

/* ---------- 主界面 / 星图 ---------- */
#screen-map { gap: 8px; }
.map-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.map-title { font-family: var(--font-story); font-size: 16px; color: var(--gold); letter-spacing: 2px; }
.map-sub { font-size: 12px; color: var(--faint); }
.map-body { flex: 1; min-height: 0; display: flex; align-items: stretch; justify-content: center; }
#map-svg { width: 100%; height: 100%; touch-action: pan-x pan-y; }
.map-legend { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 2px; }
.node-detail {
  padding: 13px 15px;
  display: flex; align-items: center; gap: 12px;
  animation: slideup .25s ease;
}
@keyframes slideup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.node-ico { font-size: 30px; }
.node-info { flex: 1; min-width: 0; }
.node-name { font-size: 15px; color: var(--gold); font-weight: 600; letter-spacing: 1px; }
.node-desc { font-size: 12.5px; color: var(--dim); margin-top: 3px; line-height: 1.6; }

svg .trail { stroke: rgba(255, 180, 84, .30); stroke-width: 2.6; fill: none; stroke-linecap: round; }
svg .link { stroke: rgba(127, 178, 255, .18); stroke-width: 2; fill: none; }
svg .link.open { stroke: rgba(255, 180, 84, .55); stroke-width: 2.4; stroke-dasharray: 5 5; animation: dashmove 1.2s linear infinite; }
@keyframes dashmove { to { stroke-dashoffset: -20; } }
svg .nd { cursor: pointer; }
svg .nd circle.body { fill: rgba(14, 22, 44, .92); stroke: rgba(127, 178, 255, .3); stroke-width: 1.6; }
svg .nd.reachable circle.body { stroke: var(--amber); filter: drop-shadow(0 0 6px rgba(255, 170, 60, .7)); animation: nodepulse 1.6s ease-in-out infinite; }
svg .nd.current circle.body { stroke: var(--cyan); filter: drop-shadow(0 0 8px rgba(127, 216, 232, .8)); }
svg .nd.visited circle.body { fill: rgba(40, 52, 84, .55); stroke: rgba(127, 178, 255, .18); }
svg .nd text { fill: var(--dim); font-size: 13px; text-anchor: middle; pointer-events: none; }
svg .nd.visited text { fill: var(--faint); }
svg .nd.sel circle.body { stroke: #fff; stroke-width: 2.4; }
@keyframes nodepulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.09); } }
svg .nd { transform-box: fill-box; transform-origin: center; }

/* ---------- 事件界面 ---------- */
#screen-event { justify-content: center; }
.ev-card { max-width: 720px; width: 100%; margin: 0 auto; padding: 22px 20px; display: flex; flex-direction: column; max-height: 100%; }
.ev-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ev-ico { font-size: 34px; filter: drop-shadow(0 0 12px rgba(255, 170, 60, .45)); }
.ev-title { font-family: var(--font-story); font-size: 20px; color: var(--gold); letter-spacing: 2px; flex: 1; }
.ev-tagline { font-size: 11.5px; color: var(--faint); }
.ev-text {
  font-family: var(--font-story);
  font-size: 16.5px; line-height: 2.05; color: var(--ink);
  white-space: pre-wrap; overflow-y: auto; min-height: 96px;
  padding: 4px 2px; user-select: text; -webkit-user-select: text;
}
.ev-text.dim { color: var(--dim); }
.ev-opts { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.ev-opt {
  text-align: left; padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(127, 178, 255, .05);
  font-size: 14.5px; line-height: 1.6; color: var(--ink);
  transition: transform .08s, border-color .15s;
  display: flex; flex-direction: column; gap: 4px;
}
.ev-opt:active { transform: scale(.98); border-color: var(--amber); }
.ev-opt .opt-main { display: flex; align-items: center; gap: 8px; }
.ev-opt .req { color: var(--cyan); font-size: 12px; }
.ev-opt .chk { color: var(--amber); font-size: 12px; }
.ev-opt.no { opacity: .42; }
.ev-opt .why { font-size: 11.5px; color: var(--red); }
.ev-result { margin-top: 14px; padding: 14px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(255, 180, 84, .05); }

/* ---------- 效果结算条 ---------- */
.gain-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gain {
  font-size: 12.5px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(125, 232, 162, .45); color: var(--green);
  background: rgba(125, 232, 162, .07);
  animation: popin .3s ease;
}
.gain.neg { border-color: rgba(255, 107, 107, .45); color: var(--red); background: rgba(255, 107, 107, .07); }
.gain.info { border-color: var(--line); color: var(--cyan); background: rgba(127, 216, 232, .06); }
@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- 战斗 ---------- */
#screen-combat { gap: 8px; }
.cb-enemy, .cb-self { padding: 13px 15px; }
.cb-enemy { border-color: rgba(255, 107, 107, .3); }
.cb-head { display: flex; align-items: center; gap: 10px; }
.cb-name { font-size: 16px; font-weight: 700; letter-spacing: 1px; flex: 1; }
.cb-ico { font-size: 30px; filter: drop-shadow(0 0 10px rgba(255, 90, 90, .5)); animation: hover 3s ease-in-out infinite; }
.cb-self .cb-ico { filter: drop-shadow(0 0 10px rgba(127, 216, 232, .5)); }
@keyframes hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.bar { height: 10px; border-radius: 6px; background: rgba(0, 0, 0, .5); border: 1px solid var(--line); overflow: hidden; margin-top: 7px; position: relative; }
.bar > i { display: block; height: 100%; border-radius: 6px; transition: width .4s ease; }
.bar.hull > i { background: linear-gradient(90deg, #ff8560, #ff4d4d); }
.bar.shield > i { background: linear-gradient(90deg, #7fd8e8, #3f8cff); }
.bar.heat > i { background: linear-gradient(90deg, #ffb454, #ff6b6b); }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); margin-top: 7px; }
.bar-row .bar { flex: 1; margin-top: 0; }
.intent {
  margin-top: 8px; font-size: 12.5px; color: var(--red);
  border: 1px dashed rgba(255, 107, 107, .4); border-radius: 10px;
  padding: 7px 11px; background: rgba(255, 107, 107, .05);
}
.intent.calm { color: var(--cyan); border-color: rgba(127, 216, 232, .35); background: rgba(127, 216, 232, .05); }
.cb-actions { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.cb-acts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; overflow-y: auto; }
.cb-act {
  text-align: left; padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(127, 178, 255, .05);
  display: flex; flex-direction: column; gap: 3px; font-size: 13.5px;
  transition: transform .08s;
}
.cb-act:active { transform: scale(.97); border-color: var(--amber); }
.cb-act:disabled { opacity: .4; }
.cb-act .cd { color: var(--amber); font-size: 11.5px; }
.cb-act .desc { color: var(--dim); font-size: 11.5px; line-height: 1.5; }
.cb-act.skill { border-color: rgba(177, 140, 255, .4); background: rgba(177, 140, 255, .06); }
.cb-log {
  height: 92px; padding: 8px 12px; font-size: 12.5px; line-height: 1.8;
  color: var(--dim); overflow-y: auto;
  border-top: 1px solid var(--line);
}
.cb-log .em { color: var(--amber); }
.cb-log .bad { color: var(--red); }
.cb-log .good { color: var(--green); }
.dmg-float {
  position: absolute; font-size: 22px; font-weight: 800; pointer-events: none; z-index: 30;
  animation: floatup .9s ease-out forwards;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
}
@keyframes floatup { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-46px) scale(1.35); } }
.shake { animation: shake .35s ease; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-7px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }

/* ---------- 港口 ---------- */
.port-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.port-svc { padding: 14px 12px; text-align: center; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.port-svc .pi { font-size: 26px; }
.port-svc .pn { font-size: 14px; color: var(--gold); letter-spacing: 1px; }
.port-svc .pd { font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.shop-list { display: flex; flex-direction: column; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; }
.shop-item .si { font-size: 24px; }
.shop-item .sn { font-size: 14px; color: var(--ink); }
.shop-item .sd { font-size: 11.5px; color: var(--dim); margin-top: 2px; line-height: 1.5; }
.shop-item .sp { margin-left: auto; text-align: right; }
.price { color: var(--amber); font-size: 14px; font-weight: 600; white-space: nowrap; }

/* ---------- 船员 / 货舱 / 面板 ---------- */
.panel-page { max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.crew-card { padding: 13px 15px; display: flex; gap: 12px; align-items: flex-start; }
.crew-ico { font-size: 32px; }
.crew-name { font-size: 15.5px; font-weight: 700; color: var(--gold); }
.crew-role { font-size: 11.5px; color: var(--cyan); margin-left: 6px; }
.crew-bio { font-size: 12px; color: var(--dim); line-height: 1.7; margin-top: 5px; font-family: var(--font-story); }
.crew-stats { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.loyal { color: var(--amber); font-size: 12px; }
.hp-dots { letter-spacing: 2px; font-size: 12px; }
.cargo-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; }

/* ---------- 图鉴 ---------- */
.codex-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.codex-tab { flex-shrink: 0; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); font-size: 13px; letter-spacing: 1px; }
.codex-tab.on { color: var(--gold); border-color: var(--line2); background: rgba(255, 180, 84, .09); }
.codex-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; }
.codex-item.locked { opacity: .45; }
.codex-detail { padding: 18px; }
.codex-detail h3 { font-family: var(--font-story); color: var(--gold); letter-spacing: 2px; margin-bottom: 10px; font-size: 18px; }
.codex-detail p { font-family: var(--font-story); font-size: 14.5px; line-height: 2; color: var(--dim); white-space: pre-wrap; }

/* ---------- 结局 ---------- */
#screen-ending { align-items: center; justify-content: center; text-align: center; }
.end-title {
  font-family: var(--font-story); letter-spacing: 8px; text-indent: 8px;
  font-size: clamp(30px, 9vw, 52px); font-weight: 700; margin-bottom: 8px;
}
.end-tier { margin-bottom: 18px; }
.end-text {
  font-family: var(--font-story); font-size: 16px; line-height: 2.2; color: var(--ink);
  max-width: 640px; text-align: left; white-space: pre-wrap;
  max-height: 46vh; overflow-y: auto; padding: 0 6px;
}
.end-stats { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin: 18px 0; }
.ember-fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.ember-fx i {
  position: absolute; bottom: -3%; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle, #ffd98a, #ff8c1a 70%, transparent);
  opacity: 0; animation: rise linear infinite;
  filter: blur(.4px);
}
@keyframes rise {
  0% { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
  12% { opacity: .9; }
  100% { transform: translateY(-108vh) translateX(var(--dx, 20px)) scale(.2); opacity: 0; }
}

.intent-attack { color: var(--red); border-color: rgba(255,107,107,.4); background: rgba(255,107,107,.05); }
.intent-bigattack { color: var(--red); border-color: rgba(255,107,107,.5); background: rgba(255,107,107,.08); }
.intent-charge { color: var(--amber); border-color: rgba(255,180,84,.4); background: rgba(255,180,84,.05); }
.intent-defend { color: var(--cyan); border-color: rgba(127,216,232,.35); background: rgba(127,216,232,.05); }
.intent-curse { color: var(--purple); border-color: rgba(177,140,255,.35); background: rgba(177,140,255,.05); }

/* ---------- 弹窗 / Toast ---------- */
#modal-root { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(4, 6, 12, .72); backdrop-filter: blur(4px); }
#modal-root.on { display: flex; }
.modal { max-width: 560px; width: 100%; max-height: 84vh; display: flex; flex-direction: column; padding: 20px; animation: slideup .25s ease; }
.modal h3 { font-family: var(--font-story); letter-spacing: 2px; color: var(--gold); margin-bottom: 12px; font-size: 18px; }
.modal .mbody { overflow-y: auto; font-size: 14px; line-height: 1.9; color: var(--dim); }
.modal .mfoot { display: flex; gap: 9px; margin-top: 16px; }
.modal .mfoot .btn { flex: 1; }
#toasts { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 0; right: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 7px; pointer-events: none; }
.toast {
  padding: 9px 18px; border-radius: 999px; font-size: 13.5px; letter-spacing: .5px;
  background: rgba(14, 22, 44, .92); border: 1px solid var(--line2); color: var(--gold);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .5);
  animation: toastin .3s ease, toastout .4s ease 2.3s forwards;
  max-width: 88vw; text-align: center;
}
.toast.bad { border-color: rgba(255, 107, 107, .5); color: var(--red); }
.toast.good { border-color: rgba(125, 232, 162, .5); color: var(--green); }
.toast.info { border-color: rgba(127, 216, 232, .5); color: var(--cyan); }
@keyframes toastin { from { opacity: 0; transform: translateY(-14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- 日志面板 ---------- */
.log-list { display: flex; flex-direction: column; gap: 7px; }
.log-item { font-size: 12.5px; color: var(--dim); line-height: 1.7; padding: 7px 11px; border-left: 2px solid var(--line2); background: rgba(127, 178, 255, .04); border-radius: 0 9px 9px 0; }
.log-item b { color: var(--amber); font-weight: 600; }

/* ---------- 编年史 / 回响商店 ---------- */
.echo-balance { display: flex; align-items: center; gap: 9px; padding: 12px 15px; font-size: 14px; }
.echo-balance .big { font-size: 22px; color: var(--amber); font-weight: 800; }
.unlock-item { display: flex; align-items: center; gap: 11px; padding: 12px 13px; }
.unlock-item .ui2 { font-size: 24px; }
.unlock-item .un { font-size: 14px; color: var(--gold); }
.unlock-item .ud { font-size: 11.5px; color: var(--dim); margin-top: 2px; line-height: 1.5; }
.record-item { padding: 10px 13px; font-size: 12.5px; color: var(--dim); line-height: 1.8; }
.record-item b { color: var(--gold); }

/* ---------- 开发面板 ---------- */
#dev-panel { position: fixed; right: 8px; bottom: 8px; z-index: 99; display: none; flex-direction: column; gap: 5px; padding: 10px; background: rgba(10, 14, 28, .95); border: 1px solid var(--red); border-radius: 12px; font-size: 12px; }
#dev-panel.on { display: flex; }
#dev-panel button { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; color: var(--ink); background: rgba(127, 178, 255, .08); }

/* ---------- 响应式(宽屏) ---------- */
@media (min-width: 780px) {
  .screen { padding: 18px; }
  .topbar { padding: 10px 16px; }
  .story-text { font-size: 18.5px; }
  .ev-card { padding: 28px 30px; }
  .port-grid { grid-template-columns: repeat(3, 1fr); }
  .cb-acts-grid { grid-template-columns: repeat(3, 1fr); }
  .panel-page { padding-top: 12px; }
}
@media (max-height: 640px) {
  .story-text { min-height: 120px; font-size: 15.5px; line-height: 1.9; }
  .cb-log { height: 64px; }
  .title-quote { margin-bottom: 16px; }
}

/* ============================================================
   浅色模式 (body.light) — 晨海曙光主题
   ============================================================ */
body.light {
  --bg: #e9eef8; --bg2: #dfe7f4;
  --panel: rgba(255, 255, 255, .9);
  --panel2: rgba(241, 246, 253, .85);
  --line: rgba(58, 86, 138, .25);
  --line2: rgba(190, 125, 40, .55);
  --ink: #1d2c48; --dim: #49597c; --faint: #7c8bad;
  --amber: #c8791c; --amber-deep: #9c5c10;
  --cyan: #1186a6; --gold: #8f6410;
  --red: #c0392b; --green: #1d7d4d; --purple: #6b44c4;
}
body.light .nebula {
  background:
    radial-gradient(60vmax 40vmax at 85% -10%, rgba(255, 194, 122, .4), transparent 60%),
    radial-gradient(50vmax 40vmax at -10% 30%, rgba(140, 182, 240, .35), transparent 60%),
    radial-gradient(40vmax 40vmax at 60% 110%, rgba(190, 163, 255, .25), transparent 60%),
    linear-gradient(180deg, #d8e7f8 0%, #eef3fb 55%, #e6edf8 100%);
  animation: none;
}
body.light .stars { opacity: .3; animation: none; }
body.light .card { box-shadow: 0 4px 16px rgba(70, 95, 140, .16); }
body.light .btn.ghost { background: rgba(58, 86, 138, .07); }
body.light .btn.danger { background: rgba(192, 57, 43, .1); }
body.light .btn.primary { box-shadow: 0 4px 14px rgba(196, 122, 28, .3), inset 0 1px 0 rgba(255, 255, 255, .5); }
body.light .res, body.light .tag { background: rgba(58, 86, 138, .08); }
body.light svg .trail { stroke: rgba(196, 122, 28, .5); }
body.light svg .link { stroke: rgba(58, 86, 138, .3); }
body.light svg .link.open { stroke: rgba(196, 122, 28, .8); }
body.light svg .nd circle.body { fill: rgba(255, 255, 255, .96); stroke: rgba(58, 86, 138, .45); }
body.light svg .nd.visited circle.body { fill: rgba(216, 228, 245, .85); stroke: rgba(58, 86, 138, .3); }
body.light svg .nd.sel circle.body { stroke: #1d2c48; }
body.light #modal-root { background: rgba(214, 226, 242, .6); }
body.light .toast { background: rgba(255, 255, 255, .96); box-shadow: 0 6px 20px rgba(70, 95, 140, .25); }
body.light .dmg-float { text-shadow: 0 2px 8px rgba(255, 255, 255, .9); }
body, .card { transition: background .25s ease, border-color .25s ease; }
