:root {
  --bg: #000000;
  --glass-bg: rgba(255, 255, 255, 0.15);
  --text: #fff;
}

body.light {
  --bg: #f0f0f0;
  --glass-bg: rgba(255, 255, 255, 0.55);
  --text: #111;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  /* Animierter weiß-blauer Gradient von Ecke zu Ecke */
  background: linear-gradient(135deg, #ffffff, #3a8dde, #ffffff, #3a8dde);
  background-size: 300% 300%;
  animation: rgb-bg 10s ease-in-out infinite;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Keyframes für den animierten RGB-Effekt */
@keyframes rgb-bg {
  0% {
    background-position: 0% 100%;
  }
  50% {
    background-position: 100% 0%;
  }
  100% {
    background-position: 0% 100%;
  }
}

.glass-topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 54px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(31, 38, 135, 0.1);
  gap: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 2px;
}

.theme-switch {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px; /* kleiner Abstand, damit Mond näher am Toggle ist */
}

.theme-switch .icon:last-child {
  margin-left: 0; /* wirklich kein Abstand mehr */
}

.settings-btn {
  margin-left: 10px; /* leicht links vom Theme-Switch */
}

#toggleTheme {
  display: none;
}

#toggleTheme:checked + .toggle-label .slider {
  transform: translateX(20px);
}

/* Light-Mode-Klasse für den Body */
body.light {
  --bg: #f0f0f0;
  --glass-bg: rgba(255, 255, 255, 0.55);
  --text: #111;
}

.toggle-label {
  position: relative;
  width: 40px;
  height: 20px;
  background: #ccc;
  border-radius: 20px;
  cursor: pointer;
  display: inline-block;
  margin-right: 0;   /* kein zusätzlicher Abstand zum Mond */
  margin-left: 0;    /* kein zusätzlicher Abstand zur Sonne */
}

.toggle-label .slider {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

#toggleTheme:checked + .toggle-label .slider {
  transform: translateX(20px);
}

.slide-box {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 400px;
  transition: opacity 0.5s, transform 0.5s;
  opacity: 1;
  z-index: 2;
}

.glassbox-wrapper {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center; /* jetzt wirklich vertikal und horizontal mittig */
}

.glass-box {
  position: relative;
  left: 0;
  top: 0;
  transform: none;
  min-width: 320px;
  max-width: 400px;
  width: 90vw;
  min-height: 340px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 30px 20px 30px 20px;
  text-align: center;
  box-shadow: 0 0 20px rgba(31, 38, 135, 0.2);
  transition: transform 0.5s cubic-bezier(.77,0,.18,1), opacity 0.5s;
  opacity: 1;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* jetzt auch vertikal mittig */
}

.glass-box.slide-out-left {
  transform: translateX(-120vw);
  opacity: 0;
  pointer-events: none;
}

.glass-box.slide-in-right {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.glass-box.slide-in-from-right {
  transform: translateX(120vw);
  opacity: 0;
  pointer-events: none;
}

.glass-box.slide-in-from-right.slide-in-right {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

button {
  margin: 8px;
  padding: 10px 18px;
  font-size: 1rem;
  border: none;
  border-radius: 12px;
  background: #222;
  color: white;
  cursor: pointer;
}

body.light button {
  background: #ddd;
  color: #000;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  margin-right: 0; /* Abstand entfernt */
  font-size: 1rem;
}

.menu-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.menu-label {
  font-size: 0.7rem;
  margin-top: -2px;
}

.clock {
  font-size: 1.3rem;
  font-family: 'Courier New', monospace;
  margin-right: auto;
  margin-left: 8px;
}

.settings-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1.5rem;
  margin-left: 0; /* kein Abstand mehr nötig */
}

.settings-modal {
  display: block;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 54px; /* direkt unter der Topbar */
  left: 60px; /* Abstand zum linken Rand, ggf. anpassen */
  min-width: 220px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 24px 32px;
  box-shadow: 0 0 20px rgba(31, 38, 135, 0.2);
  z-index: 200;
  transition: opacity 0.3s ease;
}

.settings-modal.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 600px) {
  .settings-modal {
    left: 8px;
    right: 8px;
    min-width: unset;
    width: auto;
  }
}

.settings-content label,
.settings-content select,
.settings-content button {
  display: block;
  margin-bottom: 12px;
}

#stopwatchControls,
#countdownControls {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.button-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
  margin-top: 40px;
  width: 100%;
}

.button-row button {
  flex: 1 1 0;
  min-width: 70px;
  max-width: 120px;
}

.countdown-arrow {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--glass-bg);
  border: none;
  border-radius: 50%;
  font-size: 1.5em;
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  transition: background 0.2s;
  z-index: 3;
}
.countdown-arrow:hover {
  background: rgba(58, 141, 222, 0.3);
}

.time-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 18px 0 0 0;
}

.cd-select {
  font-size: 1.2em;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #3a8dde;
  background: rgba(255,255,255,0.15);
  color: var(--text);
  outline: none;
  transition: box-shadow 0.2s, border 0.2s;
  box-shadow: 0 2px 8px rgba(31,38,135,0.08);
  appearance: none;
  scrollbar-width: thin;
  max-height: 2.2em;
}

.cd-select:focus {
  border: 1.5px solid #3a8dde;
  box-shadow: 0 0 8px #3a8dde44;
}

.cd-sep {
  font-size: 1.3em;
  color: #3a8dde;}