/* 霓虹防线：整体视觉采用深色 + 霓虹点缀 */

/* 开源商用字体 JetBrains Mono（SIL OFL 1.1，许可见 fonts/OFL.txt） */
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #070b13;
  --panel: rgba(15, 23, 38, 0.78);
  --line: rgba(120, 170, 255, 0.14);
  --text: #e6eefc;
  --muted: #8fa4c4;
  --gold: #ffd166;
  --mint: #7ef0c0;
  --arrow: #7ef0c0;
  --frost: #6fd8ff;
  --cannon: #ffb35c;
}

* {
  box-sizing: border-box;
}

/* 声音开关：顶栏右侧的小图标按钮 */
.sound-btn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(20, 30, 48, 0.7);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  padding: 8px 10px;
  border-radius: 10px;
  transition: border-color 0.12s ease;
}

.sound-btn:hover {
  border-color: rgba(126, 240, 192, 0.5);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 620px at 12% -12%, rgba(80, 140, 255, 0.18), transparent 62%),
    radial-gradient(900px 520px at 112% 6%, rgba(126, 240, 192, 0.1), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 24px 30px;
}

/* 广告位与返回门户的页脚 */
.app > .ad-slot {
  margin: 16px 0 20px;
}

.arcade-foot {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 26px;
  font-size: 11px;
}

.arcade-foot a {
  color: #7dd3fc;
  text-decoration: none;
}

.arcade-foot a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------ 顶部信息栏 */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(126, 240, 192, 0.9), rgba(111, 216, 255, 0.9));
  box-shadow: 0 0 22px rgba(111, 216, 255, 0.45);
  position: relative;
}

.logo::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 4px;
  background: #0a1320;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 3px;
  font-weight: 700;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 11px;
  letter-spacing: 1.4px;
  color: var(--muted);
  text-transform: uppercase;
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat {
  min-width: 92px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(16, 24, 39, 0.72);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-key {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-value.gold {
  color: var(--gold);
}

/* ------------------------------------------------------------ 主体布局 */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 282px;
  gap: 18px;
  align-items: start;
}

.stage {
  position: relative;
  padding: 10px;
  border-radius: 18px;
  background: rgba(14, 21, 35, 0.7);
  border: 1px solid var(--line);
  box-shadow:
    0 24px 60px -28px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  touch-action: none;
  cursor: crosshair;
}

/* 加载提示：加载完成后由 JS 移除 */
.stage-loading {
  position: absolute;
  inset: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(7, 11, 19, 0.86);
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 1px;
  animation: pulse 1.6s ease-in-out infinite;
}

.stage-loading.hidden {
  display: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

/* ------------------------------------------------------------ 右侧面板 */

.panel {
  padding: 18px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}

.panel h2.sub {
  margin-top: 18px;
}

/* 模式切换：分段控件 */
.modes {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: rgba(10, 16, 27, 0.62);
  border: 1px solid var(--line);
}

.mode {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease;
}

.mode:hover {
  color: var(--text);
}

.mode.selected {
  background: rgba(126, 240, 192, 0.12);
  border-color: rgba(126, 240, 192, 0.4);
  color: #b9ffe4;
  font-weight: 600;
}

/* 突袭模式下的军团说明 */
.raid-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: rgba(10, 16, 27, 0.62);
  border: 1px dashed rgba(255, 143, 163, 0.35);
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.raid-note b {
  color: #ff8fa3;
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

.shop {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border-radius: 13px;
  background: rgba(20, 30, 48, 0.66);
  border: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease;
  font-family: inherit;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(160, 200, 255, 0.34);
}

.card.selected {
  border-color: var(--tc);
  box-shadow: 0 0 0 1px var(--tc) inset, 0 8px 24px -14px var(--tc);
  background: rgba(24, 38, 60, 0.85);
}

/* 金币不足时卡片变暗，但仍可点击查看提示 */
.card.is-locked {
  opacity: 0.5;
}

.card[data-kind="0"] {
  --tc: var(--arrow);
}
.card[data-kind="1"] {
  --tc: var(--frost);
}
.card[data-kind="2"] {
  --tc: var(--cannon);
}

.icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(10, 16, 27, 0.9);
  border: 1px solid var(--tc);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px -6px var(--tc);
}

/* 用小方块 + 炮管拼出迷你塔图标 */
.icon i {
  display: block;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: var(--tc);
  position: relative;
}

.icon i::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 4px;
  width: 8px;
  height: 4px;
  border-radius: 2px;
  background: var(--tc);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.card-top b {
  font-size: 14px;
  font-weight: 600;
}

.card-top em {
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.card-top em::after {
  content: " pts";
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 209, 102, 0.65);
}

.card-desc {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls {
  display: flex;
  gap: 10px;
  margin: 16px 0 14px;
}

.btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(20, 30, 48, 0.7);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease;
}

.btn:hover {
  background: rgba(30, 44, 68, 0.9);
  border-color: rgba(160, 200, 255, 0.3);
}

.btn.primary {
  background: linear-gradient(135deg, rgba(126, 240, 192, 0.16), rgba(111, 216, 255, 0.16));
  border-color: rgba(126, 240, 192, 0.4);
  color: #b9ffe4;
  font-weight: 600;
}

.btn.primary:hover {
  background: linear-gradient(135deg, rgba(126, 240, 192, 0.26), rgba(111, 216, 255, 0.26));
}

/* 拆除模式激活态：红色警示，提示当前点击为拆除 */
.btn.active {
  background: linear-gradient(135deg, rgba(255, 99, 99, 0.2), rgba(255, 140, 80, 0.2));
  border-color: rgba(255, 99, 99, 0.55);
  color: #ffc9c9;
  font-weight: 600;
}

.btn.wide {
  width: 100%;
  flex: none;
  margin-top: 4px;
}

/* ------------------------------------------------------------ 预算条 */

.budget {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 16, 27, 0.62);
  border: 1px solid var(--line);
}

.budget-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}

