/* ============================================================
   EYES ONLY - Gone Rogue Mobile Touch Interface Styles
   ============================================================ */

/* CSS Variables */
:root {
  --combat-bubble-min-width: 320px;
  --str-overlay-min-width: 300px;
}

/* Grid Container — mobile-first (portrait cap at 100vw) */
.rogue-grid-mobile {
  display: none;
  width: 100%;
  position: relative;
  max-width: min(600px, 100vw); /* mobile cap — desktop override below */
  margin: 0 auto;
  gap: 1px;
  background: #0a0a0a;
  padding: 4px;
  border: 2px solid #1cff9b;
  box-shadow: 0 0 20px rgba(28, 255, 155, 0.3);
  font-family: 'Courier New', monospace;
  touch-action: pan-y pan-x;
  user-select: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  overflow: visible;
  box-sizing: border-box;
  z-index: 10;
  min-height: min-content;
}

/* ── Desktop: remove 600px cap, fill the log-frame ── */
@media (min-width: 768px) {
  body.gone-rogue-active .rogue-grid-mobile {
    max-width: 100%;        /* uncap — fill available space */
    width: 100%;            /* stretch to container */
    height: 100%;           /* fill vertical space too */
    margin: 0;              /* no centering margin — we want edge-to-edge */
    padding: 0;             /* no inner padding — canvas fills the frame */
    border: none;           /* border comes from the log-frame/terminal instead */
    box-shadow: none;       /* CRT glow handled by parent frame */
    border-radius: 0;       /* inherits clip from parent overflow */
    overflow: hidden;       /* clip canvas to this container */
  }
}

/* Combat Zoom Effect - Desktop & Mobile */
.rogue-grid-mobile.combat-zoom-active {
  transform: scale(1.1);
  border-color: #ffaa00;
  box-shadow: 0 0 40px rgba(255, 170, 0, 0.6), inset 0 0 20px rgba(255, 170, 0, 0.2);
  animation: combat-zoom-pulse 1s ease-in-out infinite;
}

@keyframes combat-zoom-pulse {
  0%, 100% {
    box-shadow: 0 0 40px rgba(255, 170, 0, 0.6), inset 0 0 20px rgba(255, 170, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 50px rgba(255, 170, 0, 0.8), inset 0 0 30px rgba(255, 170, 0, 0.3);
  }
}

/* ── Phase 2: Paused grid overlay ──────────────────────────────── */
.rogue-grid-mobile.paused {
  position: relative;
  filter: brightness(0.4) saturate(0.3);
  pointer-events: none;
}
.rogue-grid-mobile.paused::after {
  content: 'PAUSED';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Courier New', monospace;
  font-size: 28px;
  font-weight: bold;
  color: #ffaa00;
  text-shadow: 0 0 20px rgba(255, 170, 0, 0.6), 0 0 40px rgba(255, 170, 0, 0.3);
  letter-spacing: 8px;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 100;
  animation: paused-blink 2s ease-in-out infinite;
}
@keyframes paused-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Grid Cells */
.rogue-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #1cff9b;
  font-size: clamp(10px, 2vw, 14px);
  cursor: pointer;
  transition: all 0.1s ease;
  position: relative;
}

.rogue-cell:active {
  background: rgba(28, 255, 155, 0.2);
  transform: scale(0.95);
}

/* Cell Types */
.cell-player {
  background: #1cff9b !important;
  color: #000;
  font-weight: bold;
  animation: pulse-player 1s infinite;
}

/* Player collecting currency animation - subtle bobbing */
.cell-player.currency-collecting {
  animation: player-currency-bob 0.6s ease-out, pulse-player 1s infinite;
}

@keyframes player-currency-bob {
  0% { transform: translateY(0) scale(1); }
  15% { transform: translateY(-3px) scale(1.05); }
  30% { transform: translateY(-2px) scale(1.04); }
  45% { transform: translateY(-3px) scale(1.05); }
  60% { transform: translateY(-1px) scale(1.02); }
  75% { transform: translateY(-2px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes pulse-player {
  0%, 100% { box-shadow: 0 0 5px #1cff9b; }
  50% { box-shadow: 0 0 15px #1cff9b, 0 0 25px #1cff9b; }
}

.cell-enemy {
  color: #fff;
  font-weight: bold;
  position: relative;
  transition: background-color 0.4s ease, opacity 0.4s ease;
}

/* Elite Enemy Styling */
.cell-elite {
  position: relative;
  animation: elite-pulse 2s ease-in-out infinite;
}

@keyframes elite-pulse {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.3);
  }
}

/* Intent Icon Overlay */
.enemy-intent-icon {
  position: absolute;
  top: 0px;
  left: 0px;
  font-size: 10px;
  opacity: 0.9;
  pointer-events: none;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
  z-index: 10;
  animation: intent-bob 1s ease-in-out infinite;
}

@keyframes intent-bob {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-2px); }
}

.cell-enemy .enemy-direction-arrow {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  opacity: 0.7;
  pointer-events: none;
}

/* Sight cone highlight */
.in-sight-cone {
  background: rgba(255, 28, 74, 0.15) !important;
  box-shadow: inset 0 0 3px rgba(255, 28, 74, 0.3);
}

.cell-enemy.has-detection-cone::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid rgba(255, 28, 74, 0.5);
  pointer-events: none;
  animation: detection-pulse 2s infinite;
}

