/* ================================================================
   main.css — Tap Titans: Reborn
   黑暗奇幻像素风设计系统
   
   配色体系：
     背景层   #060912 / #0a0e1a / #111827
     边框     #1e2540 / #2a3560
     金色主色 #f5c518 / #ffd740
     紫色辅色 #9b59b6 / #bb77d6
     青色强调 #00d4ff / #40e8ff
     危险红   #e74c3c / #ff6b5b
     成功绿   #27ae60 / #2ecc71
     文字     #e8e8f0 / #a0aac0 / #6b7295

   字体：Press Start 2P (Google Fonts) → 像素风
   圆角：2px 基准（像素风偏方正）
   间距：4px 基准 × 倍数
================================================================ */

/* ── CSS 变量 ─────────────────────────────────────────────── */
:root {
  /* 背景 */
  --bg-deep:    #060912;
  --bg:         #0a0e1a;
  --bg-panel:   #0e1424;
  --bg-surface: #111827;
  --bg-hover:   #161e30;
  --bg-active:  #1e2840;

  /* 边框 */
  --border:     #1e2540;
  --border-md:  #2a3560;
  --border-hi:  #3a4a80;

  /* 主色 — 金色 */
  --gold:       #f5c518;
  --gold-light: #ffd740;
  --gold-dim:   #a88810;
  --gold-glow:  rgba(245, 197, 24, 0.35);

  /* 辅色 — 紫色 */
  --purple:      #9b59b6;
  --purple-light:#bb77d6;
  --purple-dim:  #6a3c80;
  --purple-glow: rgba(155, 89, 182, 0.35);

  /* 强调 — 青色 */
  --cyan:        #00d4ff;
  --cyan-light:  #40e8ff;
  --cyan-dim:    #007090;
  --cyan-glow:   rgba(0, 212, 255, 0.3);

  /* 语义色 */
  --red:         #e74c3c;
  --red-light:   #ff6b5b;
  --green:       #27ae60;
  --green-light: #2ecc71;
  --orange:      #e67e22;

  /* 文字 */
  --text:        #e8e8f0;
  --text-dim:    #a0aac0;
  --text-muted:  #6b7295;
  --text-faint:  #3a4060;

  /* 间距 */
  --sp1: 4px;
  --sp2: 8px;
  --sp3: 12px;
  --sp4: 16px;
  --sp5: 20px;
  --sp6: 24px;

  /* 圆角 */
  --r-sm:  2px;
  --r-md:  4px;
  --r-lg:  6px;
  --r-xl:  8px;

  /* 字体 */
  --font-pixel: 'Press Start 2P', 'Courier New', monospace;

  /* 过渡 */
  --t-fast:   0.12s ease;
  --t-normal: 0.20s ease;
  --t-slow:   0.35s ease;

  /* 布局尺寸 */
  --hud-h:        52px;
  --footer-h:     48px;
  --sidebar-w:    160px;
  --right-panel-w:260px;
  --canvas-size:  480px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }


/* ================================================================
   LAYOUT — 整体游戏框架
   顶部 HUD → 三列主区（左英雄 | 中Canvas | 右面板）→ 底部资源栏
================================================================ */

#game-root {
  display: grid;
  grid-template-rows: var(--hud-h) 1fr var(--footer-h);
  grid-template-areas:
    "hud"
    "main"
    "footer";
  height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

/* ── TOP HUD ──────────────────────────────────────────────── */
#hud {
  grid-area: hud;
  display: flex;
  align-items: center;
  gap: var(--sp4);
  padding: 0 var(--sp4);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 50;
}

/* 品牌标题 */
#hud-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  flex-shrink: 0;
  padding-right: var(--sp3);
  border-right: 1px solid var(--border);
}
#hud-brand-title {
  font-size: 11px;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold-glow), 0 0 20px var(--gold-glow);
  letter-spacing: 1px;
}
#hud-brand-sub {
  font-size: 7px;
  color: var(--purple);
  letter-spacing: 3px;
  margin-top: 1px;
}

/* 关卡区块 */
#hud-stage-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  padding: var(--sp1) var(--sp3);
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  flex-shrink: 0;
}
#hud-stage-wrap .hud-label {
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 1px;
}
#hud-stage-num {
  font-size: 16px;
  color: var(--text);
  min-width: 32px;
  text-align: center;
}

