:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-soft: #eef4f8;
  --panel: rgba(255, 255, 255, 0.68);
  --panel-strong: rgba(255, 255, 255, 0.84);
  --stroke: rgba(34, 44, 58, 0.13);
  --stroke-strong: rgba(34, 44, 58, 0.2);
  --text: #151922;
  --muted: #526171;
  --quiet: #738092;
  --accent: #d9362b;
  --accent-strong: #b9271e;
  --teal: #097f7a;
  --blue: #315f9a;
  --amber: #a66b00;
  --surface: #ffffff;
  --radius: 8px;
  --shadow: 0 18px 55px rgba(38, 51, 68, 0.13);
  --shadow-soft: 0 10px 28px rgba(38, 51, 68, 0.09);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background:
    linear-gradient(130deg, rgba(217, 54, 43, 0.1), transparent 34%),
    linear-gradient(280deg, rgba(9, 127, 122, 0.09), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, var(--bg-soft) 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(rgba(34, 44, 58, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 44, 58, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.08));
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
select,
input {
  outline-offset: 3px;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
}

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.glass-panel {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(135%);
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 244px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(217, 54, 43, 0.28);
  border-radius: var(--radius);
  background: rgba(217, 54, 43, 0.1);
  color: var(--accent-strong);
  font-weight: 900;
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  font-size: 1rem;
  font-weight: 850;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.83rem;
}

.nav-links {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(34, 44, 58, 0.11);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.nav-links a:hover {
  border-color: rgba(34, 44, 58, 0.2);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  transform: translateY(-1px);
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(360px, 0.97fr);
  gap: 20px;
  align-items: stretch;
  min-height: 455px;
  padding: 36px 0 14px;
}

.landing-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  animation: fade-up 520ms ease both;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  max-width: 17ch;
  margin: 0;
  color: var(--text);
  font-size: 3.25rem;
  line-height: 0.98;
}

.hero-lede {
  max-width: 62ch;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.primary-link,
.secondary-link,
.listen-link,
.song-link,
.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.primary-link,
.refresh-button {
  background: var(--text);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.secondary-link,
.listen-link,
.song-link {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.primary-link,
.secondary-link {
  min-width: 142px;
  padding: 0 18px;
}

.primary-link:hover,
.secondary-link:hover,
.listen-link:hover,
.song-link:hover,
.refresh-button:hover {
  transform: translateY(-2px);
}

.primary-link:active,
.secondary-link:active,
.listen-link:active,
.song-link:active,
.refresh-button:active {
  transform: translateY(0);
}

.signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.signal-row span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(34, 44, 58, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 780;
  backdrop-filter: blur(14px);
}

.hero-stage {
  display: grid;
  align-content: space-between;
  min-height: 420px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.52)),
    var(--panel);
  box-shadow: var(--shadow);
  animation: fade-up 520ms ease 120ms both;
}

.hero-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(34, 44, 58, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.pulse-dot {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  animation: breathe 1.8s ease-in-out infinite;
}

.motion-bars {
  display: inline-flex;
  align-items: end;
  gap: 4px;
  width: 44px;
  height: 28px;
}

.motion-bars span {
  width: 7px;
  border-radius: 999px;
  background: var(--teal);
  animation: lift 1s ease-in-out infinite;
}

.motion-bars span:nth-child(1) {
  height: 12px;
}

.motion-bars span:nth-child(2) {
  height: 24px;
  animation-delay: 0.12s;
  background: var(--accent);
}

.motion-bars span:nth-child(3) {
  height: 17px;
  animation-delay: 0.24s;
  background: var(--amber);
}

.motion-bars span:nth-child(4) {
  height: 21px;
  animation-delay: 0.36s;
  background: var(--blue);
}

.hero-track {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  gap: 22px;
  align-items: end;
  margin-top: 24px;
}

.cover-frame {
  position: relative;
  width: min(100%, 260px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(217, 54, 43, 0.1), rgba(9, 127, 122, 0.1)),
    rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  animation: cover-lift 4.8s ease-in-out infinite;
}

.cover-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 220ms ease;
}

.cover-frame img.has-art {
  opacity: 1;
}

.cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(21, 25, 34, 0.2);
  font-size: 4rem;
  font-weight: 900;
}

.cover-frame img.has-art + .cover-fallback {
  display: none;
}

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

.now-copy h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.06;
}

