* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Georgia, "Times New Roman", serif;
  color: #f4efe6;
  background:
    radial-gradient(circle at top, rgba(111, 149, 116, 0.18), transparent 35%),
    linear-gradient(180deg, #0b120c 0%, #132016 42%, #0a0f0a 100%);
}

body {
  overflow-x: hidden;
  position: relative;
}

.forest-magic {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.branch-left,
.branch-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 220px;
  opacity: 0.22;
  filter: blur(0.2px);
}

.branch-left {
  left: 0;
  background:
    radial-gradient(circle at 30% 12%, rgba(95, 126, 73, 0.55) 0 10px, transparent 11px),
    radial-gradient(circle at 42% 20%, rgba(95, 126, 73, 0.42) 0 12px, transparent 13px),
    radial-gradient(circle at 28% 32%, rgba(127, 164, 98, 0.45) 0 10px, transparent 11px),
    radial-gradient(circle at 46% 44%, rgba(87, 120, 65, 0.42) 0 11px, transparent 12px),
    radial-gradient(circle at 26% 58%, rgba(127, 164, 98, 0.4) 0 9px, transparent 10px),
    radial-gradient(circle at 40% 74%, rgba(95, 126, 73, 0.45) 0 12px, transparent 13px),
    linear-gradient(70deg, transparent 0 35%, rgba(62, 41, 23, 0.72) 36% 39%, transparent 40% 100%);
}

.branch-right {
  right: 0;
  background:
    radial-gradient(circle at 70% 10%, rgba(95, 126, 73, 0.55) 0 10px, transparent 11px),
    radial-gradient(circle at 58% 23%, rgba(95, 126, 73, 0.42) 0 12px, transparent 13px),
    radial-gradient(circle at 74% 35%, rgba(127, 164, 98, 0.45) 0 10px, transparent 11px),
    radial-gradient(circle at 56% 48%, rgba(87, 120, 65, 0.42) 0 11px, transparent 12px),
    radial-gradient(circle at 72% 62%, rgba(127, 164, 98, 0.4) 0 9px, transparent 10px),
    radial-gradient(circle at 60% 77%, rgba(95, 126, 73, 0.45) 0 12px, transparent 13px),
    linear-gradient(-70deg, transparent 0 35%, rgba(62, 41, 23, 0.72) 36% 39%, transparent 40% 100%);
}

.sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 239, 180, 0.95);
  box-shadow: 0 0 8px rgba(255, 230, 150, 0.95), 0 0 18px rgba(255, 230, 150, 0.55);
  animation: twinkle 4s ease-in-out infinite;
}

.sparkle-1 { top: 12%; left: 14%; animation-delay: 0s; }
.sparkle-2 { top: 25%; left: 82%; animation-delay: 1s; }
.sparkle-3 { top: 46%; left: 18%; animation-delay: 2.2s; }
.sparkle-4 { top: 60%; left: 74%; animation-delay: 1.6s; }
.sparkle-5 { top: 78%; left: 30%; animation-delay: 2.8s; }
.sparkle-6 { top: 86%; left: 60%; animation-delay: 0.8s; }

.fairy {
  position: absolute;
  font-size: 20px;
  opacity: 0.22;
  filter: drop-shadow(0 0 8px rgba(255, 236, 160, 0.4));
  animation: drift 18s linear infinite;
}

.fairy-1 { left: 8%; top: 70%; animation-delay: 0s; }
.fairy-2 { left: 82%; top: 58%; animation-delay: 6s; }
.fairy-3 { left: 36%; top: 82%; animation-delay: 11s; }

.fairy-glyph {
  position: absolute;
  font-size: 22px;
  color: rgba(255, 239, 186, 0.75);
  text-shadow:
    0 0 6px rgba(255, 239, 186, 0.75),
    0 0 12px rgba(255, 226, 130, 0.55),
    0 0 24px rgba(255, 226, 130, 0.25);
  opacity: 0.15;
  animation: fairyPulse 5s ease-in-out infinite;
}

.fairy-glyph-1 {
  top: 16%;
  left: 22%;
  animation-delay: 0s;
}

.fairy-glyph-2 {
  top: 30%;
  right: 18%;
  animation-delay: 1.2s;
}

.fairy-glyph-3 {
  bottom: 20%;
  left: 16%;
  animation-delay: 2.4s;
}

.fairy-glyph-4 {
  bottom: 14%;
  right: 26%;
  animation-delay: 3.1s;
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 28px 16px 40px;
  display: flex;
  justify-content: center;
}

