/* ================= Formulario de estudiantes: una pregunta por pantalla, en una sola columna ================= */
body.estudiante {
  --ink: #18263a;
  --ink-2: #4a5a70;
  --paper: #f5f8fc;
  --grid: #e3eaf3;
  --line-2: #cdd7e4;
  --accent: #2c5bd1;
  --accent-soft: #e8eefc;
  --error: #b42b2b;
  --error-soft: #fcecec;
  --ok: #1d7a52;
  --ok-soft: #e4f4ec;
  --gutter: clamp(16px, 8vw, 168px);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 18px;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  background-attachment: fixed;
}
body.estudiante .wrap { max-width: none; padding: 0; }

/* ---------- Barra superior y progreso ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  padding: 12px var(--gutter) 14px;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-2);
}
.topbar-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.topbar-title { font-size: 15px; }
.tag-final { font-size: 13px; font-weight: 700; color: #8a4310; background: #fdebd9; border-radius: 6px; padding: 2px 8px; margin-left: 6px; }
.progress-text { font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress-track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.progress-track li { min-width: 0; }
.seg {
  width: 100%; height: 30px; padding: 0; cursor: pointer;
  border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff;
  color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .15s, border-color .15s, color .15s;
}
.seg:disabled { cursor: default; color: #a7b3c3; background: rgba(255, 255, 255, .6); border-color: var(--grid); }
.seg.is-done { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg.is-pending { border-color: #d9a21b; background: #fff8e3; color: #7a5500; }
.seg.is-current { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.seg:not(:disabled):hover { border-color: var(--ink); }
.seg.is-done:not(:disabled):hover { filter: brightness(1.1); }
.seg:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Escenario (una columna) ---------- */
.stage { padding: clamp(28px, 5vw, 64px) var(--gutter) 40px; min-height: calc(100vh - 200px); }
.js .step { display: none; }
.js .step.is-active { display: block; animation: step-in .2s ease-out; }
html:not(.js) .step { margin-bottom: 64px; }
html:not(.js) .step.review, html:not(.js) .attach { display: none; }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step > * + * { margin-top: 0; }
.inst { margin: 0 0 18px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.kicker { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--accent); }
.step-title {
  font-family: "Literata", Georgia, serif; font-weight: 600;
  font-size: clamp(26px, 2.6vw, 40px); line-height: 1.22; letter-spacing: -.01em;
  margin: 0 0 12px; outline: none; max-width: 40ch;
}
h1.step-title { font-size: clamp(32px, 3.6vw, 56px); max-width: 22ch; }
.lead { font-size: 19px; line-height: 1.6; margin: 0 0 12px; max-width: 80ch; }
.facts { padding: 0; margin: 20px 0 32px; list-style: none; display: grid; gap: 10px; max-width: 80ch; }
.facts li { padding-left: 28px; position: relative; color: var(--ink-2); line-height: 1.5; }
.facts li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 12px; height: 7px; border-left: 3px solid var(--accent); border-bottom: 3px solid var(--accent); transform: rotate(-45deg); }
.help { font-size: 16px; color: var(--ink-2); margin: 0 0 18px; max-width: 80ch; }
.counter { font-size: 16px; color: var(--ink-2); margin: 0 0 16px; }
.counter span { font-weight: 700; color: var(--accent); font-size: 22px; font-variant-numeric: tabular-nums; }

