:root {
  --bg: #0a0a1a;
  --panel: rgba(20, 20, 45, 0.85);
  --border: #333366;
  --accent: #4488ff;
  --accent-light: #88ccff;
  --text: #e0e0e0;
  --text-dim: #8888aa;
  --good: #44ff88;
  --bad: #ff5566;
  --warn: #ffaa44;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  overflow: hidden;
  user-select: none;
}
body {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(68,136,255,0.08), transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(255,100,200,0.06), transparent 60%),
    var(--bg);
}
.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 80px 120px, #aac, transparent),
    radial-gradient(1.5px 1.5px at 200px 60px, #fff, transparent),
    radial-gradient(1px 1px at 320px 200px, #ccd, transparent),
    radial-gradient(1px 1px at 480px 90px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 600px 250px, #aaf, transparent),
    radial-gradient(1px 1px at 750px 150px, #fff, transparent);
  background-size: 800px 400px;
  opacity: 0.6;
}

#selector {
  position: relative; z-index: 1;
  height: 100vh; display: flex; flex-direction: column;
  align-items: center; padding: 40px 20px; overflow-y: auto;
}
#selector h1 {
  font-size: 36px; font-weight: 300; letter-spacing: 8px;
  color: var(--accent-light); margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(68,136,255,0.5);
}
#selector .subtitle {
  color: var(--text-dim); margin-bottom: 40px; letter-spacing: 4px;
}
.planet-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  gap: 20px; max-width: 1200px; margin-bottom: 30px;
}
.planet-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 18px; cursor: pointer;
  transition: all 0.2s; backdrop-filter: blur(10px);
}
.planet-card:hover {
  border-color: var(--accent); transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(68,136,255,0.3);
}
.planet-card canvas {
  display: block; margin: 0 auto 12px; border-radius: 50%; background: #000;
}
.planet-card .name {
  font-size: 16px; text-align: center; margin-bottom: 4px; color: var(--accent-light);
}
.planet-card .type {
  font-size: 11px; text-align: center; color: var(--text-dim); margin-bottom: 12px;
}
.planet-card .stats {
  font-size: 11px; line-height: 1.6; color: var(--text-dim);
  padding: 8px 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.planet-card .stats span { color: var(--text); }
.planet-card .desc {
  font-size: 11px; font-style: italic; color: var(--text-dim);
  text-align: center; min-height: 30px;
}
.planet-card .difficulty {
  text-align: center; margin-top: 8px; color: var(--warn);
  font-size: 12px; letter-spacing: 2px;
}
.planet-card .modifiers {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px;
  justify-content: center;
}
.planet-card .mod-tag {
  font-size: 10px; padding: 2px 6px; border-radius: 3px;
  background: rgba(255,170,68,0.15); border: 1px solid rgba(255,170,68,0.3);
  color: var(--warn); cursor: help;
}
.regen-btn {
  padding: 10px 30px; background: transparent;
  border: 1px solid var(--accent); color: var(--accent);
  cursor: pointer; font-family: inherit; font-size: 13px;
  letter-spacing: 3px; border-radius: 4px;
  transition: all 0.2s;
}
.regen-btn:hover { background: var(--accent); color: #000; }

#game {
  display: none; position: relative; z-index: 1;
  height: 100vh; padding: 10px; gap: 10px;
  grid-template-columns: 240px 1fr 300px;
}
#game.active { display: grid; }
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px;
  backdrop-filter: blur(8px); display: flex; flex-direction: column;
  overflow: hidden;
}
.panel h3 {
  font-size: 11px; letter-spacing: 3px; color: var(--accent-light);
  margin-bottom: 6px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border); font-weight: 400;
  flex-shrink: 0;
}
/* 可折叠区块 */
.panel h3.collapsible {
  cursor: pointer; user-select: none;
  transition: color 0.2s;
}
.panel h3.collapsible:hover { color: var(--text); }
.panel h3.collapsible .collapse-arrow {
  float: right; font-size: 10px; color: var(--text-dim);
  transition: transform 0.2s;
}
.panel h3.collapsible.collapsed { margin-bottom: 4px; padding-bottom: 4px; }
.collapsible-body {
  max-height: 200px;
  transition: max-height 0.3s ease, opacity 0.2s;
  overflow: hidden;
}
.collapsible-body.collapsed {
  max-height: 0 !important; opacity: 0;
  margin: 0 !important; padding: 0 !important;
}
/* 里程碑紧凑标签样式 */
.milestone-list.collapsible-body {
  display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center;
  padding: 4px 0; margin-bottom: 4px;
}
#left-panel { gap: 8px; overflow-y: auto; }
.power-bar-wrap { margin-bottom: 4px; }
.power-label { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 3px; }
.power-bar {
  height: 8px; background: #1a1a3a; border: 1px solid var(--border);
  border-radius: 2px; overflow: hidden;
}
.power-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 0.3s; box-shadow: 0 0 8px var(--accent); width: 50%;
}
.ability-group { margin-bottom: 6px; }
.ability-group .label { font-size: 10px; color: var(--text-dim); letter-spacing: 2px; margin-bottom: 4px; }
.ability-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.ability {
  aspect-ratio: 1; background: #1a1a3a; border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 16px; transition: all 0.15s; position: relative;
}
.ability:hover:not(.disabled):not(.locked) {
  background: #2a2a5a; border-color: var(--accent); transform: scale(1.05);
}
.ability.selected {
  background: var(--accent); border-color: var(--accent-light);
  box-shadow: 0 0 12px var(--accent);
}
.ability.disabled, .ability.locked { opacity: 0.3; cursor: not-allowed; }
.ability .cost {
  position: absolute; bottom: 2px; right: 4px;
  font-size: 9px; color: var(--accent-light); font-family: monospace;
}
.ability .lock { position: absolute; top: 2px; left: 4px; font-size: 9px; color: var(--bad); }
.selected-info {
  font-size: 10px; color: var(--text-dim); padding: 6px 8px;
  background: #0a0a25; border-radius: 4px; min-height: 40px;
  line-height: 1.4; margin-top: auto;
}
.selected-info b { color: var(--accent-light); }
.selected-info .hint { color: var(--text-dim); font-size: 10px; }

#center-panel { padding: 8px; gap: 6px; }
.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; gap: 8px; min-width: 0;
}
.top-bar .planet-name {
  color: var(--accent-light); letter-spacing: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex-shrink: 1;
}
.top-bar .epoch {
  color: var(--text-dim); white-space: nowrap; flex-shrink: 0;
  font-size: 11px;
}
.canvas-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; background: #050510; border-radius: 4px;
  overflow: hidden; min-height: 0;
}
#planetCanvas { display: block; cursor: crosshair; max-width: 100%; max-height: 100%; }
.view-toggle { display: flex; gap: 3px; padding: 2px 0; align-items: center; flex-wrap: wrap; }
.view-btn {
  background: rgba(20,20,45,0.8); border: 1px solid var(--border);
  color: var(--text-dim); padding: 3px 8px; font-size: 10px;
  cursor: pointer; border-radius: 3px; font-family: inherit; letter-spacing: 1px;
}
.view-btn.active { color: var(--accent); border-color: var(--accent); }
.conn-status {
  margin-left: auto;
  font-size: 10px; color: var(--good);
  font-family: monospace; padding: 2px 6px; background: rgba(0,0,0,0.4); border-radius: 8px;
}
.conn-status.bad { color: var(--bad); }

