/* 菜单 / 卡片 / 商店 / 结算界面 */
.game-title {
  font-size: clamp(30px, 6vh, 52px);
  letter-spacing: 0.3em;
  margin: 10px 0 2px;
  background: linear-gradient(120deg, var(--color-pulse), var(--color-arc), var(--color-thermal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(53, 200, 255, 0.4));
}
.subtitle {
  color: var(--color-text-dim);
  letter-spacing: 0.55em;
  font-size: clamp(11px, 1.8vh, 15px);
  margin-bottom: clamp(14px, 3vh, 30px);
}
.logo-hex {
  width: clamp(44px, 8vh, 70px);
  height: clamp(44px, 8vh, 70px);
  margin: 0 auto;
  background: conic-gradient(from 0deg, #35c8ff, #b46bff, #ff8c3a, #35c8ff);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  animation: hexSpin 6s linear infinite;
}
@keyframes hexSpin { to { transform: rotate(360deg); } }

.menu-buttons { display: flex; flex-direction: column; gap: clamp(8px, 1.6vh, 14px); margin-top: 8px; }

#menu-records {
  margin-top: clamp(14px, 3vh, 26px);
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--color-text-dim);
  font-size: clamp(10px, 1.5vh, 13px);
}
#menu-records b { color: var(--color-energy); margin-left: 4px; }