.budget-row b {
  font-size: 14px;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}

.budget-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(120, 170, 255, 0.14);
  overflow: hidden;
}

.budget-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--mint), var(--frost));
  transition: width 0.18s ease;
}

/* ------------------------------------------------------------ 对手列表 */

.ghosts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.ghost {
  width: 100%;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(20, 30, 48, 0.6);
  border: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition:
    border-color 0.16s ease,
    background 0.16s ease;
}

.ghost:hover {
  border-color: rgba(160, 200, 255, 0.34);
}

.ghost.selected {
  border-color: var(--mint);
  background: rgba(24, 46, 44, 0.7);
  box-shadow: 0 0 0 1px rgba(126, 240, 192, 0.25) inset;
}

.ghost-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ghost-top b {
  font-size: 13px;
  font-weight: 600;
}

.ghost-top em {
  font-style: normal;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  color: #0a1320;
  background: var(--mint);
  font-weight: 700;
}

.ghost-top i {
  margin-left: auto;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.ghost-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

/* ------------------------------------------------------------ 战术卡 */

.tactics {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.tactic {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(20, 30, 48, 0.66);
  border: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition:
    border-color 0.16s ease,
    opacity 0.16s ease,
    transform 0.16s ease;
}

.tactic:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--tc);
}

.tactic:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tactic[data-tactic="0"] {
  --tc: var(--cannon);
}
.tactic[data-tactic="1"] {
  --tc: var(--frost);
}
.tactic[data-tactic="2"] {
  --tc: var(--gold);
}

.tactic-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tactic-top b {
  font-size: 13px;
  font-weight: 600;
  color: var(--tc);
}

.tactic-top em {
  margin-left: auto;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.tactic-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.tactic-state {
  font-size: 10px;
  letter-spacing: 0.5px;
  color: rgba(143, 164, 196, 0.8);
}

/* ------------------------------------------------------------ 战报面板 */

.result-box {
  padding: 14px;
  border-radius: 12px;
  background: rgba(10, 16, 27, 0.62);
  border: 1px solid var(--line);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.result-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--mint);
}

.result-title.bad {
  color: #ff6b81;
}

.result-line {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.result-delta {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.tips {
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.tips b {
  color: #cdddf5;
  font-weight: 600;
}

/* ------------------------------------------------------------ 响应式 */

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .shop {
    flex-direction: row;
  }

  .card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card-desc {
    white-space: normal;
  }

  .tips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 16px 14px 22px;
  }

  .stats {
    width: 100%;
  }

  .stat {
    flex: 1;
    min-width: 0;
  }

  .shop {
    flex-direction: column;
  }

  .card {
    flex-direction: row;
    align-items: center;
  }

  .tips {
    grid-template-columns: 1fr;
  }
}
