/* ─────────────────────────────────────────────────────────
   《戴上她的眼睛》原型 0.1 · 三栏界面
   左：下矿游玩区 / 右上：当前聊天对象立绘 / 右下：数据 + 聊天
   ───────────────────────────────────────────────────────── */
:root {
  --bg: #070a10;
  --panel: #0d131d;
  --line: #1b2838;
  --txt: #c3d2e2;
  --dim: #6b8299;
  --cyan: #57d8ff;
  --gold: #e8c45a;
  --red: #ff6b6b;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  grid-template-rows: minmax(220px, 44%) minmax(0, 56%);
  gap: 10px;
  height: 100vh;
  padding: 10px;
  max-width: 1720px;
  margin: 0 auto;
}

#play { grid-column: 1; grid-row: 1 / span 2; }
#portraitPanel { grid-column: 2; grid-row: 1; }
#hudPanel { grid-column: 2; grid-row: 2; }

.panel {
  position: relative;
  background: linear-gradient(180deg, #0e1520, #0a0f18);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  min-height: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(160, 210, 255, 0.028) 0 1px, transparent 1px 3px);
}

/* ── 游玩区 ───────────────────────────────────────────── */
#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #05080d;
  image-rendering: pixelated;
}

.banner {
  position: absolute;
  left: 10px;
  right: 46px;
  top: 10px;
  padding: 7px 10px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #cfe9f7;
  background: rgba(14, 24, 38, 0.92);
  border-left: 3px solid var(--cyan);
  backdrop-filter: blur(2px);
}
.banner.warn {
  border-left-color: var(--gold);
  color: #ffe9a8;
}
.banner.hidden { display: none; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 12px;
  color: #cfe3f4;
  background: rgba(8, 12, 20, 0.94);
  border: 1px solid #2a3f58;
  white-space: nowrap;
}
.toast.hidden { display: none; }

.help-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 26px;
  height: 26px;
  font: inherit;
  font-size: 13px;
  color: #7fa3bc;
  background: rgba(10, 16, 26, 0.9);
  border: 1px solid #22374d;
  cursor: pointer;
  line-height: 1;
}
.help-btn:hover { color: var(--cyan); border-color: #3a5a76; }

.err {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 20;
  padding: 8px 10px;
  font-size: 12px;
  color: #ffd7d7;
  background: rgba(70, 16, 16, 0.96);
  border: 1px solid #a33;
}
.err.hidden { display: none; }

/* ── 基地控制台：贴在画面底部的横条，不遮住机库 ─────── */
.overlay.dock {
  align-items: flex-end;
  padding: 0;
  background: linear-gradient(to top, rgba(4, 8, 14, 0.92) 0%, rgba(4, 8, 14, 0.62) 30%, rgba(4, 8, 14, 0) 62%);
  backdrop-filter: none;
}
.overlay.dock .overlay-card {
  width: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-top: 1px solid #24394f;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(12, 19, 29, 0.93), rgba(7, 11, 18, 0.98));
  box-shadow: 0 -20px 46px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(120, 200, 255, 0.10);
}
.base-bar {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 14px 22px 16px;
}
.bb-title { flex: 1 1 auto; min-width: 0; }
.bb-title .ov-tag { margin-bottom: 4px; }
.bb-title h2 { margin: 2px 0 5px; font-size: 20px; }
.bb-title .ov-sub { margin: 0; font-size: 12px; }
.bb-stats { display: flex; gap: 10px; flex: 0 0 auto; }
.bb-stats > div {
  min-width: 88px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #1e2f45;
  border-left: 2px solid #2f5273;
}
.bb-stats b {
  display: block;
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1.2;
  color: #e6f4ff;
  font-variant-numeric: tabular-nums;
}
.bb-stats i {
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.bb-actions { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; }
.bb-actions .btn.primary { padding: 10px 22px; }
.bb-sub { display: flex; gap: 8px; }
.bb-sub .btn { padding: 6px 12px; font-size: 12px; }

/* ── 按钮扫光 ─────────────────────────────────────────── */
.btn { position: relative; overflow: hidden; }
.btn.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 18%, rgba(255, 255, 255, 0.16) 45%, transparent 72%);
  transform: translateX(-130%);
  animation: sheen 4.2s ease-in-out infinite;
}
@keyframes sheen {
  0% { transform: translateX(-130%); }
  55% { transform: translateX(130%); }
  100% { transform: translateX(130%); }
}

