body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Press Start 2P', cursive;
  background-color: #000;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  image-rendering: pixelated;
}

#outer-container {
  background: #111;
  width: 90%;
  max-width: 1500px;
  aspect-ratio: 16 / 9;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 255, 255, 0.3);
}

/* Start Screen */
#start-screen {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #000;
  background-image: radial-gradient(circle, #111 0%, #000 70%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #0ff;
  text-shadow: 2px 2px #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  font-size: 1rem;
  z-index: 10;
  animation: flicker 2s infinite;
}

#start-screen h1 {
  margin-bottom: 30px;
  font-size: 2rem;
  letter-spacing: 2px;
  animation: glow 3s infinite alternate;
}

.intro-text {
  margin-bottom: 40px;
  text-align: center;
  max-width: 80%;
  line-height: 1.5;
  font-size: 0.8rem;
}

/* Game Container */
#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  overflow: hidden;
  text-align: center;
  color: #fff;
}

#game-title {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  color: #ffcc00;
  text-shadow: 2px 2px #000;
  z-index: 5;
  margin: 0;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
}

#background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('backgrounds/ApocalypsecityBG.png');
  background-size: cover;
  background-position: center;
  z-index: 0;
  transition: background-image 1s ease-in-out;
}

#game-content {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  justify-content: flex-start !important;
  padding-top: 60px !important;
}

/* ======================================
   CHARACTER BREATHING & OVERHEAD TEXT
   ====================================== */

/* ALEX CHARACTER */
#alex-character {
  position: absolute !important;
  bottom: 120px !important;
  left: 150px !important;
  width: 150px;
  height: 150px;
  background-image: url('sprites/Alex.png');
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 10;
  cursor: pointer;
  will-change: transform;
  transition: left 0.3s ease-out, bottom 0.3s ease-out, transform 0.3s ease-out;
  transform: scaleX(-1) !important;
}

#alex-character.breathing {
  animation: alexBreathe 3s infinite ease-in-out !important;
}

@keyframes alexBreathe {
  0% { transform: scaleX(-1) scale(1); }
  50% { transform: scaleX(-1) scale(1.05); }
  100% { transform: scaleX(-1) scale(1); }
}

#alex-character.breathing.facing-left {
  animation: alexBreatheLeft 3s infinite ease-in-out !important;
}

#alex-character.breathing.facing-right {
  animation: alexBreatheRight 3s infinite ease-in-out !important;
}

@keyframes alexBreatheLeft {
  0% { transform: scaleX(-1) scale(1); }
  50% { transform: scaleX(-1) scale(1.05); }
  100% { transform: scaleX(-1) scale(1); }
}

@keyframes alexBreatheRight {
  0% { transform: scaleX(1) scale(1); }
  50% { transform: scaleX(1) scale(1.05); }
  100% { transform: scaleX(1) scale(1); }
}

/* COMMANDER VEX CHARACTER - Large and Centered */
#npc-character[style*="raider.png"] {
  width: 280px !important;
  height: 280px !important;
  position: absolute !important;
  left: 50% !important;
  bottom: 50px !important;
  transform: translateX(-50%) scale(1) !important;
  transform-origin: bottom center;
  filter: brightness(1.1) contrast(1.1);
  z-index: 20;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Updated breathing animation for smaller Vex */
#npc-character[style*="raider.png"].breathing {
  animation: vexBreatheCenter 2.5s infinite;
}

@keyframes vexBreatheCenter {
  0% { 
    transform: translateX(-50%) scale(1);
    filter: brightness(1.1) contrast(1.1);
  }
  50% { 
    transform: translateX(-50%) scale(1.05);
    filter: brightness(1.3) contrast(1.2);
  }
  100% { 
    transform: translateX(-50%) scale(1);
    filter: brightness(1.1) contrast(1.1);
  }
}

/* Hover effect for large centered Commander Vex */
#npc-character[style*="raider.png"]:hover {
  filter: brightness(1.4) contrast(1.3) drop-shadow(0 0 20px rgba(255, 68, 68, 0.7)) !important;
  cursor: pointer;
}

/* GENERAL NPC CHARACTER */
#npc-character {
  position: absolute;
  bottom: 75px;
  right: 150px;
  width: 150px;
  height: 150px;
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 9;
  cursor: pointer;
  transition: left 0.2s ease-out, bottom 0.2s ease-out, right 0.2s ease-out;
}

