:root {
  --neon-cyan:    #00f5ff;
  --neon-magenta: #ff00aa;
  --neon-amber:   #ffb300;
  --neon-green:   #39ff14;
  --neon-red:     #ff2244;
  --bg-dark:      #050510;
  --bg-card:      rgba(10, 10, 30, 0.92);
  --text-main:    #e0e8ff;
  --glow-sm:      0 0 6px currentColor, 0 0 12px currentColor;
  --glow-md:      0 0 8px currentColor, 0 0 20px currentColor, 0 0 40px currentColor;
}

/* Klassisches Tag-Theme */
body.light {
  --neon-cyan:    #1a3a6e;
  --neon-magenta: #8a1050;
  --neon-amber:   #8a4000;
  --neon-green:   #005500;
  --neon-red:     #aa0000;
  --bg-dark:      #d8dcec;
  --bg-card:      rgba(220, 224, 236, 0.97);
  --text-main:    #111122;
  --glow-sm:      none;
  --glow-md:      none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-dark);
  font-family: 'Courier New', monospace;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
}

#game-wrapper {
  display: flex;
  flex-direction: column;
  width: 800px;
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 20px var(--neon-cyan), 0 0 60px rgba(0,245,255,0.2);
}

#hud {
  background: var(--bg-card);
  border-bottom: 2px solid var(--neon-cyan);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--neon-cyan);
  text-shadow: var(--glow-sm);
  letter-spacing: 2px;
  white-space: nowrap;
}

#hud-center {
  display: flex;
  gap: 24px;
  align-items: center;
}

#score-display, #time-display {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#score-label, #time-label {
  font-size: 0.6rem;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  opacity: 0.7;
}

#score-value {
  font-size: 1.6rem;
  font-weight: bold;
  color: var(--neon-amber);
  text-shadow: var(--glow-sm);
  min-width: 80px;
  text-align: center;
  transition: transform 0.1s;
}

#score-value.bump {
  transform: scale(1.3);
}

#time-value {
  font-size: 1.2rem;
  color: var(--text-main);
}

#combo-display {
  display: flex;
  align-items: center;
  gap: 6px;
}

#combo-display.hidden { display: none; }

#combo-text {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--neon-amber);
  text-shadow: var(--glow-md);
}

#speed-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 80px;
}

#speed-label {
  font-size: 0.6rem;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  opacity: 0.7;
}

#speed-bar-outer {
  width: 80px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(0,245,255,0.3);
}

#speed-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  box-shadow: var(--glow-sm);
  transition: width 0.3s, background 0.5s;
}

#game-area {
  position: relative;
  width: 800px;
  height: 500px;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 800px;
  height: 500px;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 16, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10;
}

.overlay.hidden { display: none; }

#neon-title {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--neon-cyan);
  text-shadow: var(--glow-md);
  animation: flicker 4s infinite;
}

@keyframes flicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.4; }
  97% { opacity: 1; }
  98% { opacity: 0.2; }
  99% { opacity: 0.9; }
}

#version-badge {
  background: var(--neon-magenta);
  color: white;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  letter-spacing: 2px;
  box-shadow: var(--glow-sm);
}

#start-instructions {
  text-align: center;
  color: rgba(200,220,255,0.75);
  font-size: 0.9rem;
  line-height: 1.8;
}

#start-hint {
  color: var(--neon-amber);
  font-weight: bold;
  letter-spacing: 3px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#top-scores-preview {
  font-size: 0.82rem;
  color: #a8d4ff;
  text-align: center;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(0,180,255,0.4);
}

#gameover-title {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--neon-red);
  text-shadow: var(--glow-md);
  letter-spacing: 6px;
  animation: flicker 3s infinite;
}

#gameover-subtitle {
  color: rgba(200,220,255,0.7);
  font-style: italic;
  font-size: 1rem;
}

#gameover-score-wrap {
  font-size: 1.4rem;
  color: var(--neon-amber);
  text-shadow: var(--glow-sm);
  gap: 8px;
  display: flex;
}

#gameover-score { font-weight: bold; }

#name-input-wrap {
  display: flex;
  gap: 8px;
}

#player-name {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--neon-cyan);
  color: var(--text-main);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 1rem;
  border-radius: 4px;
  outline: none;
}

#player-name:focus { box-shadow: 0 0 10px var(--neon-cyan); }

#save-score-btn, #restart-btn {
  background: transparent;
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  padding: 6px 18px;
  font-family: inherit;
  font-size: 0.9rem;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

#save-score-btn:hover, #restart-btn:hover {
  background: var(--neon-cyan);
  color: var(--bg-dark);
  box-shadow: var(--glow-sm);
}

#restart-btn {
  border-color: var(--neon-amber);
  color: var(--neon-amber);
  font-size: 1.1rem;
  padding: 10px 30px;
  margin-top: 8px;
}

#restart-btn:hover {
  background: var(--neon-amber);
  color: var(--bg-dark);
}

#highscore-list {
  font-size: 0.85rem;
  color: #c8e0ff;
  text-align: center;
  line-height: 1.8;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(0,200,255,0.5);
}

#quality-footer {
  background: var(--bg-card);
  border-top: 2px solid rgba(0,245,255,0.3);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

#quality-label {
  font-size: 0.75rem;
  letter-spacing: 1px;
  white-space: nowrap;
  min-width: 180px;
}

