:root {
  color-scheme: light;
  --blue: #1f3fd6;
  --blue-light: #2a5de6;
  --blue-soft: #e6ecff;
  --bg: #eef2fc;
  --surface: #ffffff;
  --text: #16245a;
  --muted: #55608a;
  --line: #d9e0f5;
  --green: #0a7a55;
  --green-soft: #dcf5ea;
  --red: #c2281d;
  --red-soft: #fde8e6;
  --amber: #8f5a00;
  --amber-soft: #fff1d6;
  --shadow: 0 12px 32px rgba(31, 63, 214, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: calc(32px + env(safe-area-inset-top)) 20px 56px;
  background:
    radial-gradient(ellipse 70% 62% at 50% 68%, rgba(70, 110, 255, .75), transparent 72%),
    radial-gradient(ellipse 46% 60% at 8% 92%, rgba(130, 70, 255, .5), transparent 70%),
    radial-gradient(ellipse 46% 60% at 94% 18%, rgba(30, 170, 255, .35), transparent 70%),
    linear-gradient(170deg, #0d1c8f, #1630b4);
  border-radius: 0 0 50% 50% / 0 0 34px 34px; /* curva suave, como el horizonte de un planeta */
  color: #ffffff;
  text-align: center;
}
.hero h1, .hero p { position: relative; text-shadow: 0 1px 14px rgba(20, 40, 160, .45); }
.hero h1 { margin: 0 auto; max-width: 13em; font-size: clamp(1.9rem, 8.5vw, 2.5rem); line-height: 1.12; letter-spacing: -.02em; }
.hero p { margin: 10px 0 0; font-size: 1.0625rem; }

/* Detrás del texto la galaxia se atenúa (--text-end lo mide hero.js) para no bajar el contraste. */
#sound {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .1) var(--text-end), #000 calc(var(--text-end) + 48px));
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .1) var(--text-end), #000 calc(var(--text-end) + 48px));
}
#stage { height: clamp(130px, 19vh, 170px); margin-top: 8px; }
@media (min-width: 900px) {
  #stage { height: clamp(240px, 38vh, 360px); }
}

/* Auroras: solo transform, lo mueve la GPU sin repintar. */
.aurora {
  position: absolute;
  inset: -35%;
  opacity: .45;
  background:
    radial-gradient(ellipse 34% 26% at 30% 46%, rgba(40, 210, 255, .3), transparent 70%),
    radial-gradient(ellipse 30% 24% at 72% 58%, rgba(170, 80, 255, .32), transparent 70%);
  animation: aurora 19s ease-in-out infinite alternate;
  will-change: transform;
}
.aurora + .aurora {
  background:
    radial-gradient(ellipse 36% 22% at 62% 34%, rgba(70, 120, 255, .4), transparent 70%),
    radial-gradient(ellipse 26% 22% at 24% 70%, rgba(40, 240, 220, .18), transparent 70%);
  animation-duration: 27s;
  animation-direction: alternate-reverse;
}
@media (min-width: 700px) {
  .aurora { opacity: .75; }
}
@keyframes aurora {
  from { transform: translate(-11%, 5%) rotate(-9deg) scale(1); }
  to { transform: translate(12%, -6%) rotate(11deg) scale(1.2); }
}

