/* ============================================
   幻想三国 - 主样式表
   墨色古风 × 三国题材
   ============================================ */

/* ===========================================
   1. Design Tokens
   =========================================== */
:root {
  /* Backgrounds — 墨色系 */
  --color-bg: #1a1410;
  --color-surface: #2a2018;
  --color-surface-dark: #120e0a;

  /* Brand — 朱红 + 古铜 + 鎏金 */
  --color-primary: #c0392b;
  --color-secondary: #4a3728;
  --color-gold: #d4a849;

  /* Text — 绢帛色调 */
  --color-text: #e8dcc8;
  --color-text-dim: #a09080;
  --color-text-muted: #605040;

  /* Feedback — 古风色调 */
  --color-success: #5d8a48;
  --color-danger: #b33a3a;
  --color-warning: #c98a2e;
  --color-info: #4a7fb5;

  /* Quality Rarity — 中国古器物色 */
  --quality-1: #b0a898; /* 白瓷·普通 */
  --quality-2: #5d8a48; /* 翠玉·优秀 */
  --quality-3: #4a7fb5; /* 青花·精锐 */
  --quality-4: #8b5ea8; /* 紫檀·史诗 */
  --quality-5: #d4a849; /* 鎏金·传说 */

  /* Typography */
  --font-title: 'STZhongsong', 'SimSun', 'Noto Serif SC', serif;
  --font-main: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', sans-serif;

  /* Sizing */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-pill: 999px;

  /* Transitions */
  --ease: 0.18s ease;

  /* Shadows — 墨色阴影 */
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(212, 168, 73, 0.06);
  --shadow-glow-gold: 0 0 12px rgba(212, 168, 73, 0.3);
  --shadow-glow-primary: 0 0 10px rgba(192, 57, 43, 0.35);

  /* 竹简纹理 */
  --bg-parchment: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(212, 168, 73, 0.03) 3px,
    rgba(212, 168, 73, 0.03) 4px
  );
  /* 竹节纹理（进度条用） */
  --bg-bamboo-knot: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 5px,
    rgba(255, 255, 255, 0.04) 5px,
    rgba(255, 255, 255, 0.04) 6px
  );

  /* Safe-area (notch) */
  --sat: env(safe-area-inset-top, 0px);
}

/* ===========================================
   2. Reset & Base
   =========================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--color-info); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

/* ===========================================
   3. App Layout
   =========================================== */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--color-bg);
  border-left: 1px solid var(--color-secondary);
  border-right: 1px solid var(--color-secondary);
  position: relative;
  overflow: hidden;
}

/* ===========================================
   4. Header (compact for world view)
   =========================================== */
#game-header {
  padding: calc(var(--sat) + 4px) 8px 4px;
  background: linear-gradient(180deg, #2a2018 0%, #1a1410 100%);
  border-bottom: 2px solid var(--color-primary);
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}

/* 回纹角饰 */
#game-header::before,
#game-header::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  opacity: 0.35;
}
#game-header::before {
  top: 0; left: 0;
  border-top: 2px solid var(--color-gold);
  border-left: 2px solid var(--color-gold);
}
#game-header::after {
  top: 0; right: 0;
  border-top: 2px solid var(--color-gold);
  border-right: 2px solid var(--color-gold);
}

#game-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-gold);
  letter-spacing: 6px;
  text-shadow: 0 0 12px rgba(212, 168, 73, 0.4);
}

#game-header .version-badge {
  display: inline-block;
  font-size: 0.6rem;
  color: var(--color-text-muted);
  background: var(--color-surface-dark);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0;
}

/* Resource Bar */
#resources-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.72rem;
}

#resources-bar span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--color-text-dim);
}

#resources-bar .res-value {
  color: var(--color-text);
  font-weight: 600;
}

/* ===========================================
   5. Tab Navigation (hidden, replaced by BottomNav)
   =========================================== */
#tab-nav {
  display: none;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-secondary);
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
  z-index: 10;
}

#tab-nav::-webkit-scrollbar { display: none; }

#tab-nav button {
  flex: 1 0 auto;
  min-width: 56px;
  padding: 9px 6px 7px;
  background: none;
  border: none;
  color: var(--color-text-dim);
  font-family: var(--font-main);
  font-size: 0.78rem;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  position: relative;
}

#tab-nav button:hover {
  color: var(--color-text);
}

#tab-nav button.active {
  color: var(--color-gold);
  border-bottom-color: var(--color-gold);
  text-shadow: 0 0 6px rgba(212, 168, 73, 0.3);
}

/* Notification dot on tabs */
#tab-nav button .tab-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--color-primary);
  border-radius: 50%;
  animation: pulse-glow 2s ease-in-out infinite;
}

/* ===========================================
   6. Main Content Area (hidden, panels moved to overlay)
   =========================================== */
#game-main {
  display: none;
}

.game-panel {
  display: none;
}

.game-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ===========================================
   7. Cards
   =========================================== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--ease), box-shadow var(--ease);
  position: relative;
}

/* 回纹角饰 */
.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  opacity: 0.35;
}
.card::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--color-gold);
  border-left: 2px solid var(--color-gold);
}
.card::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--color-gold);
  border-right: 2px solid var(--color-gold);
}

.card:hover {
  border-color: var(--color-gold);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-gold);
  font-family: var(--font-title);
}

/* ===========================================
   8. Buttons
   =========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 16px;
  border: 1px solid rgba(232, 81, 58, 0.4);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #d4392b, #a02820);
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--ease), transform var(--ease), box-shadow var(--ease), filter var(--ease);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.btn:hover {
  opacity: 0.92;
  box-shadow: 0 2px 8px rgba(192, 57, 43, 0.4);
}

.btn:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: grayscale(0.6);
}

.btn-primary {
  background: linear-gradient(180deg, #d4392b, #a02820);
}

.btn-small {
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
}

.btn-danger {
  background: linear-gradient(180deg, #b33a3a, #8a2020);
  border-color: rgba(208, 80, 80, 0.4);
}

.btn-danger:hover {
  box-shadow: 0 2px 8px rgba(179, 58, 58, 0.4);
}

.btn-success {
  background: linear-gradient(180deg, #5d8a48, #3d6a30);
  border-color: rgba(125, 170, 104, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-secondary);
  color: var(--color-text-dim);
  text-shadow: none;
}

.btn-outline:hover {
  border-color: var(--color-text-dim);
  color: var(--color-text);
  box-shadow: none;
}

.btn-gold {
  background: linear-gradient(180deg, #d4a849, #a07830);
  border: 1px solid rgba(232, 200, 112, 0.5);
  color: #1a1410;
  font-weight: 700;
}

.btn-gold:hover {
  box-shadow: var(--shadow-glow-gold);
}

/* ===========================================
   9. Quality / Rarity Colors
   =========================================== */
.quality-1 { color: var(--quality-1); border-color: var(--quality-1); }
.quality-2 { color: var(--quality-2); border-color: var(--quality-2); }
.quality-3 { color: var(--quality-3); border-color: var(--quality-3); }
.quality-4 { color: var(--quality-4); border-color: var(--quality-4); }
.quality-5 { color: var(--quality-5); border-color: var(--quality-5); }

.quality-4-glow {
  box-shadow: 0 0 10px rgba(139, 94, 168, 0.4), inset 0 0 6px rgba(139, 94, 168, 0.15);
}

.quality-5-glow {
  box-shadow: 0 0 14px rgba(212, 168, 73, 0.45), inset 0 0 8px rgba(212, 168, 73, 0.15);
}

/* Quality text only (no border override) */
.text-quality-1 { color: var(--quality-1); }
.text-quality-2 { color: var(--quality-2); }
.text-quality-3 { color: var(--quality-3); }
.text-quality-4 { color: var(--quality-4); }
.text-quality-5 { color: var(--quality-5); }

/* ===========================================
   10. Progress Bars
   =========================================== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-surface-dark);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--color-primary);
  background-image: var(--bg-bamboo-knot);
  transition: width 0.3s ease;
  min-width: 0;
}

.progress-bar-fill.fill-success { background: var(--color-success); }
.progress-bar-fill.fill-gold    { background: var(--color-gold); }
.progress-bar-fill.fill-info    { background: var(--color-info); }
.progress-bar-fill.fill-warning { background: var(--color-warning); }
.progress-bar-fill.fill-danger  { background: var(--color-danger); }

.progress-bar-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.6rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

/* ===========================================
   11. HP Bars
   =========================================== */
.hp-bar {
  width: 100%;
  height: 6px;
  background: var(--color-surface-dark);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.hp-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.25s ease, background 0.25s ease;
  background: var(--color-success);
}

/* Color thresholds applied via JS inline style or these utility classes */
.hp-bar-fill.hp-high   { background: var(--color-success); }
.hp-bar-fill.hp-medium { background: var(--color-warning); }
.hp-bar-fill.hp-low    { background: var(--color-danger); }

/* ===========================================
   12. Hero Cards
   =========================================== */
.hero-card {
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 8px;
  transition: border-color var(--ease), box-shadow var(--ease);
  position: relative;
}

.hero-card.quality-1 { border-left: 3px solid var(--quality-1); }
.hero-card.quality-2 { border-left: 3px solid var(--quality-2); }
.hero-card.quality-3 { border-left: 3px solid var(--quality-3); }
.hero-card.quality-4 { border-left: 3px solid var(--quality-4); box-shadow: 0 0 8px rgba(139, 94, 168, 0.25); }
.hero-card.quality-5 { border-left: 3px solid var(--quality-5); box-shadow: 0 0 10px rgba(212, 168, 73, 0.25); }

.hero-card .hero-name {
  font-weight: 700;
  font-size: 0.92rem;
  font-family: var(--font-title);
}

.hero-card .hero-level {
  font-size: 0.72rem;
  color: var(--color-text-dim);
}

.hero-card .hero-stats {
  font-size: 0.72rem;
  color: var(--color-text-dim);
  margin-top: 4px;
}

/* ===========================================
   13. Team Slots
   =========================================== */
.team-slot-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.hero-team-slot,
.team-slot {
  background: var(--color-surface-dark);
  border: 1px dashed var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-text-dim);
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}

.hero-team-slot:hover,
.team-slot:hover {
  border-color: var(--color-text-muted);
}

.hero-team-slot.filled,
.team-slot.filled {
  border-style: solid;
  background: var(--color-surface);
}

.hero-team-slot .slot-name {
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--color-text);
}

/* -- Hero Portraits -- */
.hero-portrait {
  border-radius: 50%;
  object-fit: cover;
  image-rendering: pixelated;
  vertical-align: middle;
  background: transparent;
}

.hero-portrait-fallback {
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--color-surface-dark);
}

