:root {
  --bg: #171717;
  --panel: rgba(37, 37, 37, 0.9);
  --panel-strong: rgba(44, 44, 44, 0.94);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f3f1ed;
  --muted: rgba(243, 241, 237, 0.55);
  --soft: rgba(243, 241, 237, 0.25);
  --accent: #ece0ff;
  --accent-2: #a2c8ff;
  --accent-3: #ffd6a5;
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  --radius: 26px;
  --base-size: 16px;
  --display-tracking: -0.02em;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 30%),
    linear-gradient(180deg, #1b1b1b 0%, #161616 100%);
  color: var(--text);
}

body {
  font-family: "Manrope", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
  font-size: var(--base-size);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 160px 160px, 160px 160px;
  mask-image: radial-gradient(circle at center, black 55%, transparent 100%);
}

.app-shell {
  min-height: 100vh;
  padding: 30px 34px 160px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.wordmark {
  font-family: "Syne", sans-serif;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.icon-button,
.transport,
.play-toggle,
.action-pill,
.tab {
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    opacity 180ms ease;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.9rem;
  line-height: 1;
}

.icon-button .lucide,
.transport .lucide,
.play-toggle .lucide,
.search-icon .lucide,
.clear-search .lucide,
.action-pill .lucide,
.track-action-button .lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.icon-button.ghost .lucide {
  width: 20px;
  height: 20px;
}

/* Ensure SVG fallbacks and injected icons size consistently */
.lucide {
  display: inline-block;
  width: 18px;
  height: 18px;
}

.icon-glyph svg {
  width: 20px;
  height: 20px;
}

.icon-button svg,
.transport svg,
.play-toggle svg,
.search-icon svg,
.clear-search svg,
.action-pill svg,
.track-action-button svg {
  width: 18px;
  height: 18px;
}

button:focus-visible {
  outline: 3px solid rgba(162, 200, 255, 0.12);
  outline-offset: 3px;
  border-radius: 10px;
}

.icon-button:hover,
.transport:hover,
.play-toggle:hover,
.action-pill:hover,
.tab:hover {
  transform: translateY(-1px);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.96fr) minmax(420px, 1.04fr);
  gap: 34px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-panel {
  min-height: clamp(420px, 60vh, 720px);
  padding: 48px;
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: auto -10% -30% auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(236, 224, 255, 0.22), transparent 68%);
  filter: blur(12px);
}

.hero-art-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(320px, 50vh, 620px);
  max-width: 1150px;
  margin-inline: auto;
}

.cover-card {
  position: relative;
  z-index: 2;
  width: min(100%, 430px);
  aspect-ratio: 1 / 1;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.45);
  transition: transform 420ms cubic-bezier(.2,.9,.28,1), box-shadow 420ms ease;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.2), transparent 28%),
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.22), transparent 28%),
    radial-gradient(circle at 70% 16%, rgba(142, 209, 255, 0.38), transparent 22%),
    radial-gradient(circle at 44% 62%, rgba(32, 109, 255, 0.5), transparent 26%),
    linear-gradient(180deg, #95c7eb 0%, #24375b 56%, #0f1520 100%);
}

.cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.cover-card.has-image .cover-center {
  opacity: 0;
}

.cover-glow {
  position: absolute;
  inset: auto 20% -16% 20%;
  height: 120px;
  background: radial-gradient(circle, rgba(136, 182, 255, 0.35), transparent 68%);
  filter: blur(14px);
}

.cover-meta {
  position: absolute;
  inset: 20px 20px auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cover-tag,
.cover-signature {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.34);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cover-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 42px;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 0.95;
  text-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
  letter-spacing: var(--display-tracking);
}

.vinyl-hero {
  position: absolute;
  z-index: 0;
  /* keep the vinyl behind the cover and limit how far it drifts on large screens */
  right: clamp(40px, 8vw, 220px);
  width: clamp(180px, 28vw, 320px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.78) 0 7.5%, rgba(27, 27, 27, 0.92) 7.8% 10.2%, rgba(248, 234, 255, 0.8) 10.4% 12.5%, transparent 12.8%),
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.6), transparent 22%),
    linear-gradient(145deg, #f5f4f1 0%, #cad4e8 31%, #f2efea 56%, #8fa1bd 77%, #f8f8f3 100%);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.28);
  transform: translateX(clamp(0px, 4vw, 80px));
}

