:root {
  color-scheme: dark;
  --field: #0f8f3a;
  --lime: #08ff4f;
  --yellow: #ffd84a;
  --red: #ff355d;
  --ink: #061006;
  --panel: rgba(4, 13, 6, 0.78);
  --panel-solid: rgba(4, 12, 6, 0.94);
  --line: rgba(255, 255, 255, 0.17);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  min-width: 280px;
  overflow: hidden;
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: #081208;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  background:
    linear-gradient(180deg, rgba(3, 11, 5, 0.22), rgba(3, 11, 5, 0.82)),
    linear-gradient(90deg, rgba(3, 11, 5, 0.36), rgba(3, 11, 5, 0.76)),
    url("back.jpg") center / cover no-repeat;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 50% 38%, rgba(8, 255, 79, 0.2), transparent 32%),
    linear-gradient(90deg, transparent 49.7%, rgba(255, 255, 255, 0.11) 50%, transparent 50.3%);
}

a {
  color: inherit;
  text-decoration: none;
}

.player-app {
  display: grid;
  width: 100%;
  height: 100dvh;
  min-height: 430px;
  grid-template-rows: auto 1fr;
  gap: clamp(14px, 4vh, 28px);
  padding: clamp(10px, 3vw, 22px);
}

.stream-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-self: center;
  width: min(100%, 520px);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 9, 4, 0.68);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

.stream-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 52px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: clamp(0.78rem, 2.4vw, 0.92rem);
  font-weight: 800;
  text-transform: uppercase;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.stream-tab:hover,
.stream-tab:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
  outline: none;
  transform: translateY(-1px);
}

.stream-tab.is-active {
  color: #061006;
  background: var(--lime);
}

.stream-tab img {
  width: clamp(32px, 8vw, 46px);
  height: clamp(32px, 8vw, 46px);
  object-fit: contain;
}

.radio-card {
  align-self: center;
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(110px, 0.78fr) minmax(0, 1.05fr);
  grid-template-areas:
    "art info"
    "controls controls";
  gap: clamp(14px, 4vw, 28px);
  width: min(100%, 680px);
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 34%),
    var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.46);
}

.station-art {
  position: relative;
  grid-area: art;
  align-self: center;
  justify-self: center;
  --viz-radius: 106px;
  width: min(100%, 190px);
  aspect-ratio: 1;
}

.station-art img {
  position: relative;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.48));
  animation: ball-float 3.8s ease-in-out infinite;
  transform-origin: 50% 58%;
  will-change: transform;
}

.signal-ring {
  position: absolute;
  inset: -2%;
  z-index: 1;
  border: 1px solid rgba(8, 255, 79, 0.34);
  border-radius: 50%;
  opacity: 0.7;
  box-shadow:
    0 0 16px rgba(8, 255, 79, 0.24),
    inset 0 0 16px rgba(8, 255, 79, 0.1);
}

.visualizer {
  position: absolute;
  inset: -12%;
  z-index: 2;
  border-radius: 50%;
  opacity: 0.62;
  pointer-events: none;
}

.visualizer span {
  position: absolute;
  left: calc(50% - 3px);
  top: 50%;
  width: 6px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--yellow), var(--lime));
  box-shadow: 0 0 12px rgba(8, 255, 79, 0.38);
  opacity: 0.54;
  transform-origin: 50% 0;
  transform: rotate(var(--bar-angle)) translateY(calc(-1 * var(--viz-radius))) scaleY(0.38);
}

.is-playing .visualizer {
  opacity: 1;
}

.is-playing .visualizer span {
  animation: orbital-meter 640ms ease-in-out infinite;
}

.visualizer span:nth-child(1) { --bar-angle: 0deg; }
.visualizer span:nth-child(2) { --bar-angle: 22.5deg; }
.visualizer span:nth-child(3) { --bar-angle: 45deg; }
.visualizer span:nth-child(4) { --bar-angle: 67.5deg; }
.visualizer span:nth-child(5) { --bar-angle: 90deg; }
.visualizer span:nth-child(6) { --bar-angle: 112.5deg; }
.visualizer span:nth-child(7) { --bar-angle: 135deg; }
.visualizer span:nth-child(8) { --bar-angle: 157.5deg; }
.visualizer span:nth-child(9) { --bar-angle: 180deg; }
.visualizer span:nth-child(10) { --bar-angle: 202.5deg; }
.visualizer span:nth-child(11) { --bar-angle: 225deg; }
.visualizer span:nth-child(12) { --bar-angle: 247.5deg; }
.visualizer span:nth-child(13) { --bar-angle: 270deg; }
.visualizer span:nth-child(14) { --bar-angle: 292.5deg; }
.visualizer span:nth-child(15) { --bar-angle: 315deg; }
.visualizer span:nth-child(16) { --bar-angle: 337.5deg; }

.is-playing .visualizer span:nth-child(2) {
  animation-duration: 520ms;
  animation-delay: -120ms;
}

.is-playing .visualizer span:nth-child(3) {
  animation-duration: 760ms;
  animation-delay: -260ms;
}

.is-playing .visualizer span:nth-child(4) {
  animation-duration: 460ms;
  animation-delay: -80ms;
}

.is-playing .visualizer span:nth-child(5) {
  animation-duration: 680ms;
  animation-delay: -320ms;
}

.is-playing .visualizer span:nth-child(6) {
  animation-duration: 560ms;
  animation-delay: -180ms;
}

