:root {
  --teal: #8fb9a8;
  --teal-deep: #37564b;
  --maroon: #7c3a35;
  --mustard: #d9a441;
  --mustard-hi: #eec06a;
  --cream: #f3e6c9;
  --ink: #241a12;
  --glow: #ffb84d;
  --hairline: rgba(255, 235, 205, 0.28);
  --text-dim: rgba(243, 230, 201, 0.55);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  font-family: "Baloo Tamma 2", sans-serif;
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; }

:where(button, a, input):focus-visible {
  outline: 2px solid rgba(255, 214, 150, 0.85);
  outline-offset: 2px;
  border-radius: 6px;
}

/* staggered page reveal */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rise-center {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.masthead { animation: rise 0.9s var(--ease) 0.15s backwards; }
.player   { animation: rise-center 0.9s var(--ease) 0.3s backwards; }
.credit   { animation: rise 0.9s var(--ease) 0.5s backwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- scene ---------- */

.scene {
  position: fixed;
  inset: 0;
}

.scene__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 35% center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.radio-glow {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 184, 77, 0.55), rgba(255, 184, 77, 0.18) 55%, transparent 75%);
  filter: blur(6px);
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
  z-index: 5;
}

.scene.is-playing .radio-glow {
  opacity: 1;
  animation: glow-breathe 3.4s ease-in-out infinite;
}

@keyframes glow-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* ---------- music notes ---------- */

.notes { position: absolute; inset: 0; pointer-events: none; z-index: 7; }

.note {
  position: absolute;
  font-size: 20px;
  color: rgba(255, 226, 166, 0.95);
  text-shadow: 0 0 8px rgba(255, 184, 77, 0.6);
  animation: note-float 4.5s ease-out forwards;
}

@keyframes note-float {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translate(var(--dx, 40px), -160px) rotate(var(--rot, 18deg)); opacity: 0; }
}

/* ---------- dust motes ---------- */

.motes { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

.motes i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 236, 190, 0.8);
  filter: blur(1px);
  animation: mote-drift linear infinite;
}

.motes i:nth-child(1)  { left: 68%; top: 30%; animation-duration: 11s; animation-delay: 0s; }
.motes i:nth-child(2)  { left: 74%; top: 45%; animation-duration: 14s; animation-delay: -3s; }
.motes i:nth-child(3)  { left: 80%; top: 25%; animation-duration: 9s;  animation-delay: -6s; width: 3px; height: 3px; }
.motes i:nth-child(4)  { left: 86%; top: 50%; animation-duration: 16s; animation-delay: -2s; }
.motes i:nth-child(5)  { left: 71%; top: 60%; animation-duration: 12s; animation-delay: -8s; width: 5px; height: 5px; }
.motes i:nth-child(6)  { left: 90%; top: 35%; animation-duration: 10s; animation-delay: -4s; }
.motes i:nth-child(7)  { left: 77%; top: 70%; animation-duration: 15s; animation-delay: -10s; width: 3px; height: 3px; }
.motes i:nth-child(8)  { left: 84%; top: 15%; animation-duration: 13s; animation-delay: -5s; }
.motes i:nth-child(9)  { left: 65%; top: 50%; animation-duration: 17s; animation-delay: -12s; width: 3px; height: 3px; }
.motes i:nth-child(10) { left: 93%; top: 55%; animation-duration: 11s; animation-delay: -7s; }
.motes i:nth-child(11) { left: 88%; top: 65%; animation-duration: 14s; animation-delay: -9s; width: 5px; height: 5px; }
.motes i:nth-child(12) { left: 70%; top: 20%; animation-duration: 18s; animation-delay: -1s; }

@keyframes mote-drift {
  0%   { transform: translate(0, 0); opacity: 0; }
  15%  { opacity: 0.9; }
  85%  { opacity: 0.5; }
  100% { transform: translate(-60px, 90px); opacity: 0; }
}

/* ---------- grain + vignette ---------- */

