:root {
  color-scheme: light;
  --bt-ink: #172033;
  --bt-muted: #5e697d;
  --bt-soft: #f7fbff;
  --bt-sky: #dff4ff;
  --bt-coral: #ff6f61;
  --bt-teal: #069aa8;
  --bt-blue: #1967d2;
  --bt-yellow: #ffd166;
  --bt-lavender: #eee7ff;
  --bt-line: rgba(23, 32, 51, 0.14);
  --bt-panel: #ffffff;
  --bt-shadow: 0 22px 70px rgba(23, 32, 51, 0.16);
  --bt-radius: 12px;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--bt-ink);
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 209, 102, 0.42), transparent 24rem),
    radial-gradient(circle at 88% 8%, rgba(6, 154, 168, 0.2), transparent 25rem),
    radial-gradient(circle at 78% 92%, rgba(238, 231, 255, 0.95), transparent 30rem),
    linear-gradient(145deg, #fffafd 0%, #f2fbff 52%, #fffdf2 100%);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) 0;
}

.player-card {
  display: grid;
  grid-template-columns: minmax(310px, 0.92fr) minmax(470px, 1.08fr);
  min-height: 720px;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 51, 0.12);
  border-radius: 28px;
  background: var(--bt-panel);
  box-shadow: var(--bt-shadow);
}

.brand-panel {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: clamp(18px, 3vw, 34px);
  overflow: hidden;
  padding: clamp(38px, 6vw, 70px) clamp(26px, 4vw, 46px);
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 209, 102, 0.24) 0 5px, transparent 6px),
    radial-gradient(circle at 82% 13%, rgba(86, 213, 225, 0.22) 0 9px, transparent 10px),
    radial-gradient(circle at 76% 82%, rgba(255, 111, 97, 0.2) 0 16px, transparent 17px),
    linear-gradient(155deg, #101b3b 0%, #113f78 54%, #087b8a 100%);
}

.brand-panel::before,
.brand-panel::after {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 50%;
  content: "";
}

.brand-panel::before { top: 9%; right: -48px; width: 160px; height: 160px; }
.brand-panel::after { bottom: 16%; left: -34px; width: 92px; height: 92px; }

.brand-mark {
  position: relative;
  z-index: 1;
  display: block;
  width: min(94%, 410px);
  height: auto;
  filter: drop-shadow(0 20px 28px rgba(4, 13, 35, 0.3));
}

.brand-copy {
  position: relative;
  z-index: 1;
  width: min(100%, 390px);
  color: #ffffff;
}

