
#turn-miasma-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  display: none; /* toggled by JS */
}

#turn-miasma-message {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(92vw, 840px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(231, 210, 156, 0.55);
  color: #f4ead0;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(12px, 1.7vw, 15px);
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.turn-edge-glyph {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 440px;
  transform: translateY(-50%);
  transition: filter 180ms ease, opacity 180ms ease;
}

#turn-edge-glyph-left {
  left: 0;
}

#turn-edge-glyph-right {
  right: 0;
}

.turn-edge-glyph::before,
.turn-edge-glyph::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(192, 192, 192, 0.28);
  box-shadow: 0 0 6px rgba(140, 140, 140, 0.2);
  transition: background 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.turn-edge-glyph::before {
  top: 8px;
  height: calc(50% - 18px);
}

.turn-edge-glyph::after {
  top: calc(50% + 10px);
  height: calc(50% - 18px);
}

.turn-edge-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(216, 216, 216, 0.55);
  background: rgba(170, 170, 170, 0.26);
  box-shadow: 0 0 8px rgba(130, 130, 130, 0.26);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

#turn-miasma-overlay.my-turn .turn-edge-glyph::after {
  background: rgba(64, 214, 110, 0.92);
  box-shadow: 0 0 12px rgba(64, 214, 110, 0.74), 0 0 24px rgba(64, 214, 110, 0.4);
}

#turn-miasma-overlay.my-turn .turn-edge-core {
  border-color: rgba(112, 237, 148, 0.96);
  background: rgba(64, 214, 110, 0.92);
  box-shadow: 0 0 12px rgba(64, 214, 110, 0.74), 0 0 26px rgba(64, 214, 110, 0.48);
}

#turn-miasma-overlay.their-turn .turn-edge-glyph::before {
  background: rgba(222, 72, 72, 0.92);
  box-shadow: 0 0 12px rgba(222, 72, 72, 0.72), 0 0 24px rgba(222, 72, 72, 0.42);
}

#turn-miasma-overlay.their-turn .turn-edge-core {
  border-color: rgba(237, 122, 122, 0.96);
  background: rgba(222, 72, 72, 0.9);
  box-shadow: 0 0 12px rgba(222, 72, 72, 0.72), 0 0 26px rgba(222, 72, 72, 0.48);
}

#turn-miasma-overlay.my-turn .turn-edge-core,
#turn-miasma-overlay.their-turn .turn-edge-core,
#turn-miasma-overlay.my-turn .turn-edge-glyph::before,
#turn-miasma-overlay.my-turn .turn-edge-glyph::after,
#turn-miasma-overlay.their-turn .turn-edge-glyph::before,
#turn-miasma-overlay.their-turn .turn-edge-glyph::after {
  animation: turnEdgePulse 1.6s ease-in-out infinite;
}

@keyframes turnEdgePulse {
  0% {
    opacity: 0.82;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.82;
  }
}

/* ====================================
   Game Over Overlay
   ==================================== */

#game-over-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#game-over-overlay.active {
  display: flex;
  animation: gameOverBackdropIn 0.5s ease-out forwards;
}

@keyframes gameOverBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#game-over-title {
  font-family: Georgia, serif;
  font-size: clamp(56px, 10vw, 112px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 6px;
  line-height: 1;
  text-align: center;
  animation: gameOverTitlePop 0.8s cubic-bezier(0.22, 1.6, 0.5, 1) 0.2s both;
}

#game-over-overlay.won #game-over-title {
  color: #ffd700;
  text-shadow:
    0 0 30px rgba(255, 220, 60, 0.90),
    0 0 80px rgba(255, 190, 0, 0.50),
    0 4px 12px rgba(0, 0, 0, 0.8);
}

#game-over-overlay.lost #game-over-title {
  color: #cc2222;
  text-shadow:
    0 0 30px rgba(200, 30, 30, 0.80),
    0 0 70px rgba(160, 0, 0, 0.40),
    0 4px 12px rgba(0, 0, 0, 0.8);
}

@keyframes gameOverTitlePop {
  from { opacity: 0; transform: scale(0.3) translateY(20px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* Damage animation styles */
.dmg-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 100, 100, 0.8), rgba(200, 50, 50, 0.6));
  pointer-events: none;
  z-index: 1000;
  animation: damageFlash 500ms ease-out forwards;
}

.dmg-animation-a {
  animation: damageFlash 500ms ease-out forwards;
}

.dmg-animation-a-inner {
  width: 100%;
  height: 100%;
}

.dmg-animation-a-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1001;
}

.dmg-animation-a-label-inner {
  display: inline-block;
  font-size: 32px;
  font-weight: 900;
  color: #ff4444;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(255, 50, 50, 0.6);
  font-family: 'Arial Black', sans-serif;
  animation: damagePop 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes damageFlash {
  0% {
    opacity: 1;
    filter: brightness(1.5);
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    filter: brightness(1);
  }
}

@keyframes damagePop {
  0% {
    opacity: 1;
    transform: scale(0.5) translateY(0);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.2) translateY(-30px);
  }
}

/* Prevented damage animation styles */
.prevented-dmg-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(170, 170, 170, 0.8), rgba(110, 110, 110, 0.6));
  pointer-events: none;
  z-index: 1000;
}

.prevented-dmg-animation-a {
  animation: preventedDamageFlash 500ms ease-out forwards;
}

.prevented-dmg-animation-a-inner {
  width: 100%;
  height: 100%;
}

.prevented-dmg-animation-a-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1001;
}

.prevented-dmg-animation-a-label-inner {
  display: inline-block;
  font-size: 32px;
  font-weight: 900;
  color: #b8b8b8;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(170, 170, 170, 0.6);
  font-family: 'Arial Black', sans-serif;
  animation: preventedDamagePop 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes preventedDamageFlash {
  0% {
    opacity: 1;
    filter: brightness(1.35);
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    filter: brightness(1);
  }
}

@keyframes preventedDamagePop {
  0% {
    opacity: 1;
    transform: scale(0.5) translateY(0);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.2) translateY(-30px);
  }
}

/* Restore animation styles */
.restore-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(80, 160, 255, 0.8), rgba(40, 110, 200, 0.6));
  pointer-events: none;
  z-index: 1000;
}

.restore-animation-a {
  animation: restoreFlash 500ms ease-out forwards;
}

.restore-animation-a-inner {
  width: 100%;
  height: 100%;
}

.restore-animation-a-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1001;
}

.restore-animation-a-label-inner {
  display: inline-block;
  font-size: 32px;
  font-weight: 900;
  color: #44aaff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(50, 150, 255, 0.6);
  font-family: 'Arial Black', sans-serif;
  animation: restorePop 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes restoreFlash {
  0% {
    opacity: 1;
    filter: brightness(1.5);
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    filter: brightness(1);
  }
}

@keyframes restorePop {
  0% {
    opacity: 1;
    transform: scale(0.5) translateY(0);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.2) translateY(-30px);
  }
}

#game-over-menu-btn {
  margin-top: 52px;
  padding: 14px 44px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.90);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  animation: gameOverBtnSlideUp 0.6s ease-out 0.9s both;
}

#game-over-menu-btn:hover {
  background: rgba(255, 255, 255, 0.20);
  border-color: rgba(255, 255, 255, 0.55);
  transform: scale(1.05);
}

@keyframes gameOverBtnSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Exhausted / Rested status polish */
.exhausted-status-card {
  will-change: transform;
}

.exhausted-status-overlay-layer {
  opacity: 1;
}

.exhausted-status-card-enter .exhausted-status-overlay-layer {
  opacity: 0;
}
