:root {
  --player-height: 200px;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
}

html { scroll-padding-top: 80px; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--player-height) + env(safe-area-inset-bottom));
  background:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--bs-primary) 10%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, #ec4899 10%, transparent), transparent 60%),
    var(--bs-body-bg);
  background-attachment: fixed;
}

.site-header {
  background: color-mix(in srgb, var(--bs-body-bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  z-index: 1020;
}

.site-title {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.search .form-control,
.search .input-group-text {
  border-radius: 999px;
}
.search .input-group-text {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.search .form-control {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.search { width: 220px; max-width: 42vw; }

.track-list { border: 1px solid var(--bs-border-color); }

.track {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--bs-border-color);
  background: transparent;
  color: inherit;
  width: 100%;
  transition: background-color 0.15s;
  position: relative;
}
.track:last-child { border-bottom: none; }
.track:hover { background: var(--bs-tertiary-bg); }
.track:focus-visible {
  outline: none;
  background: var(--bs-tertiary-bg);
  box-shadow: inset 0 0 0 2px var(--bs-primary);
  z-index: 1;
}
.track.active {
  background: color-mix(in srgb, var(--bs-primary) 10%, transparent);
}
.track.active .track-title {
  color: var(--bs-primary);
  font-weight: 600;
}
.track.active .track-index i { color: var(--bs-primary); }

.track-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  color: var(--bs-secondary-color);
  font-weight: 500;
}
.track-index .playing-indicator { display: none; }
.track.active .track-index .number { display: none; }
.track.active .track-index .playing-indicator {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
}
.track.active .track-index .playing-indicator span {
  display: block;
  width: 3px;
  background: var(--bs-primary);
  border-radius: 1px;
  animation: bars 1s ease-in-out infinite;
}
.track.active .track-index .playing-indicator span:nth-child(1) { animation-delay: -0.4s; }
.track.active .track-index .playing-indicator span:nth-child(2) { animation-delay: -0.2s; }
.track.active .track-index .playing-indicator span:nth-child(3) { animation-delay: 0s; }
#player[data-state="playing"] .track.active .track-index .playing-indicator span {
  animation-play-state: running;
}
#player:not([data-state="playing"]) .track.active .track-index .playing-indicator span {
  animation-play-state: paused;
  height: 40%;
}
@keyframes bars {
  0%, 100% { height: 25%; }
  50%      { height: 100%; }
}

.track-body { min-width: 0; }
.track-title, .track-subtitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.track-title { font-size: 0.95rem; font-weight: 500; }
.track-subtitle { font-size: 0.8125rem; color: var(--bs-secondary-color); margin-top: 2px; }
.track-duration {
  color: var(--bs-secondary-color);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.track-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: transparent;
  pointer-events: none;
}
.track-progress > span {
  display: block;
  height: 100%;
  background: var(--bs-primary);
  width: var(--pct, 0%);
  opacity: 0.7;
}
.track:not([data-progress]) .track-progress { display: none; }

.empty-state code {
  background: var(--bs-tertiary-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.player {
  z-index: 1030;
  background: color-mix(in srgb, var(--bs-body-bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(20px);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
}

[data-bs-theme="dark"] .player {
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.play-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  background: var(--accent-gradient);
  border: none;
  box-shadow: 0 6px 16px color-mix(in srgb, #6366f1 35%, transparent);
  transition: transform 0.12s, box-shadow 0.15s;
}
.play-btn:hover,
.play-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px color-mix(in srgb, #6366f1 45%, transparent);
  background: var(--accent-gradient);
}
.play-btn:active { transform: translateY(0); }
.play-btn i { color: #fff; }

.skip-btn { position: relative; }
.skip-btn .skip-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -46%);
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--bs-body-color);
  pointer-events: none;
}

.seek {
  --pct: 0%;
  appearance: none;
  background: transparent;
  height: 1.25rem;
  cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--bs-primary) 0 var(--pct),
    var(--bs-tertiary-bg) var(--pct) 100%
  );
}
.seek::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: var(--bs-tertiary-bg);
}
.seek::-moz-range-progress {
  height: 4px;
  border-radius: 4px;
  background: var(--bs-primary);
}
.seek::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bs-primary);
  margin-top: -5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.12s;
}
.seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--bs-primary);
}
.seek:hover::-webkit-slider-thumb { transform: scale(1.25); }
.seek:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--bs-primary) 30%, transparent);
}

@media (max-width: 576px) {
  .site-title { font-size: 1.2rem; }
  .search { width: 150px; }
  :root { --player-height: 220px; }
  .play-btn { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