.is-playing .visualizer span:nth-child(7) {
  animation-duration: 720ms;
  animation-delay: -420ms;
}

.is-playing .visualizer span:nth-child(8) {
  animation-duration: 500ms;
  animation-delay: -220ms;
}

.is-playing .visualizer span:nth-child(9) {
  animation-duration: 740ms;
  animation-delay: -340ms;
}

.is-playing .visualizer span:nth-child(10) {
  animation-duration: 580ms;
  animation-delay: -460ms;
}

.is-playing .visualizer span:nth-child(11) {
  animation-duration: 700ms;
  animation-delay: -160ms;
}

.is-playing .visualizer span:nth-child(12) {
  animation-duration: 540ms;
  animation-delay: -300ms;
}

.is-playing .visualizer span:nth-child(13) {
  animation-duration: 790ms;
  animation-delay: -90ms;
}

.is-playing .visualizer span:nth-child(14) {
  animation-duration: 610ms;
  animation-delay: -390ms;
}

.is-playing .visualizer span:nth-child(15) {
  animation-duration: 470ms;
  animation-delay: -250ms;
}

.is-playing .visualizer span:nth-child(16) {
  animation-duration: 680ms;
  animation-delay: -520ms;
}

.station-info {
  grid-area: info;
  align-self: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--lime);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.live-label span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(255, 53, 93, 0.16);
}

h1 {
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Goldman, Inter, Arial, sans-serif;
  font-size: clamp(1.75rem, 6vw, 3.35rem);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.stream-title {
  margin: 10px 0 0;
  color: var(--text);
  font-size: clamp(1rem, 3.2vw, 1.35rem);
  font-weight: 800;
  text-transform: uppercase;
}

.status {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(0.86rem, 2.5vw, 1rem);
  font-weight: 700;
}

.controls {
  grid-area: controls;
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr);
  align-items: center;
  gap: clamp(14px, 4vw, 24px);
  padding: clamp(12px, 3vw, 16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: var(--panel-solid);
}

.play-button {
  display: grid;
  place-items: center;
  width: clamp(74px, 19vw, 102px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  color: #061006;
  background: var(--lime);
  box-shadow: 0 0 0 8px rgba(8, 255, 79, 0.18), 0 20px 46px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.play-button:hover,
.play-button:focus-visible {
  filter: brightness(1.08);
  outline: none;
  transform: scale(1.03);
}

.play-icon {
  width: 0;
  height: 0;
  margin-left: 7px;
  border-block: 16px solid transparent;
  border-left: 25px solid currentColor;
}

.is-playing .play-icon {
  width: 28px;
  height: 30px;
  margin-left: 0;
  border: 0;
  background:
    linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%);
}

.volume-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mute-button {
  min-width: 48px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.mute-button:hover,
.mute-button:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: var(--lime);
  cursor: pointer;
}

audio {
  display: none;
}

@keyframes ball-float {
  0%,
  100% {
    transform: translate3d(-3px, 0, 0) rotate(-4deg) scale(1);
  }
  25% {
    transform: translate3d(4px, -8px, 0) rotate(3deg) scale(1.025);
  }
  50% {
    transform: translate3d(0, -14px, 0) rotate(6deg) scale(1.035);
  }
  75% {
    transform: translate3d(-4px, -7px, 0) rotate(-2deg) scale(1.018);
  }
}

@keyframes orbital-meter {
  0%,
  100% {
    opacity: 0.48;
    transform: rotate(var(--bar-angle)) translateY(calc(-1 * var(--viz-radius))) scaleY(0.35);
  }
  24% {
    opacity: 1;
    transform: rotate(var(--bar-angle)) translateY(calc(-1 * var(--viz-radius))) scaleY(1.45);
  }
  52% {
    opacity: 0.66;
    transform: rotate(var(--bar-angle)) translateY(calc(-1 * var(--viz-radius))) scaleY(0.62);
  }
  76% {
    opacity: 0.88;
    transform: rotate(var(--bar-angle)) translateY(calc(-1 * var(--viz-radius))) scaleY(1.06);
  }
}

@media (max-width: 520px) {
  .player-app {
    min-height: 520px;
    gap: 12px;
    padding: 8px;
  }

  .stream-tabs {
    width: 100%;
  }

  .stream-tab {
    flex-direction: column;
    gap: 3px;
    min-height: 68px;
    padding: 6px 4px;
  }

  .radio-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "art"
      "info"
      "controls";
    align-content: center;
    gap: 14px;
    padding: 14px;
  }

  .station-art {
    --viz-radius: min(25vw, 84px);
    width: min(44vw, 150px);
  }

  .station-info {
    text-align: center;
  }

  h1 {
    font-size: clamp(1.9rem, 11vw, 2.85rem);
  }

  .controls {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .volume-control {
    width: 100%;
  }
}

@media (max-height: 470px) {
  .player-app {
    min-height: 360px;
    gap: 8px;
    padding: 8px;
  }

  .stream-tab {
    min-height: 44px;
  }

  .stream-tab img {
    width: 30px;
    height: 30px;
  }

  .radio-card {
    grid-template-columns: 100px minmax(0, 1fr) auto;
    grid-template-areas: "art info controls";
    gap: 12px;
    padding: 12px;
  }

  .station-art {
    --viz-radius: 56px;
    width: 96px;
  }

  h1 {
    font-size: clamp(1.45rem, 6vh, 2.25rem);
  }

  .controls {
    grid-template-columns: 74px;
    width: 190px;
    padding: 10px;
  }

  .volume-control {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