#quality-text {
  color: var(--neon-green);
  font-weight: bold;
}

#quality-bar-outer {
  flex: 1;
  height: 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}

#quality-bar-inner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--neon-red), var(--neon-amber) 40%, var(--neon-green));
  background-size: 300% 100%;
  background-position: right center;
  transition: width 0.3s, background-position 0.5s;
  box-shadow: 0 0 6px var(--neon-green);
}

#quality-footer.critical #quality-bar-inner {
  animation: quality-flash 0.5s infinite;
  background-position: left center;
}

@keyframes quality-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (max-width: 820px) {
  #game-wrapper { width: 100vw; }
  #game-canvas { width: 100vw; height: auto; }
  #game-area { width: 100vw; height: auto; }
  #combo-display { display: none !important; }
}

/* ============================================================
   LIGHT THEME OVERRIDES — vollständige Neufassung
   Ziel: alle Texte lesbar, Kontraste ausbalanciert
   ============================================================ */

/* Rahmen & Hülle */
body.light #game-wrapper {
  border: 2px solid #2a4a80;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

/* HUD-Leiste */
body.light #hud {
  background: #dde2ef;
  border-bottom: 2px solid #2a4a80;
}

body.light #logo {
  color: #1a3a6e;
}

/* Labels (score/time/speed) — opacity entfernen, größer + fetter */
body.light #score-label,
body.light #time-label,
body.light #speed-label {
  color: #0d2452;
  opacity: 1;
  font-size: 0.65rem;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Score-Wert */
body.light #score-value {
  color: #7a3200;
  text-shadow: none;
}

/* Zeit-Wert */
body.light #time-value {
  color: #111122;
}

/* Combo */
body.light #combo-text {
  color: #8a4000;
  text-shadow: none;
}

/* Tempo-Balken */
body.light #speed-bar-outer {
  border: 2px solid #2a4a80;
  background: #b8c0d8;
}

body.light #speed-bar-inner {
  background: linear-gradient(90deg, #007722, #8a4000);
  box-shadow: none;
}

/* Overlay-Hintergrund */
body.light .overlay {
  background: rgba(220, 224, 236, 0.97);
}

/* Titel (Start) */
body.light #neon-title {
  color: #1a3a6e;
  text-shadow: 0 2px 8px rgba(26,58,110,0.25);
  animation: none;
}

/* Version-Badge */
body.light #version-badge {
  background: #1a3a6e;
  color: #fff;
  box-shadow: none;
}

/* Theme-Auswahl-Buttons */
body.light .theme-btn {
  border: 2px solid #2a4a80;
  background: #c8d0e8;
  color: #111122;
  box-shadow: none;
}

body.light .theme-btn:hover {
  background: #b0bcd8;
}

body.light .theme-btn.active {
  background: #1a3a6e;
  color: #fff;
  border-color: #0d2452;
}

/* Anweisungstext */
body.light #start-instructions {
  color: #1e2a44;
}

/* "KLICKEN ODER TASTE DRÜCKEN" */
body.light #start-hint {
  color: #8a4000;
}

/* Top-Scores Vorschau im Startmenü */
body.light #top-scores-preview {
  color: #1a3a6e;
  text-shadow: none;
}

/* Game-Over-Overlay */
body.light #gameover-title {
  color: #aa0000;
  text-shadow: 0 2px 6px rgba(170,0,0,0.3);
  animation: none;
}

body.light #gameover-subtitle {
  color: #2a2a4a;
  font-style: italic;
}

body.light #gameover-score-wrap {
  color: #8a4000;
  text-shadow: none;
}

/* Highscore-Liste */
body.light #highscore-list {
  color: #1a2a50;
  text-shadow: none;
}

/* Namenseingabe */
body.light #player-name {
  background: #f0f2f8;
  color: #111122;
  border: 2px solid #2a4a80;
}

body.light #player-name:focus {
  box-shadow: 0 0 0 2px rgba(42,74,128,0.4);
}

/* Buttons */
body.light #save-score-btn,
body.light #restart-btn {
  background: #1a3a6e;
  color: #fff;
  border: 2px solid #0d2452;
  box-shadow: none;
}

body.light #save-score-btn:hover,
body.light #restart-btn:hover {
  background: #2a5aaa;
  color: #fff;
  box-shadow: none;
}

/* Qualitäts-Fußzeile */
body.light #quality-footer {
  background: #dde2ef;
  border-top: 2px solid #2a4a80;
}

body.light #quality-label {
  color: #111122;
}

body.light #quality-text {
  color: #005500;
}

body.light #quality-bar-outer {
  border: 2px solid #2a4a80;
  background: #b8c0d8;
}

body.light #quality-bar-inner {
  box-shadow: none;
}

/* Theme Selector Buttons */
#theme-selector {
  display: flex;
  gap: 16px;
  margin: 20px 0;
  justify-content: center;
}

.theme-btn {
  padding: 10px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  border: 2px solid var(--neon-cyan);
  background: rgba(0,0,0,0.5);
  color: var(--neon-cyan);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  transition: all 0.2s;
}

.theme-btn:hover {
  background: rgba(0,245,255,0.1);
}

.theme-btn.active {
  background: var(--neon-cyan);
  color: #000;
}