.brand-title {
  margin: 0;
  font-size: clamp(2.8rem, 5.4vw, 4.65rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.06em;
  text-shadow: 0 4px 22px rgba(4, 13, 35, 0.28);
}

.brand-title span { color: var(--bt-yellow); }

.brand-credit {
  max-width: 340px;
  margin: 17px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.77rem;
  line-height: 1.55;
}

.brand-credit a { color: #ffffff; font-weight: 900; text-underline-offset: 3px; }
.brand-credit a:hover { color: var(--bt-yellow); }

.player-panel {
  min-width: 0;
  padding: clamp(28px, 4.6vw, 50px);
  background:
    radial-gradient(circle at 95% 0, rgba(223, 244, 255, 0.82), transparent 17rem),
    #ffffff;
}

.player-header,
.mini-brand,
.collection-heading,
.now-playing,
.controls,
.playlist-heading,
.track,
.track-main,
.sync-note {
  display: flex;
  align-items: center;
}

.player-header { justify-content: space-between; gap: 18px; }

.mini-brand { min-width: 0; gap: 11px; }

.mini-brand img {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: contain;
  background: transparent;
}

.mini-brand div { display: grid; min-width: 0; }
.mini-brand strong { overflow: hidden; font-size: 0.83rem; text-overflow: ellipsis; white-space: nowrap; }
.mini-brand span { color: var(--bt-muted); font-size: 0.65rem; }

.bubble-button {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(6, 154, 168, 0.25);
  border-radius: 50%;
  background: rgba(223, 244, 255, 0.7);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.bubble-button:hover { transform: scale(1.06); background: var(--bt-sky); }

.bubble-button span {
  position: absolute;
  border: 1.5px solid var(--bt-teal);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

.bubble-button span:nth-child(1) { left: 9px; bottom: 8px; width: 15px; height: 15px; }
.bubble-button span:nth-child(2) { right: 8px; top: 8px; width: 11px; height: 11px; }
.bubble-button span:nth-child(3) { left: 10px; top: 7px; width: 7px; height: 7px; }

.collection-heading {
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 34px;
}

.collection-heading > div { min-width: 0; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--bt-teal);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 900;
  line-height: 0.97;
  letter-spacing: -0.055em;
}

.track-count {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--bt-line);
  border-radius: 999px;
  color: var(--bt-muted);
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.68rem;
}

.now-playing {
  justify-content: space-between;
  gap: 18px;
  margin-top: 34px;
}

.now-copy { min-width: 0; }

.now-copy p {
  margin: 0 0 4px;
  color: var(--bt-muted);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.now-copy h2 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(1.18rem, 2.4vw, 1.55rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-download,
.track-download {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--bt-ink);
  text-decoration: none;
}

.current-download {
  width: 40px;
  height: 40px;
  border: 1px solid var(--bt-line);
  border-radius: 50%;
  background: #ffffff;
}

.current-download:hover { color: var(--bt-blue); border-color: var(--bt-blue); }
.current-download svg, .track-download svg { width: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.timeline { margin-top: 24px; }

input[type="range"] {
  --value: 0%;
  width: 100%;
  height: 5px;
  margin: 0;
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background: linear-gradient(to right, var(--bt-coral) var(--value), rgba(23, 32, 51, 0.12) var(--value));
}

input[type="range"]:disabled { cursor: default; opacity: 0.48; }

input[type="range"]::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  appearance: none;
  background: var(--bt-coral);
  box-shadow: 0 0 0 1px var(--bt-coral);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--bt-coral);
  box-shadow: 0 0 0 1px var(--bt-coral);
}

.time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--bt-muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.controls { gap: 14px; margin-top: 7px; }

.icon-button,
.play-button {
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 7px;
  background: transparent;
  color: var(--bt-muted);
}

.icon-button:hover { color: var(--bt-blue); }
.icon-button:disabled, .play-button:disabled { cursor: default; opacity: 0.38; }
.icon-button svg { width: 22px; fill: none; stroke: currentColor; stroke-linejoin: round; stroke-width: 1.7; }

.play-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bt-coral);
  color: #ffffff;
  box-shadow: 0 9px 22px rgba(255, 111, 97, 0.25);
  transition: transform 160ms ease, background 160ms ease;
}

.play-button:hover:not(:disabled) { transform: scale(1.04); background: #f45f52; }
.play-button svg { width: 26px; fill: currentColor; }
.pause-icon, .is-playing .play-icon { display: none; }
.is-playing .pause-icon { display: block; }

.volume { display: flex; align-items: center; gap: 9px; margin-left: auto; color: var(--bt-muted); }
.volume svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.volume input { width: 76px; }

.playlist-heading {
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 32px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--bt-line);
}

.playlist-heading h2 { margin: 0; font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase; }
.playlist-heading p { margin: 3px 0 0; color: var(--bt-muted); font-size: 0.67rem; }

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--bt-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--bt-muted);
  font-size: 0.67rem;
  font-weight: 800;
  cursor: pointer;
}

.refresh-button:hover { color: var(--bt-blue); border-color: var(--bt-blue); }
.refresh-button.is-syncing svg { animation: spin 700ms linear infinite; }
.refresh-button svg { width: 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.music-library { margin-top: 4px; }

.library-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 0 7px;
}

.library-section-heading h3,
.collections-heading h3 {
  margin: 0;
  font-size: 0.94rem;
  letter-spacing: -0.02em;
}

.library-section-heading p,
.collections-heading > p:last-child {
  margin: 3px 0 0;
  color: var(--bt-muted);
  font-size: 0.67rem;
  line-height: 1.45;
}

.library-section-heading > span {
  flex: 0 0 auto;
  color: var(--bt-muted);
  font-size: 0.65rem;
}

.main-empty {
  margin: 0;
  padding: 17px 12px;
  border-top: 1px solid var(--bt-line);
  color: var(--bt-muted);
  font-size: 0.7rem;
  text-align: center;
}

.client-collections { margin-top: 27px; }
.collections-heading { margin-bottom: 11px; }
.collections-heading .eyebrow { margin-bottom: 5px; }
.collection-list { display: grid; gap: 9px; }

