@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("assets/fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Noche: casi negro cálido y una sola luz ámbar. Textos secundarios claros para leer bien. */
:root {
  --bg: #0e0c0a;
  --bg-2: #171411;
  --raise: #221d18;
  --line: #322b24;
  --line-2: #4a4036;
  --ink: #f6f0e8;
  --ink-2: #d6ccbf;
  --ink-3: #ab9f92;
  --amber: #ffad55;
  --amber-hi: #ffbd73;
  --amber-ink: #1d1206;
  --amber-soft: rgba(255, 173, 85, 0.14);
  --bad: #ff9585;
  --r: 14px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding: 96px 0 120px; }
@media (pointer: fine) { html { overscroll-behavior: none; } }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 173, 85, 0.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font);
  font-variation-settings: "opsz" 16;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}
::selection { background: var(--amber); color: var(--amber-ink); }
* { scrollbar-color: var(--line-2) transparent; }
img { display: block; max-width: 100%; }
a { color: var(--amber); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, label, a, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 8px; }
h1, h2 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.ic { width: 20px; height: 20px; flex: none; }
.ic.xs { width: 16px; height: 16px; vertical-align: -3px; }
.ic.lg { width: 28px; height: 28px; }
.ic.xl { width: 42px; height: 42px; }

.skip { position: absolute; left: 12px; top: -60px; background: var(--amber); color: var(--amber-ink); padding: 12px 16px; border-radius: 10px; font-weight: 700; z-index: 10; }
.skip:focus { top: 12px; }

/* ---------- Cabecera ---------- */
.top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 16px clamp(16px, 4vw, 40px);
  padding-top: max(16px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  background: rgba(14, 12, 10, 0.9);
  backdrop-filter: blur(14px) saturate(1.2);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.3rem; letter-spacing: -0.02em; font-variation-settings: "opsz" 32; }