/* 资源行 */
#hud-resources {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  flex: 1;
}
.hud-res {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px var(--sp2);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: border-color var(--t-fast);
}
.hud-res:hover { border-color: var(--border-md); }
.hud-res-icon { font-size: 12px; }
.hud-res-val {
  font-size: 11px;
  min-width: 28px;
}
.hud-res-label {
  font-size: 7px;
  color: var(--text-muted);
}
#hud-gold-wrap   .hud-res-val { color: var(--gold); }
#hud-shards-wrap .hud-res-val { color: var(--purple); }
#hud-dps-wrap    .hud-res-val { color: var(--cyan); }
#hud-click-wrap  .hud-res-val { color: var(--green-light); }

/* 控制按钮组 */
#hud-controls {
  display: flex;
  gap: var(--sp1);
  flex-shrink: 0;
}
.ctrl-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.ctrl-btn:hover   { background: var(--bg-hover); border-color: var(--border-md); color: var(--text); }
.ctrl-btn:active  { transform: scale(0.92); }
.ctrl-btn.active  { color: var(--gold); border-color: var(--gold-dim); background: rgba(245,197,24,0.1); }

/* ── MAIN AREA — 三列 ──────────────────────────────────── */
#main-area {
  grid-area: main;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--right-panel-w);
  grid-template-areas: "hero-sidebar stage-area right-panel";
  overflow: hidden;
}

/* ── 左侧英雄快捷侧栏 ─────────────────────────────────── */
#hero-sidebar {
  grid-area: hero-sidebar;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp2) var(--sp3);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-title {
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 1px;
}
.sidebar-dps-label {
  font-size: 7px;
  color: var(--cyan);
}

#hero-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: var(--sp1) 0;
}

/* 英雄行 */
.sidebar-hero {
  display: flex;
  align-items: center;
  gap: var(--sp1) + 2px;
  padding: 5px var(--sp2);
  border-bottom: 1px solid rgba(30,37,64,0.5);
  cursor: pointer;
  transition: background var(--t-fast);
}
.sidebar-hero:hover  { background: var(--bg-hover); }
.sidebar-hero.active { background: var(--bg-active); }

.sh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sh-avatar {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 1px solid var(--border);
}
.sh-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sh-name {
  font-size: 7px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sh-lv {
  font-size: 7px;
  color: var(--text-muted);
}
.sh-dps {
  font-size: 7px;
  color: var(--cyan);
  text-align: right;
  flex-shrink: 0;
}

/* ── 中间战斗区 ───────────────────────────────────────── */
#stage-area {
  grid-area: stage-area;
  position: relative;
  overflow: hidden;
  background: #060912;
  /* Canvas 居中 */
  display: flex;
  align-items: stretch;
}

#stage-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#tap-zone {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  z-index: 5;
}

/* ── 关卡进度叠加层 ──────────────────────────────────── */
#stage-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: var(--sp2) var(--sp3);
  background: linear-gradient(to bottom, rgba(6,9,18,0.85) 60%, transparent);
  pointer-events: none;
  z-index: 10;
}

#stage-progress-header {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  margin-bottom: 5px;
}

#stage-label {
  font-size: 10px;
  color: var(--text);
  text-shadow: 0 0 8px rgba(0,0,0,0.8);
}

/* 关卡类型徽章 */
.stage-badge {
  font-size: 7px;
  padding: 2px 5px;
  border-radius: var(--r-sm);
  font-weight: bold;
  letter-spacing: 1px;
  border: 1px solid transparent;
  animation-fill-mode: both;
}
.stage-badge.badge-boss {
  background: rgba(231,76,60,0.2);
  border-color: var(--red);
  color: var(--red-light);
  text-shadow: 0 0 6px var(--red);
  animation: badgePulse 1s ease-in-out infinite;
}
.stage-badge.badge-mini {
  background: rgba(155,89,182,0.2);
  border-color: var(--purple);
  color: var(--purple-light);
  text-shadow: 0 0 6px var(--purple);
}
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.4); }
  50%       { box-shadow: 0 0 0 4px rgba(231,76,60,0); }
}

/* 最高关卡记录 */
#stage-record {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 8px;
  color: var(--gold);
}
.rec-icon { font-size: 10px; }