.hero-portrait-frame {
  display: inline-block;
  border-radius: 50%;
  padding: 2px;
  line-height: 0;
}
.hero-portrait-frame.quality-1 { border: 2px solid #b0a898; }
.hero-portrait-frame.quality-2 { border: 2px solid #5d8a48; }
.hero-portrait-frame.quality-3 { border: 2px solid #4a7fb5; }
.hero-portrait-frame.quality-4 { border: 2px solid #8b5ea8; }
.hero-portrait-frame.quality-5 { border: 2px solid #d4a849; }

/* ===========================================
   14. Equipment Grid
   =========================================== */
.equip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.equip-item,
.equip-inv-card {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 8px;
  text-align: center;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color var(--ease), transform var(--ease);
}

.equip-item:hover,
.equip-inv-card:hover {
  border-color: var(--color-text-dim);
  transform: translateY(-2px);
}

.equip-item.quality-1 { border-color: var(--quality-1); }
.equip-item.quality-2 { border-color: var(--quality-2); }
.equip-item.quality-3 { border-color: var(--quality-3); }
.equip-item.quality-4 { border-color: var(--quality-4); box-shadow: 0 0 6px rgba(139, 94, 168, 0.3); }
.equip-item.quality-5 { border-color: var(--quality-5); box-shadow: 0 0 8px rgba(212, 168, 73, 0.3); }

.equip-item .equip-name {
  font-weight: 600;
  margin-top: 4px;
}

.equip-item .equip-stats {
  color: var(--color-text-dim);
  font-size: 0.65rem;
}

.equip-hero-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  background: var(--color-surface-dark);
  color: var(--color-text-dim);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all var(--ease);
}

.equip-hero-tab:hover { border-color: var(--color-text-dim); }
.equip-hero-tab.active {
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: var(--color-surface);
}

.equip-filter-btn {
  padding: 4px 10px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-dim);
  font-size: 0.68rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all var(--ease);
}

.equip-filter-btn:hover { border-color: var(--color-text-dim); }
.equip-filter-btn.active {
  background: var(--color-secondary);
  color: var(--color-text);
  border-color: var(--color-info);
}

/* ===========================================
   15. Battle Area
   =========================================== */
.battle-area {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}

.battle-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.battle-side-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-text-dim);
  margin-bottom: 4px;
}

.battle-vs {
  font-size: 1rem;
  color: var(--color-primary);
  font-weight: 700;
  align-self: center;
  text-shadow: 0 0 8px rgba(192, 57, 43, 0.4);
}

.battle-unit {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 0.72rem;
  transition: border-color var(--ease);
}

.battle-unit.ally { border-left: 3px solid var(--color-success); }
.battle-unit.enemy { border-left: 3px solid var(--color-danger); }
.battle-unit.dead { opacity: 0.35; }

.battle-unit .unit-name {
  font-weight: 600;
  font-size: 0.75rem;
}

/* ===========================================
   16. Battle Log
   =========================================== */
.battle-log,
#battle-log {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  overflow-y: auto;
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--color-text-dim);
}

.battle-log-entry {
  padding: 2px 0;
  border-bottom: 1px solid rgba(15, 52, 96, 0.3);
}

.battle-log-entry:last-child { border-bottom: none; }

.battle-log-entry.damage { color: var(--color-danger); }
.battle-log-entry.heal   { color: var(--color-success); }
.battle-log-entry.skill  { color: var(--color-info); }
.battle-log-entry.buff   { color: var(--color-gold); }
.battle-log-entry.system { color: var(--color-text-muted); }

/* Battle Controls */
#battle-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ===========================================
   17. Recruit System
   =========================================== */
.recruit-result {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  margin-bottom: 8px;
  animation: slideUp 0.3s ease;
}

.recruit-result.quality-4 {
  border-color: var(--quality-4);
  box-shadow: 0 0 16px rgba(139, 94, 168, 0.35);
  animation: slideUp 0.3s ease, pulse-glow-purple 2s ease-in-out 1;
}

.recruit-result.quality-5 {
  border-color: var(--quality-5);
  box-shadow: 0 0 20px rgba(212, 168, 73, 0.4);
  animation: slideUp 0.3s ease, pulse-glow-orange 2s ease-in-out 1;
}

.recruit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--color-secondary);
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

/* Recruit Buttons */
.recruit-btn-single,
.recruit-btn-ten,
.recruit-btn-free {
  font-family: var(--font-main);
}

@keyframes recruit-free-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(93, 138, 72, 0.3); }
  50%      { box-shadow: 0 0 14px rgba(93, 138, 72, 0.6); }
}

.recruit-btn-free.pulse {
  animation: recruit-free-pulse 2s ease-in-out infinite;
}

/* ===========================================
   18. Pity Bars
   =========================================== */
.pity-bar {
  width: 100%;
  height: 6px;
  background: var(--color-surface-dark);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.pity-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
  background-image: var(--bg-bamboo-knot);
}

.pity-bar-fill.fill-quality-4 { background: var(--quality-4); }
.pity-bar-fill.fill-quality-5 { background: var(--quality-5); }

/* ===========================================
   19. Section Titles
   =========================================== */
.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-gold);
  font-family: var(--font-title);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-secondary);
}

.section-title .title-icon {
  font-size: 1rem;
}

.section-title .title-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--color-text-dim);
}

/* ===========================================
   20. Stats Grid (Settings, Info)
   =========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 0.78rem;
}

.stats-grid .stat-label {
  color: var(--color-text-dim);
}

.stats-grid .stat-value {
  text-align: right;
  font-weight: 600;
  color: var(--color-text);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(15, 52, 96, 0.3);
  font-size: 0.78rem;
}

.stat-row:last-child { border-bottom: none; }

/* ===========================================
   21. Achievement Cards
   =========================================== */
.achievement {
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color var(--ease);
}

.achievement.unlocked {
  border-color: var(--color-gold);
  box-shadow: 0 0 6px rgba(212, 168, 73, 0.15);
}

.achievement .achievement-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.achievement .achievement-info {
  flex: 1;
  min-width: 0;
}

.achievement .achievement-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.achievement .achievement-desc {
  font-size: 0.7rem;
  color: var(--color-text-dim);
  margin-top: 2px;
}

.achievement .achievement-progress {
  margin-top: 6px;
}

/* ===========================================
   22. Story Scenes
   =========================================== */
.story-scene {
  margin-bottom: 10px;
}

.scene-text {
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--color-text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-dark);
  border-left: 3px solid var(--color-secondary);
}

.scene-speaker {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: 4px;
}

/* Story card type accents */
.story-system {
  border-left: 3px solid var(--color-primary);
}

.story-narration {
  border-left: 3px solid var(--color-secondary);
}

.story-dialogue {
  border-left: 3px solid var(--color-gold);
}

.story-chapter-item {
  padding: 8px 10px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  background: var(--color-surface-dark);
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: all var(--ease);
}

.story-chapter-item:hover {
  border-color: var(--color-text-dim);
}

.story-chapter-item.active {
  border-color: var(--color-gold);
  background: var(--color-surface);
}

.story-chapter-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.story-char-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-dim);
  font-size: 0.72rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all var(--ease);
}

.story-char-btn:hover { border-color: var(--color-gold); color: var(--color-gold); }

.btn-mark-seen,
.btn-mark-all {
  font-family: var(--font-main);
}

/* ===========================================
   23. Character Profiles
   =========================================== */
.char-profile {
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}

.char-profile .char-avatar {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.char-profile .char-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-gold);
  font-family: var(--font-title);
}

.char-profile .char-title {
  font-size: 0.72rem;
  color: var(--color-text-dim);
  margin-top: 2px;
}

.char-profile .char-bio {
  font-size: 0.78rem;
  color: var(--color-text);
  line-height: 1.6;
  margin-top: 10px;
  text-align: left;
}

/* ===========================================
   24. Utility Text & Layout Helpers
   =========================================== */
.text-gold    { color: var(--color-gold); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-dim     { color: var(--color-text-dim); }
.text-muted   { color: var(--color-text-muted); }
.text-info    { color: var(--color-info); }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-bold    { font-weight: 700; }
.text-sm      { font-size: 0.75rem; }
.text-xs      { font-size: 0.65rem; }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap    { flex-wrap: wrap; }
.gap-4        { gap: 4px; }
.gap-6        { gap: 6px; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* ===========================================
   25. Dividers & Separators
   =========================================== */
.divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-secondary) 20%,
    var(--color-gold) 50%,
    var(--color-secondary) 80%,
    transparent 100%
  );
  margin: 12px 0;
  border: none;
}

/* ===========================================
   26. Tooltips
   =========================================== */
.tooltip-wrapper {
  position: relative;
}

.tooltip-wrapper .tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface-dark);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.68rem;
  color: var(--color-text);
  white-space: nowrap;
  z-index: 100;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.tooltip-wrapper:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ===========================================
   27. Empty State
   =========================================== */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ===========================================
   28. Animations & Keyframes
   =========================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@keyframes pulse-glow-purple {
  0%, 100% { box-shadow: 0 0 8px rgba(139, 94, 168, 0.2); }
  50%      { box-shadow: 0 0 24px rgba(139, 94, 168, 0.5); }
}

@keyframes pulse-glow-orange {
  0%, 100% { box-shadow: 0 0 10px rgba(212, 168, 73, 0.2); }
  50%      { box-shadow: 0 0 28px rgba(212, 168, 73, 0.55); }
}

@keyframes cardFlip {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.anim-fade-in  { animation: fadeIn 0.25s ease; }
.anim-slide-up { animation: slideUp 0.3s ease; }
.anim-pulse    { animation: pulse-glow 2s ease-in-out infinite; }
.anim-flip     { animation: cardFlip 0.6s ease; }

/* Shimmer loading placeholder */
.shimmer {
  background: linear-gradient(90deg,
    var(--color-surface-dark) 25%,
    var(--color-surface) 50%,
    var(--color-surface-dark) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ===========================================
   29. Abyss Loot Explosion
   =========================================== */

/* --- New keyframes --- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}

@keyframes lightPillar {
  0%   { opacity: 0; height: 0; }
  30%  { opacity: 1; height: 200px; }
  80%  { opacity: 1; height: 200px; }
  100% { opacity: 0; height: 200px; }
}

@keyframes mythicFlash {
  0%   { opacity: 0; }
  15%  { opacity: 0.8; }
  30%  { opacity: 0; }
  50%  { opacity: 0.8; }
  65%  { opacity: 0; }
  100% { opacity: 0; }
}

@keyframes countUpGlow {
  0%   { color: #fff; text-shadow: 0 0 8px var(--color-gold); }
  100% { color: var(--color-text); text-shadow: none; }
}

@keyframes pulse-glow-red {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 34, 34, 0.3); }
  50%      { box-shadow: 0 0 36px rgba(255, 34, 34, 0.7); }
}

/* --- Settlement layout --- */
.abyss-settlement {
  position: relative;
  min-height: 300px;
}
.abyss-settlement__skip {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--color-text-dim);
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  z-index: 20;
}
.abyss-settlement__skip:hover {
  background: rgba(255,255,255,0.2);
}
.abyss-settlement__title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 16px 0;
}
.abyss-settlement__resources {
  padding: 8px 12px;
}
.abyss-settlement__resources .res-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 3px 0;
}
.abyss-settlement__resources .res-value {
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

/* --- Equipment reveal cards --- */
.abyss-settlement__equips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px 0;
}
.equip-reveal-card {
  width: calc((100% - 16px) / 3);
  min-width: 90px;
  max-width: 130px;
  aspect-ratio: 3 / 4;
  perspective: 600px;
  cursor: default;
}
.equip-reveal-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}
.equip-reveal-card__inner.flipped {
  transform: rotateY(180deg);
}
.equip-reveal-card__back,
.equip-reveal-card__front {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-sizing: border-box;
}
.equip-reveal-card__back {
  background: var(--color-surface);
  border: 2px solid #555;
}
.equip-reveal-card__back::after {
  content: '?';
  font-size: 1.8rem;
  color: rgba(255,255,255,0.2);
}
.equip-reveal-card__front {
  background: var(--color-surface);
  transform: rotateY(180deg);
  border: 2px solid #555;
}
.equip-reveal-card__front .eq-emoji {
  font-size: 1.6rem;
  margin-bottom: 4px;
}
.equip-reveal-card__front .eq-name {
  font-size: 0.72rem;
  font-weight: bold;
  text-align: center;
  word-break: break-all;
}
.equip-reveal-card__front .eq-stat {
  font-size: 0.62rem;
  color: var(--color-text-dim);
  margin-top: 2px;
}

