/* 4kiscan · estilos
 * Idea visual: un dictamen. La regla lateral de cada dato dice de dónde viene:
 * continua = verificado en la red, punteada = lo declaró el cliente,
 * rayada = inferido. Es lo único decorativo que lleva significado.
 */
:root {
  --ink: #12232c;
  --ink-soft: #3b5059;
  --paper: #f3f7f8;
  --surface: #ffffff;
  --rule: #c3d0d5;
  --accent: #17587c;
  --accent-ink: #ffffff;
  --focus: #0b6bcb;

  --ok: #17734a;
  --attention: #965f00;
  --problem: #ad3328;
  --wait: #33579f;
  --unknown: #53656d;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.6rem;
  --step-3: clamp(1.8rem, 1.2rem + 2.6vw, 2.6rem);
  --gap: 1.25rem;
  --radius: 4px;
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e5eef1;
    --ink-soft: #b4c6cd;
    --paper: #0d191f;
    --surface: #14252d;
    --rule: #2f4650;
    --accent: #7fc4e8;
    --accent-ink: #08202b;
    --focus: #8fc2ff;
    --ok: #62c997;
    --attention: #e6b04e;
    --problem: #f28f83;
    --wait: #93b4f0;
    --unknown: #9db1b9;
  }
}
:root[data-theme="dark"] {
  --ink: #e5eef1; --ink-soft: #b4c6cd; --paper: #0d191f; --surface: #14252d; --rule: #2f4650;
  --accent: #7fc4e8; --accent-ink: #08202b; --focus: #8fc2ff;
  --ok: #62c997; --attention: #e6b04e; --problem: #f28f83; --wait: #93b4f0; --unknown: #9db1b9;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--step-0) / 1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
button { font: inherit; color: inherit; }

.skip-link { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 20; }
.skip-link:focus { top: 0.75rem; }

/* ───── Cabecera ───── */
.masthead { border-bottom: 1px solid var(--rule); background: var(--surface); }
.masthead__inner { max-width: 66rem; margin: 0 auto; padding: 0.75rem 1rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none; }
.brand__mark rect { fill: var(--ink); }
.brand__mark path { fill: none; stroke: #7fd0f0; stroke-width: 2.4; }
.brand__name { font: 700 1.2rem var(--serif); letter-spacing: 0.01em; }
.masthead__tag { color: var(--ink-soft); font-size: var(--step--1); flex: 1; }
.language-picker { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--ink-soft); font-size: var(--step--1); }
.language-picker select { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 0.35rem 0.45rem; }
.link-status { display: inline-flex; align-items: center; gap: 0.5rem; border: 1px solid var(--rule); background: transparent; padding: 0.4rem 0.75rem; border-radius: 999px; cursor: pointer; font-size: var(--step--1); }
.link-status__dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--unknown); }
.link-status[data-state="on"] .link-status__dot { background: var(--ok); }
.link-status[data-state="off"] .link-status__dot { background: transparent; border: 2px solid var(--attention); }

/* ───── Estructura ───── */
.layout { flex: 1; width: 100%; max-width: 66rem; margin: 0 auto; padding: 2rem 1rem 3rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-items: start; }
.layout[data-has-transcript="true"] { grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); }
.stage { min-width: 0; max-width: 42rem; outline: none; }
.foot { max-width: 66rem; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; color: var(--ink-soft); font-size: var(--step--1); border-top: 1px solid var(--rule); width: 100%; }
.foot p { max-width: 46rem; }

/* ───── Transcripción (lo que llevamos) ───── */
.transcript { position: sticky; top: 1rem; font-size: var(--step--1); max-height: calc(100vh - 2rem); overflow-y: auto; padding-right: 0.5rem; }
.transcript__title { font: 600 var(--step-0) var(--serif); margin-bottom: 0.75rem; }
.transcript__list { border-left: 1px solid var(--rule); }
.transcript__item { padding: 0.55rem 0 0.55rem 0.9rem; position: relative; }
.transcript__item::before { content: ""; position: absolute; left: -4px; top: 0.95rem; width: 7px; height: 7px; border-radius: 50%; background: var(--rule); }
.transcript__q { color: var(--ink-soft); }
.transcript__a { font-weight: 600; overflow-wrap: anywhere; }
.transcript__a--none { font-weight: 400; color: var(--ink-soft); font-style: italic; }
.transcript__edit { margin-top: 0.15rem; background: none; border: 0; padding: 0.2rem 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; font-size: var(--step--1); }
.transcript__note { margin-top: 0.35rem; padding: 0.45rem 0.6rem; border-left: 2px solid var(--attention); background: color-mix(in srgb, var(--attention) 9%, var(--surface)); }
.transcript__note--error { border-color: var(--problem); background: color-mix(in srgb, var(--problem) 9%, var(--surface)); }
.transcript__note strong { display: block; }
.transcript details > summary { cursor: pointer; font-weight: 600; padding: 0.4rem 0; }

