:root {
  --bg: #faf9f5;
  --text: #141413;
  --muted: #6b6a64;
  --track: rgba(20, 20, 19, 0.1);
  --accent: #d97757;
  --button: #141413;
  --button-text: #faf9f5;
  --hue: 18;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413;
    --text: #faf9f5;
    --muted: #9c9a92;
    --track: rgba(250, 249, 245, 0.14);
    --button: #faf9f5;
    --button-text: #141413;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141413;
  --text: #faf9f5;
  --muted: #9c9a92;
  --track: rgba(250, 249, 245, 0.14);
  --button: #faf9f5;
  --button-text: #141413;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

/* Soft color that follows the song on air. */
.backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.glow {
  position: absolute; inset: -30%;
  background:
    radial-gradient(40% 35% at 30% 30%, hsl(var(--hue) 70% 60% / 0.35), transparent 70%),
    radial-gradient(40% 35% at 70% 65%, hsl(calc(var(--hue) + 40) 70% 55% / 0.28), transparent 70%);
  filter: blur(40px);
  transition: background 2s ease;
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: rotate(12deg) scale(1.08); } }

/* Black Sea photos: a new one every 2–3 s, cross-faded, with a slow drift. */
.photo {
  position: absolute; inset: 0;
  background: center / cover no-repeat;
  opacity: 0;
  transition: opacity 1.4s ease;
  will-change: opacity, transform;
}
.photo.show { opacity: 1; animation: kenburns 7s ease-out forwards; }
@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1.02); } }
/* Keeps text readable on any photo, in both themes. */
.scrim {
  position: absolute; inset: 0; opacity: 0; transition: opacity 1s ease;
  background:
    radial-gradient(ellipse 70% 55% at 50% 50%,
      color-mix(in srgb, var(--bg) 62%, transparent) 0%,
      color-mix(in srgb, var(--bg) 35%, transparent) 60%,
      color-mix(in srgb, var(--bg) 10%, transparent) 100%),
    linear-gradient(to bottom,
      color-mix(in srgb, var(--bg) 25%, transparent) 0%,
      transparent 30%, transparent 70%,
      color-mix(in srgb, var(--bg) 45%, transparent) 100%);
}
body.photos .scrim { opacity: 1; }
body.photos .glow { opacity: 0; }
body.photos :is(.top h1, .top p, .meta, .times, .next) {
  text-shadow: 0 1px 10px color-mix(in srgb, var(--bg) 85%, transparent);
}
body.photos :is(.top p, .meta p, .times, .next) { color: color-mix(in srgb, var(--text) 78%, transparent); }

.player {
  position: relative;
  height: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 28px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px;
  text-align: center;
}

.top h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 10px; }
.top p { color: var(--muted); font-size: 14px; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  padding: 4px 10px; border-radius: 99px;
  background: var(--track); color: var(--muted);
  transition: background .4s, color .4s;
}
.live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
body.on .live { background: #e5484d; color: #fff; }
body.on .live i { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.meta { width: 100%; min-height: 58px; }
.meta h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta p { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress { width: 100%; }
.bar { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--text); border-radius: 2px; }
.times { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.play {
  width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--button); color: var(--button-text);
  display: grid; place-items: center; position: relative;
  transition: transform .15s ease;
}
.play:active { transform: scale(.92); }
.play:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.play svg { width: 34px; height: 34px; fill: currentColor; grid-area: 1 / 1; }
.icon-play { margin-left: 4px; }
.icon-stop, .spinner { display: none; }
body.on .icon-play { display: none; }
body.on .icon-stop { display: block; }
body.loading .icon-play, body.loading .icon-stop { display: none; }
body.loading .spinner {
  display: block; grid-area: 1 / 1; width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.next { font-size: 13px; color: var(--muted); min-height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .glow { animation: none; }
  .photo.show { animation: none; }
  .photo { transition-duration: .01s; }
}
