:root {
  color-scheme: dark;
  --background: #050505;
  --surface: #111;
  --surface-raised: #181818;
  --border: #2a2a2a;
  --muted: #a3a3a3;
  --accent: #75f0a0;
  --accent-dark: #102f1b;
  --danger: #ff7b7b;
  --warning: #f4cd68;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--background);
}

body {
  color: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.main-container {
  min-height: 100dvh;
  position: relative;
  isolation: isolate;
  background: #030504;
}

.app-header {
  position: fixed;
  z-index: 1020;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1.2rem clamp(1rem, 3vw, 3rem);
  pointer-events: none;
}

.stations-trigger {
  pointer-events: auto;
}

.player-zone {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 5.5rem 1.25rem 3rem;
  position: relative;
  overflow: hidden;
  background: #030504;
}

.player-zone::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(2, 3, 2, 0.88) 0%, rgba(2, 4, 3, 0.42) 50%, rgba(2, 3, 2, 0.82) 100%),
    linear-gradient(0deg, #030504 0%, transparent 32%, rgba(3, 5, 4, 0.2) 75%, #030504 100%);
}

.ambient-artwork {
  position: absolute;
  z-index: 0;
  inset: -20%;
  width: 140%;
  height: 140%;
  object-fit: cover;
  filter: blur(90px) saturate(1.25) brightness(0.55);
  opacity: 0.3;
  transform: scale(1.08);
  pointer-events: none;
}

.stations-trigger {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(20, 20, 20, 0.66);
  box-shadow: 0 0.5rem 1.6rem rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
  transition: transform 150ms ease, background 150ms ease;
}

.stations-trigger:hover {
  transform: translateY(-1px);
  background: rgba(36, 36, 36, 0.92);
  color: #fff;
}

.player-card {
  z-index: 1;
  width: min(68rem, 100%);
  position: relative;
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(17rem, 0.95fr) minmax(20rem, 1.05fr);
  align-items: center;
  gap: clamp(2.5rem, 8vw, 7.5rem);
}

.logo-frame {
  width: min(23rem, 34vw, calc(100dvh - 10rem));
  min-width: 10rem;
  aspect-ratio: 1;
  margin-inline: auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  padding: clamp(0.22rem, 0.45vw, 0.35rem);
  border-radius: 1.45rem;
  border: 0;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 2.5rem 6rem rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(24px) saturate(1.15);
  isolation: isolate;
  transition: transform 350ms ease, box-shadow 350ms ease;
}

.logo-frame::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    radial-gradient(circle at 25% 15%, rgba(255, 255, 255, 0.11), transparent 44%),
    linear-gradient(145deg, rgba(117, 240, 160, 0.055), rgba(255, 255, 255, 0.015));
}

.logo-frame:hover {
  transform: translateY(-4px) scale(1.012);
  box-shadow: 0 3rem 7rem rgba(0, 0, 0, 0.68);
}

.logo-frame img {
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  border-radius: 1.2rem;
  background: transparent;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.28);
  transform: translateZ(0);
}

.logo-fallback {
  z-index: 1;
  font-size: clamp(5rem, 18vw, 9rem);
  color: var(--accent);
}

.player-controls {
  min-width: 0;
  text-shadow: 0 2px 1.2rem rgba(0, 0, 0, 0.45);
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

#station-title {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 720;
  line-height: 0.96;
  letter-spacing: -0.055em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.transport {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 2.25rem;
}

.control-button {
  width: 3.1rem;
  height: 3.1rem;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(30, 30, 30, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 0.6rem 1.5rem rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(14px);
  transition: transform 150ms ease, background 150ms ease;
}

.control-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #222;
}

.control-button:active:not(:disabled),
.stations-trigger:active {
  transform: scale(0.94);
}

.control-button.primary {
  width: 4rem;
  height: 4rem;
  color: #fff;
  border: 0;
  background: #1a1a1a;
  font-size: 1.5rem;
}

.transport[data-playback-state="playing"] #btnPlay {
  color: #06130a;
  background: var(--accent);
  box-shadow: 0 0.7rem 1.8rem rgba(117, 240, 160, 0.12);
}

.transport[data-playback-state="paused"] #btnPlay {
  color: #06130a;
  background: var(--accent);
  box-shadow: 0 0.7rem 1.8rem rgba(117, 240, 160, 0.12);
}

.transport[data-playback-state="stopped"] #btnStop {
  color: #06130a;
  background: var(--accent);
  box-shadow: 0 0.7rem 1.8rem rgba(117, 240, 160, 0.12);
}

