/* Paleta fría de azul marino (la del icono). Cian = inglés, ámbar = teoría. */
:root {
  --bg: #f2f4f9;
  --bg-glow: #dfe9f7;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #121631;
  --muted: #646c8a;
  --line: #e1e5ef;
  --accent: #0279ad;
  --accent-soft: #e3f2fa;
  --on-accent: #ffffff;
  --en: #0279ad;
  --th: #b25b06;
  --th-soft: #fcf0e2;
  --on-th: #ffffff;
  --ok: #13804a;
  --ok-soft: #e5f5ec;
  --ko: #c3313a;
  --ko-soft: #fceaeb;
  --warn: #a86a05;
  --navy: #1e2140;
  --navy-2: #2a2e58;
  --cyan: #05a3d8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(30, 33, 64, .06), 0 8px 24px -12px rgba(30, 33, 64, .18);
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0d1a;
    --bg-glow: #13203d;
    --surface: #121629;
    --surface-2: #1a1f37;
    --text: #e8ebf6;
    --muted: #8a92b2;
    --line: #232a46;
    --accent: #2ab4e4;
    --accent-soft: #10273a;
    --on-accent: #04121b;
    --en: #2ab4e4;
    --th: #f2a440;
    --th-soft: #2b2012;
    --on-th: #1d1103;
    --ok: #3fd486;
    --ok-soft: #0f2a1d;
    --ko: #ff7178;
    --ko-soft: #321619;
    --warn: #f5c84b;
    --navy: #161a35;
    --navy-2: #222851;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -18px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 780px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 16px 28px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
h1 { font-size: 28px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; text-wrap: balance; }
h2 { font-size: 13px; font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 30px 0 12px; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
p { text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt { margin-top: 14px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* Entrada escalonada de cada vista */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#app > * { animation: rise .42s var(--ease) both; }
#app > *:nth-child(2) { animation-delay: .04s; }
#app > *:nth-child(3) { animation-delay: .08s; }
#app > *:nth-child(4) { animation-delay: .12s; }
#app > *:nth-child(5) { animation-delay: .16s; }
#app > *:nth-child(n+6) { animation-delay: .2s; }
body.running #app > * { animation: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Cabecera */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; min-height: 40px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto; box-shadow: 0 6px 16px -8px rgba(5, 163, 216, .7); }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.brand-sub { white-space: nowrap; font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.sync { font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 99px; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot.off { background: var(--warn); }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; color: var(--muted); padding: 8px 10px 8px 4px; border-radius: 10px; transition: color .15s; }
.back:hover { color: var(--text); }

/* Tarjetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }

/* Panel de repaso: fondo de radar */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 22px 24px;
  background: linear-gradient(160deg, var(--navy-2), var(--navy));
  border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
  color: #eef2ff;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.hero::before {
  content: ""; position: absolute; z-index: -1; right: -70px; top: 50%; width: 260px; height: 260px; transform: translateY(-50%);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 31px, rgba(5, 163, 216, .22) 31px 32px),
    conic-gradient(from 200deg, rgba(5, 163, 216, .38), transparent 22%);
  mask: radial-gradient(circle, #000 55%, transparent 72%);
  -webkit-mask: radial-gradient(circle, #000 55%, transparent 72%);
  animation: sweep 9s linear infinite;
}
@keyframes sweep { to { transform: translateY(-50%) rotate(360deg); } }
a.hero:hover { transform: translateY(-1px); }
a.hero:active { transform: scale(.99); }
.hero h3 { color: #fff; font-size: 17px; }
.hero .small, .hero .muted { color: #a9b2d6; }
.hero .big { font-family: var(--mono); font-size: 46px; font-weight: 600; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -.04em; text-shadow: 0 0 24px rgba(5, 163, 216, .55); }
.hero .big small { display: block; font-size: 11px; letter-spacing: .1em; text-align: right; color: #7fd3f2; text-shadow: none; margin-top: 6px; }
.hero .eyebrow { color: #7fd3f2; }

/* Tarjeta de sección: estilo ficha de progresión de vuelo */
.sec-card { position: relative; padding: 18px 18px 18px 26px; overflow: hidden; display: flex; flex-direction: column; }
.sec-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--en); }
.sec-card.th::before { background: var(--th); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec-code { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; color: var(--en); }
.sec-card.th .sec-code { color: var(--th); }
.sec-card h3 { font-size: 21px; letter-spacing: -.02em; margin-top: 2px; }
.sec-card .meta { font-size: 13px; color: var(--muted); margin: 2px 0 16px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.kpi { padding: 10px 12px; }
.kpi + .kpi { border-left: 1px dashed var(--line); }
.kpi .v { font-family: var(--mono); font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.2; }
.kpi .l { font-size: 11.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.mastery { margin: -4px 0 16px; }
.mastery .bar { height: 6px; }
.mastery .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sec-card .btns { margin-top: auto; }

.tip { position: relative; display: flex; gap: 14px; align-items: flex-start; }
.tip .tip-ico { flex: 0 0 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tip p { font-size: 14.5px; line-height: 1.6; max-width: 62ch; }
.tip b { font-weight: 600; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); font-weight: 560; font-size: 15px; letter-spacing: -.005em; transition: background .15s, border-color .15s, transform .12s var(--ease), box-shadow .15s, filter .15s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px -12px var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn.th { background: var(--th); border-color: var(--th); color: var(--on-th); box-shadow: 0 8px 20px -12px var(--th); }
.btn.th:hover:not(:disabled) { background: var(--th); filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 13px; font-size: 14px; border-radius: 11px; }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns .btn { flex: 1; }
.btn .arrow { transition: transform .2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* Chips y formularios */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; transition: background .15s, border-color .15s, color .15s, transform .12s; }
.chip:active { transform: scale(.97); }
.chip .muted { font-family: var(--mono); font-size: 12px; margin-left: 2px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.on .muted { color: inherit; opacity: .75; }
.field + .field { margin-top: 20px; }
.field > label { display: block; font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; min-height: 46px; font-size: 16px; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border-radius: 13px; padding: 4px; gap: 2px; max-width: 100%; }
.seg button { padding: 8px 14px; border-radius: 10px; font-size: 14px; color: var(--muted); transition: background .18s, color .18s, box-shadow .18s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 8px -4px rgba(0, 0, 0, .2); font-weight: 600; }
.lede { color: var(--muted); margin-top: 8px; max-width: 60ch; font-size: 15px; }

/* Sesión en curso */
.runbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.runbar .count { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--muted); }
.runbar .count b { color: var(--text); font-weight: 600; }
.runbar .score { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; padding: 4px 10px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); }
.timer { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14px; padding: 4px 10px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); }
.timer.low { color: var(--ko); border-color: var(--ko); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, transparent), var(--accent)); box-shadow: 0 0 12px var(--accent); transition: width .35s var(--ease); }
.qcard { padding: 22px 20px 20px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tag { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .02em; padding: 4px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.tag.th { background: var(--th-soft); color: var(--th); }
.tag.src { background: var(--surface-2); color: var(--muted); }
.tag.doubt { background: var(--ko-soft); color: var(--ko); }
.qtext { font-size: 18.5px; line-height: 1.5; font-weight: 500; letter-spacing: -.01em; margin-bottom: 18px; white-space: pre-line; text-wrap: pretty; }
.opt { display: flex; gap: 13px; align-items: flex-start; width: 100%; text-align: left; padding: 13px 14px; margin-bottom: 9px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-size: 15.5px; line-height: 1.45; transition: border-color .15s, background .15s, transform .12s var(--ease); }
.opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }
.opt:active:not(:disabled) { transform: scale(.99); }
.opt .k { flex: 0 0 28px; height: 28px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 13px; color: var(--muted); transition: background .15s, color .15s; }
.opt > span:last-child { padding-top: 2px; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .k { background: var(--accent); color: var(--on-accent); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); animation: pop .3s var(--ease); }
.opt.correct .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--ko); background: var(--ko-soft); animation: shake .32s var(--ease); }
.opt.wrong .k { background: var(--ko); color: #fff; }
.opt:disabled { cursor: default; }
@keyframes pop { 40% { transform: scale(1.015); } }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.exp { margin-top: 8px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border-left: 3px solid var(--accent); font-size: 14.5px; line-height: 1.6; animation: rise .3s var(--ease) both; }
.exp:has(b.ok) { border-left-color: var(--ok); }
.exp:has(b.ko) { border-left-color: var(--ko); }
.exp b.ok { color: var(--ok); }
.exp b.ko { color: var(--ko); }
.runfoot { display: flex; gap: 8px; margin-top: 16px; }
.runfoot .btn { flex: 1; }
details > summary.small { padding: 8px 2px; }
.sheet { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-top: 10px; }
.sheet button { aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; transition: background .15s; }
.sheet button.ans { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.sheet button.cur { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet button.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.sheet button.ko { background: var(--ko-soft); border-color: var(--ko); color: var(--ko); }
@media (max-width: 420px) { .sheet { grid-template-columns: repeat(8, 1fr); } }
.kbd-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 16px; }
.kbd-hint kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); }
@media (hover: none) { .kbd-hint { display: none; } }

/* Resultados */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; padding: 22px; }
.gauge { position: relative; width: 132px; height: 132px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .track { stroke: var(--surface-2); }
.gauge .val { transition: stroke-dashoffset 1s var(--ease); }
.gauge .num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .num b { font-family: var(--mono); font-size: 32px; font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge .num span { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 4px; }
.verdict { font-size: 19px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.result-hero .of { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pill { font-family: var(--mono); font-size: 12px; padding: 4px 9px; border-radius: 7px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.ko { background: var(--ko-soft); color: var(--ko); }
@media (max-width: 440px) {
  .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .result-hero .pills { justify-content: center; }
}
.ok-t { color: var(--ok); } .ko-t { color: var(--ko); }

/* Barras y listas */
.bar-row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr 52px; gap: 12px; align-items: center; padding: 8px 0; font-size: 14px; }
.bar-row + .bar-row { border-top: 1px dashed var(--line); }
.bar-row .muted.small { font-family: var(--mono); font-size: 11.5px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transform-origin: left; animation: grow .7s var(--ease) both; }
.bar.th > i { background: var(--th); }
@keyframes grow { from { transform: scaleX(0); } }
.bar-row .pct { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.list-item { padding: 13px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; padding-top: 2px; }
.list-item:last-child { padding-bottom: 2px; }
.list-item .q { font-size: 15px; line-height: 1.5; }
.list-item .a { font-size: 14px; margin-top: 6px; padding-left: 18px; }
.list-item .exp { margin-left: 18px; }
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary .chev { transform: rotate(90deg); }
.chev { display: inline-block; width: 12px; transition: transform .2s var(--ease); color: var(--muted); }
table.hist { width: 100%; border-collapse: collapse; font-size: 13.5px; font-family: var(--mono); font-variant-numeric: tabular-nums; margin-top: 8px; }
table.hist td, table.hist th { padding: 9px 4px; border-top: 1px solid var(--line); text-align: left; }
table.hist th { color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; border-top: 0; }
.chart { width: 100%; height: 150px; display: block; margin-top: 8px; }
.empty { text-align: center; padding: 36px 10px; color: var(--muted); }
.empty .ico { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }

/* Barra de pestañas */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); width: min(440px, calc(100% - 24px)); display: flex; padding: 6px; gap: 2px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.8) blur(18px); -webkit-backdrop-filter: saturate(1.8) blur(18px); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 32px -12px rgba(10, 13, 26, .35); z-index: 10; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 6px; font-size: 11px; font-weight: 500; color: var(--muted); position: relative; border-radius: 16px; transition: color .18s, background .18s; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a:hover { color: var(--text); }
.tabbar a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.badge-count { position: absolute; top: 3px; left: calc(50% + 7px); background: var(--ko); color: #fff; font-family: var(--mono); font-size: 10px; font-weight: 600; border-radius: 99px; padding: 0 5px; min-width: 17px; line-height: 17px; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.badge-count:empty { display: none; }
body.running .tabbar { display: none; }
body.running { padding-bottom: 24px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px) scale(.98); display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100% - 32px)); width: max-content; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); color: var(--text); border: 1px solid var(--line); padding: 11px 16px 11px 12px; border-radius: 14px; font-size: 14.5px; font-weight: 500; line-height: 1.35; box-shadow: 0 16px 36px -14px rgba(10, 13, 26, .45); z-index: 30; opacity: 0; transition: opacity .2s, transform .3s var(--ease); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
body.running .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
.toast-ico { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.toast-ico svg { width: 16px; height: 16px; }
.toast[data-kind="ok"] .toast-ico { background: var(--ok-soft); color: var(--ok); }
.toast[data-kind="warn"] .toast-ico, .toast[data-kind="time"] .toast-ico { background: var(--th-soft); color: var(--warn); }

/* La teoría usa el ámbar como acento en sus pantallas */
body[data-sec="th"] { --accent: var(--th); --accent-soft: var(--th-soft); --on-accent: var(--on-th); }
@media (max-width: 520px) {
  .bar-row { grid-template-columns: 1fr auto; grid-template-areas: "label pct" "bar bar"; row-gap: 7px; }
  .bar-row > :nth-child(1) { grid-area: label; }
  .bar-row > .bar { grid-area: bar; }
  .bar-row > .pct { grid-area: pct; }
}

/* Explicaciones por opción y apuntes */
.exp .why { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.exp .why b { color: var(--ko); }
.saved { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.saved b { color: var(--text); }
.others { margin-top: 10px; }
.others summary { padding: 4px 0; }
.others .other { font-size: 14px; line-height: 1.55; padding: 7px 0 0 18px; }
.others .other b { font-weight: 600; }
mark { background: var(--accent-soft); color: var(--accent); padding: 0 4px; border-radius: 5px; font-weight: 600; }
.search, .note-txt { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; font-size: 16px; }
.search:focus, .note-txt:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-txt { display: block; margin: 12px 0 0 18px; width: calc(100% - 18px); min-height: 64px; resize: vertical; line-height: 1.5; }
.note-meta { padding-left: 18px; margin-top: 3px; font-family: var(--mono); font-size: 11.5px; }
.note-h { display: flex; justify-content: space-between; align-items: baseline; }
.note .btns { padding-left: 18px; }
.exp .why b.warn-t { color: var(--warn); }

/* Entrada */
.login { max-width: 380px; margin: 8vh auto 0; }
.login-mark { width: 56px; height: 56px; border-radius: 14px; display: block; margin-bottom: 18px; }
.login input { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; width: 100%; min-height: 48px; font-size: 16px; }
.login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login .ko-t:empty { display: none; }

/* Modales (sustituyen a confirm()) */
.modal { margin: auto; width: min(400px, calc(100% - 32px)); padding: 26px 22px 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: 0 30px 70px -20px rgba(5, 8, 20, .55); text-align: center; animation: modal-in .24s var(--ease) both; }
.modal::backdrop { background: rgba(8, 11, 24, .42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in .2s ease both; }
.modal.out { animation: modal-out .14s ease-in both; }
.modal.out::backdrop { animation: fade-out .14s ease-in both; }
.modal-ico { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.modal-ico svg { width: 24px; height: 24px; }
.modal.danger .modal-ico { background: var(--ko-soft); color: var(--ko); }
.modal h3 { font-size: 18.5px; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; text-wrap: balance; }
.modal p { margin-top: 8px; color: var(--muted); font-size: 15px; line-height: 1.5; text-wrap: pretty; }
.modal-btns { display: flex; gap: 10px; margin-top: 22px; }
.modal-btns .btn { flex: 1; }
.btn.danger { background: var(--ko); border-color: var(--ko); color: #fff; box-shadow: 0 8px 20px -12px var(--ko); }
.btn.danger:hover:not(:disabled) { background: var(--ko); filter: brightness(1.08); }
.modal .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (max-width: 480px) {
  .modal { margin: auto auto calc(16px + env(safe-area-inset-bottom)); }
  .modal-btns { flex-direction: column-reverse; }
}