/* 血条 */
#stage-hp-wrap {
  position: relative;
  height: 8px;
  background: rgba(30,37,64,0.8);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
#stage-hp-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(to right, #27ae60, #2ecc71);
  border-radius: var(--r-sm);
  transition: width 0.15s ease, background-color 0.3s ease;
  transform-origin: left center;
}
#stage-hp-bar.hp-mid   { background: linear-gradient(to right, #e67e22, #f39c12); }
#stage-hp-bar.hp-low   { background: linear-gradient(to right, #c0392b, #e74c3c); }
#stage-hp-bar.hp-crit  {
  background: linear-gradient(to right, #922b21, #e74c3c);
  animation: hpCritFlash 0.5s ease-in-out infinite;
}
@keyframes hpCritFlash {
  0%, 100% { filter: brightness(1); }
  50%       { filter: brightness(1.4); }
}
#stage-hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 6px;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* Boss 倒计时 */
#stage-timer {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 9px;
  color: var(--red-light);
}
.timer-icon { font-size: 11px; }
#stage-timer-val {
  font-size: 14px;
  color: var(--red-light);
  min-width: 24px;
}
.timer-label { color: var(--text-muted); }
#stage-timer.timer-urgent #stage-timer-val {
  animation: urgentBlink 0.4s step-end infinite;
  color: #ff3300;
  text-shadow: 0 0 8px rgba(255,50,0,0.8);
}
@keyframes urgentBlink {
  50% { opacity: 0.2; }
}

/* 连击显示 */
#combo-display {
  position: absolute;
  top: 70px;
  right: var(--sp3);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 10;
  animation: comboBounce 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
#combo-count {
  font-size: 28px;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold-glow), 0 2px 0 rgba(0,0,0,0.8);
  line-height: 1;
}
.combo-label {
  font-size: 7px;
  color: var(--cyan);
  letter-spacing: 2px;
  text-shadow: 0 0 8px var(--cyan-glow);
}
@keyframes comboBounce {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* 敌人信息底部 */
#enemy-info {
  position: absolute;
  bottom: var(--sp3);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 10;
}
#enemy-name {
  display: block;
  font-size: 9px;
  color: var(--text-dim);
  text-shadow: 0 0 8px rgba(0,0,0,0.9);
  letter-spacing: 1px;
  text-transform: uppercase;
}
#kill-progress {
  display: inline-block;
  font-size: 8px;
  color: var(--gold);
  margin-top: 3px;
  text-shadow: 0 0 6px rgba(0,0,0,0.8);
}

/* ── 右侧功能面板 ─────────────────────────────────────── */
#right-panel {
  grid-area: right-panel;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tab 导航 */
#panel-tabs {
  display: flex;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 7px;
  padding: var(--sp2) 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab-btn:hover { color: var(--text-dim); background: var(--bg-hover); }
.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: rgba(245,197,24,0.05);
}
.tab-icon { font-size: 13px; }
.tab-label { letter-spacing: 0.5px; }

/* 面板内容 */
#panel-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp2);
}
.panel { display: none; }
.panel.active { display: block; }

/* ── BOTTOM RESOURCE BAR ─────────────────────────────── */
#resource-bar {
  grid-area: footer;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 0 var(--sp4);
  overflow: hidden;
}

