/* ================= Melos =================
   Three-color identity: hot pink, electric cyan, sunshine yellow on midnight purple. */
:root {
  --pink: #ff3d9a;
  --cyan: #21e6ff;
  --yellow: #ffe45c;
  --grad: linear-gradient(90deg, var(--pink), var(--yellow), var(--cyan));
  --grad-diag: linear-gradient(135deg, var(--pink) 0%, #ff8a5c 45%, var(--yellow) 100%);

  --bg: #0b0820;
  --bg-2: #120d2e;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-solid: #171238;
  --panel-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f6f3ff;
  --muted: #a39dc4;
  --ok: #4dffb5;
  --err: #ff6b8a;
  --radius: 22px;
  --font: "Outfit", system-ui, "Segoe UI", sans-serif;
  --display: "Unbounded", "Outfit", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #2a1460 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  min-height: 100vh;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }
::selection { background: var(--pink); color: #fff; }

/* ---------- Blurred stage backdrop: spotlight + mic stand ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop svg {
  position: absolute; inset: -3%; width: 106%; height: 106%;
  filter: blur(7px) saturate(1.15);
}
/* darkens the top a little so text on the cards stays easy to read */
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11, 8, 32, .55) 0%, rgba(11, 8, 32, .2) 45%, rgba(11, 8, 32, .35) 100%);
}
.beam { transform-box: view-box; animation: sway 11s ease-in-out infinite alternate; }
.beam-pink { transform-origin: 170px -40px; }
.beam-cyan { transform-origin: 1430px -40px; animation-delay: -5.5s; animation-direction: alternate-reverse; }
@keyframes sway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
.spot { animation: glow 5s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .85; } to { opacity: 1; } }

/* ---------- Top bar + logo ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px; position: sticky; top: 0; z-index: 10;
  background: rgba(11, 8, 32, .55); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.wordmark {
  font-family: var(--display); font-weight: 900; font-size: 34px; letter-spacing: -.02em; line-height: 1;
  background: linear-gradient(90deg, var(--pink), var(--yellow), var(--cyan), var(--pink));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite;
  filter: drop-shadow(0 0 18px rgba(255, 61, 154, .35));
}
@keyframes shimmer { to { background-position: 300% 0; } }

/* bouncing equalizer logo mark */
.eq { display: flex; align-items: flex-end; gap: 3px; height: 30px; }
.eq i { display: block; width: 5px; border-radius: 3px; animation: bounce 1.1s ease-in-out infinite; }
.eq i:nth-child(1) { background: var(--pink); height: 40%; animation-delay: -.2s; }
.eq i:nth-child(2) { background: var(--yellow); height: 90%; animation-delay: -.5s; }
.eq i:nth-child(3) { background: var(--cyan); height: 65%; animation-delay: -.8s; }
.eq i:nth-child(4) { background: var(--pink); height: 80%; animation-delay: -.35s; }
.eq i:nth-child(5) { background: var(--yellow); height: 45%; animation-delay: -.65s; }
@keyframes bounce { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }
.eq i { transform-origin: bottom; }

.hint { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
kbd {
  font: 600 11px var(--font); padding: 3px 7px; border-radius: 6px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px;
}
.hint kbd + kbd { margin-left: -3px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 290px 1fr; min-height: calc(100vh - 71px); }
.main { padding: 28px; display: flex; flex-direction: column; gap: 22px; max-width: 1120px; width: 100%; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, .7);
}

