/* ==========================================
   CSS-VARIABLEN & THEMES
   ========================================== */
:root {
  /* Moderne, elegante serifenlose Schriftart */
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-small: 6px;
  --radius-medium: 12px;
  --radius-large: 24px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 3rem;
  
  --bg-color: #f4f7f6;
  --text-color: #1e293b;
  --card-bg: #ffffff;
  --border-color: #cbd5e1;
  --accent-primary: #0284c7;
  --accent-hover: #0369a1;
  --accent-bg: #e0f2fe;
  --accent-active: #bae6fd;
  
  /* Neue markante Farbe für den Nächste-Runde-Button */
  --accent-success: #10b981;
  --accent-success-hover: #059669;
}

@media (prefers-color-scheme: dark) {
  body {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: #1e293b;
    --border-color: #334155;
    --accent-primary: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-bg: #0c4a6e;
    --accent-active: #0369a1;
    --accent-success: #34d399;
    --accent-success-hover: #059669;
  }
}

body {
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  user-select: none;
}

#seite_main {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  max-width: 600px;
  margin: 0 auto;
}

section {
  background-color: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-medium);
  padding: var(--spacing-sm);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 var(--spacing-xs) 0;
  text-align: center;
  opacity: 0.9;
}

button {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  background-color: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-small);
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
@media (hover: hover) {
  button:hover { background-color: var(--accent-hover); }
}
button:active { transform: scale(0.98); }

/* ELEGANTER FLARE-GLITZER-EFFEKT (Langsamer & breiterer Lichtkegel) */
.glitter-btn {
  position: relative;
  overflow: hidden;
}
.glitter-btn::after {
  content: '';
  position: absolute;
  top: -50%; left: -100%; width: 60%; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: rotate(25deg);
  animation: shimmer 4s infinite ease-in-out;
}
@keyframes shimmer {
  0% { left: -100%; }
  50% { left: 160%; }
  100% { left: 160%; }
}

/* Auffälliger Nächste-Runde-Button */
#p_aktuelleRunde {
  background-color: var(--accent-success);
  font-size: 1.1rem;
  margin-top: var(--spacing-xs);
}
@media (hover: hover) {
  #p_aktuelleRunde:hover { background-color: var(--accent-success-hover); }
}

.timer-presets {
  display: flex;
  gap: var(--spacing-xs);
  justify-content: center;
  flex-wrap: wrap; /* Ermöglicht das Umbrechen bei Platzmangel */
}
.preset-btn {
  background-color: var(--card-bg);
  border: 2px solid var(--border-color);
  color: var(--text-color);
  flex: 1 1 calc(50% - var(--spacing-xs)); /* Erzwingt paarweises Umbrechen */
  min-width: 80px;
}

.preset-btn.active {
  border: 2px solid var(--accent-primary);
}

#input_Stoppuhr_Zeit {
  text-align: center;
  font-size: 1rem;
  padding: 0.5rem;
  border-radius: var(--radius-small);
  border: 2px solid var(--accent-primary);
  background-color: var(--bg-color);
  color: var(--text-color);
  outline: none;
}

/* ==========================================
   GAME CONTROLS (ZENTRALE STEUERUNG)
   ========================================== */

/* Der alleinstehende Info-Text (Unauffällig & Elegant) */
#p_wievieleBuchstabenAusgewählt {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-color, #94a3b8);
  opacity: 0.7;              /* Lässt die Info edel in den Hintergrund treten */
  margin: 0;                 /* Killt Standard-P-Abstände für präzises Gap-Scaling */
  letter-spacing: 0.02em;
  text-align: center;
}

/* ==========================================
   BUCHSTABEN-HISTORIE
   ========================================== */

.badge-runde {
  display: block;             /* Macht das Badge zu einem Block-Element für margin: auto */
  width: 20%;
  min-width: 65px;
  margin: 0 auto 2px auto;   /* Zentriert das Badge autark in der Mitte, ohne andere Elemente anzufassen */
  box-sizing: border-box;
  
  position: relative;
  background-color: var(--accent-primary, #0284c7);
  color: white;
  font-size: 0.65rem;         /* Leicht verkleinert, damit der Text bei kompakter Breite perfekt reinpasst */
  font-weight: bold;
  padding: 4px 0;             /* Kein horizontales Padding, damit das Badge exakt die definierte Breite hält */
  text-align: center;         /* Zentriert den Text "Runde X" innerhalb der festen Breite */
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Der Pfeil bleibt unverändert exakt in der Mitte verankert */
.badge-runde::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: var(--accent-primary, #0284c7) transparent;
}

#div_containerBuchstaben {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-xs);
  background-color: var(--bg-color);
  padding: var(--spacing-xs);
  border-radius: var(--radius-medium);
}

.carousel-item {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-small);
  background-color: var(--card-bg);
  font-weight: bold;
  cursor: pointer;
  width: 16%;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

#p_Anzeige_buchstabe3 { width: 26%; font-size: 2rem; }
#p_Anzeige_buchstabe2, #p_Anzeige_buchstabe4 { width: 20%; font-size: 1.5rem; }

.aktuelles_Feld {
  background-color: var(--accent-active) !important;
  border-color: var(--accent-primary) !important;
}

/* ==========================================
   SECTION 3 & DROPDOWN (Kein Scrollen mehr)
   ========================================== */
.section3 {
  position: relative;
}

.dropdown { 
  position: relative; 
  display: inline-block; 
  width: 100%; 
}

.dropbtn { 
  width: 100%; 
  background-color: var(--accent-primary); 
}

.dropdown-content {
  display: none;
  position: relative; 
  width: 100%;
  background-color: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-small);
  margin-top: var(--spacing-xs);
  box-sizing: border-box;
  /* Scrollen entfernt, passt sich dem Inhalt vollständig an */
  max-height: none;
  overflow-y: visible;
}

