/* Identidad Andén Microlearning (kit 2.0): azul, turquesa y ámbar; burbujas A/B/C. La app vive en una columna de celular. */
:root {
  --paper: #F8F7F2; --ink: #153650; --muted: #4E6273; --line: #D6E3E4;
  --accent: #0F7F74; --ok: #2E7A4D; --bad: #B3402F; --card: #ffffff; --graphite: #153650;
  --amber: #EAAE55; --amber-ink: #8A5A10; --mk1: #153650; --mk2: #20B9A8;
  --font-display: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Montserrat", "Segoe UI", system-ui, sans-serif; /* etiquetas: Montserrat (antes monoespaciada) */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E2235; --ink: #EEF3F2; --muted: #A6B8C4; --line: #24445C;
    --accent: #3FD0BE; --ok: #6CC892; --bad: #FF8A75; --card: #153650; --graphite: #DDE7EA;
    --amber: #EAAE55; --amber-ink: #EAAE55; --mk1: #20B9A8; --mk2: #65DACB; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E2235; --ink: #EEF3F2; --muted: #A6B8C4; --line: #24445C;
    --accent: #3FD0BE; --ok: #6CC892; --bad: #FF8A75; --card: #153650; --graphite: #DDE7EA;
    --amber: #EAAE55; --amber-ink: #EAAE55; --mk1: #20B9A8; --mk2: #65DACB; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: color-mix(in srgb, var(--line) 35%, var(--paper)); color: var(--ink); font-family: var(--font-body); font-size: 1.02rem; line-height: 1.55; }
.phone { max-width: 440px; height: 100%; margin: 0 auto; background: var(--paper); display: grid; grid-template-rows: auto 1fr auto; border-inline: 1px solid var(--line); }
@media (min-width: 520px) { .phone { height: calc(100% - 32px); margin: 16px auto; border: 2px solid var(--ink); border-radius: 28px; overflow: hidden; } }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; }
.brand .logo { width: 112px; height: auto; aspect-ratio: 428 / 154; flex: none; display: block; }
.streak { font-family: var(--font-mono); font-size: 0.8rem; color: var(--amber-ink); font-weight: 600; }
main { overflow-y: auto; padding: 18px; display: grid; gap: 16px; align-content: start; }
nav.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: var(--card); }
nav.tabs button { border: 0; background: transparent; padding: 12px 6px 14px; font: inherit; font-size: 0.85rem; color: var(--muted); cursor: pointer; display: grid; justify-items: center; gap: 2px; }
nav.tabs button .ic { width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.7rem; }
nav.tabs button[aria-current="page"] { color: var(--accent); font-weight: 700; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.kicker { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.card.strong { border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 10px 24px -14px rgba(21, 54, 80, .45); }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; width: 100%; }
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn[disabled] { opacity: 0.45; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 300ms; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { border-left: 3px solid var(--accent); padding-left: 10px; }
.stat b { font-family: var(--font-display); font-size: 1.5rem; display: block; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.unit-title { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); font-weight: 600; margin-top: 6px; }
.session { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; color: inherit; cursor: pointer; }
.session .num { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.session .state { font-family: var(--font-mono); font-size: 0.72rem; padding: 3px 8px; border-radius: 999px; }
.state.free { background: var(--ok); color: #fff; }
.state.lock { border: 1px dashed var(--muted); color: var(--muted); }
.state.done { background: var(--ink); color: var(--paper); }
.session.locked { opacity: 0.75; }
.player-head { display: grid; gap: 8px; }
.step-type { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 600; }
.lead { font-size: 1.08rem; }
.quote { border-left: 4px solid var(--accent); padding: 8px 12px; background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 10px 10px 0; font-style: italic; }
ul.clean { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
ul.clean li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; }
ul.clean li .b { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.7rem; margin-top: 2px; }
.tag-norm { display: inline-block; font-family: var(--font-mono); font-size: 0.78rem; border: 1px solid var(--ink); border-radius: 6px; padding: 2px 8px; }
.opts { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; color: inherit; cursor: pointer; }
.opt[disabled] { cursor: default; }
.bubble { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; font-family: var(--font-mono); font-weight: 600; color: var(--accent); position: relative; overflow: hidden; }
.bubble::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--graphite); transform: scale(0); transition: transform 260ms cubic-bezier(.3,1.4,.5,1); }
.bubble span { position: relative; z-index: 1; }
.opt.picked .bubble::after { transform: scale(1); }
.opt.picked .bubble { color: var(--paper); }
.opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--card)); }
.opt.right .bubble { border-color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--card)); }
.fb { padding: 12px 14px; border-left: 4px solid var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); border-radius: 0 10px 10px 0; font-size: 0.95rem; display: grid; gap: 4px; }
.fb.bad { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, transparent); }
.foot { display: grid; grid-template-columns: auto 1fr; gap: 10px; position: sticky; bottom: 0; padding-top: 8px; background: linear-gradient(transparent, var(--paper) 30%); }
.foot .btn.ghost { width: auto; }
.flash { perspective: 800px; }
.flash .inner { min-height: 170px; display: grid; place-items: center; text-align: center; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); cursor: pointer; font-size: 1.1rem; box-shadow: 0 10px 24px -16px rgba(21, 54, 80, .4); }
.flash .inner.back { background: color-mix(in srgb, var(--ok) 8%, var(--card)); }
.qr { width: 150px; height: 150px; border: 2px dashed var(--muted); border-radius: 12px; display: grid; place-items: center; text-align: center; font-size: 0.8rem; color: var(--muted); padding: 10px; margin: 0 auto; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.3rem; font-weight: 600; letter-spacing: 0.08em; text-align: center; border: 2px solid var(--ink); border-radius: 10px; padding: 8px; }
.pill { display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: #fff; }
nav.tabs { grid-template-columns: repeat(4, 1fr); }
.level { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.level .roman { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--accent); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: var(--accent); background: var(--card); }
.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 4px; background: var(--card); }
.badge .seal { width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--muted); display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.badge.on { border-color: var(--ok); }
.badge.on .seal { border: 2px solid var(--ok); background: var(--ok); color: #fff; }
.badge b { font-size: 0.92rem; }
.badge span { font-size: 0.8rem; color: var(--muted); }
.goal-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.goal-opts button { border: 1px solid var(--ink); background: transparent; color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.goal-opts button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.dots { display: flex; gap: 6px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.dots i.on { background: var(--accent); }
table.rank { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.rank td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.rank td:last-child { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.rank tr.me td { font-weight: 700; color: var(--accent); }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
.field { display: grid; gap: 4px; font-size: 0.9rem; }
.field input, .field select { font: inherit; padding: 8px 10px; border: 1px solid var(--muted); border-radius: 10px; background: var(--paper); color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); pointer-events: none; box-shadow: 0 10px 24px -10px rgba(0,0,0,.4); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 0.92rem; z-index: 20; max-width: 90vw; text-align: center; }
.note { font-size: 0.8rem; color: var(--muted); border: 1px dashed var(--muted); border-radius: 10px; padding: 8px 10px; }
input[type="file"] { font: inherit; font-size: 0.9rem; }
@media (prefers-reduced-motion: reduce) { .bubble::after, .bar span { transition: none; } }

/* ---- Agregados de la app real ---- */
body.guest nav.tabs, body.guest .streak { visibility: hidden; }
.brand { color: inherit; text-decoration: none; }
.prose p, .prose li { margin: 0 0 0.6em; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 0.8em; }
.prose h4 { font-family: var(--font-display); margin: 0.8em 0 0.4em; }
.tw { overflow-x: auto; margin: 0.4em 0 0.9em; }
.tw table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.tw th, .tw td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.tw th { background: color-mix(in srgb, var(--line) 40%, var(--card)); }
.big { font-family: var(--font-display); font-size: 3rem; font-weight: 800; margin: 0.2em 0; }
.err { color: var(--bad); font-weight: 700; min-height: 1em; margin: 0; }
.link { border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.85rem; cursor: pointer; padding: 0; }
details.card summary { cursor: pointer; }
details.case[open] summary { margin-bottom: 8px; }
.review-item .mark { font-weight: 800; color: var(--ok); }
.review-item.bad .mark { color: var(--bad); }
.session.exam .num { font-size: 1rem; }
.qr-img { display: block; width: 220px; max-width: 100%; margin: 8px auto; border-radius: 12px; }
a.btn { text-align: center; text-decoration: none; display: block; }
.phone { height: 100dvh; }
@media (min-width: 520px) { .phone { height: calc(100dvh - 32px); } }

/* ---- Accesibilidad ---- */
:root { --fs: 1; }
html { font-size: calc(100% * var(--fs)); }
@media (min-width: 520px) { .phone { max-width: calc(440px * max(1, var(--fs))); } }
.top-right { display: flex; align-items: center; gap: 10px; }
.a11y-btn { border: 2px solid var(--ink); background: var(--card); color: var(--ink); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.a11y-panel { padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--card); display: grid; gap: 10px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { min-width: 48px; min-height: 44px; border: 2px solid var(--ink); background: transparent; color: var(--ink); border-radius: 10px; font-family: var(--font-body); font-weight: 700; cursor: pointer; padding: 4px 12px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.listen { justify-self: start; border: 1.5px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; margin-bottom: -8px; min-height: 40px; }
.listen[aria-pressed="true"] { background: var(--accent); color: #fff; }
.phone { grid-template-rows: auto auto 1fr auto; }
.phone > .top { grid-row: 1; } .phone > .a11y-panel { grid-row: 2; } .phone > main { grid-row: 3; } .phone > nav.tabs { grid-row: 4; }
.top { flex-wrap: nowrap; padding: 10px 16px; }

/* ---- Tablet y computadora ---- */
@media (min-width: 700px) {
  .phone { max-width: min(780px, calc(100% - 32px)); }
  main { padding: 24px 32px; }
  .badges { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
  body { background: var(--paper); }
  .phone { max-width: none; width: 100%; height: 100dvh; margin: 0; border: 0; border-radius: 0;
    grid-template-columns: 250px 1fr; grid-template-rows: auto auto 1fr; }
  .phone > .top { grid-column: 1 / -1; grid-row: 1; padding: 14px 28px; }
  .phone > .a11y-panel { grid-column: 1 / -1; grid-row: 2; padding: 16px 28px; }
  .a11y-panel > * { max-width: 520px; }
  .phone > nav.tabs { grid-column: 1; grid-row: 3; display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; border-top: 0; border-right: 1px solid var(--line); }
  nav.tabs button { display: flex; align-items: center; gap: 12px; padding: 12px 14px; font-size: 1rem; border-radius: 12px; text-align: left; }
  nav.tabs button[aria-current="page"] { background: color-mix(in srgb, var(--accent) 10%, transparent); }
  .phone > main { grid-column: 2; grid-row: 3; padding: 32px max(32px, calc((100% - 860px) / 2)); }
  body.guest .phone > nav.tabs { display: none; }
  body.guest .phone > main { grid-column: 1 / -1; padding-inline: max(32px, calc((100% - 560px) / 2)); }
  .toast { bottom: 120px; left: calc(50% + 125px); }
  h1 { font-size: 2rem; }
  .foot { max-width: 560px; margin-left: auto; width: 100%; }
}

.welcome-logo { width: 280px; max-width: 80%; height: auto; aspect-ratio: 428 / 196; flex: none; display: block; margin: 8px auto 4px; }
.guest .top .brand { visibility: hidden; }

/* ---- Andén 1.1 ---- */
nav.tabs button svg.ic { width: 24px; height: 24px; border: 0; border-radius: 0; }
nav.tabs button[aria-current="page"] svg.ic { stroke-width: 2.4; }
nav.tabs button[aria-current="page"] { position: relative; }
@media (max-width: 999px) { nav.tabs button[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); } }
.streak { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 700; font-size: 0.78rem; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--amber) 18%, var(--card)); color: var(--amber-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.streak svg { width: 14px; height: 14px; color: var(--amber); }
.streak .sep { opacity: .5; margin: 0 2px; }
.top-right { gap: 8px; }
.a11y-btn { border: 1.5px solid var(--line); padding: 4px 11px; min-height: 32px; }
.kicker, .step-type, .unit-title { font-weight: 700; letter-spacing: 0.1em; }
.steps { display: flex; align-items: flex-end; gap: 4px; height: 26px; }
.steps i { flex: 1; height: calc(8px + var(--i) * 1.8px); border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--mk2); }
.steps i.on:nth-child(odd) { background: var(--accent); }
.opt.right .bubble::after, .opt.wrong .bubble::after { transform: scale(1); inset: -2px; }
.opt.right .bubble::after { background: var(--ok); }
.opt.wrong .bubble { border-color: var(--bad); }
.opt.wrong .bubble::after { background: var(--bad); }
.opt.right .bubble span, .opt.wrong .bubble span { visibility: hidden; }
.opt.right .bubble::before, .opt.wrong .bubble::before { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1rem; }
.opt.right .bubble::before { content: "✓"; }
.opt.wrong .bubble::before { content: "✕"; }
.opt.wrong { border-width: 2px; }
.opt.right { border-width: 2px; }
