:root {
  /* Paleta de ciberimaginario.cloud */
  --red: #b1040e;
  --red-dark: #8f1000;
  --gold: #fcbd00;
  --gray: #aaaaaa;
  --black: #111111;
  --off: #f9f9f9;
  --white: #ffffff;

  --bg: var(--white);
  --surface: var(--white);
  --text: var(--black);
  --muted: #666666;
  --line: rgba(0, 0, 0, .1);
  --line-strong: rgba(0, 0, 0, .18);
  --accent: var(--red);
  --accent-hover: var(--red-dark);
  --accent-soft: rgba(177, 4, 14, .06);
  --ok: #059669;
  --warn: #b45309;
  --warn-soft: #fff8e1;
  --err: var(--red);
  --err-soft: #fdecec;
  --radius: 2px;
  --shadow: none;
  --display: "Bebas Neue", "Arial Narrow", sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* Retícula de fondo, como en ciberimaginario.cloud */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image:
    linear-gradient(rgba(0, 0, 0, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, .03) 1px, transparent 1px);
  background-size: 60px 60px;
}
.accent-line { height: 3px; background: linear-gradient(90deg, var(--red-dark), var(--red), var(--gold)); }
main { flex: 1; width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font: 400 clamp(2rem, 4.5vw, 2.6rem)/1 var(--display); letter-spacing: .03em; margin: 0 0 .5rem; }
h2 { font: 400 1.45rem/1.1 var(--display); letter-spacing: .04em; margin: 0 0 .5rem; }
.eyebrow { font: 500 .66rem/1.4 var(--mono); letter-spacing: .25em; text-transform: uppercase; color: var(--red); margin: 0 0 .6rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
code { font-size: .9em; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Cabecera y pasos */
.top { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .93); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgba(0, 0, 0, .08); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-link { display: block; line-height: 0; }
.logo-link img { height: 34px; width: auto; }
.brand { font: 400 1.35rem/1 var(--display); letter-spacing: .05em; color: var(--text); text-decoration: none; padding-left: 14px; border-left: 1px solid var(--line); white-space: nowrap; }
.brand:hover { color: var(--red); }
.arrow { color: var(--red); }
.stepper { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.stepper li { display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px 5px; border: 1px solid transparent; border-radius: var(--radius); color: #888; font: 400 .66rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.stepper .num { display: grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius); border: 1px solid var(--line-strong); font: 500 .7rem/1 var(--mono); letter-spacing: 0; }
.stepper li.done .num { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.stepper li.current { border-color: var(--line-strong); color: var(--text); background: var(--white); }
.stepper li.current .num { background: var(--accent); border-color: var(--accent); color: var(--white); }
.stepper li.link { cursor: pointer; }
.stepper li.link:hover { color: var(--text); }
@media (max-width: 640px) {
  .stepper .lbl { display: none; } .stepper li.current .lbl { display: inline; }
  .logo-link img { height: 28px; } .brand { font-size: 1.15rem; padding-left: 10px; }
  .brand-row { gap: 10px; }
}

main { padding-top: 32px; padding-bottom: 40px; }
.foot { border-top: 1px solid rgba(0, 0, 0, .08); background: var(--off); }
.foot-inner { display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 22px; }
.foot-inner img { height: 26px; width: auto; display: block; }
.foot-text { font: 400 .62rem/1.7 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #888; flex: 1 1 320px; }

/* Tarjetas */
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
/* Línea roja superior, como las tarjetas de la web principal */
.card::before { content: ""; position: absolute; top: -1px; left: -1px; right: -1px; height: 3px; background: var(--red); }
.side .card::before { background: var(--line-strong); }
.card + .card { margin-top: 16px; }
.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head-row h1 { margin: 0; }
.head-row p { margin: .25rem 0 0; }

/* Formularios */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1 1 220px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font: 500 .66rem/1.4 var(--mono); letter-spacing: .15em; text-transform: uppercase; color: #555; }
legend { font: 400 1.4rem/1 var(--display); letter-spacing: .05em; color: var(--text); }
.field small { font-weight: 400; }
input[type=password], input[type=number], select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 9px 11px; min-height: 42px; width: 100%;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, .drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 42px; }
output { color: var(--accent); font-family: var(--mono); letter-spacing: 0; text-transform: none; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0; margin-bottom: 12px; float: left; width: 100%; }
legend + * { clear: both; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }

.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 190px; padding: 24px; text-align: center; cursor: pointer;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--off); transition: border-color .15s, background .15s;
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.has-file { border-style: solid; border-color: var(--accent); }
.drop-icon { font-size: 2rem; color: var(--accent); line-height: 1; }
.drop-main { font-weight: 500; word-break: break-word; }
.drop-sub { font: 400 .66rem/1.6 var(--mono); letter-spacing: .12em; text-transform: uppercase; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 .7rem/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 9px 16px; min-height: 42px; text-align: center; transition: background .2s, border-color .2s, color .2s;
}
.btn:hover { border-color: var(--red); color: var(--red); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--white); }
.btn.primary:hover { color: var(--white); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; color: var(--accent); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: .64rem; }
.btn.icon { width: 34px; padding: 0; font: 400 1.1rem/1 var(--sans); }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn small { font-size: .9em; opacity: .8; text-transform: none; letter-spacing: .02em; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.actions.sticky { position: sticky; bottom: 0; background: var(--surface); padding: 16px 0 4px; margin-top: 8px; border-top: 1px solid var(--line); }

.alert { border-radius: var(--radius); border-left: 3px solid currentColor; padding: 12px 16px; margin-bottom: 16px; }
.alert.error { background: var(--err-soft); color: var(--err); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

.progress { height: 6px; border-radius: 0; background: rgba(0, 0, 0, .07); overflow: hidden; }
.progress.big { height: 8px; margin: 16px 0 8px; }
.progress .bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--red-dark), var(--red), var(--gold)); transition: width .4s; }
.progress.indeterminate .bar { width: 30%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

.spinner { width: 40px; height: 40px; margin: 8px auto 16px; border-radius: 50%; border: 3px solid rgba(0, 0, 0, .08); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.spinner.small { width: 22px; height: 22px; border-width: 3px; margin: 0; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner, .progress .bar { animation-duration: 3s; transition: none; } }

/* Páginas */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.thumb { position: relative; display: block; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--off); transition: border-color .2s; }
.thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; background: #fff; }
.thumb.on { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--red); }
.thumb:not(.on) img { opacity: .45; }
.thumb input { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; accent-color: var(--accent); }
.thumb .cap { display: flex; justify-content: space-between; gap: 6px; padding: 7px 9px; font: 400 .62rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; background: var(--surface); border-top: 1px solid var(--line); }
.thumb .tag { color: var(--warn); }

.omr-count { font: 500 .8rem/1.4 var(--mono); letter-spacing: .08em; margin: 0 0 12px; }
.omr-pages { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.omr-pages li { font: 400 .62rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 4px 9px; border: 1px solid rgba(177, 4, 14, .35); border-radius: var(--radius); color: var(--accent); }

/* Revisión */
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 920px) { .review-grid { grid-template-columns: 1fr; } }
.score-card { padding: 20px; min-width: 0; }
.score { overflow: auto; max-height: 78vh; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 8px; color: #000; }
.score > p { color: #555; padding: 40px 0; }
.zoom { display: flex; align-items: center; gap: 8px; font: 400 .75rem/1 var(--mono); }
.side { display: flex; flex-direction: column; gap: 16px; }
.side .card + .card { margin-top: 0; }
.side .card { padding: 18px; }
audio { width: 100%; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; font-size: .88rem; align-items: baseline; }
.facts dt { font: 400 .6rem/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #888; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.warn-box { background: var(--warn-soft); color: var(--warn); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: 10px 12px; font-size: .85rem; margin-top: 8px; }
.warn-box ul { margin: 4px 0 0; padding-left: 18px; }
.ok-box { color: var(--ok); font-size: .9rem; }

/* Audio */
.apply-all { margin-bottom: 14px; }
.parts { display: grid; gap: 10px; }
.part { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: var(--radius); background: var(--off); }
.part .meta { display: flex; flex-direction: column; }
.part .meta b { font-weight: 600; }
.part .meta span { color: #888; font: 400 .6rem/1.6 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 560px) { .part { grid-template-columns: 1fr; } }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid3 { grid-template-columns: 1fr; } }
#render-form fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 18px; }
.rendering { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); }
.result { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }

@media (max-width: 480px) {
  main { padding-top: 16px; }
  .card { padding: 20px 16px; }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  h1 { font-size: 1.9rem; }
}
