* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: #fff8ec;
  overflow-x: hidden;
  position: relative;
  background:
    linear-gradient(
      90deg,
      rgba(32, 58, 39, 0.18) 0%,
      rgba(32, 58, 39, 0.18) 50%,
      rgba(79, 48, 26, 0.18) 50%,
      rgba(79, 48, 26, 0.18) 100%
    ),
    linear-gradient(
      180deg,
      #2a2030 0%,
      #1d1522 100%
    );
}

/* SFONDO DIVISO */

.split-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.bg-half {
  position: relative;
  height: 100vh;
}

.bg-fairytale {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 236, 204, 0.28), transparent 22%),
    radial-gradient(circle at 65% 30%, rgba(215, 255, 220, 0.16), transparent 26%),
    radial-gradient(circle at 50% 80%, rgba(255, 208, 240, 0.12), transparent 20%),
    linear-gradient(180deg, rgba(45, 79, 54, 0.72), rgba(21, 45, 34, 0.9)),
    linear-gradient(135deg, #68885f 0%, #395440 45%, #1e3026 100%);
}

.bg-fairytale::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 85%, rgba(0,0,0,0.32), transparent 28%),
    radial-gradient(circle at 40% 88%, rgba(0,0,0,0.34), transparent 25%),
    radial-gradient(circle at 70% 90%, rgba(0,0,0,0.30), transparent 24%);
  opacity: 0.85;
}

.bg-fairytale::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 252, 214, 0.24), transparent 8%),
    radial-gradient(circle at 32% 12%, rgba(255, 240, 190, 0.18), transparent 6%),
    radial-gradient(circle at 58% 20%, rgba(255, 244, 226, 0.16), transparent 8%),
    radial-gradient(circle at 78% 14%, rgba(255, 255, 220, 0.13), transparent 6%);
  filter: blur(2px);
}

.bg-steampunk {
  background:
    radial-gradient(circle at 70% 20%, rgba(255, 212, 141, 0.18), transparent 20%),
    radial-gradient(circle at 40% 30%, rgba(173, 140, 101, 0.12), transparent 24%),
    linear-gradient(180deg, rgba(96, 58, 31, 0.74), rgba(35, 22, 18, 0.92)),
    linear-gradient(135deg, #8a613c 0%, #5a3b2e 45%, #221914 100%);
}

.bg-steampunk::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 24%, rgba(255, 220, 170, 0.15) 0 2px, transparent 3px),
    radial-gradient(circle at 42% 62%, rgba(255, 220, 170, 0.10) 0 2px, transparent 3px),
    radial-gradient(circle at 76% 34%, rgba(255, 220, 170, 0.14) 0 2px, transparent 3px);
  opacity: 0.75;
}

.bg-steampunk::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 194, 122, 0.05) 0px,
      rgba(255, 194, 122, 0.05) 2px,
      transparent 2px,
      transparent 18px
    );
  opacity: 0.35;
}

/* PETALI E RONDELLE */

.falling-layer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 50%;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.fairy-fall {
  left: 0;
}

.steam-fall {
  right: 0;
}

.falling-item {
  position: absolute;
  top: -60px;
  user-select: none;
  will-change: transform, opacity;
  animation-name: fallingMotion;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  opacity: 0.85;
}

.falling-item.petal {
  color: rgba(255, 228, 236, 0.85);
  text-shadow: 0 0 10px rgba(255, 240, 247, 0.35);
}

.falling-item.gear {
  color: rgba(234, 195, 132, 0.85);
  text-shadow: 0 0 12px rgba(255, 211, 147, 0.25);
}

@keyframes fallingMotion {
  0% {
    transform: translate3d(0, -80px, 0) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 0.95;
  }

  100% {
    transform: translate3d(var(--driftX), 110vh, 0) rotate(var(--rotateEnd));
    opacity: 0;
  }
}

/* PLAYER */

.player-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  position: relative;
  z-index: 3;
}

.glass-card {
  width: min(94vw, 570px);
  padding: 28px 22px 22px;
  border-radius: 32px;
  background: rgba(35, 23, 38, 0.56);
  border: 1px solid rgba(255, 238, 201, 0.38);
  box-shadow:
    0 0 30px rgba(255, 214, 160, 0.22),
    inset 0 0 18px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  text-align: center;
  position: relative;
  z-index: 4;
}

.main-header h1 {
  font-size: clamp(1.8rem, 8vw, 3rem);
  line-height: 1.05;
  color: #ffe7ad;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.subtitle {
  margin-top: 8px;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f7d8ee;
}

/* BOTTIGLIETTA */

.bottle-stage {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 22px auto 12px;
  min-height: 150px;
}

.magic-bottle {
  width: 150px;
  max-width: 42vw;
  height: auto;
  display: block;
  object-fit: contain;
  filter:
    drop-shadow(0 0 12px rgba(255, 220, 167, 0.45))
    drop-shadow(0 0 26px rgba(196, 143, 255, 0.24));
  animation: bottleFloat 4.8s ease-in-out infinite;
  transform-origin: center;
}