/* SARAH CHARACTER */
#npc-character[style*="sarah.png"] {
  position: absolute;
  bottom: 150px;
  right: 150px;
  width: 150px;
  height: 150px;
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 9;
  cursor: pointer;
  transition: all 0.3s ease;
}

#npc-character[style*="sarah.png"].breathing {
  animation: sarahBreathe 2.8s infinite ease-in-out;
}

@keyframes sarahBreathe {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Sarah's Happy State */
#npc-character.sarah-happy {
  filter: brightness(1.3) saturate(1.2) hue-rotate(10deg);
  animation: sarahHappyPulse 2s infinite ease-in-out;
  transform: scale(1.1);
}

@keyframes sarahHappyPulse {
  0% { 
    transform: scale(1.1);
    filter: brightness(1.3) saturate(1.2) hue-rotate(10deg);
  }
  50% { 
    transform: scale(1.15);
    filter: brightness(1.5) saturate(1.4) hue-rotate(15deg);
  }
  100% { 
    transform: scale(1.1);
    filter: brightness(1.3) saturate(1.2) hue-rotate(10deg);
  }
}

/* ELI CHARACTER */
#npc-character[style*="eli.gif"] {
  position: absolute;
  bottom: 100px;
  right: 150px;
  width: 150px;
  height: 150px;
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 9;
  cursor: pointer;
  transition: all 0.3s ease;
}

#npc-character[style*="eli.gif"].breathing {
  animation: eliBreathe 3.2s infinite ease-in-out;
}

@keyframes eliBreathe {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.1); }
  100% { transform: scale(1); filter: brightness(1); }
}

/* DR. CHEN CHARACTER */
#npc-character[style*="doctor.png"] {
  position: absolute;
  transform: scaleX(1);
  bottom: 100px;
  right: 150px;
  width: 150px;
  height: 150px;
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 9;
  cursor: pointer;
  transition: all 0.3s ease;
}

#npc-character[style*="doctor.png"].breathing {
  animation: chenBreathe 2.5s infinite ease-in-out;
}

@keyframes chenBreathe {
  0% { transform: scale(1); }
  50% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

/* Add breathing animation to NPC character */
#npc-character.breathing {
  animation: breathe 3s infinite;
}

#npc-character.breathing.facing-left {
  animation: breatheLeft 3s infinite;
}

#npc-character.breathing.facing-right {
  animation: breatheRight 3s infinite;
}

/* Character Name Labels */
.character-label {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffcc00;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.9);
  padding: 6px 10px;
  border-radius: 6px;
  border: 2px solid #ffcc00;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
  text-shadow: 1px 1px 2px #000;
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
  animation: labelGlow 3s infinite alternate;
  font-family: 'Press Start 2P', cursive;
  letter-spacing: 1px;
  user-select: none;
  text-transform: uppercase;
}

.character-label.alex {
  color: #00ffff;
  border-color: #00ffff;
  left: 15%;
  transform: scaleX(-1);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
  animation: alexLabelPulse 4s infinite alternate;
}

@keyframes alexLabelPulse {
  0% { 
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
    opacity: 0.9;
  }
  100% { 
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
    opacity: 1;
  }
}

.character-label.sarah {
  color: #ff69b4;
  border-color: #ff69b4;
  box-shadow: 0 0 10px rgba(255, 105, 180, 0.4);
  animation: sarahLabelPulse 3.5s infinite alternate;
}

@keyframes sarahLabelPulse {
  0% { 
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.4);
    opacity: 0.9;
  }
  100% { 
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.7);
    opacity: 1;
  }
}

/* Sarah's character label when happy */
.character-label.sarah.happy {
  color: #90EE90;
  border-color: #90EE90;
  background: rgba(144, 238, 144, 0.2);
  box-shadow: 0 0 15px rgba(144, 238, 144, 0.7);
  animation: happyLabelGlow 2s infinite alternate;
}

@keyframes happyLabelGlow {
  0% { 
    box-shadow: 0 0 15px rgba(144, 238, 144, 0.7);
    transform: translateX(-50%) scale(1);
  }
  100% { 
    box-shadow: 0 0 25px rgba(144, 238, 144, 1);
    transform: translateX(-50%) scale(1.05);
  }
}

.character-label.eli {
  color: #90EE90;
  border-color: #90EE90;
  box-shadow: 0 0 10px rgba(144, 238, 144, 0.4);
  animation: eliLabelPulse 4.2s infinite alternate;
}

