/* ==========================================================================
 * 修仙·问道 — 布局与组件
 * ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--line-height);
  transition: background-color .15s ease, color .15s ease;
  overflow: hidden;
}
#app {
  height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 255, 255, .035), transparent 60%),
    var(--bg);
  transition: background-color .15s ease;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 700; margin: 0 0 .4em; line-height: 1.25; }
p { margin: 0 0 .7em; }
.dim { color: var(--text-dim); }
.gold { color: var(--accent); }
.bad { color: var(--danger); }
.good { color: var(--success); }
.mono { font-family: var(--font-mono); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------- 屏幕 */
.screen { display: none; flex: 1; min-height: 0; }
.screen.active { display: flex; flex-direction: column; }
#boot-screen { align-items: center; justify-content: center; }
.boot-inner { text-align: center; color: var(--text-dim); }
.boot-mark { font-size: 64px; animation: breathe 2.4s ease-in-out infinite; }
.boot-text { letter-spacing: .2em; font-size: 14px; }
@keyframes breathe { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* ------------------------------------------------------------- 标题 */
#title-screen { position: relative; overflow: hidden; }
.title-sky { position: absolute; inset: 0; pointer-events: none; }
.title-sky::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(700px 420px at 72% 22%, rgba(255, 240, 200, .07), transparent 70%),
    radial-gradient(900px 500px at 18% 82%, rgba(80, 160, 140, .06), transparent 70%);
}
.moon {
  position: absolute; right: 18%; top: 12%; width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f3e7c8, #d8c59a 55%, #b9a678 100%);
  box-shadow: 0 0 70px rgba(236, 219, 176, .25);
  opacity: .85;
}
.mountain {
  position: absolute; bottom: 0; left: -10%; width: 120%; height: 46%;
  background: linear-gradient(180deg, rgba(20, 26, 24, .1), rgba(8, 10, 9, .92));
}
.mountain.back {
  height: 38%; opacity: .55;
  clip-path: polygon(0 80%, 12% 52%, 22% 66%, 34% 30%, 46% 58%, 58% 38%, 70% 64%, 82% 42%, 94% 62%, 100% 52%, 100% 100%, 0 100%);
}
.mountain.front {
  height: 28%; opacity: .9;
  clip-path: polygon(0 78%, 10% 60%, 18% 72%, 30% 48%, 42% 70%, 54% 54%, 66% 78%, 78% 58%, 90% 74%, 100% 64%, 100% 100%, 0 100%);
}
.title-inner {
  position: relative; z-index: 1; margin: auto; width: min(560px, 92vw);
  padding: calc(42px + var(--safe-t)) 24px calc(28px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.title-kicker { font-size: 12px; letter-spacing: .35em; color: var(--text-dim); margin-bottom: 10px; }
.title-main {
  font-size: clamp(46px, 9vw, 76px); letter-spacing: .08em; margin: 0 0 6px;
  color: var(--text); text-shadow: 0 4px 26px rgba(0, 0, 0, .6);
}
.title-dot { color: var(--accent); }
.title-sub { color: var(--text-dim); font-size: 14px; letter-spacing: .12em; margin-bottom: 34px; }
.title-menu { display: flex; flex-direction: column; gap: 10px; width: min(300px, 80vw); }
.title-btn {
  width: 100%; padding: 12px 18px; border-radius: 6px; border: 1px solid var(--border);
  background: rgba(0, 0, 0, .18); letter-spacing: .14em; font-size: 15px;
  transition: border-color .15s, color .15s, background .15s, transform .15s;
}
.title-btn:hover:not(:disabled), .title-btn:focus-visible:not(:disabled) {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
}
.title-btn:active:not(:disabled) { transform: translateY(1px); }
.title-btn.primary { border-color: var(--accent); color: var(--accent); }
.title-btn:disabled, .title-btn.primary:disabled {
  color: var(--text-dim); border-color: var(--border); background: transparent; opacity: .58;
}
.title-meta { margin-top: 26px; font-size: 12px; color: var(--text-dim); line-height: 1.8; min-height: 3em; }
.title-meta p { margin: 0; }
.title-foot { margin-top: 14px; font-size: 11px; color: var(--border-strong); letter-spacing: .08em; }

/* ------------------------------------------------------------- 页面 */
.page { flex: 1; overflow-y: auto; padding: calc(24px + var(--safe-t)) max(20px, var(--safe-l)) calc(24px + var(--safe-b)) max(20px, var(--safe-r)); }
.page.narrow { width: min(720px, 100%); margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 26px; letter-spacing: .1em; }
.page-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.hint { font-size: 12px; margin-top: 14px; }

.seed-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.seed-row label { flex: 0 0 3.2em; color: var(--text-dim); font-size: 13px; }
.text-input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: rgba(0, 0, 0, .2); color: var(--text);
  outline: none; font-family: var(--font-mono); font-size: 14px;
}
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.preview {
  margin-top: 18px; border: 1px solid var(--border); background: rgba(0, 0, 0, .16);
  border-radius: var(--radius); padding: 18px; min-height: 220px;
}
.preview h3 { font-size: 18px; color: var(--accent); letter-spacing: .06em; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; font-size: 14px; }
.preview-grid .k { color: var(--text-dim); }
.preview-grid .v { color: var(--text); }
.preview-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; margin: 12px 0; font-size: 13px; }
.preview-stats span { font-family: var(--font-mono); }
.preview-line { margin: 6px 0; font-size: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 12px; color: var(--text-dim);
}
.tag.accent { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: rgba(0, 0, 0, .16); color: var(--text);
  padding: 10px 16px; border-radius: 7px; cursor: pointer; font-size: 15px;
  transition: border-color .15s, color .15s, background .15s, transform .15s;
  min-height: 44px;
}
.btn:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(255, 255, 255, .035); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn.primary:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.btn.ghost { border-color: transparent; color: var(--text-dim); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer;
  font-size: 18px; color: var(--text-dim); transition: .15s;
}
.icon-btn:hover, .icon-btn:focus-visible { border-color: var(--border-strong); color: var(--accent); background: rgba(255, 255, 255, .03); }
.btn:focus-visible, .icon-btn:focus-visible, .action-btn:focus-visible, .choice-btn:focus-visible,
.text-input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------- 状态条 */
#status-bar {
  position: relative; z-index: 5; flex: 0 0 auto;
  padding: calc(8px + var(--safe-t)) max(14px, var(--safe-r)) 8px max(14px, var(--safe-l));
  background: linear-gradient(180deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, .08));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}