/* ───── Texto de la entrevista ───── */
.lead { font: var(--step-3) / 1.15 var(--serif); font-weight: 600; letter-spacing: -0.01em; max-width: 24ch; }
.prose { max-width: 62ch; }
.prose > * + * { margin-top: 0.85rem; }
.intro > * + * { margin-top: 1.1rem; }
.intro__list { display: grid; gap: 0.75rem; max-width: 60ch; margin-top: 1.5rem; }
.intro__list li { padding-left: 1rem; border-left: 2px solid var(--rule); }
.intro__list strong { font-weight: 600; }

.progress { display: flex; align-items: center; gap: 0.75rem; color: var(--ink-soft); font-size: var(--step--1); margin-bottom: 1.25rem; }
.progress__bar { flex: 1; height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; max-width: 14rem; }
.progress__fill { height: 100%; background: var(--accent); transition: width 240ms ease; }

.question__prompt { font: var(--step-2) / 1.25 var(--serif); font-weight: 600; max-width: 30ch; outline: none; }
.question__help { color: var(--ink-soft); margin-top: 0.6rem; max-width: 56ch; }

.options { margin-top: 1.5rem; display: grid; gap: 0.5rem; max-width: 34rem; }
.option { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.8rem 1rem; cursor: pointer; display: flex; align-items: center; gap: 0.8rem; transition: border-color 120ms, background-color 120ms; }
.option::before { content: ""; flex: none; width: 1rem; height: 1rem; border: 2px solid var(--ink-soft); border-radius: 50%; }
.option[aria-pressed="true"] { border-color: var(--accent); }
.option[aria-pressed="true"]::before { background: radial-gradient(var(--accent) 45%, transparent 50%); border-color: var(--accent); }

.field { display: grid; gap: 0.4rem; margin-top: 1.5rem; max-width: 34rem; }
.field__label { font-weight: 600; font-size: var(--step--1); }
input[type="text"], input[type="password"], input:not([type]) { width: 100%; font: inherit; padding: 0.7rem 0.85rem; color: var(--ink); background: var(--surface); border: 1px solid var(--ink-soft); border-radius: var(--radius); }
input.mono { font-family: var(--mono); font-size: 0.95rem; }
input[aria-invalid="true"] { border-color: var(--problem); border-width: 2px; }
.error { color: var(--problem); font-weight: 600; margin-top: 0.5rem; max-width: 34rem; }
.error:empty { display: none; }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; align-items: center; }
.btn { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: var(--radius); padding: 0.65rem 1.2rem; font-weight: 600; cursor: pointer; }
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--ink-soft); font-weight: 500; }

.learn { margin-top: 1.75rem; max-width: 40rem; border-top: 1px solid var(--rule); }
.learn > summary { cursor: pointer; padding: 0.7rem 0; font-weight: 600; color: var(--accent); }
.term + .term { margin-top: 0.9rem; }
.term__name { font-weight: 600; }
.term__short { color: var(--ink-soft); }
.term details { margin-top: 0.25rem; }
.term summary { cursor: pointer; color: var(--accent); font-size: var(--step--1); }
.term details p { margin-top: 0.4rem; }