.grain {
  position: absolute;
  inset: -50%;
  z-index: 8;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(4) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, 3%); }
  50%  { transform: translate(3%, -2%); }
  75%  { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(20, 12, 6, 0.5) 100%);
}

/* ---------- masthead ---------- */

.masthead {
  position: fixed;
  top: 26px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 10;
  pointer-events: none;
}

.masthead__title {
  font-family: "Noto Serif Kannada", serif;
  font-weight: 900;
  font-size: clamp(1.5rem, 3.9vw, 3rem);
  line-height: 1.3;
  color: var(--cream);
  text-shadow:
    2px 2px 0 var(--maroon),
    4px 4px 0 rgba(36, 26, 18, 0.55),
    0 0 30px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
}

.masthead__sub {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(0.6rem, 1.1vw, 0.72rem);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(243, 230, 201, 0.82);
  text-shadow: 0 1px 2px rgba(36, 26, 18, 0.8);
  margin-top: 10px;
}

/* ---------- player ---------- */

.player {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 12;
  width: min(680px, calc(100vw - 24px));
  display: flex;
  gap: 16px;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.07), rgba(255, 250, 240, 0) 45%),
    rgba(26, 18, 12, 0.55);
  -webkit-backdrop-filter: blur(50px) saturate(1.8);
  backdrop-filter: blur(50px) saturate(1.8);
  border: none;
  border-radius: 22px;
  padding: 12px 20px 12px 12px;
  box-shadow:
    0 0 0 0.5px var(--hairline),
    inset 0 0.5px 0 rgba(255, 245, 225, 0.25),
    0 32px 64px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

/* art tile: spinning vinyl */

.player__art {
  position: relative;
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 214, 150, 0.08), transparent 60%),
    linear-gradient(160deg, #211712, #120c08);
  box-shadow: 0 0 0 0.5px rgba(255, 235, 205, 0.2), 0 10px 24px rgba(0, 0, 0, 0.45);
  transform: scale(0.97);
  transition: transform 0.65s var(--ease), box-shadow 0.65s var(--ease);
}

/* Apple Music signature: artwork swells while playing */
.player.is-on .player__art {
  transform: scale(1.05);
  box-shadow: 0 0 0 0.5px rgba(255, 235, 205, 0.25), 0 16px 36px rgba(0, 0, 0, 0.55);
}

.vinyl {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    conic-gradient(from 130deg, rgba(255, 235, 200, 0.10), transparent 22%, transparent 46%, rgba(255, 235, 200, 0.06) 55%, transparent 65%),
    repeating-radial-gradient(circle at center, #16110d 0 1.6px, #221a14 1.6px 3.2px);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.7),
    0 6px 16px rgba(0, 0, 0, 0.65),
    inset 0 0 22px rgba(0, 0, 0, 0.55);
  animation: vinyl-spin 5.5s linear infinite;
  animation-play-state: paused;
}

.player.is-on .vinyl { animation-play-state: running; }

@keyframes vinyl-spin { to { transform: rotate(360deg); } }

.vinyl__label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 47%;
  height: 47%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(217, 164, 65, 0.55), 0 0 10px rgba(0, 0, 0, 0.6);
  background: var(--maroon);
}

.vinyl__hole {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7%;
  height: 7%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #0a0705;
  box-shadow: 0 0 0 2px rgba(243, 230, 201, 0.25);
}

.player__artShield {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

/* offstage audio engine: audible but out of sight */

.offstage {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 2px;
  height: 2px;
  overflow: hidden;
  opacity: 0.01;
  pointer-events: none;
  z-index: 1;
}

.offstage iframe { width: 200px; height: 112px; border: 0; }

/* body */

.player__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.player__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(217, 164, 65, 0.9);
}

.player__count {
  margin-left: auto;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

/* animated equalizer: alive while playing, resting dots when paused */
.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 11px;
}

.eq i {
  width: 3px;
  border-radius: 1.5px;
  background: var(--mustard);
  height: 25%;
  transition: height 0.5s var(--ease);
}

