:root {
  --ink: #f4ecf7;
  --muted: #c9bcd8;
  --night: #120a24;
  --glass: rgba(22, 12, 44, .58);
  --line: rgba(255, 214, 236, .16);
  --magenta: #ff5fa2;
  --peach: #ffb59a;
  --lavender: #b9b0ff;
  --cream: #ffeac2;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  /* Shown when WebGL is missing or its context is lost: the same scene, still. */
  background:
    radial-gradient(circle at 65% 82%, rgba(255, 234, 194, .45), transparent 14%),
    radial-gradient(ellipse at 55% 35%, rgba(255, 95, 162, .28), transparent 50%),
    linear-gradient(#0d0820, #2a1640 65%, #6a5a98) fixed var(--night);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#sky {
  position: fixed; inset: 0; z-index: -1;
  width: 100vw; height: 100vh;
  image-rendering: auto;
}
#sky.fallback { visibility: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---- Selector between the music and the series, right under the hero ---- */
/* The hero fills the screen minus this height, so only the selector peeks out at the bottom. */
:root { --switch-h: 64px; }
.switch { height: var(--switch-h); display: flex; align-items: flex-start; justify-content: center; }
.tabs {
  display: flex; gap: 4px; padding: 5px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(14, 7, 30, .55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.tabs button {
  border: 0; background: transparent; padding: 9px 26px; border-radius: 999px; font-weight: 750; font-size: 1.05rem;
  color: var(--muted); transition: background .2s, color .2s;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: linear-gradient(120deg, var(--magenta), #b35cff); color: var(--ink); }
body[data-view="music"] #series, body[data-view="series"] #music, body[data-view="series"] #suggest { display: none; }

/* ---- Hero ---- */
.hero {
  /* Exactly the screen, minus the selector that peeks out below it. */
  min-height: calc(100vh - var(--switch-h));
  min-height: calc(100svh - var(--switch-h));
  box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 64px 20px 40px; gap: 14px;
}
.avatar {
  position: relative; width: 168px; height: 168px; border-radius: 50%; padding: 4px; overflow: hidden;
  box-shadow: 0 0 60px rgba(255, 95, 162, .45), 0 0 140px rgba(185, 176, 255, .25);
}
/* Only the ring turns; the picture keeps its colours. */
.avatar::before {
  content: ""; position: absolute; inset: -40%;
  background: conic-gradient(from 0deg, var(--magenta), var(--lavender), var(--cream), var(--peach), var(--magenta));
  animation: halo 9s linear infinite;
}
.avatar img { position: relative; width: 100%; height: 100%; border-radius: 50%; display: block; border: 4px solid var(--night); object-fit: cover; }
@keyframes halo { to { transform: rotate(360deg); } }
h1 {
  margin: 8px 0 0;
  font-size: clamp(3rem, 11vw, 7.5rem); line-height: .95; letter-spacing: -.04em; font-weight: 900;
  background: linear-gradient(100deg, var(--cream) 10%, var(--peach) 35%, var(--magenta) 60%, var(--lavender) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255, 95, 162, .35));
}
.socials { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }
.social {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 999px; text-decoration: none; font-weight: 700;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.social svg { width: 22px; height: 22px; fill: currentColor; }
.social:hover, .social:focus-visible { transform: translateY(-3px); }
.social.yt:hover { background: #ff0033; box-shadow: 0 10px 40px rgba(255, 0, 51, .45); }
.social.ig:hover { background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7); box-shadow: 0 10px 40px rgba(238, 42, 123, .45); }
.social.tt:hover { background: #000; box-shadow: -3px -3px 0 #25f4ee, 3px 3px 0 #fe2c55; }

/* ---- Sections ---- */
main { width: min(1200px, 100% - 32px); margin: 0 auto; }
section { padding: 40px 0 56px; }
h2 {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem); letter-spacing: -.02em; margin: 0 0 20px; font-weight: 850;
}
h2::after {
  content: ""; display: block; width: 64px; height: 4px; margin-top: 10px; border-radius: 4px;
  background: linear-gradient(90deg, var(--magenta), var(--peach));
}

/* ---- Filters ---- */
.filters { display: grid; gap: 10px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); min-width: 84px; }
.chip {
  padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: .92rem; transition: background .2s, border-color .2s, transform .15s;
}
.chip:hover { border-color: rgba(255, 181, 154, .6); transform: translateY(-1px); }
.chip.on { background: linear-gradient(120deg, var(--magenta), #b35cff); border-color: transparent; font-weight: 700; }
.playmodes { display: flex; flex-wrap: wrap; gap: 18px; margin: 6px 0 22px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--muted); }
.toggle input {
  appearance: none; width: 40px; height: 22px; border-radius: 22px; margin: 0; position: relative;
  background: rgba(255, 255, 255, .15); transition: background .2s; cursor: pointer;
}
.toggle input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ink); transition: transform .2s;
}
.toggle input:checked { background: var(--magenta); }
.toggle input:checked::after { transform: translateX(18px); }
.toggle input:checked + span { color: var(--ink); }

/* ---- Songs ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.song {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.song[hidden] { display: none; }
.song:hover { transform: translateY(-4px); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
.song.playing { border-color: rgba(255, 95, 162, .7); box-shadow: 0 0 0 1px rgba(255, 95, 162, .5), 0 18px 60px rgba(255, 95, 162, .25); }
.frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.thumb { position: absolute; inset: 0; border: 0; padding: 0; background: none; display: block; width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s, filter .3s; }
.thumb:hover img { transform: scale(1.04); filter: brightness(1.1); }
.play {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  background: rgba(18, 10, 36, .65); border: 2px solid rgba(255, 255, 255, .85); backdrop-filter: blur(6px);
  transition: transform .2s, background .2s;
}
.play::after {
  content: ""; position: absolute; left: 25px; top: 19px;
  border-style: solid; border-width: 13px 0 13px 20px; border-color: transparent transparent transparent #fff;
}
.thumb:hover .play { transform: scale(1.1); background: var(--magenta); }
.player-slot, .frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.body { padding: 14px 16px 16px; display: grid; gap: 10px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
h3 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; }
.share {
  flex: none; padding: 5px 12px; font-size: .82rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.share:hover { color: var(--ink); border-color: var(--peach); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: rgba(185, 176, 255, .14); color: var(--lavender); }
.tag.topic { background: rgba(255, 181, 154, .12); color: var(--peach); }
.stores { display: flex; flex-wrap: wrap; gap: 6px; }
.store {
  font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 8px; text-decoration: none;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); transition: background .2s;
}
.store:hover { background: rgba(255, 255, 255, .18); }
.s-spotify:hover { background: #1db954; color: #000; }
.s-deezer:hover { background: #a238ff; }
.s-applemusic:hover, .s-itunes:hover { background: #fa2d48; }
.s-amazon:hover { background: #25d1da; color: #000; }
.s-soundcloud:hover { background: #ff5500; }
.s-tidal:hover { background: #fff; color: #000; }

/* ---- Series ---- */
.series { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.serie {
  position: relative; padding: 34px 26px 28px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background:
    radial-gradient(circle at 85% 20%, rgba(255, 234, 194, .35), transparent 30%),
    linear-gradient(140deg, rgba(58, 29, 98, .85), rgba(18, 10, 36, .8));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.serie h3 { font-size: 2rem; letter-spacing: .02em; text-transform: uppercase; }
.serie p { color: var(--muted); margin: 10px 0 0; }
.badge {
  display: inline-block; margin-bottom: 14px; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--night); background: var(--cream);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 234, 194, 0); } 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 234, 194, .5); } }

