:root {
  --bg: #f4f1ec; --card: #ffffff; --text: #1d1b19; --muted: #6f6a63;
  --line: #e2ddd5; --field: #f8f6f2; --accent: #d6402b; --accent-ink: #fff;
  --ok: #2f7d4f; --err-bg: #fbe9e6; --err: #a3271a; --warn: #8a5a00;
  --yt: #e62117; --sp: #1db954;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141312; --card: #1e1c1a; --text: #f1ede7; --muted: #a29b92;
    --line: #34302c; --field: #171615; --accent: #ef5a44; --accent-ink: #fff;
    --ok: #5cc08a; --err-bg: #3a1d18; --err: #ff9d8f; --warn: #f0b955;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: grid; justify-items: center; align-content: start;
  background: var(--bg); color: var(--text); padding: max(24px, 6vh) 16px 24px;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main {
  width: 100%; max-width: 580px; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px;
}
h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.02em; }
h1 span { color: var(--accent); }
.sub { margin: 0 0 24px; color: var(--muted); }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
input, select, button { font: inherit; }
.campo { position: relative; }
input[type=text], select {
  width: 100%; padding: 13px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--field); color: var(--text);
}
input[type=text] { padding-right: 96px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  color: #fff; display: none;
}
.chip.yt { background: var(--yt); display: block; }
.chip.sp { background: var(--sp); display: block; }
.row { display: flex; gap: 12px; margin-top: 16px; align-items: end; }
.row > div { flex: 1; }
button {
  border: 0; border-radius: 10px; padding: 13px 22px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; white-space: nowrap;
}
button:disabled { opacity: .55; cursor: wait; }
#estado { margin-top: 26px; display: none; }
.cabecera { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.cabecera img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; background: var(--line); }
.titulo { font-weight: 650; margin: 0; word-break: break-word; line-height: 1.3; }
.subtitulo { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.barra { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.barra > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.barra.indet > div { width: 35%; animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.texto { font-size: 14px; color: var(--muted); margin-top: 8px; word-break: break-word; }
.error { background: var(--err-bg); color: var(--err); padding: 12px 14px; border-radius: 10px; }
.aviso { color: var(--warn); font-size: 14px; margin-top: 12px; }
.aviso ul { margin: 4px 0 0; padding-left: 20px; }
.descarga {
  display: inline-block; margin-top: 14px; color: var(--ok); font-weight: 600;
  text-decoration: none; border: 1px solid currentColor; padding: 10px 16px;
  border-radius: 10px; word-break: break-word;
}
footer { margin-top: 28px; font-size: 13px; color: var(--muted); }
@media (max-width: 480px) {
  main { padding: 24px 18px; }
  .row { flex-direction: column; align-items: stretch; }
}
.enlace { color: var(--accent); font-weight: 600; text-decoration: none; }
.enlace:hover { text-decoration: underline; }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.top a { font-size: 14px; }
.error .enlace { color: inherit; text-decoration: underline; }
.pestanas {
  display: flex; gap: 4px; padding: 4px; margin: 14px 0 22px;
  background: var(--field); border: 1px solid var(--line); border-radius: 12px;
}
.pestanas a {
  flex: 1; text-align: center; padding: 8px 6px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
}
.pestanas a:hover { color: var(--text); }
.pestanas a.activa { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.top { align-items: center; }
.salir { margin: 0; }
.salir button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 14px;
  background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 9px;
}
.salir button:hover { color: var(--text); border-color: var(--muted); }
.salir svg { width: 16px; height: 16px; }
