/* The Songs page in the purple theme: pages/purple/songs.php + js/purple-songs.js.
   A night-sky player above the song cards. In full screen the player alone fills the
   screen (:fullscreen, or .is-full over the page where the Fullscreen API is missing). */
.sg-page { --sg-night: #1c0f40; --sg-gold: #ffc93c; --sg-lav: #b3a4ff; padding-bottom: 8px; }
.sg-page .crumbs { font-size: 13px; color: var(--pv-muted); padding: 22px 0 6px; }
.sg-page .crumbs a { color: var(--pv-violet); text-decoration: none; }
.sg-page .crumbs span { margin: 0 6px; color: #c9c0dd; }
.sg-page .crumbs .here { margin: 0; color: inherit; }

/* ---------- Heading, with the giraffe and notes at the right ---------- */
.sg-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.sg-hero h1 { font: 700 54px/1.05 'Fredoka', sans-serif; color: var(--pv-plum); margin: 0; letter-spacing: -.5px; }
.sg-hero p { font-size: 19px; color: var(--pv-muted); margin: 8px 0 0; }
.sg-hero-art { position: relative; width: 330px; height: 150px; flex: none; margin-bottom: -18px; }
.sg-hero-art::before { content: ''; position: absolute; right: -40px; bottom: -10px; width: 300px; height: 190px; border-radius: 50%; background: radial-gradient(closest-side, #f6e6cf, rgba(246,230,207,0)); }
.sg-hero-art img { position: absolute; right: 6px; bottom: 0; height: 170px; width: auto; }
.sg-hero-art .n { position: absolute; fill: currentColor; animation: sg-bob 3.2s ease-in-out infinite; }
.sg-hero-art .n1 { left: 30px; top: 22px; width: 42px; color: #2f6bff; }
.sg-hero-art .n2 { left: 100px; top: 44px; width: 30px; color: var(--pv-orange); animation-delay: -1s; }
.sg-hero-art .n3 { left: 150px; top: 82px; width: 30px; color: #8b3fe0; animation-delay: -2s; }
@keyframes sg-bob { 50% { transform: translateY(-7px) rotate(-6deg); } }

/* ---------- The player ---------- */
/* (#player #songTitle: two ids outrank the skin's heading colour, body.pv-body :is(h1, h2)) */
.sg-player { position: relative; display: flex; flex-direction: column; min-height: 540px; padding: 22px 26px 0; border-radius: 28px; overflow: hidden; color: #fff;
  background: radial-gradient(120% 90% at 50% 0%, #2c1763 0%, #1f1048 55%, #170a38 100%); box-shadow: 0 18px 40px rgba(36,18,67,.22); isolation: isolate; }
.sg-sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.sg-sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 2; }
.sg-stars i { position: absolute; border-radius: 50%; background: #fff; opacity: var(--o, .6); animation: sg-twinkle var(--d, 2s) ease-in-out infinite alternate; }
@keyframes sg-twinkle { to { opacity: .1; transform: scale(.5); } }
.sg-cloud { position: absolute; bottom: 120px; width: 34%; height: 110px; fill: #2a1760; z-index: 1; }
.sg-cloud.l { left: -2%; }
.sg-cloud.r { right: -2%; }

.sg-top { display: flex; align-items: center; gap: 18px; position: relative; z-index: 5; }   /* over the lyrics, for the visualizer menu */
.sg-now-art { width: 148px; flex: none; border-radius: 14px; box-shadow: 0 0 0 2px rgba(255,255,255,.12); }
.sg-now { min-width: 0; }
#player #songTitle { font: 600 30px/1.15 'Fredoka', sans-serif; color: #fff; margin: 0; letter-spacing: -.2px; }
.sg-now-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 16px; color: #c3b8e8; }
.sg-karaoke-tag { font: 700 11px 'DM Sans', sans-serif; letter-spacing: 1.4px; text-transform: uppercase; color: #fff; background: linear-gradient(135deg, #f06ad5, #8b6bff); padding: 4px 9px; border-radius: 999px; }
.sg-tools { margin-left: auto; display: flex; gap: 10px; align-self: flex-start; }
.sg-round { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; min-width: 46px; padding: 0 12px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.06); color: #fff; font: 600 15px 'DM Sans', sans-serif; cursor: pointer; transition: background .15s, border-color .15s; }
.sg-round:hover, .sg-round[aria-expanded="true"] { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.5); }
.sg-round svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sg-pill { padding: 0 14px 0 16px; }
.sg-pill .chev { width: 16px; height: 16px; opacity: .7; }

/* the visualizer picker */
.sg-viz-pick { position: relative; }
.sg-viz-menu { position: absolute; right: 0; top: calc(100% + 10px); z-index: 20; display: grid; grid-template-columns: repeat(3, 92px); gap: 6px; padding: 10px; border-radius: 20px;
  background: #2a1858; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 18px 40px rgba(8,0,26,.5); }
.sg-viz-menu[hidden] { display: none; }
.sg-viz-menu button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 1.5px solid transparent; border-radius: 14px; background: rgba(255,255,255,.05);
  color: #d9d1f5; font: 600 13px 'DM Sans', sans-serif; cursor: pointer; transition: background .15s; }
.sg-viz-menu button:hover { background: rgba(255,255,255,.12); color: #fff; }
.sg-viz-menu button.on { border-color: #a58bff; background: rgba(139,107,255,.28); color: #fff; }
.sg-viz-menu svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Lyrics ---------- */
.sg-stage { position: relative; flex: 1; min-height: 250px; overflow: hidden; z-index: 3; }
.lyric-line { position: absolute; left: 0; right: 0; top: 50%; text-align: center; line-height: 1.25; padding: 0 4%; transform-origin: top center;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s cubic-bezier(.2,.8,.2,1); }
.lyric-line.active { transform: translateY(-100%); opacity: 1; z-index: 2; }
.lyric-line.next { transform: translateY(14%) scale(.86); opacity: 1; z-index: 1; }
.lyric-line.past { transform: translateY(-215%) scale(.9); opacity: 0; pointer-events: none; }
.lyric-line.upcoming { transform: translateY(80%) scale(.7); opacity: 0; pointer-events: none; }
.word { display: inline-block; font: 600 clamp(26px, 3.9vw, 50px)/1.25 'Fredoka', sans-serif; color: rgba(255,255,255,.5); margin: 0 .12em;
  transition: color .22s ease, transform .22s ease, text-shadow .22s ease; }
.lyric-line.next .word { color: var(--sg-lav); }
.word.past { color: var(--sg-gold); }
.word.active { color: #ffd84d; transform: scale(1.1); text-shadow: 0 0 24px rgba(255,216,77,.55), 0 0 60px rgba(245,158,11,.3); }

/* before the first play: the first lines wait, with a hint under them */
.sg-start { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; z-index: 4; pointer-events: none; white-space: nowrap;
  padding: 5px 14px; border-radius: 999px; background: rgba(23,10,56,.7); font: 500 16px 'Fredoka', sans-serif; color: #c3b8e8; }
.sg-start svg { width: 16px; height: 16px; fill: currentColor; }
.sg-player.started .sg-start { display: none; }
.sg-tap { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 13px; color: rgba(255,255,255,.35); opacity: 0; transition: opacity .4s; pointer-events: none; }
.sg-stage.controls-hidden .sg-tap { opacity: 1; }

/* ---------- Controls ---------- */
.sg-controls { position: relative; z-index: 3; margin: 0 -26px; padding: 14px 30px 20px; background: linear-gradient(180deg, rgba(23,10,56,.55), rgba(18,7,46,.92));
  max-height: 260px; transition: max-height .4s cubic-bezier(.4,0,.2,1), padding .35s, opacity .3s; }
.sg-controls.hide { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; pointer-events: none; overflow: hidden; }
.sg-progress { position: relative; height: 24px; cursor: pointer; touch-action: none; outline: none; }
.sg-progress .bg, .sg-progress .fill { position: absolute; left: 0; top: 50%; height: 7px; border-radius: 99px; transform: translateY(-50%); }
.sg-progress .bg { right: 0; background: rgba(255,255,255,.16); }
.sg-progress .fill { width: 0; background: linear-gradient(90deg, #7c6bff, #c88bff); }
.sg-progress .thumb { position: absolute; top: 50%; left: 0; width: 20px; height: 20px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); box-shadow: 0 0 10px rgba(169,140,255,.8); }
.sg-progress:focus-visible .thumb { box-shadow: 0 0 0 4px rgba(255,255,255,.35); }
.sg-times { display: flex; justify-content: space-between; font-size: 14px; color: #c3b8e8; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.sg-buttons { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.sg-ctl { width: 66px; height: 66px; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.08); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: transform .1s, background .15s; flex: none; }
.sg-ctl:hover { background: rgba(255,255,255,.16); transform: scale(1.05); }
.sg-ctl:active { transform: scale(.94); }
.sg-ctl svg, .sg-karaoke svg, .sg-mute svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sg-ctl svg .f, .sg-mute svg .f { fill: currentColor; stroke: none; }
.sg-ctl.on { background: linear-gradient(135deg, #8b6bff, #c66bff); border-color: transparent; box-shadow: 0 0 18px rgba(169,116,255,.55); }
.sg-play { width: 92px; height: 92px; border: 0; background: linear-gradient(135deg, #a974ff, #f06ad5); box-shadow: 0 0 0 6px rgba(169,116,255,.15), 0 0 32px rgba(240,106,213,.5); }
.sg-play:hover { background: linear-gradient(135deg, #b585ff, #f57fdd); }
.sg-play svg { width: 38px; height: 38px; stroke-width: 3.2; }
.sg-play svg .f { transform: translateX(1.5px); }
.sg-player.is-loading .sg-play svg { animation: sg-pulse 1s ease-in-out infinite; }
@keyframes sg-pulse { 50% { opacity: .35; } }
.sg-karaoke { display: inline-flex; align-items: center; gap: 10px; height: 60px; padding: 0 28px 0 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: #a48cfb; color: #24124a; font: 600 21px 'Fredoka', sans-serif; transition: background .15s, transform .1s; }
.sg-karaoke:hover { background: #b39ffc; }
.sg-karaoke:active { transform: scale(.96); }
.sg-karaoke.on { background: linear-gradient(135deg, #f06ad5, #8b6bff); color: #fff; box-shadow: 0 0 20px rgba(240,106,213,.55); }
.sg-karaoke.waiting { opacity: .7; cursor: progress; }
.sg-karaoke.unavailable { opacity: .45; cursor: not-allowed; }
.sg-vol { display: flex; align-items: center; gap: 8px; }
.sg-mute { width: 44px; height: 44px; border: 0; background: none; color: #fff; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.sg-vol input { --v: 80%; -webkit-appearance: none; appearance: none; width: 150px; height: 7px; border-radius: 99px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, #8b6bff var(--v), rgba(255,255,255,.2) var(--v)); }
.sg-vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px rgba(169,140,255,.8); }
.sg-vol input::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; }

/* ---------- Full screen ---------- */
.sg-player:fullscreen, .sg-player.is-full { min-height: 0; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; padding: 26px 34px 0; box-shadow: none; }
.sg-player.is-full { position: fixed; inset: 0; z-index: 5000; }
html.sg-locked, html.sg-locked body { overflow: hidden; }
.sg-player.is-full .sg-controls { margin: 0 -34px; padding-left: 40px; padding-right: 40px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.sg-player.is-full .word { font-size: clamp(34px, 6.6vw, 112px); }
#player.is-full #songTitle { font-size: clamp(24px, 2.6vw, 40px); }
.sg-player.is-full .sg-stage { cursor: pointer; }
.sg-player.is-full .sg-cloud { bottom: 150px; height: 140px; }
.sg-player.clean .sg-top, .sg-player.clean .sg-controls, .sg-player.clean .sg-tap { display: none; }

/* ---------- Song cards ---------- */
/* a song's words, on its own page (/songs/<id>/): a white panel, verses in columns */
.sg-words { margin-top: 34px; padding: 22px 26px 8px; border-radius: 22px; background: #fff; border: 1.5px solid var(--pv-line); }
.sg-words[hidden] { display: none; }
.sg-words h2 { font: 600 26px 'Fredoka', sans-serif; color: var(--pv-plum); margin: 0 0 14px; }
.sg-verses { column-width: 250px; column-gap: 36px; }
.sg-verses p { break-inside: avoid; margin: 0 0 16px; font: 500 16px/1.55 'DM Sans', sans-serif; color: var(--pv-ink, #2d2150); }
.sg-list { margin-top: 34px; }
.sg-list-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.sg-list-head h2 { font: 600 26px 'Fredoka', sans-serif; color: var(--pv-plum); margin: 0; }
.sg-list-head small { font: 600 14px 'DM Sans', sans-serif; color: var(--pv-muted); }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 16px; }
.sg-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 14px; border-radius: 20px; background: #fff; border: 1.5px solid var(--pv-line);
  text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.sg-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(52,30,96,.12); }
.sg-card.current { border: 2.5px solid var(--pv-violet); padding: 9px 9px 13px; background: #f7f4ff; box-shadow: 0 8px 22px rgba(99,75,245,.18); }
.sg-info { display: flex; flex-direction: column; gap: 4px; padding: 0 52px 0 4px; }
.sg-info b { font: 600 16.5px/1.25 'Fredoka', sans-serif; color: var(--pv-plum); }
.sg-meta { font-size: 13.5px; color: var(--pv-muted); }
.sg-go { position: absolute; right: 12px; bottom: 12px; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #efeaff; color: var(--pv-violet); transition: background .15s, color .15s; }
.sg-card:hover .sg-go, .sg-card.current .sg-go { background: var(--pv-violet); color: #fff; }
.sg-go .i-play { width: 20px; height: 20px; fill: currentColor; margin-left: 2px; }
.sg-go .i-eq { display: none; align-items: flex-end; gap: 3px; height: 16px; }
.sg-go .i-eq i { width: 4px; height: 100%; border-radius: 2px; background: currentColor; animation: sg-eq .9s ease-in-out infinite; }
.sg-go .i-eq i:nth-child(2) { animation-delay: -.3s; }
.sg-go .i-eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes sg-eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.sg-go .i-eq i { transform-origin: bottom; }
.sg-card.playing .i-play { display: none; }
.sg-card.playing .i-eq { display: flex; }

/* a song's picture: the topic's colours, its badge and an animal */
.sg-art { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; container-type: inline-size; }
.sg-art::after { content: ''; position: absolute; left: -10%; right: -10%; bottom: -38%; height: 62%; border-radius: 50%; background: rgba(255,255,255,.28); }
.sg-art img { position: absolute; right: 5%; bottom: 4%; height: 84%; width: 46%; object-fit: contain; object-position: right bottom; z-index: 1; }
.sg-badge { position: absolute; left: 7%; top: 44%; transform: translateY(-50%) rotate(-4deg); z-index: 2; font: 700 15cqw/1 'Fredoka', sans-serif; font-style: normal; white-space: nowrap; letter-spacing: -.02em; }
.sg-badge b { font-weight: 700; display: inline-block; -webkit-text-stroke: .07em #2a1b4d; paint-order: stroke fill; text-shadow: 0 .05em 0 rgba(42,27,77,.35); }
.sg-badge b:nth-child(even) { transform: translateY(-.06em); }
.sg-badge .c1 { color: #ff5a5f; } .sg-badge .c2 { color: #3b82f6; } .sg-badge .c3 { color: #ffc21a; } .sg-badge .c4 { color: #2fbf71; }
.t-sky { background: linear-gradient(160deg, #7cc8ff, #d8f0ff); }
.t-meadow { background: linear-gradient(160deg, #8fdc6d, #e1f7c6); }
.t-gold { background: linear-gradient(160deg, #ffcb52, #fff0bd); }
.t-jungle { background: linear-gradient(160deg, #36a56f, #a9e3b3); }
.t-sunset { background: linear-gradient(160deg, #ff9466, #ffd9a6); }
.t-night { background: linear-gradient(160deg, #2a226b, #5b40b8); }
.t-space { background: linear-gradient(160deg, #18235f, #3a52c4); }
.t-sea { background: linear-gradient(160deg, #31bcd0, #b0eef4); }
.t-berry { background: linear-gradient(160deg, #ff86b2, #ffd6e6); }
.t-night::after, .t-space::after { background: rgba(255,255,255,.12); }

.sg-page .ending { margin-top: 34px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  .sg-hero-art { width: 220px; height: 120px; }
  .sg-hero-art img { height: 130px; }
  .sg-hero-art .n1 { left: 10px; } .sg-hero-art .n2 { left: 56px; } .sg-hero-art .n3 { display: none; }
  .sg-buttons { gap: 12px; }
  .sg-vol input { width: 100px; }
}
@media (max-width: 760px) {
  .sg-page .crumbs { padding-top: 14px; }
  .sg-hero h1 { font-size: 40px; }
  .sg-hero p { font-size: 16px; }
  .sg-hero-art { width: 120px; height: 96px; margin-bottom: -10px; }
  .sg-hero-art::before { width: 170px; height: 120px; right: -30px; }
  .sg-hero-art img { height: 100px; right: 0; }
  .sg-hero-art .n2 { display: none; } .sg-hero-art .n1 { left: -6px; top: 6px; width: 30px; }
  .sg-player { min-height: 0; padding: 14px 14px 0; border-radius: 22px; }
  .sg-top { gap: 12px; }
  .sg-now-art { width: 76px; border-radius: 10px; }
  #player #songTitle { font-size: 18px; }
  .sg-now-meta { font-size: 13px; margin-top: 3px; }
  .sg-pill #vizName, .sg-pill .chev { display: none; }
  .sg-pill { padding: 0 12px; }
  .sg-round { height: 40px; min-width: 40px; }
  .sg-tools { gap: 6px; }
  .sg-viz-menu { grid-template-columns: repeat(3, 80px); right: -48px; }
  .sg-stage { min-height: 210px; }
  .word { font-size: clamp(22px, 6.2vw, 30px); }
  .sg-start { font-size: 14px; bottom: 8px; }
  .sg-cloud { bottom: 150px; height: 70px; width: 50%; }
  .sg-controls { margin: 0 -14px; padding: 10px 16px 16px; }
  .sg-buttons { gap: 10px; }
  .sg-ctl { width: 50px; height: 50px; }
  .sg-ctl svg { width: 22px; height: 22px; }
  .sg-play { width: 68px; height: 68px; }
  .sg-play svg { width: 30px; height: 30px; }
  .sg-karaoke { height: 46px; padding: 0 16px 0 14px; font-size: 16px; gap: 6px; }
  .sg-karaoke svg { width: 20px; height: 20px; }
  .sg-buttons .sg-karaoke { order: 5; }
  .sg-vol { display: none; }   /* phones and tablets: the device's own volume buttons */
  .sg-player.is-full { padding: 16px 16px 0; }
  .sg-player.is-full .sg-controls { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .sg-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .sg-card { padding: 7px 7px 10px; border-radius: 16px; gap: 8px; }
  .sg-card.current { padding: 6px 6px 9px; }
  .sg-info { padding: 0 2px; }
  .sg-info b { font-size: 14.5px; }
  .sg-meta { font-size: 12.5px; }
  .sg-go { width: 34px; height: 34px; right: 10px; top: 10px; bottom: auto; box-shadow: 0 2px 6px rgba(42,27,77,.2); }
  .sg-card:not(.current) .sg-go { background: rgba(255,255,255,.92); }
  .sg-go .i-play { width: 16px; height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .sg-stars i, .sg-hero-art .n, .sg-go .i-eq i { animation: none; }
}