@keyframes detection-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.cell-item {
  color: #ffeb3b;
  animation: sparkle 1.5s infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; text-shadow: 0 0 5px #ffeb3b; }
}

.cell-wall {
  background: #333;
  color: #666;
}

.cell-cover {
  background: #1a1a1a;
  color: #888;
}

.cell-breakable {
  color: #ff9800;
}

.cell-breakable-destroying {
  color: #ff9800;
  animation: breakable-blink 0.2s ease-in-out;
}

/* Oil slick BLVCK droplet — dark pearlescent 💧 using joker greyed filter language.
   Applied to ground-effect OIL tiles rendered as 💧 emoji.
   Dark iridescent sheen: near-black with subtle rainbow shimmer on pulse. */
.cell-oil-slick-blvck {
  filter: grayscale(0.8) brightness(0.35) contrast(1.4) drop-shadow(0 0 2px rgba(40, 30, 50, 0.9));
  animation: oil-slick-blvck-shimmer 3s ease-in-out infinite;
}

@keyframes oil-slick-blvck-shimmer {
  0%, 100% {
    filter: grayscale(0.8) brightness(0.35) contrast(1.4) drop-shadow(0 0 2px rgba(40, 30, 50, 0.9));
    color: #1a1520;
  }
  33% {
    filter: grayscale(0.6) brightness(0.4) contrast(1.3) hue-rotate(20deg) drop-shadow(0 0 3px rgba(60, 40, 80, 0.7));
    color: #201828;
  }
  66% {
    filter: grayscale(0.7) brightness(0.38) contrast(1.3) hue-rotate(-15deg) drop-shadow(0 0 3px rgba(30, 50, 40, 0.7));
    color: #182018;
  }
}

/* Explosive barrel idle pulse — gentle red-to-dark-red glow */
.cell-explosive-idle {
  animation: explosive-idle-pulse 2s ease-in-out infinite;
}

@keyframes explosive-idle-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 2px #660000);
    color: #cc2200;
  }
  50% {
    filter: drop-shadow(0 0 6px #ff3300);
    color: #ff4400;
  }
}

/* Kick wobble animation — brief shake when kicked */
.cell-kick-wobble {
  animation: kick-wobble 0.3s ease-out;
}

@keyframes kick-wobble {
  0% { transform: translate(0, 0); }
  15% { transform: translate(-3px, -1px); }
  30% { transform: translate(3px, 1px); }
  50% { transform: translate(-2px, 0); }
  70% { transform: translate(2px, 0); }
  100% { transform: translate(0, 0); }
}

/* Kick push slide — slides breakable in push direction */
.cell-kick-pushed {
  animation: kick-push 0.25s ease-out;
}

@keyframes kick-push {
  0% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 0.8; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

/* Explosion screen shake — applied to grid container on barrel detonation */
.explosion-shake {
  animation: explosion-shake 0.4s ease-out;
}

@keyframes explosion-shake {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-4px, 3px); }
  20%  { transform: translate(3px, -4px); }
  30%  { transform: translate(-3px, 3px); }
  40%  { transform: translate(3px, -2px); }
  50%  { transform: translate(-2px, 2px); }
  60%  { transform: translate(2px, -1px); }
  70%  { transform: translate(-1px, 1px); }
  80%  { transform: translate(1px, 0); }
  100% { transform: translate(0, 0); }
}

/* Explosion frame flash — orange-red border glow overlaid on entire grid */
.explosion-flash {
  animation: explosion-flash 0.5s ease-out;
}

@keyframes explosion-flash {
  0%   { box-shadow: inset 0 0 60px rgba(255, 80, 0, 0.7); }
  30%  { box-shadow: inset 0 0 35px rgba(255, 120, 0, 0.4); }
  100% { box-shadow: inset 0 0 0 rgba(255, 80, 0, 0); }
}

.cell-projectile-impact {
  color: #1cff9b;
  animation: impact-flash 0.2s ease-in-out;
}

/* Muzzle Flash Animation */
.cell-muzzle-flash {
  animation: muzzle-flash 0.3s ease-out;
}

@keyframes muzzle-flash {
  0% {
    background: rgba(255, 255, 100, 0);
    box-shadow: none;
  }
  30% {
    background: rgba(255, 255, 100, 0.9);
    box-shadow: 0 0 15px rgba(255, 255, 100, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.6);
  }
  100% {
    background: rgba(255, 255, 100, 0);
    box-shadow: none;
  }
}

/* Impact Splash Types */
.cell-impact-breakable {
  animation: impact-splash-breakable 0.4s ease-out;
}

.cell-impact-enemy {
  animation: impact-splash-enemy 0.4s ease-out;
}

.cell-impact-wall {
  animation: impact-splash-wall 0.3s ease-out;
}

.cell-impact-miss {
  animation: impact-fizzle 0.3s ease-out;
}

@keyframes impact-splash-breakable {
  0% {
    box-shadow: none;
    filter: brightness(1);
  }
  40% {
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.9), inset 0 0 15px rgba(255, 200, 100, 0.6);
    filter: brightness(2);
  }
  100% {
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.3);
    filter: brightness(1);
  }
}