.player.is-on .eq i { animation: eq-bounce 1s var(--ease) infinite; }
.player.is-on .eq i:nth-child(1) { animation-delay: -0.2s; }
.player.is-on .eq i:nth-child(2) { animation-delay: -0.55s; }
.player.is-on .eq i:nth-child(3) { animation-delay: -0.85s; }

@keyframes eq-bounce {
  0%, 100% { height: 30%; }
  50%      { height: 100%; }
}

.player__title {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player__artist {
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* seek */

.player__seekRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 5px;
}

.player__time {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.66rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
}

.player__time:last-child { text-align: right; }

.player__seek {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 14px;
  background: transparent;
  cursor: pointer;
  --fill: 0%;
}

.player__seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(243, 230, 201, 0.92) var(--fill), rgba(243, 230, 201, 0.16) var(--fill));
  transition: background 0.2s ease;
}

.player__seek:hover::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #fff var(--fill), rgba(243, 230, 201, 0.24) var(--fill));
}

.player__seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45), 0 0 0 0.5px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.player__seek:hover::-webkit-slider-thumb,
.player__seek:active::-webkit-slider-thumb { opacity: 1; transform: scale(1); }
.player__seek:active::-webkit-slider-thumb { transform: scale(1.25); }

.player__seek::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(243, 230, 201, 0.16);
}

.player__seek::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: rgba(243, 230, 201, 0.92);
}

.player__seek::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.player__seek:hover::-moz-range-thumb,
.player__seek:active::-moz-range-thumb { opacity: 1; }

/* controls */

.player__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
}

.pbtn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(243, 230, 201, 0.85);
  cursor: pointer;
  transition: color 0.35s var(--ease), background 0.35s var(--ease), transform 0.35s var(--ease);
}

.pbtn:hover { color: #fff; background: rgba(255, 240, 215, 0.1); }
.pbtn:active { transform: scale(0.88); transition-duration: 0.1s; }

.pbtn--play {
  width: 46px;
  height: 46px;
  margin: 0 4px;
  color: #1c1410;
  background: var(--cream);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.4);
}

.pbtn--play:hover {
  color: #1c1410;
  background: #fff;
  transform: scale(1.04);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 12px 32px rgba(0, 0, 0, 0.45);
}

.pbtn--play:active { transform: scale(0.92); transition-duration: 0.1s; }

.pbtn svg { display: block; }
.pbtn--play svg { width: 22px; height: 22px; }

.pbtn--surprise {
  color: var(--mustard-hi);
  margin-left: 2px;
}

.pbtn--surprise:hover {
  color: #ffd98a;
  background: rgba(238, 192, 106, 0.14);
  box-shadow: 0 0 16px rgba(238, 192, 106, 0.25);
}

.pbtn--surprise svg { animation: twinkle 4s ease-in-out infinite; }

@keyframes twinkle {
  0%, 88%, 100% { transform: scale(1) rotate(0deg); }
  92%           { transform: scale(1.2) rotate(12deg); }
  96%           { transform: scale(0.95) rotate(-6deg); }
}

/* roulette state while the surprise spins up */
.player.rouletting .vinyl {
  animation-play-state: running;
  animation-duration: 0.45s;
}

.player.rouletting .player__title,
.player.rouletting .player__artist {
  filter: blur(1px);
  opacity: 0.75;
}

.note--burst {
  font-size: 26px;
  animation-duration: 2.4s;
}

/* ---------- live listeners ---------- */

.topright {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: rise 0.9s var(--ease) 0.6s backwards;
}