.speed-controls { display: flex; gap: 4px; justify-content: center; padding: 4px 0; }
.speed-btn {
  background: #1a1a3a; border: 1px solid var(--border);
  color: var(--text-dim); padding: 4px 12px; font-size: 11px;
  cursor: pointer; border-radius: 3px; font-family: inherit;
}
.speed-btn.active { color: var(--accent-light); border-color: var(--accent); background: #2a2a5a; }

.stats-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; font-size: 10px; }
.stat-cell {
  background: #0a0a25; padding: 4px 2px; border-radius: 3px;
  border: 1px solid var(--border); text-align: center;
  overflow: hidden;
}
.stat-cell .lbl { color: var(--text-dim); font-size: 9px; letter-spacing: 0.5px; }
.stat-cell .val { color: var(--text); font-size: 12px; font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#right-panel { gap: 6px; overflow-y: auto; }
.milestone-list {
  font-size: 10px;
  padding: 4px 6px; background: #0a0a25; border-radius: 4px;
  margin-bottom: 4px;
}
.milestone-item {
  padding: 2px 6px; border-radius: 10px;
  color: var(--text-dim); font-size: 10px; white-space: nowrap;
  display: inline-block; margin: 2px 3px;
  background: rgba(100,100,160,0.1); border: 1px solid rgba(100,100,160,0.15);
}
.milestone-item.done {
  color: var(--good); background: rgba(68,255,136,0.1);
  border-color: rgba(68,255,136,0.25);
}
.chronicle-log {
  flex: 1; overflow-y: auto; font-size: 11px; line-height: 1.5;
  padding: 6px 8px; background: #0a0a25; border-radius: 4px;
  min-height: 0;
}
.log-entry { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed #1f1f40; }
.log-entry .turn { color: var(--text-dim); font-size: 10px; }
.log-entry .text { color: var(--text); margin-top: 2px; }
.log-entry.milestone .text { color: var(--good); font-weight: bold; }
.log-entry.action .text { color: var(--accent-light); }
.log-entry.disaster .text { color: var(--warn); }
.log-entry.combo .turn { color: #ffd700; }
.log-entry.combo .text { color: #ffe066; font-weight: bold; }
.log-entry.mission .turn { color: var(--good); }
.log-entry.mission .text { color: #66ffaa; }
.log-entry.interstellar { border-left: 3px solid #cc88ff; background: rgba(120,60,200,0.08); }
.log-entry.interstellar .turn { color: #cc88ff; }
.log-entry.interstellar .text { color: #ddaaff; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

#milestone-popup {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: none; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(6px);
}
#milestone-popup.show { display: flex; animation: fadeIn 0.4s; }
.milestone-card {
  background: linear-gradient(135deg, #1a1a3a, #0a0a25);
  border: 2px solid var(--accent); border-radius: 8px;
  padding: 40px 50px; max-width: 500px; text-align: center;
  box-shadow: 0 0 60px rgba(68,136,255,0.5);
  animation: scaleIn 0.5s;
}
.milestone-card .title { font-size: 14px; letter-spacing: 6px; color: var(--accent-light); margin-bottom: 8px; }
.milestone-card .ms-name { font-size: 28px; color: var(--text); margin-bottom: 16px; letter-spacing: 4px; }
.milestone-card .narrative { font-size: 13px; color: var(--text-dim); line-height: 1.8; margin-bottom: 20px; font-style: italic; }
.milestone-card .reward { color: var(--good); font-size: 13px; }
.milestone-card button {
  margin-top: 20px; padding: 8px 30px;
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); cursor: pointer; font-family: inherit;
  letter-spacing: 3px; border-radius: 3px;
}
.milestone-card button:hover { background: var(--accent); color: #000; }

@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes scaleIn { from{transform:scale(0.8);opacity:0} to{transform:scale(1);opacity:1} }

.panel-toolbar {
  display: flex; gap: 4px; align-items: center;
  padding-bottom: 6px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; flex-wrap: wrap;
}
.toolbar-spacer { flex: 1; }
.back-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); padding: 3px 8px; font-size: 10px;
  cursor: pointer; font-family: inherit; border-radius: 3px;
  white-space: nowrap;
}
.back-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ===== 存档模态 ===== */
#save-modal {
  display: none; position: fixed; inset: 0; z-index: 200;
}
#save-modal.show { display: block; }
.save-window { max-width: 500px; width: 90vw; }
.save-content { padding: 20px 24px; }
.save-new {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.save-new input {
  flex: 1; background: #0a0a25; border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; font-size: 12px;
  border-radius: 4px; font-family: inherit; outline: none;
}
.save-new input:focus { border-color: var(--accent); }
.save-new button {
  background: var(--accent); border: none; color: #000;
  padding: 8px 16px; font-size: 12px; border-radius: 4px;
  cursor: pointer; font-family: inherit; font-weight: bold;
  white-space: nowrap;
}
.save-new button:hover { filter: brightness(1.2); }
.save-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 320px; overflow-y: auto;
}
.save-item {
  display: flex; align-items: center; gap: 10px;
  background: #0a0a25; border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 14px;
  transition: border-color 0.2s;
}
.save-item:hover { border-color: var(--accent); }
.save-item .si-info { flex: 1; min-width: 0; }
.save-item .si-name { font-size: 13px; color: var(--text); font-weight: bold; }
.save-item .si-meta { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.save-item .si-actions { display: flex; gap: 4px; }
.save-item .si-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); padding: 4px 10px; font-size: 10px;
  cursor: pointer; border-radius: 3px; font-family: inherit;
}
.save-item .si-btn:hover { color: var(--accent); border-color: var(--accent); }
.save-item .si-btn.danger:hover { color: var(--bad); border-color: var(--bad); }
.save-empty { color: var(--text-dim); font-size: 12px; font-style: italic; text-align: center; padding: 20px; }

/* ===== 星系模态 ===== */
#galaxy-modal {
  display: none; position: fixed; inset: 0; z-index: 200;
}
#galaxy-modal.show { display: block; }

/* ===== 选择界面星系列表 ===== */
.galaxy-shelf {
  width: 100%; max-width: 1200px;
  margin-bottom: 30px;
}
.galaxy-shelf-title {
  font-size: 16px; font-weight: 300; letter-spacing: 6px;
  color: var(--accent-light); margin-bottom: 14px; text-align: center;
  text-shadow: 0 0 12px rgba(68,136,255,0.4);
}
.galaxy-shelf-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.galaxy-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 14px; cursor: pointer;
  transition: all 0.2s; backdrop-filter: blur(10px);
  position: relative;
}
.galaxy-card:hover {
  border-color: var(--accent); transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(68,136,255,0.25);
}
.galaxy-card.active {
  border-color: var(--good);
  box-shadow: 0 0 12px rgba(68,255,136,0.2);
}
.galaxy-card .gc-name {
  font-size: 14px; color: var(--accent-light); margin-bottom: 4px;
  letter-spacing: 1px;
}
.galaxy-card .gc-phase {
  font-size: 11px; color: var(--text-dim); margin-bottom: 8px;
}
.galaxy-card .gc-stats {
  font-size: 10px; color: var(--text-dim); line-height: 1.6;
}
.galaxy-card .gc-stats span { color: var(--text); }
.galaxy-card .gc-active-tag {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; padding: 2px 6px; border-radius: 8px;
  background: rgba(68,255,136,0.15); border: 1px solid rgba(68,255,136,0.3);
  color: var(--good);
}
.galaxy-card .gc-idle-tag {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; padding: 2px 6px; border-radius: 8px;
  background: rgba(100,100,160,0.15); border: 1px solid rgba(100,100,160,0.3);
  color: var(--text-dim);
}
.galaxy-card.has-notifs {
  border-color: #cc88ff;
  animation: galaxyPulse 2s ease-in-out infinite;
}
.galaxy-card.has-notifs .gc-idle-tag {
  background: rgba(160,100,255,0.2); border-color: rgba(160,100,255,0.4);
  color: #ddaaff;
}
@keyframes galaxyPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(160,100,255,0.15); }
  50% { box-shadow: 0 0 16px rgba(160,100,255,0.35); }
}
.galaxy-notif-badge {
  display: inline-block; background: #cc88ff; color: #1a1a1a;
  font-size: 9px; font-weight: bold; padding: 1px 6px;
  border-radius: 8px; margin-left: 6px; vertical-align: middle;
}
.galaxy-notif-list {
  margin-top: 6px; padding: 6px 8px;
  background: rgba(120,60,200,0.08); border-radius: 4px;
  border-left: 2px solid #cc88ff;
}
.galaxy-notif-item {
  font-size: 10px; color: #ddaaff; line-height: 1.6;
  padding: 1px 0;
}
.galaxy-notif-more {
  font-size: 9px; color: var(--text-dim); margin-top: 2px;
}
.gc-notif-preview {
  font-size: 10px; color: #ddaaff; margin-top: 6px;
  padding: 4px 6px; background: rgba(120,60,200,0.1);
  border-radius: 3px; border-left: 2px solid #cc88ff;
  line-height: 1.5;
}