.status-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.identity { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.st-name { font-family: var(--font-title); font-size: 17px; color: var(--text); letter-spacing: .06em; }
.st-realm { font-size: 13px; color: var(--accent); font-family: var(--font-mono); }
.st-chip {
  font-size: 11px; color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 7px; white-space: nowrap;
}
.status-nav {
  display: flex; gap: 6px; flex-shrink: 0;
  margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .06);
}
.status-nav .nav-btn {
  flex: 1 1 0; width: auto; min-width: 0; height: 46px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid var(--border); border-radius: 8px;
  background: rgba(255, 255, 255, .018); color: var(--text);
  padding: 4px 2px;
}
.status-nav .nav-btn:hover, .status-nav .nav-btn:focus-visible {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
}
.nav-ico { font-size: 18px; line-height: 1.05; }
.nav-label { font-size: 11px; line-height: 1.15; letter-spacing: .04em; color: var(--text-dim); white-space: nowrap; }
.status-nav .nav-btn:hover .nav-label, .status-nav .nav-btn:focus-visible .nav-label { color: var(--accent); }
.status-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 5px; }
.vitals { display: flex; gap: 16px; flex: 1; min-width: 0; }
.vital { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.vital-label { font-size: 12px; color: var(--text-dim); }
.vital-num { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.bar { height: 7px; background: rgba(0, 0, 0, .4); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--danger), #e88a63); transition: width .3s ease; }
.bar.mp i { background: linear-gradient(90deg, #4a7fb0, #7fc4e8); }
.stats-inline { display: flex; gap: 12px; font-size: 13px; color: var(--text); font-family: var(--font-mono); white-space: nowrap; }
.status-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; min-height: 0; }
.status-tags:empty { display: none; }
.status-tag { font-size: 11px; border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; color: var(--text-dim); }
.status-tag.bad { border-color: rgba(192, 57, 43, .55); color: var(--danger); }

/* ------------------------------------------------------------- 主游戏 */
#game-screen { min-height: 0; }
#stage {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
  width: min(960px, 100%); margin: 0 auto; padding: 0 max(14px, var(--safe-l)) 0 max(14px, var(--safe-r));
}
.scene-chip {
  flex: 0 0 auto; margin: 10px 0 0; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--accent);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; background: rgba(0, 0, 0, .18);
}
#body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 16px 4px 12px; scroll-behavior: smooth; outline: none;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
#body::-webkit-scrollbar { width: 8px; }
#body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.block {
  margin: 0 0 1.05em; max-width: 42em; color: var(--text);
  animation: block-in .28s ease both;
}
.block.event { font-size: 1.02em; }
.block.result { color: var(--text); }
.block.good { color: var(--success); }
.block.bad { color: var(--danger); }
.block.gold { color: var(--accent); }
.block.dim { color: var(--text-dim); font-size: .92em; }
.block.world {
  border-left: 2px solid var(--accent); padding-left: 12px; color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
}
.block.system { color: var(--text-dim); font-size: .9em; font-style: italic; }
@keyframes block-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ch { visibility: hidden; }
.ch.on { visibility: visible; }
#body .cursor { display: inline-block; width: .5em; color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ------------------------------------------------------------- 选项 */
.choices {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px;
  padding: 8px 0 12px; border-top: 1px solid var(--border);
}
.choices:empty { display: none; }
.choices.battle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choices.battle .choice-btn { min-height: 50px; }
.choice-btn {
  width: 100%; text-align: left; display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--border); background: rgba(0, 0, 0, .18); color: var(--text);
  padding: 12px 15px; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1.55;
  min-height: 50px;
  transition: border-color .15s, background .15s, color .15s;
}
.choice-btn:hover:not(:disabled), .choice-btn:focus-visible:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.choice-btn .num {
  flex: 0 0 1.5em; color: var(--accent); font-family: var(--font-mono); font-size: 12px; padding-top: 2px;
}
.choice-btn .choice-text { flex: 1; min-width: 0; }
.choice-btn .lock { display: block; font-size: 11px; color: var(--danger); margin-top: 2px; }
.choice-btn:disabled { opacity: .45; cursor: not-allowed; }
.choice-btn.battle { border-left: 3px solid var(--danger); }
.choice-btn.fate { border-color: var(--accent); }