.control-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.15rem;
}

.sources[hidden] {
  display: none;
}

.source-button {
  position: relative;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(22, 22, 22, 0.65);
  backdrop-filter: blur(12px);
  font-size: 0.8rem;
  opacity: 0.38;
  transition: opacity 150ms ease, color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.source-button:hover {
  color: #fff;
  background: #1c1c1c;
  opacity: 0.75;
}

.source-button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-dark);
  opacity: 1;
}

.source-button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  right: -0.1rem;
  bottom: -0.1rem;
  width: 0.42rem;
  height: 0.42rem;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.app-status {
  position: fixed;
  z-index: 1010;
  left: 0;
  bottom: 0;
  width: 100%;
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem;
  border: 0;
  color: var(--muted);
  background: rgba(9, 9, 9, 0.9);
  backdrop-filter: blur(16px);
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: left;
}

.app-status::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  opacity: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(117, 240, 160, 0.35) 25%,
    var(--accent) 50%,
    rgba(117, 240, 160, 0.35) 75%,
    transparent 100%
  );
  background-size: 200% 100%;
  transition: opacity 200ms ease;
}

.app-status[data-kind="error"] {
  color: var(--danger);
}

.app-status[data-kind="warning"] {
  color: var(--warning);
}

.app-status[data-kind="playing"] {
  color: var(--accent);
}

.app-status[data-kind="paused"],
.app-status[data-kind="stopped"] {
  color: var(--accent);
}

.app-status[data-kind="playing"]::after {
  opacity: 0.75;
  animation: status-flow 2.6s linear infinite;
}

.status-wave {
  width: 1rem;
  height: 0.85rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1px;
}

.app-status[data-kind="playing"] .status-wave {
  display: inline-flex;
}

.status-icon {
  width: 1rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.app-status[data-kind="playing"] .status-icon {
  display: none;
}

.app-status[data-kind="loading"] .status-icon {
  animation: status-spin 1.1s linear infinite;
}

.status-wave i {
  width: 2px;
  height: 30%;
  border-radius: 999px;
  background: currentColor;
  animation: status-wave 850ms ease-in-out infinite alternate;
}

.status-wave i:nth-child(2),
.status-wave i:nth-child(4) {
  animation-delay: -420ms;
}

.status-wave i:nth-child(3) {
  animation-delay: -680ms;
}

@keyframes status-flow {
  to { background-position: -200% 0; }
}

@keyframes status-wave {
  0% { height: 25%; opacity: 0.5; }
  100% { height: 100%; opacity: 1; }
}

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

.retry-button {
  border: 0;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  color: var(--accent);
  background: rgba(117, 240, 160, 0.1);
  font-size: 0.75rem;
  font-weight: 600;
}

.offcanvas {
  --bs-offcanvas-width: min(23rem, 92vw);
  background: #080808 !important;
  border: 0 !important;
  box-shadow: -2rem 0 5rem rgba(0, 0, 0, 0.55);
}

.offcanvas-header {
  min-height: 3.5rem;
  justify-content: flex-end;
  padding: 0.8rem 1rem 0.25rem;
  border: 0;
}

.offcanvas-header .btn-close {
  opacity: 0.55;
  transition: opacity 150ms ease;
}

.offcanvas-header .btn-close:hover,
.offcanvas-header .btn-close:focus-visible {
  opacity: 1;
}

.offcanvas-body {
  scrollbar-width: thin;
  scrollbar-color: #3b3b3b transparent;
}

.offcanvas-body::-webkit-scrollbar {
  width: 5px;
}

.offcanvas-body::-webkit-scrollbar-track {
  background: transparent;
}

.offcanvas-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #3b3b3b;
}

.offcanvas-backdrop.show {
  opacity: 0.72;
  background: #000;
}

.station-list {
  margin: 0;
  padding: 0.75rem 0.65rem 1rem;
  list-style: none;
}

.station-button {
  width: 100%;
  display: grid;
  grid-template-columns: 2.75rem 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem;
  border: 0;
  border-radius: 0.85rem;
  color: #eee;
  background: transparent;
  text-align: left;
  transition: background 150ms ease;
}

.station-button:hover {
  background: rgba(255, 255, 255, 0.045);
}

.station-button[aria-current="true"] {
  background: linear-gradient(90deg, rgba(34, 116, 60, 0.32), rgba(34, 116, 60, 0.16));
}

.station-logo-frame {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 0.65rem;
  background: #000;
  isolation: isolate;
}