/* 全局指标行 */
.globals-row .stat-cell .lbl { color: var(--accent-light); font-size: 9px; }
.globals-row .stat-cell .val { font-size: 12px; }
.globals-row .stat-cell.bad .val { color: var(--bad); }
.globals-row .stat-cell.warn .val { color: var(--warn); }
.globals-row .stat-cell.good .val { color: var(--good); }


.biosphere {
  background: #0a0a25; border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px; line-height: 1.4;
}
/* 生命圈折叠区固定高度 */
#biosphere.collapsible-body:not(.collapsed) {
  max-height: 130px !important;
  overflow-y: auto;
}
.biosphere .group { color: var(--text-dim); font-size: 10px; letter-spacing: 1px; margin-top: 4px; }
.biosphere .bio-item { display: flex; justify-content: space-between; padding: 2px 0; color: var(--text); }
.biosphere .bio-item.dead { color: var(--text-dim); text-decoration: line-through; opacity: 0.6; }
.biosphere .bio-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biosphere .bio-tag { color: var(--accent-light); font-size: 9px; margin-left: 4px; }
.biosphere .tech-bar {
  height: 3px; background: #1a1a3a; border-radius: 1px;
  margin-top: 2px;
}
.biosphere .tech-bar > div { height: 100%; background: var(--accent); border-radius: 1px; }
.biosphere .empty { color: var(--text-dim); font-style: italic; font-size: 10px; }

/* ===== 阶段头 ===== */
.phase-bar {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, rgba(68,136,255,0.08), rgba(68,136,255,0.02));
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 10px; margin-bottom: 4px;
  font-size: 11px;
}
.phase-bar .ph-icon { font-size: 18px; }
.phase-bar .ph-name { color: var(--accent-light); letter-spacing: 2px; font-weight: bold; }
.phase-bar .ph-sub { color: var(--text-dim); font-size: 10px; flex: 1; }
.phase-bar .ph-progress {
  display: flex; gap: 3px;
}
.phase-bar .ph-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--border);
}
.phase-bar .ph-dot.done { background: var(--accent-light); box-shadow: 0 0 4px var(--accent); }
.phase-bar .ph-dot.current { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ===== 编年史标题行 ===== */
.chronicle-header {
  display: flex; align-items: center; gap: 4px;
  flex-wrap: wrap;
}
.chronicle-btns {
  margin-left: auto;
  display: flex; gap: 3px; flex-shrink: 0;
}
/* ===== 史诗按钮 ===== */
.epic-btn {
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); cursor: pointer; font-family: inherit;
  font-size: 10px; padding: 2px 6px; border-radius: 3px; letter-spacing: 1px;
  white-space: nowrap;
}
.epic-btn:hover { background: var(--accent); color: #000; }

/* ===== 史诗模态 ===== */
#epic-modal { display: none; position: fixed; inset: 0; z-index: 200; }
#epic-modal.show { display: block; }
.epic-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
}
.epic-window {
  position: absolute; top: 30px; bottom: 30px; left: 50%;
  transform: translateX(-50%); width: 92%; max-width: 980px;
  background: linear-gradient(180deg, #0c0c20, #050510);
  border: 1px solid var(--accent); border-radius: 8px;
  box-shadow: 0 20px 80px rgba(68,136,255,0.4);
  display: flex; flex-direction: column; overflow: hidden;
}
.epic-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: rgba(20, 25, 60, 0.4);
}
.epic-title {
  font-size: 18px; letter-spacing: 6px; color: var(--accent-light);
  text-shadow: 0 0 20px rgba(68,136,255,0.5);
}
.epic-x {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); padding: 4px 12px; cursor: pointer;
  border-radius: 3px; font-family: inherit;
}
.epic-x:hover { color: var(--accent); border-color: var(--accent); }
.epic-content {
  flex: 1; overflow-y: auto; padding: 24px 36px;
  font-size: 12px; line-height: 1.7;
}

/* ===== 史诗章节 ===== */
.chapter {
  display: grid; grid-template-columns: 200px 1fr; gap: 24px;
  margin-bottom: 36px; padding-bottom: 28px;
  border-bottom: 1px dashed #1f1f40;
  animation: fadeIn 0.6s;
}
.chapter:last-child { border-bottom: none; }
.chapter-art {
  background: #050510; border: 1px solid var(--border);
  border-radius: 6px; padding: 8px; align-self: start;
  text-align: center;
}
.chapter-art canvas {
  width: 184px; height: 92px; display: block; border-radius: 3px;
}
.chapter-art .turn-range {
  color: var(--text-dim); font-size: 10px; letter-spacing: 1px;
  margin-top: 6px;
}
.chapter-body { min-width: 0; }
.chapter-num {
  color: var(--text-dim); font-size: 10px; letter-spacing: 4px;
  margin-bottom: 4px;
}
.chapter h2 {
  font-size: 24px; color: var(--accent-light); letter-spacing: 6px;
  font-weight: 300; margin-bottom: 4px;
}
.chapter h2 .big-icon { font-size: 30px; margin-right: 10px; vertical-align: -4px; }
.chapter .chapter-subtitle {
  font-size: 11px; color: var(--text-dim); letter-spacing: 2px;
  margin-bottom: 14px; font-style: italic;
}
.chapter .chapter-intro {
  color: var(--text); margin-bottom: 18px; line-height: 1.85;
  border-left: 2px solid var(--accent); padding-left: 12px;
}
.chapter-events { display: flex; flex-direction: column; gap: 6px; }
.chapter-event {
  display: grid; grid-template-columns: 70px 1fr; gap: 10px;
  font-size: 11px; padding: 4px 0;
  border-bottom: 1px dotted #1a1a35;
}
.chapter-event:last-child { border-bottom: none; }
.chapter-event .ev-turn { color: var(--text-dim); font-family: monospace; }
.chapter-event .ev-body { color: var(--text); }
.chapter-event .ev-title { font-weight: bold; }
.chapter-event.milestone {
  padding: 6px 10px; margin: 4px 0;
  background: linear-gradient(90deg, rgba(68,255,136,0.10), transparent);
  border-left: 2px solid var(--good); border-radius: 2px;
}
.chapter-event.milestone .ev-title { color: var(--good); font-size: 12px; }
.chapter-event.disaster {
  background: rgba(255,170,68,0.06);
  border-left: 2px solid var(--warn);
}
.chapter-event.disaster .ev-title { color: var(--warn); }
.chapter-event.opening .ev-title { color: var(--accent-light); }
.chapter-event.action .ev-title { color: var(--accent-light); }

@media (min-width: 1600px) {
  #game { grid-template-columns: 260px 1fr 320px; }
}
@media (max-width: 1200px) {
  #game { grid-template-columns: 220px 1fr 280px; }
  .ability-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 720px) {
  .chapter { grid-template-columns: 1fr; }
  .chapter-art canvas { width: 100%; height: auto; }
}