@keyframes impact-splash-enemy {
  0% {
    box-shadow: none;
    filter: brightness(1);
  }
  40% {
    box-shadow: 0 0 20px rgba(255, 28, 74, 0.9), inset 0 0 15px rgba(255, 100, 120, 0.6);
    filter: brightness(2);
  }
  100% {
    box-shadow: 0 0 5px rgba(255, 28, 74, 0.3);
    filter: brightness(1);
  }
}

@keyframes impact-splash-wall {
  0% {
    box-shadow: none;
    filter: brightness(1);
  }
  40% {
    box-shadow: 0 0 15px rgba(200, 200, 200, 0.7), inset 0 0 10px rgba(255, 255, 255, 0.4);
    filter: brightness(1.5);
  }
  100% {
    box-shadow: none;
    filter: brightness(1);
  }
}

@keyframes impact-fizzle {
  0% {
    opacity: 1;
    filter: brightness(1);
  }
  50% {
    opacity: 0.6;
    filter: brightness(0.7);
  }
  100% {
    opacity: 0.3;
    filter: brightness(0.5);
  }
}

@keyframes breakable-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

@keyframes impact-flash {
  0% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.8; transform: scale(1); }
}

.cell-breakable-broken {
  color: #6b4c3b;
}

.cell-projectile {
  color: #1cff9b;
}

.cell-exit {
  color: #00ff00;
  animation: exit-glow 1s infinite alternate;
}