/* 卡片行（核心选择 / 升级三选一） */
.card-row {
  display: flex;
  gap: clamp(10px, 2vw, 20px);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.select-card {
  width: clamp(150px, 24vw, 220px);
  min-height: 170px;
  padding: clamp(12px, 2vh, 20px);
  border: 1px solid var(--color-panel-border);
  border-radius: 12px;
  background: rgba(16, 25, 44, 0.9);
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  animation: cardIn 0.35s ease-out backwards;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.select-card:nth-child(2) { animation-delay: 0.08s; }
.select-card:nth-child(3) { animation-delay: 0.16s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.select-card:hover { transform: translateY(-4px) scale(1.03); box-shadow: 0 6px 26px rgba(53, 200, 255, 0.25); }
.select-card:active { transform: scale(0.97); }

.card-icon { font-size: clamp(26px, 4.5vh, 38px); line-height: 1; }
.card-name { font-size: clamp(13px, 2vh, 17px); letter-spacing: 0.1em; }
.card-desc { font-size: clamp(10px, 1.5vh, 13px); color: var(--color-text-dim); line-height: 1.55; flex: 1; }
.card-rarity { font-size: 10px; letter-spacing: 0.3em; }

.select-card.rarity-common { border-color: rgba(53, 200, 255, 0.55); }
.select-card.rarity-common .card-rarity { color: var(--color-pulse); }
.select-card.rarity-rare { border-color: rgba(180, 107, 255, 0.65); box-shadow: 0 0 14px rgba(180, 107, 255, 0.15); }
.select-card.rarity-rare .card-rarity { color: var(--color-arc); }
.select-card.rarity-epic { border-color: rgba(255, 140, 58, 0.75); box-shadow: 0 0 18px rgba(255, 140, 58, 0.22); }
.select-card.rarity-epic .card-rarity { color: var(--color-thermal); }

.core-card .card-icon { filter: drop-shadow(0 0 10px currentColor); }
.core-card .card-mods { font-size: clamp(9px, 1.3vh, 12px); color: var(--color-energy); line-height: 1.5; }

/* 教学 */
.tutorial-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.tut-item {
  display: flex; align-items: center; gap: 14px;
  font-size: clamp(11px, 1.7vh, 15px);
  color: var(--color-text);
  line-height: 1.5;
}
.tut-key {
  flex-shrink: 0;
  min-width: 110px;
  text-align: center;
  padding: 5px 10px;
  border: 1px solid var(--color-panel-border);
  border-radius: 7px;
  background: rgba(21, 32, 54, 0.9);
  color: var(--color-pulse);
  font-size: clamp(10px, 1.4vh, 13px);
}

/* ============ 商店 ============ */
.shop-panel {
  width: min(96vw, 980px);
  max-height: 94vh;
  overflow-y: auto;
  touch-action: pan-y;
}
.shop-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.shop-energy {
  font-size: clamp(16px, 2.6vh, 24px);
  color: var(--color-energy);
  text-shadow: 0 0 10px rgba(255, 210, 58, 0.5);
}
.shop-body { display: flex; gap: clamp(12px, 2.5vw, 28px); flex-wrap: wrap; }
.shop-left { flex: 1 1 380px; min-width: 280px; }
.shop-right { flex: 0 1 300px; min-width: 240px; }
.shop-right h3 { font-size: clamp(12px, 1.8vh, 15px); color: var(--color-text-dim); letter-spacing: 0.15em; margin: 12px 0 8px; }

.shop-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.shop-item {
  border: 1px solid var(--color-panel-border);
  border-radius: 10px;
  background: rgba(16, 25, 44, 0.9);
  padding: 10px 12px;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.12s;
  animation: cardIn 0.3s ease-out backwards;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 128px;
}
.shop-item:hover:not(.sold) { transform: translateY(-2px); box-shadow: 0 4px 18px rgba(53, 200, 255, 0.25); }
.shop-item .si-head-right { display: flex; align-items: center; gap: 6px; }
.shop-item .si-lock { cursor: pointer; font-size: 13px; opacity: 0.35; line-height: 1; transition: opacity 0.12s, transform 0.12s; }
.shop-item .si-lock:hover { opacity: 0.85; transform: scale(1.15); }
.shop-item .si-lock.on { opacity: 1; filter: drop-shadow(0 0 4px rgba(255, 210, 58, 0.8)); }
.shop-item.sold { opacity: 0.3; pointer-events: none; }
.shop-item .si-head { display: flex; justify-content: space-between; align-items: center; }
.shop-item .si-icon { font-size: 22px; }
.shop-item .si-level { font-size: 11px; color: var(--color-energy); letter-spacing: 0.1em; }
.shop-item .si-name { font-size: clamp(12px, 1.7vh, 15px); }
.shop-item .si-circuit { font-size: 10px; letter-spacing: 0.2em; }
.shop-item .si-desc { font-size: 10.5px; color: var(--color-text-dim); line-height: 1.45; flex: 1; }
.shop-item .si-stats { font-size: 10px; color: var(--color-xp); }
.shop-item .si-up { font-size: 10px; color: var(--color-arc); }
.shop-item .si-price { font-size: 13px; color: var(--color-energy); margin-top: 2px; }
.shop-item.cant-afford .si-price { color: var(--color-danger); }

.circuit-pulse { color: var(--color-pulse); }
.circuit-arc { color: var(--color-arc); }
.circuit-thermal { color: var(--color-thermal); }

.shop-actions { display: flex; gap: 10px; margin-top: 12px; }

#shop-slots-svg { display: block; margin: 0 auto; }
#shop-slots-svg .slot-node { cursor: pointer; }
#shop-slots-svg .slot-node.selected { filter: drop-shadow(0 0 8px #fff); }

#circuit-preview { font-size: clamp(10px, 1.5vh, 13px); line-height: 1.7; min-height: 44px; margin: 6px 0; }
#circuit-preview .ci-ok { color: var(--color-xp); }
#circuit-preview .ci-none { color: var(--color-text-dim); }

#shop-stats { font-size: clamp(10px, 1.5vh, 12.5px); line-height: 1.8; color: var(--color-text); columns: 2; }
#shop-stats .st b { color: var(--color-pulse); float: right; margin-left: 8px; }

#btn-next-wave { display: block; margin: 16px auto 0; }

/* 结算 */
#end-title { font-size: clamp(26px, 5vh, 44px); }
#end-title.victory { color: var(--color-xp); text-shadow: 0 0 24px rgba(58, 255, 216, 0.7); }
#end-title.defeat { color: var(--color-danger); text-shadow: 0 0 24px rgba(255, 56, 96, 0.7); }
#end-subtitle { color: var(--color-text-dim); margin-bottom: 18px; font-size: clamp(11px, 1.8vh, 15px); }
#end-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
#end-stats .es {
  padding: 10px;
  border: 1px solid rgba(125, 146, 173, 0.25);
  border-radius: 9px;
  background: rgba(16, 25, 44, 0.8);
}
#end-stats .es .v { font-size: clamp(16px, 3vh, 26px); color: var(--color-pulse); }
#end-stats .es .k { font-size: 10px; color: var(--color-text-dim); letter-spacing: 0.15em; margin-top: 3px; }
#end-records { min-height: 22px; margin-bottom: 12px; font-size: clamp(11px, 1.7vh, 14px); color: var(--color-energy); }
#end-records .new-record { animation: recordFlash 0.8s ease-in-out infinite alternate; }
@keyframes recordFlash { from { opacity: 0.65; } to { opacity: 1; text-shadow: 0 0 14px rgba(255, 210, 58, 0.9); } }

/* 结算明细（构筑/武器/道具） */
#end-detail { max-height: 38vh; overflow-y: auto; margin-bottom: 12px; text-align: left; }
.end-sec { margin-bottom: 12px; }
.end-sec-title {
  font-size: 10px; letter-spacing: 0.2em; color: var(--color-text-dim);
  border-bottom: 1px solid rgba(125, 146, 173, 0.2); padding-bottom: 4px; margin-bottom: 6px;
}
.end-build { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: clamp(11px, 1.7vh, 14px); }
.end-build .dim, #end-detail .dim { color: var(--color-text-dim); }
.end-wrow { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: clamp(11px, 1.7vh, 13px); }
.end-wicon { width: 20px; text-align: center; }
.end-wname { min-width: 108px; }
.end-wbar { flex: 1; height: 6px; border-radius: 3px; background: rgba(125, 146, 173, 0.18); overflow: hidden; }
.end-wbar i { display: block; height: 100%; border-radius: 3px; }
.end-wdmg { min-width: 92px; text-align: right; color: var(--color-text-dim); font-variant-numeric: tabular-nums; }
.end-items { display: flex; flex-wrap: wrap; gap: 6px; font-size: clamp(14px, 2.2vh, 19px); }
.end-item b { font-size: 10px; color: var(--color-text-dim); vertical-align: super; }

/* 设置 */
.settings-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 22px; min-width: min(70vw, 300px); }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; font-size: clamp(13px, 2vh, 16px); }
.setting-row input[type="range"] { width: 140px; accent-color: var(--color-pulse); }
.setting-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--color-pulse); }