/* Entrance animation when hero changes */
.vinyl-entrance {
  animation: vinylPop 700ms cubic-bezier(0.2,0.9,0.28,1) both;
}

@keyframes vinylPop {
  0% { transform: translateX(40px) scale(0.86) rotate(-8deg); opacity: 0; }
  60% { transform: translateX(6px) scale(1.04) rotate(-2deg); opacity: 1; }
  100% { transform: translateX(0) scale(1) rotate(0); opacity: 1; }
}

/* Cover card pop when hero updates */
.cover-pop {
  animation: coverPop 620ms cubic-bezier(0.2,0.9,0.28,1) both;
  transform-origin: center;
}

@keyframes coverPop {
  0% { transform: translateY(8px) scale(0.985); }
  50% { transform: translateY(-6px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

.vinyl-grooves {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.16) 0 1.5px, rgba(53, 63, 82, 0.18) 1.5px 7px),
    linear-gradient(132deg, rgba(89, 236, 217, 0.22), transparent 36%, rgba(255, 219, 143, 0.22) 66%, transparent 82%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(88, 100, 120, 0.84));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.vinyl-label,
.mini-disc-label {
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(248, 238, 253, 0.92), rgba(208, 194, 241, 0.86));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.content-column {
  display: grid;
  gap: 22px;
}

.search-panel,
.details-panel {
  padding: 22px;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.searchbox {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 0 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.search-icon,
.clear-search {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
}

.searchbox input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  outline: none;
}

.searchbox input::placeholder {
  color: var(--muted);
}

.action-pill,
.tab {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.tab.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-strong);
}

.details-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.details-head h1 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 0.96;
  max-width: 10ch;
}

.track-caption {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  margin: 12px 0 0;
}

.divider-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--soft);
}

.play-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: var(--text);
  color: #151515;
  font-size: 1.55rem;
  font-weight: 800;
}

.icon-glyph {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  line-height: 1;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0;
}

.metric {
  min-height: 96px;
  padding: 18px;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-value {
  font-family:  "Syne", sans-serif;
  font-size: 1.32rem;
}

.metric-value-number {
  font-family: "Manrope", sans-serif;
  font-size: 1.32rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
}

.tracks-list {
  display: grid;
  gap: 12px;
}

.track-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 108px;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  color: var(--text);
}

.track-card:hover,
.track-card.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.track-card.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.track-art {
  position: relative;
  width: 92px;
  height: 84px;
}

.track-art-cover {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 2;
  width: 72px;
  height: 84px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.track-art-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.track-art-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.24), transparent 26%),
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.22), transparent 26%);
}

.track-art-disc {
  position: absolute;
  z-index: 1;
  right: 4px;
  top: 12px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(23, 23, 23, 0.9) 0 10%, rgba(255, 255, 255, 0.65) 10.5% 12.5%, transparent 12.8%),
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.06) 0 1px, rgba(47, 57, 74, 0.2) 1px 6px),
    linear-gradient(130deg, #f5f6fb, #8799bb 36%, #f5f5fb 50%, #90a8d9 78%, #f7f8fc);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.track-card.active .track-art-disc,
.track-card[data-playing="true"] .track-art-disc,
.mini-disc.is-spinning {
  animation: spin 8s linear infinite;
}

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

.track-title {
  margin: 0 0 6px;
  font-size: 1.08rem;
  font-weight: 700;
}

.track-artist {
  margin: 0;
  color: var(--muted);
}

.track-actions {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
}

.track-index {
  color: var(--muted);
  font-size: 0.85rem;
}

.track-action-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1rem;
}