@keyframes exit-glow {
  from { text-shadow: 0 0 5px #00ff00; }
  to { text-shadow: 0 0 15px #00ff00, 0 0 25px #00ff00; }
}

.cell-empty {
  color: #0d3f22;
}

/* Run Mode Flash */
.run-mode-flash {
  animation: run-flash 0.2s;
}

@keyframes run-flash {
  0%, 100% { background: rgba(255, 255, 0, 0); }
  50% { background: rgba(255, 255, 0, 0.5); }
}

/* Click/Tap Feedback Dot */
.click-feedback-dot {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  background: #1cff9b;
  box-shadow: 0 0 8px #1cff9b, 0 0 12px rgba(28, 255, 155, 0.6);
  z-index: 9999;
  animation: click-expand-fade 0.4s ease-out forwards;
  transform: translate(-50%, -50%);
}

@keyframes click-expand-fade {
  0% {
    width: 2px;
    height: 2px;
    opacity: 1;
  }
  50% {
    width: 10px;
    height: 10px;
    opacity: 0.8;
  }
  100% {
    width: 5px;
    height: 5px;
    opacity: 0;
  }
}

/* Card Fan Popup — fixed-position overlay toggled by 🃏 CARDS button.
   Renders the player's hand of cards via _showCardFan().
   See _showCardFan() in gone-rogue-mobile.js for lifecycle details. */
.rogue-cards-mobile {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  gap: 10px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #1cff9b;
  border-radius: 10px;
  box-shadow: 0 0 30px rgba(28, 255, 155, 0.5);
  z-index: 1000;
  max-width: 90vw;
  overflow-x: auto;
  flex-wrap: nowrap;
}

/* Individual Card */
.rogue-card {
  position: relative; /* For badge positioning */
  min-width: 100px;
  padding: 15px;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  border: 2px solid #1cff9b;
  border-radius: 8px;
  text-align: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: all 0.2s ease;
}

.rogue-card:hover {
  border-color: #ffeb3b;
  box-shadow: 0 0 15px rgba(255, 235, 59, 0.5);
  transform: translateY(-5px);
}

.rogue-card:active {
  cursor: grabbing;
}

.rogue-card.card-dragging {
  opacity: 0.8;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(28, 255, 155, 0.7);
  z-index: 1001;
  cursor: grabbing;
}

.card-emoji {
  font-size: 32px;
  margin-bottom: 8px;
}

.card-name {
  color: #1cff9b;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 4px;
  font-family: 'Courier New', monospace;
}

.card-quality {
  color: #888;
  font-size: 10px;
  font-family: 'Courier New', monospace;
}

/* Quality Colors */
.rogue-card[data-quality="cracked"] { border-color: #666; }
.rogue-card[data-quality="worn"] { border-color: #999; }
.rogue-card[data-quality="standard"] { border-color: #fff; }
.rogue-card[data-quality="fine"] { border-color: #4fc3f7; }
.rogue-card[data-quality="superior"] { border-color: #ffeb3b; }
.rogue-card[data-quality="elite"] { border-color: #ff9800; }
.rogue-card[data-quality="masterwork"] { border-color: #ffd700; }
.rogue-card[data-quality="near_perfect"] { border-color: #8bc34a; }
.rogue-card[data-quality="perfect"] { border-color: #9c27b0; }

/* Card Navigation Arrow */
.rogue-card.card-nav {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-color: #ffeb3b;
  cursor: pointer;
  touch-action: auto;
  opacity: 0.9;
}

.rogue-card.card-nav:hover {
  opacity: 1;
  transform: translateY(-5px) scale(1.05);
}

.rogue-card.card-nav .card-nav-arrow {
  animation: arrow-pulse 1.5s ease-in-out infinite;
}

@keyframes arrow-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

/* Card Selection Styles */
.rogue-card.card-selected {
  border-color: #ff9800;
  background: linear-gradient(135deg, #1a1506 0%, #2a1a0a 100%);
  box-shadow: 0 0 20px rgba(255, 152, 0, 0.6);
  transform: translateY(-8px);
}

.card-selection-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: #ff9800;
  border: 2px solid #000;
  border-radius: 50%;
  color: #000;
  font-size: 14px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 0 10px rgba(255, 152, 0, 0.8);
}

/* Play Selected Button */
.rogue-card.card-play-selected {
  background: linear-gradient(135deg, #0a4a0a 0%, #0d6a0d 100%);
  border-color: #1cff9b;
  cursor: pointer;
  touch-action: auto;
  animation: play-button-pulse 2s ease-in-out infinite;
}

.rogue-card.card-play-selected:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 0 30px rgba(28, 255, 155, 0.8);
}

@keyframes play-button-pulse {
  0%, 100% { box-shadow: 0 0 15px rgba(28, 255, 155, 0.5); }
  50% { box-shadow: 0 0 25px rgba(28, 255, 155, 0.8); }
}

/* No Cards Message */
.no-cards {
  color: #ff1c4a;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  padding: 20px;
  text-align: center;
}

/* Swipe Direction Indicators */
.rogue-cards-mobile::before {
  content: '← SWIPE TO USE →';
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  color: #1cff9b;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  opacity: 0.7;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .rogue-grid-mobile {
    max-width: 100vw;
    width: calc(100vw - 8px); /* Account for margins */
    padding: 2px;
    gap: 0.5px;
    margin: 0 4px;
  }

  .rogue-cell {
    font-size: clamp(8px, 1.8vw, 10px);
    min-width: 0;
    min-height: 0;
  }

  .rogue-card {
    min-width: 80px;
    padding: 10px;
  }

  .card-emoji {
    font-size: 24px;
  }

  .card-name {
    font-size: 10px;
  }

  .card-quality {
    font-size: 8px;
  }
}

/* Touch Feedback */
@media (hover: none) {
  .rogue-cell:hover {
    background: rgba(28, 255, 155, 0.1);
  }
}

/* Status Bar for Mobile */
.rogue-mobile-status {
  position: fixed;
  top: 60px;
  right: 10px;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #1cff9b;
  border-radius: 5px;
  padding: 10px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #1cff9b;
  z-index: 999;
}

.rogue-mobile-status div {
  margin: 2px 0;
}

/* Stealth Alert Levels */
.alert-safe {
  color: #00ff00;
}

.alert-caution {
  color: #ffeb3b;
  animation: blink-caution 1s infinite;
}

@keyframes blink-caution {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.alert-danger {
  color: #ff1c4a;
  animation: blink-danger 0.5s infinite;
}

@keyframes blink-danger {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

/* STR Combat Overlay */
.str-combat-overlay {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 10, 0.95);
  border: 3px solid #ff1c4a;
  border-radius: 8px;
  padding: 15px 20px;
  z-index: 1000;
  box-shadow: 0 0 30px rgba(255, 28, 74, 0.6), inset 0 0 20px rgba(255, 28, 74, 0.2);
  font-family: 'Courier New', monospace;
  text-align: center;
  animation: combat-pulse 1s infinite;
  min-width: var(--str-overlay-min-width);
  max-width: 90vw;
}

/* Amber HUD color when in combat */
.str-combat-overlay.combat-active {
  border-color: #ffaa00;
  box-shadow: 0 0 30px rgba(255, 170, 0, 0.6), inset 0 0 20px rgba(255, 170, 0, 0.2);
}

@keyframes combat-pulse {
  0%, 100% {
    box-shadow: 0 0 30px rgba(255, 28, 74, 0.6), inset 0 0 20px rgba(255, 28, 74, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 28, 74, 0.8), inset 0 0 25px rgba(255, 28, 74, 0.3);
  }
}

.str-combat-header {
  color: #ff1c4a;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.str-combat-status {
  color: #1cff9b;
  font-size: 14px;
  margin: 8px 0;
}

.advantage-indicator {
  display: inline-block;
  padding: 5px 10px;
  background: rgba(28, 255, 155, 0.1);
  border: 1px solid #1cff9b;
  border-radius: 4px;
}

.str-combat-enemy {
  color: #ffeb3b;
  font-size: 13px;
  margin-top: 10px;
}

/* Combat Bubble - Zoomed combat view */
.combat-bubble {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(4px);
  border: 3px solid #ffaa00;
  border-radius: 8px;
  padding: 12px 16px;
  z-index: 1500;
  box-shadow: 0 0 30px rgba(255, 170, 0, 0.6), inset 0 0 20px rgba(255, 170, 0, 0.08);
  font-family: 'Courier New', monospace;
  min-width: 280px;
  max-width: 90vw;
  animation: bubble-appear 0.2s ease-out;
}

@keyframes bubble-appear {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.combat-bubble-header {
  text-align: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #ffaa00;
}

/* Floating damage numbers */
.floating-damage {
  font-family: 'Courier New', monospace;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  z-index: 2000;
}

@keyframes float-up {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-40px);
  }
}

/* Combat Arena - Visual representation */
.combat-arena {
  display: grid;
  grid-template-rows: repeat(3, auto);
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 10px 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid #333;
  border-radius: 6px;
}

.combatant {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  font-size: 48px;
  position: relative;
}

.combatant-glyph {
  font-family: 'Courier New', monospace;
  font-size: 48px;
  text-shadow: 0 0 10px currentColor;
  animation: combatant-idle 2s ease-in-out infinite;
  position: relative;
  line-height: 1;
}

@keyframes combatant-idle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

/* Glyph Expressions */
.glyph-confident { /* ^__^ - Normal state */
  color: #1cff9b;
}

.glyph-charging { /* >_< - Preparing attack */
  color: #ffaa00;
  animation: glyph-charge 0.5s ease-in-out infinite;
}

@keyframes glyph-charge {
  0%, 100% { 
    transform: scale(1); 
    text-shadow: 0 0 10px #ffaa00;
  }
  50% { 
    transform: scale(1.1); 
    text-shadow: 0 0 20px #ffaa00, 0 0 30px #ffaa00;
  }
}

.glyph-hurt { /* T__T - Taking damage */
  color: #ff1c4a;
  animation: glyph-hurt 0.6s ease-out;
}

@keyframes glyph-hurt {
  0% { 
    transform: translateX(0); 
    opacity: 1;
  }
  25% { 
    transform: translateX(-10px); 
    opacity: 0.7;
  }
  50% { 
    transform: translateX(5px); 
    opacity: 0.5;
  }
  75% { 
    transform: translateX(-3px); 
    opacity: 0.8;
  }
  100% { 
    transform: translateX(0); 
    opacity: 1;
  }
}

.glyph-guarding { /* =_= - Defensive stance */
  color: #4fc3f7;
  animation: glyph-guard 1s ease-in-out infinite;
}

@keyframes glyph-guard {
  0%, 100% { 
    transform: scale(1); 
    filter: brightness(1);
  }
  50% { 
    transform: scale(0.95); 
    filter: brightness(1.2);
  }
}

.glyph-defeated { /* x__x - Knocked out */
  color: #666;
  animation: glyph-defeated 1s ease-out forwards;
}

@keyframes glyph-defeated {
  0% { 
    transform: scale(1) rotate(0deg); 
    opacity: 1;
  }
  50% { 
    transform: scale(0.9) rotate(5deg); 
    opacity: 0.5;
  }
  100% { 
    transform: scale(0.8) rotate(0deg); 
    opacity: 0.3;
  }
}

/* Impact Effects */
.impact-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 72px;
  animation: impact-burst 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes impact-burst {
  0% { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(0.5);
  }
  50% { 
    opacity: 0.8; 
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% { 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* Planning Phase Timer */
.planning-timer {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 80px;
  height: 80px;
  background: rgba(0, 0, 0, 0.9);
  border: 3px solid #ffaa00;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  color: #ffaa00;
  font-family: 'Courier New', monospace;
  z-index: 2000;
  box-shadow: 0 0 30px rgba(255, 170, 0, 0.6);
  animation: timer-pulse 1s ease-in-out infinite;
}

.planning-timer.time-critical {
  border-color: #ff1c4a;
  color: #ff1c4a;
  animation: timer-critical 0.5s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 30px rgba(255, 170, 0, 0.6);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(255, 170, 0, 0.8);
  }
}

@keyframes timer-critical {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 40px rgba(255, 28, 74, 0.8);
  }
  50% { 
    transform: scale(1.1);
    box-shadow: 0 0 50px rgba(255, 28, 74, 1);
  }
}

/* Combat Log in Bubble */
.combat-log {
  max-height: 150px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #333;
  border-radius: 4px;
  padding: 10px;
  margin: 15px 0;
  font-size: 12px;
  color: #1cff9b;
  text-align: left;
  font-family: 'Courier New', monospace;
}

.combat-log-line {
  margin: 2px 0;
  animation: log-line-appear 0.3s ease-out;
}

@keyframes log-line-appear {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* HP Bars */
.hp-bar-container {
  width: 100%;
  height: 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #333;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin: 5px 0;
}

.hp-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff1c4a 0%, #ff6b9d 100%);
  transition: width 0.5s ease-out;
  position: relative;
}

.hp-bar.high {
  background: linear-gradient(90deg, #1cff9b 0%, #6bffc8 100%);
}

.hp-bar.medium {
  background: linear-gradient(90deg, #ffeb3b 0%, #ffd54f 100%);
}

.hp-bar.low {
  background: linear-gradient(90deg, #ff1c4a 0%, #ff6b9d 100%);
}

.hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  text-shadow: 1px 1px 2px #000;
  z-index: 1;
}

/* ============================================================
   LIGHTING SYSTEM STYLES
   Dynamic per-tile illumination based on light sources
   ============================================================ */

/* Lighting intensity classes */
.lit-very-dark {
  filter: brightness(0.45) saturate(0.7);
}

.lit-dark {
  filter: brightness(0.6) saturate(0.8);
}

.lit-dim {
  filter: brightness(0.75) saturate(0.85);
}

.lit-normal {
  filter: brightness(0.9) saturate(0.95);
}

.lit-bright {
  filter: brightness(1.0) saturate(1.0);
}

.lit-very-bright {
  filter: brightness(1.2) saturate(1.1);
}

/* Light source indicators — orb pseudo-elements removed.
   Lighting is now rendered as smooth canvas gradients from source positions.
   DOM fallback relies only on the brightness filter classes above. */
.cell-light-source {
  position: relative;
}

/* ============================================================
   LOCKED GATE / CHEST — high visibility pulsing glow
   ============================================================ */
.cell-locked-gate {
  position: relative;
  filter: brightness(1.6) saturate(1.3) !important;
  text-shadow: 0 0 6px rgba(255, 200, 60, 0.9), 0 0 14px rgba(255, 140, 0, 0.6);
  animation: gate-pulse 1.6s ease-in-out infinite;
  z-index: 2;
}

.cell-locked-gate::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200%;
  height: 200%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 160, 0, 0.35) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
  animation: gate-glow 1.6s ease-in-out infinite;
}

.cell-locked-chest {
  position: relative;
  filter: brightness(1.4) saturate(1.2) !important;
  text-shadow: 0 0 6px rgba(120, 200, 255, 0.8), 0 0 12px rgba(60, 140, 255, 0.5);
  animation: gate-pulse 2s ease-in-out infinite;
}

@keyframes gate-pulse {
  0%, 100% { filter: brightness(1.4) saturate(1.2); }
  50% { filter: brightness(1.8) saturate(1.5); }
}

@keyframes gate-glow {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.15); }
}

@keyframes fire-flicker {
  0%, 100% {
    opacity: 0.4;
    transform: translate(-50%, -50%) scale(0.95);
  }
  25% {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1.05);
  }
  50% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  75% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.02);
  }
}

@keyframes lava-pulse {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

/* ============================================================
   REDUNDANT: .rogue-inventory-mobile
   Inventory/equip grid popup — rendered by showInventory().
   This popup is REDUNDANT with the header → left-column and
   NCH → header equip flows. It still fires during NPC turn-in
   and quest key interactions. Should stay hidden. Has a minimize
   arrow (▾) as safety valve during playtesting before removal.
   ============================================================ */

.rogue-inventory-mobile {
  display: none;
  position: relative; /* for minimize arrow positioning */
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  padding: 12px 12px 12px 12px;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #1cff9b;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(28, 255, 155, 0.4);
  margin: 10px auto;
  max-width: min(90vw, 360px);
  max-height: min(50vh, 320px);
  overflow-y: auto;
  font-family: 'Courier New', monospace;
}

/* Minimize arrow — safety valve to dismiss the redundant popup */
.rogue-inventory-minimize {
  position: absolute;
  top: 2px;
  right: 6px;
  background: none;
  border: none;
  color: #1cff9b;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  opacity: 0.6;
  z-index: 1;
  line-height: 1;
}
.rogue-inventory-minimize:hover,
.rogue-inventory-minimize:active {
  opacity: 1;
}

.rogue-inventory-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  border: 2px solid #1cff9b;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: all 0.2s ease;
  position: relative;
}

.rogue-inventory-item:hover {
  border-color: #ffeb3b;
  box-shadow: 0 0 15px rgba(255, 235, 59, 0.5);
  transform: translateY(-3px);
}

.rogue-inventory-item:active {
  cursor: grabbing;
}

.rogue-inventory-item.dragging {
  opacity: 0.8;
  box-shadow: 0 0 25px rgba(28, 255, 155, 0.7);
  z-index: 1001;
  cursor: grabbing;
  pointer-events: none;
}

.rogue-inventory-item.equipped {
  border-color: #ffaa00;
  background: linear-gradient(135deg, #1a1a0a 0%, #2a2a1a 100%);
  box-shadow: 0 0 15px rgba(255, 170, 0, 0.4);
}

.rogue-inventory-item.equipped::after {
  content: '⚡';
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 14px;
  color: #ffaa00;
  animation: equip-pulse 1.5s ease-in-out infinite;
}

@keyframes equip-pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.rogue-inventory-item .item-emoji {
  font-size: 32px;
  margin-bottom: 6px;
  display: block;
}

.rogue-inventory-item .item-name {
  color: #1cff9b;
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  word-break: break-word;
}

.rogue-inventory-item.equipped .item-name {
  color: #ffaa00;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
  .rogue-inventory-mobile {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .rogue-inventory-item {
    padding: 8px;
  }

  .rogue-inventory-item .item-emoji {
    font-size: 24px;
    margin-bottom: 4px;
  }

  .rogue-inventory-item .item-name {
    font-size: 9px;
  }
}

/* Active slot highlight when dragging over */
#active-item-slot.drag-over {
  border-color: #ffeb3b;
  box-shadow: 0 0 20px rgba(255, 235, 59, 0.6);
  animation: slot-highlight 0.5s ease-in-out infinite;
}

/* Box placement preview (deployables) */
.rogue-cell.box-placement-valid {
  outline: 2px solid rgba(104, 211, 145, 0.75);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 2px rgba(104, 211, 145, 0.25);
}

.rogue-cell.box-placement-invalid {
  outline: 2px solid rgba(244, 67, 54, 0.65);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 2px rgba(244, 67, 54, 0.18);
}

.active-slot-drag-ghost {
  filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.6));
}

@keyframes slot-highlight {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 235, 59, 0.6);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 235, 59, 0.8);
  }
}

/* ============================================================
   OVERHEAD ANIMATOR SYSTEM
   ============================================================ */

/* Overhead animation container */
.overhead-animation {
  position: absolute;
  pointer-events: none;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  z-index: 1000;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.8),
    0 0 6px rgba(0, 0, 0, 0.6),
    1px 1px 2px rgba(0, 0, 0, 1);
  animation: overhead-appear 0.2s ease-out;
}

@keyframes overhead-appear {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Currency pickup animation */
.overhead-animation.currency-pickup {
  font-size: 16px;
  font-weight: bold;
}

/* Expression animations */
.overhead-animation.expression {
  font-size: 20px;
}

/* Status effect indicators */
.overhead-animation.status-persistent {
  font-size: 18px;
  animation: overhead-bob 1s ease-in-out infinite;
}

@keyframes overhead-bob {
  0%, 100% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(2px);
  }
}

/* Speech/thought bubbles */
.overhead-animation.speech {
  font-size: 14px;
  max-width: 150px;
  white-space: normal;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 4px 8px;
  line-height: 1.2;
}

.overhead-animation.speech::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(0, 0, 0, 0.8);
}