/* ───── Verificación en curso ───── */
.steps { margin-top: 1.5rem; display: grid; gap: 0.55rem; max-width: 34rem; }
.steps li { display: flex; gap: 0.7rem; align-items: baseline; color: var(--ink-soft); }
.steps li[data-state="active"] { color: var(--ink); font-weight: 600; }
.steps__mark { flex: none; width: 1.1rem; text-align: center; font-family: var(--mono); }
.steps li[data-state="active"] .steps__mark { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ───── Dictamen ───── */
.verdict { border-top: 3px solid var(--tone, var(--unknown)); padding-top: 1.25rem; --tone: var(--unknown); }
.verdict[data-level="ok"] { --tone: var(--ok); }
.verdict[data-level="attention"] { --tone: var(--attention); }
.verdict[data-level="problem"] { --tone: var(--problem); }
.verdict[data-level="wait"] { --tone: var(--wait); }
.verdict__row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; }
.stamp { display: inline-block; font: 700 var(--step-0) var(--serif); color: var(--tone); border: 2px solid var(--tone); border-radius: var(--radius); padding: 0.2rem 0.7rem; transform: rotate(-1.5deg); animation: press 380ms cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes press { from { transform: rotate(-4deg) scale(1.35); opacity: 0; } to { transform: rotate(-1.5deg) scale(1); opacity: 1; } }
.verdict__confidence { color: var(--ink-soft); font-size: var(--step--1); }
.verdict__headline { font: var(--step-3) / 1.12 var(--serif); font-weight: 600; letter-spacing: -0.012em; margin-top: 0.9rem; max-width: 22ch; outline: none; }

.section { margin-top: 2.25rem; }
.section__title { font: 600 var(--step-1) var(--serif); margin-bottom: 0.75rem; }
.section__sub { color: var(--ink-soft); font-size: var(--step--1); margin: -0.4rem 0 0.9rem; max-width: 56ch; }

.pair { display: grid; gap: 1rem; margin-top: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .pair { grid-template-columns: 1fr 1fr; } }
.panel { border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius); padding: 0.9rem 1rem; }
.panel__label { font-size: var(--step--1); color: var(--ink-soft); }
.panel__value { font: 600 var(--step-1) / 1.3 var(--serif); margin-top: 0.15rem; }
.panel__text { margin-top: 0.35rem; font-size: var(--step--1); color: var(--ink-soft); }

.alert { border: 1px solid var(--tone); border-left-width: 6px; background: color-mix(in srgb, var(--tone) 8%, var(--surface)); padding: 0.8rem 1rem; border-radius: var(--radius); --tone: var(--attention); }
.alert--critical { --tone: var(--problem); }
.alert + .alert { margin-top: 0.6rem; }
.alert--info { --tone: var(--wait); }
.flash { margin-bottom: 1.25rem; }
.alert strong { display: block; }

/* Libro de comprobaciones: la regla lateral expresa el origen del dato */
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: var(--step--1); color: var(--ink-soft); margin-bottom: 1rem; }
.legend li { display: inline-flex; align-items: center; gap: 0.5rem; }
.rule-sample { display: inline-block; width: 0; height: 1.1rem; border-left: 3px solid var(--ink); }
.rule-sample--declared, .ledger__item[data-basis="declared"], .facts__row[data-basis="declared"] { border-left-style: dashed; }
.rule-sample--inferred, .ledger__item[data-basis="inferred"], .facts__row[data-basis="inferred"] { border-left-style: dotted; }
.ledger { display: grid; gap: 0.85rem; }
.ledger__item, .facts__row { border-left: 3px solid var(--ink); padding: 0.1rem 0 0.1rem 0.9rem; }
.ledger__head { display: flex; flex-wrap: wrap; gap: 0.4rem 0.7rem; align-items: baseline; }
.status { font-size: var(--step--1); font-weight: 700; color: var(--tone, var(--unknown)); border: 1px solid currentColor; border-radius: 999px; padding: 0 0.55rem; white-space: nowrap; }
.status[data-status="ok"] { --tone: var(--ok); }
.status[data-status="warning"] { --tone: var(--attention); }
.status[data-status="problem"] { --tone: var(--problem); }
.status[data-status="info"] { --tone: var(--wait); }
.ledger__title { font-weight: 600; }
.ledger__detail { color: var(--ink-soft); margin-top: 0.2rem; max-width: 60ch; }
.ledger__meta { margin-top: 0.3rem; font-size: var(--step--1); color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }
.ledger__meta a { color: var(--accent); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; }
.chips a { white-space: nowrap; }

.bullets--after { margin-top: 0.9rem; }
.section__title--minor { margin-top: 1.25rem; font-size: var(--step-0); }
.term__long { margin-top: 0.5rem; }
.facts { display: grid; gap: 0.6rem; }
.facts__row dt { font-size: var(--step--1); color: var(--ink-soft); }
.facts__row dd { overflow-wrap: anywhere; font-weight: 500; }
.facts__row dd.mono { font-family: var(--mono); font-size: 0.9rem; }

.steps-list { counter-reset: s; display: grid; gap: 0.7rem; }
.steps-list li { counter-increment: s; display: grid; grid-template-columns: 1.8rem 1fr; gap: 0.4rem; max-width: 60ch; }
.steps-list li::before { content: counter(s) "."; font: 600 var(--step-0) var(--serif); color: var(--accent); }