/* Quality-specific glow */
.equip-reveal-card--epic .equip-reveal-card__back {
  border-color: #8b5ea8;
}
.equip-reveal-card--epic .equip-reveal-card__front {
  border-color: #8b5ea8;
  animation: pulse-glow-purple 2s ease-in-out infinite;
}
.equip-reveal-card--legendary .equip-reveal-card__back {
  border-color: #d4a849;
}
.equip-reveal-card--legendary .equip-reveal-card__front {
  border-color: #d4a849;
  box-shadow: 0 0 20px #d4a849;
  animation: pulse-glow-orange 2s ease-in-out infinite;
}
.equip-reveal-card--mythic .equip-reveal-card__back {
  border-color: #ff2222;
}
.equip-reveal-card--mythic .equip-reveal-card__front {
  border-color: #ff2222;
  box-shadow: 0 0 24px #ff2222;
  animation: pulse-glow-red 2s ease-in-out infinite;
}

/* Light pillar (legendary) */
.equip-light-pillar {
  position: absolute;
  width: 40px;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  background: linear-gradient(to top, #d4a849, transparent);
  border-radius: 4px;
  pointer-events: none;
  animation: lightPillar 1.1s ease forwards;
}

/* Mythic full-screen flash overlay */
.equip-mythic-flash {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(255,34,34,0.4), rgba(245,197,24,0.2));
  pointer-events: none;
  z-index: 15;
  animation: mythicFlash 800ms ease forwards;
}

/* --- Summary --- */
.abyss-settlement__summary {
  padding: 8px 12px;
}
.abyss-settlement__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px 0;
}
.abyss-settlement__actions .btn {
  flex: 1;
  max-width: 180px;
}

/* --- Clear Art --- */
.abyss-clear-art {
  width: min(100%, 360px);
  margin: 0 auto 12px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(245, 197, 24, 0.32);
  box-shadow: 0 10px 26px rgba(0,0,0,0.38), 0 0 22px rgba(245,197,24,0.14);
  background: rgba(0,0,0,0.24);
}
.abyss-clear-art img {
  display: block;
  width: 100%;
  aspect-ratio: 18 / 11;
  object-fit: cover;
}

/* --- Quick Battle Progress --- */
.abyss-quick-progress {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 24px;
  text-align: center;
}
.abyss-quick-progress svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.abyss-quick-progress .progress-bar {
  position: relative;
  z-index: 1;
  width: 80%;
  height: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 16px;
}
.abyss-quick-progress .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-gold));
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}
.abyss-quick-progress .progress-text {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  color: var(--color-text);
  margin-top: 12px;
  font-weight: bold;
}
.abyss-quick-progress .progress-label {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  color: var(--color-text-dim);
  margin-top: 4px;
}

/* --- Boss Entrance Transition --- */
.abyss-transition {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 24px;
  text-align: center;
  animation: fadeIn 0.3s ease;
}
.abyss-transition__boss {
  margin-bottom: 12px;
}
.abyss-transition__name {
  font-size: 1.3rem;
  font-weight: bold;
  font-family: var(--font-title);
  animation: slideUp 0.4s ease;
}
.abyss-transition__title {
  font-size: 0.78rem;
  color: var(--color-text-dim);
  margin-top: 4px;
}

/* --- Floor Clear Banner --- */
.abyss-floor-clear {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 16px;
  text-align: center;
  animation: slideUp 0.3s ease;
}
.abyss-floor-clear__text {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--color-success);
}
.abyss-floor-clear__rewards {
  font-size: 0.78rem;
  color: var(--color-text-dim);
  margin-top: 8px;
}

/* --- Slot Machine --- */
.slot-machine {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
}
.slot-frame-svg {
  margin-bottom: 8px;
}
.slot-columns {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.slot-column {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 2px solid var(--color-secondary);
  border-radius: var(--radius-md);
  background: var(--color-surface-dark);
  position: relative;
}
.slot-reel {
  display: flex;
  flex-direction: column;
  transition: transform 1.2s cubic-bezier(0.15, 0.8, 0.3, 1);
}
.slot-item {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}
.slot-result-name {
  margin-top: 12px;
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  animation: slideUp 0.3s ease;
}

/* Quality flashes */
.slot-flash-blue {
  animation: slotFlashBlue 0.5s ease;
  box-shadow: 0 0 24px var(--quality-3), inset 0 0 12px rgba(74,127,181,0.3);
}
.slot-flash-purple {
  animation: slotFlashBlue 0.5s ease;
  box-shadow: 0 0 24px var(--quality-4), inset 0 0 12px rgba(139,94,168,0.3);
}
.slot-flash-gold {
  animation: slotFlashBlue 0.6s ease;
  box-shadow: 0 0 30px var(--quality-5), inset 0 0 16px rgba(212,168,73,0.3);
}
.slot-flash-red {
  animation: slotFlashBlue 0.8s ease;
  box-shadow: 0 0 36px #ff2222, inset 0 0 18px rgba(255,34,34,0.3);
}

/* Full-screen Jackpot Explosion */
.jackpot-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.85) 100%);
}
.jackpot-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 200vmax;
  transform: translate(-50%, -50%);
  opacity: 0.7;
  animation: jackpotRaysPulse 1.5s ease-in-out infinite alternate;
}
.jackpot-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 3px solid;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: jackpotRingExpand 1.2s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  opacity: 0.6;
}
.jackpot-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  animation: jackpotIconPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s forwards;
}
.jackpot-icon__emoji {
  font-size: 2.8rem;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.5));
}
.jackpot-info {
  position: absolute;
  top: calc(50% + 70px);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  animation: jackpotInfoSlide 0.5s ease 0.4s both;
}
.jackpot-info__name {
  font-size: 1.6rem;
  font-weight: bold;
  font-family: var(--font-title, 'Microsoft YaHei');
  white-space: nowrap;
}
.jackpot-info__quality {
  font-size: 0.9rem;
  margin-top: 4px;
  opacity: 0.9;
}
.jackpot-particle {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
  opacity: 0;
  animation: jackpotParticleIn 0.15s ease forwards;
  filter: drop-shadow(0 0 3px rgba(255,255,255,0.4));
}
.jackpot-shake {
  animation: jackpotShake 0.6s ease !important;
}

/* Jackpot keyframes */
@keyframes jackpotRaysPulse {
  0%   { opacity: 0.4; }
  100% { opacity: 0.8; }
}
@keyframes jackpotRingExpand {
  0%   { width: 20px; height: 20px; opacity: 0.8; border-width: 3px; }
  100% { width: 120vmax; height: 120vmax; opacity: 0; border-width: 1px; }
}
@keyframes jackpotIconPop {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(-20deg); }
  60%  { transform: translate(-50%, -50%) scale(1.2) rotate(5deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}
@keyframes jackpotInfoSlide {
  0%   { opacity: 0; transform: translateX(-50%) translateY(20px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes jackpotParticleIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes jackpotShake {
  0%, 100% { transform: translateX(0); }
  10%  { transform: translateX(-6px) translateY(2px); }
  20%  { transform: translateX(5px) translateY(-2px); }
  30%  { transform: translateX(-4px) translateY(1px); }
  40%  { transform: translateX(4px) translateY(-1px); }
  50%  { transform: translateX(-3px); }
  60%  { transform: translateX(2px); }
  70%  { transform: translateX(-1px); }
}

/* Quick battle button */
.abyss-quick-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
}
.abyss-quick-btn:hover {
  background: var(--color-secondary);
}

/* --- New Keyframes --- */
@keyframes slotSpin {
  from { transform: translateY(0); }
  to   { transform: translateY(-100%); }
}
@keyframes slotFlashBlue {
  0%   { opacity: 1; }
  50%  { opacity: 0.6; }
  100% { opacity: 1; }
}
/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .equip-reveal-card__inner,
  .equip-light-pillar,
  .equip-mythic-flash,
  .abyss-settlement__title,
  .slot-reel,
  .jackpot-overlay,
  .jackpot-rays,
  .jackpot-ring,
  .jackpot-icon,
  .jackpot-particle,
  .abyss-transition,
  .abyss-floor-clear,
  .abyss-quick-progress .progress-fill,
  .abyss-clear-art {
    animation: none !important;
    transition: none !important;
  }
  .jackpot-overlay {
    display: none !important;
  }
}

/* ===========================================
   29. Custom Scrollbar
   =========================================== */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #4a3728;
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: #6a5738;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #4a3728 transparent;
}

/* ===========================================
   30. Battle Arena (Game-specific)
   =========================================== */
#battle-arena {
  min-height: 120px;
}

.battle-btn-prev-stage,
.battle-btn-next-stage,
.battle-btn-start,
.battle-btn-auto,
.battle-btn-sweep {
  font-family: var(--font-main);
}

/* ===========================================
   31. Settings Panel Specifics
   =========================================== */
.settings-section {
  margin-bottom: 16px;
}

.settings-section h3 {
  font-size: 0.85rem;
  color: var(--color-gold);
  font-family: var(--font-title);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-secondary);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(15, 52, 96, 0.3);
}

.settings-row:last-child { border-bottom: none; }

/* ===========================================
   32. Monologue Bubble
   =========================================== */
.monologue-bubble {
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  line-height: 1.6;
  position: relative;
  animation: fadeIn 0.4s ease;
}

.monologue-bubble .monologue-speaker {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: 4px;
}

/* ===========================================
   33. Responsive & Width Enforcement
   =========================================== */
body {
  overflow-x: hidden;
}

@media (min-width: 481px) {
  #app {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }
}

@media (max-width: 390px) {
  #resources-bar {
    gap: 8px;
    font-size: 0.72rem;
  }

  #tab-nav button {
    font-size: 0.72rem;
    padding: 8px 4px 6px;
  }

  #game-main {
    padding: 8px;
  }

  .card {
    padding: 8px;
  }

  .team-slot-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }

  .equip-grid {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 6px;
  }

  .btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
}