/* 危级选择卡片 */
.danger-row { flex-wrap: wrap; justify-content: center; }
.danger-card.locked { opacity: 0.45; cursor: not-allowed; }
.danger-card.locked:hover { transform: none; box-shadow: none; }

/* 下一波预告 */
#next-wave-info {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  margin: 10px 0 2px; font-size: 13px; color: var(--color-text-dim, #8fa3c8);
}
#next-wave-info .nw-boss { color: #ff2255; font-weight: 700; text-shadow: 0 0 10px rgba(255,34,85,0.6); }
#next-wave-info .nw-elite { color: #ff3860; }
#next-wave-info .nw-horde { color: #ff8c3a; }

/* ---- 阶段 3：属性面板 / 升级四选一 ---- */
.stats-panel { max-height: 46vh; overflow-y: auto; margin: 8px 0; text-align: left; }
.sp-cat { margin: 8px 0 3px; font-size: 11px; letter-spacing: 2px; color: var(--color-text-dim, #8fa3c8); }
.sp-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  background: none; border: none; border-bottom: 1px dashed rgba(80, 110, 150, 0.25);
  color: var(--color-text, #d7e6ff); font-size: 12px; padding: 3px 2px; cursor: pointer;
}
.sp-row:hover { background: rgba(53, 200, 255, 0.06); }
.sp-val { font-weight: 700; color: var(--color-pulse, #35c8ff); }
.sp-val.neg, .neg { color: #ff5566 !important; }
.sp-cap { font-style: normal; font-size: 9px; color: #ffd23a; margin-left: 4px; }
.sp-detail { font-size: 11px; color: #9fb4d8; padding: 4px 8px; line-height: 1.7;
  background: rgba(10, 16, 30, 0.6); border-left: 2px solid rgba(53, 200, 255, 0.4); }
.upgrade-actions { margin-top: 12px; text-align: center; }
.card-desc .delta { display: block; font-size: 10px; color: #7d92ad; }
.card-desc.neg b { color: #ff5566; }
.si-delta { font-size: 10px; color: #7bff9e; margin-top: 2px; }
.pause-panel { max-width: min(92vw, 460px); }
#debug-panel { cursor: pointer; user-select: none; }

/* ---- 阶段 4：武器职业 / 品质 / 详情 ---- */
.class-chip {
  display: inline-block; font-size: 9px; padding: 1px 6px; margin: 0 3px 1px 0;
  border: 1px solid rgba(143, 163, 200, 0.55); border-radius: 8px;
  color: #aebfdc; letter-spacing: 1px;
}
.shop-item .si-classes { margin: 2px 0; }
.si-scaling { font-size: 10px; color: #8fa3c8; margin-top: 2px; }
.si-class-preview { font-size: 10px; color: #7bff9e; margin-top: 3px; line-height: 1.6; }
.si-class-preview.no { color: #ff5566; }
#class-panel { font-size: 11px; line-height: 1.8; margin: 4px 0 8px; text-align: left; }
.cp-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
  border-bottom: 1px dashed rgba(80, 110, 150, 0.25); padding: 3px 2px; }
.cp-name { color: var(--color-text, #d7e6ff); min-width: 64px; }
.cp-name b { color: #ffd23a; }
.cp-active { color: #7bff9e; font-size: 10px; }
.cp-next { color: #8fa3c8; font-size: 10px; }
.cp-max { color: #ffd23a; font-size: 10px; }
.cp-none { color: var(--color-text-dim, #8fa3c8); font-size: 10px; }
#slot-detail { min-height: 0; margin: 6px 0; text-align: left; font-size: 12px; }
#slot-detail .sd-head { font-size: 13px; margin-bottom: 2px; }
#slot-detail .sd-line { line-height: 1.7; }
#slot-detail .sd-line.dim { color: #8fa3c8; font-size: 11px; }

/* ---- 阶段 5：道具商品 / 持有栏 / 商店 debug ---- */
.si-effect { font-size: 11px; color: #7bff9e; margin-top: 2px; }
.si-effect.neg { color: #ff5566; }
.si-before-after { color: #8fa3c8; font-size: 10px; margin-left: 6px; }
.si-held { font-size: 9px; color: #ffd23a; margin-left: 6px; }
#item-inventory { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.inv-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10px;
  border: 1px solid; border-radius: 8px; padding: 2px 7px; color: #d7e6ff;
  background: rgba(10, 16, 30, 0.6);
}
#shop-debug { margin-top: 10px; font-size: 10px; line-height: 1.6; color: #9fb4d8;
  border-top: 1px dashed rgba(80, 110, 150, 0.35); padding-top: 6px; text-align: left; }
#shop-debug .sdg-head { color: #ffd23a; margin-top: 6px; }
#shop-debug .sdg.dim { color: #6d7f9d; }

/* ---- 阶段 6：开箱界面 ---- */
.crate-panel { min-width: 340px; }
#crate-remaining { margin: 4px 0 12px; }
.crate-card { display: flex; justify-content: center; margin-bottom: 16px; }
.crate-item {
  width: 240px; padding: 18px 16px; border: 2px solid #35c8ff; border-radius: 12px;
  background: rgba(10, 16, 30, 0.85); text-align: center;
  box-shadow: 0 0 18px rgba(53, 200, 255, 0.12) inset;
}
.crate-item.empty { border-color: #4a5a78; box-shadow: none; }
.crate-icon { font-size: 34px; line-height: 1.2; }
.crate-name { font-size: 17px; font-weight: 700; margin-top: 6px; }
.crate-quality { font-size: 11px; letter-spacing: 2px; margin-top: 2px; opacity: 0.9; }
.crate-desc { font-size: 11px; color: #8fa3c8; margin: 8px 0 10px; line-height: 1.6; }
.crate-effect { font-size: 12px; color: #7bff9e; line-height: 1.8; }
.crate-effect.neg { color: #ff5566; }
.crate-tag {
  display: inline-block; margin-top: 8px; font-size: 10px; color: #ffd23a;
  border: 1px solid rgba(255, 210, 58, 0.5); border-radius: 8px; padding: 1px 8px;
}
.crate-actions { flex-direction: row; justify-content: center; gap: 12px; }

/* ---- 阶段 7：角色通关记录 / 锁定内容 / 成就 / 图鉴 / 解锁弹窗 ---- */
.select-card.locked { opacity: 0.55; filter: grayscale(0.7); cursor: not-allowed; }
.select-card.locked:hover { transform: none; box-shadow: none; }
.card-record { font-size: 10.5px; color: #b8c9e8; margin-top: 6px; line-height: 1.7; }
.card-record.dim { color: #6d7f9d; }
.card-record.rule { color: #ffd23a; }
.card-record.lock-hint { color: #ffb36b; }
.rec-dot {
  display: inline-block; min-width: 15px; text-align: center; margin-right: 2px;
  border: 1px solid rgba(110, 140, 190, 0.4); border-radius: 6px; padding: 0 3px;
  font-size: 10px; color: #5d6f8d;
}
.rec-dot.done { color: #7bff9e; border-color: rgba(123, 255, 158, 0.6); background: rgba(123, 255, 158, 0.08); }

.achv-list {
  display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px;
  max-height: 62vh; overflow-y: auto; padding-right: 4px;
}
.achv-row {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  border: 1px solid rgba(80, 110, 150, 0.4); border-radius: 10px;
  background: rgba(10, 16, 30, 0.6); padding: 10px 14px;
}
.achv-row.done { border-color: rgba(255, 210, 58, 0.55); background: rgba(30, 26, 10, 0.5); }
.achv-row.locked { opacity: 0.6; }
.achv-icon { font-size: 22px; line-height: 1.3; min-width: 28px; text-align: center; }
.achv-body { flex: 1; }
.achv-name { font-size: 14px; font-weight: 700; color: #dfe9f5; }
.achv-sub { font-size: 10.5px; color: #8fa3c8; font-weight: 400; margin-left: 6px; }
.achv-check { color: #ffd23a; }
.achv-desc { font-size: 11.5px; color: #8fa3c8; margin-top: 3px; line-height: 1.6; }
.achv-reward { font-size: 11px; color: #7bff9e; margin-top: 4px; line-height: 1.6; }
.achv-progress { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.achv-progress .bar {
  flex: 1; max-width: 220px; height: 7px; border-radius: 4px;
  background: rgba(60, 80, 120, 0.5); overflow: hidden;
}
.achv-progress .bar > div { height: 100%; background: #35c8ff; border-radius: 4px; }
.achv-progress span { font-size: 10.5px; color: #8fa3c8; }

.codex-tabs { display: flex; gap: 8px; justify-content: center; margin: 4px 0 6px; flex-wrap: wrap; }
.codex-tab.primary { pointer-events: none; }

#unlock-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 7, 14, 0.78); backdrop-filter: blur(3px);
}
#unlock-overlay.hidden { display: none; }
.unlock-panel { min-width: 320px; max-width: 90vw; }
#unlock-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 18px; }
.unlock-row {
  display: flex; align-items: center; gap: 10px; font-size: 14px; color: #dfe9f5;
  border: 1px solid rgba(255, 210, 58, 0.4); border-radius: 10px;
  background: rgba(30, 26, 10, 0.5); padding: 9px 14px;
  animation: unlock-pop 0.35s ease-out backwards;
}
.unlock-row:nth-child(2) { animation-delay: 0.08s; }
.unlock-row:nth-child(3) { animation-delay: 0.16s; }
.unlock-row:nth-child(4) { animation-delay: 0.24s; }
.unlock-icon { font-size: 20px; }
@keyframes unlock-pop {
  from { transform: translateY(10px) scale(0.95); opacity: 0; }
  to { transform: none; opacity: 1; }
}
#slot-limit-hint.slot-limit { display: block; color: #ffb36b; margin: 2px 0 4px; min-height: 12px; }

/* 英文标题：拉丁字母较长，收紧字距避免溢出面板 */
html[lang="en"] .game-title {
  letter-spacing: 0.1em;
  font-size: clamp(24px, 5.2vh, 46px);
}
