:root {
  --bg: #fbfaf7; --fg: #1f2933; --muted: #52606d; --card: #ffffff; --line: #d9d6cf;
  --accent: #1d5fa8; --accent-fg: #ffffff; --ok: #1f7a3d; --ok-bg: #e6f4ea;
  --red: #b3261e; --red-fg: #ffffff; --warn-bg: #fff4d6; --warn-line: #b7791f;
  --ill-bg: #e8eef7; --hl: #dbe8f7;
  --gap: 16px; --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191d; --fg: #eef1f4; --muted: #b4bcc5; --card: #20252b; --line: #3a424b;
    --accent: #7ab4f0; --accent-fg: #0b1620; --ok: #7fd49a; --ok-bg: #1c3425;
    --ill-bg: #243041; --hl: #2b3f58;
    --red: #e0564d; --red-fg: #1a0806; --warn-bg: #3a2f12; --warn-line: #e0b252;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main, header, footer { max-width: 640px; margin: 0 auto; padding: 0 var(--gap); }
header { padding-top: var(--gap); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 1rem 0 .5rem; }
h2 { font-size: 1.3rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1.15rem; margin: 0 0 .25rem; }
p { margin: .5rem 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn, .btn-ghost {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 12px 16px; border-radius: var(--radius);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; border: 2px solid transparent; width: 100%;
}
.btn { background: var(--accent); color: var(--accent-fg); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
/* Botón de emergencia flotante: arranca grande con texto y se achica a un círculo rojo con "!". Funciona sin JS. */
.sos { position: fixed; z-index: 20; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px;
  min-width: 60px; min-height: 60px; max-width: calc(100vw - 32px); padding: 8px 20px 8px 8px; border-radius: 999px;
  background: var(--red); color: var(--red-fg); font-weight: 700; font-size: 1.05rem; text-decoration: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: sos-shrink 1s cubic-bezier(.65,0,.35,1) 2.5s forwards; }
.sos-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; background: rgba(255,255,255,.18); }
.sos-text { overflow: hidden; line-height: 1.2; max-height: 2.4em; width: max-content; max-width: min(17em, calc(100vw - 120px)); animation: sos-text 1s cubic-bezier(.65,0,.35,1) 2.5s forwards; }
@keyframes sos-shrink { to { padding: 8px; gap: 0; } }
@keyframes sos-text { 35% { opacity: 0; } to { max-width: 0; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sos, .sos-text { animation-duration: .01s; } }
.in-guide .sos { bottom: calc(96px + env(safe-area-inset-bottom)); }
main { padding-bottom: 80px; }
.counter { color: var(--muted); margin: 0 0 var(--gap); }
.task { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--gap); margin: 0 0 var(--gap); }
.task.done { border-color: var(--ok); background: var(--ok-bg); }
.why { color: var(--muted); }
.steps { padding-left: 1.4rem; margin: .75rem 0; }
.steps li { margin: .6rem 0; }
.steps .btn { margin: .5rem 0; width: auto; display: inline-flex; }
.os-label { font-weight: 700; }
.js .os-label { display: none; }
.win { background: var(--ok-bg); border-left: 4px solid var(--ok); padding: 8px 12px; border-radius: 6px; }
.warning { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px var(--gap); margin: var(--gap) 0; }
.os-tabs { display: flex; gap: 8px; margin: .5rem 0; }
.os-tabs button { flex: 1; min-height: 44px; font: inherit; border: 2px solid var(--accent); background: transparent; color: var(--accent); border-radius: var(--radius); cursor: pointer; }
.os-tabs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 0; }
.progress > span { display: block; height: 100%; background: var(--ok); }
.guide { display: grid; gap: 12px; padding-bottom: 110px; }
.guide .steps { list-style: none; padding: 0; }
.back { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; flex: none; }
footer { color: var(--muted); font-size: 1rem; padding-top: var(--gap); padding-bottom: 32px; }
/* emergencia */
.em-steps { list-style: none; padding: 0; margin: var(--gap) 0; counter-reset: em; }
.em-step { counter-increment: em; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--gap); margin: 0 0 var(--gap); }
.em-step h2 { margin-top: 0; }
.em-step h2::before { content: counter(em) ". "; }
.em-step .btn { margin: .5rem 0; }
@media (min-width: 700px) { body { font-size: 19px; } }
/* utilidades y modo guía (JS) */
[hidden] { display: none !important; }
.js .task > .steps, .js .task > .win { display: none; }
.min { color: var(--muted); margin: 0 0 .25rem; font-size: 1rem; }
.actions { display: grid; gap: 8px; margin-top: 12px; }
.status { color: var(--ok); font-weight: 700; }
.guide h3 { font-size: 1.3rem; }
.guide .step-count { color: var(--muted); font-size: 1rem; font-weight: 600; letter-spacing: .02em; margin: 16px 0 2px; }
.guide .done-screen { text-align: center; display: grid; gap: 12px; }
.guide .emoji { font-size: 3rem; line-height: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Pasos: título, texto y aclaración (también sin JS) */
.steps h4 { font-size: 1.1rem; line-height: 1.25; margin: 0 0 .25rem; }
.steps p { margin: 0 0 .5rem; }
.hint { color: var(--muted); }
.guide .steps h4 { font-size: 1.5rem; margin: 2px 0 10px; }
.guide .steps p { margin: 0 0 12px; }
.guide .steps li:focus { outline: none; }
.guide-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.guide-top h3 { margin: 0; font-size: 1rem; font-weight: 400; color: var(--muted); text-align: right; }
/* Dibujos simples de lo que se va a ver en pantalla (no son capturas) */
.ill { margin: 0 0 .75rem; padding: 16px; border-radius: 18px; background: var(--ill-bg); display: flex; justify-content: center; }
.mini { width: 100%; max-width: 280px; background: var(--card); border-radius: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 10px 12px; font-size: 1rem; }
.mini-t { font-weight: 700; margin-bottom: 6px; }
.srch { display: flex; gap: 6px; align-items: center; border: 2px solid var(--accent); border-radius: 999px; padding: 5px 12px; }
.res { margin-top: 8px; padding: 7px 10px; border-radius: 8px; background: var(--hl); font-weight: 600; }
.mini .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.mini .row:last-child { border-bottom: 0; }
.mini .row.hl { background: var(--hl); border-radius: 8px; padding-left: 8px; padding-right: 8px; font-weight: 600; }
.switch { flex: none; position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--ok); }
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; }
/* Barra inferior fija */
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 12px var(--gap) calc(12px + env(safe-area-inset-bottom)); }
.bar-in { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; }
.pill { min-height: 52px; border-radius: 999px; font: inherit; font-weight: 700; padding: 0 20px; cursor: pointer; border: 2px solid transparent; }
.pill.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.pill.pri, .pill.go { flex: 1; }
.pill.pri { background: var(--accent); color: var(--accent-fg); }
.pill.go { background: var(--ok); color: #fff; }
@media (prefers-color-scheme: dark) { .pill.go { color: #06210f; } }
.in-guide header, .in-guide footer { display: none; }
.guide-top h3:focus { outline: none; }
.tiles { display: flex; gap: 6px; }
.tiles span { flex: 1; text-align: center; padding: 10px 2px; border-radius: 10px; background: var(--ill-bg); font-size: .85rem; font-weight: 600; }
.tiles .hl, .topbar .hl { background: var(--hl); outline: 2px solid var(--accent); }
.topbar { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.topbar span { padding: 4px 8px; border-radius: 8px; background: var(--ill-bg); }
.topbar .sp { flex: 1; background: none; }
.mini-t.big { font-size: 1.3rem; }
.ill.shot { padding: 0; background: none; }
/* La captura entera siempre entra en la pantalla: nunca más ancha que la columna ni más alta que ~40% del alto visible. */
.ill.shot img { display: block; width: auto; height: auto; max-width: 100%; max-height: 40vh; max-height: 40dvh; margin: 0 auto; border-radius: 14px; border: 1px solid var(--line); }
/* Stepper de las 3 tareas principales (lo dibuja app.js; sin JS no aparece). */
.stepper { list-style: none; display: flex; padding: 0; margin: 28px 0 8px; counter-reset: none; }
.stepper li { flex: 1; position: relative; text-align: center; }
.stepper li + li::before { content: ""; position: absolute; top: 20px; right: calc(50% + 24px); left: calc(-50% + 24px); height: 3px; border-radius: 2px; background: var(--line); }
.stepper li.done + li::before { background: var(--ok); }
.stepper button { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 1rem; cursor: pointer; }
.stepper .dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--line); background: var(--card); color: var(--muted); }
.stepper .done .dot { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.stepper .done button { color: var(--fg); }
.stepper .current .dot { border-color: var(--accent); color: var(--accent); }
.stepper .current button { color: var(--fg); font-weight: 600; }