/* Prevent horizontal scroll globally */
html, body, #app {
  max-width: 100vw;
}

/* ===========================================
   34. Print (Minimal)
   =========================================== */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  #tab-nav,
  #game-header,
  .btn {
    display: none;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* ===========================================
   35. Battle Scene — SVG 动画战斗
   =========================================== */

/* --- 关卡信息条 --- */
.battle-stage-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.battle-stage-info {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.battle-stage-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.battle-chapter-badge {
  display: inline-block;
  background: var(--color-gold);
  color: #1a1410;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  vertical-align: middle;
}

.battle-boss-tag {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.72rem;
}

.battle-cleared-tag {
  color: var(--color-success);
  font-size: 0.72rem;
}

.battle-stage-meta {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--color-text-dim);
  margin-top: 2px;
}

.battle-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  background: var(--color-surface-dark);
  color: var(--color-text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--ease);
  flex-shrink: 0;
  font-family: var(--font-main);
}

.battle-nav-btn:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
}

/* --- SVG 战斗场景容器 --- */
.battle-scene-container {
  background: linear-gradient(180deg, #120e0a 0%, #1a1410 100%);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  min-height: 280px;
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

/* --- 待机场景 --- */
.battle-idle-scene {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 12px;
  min-height: 280px;
  gap: 8px;
  background-image: var(--bg-parchment);
}

.battle-idle-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.battle-idle-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-success);
  text-align: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: rgba(93, 138, 72, 0.1);
}

.battle-idle-label.enemy {
  color: var(--color-danger);
  background: rgba(179, 58, 58, 0.1);
}

.battle-idle-units {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.battle-idle-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 8px 6px;
  transition: all var(--ease);
}

.battle-idle-unit.ally {
  border-left: 3px solid var(--color-success);
}

.battle-idle-unit.enemy {
  border-left: 3px solid var(--color-danger);
}

.battle-idle-avatar {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.battle-idle-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
}

.battle-idle-level {
  font-size: 0.62rem;
  color: var(--color-text-dim);
}

.battle-idle-empty {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: center;
  padding: 20px 0;
}

.battle-idle-vs {
  font-size: 1.8rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(192, 57, 43, 0.4));
  animation: pulse-glow 2s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.power-ally,
.power-enemy {
  font-size: 0.85rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.power-vs-label {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
}

/* 颜色编码 —— 我方领先=绿/敌红, 我方落后=红/敌绿, 均势=金 */
.power-ally.power-ahead  { color: var(--color-success); }
.power-enemy.power-ahead { color: var(--color-danger); }

.power-ally.power-behind  { color: var(--color-danger); }
.power-enemy.power-behind { color: var(--color-success); }

.power-ally.power-even,
.power-enemy.power-even { color: var(--color-gold); }

/* --- 控制按钮 --- */
.battle-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

/* ===== 章节门禁面板 ===== */
.chapter-gate-panel {
  background: linear-gradient(135deg, rgba(233, 69, 96, 0.12), rgba(245, 197, 24, 0.08));
  border: 1px solid rgba(233, 69, 96, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.chapter-gate-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: 4px;
}
.chapter-gate-desc {
  font-size: 0.72rem;
  color: var(--color-text-dim);
  margin-bottom: 8px;
}
.chapter-gate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chapter-gate-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(233, 69, 96, 0.25);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.75rem;
}
.gate-icon { font-size: 1rem; }
.gate-name { color: var(--color-text); font-weight: 600; }
.gate-level { color: var(--color-text-dim); }
.gate-current { color: var(--color-primary); font-weight: 700; }
.gate-required { color: var(--color-gold); font-weight: 700; }

/* ===== 关卡选择器 ===== */
.stage-picker-hint {
  font-size: 0.65rem;
  opacity: 0.5;
}
.battle-stage-info:hover .stage-picker-hint {
  opacity: 1;
}
.stage-picker {
  max-height: 55vh;
  display: flex;
  flex-direction: column;
}
.stage-picker-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 80px;
  overflow-y: auto;
}
.stage-picker-tab {
  padding: 3px 8px;
  font-size: 0.68rem;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-pill);
  background: var(--color-surface-dark, #120e0a);
  color: var(--color-text-dim);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-main);
  white-space: nowrap;
}
.stage-picker-tab:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
}
.stage-picker-tab.active {
  background: var(--color-gold);
  color: #1a1410;
  border-color: var(--color-gold);
  font-weight: 700;
}
.stage-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  overflow-y: auto;
  max-height: 40vh;
  padding-right: 2px;
}
.stage-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  background: var(--color-surface-dark, #120e0a);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.stage-picker-item:hover:not(.locked) {
  border-color: var(--color-gold);
  background: rgba(245, 197, 24, 0.08);
}
.stage-picker-item.current {
  border-color: var(--color-gold);
  background: rgba(245, 197, 24, 0.12);
  box-shadow: 0 0 8px rgba(245, 197, 24, 0.2);
}
.stage-picker-item.cleared {
  border-color: var(--color-success);
  opacity: 0.85;
}
.stage-picker-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.stage-picker-item.boss {
  border-color: var(--color-primary);
}
.stage-picker-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-gold);
}
.stage-picker-name {
  font-size: 0.65rem;
  color: var(--color-text);
  text-align: center;
  margin: 2px 0;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-picker-status {
  font-size: 0.85rem;
}
.stage-picker-boss {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.55rem;
  color: var(--color-primary);
  font-weight: 700;
}

.battle-bond-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

/* ===== 终极技能栏 ===== */
.ultimate-bar {
  display: flex;
  gap: 6px;
  padding: 6px 0;
  min-height: 0;
}
.ult-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  cursor: default;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ult-slot.ult-ready {
  cursor: pointer;
  background: rgba(233, 69, 96, 0.15);
  box-shadow: 0 0 8px rgba(233, 69, 96, 0.4);
  animation: ult-pulse 1s infinite;
}
.ult-slot.ult-ready:active { transform: scale(0.92); }
.ult-icon { font-size: 1.3rem; }
.ult-name { font-size: 0.6rem; color: var(--color-text-dim); margin-top: 2px; }
.ult-energy-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}
.ult-energy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-gold));
  border-radius: 2px;
  transition: width 0.3s;
}
@keyframes ult-pulse {
  0%,100% { box-shadow: 0 0 6px rgba(233,69,96,0.3); }
  50% { box-shadow: 0 0 14px rgba(233,69,96,0.6); }
}
.bond-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(212, 168, 73, 0.15);
  color: var(--color-gold);
  border: 1px solid rgba(212, 168, 73, 0.3);
}
.bond-tag.faction {
  background: rgba(76, 175, 80, 0.15);
  color: var(--color-success);
  border-color: rgba(76, 175, 80, 0.3);
}

/* ===== 增益提示栏 ===== */
.battle-buff-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.buff-tag {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(76, 175, 80, 0.12);
  color: #8bc34a;
  border: 1px solid rgba(76, 175, 80, 0.25);
}

.battle-btn-main {
  flex: 1;
  font-size: 0.9rem !important;
  padding: 10px 16px !important;
  font-family: var(--font-main);
}

.battle-food-cost {
  font-size: 0.72rem;
  opacity: 0.8;
}
.battle-food-cost.depleted {
  color: var(--color-danger);
  opacity: 1;
}

.battle-btn-speed {
  min-width: 44px;
  font-weight: bold;
  color: var(--color-gold) !important;
}

.battle-btn-side {
  padding: 8px 12px !important;
  font-size: 0.78rem !important;
  background: var(--color-secondary) !important;
  font-family: var(--font-main);
}

.battle-btn-side.active {
  background: var(--color-success) !important;
}

/* --- 结果覆盖层 --- */
.battle-result {
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 8px;
  text-align: center;
  animation: slideUp 0.3s ease;
  flex-shrink: 0;
}

.battle-result.victory {
  background: rgba(212, 168, 73, 0.08);
  border-color: var(--color-gold);
}

.battle-result.defeat {
  background: rgba(179, 58, 58, 0.08);
  border-color: var(--color-danger);
}

.battle-result-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.battle-result-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.victory .battle-result-title { color: var(--color-gold); text-shadow: 0 0 8px rgba(212,168,73,0.3); }
.defeat .battle-result-title  { color: var(--color-danger); }

.battle-result-rewards {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.battle-reward-item {
  font-size: 0.9rem;
  color: var(--color-gold);
  background: rgba(212, 168, 73, 0.08);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.battle-result-first {
  font-size: 0.75rem;
  color: var(--color-primary);
  margin-top: 4px;
  animation: pulse-glow 2s ease-in-out infinite;
}

.battle-result-hint {
  font-size: 0.8rem;
  color: var(--color-text-dim);
}

/* --- 日志区 --- */
.battle-log-section {
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  flex-shrink: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.battle-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-dim);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--color-secondary);
  flex-shrink: 0;
}

.battle-log-header:hover {
  color: var(--color-text);
}

.battle-log-arrow {
  font-size: 0.68rem;
  transition: transform var(--ease);
}

.battle-log-body {
  max-height: 120px;
  overflow-y: auto;
  padding: 4px 10px;
  font-size: 0.7rem;
  line-height: 1.5;
  transition: max-height 0.2s ease;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 11px,
    rgba(74, 55, 40, 0.1) 11px,
    rgba(74, 55, 40, 0.1) 12px
  );
}

.battle-log-body.collapsed {
  max-height: 0;
  padding: 0 10px;
  overflow: hidden;
}

.battle-log-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 8px;
}

.battle-log-entry {
  padding: 2px 0;
  border-bottom: 1px solid rgba(15, 52, 96, 0.2);
  color: var(--color-text-dim);
}

.battle-log-entry:last-child { border-bottom: none; }
.battle-log-entry.damage  { color: var(--color-danger); }
.battle-log-entry.heal    { color: var(--color-success); }
.battle-log-entry.skill   { color: var(--color-info); }
.battle-log-entry.kill    { color: var(--color-warning); }
.battle-log-entry.victory { color: var(--color-gold); }
.battle-log-entry.defeat  { color: var(--color-danger); font-weight: 600; }

/* --- 关卡进度条 --- */
.battle-progress-bar {
  position: relative;
  height: 18px;
  background: var(--color-surface-dark);
  border-radius: var(--radius-pill);
  overflow: hidden;
  flex-shrink: 0;
}

.battle-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-secondary), var(--color-gold));
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.battle-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.62rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