/* ---- Suggestions ---- */
.intro { color: var(--muted); max-width: 60ch; margin-top: -6px; }
form { display: grid; gap: 10px; max-width: 640px; margin: 18px 0 30px; }
input, textarea {
  font: inherit; color: var(--ink); padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); resize: vertical;
}
input:focus, textarea:focus { outline: 2px solid var(--magenta); outline-offset: 1px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
form button {
  justify-self: start; padding: 11px 26px; border: 0; border-radius: 999px; font-weight: 800;
  background: linear-gradient(120deg, var(--magenta), var(--peach)); color: #1a0d26;
  box-shadow: 0 10px 30px rgba(255, 95, 162, .35); transition: transform .2s;
}
form button:hover { transform: translateY(-2px); }
form button:disabled { opacity: .6; }
.status { margin: 0; min-height: 1.5em; color: var(--peach); }
.ideas { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-width: 760px; }
.idea {
  display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.idea p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.empty { color: var(--muted); }
.vote {
  flex: none; display: grid; justify-items: center; min-width: 64px; padding: 6px 8px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .05); font-size: .75rem; transition: background .2s;
}
.vote .count { font-size: 1.2rem; font-weight: 800; }
.vote.on { background: linear-gradient(140deg, var(--magenta), #b35cff); border-color: transparent; }
footer { text-align: center; padding: 40px 0 60px; color: var(--muted); font-size: .85rem; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; background: var(--cream); color: var(--night); font-weight: 700;
  transition: opacity .25s, transform .25s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- Immersive player ---- */
body.staged { overflow: hidden; }
/* Only the sky stays behind the immersive view; visibility keeps the scroll position. */
body.staged > .switch, body.staged > header, body.staged > main, body.staged > footer { visibility: hidden; }
.stage {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto;
  /* Light enough for the sky to show through: it pulses on the beat behind the video. */
  background: rgba(9, 4, 20, .5);
  backdrop-filter: blur(8px) saturate(1.3); -webkit-backdrop-filter: blur(8px) saturate(1.3);
  animation: stage-in .35s cubic-bezier(.2, .8, .2, 1);
}
.stage[hidden] { display: none; }
@keyframes stage-in { from { opacity: 0; transform: scale(1.03); } }
.stage-close {
  position: fixed; top: 14px; right: 18px; z-index: 2; width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(18, 10, 36, .7); font-size: 1.7rem; line-height: 1;
}
.stage-close:hover { background: var(--magenta); }
.stage-inner {
  /* The video takes what the height allows, the lyrics column only shows beside it on wide screens. */
  --video-w: min(100%, calc((100vh - 190px) * 16 / 9));
  min-height: 100%; padding: 70px 24px 32px; display: grid; gap: 24px;
  grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: center;
}
.stage-main { width: var(--video-w); display: grid; gap: 14px; }
.stage-frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000;
  box-shadow: 0 30px 120px rgba(255, 95, 162, .25), 0 0 0 1px rgba(255, 214, 236, .12);
}
.stage-frame iframe, .stage-frame .player-slot { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage-meta { display: grid; gap: 10px; }
.stage-meta .head h3 { font-size: clamp(1.3rem, 2.6vw, 1.9rem); }
.stage-lyrics { width: var(--video-w); position: relative; }
.lines.timed .line {
  margin: 0; padding: 4px 0; line-height: 1.45; color: var(--muted); opacity: .55; cursor: pointer;
  transition: opacity .3s, color .3s, transform .3s; transform-origin: left center;
}
.lines.timed .line:hover { opacity: .85; }
.lines.timed .line.gap { margin-top: 18px; }
.lines.timed .line.now {
  opacity: 1; color: var(--cream); transform: scale(1.04);
  text-shadow: 0 0 18px rgba(255, 95, 162, .55);
}
.stage-lyrics h4 { margin: 0 0 10px; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.stage-lyrics .lines { font-size: 1rem; }
.stage-lyrics pre { white-space: pre-wrap; font: inherit; font-size: 1rem; line-height: 1.7; margin: 0; }
.stage.no-lyrics .stage-lyrics { display: none; }
@media (min-width: 1100px) {
  .stage:not(.no-lyrics) .stage-inner {
    --video-w: min(100%, calc((100vh - 190px) * 16 / 9));
    grid-template-columns: minmax(0, auto) minmax(280px, 380px); align-items: start; justify-content: center;
  }
  .stage:not(.no-lyrics) .stage-main { width: min(calc(100vw - 480px), calc((100vh - 190px) * 16 / 9)); }
  .stage:not(.no-lyrics) .stage-lyrics {
    width: auto; max-height: calc(100vh - 110px); overflow-y: auto; padding: 18px 20px; border-radius: 14px;
    background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .chips-label { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