.brand-mark { width: 30px; height: 30px; color: var(--amber); }
.steps ol { display: flex; justify-content: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 0.95rem; font-weight: 550; padding: 6px 14px 6px 6px; border-radius: 99px; }
.steps .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); font-size: 0.8rem; font-weight: 700; }
.steps li.done { color: var(--ink-2); }
.steps li.done .n { background: var(--raise); border-color: var(--raise); color: var(--amber); }
.steps li[aria-current] { color: var(--ink); background: var(--raise); }
.steps li[aria-current] .n { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.account { display: flex; align-items: center; gap: 10px; justify-self: end; }
.who { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.95rem; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who img { border-radius: 50%; }
.offline {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px;
  background: rgba(255, 149, 133, 0.12); border: 1px solid rgba(255, 149, 133, 0.45);
  color: #ffd2ca; font-size: 0.9rem; font-weight: 650; white-space: nowrap;
}

/* ---------- Estructura ---------- */
main { outline: none; }
.wrap { width: min(1040px, 100% - 32px); margin: 0 auto; padding: clamp(32px, 6vw, 64px) 0 24px; }
.wrap.narrow { width: min(700px, 100% - 32px); }
.center { text-align: center; }
.display {
  font-size: clamp(2.8rem, 8vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 760;
  font-variation-settings: "opsz" 96, "wdth" 92;
  max-width: 12ch;
}
.h1 { font-size: clamp(2rem, 4.4vw, 2.8rem); line-height: 1.06; letter-spacing: -0.03em; font-weight: 740; font-variation-settings: "opsz" 64; }
.hero .actions { margin-top: 40px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.actions.center { justify-content: center; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: 99px; border: 1.5px solid transparent;
  font: 650 1rem/1 var(--font);
  color: var(--ink); background: none; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.16s var(--ease), box-shadow 0.18s var(--ease);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(0.97); transition-duration: 0.08s; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn.primary { background: var(--amber); color: var(--amber-ink); box-shadow: 0 8px 26px -12px rgba(255, 173, 85, 0.7); }
.btn.primary:hover:not(:disabled) { background: var(--amber-hi); box-shadow: 0 12px 30px -12px rgba(255, 173, 85, 0.85); }
.btn.ghost { border-color: var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: var(--raise); border-color: var(--ink-3); }
.btn.lg { min-height: 58px; padding: 0 30px; font-size: 1.1rem; }
.btn.sm { min-height: 44px; padding: 0 16px; font-size: 0.92rem; }
.btn.icon { width: 48px; padding: 0; color: var(--ink-2); }
.btn.icon:hover:not(:disabled) { color: var(--ink); background: var(--raise); }
.btn .ic { width: 19px; height: 19px; }

.alert { margin-top: 24px; padding: 14px 18px; border-radius: var(--r); border: 1px solid rgba(255, 149, 133, 0.45); background: rgba(255, 149, 133, 0.1); color: #ffd2ca; font-weight: 500; }
.empty { padding: 40px 0; text-align: center; display: grid; gap: 6px; font-size: 1.1rem; }

/* ---------- Configuración ---------- */
.setup { margin-top: 48px; padding: clamp(22px, 4vw, 36px); background: var(--bg-2); border: 1px solid var(--line); border-radius: 22px; max-width: 760px; }
.setup h2 { font-size: 1.5rem; letter-spacing: -0.02em; font-weight: 720; }
.howto { counter-reset: s; list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 24px; font-size: 1.08rem; }
.howto > li { counter-increment: s; position: relative; padding-left: 50px; color: var(--ink-2); }
.howto > li::before { content: counter(s); position: absolute; left: 0; top: -3px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--amber); color: var(--amber-ink); font-weight: 750; font-size: 0.95rem; }
.howto b { color: var(--ink); font-weight: 650; }
.copyline { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 6px 6px 16px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: var(--bg); }
.copyline code { flex: 1; overflow-x: auto; white-space: nowrap; color: var(--amber); font: 600 1rem/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; }
.clientform label { display: block; color: var(--ink-2); margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.clientform input, .field > input:not([type="range"]) {
  flex: 1; min-width: 220px; width: 100%; min-height: 52px; padding: 0 16px;
  background: var(--bg); color: var(--ink);
  border: 1.5px solid var(--line-2); border-radius: 12px;
  font: 550 1.05rem var(--font);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.clientform input { width: auto; }
input::placeholder { color: var(--ink-3); }
.clientform input:focus, .field > input:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 4px var(--amber-soft); }
input:user-invalid { border-color: var(--bad); }

.note { margin-top: 18px; color: var(--ink-2); font-size: 0.98rem; }
.note summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.note summary:hover { color: var(--ink); }
.note p { margin-top: 6px; max-width: 62ch; }
.note.open { text-align: left; margin-top: 40px; padding: 8px 20px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); }
.misslist { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 8px; }

/* ---------- Elegir listas ---------- */
.picklist { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 4px; }
.pick { display: grid; grid-template-columns: 64px 1fr 34px; align-items: center; gap: 16px; padding: 8px 14px 8px 8px; border-radius: 16px; cursor: pointer; transition: background-color 0.18s var(--ease); }
.pick:hover { background: var(--bg-2); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick .art { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--raise); display: grid; place-items: center; color: var(--ink-3); }
.pick .art img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s var(--ease); }
.pick:hover .art img { transform: scale(1.03); }
.picklist li:first-child .art { background: linear-gradient(140deg, #4a3220, #221d18); color: var(--amber); }
.meta { display: grid; min-width: 0; gap: 1px; }
.name { font-weight: 650; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--ink-2); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease); }
.tick .ic { width: 17px; height: 17px; }
.pick input:checked ~ .tick { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.pick:active .tick { transform: scale(0.9); }
.pick:has(input:checked) { background: var(--amber-soft); }
.pick:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- Barra inferior fija ---------- */
.dock {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(700px, 100% - 24px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 24px;
  background: rgba(34, 29, 24, 0.94); backdrop-filter: blur(16px);
  border: 1px solid var(--line-2); border-radius: 99px;
  box-shadow: 0 20px 44px -16px rgba(0, 0, 0, 0.85);
  color: var(--ink); font-size: 1.02rem; font-weight: 600; z-index: 4;
}
.dock.enter { animation: rise 0.45s var(--ease) both; }
.dock .btn.ghost:first-child { margin-left: -14px; }
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } }

/* ---------- Ajustes ---------- */
.toplist { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.toplist li { padding: 6px 12px; border-radius: 99px; background: var(--raise); color: var(--ink); font-size: 0.95rem; font-weight: 550; }
.toplist .tnum { color: var(--amber); margin-left: 4px; }
.tune { margin-top: 36px; display: grid; gap: 34px; }
.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.field > label, .field legend { display: flex; gap: 6px; align-items: baseline; width: 100%; font-weight: 650; font-size: 1.1rem; margin-bottom: 14px; padding: 0; }
.field > label .muted { font-weight: 400; }
.field output { margin-left: auto; color: var(--amber); font-size: 1.7rem; font-weight: 750; letter-spacing: -0.02em; }
.ends { display: flex; justify-content: space-between; color: var(--ink-2); font-size: 0.95rem; margin-top: 8px; }
input[type="range"] { width: 100%; height: 32px; background: none; appearance: none; -webkit-appearance: none; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: var(--line-2); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--amber); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--ink); border: 5px solid var(--amber); transition: transform 0.15s var(--ease); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 5px solid var(--amber); }
.segs { display: inline-flex; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 99px; }
.seg input, .chip input, .switch input { position: absolute; opacity: 0; }
.seg span { display: grid; place-items: center; min-width: 60px; height: 44px; border-radius: 99px; font-weight: 700; font-size: 1.05rem; color: var(--ink-2); cursor: pointer; transition: background-color 0.18s var(--ease), color 0.18s var(--ease); }
.seg input:checked + span { background: var(--amber); color: var(--amber-ink); }
.seg input:focus-visible + span, .chip input:focus-visible + span, .switch input:focus-visible ~ .track { outline: 3px solid var(--amber); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--line-2); color: var(--ink-2); font-size: 0.98rem; font-weight: 550; cursor: pointer; transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease); }
.chip span .ic { width: 0; opacity: 0; transition: width 0.18s var(--ease), opacity 0.18s var(--ease); }
.chip:active span { transform: scale(0.97); }
.chip input:checked + span { background: var(--raise); border-color: var(--ink-3); color: var(--ink); text-decoration: line-through; text-decoration-color: var(--amber); text-decoration-thickness: 2px; }
.chip input:checked + span .ic { width: 16px; opacity: 1; color: var(--amber); }
.switch { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; min-height: 44px; cursor: pointer; font-weight: 650; font-size: 1.1rem; }
.switch .track { width: 52px; height: 30px; border-radius: 99px; background: var(--line-2); position: relative; transition: background-color 0.22s var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); transition: transform 0.25s var(--ease), background-color 0.22s var(--ease); }
.switch input:checked ~ .track { background: var(--amber); }
.switch input:checked ~ .track::after { transform: translateX(22px); background: var(--amber-ink); }