/* --- 进度条颜色阶段 --- */
.progress-tier1 .battle-progress-fill {
  background: linear-gradient(90deg, var(--color-primary), #d63447);
}
.progress-tier2 .battle-progress-fill {
  background: linear-gradient(90deg, #e08a2a, var(--color-gold));
}
.progress-tier3 .battle-progress-fill {
  background: linear-gradient(90deg, #43a047, var(--color-success));
}
.progress-tier4 .battle-progress-fill {
  background: linear-gradient(90deg, var(--color-gold), #ab47bc, var(--color-gold));
  background-size: 200% 100%;
  animation: progress-shimmer 3s linear infinite;
}

@keyframes progress-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===========================================
   36. SVG 战斗动画 Keyframes
   =========================================== */

/* 单位震动 */
@keyframes unitShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(2px); }
}

.unit-shake {
  animation: unitShake 0.3s ease;
}

/* 发光环 */
@keyframes glowRingPulse {
  0%   { r: 20; opacity: 0.8; }
  100% { r: 30; opacity: 0; }
}

.anim-glow-ring {
  animation: glowRingPulse 0.6s ease-out forwards;
}

/* 斩击淡出 */
.anim-slash {
  animation: fadeIn 0.1s ease, fadeOut 0.25s ease 0.1s forwards;
}

.anim-crit {
  animation: fadeIn 0.1s ease, fadeOut 0.35s ease 0.1s forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* SVG 伤害数字飘 */
@keyframes svgDmgFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-20px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-30px) scale(0.8); }
}

/* SVG 技能名闪过 */
@keyframes svgSkillName {
  0%   { opacity: 0; transform: translateY(4px) scale(0.8); }
  30%  { opacity: 1; transform: translateY(0) scale(1.05); }
  70%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-6px) scale(0.9); }
}

/* SVG 治疗粒子上升 */
@keyframes svgHealRise {
  0%   { opacity: 0.8; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-28px); }
}

/* SVG 向上飘浮 */
@keyframes svgFloatUp {
  0%   { opacity: 0.8; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-16px); }
}

/* SVG 波纹扩散 */
@keyframes svgRipple {
  0%   { r: 6; opacity: 0.7; }
  100% { r: 26; opacity: 0; }
}

/* SVG 爆炸碎片飞散 */
@keyframes svgExplode {
  0%   { opacity: 0.9; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx, 20px), var(--ty, -20px)) scale(0.3); }
}

/* 死亡特效 */
.anim-death {
  animation: fadeIn 0.1s ease, fadeOut 0.5s ease 0.1s forwards;
}

/* 技能命中波纹 */
.anim-skill-hit {
  animation: fadeIn 0.1s ease;
}

/* Buff 光环 */
.anim-buff {
  animation: fadeIn 0.2s ease, fadeOut 0.5s ease 0.3s forwards;
}

/* 治疗 */
.anim-heal {
  animation: fadeIn 0.2s ease;
}

/* ===========================================
   Resources Bar — 7 资源分组
   =========================================== */
#resources-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  font-size: 0.72rem;
}
.res-group {
  display: flex;
  gap: 6px;
}
.res-item {
  white-space: nowrap;
}

/* ===========================================
   Tab Nav — 9 tabs 滚动
   =========================================== */
#tab-nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#tab-nav::-webkit-scrollbar {
  display: none;
}
#tab-nav button {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 6px 10px;
}

/* ===========================================
   Town Panel — 城镇系统
   =========================================== */
.town-header {
  text-align: center;
  padding: 12px;
  background: var(--color-surface-dark);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.town-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--color-gold);
  font-family: var(--font-title);
}
.town-meta {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin-top: 4px;
}
.town-production-overview {
  text-align: center;
  padding: 6px 12px;
  background: rgba(79, 175, 80, 0.1);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--color-success);
  margin-bottom: 8px;
}
.town-category-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.town-cat-btn {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid var(--color-secondary);
  background: transparent;
  color: var(--color-text-dim);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--ease);
}
.town-cat-btn.active {
  background: var(--color-secondary);
  color: var(--color-text);
}
.town-building-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.town-building-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.05);
}
.town-building-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.town-building-name {
  font-weight: bold;
  font-size: 0.85rem;
}
.town-building-level {
  color: var(--color-gold);
  font-weight: bold;
  font-size: 0.8rem;
}
.town-building-effect {
  font-size: 0.72rem;
  color: var(--color-success);
  margin-bottom: 6px;
}
.town-build-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.town-build-progress .progress-bar {
  flex: 1;
  min-width: 80px;
}
.town-build-time {
  font-size: 0.72rem;
  color: var(--color-gold);
}
.town-upgrade-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.town-cost {
  font-size: 0.72rem;
  color: var(--color-text-dim);
  flex: 1;
}
.town-upgrade-info {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}
.town-lock-reason {
  width: 100%;
  font-size: 0.68rem;
  color: var(--color-danger);
  margin-top: 2px;
}
.town-max-level {
  font-size: 0.72rem;
  color: var(--color-gold);
  text-align: center;
  padding: 4px;
}
.town-market {
  margin-top: 12px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.town-section-title {
  font-size: 0.85rem;
  font-weight: bold;
  margin-bottom: 8px;
}
.town-trade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.town-trade-rate {
  color: var(--color-text-dim);
  font-size: 0.68rem;
}

/* Town status tags */
.town-building-level-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.town-status-tag {
  font-size: 0.62rem;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: bold;
}
.town-status-building { background: rgba(212,168,73,0.2); color: var(--color-gold); }
.town-status-upgradeable { background: rgba(93,138,72,0.2); color: var(--color-success); }
.town-status-maxed { background: rgba(139,94,168,0.2); color: #b896d0; }
.town-status-unbuilt { background: rgba(255,255,255,0.08); color: var(--color-text-dim); }
.town-card-clickable { cursor: pointer; transition: var(--ease); }
.town-card-clickable:active { transform: scale(0.98); opacity: 0.9; }

/* ===========================================
   Building Detail Overlay (bdo-)
   =========================================== */
.bdo { padding: 4px 0; }
.bdo-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.bdo-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--color-surface-dark);
  padding: 4px;
  object-fit: contain;
}
.bdo-info h3 {
  margin: 0;
  font-size: 1.1rem;
}
.bdo-level-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: bold;
  background: rgba(212,168,73,0.2);
  color: var(--color-gold);
  margin-top: 2px;
}
.bdo-level-badge.bdo-unbuilt {
  background: rgba(255,255,255,0.08);
  color: var(--color-text-dim);
}
.bdo-desc {
  font-size: 0.78rem;
  color: var(--color-text-dim);
  margin: 0 0 10px;
}
/* Construction */
.bdo-construction {
  background: rgba(212,168,73,0.08);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 10px;
  text-align: center;
}
.bdo-construct-label {
  font-weight: bold;
  color: var(--color-gold);
  margin-bottom: 6px;
}
.bdo-progress-bar {
  height: 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.bdo-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #5d8a48, #7daa68);
  border-radius: 4px;
  transition: width 1s linear;
}
.bdo-construct-time {
  font-size: 0.72rem;
  color: var(--color-gold);
  margin-bottom: 6px;
}
.bdo-speed-btn {
  font-size: 0.72rem;
}
/* Sections */
.bdo-section {
  background: var(--color-surface-dark);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.bdo-section-title {
  font-size: 0.82rem;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--color-text);
}
.bdo-effect-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.bdo-effect-list li {
  font-size: 0.75rem;
  color: var(--color-success);
  padding: 2px 0;
}
.bdo-eff-new {
  color: #8BC34A !important;
}
/* Upgrade comparison */
.bdo-compare {
  margin: 8px 0;
}
.bdo-compare-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--color-text-dim);
  padding: 0 0 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 4px;
}
.bdo-compare-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 0.75rem;
}
.bdo-compare-label {
  flex: 1;
  color: var(--color-text-dim);
  font-size: 0.7rem;
}
.bdo-compare-cur {
  color: var(--color-text);
  min-width: 48px;
  text-align: right;
}
.bdo-compare-arrow {
  color: var(--color-text-dim);
  font-size: 0.65rem;
}
.bdo-compare-next {
  color: var(--color-text);
  min-width: 48px;
  text-align: right;
  font-weight: bold;
}
.bdo-compare-diff {
  color: var(--color-success);
  font-size: 0.68rem;
  font-weight: bold;
  min-width: 40px;
  text-align: right;
}
/* Cost */
.bdo-cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.bdo-cost-item {
  font-size: 0.78rem;
  color: var(--color-text);
}
.bdo-cost-item.bdo-cost-lack {
  color: var(--color-danger);
}
.bdo-build-time {
  font-size: 0.7rem;
  color: var(--color-text-dim);
  margin-bottom: 8px;
}
/* Upgrade button */
.bdo-upgrade-btn {
  width: 100%;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: bold;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--ease);
}
.bdo-upgrade-btn:hover:not(.disabled) {
  filter: brightness(1.15);
}
.bdo-upgrade-btn.disabled {
  background: var(--color-surface);
  color: var(--color-text-dim);
  cursor: not-allowed;
}
.bdo-lock-reason {
  font-size: 0.72rem;
  color: var(--color-danger);
  text-align: center;
  margin-top: 6px;
}
/* Prerequisites */
.bdo-prereqs {
  margin-top: 8px;
}
.bdo-prereq-item {
  font-size: 0.7rem;
  padding: 2px 0;
}
.bdo-prereq-ok { color: var(--color-success); }
.bdo-prereq-fail { color: var(--color-danger); }
/* Bottom actions */
.bdo-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.bdo-action-btn {
  flex: 1;
  font-size: 0.75rem;
}
/* Maxed */
.bdo-maxed {
  text-align: center;
  color: var(--color-gold);
  font-weight: bold;
  padding: 16px;
}
/* Building copy section */
.bdo-count-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: bold;
  background: rgba(93,138,72,0.2);
  color: var(--color-success);
  margin-left: 4px;
}
.bdo-copy-section {
  background: rgba(93,138,72,0.06);
  border: 1px solid rgba(93,138,72,0.15);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.bdo-copy-btn {
  width: 100%;
  margin-top: 6px;
  background: var(--color-success);
  color: #fff;
}
.bdo-copy-btn.disabled {
  background: rgba(93,138,72,0.2);
  color: var(--color-text-dim);
  cursor: not-allowed;
}
.bdo-copy-maxed {
  text-align: center;
  color: var(--color-text-dim);
  font-size: 0.78rem;
  padding: 4px;
}
.bdo-copy-hint {
  text-align: center;
  color: var(--color-gold);
  font-size: 0.72rem;
  margin-top: 4px;
}
/* Town panel count badge */
.town-count-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.62rem;
  font-weight: bold;
  background: rgba(93,138,72,0.2);
  color: var(--color-success);
  margin-left: 4px;
}
.town-copy-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.1);
}
.town-copy-btn {
  font-size: 0.72rem;
}
.btn-gold {
  background: rgba(212,168,73,0.2);
  color: var(--color-gold);
  border-color: rgba(212,168,73,0.3);
}
/* All levels table */
.bdo-all-levels {
  overflow-x: auto;
}
.bdo-levels-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
}
.bdo-levels-table th {
  background: var(--color-surface-dark);
  color: var(--color-text-dim);
  padding: 6px 4px;
  text-align: left;
  position: sticky;
  top: 0;
}
.bdo-levels-table td {
  padding: 5px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--color-text);
}
.bdo-levels-table .bdo-lv-cost {
  font-size: 0.65rem;
  color: var(--color-text-dim);
  white-space: nowrap;
}
.bdo-levels-table tr.bdo-lv-current {
  background: rgba(212,168,73,0.12);
}
.bdo-levels-table tr.bdo-lv-current td {
  color: var(--color-gold);
  font-weight: bold;
}
.bdo-levels-table tr.bdo-lv-next {
  background: rgba(93,138,72,0.08);
}