/* Speech bubble emoji prefix */
.overhead-animation.speech .bubble-emoji {
  display: inline-block;
  margin-right: 4px;
  font-size: 16px;
}

/* Alert indicator pulse */
.overhead-animation.alert {
  animation: overhead-alert-pulse 0.5s ease-in-out infinite;
}

@keyframes overhead-alert-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
  }
}

/* Emoji glow effects for status */
.overhead-animation.burning {
  animation: overhead-fire-flicker 0.3s ease-in-out infinite;
}

@keyframes overhead-fire-flicker {
  0%, 100% {
    filter: brightness(1) hue-rotate(0deg);
  }
  50% {
    filter: brightness(1.3) hue-rotate(10deg);
  }
}

.overhead-animation.frozen {
  animation: overhead-ice-shimmer 2s ease-in-out infinite;
}

@keyframes overhead-ice-shimmer {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.5) drop-shadow(0 0 4px cyan);
  }
}

.overhead-animation.shocked {
  animation: overhead-shock-zap 0.2s ease-in-out infinite;
}

@keyframes overhead-shock-zap {
  0%, 100% {
    transform: translateX(0) scale(1);
  }
  25% {
    transform: translateX(-2px) scale(1.1);
  }
  75% {
    transform: translateX(2px) scale(1.1);
  }
}

