:root {
  --red: #8b1538;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.75);
  --rail: rgba(255, 255, 255, 0.35);
  --rail-2: rgba(255, 255, 255, 0.55);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  --cover-bg: url("uploads/radio-covers/default-logo.jpg");
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: default;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans";
  color: var(--fg);
  background: #000;
  position: relative;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, var(--red) 0%, #000000 100%);
}

.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--cover-bg);
  background-size: cover;
  background-position: center;
  filter: blur(40px) saturate(120%);
  opacity: 0.25;
  transition: background-image 0.4s ease, opacity 0.4s ease, filter 0.4s ease;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.logo-image {
  height: 40px;
  width: auto;
  user-select: none;
  -webkit-user-select: none;
}

.wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 20px 0;
}

.player {
  width: min(880px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  flex-grow: 0;
}

.cover {
  width: min(280px, 50vw);
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: rgba(0, 0, 0, 0.5);
  position: relative;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease, opacity .4s ease;
}

.cover.loading img {
  transform: scale(0.96);
  opacity: 0.6;
}

.cover.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url(icons/spinner-white.svg) center / 40px no-repeat;
  z-index: 2;
  pointer-events: none;
  opacity: 1;
}

h1 {
  font-size: clamp(22px, 3.2vw, 32px);
  margin: 0;
  height: clamp(28px, 4vw, 36px);
  line-height: 1.2;
}

#program {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  display: flex;
  justify-content: center;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 8%,
    black 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 8%,
    black 92%,
    transparent 100%
  );
}

#program:not(.marquee) .track-inner {
  justify-content: center;
}

#program .track-inner {
  display: inline-flex;
  align-items: center;
  gap: 60px;
  white-space: nowrap;
}

#program.marquee {
  justify-content: flex-start;
}

#program.marquee .track-inner {
  animation: marquee-loop 20s linear infinite;
}

#program.marquee:hover .track-inner {
  animation-play-state: paused;
}

.track-title {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}

@keyframes marquee-loop {
  0% {
    transform: translateX(0);
  }
  10% {
    transform: translateX(0);
  }
  70% {
    transform: translateX(-50%);
  }
  90% {
    transform: translateX(-50%);
  }
  100% {
    transform: translateX(0);
  }
}

@media (max-width: 480px) {
  #program.marquee .track-inner {
    animation-duration: 26s;
  }
}

.hosts {
  margin: 0;
  color: var(--muted);
  text-align: center;
  height: 20px;
}

.skeleton {
  color: transparent !important;
  background-color: var(--rail-2);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

h1.skeleton {
  width: 60%;
  margin-left: auto;
  margin-right: auto;
}

.hosts.skeleton {
  width: 40%;
  margin-left: auto;
  margin-right: auto;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 20%,
    rgba(255, 255, 255, 0.4) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.progress {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  position: relative;
}

.time {
  font-size: 12px;
  color: var(--muted);
}

.hour-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--rail);
  position: relative;
}

.hour-bar {
  height: 100%;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: width 0.1s linear;
}

.timeline-tip {
  position: absolute;
  top: -25px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  transform: translateX(-50%);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}

