body {
  background: #1a0a2a;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  overflow: hidden;
  touch-action: none; /* Prevent scroll on mobile */
  user-select: none;
  -webkit-user-select: none;
  margin: 0;
  line-height: 1.5; /* Improved readability global */
}

/* ... existing styles ... */

.screen-content {
  background: rgba(30, 20, 40, 0.95); /* Slightly more opaque */
  padding: 2.5rem; /* More breathing room */
  border-radius: 24px; /* Softer corners */
  box-shadow: 0 0 50px rgba(0, 255, 255, 0.15);
  border: 1px solid rgba(0, 255, 255, 0.2);
  max-width: 90%;
  width: 440px; /* Slightly wider */
}

.logo h1 {
  font-size: 3.5rem;
  margin: 1rem 0; /* More spacing */
  color: #fff;
  text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
  letter-spacing: 2px;
  font-weight: 900;
}

/* ... */

.instructions {
  margin-top: 2rem;
  font-size: 1rem; /* Slightly larger */
  color: #aaccff;
  line-height: 1.6; /* Better readability */
}

/* UI Overlay */
#game-ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  font-family: "Orbitron", sans-serif; /* Premium Font */
}

/* Graphical Lives Display */
.lives-container {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 15px;
  background: rgba(0, 20, 40, 0.6);
  padding: 10px 20px;
  border-radius: 30px;
  border: 1px solid rgba(0, 255, 255, 0.3);
  backdrop-filter: blur(5px);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);
}

.life-orb {
  width: 30px;
  height: 30px;
  background: #333; /* Empty/Dead state */
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 5px #000;
}

.life-orb.filled {
  background: radial-gradient(circle at 30% 30%, #00ffff, #0088ff);
  box-shadow: 0 0 10px #00ffff, 0 0 20px #00aaff;
  animation: pulse-life 2s infinite ease-in-out;
}

/* 3 Segments per Orb logic? 
   Implementation: We can use a conic-gradient for segments 
   or just opacity levels. Let's use opacity/color stages for simplicity first?
   User asked for "3 chances per life". 
   Let's visualize "Damage" on the current orb.
*/
.life-orb.stage-3 {
  opacity: 1;
  box-shadow: 0 0 15px #00ffff;
}
.life-orb.stage-2 {
  opacity: 0.6;
  box-shadow: 0 0 5px #00ffff;
  filter: grayscale(0.3);
}
.life-orb.stage-1 {
  opacity: 0.3;
  box-shadow: none;
  filter: grayscale(0.7);
  animation: danger-blink 0.5s infinite;
}

@keyframes danger-blink {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
    background: #ff0055;
  }
  100% {
    opacity: 0.3;
  }
}

@keyframes pulse-life {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.score-container {
  position: absolute;
  top: 80px; /* Moved down slightly to clear lives if needed, or stick to 10% */
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.current-score {
  font-family: "Audiowide", cursive; /* Distinct score font */
  font-size: 5rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.8), 2px 2px 0px rgba(0, 0, 0, 0.5);
}

/* Robot Dock Styling */
.robot-dock-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px; /* Area for robots */
  background: linear-gradient(to top, rgba(0, 20, 40, 0.9), transparent);
  z-index: -1; /* Behind canvas elements? No, canvas is z-0. Overlay is z-5.*/
  /* Wait, checking: CSS z-index 5 is ABOVE canvas. 
       If we want robots to be "in" the dock, the canvas draws them.
       So this overlay provides the 'background' visual.
       BUT because it's z-5, it might block clicks if not pointer-events: none.
       pointer-events IS none on #game-ui. 
       So this needs pointer-events: none too.
    */
  pointer-events: none;
  border-top: 1px solid rgba(0, 255, 255, 0.3);
}

.dock-label {
  position: absolute;
  bottom: 10px;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 4px;
  color: rgba(0, 255, 255, 0.5);
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

.dock-scanline {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 255, 0.05) 3px
  );
}

.combo-display {
  font-family: "Orbitron", sans-serif;
  font-size: 2rem;
  color: #ffd700;
  font-weight: bold;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sound-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 10px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  pointer-events: auto;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.hidden {
  display: none !important;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  80% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Lives Display */
.lives-display {
  font-size: 1.5rem;
  color: #ff3333;
  font-weight: bold;
  margin-top: 0.5rem;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
  transition: transform 0.2s;
}

.lives-display.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* Ability Modal */

.ability-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem; /* Increased gap */
  margin: 2rem 0;
}

.ability-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 15px;
  padding: 1rem;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem; /* Better separation between icon and label */
}

.ability-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  border-color: #00ffff;
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 255, 255, 0.2);
}

.ability-btn:active {
  transform: translateY(-2px);
}

.ability-btn .icon {
  font-size: 2.5rem;
}

.ability-btn .label {
  font-size: 1rem;
  font-weight: bold;
}

/* Responsive fix for modal */
@media (max-height: 700px) {
  .screen-content {
    padding: 1.5rem;
  }
  .ability-grid {
    margin: 1rem 0;
  }
  .ability-btn {
    padding: 0.5rem;
  }
}