.res-stat {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  flex: 1;
  padding: 0 var(--sp3);
}
.res-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}
.res-icon { font-size: 14px; flex-shrink: 0; }
.res-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.res-label {
  font-size: 7px;
  color: var(--text-muted);
  white-space: nowrap;
}
.res-val {
  font-size: 10px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#footer-gold    { color: var(--gold); }
#footer-shards  { color: var(--purple); }
#footer-dps     { color: var(--cyan); }
#footer-click   { color: var(--green-light); }
#footer-best    { color: var(--gold); }
#footer-prestige{ color: var(--purple); }


/* ================================================================
   COMPONENT SYSTEM — 可复用组件
================================================================ */

/* ── 通用按钮 ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp1);
  font-family: var(--font-pixel);
  font-size: 9px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 6px var(--sp3);
  transition: all var(--t-fast);
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: scale(0.95); }
.btn:disabled, .btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* 主按钮 — 金色 */
.btn-primary {
  background: linear-gradient(135deg, rgba(245,197,24,0.25), rgba(245,197,24,0.15));
  border-color: rgba(245,197,24,0.55);
  color: var(--gold);
}
.btn-primary:hover { background: linear-gradient(135deg, rgba(245,197,24,0.38), rgba(245,197,24,0.25)); border-color: var(--gold); box-shadow: 0 0 8px var(--gold-glow); }

/* 次要按钮 — 灰色 */
.btn-secondary {
  background: rgba(255,255,255,0.05);
  border-color: var(--border-md);
  color: var(--text-dim);
}
.btn-secondary:hover { background: rgba(255,255,255,0.10); border-color: var(--border-hi); }

/* 危险按钮 — 红色 */
.btn-danger {
  background: rgba(231,76,60,0.15);
  border-color: rgba(231,76,60,0.5);
  color: var(--red-light);
}
.btn-danger:hover { background: rgba(231,76,60,0.28); border-color: var(--red); }

/* 成功按钮 — 绿色 */
.btn-success {
  background: rgba(39,174,96,0.15);
  border-color: rgba(39,174,96,0.5);
  color: var(--green-light);
}
.btn-success:hover { background: rgba(39,174,96,0.28); border-color: var(--green); }

/* 图标按钮 */
.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-md); }
.btn-icon:active { transform: scale(0.9); }

/* 升级按钮（×1 ×10 ×Max）*/
.btn-upg {
  flex: 1;
  background: rgba(245,197,24,0.10);
  border: 1px solid rgba(245,197,24,0.30);
  color: var(--gold);
  border-radius: var(--r-sm);
  padding: 4px 2px;
  font-family: var(--font-pixel);
  font-size: 7px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-align: center;
  line-height: 1.4;
}
.btn-upg:hover:not(.disabled) {
  background: rgba(245,197,24,0.22);
  border-color: rgba(245,197,24,0.6);
  box-shadow: 0 0 6px rgba(245,197,24,0.2);
}
.btn-upg:active:not(.disabled) { transform: scale(0.95); }
.btn-upg.btn-x10 {
  background: rgba(155,89,182,0.10);
  border-color: rgba(155,89,182,0.30);
  color: var(--purple-light);
}
.btn-upg.btn-x10:hover:not(.disabled) { background: rgba(155,89,182,0.22); border-color: rgba(155,89,182,0.6); }
.btn-upg.btn-max {
  background: rgba(0,212,255,0.10);
  border-color: rgba(0,212,255,0.30);
  color: var(--cyan);
}
.btn-upg.btn-max:hover:not(.disabled) { background: rgba(0,212,255,0.22); border-color: rgba(0,212,255,0.6); }
.btn-upg.disabled {
  background: rgba(30,37,64,0.4);
  border-color: var(--border);
  color: var(--text-faint);
  cursor: not-allowed;
  opacity: 0.55;
}

/* ── 卡片 ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp3);
  margin-bottom: var(--sp2);
}
.card:hover { border-color: var(--border-md); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp2);
}
.card-title {
  font-size: 9px;
  color: var(--text);
  letter-spacing: 0.5px;
}
.card-sub {
  font-size: 7px;
  color: var(--text-muted);
}

/* ── 英雄卡片 ─────────────────────────────────────────────── */
.hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp2);
  margin-bottom: var(--sp2);
  transition: border-color var(--t-fast), background var(--t-fast);
  cursor: pointer;
}
.hero-card:hover  { border-color: var(--border-md); background: var(--bg-hover); }
.hero-card.locked { opacity: 0.4; cursor: not-allowed; }
.hero-card.milestone-glow {
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
  animation: msGlow 2s ease-in-out;
}
@keyframes msGlow {
  0%, 100% { box-shadow: 0 0 10px var(--gold-glow); }
  50%       { box-shadow: 0 0 20px rgba(245,197,24,0.6); }
}

.hero-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  margin-bottom: var(--sp2);
}
.hero-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--bg-active);
}
.hero-meta { flex: 1; min-width: 0; }
.hero-name-row {
  display: flex;
  align-items: center;
  gap: var(--sp1);
}
.hero-name {
  font-size: 8px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-level {
  font-size: 7px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.hero-dps {
  font-size: 8px;
  color: var(--cyan);
  margin-top: 2px;
}
.hero-cost {
  font-size: 7px;
  color: var(--gold);
  flex-shrink: 0;
  text-align: right;
}

/* 里程碑进度条 */
.ms-bar-wrap {
  margin-bottom: var(--sp2);
}
.ms-bar-track {
  height: 4px;
  background: rgba(30,37,64,0.8);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 3px;
}
.ms-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--purple), var(--cyan));
  border-radius: 2px;
  transition: width 0.3s ease;
}
.ms-info {
  display: flex;
  justify-content: space-between;
  font-size: 7px;
}
.ms-count { color: var(--text-muted); }
.ms-next  { color: var(--purple); }

