* { box-sizing: border-box; }
html, body { 
  height: 100%; 
  margin: 0; 
  overflow: hidden;
  touch-action: none;
  position: relative;
}

.version-info {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-family: Arial, sans-serif;
  font-size: 14px;
  pointer-events: none;
  z-index: 1000;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

#killswitch-overlay {
  display: none;
}

body { 
  background: #0e0f14; 
  color: #e9eef4; 
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; 
  -webkit-tap-highlight-color: transparent;
}

#app { 
  position: relative; 
  height: 100vh; 
  width: 100%; 
  overflow: hidden;
  touch-action: none;
}

#game { 
  display: block; 
  width: 100%; 
  height: 100%; 
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
  -webkit-tap-highlight-color: transparent;
}

.hud { 
  position: absolute; 
  top: 12px; 
  left: 12px; 
  display: flex; 
  gap: 12px; 
  z-index: 10; 
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.hud .score { 
  font-weight: 700; 
  font-size: clamp(16px, 5vw, 22px);
}

.hud .best { 
  opacity: 0.85;
  font-size: clamp(14px, 4vw, 18px);
}

.overlay { 
  position: absolute; 
  inset: 0; 
  display: flex; 
  flex-direction: column; 
  justify-content: center; 
  align-items: center; 
  gap: 12px; 
  background: rgba(10,12,18,0.85); 
  z-index: 20; 
  text-align: center; 
  padding: 20px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.overlay h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  margin: 0 0 1rem 0;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.overlay p {
  font-size: clamp(1rem, 4vw, 1.25rem);
  max-width: 90%;
  margin: 0 0 1.5rem 0;
  line-height: 1.5;
  padding: 0 18px;
  opacity: 0.9;
}

.overlay.hidden { 
  display: none; 
}

.menu-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

#startBtn, #restartBtn, #muteBtn {
  background: #3a86ff;
  color: white;
  border: none;
  padding: 10px 25px;
  font-size: 1.2em;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

#startBtn:hover, #restartBtn:hover, #muteBtn:hover {
  background: #2667cc;
}

button:hover { 
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Inventory */
.inventory {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(10, 12, 16, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 12px;
  padding: 8px 16px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  min-width: 200px;
}

.inventory-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}

.inventory-slots {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.inventory-slot {
  position: relative;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s ease;
}

.inventory-slot.active {
  border-color: #3a86ff;
  box-shadow: 0 0 10px rgba(58, 134, 255, 0.5);
  transform: translateY(-2px);
}

.inventory-count {
  position: absolute;
  bottom: -8px;
  right: -8px;
  background: #ff3232;
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid rgba(10, 12, 16, 0.8);
}

/* Mobile-specific styles */
@media (max-width: 768px) {
  .inventory {
    bottom: 10px;
    padding: 6px 12px 10px;
    min-width: 180px;
  }
  
  .inventory-slot {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  
  .inventory-title {
    font-size: 9px;
  }
  .hud {
    top: 8px;
    left: 8px;
    gap: 8px;
  }
  
  .controls {
    margin-bottom: 1.5rem;
  }
  
  button {
    padding: 10px 20px;
    min-width: 100px;
  }
  
  /* Touch controls area */
  .touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    z-index: 5;
    display: flex;
    pointer-events: none;
  }
  
  .touch-left, .touch-right {
    flex: 1;
    height: 100%;
    pointer-events: auto;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .hud {
    top: 4px;
    left: 4px;
  }
  
  .overlay {
    padding: 10px;
  }
  
  .controls {
    margin-bottom: 1rem;
    padding: 0 10px;
  }
  
  button {
    padding: 8px 16px;
    min-width: 90px;
  }
}

/* Large desktop screens */
@media (min-width: 1200px) {
  .overlay {
    padding: 40px;
  }
  
  .controls {
    max-width: 800px;
  }
}

/* Ultra-wide screens */
@media (min-width: 2000px) {
  .overlay {
    padding: 60px;
  }
  
  .overlay h1 {
    font-size: 5rem;
  }
  
  .overlay p {
    font-size: 1.5rem;
  }
  
  button {
    padding: 16px 32px;
    font-size: 1.5rem;
    border-radius: 12px;
  }
}