.timeline-tip.visible {
  visibility: visible;
  opacity: 1;
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.btn {
  appearance: none;
  border: 0;
  background: #fff;
  color: var(--red);
  cursor: pointer;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  transition: all 0.2s ease;
  width: 56px;
  height: 56px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
  outline: 2px solid transparent;
  outline-offset: 4px;
}

.btn * {
  cursor: pointer !important;
}

.btn:hover {
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
  transform: scale(1.05);
}

.btn:focus-visible {
  outline: 2px solid var(--fg);
}

.btn svg {
  width: 30px;
  height: 30px;
}

.btn.play {
  background: #ffffff;
  color: var(--red);
  position: relative;
  z-index: 1;
}

.btn.play.is-playing {
  animation: play-pulse 1.5s infinite ease-in-out;
}

@keyframes play-pulse {
  0% {
    box-shadow: 0 0 0 rgba(139, 21, 56, 0.0), 0 0 20px rgba(139, 21, 56, 0.6);
  }
  50% {
    box-shadow: 0 0 0 rgba(139, 21, 56, 0.0), 0 0 32px rgba(139, 21, 56, 1);
  }
  100% {
    box-shadow: 0 0 0 rgba(139, 21, 56, 0.0), 0 0 20px rgba(139, 21, 56, 0.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn.play.is-playing {
    animation: none;
    box-shadow: 0 0 20px rgba(139, 21, 56, 0.8);
  }
}

.volume {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume input[type="range"] {
  width: 160px;
}

.stations {
  position: fixed;
  left: 16px;
  top: 80px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 15;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.pill:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
}

.pill:focus-visible {
  outline: 2px solid var(--fg);
}

.pill.active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.6);
}

.preloader {
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s;
}

.preloader.hidden {
  opacity: 0;
  pointer-events: none;
}

.preloader .loader {
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top: 4px solid #fff;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}

.footer {
  width: 100%;
  text-align: center;
  padding: 32px 20px 0;
  font-size: 12px;
  color: var(--muted);
  z-index: 10;
  margin-top: 24px;
  background: transparent;
}

.footer p {
  margin: 4px 0;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.footer a:hover {
  color: var(--fg);
  text-decoration: underline;
}

.footer a:focus-visible {
  outline: 2px solid var(--fg);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (min-width: 768px) {
  .wrap {
    padding: 80px 20px 0;
  }
  .player {
    flex-grow: 1;
    justify-content: center;
    gap: 24px;
  }
  .cover {
    width: min(320px, 40vw);
  }
  h1 {
    font-size: clamp(24px, 3.5vw, 36px);
    height: clamp(30px, 4.2vw, 40px);
  }
  .hosts {
    height: 22px;
  }
  .controls {
    gap: 18px;
    margin-top: 8px;
  }
  .btn {
    width: 64px;
    height: 64px;
  }
  .btn svg {
    width: 34px;
    height: 34px;
  }
  .header {
    height: 70px;
  }
  .logo-image {
    height: 50px;
  }
  .stations {
    left: 24px;
    top: 94px;
  }
  .footer {
    padding: 40px 40px 0;
    margin-top: auto;
  }
}

@media (min-width: 1200px) {
  .wrap {
    padding: 100px 40px 0;
  }
  .player {
    gap: 32px;
  }
  .cover {
    width: min(360px, 35vw);
  }
}

@media (hover: none) {
  .btn:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    transform: none;
  }
  .pill:hover {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .skeleton::after {
    background: none !important;
  }
  .bg::before {
    transition: none !important;
  }
  .cover.loading::after {
    content: none !important;
  }
  #program.marquee .track-inner {
    animation: none !important;
  }
}

.snow {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  overflow: hidden;
  border-radius: 14px;
}

.snowflake {
  position: absolute;
  top: -10px;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}

.snowflake.depth-far {
  background: rgba(255, 255, 255, 0.15);
  width: 1.5px;
  height: 1.5px;
  filter: blur(1px);
}

.snowflake.depth-mid {
  background: rgba(255, 255, 255, 0.4);
  width: 2.5px;
  height: 2.5px;
  filter: blur(0.5px);
}

.snowflake.depth-near {
  background: rgba(255, 255, 255, 0.8);
  width: 3.5px;
  height: 3.5px;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.4), 0 0 6px rgba(255, 255, 255, 0.2);
}

.nav-toggle {
  position: absolute;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.28);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
  z-index: 50;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(.4,0,.2,1), opacity 0.25s ease;
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-popover {
  position: absolute;
  top: 62px;
  right: 16px;
  background: #000;
  border-radius: 14px;
  padding: 6px;
  min-width: 180px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.65);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 45;
}

.nav-popover.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-item {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
}

@media (min-width: 768px) {
  .nav-popover {
    top: 72px;
  }
}