/* 升级按钮组 */
.hero-btns {
  display: flex;
  gap: 4px;
}

/* ── 武器卡片 ─────────────────────────────────────────────── */
.weapon-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp2);
  margin-bottom: var(--sp2);
  position: relative;
  transition: all var(--t-fast);
}
.weapon-card:hover { border-color: var(--border-md); }
.weapon-card.equipped {
  border-color: var(--gold-dim);
  background: rgba(245,197,24,0.05);
}
.weapon-card.equipped::before {
  content: '装备中';
  position: absolute;
  top: var(--sp1);
  right: var(--sp2);
  font-size: 6px;
  color: var(--gold);
  background: rgba(245,197,24,0.15);
  border: 1px solid var(--gold-dim);
  border-radius: var(--r-sm);
  padding: 1px 4px;
}

/* 稀有度边框颜色 */
.weapon-card.rarity-common    { border-color: var(--border-md); }
.weapon-card.rarity-rare      { border-color: rgba(0,212,255,0.4); }
.weapon-card.rarity-epic      { border-color: rgba(155,89,182,0.5); }
.weapon-card.rarity-legendary {
  border-color: rgba(245,197,24,0.6);
  box-shadow: 0 0 8px rgba(245,197,24,0.2);
}

.weapon-header {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  margin-bottom: var(--sp2);
}
.weapon-icon { font-size: 20px; flex-shrink: 0; }
.weapon-info { flex: 1; min-width: 0; }
.weapon-name { font-size: 8px; color: var(--text); }
.weapon-affix {
  font-size: 7px;
  color: var(--purple-light);
  margin-top: 2px;
}

/* 比较面板 */
.compare-panel {
  background: rgba(10,14,26,0.96);
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  padding: var(--sp3);
  margin-top: var(--sp2);
}
.cmp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(30,37,64,0.4);
}
.cmp-row:last-child { border-bottom: none; }
.cmp-label { color: var(--text-muted); }
.cmp-val   { color: var(--text); }
.cmp-val.better { color: var(--green-light); }
.cmp-val.worse  { color: var(--red-light); }
.cmp-actions { display: flex; gap: var(--sp2); margin-top: var(--sp2); }

/* ── 技能节点 ─────────────────────────────────────────────── */
.skill-node {
  display: flex;
  align-items: flex-start;
  gap: var(--sp2);
  padding: var(--sp2);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: var(--sp2);
  transition: all var(--t-fast);
}
.skill-node:hover:not(.locked) { border-color: var(--border-md); background: var(--bg-hover); }
.skill-node.unlocked {
  border-color: rgba(0,212,255,0.35);
  background: rgba(0,212,255,0.05);
}
.skill-node.maxed {
  border-color: rgba(245,197,24,0.4);
  background: rgba(245,197,24,0.06);
}
.skill-node.locked { opacity: 0.4; }

.skill-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--bg-active);
  border: 1px solid var(--border-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.skill-info { flex: 1; min-width: 0; }
.skill-name {
  font-size: 8px;
  color: var(--text);
  margin-bottom: 3px;
}
.skill-desc {
  font-size: 6px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: var(--sp1);
}
.skill-level {
  font-size: 7px;
  color: var(--cyan);
}
.skill-cost {
  font-size: 7px;
  color: var(--gold);
  white-space: nowrap;
}

/* ── 转生面板 ─────────────────────────────────────────────── */
.prestige-section {
  margin-bottom: var(--sp4);
}
.prestige-section-title {
  font-size: 9px;
  color: var(--purple);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp2);
  margin-bottom: var(--sp3);
  letter-spacing: 1px;
}
.prestige-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(30,37,64,0.4);
}
.prestige-stat-label { color: var(--text-muted); }
.prestige-stat-val   { color: var(--purple-light); }