@keyframes eliLabelPulse {
  0% { 
    box-shadow: 0 0 10px rgba(144, 238, 144, 0.4);
    opacity: 0.85;
  }
  100% { 
    box-shadow: 0 0 15px rgba(144, 238, 144, 0.7);
    opacity: 1;
  }
}

.character-label.chen {
  color: #87CEEB;
  border-color: #87CEEB;
  box-shadow: 0 0 10px rgba(135, 206, 235, 0.4);
  animation: chenLabelPulse 3.8s infinite alternate;
}

@keyframes chenLabelPulse {
  0% { 
    box-shadow: 0 0 10px rgba(135, 206, 235, 0.4);
    opacity: 0.9;
  }
  100% { 
    box-shadow: 0 0 15px rgba(135, 206, 235, 0.7);
    opacity: 1;
  }
}

.character-label.vex {
  color: #ff4444;
  border-color: #ff4444;
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
  font-size: 16px !important;
  padding: 8px 15px !important;
  border-width: 3px !important;
  text-shadow: 2px 2px 4px #000;
  top: -50px !important;
  animation: vexLabelIntense 2s infinite alternate;
  background: rgba(0, 0, 0, 0.95) !important;
}

@keyframes vexLabelIntense {
  0% { 
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
    transform: translateX(-50%) scale(1);
    color: #ff4444;
  }
  100% { 
    box-shadow: 0 0 25px rgba(255, 68, 68, 0.8);
    transform: translateX(-50%) scale(1.1);
    color: #ff6666;
  }
}

@keyframes labelGlow {
  0% { opacity: 0.8; }
  100% { opacity: 1; }
}

/* Story and Choices */
#story-text {
  position: relative;
  margin: 30px auto 15px auto !important;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.8);
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #0ff;
  max-width: 85%;
  z-index: 15;
  line-height: 1.5;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
  transition: opacity 0.3s ease;
}

#choices {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin: 10px auto 20px auto !important;
  z-index: 15;
  width: 85%;
  max-width: 800px;
}

button {
  background-color: #222;
  color: #0ff;
  border: 2px solid #0ff;
  padding: 15px 25px;
  margin: 5px;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7rem; 
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
  width: 80%;
  max-width: 500px;
}

button:hover {
  background-color: #444;
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
}

button:active {
  transform: scale(0.98);
}

button.disabled {
  background-color: #333;
  color: #666;
  border-color: #666;
  cursor: not-allowed;
}

/* Final Ending Display */
#final-ending {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 300;
}

.ending-content {
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.9);
  border: 3px solid #ffcc00;
  border-radius: 15px;
  padding: 40px;
  max-width: 80%;
  box-shadow: 0 0 30px rgba(255, 204, 0, 0.5);
}

#ending-title {
  color: #ffcc00;
  font-size: 2rem;
  margin-bottom: 20px;
  text-shadow: 0 0 15px #ffcc00;
  animation: endingGlow 2s infinite alternate;
}

@keyframes endingGlow {
  0% { text-shadow: 0 0 15px #ffcc00; }
  100% { text-shadow: 0 0 25px #ffcc00, 0 0 35px #ffaa00; }
}

#ending-message {
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 30px;
  text-shadow: 1px 1px 2px #000;
}

.ending-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.ending-buttons button {
  background-color: #ffcc00;
  color: #000;
  border: 2px solid #ffcc00;
  padding: 15px 25px;
  font-size: 0.8rem;
  min-width: 150px;
  max-width: none;
  width: auto;
}

.ending-buttons button:hover {
  background-color: #fff;
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.8);
}

/* Food Drop Zone (Sarah's Food Box) */
.food-drop-zone {
  position: absolute;
  bottom: 180px;
  right: 80px;
  width: 120px;
  height: 120px;
  background: rgba(255, 204, 0, 0.1);
  border: 3px dashed rgba(255, 204, 0, 0.6);
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  z-index: 25;
  pointer-events: auto;
}

.food-drop-zone.drag-over {
  background: rgba(255, 204, 0, 0.3);
  border-color: rgba(255, 204, 0, 1);
  border-width: 4px;
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.7);
  transform: scale(1.1);
}

.food-drop-zone.success {
  background: rgba(144, 238, 144, 0.3);
  border-color: rgba(144, 238, 144, 1);
  box-shadow: 0 0 25px rgba(144, 238, 144, 0.8);
  animation: successPulse 1s ease-out;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.food-box-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.8;
}