.dropdown-content.show {
  display: block;
}

.dropdown-content span {
  padding: 10px 16px;
  display: block;
  cursor: pointer;
  color: var(--text-color);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.dropdown-content span:last-child {
  border-bottom: none;
}
@media (hover: hover) {
  .dropdown-content span:hover { background-color: var(--accent-bg); }
}

/* Aktive Kategorie Titel */
#div_AktiveKategorieTitel {
  font-weight: bold;
  font-size: 1.1rem;
  margin-top: var(--spacing-sm);
  margin-bottom: 2px;
  text-align: left;
  display: none; /* Wird via JS eingeblendet */
}

#div_Beispiele { display: flex; flex-direction: column; gap: 4px; }
#div_Beispiele p { margin: 0; padding: 6px; background-color: var(--bg-color); border-radius: 4px; }

/* ==========================================
   BOMBENFESTES OVERLAY
   ========================================== */
.fullscreen-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: #0f172a;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #ffffff;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  transition: background-color 0.5s ease;
}

.fullscreen-overlay.overlay-alarm {
  animation: backgroundAlarm 1.5s infinite alternate;
}
@keyframes backgroundAlarm {
  0% { background-color: #581c1c; }
  100% { background-color: #851e1e; }
}

#countdown_spannung {
  font-size: 8rem; font-weight: 800; color: #38bdf8;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
  animation: zoomCountdown 1s infinite ease-in-out;
  flex-shrink: 0;
}

#aktive_runde_content {
  width: 100%; max-width: 450px; height: 100%;
  min-height: 550px;
  display: flex; flex-direction: column;
  justify-content: space-between; align-items: center;
  padding: var(--spacing-md) var(--spacing-sm);
  box-sizing: border-box;
  flex-shrink: 0;
}

.directional-letters { position: relative; width: 260px; height: 260px; flex-shrink: 0; }

/* Unmissverständliche Schriftart für die Buchstabenanzeige */
.letter-box {
  position: absolute;
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 4rem; font-weight: 900; color: #ffffff; width: 75px; height: 75px;
  display: flex; align-items: center; justify-content: center;
  background: #1e293b; border: 2px solid #38bdf8;
  border-radius: var(--radius-medium);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}
.north { top: 0; left: 92px; transform: rotate(180deg); }
.east  { top: 92px; right: 0; transform: rotate(-90deg); }
.south { bottom: 0; left: 92px; }
.west  { top: 92px; left: 0; transform: rotate(90deg); }

.current-round-letter {
  text-decoration: underline;
  text-underline-offset: 8px;
  text-decoration-thickness: 6px;
  text-decoration-color: #38bdf8;
  display: inline-block;
}

.visual-timer-container { position: relative; width: 220px; height: 220px; flex-shrink: 0; }
.timer-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer-circle-bg { fill: none; stroke: #334155; stroke-width: 12; }
.timer-circle-progress {
  fill: none; stroke: #38bdf8; stroke-width: 12;
  stroke-dasharray: 534; stroke-dashoffset: 0;
  stroke-linecap: round; transition: stroke-dashoffset 1s linear;
}

#p_Anzeige_Stoppuhr {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

#button_manuellStoppuhrBeenden { background-color: #ef4444; flex-shrink: 0; width: 100%; }

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: rgba(15, 23, 42, 0.85); backdrop-filter: blur(4px); z-index: 200;
  display: flex; justify-content: center; align-items: center;
}
.modal-box {
  background-color: var(--card-bg); border: 2px solid var(--accent-primary);
  border-radius: var(--radius-medium); padding: var(--spacing-md); text-align: center;
  max-width: 90%; width: 320px;
}
.modal-box p { font-size: 1.2rem; font-weight: 600; margin-bottom: var(--spacing-md); }
.modal-buttons { display: flex; gap: var(--spacing-sm); }
.modal-buttons button { flex: 1; }
#btn_confirm_ja { background-color: var(--accent-primary); }
#btn_confirm_nein { background-color: #64748b; }

/* ==========================================
   ORBIT SEITE (Optimiert & Kompakt)
   ========================================== */
#seite_buchstaben_auswählen {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: #0f172a; overflow: hidden; z-index: 50;
  display: flex; justify-content: center; align-items: center;
}
.zentrum-fokus { 
  text-align: center; 
  z-index: 60; 
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.zentrum-fokus h1 { 
  color: white; 
  font-size: 1rem; 
  margin: 0 0 4px 0; 
  text-transform: uppercase; 
  letter-spacing: 0.05em;
  opacity: 0.8;
}
.zentrum-fokus button {
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  width: 150px;
}
#btn_auswahl_zuruecksetzen {
  background-color: #475569; /* Unauffälligeres Grau als Zweitfunktion */
}
@media (hover: hover) {
  #btn_auswahl_zuruecksetzen:hover { background-color: #334155; }
}

.fliegender-buchstabe {
  position: absolute; width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: #0284c7; color: white; border-radius: 50%; font-size: 1.1rem;
}
.fliegender-buchstabe.abgewaehlt { background: #475569; color: #94a3b8; opacity: 0.2; }