/* ---------- Progreso ---------- */
.progress { margin: 8px auto 32px; max-width: 480px; }
.ptitle { font-size: clamp(1.6rem, 3.4vw, 2.1rem); font-weight: 740; letter-spacing: -0.02em; outline: none; }
.progress .muted { font-size: 1.05rem; }
.bar { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; margin: 22px 0 12px; }
.bar span { display: block; height: 100%; background: var(--amber); transform-origin: left; transition: transform 0.35s var(--ease); }
.phases { list-style: none; padding: 0; margin: 0 0 40px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; color: var(--ink-3); font-size: 1rem; }
.phases li { display: inline-flex; align-items: center; gap: 6px; }
.phases li.done { color: var(--ink-2); }
.phases li.done .ic { color: var(--amber); }
.phases li.now { color: var(--ink); font-weight: 650; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------- Resultados ---------- */
.reshead { display: flex; justify-content: space-between; align-items: end; gap: 20px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.dropped { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dropped li { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--ink-2); font-size: 0.92rem; font-weight: 550; }
.dropped .tnum { color: var(--ink); font-weight: 700; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.tracklist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.trk {
  display: grid; grid-template-columns: 32px 64px minmax(0, 1fr) auto 48px; align-items: center; gap: 16px;
  padding: 10px 8px; border-bottom: 1px solid var(--line);
  transition: background-color 0.18s var(--ease), opacity 0.22s var(--ease);
}
/* Solo entra animada una lista recién buscada, nunca al quitar o recuperar una canción. */
.tracklist.fresh .trk { animation: enter 0.5s var(--ease) both; animation-delay: calc(min(var(--i), 14) * 30ms); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.trk:hover { background: var(--bg-2); }
.trk .num { color: var(--ink-3); text-align: right; font-size: 0.95rem; font-weight: 600; }
.cover { position: relative; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--raise); cursor: pointer; }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s var(--ease), filter 0.22s var(--ease); }
.cover .pp { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.16s var(--ease); }
.cover .pp .ic { width: 26px; height: 26px; }
.cover:hover .pp, .cover:focus-visible .pp, .trk.playing .pp { opacity: 1; }
.cover:hover:not(:disabled) img { transform: scale(1.03); }
.cover:active:not(:disabled) { transform: scale(0.96); }
.cover:disabled { cursor: default; }
.cover:disabled .pp { display: none; }
.trk.playing { background: var(--amber-soft); }
.trk.playing .name { color: var(--amber); }
.trk.playing .pp { background: rgba(0, 0, 0, 0.4); color: var(--amber); }
.trk .why { color: var(--ink-3); font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trk .dur { color: var(--ink-2); font-size: 0.98rem; }
.trk.off { opacity: 0.42; }
.trk.off .name { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.trk.off .cover img { filter: grayscale(1); }

/* ---------- Final ---------- */
.done .seal { width: 88px; height: 88px; margin: 0 auto 28px; border-radius: 50%; display: grid; place-items: center; background: var(--amber); color: var(--amber-ink); animation: pop 0.5s var(--ease) both; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }
.done > .muted { margin: 12px auto 32px; font-size: 1.15rem; }

/* ---------- Aviso ---------- */
.toast { position: fixed; left: 50%; top: 88px; transform: translate(-50%, -10px); padding: 13px 20px; border-radius: 99px; background: var(--ink); color: var(--bg); font-weight: 650; font-size: 0.98rem; opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.3s var(--ease); z-index: 20; max-width: calc(100% - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
  .top { grid-template-columns: 1fr auto; padding-block: 10px; gap: 10px; }
  .steps { grid-column: 1 / -1; grid-row: 2; }
  .steps ol { justify-content: space-between; }
  .steps li { padding: 4px 10px 4px 4px; font-size: 0.9rem; }
  .steps li:not([aria-current]) .lbl { display: none; }
  .steps li:not([aria-current]) { padding-right: 4px; }
  .who { display: none; }
  .trk { grid-template-columns: 56px minmax(0, 1fr) 48px; gap: 12px; padding-inline: 0; }
  .trk .num, .trk .dur { display: none; }
  .cover { width: 56px; height: 56px; }
  .dock { padding-left: 20px; }
  .dock .btn { padding-inline: 18px; }
  .tools { width: 100%; }
  .tools .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  .btn:hover:not(:disabled) { transform: none; }
}