.empty-state {
  margin: 24px 0 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

.player-dock {
  position: fixed;
  display: flex;
  right: 5%;
  bottom: 24px;
  transform: translateX(-50%);
  min-height: 96px;
  padding: 14px 18px;
  border-radius: 28px;
  gap: 24px;
  align-items: center;
  justify-content: center;
  justify-items: center;
  background: rgba(46, 46, 46, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  flex-wrap: wrap;
}

.player-left,
.player-center,
.player-actions {
  display: flex;
  align-items: center;
}

.player-left {
  gap: 14px;
  min-width: 0;
}

.mini-disc {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.07) 0 10px, rgba(18, 18, 18, 0.98) 1px 7px),
    linear-gradient(145deg, #726a6adc, #0007 56%, #939297a9);
}

.mini-disc.is-spinning {
  animation: spin 7.6s linear infinite;
  transform-origin: center;
}

.player-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.player-copy strong,
.player-copy span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.player-center {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  min-width: 0;
}

.player-progress {
  position: relative;
  min-width: 0;
}

.waveform {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 3px;
  height: 34px;
  width: 100%;
  pointer-events: none;
}

.progress-slider {
  --progress: 0%;
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  top: calc(50% - 5px);
  margin: 0;
  cursor: pointer;
  background: rgba(0, 0, 0, 0);
  z-index: 2;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 12px;
}

.waveform-bar {
  width: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  transform-origin: center;
}

.waveform {
  z-index: 1;
}

.progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
  border: 2px solid rgba(0,0,0,0.12);
  margin-top: -2px;
}

.progress-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  border: none;
}

.waveform.is-playing .waveform-bar {
  animation: pulse 1.4s ease-in-out infinite;
}

.time-readout {
  display: inline-flex;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.player-actions {
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.transport {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
}

.transport.primary {
  background: var(--text);
  color: #131313;
  font-weight: 800;
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  animation: revealUp 800ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.delay-1 {
  animation-delay: 80ms;
}

.delay-2 {
  animation-delay: 160ms;
}

.delay-3 {
  animation-delay: 240ms;
}

@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse {
  0%,
  100% {
    transform: scaleY(0.35);
    opacity: 0.3;
  }

  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    position: static;
    min-height: auto;
  }

  .hero-art-wrap {
    min-height: 500px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px 16px 170px;
  }

  .hero-panel,
  .search-panel,
  .details-panel {
    padding: 18px;
  }

  .hero-art-wrap {
    min-height: 380px;
  }

  .vinyl-hero {
    width: 56%;
    right: 8%;
    transform: translateX(5%);
  }

  .search-row,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .details-head {
    align-items: center;
  }

  .details-grid {
    gap: 10px;
  }

  .track-card {
    grid-template-columns: auto 1fr;
  }

  .track-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .player-dock {
    width: calc(100vw - 18px);
    padding: 16px;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .player-left,
  .player-center,
  .player-actions {
    justify-content: center;
  }

  .player-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .transport {
    width: 40px;
    height: 40px;
  }

  .transport.primary {
    width: 56px;
    height: 56px;
    border-radius: 14px;
  }

  .player-center {
    grid-template-columns: 1fr;
  }

  .player-copy {
    align-items: center;
    text-align: center;
  }

  .time-readout {
    justify-content: center;
  }
}

/* Fix centering for medium screens/tablets where fixed left + translate can cause clipping */
@media (max-width: 1100px) and (min-width: 521px) {
  .player-dock {
    /* use inset with margins so it's never clipped by viewport quirks */
    left: auto;
    right: 16px;
    bottom: 20px;
    transform: none;
    width: calc(100% - 32px);
    max-width: 980px;
    border-radius: 18px;
    padding: 12px 14px;
    grid-template-columns: 1fr auto;
  }

  .player-left { order: 1; }
  .player-center { order: 2; }
  .player-actions { order: 3; }

  .player-center {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  /* reduce width of transport area to avoid overlap */
  .player-actions { gap: 8px; }
  .transport { width: 40px; height: 40px; }
  .transport.primary { width: 48px; height: 48px; }
}

/* Improved small-screen layout for player-dock */
@media (max-width: 520px) {
  .player-dock {
    left: 0;
    transform: none;
    width: 100%;
    bottom: 0;
    padding: 10px 12px;
    border-radius: 12px 12px 0 0;
    grid-template-columns: 1fr auto;
    gap: 10px;
    z-index: 1100;
  }

  .player-left { order: 1; }
  .player-center { order: 2; }
  .player-actions { order: 3; justify-content: flex-end; }

  /* Simplify center: hide waveform to avoid overlap and keep slider visible */
  .player-progress { position: relative; min-width: 0; padding: 6px 0; }
  .waveform { display: none; }

  .progress-slider {
    position: relative;
    height: 8px;
    top: auto;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--progress), rgba(255,255,255,0.12) var(--progress), rgba(255,255,255,0.04) 100%);
    opacity: 1;
    border-radius: 999px;
  }

  .time-readout { display: none; }

  .transport { width: 40px; height: 40px; }
  .transport.primary { width: 48px; height: 48px; }
}
