/* ===================================================
   WINTER WONDERLAND ADVENTSKALENDER
   Farben: Schnee-Weiß, Eis-Blau, Violett & Lila
   Schneelandschaft mit Tannen, Schneemann & fliegendem Weihnachtsmann
   =================================================== */

:root {
  --bg-night-top: #0a1120;
  --bg-night-mid: #131e36;
  --bg-night-bottom: #1d2d4d;
  
  --ice-blue-light: #d6eaff;
  --ice-blue: #7bb8f5;
  --soft-purple: #c4b5fd;
  --vibrant-purple: #8b5cf6;
  --purple-glow: rgba(196, 181, 253, 0.45);
  --blue-glow: rgba(123, 184, 245, 0.4);
  
  --snow-white: #ffffff;
  --snow-shadow: #cbe3fc;
  
  --door-bg: rgba(22, 34, 58, 0.72);
  --door-border: rgba(196, 181, 253, 0.38);
  --door-opened: rgba(45, 28, 48, 0.78);
  
  --shadow-frost: 0 10px 25px rgba(0, 0, 0, 0.65);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(180deg, var(--bg-night-top) 0%, var(--bg-night-mid) 40%, var(--bg-night-bottom) 100%);
  color: #ffffff;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===================================================
   SCHNEELANDSCHAFT IM HINTERGRUND
   =================================================== */
.landscape-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 48vh;
  min-height: 260px;
  max-height: 520px;
  pointer-events: none;
  z-index: 1;
}

.landscape-svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: bottom center;
}

/* ===================================================
   FLIEGENDER WEIHNACHTSMANN (GLEITET GLEICHMÄSSIG DURCH)
   =================================================== */
.santa-fly-container {
  position: fixed;
  top: 12%;
  left: -320px;
  width: 260px;
  height: 80px;
  pointer-events: none;
  z-index: 2;
  animation: flyAcrossSky 28s linear infinite;
  animation-delay: 1.5s;
}

@keyframes flyAcrossSky {
  0% {
    transform: translateX(0);
    opacity: 0;
  }
  1% {
    opacity: 0.95;
  }
  34% {
    transform: translateX(calc(100vw + 450px));
    opacity: 0.95;
  }
  35% {
    transform: translateX(calc(100vw + 450px));
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 0;
  }
}

.santa-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 20px rgba(196, 181, 253, 0.6));
}

/* Schnee Canvas */
#snow-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* ===================================================
   LICHTERKETTE OBEN (LILA, EISBLAU & WEISS)
   =================================================== */
.fairy-lights {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-around;
  padding: 0 15px;
  pointer-events: none;
  z-index: 3;
}

.light-bulb {
  width: 11px;
  height: 16px;
  border-radius: 50% 50% 45% 45%;
  position: relative;
  animation: glow-pulse 2.4s infinite alternate ease-in-out;
}

.light-bulb::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 4px;
  background: #3a4964;
  border-radius: 2px;
}

.light-bulb.purple {
  background: #a78bfa;
  box-shadow: 0 4px 14px rgba(167, 139, 250, 0.85), 0 0 20px rgba(167, 139, 250, 0.5);
  animation-delay: 0s;
}

.light-bulb.blue {
  background: #80c4ff;
  box-shadow: 0 4px 14px rgba(128, 196, 255, 0.85), 0 0 20px rgba(128, 196, 255, 0.5);
  animation-delay: 0.6s;
}

.light-bulb.white {
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.95), 0 0 22px rgba(255, 255, 255, 0.6);
  animation-delay: 1.2s;
}

.light-bulb.purple {
  background: #8b5cf6;
  box-shadow: 0 4px 14px rgba(167, 139, 250, 0.85), 0 0 20px rgba(167, 139, 250, 0.5);
  animation-delay: 1.8s;
}

@keyframes glow-pulse {
  0% { opacity: 0.55; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1.08); }
}

/* ===================================================
   APP CONTAINER & HEADER
   =================================================== */
.app-container {
  width: 100%;
  max-width: 960px;
  padding: 38px 16px 50px;
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header {
  text-align: center;
  margin-bottom: 22px;
  width: 100%;
}

.header h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  text-shadow: 
    0 2px 10px rgba(0, 0, 0, 0.6),
    0 0 30px var(--blue-glow),
    0 0 50px var(--purple-glow);
  margin-bottom: 12px;
}

