:root {
  --text: #68456f;
  --deep: #482b52;
  --active: #9f5ca5;
  --rose: #efb9cf;
  --violet: #be9bdf;
  --cream: #fff8f2;
  --gold: #d7a76b;
  --shadow: rgba(80, 45, 92, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background: #f8edf8;
  overflow-x: hidden;
}

/* SFONDO FISSO CON LA TUA IMMAGINE JPG */
.magic-background {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  pointer-events: none;
}

.magic-background::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("assets/milana-player-graphic.jpg");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  opacity: 1;
  filter: none;
  transform: scale(1);
}

/* VELO LEGGERO */
.magic-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 245, 252, 0.08), rgba(255, 245, 252, 0.16)),
    radial-gradient(
      circle at var(--mouse-x, 50%) var(--mouse-y, 28%),
      rgba(255, 255, 255, 0.20),
      transparent 22%
    );
}

/* BAGLIORI VIVI */
.glow {
  position: absolute;
  width: 34vw;
  height: 34vw;
  border-radius: 50%;
  filter: blur(20px);
  opacity: 0.26;
  animation: floatGlow 12s ease-in-out infinite alternate;
}

.glow-one {
  left: -8vw;
  top: 10vh;
  background: rgba(255, 202, 228, 0.7);
}

.glow-two {
  right: -9vw;
  top: 28vh;
  background: rgba(204, 188, 255, 0.62);
  animation-delay: -3s;
}

.glow-three {
  left: 34vw;
  bottom: -14vw;
  background: rgba(255, 226, 178, 0.58);
  animation-delay: -6s;
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.96) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(255, 245, 215, 0.85) 0 1px, transparent 1.7px);
  background-size: 44px 44px, 82px 82px;
  background-position: 0 0, 18px 22px;
  opacity: 0.20;
  animation: driftStars 28s linear infinite;
}

/* STRUTTURA PAGINA */
.page-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 22px;
}

/* CARD PRINCIPALE */
.player-card {
  position: relative;
  width: min(100%, 720px);
  border-radius: 34px;
  padding: clamp(18px, 3vw, 32px);
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.50),
      rgba(255, 246, 252, 0.34)
    ),
    radial-gradient(
      circle at 50% 0%,
      rgba(255, 221, 241, 0.32),
      transparent 40%
    );
  box-shadow:
    0 30px 80px rgba(80, 45, 92, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.50);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.player-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 26px;
  border: 1px solid rgba(215, 167, 107, 0.30);
  pointer-events: none;
}

.player-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.34), transparent 20%),
    radial-gradient(circle at 82% 92%, rgba(255, 227, 245, 0.28), transparent 24%);
  pointer-events: none;
}

.player-card > * {
  position: relative;
  z-index: 1;
}

/* TESTATA */
.player-header {
  text-align: center;
  margin-bottom: 16px;
}

.small-title {
  margin: 0 0 8px;
  font-size: clamp(13px, 2.2vw, 16px);
  letter-spacing: 0.03em;
  text-transform: none;
  color: rgba(72, 43, 82, 0.82);
  font-style: italic;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
}

.player-header h1 {
  margin: 0;
  font-size: clamp(38px, 7vw, 68px);
  line-height: 0.95;
  color: var(--deep);
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.68),
    0 0 20px rgba(255, 226, 244, 0.62);
}

.subtitle {
  max-width: 540px;
  margin: 12px auto 0;
  font-size: clamp(14px, 2.5vw, 18px);
  line-height: 1.35;
  color: rgba(72, 43, 82, 0.84);
}

/* COPERTINA / PULSANTE DIRETTO AL LIBRO */
.book-button {
  display: block;
  position: relative;
  width: min(100%, 360px);
  margin: 0 auto 20px;
  padding: 8px;
  border: 0;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  box-shadow:
    0 18px 40px rgba(72, 43, 82, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.72);
  animation: gentleBreath 5.4s ease-in-out infinite;
}

.book-button img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 20px;
}

.book-button::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, transparent 48%, rgba(62, 35, 70, 0.30)),
    radial-gradient(circle at 50% 50%, transparent 50%, rgba(255, 255, 255, 0.18));
  opacity: 0.62;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.book-button:hover::before {
  opacity: 0.36;
}

.book-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 24px 52px rgba(72, 43, 82, 0.28),
    0 0 38px rgba(255, 221, 241, 0.74);
}

.book-label {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: inline-flex;
  justify-content: center;
  width: max-content;
  max-width: calc(100% - 34px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 248, 252, 0.90);
  color: var(--deep);
  font-weight: 700;
  font-size: clamp(13px, 2.4vw, 17px);
  box-shadow: 0 10px 22px rgba(72, 43, 82, 0.18);
}

/* PANNELLO AUDIO */
.audio-panel {
  border-radius: 28px;
  padding: clamp(14px, 3vw, 22px);
  background: rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(215, 167, 107, 0.20),
    0 16px 34px rgba(80, 45, 92, 0.10);
}

.now-playing {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  text-align: center;
}

.now-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: rgba(104, 69, 111, 0.66);
}

#currentTrackTitle {
  font-size: clamp(17px, 3vw, 24px);
  color: var(--deep);
}

/* PLAYLIST */
.playlist {
  display: grid;
  gap: 6px;
  max-height: 390px;
  overflow: auto;
  padding: 4px 4px 4px 0;
  scrollbar-width: thin;
}

.playlist::-webkit-scrollbar {
  width: 8px;
}

.playlist::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.playlist::-webkit-scrollbar-thumb {
  background: rgba(159, 92, 165, 0.38);
  border-radius: 999px;
}