/* 转生按钮 */
.btn-prestige {
  width: 100%;
  padding: var(--sp3);
  background: linear-gradient(135deg, rgba(155,89,182,0.25), rgba(155,89,182,0.15));
  border: 1px solid rgba(155,89,182,0.5);
  color: var(--purple-light);
  border-radius: var(--r-md);
  font-family: var(--font-pixel);
  font-size: 9px;
  cursor: pointer;
  transition: all var(--t-normal);
  letter-spacing: 1px;
}
.btn-prestige:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(155,89,182,0.4), rgba(155,89,182,0.28));
  border-color: var(--purple);
  box-shadow: 0 0 16px var(--purple-glow);
}
.btn-prestige:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ================================================================
   FLOATING DAMAGE NUMBERS
================================================================ */

#damage-numbers {
  position: fixed;
  pointer-events: none;
  inset: 0;
  z-index: 999;
  overflow: hidden;
}

.dmg-float {
  position: fixed;
  font-family: var(--font-pixel);
  font-size: 14px;
  font-weight: bold;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(245,197,24,0.9), 0 1px 3px rgba(0,0,0,0.8);
  white-space: nowrap;
  pointer-events: none;
  animation: floatUp 0.85s ease-out forwards;
  z-index: 999;
  transform: translateX(-50%);
}

/* 暴击 */
.dmg-float.dmg-crit {
  font-size: 22px;
  color: var(--red-light);
  text-shadow: 0 0 14px rgba(231,76,60,0.9), 0 2px 4px rgba(0,0,0,0.8);
  animation: floatUpCrit 1.05s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* 普通 */
.dmg-float.dmg-normal {
  font-size: 13px;
  color: var(--gold);
  animation: floatUp 0.8s ease-out forwards;
}

/* 连击 */
.dmg-float.dmg-combo {
  font-size: 10px;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-glow);
  animation: floatUp 0.6s ease-out forwards;
}

/* 金币 */
.dmg-float.dmg-gold {
  font-size: 11px;
  color: var(--gold-light);
  animation: floatUpGold 1.0s ease-out forwards;
}

/* 英雄DPS（小字，偏淡）*/
.dmg-float.dmg-hero {
  font-size: 9px;
  color: var(--cyan-dim);
  text-shadow: none;
  animation: floatUp 0.6s ease-out forwards;
  opacity: 0.7;
}

/* 动画 */
@keyframes floatUp {
  0%   { opacity: 1;   transform: translateX(-50%) translateY(0)     scale(1); }
  15%  { opacity: 1;   transform: translateX(-50%) translateY(-12px) scale(1.06); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(-70px) scale(0.85); }
}
@keyframes floatUpCrit {
  0%   { opacity: 0;   transform: translateX(-50%) translateY(0)     scale(0.6); }
  10%  { opacity: 1;   transform: translateX(-50%) translateY(-8px)  scale(1.25); }
  30%  { opacity: 1;   transform: translateX(-50%) translateY(-22px) scale(1.0); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(-90px) scale(0.8); }
}
@keyframes floatUpGold {
  0%   { opacity: 1;   transform: translateX(-50%) translateY(0)     scale(1); }
  20%  { opacity: 1;   transform: translateX(-50%) translateY(-15px) scale(1.08); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(-60px) scale(0.9); }
}


/* ================================================================
   MODAL / DIALOG
================================================================ */

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,9,18,0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 800;
  animation: overlayIn 0.15s ease;
}
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-md);
  border-radius: var(--r-xl);
  min-width: 320px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
  animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalIn {
  from { transform: scale(0.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}
#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp3) var(--sp4);
  border-bottom: 1px solid var(--border);
}
#modal-title {
  font-size: 10px;
  color: var(--text);
  letter-spacing: 1px;
}
#modal-body {
  padding: var(--sp4);
}
#modal-footer {
  display: flex;
  gap: var(--sp2);
  justify-content: flex-end;
  padding: var(--sp3) var(--sp4);
  border-top: 1px solid var(--border);
}


/* ================================================================
   TOOLTIP
================================================================ */

#tooltip {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  padding: var(--sp2) var(--sp3);
  font-size: 8px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 220px;
  pointer-events: none;
  z-index: 900;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: tooltipIn 0.1s ease;
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tooltip-title {
  font-size: 9px;
  color: var(--text);
  margin-bottom: 4px;
}
.tooltip-gold  { color: var(--gold); }
.tooltip-cyan  { color: var(--cyan); }
.tooltip-purple{ color: var(--purple-light); }