.player-card {
  width: 100%;
  max-width: 860px;
  background: rgba(18, 20, 14, 0.76);
  border: 1px solid rgba(212, 188, 134, 0.22);
  border-radius: 24px;
  padding: 24px 18px 28px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(6px);
}

.hero {
  text-align: center;
  margin-bottom: 22px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 0.03em;
  color: #f3e7c2;
  text-shadow: 0 0 12px rgba(246, 228, 174, 0.12);
}

.subtitle {
  margin: 0;
  font-size: 1rem;
  color: #d8d0bc;
  line-height: 1.6;
}

.cover-section {
  margin-bottom: 20px;
}

.book-link {
  position: relative;
  display: block;
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.book-cover {
  width: 100%;
  display: block;
  border-radius: 20px;
  transition: transform 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}

.cover-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
  display: flex;
  justify-content: center;
  align-items: end;
}

.cover-overlay span {
  color: #f8f1db;
  font-size: 0.98rem;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.book-link:hover .book-cover,
.book-link:focus .book-cover {
  transform: scale(1.015);
  filter: brightness(1.04);
}

.intro-text {
  text-align: center;
  margin: 0 auto 24px;
  max-width: 740px;
}

.intro-text p {
  margin: 0;
  line-height: 1.7;
  color: #e7dfc9;
}

.realm-switch {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 24px;
  flex-wrap: wrap;
}

.realm-pill {
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 1rem;
  letter-spacing: 0.04em;
  border: 1px solid rgba(214, 194, 149, 0.22);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.realm-pill:hover {
  transform: translateY(-1px);
}

.realm-pill.active {
  box-shadow: 0 0 0 1px rgba(255, 241, 196, 0.24) inset, 0 0 18px rgba(255, 231, 160, 0.14);
  filter: brightness(1.08);
}

.roots-pill {
  background: rgba(101, 78, 43, 0.28);
  color: #f0dfae;
}

.wings-pill {
  background: rgba(143, 131, 201, 0.18);
  color: #eadfff;
}

.track-groups {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
}

.group {
  border-radius: 18px;
  padding: 16px;
}

.roots-group {
  background: rgba(72, 55, 28, 0.15);
  border: 1px solid rgba(202, 170, 107, 0.14);
}

.wings-group {
  background: rgba(118, 108, 173, 0.09);
  border: 1px solid rgba(195, 180, 255, 0.12);
}

.hidden-group {
  display: none;
}

.group-title {
  margin: 0 0 6px;
  font-size: 1.2rem;
  color: #f0dfae;
}

.group-subtitle {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: #d9d0bc;
  line-height: 1.5;
}

.track {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 14px;
  margin-bottom: 10px;
  background: rgba(45, 60, 37, 0.72);
  color: #f6f0de;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.track:last-child {
  margin-bottom: 0;
}

.track:hover,
.track:focus {
  transform: translateY(-1px);
  background: rgba(61, 82, 51, 0.95);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.track.active {
  background: rgba(97, 126, 82, 0.95);
  box-shadow: 0 0 0 1px rgba(241, 223, 172, 0.25) inset;
}

.track-title {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

.track-meta {
  display: block;
  font-size: 0.9rem;
  color: #d5ceb8;
}

.player-panel {
  text-align: center;
  margin: 22px 0 18px;
}

#statusText {
  margin: 0 0 12px;
  color: #eadfbe;
}

#audioPlayer {
  width: 100%;
  max-width: 680px;
  border-radius: 12px;
}

.credits {
  text-align: center;
  margin-top: 18px;
  color: #cfc6ad;
  font-size: 0.95rem;
  line-height: 1.7;
}

.credits p {
  margin: 4px 0;
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.7); opacity: 0.25; }
  50% { transform: scale(1.5); opacity: 1; }
}

@keyframes drift {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.2;
  }
  50% {
    transform: translate(60px, -120px) rotate(8deg);
    opacity: 0.34;
  }
  100% {
    transform: translate(120px, -260px) rotate(-8deg);
    opacity: 0;
  }
}

@keyframes fairyPulse {
  0%, 100% {
    opacity: 0.08;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.22);
  }
}

@media (max-width: 640px) {
  .player-card {
    padding: 18px 14px 22px;
    border-radius: 20px;
  }

  .group {
    padding: 14px;
  }

  .track {
    padding: 13px 12px;
  }

  .cover-overlay span {
    font-size: 0.92rem;
  }

  .branch-left,
  .branch-right {
    width: 120px;
    opacity: 0.16;
  }

  .fairy {
    font-size: 16px;
  }

  .fairy-glyph {
    font-size: 18px;
  }
}