.food-box-text {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  color: #ffcc00;
  text-align: center;
  text-shadow: 1px 1px 2px #000;
  line-height: 1.2;
}

/* Draggable Food Item */
.draggable-food-item {
  position: absolute;
  bottom: 200px;
  left: 150px;
  width: 80px;
  height: 80px;
  background: rgba(0, 255, 255, 0.1);
  border: 2px solid rgba(0, 255, 255, 0.6);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: grab;
  transition: all 0.3s ease;
  z-index: 20;
  pointer-events: auto;
  animation: foodItemPulse 3s infinite ease-in-out;
}

.draggable-food-item:hover {
  transform: scale(1.1);
  border-color: rgba(0, 255, 255, 1);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
  cursor: grab;
}

.draggable-food-item.dragging {
  cursor: grabbing;
  opacity: 0.8;
  transform: scale(1.2);
  z-index: 100;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.9);
}

.draggable-food-item img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  pointer-events: none;
}

.food-label {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.4rem;
  color: #0ff;
  text-align: center;
  margin-top: 4px;
  text-shadow: 1px 1px 2px #000;
  pointer-events: none;
}

@keyframes foodItemPulse {
  0% { 
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
  }
  50% { 
    border-color: rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
  }
  100% { 
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
  }
}

/* Food Success Animation */
@keyframes foodDelivered {
  0% { 
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% { 
    transform: scale(1.3) rotate(180deg);
    opacity: 0.7;
  }
  100% { 
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

.food-delivered {
  animation: foodDelivered 1s ease-out forwards;
  pointer-events: none;
}

/* Food Box Success Text */
.food-box-success-text {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(144, 238, 144, 0.9);
  color: #000;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  border: 2px solid #90EE90;
  box-shadow: 0 0 10px rgba(144, 238, 144, 0.7);
  animation: successTextAppear 3s ease-out forwards;
  z-index: 30;
}

@keyframes successTextAppear {
  0% { 
    opacity: 0;
    transform: translateX(-50%) translateY(20px) scale(0.8);
  }
  20% { 
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  80% { 
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% { 
    opacity: 0;
    transform: translateX(-50%) translateY(-20px) scale(0.8);
  }
}

/* Inventory System */
#inventory-panel {
  position: absolute;
  top: 200px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #0ff;
  border-radius: 8px;
  padding: 10px;
  width: 180px;
  z-index: 20;
  transition: opacity 0.3s ease;
}

#inventory-panel h3 {
  margin: 0 0 10px 0;
  font-size: 0.7rem;
  color: #0ff;
  text-align: center;
}

#inventory-items {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.inventory-item {
  width: 40px;
  height: 40px;
  background-color: #333;
  border: 1px solid #0ff;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.6rem;
  color: #fff;
  transition: all 0.2s;
}

.inventory-item:hover {
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.7);
}

.inventory-item img {
  max-width: 32px;
  max-height: 32px;
}

/* Stats Display */
#stats-display {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #0ff;
  border-radius: 8px;
  padding: 10px;
  width: 180px;
  z-index: 20;
  font-size: 0.6rem;
}

.stat-bar {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  gap: 5px;
}

.stat-label {
  width: 70px;
  text-align: left;
  color: #0ff;
}

.bar-container {
  flex-grow: 1;
  height: 8px;
  background-color: #333;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease-out;
}

.bar-fill.health {
  background-color: #ff3333;
}

.bar-fill.sanity {
  background-color: #33aaff;
}

#memory-counter {
  position: absolute;
  top: 250px;
  left: 30px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #ffcc00;
  border-radius: 8px;
  padding: 5px 10px;
  color: #ffcc00;
  font-size: 0.6rem;
  z-index: 20;
}

/* Interactive Elements */
#floating-items {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