/* ===========================================
   Adventure Panel — 冒险系统
   =========================================== */
.adv-header {
  padding: 8px 12px;
  background: var(--color-surface-dark);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.adv-title {
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 6px;
  font-family: var(--font-title);
}
.adv-sub-tabs {
  display: flex;
  gap: 4px;
}
.adv-sub-btn {
  flex: 1;
  padding: 5px 4px;
  border: 1px solid var(--color-secondary);
  background: transparent;
  color: var(--color-text-dim);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--ease);
}
.adv-sub-btn.active {
  background: var(--color-secondary);
  color: var(--color-text);
}
.adv-region-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 0;
  margin-bottom: 8px;
}
.adv-region-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  font-size: 0.72rem;
  min-width: 60px;
  transition: var(--ease);
  position: relative;
}
.adv-region-btn.active {
  border-color: var(--color-gold);
  background: rgba(212, 168, 73, 0.1);
}
.adv-region-btn.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.adv-region-label {
  font-size: 0.65rem;
  white-space: nowrap;
}
.adv-recommended {
  position: absolute;
  top: -4px;
  right: -4px;
  color: var(--color-gold);
  font-size: 0.65rem;
}
.adv-region-detail {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.adv-region-name {
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.adv-region-desc {
  font-size: 0.72rem;
  color: var(--color-text-dim);
  margin-bottom: 6px;
}
.adv-multipliers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.adv-mult {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
}
.adv-mult.mult-high { color: var(--color-success); }
.adv-mult.mult-low { color: var(--color-danger); }
.adv-mult.mult-normal { color: var(--color-text-dim); }
.adv-mult-legend {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.65rem;
  opacity: 0.7;
}
.adv-map-nodes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
  justify-content: center;
}
.adv-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 32px;
}
.adv-node-id {
  font-size: 0.6rem;
  color: var(--color-text-dim);
}
.adv-node-icon {
  font-size: 0.85rem;
}
.adv-node.cleared .adv-node-icon { color: var(--color-success); }
.adv-node.current .adv-node-icon { color: var(--color-gold); animation: pulse-glow 2s infinite; }
.adv-node.locked .adv-node-icon { color: var(--color-text-muted); }
.adv-node.boss .adv-node-icon { color: var(--color-danger); }
.adv-node-connector {
  color: var(--color-text-muted);
  font-size: 0.6rem;
}
.adv-mode-switch {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.adv-mode-switch .btn {
  flex: 1;
}
.adv-recommendation {
  text-align: center;
  font-size: 0.72rem;
  color: var(--color-gold);
  padding: 6px;
  background: rgba(212, 168, 73, 0.08);
  border-radius: var(--radius-sm);
}
.adv-battle-view {
  padding: 8px;
}
.adv-battle-header {
  text-align: center;
  font-weight: bold;
  margin-bottom: 8px;
}
.adv-battle-scene {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 8px;
}
.adv-auto-indicator {
  font-size: 1rem;
  color: var(--color-gold);
  animation: pulse-glow 2s infinite;
  margin-bottom: 8px;
}
.adv-battle-stats {
  font-size: 0.75rem;
  color: var(--color-text-dim);
}
.adv-session-rewards {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.adv-section-title {
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--color-text-dim);
}
.adv-reward-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.75rem;
}
.adv-battle-controls {
  text-align: center;
}
.adv-push-info {
  text-align: center;
  padding: 30px 16px;
}
.adv-push-info p {
  margin-bottom: 8px;
}
.adv-stats {
  padding: 8px;
}
.adv-stats-current {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.adv-stat-row {
  font-size: 0.75rem;
  padding: 2px 0;
}
.adv-stats-efficiency {
  margin-top: 6px;
}
.adv-history-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.adv-empty {
  text-align: center;
  padding: 20px;
  color: var(--color-text-dim);
}

/* ===========================================
   Economy Panel — 经济系统
   =========================================== */
.eco-panel {
  padding: 4px;
}
.eco-summary {
  background: var(--color-surface-dark);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.eco-title {
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
  font-family: var(--font-title);
}
.eco-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.eco-summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
}
.eco-card-icon {
  font-size: 0.85rem;
}
.eco-card-net {
  font-size: 0.72rem;
  font-weight: bold;
}
.eco-chart-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.eco-chart-btn {
  flex: 1;
  padding: 5px 4px;
  border: 1px solid var(--color-secondary);
  background: transparent;
  color: var(--color-text-dim);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--ease);
}
.eco-chart-btn.active {
  background: var(--color-secondary);
  color: var(--color-text);
}
.eco-chart-container {
  background: var(--color-surface-dark);
  border-radius: var(--radius-md);
  padding: 8px;
  margin-bottom: 6px;
  text-align: center;
}
.eco-chart-container canvas {
  max-width: 100%;
}
.eco-filters {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 8px;
}
.eco-range-btn {
  padding: 4px 8px;
  border: 1px solid var(--color-secondary);
  background: transparent;
  color: var(--color-text-dim);
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  cursor: pointer;
  transition: var(--ease);
}
.eco-range-btn.active {
  background: var(--color-secondary);
  color: var(--color-text);
}
.eco-resource-select {
  margin-left: auto;
  padding: 4px 8px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
}
.eco-transactions {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.eco-section-title {
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--color-text-dim);
  text-align: center;
}
.eco-tx-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 0;
  font-size: 0.72rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.eco-tx-dir { width: 14px; text-align: center; }
.eco-tx-amount { width: 50px; text-align: right; font-weight: bold; }
.eco-tx-icon { width: 18px; }
.eco-tx-source { flex: 1; color: var(--color-text-dim); }
.eco-tx-time { color: var(--color-text-muted); font-size: 0.65rem; }
.eco-alerts {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.eco-alert-item {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  margin-bottom: 4px;
}
.eco-alert-warning {
  background: rgba(201, 138, 46, 0.1);
  color: var(--color-warning);
}
.eco-alert-error {
  background: rgba(179, 58, 58, 0.1);
  color: var(--color-danger);
}
.eco-alert-info {
  background: rgba(74, 127, 181, 0.1);
  color: var(--color-info);
}
.eco-alert-success {
  background: rgba(93, 138, 72, 0.1);
  color: var(--color-success);
}
.eco-suggestions {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.eco-suggestion-item {
  padding: 6px 8px;
  font-size: 0.75rem;
  border-left: 3px solid var(--color-gold);
  margin-bottom: 6px;
  padding-left: 10px;
}
.eco-empty {
  text-align: center;
  padding: 10px;
  color: var(--color-text-dim);
  font-size: 0.72rem;
}

/* =============================================
   NEW: Town World View
   ============================================= */
#town-world-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #2a3020;
}

#town-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Build FAB button */
.btn-fab {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--color-gold);
  background: var(--color-surface);
  color: var(--color-gold);
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
  z-index: 20;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-fab:active {
  transform: scale(0.92);
}

/* =============================================
   Build Queue Widget
   ============================================= */
.build-queue-widget {
  position: fixed;
  top: calc(var(--sat, 0px) + 52px);
  right: 8px;
  z-index: 30;
  font-family: var(--font-main);
  max-width: 280px;
}

/* Collapsed state */
.build-queue-collapsed .bqw-collapsed {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  color: var(--color-text);
  font-size: 0.78rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: background 0.15s;
}
.build-queue-collapsed .bqw-collapsed:hover {
  background: var(--color-secondary);
}
.bqw-icon { font-size: 1rem; }
.bqw-idle { color: var(--color-text-dim); font-size: 0.72rem; }
.bqw-progress-mini { display: inline-flex; align-items: center; gap: 4px; }
.bqw-progress-bar-mini {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}
.bqw-progress-fill-mini {
  height: 100%;
  background: var(--color-gold);
  border-radius: 2px;
  transition: width 0.3s;
}
.bqw-time-mini { color: var(--color-gold); font-size: 0.7rem; }

/* Expanded state */
.build-queue-expanded {
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-top: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  max-height: 60vh;
  overflow-y: auto;
}
.bqw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-secondary);
}
.bqw-title {
  font-size: 0.85rem;
  color: var(--color-gold);
  font-weight: bold;
}
.bqw-close {
  background: none;
  border: none;
  color: var(--color-text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-main);
}
.bqw-close:hover { color: var(--color-text); }

.bqw-section {
  padding: 8px 12px;
}
.bqw-section + .bqw-section {
  border-top: 1px solid var(--color-secondary);
}
.bqw-section-title {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin-bottom: 6px;
}

/* Active build cards */
.bqw-active-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-bottom: 6px;
}
.bqw-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--color-text);
  margin-bottom: 4px;
}
.bqw-cancel-active {
  background: none;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-size: 0.65rem;
  cursor: pointer;
  font-family: var(--font-main);
}
.bqw-cancel-active:hover { background: var(--color-danger); color: #fff; }

.bqw-progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bqw-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.bqw-progress-fill {
  height: 100%;
  background: var(--color-gold);
  border-radius: 3px;
  transition: width 0.5s;
}
.bqw-time {
  font-size: 0.7rem;
  color: var(--color-gold);
  min-width: 42px;
  text-align: right;
}

.bqw-workers-info {
  font-size: 0.72rem;
  color: var(--color-text-dim);
  text-align: right;
  margin-top: 4px;
}

/* Queue items */
.bqw-queue-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bqw-queue-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.75rem;
  color: var(--color-text);
  cursor: grab;
  transition: background 0.15s, opacity 0.15s;
}
.bqw-queue-item:hover {
  background: rgba(255,255,255,0.06);
}
.bqw-queue-item.bqw-dragging {
  opacity: 0.4;
  background: rgba(245,197,24,0.1);
}
.bqw-drag-handle {
  cursor: grab;
  color: var(--color-text-dim);
  font-size: 0.9rem;
  user-select: none;
  -webkit-user-select: none;
}
.bqw-queue-name { flex: 1; }
.bqw-remove-queue {
  background: none;
  border: none;
  color: var(--color-text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 2px;
  line-height: 1;
}
.bqw-remove-queue:hover { color: var(--color-danger); }

.bqw-empty {
  font-size: 0.72rem;
  color: var(--color-text-dim);
  text-align: center;
  padding: 8px 0;
}
.bqw-guide { font-style: italic; }

/* =============================================
   NEW: Bottom Navigation Bar
   ============================================= */
#bottom-nav {
  position: relative;
  flex-shrink: 0;
  z-index: 60;
}

.bnav-bar {
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-secondary);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px 4px;
  background: none;
  border: none;
  border-right: 1px solid var(--color-secondary);
  color: var(--color-text-dim);
  font-family: var(--font-main);
  cursor: pointer;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bnav-btn:last-child { border-right: none; }
.bnav-btn:active { color: var(--color-gold); }
.bnav-btn.active { color: var(--color-gold); }
.bnav-btn.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--color-gold);
  border-radius: 1px;
}