.bullets { display: grid; gap: 0.5rem; max-width: 60ch; }
.bullets li { padding-left: 1rem; position: relative; }
.bullets li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 5px; height: 1px; background: var(--ink-soft); }

.result-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.toast { color: var(--ok); font-weight: 600; align-self: center; }

/* ───── Diálogo ───── */
dialog { width: min(34rem, calc(100vw - 2rem)); border: 1px solid var(--rule); border-radius: 6px; padding: 0; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgb(8 18 24 / 0.55); }
.settings { padding: 1.5rem; display: grid; gap: 0.9rem; }
.settings h2 { font: 600 var(--step-2) var(--serif); }
.settings .field, .settings .actions { margin-top: 0; max-width: none; }
.check { display: flex; gap: 0.6rem; align-items: center; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.note { font-size: var(--step--1); color: var(--ink-soft); }
.settings__result { min-height: 1.5em; font-weight: 600; }
.settings__result[data-kind="ok"] { color: var(--ok); }
.settings__result[data-kind="error"] { color: var(--problem); }

/* ───── Responsive y preferencias ───── */
@media (max-width: 56rem) {
  .layout[data-has-transcript="true"] { grid-template-columns: minmax(0, 1fr); }
  .transcript { position: static; max-height: none; overflow: visible; border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius); padding: 0 0.9rem; }
  .masthead__tag { display: none; }
  .masthead__inner { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .masthead, .foot, .transcript, .result-actions, .skip-link, .learn { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { display: block; padding: 0; }
}


/* ═════════ Adaptación por dispositivo ═════════ */

/* Base común: tacto, texto largo y apartados plegables */
body { padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
html { scroll-padding-top: 1rem; }
button, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.stage { overflow-wrap: anywhere; }
.option__label { flex: 1; min-width: 0; }
.option__key { display: none; }
.question__nav { margin: 0 0 0.6rem; }
.backlink { background: none; border: 0; padding: 0.35rem 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; font-size: var(--step--1); }
.toast:empty { display: none; }
.ledger__meta a, .chips a { display: inline-block; padding-block: 0.3rem; }

.fold__summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.25rem; }
.fold__summary::-webkit-details-marker { display: none; }
.fold__summary::after { content: ""; flex: none; width: 0.55rem; height: 0.55rem; margin-right: 0.3rem; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg); transition: transform 160ms; }
.fold[open] > .fold__summary::after { transform: rotate(-135deg); }
.fold__summary .section__title { margin: 0; }
.fold__count { color: var(--ink-soft); font-weight: 400; }
.fold[open] > .fold__summary { margin-bottom: 0.75rem; }

/* El resultado es una columna en móvil y tableta; en escritorio, texto + panel lateral */
.result__layout { display: flex; flex-direction: column; }
.result__aside { display: contents; }
.pair { order: 1; }
.result__main { order: 2; }
.result__more { order: 3; display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2rem; }
.result-actions { order: 4; }

/* Interacción: puntero fino con hover vs. táctil con :active */
@media (hover: hover) {
  .link-status:hover { border-color: var(--ink-soft); }
  .option:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
  .option:hover::before { border-color: var(--accent); }
  .btn:hover { filter: brightness(1.08); }
  .btn--quiet:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); filter: none; }
  .fold__summary:hover .section__title { color: var(--accent); }
}
@media (hover: none) {
  .option:active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
  .btn:active { filter: brightness(0.92); }
  .btn--quiet:active { background: color-mix(in srgb, var(--ink) 10%, transparent); }
}
@media (pointer: coarse), (max-width: 39.99em) {
  .btn, .link-status, .brand { min-height: 2.9rem; }
  .btn { padding-block: 0.75rem; }
  .link-status { padding-inline: 0.9rem; }
  .brand { padding-block: 0.3rem; }
  .transcript__edit, .backlink { min-height: 2.75rem; padding-inline: 0.4rem; margin-left: -0.4rem; display: inline-flex; align-items: center; }
  .transcript details > summary, .term summary { padding-block: 0.8rem; }
  .chips a, .ledger__meta a, .bullets--after a { padding-block: 0.8rem; display: inline-block; }
  input[type="text"], input[type="password"], input:not([type]) { min-height: 3rem; }
  .check { min-height: 2.75rem; }
  .check input { width: 1.35rem; height: 1.35rem; }
}