/* ===== 书式史诗 ===== */
.epic-content {
  font-family: 'Source Han Serif', 'Songti SC', 'STSong', 'SimSun', serif;
  font-size: 14px;
  line-height: 2.0;
  color: #d4d0c0;
  padding: 40px 60px;
}
.book-chapter {
  max-width: 720px; margin: 0 auto 60px;
  padding-bottom: 50px;
  border-bottom: 1px solid #2a2a4a;
  animation: fadeIn 0.6s;
}
.book-chapter:last-child { border-bottom: none; }
.book-chapter .ch-decor {
  text-align: center; color: var(--text-dim);
  font-size: 11px; letter-spacing: 6px; margin-bottom: 12px;
  font-family: 'JetBrains Mono', monospace;
}
.book-chapter .ch-title {
  text-align: center; font-weight: 300;
  font-size: 36px; letter-spacing: 16px;
  color: var(--accent-light);
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(68,136,255,0.4);
}
.book-chapter .ch-title .big-icon { font-size: 40px; margin-right: 12px; vertical-align: -4px; letter-spacing: 0; }
.book-chapter .ch-sub {
  text-align: center; color: var(--text-dim);
  font-size: 12px; letter-spacing: 6px;
  font-style: italic; margin-bottom: 4px;
}
.book-chapter .ch-period {
  text-align: center; color: var(--text-dim);
  font-size: 11px; letter-spacing: 2px;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 24px;
}
.book-chapter .ch-snapshot {
  text-align: center; margin: 0 auto 32px;
  background: #050510; border: 1px solid #2a2a4a;
  border-radius: 4px; padding: 8px;
  display: inline-block; width: 100%;
}
.book-chapter .ch-snapshot canvas {
  width: 100%; max-width: 400px; height: auto;
  display: block; margin: 0 auto;
  border-radius: 3px;
}
.book-chapter .ch-prose p {
  text-indent: 2em; text-align: justify;
  margin-bottom: 16px;
  color: #e8e4d4;
}
.book-chapter .ch-prose p.opening {
  margin-top: 8px; font-size: 15px;
  border: none; padding: 0;
}
.book-chapter .ch-prose p.opening::first-letter {
  font-size: 2.4em;
  color: var(--accent-light);
  float: left;
  margin: 4px 6px 0 0;
  line-height: 1;
  font-weight: bold;
  text-shadow: 0 0 12px rgba(68,136,255,0.5);
}
.book-chapter .ch-prose p.closing {
  margin-top: 24px; font-style: italic;
  color: #a8a896; border-top: 1px dotted #2a2a4a;
  padding-top: 16px;
}
.book-chapter .section-heading {
  text-align: center;
  font-size: 16px; letter-spacing: 8px;
  color: var(--accent-light);
  font-weight: 400;
  margin: 36px 0 16px;
}
.book-chapter .section-heading .orn {
  color: var(--accent); margin: 0 12px; opacity: 0.6;
}
.book-chapter .ch-prose .hl {
  color: var(--accent-light); font-weight: bold;
}
.book-chapter .ch-prose .dead {
  color: var(--text-dim); text-decoration: line-through;
}