.bnav-icon { font-size: 1.3rem; line-height: 1; }
.bnav-label { font-size: 0.62rem; margin-top: 2px; }

/* More popup menu */
.bnav-more-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-secondary);
  border-top: 2px solid var(--color-primary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  padding: 4px 0;
  z-index: 70;
}
.bnav-more-menu.active { display: flex; }

.bnav-more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--color-text);
  font-family: var(--font-main);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s;
}
.bnav-more-item:hover {
  background: rgba(212, 168, 73, 0.06);
  border-left: 3px solid var(--color-primary);
  padding-left: 13px;
}
.bnav-more-icon { font-size: 1.2rem; }
.bnav-more-label { font-size: 0.82rem; }

/* =============================================
   NEW: Overlay Panel System
   ============================================= */
.overlay-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.overlay-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay-panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  background: var(--color-bg);
  border-top: 2px solid var(--color-primary);
  border-left: 1px solid var(--color-secondary);
  border-right: 1px solid var(--color-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 90;
  transition: transform 0.3s cubic-bezier(0.22, 0.68, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.overlay-panel.active {
  transform: translateX(-50%) translateY(0);
}

/* Height variants */
.overlay-panel.overlay-half { max-height: 55vh; }
.overlay-panel.overlay-full { max-height: 85vh; }
.overlay-panel.overlay-auto { max-height: 70vh; }

/* Drag handle */
.overlay-handle {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
  cursor: grab;
}
.overlay-handle span {
  display: block;
  width: 40px;
  height: 3px;
  background: var(--color-gold);
  border-radius: var(--radius-pill);
  opacity: 0.6;
}

/* Overlay header */
.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 8px;
  border-bottom: 1px solid var(--color-secondary);
  flex-shrink: 0;
  background: var(--color-surface);
  position: relative;
}

/* 标题栏回纹角饰 */
.overlay-header::before,
.overlay-header::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
  opacity: 0.3;
}
.overlay-header::before {
  bottom: 0; left: 0;
  border-bottom: 2px solid var(--color-gold);
  border-left: 2px solid var(--color-gold);
}
.overlay-header::after {
  bottom: 0; right: 0;
  border-bottom: 2px solid var(--color-gold);
  border-right: 2px solid var(--color-gold);
}
.overlay-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-gold);
  font-family: var(--font-title);
  text-shadow: 0 0 8px rgba(212, 168, 73, 0.2);
}
.overlay-close {
  background: none;
  border: none;
  color: var(--color-gold);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.7;
  transition: color var(--ease), opacity var(--ease);
}
.overlay-close:hover { color: var(--color-primary); opacity: 1; }

/* Overlay content */
.overlay-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
  background-image: var(--bg-parchment);
}

/* 战斗面板固定布局 — 日志不撑高整体 */
.overlay-content:has(#panel-battle) {
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}
#panel-battle {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#panel-battle.game-panel.active {
  display: flex;
}

/* When game panel is inside overlay, show it */
.overlay-content .game-panel {
  display: block !important;
}
.overlay-content #panel-battle {
  display: flex !important;
}

/* =============================================
   NEW: Building Detail Overlay Styles
   ============================================= */
.building-detail-overlay {
  text-align: center;
}
.bdo-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 12px;
}
.bdo-icon {
  width: 72px;
  height: 72px;
  border: 2px solid var(--color-secondary);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 4px;
}
.bdo-info {
  text-align: left;
}
.bdo-info h3 {
  font-size: 1.1rem;
  color: var(--color-gold);
}
.bdo-level {
  font-size: 0.85rem;
  color: var(--color-text-dim);
  background: var(--color-surface);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.bdo-desc {
  text-align: left;
  color: var(--color-text-dim);
  font-size: 0.78rem;
  margin: 8px 0;
  line-height: 1.4;
}
.bdo-effects {
  text-align: left;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin: 8px 0;
}
.bdo-effects h4 {
  font-size: 0.82rem;
  color: var(--color-gold);
  margin-bottom: 4px;
}
.bdo-effects ul {
  list-style: none;
  padding: 0;
}
.bdo-effects li {
  font-size: 0.76rem;
  color: var(--color-text);
  padding: 2px 0;
}
.bdo-building {
  margin: 10px 0;
}
.bdo-progress-bar {
  height: 10px;
  background: var(--color-surface);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 6px;
}
.bdo-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), #66BB6A);
  border-radius: var(--radius-pill);
  transition: width 0.3s;
}
.bdo-upgrade {
  margin: 12px 0;
  padding: 10px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
}
.bdo-upgrade h4 {
  font-size: 0.85rem;
  color: var(--color-gold);
  margin-bottom: 6px;
}
.bdo-cost {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.76rem;
}
.bdo-cost span {
  background: var(--color-surface-dark);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.btn-upgrade {
  width: 100%;
  padding: 10px;
  font-size: 0.9rem;
  background: linear-gradient(135deg, var(--color-success), #2E7D32);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-main);
  font-weight: 600;
  cursor: pointer;
}
.btn-upgrade.disabled {
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.btn-move {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  font-size: 0.82rem;
  background: none;
  border: 1px solid var(--color-secondary);
  border-radius: var(--radius-md);
  color: var(--color-text-dim);
  font-family: var(--font-main);
  cursor: pointer;
}
.btn-move:hover { border-color: var(--color-gold); color: var(--color-gold); }

/* =============================================
   NEW: Build Menu Styles
   ============================================= */
.build-menu { padding: 4px 0; }
.bm-manage-bar {
  margin-bottom: 10px;
  text-align: center;
}
.bm-manage-btn {
  width: 100%;
  padding: 8px 0 !important;
  font-size: 0.85rem !important;
  background: var(--color-secondary);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
}
.bm-manage-btn:active {
  background: var(--color-gold);
  color: var(--color-bg);
}
.bm-item.built { opacity: 1; }
.bm-category { margin-bottom: 12px; }
.bm-cat-title {
  font-size: 0.82rem;
  color: var(--color-gold);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-secondary);
}
.bm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-secondary);
}
.bm-item.built { opacity: 0.6; }
.bm-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-secondary);
  background: var(--color-surface-dark);
  padding: 2px;
}
.bm-info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bm-name { font-size: 0.82rem; color: var(--color-text); }
.bm-level { font-size: 0.72rem; color: var(--color-success); }
.bm-locked { font-size: 0.72rem; color: var(--color-text-muted); }
.btn-sm {
  padding: 4px 12px;
  font-size: 0.72rem;
  background: var(--color-success);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-main);
}

/* ═══ Mythic Quality (品质6 - 神话) ═══ */
.quality-mythic {
  color: #ff2222;
  text-shadow: 0 0 6px rgba(255, 34, 34, 0.5);
  animation: mythic-pulse 2s ease-in-out infinite;
}
@keyframes mythic-pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(255, 34, 34, 0.5); }
  50% { text-shadow: 0 0 12px rgba(255, 34, 34, 0.8), 0 0 20px rgba(255, 34, 34, 0.3); }
}
.mythic-border {
  border: 1px solid rgba(255, 34, 34, 0.3);
  box-shadow: inset 0 0 8px rgba(255, 34, 34, 0.1);
}

/* ===========================================
   无尽试炼 (Roguelike Panel)
   =========================================== */
.rl-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; margin-bottom: 8px; font-size: 0.8rem;
}
.rl-best { color: var(--color-gold); }
.rl-runs { color: var(--color-text-dim); }
.rl-start-area { text-align: center; padding: 30px 20px; }
.rl-floor-label {
  text-align: center; font-size: 1rem; font-weight: bold;
  color: var(--color-gold); margin-bottom: 10px;
}
.rl-team-row {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
}
.rl-vs {
  text-align: center; font-size: 1.2rem; margin: 6px 0;
}
.rl-unit {
  width: 56px; text-align: center; padding: 4px;
  border-radius: 6px; background: rgba(255,255,255,0.04);
  transition: opacity 0.3s;
}
.rl-unit.rl-dead { opacity: 0.3; }
.rl-unit-emoji { font-size: 1.3rem; }
.rl-unit-name { font-size: 0.55rem; color: var(--color-text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-unit-hp-bar {
  width: 100%; height: 4px; background: rgba(255,255,255,0.1);
  border-radius: 2px; margin-top: 3px; overflow: hidden;
}
.rl-unit-hp-fill {
  height: 100%; background: var(--color-success); border-radius: 2px;
  transition: width 0.3s;
}
.rl-unit-hp-fill.enemy { background: var(--color-danger); }
.rl-buffs-summary {
  font-size: 0.7rem; color: var(--color-text-dim);
  text-align: center; margin: 8px 0;
}
.rl-choosing { padding: 10px 0; }
.rl-choices { display: flex; gap: 8px; justify-content: center; }
.rl-choice-card {
  flex: 1; max-width: 120px; text-align: center; padding: 12px 8px;
  border-radius: 10px; background: var(--color-secondary);
  border: 2px solid var(--color-gold)44; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.rl-choice-card:hover { transform: scale(1.05); box-shadow: 0 0 12px rgba(245,197,24,0.3); }

/* ===========================================
   UI Icons — PNG 图标内联样式
   =========================================== */
.ui-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  object-fit: contain;
  pointer-events: none;
}
.ui-icon-sm { width: 0.85em; height: 0.85em; }
.ui-icon-lg { width: 1.4em; height: 1.4em; }
.ui-icon-xl { width: 1.8em; height: 1.8em; }
.ui-icon-nav { width: 24px; height: 24px; vertical-align: middle; }

/* Bottom nav icon override */
.bnav-icon .ui-icon,
.bnav-more-icon .ui-icon {
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

/* Resources bar icon */
.res-item .ui-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 1px;
}
.rl-choice-card:active { transform: scale(0.95); }
.rl-choice-icon { font-size: 1.5rem; margin-bottom: 4px; }
.rl-choice-name { font-size: 0.85rem; font-weight: bold; color: var(--color-gold); }
.rl-choice-desc { font-size: 0.65rem; color: var(--color-text-dim); margin-top: 4px; }
.rl-end-screen { text-align: center; padding: 20px; }
.rl-rewards {
  display: flex; gap: 12px; justify-content: center;
  font-size: 0.85rem; margin-top: 10px;
}

/* ===== 每日挑战 ===== */
.dc-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 0.8rem;
}
.dc-date { color: var(--color-gold); }
.dc-attempts { color: var(--color-text-dim); }
.dc-stats {
  display: flex; gap: 16px; font-size: 0.75rem;
  color: var(--color-text-dim); margin-bottom: 10px;
}
.dc-start-area { text-align: center; padding: 30px 20px; }
.dc-round {
  text-align: center; font-size: 0.9rem; font-weight: bold;
  color: var(--color-gold); margin-bottom: 8px;
}
.dc-end-screen { text-align: center; padding: 20px; }

/* ===========================================
   庆祝覆盖层 (Celebration Overlay)
   =========================================== */
.celebration-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: celebrationFadeIn 0.4s ease;
}
.celebration-overlay.celebration-exit {
  animation: celebrationFadeOut 0.3s ease forwards;
}