/* Fortschrittsanzeige */
.progress-bar-container {
  width: 100%;
  max-width: 440px;
  background: rgba(14, 21, 36, 0.65);
  border-radius: 20px;
  padding: 4px;
  margin: 12px auto 8px;
  border: 1px solid rgba(196, 181, 253, 0.3);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.progress-bar-fill {
  height: 12px;
  background: linear-gradient(90deg, #7bb8f5, #c4b5fd, #ffffff);
  border-radius: 12px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 0 14px var(--purple-glow);
}

.progress-text {
  font-size: 0.85rem;
  color: var(--soft-purple);
  text-align: center;
  margin-bottom: 24px;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* ===================================================
   KALENDER GITTER & TÜRHEN (ALLE IDENTISCH)
   =================================================== */
.doors-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: 100%;
}

.door-card.available {
  border-color: rgba(196, 181, 253, 0.58);
}

@media (max-width: 768px) {
  .doors-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .doors-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

/* Einzelnes Türchen: Schlicht, elegant, zentriert */
.door-card {
  aspect-ratio: 1 / 1;
  background: var(--door-bg);
  border: 2px solid var(--door-border);
  border-radius: 18px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-frost);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  overflow: hidden;
  user-select: none;
  font-family: inherit;
  color: inherit;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

/* Zarter Innenrahmen */
.door-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(163, 207, 255, 0.28);
  border-radius: 13px;
  pointer-events: none;
  transition: border-color 0.25s ease;
}

.door-card:hover {
  transform: translateY(-4px);
  border-color: var(--soft-purple);
  background: rgba(30, 48, 80, 0.82);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 20px var(--blue-glow);
}

.door-card:hover::before {
  border-color: rgba(196, 181, 253, 0.65);
}

.door-card:active {
  transform: scale(0.96);
}

/* Große, klare Nummer in der Mitte */
.door-number {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7), 0 0 16px var(--blue-glow);
  z-index: 2;
  line-height: 1;
}

/* Status: Noch gesperrt */
.door-card.locked {
  opacity: 0.62;
  filter: grayscale(35%);
}

.door-card.locked:hover {
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

/* Wackeln bei verfrühtem Klick */
.door-card.shake {
  animation: shake 0.45s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px) rotate(-3deg); }
  40%, 80% { transform: translateX(8px) rotate(3deg); }
}

/* Status: Heute fällig */
.door-card.ready {
  border-color: var(--ice-blue);
  animation: frost-glow 2.2s infinite ease-in-out;
}

@keyframes frost-glow {
  0% { box-shadow: 0 0 0 0 rgba(123, 184, 245, 0.7); }
  70% { box-shadow: 0 0 0 14px rgba(123, 184, 245, 0); }
  100% { box-shadow: 0 0 0 0 rgba(123, 184, 245, 0); }
}

/* Status: Bereits geöffnet (Alle Türchen einheitlich) */
.door-card.opened {
  background: var(--door-opened);
  border-color: rgba(139, 92, 246, 0.65);
}

.door-card.opened::before {
  border-color: rgba(139, 92, 246, 0.4);
}

.door-card.opened .door-number {
  color: var(--soft-purple);
  text-shadow: 0 0 14px var(--purple-glow);
}

.door-card.opened .door-badge-pill {
  position: absolute;
  bottom: 8px;
  font-size: 0.65rem;
  background: rgba(139, 92, 246, 0.4);
  color: #ddd6fe;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.55);
  font-weight: 600;
}

/* ===================================================
   MODAL (Fun Fact des Tages in Lila & Blau)
   =================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  background: linear-gradient(160deg, #1b263e 0%, #111828 100%);
  border: 2px solid var(--soft-purple);
  border-radius: 26px;
  max-width: 480px;
  width: 100%;
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 34px 24px 28px;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 35px var(--purple-glow);
  transform: scale(0.85) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.modal-badge {
  display: inline-block;
  background: linear-gradient(90deg, var(--vibrant-purple), #a78bfa);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 16px;
  border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.45);
}

.modal-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 14px;
  line-height: 1.3;
}

.modal-body {
  font-size: 1.05rem;
  color: #f0f5fc;
  line-height: 1.6;
  white-space: pre-line;
  margin-bottom: 22px;
}

/* ===================================================
   DIREKTER AUDIO PLAYER (KEIN YOUTUBE / KEIN VIDEO)
   =================================================== */
.modal-audio-card {
  margin: 0 0 22px;
  background: rgba(14, 21, 36, 0.75);
  border: 1px solid rgba(196, 181, 253, 0.45);
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 16px var(--purple-glow);
  text-align: left;
}