/* ------------------------------------------------------------- 行动 */
.actions {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px;
  align-items: stretch;
  padding: 10px max(14px, var(--safe-r)) calc(10px + var(--safe-b)) max(14px, var(--safe-l));
  border-top: 1px solid var(--border); background: rgba(0, 0, 0, .27);
}
.actions::-webkit-scrollbar { display: none; }
.actions:empty { display: none; }
.action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; min-height: 64px; padding: 8px 5px; border-radius: 8px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .025);
  color: var(--text); cursor: pointer; font-size: 13px; line-height: 1.25; transition: .15s;
}
.action-btn .ico { font-size: 22px; line-height: 1.05; }
.action-btn .meta { font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }
.action-btn:hover, .action-btn:focus-visible {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
}
.action-btn:hover .meta, .action-btn:focus-visible .meta { color: var(--accent); }
.action-btn:disabled, .action-btn.locked { opacity: .35; cursor: not-allowed; filter: grayscale(.65); }
.action-btn.primary-action { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.action-btn.primary-action .ico { filter: drop-shadow(0 0 5px var(--accent-soft)); }
.action-btn.breakthrough {
  color: var(--accent); border-color: var(--accent); background: var(--accent-soft);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 5px transparent; } }

/* ------------------------------------------------------------- 战斗 */
.battle-hud { flex: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.fighter { min-width: 0; }
.fighter.enemy { text-align: right; }
.fighter .fname { font-size: 13px; color: var(--text); display: flex; gap: 6px; align-items: center; }
.fighter.enemy .fname { justify-content: flex-end; }
.fighter .frealm { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.fighter .bar { margin-top: 4px; }
.fighter .fbar-row { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 2px; }
.vs { color: var(--accent); font-family: var(--font-title); font-size: 15px; opacity: .7; }
.battle-round { text-align: center; font-size: 10px; color: var(--text-dim); letter-spacing: .12em; }
.battle-status { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.fighter.enemy .battle-status { justify-content: flex-end; }
.battle-hint { text-align: center; font-size: 11px; color: var(--text-dim); padding: 4px 0; }

/* ------------------------------------------------------------- 遮罩面板 */
#overlay-root:empty { display: none; }
.overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .62); backdrop-filter: blur(3px); padding: 16px;
  animation: fade-in .15s ease both;
}
.panel {
  width: min(880px, 96vw); max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden; animation: panel-in .18s ease both;
}
.panel.wide { width: min(1040px, 96vw); }
.panel-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 20px; letter-spacing: .08em; }
.panel-head .sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px calc(18px + var(--safe-b)); }
.panel-foot { flex: 0 0 auto; display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- 面板内容 */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; margin: 12px 0; }
.stat-grid .stat { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; background: rgba(0, 0, 0, .12); }
.stat-grid .stat .k { font-size: 11px; color: var(--text-dim); }
.stat-grid .stat .v { font-family: var(--font-mono); font-size: 16px; color: var(--text); }
.stat-grid .stat .v small { font-size: 11px; color: var(--text-dim); }
.stat-effect-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 18px; margin: 8px 0 2px; }
.stat-effect { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; font-size: 14px; }
.info-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed rgba(255, 255, 255, .055); padding: 3px 0; }
.info-row .k { color: var(--text-dim); }
.info-row .v { color: var(--text); text-align: right; }
.info-grid .k { color: var(--text-dim); }
.section-title { font-size: 12px; letter-spacing: .18em; color: var(--text-dim); border-bottom: 1px solid var(--border); padding-bottom: 4px; margin: 18px 0 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.progress-line { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-dim); }
.progress-line .bar { flex: 1; }
.progress-line .bar i { background: linear-gradient(90deg, var(--accent), #f0d79a); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { border: 1px solid var(--border); background: transparent; color: var(--text-dim); padding: 8px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; min-height: 40px; }
.tab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.list-detail { display: grid; grid-template-columns: minmax(200px, 320px) 1fr; gap: 16px; min-height: 260px; }
.list { display: flex; flex-direction: column; gap: 4px; max-height: 52dvh; overflow-y: auto; padding-right: 4px; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid transparent; border-bottom-color: var(--border); background: transparent;
  padding: 10px; border-radius: 6px; cursor: pointer; text-align: left; font-size: 14px; color: var(--text);
  min-height: 46px;
}
.list-row:hover, .list-row.active { border-color: var(--accent); background: var(--accent-soft); }
.list-row .meta { font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }
.detail { border: 1px solid var(--border); border-radius: 6px; padding: 14px; background: rgba(0, 0, 0, .12); }
.detail h3 { color: var(--accent); font-size: 17px; margin-bottom: 6px; }
.detail .sub { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.detail p { font-size: 14px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.empty { color: var(--text-dim); font-size: 13px; padding: 14px; text-align: center; }

/* ------------------------------------------------------------- 地图/宗门 */
.region-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.region-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: rgba(0, 0, 0, .12); }
.region-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.region-card.locked { opacity: .55; }
.region-card h3 { font-size: 16px; margin: 0 0 4px; color: var(--text); display: flex; justify-content: space-between; gap: 8px; }
.region-card .rdesc { font-size: 12px; color: var(--text-dim); min-height: 2.6em; }
.region-card .rline { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 4px; }
.region-card .rfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }

/* ------------------------------------------------------------- 浮罗舆图 */
.atlas-viewport {
  position: relative; height: 430px; overflow: hidden; margin: 10px 0 8px;
  border: 1px solid var(--border); border-radius: 12px;
  background: radial-gradient(circle at 50% 50%, rgba(201,164,82,.08), rgba(8,10,12,.7) 58%, rgba(4,5,6,.92));
  touch-action: none; cursor: grab;
}
.atlas-viewport:active { cursor: grabbing; }
.atlas-stage { position: absolute; left: 0; top: 0; width: 1000px; height: 1000px; transform-origin: 0 0; }
.atlas-ring {
  position: absolute; left: 50%; top: 50%; width: 620px; height: 620px;
  transform: translate(-50%, -50%); border: 1px solid rgba(201,164,82,.15);
  border-radius: 50%; box-shadow: 0 0 0 70px rgba(201,164,82,.025), 0 0 0 140px rgba(90,167,196,.025);
}
.atlas-ring.inner { width: 380px; height: 380px; border-color: rgba(201,164,82,.25); }
.atlas-node {
  position: absolute; transform: translate(-50%, -50%); width: 106px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 4px; border: 0; background: transparent; color: var(--text-dim);
  cursor: pointer; font-family: inherit;
}
.atlas-node-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--node-color, #b9b0a0); box-shadow: 0 0 12px var(--node-color, #b9b0a0); }
.atlas-node.current .atlas-node-dot { width: 18px; height: 18px; box-shadow: 0 0 0 5px rgba(201,164,82,.22), 0 0 20px var(--node-color, #b9b0a0); }
.atlas-node.selected .atlas-node-name { color: var(--accent); }
.atlas-node-name { font-size: 12px; color: var(--text); white-space: nowrap; }
.atlas-node-ring { font-size: 9px; color: var(--text-dim); white-space: nowrap; }
.atlas-node.known { opacity: .42; filter: grayscale(.7); }
.atlas-node.known .atlas-node-dot { box-shadow: none; border: 1px dashed var(--text-dim); background: transparent; }
.atlas-controls { display: flex; gap: 8px; justify-content: flex-end; }
.atlas-controls .btn { min-width: 46px; padding: 5px 10px; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 8px 0; }
.site-card { border: 1px solid var(--border); border-radius: 9px; padding: 9px; background: rgba(255,255,255,.018); }
.site-card.current { border-color: var(--accent); }
.site-card h4 { margin: 0 0 4px; font-size: 14px; color: var(--gold); }
.site-card p { margin: 3px 0; }
.region-ledger { display: flex; flex-wrap: wrap; gap: 6px; }


/* ------------------------------------------------------------- 市场 */
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.market-item { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: rgba(0, 0, 0, .12); display: flex; flex-direction: column; gap: 6px; }
.market-item .mname { font-size: 14px; color: var(--text); }
.market-item .mdesc { font-size: 11px; color: var(--text-dim); flex: 1; }
.market-item .mprice { font-family: var(--font-mono); color: var(--accent); font-size: 13px; }
.market-item .mfoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ------------------------------------------------------------- 设置 */
.settings-row { display: grid; grid-template-columns: 6.5em 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.settings-row .slabel { font-size: 13px; color: var(--text-dim); }
.settings-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.settings-row .sval { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); min-width: 3em; text-align: right; }
.switch { display: inline-flex; gap: 6px; }
.switch button { min-width: 52px; }
.switch button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------------- 日志 */
.log-list { display: flex; flex-direction: column; gap: 0; }
.log-row { display: grid; grid-template-columns: 4.8em 1.8em 1fr; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-row .lt { color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; }
.log-row .lc { text-align: center; }
.log-row .lx { color: var(--text); }

/* ------------------------------------------------------------- 结局 */
#ending-screen { overflow-y: auto; background: radial-gradient(900px 500px at 50% 0%, var(--accent-soft), transparent 65%), var(--bg); }
.ending-wrap { width: min(760px, 92vw); margin: auto; padding: calc(40px + var(--safe-t)) 20px calc(30px + var(--safe-b)); }
.ending-head { text-align: center; margin-bottom: 26px; }
.ending-icon { font-size: 64px; line-height: 1; filter: drop-shadow(0 0 24px var(--accent-soft)); }
.ending-kicker { font-size: 11px; letter-spacing: .3em; color: var(--text-dim); margin: 10px 0 4px; }
.ending-title { font-size: clamp(34px, 7vw, 52px); letter-spacing: .16em; color: var(--accent); margin: 0 0 10px; }
.ending-epitaph { color: var(--text); font-size: 16px; max-width: 36em; margin: 0 auto; }
.ending-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 14px 0; margin-bottom: 18px; }
.ending-stats .es { text-align: center; }
.ending-stats .es .k { font-size: 10px; color: var(--text-dim); letter-spacing: .1em; }
.ending-stats .es .v { font-family: var(--font-mono); font-size: 15px; color: var(--accent); }
.ending-bio-wrap h3 { font-size: 14px; letter-spacing: .18em; color: var(--text-dim); }
.ending-bio { list-style: none; padding: 0; margin: 0 0 18px; border-left: 1px solid var(--border); }
.ending-bio li { position: relative; padding: 4px 0 10px 18px; font-size: 13px; color: var(--text); }
.ending-bio li::before { content: ""; position: absolute; left: -4px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.ending-bio li .ea { color: var(--text-dim); font-family: var(--font-mono); font-size: 10px; margin-right: 6px; }
.ending-achievements { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.ending-achievements .ach { font-size: 11px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; color: var(--text-dim); }

/* ------------------------------------------------------------- 提示 */
.toast-root { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); z-index: 55; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  color: var(--text); padding: 9px 12px; border-radius: 6px; font-size: 13px;
  box-shadow: var(--shadow); animation: toast-in .2s ease both;
}
.toast.bad { border-left-color: var(--danger); }
.toast.good { border-left-color: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- 动效开关 */
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after {
  animation: none !important; transition: none !important;
}
[data-motion="off"] .ch { visibility: visible; }

/* ------------------------------------------------------------- 手机 */
@media (min-width: 980px) {
  .actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  :root { --fs-body: 17px; --fs-title: 28px; }
  .title-inner { padding-top: calc(28px + var(--safe-t)); }
  .title-main { font-size: clamp(42px, 13vw, 60px); }
  .title-sub { margin-bottom: 26px; }
  .title-menu { width: min(280px, 84vw); }
  .moon { right: 10%; top: 9%; width: 64px; height: 64px; }
  #status-bar { padding-top: calc(6px + var(--safe-t)); }
  .status-top { gap: 6px; }
  .identity { gap: 5px; }
  .st-name { font-size: 15px; }
  .st-chip { font-size: 10px; padding: 0 5px; }
  .status-nav { gap: 4px; margin-top: 7px; padding-top: 6px; }
  .status-nav .nav-btn { height: 44px; border-radius: 7px; }
  .nav-ico { font-size: 17px; }
  .nav-label { font-size: 10px; }
  .status-bottom { gap: 8px; }
  .vitals { gap: 10px; }
  .vital { grid-template-columns: minmax(42px, 1fr) auto; gap: 5px; }
  .vital-label { display: none; }
  .vital-num { font-size: 11px; }
  .stats-inline { font-size: 12px; gap: 7px; flex-direction: column; align-items: flex-end; line-height: 1.5; }
  #stage { padding-left: max(12px, var(--safe-l)); padding-right: max(12px, var(--safe-r)); }
  #body { padding-top: 10px; }
  .block { font-size: 1em; }
  .choice-btn { padding: 11px 13px; font-size: 15px; min-height: 48px; }
  .actions { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding-left: max(10px, var(--safe-l)); padding-right: max(10px, var(--safe-r)); }
  .action-btn { min-height: 58px; font-size: 12px; padding: 6px 3px; }
  .action-btn .ico { font-size: 20px; }
  .action-btn .meta { font-size: 9px; }
  .battle-hud { grid-template-columns: 1fr 1fr; gap: 6px; }
  .vs { display: none; }
  .battle-round { grid-column: 1 / -1; order: -1; }
  .overlay { padding: 0; align-items: stretch; }
  .panel { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; }
  .panel-head { padding-top: calc(12px + var(--safe-t)); }
  .panel-body { padding-bottom: calc(20px + var(--safe-b)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-effect-list { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .list-detail { grid-template-columns: 1fr; }
  .list { max-height: 32dvh; }
  .preview-grid { grid-template-columns: 1fr; }
  .preview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ending-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ending-wrap { padding-top: calc(26px + var(--safe-t)); }
  .seed-row { flex-wrap: wrap; }
  .seed-row label { flex: 0 0 2.4em; }
  .settings-row { grid-template-columns: 5em 1fr; }
  .settings-row .sval { grid-column: 2; text-align: left; }
  .log-row { grid-template-columns: 4.2em 1.6em 1fr; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .block, .overlay, .panel, .toast, .title-btn, .btn, .action-btn, .choice-btn { animation: none !important; transition: none !important; }
  .ch { visibility: visible; }
}
@media (max-width: 380px) {
  .status-nav { gap: 3px; }
  .status-nav .nav-btn { height: 42px; }
  .nav-ico { font-size: 16px; }
  .nav-label { font-size: 10px; }
  .st-chip { display: none; }
  .action-btn { min-height: 54px; font-size: 11px; }
  .action-btn .ico { font-size: 18px; }
}