.celebration-content {
  text-align: center;
  position: relative;
  padding: 40px 30px;
  max-width: 340px;
  width: 85%;
}

.celebration-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: celebrationBounce 0.6s ease;
}

.celebration-hero-emoji {
  font-size: 5rem;
  margin-bottom: 12px;
  animation: celebrationBounce 0.6s ease;
  filter: drop-shadow(0 0 20px var(--quality-color, #a855f7));
}

.celebration-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-gold);
  margin-bottom: 8px;
  font-family: 'STZhongsong', 'SimSun', 'Noto Serif SC', serif;
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.5);
  animation: celebrationSlideUp 0.5s ease 0.2s both;
}

.celebration-subtitle {
  font-size: 1rem;
  color: #e8dcc8;
  margin-bottom: 6px;
  animation: celebrationSlideUp 0.5s ease 0.3s both;
}

.celebration-boss {
  font-size: 0.85rem;
  color: var(--color-danger);
  margin-top: 10px;
  animation: celebrationSlideUp 0.5s ease 0.4s both;
}

.celebration-hero-quality {
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 4px;
  animation: celebrationSlideUp 0.5s ease 0.15s both;
}

.celebration-hero-title {
  font-size: 0.85rem;
  color: #a09080;
  margin-bottom: 4px;
  animation: celebrationSlideUp 0.5s ease 0.35s both;
}

.celebration-hero-faction {
  font-size: 0.8rem;
  color: #ccc;
  margin-top: 8px;
  animation: celebrationSlideUp 0.5s ease 0.4s both;
}

.celebration-desc {
  font-size: 0.8rem;
  color: #a09080;
  margin-top: 6px;
  animation: celebrationSlideUp 0.5s ease 0.4s both;
}

.celebration-hint {
  font-size: 0.7rem;
  color: #666;
  margin-top: 24px;
  animation: celebrationPulse 2s ease-in-out infinite;
}

/* 粒子效果 */
.celebration-particles {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  pointer-events: none;
}
.celebration-particles .particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-gold);
  animation: celebrationParticle 1.5s ease-out calc(var(--i) * 0.05s) both;
}
.celebration-particles .particle:nth-child(odd) {
  background: var(--quality-color, var(--color-primary));
}

@keyframes celebrationFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes celebrationFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes celebrationBounce {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes celebrationSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes celebrationPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
@keyframes celebrationParticle {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(
      calc(cos(calc(var(--i) * 18deg)) * 120px),
      calc(sin(calc(var(--i) * 18deg)) * 120px)
    ) scale(0);
    opacity: 0;
  }
}

/* ===========================================
   招募演出动画 (CAP-ERH-10 ~ CAP-ERH-15)
   =========================================== */

/* 全屏演出遮罩 */
.recruit-reveal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  background: rgba(0,0,0,0.95);
  animation: recruit-fade-in 0.3s ease;
  cursor: pointer;
}
@keyframes recruit-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 卡片弹出动画 */
.recruit-card-reveal {
  text-align: center;
  padding: 30px;
  animation: recruit-card-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes recruit-card-pop {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Q1-Q2 快速翻牌 */
.recruit-q1q2-flip {
  animation: recruit-flip 0.3s ease;
}
@keyframes recruit-flip {
  0%   { transform: rotateY(90deg); opacity: 0; }
  100% { transform: rotateY(0deg);  opacity: 1; }
}

/* Q3 蓝光脉冲 */
.recruit-q3-glow {
  animation: recruit-q3-pulse 0.8s ease-in-out;
}
@keyframes recruit-q3-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(74, 127, 181, 0); }
  50%      { box-shadow: 0 0 30px rgba(74, 127, 181, 0.65), 0 0 60px rgba(74, 127, 181, 0.25); }
}

/* Q4 裂缝效果 */
.recruit-crack {
  width: 4px; height: 0;
  background: var(--color-gold, #d4a849);
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: recruit-crack-grow 0.6s ease-out forwards;
  box-shadow: 0 0 20px var(--color-gold, #d4a849), 0 0 40px rgba(212, 168, 73, 0.4);
}
@keyframes recruit-crack-grow {
  to { height: 80vh; }
}

/* Q5 天道系统弹窗 */
.recruit-tiandao-alert {
  background: var(--color-surface, #2a2018);
  border: 2px solid var(--color-warning, #c98a2e);
  border-radius: 12px;
  padding: 20px 30px;
  text-align: center;
  color: var(--color-text, #e8dcc8);
  animation: recruit-card-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 40px rgba(201, 138, 46, 0.3);
}

/* Q5 故障效果 — 整个 body 添加此 class */
.recruit-glitch {
  animation: recruit-glitch-anim 0.1s infinite;
}
@keyframes recruit-glitch-anim {
  0%   { filter: none;                              transform: translate(0); }
  20%  { filter: hue-rotate(90deg);                 transform: translate(-2px, 1px); }
  40%  { filter: hue-rotate(180deg) saturate(2);    transform: translate(1px, -1px); }
  60%  { filter: hue-rotate(270deg);                transform: translate(-1px, 2px); }
  80%  { filter: hue-rotate(0deg) brightness(1.5);  transform: translate(2px, -2px); }
  100% { filter: none;                              transform: translate(0); }
}

/* Q5 粒子 */
.recruit-particle {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-gold, #d4a849);
  pointer-events: none;
  animation: recruit-particle-float 2s ease-out forwards;
}
@keyframes recruit-particle-float {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-100px) scale(0.3); }
}

/* Q5 渐变金背景 */
.recruit-q5-bg {
  background: linear-gradient(180deg, rgba(0,0,0,0.95) 0%, rgba(60,40,10,0.95) 50%, rgba(0,0,0,0.95) 100%) !important;
}

/* Q5 emoji 发光 */
.recruit-q5-emoji-glow {
  animation: recruit-q5-glow 1.5s ease-in-out infinite;
}
@keyframes recruit-q5-glow {
  0%, 100% { text-shadow: 0 0 10px rgba(212, 168, 73, 0.3); }
  50%      { text-shadow: 0 0 30px rgba(212, 168, 73, 0.8), 0 0 60px rgba(212, 168, 73, 0.4); }
}

/* 跳过提示 */
.recruit-skip-hint {
  position: absolute;
  bottom: 20px;
  left: 50%; transform: translateX(-50%);
  color: #666;
  font-size: 0.75rem;
  animation: recruit-blink 1.5s infinite;
  pointer-events: none;
}
@keyframes recruit-blink {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* 保底文案 */
.recruit-pity-text {
  position: absolute;
  bottom: 60px;
  left: 50%; transform: translateX(-50%);
  color: var(--color-gold, #d4a849);
  font-size: 0.9rem;
  white-space: nowrap;
  animation: recruit-pity-fade 1.5s ease forwards;
  pointer-events: none;
}
@keyframes recruit-pity-fade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* 十连翻牌 mini 卡片 */
.recruit-ten-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-width: 360px;
  margin: 0 auto;
}
.recruit-ten-card {
  text-align: center;
  padding: 6px 2px;
  border-radius: 6px;
  background: var(--color-secondary, #4a3728);
  border: 2px solid var(--quality-1, #b0a898);
  opacity: 0;
  animation: recruit-flip 0.3s ease forwards;
}
.recruit-ten-card.revealed {
  opacity: 1;
}

/* ===========================================
   Element & Role Badges
   =========================================== */
.hero-element, .hero-role {
  display: inline-block;
  font-size: 0.65em;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  background: rgba(0,0,0,0.3);
}
.team-element-summary {
  text-align: center;
  padding: 4px 0;
  margin-top: 6px;
  font-size: 0.82em;
  color: var(--color-text-dim);
}
.team-role-warning {
  text-align: center;
  padding: 6px 8px;
  margin: 4px 0;
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 6px;
  color: #e74c3c;
  font-size: 0.85em;
}
.team-role-summary {
  text-align: center;
  padding: 4px 0;
  font-size: 0.85em;
  color: var(--color-text-dim);
}
.hero-role-filter {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.role-filter-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--color-secondary);
  border-radius: 12px;
  background: transparent;
  color: var(--color-text-dim);
  font-size: 0.8em;
  cursor: pointer;
}
.role-filter-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Boss Mechanic UI */
.boss-mechanics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin: 4px 0;
}
.mechanic-tag {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.75em;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--color-text);
}
.strategy-tip {
  text-align: center;
  padding: 4px 8px;
  margin: 4px 0;
  font-size: 0.8em;
  color: var(--color-gold);
  background: rgba(245, 197, 24, 0.1);
  border-radius: 6px;
}
.active-mechanics {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 2px 0;
}
.mechanic-active {
  font-size: 0.75em;
  padding: 1px 4px;
  border-radius: 3px;
  animation: pulse-mechanic 1.5s infinite;
}
.mechanic-active.enraged {
  background: rgba(231, 76, 60, 0.3);
  color: #e74c3c;
}
@keyframes pulse-mechanic {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===========================================
   Pachinko (弹珠)
   =========================================== */
.pachinko-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px;
}
.pachinko-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--color-surface-dark);
  border-radius: 6px;
  border: 1px solid var(--color-secondary);
}
.pachinko-jade {
  font-size: 1rem;
  font-weight: bold;
  color: var(--color-gold);
}
.pachinko-cost {
  font-size: 0.78rem;
  color: var(--color-text-dim);
}
.pachinko-canvas-wrap {
  display: flex;
  justify-content: center;
  background: #0d0d1a;
  border-radius: 8px;
  border: 2px solid var(--color-secondary);
  overflow: hidden;
}
.pachinko-canvas-wrap canvas {
  display: block;
  max-width: 100%;
}
.pachinko-actions {
  display: flex;
  justify-content: center;
}
.pachinko-launch-btn {
  font-size: 1.1rem;
  padding: 10px 40px;
  background: linear-gradient(135deg, var(--color-gold) 0%, #c0942e 100%);
  color: #1a1410;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(212, 168, 73, 0.3);
}
.pachinko-launch-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(212, 168, 73, 0.5);
}
.pachinko-launch-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pachinko-result {
  text-align: center;
  min-height: 24px;
}
.pachinko-result-text {
  font-size: 1rem;
  font-weight: bold;
  animation: pachinko-result-in 0.3s ease-out;
}
@keyframes pachinko-result-in {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.pachinko-stats {
  background: var(--color-surface-dark);
  border-radius: 6px;
  padding: 8px;
  border: 1px solid var(--color-secondary);
}
.pachinko-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.pachinko-stat {
  text-align: center;
}
.pachinko-stat-label {
  display: block;
  font-size: 0.68rem;
  color: var(--color-text-dim);
}
.pachinko-stat-value {
  display: block;
  font-size: 0.88rem;
  font-weight: bold;
  color: var(--color-text);
}
.pachinko-history-toggle {
  background: var(--color-surface-dark);
  border-radius: 6px;
  padding: 8px;
  border: 1px solid var(--color-secondary);
}
.pachinko-history-toggle summary {
  cursor: pointer;
  color: var(--color-text-dim);
  font-size: 0.8rem;
}
.pachinko-history-item {
  padding: 3px 0;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