/* ── 覆层 ─────────────────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(ellipse at 50% 38%, rgba(8, 14, 24, 0.74), rgba(4, 7, 12, 0.94));
  backdrop-filter: blur(2px);
}
.overlay.hidden { display: none; }

.overlay-card {
  width: min(620px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 20px 22px;
  background: rgba(10, 16, 26, 0.97);
  border: 1px solid #263c55;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(87, 216, 255, 0.05);
}

.ov-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 3px 9px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  border: 1px solid rgba(87, 216, 255, 0.34);
}
.ov-tag.ok { color: #7fe0b0; border-color: rgba(127, 224, 176, 0.34); }
.ov-tag.warn { color: var(--gold); border-color: rgba(232, 196, 90, 0.34); }
.ov-tag.bad { color: #ff8b8b; border-color: rgba(255, 139, 139, 0.34); }

.overlay-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #e8f4ff;
}
.ver {
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 400;
  color: var(--dim);
  border: 1px solid #2a3d55;
  vertical-align: 4px;
}
.ov-sub {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--dim);
}
.ov-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 14px;
}
.ov-grid > div {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #1e2f45;
}
.ov-grid b {
  display: block;
  font-family: var(--mono);
  font-size: 18px;
  color: #dcecfb;
  font-variant-numeric: tabular-nums;
}
.ov-grid i {
  font-style: normal;
  font-size: 11px;
  color: var(--dim);
}
.ov-note {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--dim);
}
.ov-note.ok { color: #7fe0b0; }
.ov-line {
  margin: 12px 0;
  padding-left: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: #cfe3f4;
  border-left: 2px solid var(--cyan);
}
.ov-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn {
  font: inherit;
  font-size: 13px;
  padding: 9px 16px;
  color: #a8dcf5;
  background: #16283c;
  border: 1px solid #2f4a68;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: #1d3752; border-color: #3f6489; color: #d6f3ff; }
.btn.primary {
  color: #d8f6ff;
  background: linear-gradient(180deg, #1e4a63, #153245);
  border-color: #3b6f92;
}
.btn.primary:hover { background: linear-gradient(180deg, #245c7b, #183b52); }
.btn.ghost { background: transparent; color: var(--dim); border-color: #24374d; }
.btn.ghost:hover { color: #b9d4e8; }

table.keys {
  width: 100%;
  margin: 4px 0 12px;
  font-size: 12.5px;
  border-collapse: collapse;
}
table.keys td {
  padding: 7px 8px;
  border-bottom: 1px solid #16212f;
  vertical-align: top;
  line-height: 1.6;
}
table.keys td:first-child {
  width: 156px;
  color: var(--cyan);
  font-family: var(--mono);
  white-space: nowrap;
}

/* ── 右上：立绘 ───────────────────────────────────────── */
.portrait-panel {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 10px;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.pp-name { font-size: 15px; letter-spacing: 0.1em; color: #e6f4ff; }
.pp-stage {
  margin-left: auto;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--dim);
  border: 1px solid #22344a;
}
.portrait-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
#portrait {
  height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  background: #070b12;
  border: 1px solid #1d2c3f;
  image-rendering: auto;
  animation: breathe 5.6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}
.portrait-tag {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 6px;
  font-size: 11px;
  color: #9fd6ee;
  background: rgba(6, 10, 16, 0.82);
  border: 1px solid #223a50;
}
.switch-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.chbtn {
  font: inherit;
  font-size: 12px;
  padding: 5px 0;
  color: #8fa9bf;
  background: #101a26;
  border: 1px solid #1e2f42;
  cursor: pointer;
}
.chbtn:hover { color: #d5efff; border-color: #33536f; background: #142334; }
.diff-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-top: 6px;
}
.diffbtn {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 0;
  color: #56718a;
  background: #0c141e;
  border: 1px solid #17232f;
  cursor: pointer;
}
.diffbtn:hover { color: var(--cyan); border-color: #2a4a63; }

/* ── 右下：数据 + 聊天 ────────────────────────────────── */
.hud-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 10px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.stat {
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid #172535;
  min-width: 0;
}
.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #d9ecfb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat i {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #5e7a92;
}

