/* ===== 守住城堡 · 塔防 ===== */
:root {
  --theme: #FF8A3D;
  --theme-dark: #E8722A;
  --theme-soft: #FFF1E4;
  --ink: #2A2018;
  --ink-2: #6F6355;
  --ink-3: #A79B8B;
  --paper: #FFFDF8;
  --line: #EBDFCC;
  --bg: #F6EEE1;
  --gold: #F5A623;
  --red: #E5484D;
  --green: #4CAF50;
  --blue: #4FC3F7;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-user-select: none; user-select: none;
}

#app { position: fixed; inset: 0; }

.screen { display: none; height: 100%; }
.screen.active { display: flex; }

button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input { font-family: inherit; }

.hidden { display: none !important; }

/* ---------- 开始页 ---------- */
#screen-start { flex-direction: column; position: relative; overflow-y: auto; overflow-x: hidden; background: #8FC6E8; }
#startCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.start-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 30, 40, 0.42) 0%, rgba(20, 30, 40, 0.06) 34%, rgba(20, 30, 40, 0.10) 58%, rgba(20, 30, 40, 0.72) 100%);
}
.start-top {
  position: relative; z-index: 1; padding: calc(22px + env(safe-area-inset-top)) 20px 0;
  display: flex; flex-direction: column; align-items: center; text-align: center; color: #fff;
}
.brand-badge {
  width: 62px; height: 62px; border-radius: 18px;
  background: linear-gradient(160deg, #FFA25C, var(--theme-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff;
  box-shadow: 0 10px 22px rgba(232, 114, 42, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.55);
}
.brand-badge .mp-icon { width: 34px; height: 34px; }
.brand-title {
  margin: 10px 0 0; font-size: 36px; font-weight: 900; letter-spacing: 0.06em;
  color: #fff; text-shadow: 0 3px 0 rgba(180, 70, 10, 0.55), 0 8px 18px rgba(0, 0, 0, 0.35);
}
.brand-sub { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.92); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); letter-spacing: 0.04em; }

