:root {
  --bg: #090b10;
  --panel: rgba(20, 23, 32, 0.78);
  --raised: #1b1f2b;
  --raised-hover: #232838;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f7;
  --muted: #8a91a6;
  --faint: #5d6478;
  --violet: #7c5cff;
  --cyan: #22d3ee;
  --gradient: linear-gradient(135deg, var(--violet), var(--cyan));
  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.14);
  --danger: #fb7185;
  --radius-lg: 22px;
  --radius: 14px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }

.glow {
  position: fixed; inset: -20vh -10vw auto; height: 70vh; pointer-events: none; z-index: 0;
  background:
    radial-gradient(40% 60% at 20% 30%, rgba(124, 92, 255, 0.22), transparent 70%),
    radial-gradient(35% 50% at 80% 20%, rgba(34, 211, 238, 0.14), transparent 70%);
  filter: blur(10px);
}

.shell { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 24px 16px 80px; display: grid; gap: 24px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--gradient); display: grid; place-items: center; box-shadow: 0 8px 24px -8px var(--violet); }
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.topbar-note { color: var(--muted); font-size: .875rem; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow); backdrop-filter: blur(16px);
}

.intake-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.intake h1 { margin: 0; font-size: clamp(1.35rem, 2.6vw, 1.75rem); letter-spacing: -0.03em; }

.tabs { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .875rem; }
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); }

.link-form {
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 999px; transition: border-color .15s, box-shadow .15s;
}
.link-form:focus-within { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.18); }
.link-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.link-form input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; outline: none; font-size: 1rem; }
.link-form input::placeholder { color: var(--faint); }

.primary {
  border: 0; border-radius: 999px; padding: 11px 22px; font-weight: 700; color: #fff; background: var(--gradient);
  box-shadow: 0 10px 24px -10px var(--violet); transition: transform .12s, filter .12s; white-space: nowrap;
}
.primary:hover { filter: brightness(1.1); }
.primary:active { transform: scale(.97); }
.primary:disabled { filter: grayscale(.6) brightness(.8); cursor: progress; }

.dropzone {
  display: grid; justify-items: center; gap: 6px; padding: 34px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--raised); color: var(--muted);
  transition: border-color .15s, background .15s;
}
.dropzone svg { width: 30px; height: 30px; fill: none; stroke: var(--violet); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { color: var(--text); }
.dropzone:hover, .dropzone.dragging { border-color: var(--violet); background: var(--raised-hover); }

.fineprint { margin: 14px 2px 0; color: var(--faint); font-size: .8rem; }

.toast { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); font-size: .9rem; }
.toast.error { color: var(--danger); border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.08); }