.bars { display: flex; flex-direction: column; gap: 5px; }
.bar {
  position: relative;
  height: 16px;
  background: #0a121c;
  border: 1px solid #1a2a3c;
  overflow: hidden;
}
.bar .fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  transition: width 0.18s linear;
}
.bar em {
  position: relative;
  z-index: 1;
  display: block;
  padding: 0 6px;
  font-style: normal;
  font-size: 10.5px;
  line-height: 14px;
  letter-spacing: 0.04em;
  color: #d6e8f6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}
.bar.hp .fill { background: linear-gradient(180deg, #3fd08a, #1f8a5c); }
.bar.hp.danger .fill { background: linear-gradient(180deg, #f2c14e, #b8862a); }
.bar.hp.critical .fill { background: linear-gradient(180deg, #ff6b6b, #a02b2b); }
.bar.cargo .fill { background: linear-gradient(180deg, #57d8ff, #2a7fa8); }
.bar.cargo.full .fill { background: linear-gradient(180deg, #e8c45a, #a8842a); }

.mini-wrap {
  position: relative;
  flex: 0 0 auto;
  height: 122px;
  padding: 2px;
  background: #070b12;
  border: 1px solid #172535;
}
#minimap { display: block; width: 100%; height: 100%; }
.mini-tag {
  position: absolute;
  right: 6px;
  top: 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #6b8299;
}

.chat {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 132px;
  background: #080d15;
  border: 1px solid #172535;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  font-size: 11.5px;
  color: #8fb4cc;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid #14202e;
}
.chat-flags { margin-left: auto; }
.mini-btn {
  font: inherit;
  font-size: 10.5px;
  padding: 2px 7px;
  color: #7fa3bc;
  background: #0e1926;
  border: 1px solid #1d3247;
  cursor: pointer;
}
.mini-btn:hover { color: var(--cyan); border-color: #2f5470; }

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.65;
  scrollbar-width: thin;
}
.msg { margin: 0 0 5px; word-break: break-word; }
.msg.sys { color: #6e8aa2; }
.msg.warn { color: var(--gold); }
.msg.tip { font-size: 11px; color: #55718a; }
.msg.me { color: #9fd6ee; }
.msg.her { color: #d6e6f4; }

.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb { background: #1d3048; }
.chat-log::-webkit-scrollbar-track { background: #0a121c; }

.chat-input {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid #14202e;
}
.chat-input input {
  flex: 1;
  min-width: 0;
  padding: 5px 7px;
  font: inherit;
  font-size: 12px;
  color: #d6e6f4;
  background: #0b1420;
  border: 1px solid #1b2c3f;
  outline: none;
}
.chat-input input:focus { border-color: #2f5470; }
.chat-input button {
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  color: #a8dcf5;
  background: #16283c;
  border: 1px solid #2f4a68;
  cursor: pointer;
}
.chat-input button:hover { background: #1d3752; }

/* ── 窄屏：三块竖排，顺序不变 ─────────────────────────── */
@media (max-width: 1180px) {
  html, body { overflow: auto; }
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: 62vh 340px auto;
    height: auto;
    min-height: 100vh;
  }
  #play { grid-column: 1; grid-row: 1; }
  #portraitPanel { grid-column: 1; grid-row: 2; height: 340px; }
  #hudPanel { grid-column: 1; grid-row: 3; height: 520px; }
}

@media (max-width: 900px) {
  .base-bar { flex-wrap: wrap; gap: 12px; padding: 12px 14px 14px; }
  .bb-title { flex: 1 1 100%; }
  .bb-stats { flex: 1 1 auto; }
  .bb-actions { flex-direction: row; align-items: center; width: 100%; justify-content: flex-end; }
}

/* ═══ 0.3：商城 / 档案 / 航线 / 结局 ═══════════════════ */
.overlay.wide { align-items: center; }
.overlay.wide .overlay-card {
  width: min(940px, 96%);
  max-height: 92%;
  overflow-y: auto;
}
.panel-head-lg {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 14px;
}
.panel-head-lg h2 { margin: 2px 0 0; }
.panel-gold {
  margin-left: auto;
  padding: 6px 14px;
  text-align: right;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #24374d;
}
.panel-gold b { display: block; font-family: var(--mono); font-size: 22px; color: var(--gold); }
.panel-gold i { font-style: normal; font-size: 10px; color: var(--dim); letter-spacing: 0.1em; }

.shop-groups { display: flex; flex-direction: column; gap: 18px; }
.shop-group h3, .aff-h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #8fb4cc;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.shop-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid #1c2c3e;
  border-left: 2px solid #2f5273;
}
.shop-card.maxed { border-left-color: #3f6b52; opacity: 0.85; }
.shop-card.gift { border-left-color: #6b5a2f; }
.sc-top { display: flex; align-items: baseline; gap: 8px; }
.sc-name { font-size: 14px; color: #e2eefb; }
.sc-lv { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.sc-desc { margin: 0; font-size: 12px; color: #a8c0d4; line-height: 1.5; }
.sc-detail { margin: 0; font-size: 11px; color: #5e7a92; }
.sc-bottom { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.sc-cost { font-family: var(--mono); font-size: 13px; color: var(--gold); }
.sc-cost.poor { color: #7a5a5a; }
.sc-done { font-size: 11px; color: #6fa88a; }
.sc-bottom .btn { margin-left: auto; }

.btn.small { padding: 5px 12px; font-size: 12px; }

/* 档案 */
.aff-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.aff-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font: inherit;
  color: #8fa9bf;
  background: #101a26;
  border: 1px solid #1e2f42;
  cursor: pointer;
}
.aff-tab img { width: 30px; height: 30px; object-fit: cover; border: 1px solid #24384d; }
.aff-tab span { font-size: 12px; }
.aff-tab em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 10px; color: #56718a; }
.aff-tab.on { color: #d8f2ff; border-color: #3f7396; background: #16283a; }
.aff-body { display: grid; grid-template-columns: 210px 1fr; gap: 16px; }
.aff-portrait {
  width: 100%;
  display: block;
  border: 1px solid #24384d;
  background: #070b12;
}
.aff-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.aff-head b { font-size: 15px; color: #e2f2ff; letter-spacing: 0.1em; }
.aff-head span { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.bar.aff { height: 8px; margin-bottom: 14px; }
.bar.aff .fill { background: linear-gradient(90deg, #57d8ff, #b18cf0); }
.report-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.report-card {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #1a2837;
  border-left: 2px solid #24384d;
}
.report-card.open { border-left-color: #57d8ff; background: rgba(87, 216, 255, 0.03); }
.rc-title { font-size: 12px; color: #cfe3f4; margin-bottom: 3px; }
.report-card.open .rc-title { color: #9fe0ff; }
.rc-body { font-size: 12px; line-height: 1.75; color: #8fa9bf; }
.report-card.open .rc-body { color: #c3d2e2; }
.gift-list { display: flex; flex-direction: column; gap: 5px; }
.gift-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid #1a2837;
}
.gift-row.empty { opacity: 0.55; }
.gr-name { font-size: 12.5px; color: #d6e6f4; }
.gr-tone { font-size: 10.5px; color: #7d93a8; }
.gr-own { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); }

/* 航线 */
.layer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.layer-card {
  position: relative;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid #1c2c3e;
  border-left: 2px solid #2b3f52;
}
.layer-card.unlocked { border-left-color: #57d8ff; }
.lc-no { position: absolute; right: 12px; top: 10px; font-family: var(--mono); font-size: 22px; color: rgba(120, 170, 210, 0.12); }
.lc-name { font-size: 16px; color: #e2f2ff; }
.lc-tag { font-size: 11px; color: #6f8ba1; letter-spacing: 0.1em; margin-bottom: 6px; }
.lc-desc { margin: 0 0 8px; font-size: 12px; line-height: 1.7; color: #a8c0d4; }
.lc-goal { font-size: 11.5px; color: var(--gold); margin-bottom: 8px; }
.lc-req { font-size: 11.5px; color: #8fa9bf; margin-bottom: 8px; font-family: var(--mono); }

/* 基地层区 chips */
.bb-layers { display: flex; gap: 6px; flex: 0 0 auto; }
.layer-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 9px;
  font: inherit;
  color: #8fa9bf;
  background: #0f1926;
  border: 1px solid #1e2f42;
  cursor: pointer;
  min-width: 74px;
}
.layer-chip b { font-size: 11.5px; font-weight: 500; }
.layer-chip i { font-style: normal; font-size: 9.5px; color: #56718a; }
.layer-chip.on { color: #d8f2ff; border-color: #3f7396; background: #16283a; box-shadow: 0 0 0 1px rgba(87, 216, 255, 0.18); }
.layer-chip.locked { opacity: 0.62; }

/* 结算表 */
.sale-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.sale-table td { padding: 5px 8px; border-bottom: 1px solid #16212f; color: #c3d2e2; }
.sale-table td:last-child { text-align: right; color: var(--gold); font-family: var(--mono); }
.sale-table td.dim { color: var(--dim); }

/* 结局 */
.ending h2 { font-size: 26px; }
.end-body { font-size: 13.5px; line-height: 2; color: #c3d2e2; margin: 10px 0 18px; }
.end-crew-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.end-crew-row.dim img { filter: grayscale(0.5) brightness(0.7); }
.end-crew { text-align: center; }
.end-crew img { width: 100%; display: block; border: 1px solid #24384d; }
.end-crew span { display: block; font-size: 12px; color: #cfe3f4; margin-top: 4px; }
.end-crew em { font-style: normal; font-size: 10px; color: #6f8ba1; }
.ending.good h2 { color: #cdeaff; }
.ending.bad h2 { color: #e0c2ff; }

/* 基地控制台：允许换行，避免挤成竖排 */
.base-bar { flex-wrap: wrap; gap: 12px 18px; }
.bb-title { flex: 1 1 240px; min-width: 210px; }
.bb-stats { flex: 0 0 auto; }
.bb-layers { flex: 0 0 auto; }
.bb-actions { flex: 0 0 auto; margin-left: auto; }
.bb-actions .btn.primary { padding: 8px 18px; }

.end-crew img { aspect-ratio: 3 / 4; object-fit: cover; object-position: top center; height: auto; }

/* 音效 / 语音开关 */
.help-btn.mute-btn { right: 42px; }
.help-btn.mute-btn.off { color: #4a5b6b; border-color: #1b2836; }
.mini-btn.off { color: #4a5b6b; border-color: #16212c; }

/* ── 触屏方向盘 ───────────────────────────────────────── */
.touch-pad { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
.touch-pad.hidden { display: none; }
.touch-pad .dpad {
  position: absolute;
  left: 16px;
  bottom: 18px;
  width: 162px;
  height: 162px;
}
.touch-pad .tb {
  pointer-events: auto;
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 1px solid rgba(120, 200, 240, 0.45);
  background: rgba(12, 22, 34, 0.62);
  color: #b9e6ff;
  font: inherit;
  font-size: 15px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-pad .tb:active { background: rgba(40, 90, 130, 0.85); }
.touch-pad .dpad .up { left: 55px; top: 0; }
.touch-pad .dpad .left { left: 0; top: 55px; }
.touch-pad .dpad .right { left: 110px; top: 55px; }
.touch-pad .dpad .down { left: 55px; top: 110px; }
.touch-pad .dpad .up::before { content: "▲"; }
.touch-pad .dpad .down::before { content: "▼"; }
.touch-pad .dpad .left::before { content: "◀"; }
.touch-pad .dpad .right::before { content: "▶"; }
.touch-pad .tacts {
  position: absolute;
  right: 16px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.touch-pad .tacts .tb {
  position: relative;
  width: 62px;
  height: 44px;
  font-size: 12px;
}
.touch-pad + .banner { top: 10px; }
#game { touch-action: none; }

body.touch .toast { bottom: 205px; }
body.touch .banner { right: 96px; }

/* ── AI 接入设置 ──────────────────────────────────────── */
.ai-form { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.ai-row { display: flex; align-items: center; gap: 12px; }
.ai-row span { width: 110px; font-size: 12.5px; color: #8fb4cc; flex: 0 0 auto; }
.ai-row input[type="text"], .ai-row input[type="password"] {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font: inherit;
  font-size: 12.5px;
  color: #d6e6f4;
  background: #0b1420;
  border: 1px solid #1b2c3f;
  outline: none;
}
.ai-row input:focus { border-color: #2f5470; }
.ai-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #3f7396; }
.ai-row input[type="range"] { flex: 1; accent-color: #3f7396; }
.ai-row b { width: 44px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--gold); }
.ai-prompt { margin: 10px 0; font-size: 12px; color: #8fb4cc; }
.ai-prompt summary { cursor: pointer; color: #a8dcf5; }
.ai-prompt pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: #b9cfe0;
  background: #080e16;
  border: 1px solid #16212f;
  white-space: pre-wrap;
}
.msg.her-pending { color: #6f8ba1; }