.station-logo {
  width: calc(100% + 3px);
  height: calc(100% + 3px);
  max-width: none;
  object-fit: contain;
  background: #000;
  transform: translateZ(0);
}

.station-logo-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
}

.station-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 560;
}

.station-active {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 650;
}

.station-active:not(:empty)::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0.65rem rgba(117, 240, 160, 0.45);
}

.swipe-feedback {
  animation: swipe-feedback 180ms ease;
}

.player-card.station-enter .logo-frame {
  animation: artwork-enter 420ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.player-card.station-enter .player-controls {
  animation: controls-enter 360ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.ambient-artwork.ambient-enter {
  animation: ambient-enter 700ms ease-out;
}

@keyframes artwork-enter {
  0% { opacity: 0.35; transform: scale(0.965); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes controls-enter {
  0% { opacity: 0; transform: translateY(0.65rem); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes ambient-enter {
  0% { opacity: 0; }
  100% { opacity: 0.3; }
}

@keyframes swipe-feedback {
  50% { opacity: 0.68; }
}

@media (min-width: 701px) and (min-height: 701px) {
  .player-card {
    transform: translateY(-2.5vh);
  }
}

@media (max-width: 700px), (orientation: portrait) {
  .player-zone {
    place-items: start center;
  }

  .player-card {
    margin-top: clamp(4.5rem, 12dvh, 7.5rem);
  }

  .player-layout {
    grid-template-columns: 1fr;
    gap: clamp(1.5rem, 3.5dvh, 2.25rem);
    text-align: center;
  }

  .logo-frame {
    width: clamp(10rem, 48vw, 14rem);
    min-width: 0;
    border-radius: 1.4rem;
  }

  .transport,
  .sources {
    justify-content: center;
  }

  .player-controls {
    width: min(25rem, 100%);
    margin-inline: auto;
  }

  #station-title {
    margin-inline: auto;
    text-align: center;
  }

  .ambient-artwork {
    filter: blur(70px) saturate(1.15) brightness(0.5);
    opacity: 0.24;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .app-header {
    padding-block: 0.65rem;
  }

  .player-zone {
    padding: 3.5rem 1rem 2.25rem;
  }

  .player-card {
    width: min(48rem, 88%);
  }

  .player-layout {
    grid-template-columns: minmax(9rem, 0.8fr) minmax(17rem, 1fr);
    gap: clamp(1.5rem, 6vw, 4rem);
  }

  .logo-frame {
    width: min(15rem, 27vw, calc(100dvh - 6rem));
    min-width: 8rem;
    border-radius: 1.35rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.4);
  }

  #station-title {
    font-size: clamp(1.75rem, 4vw, 2.8rem);
  }

  .transport {
    margin-top: 1.1rem;
  }

  .control-button {
    width: 2.65rem;
    height: 2.65rem;
  }

  .control-button.primary {
    width: 3.4rem;
    height: 3.4rem;
  }

  .sources {
    margin-top: 0.65rem;
  }
}

@media (max-width: 600px), (max-height: 520px) {
  .app-header {
    padding-inline: 0.85rem;
  }

  .stations-trigger {
    width: 2.75rem;
    height: 2.75rem;
    justify-content: center;
    gap: 0;
    padding: 0;
    border-radius: 50%;
  }

  .stations-trigger span {
    display: none;
  }
}

@media (max-height: 700px) and (orientation: portrait) {
  .player-zone {
    place-items: center;
    padding: 4rem 0.8rem 2.25rem;
  }

  .player-card {
    margin-top: 0;
  }

  .player-layout {
    gap: 1.15rem;
  }

  .logo-frame {
    width: min(10.5rem, 46vw);
    border-radius: 1rem;
  }

  #station-title {
    font-size: clamp(1.7rem, 8vw, 2rem);
  }

  .transport {
    margin-top: 0.85rem;
  }

  .control-button {
    width: 2.55rem;
    height: 2.55rem;
  }

  .control-button.primary {
    width: 3.2rem;
    height: 3.2rem;
  }

  .sources {
    margin-top: 0.5rem;
  }
}

@media (max-width: 430px) and (min-height: 701px) {
  .player-zone {
    padding-inline: 0.8rem;
  }

  .control-button {
    width: 2.8rem;
    height: 2.8rem;
  }

  .control-button.primary {
    width: 3.55rem;
    height: 3.55rem;
  }
}

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

  .status-wave i {
    height: 55%;
    animation: none !important;
  }

  .status-icon {
    animation: none !important;
  }

  .app-status[data-kind="playing"]::after {
    background-position: center;
    animation: none !important;
  }
}