.song-head { display: flex; align-items: center; gap: 16px; }
.cover {
  width: 64px; height: 64px; flex: none; border-radius: 16px;
  background: linear-gradient(135deg, hsl(var(--hue, 260) 80% 62%), hsl(calc(var(--hue, 260) + 60) 80% 52%));
  box-shadow: 0 12px 30px -12px hsl(var(--hue, 260) 80% 50%);
}
.song-meta { min-width: 0; }
.song-meta h2 { margin: 0; font-size: 1.3rem; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.song-sub { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.song-sub.failed { color: var(--danger); }

.progress { margin-top: 24px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.step { position: relative; padding-top: 14px; color: var(--faint); font-size: .85rem; font-weight: 600; }
.step::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; border-radius: 4px; background: var(--raised-hover); }
.step.done { color: var(--muted); }
.step.done::before { background: var(--gradient); }
.step.active { color: var(--text); }
.step.active::before { background: linear-gradient(90deg, var(--violet), var(--cyan), var(--violet)); background-size: 200% 100%; animation: flow 1.6s linear infinite; }
@keyframes flow { to { background-position: -200% 0; } }
.progress-note { margin: 14px 0 0; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }

.studio { margin-top: 26px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(20px, 4vw, 44px); align-items: center; }

.wheel-wrap { position: relative; width: min(100%, 27.5rem); aspect-ratio: 1; margin: 0 auto; }
.wheel { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, transparent 37%, rgba(255,255,255,0.025) 37.5%, rgba(255,255,255,0.025) 70%, transparent 70.5%); }
.wheel::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--line); }
.wheel-key {
  position: absolute; transform: translate(-50%, -50%); border: 1px solid var(--line); background: var(--raised);
  border-radius: 50%; display: grid; place-items: center; font-weight: 700; transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
}
.wheel-key.major { width: 15%; height: 15%; font-size: clamp(.8rem, 2.2vw, 1rem); }
.wheel-key.minor { width: 11.5%; height: 11.5%; font-size: clamp(.65rem, 1.7vw, .8rem); color: var(--muted); }
.wheel-key:hover:not(:disabled) { background: var(--raised-hover); border-color: var(--line-strong); transform: translate(-50%, -50%) scale(1.08); }
.wheel-key.original { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.wheel-key.selected { border-color: transparent; background: var(--gradient); color: #fff; box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.25), 0 10px 26px -8px var(--violet); }
.wheel-key.selected.original { box-shadow: 0 0 0 3px var(--gold), 0 10px 26px -8px var(--violet); }
.wheel.busy .wheel-key { cursor: progress; }
.wheel-key.pending { animation: pulse 1.4s ease-in-out infinite; }
.wheel-center { position: absolute; inset: 34%; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(circle, var(--raised-hover), var(--raised)); border: 1px solid var(--line); }
.wheel-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); }
.wheel-center strong { font-size: clamp(1.6rem, 5vw, 2.4rem); letter-spacing: -0.04em; line-height: 1.1; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wheel-sub { font-size: .75rem; color: var(--muted); }

.controls { display: grid; gap: 22px; min-width: 0; }
.field { display: grid; gap: 8px; }
.field-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); font-weight: 700; }
.key-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.key-hint { color: var(--muted); font-size: .85rem; }
.badge { padding: 5px 14px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-weight: 700; border: 1px solid rgba(251, 191, 36, 0.35); }