.audio-track-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.audio-disk-icon {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f2e4d 0%, #101a2d 100%);
  border: 2px solid var(--soft-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  box-shadow: 0 0 10px var(--purple-glow);
  flex-shrink: 0;
  transition: transform 0.3s ease;
  transform-origin: 50% 50%;
}

.audio-snowflake {
  position: relative;
  z-index: 1;
  display: block;
  width: 22px;
  height: 22px;
  overflow: visible;
}

.audio-snowflake path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audio-disk-icon.spinning {
  animation: spinDisk 3.5s linear infinite;
}

@keyframes spinDisk {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.audio-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-meta .audio-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.audio-equalizer {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  flex-shrink: 0;
}

.audio-equalizer span {
  display: block;
  width: 3px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(180deg, #c4b5fd, #8b5cf6);
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.8);
  transform: scaleY(0.25);
  transform-origin: center;
}

.modal-audio-card.is-playing .audio-equalizer span {
  animation: equalizerWave 0.9s ease-in-out infinite alternate;
}

.audio-equalizer span:nth-child(1) { height: 8px; }
.audio-equalizer span:nth-child(2) { height: 13px; }
.audio-equalizer span:nth-child(3) { height: 16px; }
.audio-equalizer span:nth-child(4) { height: 10px; }

.modal-audio-card.is-playing .audio-equalizer span:nth-child(2) { animation-delay: 0.14s; }
.modal-audio-card.is-playing .audio-equalizer span:nth-child(3) { animation-delay: 0.28s; }
.modal-audio-card.is-playing .audio-equalizer span:nth-child(4) { animation-delay: 0.14s; }

@keyframes equalizerWave {
  from { transform: scaleY(0.3); }
  to { transform: scaleY(0.8); }
}

.audio-meta .audio-artist {
  font-size: 0.85rem;
  color: var(--soft-purple);
  margin-top: 2px;
}

/* Datei-Ausweich-Feld */
.audio-file-fallback {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed rgba(196, 181, 253, 0.3);
  border-radius: 12px;
  font-size: 0.8rem;
  color: #ddd6fe;
  line-height: 1.4;
  text-align: center;
}

.audio-file-fallback p {
  margin-bottom: 8px;
}

.audio-file-btn {
  display: inline-block;
  background: rgba(196, 181, 253, 0.2);
  border: 1px solid var(--soft-purple);
  color: #fff;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.audio-file-btn:hover {
  background: rgba(196, 181, 253, 0.35);
}

/* Überraschungskarte im Modal */
.modal-surprise-box {
  background: rgba(196, 181, 253, 0.1);
  border: 1px dashed var(--soft-purple);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 22px;
  font-size: 0.95rem;
  color: #ede9fe;
  line-height: 1.5;
  text-align: left;
}

.modal-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 13px 28px;
  font-size: 1.02rem;
  font-weight: 700;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.6), 0 0 20px var(--purple-glow);
}

.modal-btn:active {
  transform: scale(0.98);
}

/* ===================================================
   TOAST
   =================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(18, 26, 44, 0.96);
  border: 1px solid var(--soft-purple);
  color: #fff;
  padding: 13px 26px;
  border-radius: 50px;
  font-size: 0.95rem;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.35s;
  pointer-events: none;
  text-align: center;
  max-width: 90vw;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 768px) {
  .app-container {
    padding: 28px 16px 34px;
  }

  .header h1 {
    font-size: clamp(1.8rem, 6vw, 2.7rem);
  }

  .door-card {
    border-radius: 16px;
  }
}

@media (max-width: 480px) {
  body {
    min-height: 100vh;
    min-height: 100svh;
  }

  .app-container {
    padding: 22px 14px 28px;
  }

  .header {
    margin-bottom: 14px;
  }

  .header h1 {
    font-size: clamp(1.65rem, 8vw, 2.2rem);
    margin-bottom: 8px;
  }

  .progress-bar-container {
    margin-top: 8px;
  }

  .progress-text {
    font-size: 0.8rem;
    margin-bottom: 16px;
  }

  .doors-grid {
    gap: 9px;
  }

  .door-card {
    border-width: 1.5px;
    border-radius: 14px;
  }

  .door-card::before {
    inset: 4px;
    border-radius: 10px;
  }

  .door-number {
    font-size: clamp(1.75rem, 8vw, 2.4rem);
  }

  .door-card.opened .door-badge-pill {
    bottom: 5px;
    font-size: 0.56rem;
    padding: 2px 5px;
  }

  .modal-overlay {
    align-items: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }

  .modal-content {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    margin: auto 0;
    padding: 54px 18px 22px;
    border-radius: 22px;
  }

  .modal-title {
    font-size: 1.35rem;
  }

  .modal-body {
    font-size: 1rem;
  }

  .toast {
    bottom: max(18px, env(safe-area-inset-bottom));
    padding: 12px 18px;
    font-size: 0.88rem;
  }
}

@media (hover: none) {
  .door-card:hover {
    transform: none;
    background: var(--door-bg);
    box-shadow: var(--shadow-frost);
  }
}
