:root {
  --bg: #f6f6fb;
  --surface: #ffffff;
  --surface-2: #f0effa;
  --text: #16151f;
  --muted: #6b6a7b;
  --border: #e3e2ee;
  --accent: #5b3df5;
  --accent-strong: #4a2de0;
  --accent-soft: #ece8ff;
  --ok: #14a06f;
  --danger: #d8344a;
  --shadow: 0 1px 2px rgba(22, 21, 31, .04), 0 8px 24px rgba(22, 21, 31, .06);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e16;
    --surface: #1a1924;
    --surface-2: #232231;
    --text: #efeef6;
    --muted: #a09fb2;
    --border: #2e2d3e;
    --accent: #8b74ff;
    --accent-strong: #a391ff;
    --accent-soft: #2a2447;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); text-align: center; }
.muted { color: var(--muted); }
.center { text-align: center; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
section { padding: 56px 0; }

/* --- botones --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid transparent; border-radius: 10px;
  padding: .65em 1.2em; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: .45em .9em; font-size: .9rem; }
.btn.lg { padding: .95em 2.2em; font-size: 1.15rem; border-radius: 12px; box-shadow: 0 6px 20px rgba(91, 61, 245, .28); }
.btn.full { width: 100%; }
.btn .lock { font-size: .85em; }

/* --- cabecera --- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--text); }
.brand svg { width: 28px; height: 28px; }
.brand rect { fill: var(--accent); }
.brand path { stroke: #fff; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.nav { display: flex; gap: 20px; margin-right: auto; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); }
.account { display: flex; align-items: center; gap: 8px; }
.account .email { color: var(--muted); font-size: .9rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-block; padding: .15em .6em; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 700;
}

/* --- portada y herramientas --- */
.hero { padding: 64px 0 24px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; }
.lead { max-width: 640px; margin: 0 auto 36px; font-size: 1.15rem; color: var(--muted); }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; text-align: left; }
.tool-card {
  display: block; padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text); cursor: pointer; transition: border-color .15s, transform .15s;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card.active { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.tool-card .icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 14px;
}
.tool-card .icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-card h3 { font-size: 1.05rem; margin: 0 0 4px; }
.tool-card p { margin: 0; color: var(--muted); font-size: .92rem; }

/* --- zona de trabajo --- */
.workspace { padding-top: 24px; }
.workspace h2 { margin-bottom: .2em; }
.workspace > .wrap > .muted { text-align: center; margin: 0 0 24px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 16px; border: 2px dashed var(--border); border-radius: 12px;
  transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 48px; height: 48px; fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.dropzone p { margin: 0; }
.options { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; justify-content: space-between; margin-top: 20px; }
.options label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
select, input[type=email], input[type=password] {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: .6em .8em; min-width: 220px;
}
select:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.limits { margin: 0; font-size: .88rem; color: var(--muted); max-width: 360px; }

.progress-head, .done-head, .preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filename { font-weight: 700; word-break: break-all; }
.stage { color: var(--muted); font-size: .92rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 18px 0 8px; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #9b6bff); border-radius: 999px; transition: width .4s ease; }
.bar-fill.indeterminate { width: 35% !important; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.progress-foot { display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { font-size: .85rem; color: var(--muted); margin: 16px 0 0; }

.done-head { justify-content: flex-start; margin-bottom: 18px; }
.done-head h3 { margin: 0; }
.check { width: 40px; height: 40px; flex: none; }
.check circle { fill: var(--ok); }
.check path { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.preview-head span { font-weight: 600; }
.preview {
  white-space: pre-wrap; word-wrap: break-word; max-height: 340px; overflow: auto;
  background: var(--surface-2); border-radius: 10px; padding: 16px; margin: 8px 0 20px;
  font: .95rem/1.6 inherit; font-family: inherit;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; }
#step-error h3 { color: var(--danger); }

/* --- historial --- */
.history { padding-top: 0; }
.job-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.job {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.job-main { flex: 1; min-width: 0; }
.job-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { font-size: .85rem; color: var(--muted); }
.job-actions { display: flex; gap: 4px; flex: none; }
.status { font-size: .78rem; font-weight: 700; padding: .15em .55em; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status.done { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.status.error { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.status.processing, .status.queued { background: var(--accent-soft); color: var(--accent); }

/* --- precios --- */
.pricing { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 32px; }
.plan {
  display: flex; flex-direction: column; padding: 26px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg);
}
.plan.featured { border: 2px solid var(--accent); background: var(--surface); box-shadow: var(--shadow); position: relative; }
.plan.featured::before {
  content: "Recomendado"; position: absolute; top: -12px; left: 24px;
  background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; padding: .2em .7em; border-radius: 999px;
}
.plan h3 { margin: 0; }
.price { font-size: 2rem; font-weight: 800; margin: 8px 0 16px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; flex: 1; }
.plan li { padding-left: 26px; position: relative; font-size: .95rem; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.plan .current { text-align: center; color: var(--muted); font-weight: 600; padding: .65em; }

/* --- preguntas --- */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.faq details p { margin: 0 0 14px; color: var(--muted); }

.footer { padding: 28px 0; border-top: 1px solid var(--border); font-size: .9rem; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* --- diálogo de acceso --- */
.dialog { border: none; border-radius: 16px; padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(15, 14, 22, .5); }
.auth-form { display: grid; gap: 14px; padding: 24px; }
.auth-form label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.auth-form input { min-width: 0; width: 100%; }
.auth-form p { margin: 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.tab { border: 0; background: transparent; padding: .55em; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.form-error { color: var(--danger); font-size: .9rem; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: .75em 1.2em; border-radius: 10px;
  box-shadow: var(--shadow); font-weight: 600; max-width: calc(100vw - 32px);
}

/* --- opciones de subida --- */
.advanced { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.advanced summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
.advanced label { display: block; font-size: .9rem; margin: 12px 0 6px; }
.advanced .hint { margin-top: 6px; }
textarea {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--border); border-radius: 10px; padding: .6em .8em; resize: vertical;
}
textarea:focus, input[type=search]:focus, input[type=text]:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* --- resultado --- */
.result-tabs { margin-bottom: 20px; max-width: 360px; }
.field-label { font-size: .9rem; font-weight: 600; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
  padding: .5em 1em; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip[data-locked] { color: var(--muted); }
.chip .lock { font-size: .8em; margin-right: 4px; }
.export-options { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: end; margin-bottom: 20px; }
.export-options label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
.export-options label[hidden] { display: none; }
.check-label { display: flex !important; align-items: center; gap: 8px !important; font-weight: 500 !important; padding-bottom: .55em; cursor: pointer; }
.check-label input { width: 18px; height: 18px; accent-color: var(--accent); }
.download-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
#again { margin-top: 4px; padding-left: 0; }

/* --- editor --- */
.editor-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.editor-bar input {
  font: inherit; color: var(--text); background: var(--surface); flex: 1 1 160px; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px; padding: .5em .75em;
}
.segments {
  max-height: 460px; overflow: auto; margin: 12px 0; padding: 4px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.seg { display: flex; gap: 10px; align-items: flex-start; padding: 4px; }
.seg-time { flex: none; width: 64px; padding-top: .55em; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.seg-text { resize: none; overflow: hidden; padding: .45em .6em; line-height: 1.5; background: var(--surface); border-color: transparent; }
.seg-text:hover { border-color: var(--border); }
.seg-text.hit { border-color: #f5b400; background: color-mix(in srgb, #f5b400 12%, var(--surface)); }
.editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* --- ventajas --- */
.features { padding-top: 16px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.feature-grid h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature-grid p { margin: 0; font-size: .95rem; }

/* --- pie, enlaces, diálogos --- */
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: .9rem; color: var(--accent); cursor: pointer; justify-self: center; }
.link.danger { color: var(--danger); }
.form-ok { color: var(--ok); font-size: .92rem; }
.legal-note { font-size: .82rem; color: var(--muted); text-align: center; }
.account-info { display: grid; gap: 10px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.account-info div { display: flex; justify-content: space-between; gap: 12px; font-size: .95rem; }
.auth-form h3 { margin: 0; }

/* --- páginas legales --- */
.legal { padding: 40px 0 56px; }
.legal h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.legal h2 { text-align: left; font-size: 1.2rem; margin-top: 1.8em; }
.legal p, .legal li { color: var(--text); }
.legal li { margin-bottom: 6px; }
mark { background: #fff1a8; color: #5a4a00; padding: 0 .25em; border-radius: 4px; }

@media (max-width: 720px) {
  .nav { display: none; }
  .topbar-inner { justify-content: space-between; }
  .account .email { display: none; }
  section { padding: 40px 0; }
  .hero { padding-top: 40px; }
  .card { padding: 18px; }
  .options { flex-direction: column; align-items: stretch; }
  select { min-width: 0; width: 100%; }
  .job { flex-wrap: wrap; }
  .topbar-inner { gap: 8px; }
  .brand { font-size: 1rem; gap: 8px; }
  .account { gap: 2px; }
  .account .btn { padding: .4em .5em; font-size: .85rem; }
  /* En el móvil, herramientas compactas en dos columnas: el botón de subir queda a la vista. */
  .tools { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tool-card { padding: 14px; }
  .tool-card .icon { width: 36px; height: 36px; margin-bottom: 8px; }
  .tool-card h3 { font-size: .95rem; }
  .tool-card p { display: none; }
  .lead { margin-bottom: 24px; font-size: 1.05rem; }
  .seg-time { width: 48px; font-size: .75rem; }
  .download-row .btn { flex: 1; }
  .export-options label { width: 100%; }
  .footer .wrap { flex-direction: column; }
}