.player { position: relative; border-radius: var(--radius-lg); background: var(--raised); border: 1px solid var(--line); padding: 16px; overflow: hidden; }
.visualizer { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 45%; opacity: .35; pointer-events: none; }
.transport { position: relative; display: flex; align-items: center; gap: 14px; }
.play {
  position: relative; width: 56px; height: 56px; flex: none; border: 0; border-radius: 50%; background: var(--gradient);
  display: grid; place-items: center; box-shadow: 0 12px 28px -10px var(--violet); transition: transform .12s;
}
.play:active { transform: scale(.94); }
.play svg { width: 24px; height: 24px; fill: #fff; grid-area: 1 / 1; }
.play .icon-pause, .play.playing .icon-play { display: none; }
.play.playing .icon-pause { display: block; }
.play .spinner { grid-area: 1 / 1; width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; display: none; }
.play.loading svg { display: none; }
.play.loading .spinner { display: block; }
.play:disabled { cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }

.timeline { flex: 1; min-width: 0; display: grid; gap: 4px; }
.now-playing { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.times { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; cursor: pointer; --fill: 0%; }
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 5px; background: linear-gradient(90deg, var(--violet), var(--cyan)) 0 / var(--fill) 100% no-repeat, rgba(255,255,255,0.1); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4.5px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 5px; background: rgba(255,255,255,0.1); }
input[type="range"]::-moz-range-progress { height: 5px; border-radius: 5px; background: var(--gradient); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

.icon-button { width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; color: var(--faint); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button[aria-pressed="true"] { color: var(--cyan); border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.08); }

.downloads { position: relative; display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.ghost { flex: 1; text-align: center; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; font-weight: 600; font-size: .875rem; background: rgba(255,255,255,0.03); }
.ghost:hover { border-color: var(--violet); background: rgba(124, 92, 255, 0.12); }
.ghost[aria-disabled="true"] { pointer-events: none; opacity: .4; }

.secondary {
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 9px 16px; font-weight: 600; font-size: .9rem;
  background: rgba(255,255,255,0.04); color: var(--text); transition: border-color .15s, background .15s;
}
.secondary:hover:not(:disabled) { border-color: var(--violet); background: rgba(124, 92, 255, 0.12); }
.secondary:disabled { opacity: .55; cursor: progress; }
.secondary.busy { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }

.select {
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 9px 12px; font: inherit; font-size: .9rem;
  background: var(--raised); color: var(--text); min-width: 0; max-width: 100%;
}

.singers { margin-top: 26px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card { border-radius: var(--radius-lg); background: var(--raised); border: 1px solid var(--line); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }
.tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.card-body { display: grid; gap: 12px; justify-items: start; }
.card-body > * { max-width: 100%; }
.card-note { margin: 0; color: var(--muted); font-size: .875rem; }
.error-text { color: var(--danger); }

.roll { width: 100%; height: 150px; border-radius: 12px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); justify-self: stretch; }
.parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; justify-self: stretch; }
.part-row { display: flex; gap: 8px; }
.part-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: transparent; text-align: left; transition: border-color .15s, background .15s;
}
.part-toggle[aria-pressed="true"] { border-color: var(--part); background: color-mix(in srgb, var(--part) 14%, transparent); }
.part-dot { width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid var(--part); }
.part-toggle[aria-pressed="true"] .part-dot { background: var(--part); }
.part-name { font-weight: 700; }
.part-range { margin-left: auto; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.part-download { flex: none; display: grid; place-items: center; padding: 9px 12px; }
.volume { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; justify-self: stretch; }
.volume input { flex: 1; }

.voice-range { display: grid; gap: 2px; }
.voice-range strong { font-size: 1.1rem; }
.voice-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.voice-test { justify-self: stretch; display: grid; gap: 8px; justify-items: center; text-align: center; padding: 14px; border-radius: 12px; background: rgba(0,0,0,0.25); border: 1px solid var(--line); }
.voice-test p { margin: 0; color: var(--muted); font-size: .9rem; }
.live-note { font-size: 2.2rem; letter-spacing: -0.03em; line-height: 1.1; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.suggest-title { margin: 4px 0 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); font-weight: 700; }
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.suggest-chip {
  display: grid; gap: 1px; padding: 8px 14px; border-radius: 12px; text-align: left;
  border: 1px solid rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.08); transition: background .15s;
}
.suggest-chip strong { font-size: 1.05rem; }
.suggest-chip span { font-size: .75rem; color: var(--muted); }
.suggest-chip:hover { background: rgba(34, 211, 238, 0.16); }
.suggest-chip.selected { border-color: transparent; background: var(--gradient); }
.suggest-chip.selected span { color: rgba(255,255,255,0.85); }
#voice-suggest { display: grid; gap: 6px; justify-self: stretch; }
#voice-suggest > .secondary { justify-self: start; }

.wheel-key.suggested::after { content: ""; position: absolute; top: 6%; right: 6%; width: 22%; height: 22%; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 2px var(--bg); }

.library h2 { margin: 0 0 12px; font-size: 1rem; color: var(--muted); font-weight: 600; }
.library-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.song-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.song-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.song-card.current { border-color: var(--violet); }
.song-card .cover { width: 42px; height: 42px; border-radius: 11px; box-shadow: none; }
.song-card-text { min-width: 0; display: grid; }
.song-card-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-card-key { font-size: .8rem; color: var(--muted); }

@media (max-width: 860px) {
  .studio, .singers { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .shell { padding: 16px 10px 56px; gap: 16px; }
  .panel { padding: 16px 14px; }
  .card { padding: 14px; }
  .song-head { gap: 12px; }
  .cover { width: 52px; height: 52px; border-radius: 14px; }
  .song-meta h2 { font-size: 1.1rem; }
  .wheel-key.minor { width: 13%; height: 13%; }
  .downloads .ghost { min-height: 44px; display: grid; place-items: center; }
  .link-form { flex-wrap: wrap; border-radius: var(--radius); padding: 10px 12px; }
  .link-form .primary { width: 100%; }
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* Large screens: wider page and everything scaled up ~25% */
@media (min-width: 1280px) {
  html { font-size: 20px; }
  body { font-size: 18.75px; }
  .shell { max-width: 1340px; padding-top: 28px; gap: 28px; }
}

/* Very large monitors (1920px and up) */
@media (min-width: 1920px) {
  html { font-size: 22px; }
  body { font-size: 20.6px; }
  .shell { max-width: 1560px; }
}