/* ───── Móvil (< 40em): pulgar primero ───── */
@media (max-width: 39.99em) {
  :root { --step-0: 1.0625rem; }
  .masthead__inner { padding: calc(0.4rem + env(safe-area-inset-top)) 1rem 0.4rem; }
  .layout { padding: 1.25rem 1rem 2rem; gap: 1rem; }
  .lead, .question__prompt, .verdict__headline { max-width: none; }
  .question__prompt { font-size: 1.45rem; }
  .progress__bar { max-width: none; }
  .options { gap: 0.6rem; margin-top: 1.25rem; }
  .option { min-height: 3.5rem; padding: 0.9rem 1rem; font-size: 1.05rem; }
  .qform .actions, .intro .actions { flex-direction: column; align-items: stretch; }
  .qform .actions .btn, .intro .actions .btn { width: 100%; }
  .field { margin-top: 1.25rem; }
  .section { margin-top: 1.75rem; }
  .pair { margin-top: 1.25rem; }
  .fold-section { margin-top: 0; border-top: 1px solid var(--rule); padding-top: 0.5rem; }
  .fold-section:last-of-type { border-bottom: 1px solid var(--rule); padding-bottom: 0.5rem; }
  .fold-section + .fold-section { margin-top: 0; }
  .result__main > .section:nth-last-of-type(5) { margin-bottom: 1.75rem; }
  .fold__summary { min-height: 2.9rem; }

  /* Barra de acciones fija abajo, a alcance del pulgar */
  .result-actions { position: sticky; bottom: 0; z-index: 5; margin: 1.5rem -1rem 0; padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1.2fr; gap: 0.6rem; background: color-mix(in srgb, var(--paper) 94%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-top: 1px solid var(--rule); }
  .result-actions .btn { width: 100%; padding-inline: 0.4rem; font-size: 0.95rem; white-space: nowrap; }
  .result-actions .btn:first-child { order: 2; }
  .result-actions .btn:nth-child(2) { order: 1; }
  .result-actions .toast { grid-column: 1 / -1; text-align: center; }
  .result__more { flex-direction: column; margin-top: 1.5rem; }
  .result__more .btn { width: 100%; }
  .alert .btn { margin-top: 0.6rem; width: 100%; }

  /* El diálogo de la clave sube desde abajo, como una hoja */
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 14px 14px 0 0; max-height: 92dvh; border-bottom: 0; }
  .settings { padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); }
  .settings .actions { flex-direction: column; align-items: stretch; }
  .settings .actions .btn { width: 100%; }
  .foot { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom)); }
}

/* ───── Tableta (40em – 64em) ───── */
@media (min-width: 40em) and (max-width: 63.99em) {
  .layout { padding-inline: 1.75rem; }
  .stage { max-width: 44rem; }
  .masthead__inner, .foot { padding-inline: 1.75rem; }
}

/* ───── Escritorio (≥ 64em): texto + panel lateral que acompaña la lectura ───── */
@media (min-width: 64em) {
  .layout[data-stage="result"], body[data-stage="result"] .masthead__inner, body[data-stage="result"] .foot { max-width: 86rem; }
  .layout[data-stage="result"][data-has-transcript="true"] { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 3rem; }
  .layout[data-stage="result"] .stage { max-width: none; }
  .verdict__headline { max-width: 32ch; }
  .result__layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 3.5rem; align-items: start; }
  .result__main { order: 0; }
  .result__aside { display: block; position: sticky; top: 1rem; order: 0; }
  .result__aside .pair { order: 0; grid-template-columns: 1fr; margin-top: 2.25rem; }
  .result__aside .result-actions { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); display: grid; gap: 0.6rem; }
  .result__aside .result__more { margin-top: 0.6rem; display: grid; gap: 0.6rem; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 2rem; }
  .fold__summary { cursor: default; pointer-events: none; }
  .fold__summary::after { display: none; }
}

/* Atajos numéricos: solo donde hay teclado y puntero fino */
@media (hover: hover) and (pointer: fine) {
  .option__key { display: inline-block; flex: none; min-width: 1.5rem; text-align: center; font: 500 0.8rem var(--mono); color: var(--ink-soft); border: 1px solid var(--rule); border-radius: 3px; padding: 0.05rem 0.3rem; }
}

/* Móvil horizontal, poca altura: sin barras fijas */
@media (max-height: 30rem) and (orientation: landscape) {
  .result-actions { position: static; }
  .transcript { max-height: none; }
}

@media (forced-colors: active) {
  .stamp, .status, .alert { border: 1px solid CanvasText; }
  .option[aria-pressed="true"] { outline: 2px solid Highlight; }
  .progress__fill { background: Highlight; }
}