/* ================================================================
   TOAST NOTIFICATIONS
================================================================ */

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14,20,36,0.96);
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  padding: var(--sp2) var(--sp4);
  font-size: 9px;
  color: var(--text);
  white-space: nowrap;
  z-index: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toastAnim 2.0s ease-out forwards;
  pointer-events: none;
}
.toast.toast-top    { top: var(--sp4); }
.toast.toast-bottom { bottom: 60px; }
.toast.toast-gold   { border-color: var(--gold-dim); color: var(--gold); }
.toast.toast-purple { border-color: var(--purple-dim); color: var(--purple-light); }
.toast.toast-cyan   { border-color: var(--cyan-dim); color: var(--cyan); }
.toast.toast-red    { border-color: rgba(231,76,60,0.5); color: var(--red-light); }

@keyframes toastAnim {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}

/* 存档 Toast */
.save-toast {
  position: fixed;
  bottom: var(--sp4);
  right: var(--sp4);
  background: rgba(14,20,36,0.95);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 6px var(--sp3);
  border-radius: var(--r-md);
  z-index: 600;
  animation: saveToastAnim 1.8s ease-out forwards;
}
@keyframes saveToastAnim {
  0%   { opacity: 0; transform: translateY(8px); }
  12%  { opacity: 1; transform: translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* 里程碑通知 */
.ms-toast {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,14,26,0.96);
  border: 1px solid rgba(155,89,182,0.5);
  border-radius: var(--r-lg);
  padding: var(--sp2) var(--sp4);
  font-size: 8px;
  color: var(--purple-light);
  text-align: center;
  z-index: 650;
  box-shadow: 0 0 20px rgba(155,89,182,0.25);
  animation: toastAnim 2.5s ease-out forwards;
  pointer-events: none;
}
.ms-toast span {
  font-size: 7px;
  color: var(--text-muted);
  display: block;
  margin-top: 3px;
}

/* 武器掉落通知 */
.weapon-drop-toast {
  position: fixed;
  bottom: 64px;
  right: var(--sp3);
  background: rgba(10,14,26,0.96);
  border: 1px solid var(--border-md);
  border-radius: var(--r-lg);
  padding: var(--sp2) var(--sp3);
  display: flex;
  align-items: center;
  gap: var(--sp2);
  z-index: 650;
  cursor: pointer;
  max-width: 250px;
  animation: dropToastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.weapon-drop-toast.rarity-legendary { border-color: rgba(245,197,24,0.6); box-shadow: 0 0 12px rgba(245,197,24,0.25); }
.weapon-drop-toast.rarity-epic      { border-color: rgba(155,89,182,0.5); }
.weapon-drop-toast.rarity-rare      { border-color: rgba(0,212,255,0.4);  }
@keyframes dropToastIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.dt-icon { font-size: 22px; }
.dt-info { display: flex; flex-direction: column; gap: 2px; }
.dt-name { font-size: 8px; font-weight: bold; color: var(--text); }
.dt-affixes { font-size: 7px; color: var(--text-muted); }

/* 转生 Toast */
.prestige-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  background: rgba(10,14,26,0.97);
  border: 1px solid rgba(155,89,182,0.6);
  border-radius: var(--r-xl);
  padding: var(--sp4) var(--sp6);
  text-align: center;
  font-size: 12px;
  color: var(--purple-light);
  z-index: 900;
  box-shadow: 0 0 40px rgba(155,89,182,0.3), 0 24px 48px rgba(0,0,0,0.7);
  animation: prestigeIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}
.prestige-toast span { font-size: 8px; color: var(--text-muted); display: block; margin-top: 5px; }
@keyframes prestigeIn {
  from { transform: translate(-50%,-50%) scale(0.5); opacity: 0; }
  to   { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
}


/* ================================================================
   UTILITY CLASSES
================================================================ */

.hidden { display: none !important; }
.invisible { visibility: hidden !important; }

/* 文字颜色 */
.text-gold    { color: var(--gold); }
.text-purple  { color: var(--purple-light); }
.text-cyan    { color: var(--cyan); }
.text-red     { color: var(--red-light); }
.text-green   { color: var(--green-light); }
.text-muted   { color: var(--text-muted); }

/* 对齐 */
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* 间距 */
.mt1 { margin-top: var(--sp1); }
.mt2 { margin-top: var(--sp2); }
.mt3 { margin-top: var(--sp3); }
.mt4 { margin-top: var(--sp4); }
.mb2 { margin-bottom: var(--sp2); }
.mb3 { margin-bottom: var(--sp3); }

/* Flex */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap2 { gap: var(--sp2); }
.gap3 { gap: var(--sp3); }


/* ================================================================
   STAGE PROGRESS — Badge 追加样式（UIRenderer 动态设置）
================================================================ */

/* Boss 战血条特效 */
#stage-hp-bar.boss-bar {
  background: linear-gradient(to right, #8b0000, #cc0020, #ff3344);
  box-shadow: 0 0 8px rgba(204,0,32,0.5);
}
/* MiniBoss 血条 */
#stage-hp-bar.miniboss-bar {
  background: linear-gradient(to right, #5b00a0, #8b00d4, #bb44ff);
  box-shadow: 0 0 6px rgba(155,0,180,0.4);
}

/* Boss 战期间 stage-area 脉冲边框 */
#stage-area.boss-active::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid rgba(231,76,60,0.4);
  border-radius: 0;
  pointer-events: none;
  z-index: 20;
  animation: bossEdgePulse 1.5s ease-in-out infinite;
}
@keyframes bossEdgePulse {
  0%, 100% { box-shadow: inset 0 0 20px rgba(231,76,60,0.15); }
  50%       { box-shadow: inset 0 0 40px rgba(231,76,60,0.35); }
}


/* ================================================================
   RESPONSIVE — 平板适配 (≤ 900px)
================================================================ */

@media (max-width: 900px) {
  :root {
    --sidebar-w:    120px;
    --right-panel-w:200px;
  }
  #hud-brand-title { font-size: 9px; }
  #hud-brand-sub   { display: none; }
  #hud-resources   { gap: var(--sp2); }
  .hud-res         { padding: 3px 6px; }
  .hud-res-val     { font-size: 9px; }
  .hud-res-label   { display: none; }
}

@media (max-width: 700px) {
  :root {
    --hud-h:          44px;
    --footer-h:       40px;
    --sidebar-w:      0px;
    --right-panel-w:  0px;
  }
  #hero-sidebar { display: none; }
  #right-panel  { display: none; }
  #main-area {
    grid-template-columns: 1fr;
    grid-template-areas: "stage-area";
  }
  #hud-brand  { display: none; }
  #hud-resources {
    flex-wrap: wrap;
    gap: var(--sp1);
  }
  .hud-res { padding: 2px 5px; }
  #resource-bar { padding: 0 var(--sp2); }
  .res-stat { padding: 0 var(--sp2); }
  .res-label { display: none; }
}