.listeners,
.likebtn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  font-family: "Baloo Tamma 2", sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  color: rgba(243, 230, 201, 0.92);
  background: rgba(26, 18, 12, 0.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 0 0 0.5px var(--hairline), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.likebtn {
  border: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
  font-variant-numeric: tabular-nums;
}

.likebtn:hover { background: rgba(26, 18, 12, 0.75); transform: translateY(-1px); }
.likebtn:active { transform: scale(0.92); transition-duration: 0.1s; }

.likebtn__heart {
  fill: none;
  stroke: rgba(243, 230, 201, 0.9);
  stroke-width: 2;
  transition: fill 0.3s var(--ease), stroke 0.3s var(--ease);
}

.likebtn.liked .likebtn__heart {
  fill: #e0564a;
  stroke: #e0564a;
}

.likebtn.liked svg { animation: heart-pop 0.45s var(--ease); }

@keyframes heart-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

.note--heart {
  color: #e0564a;
  text-shadow: 0 0 8px rgba(224, 86, 74, 0.6);
}

.listeners__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4cd964;
  box-shadow: 0 0 6px rgba(76, 217, 100, 0.8);
  animation: dot-pulse 2.2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* ---------- credit ---------- */

.credit {
  position: fixed;
  left: 18px;
  top: 18px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
}

.credit__label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(243, 230, 201, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.credit__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: rgba(243, 230, 201, 0.9);
  background: rgba(26, 18, 12, 0.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border: none;
  box-shadow: 0 0 0 0.5px var(--hairline), 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: color 0.35s var(--ease), transform 0.35s var(--ease), background 0.35s var(--ease);
}

.credit__icon:hover {
  color: #fff;
  background: rgba(26, 18, 12, 0.75);
  transform: translateY(-2px) scale(1.06);
}

.credit__icon:active { transform: translateY(0) scale(0.94); transition-duration: 0.1s; }

.inspired {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 10;
  font-family: "Special Elite", monospace;
  font-size: 0.7rem;
  color: rgba(243, 230, 201, 0.65);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.7);
  text-decoration: none;
  animation: rise 0.9s var(--ease) 0.55s backwards;
}

.inspired:hover { color: var(--mustard); text-decoration: underline; }

/* ---------- personal social links ---------- */

.social {
  position: fixed;
  left: 18px;
  bottom: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: rise 0.9s var(--ease) 0.6s backwards;
}

/* ---------- small screens ---------- */

/* the portrait artwork frames the radio center-left; bias slightly up */
@media (orientation: portrait) {
  .scene__img { object-position: center 40%; }
}

/* phones, portrait */
@media (max-width: 640px) {

  /* top bar: playlist icons left, listeners right, title below */
  .credit { top: 10px; left: 10px; gap: 8px; }
  .credit__label { display: none; }
  .credit__icon { width: 34px; height: 34px; }

  .listeners {
    top: 10px;
    right: 10px;
    bottom: auto;
    font-size: 0.72rem;
    padding: 7px 12px;
  }

  .masthead { top: 56px; padding: 0 16px; }
  .masthead__title { font-size: 1.35rem; }
  .masthead__sub { font-size: 0.55rem; letter-spacing: 0.18em; margin-top: 6px; }

  .inspired { display: none; }
  .social { display: none; }

  /* player: art + info on top row, full-width controls beneath */
  .player {
    bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 12px 14px 8px;
    gap: 12px;
    flex-wrap: wrap;
    border-radius: 20px;
  }

  .player__art { flex: 0 0 58px; width: 58px; height: 58px; border-radius: 12px; }
  .player__eyebrow { display: none; }
  .player__meta { font-size: 0.56rem; }
  .player__title { font-size: 0.98rem; margin-top: 0; }
  .player__artist { font-size: 0.7rem; }
  .player__seekRow { padding-top: 4px; }

  .player__controls {
    flex-basis: 100%;
    justify-content: center;
    gap: 22px;
    padding-top: 2px;
  }

  .pbtn { width: 44px; height: 44px; }
  .pbtn--play { width: 54px; height: 54px; margin: 0; }
  .pbtn--play svg { width: 22px; height: 22px; }
  .pbtn--surprise { margin-left: 0; }
}

/* phones, landscape: keep the slim bar but clear the corners */
@media (min-width: 641px) and (max-height: 480px) {
  .masthead { top: 8px; }
  .masthead__sub { display: none; }
  .player { width: min(560px, calc(100vw - 300px)); bottom: 10px; }
  .credit { top: 10px; }
  .listeners { top: 10px; right: 12px; }
}