/* ---------- Library ---------- */
.library {
  padding: 24px 16px; border-right: 1px solid var(--line); overflow-y: auto;
  background: rgba(11, 8, 32, .45); backdrop-filter: blur(12px);
}
.library h2 {
  font: 700 12px var(--display); text-transform: uppercase; letter-spacing: .14em;
  margin: 0 0 14px 6px; color: var(--muted);
}
.library-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.library-list li {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-radius: 14px;
  background: var(--panel); border: 1px solid transparent; cursor: pointer; position: relative;
  transition: transform .15s, background .15s, border-color .15s;
}
.library-list li::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 4px;
  background: var(--grad); opacity: 0; transition: opacity .2s;
}
.library-list li:nth-child(3n+1) { --accent: var(--pink); }
.library-list li:nth-child(3n+2) { --accent: var(--cyan); }
.library-list li:nth-child(3n) { --accent: var(--yellow); }
.library-list li:hover { transform: translateX(3px); background: var(--panel-2); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.library-list li.active { background: var(--panel-2); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.library-list li.active::before { opacity: 1; }
.library-list .li-text { flex: 1; min-width: 0; }
.library-list .li-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-list .li-sub { font-size: 12px; color: var(--accent); opacity: .85; }
.library-list .del {
  background: none; border: 0; color: var(--muted); font-size: 14px; padding: 4px 8px; border-radius: 8px; opacity: 0;
  transition: opacity .15s;
}
.library-list li:hover .del, .library-list li.active .del { opacity: 1; }
.library-list .del:hover { color: var(--err); background: rgba(255, 107, 138, .12); }
.empty-lib { color: var(--muted); font-size: 14px; margin: 4px 6px; line-height: 1.5; }

/* ---------- Create card ---------- */
.hero {
  font: 800 clamp(22px, 3vw, 32px)/1.15 var(--display); letter-spacing: -.02em; margin: 0 0 20px;
}
.hl-pink { color: var(--pink); }
.hl-cyan { color: var(--cyan); }
.url-row { display: flex; gap: 12px; }
.input-wrap { flex: 1; min-width: 0; position: relative; }
.input-icon { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); }
.url-row input {
  width: 100%; background: rgba(0, 0, 0, .3); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 16px 16px 16px 48px; outline: none; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.url-row input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(33, 230, 255, .15); }
button.primary {
  background: var(--grad-diag); border: 0; border-radius: 16px; padding: 0 26px;
  font: 700 16px var(--font); color: #1a0b2e; white-space: nowrap; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 10px 30px -8px rgba(255, 61, 154, .6); transition: transform .15s, box-shadow .15s, filter .15s;
}
button.primary:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); box-shadow: 0 14px 34px -8px rgba(255, 61, 154, .8); }
button.primary:active:not(:disabled) { transform: translateY(0) scale(.98); }
button.primary:disabled { filter: grayscale(.6); opacity: .55; cursor: default; }
.drop-zone {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; padding: 16px;
  border: 1.5px dashed rgba(255, 255, 255, .18); border-radius: 16px; color: var(--text);
  cursor: pointer; font-size: 15px; transition: all .2s;
}
.drop-zone:hover { border-color: var(--yellow); background: rgba(255, 228, 92, .05); }
.drop-zone.over { border-color: var(--cyan); background: rgba(33, 230, 255, .08); transform: scale(1.01); }
.drop-icon { font-size: 22px; color: var(--yellow); }

.job { margin-top: 18px; }
.job-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 600; gap: 12px; }
.pct { font-family: var(--display); font-weight: 800; color: var(--yellow); }
.bar { height: 12px; background: rgba(255, 255, 255, .07); border-radius: 99px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0; border-radius: 99px; transition: width .5s ease;
  background: linear-gradient(90deg, var(--pink), var(--yellow), var(--cyan), var(--pink));
  background-size: 200% 100%; animation: shimmer-bar 2s linear infinite;
}
@keyframes shimmer-bar { to { background-position: -200% 0; } }
.job.error .bar-fill { background: var(--err); animation: none; }
.job.error #job-stage { color: var(--err); }
.job p { margin: 10px 0 0; }

/* ---------- Player ---------- */
.song-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 12px; box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .6); }
.song-title { font: 800 22px/1.2 var(--display); letter-spacing: -.01em; }