.start-bottom {
  position: relative; z-index: 1; margin-top: auto;
  padding: 0 20px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
}
.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 6px 18px rgba(40, 25, 10, 0.12);
}
.player-panel { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.player-avatar {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: var(--theme-soft); color: var(--theme-dark);
  display: flex; align-items: center; justify-content: center;
}
.player-body { flex: 1; min-width: 0; }
.panel-label { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; font-weight: 600; }
.player-input {
  width: 100%; border: none; outline: none; background: transparent;
  font-size: 16px; font-weight: 700; color: var(--ink); padding: 0;
}
.player-input::placeholder { color: var(--ink-3); font-weight: 500; }

.record-row { display: flex; gap: 10px; }
.record-chip {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: rgba(255, 253, 248, 0.92); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 9px 12px; box-shadow: 0 4px 12px rgba(40, 25, 10, 0.10);
}
.record-chip .mp-icon { width: 18px; height: 18px; color: var(--theme); flex: none; }
.record-chip span { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.record-chip b { margin-left: auto; font-size: 15px; font-weight: 800; color: var(--ink); }

/* ---------- 地图选择 ---------- */
.map-strip {
  background: rgba(255, 253, 248, 0.94); border: 1px solid var(--line);
  border-radius: 18px; padding: 10px 10px 8px;
  box-shadow: 0 6px 18px rgba(40, 25, 10, 0.13);
}
.map-strip-head { display: flex; align-items: center; justify-content: space-between; padding: 0 3px 7px; }
.map-strip-title { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--ink-2); }
.map-strip-title .mp-icon { width: 15px; height: 15px; color: var(--theme); }
.map-strip-best { font-size: 11px; font-weight: 800; color: var(--theme-dark); }
.map-list {
  display: flex; gap: 7px; overflow-x: auto; overflow-y: hidden;
  padding: 2px 2px 3px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.map-list::-webkit-scrollbar { display: none; }
.map-card {
  flex: 0 0 98px; padding: 0; border-radius: 13px; overflow: hidden;
  background: var(--paper); border: 2px solid transparent; text-align: left;
  box-shadow: 0 3px 8px rgba(40, 25, 10, 0.12);
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.map-card:active { transform: scale(0.96); }
.map-card.active { border-color: var(--theme); box-shadow: 0 6px 16px rgba(255, 138, 61, 0.32); }
.map-thumb-wrap { position: relative; display: block; width: 100%; background: #E7DAC6; }
.map-thumb { display: block; width: 100%; height: auto; }
.map-check {
  position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--theme); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(180, 80, 20, 0.4);
}
.map-check .mp-icon { width: 12px; height: 12px; }
.map-best {
  position: absolute; left: 4px; bottom: 4px;
  font-size: 9px; font-weight: 700; color: #fff;
  background: rgba(42, 32, 24, 0.74); border-radius: 999px; padding: 1px 7px;
  max-width: calc(100% - 8px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-card-body { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; }
.map-card-body b { font-size: 12px; font-weight: 800; color: var(--ink); }
.map-diff { display: flex; gap: 2px; }
.diff-pip { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.diff-pip.on { background: var(--theme); }
.map-rule {
  padding: 4px 4px 0; font-size: 10px; font-weight: 600; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 防御塔图鉴 / 成就 ---------- */
.arsenal-list,
.ach-list {
  display: flex; gap: 7px; overflow-x: auto; overflow-y: hidden;
  padding: 2px 2px 3px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.arsenal-list::-webkit-scrollbar,
.ach-list::-webkit-scrollbar { display: none; }
.arsenal-card {
  flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 4px 2px; transition: transform 0.08s ease;
}
.arsenal-card:active { transform: scale(0.95); }
.arsenal-card canvas { width: 36px; height: 36px; display: block; }
.arsenal-name { font-size: 10.5px; font-weight: 800; color: var(--ink); }
.arsenal-cond {
  font-size: 8.5px; font-weight: 700; color: var(--ink-3);
  max-width: 100%; padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.arsenal-card.locked { background: #F4EEE4; }
.arsenal-card.locked canvas { filter: grayscale(1); opacity: 0.35; }
.arsenal-card.locked .arsenal-name { color: var(--ink-3); }

.ach-chip {
  flex: 0 0 144px; display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px 8px;
}
.ach-chip .mp-icon { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.ach-chip.done { background: var(--theme-soft); border-color: #FFD9BB; }
.ach-chip.done .mp-icon { color: var(--theme-dark); }
.ach-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ach-body b { font-size: 10.5px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-body span { font-size: 8.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ach-chip em {
  font-style: normal; font-size: 8.5px; font-weight: 800; color: var(--ink-3);
  flex: none; max-width: 44px; text-align: right; line-height: 1.15;
}
.ach-chip.done em { color: var(--theme-dark); }

.btn-primary {
  background: linear-gradient(180deg, #FF9E55, var(--theme)); color: #fff;
  border-radius: var(--r-md); padding: 13px 22px; font-size: 16px; font-weight: 800;
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 18px rgba(255, 138, 61, 0.38), inset 0 2px 0 rgba(255, 255, 255, 0.30);
  transition: transform 0.08s ease, filter 0.15s ease; letter-spacing: 0.05em;
}
.btn-primary .mp-icon { width: 20px; height: 20px; }
.btn-primary:active { transform: scale(0.97); filter: brightness(0.95); }
.btn-large { padding: 14px 22px; font-size: 17px; border-radius: 17px; }

.btn-secondary {
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 22px; font-size: 15px; font-weight: 700; width: 100%;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn-secondary:active { transform: scale(0.97); background: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink-2); padding: 10px; font-size: 14px; font-weight: 700; width: 100%; }
.btn-ghost:active { color: var(--ink); }

.tips { display: flex; gap: 8px; }
.tip {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: rgba(255, 253, 248, 0.86); border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--r-sm); padding: 8px 4px;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
}
.tip .mp-icon { width: 18px; height: 18px; color: var(--theme); }

/* ---------- 游戏页 ---------- */
#screen-game { flex-direction: column; background: #CFE6B4; }
.hud {
  flex: none; display: flex; align-items: center; gap: 7px;
  padding: calc(9px + env(safe-area-inset-top)) 12px 9px;
  background: linear-gradient(180deg, #FFFDF8, #FBF2E4);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(60, 40, 15, 0.06);
}
.hud-chip {
  display: flex; align-items: center; gap: 5px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px 5px 8px; box-shadow: 0 2px 5px rgba(60, 40, 15, 0.06);
}
.hud-chip .mp-icon { width: 16px; height: 16px; flex: none; }
.hud-chip b { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-gold .mp-icon { color: var(--gold); }
.hud-lives .mp-icon { color: var(--red); }
.hud-wave .mp-icon { color: var(--theme); }
.hud-chip.bump { animation: bump 0.28s ease; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.16); } 100% { transform: scale(1); } }

.hud-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--paper); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); box-shadow: 0 2px 5px rgba(60, 40, 15, 0.06);
  transition: transform 0.08s ease, background 0.15s ease;
}
.icon-btn .mp-icon { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(0.94); background: var(--bg); }
.icon-btn-text { font-size: 12px; font-weight: 800; color: var(--ink); }
.icon-btn.on { background: var(--theme-soft); border-color: #FFD3AE; color: var(--theme-dark); }

/* 速度选择 */
.speed-wrap { position: relative; display: flex; }
.icon-btn-speed {
  width: auto; min-width: 47px; padding: 0 7px; gap: 3px;
  font-size: 12px; font-weight: 800; color: var(--ink);
}
.icon-btn-speed .mp-icon { width: 15px; height: 15px; color: var(--theme-dark); }
.speed-menu {
  position: absolute; top: calc(100% + 8px); right: -4px; z-index: 50; width: 204px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; box-shadow: 0 14px 32px rgba(40, 25, 10, 0.26);
  animation: panelIn 0.14s ease;
}
.speed-title { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 0 2px 8px; }
.speed-opts { display: flex; gap: 6px; }
.speed-opt {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 7px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 14px; font-weight: 800; color: var(--ink);
  transition: transform 0.08s ease, background 0.15s ease;
}
.speed-opt small { font-size: 9px; font-weight: 600; color: var(--ink-3); }
.speed-opt:active { transform: scale(0.94); }
.speed-opt.active { background: var(--theme); border-color: var(--theme); color: #fff; box-shadow: 0 4px 10px rgba(255, 138, 61, 0.35); }
.speed-opt.active small { color: rgba(255, 255, 255, 0.88); }

@media (max-width: 366px) {
  .hud { gap: 5px; padding-left: 9px; padding-right: 9px; }
  .hud-chip { padding: 5px 8px 5px 7px; gap: 4px; }
  .hud-chip .mp-icon { width: 14px; height: 14px; }
  .hud-chip b { font-size: 12px; }
  .hud-actions { gap: 4px; }
  .icon-btn { width: 31px; height: 31px; }
  .icon-btn-speed { width: auto; min-width: 44px; }
}

.stage { flex: 1; position: relative; min-height: 0; overflow: hidden; background: #CFE6B4; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* 波次横幅 */
.wave-banner {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%);
  padding: 10px 26px; border-radius: 999px; white-space: nowrap;
  background: rgba(42, 32, 24, 0.82); color: #fff;
  font-size: 20px; font-weight: 900; letter-spacing: 0.08em;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
  animation: bannerIn 1.5s ease forwards; pointer-events: none; z-index: 6;
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  26% { transform: translate(-50%, -50%) scale(1); }
  76% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* 备战条 */
.prep-bar {
  position: absolute; left: 10px; right: 10px; top: 10px; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 253, 248, 0.94); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 8px 10px;
  box-shadow: 0 6px 16px rgba(40, 25, 10, 0.16); backdrop-filter: blur(6px);
}
.prep-info { flex: 1; min-width: 0; }
.prep-title { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.prep-title b { color: var(--theme-dark); font-size: 14px; }
.prep-enemies { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.ene-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--c, var(--ink-2)); border-radius: 999px; padding: 2px 8px;
}
.call-btn {
  flex: none; align-self: stretch; min-width: 86px;
  background: linear-gradient(180deg, #FF9E55, var(--theme)); color: #fff;
  border-radius: var(--r-sm); padding: 8px 10px; font-size: 11px; font-weight: 700; line-height: 1.35;
  box-shadow: 0 4px 10px rgba(255, 138, 61, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.08s ease;
}
.call-btn b { font-size: 13px; font-weight: 900; }
.call-btn:active { transform: scale(0.96); }

/* 塔面板 */
.tower-panel {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 5;
  background: rgba(255, 253, 248, 0.97); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px;
  box-shadow: 0 10px 24px rgba(40, 25, 10, 0.2); backdrop-filter: blur(6px);
  animation: panelIn 0.16s ease;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tp-head { display: flex; align-items: center; gap: 10px; }
.tp-icon { width: 44px; height: 44px; flex: none; }
.tp-meta { flex: 1; min-width: 0; }
.tp-name { font-size: 15px; font-weight: 800; }
.tp-stat { font-size: 11px; color: var(--ink-2); margin-top: 2px; font-weight: 600; }
.tp-pips { display: flex; gap: 3px; margin-top: 5px; }
.tp-pip { width: 14px; height: 4px; border-radius: 2px; background: var(--line); }
.tp-pip.on { background: var(--theme); }
.tp-pip.last.on { background: var(--gold); }
.tp-next {
  margin-top: 9px; padding: 7px 10px; border-radius: 9px;
  background: var(--bg); color: var(--ink-2);
  font-size: 11px; font-weight: 700; line-height: 1.4;
}
.tp-next.max { background: var(--theme-soft); border: 1px solid #FFD9BB; color: var(--theme-dark); }
.tp-evo { display: flex; align-items: center; gap: 5px; margin-top: 7px; min-height: 38px; }
.tp-evo-tag {
  font-size: 10px; font-weight: 800; color: var(--ink-3);
  background: var(--bg); border-radius: 6px; padding: 3px 6px; flex: none;
}
.tp-evo canvas { width: 34px; height: 38px; flex: none; }
.tp-evo-arrow { width: 13px; height: 13px; color: var(--ink-3); flex: none; }
.tp-evo-tier { margin-left: auto; font-size: 10px; font-weight: 800; color: var(--theme-dark); text-align: right; }
.tp-evo.max .tp-evo-arrow,
.tp-evo.max #tpEvoNext { display: none; }
.tp-evo.max .tp-evo-tier { color: var(--gold); }
.tp-close {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: var(--bg); color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.tp-close .mp-icon { width: 16px; height: 16px; }
.tp-close:active { background: var(--line); }
.tp-actions { display: flex; gap: 8px; margin-top: 9px; }
.tp-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-sm); padding: 10px 8px; font-size: 14px; font-weight: 800;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.tp-btn .mp-icon { width: 17px; height: 17px; }
.tp-btn b { font-variant-numeric: tabular-nums; }
.tp-btn:active { transform: scale(0.97); }
.tp-up { background: linear-gradient(180deg, #FF9E55, var(--theme)); color: #fff; box-shadow: 0 4px 10px rgba(255, 138, 61, 0.3); }
.tp-sell { background: var(--theme-soft); color: var(--theme-dark); border: 1px solid #FFD9BB; }
.tp-btn.max { background: var(--bg); color: var(--ink-3); box-shadow: none; }
.tp-btn.poor { filter: grayscale(0.7); opacity: 0.75; }

/* 暂停 */
.pause-overlay {
  position: absolute; inset: 0; z-index: 8;
  background: rgba(30, 24, 18, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.pause-card {
  width: 100%; max-width: 300px; background: var(--paper);
  border-radius: var(--r-lg); padding: 22px 18px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3); text-align: center;
  animation: panelIn 0.18s ease;
}
.pause-title { font-size: 22px; font-weight: 900; margin-bottom: 4px; }
.pause-map { font-size: 12px; font-weight: 700; color: var(--ink-2); margin: -2px 0 6px; }

/* 激励视频入口 */
.btn-ad {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 12px; border-radius: var(--r-md);
  background: linear-gradient(180deg, #FFF7EA, #FFE6C4);
  border: 1.5px solid #FFC98F; color: #B35410;
  font-size: 15px; font-weight: 800; letter-spacing: 0.01em;
  box-shadow: 0 4px 12px rgba(255, 138, 61, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn-ad .mp-icon { width: 19px; height: 19px; color: var(--theme-dark); flex: none; }
.btn-ad b { font-size: 17px; font-weight: 900; color: var(--theme-dark); font-variant-numeric: tabular-nums; }
.btn-ad .ad-tag {
  flex: none; font-size: 9px; font-weight: 900; line-height: 1; letter-spacing: 0.04em;
  color: #fff; background: var(--theme); border-radius: 5px; padding: 3px 4px;
  box-shadow: 0 2px 5px rgba(255, 138, 61, 0.35);
}
.btn-ad:active { transform: scale(0.97); filter: brightness(0.97); }
.btn-ad.busy { opacity: 0.55; pointer-events: none; }
.ad-hint { margin-top: -4px; font-size: 10.5px; font-weight: 600; color: var(--ink-3); }

/* 提示 */
.toast {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%);
  background: rgba(42, 32, 24, 0.9); color: #fff;
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
  z-index: 20; pointer-events: none; opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ---------- 建造栏 ---------- */
.dock {
  flex: none; display: flex; gap: 8px;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, #FBF2E4, var(--paper));
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(60, 40, 15, 0.05);
}
.dock::-webkit-scrollbar { display: none; }
.dock-btn {
  flex: 0 0 74px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--r-md);
  padding: 5px 3px 6px; position: relative;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
  box-shadow: 0 3px 8px rgba(60, 40, 15, 0.06);
}
.dock-btn:active { transform: scale(0.96); }
.dock-ico { width: 34px; height: 34px; }
.dock-name { font-size: 12px; font-weight: 800; }
.dock-cost { font-size: 10px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 2px; }
.dock-cost .mp-icon { width: 11px; height: 11px; color: var(--gold); }
.dock-btn.active { border-color: var(--theme); background: var(--theme-soft); box-shadow: 0 4px 12px rgba(255, 138, 61, 0.28); }
.dock-btn.active::after {
  content: ""; position: absolute; top: 3px; right: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--theme); border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(255, 138, 61, 0.5);
}
.dock-btn.poor { opacity: 0.55; }
.dock-btn.poor .dock-cost { color: var(--red); }
.dock-btn.locked { background: #F4EEE4; }
.dock-btn.locked .dock-ico { filter: grayscale(1); opacity: 0.28; }
.dock-btn.locked .dock-name { color: var(--ink-3); }

/* 建造栏里的激励视频入口 */
.dock-btn.dock-ad {
  background: linear-gradient(180deg, #FFF8EA, #FFE2B8);
  border-color: #FFC98F;
  box-shadow: 0 3px 10px rgba(255, 138, 61, 0.18);
}
.dock-ad .ad-badge {
  position: absolute; top: 3px; left: 3px;
  font-size: 8px; font-weight: 900; line-height: 1; letter-spacing: 0.04em;
  color: #fff; background: var(--theme); border-radius: 4px; padding: 2px 3px;
}
.dock-ad .dock-ad-ico { width: 32px; height: 32px; color: var(--theme-dark); }
.dock-ad .dock-name { color: #B35410; }
.dock-ad .dock-cost { color: #B35410; }
.dock-ad .dock-cost .mp-icon { color: var(--gold); }
.dock-ad:active { background: #FFE2B8; }
.dock-lock {
  position: absolute; left: 0; right: 0; top: 4px; height: 38px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: var(--ink-3); pointer-events: none;
}
.dock-lock .mp-icon { width: 15px; height: 15px; }
.dock-lock em { font-style: normal; font-size: 8px; font-weight: 700; white-space: nowrap; }

/* ---------- 结算页 ---------- */
#screen-result { align-items: center; justify-content: center; padding: 20px; overflow-y: auto; background: linear-gradient(180deg, #F7E9D4, #EFDCC0); }
.result-card {
  width: 100%; max-width: 360px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 24px; padding: 26px 22px 22px;
  text-align: center; box-shadow: 0 16px 40px rgba(80, 50, 20, 0.18);
  animation: panelIn 0.24s ease;
}
.result-icon {
  width: 74px; height: 74px; border-radius: 22px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #FFD9A8, #FFB877); color: #B35410;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 8px 18px rgba(255, 138, 61, 0.3);
}
.result-icon.lose { background: linear-gradient(160deg, #D8D3CC, #B9B2A8); color: #5C554C; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4); }
.result-icon .mp-icon { width: 40px; height: 40px; }
.result-title { margin: 0; font-size: 24px; font-weight: 900; }
.result-desc { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.result-stats { margin-top: 16px; display: flex; flex-direction: column; gap: 7px; text-align: left; }
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--bg); border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.stat-row b { font-size: 15px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.new-record {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 6px;
  background: var(--theme-soft); color: var(--theme-dark);
  border: 1px solid #FFD9BB; border-radius: 999px; padding: 6px 14px;
  font-size: 12px; font-weight: 800;
}
.new-record .mp-icon { width: 15px; height: 15px; }
.result-unlock {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px;
  background: var(--theme-soft); border: 1px dashed #FFC98F;
  color: var(--theme-dark); font-size: 11.5px; font-weight: 700;
  line-height: 1.65; text-align: left;
}
.result-unlock .mp-icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 2px; }
.result-card .btn-primary { margin-top: 16px; }
.result-card .btn-secondary { margin-top: 9px; }