.now-artists {
  max-width: 46ch;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.listen-link {
  min-width: 132px;
  margin-top: 20px;
  padding: 0 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 16px;
  animation: fade-up 500ms ease both;
}

.metric-card:nth-child(2) {
  animation-delay: 60ms;
}

.metric-card:nth-child(3) {
  animation-delay: 120ms;
}

.metric-card:nth-child(4) {
  animation-delay: 180ms;
}

.metric-card span,
.field span,
.stats-grid dt {
  color: var(--quiet);
  font-size: 0.76rem;
  font-weight: 820;
  text-transform: uppercase;
}

.metric-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-panel,
.list-shell {
  margin-top: 16px;
  padding: 18px;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 1.7rem;
}

.result-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.toolbar {
  display: grid;
  grid-template-columns: 160px minmax(220px, 1fr) 128px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(34, 44, 58, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}

.field {
  display: grid;
  gap: 6px;
}

select,
input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
}

select {
  padding: 0 34px 0 12px;
}

input {
  padding: 0 12px;
}

input::placeholder {
  color: #8591a0;
}

.refresh-button {
  gap: 8px;
  min-width: 120px;
  padding: 0 14px;
}

.refresh-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.refresh-icon {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.is-loading .refresh-icon {
  animation: spin 0.8s linear infinite;
}

.song-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.song-card {
  display: grid;
  grid-template-columns: 48px 64px minmax(0, 1fr) minmax(80px, 120px) 96px;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 10px;
  border: 1px solid rgba(34, 44, 58, 0.11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  animation: rise 360ms ease both;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.song-card:hover {
  border-color: rgba(34, 44, 58, 0.22);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.rank {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(166, 107, 0, 0.24);
  border-radius: var(--radius);
  background: rgba(166, 107, 0, 0.08);
  color: var(--amber);
  font-weight: 900;
}

.song-cover {
  width: 64px;
  height: 64px;
  border: 1px solid rgba(34, 44, 58, 0.13);
  border-radius: var(--radius);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.7);
}

.song-meta {
  min-width: 0;
}

.song-meta h3 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-meta p {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.views {
  overflow: hidden;
  color: var(--quiet);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-link {
  min-width: 88px;
  min-height: 38px;
  padding: 0 12px;
}

.empty-state {
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

.docs-shell {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.docs-hero {
  padding: 24px;
}

.docs-hero h1 {
  max-width: 15ch;
  font-size: 3.1rem;
}

.docs-hero p {
  max-width: 72ch;
  color: var(--muted);
  line-height: 1.7;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.endpoint-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(34, 44, 58, 0.11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.endpoint-card:hover {
  border-color: rgba(34, 44, 58, 0.22);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.endpoint-card h2 {
  margin: 0;
  font-size: 1.08rem;
}

.endpoint-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.endpoint-card code,
.docs-code {
  display: block;
  overflow-x: auto;
  padding: 10px;
  border: 1px solid rgba(34, 44, 58, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.84rem;
  white-space: nowrap;
}

.docs-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

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

@keyframes lift {
  0%,
  100% {
    transform: scaleY(0.55);
  }
  50% {
    transform: scaleY(1);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.58;
    transform: scale(0.86);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cover-lift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@media (max-width: 980px) {
  .landing-hero,
  .hero-track,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    min-height: 0;
    padding-top: 34px;
  }

  .hero-stage {
    min-height: 0;
  }

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

  .cover-frame {
    width: 220px;
  }

  h1 {
    max-width: 14ch;
    font-size: 3rem;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .topbar {
    position: static;
    display: grid;
  }

  .brand {
    min-width: 0;
  }

  .nav-links {
    margin-left: 0;
  }

  .landing-hero {
    gap: 12px;
    padding-top: 20px;
  }

  .hero-stage,
  .live-panel,
  .list-shell {
    padding: 12px;
  }

  .hero-stage {
    min-height: 0;
  }

  .hero-stage-header,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .hero-track,
  .toolbar,
  .endpoint-grid {
    grid-template-columns: 1fr;
  }

  .refresh-button {
    width: 100%;
  }

  h1 {
    max-width: 15ch;
    font-size: 2.2rem;
  }

  .now-copy h2 {
    font-size: 1.25rem;
  }

  .hero-lede {
    margin-top: 14px;
    font-size: 0.96rem;
    line-height: 1.55;
  }

  .hero-actions {
    margin-top: 18px;
  }

  .signal-row {
    margin-top: 14px;
  }

  .hero-track {
    gap: 10px;
    margin-top: 14px;
  }

  .cover-frame {
    display: none;
  }

  .now-artists {
    margin-top: 8px;
    line-height: 1.45;
  }

  .listen-link {
    min-height: 38px;
    margin-top: 12px;
  }

  .song-card {
    grid-template-columns: 38px 54px minmax(0, 1fr);
    min-height: 78px;
  }

  .song-cover {
    width: 54px;
    height: 54px;
  }

  .views {
    display: none;
  }

  .song-link {
    grid-column: 3;
    justify-self: start;
    min-height: 34px;
    margin-top: -4px;
  }
}

@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;
  }
}
