*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, Segoe UI, Roboto, Arial, sans-serif;
  margin: 1rem;
  background: #f9f9f9;
  color: #000;
}

/* --- HEADER & TITEL --- */
h1 {
  width: -moz-fit-content;
  width: fit-content;
  margin-inline: auto;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: transparent;
  background: linear-gradient(45deg, #81d4fa, #2196f3);
  -webkit-background-clip: text;
  background-clip: text;
  text-align: center;
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  margin-top: 0;
  margin-bottom: 0.1rem;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transform: translateZ(0);
  filter: drop-shadow(0 0 8px rgba(33, 150, 243, 0.3));
  transition: filter 0.3s ease, transform 0.2s;
}

h1:hover {
  filter: drop-shadow(0 0 12px rgba(33, 150, 243, 0.6));
  transform: scale(1.02) translateZ(0);
}

/* --- LOGO & ANIMATIONEN --- */
.icy-logo {
  height: 1.25em;
  width: auto;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.icy-logo.flying {
  animation: penguinFly 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.icy-logo.chilling {
  animation: bearChill 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes penguinFly {
  0% {
    opacity: 0;
    transform: translateY(-50px) scale(0) rotate(-45deg);
  }
  60% {
    transform: translateY(10px) scale(1.2) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes bearChill {
  0% {
    opacity: 0;
    transform: translateY(-30px) scale(0.5) rotate(-20deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

/* --- EASTER EGG HINT --- */
.easter-hint {
  font-size: 0.75rem;
  color: #2196f3;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  margin-top: -0.3rem;
  margin-bottom: 0.4rem;
  min-height: 1rem;
  font-weight: 500;
  pointer-events: none;
}

.easter-hint.show {
  opacity: 1;
}

/* --- AKTUELL BOX --- */
.now {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  font-size: 1.05rem;
  padding: 0.5rem 0.7rem;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 0.5rem;
  gap: 0.3rem;
  line-height: 1.3;
}

.trend {
  margin: 0 0 0.8rem;
  padding: 0.35rem 0.7rem;
  background: #eef7ff;
  border-radius: 0.5rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  font-size: 0.9rem;
}

/* --- LEGENDE --- */
.legend {
  text-align: center;
  margin: 0.2rem 0 0.7rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0.6rem;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  display: inline-block;
  border-radius: 50%;
}

.dot.red { background: #e53935; }
.dot.blue { background: #1e88e5; }

/* --- CONTROLS --- */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0 0 0.8rem;
  min-height: 2.2rem;
}

.controls button {
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  background: #f7f7f7;
  border: 1px solid #ddd;
  cursor: pointer;
  font-size: 0.85rem;
  color: #444;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-weight: 500;
}

.controls button:hover {
  background: #eaeaea;
  transform: translateY(-1px);
}

.controls button.active {
  background: #2196f3;
  color: #fff;
  border-color: #1e88e5;
  box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.reset-zoom-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.15);
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  min-width: 2rem;
  transition: opacity 0.3s;
}

/* --- CHART CONTAINER --- */
.chart-container {
  position: relative;
  height: 400px;
  background: #fff;
  padding: 0.5rem 0.5rem 0.8rem;
  border-radius: 0.8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 0.7rem;
  overflow: hidden;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* --- FOOTER --- */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.1rem 0 0.25rem;
  min-height: 2.2rem;
}

.range-indicator {
  padding: 0.3rem 0.7rem;
  background: #ffffffcc;
  border-radius: 0.45rem;
  font-size: 0.85rem;
  color: #555;
  border: 1px solid rgba(0,0,0,0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 3.5rem);
}

.theme-toggle {
  font-size: 1.1rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #ddd;
  cursor: pointer;
  min-width: 2.4rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* --- LISTE --- */
.eisbaden-list {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.9;
  padding: 0.4rem 0.1rem;
  min-height: 3.2rem;
}

.eisbaden-list h3 {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
}

.eisbaden-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.eisbaden-list li {
  margin-bottom: 0.2rem;
}

/* --- DARK MODE --- */
html[data-theme="dark"] body {
  background: #121212;
  color: #eee;
}

html[data-theme="dark"] .now,
html[data-theme="dark"] .trend,
html[data-theme="dark"] .chart-container {
  background: #1e1e1e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

html[data-theme="dark"] .controls button {
  background: #2c2c2c;
  border-color: #444;
  color: #ccc;
}

html[data-theme="dark"] .controls button.active {
  background: #2196f3;
  color: #fff;
  border-color: #2196f3;
}

html[data-theme="dark"] .reset-zoom-btn,
html[data-theme="dark"] .theme-toggle {
  background: #2c2c2c;
  border-color: #444;
  color: #eee;
}

html[data-theme="dark"] .range-indicator {
  color: #aaa;
  background: rgba(255,255,255,0.05);
  border-color: #333;
}

html[data-theme="dark"] .eisbaden-list h3 {
  color: #ddd;
}

/* --- MOBILE OPTIMIERUNG --- */
@media (max-width: 600px) {
  .chart-container {
    height: 320px;
    padding: 0.3rem 0.3rem 0.6rem;
  }

  h1 {
    max-width: 100%;
    flex-wrap: nowrap;
    gap: 0.4rem;
    padding: 0.2rem 0.5rem;
  }
  
  .icy-logo {
    height: 1.6em;
  }

  .now {
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem;
    margin-top: 0.1rem;
  }

  .now-separator {
    display: none;
  }

  .now-bottom {
    font-size: 1.1rem;
    display: block;
    font-weight: 500;
  }

  .now-top {
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 0.1rem;
  }

  html[data-theme="dark"] .now-top {
    color: #aaa;
  }

  .range-indicator {
    font-size: 0.75rem;
    max-width: 65%;
    padding: 0.25rem 0.5rem;
  }
}
