html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
}

/* 9:16-Container, zentriert im Viewport */
#game-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 12px;
}

/* Animierter Hintergrund füllt den Container */
#bg-apng {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

/* Canvas füllt den Container */
#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: transparent;
}

/* Desktop: Fadenkreuz-Cursor */
@media (pointer: fine) {
  #game {
    cursor: crosshair;
  }
}

/* Mobile: Cursor egal / versteckt */
@media (pointer: coarse) {
  #game {
    cursor: none;
  }
}

/* HUD als Holzschild im Tresenbereich */
#hud {
  position: absolute;
  top: 83%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(70, 38, 22, 0.96);
  border: 1px solid rgba(255, 211, 74, 0.6);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  font-size: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 3;
  pointer-events: none;
}

#hud span {
  white-space: nowrap;
}

/* Settings-Button – schwebend oben rechts im Container */
#settings-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #ffd34a;
  color: #222;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  z-index: 4;
}

@media (max-width: 600px) {
  #settings-btn {
    top: 8px;
    right: 8px;
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
}

/* Overlays allgemein */
#info-overlay,
#gameover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 25;
}

#info-box,
#gameover-box {
  background: #181818;
  border-radius: 18px;
  padding: 14px 16px;
  max-width: 380px;
  width: 86vw;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: 14px;
}

#info-box h2,
#gameover-box h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 20px;
}

#info-box p,
#gameover-box p {
  margin: 4px 0;
}

#info-box input[type="text"],
#gameover-box input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: none;
  margin-top: 6px;
  margin-bottom: 8px;
  font-size: 14px;
}

#info-box button,
#gameover-box button {
  margin-top: 6px;
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  background: #ffd34a;
  color: #222;
  font-weight: 600;
  margin-right: 6px;
}

/* Game Over – Top 10 Liste */
#gameover-highscore-list {
  max-height: 180px;
  overflow-y: auto;
  padding-left: 0;
  list-style-position: inside;
}

#gameover-highscore-list li {
  margin: 3px 0;
}

.hidden {
  display: none !important;
}

/* Menü-Overlay */
#menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 30;
}

#menu-panel {
  background: #181818;
  border-radius: 20px;
  padding: 14px 16px;
  max-width: 420px;
  width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: 14px;
}

#menu-panel h2 {
  margin-top: 0;
  font-size: 18px;
}

#menu-panel h3 {
  margin: 12px 0 6px;
  font-size: 15px;
}

#menu-panel input[type="text"] {
  width: 100%;
  padding: 5px 8px;
  border-radius: 8px;
  border: none;
  margin-top: 4px;
  font-size: 14px;
}

#menu-panel button {
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  background: #ffd34a;
  color: #222;
  font-weight: 600;
  margin-right: 8px;
  margin-top: 8px;
}

#targets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 8px;
}

#targets-list label {
  white-space: nowrap;
}

#mute-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

#mute-label input[type="checkbox"] {
  transform: scale(1.1);
}

.made-by {
  margin-top: 14px;
  font-size: 12px;
  opacity: 0.75;
}

.made-by a {
  color: #ffd34a;
  text-decoration: none;
}

.made-by a:hover {
  text-decoration: underline;
}

/* Safari-Fix: Eingabefeld im Info-Overlay */
#info-box input[type="text"] {
  font-size: 16px;
}

/* Info-Overlay auf kleinen Screens etwas nach unten setzen */
@media (max-width: 600px) {
  #info-overlay {
    align-items: flex-start;
    justify-content: center;
    padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
    overflow-y: auto;
  }

  #info-box {
    max-width: 320px;
    width: 90%;
  }
}

/* ---------------------------------------
   INTRO OVERLAY – Neon-Schild am Anfang
   --------------------------------------- */
#intro-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

#intro-sign {
  padding: 18px 26px;
  border-radius: 18px;
  background: rgba(15, 8, 25, 0.9);
  border: 2px solid #ffd34a;
  box-shadow:
    0 0 10px rgba(255, 211, 74, 0.9),
    0 0 30px rgba(255, 60, 120, 0.5);
  text-align: center;
  animation: intro-pop 0.4s ease-out, intro-neon 2.2s linear;
}

.intro-line {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
}

.intro-top {
  font-size: 16px;
  letter-spacing: 0.12em;
  color: #ffd34a;
}

.intro-main {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ff4a6a;
  text-shadow:
    0 0 4px #ff4a6a,
    0 0 10px #ff4a6a,
    0 0 18px rgba(255, 74, 106, 0.7);
}

/* Intro erscheint kurz "plopp" und flackert wie ein Neon-Schild */
@keyframes intro-pop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  60% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1.0);
    opacity: 1;
  }
}

@keyframes intro-neon {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  20%  { opacity: 0.4; }
  30%  { opacity: 1; }
  45%  { opacity: 0.6; }
  60%  { opacity: 1; }
  80%  { opacity: 0.9; }
  100% { opacity: 0; }
}