/* ============================================================
   大闹天宫 — Havoc in Heaven
   Top-Down Survival Roguelike — DOM Overlay Styles
   ============================================================ */

/* ---- Hide site nav on game page ---- */
body.game-active .site-nav { display: none !important; }
body.game-active { background: #0a0604; overflow: hidden; margin: 0; padding: 0; }

/* ---- Canvas Container ---- */
#game-wrapper {
  position: fixed;
  inset: 0;
  z-index: 1;
}
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- HUD (above canvas) ---- */
#game-hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
}
.hud-left { display: flex; flex-direction: column; gap: 6px; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* HP Bar */
.hp-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hp-label-text {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: #e8b0a0;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.hp-outer {
  width: 160px;
  height: 12px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(196,77,52,0.4);
  border-radius: 6px;
  overflow: hidden;
}
.hp-inner {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #c44d34, #e06040);
  transition: width 0.3s ease;
}
.hp-num {
  font-size: 0.75rem;
  color: rgba(232,220,200,0.8);
  font-family: monospace;
  min-width: 55px;
}

/* XP Bar */
.xp-outer {
  width: 160px;
  height: 6px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(184,160,110,0.3);
  border-radius: 3px;
  overflow: hidden;
}
.xp-inner {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #7ab86e, #a0d890);
  transition: width 0.3s ease;
}

/* Level + Wave */
.hud-stat {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: rgba(232,220,200,0.7);
  letter-spacing: 2px;
}
.hud-stat span { color: var(--accent-gold); }

/* Upgrade icons row */
.upgrade-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 200px;
  justify-content: flex-end;
}
.upgrade-icon {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(184,160,110,0.4);
  background: rgba(184,160,110,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--accent-gold);
}

