:root {
  --bg: #0b0d11;
  --bg-raise: #12161d;
  --bg-card: #161b24;
  --bg-card-hi: #1d2430;
  --line: #242c39;
  --line-hi: #33405270;
  --text: #e7ecf3;
  --text-dim: #8b98ac;
  --text-faint: #5d6a7d;
  --accent: #5eead4;
  --accent-dim: #2dd4bf33;
  --ref: #a78bfa;
  --ref-dim: #a78bfa26;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Class selectors below would otherwise outrank the UA's [hidden] rule. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 420px at 15% -10%, #16303022, transparent 70%),
    radial-gradient(700px 400px at 90% 0%, #2a1f4022, transparent 70%);
}

main, .topbar { max-width: 940px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */

.topbar { padding-top: 34px; padding-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 11px; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
h1 { font-size: 19px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.subtitle { margin: 9px 0 0 20px; color: var(--text-dim); font-size: 14px; line-height: 1.5; max-width: 62ch; }

/* ---------- song bar ---------- */

.songbar { margin-bottom: 22px; }
.songbar-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.eyebrow {
  font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600;
}
.hint { font-size: 11px; color: var(--text-faint); }

.song-list { display: flex; flex-wrap: wrap; gap: 7px; }
.song-list button {
  font: inherit; font-size: 13px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--text-dim);
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
}
.song-list button:hover { background: var(--bg-card-hi); color: var(--text); }
.song-list button[aria-selected="true"] {
  background: var(--accent); border-color: var(--accent);
  color: #06231f; font-weight: 600;
}
.song-list button.loading { opacity: .55; }

/* ---------- transport ---------- */

.transport {
  display: flex; align-items: center; gap: 18px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 26px;
}

.play {
  flex: none;
  width: 50px; height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #06231f;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .1s, box-shadow .18s, opacity .15s;
  box-shadow: 0 0 0 0 var(--accent-dim);
}
.play:hover:not(:disabled) { box-shadow: 0 0 0 7px var(--accent-dim); }
.play:active:not(:disabled) { transform: scale(.94); }
.play:disabled { opacity: .3; cursor: default; }
.play svg { width: 24px; height: 24px; fill: currentColor; }
.play .ico-pause { display: none; }
body.playing .play .ico-play { display: none; }
body.playing .play .ico-pause { display: block; }

.scrub { flex: 1 1 auto; min-width: 0; }
.track {
  position: relative;
  height: 6px;
  background: #222a37;
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
}
.track::before { content: ""; position: absolute; inset: -9px 0; }
.track-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, #2dd4bf, var(--accent));
  border-radius: 999px;
}
.track-head {
  position: absolute; top: 50%; left: 0;
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0; transition: opacity .13s;
  pointer-events: none;
}
.track:hover .track-head, .track:focus-visible .track-head, body.playing .track-head { opacity: 1; }
.track:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }

.scrub-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 9px; font-size: 11.5px; color: var(--text-faint);
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.loop-badge { display: inline-flex; align-items: center; gap: 5px; letter-spacing: .04em; }
.loop-badge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.vol { flex: none; display: flex; align-items: center; gap: 9px; color: var(--text-faint); }
.vol svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.vol input {
  -webkit-appearance: none; appearance: none;
  width: 84px; height: 4px; border-radius: 999px;
  background: #222a37; cursor: pointer;
}
.vol input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--text-dim); cursor: pointer;
}
.vol input::-moz-range-thumb {
  width: 12px; height: 12px; border: none;
  border-radius: 50%; background: var(--text-dim); cursor: pointer;
}

/* ---------- variant cards ---------- */

.pick-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.pick-head-models { margin-top: 22px; }

.model-slots { display: grid; gap: 8px; }

.card {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 15px 17px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.card:hover { background: var(--bg-card-hi); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card .key {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: #1e2634;
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px;
  color: var(--text-faint);
}
.card .label { flex: 1 1 auto; font-size: 15px; font-weight: 500; }
.card .live {
  flex: none;
  display: flex; align-items: flex-end; gap: 2px;
  height: 15px; width: 17px;
  opacity: 0; transition: opacity .15s;
}
.card .live i { display: block; width: 3px; border-radius: 1px; background: currentColor; height: 4px; }
.card[aria-pressed="true"] .live { opacity: 1; }
body.playing .card[aria-pressed="true"] .live i { animation: bob .62s ease-in-out infinite alternate; }
.card .live i:nth-child(2) { animation-delay: .2s !important; }
.card .live i:nth-child(3) { animation-delay: .4s !important; }
@keyframes bob { from { height: 4px; } to { height: 15px; } }
@media (prefers-reduced-motion: reduce) {
  body.playing .card[aria-pressed="true"] .live i { animation: none; height: 10px; }
}

.card[aria-pressed="true"] {
  border-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-dim), transparent 55%), var(--bg-card-hi);
  color: var(--text);
}
.card[aria-pressed="true"] .key { background: var(--accent); border-color: var(--accent); color: #06231f; font-weight: 700; }
.card[aria-pressed="true"] .live { color: var(--accent); }

.card.reference { border-color: #2e2a45; background: linear-gradient(90deg, var(--ref-dim), transparent 45%), var(--bg-card); }
.card.reference .label { color: #d9d2ff; }
.card.reference[aria-pressed="true"] {
  border-color: var(--ref);
  background: linear-gradient(90deg, #a78bfa30, transparent 55%), var(--bg-card-hi);
}
.card.reference[aria-pressed="true"] .key { background: var(--ref); border-color: var(--ref); color: #1c1233; }
.card.reference[aria-pressed="true"] .live { color: var(--ref); }

/* ---------- footer ---------- */

.foot {
  margin: 34px 0 60px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 14px 22px;
  align-items: center; justify-content: space-between;
}
.keys { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 11.5px; color: var(--text-faint); }
kbd {
  font-family: var(--mono); font-size: 10.5px;
  padding: 2px 5px; margin-right: 3px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-raise);
  color: var(--text-dim);
}
.song-meta { font-size: 11px; color: var(--text-faint); }

/* ---------- splash / loading ---------- */

.splash {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .3s;
}
.splash[hidden] { display: none; }
.splash.fading { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; width: min(320px, 78vw); }
.splash-inner p { color: var(--text-dim); font-size: 13.5px; margin: 18px 0 14px; line-height: 1.5; }
.splash-inner p.error { color: #fca5a5; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.splash.errored .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.bar { height: 3px; background: #1c2430; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.splash.errored .bar { display: none; }

/* inline loading bar reused inside the transport */
.transport.busy .play { opacity: .3; }

@media (max-width: 620px) {
  .transport { flex-wrap: wrap; }
  .vol { order: 3; width: 100%; }
  .vol input { flex: 1; width: auto; }
  .subtitle { margin-left: 0; }
}