/* Bajan en diagonal desde debajo del texto: por delante de él lo volverían ilegible. */
.comet {
  position: absolute;
  top: calc(var(--text-end) + 6px);
  left: 72%;
  width: 130px;
  height: 2px;
  background: linear-gradient(90deg, #ffffff, rgba(160, 215, 255, .5) 35%, transparent);
  border-radius: 2px;
  opacity: 0;
  animation: comet 11s linear infinite 2s;
}
.comet + .comet { display: none; left: 94%; width: 90px; animation-duration: 13s; animation-delay: 6s; }
.comet + .comet + .comet { left: 40%; width: 110px; animation-duration: 17s; animation-delay: 4s; }
.comet + .comet + .comet + .comet { left: 84%; width: 70px; animation-duration: 9s; animation-delay: 9s; }
@media (min-width: 700px) {
  .comet + .comet { display: block; }
}
@keyframes comet {
  0% { opacity: 0; transform: rotate(-24deg) translateX(0); }
  1% { opacity: 1; }
  7% { opacity: 0; transform: rotate(-24deg) translateX(-460px); }
  100% { opacity: 0; transform: rotate(-24deg) translateX(-460px); }
}

main {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: -36px auto 0;
  padding: 0 16px 24px;
}

.panel {
  padding: 16px;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.drop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 60px;
  padding: 12px 20px;
  background: var(--blue);
  border-radius: 16px;
  color: #ffffff;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .12s, background .12s;
}
.drop:active { transform: scale(.98); }
.drop:hover, .dragging .drop { background: var(--blue-light); }
.drop:focus-within { outline: 3px solid var(--blue); outline-offset: 3px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.hint { margin: 10px 0 0; color: var(--muted); font-size: .9rem; text-align: center; }

/* Arrastrar no existe en pantallas táctiles. */
.drag { display: none; }
@media (hover: hover) and (pointer: fine) {
  .drag { display: inline; }
}

.promise { display: flex; gap: 10px; margin: 14px 2px 0; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.promise .icon { width: 20px; height: 20px; color: var(--green); }

.notice { margin: 12px 0 0; padding: 12px 14px; background: var(--red-soft); border-radius: 12px; color: var(--red); font-size: .95rem; }

/* Fijo arriba: con muchos audios el avance debe verse sin bajar por toda la lista. */
#summary {
  position: sticky;
  top: calc(8px + env(safe-area-inset-top));
  z-index: 1;
  width: fit-content;
  margin: 14px auto 0;
  padding: 6px 16px;
  background: var(--blue);
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: #ffffff;
  font-size: .9rem;
  font-weight: 650;
}

#limit { background: var(--amber-soft); color: var(--amber); }

#list { margin: 14px 0 0; padding: 0; list-style: none; }

.row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  column-gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px 8px 14px 14px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(31, 63, 214, .08);
}

.badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--blue-soft);
  border-radius: 50%;
  color: var(--blue);
}
.badge .check, .badge .alert { display: none; }
.done .badge { background: var(--green-soft); color: var(--green); }
.done .badge .note, .failed .badge .note, .warned .badge .note { display: none; }
.done:not(.warned) .badge .check { display: block; }
.failed .badge { background: var(--red-soft); color: var(--red); }
.warned .badge { background: var(--amber-soft); color: var(--amber); }
.failed .badge .alert, .warned .badge .alert { display: block; }
.working .badge { animation: breathe 1s ease-in-out infinite alternate; }
@keyframes breathe { to { background: #cdd9ff; } }

.info { min-width: 0; }
.name {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.status { display: block; margin-top: 2px; color: var(--muted); font-size: .9rem; line-height: 1.35; }
.failed .status { color: var(--red); }
.done .status { color: var(--green); }
.warned .status { color: var(--amber); }

.remove {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.remove .icon { width: 20px; height: 20px; }
.remove:active { background: var(--blue-soft); }

progress {
  grid-column: 1 / -1;
  display: block;
  width: calc(100% - 6px);
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  appearance: none;
  background: var(--blue-soft);
  border: 0;
  border-radius: 8px;
}
progress::-webkit-progress-bar { background: var(--blue-soft); border-radius: 8px; }
progress::-webkit-progress-value { background: var(--blue); border-radius: 8px; transition: width .2s; }
progress::-moz-progress-bar { background: var(--blue); border-radius: 8px; }

.actions { grid-column: 1 / -1; padding-right: 6px; }

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--blue-soft);
  border: 0;
  border-radius: 14px;
  color: var(--blue);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .12s;
}
.button:active { transform: scale(.98); }
.button.primary { background: var(--blue); color: #ffffff; }

.button:focus-visible, .remove:focus-visible, footer a:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

footer {
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}
footer a { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

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