.magic-bottle.shake {
  animation: bottleShake 0.75s ease-in-out;
}

@keyframes bottleFloat {
  0%, 100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-7px) rotate(1.2deg);
  }
}

@keyframes bottleShake {
  0% {
    transform: translateX(0) rotate(0deg) scale(1);
  }

  15% {
    transform: translateX(-6px) rotate(-7deg) scale(1.03);
  }

  30% {
    transform: translateX(7px) rotate(7deg) scale(1.04);
  }

  45% {
    transform: translateX(-5px) rotate(-5deg) scale(1.03);
  }

  60% {
    transform: translateX(5px) rotate(5deg) scale(1.02);
  }

  80% {
    transform: translateX(-2px) rotate(-2deg) scale(1.01);
  }

  100% {
    transform: translateX(0) rotate(0deg) scale(1);
  }
}

.sparkle-layer {
  position: absolute;
  inset: -25px;
  pointer-events: none;
  overflow: visible;
}

.click-sparkle {
  position: absolute;
  left: 50%;
  top: 50%;
  color: rgba(255, 241, 180, 0.95);
  text-shadow:
    0 0 8px rgba(255, 240, 190, 0.9),
    0 0 18px rgba(215, 171, 255, 0.45);
  animation: sparkleBurst 850ms ease-out forwards;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

@keyframes sparkleBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform:
      translate(
        calc(-50% + var(--sparkle-x)),
        calc(-50% + var(--sparkle-y))
      )
      scale(1.35)
      rotate(var(--sparkle-rotate));
  }
}

/* PULSANTI LIBRI */

.book-link-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 6px auto 18px;
}

@media (min-width: 520px) {
  .book-link-buttons {
    grid-template-columns: 1fr 1fr;
  }
}

.book-link-button {
  padding: 13px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 234, 183, 0.82);
  background:
    linear-gradient(
      135deg,
      rgba(255, 238, 196, 0.22),
      rgba(216, 172, 235, 0.18)
    );
  color: #fff4cf;
  font-size: 0.82rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(255, 223, 166, 0.18);
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.book-link-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.13);
  box-shadow: 0 0 20px rgba(255, 223, 166, 0.35);
}

/* FRASE */

.blessing {
  margin: 10px auto 22px;
  max-width: 465px;
  font-size: 1rem;
  line-height: 1.5;
  color: #fff4d5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

/* PULSANTI SEZIONI */

.section-buttons {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.section-buttons.three-buttons {
  grid-template-columns: 1fr;
}

@media (min-width: 520px) {
  .section-buttons.three-buttons {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.section-button {
  padding: 13px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 234, 183, 0.8);
  background: rgba(255, 246, 221, 0.14);
  color: #fff4cf;
  font-size: 0.82rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.section-button.active {
  background:
    linear-gradient(
      135deg,
      rgba(255, 225, 150, 0.85),
      rgba(221, 166, 238, 0.72)
    );
  color: #2b1d2d;
  box-shadow: 0 0 18px rgba(255, 222, 150, 0.5);
}

.section-button:hover,
.track-item:hover,
.controls button:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

/* LISTA BRANI */

.track-area {
  margin-top: 8px;
}

.track-area h2 {
  margin-bottom: 14px;
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  color: #ffe6a6;
}

.track-list {
  display: grid;
  gap: 9px;
}

.track-item {
  width: 100%;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 238, 201, 0.35);
  background: rgba(255, 255, 255, 0.11);
  color: #fff8ec;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.track-item.active {
  background: rgba(255, 222, 150, 0.28);
  border-color: rgba(255, 226, 165, 0.9);
  box-shadow: 0 0 12px rgba(255, 226, 165, 0.35);
}

.track-name {
  display: block;
  font-size: 0.95rem;
  color: #fff8ec;
}

.track-description {
  display: block;
  margin-top: 3px;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 238, 201, 0.78);
}

/* PLAYER COMANDI */

.audio-player {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 238, 201, 0.28);
}

.now-playing {
  min-height: 24px;
  margin-bottom: 14px;
  font-size: 0.95rem;
  color: #ffecc2;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.controls button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 238, 201, 0.7);
  background: rgba(255, 246, 221, 0.14);
  color: #fff3ca;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.volume-control {
  margin-top: 16px;
  display: grid;
  gap: 8px;
  color: #fff1cf;
  font-size: 0.85rem;
}

.volume-control input {
  width: 100%;
}

/* CREDITI */

.credits {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 238, 201, 0.22);
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(255, 248, 236, 0.78);
}

@media (max-width: 420px) {
  .glass-card {
    padding: 24px 16px 18px;
    border-radius: 26px;
  }

  .magic-bottle {
    width: 130px;
  }

  .controls button {
    width: 44px;
    height: 44px;
  }
}