.clickable-item {
  position: absolute;
  width: 150px;
  height: 150px;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.3s;
  z-index: 7;
  animation: pulse 2s infinite;
  border: 3px solid rgba(0, 255, 255, 0.6);
  border-radius: 8px;
  background-color: rgba(0, 255, 255, 0.15);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.clickable-item:hover {
  transform: scale(1.15);
  filter: brightness(1.4);
  border-color: rgba(0, 255, 255, 1);
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
}

/* Butterfly styling */
.butterfly {
  position: absolute;
  width: 40px;
  height: 40px;
  background-image: url('sprites/butterfly.png') !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-color: transparent !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 70 !important;
  transition: all 0.3s ease;
  animation: butterflyFloat 3s ease-in-out infinite;
  border: none !important;
  box-shadow: none !important;
  padding: 10px;
  margin: -10px;
  isolation: isolate;
}

.butterfly:hover {
  transform: scale(1.2);
  filter: brightness(1.3) drop-shadow(0 0 10px #FFD700);
  z-index: 80 !important;
}

.butterfly.collecting {
  animation: butterflyCollect 0.8s ease-out forwards;
  pointer-events: none !important;
}

.butterfly.golden {
  width: 50px;
  height: 50px;
  filter: hue-rotate(20deg) saturate(1.5) brightness(1.2);
  animation: butterflyFloat 2s ease-in-out infinite, goldenGlow 1.5s ease-in-out infinite alternate;
  z-index: 75 !important;
  padding: 15px;
  margin: -15px;
}

@keyframes butterflyFloat {
  0% { 
    transform: translateY(0px) rotate(0deg); 
    opacity: 0.9;
  }
  50% { 
    transform: translateY(-15px) rotate(5deg); 
    opacity: 1;
  }
  100% { 
    transform: translateY(0px) rotate(0deg); 
    opacity: 0.9;
  }
}

@keyframes butterflyCollect {
  0% { 
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% { 
    transform: scale(1.5) rotate(180deg);
    opacity: 0.7;
  }
  100% { 
    transform: scale(0) rotate(360deg);
    opacity: 0;
  }
}

@keyframes goldenGlow {
  0% { 
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
  }
  100% { 
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 25px rgba(255, 215, 0, 0.4);
  }
}

/* Popups and Notifications */
#item-popup {
  position: absolute;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #0ff;
  padding: 15px 25px;
  border: 2px solid #0ff;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: 'Press Start 2P', cursive;
  z-index: 50;
  animation: fadeIn 0.3s;
  max-width: 80%;
  text-align: center;
}

#echo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  border: 2px dashed #f00;
  padding: 15px 25px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #f00;
  text-shadow: 1px 1px #000;
  z-index: 40;
  animation: pulse 2s infinite;
}

/* Gibberish Text Box for NPCs */
#gibberish-popup {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  border: 3px solid #0ff;
  border-radius: 10px;
  padding: 10px;
  width: 80%;
  max-width: 800px;
  min-width: 300px;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7rem;
  color: #0ff;
  line-height: 1.4;
  user-select: none;
  z-index: 30;
  box-shadow: 
    0 0 10px rgba(0, 255, 255, 0.5),
    0 0 20px rgba(0, 255, 255, 0.3),
    0 0 30px rgba(0, 255, 255, 0.1),
    inset 0 0 10px rgba(0, 255, 255, 0.1);
  animation: gibberishGlow 2s infinite alternate;
  box-sizing: border-box;
  cursor: pointer;
  transition: all 0.2s ease;
}

#gibberish-popup:hover {
  border-color: rgba(0, 255, 255, 0.8);
  box-shadow: 
    0 0 15px rgba(0, 255, 255, 0.7),
    0 0 25px rgba(0, 255, 255, 0.4),
    0 0 35px rgba(0, 255, 255, 0.2),
    inset 0 0 15px rgba(0, 255, 255, 0.2);
}

#gibberish-popup .character-icon {
  width: 60px;
  height: 60px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-right: 20px;
  border: 3px solid #0ff;
  border-radius: 8px;
  background-color: #333;
  box-shadow: 
    0 0 8px rgba(0, 255, 255, 0.8),
    inset 0 0 8px rgba(0, 255, 255, 0.2);
  animation: iconPulse 3s infinite ease-in-out;
}

#gibberish-popup .gibberish-text {
  flex: 1;
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
  font-family: 'Press Start 2P', cursive;
  line-height: 1.6;
  min-height: 1.6em;
  width: 100%;
  text-align: left;
  max-width: 100%;
  overflow: hidden;
  transition: none;
}

