* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: #05070f;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  font-family: "Arial Black", Impact, system-ui, sans-serif;
}

#stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: min(100vw, calc(100dvh * 0.5625));
  margin: 0 auto;
  overflow: hidden;
  background: #6fc3ff;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  transition: filter .45s ease;
}
#game.blur { filter: blur(6px) brightness(.72) saturate(1.1); }

/* HUD */
#hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 10px; right: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  transition: opacity .3s;
}
#hud.hidden { opacity: 0; }
.pill {
  background: rgba(10, 16, 40, .62);
  color: #fff;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: .5px;
  white-space: nowrap;
  border: 2px solid rgba(255,255,255,.25);
}
#hud-weapon { color: #ffd54a; }
#hud-track {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(10, 16, 40, .55);
  border: 2px solid rgba(255,255,255,.25);
  overflow: hidden;
}
#hud-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffb300, #ff5252);
  transition: width .15s linear;
}

/* Overlay */
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
#overlay.show { opacity: 1; pointer-events: auto; }

.card { text-align: center; color: #fff; width: 100%; }

#ov-title {
  margin: 0 0 10px;
  font-size: clamp(38px, 12vw, 64px);
  line-height: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff6a8 0%, #ffb300 55%, #ff6d00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 2px #3b1a00;
  filter: drop-shadow(0 5px 0 rgba(0,0,0,.45));
}
#ov-sub {
  margin: 0 auto 8px;
  max-width: 300px;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
}
#ov-stats {
  margin: 0 0 22px;
  min-height: 20px;
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: #ffd54a;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
}

#ov-btn {
  appearance: none;
  border: 4px solid #fff;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 30px;
  letter-spacing: 1px;
  color: #fff;
  padding: 14px 54px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7dff6a 0%, #1fbf2f 100%);
  text-shadow: 0 3px 0 rgba(0,0,0,.35);
  box-shadow: 0 8px 0 #0e7a1a, 0 14px 24px rgba(0,0,0,.5);
  animation: pulse 1.1s ease-in-out infinite;
}
#ov-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 #0e7a1a, 0 6px 12px rgba(0,0,0,.5); animation: none; }
#ov-btn.red {
  background: linear-gradient(180deg, #ff8a65 0%, #e53935 100%);
  box-shadow: 0 8px 0 #8e1b17, 0 14px 24px rgba(0,0,0,.5);
}
#ov-btn.red:active { box-shadow: 0 3px 0 #8e1b17, 0 6px 12px rgba(0,0,0,.5); }

#ov-hint {
  margin: 26px 0 0;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  opacity: .9;
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
}

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

/* Mute + Lautstärke */
[hidden] { display: none !important; }

#mute {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  background: rgba(10, 16, 40, .62);
  color: #fff;
  cursor: pointer;
  padding: 0;
  transition: transform .1s, background .2s;
}
#mute:active { transform: scale(.92); }
#mute .cross { display: none; stroke: #ff6b6b; }
#mute.muted .cross { display: block; }
#mute.muted .wave { display: none; }
#mute.muted { background: rgba(60, 14, 20, .7); }

/* Install */
#install-btn {
  appearance: none;
  outline: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: .5px;
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.7);
  background: rgba(10, 16, 40, .55);
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
}
#install-btn:active { transform: translateY(2px); }
#install-hint {
  margin: 12px auto 0;
  max-width: 280px;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.8);
}

#audio {
  position: absolute;
  z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + 52px);
  right: 10px;
  width: 40px;
}
#vol-panel {
  position: absolute;
  top: 100%;
  left: 0;
  width: 40px;
  padding-top: 6px;          /* Hover-Brücke zum Button */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
#audio:hover #vol-panel,
#audio:focus-within #vol-panel,
#audio.open #vol-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}
#vol-panel .box {
  position: relative;
  height: 130px;
  border-radius: 20px;
  background: rgba(10, 16, 40, .78);
  border: 2px solid rgba(255,255,255,.35);
}
#vol {
  position: absolute;
  left: 50%; top: 50%;
  width: 96px; height: 24px;
  margin: -12px 0 0 -48px;
  transform: rotate(-90deg);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  --p: 100%;
}
#vol::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #ffb300 var(--p), rgba(255,255,255,.25) var(--p));
}
#vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ffb300;
}
#vol::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.25); }
#vol::-moz-range-progress { height: 6px; border-radius: 3px; background: #ffb300; }
#vol::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ffb300;
}

/* Credit / GitHub */
#credit {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.35);
  background: rgba(10, 16, 40, .62);
  color: #fff;
  text-decoration: none;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
  white-space: nowrap;
  opacity: .9;
}
#credit:hover, #credit:focus-visible { opacity: 1; border-color: #ffb300; }
#credit:active { transform: translateX(-50%) translateY(2px); }