/* ---------- Bloques del inicio ---------- */
.card-block { background: #fff; border: 1px solid var(--line-2); border-radius: 16px; padding: clamp(20px, 3vw, 32px); margin-top: 18px; }
.block-title { font-family: "Literata", Georgia, serif; font-size: 22px; margin: 0 0 18px; }
.card-block > p { margin: 0 0 18px; line-height: 1.55; max-width: 80ch; color: var(--ink-2); }
.field { margin-bottom: 24px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-weight: 700; margin-bottom: 8px; }
.field .help { margin: 8px 0 0; }
body.estudiante input[type="text"] {
  width: 100%; max-width: 420px; font: inherit; font-size: 20px; letter-spacing: .02em; padding: 13px 16px;
  border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--ink);
}
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 60px; height: 50px; padding: 0 14px;
  border: 1.5px solid var(--line-2); border-radius: 10px; background: #fff; font-weight: 700; cursor: pointer;
}
.segmented span:hover { border-color: #9fb2cc; }
.segmented input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Consentimiento: casilla grande y explícita */
.consent-toggle {
  display: flex; align-items: center; gap: 16px; cursor: pointer;
  padding: 16px 20px; border: 2px dashed #9fb2cc; border-radius: 14px; background: #fafcff;
  transition: background-color .15s, border-color .15s;
}
.consent-toggle:hover { border-color: var(--accent); }
.consent-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.consent-box {
  flex: none; width: 34px; height: 34px; border-radius: 8px; border: 2.5px solid #7a8ca5; background: #fff; position: relative;
}
.consent-text { display: flex; flex-direction: column; gap: 2px; }
.consent-text strong { font-size: 19px; }
.consent-sub { font-size: 14px; color: var(--ink-2); }
.consent-toggle:has(input:checked) { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.consent-toggle:has(input:checked) .consent-box { background: var(--ok); border-color: var(--ok); }
.consent-toggle:has(input:checked) .consent-box::after {
  content: ""; position: absolute; left: 10px; top: 3px; width: 9px; height: 18px;
  border: solid #fff; border-width: 0 3.5px 3.5px 0; transform: rotate(45deg);
}
.consent-sub.si { display: none; color: var(--ok); font-weight: 700; }
.consent-toggle:has(input:checked) .consent-sub.no { display: none; }
.consent-toggle:has(input:checked) .consent-sub.si { display: block; }
.consent-toggle:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Opciones ---------- */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; gap: 14px; align-items: flex-start; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line-2); border-radius: 12px;
  padding: 15px 18px; line-height: 1.45; transition: border-color .12s, background-color .12s;
}
.choice:hover { border-color: #9fb2cc; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-mark { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid #8b9bb2; background: #fff; position: relative; }
.choice.multi .choice-mark { border-radius: 6px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:checked) .choice-mark { border-color: var(--accent); background: var(--accent); }
.choice:has(input:checked) .choice-mark::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.choice:not(.multi):has(input:checked) .choice-mark::after { left: 5px; top: 5px; width: 8px; height: 8px; border: 0; border-radius: 50%; background: #fff; transform: none; }
.choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice.is-disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Respuestas abiertas ---------- */
.answer { margin-top: 22px; }
.answer-label { display: block; font-weight: 700; margin-bottom: 8px; }
.answer textarea {
  width: 100%; display: block; resize: vertical;
  font: inherit; font-size: 18px; line-height: 1.65; color: var(--ink);
  padding: 18px 20px; background: #fff; border: 1.5px solid var(--line-2); border-radius: 12px;
}
.answer textarea::placeholder { color: #98a6b8; }
body.estudiante input:focus, .answer textarea:focus { outline: 3px solid rgba(44, 91, 209, .28); border-color: var(--accent); }
.answer-meta { display: flex; justify-content: space-between; gap: 12px; margin: 8px 2px 0; font-size: 14px; color: var(--ink-2); }
.wc { font-variant-numeric: tabular-nums; }
@media (hover: none) { .kbd-hint { display: none; } }

/* ---------- Enunciados ---------- */
.enunciado { background: #fff; border: 1px solid var(--line-2); border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; padding: 18px 24px; line-height: 1.6; margin-top: 8px; }
.enunciado p { margin: 0 0 12px; max-width: 85ch; }
.enunciado p:last-child { margin-bottom: 0; }
.enunciado blockquote { margin: 12px 0; padding: 12px 16px; background: var(--paper); border-radius: 8px; font-style: italic; }
.enunciado .afirmaciones { padding-left: 20px; margin: 12px 0; max-width: 85ch; }
.enunciado .afirmaciones li { margin-bottom: 8px; }
.enunciado table.datos { border-collapse: collapse; margin: 4px 0 14px; }
.enunciado table.datos th, .enunciado table.datos td { border: 1px solid var(--line-2); padding: 6px 18px; }
.enunciado table.datos th { background: var(--accent-soft); text-align: left; }
.enunciado table.datos td:last-child { text-align: right; font-family: "Literata", Georgia, serif; font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Adjuntos ---------- */
.attach { margin-top: 28px; }
.attach-drop {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 14px 18px; border: 1.5px dashed #aebdd2; border-radius: 12px; background: rgba(255, 255, 255, .7);
  transition: background-color .15s, border-color .15s;
}
.attach-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.attach-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.attach-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-weight: 700; color: var(--accent); background: #fff; border: 1.5px solid var(--accent);
  border-radius: 10px; padding: 9px 16px;
}
.attach-btn:hover { background: var(--accent-soft); }
.attach-input:focus-visible + .attach-btn { outline: 3px solid var(--accent); outline-offset: 2px; }
.attach-help { margin: 0; font-size: 14px; color: var(--ink-2); flex: 1 1 320px; line-height: 1.45; }
.attach-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.attach-list:empty { display: none; }
.attach-item { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.attach-item .thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: none; background: var(--grid); }
.file-ico { width: 52px; height: 52px; flex: none; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; letter-spacing: .02em; }
.attach-info { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.attach-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-size { font-size: 13px; color: var(--ink-2); }
.attach-bar[hidden], .attach-err[hidden] { display: none; }
.attach-bar { display: block; height: 5px; border-radius: 3px; background: var(--grid); overflow: hidden; margin-top: 3px; }
.attach-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.attach-err { font-size: 13px; color: var(--error); font-weight: 700; }
.attach-item.is-error { border-color: var(--error); background: var(--error-soft); }
.attach-item.is-removing { opacity: .5; }
.attach-remove { flex: none; background: none; border: 0; color: var(--ink-2); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 6px; }
.attach-remove:hover { color: var(--error); }
.attach-remove:disabled { visibility: hidden; }

/* ---------- Errores ---------- */
body.estudiante .error { color: var(--error); font-weight: 700; font-size: 16px; margin: 10px 0 0; display: flex; gap: 8px; align-items: center; }
body.estudiante .error[hidden] { display: none; }
body.estudiante .error::before { content: "!"; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--error); color: #fff; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.server-alert { position: fixed; top: 110px; left: 50%; transform: translateX(-50%); z-index: 9; background: var(--error); color: #fff; font-weight: 700; padding: 10px 18px; border-radius: 10px; animation: fade-out 1s 5s forwards; }
@keyframes fade-out { to { opacity: 0; visibility: hidden; } }

/* ---------- Revisión ---------- */
.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 24px; }
.review-item { background: #fff; border: 1px solid var(--line-2); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.review-item.is-missing { border-color: var(--error); background: var(--error-soft); }
.review-q { margin: 0; font-weight: 700; font-size: 15px; line-height: 1.35; }
.review-a { margin: 0; font-size: 15px; color: var(--ink-2); line-height: 1.5; white-space: pre-line; flex: 1; }
.review-files { margin: 0; font-size: 14px; font-weight: 700; color: var(--accent); }
.review-item.is-missing .review-a { color: var(--error); font-weight: 700; }
.review-edit { align-self: flex-start; background: none; border: 0; padding: 4px 0; color: var(--accent); font: inherit; font-size: 15px; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- Navegación inferior ---------- */
.wizard-nav {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  min-height: 76px; padding: 12px var(--gutter);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line-2);
}
.wizard-nav button { font: inherit; font-size: 17px; font-weight: 700; border-radius: 12px; padding: 13px 26px; cursor: pointer; border: 1.5px solid transparent; }
.btn-back { background: #fff; color: var(--ink); border-color: var(--line-2) !important; }
.btn-back:hover { border-color: var(--ink) !important; }
.draft-status { flex: 1; text-align: center; font-size: 14px; color: var(--ink-2); }
.btn-review { background: #fff; color: var(--accent); border-color: var(--accent) !important; }
.btn-next, .btn-submit { background: var(--accent); color: #fff; min-width: 170px; }
.btn-submit { background: var(--ok); }
.btn-next:hover, .btn-submit:hover { filter: brightness(1.08); }
.btn-submit:disabled { opacity: .7; cursor: progress; }
.wizard-nav button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.wizard-nav [hidden] { display: none; }
html:not(.js) .btn-back, html:not(.js) .btn-next, html:not(.js) .btn-review { display: none; }

/* ---------- Páginas simples (gracias / cerrado) ---------- */
body.estudiante.simple .wrap { padding: 0 var(--gutter); }
body.estudiante.simple .card.center { background: #fff; border: 1px solid var(--line-2); border-radius: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  body.estudiante { font-size: 17px; }
  .progress-track { gap: 4px; }
  .seg { height: 26px; font-size: 12px; border-radius: 6px; }
  .topbar-title { display: none; }
  .wizard-nav { gap: 8px; padding: 10px 12px; }
  .wizard-nav button { padding: 12px 16px; font-size: 16px; }
  .btn-next, .btn-submit { min-width: 0; flex: 1; }
  .draft-status { display: none; }
  .review-list, .attach-list { grid-template-columns: 1fr; }
  .choice { padding: 14px; }
  .consent-toggle { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .js .step.is-active { animation: none; }
  .seg, .attach-bar span { transition: none; }
}