/* ---- Upgrade Selection Overlay ---- */
#upgrade-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10,6,4,0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#upgrade-overlay.active { display: flex; }
.upgrade-title {
  font-family: var(--font-chinese-display);
  font-size: 1.6rem;
  color: var(--accent-gold);
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(184,160,110,0.3);
}
.upgrade-sub {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: rgba(200,180,140,0.5);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.upgrade-cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 720px;
}
.upgrade-card {
  width: 200px;
  background: rgba(35,26,14,0.95);
  border: 2px solid rgba(184,160,110,0.25);
  border-radius: 12px;
  padding: 20px 16px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease;
}
.upgrade-card:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 0 24px rgba(184,160,110,0.25);
  transform: translateY(-4px);
}
.upgrade-card .uc-rarity {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.uc-rarity.common { color: #8a8a7a; }
.uc-rarity.uncommon { color: #7ab86e; }
.uc-rarity.rare { color: #5a9ad4; }
.uc-rarity.legendary { color: #d4a040; }
.upgrade-card .uc-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #e8d5b0;
  margin-bottom: 2px;
  letter-spacing: 1px;
}
.upgrade-card .uc-sub {
  font-family: var(--font-chinese-display);
  font-size: 0.75rem;
  color: var(--accent-gold);
  margin-bottom: 10px;
}
.upgrade-card .uc-desc {
  font-size: 0.75rem;
  color: rgba(200,180,140,0.6);
  line-height: 1.5;
}

/* ---- Death Screen ---- */
#death-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10,6,4,0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
#death-overlay.active { display: flex; }
.death-title {
  font-family: var(--font-chinese-display);
  font-size: 2.4rem;
  color: #c44d34;
  margin-bottom: 12px;
  text-shadow: 0 0 30px rgba(196,77,52,0.3);
}
.death-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 20px;
}
.death-stat {
  text-align: center;
}
.death-stat-val {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: #e8d5b0;
}
.death-stat-label {
  font-size: 0.7rem;
  color: rgba(200,180,140,0.5);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.death-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}
.death-links a {
  font-size: 0.82rem;
  color: var(--accent-gold);
  text-decoration: none;
  padding: 8px 18px;
  border: 1px solid rgba(184,160,110,0.3);
  border-radius: 20px;
  transition: all 0.25s;
}
.death-links a:hover {
  border-color: var(--accent-gold);
  background: rgba(184,160,110,0.08);
}

/* ---- Mobile Controls ---- */
#mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: none;
}
@media (max-width: 767px) {
  #mobile-controls { display: block; }
}
.mobile-joystick {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 173px;
  height: 173px;
  background: rgba(184,160,110,0.1);
  border: 2px solid rgba(184,160,110,0.4);
  border-radius: 50%;
  pointer-events: auto;
  box-shadow: 0 0 30px rgba(184,160,110,0.08);
}
.mobile-joystick-knob {
  position: absolute;
  width: 48px;
  height: 48px;
  background-image: url(../../../images/sun-wukong/sun-wukong-ice.jpg);
  background-size: cover;
  background-position: center 20%;
  border: 3px solid rgba(184,160,110,0.8);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: none;
  box-shadow: 0 0 18px rgba(184,160,110,0.3);
}
/* ---- Pause Hint ---- */
.pause-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  font-size: 0.7rem;
  color: rgba(200,180,140,0.3);
  letter-spacing: 2px;
  pointer-events: none;
}

/* ---- Death Screen Enhanced ---- */
.death-img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 3px solid rgba(196,77,52,0.6);
  box-shadow: 0 0 40px rgba(196,77,52,0.3), 0 0 80px rgba(196,77,52,0.1);
  margin-bottom: 16px;
  animation: death-img-pulse 2s ease-in-out infinite;
}
@keyframes death-img-pulse {
  0%, 100% { box-shadow: 0 0 40px rgba(196,77,52,0.3), 0 0 80px rgba(196,77,52,0.1); }
  50% { box-shadow: 0 0 60px rgba(196,77,52,0.5), 0 0 120px rgba(196,77,52,0.2); }
}
.death-title-main {
  font-family: var(--font-chinese-display);
  font-size: 2.6rem;
  color: #c44d34;
  text-shadow: 0 0 30px rgba(196,77,52,0.4);
  margin-bottom: 6px;
  animation: death-title-shake 0.6s ease-out;
}
@keyframes death-title-shake {
  0% { transform: translateX(-20px); opacity: 0; }
  30% { transform: translateX(12px); }
  60% { transform: translateX(-6px); }
  100% { transform: translateX(0); opacity: 1; }
}
.death-title-sub {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--accent-gold);
  text-shadow: 0 0 12px rgba(184,160,110,0.3);
  letter-spacing: 2px;
  margin-bottom: 24px;
}

/* ---- Level-Up Celebration ---- */
#celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(10,6,4,0.8);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#celebrate-overlay.active { display: flex; }
.celebrate-img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 4px solid rgba(184,160,110,0.8);
  box-shadow: 0 0 60px rgba(184,160,110,0.5), 0 0 120px rgba(184,160,110,0.2);
  animation: celebrate-bounce 0.6s ease-out;
}
@keyframes celebrate-bounce {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.celebrate-text {
  font-family: var(--font-chinese-display);
  font-size: 2.4rem;
  color: var(--accent-gold);
  text-shadow: 0 0 40px rgba(184,160,110,0.6), 0 0 80px rgba(184,160,110,0.3);
  margin-top: 20px;
  animation: celebrate-text-glow 0.8s ease-in-out infinite alternate;
}
@keyframes celebrate-text-glow {
  0% { text-shadow: 0 0 40px rgba(184,160,110,0.6); }
  100% { text-shadow: 0 0 80px rgba(255,215,0,0.9), 0 0 120px rgba(184,160,110,0.5); }
}
.celebrate-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ---- Pause hint update ---- */
.pause-hint {
  bottom: 16px;
  left: 50%;
  z-index: 15;
  font-size: 0.65rem;
  color: rgba(200,180,140,0.25);
  letter-spacing: 2px;
  pointer-events: none;
}