.collection-details {
  overflow: hidden;
  border: 1px solid var(--bt-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.78);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.collection-details:hover,
.collection-details[open] {
  border-color: rgba(6, 154, 168, 0.34);
  box-shadow: 0 8px 22px rgba(23, 32, 51, 0.05);
}

.collection-details summary {
  display: flex;
  min-height: 61px;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  cursor: pointer;
  list-style: none;
}

.collection-details summary::-webkit-details-marker { display: none; }
.collection-details summary:focus-visible { outline: 2px solid var(--bt-blue); outline-offset: -3px; }

.collection-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.collection-copy strong { overflow: hidden; font-size: 0.79rem; text-overflow: ellipsis; white-space: nowrap; }
.collection-copy small { overflow: hidden; color: var(--bt-muted); font-size: 0.64rem; text-overflow: ellipsis; white-space: nowrap; }

.collection-count {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--bt-sky);
  color: var(--bt-teal);
  font-size: 0.62rem;
  font-weight: 800;
}

.collection-play {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bt-coral);
  color: #ffffff;
  box-shadow: 0 5px 12px rgba(255, 111, 97, 0.22);
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.collection-play:hover { transform: scale(1.06); background: #f45f52; }
.collection-play svg { width: 16px; fill: currentColor; }

.collection-chevron {
  width: 22px;
  flex: 0 0 auto;
  color: var(--bt-blue);
  font-size: 1.25rem;
  line-height: 1;
  text-align: center;
  transition: transform 160ms ease;
}

.collection-details[open] .collection-chevron { transform: rotate(45deg); }
.collection-playlist { border-top: 1px solid var(--bt-line); }
.collection-playlist .track:last-child { border-bottom: 0; }

.playlist { max-height: 250px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.playlist.collection-playlist { max-height: none; overflow: visible; }
.playlist:empty { display: none; }

.track {
  min-height: 54px;
  gap: 10px;
  border-bottom: 1px solid var(--bt-line);
  transition: background 150ms ease;
}

.track:hover { background: var(--bt-soft); }
.track.active { color: var(--bt-blue); background: rgba(223, 244, 255, 0.45); }

.track-index {
  width: 20px;
  flex: 0 0 auto;
  color: var(--bt-muted);
  font-size: 0.66rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.track.active .track-index { color: var(--bt-coral); font-size: 1rem; }

.track-main {
  min-width: 0;
  flex: 1;
  align-self: stretch;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.track-title { min-width: 0; overflow: hidden; font-size: 0.79rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.track-meta { margin-left: auto; color: var(--bt-muted); font-size: 0.65rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.track-download { width: 31px; height: 31px; color: var(--bt-muted); }
.track-download:hover { color: var(--bt-coral); }

.empty-state {
  padding: 30px 20px 22px;
  text-align: center;
}

.has-tracks .empty-state { display: none; }
.empty-state h2 { margin: 12px 0 5px; font-size: 1.05rem; }
.empty-state p { max-width: 390px; margin: 0 auto; color: var(--bt-muted); font-size: 0.76rem; line-height: 1.55; }
.empty-state code { padding: 2px 5px; border-radius: 4px; background: var(--bt-sky); color: var(--bt-blue); }

.empty-bubbles { position: relative; width: 80px; height: 38px; margin: 0 auto; }
.empty-bubbles i { position: absolute; border: 2px solid rgba(6, 154, 168, 0.45); border-radius: 50%; background: rgba(223, 244, 255, 0.55); }
.empty-bubbles i:nth-child(1) { left: 6px; bottom: 0; width: 28px; height: 28px; }
.empty-bubbles i:nth-child(2) { left: 33px; top: 0; width: 20px; height: 20px; }
.empty-bubbles i:nth-child(3) { right: 4px; bottom: 3px; width: 15px; height: 15px; }

.sync-note { justify-content: center; gap: 6px; margin: 13px 0 0; color: var(--bt-muted); font-size: 0.63rem; }
.sync-note > span { width: 6px; height: 6px; border-radius: 50%; background: var(--bt-teal); box-shadow: 0 0 0 4px rgba(6, 154, 168, 0.1); }

.bubble-hint {
  position: fixed;
  top: 21px;
  right: clamp(82px, 8vw, 132px);
  z-index: 40;
  width: 230px;
  height: 70px;
  pointer-events: none;
  color: var(--bt-ink);
  transform: rotate(4deg);
  animation: hint-linger 10s ease forwards;
}

.bubble-hint span {
  position: absolute;
  right: 0;
  top: 0;
  font-family: "Comic Sans MS", "Segoe Print", cursive;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.bubble-hint i {
  position: absolute;
  right: 12px;
  top: 26px;
  width: 78px;
  height: 32px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  border-radius: 0 0 100% 0;
  transform: rotate(-14deg);
}

.bubble-hint i::after {
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  content: "";
  transform: rotate(18deg);
}

.bubble-wave {
  position: fixed;
  inset: 0;
  z-index: var(--bubble-wave-z, 100);
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(247, 252, 255, var(--bubble-wave-tint, 0.24)) 0%, rgba(255, 255, 255, 0) 42%);
  animation: wave-fade 900ms ease var(--bubble-wave-fade-delay, 7s) forwards;
}

.bubble-wave__item {
  position: absolute;
  left: var(--bubble-left);
  bottom: -24vh;
  width: var(--bubble-size);
  height: var(--bubble-size);
  animation: bubble-rise var(--bubble-duration) linear var(--bubble-delay) forwards;
}

.bubble-wave__orb {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.94) 0 8%, transparent 9%),
    radial-gradient(circle at 68% 72%, rgba(255, 209, 102, 0.2), transparent 34%),
    radial-gradient(circle at 32% 74%, rgba(255, 111, 97, 0.18), transparent 36%),
    rgba(223, 244, 255, 0.25);
  box-shadow: inset -8px -10px 18px rgba(25, 103, 210, 0.14), inset 8px 10px 18px rgba(255, 255, 255, 0.58), 0 12px 34px rgba(6, 154, 168, 0.15);
  opacity: 0;
  transform: scale(0.72);
  animation: bubble-pop var(--bubble-duration) ease var(--bubble-delay) forwards;
}

.bubble-wave__item.cluster .bubble-wave__orb:nth-child(2) { left: 54%; top: 18%; width: 72%; height: 72%; }
.bubble-wave__item.cluster .bubble-wave__orb:nth-child(3) { left: 16%; top: 60%; width: 56%; height: 56%; }
.bubble-wave__item.cluster .bubble-wave__orb:nth-child(4) { left: 78%; top: 66%; width: 42%; height: 42%; }

@keyframes bubble-rise {
  0% { transform: translate3d(0, 0, 0) rotate(var(--bubble-rotate-a, -5deg)); }
  18% { transform: translate3d(var(--bubble-drift-a), -25vh, 0) rotate(5deg); }
  36% { transform: translate3d(var(--bubble-drift-b), -50vh, 0) rotate(var(--bubble-rotate-b, -8deg)); }
  54% { transform: translate3d(var(--bubble-drift-c), -76vh, 0) rotate(-4deg); }
  72% { transform: translate3d(var(--bubble-drift-d), -102vh, 0) rotate(8deg); }
  100% { transform: translate3d(var(--bubble-drift-e), -142vh, 0) rotate(var(--bubble-rotate-c, -8deg)); }
}

@keyframes bubble-pop {
  0% { opacity: 0; transform: scale(0.72); }
  14% { opacity: 0.94; transform: scale(1); }
  74% { opacity: 0.84; }
  100% { opacity: 0; transform: scale(1.08); }
}

@keyframes wave-fade { to { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes hint-linger {
  0% { opacity: 0; transform: translateY(-4px) rotate(4deg); }
  10%, 78% { opacity: 0.82; transform: translateY(0) rotate(4deg); }
  100% { opacity: 0; transform: translateY(-4px) rotate(4deg); }
}

:focus-visible { outline: 3px solid rgba(255, 111, 97, 0.56); outline-offset: 3px; }

@media (max-width: 790px) {
  .page-shell { width: min(100% - 20px, 580px); padding: 10px 0 28px; }
  .player-card { grid-template-columns: minmax(0, 1fr); border-radius: 22px; }
  .brand-panel { min-height: 410px; padding: 32px 24px 38px; }
  .brand-mark { width: min(72%, 285px); }
  .brand-copy { width: min(100%, 400px); text-align: center; }
  .brand-title { font-size: clamp(2.8rem, 13vw, 4rem); }
  .brand-credit { max-width: 360px; margin-right: auto; margin-left: auto; }
  .player-panel { padding: 28px 22px 31px; }
  .collection-heading { align-items: flex-start; }
  .track-count { margin-top: 3px; }
  .bubble-hint { top: 18px; right: 36px; transform: rotate(4deg) scale(0.88); transform-origin: right top; }
}

@media (max-width: 440px) {
  .mini-brand span, .collection-heading .track-count { display: none; }
  .collection-heading { margin-top: 29px; }
  h1 { font-size: clamp(1.95rem, 10vw, 2.65rem); }
  .volume input { width: 52px; }
  .controls { gap: 9px; }
  .playlist-heading p { display: none; }
  .track { gap: 7px; }
  .track-meta { font-size: 0.61rem; }
  .bubble-hint { right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
  .bubble-wave, .bubble-hint { display: none; }
}