/* Interactive item indicator */
.interactive-item-indicator {
  position: absolute;
  pointer-events: none;
  font-size: 14px;
  color: #ffff00;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.8),
    0 0 6px rgba(255, 255, 0, 0.6);
  z-index: 999;
  animation: interactive-pulse 1.5s ease-in-out infinite;
}

@keyframes interactive-pulse {
  0%, 100% {
    opacity: 0.6;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}


/* ============================================================
   MOBILE PORTRAIT MODE - PRIORITIZE ROGUE GRID
   Ensure the Gone Rogue grid appears at the top of the terminal
   area in portrait mode for better mobile UX
   ============================================================ */
@media (max-width: 767px) and (orientation: portrait) {
  /* When in Gone Rogue mode on mobile portrait, position grid at top */
  body.mode-gone-rogue .log-frame,
  body.in-gone-rogue .log-frame {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Terminal output should scroll below the grid */
  body.mode-gone-rogue #terminal,
  body.in-gone-rogue #terminal {
    order: 2; /* Terminal content appears after grid */
    flex-shrink: 1; /* Allow terminal to shrink */
    overflow-y: visible; /* Let parent handle scroll */
  }

  /* Rogue grid should be at top with sticky positioning */
  body.mode-gone-rogue .rogue-grid-mobile,
  body.in-gone-rogue .rogue-grid-mobile,
  body.gone-rogue-active .rogue-grid-mobile {
    order: 1; /* Grid appears first */
    flex-shrink: 0; /* Don't shrink the grid */
    margin-bottom: 8px; /* Space between grid and terminal */
    position: relative; /* Changed from sticky to allow full scrolling */
    top: auto;
    background: #0a0a0a; /* Ensure it has a background */
    /* Add bottom padding to prevent cutoff by footer */
    padding-bottom: 8px;
  }

  /* Rogue cards should also be prioritized */
  body.mode-gone-rogue .rogue-cards-mobile,
  body.in-gone-rogue .rogue-cards-mobile {
    order: 0; /* Cards appear before grid */
    flex-shrink: 0;
    margin-bottom: 4px;
    /* Don't use sticky on cards to avoid overlap with grid */
    position: relative;
    background: #0a0a0a;
    /* z-index not needed - flexbox order handles layout */
  }

  /* Ensure input line appears at bottom if shown */
  body.mode-gone-rogue #input-line,
  body.in-gone-rogue #input-line {
    order: 3;
  }

  /* Let the footer touch the device bottom (remove after-footer dead band).
     If we need extra clearance later, add it to the footer itself, not the whole log column. */
  body.gone-rogue-active #log-column {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* ============================================================
   TODO: PORTRAIT MOBILE <-> DESKTOP LANDSCAPE SQUISH TRANSITIONS
   Maximizing "squish" possibilities for browser-based mobile
   portrait-first, single-tap / single-input performance preference.
   ============================================================

   GRID SQUISH:
   TODO: Add CSS container queries on .rogue-grid-mobile so cell size
         auto-scales to fill available width without overflow.
         Current: clamp(10px,2vw,14px) — not container-aware.
         Target: cells should fill exactly the game frame width with
         zero horizontal scroll on any viewport from 320px to 2560px.

   TODO: On portrait mobile (<480px), reduce grid from 40×20 to a
         visible viewport of ~20×14 with smooth CSS-only panning
         (transform: translate) so the full map is still accessible
         via swipe but the visible area is larger cells.

   TODO: Add transition for orientation change so grid "breathes"
         between portrait tall/narrow and landscape wide/short
         without layout jump. Use CSS transition on grid-template-columns
         + grid-template-rows for a smooth reflow (~200ms ease).

   HAND FAN SQUISH:
   TODO: In portrait mobile, anchor hand fan to bottom safe area
         (env(safe-area-inset-bottom)) and reduce card height to
         ~90px with 2-line name truncation. Cards should be tappable
         with a single thumb tap from natural resting position.

   TODO: On landscape mobile, move hand fan to right edge (vertical
         stack, not horizontal arc) so it doesn't occlude the game
         grid. Cards become ~60px wide "chip" mode with emoji + cost
         only, expandable on hold.

   TODO: Add CSS transition for hand fan position change between
         portrait (bottom arc) and landscape (right stack) so cards
         smoothly reflow during orientation change instead of popping.

   STR COMBAT WINDOW SQUISH:
   TODO: On portrait mobile, STR combat window should take full width
         (100vw - safe-area) and reduce vertical height to ~40vh so
         the game grid remains visible behind it (translucent bg).

   TODO: On landscape mobile, STR window becomes a side panel (right
         40vw) instead of centered overlay, so grid stays fully
         visible on the left.

   SINGLE-TAP INPUT PREFERENCE:
   TODO: All interactive elements must have minimum 44×44px touch
         target on mobile (WCAG 2.5.5). Audit card tap targets,
         grid cells, and combat buttons for compliance.

   TODO: Add "one-tap commit" mode for combat: selecting a card auto-
         commits after 800ms unless another card is tapped (eliminates
         need for separate "play" button on mobile).

   TODO: Ensure keyboard number keys (1-5) still work for card
         selection on desktop landscape, with visual hint overlay
         showing key bindings on card hover.

   TRANSITION ANIMATION:
   TODO: Use CSS @media (orientation: portrait/landscape) + prefers-
         reduced-motion to gate transition animations. Users with
         reduced-motion get instant layout swap, others get smooth
         200ms ease transition.

   TODO: On resize/orientation change, debounce grid reflow to avoid
         layout thrashing (single requestAnimationFrame pass).

   ============================================================ */

/* NPC gate zone hinting (subtle approach + inner trigger) */
.cell-npc-gate-warning {
  background: rgba(255, 235, 59, 0.08);
}

.cell-npc-gate-trigger {
  background: rgba(255, 82, 82, 0.08);
}

/* AOE preview rings for drag-to-map ground effects */
.rogue-cell.aoe-exact {
  outline: 2px solid rgba(0, 212, 255, 0.55);
  outline-offset: -2px;
  background: rgba(0, 212, 255, 0.12);
}

.rogue-cell.aoe-prob {
  outline: 2px dashed rgba(255, 193, 7, 0.45);
  outline-offset: -2px;
  background: rgba(255, 193, 7, 0.07);
}

.rogue-cell.aoe-far {
  background: rgba(255, 255, 255, 0.035);
}

/* ============================================================
   Environmental Damage UI - Part 3
   Screen edge vignettes, player hit animations
   ============================================================ */

/* Damage vignette overlay - appears when player takes environmental damage */
.damage-vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

/* Fire damage - red-orange vignette */
.damage-vignette.fire-damage {
  background: radial-gradient(circle, transparent 50%, rgba(255, 60, 0, 0.3) 100%);
  opacity: 1;
}

/* Lava damage - deep red vignette, more intense */
.damage-vignette.lava-damage {
  background: radial-gradient(circle, transparent 50%, rgba(200, 0, 0, 0.4) 100%);
  opacity: 1;
}

/* Campfire standing damage - amber vignette, gentler */
.damage-vignette.campfire-damage {
  background: radial-gradient(circle, transparent 50%, rgba(255, 170, 0, 0.25) 100%);
  opacity: 1;
}

/* Player hit flash animation - applied to player emoji */
@keyframes player-hit-flash {
  0% {
    filter: brightness(1);
    transform: translate(0, 0);
  }
  10% {
    filter: brightness(1.8);
    transform: translate(2px, -1px);
  }
  20% {
    filter: brightness(1.8);
    transform: translate(-2px, 1px);
  }
  40% {
    filter: brightness(1.6);
    transform: translate(1px, -2px);
  }
  60% {
    filter: brightness(1.4);
    transform: translate(-1px, 2px);
  }
  80% {
    filter: brightness(1.2);
    transform: translate(1px, 1px);
  }
  100% {
    filter: brightness(1);
    transform: translate(0, 0);
  }
}

.player-hit-animation {
  animation: player-hit-flash 0.3s ease-out;
}

/* HP bar damage flash - applied to HP indicator element */
@keyframes hp-bar-flash {
  0%, 100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8), inset 0 0 5px rgba(255, 0, 0, 0.5);
  }
}

.hp-bar-damage-flash {
  animation: hp-bar-flash 0.5s ease-in-out;
}

/* Delayed HP drain effect - the red segment lingers before shrinking */
@keyframes hp-drain-delay {
  0% {
    width: var(--hp-lost-width);
    opacity: 0.8;
  }
  70% {
    width: var(--hp-lost-width);
    opacity: 0.8;
  }
  100% {
    width: 0;
    opacity: 0;
  }
}

.hp-drain-segment {
  position: absolute;
  height: 100%;
  background: rgba(255, 0, 0, 0.6);
  animation: hp-drain-delay 0.6s ease-out forwards;
}
