:root {
  --bg: #0a0c11;
  --bg-2: #0f121a;
  --surface: #141823;
  --surface-2: #1b2030;
  --line: #262c3d;
  --text: #e9ecf4;
  --muted: #8f97ab;
  --accent: #ff4d8d;
  --accent-2: #38d9ff;
  --ok: #3ddc97;
  --warn: #ffb547;
  --danger: #ff5d5d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255, 77, 141, .13), transparent 60%),
    radial-gradient(800px 500px at -10% 10%, rgba(56, 217, 255, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto; padding: 18px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; letter-spacing: .2px; }
.brand b { color: var(--accent); font-weight: 700; }
.brand-mark { width: 28px; height: 28px; }
.brand-mark .bm-cue { fill: var(--text); }
.brand-mark .bm-in { fill: var(--accent-2); }
.brand-mark .bm-song { fill: var(--accent); }
.engine {
  font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px; background: var(--bg-2);
}
.engine.ai { color: var(--ok); border-color: rgba(61, 220, 151, .35); }
.engine:not(.ai) { cursor: help; }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 18px 0 22px; max-width: 780px; }
.hero h1 { font-size: clamp(26px, 4.4vw, 42px); line-height: 1.12; margin: 0 0 12px; letter-spacing: -.5px; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin: 0; font-size: 16px; }

.grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 16px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

/* Subida */
.upload { display: flex; flex-direction: column; gap: 10px; }
.drop {
  flex: 1; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 22px; cursor: pointer;
  border: 1.5px dashed #3a4258; border-radius: 12px; background: rgba(255, 255, 255, .015);
  transition: border-color .15s, background .15s, transform .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(255, 77, 141, .06); }
.drop.over { transform: scale(1.01); }
.drop input { display: none; }
.drop-icon { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-size: 18px; font-weight: 600; }
.drop-sub { color: var(--muted); font-size: 13px; }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; padding: 6px; font-size: 14px; }
.link:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); text-decoration: none; cursor: pointer; font-weight: 600;
  transition: transform .1s, background .15s, border-color .15s;
}
.btn:hover { border-color: #3a4258; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(90deg, var(--accent), #ff6aa0); border-color: transparent; color: #19070f; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.wide { width: 100%; margin-top: 14px; }
.drop .btn { margin-top: 6px; }

/* Opciones */
.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 520px) { .opt-grid { grid-template-columns: 1fr; } }
.opt { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opt-label { font-size: 13px; color: var(--muted); }
.opt-hint { font-size: 11px; color: #646c80; margin-top: -2px; }
select, input[type=number] {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
select:focus, input:focus, .btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.seg { display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 6px 0; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px #3a4258; }
.toggles { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 16px; }
.vols { display: grid; gap: 8px; margin-top: 16px; }
.vol { display: grid; grid-template-columns: 110px minmax(0, 1fr) 48px; align-items: center; gap: 10px; font-size: 14px; }
.vol input[type="range"] { width: 100%; accent-color: #ff4d8d; }
.vol output { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.tg { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; user-select: none; }
.tg input { display: none; }
.sw { width: 34px; height: 20px; border-radius: 20px; background: #2a3042; position: relative; transition: background .15s; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #b7bdcc; transition: transform .15s, background .15s; }
.tg input:checked + .sw { background: rgba(255, 77, 141, .45); }
.tg input:checked + .sw::after { transform: translateX(14px); background: #fff; }

/* Progreso */
.prog-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.prog-file { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--bg-2); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s ease; }
.steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 700px) { .steps { grid-template-columns: 1fr 1fr; } }
.steps li { font-size: 13px; color: #646c80; padding-left: 18px; position: relative; }
.steps li::before { content: ""; position: absolute; left: 0; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: #2a3042; }
.steps li.active { color: var(--text); }
.steps li.active::before { background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 77, 141, .18); animation: pulse 1.2s infinite; }
.steps li.done { color: var(--muted); }
.steps li.done::before { background: var(--ok); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 77, 141, .05); } }
.prog-stage { color: var(--muted); margin: 12px 0 0; font-size: 14px; }

.error { border-color: rgba(255, 93, 93, .4); }
.error p { color: var(--muted); margin: 6px 0 0; white-space: pre-line; }

/* Resultado */
.res-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.res-text { flex: 1; min-width: 200px; }
.res-cover { flex: none; display: block; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); transition: transform .15s; }
.res-cover:hover { transform: scale(1.03); }
.res-cover img { display: block; width: 88px; height: 88px; object-fit: cover; background: var(--bg-2); }
.res-title { text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; font-size: 20px !important; margin: 0 0 4px !important; }
.res-sub { color: var(--muted); margin: 0; font-size: 14px; }
.dl { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.chip { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; min-width: 0; }
.chip small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; }
.chip span { font-weight: 700; font-variant-numeric: tabular-nums; }

.wave-wrap { position: relative; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
canvas#wave { display: block; width: 100%; height: 170px; cursor: pointer; }
.wave-tip {
  position: absolute; top: 8px; transform: translateX(-50%); pointer-events: none;
  background: rgba(10, 12, 17, .92); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 12px; white-space: nowrap;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.transport { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.play {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #ff7aa9); flex: none;
}
.play svg { width: 22px; height: 22px; fill: #19070f; }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 100px; }
.cues { display: flex; gap: 8px; flex-wrap: wrap; }
.cues button { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.cues button:hover { border-color: var(--accent-2); }
.notes { margin: 14px 0 0; padding: 0; list-style: none; }
.notes li { color: var(--warn); font-size: 13px; padding-left: 20px; position: relative; margin-top: 4px; }
.notes li::before { content: "!"; position: absolute; left: 4px; font-weight: 800; }

footer { text-align: center; color: #5d6578; font-size: 12px; padding: 10px 16px 30px; }
.foot-brand { display: block; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.foot-brand b { color: var(--accent); }

/* Estructura de la canción original */
.structure { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.structure h3 { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 10px; }
.struct-strip { display: flex; gap: 2px; height: 34px; border-radius: 8px; overflow: hidden; }
.struct-strip .sec {
  position: relative; min-width: 3px; display: flex; align-items: center; padding: 0 6px; overflow: hidden;
  font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; cursor: default;
}
.struct-strip .sec.loop { box-shadow: inset 0 0 0 2px #fff; }
.struct-strip .sec .hook { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.struct-strip { cursor: pointer; }
.struct-strip .sec { cursor: pointer; }
.struct-strip .sec .hook.picked { background: var(--accent-2); box-shadow: 0 0 0 2px rgba(56, 217, 255, .35); }
.struct-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.stems { margin-top: 12px; display: grid; gap: 6px; }
.stem-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.stem-btns button { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 13px; color: var(--text); }
.stem-btns button:hover { border-color: var(--accent-2); }
.stem-btns button.on { border-color: var(--accent); color: var(--accent); }
.report { margin-top: 14px; }
.report .link { padding: 0; font-size: 13px; color: var(--muted); }
.report-form { display: grid; gap: 8px; margin-top: 8px; }
.report-form textarea { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color: var(--text); font: inherit; resize: vertical; }
.report-form .btn { justify-self: start; }
.report-done { color: var(--ok); font-size: 13px; margin: 8px 0 0; }
.hook-row { display: flex; gap: 8px; min-width: 0; }
.hook-row select { flex: 1; min-width: 0; }
.hook-play { flex: none; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; cursor: pointer; font-size: 13px; color: var(--text); white-space: nowrap; }
.hook-play:hover { border-color: var(--accent-2); }
.hook-play.on { border-color: var(--accent); color: var(--accent); }
.struct-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin-top: 12px; }
@media (max-width: 520px) { .struct-opts { grid-template-columns: 1fr; } }
#regen2 { margin-top: 12px; }
.newtab { margin-left: auto; margin-right: 10px; font-size: 12px; color: var(--accent-2); text-decoration: none; }
.newtab:hover { text-decoration: underline; }

/* Cuenta y plan */
.account { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-left: 10px; }
.account .badge { color: #19070f; background: linear-gradient(90deg, var(--accent), #ff6aa0); border-radius: 999px; padding: 2px 8px; font-weight: 700; }
.account .link { font-size: 12px; padding: 0; }
@media (max-width: 520px) { .account .who { display: none; } }
.login { border-color: rgba(255, 77, 141, .35); display: grid; gap: 10px; }
.login-sub { color: var(--muted); margin: 0; font-size: 14px; }
.login .google { justify-self: start; }
.login-form { display: flex; gap: 10px; flex-wrap: wrap; }
.login-form input { flex: 1; min-width: 180px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.login-msg { color: var(--warn); font-size: 13px; margin: 0; min-height: 1em; }
.plan { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; }
.plan-text { flex: 1; min-width: 200px; font-size: 14px; }
.plan-text b { color: var(--accent); }
.plan.out { border-color: rgba(255, 181, 71, .45); }

/* Contraseña */
.lock { border-color: rgba(56, 217, 255, .35); }
.lock-form { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.lock-form input { flex: 1; min-width: 180px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.lock-msg { color: var(--warn); font-size: 13px; margin: 8px 0 0; min-height: 1em; }

/* Mis proyectos */
.proj-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.proj-head h2 { margin-bottom: 10px; }
.proj-note { font-size: 12px; color: var(--muted); }
.proj-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.proj-cover { width: 40px; height: 40px; border-radius: 6px; flex: none; object-fit: cover; background: var(--surface-2); }
.proj-genre { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.proj-genre.reggaeton { color: #ff4d8d; }
.proj-genre.trap { color: #ff4d8d; }
.proj-genre.funk { color: #ffb547; }
.proj-genre.house { color: #38d9ff; }
.proj-genre.pop { color: #7c4dff; }
.proj-genre.dnb { color: #c6ff3d; }
.proj-genre.generic { color: var(--muted); }
@media (max-width: 620px) { .proj-genre, .proj-meta { display: none; } }
.proj-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); cursor: pointer; }
.proj-list li:hover, .proj-list li.current { border-color: var(--accent-2); }
.proj-list li.busy { position: relative; overflow: hidden; }
.proj-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--surface-2); }
.proj-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s ease; }
.proj-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.proj-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.proj-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.proj-status.done { color: var(--ok); }
.proj-status.error { color: var(--danger); }
.proj-status.queued, .proj-status.analyzing, .proj-status.rendering { color: var(--accent-2); }

/* condiciones de uso */
.terms { display: grid; gap: 10px; padding: 14px 18px; border-color: rgba(56, 217, 255, .35); }
.terms-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.terms-check { display: flex; align-items: flex-start; gap: 10px; flex: 1 1 320px; font-size: 14px; line-height: 1.45; cursor: pointer; }
.terms-check input { margin-top: 3px; width: 18px; height: 18px; accent-color: #ff4d8d; flex: none; }
.terms-check a, footer a { color: var(--accent-2); }

/* packs de créditos */
.packs { display: flex; flex-wrap: wrap; gap: 8px; }
.packs[hidden] { display: none; }
.btn.pack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 14px; text-decoration: none; }
.btn.pack b { font-size: 14px; }
.btn.pack span { font-size: 11px; color: var(--muted); }

/* aviso antes de subir varias */
.confirm { display: grid; gap: 12px; padding: 14px 18px; border-color: rgba(255, 181, 71, .45); }
.confirm-text { margin: 0; font-size: 15px; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* varias canciones: una barra por canción */
.batch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.batch-note { font-size: 12px; color: var(--muted); }
.batch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.batch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.batch-row .b-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-row .b-pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.batch-row .bar { grid-column: 1 / -1; height: 6px; }
.batch-row .b-stage { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.batch-row.wait { opacity: .6; }
.batch-row.up .bar > div { background: var(--surface-2); background: linear-gradient(90deg, #4f5df0, var(--accent-2)); }
.batch-row.done { cursor: pointer; border-color: rgba(61, 220, 151, .45); }
.batch-row.done .bar > div { background: var(--ok); }
.batch-row.done .b-stage { color: var(--ok); }
.batch-row.error .b-stage { color: var(--danger); }
