/* ============================================================
   Sternenfang – globale Stile
   Keine externen Schriften; systemnahe Schriftfamilie.
   ============================================================ */

/* Grundreset und dunkler Seitenhintergrund */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #0d0d1a;
  color: #e8e8f0;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}

/* Hauptbereich: Spiel zentriert, Breite begrenzt */
#spiel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
}

/* HUD-Leiste oberhalb des Spielfelds */
#hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background-color: #1a1a2e;
  border: 1px solid #2e2e50;
  border-radius: 8px;
  padding: 10px 16px;
}

/* Punkteanzeige und Versuche hervorheben */
#punkte,
#versuche {
  color: #f0c040;
}

/* Neustart-Button – gut sichtbar, ausreichender Kontrast */
#neustart-button {
  background-color: #3a3af0;
  color: #ffffff;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

#neustart-button:hover {
  background-color: #5555ff;
}

/* Barrierefreiheit: sichtbarer Fokusrahmen für Tastaturnavigation */
#neustart-button:focus-visible {
  outline: 3px solid #f0c040;
  outline-offset: 3px;
}

/* Container für Canvas und Overlays; position:relative für absolute Kinder */
#spielfeld-container {
  position: relative;
  width: 100%;
  /* Seitenverhältnis 480:640 = 3:4 erzwingen */
  aspect-ratio: 480 / 640;
}

/* Canvas responsiv; Seitenverhältnis 3:4 erhalten */
#spielfeld {
  display: block;
  width: 100%;
  height: auto;
  max-width: 480px;
  /* Touch-Events nicht vom Browser abfangen – Spiel verarbeitet sie selbst */
  touch-action: none;
  border-radius: 4px;
}

/* Gemeinsame Overlay-Basis: absolut über dem Canvas zentriert */
#start-overlay,
#spielende-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  /* Halbtransparenter dunkler Hintergrund */
  background-color: rgba(13, 13, 26, 0.82);
  border-radius: 4px;
  padding: 24px;
  text-align: center;
}

/* hidden-Attribut erzwingen – überschreibt display:flex der Overlays */
[hidden] {
  display: none !important;
}

/* Überschrift im Spielende-Overlay */
#spielende-overlay h2 {
  font-size: 2rem;
  color: #f0c040;
}

/* Endstand- und Bestleistungs-Werte hervorheben */
#endstand,
#bestleistung {
  color: #f0c040;
  font-weight: 700;
}

/* Erklärungstext im Start-Overlay */
#start-overlay p {
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 340px;
  color: #c8c8e0;
}

/* Start-Button */
#start-button {
  background-color: #28a045;
  color: #ffffff;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 10px 28px;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

#start-button:hover {
  background-color: #34c058;
}

/* Barrierefreiheit: sichtbarer Fokusrahmen */
#start-button:focus-visible {
  outline: 3px solid #f0c040;
  outline-offset: 3px;
}