.track {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(215, 167, 107, 0.20);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.50);
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.track:hover {
  background: rgba(255, 246, 251, 0.92);
  transform: translateX(3px);
  box-shadow: 0 8px 18px rgba(80, 45, 92, 0.10);
}

.track.active {
  background:
    linear-gradient(135deg, rgba(255, 232, 243, 0.96), rgba(238, 226, 255, 0.94));
  color: var(--active);
  box-shadow:
    0 8px 20px rgba(80, 45, 92, 0.14),
    inset 0 0 0 1px rgba(215, 167, 107, 0.22);
}

.track .num {
  font-size: 14px;
  font-weight: 700;
  color: rgba(104, 69, 111, 0.72);
}

.track .title {
  min-width: 0;
  font-size: clamp(13px, 2vw, 16px);
  line-height: 1.2;
}

/* TEMPI E BARRA */
.time-row {
  display: flex;
  justify-content: space-between;
  margin: 15px 4px 7px;
  font-weight: 700;
  font-size: 13px;
  color: rgba(72, 43, 82, 0.78);
}

.progress-bar {
  width: 100%;
  appearance: none;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

.progress-bar::-webkit-slider-runnable-track {
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(215, 167, 107, 0.44);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 6px rgba(111, 75, 119, 0.08);
}

.progress-bar::-moz-range-track {
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(215, 167, 107, 0.44);
  background: rgba(255, 255, 255, 0.58);
}

.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffd8e7 45%, #d7a76b 100%);
  border: 1px solid rgba(215, 167, 107, 0.75);
  box-shadow: 0 4px 10px rgba(111, 75, 119, 0.22);
  margin-top: -8px;
}

.progress-bar::-moz-range-thumb {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffd8e7 45%, #d7a76b 100%);
  border: 1px solid rgba(215, 167, 107, 0.75);
  box-shadow: 0 4px 10px rgba(111, 75, 119, 0.22);
}

/* CONTROLLI */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2.4vw, 18px);
  margin-top: 14px;
}

.ctrl {
  width: clamp(44px, 10vw, 58px);
  height: clamp(44px, 10vw, 58px);
  border: 1px solid rgba(215, 167, 107, 0.38);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.96), rgba(255, 230, 243, 0.86)),
    linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(238, 226, 255, 0.58));
  color: var(--deep);
  cursor: pointer;
  box-shadow:
    0 10px 22px rgba(80, 45, 92, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.58);
  transition:
    transform 0.17s ease,
    box-shadow 0.17s ease,
    filter 0.17s ease;
}

.ctrl span {
  display: inline-block;
  font-size: clamp(18px, 4vw, 24px);
  line-height: 1;
}

.main-ctrl {
  width: clamp(58px, 14vw, 78px);
  height: clamp(58px, 14vw, 78px);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 1), rgba(255, 216, 234, 0.94)),
    linear-gradient(145deg, rgba(239, 185, 207, 0.9), rgba(190, 155, 223, 0.76));
}

.main-ctrl span {
  font-size: clamp(24px, 5vw, 32px);
}

.ctrl:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 16px 28px rgba(80, 45, 92, 0.22),
    0 0 28px rgba(255, 226, 244, 0.78);
}

.ctrl:active {
  transform: translateY(1px) scale(0.98);
}

/* CREDITI */
.credits {
  margin-top: 18px;
  text-align: center;
  font-size: clamp(11px, 2vw, 14px);
  line-height: 1.4;
  color: rgba(72, 43, 82, 0.82);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.credits p {
  margin: 4px 0;
}

.credits strong {
  color: var(--deep);
}

/* ACCESSIBILITÀ */
.ctrl:focus-visible,
.track:focus-visible,
.progress-bar:focus-visible,
.book-button:focus-visible {
  outline: 3px solid rgba(174, 132, 203, 0.92);
  outline-offset: 3px;
}

/* ANIMAZIONI */
@keyframes floatGlow {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(4vw, -3vh, 0) scale(1.12);
  }
}

@keyframes driftStars {
  from {
    background-position: 0 0, 18px 22px;
  }

  to {
    background-position: 120px 180px, 180px 240px;
  }
}

@keyframes gentleBreath {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.016);
  }
}

/* QUANDO LA MUSICA SUONA */
body.is-playing .player-card {
  box-shadow:
    0 34px 90px rgba(80, 45, 92, 0.30),
    0 0 46px rgba(255, 221, 241, 0.48),
    inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

body.is-playing .stars {
  opacity: 0.36;
  animation-duration: 18s;
}

/* MOBILE */
@media (max-width: 620px) {
  .page-shell {
    padding: 12px;
    align-items: flex-start;
  }

  .magic-background::before {
    background-position: center top;
  }

  .player-card {
    width: min(100%, 520px);
    border-radius: 26px;
    padding: 16px;
    background:
      linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.56),
        rgba(255, 246, 252, 0.42)
      ),
      radial-gradient(
        circle at 50% 0%,
        rgba(255, 221, 241, 0.36),
        transparent 40%
      );
  }

  .player-card::before {
    inset: 8px;
    border-radius: 20px;
  }

  .book-button {
    width: min(100%, 320px);
    border-radius: 20px;
    padding: 7px;
  }

  .book-button img {
    border-radius: 16px;
  }

  .book-label {
    bottom: 14px;
    padding: 8px 12px;
  }

  .audio-panel {
    border-radius: 20px;
    padding: 13px;
  }

  .playlist {
    max-height: 350px;
  }

  .track {
    grid-template-columns: 38px 1fr;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .track .title {
    font-size: 12.5px;
  }

  .track .num {
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .track .title {
    font-size: 11.5px;
  }

  .small-title {
    font-size: 12px;
    letter-spacing: 0.01em;
  }
}