/* =========================================================
   FARBSYSTEM & THEMES
   ========================================================= */
:root {
  --bg-start: #e3e9f0;
  --bg-end:   #c8d4e3;
  --text:     #1c1c1c;
  --accent:   #007acc;
  --menu-bg:  #fff;
  --menu-border: #ccc;
}

body.dark {
  --bg-start: #1a1a1a;
  --bg-end:   #2a2a2a;
  --text:     #f2f2f2;
  --accent:   #5db2ff;
  --menu-bg:  #2a2a2a;
  --menu-border: #444;
}

/* =========================================================
   GRUNDEINSTELLUNGEN & LAYOUT
   ========================================================= */
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: linear-gradient(to bottom right, var(--bg-start), var(--bg-end));
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ---------------- HEADER ---------------- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  font-size: 1.2rem;
}
.app-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

/* =========================================================
   MENÜ LINKS
   ========================================================= */
.menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: var(--menu-bg);
  border-right: 2px solid var(--menu-border);
  box-shadow: 2px 0 10px rgba(0,0,0,0.3);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  padding: 20px;
  z-index: 1000;
  overflow-y: auto;
}
.menu.visible { transform: translateX(0); }
.menu-section { margin-bottom: 20px; }
.menu h2, .menu h3 { margin-top: 0; }

.menu-divider {
  border: none;
  border-top: 1px solid var(--menu-border);
  margin: 1.2rem 0;
  opacity: 0.6;
}

.menu-button {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
  margin-top: 10px;
}

.menu-button:hover {
  background: #005b99; /* dunkleres Blau bei Hover */
}

/* --- Schalter / Switches --- */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  border-radius: 26px;
  transition: .3s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
}
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(24px); }

/* =========================================================
   HAUPTINHALT / UHR
   ========================================================= */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
}

/* --- Uhr / Zeiger --- */
.clock-container {
  position: relative;
  width: min(80vmin, 500px);
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
  margin-bottom: 2rem;
}
.clock-container img {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#ziffernblatt_24h {
  transform: translate(-50%, -50%) scale(0.60);
}
#stundenzeiger, #minutenzeiger {
  transform-origin: 50% 50%;
}
.hidden { display: none; }

#secondWrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#sekundenzeiger {
  display: none;
  width: 600px;
  height: auto;
  transform-origin: 50% 50%;
  pointer-events: none;
  z-index: 4;
}

/* =========================================================
   SLIDER + ZEITSTRAHL
   ========================================================= */
#sliderContainer {
  position: relative;
  width: 90%;
  max-width: 800px;
  margin: 3rem auto 2rem;
  height: 2.2rem;
  border-radius: 8px;
  background: linear-gradient(
    to right,
    #fcbf49 0%,     /* Morgen */
    #ffd166 25%,    /* Vormittag */
    #f77f00 40%,    /* Mittag */
    #90e0ef 60%,    /* Nachmittag */
    #457b9d 80%,    /* Abend */
    #1d3557 100%    /* Nacht */
  );
}

#timeSlider {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  background: transparent;
  z-index: 2;
  height: 1.2rem;
  touch-action: none;
}

#timeSlider::-webkit-slider-thumb,
#timeSlider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
}

/* =========================================================
   ZEITTEXT UNTER DER UHR
   ========================================================= */
#timeLabel {
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
  margin-top: 2rem;
  transition: background 1.5s ease, color 1.5s ease;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

#timeLabel.morgens      { color: #d96b00; }
#timeLabel.vormittags   { color: #b84e00; }
#timeLabel.mittags      { color: #183b8f; }
#timeLabel.nachmittags  { color: #922222; }
#timeLabel.abends       { color: #5b0b0b; }
#timeLabel.nachts       { color: #000000; }

body.dark #timeLabel.morgens      { color: #ffb366; }
body.dark #timeLabel.vormittags   { color: #ff9966; }
body.dark #timeLabel.mittags      { color: #00ffff; }
body.dark #timeLabel.nachmittags  { color: #66ccff; }
body.dark #timeLabel.abends       { color: #99aaff; }
body.dark #timeLabel.nachts       { color: #ffffff; }

.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease forwards;
}
@keyframes fadeIn { to { opacity: 1; } }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 800px) {
  h1 { font-size: 1rem; }
  #timeLabel { font-size: 1.3rem; }
  #timeSlider::-webkit-slider-thumb,
  #timeSlider::-moz-range-thumb {
    width: 24px; height: 24px;
  }
}

/* =========================================================
   OVERLAY & ANLEITUNG
   ========================================================= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  transition: opacity 0.3s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  background: var(--menu-bg);
  color: var(--text);
  border: 2px solid var(--menu-border);
  border-radius: 10px;
  padding: 20px;
  width: min(90%, 420px);
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

.overlay-content h2 {
  margin-top: 0;
  text-align: center;
}

/* Wenn HUD im Level hängt, nicht fixed/sticky, sondern als normale Karte */
.hud--in-level {
  position: static !important;
  align-self: stretch;
  width: 100%;
  max-width: 760px;         /* an deine Task-Kartenbreite anpassen */
  margin: 0 0 12px 0;       /* Abstand nach unten */
  border-radius: 14px;      /* passt zum Kartenlook */
}

/* HUD standardmäßig ausblenden – nur in Level 16 zeigen */
.hud { display: none; }
body.in-level16 .hud { display: flex; }