body {
  font-family: Arial, sans-serif;
  text-align: center;
  background-color: #f4f4f4;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Verhindert ungewolltes Scrollen */
}

canvas {
  background-color: #333;
  display: block;
  margin: 0 auto;
  border: 2px solid #ff9800;
  position: relative;
}

#scoreBoard {
  font-size: 20px;
  margin-top: 10px;
  color: #ff9800;
}

#gameOver {
  margin-top: 20px;
}

#startScreen {
  margin-top: 100px;
}

/* NEU: Animation für den Spieltitel */
@keyframes popIn {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.game-title {
  color: #ff9800; /* Orange Farbe für den Titel */
  font-size: 3em; /* Deutlich größerer Titel */
  margin-bottom: 30px; /* Mehr Abstand zum nächsten Element */
  animation: popIn 0.8s ease-out forwards; /* Animation anwenden */
}


/* Mobile Steuerung */
#mobileControls {
  display: flex;
  justify-content: center;
  gap: 40px; /* ABSTAND VERGRÖSSERT: Vorher 20px, jetzt 30px */
  margin-top: 20px;
  width: 100%;
  max-width: 480px; /* Oder die maximale Breite des Canvas, um Konsistenz zu wahren */
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box; /* Padding und Border nicht zur Breite hinzufügen */
  padding: 0 10px; /* Ein bisschen Padding an den Seiten */
}

#mobileControls button {
  font-family: Arial, sans-serif, "Segoe UI Emoji", "Apple Color Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 48px; /* Sehr große Schriftgröße für Pfeile */
  width: 132px; /* BREITE ERHÖHT: Vorher 120px, jetzt 132px (10% größer) */
  height: 88px; /* HÖHE ERHÖHT: Vorher 80px, jetzt 88px (10% größer) */
  background-color: #ff9800;
  border: none;
  border-radius: 12px; /* Etwas größere Rundung */
  color: white;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); /* Leichter Schatten */
  transition: background-color 0.2s ease, transform 0.1s ease; /* Übergang für Hover/Active */
}

#mobileControls button:active {
  transform: translateY(2px); /* Leichter "Klick"-Effekt */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}


@media (max-width: 600px) {
  canvas {
    width: 100%;
    height: auto;
  }
  #mobileControls {
      padding: 0 5px; /* Weniger Padding auf sehr kleinen Bildschirmen */
      gap: 20px; /* ABSTAND VERGRÖSSERT für kleine Bildschirme (war 10px) */
  }
  #mobileControls button {
    font-size: 36px; /* Kleinere Schriftgröße auf sehr kleinen Bildschirmen */
    width: 100px; /* BREITE ERHÖHT für kleine Bildschirme (war 90px, ca. 10% größer) */
    height: 70px; /* HÖHE ERHÖHT für kleine Bildschirme (war 60px, ca. 10% größer) */
    border-radius: 10px;
  }
  .game-title {
    font-size: 2.2em; /* Kleinere Schriftgröße für den Titel auf kleinen Bildschirmen */
  }
}

#mobileControls button:hover {
  background-color: #e68900;
}

/* Highscore- und Anleitung-Container */
#highScoresContainer,
#instructionScreen {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  max-width: 400px;
  width: 90%;
  max-height: 90%; /* Verhindert Überlauf auf kleinen Bildschirmen */
  overflow-y: auto; /* Scrollbar, wenn Inhalt zu lang */
  z-index: 20; /* Über dem Spiel-Canvas */
}

#highScoresContainer h2,
#instructionScreen h2 {
  color: #ff9800;
}

#highScoresList {
  list-style-type: none;
  padding: 0;
}

#highScoresList li {
  padding: 5px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
}

#highScoresList li:last-child {
  border-bottom: none;
}

.score-date {
  font-size: 0.8em; /* Kleinere Schriftgröße (z.B. 80% der Elterngröße) */
  color: #aaa;
  margin-left: 5px; /* Etwas Abstand zum Score */
}

#highScoresContainer button,
#instructionScreen button {
  margin-top: 20px;
  font-size: 18px;
  padding: 10px 20px;
  background-color: #ff9800;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
}

#highScoresContainer button:hover,
#instructionScreen button:hover {
  background-color: #e68900;
}


/* Anleitungsspezifisches Styling */
#instructionScreen h3 {
    color: #ff9800;
    margin-top: 15px;
    font-size: 1.2em;
}

#instructionScreen p, #instructionScreen ul {
    text-align: left;
    margin-bottom: 10px;
    line-height: 1.4;
    font-size: 0.95em;
}

#instructionScreen ul {
    list-style-type: disc;
    padding-left: 20px;
}

.object-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.object-item {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 8px;
    width: calc(50% - 15px); /* Zwei Spalten mit etwas Abstand */
    box-sizing: border-box;
    text-align: left;
}

.instruction-img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    object-fit: contain; /* Bildgröße anpassen */
}

.object-item span {
    flex-grow: 1;
    font-size: 0.9em;
}

/* Responsive Anpassungen für Anleitung */
@media (max-width: 600px) {
  .object-item {
    width: 100%; /* Auf kleinen Bildschirmen eine Spalte */
  }
  #instructionScreen {
      max-width: 95%; /* Auf kleinen Bildschirmen fast volle Breite */
      padding: 10px;
  }
  #instructionScreen h2 {
      font-size: 20px;
  }
  #instructionScreen h3 {
      font-size: 16px;
  }
  #instructionScreen p, #instructionScreen ul {
      font-size: 13px;
  }
  .object-item span {
      font-size: 12px;
  }
  .instruction-img {
      width: 30px;
      height: 30px;
  }
  #instructionScreen button {
      font-size: 14px;
      padding: 6px 12px;
  }
}

/* NEU: Blinking Animation für Highscore */
@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}

.new-highscore {
  animation: blink 1s linear infinite;
  color: #FFD700;
  font-weight: bold;
}

/* NEU: Ladebildschirm-Styles */
#loadingScreen {
  display: flex; /* Standardmäßig anzeigen, damit es sichtbar ist */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #333;
  color: white;
  font-size: 2em;
  z-index: 1000;
}

#loadingScreen h1 {
  margin-bottom: 20px;
  color: #ff9800;
}

/* Anpassung für Highscore-Listen, damit sie linksbündig sind */
#highScoresList,
#globalHighScoresList {
    list-style-type: none; /* NEU: Entfernt die Standard-Listenmarker des Browsers */
    text-align: left; /* Text linksbündig ausrichten */
    padding-left: 20px; /* Optional: Etwas Einzug von links, damit es nicht direkt am Rand klebt */
    margin: 0 auto; /* Zentriert die Liste selbst, wenn sie eine begrenzte Breite hat */
    max-width: 300px; /* Optional: Setzt eine maximale Breite für die Liste, damit sie nicht zu breit wird */
}

/* Optional: Anpassen des highScoresContainer, um die Überschrift zu zentrieren und den Inhalt linksbündig zu lassen */
#highScoresContainer {
    text-align: center; /* Zentriert den gesamten Container-Inhalt (z.B. Überschrift und Buttons) */
}

#highScoresContainer h2,
#highScoresContainer h3 {
    text-align: center; /* Stellt sicher, dass die Überschriften zentriert bleiben */
}