/* ===== 总览模态 ===== */
#overview-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: none; z-index: 200; backdrop-filter: blur(4px);
}
#overview-modal.show { display: flex; align-items: center; justify-content: center; }
.overview-window { max-width: 900px; width: 90vw; max-height: 85vh; }
.overview-content {
  padding: 24px 32px; overflow-y: auto; font-size: 13px; line-height: 1.7;
  color: var(--text);
}
.ov-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 24px;
}
.ov-section {
  background: rgba(10,10,35,0.6); border: 1px solid var(--border);
  border-radius: 6px; padding: 14px 16px;
}
.ov-section h4 {
  font-size: 12px; letter-spacing: 3px; color: var(--accent-light);
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(100,100,160,0.2); font-weight: 400;
}
.ov-section .ov-stat-row {
  display: flex; justify-content: space-between; padding: 3px 0;
  font-size: 12px;
}
.ov-section .ov-stat-row .ov-lbl { color: var(--text-dim); }
.ov-section .ov-stat-row .ov-val { color: var(--text); font-family: monospace; }
.ov-section .ov-bio-item {
  padding: 4px 0; font-size: 12px; border-bottom: 1px dotted #1a1a35;
}
.ov-section .ov-bio-item:last-child { border-bottom: none; }
.ov-section .ov-bio-tag {
  color: var(--accent-light); font-size: 10px; margin-left: 6px;
}
.ov-section .ov-bio-dead {
  color: var(--text-dim); text-decoration: line-through; opacity: 0.7;
}
.ov-full { grid-column: 1 / -1; }
.ov-header {
  display: flex; gap: 16px; align-items: center; margin-bottom: 18px;
  padding-bottom: 12px; border-bottom: 1px solid rgba(100,100,160,0.3);
}
.ov-phase { font-size: 15px; color: var(--accent-light); font-weight: 600; }
.ov-turn, .ov-type { font-size: 12px; color: var(--text-dim); }
.ov-section-title {
  font-size: 12px; letter-spacing: 3px; color: var(--accent-light);
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(100,100,160,0.2); font-weight: 400;
}
.ov-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ov-table td { padding: 3px 6px; }
.ov-table td:nth-child(odd) { color: var(--text-dim); width: 35%; }
.ov-table td:nth-child(even) { color: var(--text); font-family: monospace; text-align: right; width: 15%; }
.ov-table td.good { color: #6f6; }
.ov-table td.warn { color: #fa0; }
.ov-table td.bad { color: #f44; }
.ov-tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ov-tag {
  display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px;
  background: rgba(80,80,140,0.25); border: 1px solid rgba(100,100,160,0.3); color: var(--text);
}
.ov-tag.ov-done { background: rgba(60,140,80,0.2); border-color: rgba(80,180,100,0.3); color: #8f8; }
.ov-tag.ov-pending { opacity: 0.6; }
.ov-tag.ov-tier { background: rgba(200,160,60,0.2); border-color: rgba(200,160,60,0.4); color: #fc8; }
.ov-tag.ov-resonance { background: rgba(255,215,0,0.2); border-color: rgba(255,215,0,0.4); color: gold; animation: pulse 1s infinite; }
.ov-tag.ov-modifier { background: rgba(160,100,200,0.2); border-color: rgba(160,100,200,0.4); color: #c8a0f0; }
.ov-tag.ov-combo { background: rgba(100,180,255,0.15); border-color: rgba(100,180,255,0.3); color: #8cf; }
.ov-ability-grid { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ov-ability {
  padding: 2px 8px; border-radius: 8px; font-size: 11px;
  background: rgba(60,60,120,0.3); border: 1px solid rgba(100,100,160,0.3); color: var(--text);
}
.ov-ability.locked { opacity: 0.35; }
.ov-ability.disabled { text-decoration: line-through; opacity: 0.4; }
.ov-mission-list { display: flex; flex-direction: column; gap: 6px; }
.ov-mission {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; font-size: 12px;
  background: rgba(60,60,120,0.2); border: 1px solid rgba(100,100,160,0.2);
}
.ov-mission.ov-done { border-color: rgba(80,180,100,0.3); }
.ov-mission-status { color: var(--text-dim); font-size: 11px; text-align: right; }
.ov-mission.ov-done .ov-mission-status { color: #8f8; }
.ov-bio-group {
  font-size: 11px; color: var(--accent-light); letter-spacing: 2px; margin: 8px 0 4px;
  padding-bottom: 3px; border-bottom: 1px dotted rgba(100,100,160,0.2);
}
.ov-bio-group:first-child { margin-top: 0; }
.ov-bio-entry { padding: 4px 0; font-size: 12px; }
.ov-bio-entry.small { font-size: 11px; padding: 2px 0; }
.ov-bio-entry.dead { color: var(--text-dim); text-decoration: line-through; opacity: 0.6; }
.ov-bio-name { color: var(--text); }
.ov-bio-tag { color: var(--accent-light); font-size: 10px; margin-left: 6px; }
.ov-bio-detail { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.ov-tech-bar {
  height: 3px; background: rgba(40,40,80,0.5); border-radius: 2px; margin-top: 3px;
}
.ov-tech-bar > div { height: 100%; background: linear-gradient(90deg, #4488ff, #44ffaa); border-radius: 2px; }
.ov-empty { color: var(--text-dim); font-size: 12px; font-style: italic; }
/* 大事记时间线 */
.tl-entry {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 6px 0; border-left: 2px solid #2a2a4a;
  margin-left: 40px; padding-left: 14px; position: relative;
  font-size: 12px;
}
.tl-entry .tl-turn {
  position: absolute; left: -48px; width: 40px; text-align: right;
  font-family: monospace; font-size: 10px; color: var(--text-dim);
  padding-top: 2px;
}
.tl-entry .tl-dot {
  position: absolute; left: -6px; top: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
}
.tl-entry .tl-body { flex: 1; }
.tl-entry .tl-title { font-weight: bold; color: var(--text); }
.tl-entry .tl-text { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.tl-milestone .tl-dot { background: var(--good); box-shadow: 0 0 6px var(--good); }
.tl-milestone .tl-title { color: var(--good); }
.tl-disaster .tl-dot { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.tl-disaster .tl-title { color: var(--warn); }
.tl-combo .tl-dot { background: #ffd700; box-shadow: 0 0 6px #ffd700; }
.tl-combo .tl-title { color: #ffe066; }
.tl-mission .tl-dot { background: var(--accent-light); }
.tl-mission .tl-title { color: var(--accent-light); }

.view-btn.hint-empty {
  opacity: 0.55;
  border-style: dashed;
}

/* 全局能力"已选中待确认"动画 */
.ability.armed {
  animation: armed-pulse 1.2s infinite;
  box-shadow: 0 0 16px var(--warn);
}
@keyframes armed-pulse {
  0%, 100% { box-shadow: 0 0 8px var(--warn); }
  50% { box-shadow: 0 0 20px var(--warn), 0 0 32px var(--accent); }
}

/* 视图图例 */
.view-legend {
  background: rgba(20,20,45,0.6);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  min-height: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.view-legend .legend-swatch {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -2px;
  border: 1px solid rgba(255,255,255,0.15);
}
.view-legend .legend-item {
  display: inline-flex; align-items: center;
  color: var(--text);
}
.view-legend .legend-gradient {
  display: inline-block;
  width: 140px; height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.15);
}
.view-legend .legend-marks {
  display: inline-flex;
  font-family: monospace;
  font-size: 9px;
  gap: 8px;
  color: var(--text-dim);
}
.view-legend .civ-tag {
  display: inline-flex; align-items: center;
  font-size: 10px;
  color: var(--text);
  padding: 2px 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 2px;
  white-space: nowrap;
}
.view-legend .civ-tag .tech {
  color: var(--text-dim); font-size: 9px; margin-left: 4px;
  font-family: monospace;
}

/* ===== 图鉴模态 ===== */
#codex-modal { display: none; position: fixed; inset: 0; z-index: 200; }
#codex-modal.show { display: block; }
.codex-tabs {
  display: flex; gap: 4px;
  flex: 1; margin-left: 24px;
  flex-wrap: wrap;
}
.codex-tab {
  background: rgba(20,20,45,0.7);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.codex-tab.active { color: var(--accent); border-color: var(--accent); background: rgba(68,136,255,0.15); }
.codex-tab .count { color: var(--text-dim); font-size: 9px; margin-left: 4px; }

.codex-card {
  background: linear-gradient(135deg, #0e0e25, #050510);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 18px 22px;
  margin: 0 auto 18px;
  max-width: 760px;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 18px;
  animation: fadeIn 0.4s;
}
.codex-card.extinct { opacity: 0.65; border-left-color: var(--bad); }
.codex-card .cc-portrait {
  width: 90px; height: 90px;
  display: flex; align-items: center; justify-content: center;
  font-size: 56px;
  background: #050515;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.codex-card.extinct .cc-portrait { filter: grayscale(0.7); }
.codex-card .cc-name {
  font-size: 22px; color: var(--accent-light);
  margin-bottom: 2px;
}
.codex-card .cc-name .kingdom-tag {
  font-size: 11px;
  background: rgba(68,136,255,0.15);
  border: 1px solid var(--accent);
  color: var(--accent-light);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 10px;
  vertical-align: middle;
  letter-spacing: 1px;
}
.codex-card .cc-meta {
  font-size: 10px; color: var(--text-dim);
  margin-bottom: 12px;
  font-family: monospace;
}
.codex-card .cc-meta span { margin-right: 14px; }
.codex-card .cc-meta .dead { color: var(--bad); }
.codex-card .cc-meta .alive { color: var(--good); }
.codex-card .cc-section {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
}
.codex-card .cc-label {
  display: inline-block;
  font-size: 10px; letter-spacing: 2px;
  color: var(--accent-light);
  margin-bottom: 4px;
  border-bottom: 1px dotted var(--border);
  padding-bottom: 2px;
  min-width: 80px;
}
.codex-card .cc-traits {
  display: flex; gap: 8px; margin-top: 10px;
  flex-wrap: wrap;
}
.codex-card .cc-trait {
  font-size: 10px;
  background: rgba(20,20,45,0.6);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-dim);
}
.codex-card .cc-trait .bar {
  display: inline-block; width: 40px; height: 4px;
  background: #1a1a3a; border-radius: 2px; margin-left: 4px;
  vertical-align: 1px;
  position: relative;
}
.codex-card .cc-trait .bar::after {
  content: '';
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
.codex-card .cc-parent {
  font-size: 10px; color: var(--text-dim); margin-top: 8px;
  font-style: italic;
}
.codex-empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-dim); font-style: italic;
}

/* ===== 文明图鉴卡片 ===== */
.codex-card.civ-card { border-left-color: #ffaa44; }
.codex-card.civ-card.extinct { border-left-color: #885544; }

.civ-tech-wrap {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0 4px;
}
.civ-tech-bar-outer {
  flex: 1; height: 8px;
  background: #1a1a3a;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  max-width: 300px;
}
.civ-tech-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #446688, #44aaff, #88ddff);
  border-radius: 4px;
  transition: width 0.3s;
  box-shadow: 0 0 6px rgba(68,170,255,0.4);
}
.civ-tech-pct {
  font-size: 11px;
  color: var(--accent-light);
  font-family: monospace;
  white-space: nowrap;
}
.civ-milestones {
  display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap;
}
.civ-milestone {
  font-size: 16px;
  opacity: 0.25;
  filter: grayscale(1);
  transition: all 0.2s;
}
.civ-milestone.done {
  opacity: 1;
  filter: none;
  text-shadow: 0 0 6px rgba(255,200,100,0.5);
}

/* 战争历史 */
.civ-wars { margin-top: 6px; }
.civ-war-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  padding: 4px 0;
  border-bottom: 1px dotted #1a1a35;
  flex-wrap: wrap;
}
.civ-war-item:last-child { border-bottom: none; }
.civ-war-item .war-turn {
  color: var(--text-dim);
  font-family: monospace;
  font-size: 10px;
  min-width: 80px;
}
.civ-war-item .war-cause {
  color: var(--text-dim);
  font-size: 10px;
  font-style: italic;
}
.civ-war-item .war-vs {
  color: var(--text);
  font-weight: bold;
}
.civ-war-item .war-dur {
  color: var(--text-dim);
  font-size: 10px;
  font-family: monospace;
}
.civ-war-item .war-win { color: var(--good); font-weight: bold; }
.civ-war-item .war-lose { color: var(--bad); font-weight: bold; }
.civ-war-item .war-truce { color: var(--warn); }
.civ-war-item .war-ongoing { color: var(--warn); animation: armed-pulse 1.5s infinite; }

.civ-at-war {
  color: var(--warn);
  font-weight: bold;
  animation: armed-pulse 2s infinite;
}

/* 阶段栏（升级版）：当前 + 下一纪元提示 */
.phase-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 5px 10px;
  margin-bottom: 2px;
}
.phase-bar .ph-cur {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.phase-bar .ph-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex-shrink: 1;
}
.phase-bar .ph-sub {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.phase-bar .ph-next {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; color: var(--text-dim);
  padding-top: 3px;
  border-top: 1px dotted var(--border);
  min-width: 0;
}
.phase-bar .ph-next .ph-need {
  margin-left: auto;
  color: var(--warn); font-size: 10px;
  text-align: right;
  font-family: monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 50%;
}
.phase-bar .ph-next.ph-final {
  color: var(--good); font-weight: bold; justify-content: center;
}

.book-chapter .ch-title .demote-tag {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 2px;
  background: rgba(255,170,68,0.18);
  color: var(--warn);
  border: 1px solid var(--warn);
  padding: 2px 10px;
  border-radius: 12px;
  margin-right: 14px;
  vertical-align: 6px;
}

/* ===== 灾变弹窗 ===== */
#cataclysm-modal { display: none; position: fixed; inset: 0; z-index: 250; }
#cataclysm-modal.show { display: block; animation: fadeIn 0.4s; }
.cata-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(80,20,20,0.65), rgba(0,0,0,0.92));
  backdrop-filter: blur(8px);
  animation: cata-pulse 2s infinite;
}
@keyframes cata-pulse {
  0%, 100% { background: radial-gradient(ellipse at center, rgba(80,20,20,0.65), rgba(0,0,0,0.92)); }
  50% { background: radial-gradient(ellipse at center, rgba(120,30,30,0.75), rgba(0,0,0,0.92)); }
}
.cata-card {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 92%; max-width: 580px;
  background: linear-gradient(180deg, #1a0a1a, #0a0510);
  border: 2px solid var(--warn);
  border-radius: 10px;
  padding: 28px 32px 22px;
  box-shadow: 0 0 60px rgba(255,170,68,0.45);
  animation: scaleIn 0.5s;
  font-family: 'JetBrains Mono', 'Menlo', monospace;
}
.cata-icon { font-size: 56px; text-align: center; line-height: 1; margin-bottom: 6px; }
.cata-name {
  text-align: center; font-size: 22px; letter-spacing: 6px;
  color: var(--warn); margin-bottom: 4px;
  text-shadow: 0 0 18px rgba(255,170,68,0.55);
}
.cata-tag {
  text-align: center; font-size: 10px; letter-spacing: 4px;
  color: var(--bad); margin-bottom: 16px;
  opacity: 0.85;
}
.cata-intro {
  font-size: 12px; line-height: 1.85;
  color: #d8d4c4; margin-bottom: 18px;
  font-family: 'Songti SC', serif;
  text-indent: 2em;
}
.cata-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cata-opt {
  background: rgba(40,20,20,0.55);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-align: left;
  color: var(--text);
}
.cata-opt:hover {
  background: rgba(60,30,30,0.85);
  border-left-color: var(--warn);
  transform: translateX(2px);
}
.cata-opt .opt-name {
  font-size: 13px; color: var(--accent-light);
  margin-bottom: 4px; font-weight: bold;
}
.cata-opt .opt-desc {
  font-size: 11px; color: var(--text-dim);
  line-height: 1.5;
}
.cata-timer { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cata-timer-bar {
  flex: 1; height: 6px; background: #2a1010;
  border: 1px solid var(--border);
  border-radius: 3px; overflow: hidden;
}
.cata-timer-fill {
  height: 100%; background: linear-gradient(90deg, var(--warn), var(--bad));
  transition: width 0.3s linear;
  box-shadow: 0 0 6px var(--warn);
}
.cata-timer-text {
  font-size: 11px; color: var(--warn); font-family: monospace;
  min-width: 36px; text-align: right;
}
.cata-hint {
  font-size: 10px; color: var(--text-dim);
  text-align: center; font-style: italic;
  letter-spacing: 1px;
}

/* ===== 成就系统 ===== */
#ach-modal { display: none; position: fixed; inset: 0; z-index: 200; }
#ach-modal.show { display: block; }
.ach-summary {
  font-size: 13px; color: var(--accent-light);
  margin: 0 0 4px 0; letter-spacing: 1px;
}
.ach-footer {
  padding: 12px 24px; text-align: center;
  border-top: 1px solid var(--border);
}
.ach-share-btn {
  background: linear-gradient(135deg, var(--accent), #6644ff);
  color: #fff; border: none; padding: 8px 24px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
  letter-spacing: 1px; transition: transform .15s;
}
.ach-share-btn:hover { transform: scale(1.05); }

.ach-card {
  background: rgba(30,30,60,0.7); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color .2s;
}
.ach-card.done { border-left: 3px solid var(--good); }
.ach-card.locked { opacity: 0.5; border-left: 3px solid var(--text-dim); }
.ach-card .ach-icon { font-size: 28px; flex-shrink: 0; width: 36px; text-align: center; }
.ach-card.locked .ach-icon { filter: grayscale(1); }
.ach-card .ach-info { flex: 1; min-width: 0; }
.ach-card .ach-name { font-size: 13px; font-weight: bold; color: var(--text); }
.ach-card .ach-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.ach-card .ach-diff { margin-top: 3px; font-size: 10px; color: var(--warn); letter-spacing: 1px; }
.ach-card .ach-meta { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* 成就 toast 通知 */
#ach-toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.ach-toast {
  background: linear-gradient(135deg, rgba(20,40,80,0.95), rgba(40,20,80,0.95));
  border: 1px solid var(--accent); border-radius: 10px;
  padding: 12px 18px; min-width: 260px; max-width: 340px;
  display: flex; align-items: center; gap: 12px;
  animation: achToastIn .4s ease-out, achToastOut .4s ease-in 3.6s forwards;
  box-shadow: 0 4px 20px rgba(68,136,255,0.3);
}
.ach-toast .toast-icon { font-size: 28px; }
.ach-toast .toast-body { flex: 1; }
.ach-toast .toast-label { font-size: 10px; color: var(--accent); letter-spacing: 2px; text-transform: uppercase; }
.ach-toast .toast-name { font-size: 13px; font-weight: bold; color: #fff; margin-top: 2px; }
.ach-toast .toast-desc { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
@keyframes achToastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes achToastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-20px); } }

/* === 连锁系统 UI === */
.interstellar-toast {
  background: linear-gradient(135deg, rgba(40,20,80,0.96), rgba(20,15,60,0.96)) !important;
  border-color: #cc88ff !important;
  box-shadow: 0 0 20px rgba(160,100,255,0.3) !important;
}
.defiance-toast {
  background: linear-gradient(135deg, rgba(80,50,0,0.96), rgba(60,30,5,0.96)) !important;
  border-color: #ffcc44 !important;
  box-shadow: 0 0 24px rgba(255,180,50,0.4) !important;
  animation: defiancePulse 0.6s ease-out;
}
@keyframes defiancePulse {
  0% { transform: translateX(100%) scale(1.2); opacity: 0; }
  50% { transform: translateX(0) scale(1.05); opacity: 1; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
.combo-toast {
  background: linear-gradient(135deg, rgba(40,30,10,0.96), rgba(60,40,10,0.96)) !important;
  border-color: #ffd700 !important;
  box-shadow: 0 0 20px rgba(255,215,0,0.3) !important;
}
.combo-toast .combo-icon { font-size: 32px; filter: drop-shadow(0 0 6px rgba(255,215,0,0.5)); }
.combo-new {
  display: inline-block; background: #ffd700; color: #1a1a1a;
  font-size: 9px; font-weight: bold; padding: 1px 6px;
  border-radius: 8px; margin-left: 6px; letter-spacing: 1px;
}
.combo-flash {
  position: fixed; inset: 0; z-index: 500;
  background: radial-gradient(ellipse at center, rgba(255,215,0,0.15) 0%, transparent 70%);
  pointer-events: none;
  animation: comboFlash 0.6s ease-out forwards;
}
@keyframes comboFlash { from { opacity: 1; } to { opacity: 0; } }

/* 能力等阶标记 */
.tier-badge {
  position: absolute; top: 1px; right: 2px;
  font-size: 7px; font-weight: bold; font-family: serif;
  line-height: 1; padding: 1px 2px; border-radius: 2px;
  pointer-events: none;
}
.tier-badge.tier-2 { color: #6ec6ff; text-shadow: 0 0 4px rgba(110,198,255,0.5); }
.tier-badge.tier-3 { color: #ffd700; text-shadow: 0 0 6px rgba(255,215,0,0.6); }

/* 神之共鸣 — 能量条发光 */
.power-fill.resonance {
  background: linear-gradient(90deg, #ffd700, #ffee88) !important;
  box-shadow: 0 0 16px rgba(255,215,0,0.6) !important;
  animation: resonancePulse 0.8s infinite alternate;
}
@keyframes resonancePulse {
  from { box-shadow: 0 0 12px rgba(255,215,0,0.4); }
  to   { box-shadow: 0 0 24px rgba(255,215,0,0.8); }
}

/* ===== 天命任务系统 ===== */
.mission-list { margin-bottom: 8px; }
.mission-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 8px; margin-bottom: 4px;
  border-radius: 4px; border-left: 3px solid var(--accent);
  background: rgba(30,30,60,0.5);
  transition: all 0.3s;
}
.mission-item.done {
  border-left-color: var(--good);
  background: rgba(30,60,30,0.3);
}
.mission-item .mi-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.mission-item .mi-info { flex: 1; min-width: 0; }
.mission-item .mi-name { font-size: 11px; font-weight: bold; color: var(--text); }
.mission-item .mi-desc { font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.mission-item .mi-hint { font-size: 9px; color: var(--accent); font-style: italic; margin-top: 2px; }
.mission-item .mi-check {
  flex-shrink: 0; width: 16px; height: 16px; margin-top: 2px;
  border: 1px solid var(--border); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--good);
}
.mission-item.done .mi-name { text-decoration: line-through; color: var(--text-dim); }
.mission-empty { font-size: 10px; color: var(--text-dim); font-style: italic; padding: 4px 0; }

/* 词缀指示器（游戏中） */
.modifier-bar {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 6px;
}
.mod-indicator {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: rgba(255,170,68,0.12); border: 1px solid rgba(255,170,68,0.25);
  color: var(--warn); cursor: help;
  transition: background 0.2s;
}
.mod-indicator:hover {
  background: rgba(255,170,68,0.25);
}

/* 任务完成动画 */
.mission-complete-flash {
  animation: missionFlash 0.6s ease-out;
}
@keyframes missionFlash {
  0% { background: rgba(68,255,136,0.3); }
  100% { background: rgba(30,60,30,0.3); }
}

/* 分享预览 */
#ach-share-preview { display: none; position: fixed; inset: 0; z-index: 250; }
#ach-share-preview[style*="block"] { display: block !important; }
.ach-share-window {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; max-width: 90vw; max-height: 90vh;
  overflow: auto;
}
.ach-share-header {
  font-size: 14px; color: var(--accent); margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
#achShareImg { max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.ach-share-actions { text-align: center; margin-top: 12px; }
.ach-share-actions a {
  color: var(--accent); background: rgba(68,136,255,0.15);
  padding: 8px 20px; border-radius: 6px; text-decoration: none;
  font-size: 13px; cursor: pointer;
}

/* ===== 神阶系统 ===== */
.divine-rank-bar {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 12px;
  padding: 10px 16px;
  background: rgba(20,20,40,0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.3s;
}
.divine-rank-bar:hover {
  border-color: var(--accent);
}
.divine-rank-icon {
  font-size: 28px;
  min-width: 36px;
  text-align: center;
}
.divine-rank-info {
  flex: 1;
  min-width: 0;
}
.divine-rank-name {
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
}
.divine-rank-title {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.divine-xp-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}
.divine-xp-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.divine-xp-text {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 3px;
  text-align: right;
}
.divine-rank-perks {
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
  max-width: 180px;
}
.divine-games {
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
}

/* 游戏内神阶小标签 */
.divine-ingame {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(20,20,40,0.8);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  z-index: 10;
  transition: border-color 0.3s;
}
.divine-ingame:hover {
  border-color: var(--accent);
}

/* 游戏结算弹窗 */
#game-result-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
}
.game-result-card {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 24px 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 30px rgba(68,136,255,0.3);
}
.gr-title {
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 2px;
}
.gr-breakdown {
  text-align: left;
  margin-bottom: 12px;
}
.gr-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.gr-row .gr-xp {
  color: var(--accent-light);
  font-weight: bold;
}
.gr-total {
  font-size: 16px;
  color: var(--accent-light);
  margin: 12px 0;
  padding: 8px;
  background: rgba(68,136,255,0.1);
  border-radius: 8px;
}
.gr-promotions {
  margin: 12px 0;
}
.gr-promo-item {
  font-size: 14px;
  color: #ffd700;
  padding: 6px;
  margin: 4px 0;
  background: rgba(255,215,0,0.1);
  border-radius: 6px;
  animation: promoGlow 1.5s ease-in-out infinite alternate;
}
@keyframes promoGlow {
  from { box-shadow: 0 0 5px rgba(255,215,0,0.2); }
  to { box-shadow: 0 0 15px rgba(255,215,0,0.4); }
}
#grClose {
  background: linear-gradient(135deg, var(--accent), #6644ff);
  color: white;
  border: none;
  padding: 10px 32px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
  letter-spacing: 2px;
}
#grClose:hover { filter: brightness(1.2); }

/* 神阶详情弹窗 */
#divine-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}
#divine-modal.show {
  display: block;
}
.divine-window { max-width: 560px; }
.divine-profile {
  text-align: center;
  padding: 20px;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
}
.divine-profile-icon { font-size: 48px; margin-bottom: 8px; }
.divine-profile-name { font-size: 20px; font-weight: bold; letter-spacing: 2px; }
.divine-profile-title { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.divine-profile-lore {
  font-size: 12px; color: var(--text-dim);
  margin-top: 12px; line-height: 1.6;
  font-style: italic;
}
.divine-progress-section {
  margin: 16px 0;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}
.divine-progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 5px;
  margin: 8px 0;
  overflow: hidden;
}
.divine-progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}
.divine-stats-row {
  display: flex;
  justify-content: space-around;
  margin: 16px 0;
  gap: 8px;
}
.divine-stat {
  text-align: center;
  flex: 1;
}
.divine-stat-val {
  font-size: 18px;
  font-weight: bold;
  color: var(--accent-light);
}
.divine-stat-lbl {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.divine-exam-section { margin-top: 16px; }
.divine-exam-title {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.divine-exam-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin: 4px 0;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  border-left: 3px solid var(--border);
}
.divine-exam-item.completed {
  border-left-color: #44cc88;
  opacity: 0.7;
}
.divine-exam-icon { font-size: 20px; min-width: 28px; text-align: center; }
.divine-exam-info { flex: 1; }
.divine-exam-name { font-size: 13px; font-weight: bold; }
.divine-exam-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.divine-exam-reward { font-size: 11px; color: var(--accent-light); }
.divine-exam-diff { font-size: 10px; color: var(--text-dim); }

/* ===== 新手教学系统 ===== */
#tutorial-overlay {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
}
.tutorial-mask {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  pointer-events: auto;
}
.tutorial-dialogue {
  position: fixed;
  bottom: 32px; left: 50%; transform: translateX(-50%);
  width: 620px; max-width: 92vw;
  background: linear-gradient(135deg, rgba(15,15,40,0.97), rgba(20,18,50,0.97));
  border: 1px solid rgba(100,130,255,0.35);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 0 40px rgba(68,100,255,0.2), 0 8px 32px rgba(0,0,0,0.5);
  display: flex; gap: 16px; align-items: flex-start;
  pointer-events: auto;
  animation: tutorialSlideIn 0.4s ease-out;
  z-index: 10000;
}
@keyframes tutorialSlideIn {
  from { transform: translateX(-50%) translateY(30px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.tutorial-avatar {
  font-size: 42px;
  min-width: 50px;
  text-align: center;
  filter: drop-shadow(0 0 8px rgba(255,200,80,0.3));
}
.tutorial-body {
  flex: 1;
  min-width: 0;
}
.tutorial-speaker {
  font-size: 11px;
  color: rgba(200,180,255,0.7);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.tutorial-text {
  font-size: 14px;
  line-height: 1.8;
  color: rgba(230,230,255,0.92);
  white-space: pre-wrap;
}
.tutorial-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.tutorial-progress {
  font-size: 10px;
  color: rgba(150,150,200,0.5);
  flex: 1;
}
.tutorial-skip {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(200,200,220,0.5);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.tutorial-skip:hover {
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.3);
}
.tutorial-next {
  background: linear-gradient(135deg, var(--accent), #6644ff);
  color: white;
  border: none;
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: filter 0.2s;
}
.tutorial-next:hover {
  filter: brightness(1.2);
}
.tutorial-next.waiting {
  background: rgba(80,80,120,0.5);
  color: rgba(200,200,220,0.5);
  cursor: default;
  letter-spacing: 1px;
}
/* 高亮遮罩 */
.tutorial-highlight-box {
  position: absolute;
  border: 2px solid rgba(100,150,255,0.7);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 20px rgba(100,150,255,0.4);
  pointer-events: none;
  transition: all 0.4s ease;
  z-index: 9998;
}
/* 指引箭头 */
.tutorial-arrow {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 10001;
  animation: tutorialBounce 1.2s ease-in-out infinite;
}
@keyframes tutorialBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.tutorial-arrow-text {
  font-size: 12px;
  color: rgba(150,200,255,0.9);
  background: rgba(20,20,50,0.85);
  padding: 4px 12px;
  border-radius: 10px;
  border: 1px solid rgba(100,150,255,0.3);
  margin-bottom: 6px;
  white-space: nowrap;
}
.tutorial-arrow-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 6px rgba(100,150,255,0.5));
}

/* ===== 手机适配 ===== */
@media (max-width: 900px) {
  html, body { overflow: auto; overflow-x: hidden; }

  /* === 选择界面 === */
  #selector { padding: 20px 10px; }
  #selector h1 { font-size: 24px; letter-spacing: 4px; }
  #selector .subtitle { font-size: 11px; margin-bottom: 20px; }
  .planet-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; padding: 0 4px; }
  .planet-card { padding: 12px; }
  .planet-card canvas { width: 80px; height: 80px; }
  .regen-btn { padding: 8px 16px; font-size: 12px; letter-spacing: 1px; }

  /* === 游戏主界面 === */
  #game {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto;
    height: auto; min-height: 100vh;
    padding: 6px; gap: 6px;
  }
  #game.active { display: flex; flex-direction: column; }

  /* 面板排列：先中间(星球)→左(能力)→右(信息) */
  #center-panel { order: 1; }
  #left-panel   { order: 2; }
  #right-panel  { order: 3; }

  .panel { border-radius: 4px; padding: 8px; overflow: visible; }

  /* 中间面板 — 星球 */
  #center-panel { min-height: auto; }
  .canvas-wrap { min-height: 0; flex: none; aspect-ratio: 1; max-height: 60vw; }
  #planetCanvas { max-width: 100%; max-height: 100%; touch-action: none; }
  .top-bar { padding: 4px 6px; }
  .top-bar .planet-name { font-size: 14px; }
  .top-bar .epoch { font-size: 10px; }
  .view-toggle { gap: 2px; flex-wrap: wrap; }
  .view-btn { padding: 4px 6px; font-size: 9px; }
  .speed-controls { gap: 3px; }
  .speed-btn { padding: 6px 10px; font-size: 12px; min-width: 36px; }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 3px; font-size: 9px; }
  .stat-cell { padding: 3px 4px; }
  .phase-bar { padding: 4px 8px; font-size: 10px; }

  /* 左面板 — 能力按钮 */
  #left-panel { max-height: none; overflow: visible; gap: 6px; }
  #left-panel h3 { font-size: 12px; margin-bottom: 4px; }
  .ability-grid { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .ability-btn { padding: 6px 2px; font-size: 18px; min-height: 40px; }
  .ability-group .label { font-size: 10px; }
  .selected-info { font-size: 11px; padding: 6px; }

  /* 右面板 — 信息 */
  #right-panel { max-height: none; overflow: visible; }
  .panel-toolbar { flex-wrap: wrap; gap: 4px; }
  .panel-toolbar .back-btn { padding: 6px 10px; font-size: 11px; }
  .chronicle-log { max-height: 200px; }
  .collapsible-body { max-height: 150px; }
  .chronicle-header { font-size: 11px; }
  .epic-btn { font-size: 10px; padding: 3px 6px; }

  /* === 模态窗口 === */
  .epic-window, .save-window, .overview-window, .divine-window {
    width: 95vw !important; max-width: 95vw !important;
    max-height: 90vh !important;
    margin: 5vh auto;
  }
  .epic-content { max-height: 70vh; }
  .epic-header { flex-wrap: wrap; gap: 4px; }
  .codex-tabs { flex-wrap: wrap; gap: 3px; }
  .codex-tab { font-size: 10px; padding: 3px 6px; }

  /* 灾变模态 */
  .cata-card { width: 92vw; max-width: 92vw; padding: 16px; }
  .cata-name { font-size: 18px; }
  .cata-options { gap: 8px; }
  .cata-opt { padding: 10px; font-size: 12px; }

  /* 里程碑弹窗 */
  #milestone-popup .milestone-card { width: 90vw; max-width: 90vw; padding: 20px; }

  /* 成就标签页 */
  #achTabs { flex-wrap: wrap; }

  /* 教学对话 — 手机适配 */
  .tutorial-dialogue {
    width: 94vw; max-width: 94vw;
    left: 3vw; bottom: 10px;
    padding: 12px 14px;
    transform: none; /* 覆盖桌面版的 translateX(-50%) */
    gap: 10px;
  }
  .tutorial-dialogue.tutorial-top {
    bottom: auto; top: 10px;
  }
  @keyframes tutorialSlideIn {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  .tutorial-avatar { font-size: 30px; min-width: 36px; }
  .tutorial-speaker { font-size: 10px; margin-bottom: 4px; }
  .tutorial-text { font-size: 13px; line-height: 1.6; }
  .tutorial-footer { gap: 8px; margin-top: 10px; }
  .tutorial-skip { padding: 8px 12px; font-size: 12px; min-height: 36px; }
  .tutorial-next { padding: 10px 20px; font-size: 13px; min-height: 36px; }
  .tutorial-arrow-text { font-size: 11px; }
  .tutorial-arrow-icon { font-size: 20px; }

  /* 存档管理 */
  .save-item { padding: 8px; }
  .save-item .si-name { font-size: 12px; }

  /* 星系 UI */
  .galaxy-shelf { max-width: 100%; }
  .galaxy-shelf-list { flex-wrap: wrap; gap: 8px; }
  .galaxy-planet-card { min-width: 120px; }

  /* 游戏结算 */
  .game-result-card { width: 92vw; max-width: 92vw; }

  /* 连接状态指示器 */
  .conn-status { display: none; }
}

/* 极窄屏幕 */
@media (max-width: 480px) {
  .planet-grid { grid-template-columns: 1fr; }
  .ability-grid { grid-template-columns: repeat(4, 1fr); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .view-toggle .view-btn { font-size: 9px; padding: 3px 5px; }
  .canvas-wrap { max-height: 75vw; }
  .panel-toolbar { justify-content: center; }
  .panel-toolbar .toolbar-spacer { display: none; }
}