.typing-cursor {
  animation: cursorBlink 1s infinite;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes gibberishGlow {
  0% { 
    box-shadow: 
      0 0 10px rgba(0, 255, 255, 0.5),
      0 0 20px rgba(0, 255, 255, 0.3),
      0 0 30px rgba(0, 255, 255, 0.1),
      inset 0 0 10px rgba(0, 255, 255, 0.1);
  }
  100% { 
    box-shadow: 
      0 0 15px rgba(0, 255, 255, 0.7),
      0 0 25px rgba(0, 255, 255, 0.4),
      0 0 35px rgba(0, 255, 255, 0.2),
      inset 0 0 15px rgba(0, 255, 255, 0.2);
  }
}

@keyframes iconPulse {
  0% { 
    transform: scale(1);
    box-shadow: 
      0 0 8px rgba(0, 255, 255, 0.8),
      inset 0 0 8px rgba(0, 255, 255, 0.2);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 
      0 0 12px rgba(0, 255, 255, 1),
      inset 0 0 12px rgba(0, 255, 255, 0.3);
  }
  100% { 
    transform: scale(1);
    box-shadow: 
      0 0 8px rgba(0, 255, 255, 0.8),
      inset 0 0 8px rgba(0, 255, 255, 0.2);
  }
}

/* Audio Controls */
#audio-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

#audio-controls button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.7);
  border: 2px solid #0ff;
  color: #0ff;
  font-size: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 0;
}

#audio-controls button:hover {
  background-color: rgba(0, 20, 40, 0.8);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Character animations */
.breathing {
  animation: breathe 3s infinite;
}

@keyframes breathe {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes breatheLeft {
  0% { transform: scaleX(-1) scale(1); }
  50% { transform: scaleX(-1) scale(1.05); }
  100% { transform: scaleX(-1) scale(1); }
}

@keyframes breatheRight {
  0% { transform: scaleX(1) scale(1); }
  50% { transform: scaleX(1) scale(1.05); }
  100% { transform: scaleX(1) scale(1); }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}

@keyframes flicker {
  0% { opacity: 1; }
  5% { opacity: 0.9; }
  10% { opacity: 1; }
  15% { opacity: 0.9; }
  20% { opacity: 1; }
  55% { opacity: 1; }
  60% { opacity: 0.9; }
  65% { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes glow {
  from { text-shadow: 0 0 5px #0ff, 0 0 10px #0ff, 0 0 15px #0ff; }
  to { text-shadow: 0 0 10px #0ff, 0 0 20px #0ff, 0 0 30px #0ff; }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.5s forwards;
}

.fade-out {
  animation: fadeOut 0.5s forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
  #story-text {
    max-width: 90%;
    font-size: 0.6rem;
    padding: 15px;
    margin: 20px auto 15px auto !important;
  }
  
  button {
    font-size: 0.6rem;
    padding: 10px 15px;
  }
  
  #inventory-panel {
    width: 120px;
    top: 60px;
  }
  
  .inventory-item {
    width: 30px;
    height: 30px;
  }
  
  #start-screen h1 {
    font-size: 1.5rem;
  }
  
  #game-title {
    font-size: 0.8rem;
  }
  
  #stats-display {
    width: 150px;
    font-size: 0.5rem;
  }
  
  #gibberish-popup {
    width: 90%;
    font-size: 0.6rem;
    padding: 15px;
    bottom: 20px;
  }
  
  #gibberish-popup .character-icon {
    width: 45px;
    height: 45px;
    margin-right: 12px;
  }
  
  .clickable-item {
    width: 100px;
    height: 100px;
  }
  
  .character-label {
    font-size: 8px;
    padding: 2px 4px;
  }
  
  .ending-content {
    padding: 20px;
    max-width: 95%;
  }
  
  #ending-title {
    font-size: 1.5rem;
  }
  
  #ending-message {
    font-size: 0.7rem;
  }
  
  .ending-buttons {
    flex-direction: column;
    align-items: center;
  }

  .butterfly {
    width: 35px;
    height: 35px;
    padding: 15px;
    margin: -15px;
  }
  
  .butterfly.golden {
    width: 45px;
    height: 45px;
    padding: 20px;
    margin: -20px;
  }
}

@media (max-width: 480px) {
  .butterfly {
    width: 30px;
    height: 30px;
    padding: 20px;
    margin: -20px;
  }
  
  .butterfly.golden {
    width: 40px;
    height: 40px;
    padding: 25px;
    margin: -25px;
  }
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
  #start-screen, #game-container {
    background-color: #000;
  }
  
  button {
    border-width: 3px;
  }
  
  .clickable-item {
    border-width: 3px;
  }
}