/* ================================================================
   SUPPLEMENTAL — 补充动画 & 样式
================================================================ */

/* 最高关卡刷新闪光 */
@keyframes recordFlash {
  0%   { color: var(--gold); text-shadow: 0 0 0   rgba(245,197,24,0); }
  30%  { color: #fff;        text-shadow: 0 0 14px rgba(245,197,24,1); }
  100% { color: var(--gold); text-shadow: 0 0 4px  rgba(245,197,24,0.4); }
}

/* hud-timer 保留兼容（旧 UIRenderer 引用）*/
#hud-timer { display: none; }

/* stage-area 像素渲染保证 */
#stage-canvas {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* 技能树空状态 */
.skills-empty {
  font-size: 8px;
  color: var(--text-muted);
  text-align: center;
  padding: var(--sp6) var(--sp4);
  line-height: 2.2;
}

/* 武器掉落 badge 颜色复用 */
.rarity-legendary { color: var(--gold); }
.rarity-epic      { color: var(--purple-light); }
.rarity-rare      { color: var(--cyan); }
.rarity-common    { color: var(--text-muted); }

/* 面板空状态 */
.panel-empty {
  font-size: 8px;
  color: var(--text-muted);
  text-align: center;
  padding: var(--sp4);
  line-height: 2;
}

/* Boss 倒计时 HUD（旧节点保留，新版用 #stage-timer）*/
#hud-timer.visible {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--red-light);
  font-size: 10px;
}
