* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #101319;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
}

#gl {
  display: block;
  width: 100%;
  height: 100%;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.hud-left, .hud-right {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hud-stat {
  font-size: 1.25rem;
  font-weight: 700;
}

.hud-stat small {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.8;
  margin-left: 0.25rem;
}

#hud-air {
  background: rgba(59, 130, 246, 0.85);
  color: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

#hud-air.hidden,
#hud.hidden,
#mobile-controls.hidden,
#overlay.hidden {
  display: none !important;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 16, 24, 0.78);
  backdrop-filter: blur(4px);
  z-index: 10;
}

.overlay.active {
  display: flex;
}

.panel {
  background: rgba(20, 28, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1.75rem;
  max-width: 92vw;
  width: 24rem;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.panel h1 {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
  letter-spacing: 0.03em;
}

.panel p {
  margin: 0.45rem 0;
  line-height: 1.45;
}

.controls-hint {
  margin: 1rem 0;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 0.6rem;
  font-size: 0.85rem;
  opacity: 0.92;
}

.btn {
  margin-top: 0.75rem;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  background: #fff;
  border: none;
  border-radius: 0.6rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.08s ease, background 0.15s ease;
}

.btn:hover, .btn:active {
  transform: scale(1.03);
  background: #f3f4f6;
}

#mobile-controls {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.touch-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  background: transparent;
}

.touch-left { left: 0; }
.touch-right { right: 0; }

.touch-actions {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
  pointer-events: auto;
}

.touch-btn {
  padding: 0.65rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.touch-btn:active {
  background: rgba(255, 255, 255, 1);
  transform: scale(0.96);
}

@media (max-width: 640px) {
  .panel {
    padding: 1.25rem;
    width: 90vw;
  }
  .panel h1 {
    font-size: 1.55rem;
  }
  .hud-stat {
    font-size: 1.05rem;
  }
}