.stage {
  position: relative; height: 320px; border-radius: 18px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 120%, #3a1670 0%, #160f38 55%, #0d0a24 100%);
  border: 1px solid var(--line);
}
.viz { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .38; }
.lyrics {
  position: absolute; inset: 0; overflow-y: hidden; text-align: center; padding: 140px 24px;
  scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent);
  mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent);
}
.lyrics .line {
  font: 600 22px/1.3 var(--font); padding: 7px 0; color: rgba(246, 243, 255, .45);
  transition: color .3s, transform .3s, font-size .3s;
}
.lyrics .line.past { color: rgba(246, 243, 255, .22); }
.lyrics .line.active {
  font: 800 32px/1.25 var(--display); letter-spacing: -.01em; transform: scale(1.03);
  background: linear-gradient(90deg, var(--pink) 0%, var(--yellow) calc(var(--fill, 0%) * .6), var(--cyan) var(--fill, 0%), #fff var(--fill, 0%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 61, 154, .45));
}
.lyrics .line.gap { font-size: 20px; }
.lyrics .empty { color: var(--muted); padding-top: 10px; font-size: 17px; }

.lyrics-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.lyrics-bar label { font-size: 13px; font-weight: 700; color: var(--cyan); text-transform: uppercase; letter-spacing: .08em; }
.lyrics-bar select {
  background: var(--panel-solid); color: var(--text); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 8px 12px; font-size: 14px; font-weight: 600; max-width: 100%; cursor: pointer; transition: border-color .2s;
}
.lyrics-bar select:hover:not(:disabled), .lyrics-bar select:focus { border-color: var(--cyan); outline: none; }
.lyrics-bar select:disabled { opacity: .6; cursor: default; }
#lyrics-status.working { color: var(--yellow); }
#lyrics-status.error { color: var(--err); }

.transport { display: flex; align-items: center; gap: 14px; margin: 20px 0 6px; }
.play {
  width: 64px; height: 64px; border-radius: 50%; border: 0; font-size: 22px; flex: none; color: #1a0b2e;
  background: var(--grad-diag); position: relative;
  box-shadow: 0 10px 30px -6px rgba(255, 61, 154, .7); transition: transform .15s;
}
.play:hover { transform: scale(1.07); }
.play:active { transform: scale(.95); }
.play.playing::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--pink);
  animation: ring 1.6s ease-out infinite;
}
@keyframes ring { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }
.time { font: 600 14px var(--font); font-variant-numeric: tabular-nums; color: var(--muted); min-width: 42px; text-align: center; }
.seek { flex: 1; }

/* ---------- Sliders ---------- */
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 99px; outline: none;
  background: rgba(255, 255, 255, .1); cursor: pointer; --c: var(--pink);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  border: 4px solid var(--c); box-shadow: 0 0 14px var(--c); transition: transform .15s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 4px solid var(--c); box-shadow: 0 0 14px var(--c);
}
input[type=range]::-moz-range-progress { background: var(--c); height: 8px; border-radius: 99px; }
input.seek { --c: var(--yellow); background: linear-gradient(90deg, var(--pink), var(--yellow) var(--p, 0%), rgba(255, 255, 255, .1) var(--p, 0%)); }

/* ---------- Control cards ---------- */
.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.control {
  border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 16%, transparent), rgba(255, 255, 255, .03) 60%);
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.c-pink { --c: var(--pink); }
.c-cyan { --c: var(--cyan); }
.c-yellow { --c: var(--yellow); }
.c-pink input[type=range] { --c: var(--pink); }
.c-cyan input[type=range] { --c: var(--cyan); }
.c-yellow input[type=range] { --c: var(--yellow); }
.control .label {
  font: 700 12px var(--font); text-transform: uppercase; letter-spacing: .1em;
  display: flex; justify-content: space-between; color: var(--c);
}
.control .label .val { color: var(--text); letter-spacing: 0; }
.control.transpose { align-items: center; text-align: center; }
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper button {
  width: 48px; height: 48px; border-radius: 14px; font-size: 24px; font-weight: 700;
  border: 1.5px solid color-mix(in srgb, var(--c) 45%, transparent); background: rgba(0, 0, 0, .25);
  transition: transform .12s, background .15s, box-shadow .15s;
}
.stepper button:hover { background: color-mix(in srgb, var(--c) 22%, transparent); box-shadow: 0 0 18px -4px var(--c); }
.stepper button:active { transform: scale(.92); }
.big {
  font: 900 40px/1 var(--display); min-width: 70px; text-align: center; font-variant-numeric: tabular-nums;
  color: var(--c); text-shadow: 0 0 24px color-mix(in srgb, var(--c) 60%, transparent);
}
.big.bump { animation: bump .3s ease; }
@keyframes bump { 40% { transform: scale(1.25); } }
.key-info { color: var(--text); font-weight: 600; }
.small-stepper button { width: auto; height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.hq { min-height: 18px; color: var(--yellow); font-weight: 600; }
.hq.st-hq { color: var(--ok); }
.hq.st-error { color: var(--err); }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 0; }
.link:hover { color: var(--text); }
.footnote { margin: 0; opacity: .7; }

/* ---------- Confetti overlay ---------- */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .library { border-right: 0; border-bottom: 1px solid var(--line); max-height: 240px; }
  .controls { grid-template-columns: 1fr; }
  .hint { display: none; }
  .main { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .url-row { flex-direction: column; }
  button.primary { padding: 14px; justify-content: center; }
  .stage { height: 260px; }
  .lyrics { padding: 110px 16px; }
}

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