:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --ink: #1d1b16;
  --ink-2: #5d584c;
  --line: #ddd8cc;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fde9dd;
  --ok: #17803d;
  --bad: #b42318;
  --code-bg: #fbfaf7;
  --console-bg: #17160f;
  --console-ink: #ece8da;
  --tk-k: #a21caf; --tk-s: #15803d; --tk-n: #b45309; --tk-c: #8a8574; --tk-t: #1d4ed8; --tk-a: #be185d;
  --ce-lh: 1.55em; --ce-pad: 10px;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .05);
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #14130f; --surface: #1d1c17; --surface-2: #26241d; --ink: #f1eee4; --ink-2: #a9a490; --line: #34322a;
    --accent: #fb923c; --accent-ink: #1d1208; --accent-soft: #3a2415; --ok: #4ade80; --bad: #f87171;
    --code-bg: #181712; --console-bg: #0d0c09;
    --tk-k: #e879f9; --tk-s: #86efac; --tk-n: #fbbf24; --tk-c: #7d7966; --tk-t: #7dd3fc; --tk-a: #f9a8d4;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
  }
}
:root[data-theme='dark'] {
  --bg: #14130f; --surface: #1d1c17; --surface-2: #26241d; --ink: #f1eee4; --ink-2: #a9a490; --line: #34322a;
  --accent: #fb923c; --accent-ink: #1d1208; --accent-soft: #3a2415; --ok: #4ade80; --bad: #f87171;
  --code-bg: #181712; --console-bg: #0d0c09;
  --tk-k: #e879f9; --tk-s: #86efac; --tk-n: #fbbf24; --tk-c: #7d7966; --tk-t: #7dd3fc; --tk-a: #f9a8d4;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.spacer { flex: 1; }

/* ── shell ── */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px; padding: 0 16px; height: 54px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--ink); margin-right: 12px; }
.brand:hover { text-decoration: none; }
.brand b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 700 13px var(--mono); }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--surface-2); }
main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 64px; }
main.wide { max-width: 1480px; }
main.flush { max-width: none; padding: 0; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 28px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 60ch; }
.crumbs { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }

/* ── controles ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary, .btn.run { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover, .btn.run:hover { filter: brightness(1.07); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea, .field select, .input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; color: var(--ink); }
a.card:hover { text-decoration: none; border-color: var(--accent); }
.card h3 { margin: 0; font-size: 18px; }
.card p { margin: 0; color: var(--ink-2); flex: 1; }
.card .meta { font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; align-items: center; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.card.add { align-items: center; justify-content: center; border-style: dashed; box-shadow: none; background: transparent; min-height: 140px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.card.add:hover { color: var(--accent); }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .num { width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; background: var(--surface-2); font: 600 13px var(--mono); color: var(--ink-2); flex: none; }
.row .title { font-weight: 600; color: var(--ink); }
.row .sub { font-size: 13px; color: var(--ink-2); }
.row .actions { display: flex; gap: 2px; margin-left: auto; }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-2); }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h2 { margin: 0 0 14px; font-size: 20px; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 9px; font-weight: 500; z-index: 100; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }

/* ── editor ── */
.ce { position: relative; display: flex; min-height: 60px; background: var(--code-bg); font: 13.5px/var(--ce-lh) var(--mono); overflow: hidden; }
.ce-gutter { flex: none; width: 3.4em; padding: var(--ce-pad) 8px; text-align: right; color: var(--tk-c); overflow: hidden; user-select: none; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--code-bg) 70%, var(--surface-2)); font-size: inherit; }
.ce-gutter .bad { color: var(--bad); font-weight: 700; }
.ce-body { position: relative; flex: 1; min-width: 0; }
.ce-pre, .ce-ta { position: absolute; inset: 0; margin: 0; padding: var(--ce-pad) 12px; border: 0; font: inherit; letter-spacing: 0; white-space: pre; tab-size: 4; overflow: auto; }
.ce-pre { pointer-events: none; overflow: hidden; color: var(--ink); }
.ce-ta { background: transparent; color: transparent; caret-color: var(--ink); resize: none; outline: none; -webkit-text-fill-color: transparent; }
.ce-ta::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); -webkit-text-fill-color: transparent; }
.ce-err { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--bad) 16%, transparent); border-left: 3px solid var(--bad); pointer-events: none; }
.tk-k { color: var(--tk-k); font-weight: 600; } .tk-s { color: var(--tk-s); } .tk-n { color: var(--tk-n); }
.tk-c { color: var(--tk-c); font-style: italic; } .tk-t { color: var(--tk-t); } .tk-a { color: var(--tk-a); }

/* ── runner ── */
.runner { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; min-width: 0; font-size: 14px; color: var(--ink); text-align: left; }
.rp-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rp-title { font-weight: 600; font-size: 13px; }
.badge { padding: 1px 8px; border-radius: 5px; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.badge.java { background: #fde9dd; color: #9a3412; } .badge.pseudo { background: #dbeafe; color: #1e40af; }
:root[data-theme='dark'] .badge.java, .deck-dark .badge.java { background: #4a2511; color: #fdba74; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .badge.java { background: #4a2511; color: #fdba74; } :root:not([data-theme='light']) .badge.pseudo { background: #1e2a4d; color: #93c5fd; } }
.rp-stdin-box { border-top: 1px solid var(--line); padding: 4px 12px; font-size: 13px; color: var(--ink-2); }
.rp-stdin-box summary { cursor: pointer; padding: 3px 0; }
.rp-stdin { width: 100%; font: 13px var(--mono); padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--code-bg); resize: vertical; margin: 4px 0 6px; }
.rp-out-head { display: flex; justify-content: space-between; padding: 5px 12px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--console-ink); background: #2a2820; opacity: .95; }
.rp-status { text-transform: none; letter-spacing: 0; font-weight: 500; }
.rp-status.ok { color: #86efac; } .rp-status.bad { color: #fca5a5; } .rp-status.busy { color: #fcd34d; }
.console { margin: 0; padding: 10px 14px; min-height: 64px; max-height: 260px; overflow: auto; background: var(--console-bg); color: var(--console-ink); font: 13px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; flex: 1; }
.console .err { color: #fca5a5; }
.console:empty::before { content: 'La salida aparecerá aquí…'; color: #7d7966; font-style: italic; }

.cmp { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 8px; }
.cmp-bar { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px; flex-wrap: wrap; }
.cmp-bar .rp-stdin { width: 260px; margin: 0; }
.cmp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
@media (max-width: 860px) { .cmp-cols { grid-template-columns: 1fr; } }

.static-code { margin: 0; padding: 12px 16px; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); font: 13.5px/1.55 var(--mono); overflow: auto; color: var(--ink); }

/* ── deck ── */
.deck { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 360px; background: var(--bg); color: var(--ink); font-size: var(--u, 16px); outline: none; }
.deck:fullscreen { background: var(--bg); }
.deck-stage { position: relative; flex: 1; min-height: 0; }
.slide { position: absolute; inset: 0; overflow: auto; padding: 2.2em 3.4em 2em; display: block; }
.slide > * { max-width: 62em; margin-left: auto; margin-right: auto; }
.slide h1 { font-size: 2.6em; margin: .2em auto .3em; }
.slide h2 { font-size: 1.85em; margin: 0 auto .6em; padding-bottom: .25em; border-bottom: 3px solid var(--accent); width: fit-content; max-width: 62em; }
.slide h3 { font-size: 1.2em; margin: 1em auto .3em; }
.slide p, .slide li { font-size: 1.05em; line-height: 1.55; }
.slide li { margin: .25em 0; }
.slide code:not(pre code) { font: .9em var(--mono); background: var(--surface-2); padding: .08em .35em; border-radius: 4px; }
.slide kbd { font: .85em var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 .4em; border-radius: 4px; background: var(--surface); }
.slide.title { display: flex; flex-direction: column; justify-content: center; text-align: center; }
.slide.title > * { max-width: 40em; }
.slide.title h1 { font-size: 3.2em; }
.slide.title p { color: var(--ink-2); font-size: 1.3em; }
.slide .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4em; align-items: start; }
.slide .cols.three { grid-template-columns: repeat(3, 1fr); }
.slide .callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: .6em 1em; border-radius: 0 8px 8px 0; margin-top: 1em; margin-bottom: 1em; }
.slide .callout.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.slide .callout.warn { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.slide table { border-collapse: collapse; margin: 1em auto; }
.slide th, .slide td { border: 1px solid var(--line); padding: .35em .8em; text-align: left; }
.slide th { background: var(--surface-2); }
.slide .runner, .slide .cmp, .slide .static-code { font-size: .8em; margin-top: .8em; margin-bottom: .8em; }
.slide .cmp { max-width: none; }
.slide:has(.cmp) > * { max-width: 78em; }
.deck-progress { height: 3px; background: var(--line); }
.deck-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.deck-bar { display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-top: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.deck-count { min-width: 64px; text-align: center; font: 13px var(--mono); color: var(--ink-2); }
.deck.compact .slide { padding: 1.4em 2em; }
@media (max-width: 760px) { .slide { padding: 1.2em 1em; } .slide .cols, .slide .cols.three { grid-template-columns: 1fr; } }

/* ── pantallas ── */
.present-wrap { height: calc(100vh - 54px); }
.edit-grid { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1.25fr); grid-template-rows: minmax(0, 1fr); height: calc(100vh - 54px - 52px); }
.edit-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); }
.edit-pane .ce { flex: 1; height: auto !important; max-height: none; }
.edit-tools { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.edit-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; height: 52px; border-bottom: 1px solid var(--line); background: var(--surface); }
.edit-bar input { font-weight: 600; font-size: 16px; border: 1px solid transparent; background: transparent; padding: 5px 8px; border-radius: 7px; min-width: 200px; flex: 1; max-width: 520px; }
.edit-bar input:hover, .edit-bar input:focus { border-color: var(--line); background: var(--bg); }
.preview-pane { min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.dirty { color: var(--accent); font-size: 13px; font-weight: 600; }
@media (max-width: 900px) { .edit-grid { grid-template-columns: 1fr; grid-template-rows: none; height: auto; } .edit-pane .ce { height: 50vh !important; } .preview-pane { height: 80vh; } }

.pg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .pg-grid { grid-template-columns: 1fr; } }
.help { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px 14px; margin-top: 22px; }
.help summary { cursor: pointer; font-weight: 600; padding: 12px 0 4px; }
.help pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; overflow: auto; font: 13px/1.5 var(--mono); }
.help table { border-collapse: collapse; } .help td, .help th { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }

.tabs { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; }
.tab { border: 0; background: transparent; padding: 7px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.tab[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
#pg .runner { font-size: 15px; }
#pg .console { min-height: 160px; max-height: 360px; }

/* ── diseño de diapositivas (v2) ── */
.slide { background: radial-gradient(70em 30em at 100% -10%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%); }
.slide .kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .68em; font-weight: 700; color: var(--accent); margin-top: 0; margin-bottom: .5em; }
.slide .lead { font-size: 1.3em; color: var(--ink-2); line-height: 1.5; }
.slide.title { background: radial-gradient(60em 30em at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); }
.slide.title .kicker { font-size: .8em; }
.slide.section { background: linear-gradient(135deg, var(--accent-soft), transparent 70%); }
.slide.section .num { font: 700 6em/1 var(--mono); color: var(--accent); opacity: .45; margin: 0 auto; }
.slide.section h1 { font-size: 2.8em; margin-top: .1em; }
.slide .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(13em, 1fr)); gap: 1em; margin-top: 1em; margin-bottom: 1em; }
.slide .tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1em 1.1em; box-shadow: var(--shadow); }
.slide .tile .ico { font-size: 1.9em; line-height: 1; }
.slide .tile h3 { margin: .35em 0 .2em; font-size: 1.1em; }
.slide .tile p { margin: 0; font-size: .92em; color: var(--ink-2); line-height: 1.45; }
.slide ol.steps { list-style: none; padding: 0; counter-reset: st; display: grid; gap: .6em; }
.slide ol.steps li { counter-increment: st; display: flex; gap: .8em; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .55em .9em; margin: 0; }
.slide ol.steps li::before { content: counter(st); flex: none; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 .85em var(--mono); }
.slide .flow { display: flex; flex-wrap: wrap; align-items: center; gap: .5em; justify-content: center; margin: 1.2em auto; }
.slide .flow span { background: var(--surface); border: 2px solid var(--accent); border-radius: 10px; padding: .45em .9em; font-weight: 600; }
.slide .flow span + span::before { content: '→'; position: relative; left: -1.1em; margin-right: -.6em; color: var(--accent); font-weight: 700; }
.slide .flow span + span { margin-left: .9em; }
.slide .big { font: 700 2.2em/1.2 var(--mono); text-align: center; color: var(--accent); margin: .5em auto; }
.slide .muted { color: var(--ink-2); }
.slide .tag { display: inline-block; font-size: .72em; font-weight: 700; padding: .1em .7em; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.slide .box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .9em 1.1em; }
.slide .box > :first-child { margin-top: 0; } .slide .box > :last-child { margin-bottom: 0; }

quiz-question { display: block; }
.quiz { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.1em 1.3em 1.2em; box-shadow: var(--shadow); max-width: 52em; margin: 0 auto; }
.quiz-tag { display: inline-block; font-size: .72em; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--accent-soft); color: var(--accent); padding: .2em .8em; border-radius: 99px; margin-bottom: .7em; }
.quiz-q { font-size: 1.1em; font-weight: 600; line-height: 1.45; }
.quiz-q p { margin: .2em 0 .6em; } .quiz-q .static-code { font-weight: 400; font-size: .8em; margin: .5em 0; }
.quiz-opts { display: grid; gap: .5em; margin-top: .6em; }
.quiz-opt { display: flex; gap: .8em; align-items: center; text-align: left; width: 100%; padding: .6em .9em; border: 2px solid var(--line); border-radius: 11px; background: var(--bg); cursor: pointer; font-size: .95em; }
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.quiz-opt:disabled { cursor: default; }
.quiz-key { flex: none; width: 1.9em; height: 1.9em; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font: 700 .85em var(--mono); color: var(--ink-2); }
.quiz-opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.quiz-opt.right .quiz-key { background: var(--ok); color: #fff; }
.quiz-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); opacity: .75; }
.quiz-opt.wrong .quiz-key { background: var(--bad); color: #fff; }
.quiz-label code { font: .9em var(--mono); }
.quiz-fb { margin-top: .8em; padding: .6em .9em; border-radius: 10px; font-size: .95em; line-height: 1.5; }
.quiz-fb.ok { background: color-mix(in srgb, var(--ok) 13%, transparent); }
.quiz-fb.bad { background: color-mix(in srgb, var(--bad) 11%, transparent); }
.quiz-fb code { font: .9em var(--mono); background: var(--surface-2); padding: .05em .3em; border-radius: 4px; }

/* ── animaciones SVG (se reinician cada vez que se muestra la diapositiva) ── */
.slide figure.anim { margin: .8em auto; max-width: 52em; text-align: center; }
.slide figure.anim svg { width: 100%; height: auto; max-height: 22em; font-family: var(--sans); }
.slide figure.anim figcaption { font-size: .8em; color: var(--ink-2); margin-top: .3em; }
.anim svg .bx { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.anim svg .bx2 { fill: var(--surface-2); stroke: var(--line); stroke-width: 2; }
.anim svg .hl { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; }
.anim svg .ok { fill: color-mix(in srgb, var(--ok) 18%, var(--surface)); stroke: var(--ok); stroke-width: 2.5; }
.anim svg .bad { fill: color-mix(in srgb, var(--bad) 15%, var(--surface)); stroke: var(--bad); stroke-width: 2.5; }
.anim svg text { fill: var(--ink); font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.anim svg text.sm { font-size: 12px; fill: var(--ink-2); }
.anim svg text.mono { font-family: var(--mono); font-weight: 600; }
.anim svg text.acc { fill: var(--accent); font-weight: 700; }
.anim svg text.l { text-anchor: start; }
.anim svg .ln { stroke: var(--ink-2); stroke-width: 2; fill: none; }
.anim svg .ar { stroke: var(--accent); stroke-width: 3; fill: none; stroke-dasharray: 8 6; animation: dash 1s linear infinite; }
.anim svg .dot { fill: var(--accent); }
@keyframes dash { to { stroke-dashoffset: -28; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 60% { transform: scale(1.12); } 100% { opacity: 1; transform: scale(1); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.anim .a-pop { transform-box: fill-box; transform-origin: center; animation: pop .6s both; }
.anim .a-fade { animation: fadein .6s both; }
.anim .a-blink { animation: blink 1s steps(1) infinite; }
.anim .a-bob { animation: bob 1.4s ease-in-out infinite; }
.anim .d1 { animation-delay: .4s; } .anim .d2 { animation-delay: .9s; } .anim .d3 { animation-delay: 1.4s; } .anim .d4 { animation-delay: 1.9s; } .anim .d5 { animation-delay: 2.4s; } .anim .d6 { animation-delay: 2.9s; }
@media (prefers-reduced-motion: reduce) { .anim *, .anim *::before { animation: none !important; } }

/* marcadores de subrayado para analizar enunciados */
.mk { padding: .05em .35em; border-radius: 5px; font-weight: 600; }
.mk.d { background: color-mix(in srgb, #2563eb 20%, transparent); }
.mk.a { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.mk.c { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.mk.r { background: color-mix(in srgb, #a21caf 20%, transparent); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.anim .a-grow { transform-box: fill-box; transform-origin: left center; animation: grow .9s ease-out both; }
@keyframes slidein { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }
.anim .a-slide { animation: slidein .6s both; }
@keyframes drop { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: none; } }
.anim .a-drop { animation: drop .6s both; }
@keyframes fly { from { opacity: 0; transform: translate(var(--fx, 0px), var(--fy, 0px)) scale(.7); } to { opacity: 1; transform: none; } }
.anim .a-fly { animation: fly .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(10px); } 40%, 80% { transform: translateX(-4px); } }
.anim .a-shake { animation: shake .6s both; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.anim .a-pulse { transform-box: fill-box; transform-origin: center; animation: pulse 1.4s ease-in-out infinite; }
@keyframes rise { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-40px); } }
.anim .a-rise { animation: rise .6s both; }

/* índice de contenidos y resultados esperados */
.slide ol.toc { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(20em, 1fr)); gap: .6em .9em; margin-top: 1em; }
.slide ol.toc li { display: flex; align-items: center; gap: .8em; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6em .9em; margin: 0; cursor: pointer; font-weight: 600; transition: border-color .15s, transform .15s; }
.slide ol.toc li:hover { border-color: var(--accent); transform: translateY(-1px); }
.slide ol.toc .n { flex: none; min-width: 2em; height: 2em; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 700 .85em var(--mono); }
.slide ul.checks { list-style: none; padding: 0; display: grid; gap: .6em; margin-top: 1em; }
.slide ul.checks li { position: relative; padding: .7em 1em .7em 3em; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 0; }
.slide ul.checks li::before { content: '✓'; position: absolute; left: .9em; top: 50%; transform: translateY(-50%); width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85em; }
.slide .small { font-size: .85em; }

/* títulos alineados a la columna de contenido, con barra de acento */
.slide h2 { width: 100%; border-bottom: 0; padding-bottom: 0; margin-bottom: .7em; }
.slide h2::after { content: ''; display: block; width: 2.2em; height: .16em; background: var(--accent); margin-top: .3em; border-radius: 3px; }
.slide .kicker { width: 100%; }

/* ancho de columna independiente del tamaño de fuente de cada elemento */
.slide > * { max-width: calc(62 * var(--u, 16px)); }
.slide:has(.cmp) > * { max-width: calc(78 * var(--u, 16px)); }
.slide.title > * { max-width: calc(40 * var(--u, 16px)); }
.slide figure.anim { max-width: calc(52 * var(--u, 16px)); }
.slide .quiz { max-width: calc(52 * var(--u, 16px)); }
.slide h1, .slide h2, .slide h3 { max-width: calc(62 * var(--u, 16px)); }
.slide:has(.cmp) h2, .slide:has(.cmp) h3 { max-width: calc(78 * var(--u, 16px)); }
.slide.title h1 { max-width: calc(40 * var(--u, 16px)); }
.slide .quiz { margin-left: 0; }
a.row.link { color: var(--ink); }
a.row.link:hover { background: var(--surface-2); text-decoration: none; }

/* ── Laboratorio: el alto de la ventana se reparte entre editor (arriba) y resultado (abajo) ── */
main.lab { max-width: 1680px; height: calc(100vh - 54px); min-height: 520px; padding: 14px 16px 16px; display: flex; flex-direction: column; }
main.lab .page-head { margin-bottom: 10px; flex: none; }
main.lab .page-head h1 { font-size: 24px; }
main.lab .page-head p { margin: 2px 0 0; }
main.lab #pg { flex: 1; min-height: 0; display: flex; }
main.lab #pg .runner { flex: 1; min-width: 0; min-height: 0; font-size: 15px; }
main.lab #pg .runner[hidden] { display: none; }
main.lab #pg .rp-head { flex: none; padding: 8px 10px 8px 14px; }
main.lab #pg .rp-editor { flex: 1 1 0; min-height: 160px; display: flex; }
main.lab #pg .rp-editor .ce { flex: 1; height: auto !important; max-height: none; font-size: 15px; }
main.lab #pg .rp-stdin-box { flex: none; padding: 2px 14px; }
main.lab #pg .rp-stdin { min-height: 30px; height: 30px; margin: 2px 0 4px; resize: none; }
main.lab #pg .rp-out-head { flex: none; }
main.lab #pg .console { flex: 0 0 clamp(110px, 24vh, 340px); max-height: none; min-height: 0; font-size: 14px; }

/* ── Inicio ── */
main.home { max-width: 960px; padding-top: 56px; }
.hero { text-align: center; padding: 24px 0 36px; }
.eyebrow { display: inline-block; font: 600 13px var(--mono); color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 99px; margin: 0 0 22px; }
.hero h1 { font-size: clamp(36px, 7vw, 64px); line-height: 1.05; letter-spacing: -.03em; margin: 0 0 18px; }
.hero h1 span { color: var(--accent); }
.hero .sub { font-size: 18px; color: var(--ink-2); max-width: 36em; margin: 0 auto 28px; }
.cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn.lg { padding: 11px 20px; font-size: 16px; border-radius: 10px; }
.demo { max-width: 720px; margin: 0 auto 56px; box-shadow: var(--shadow); border-radius: var(--radius); }
.demo .runner { font-size: 14px; }
.demo .console { min-height: 90px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; margin-bottom: 56px; }
.features b { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.features h3 { margin: 12px 0 4px; font-size: 17px; }
.features p { margin: 0; color: var(--ink-2); }
.courses h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); margin: 0 0 12px; }
a.course + a.course { margin-top: 12px; }
a.course { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; color: var(--ink); box-shadow: var(--shadow); }
a.course:hover { border-color: var(--accent); text-decoration: none; }
a.course h3 { margin: 8px 0 4px; font-size: 22px; }
a.course p { margin: 0; color: var(--ink-2); max-width: 42em; }
a.course .count { color: var(--accent); font-weight: 600; white-space: nowrap; }
.foot { text-align: center; color: var(--ink-2); font-size: 13px; padding: 56px 0 8px; }

/* ── Analogías ── */
.slide.analogy { background: radial-gradient(60em 26em at 0% 0%, color-mix(in srgb, #f59e0b 10%, transparent), transparent 60%); }
.slide .story { font-size: 1.15em; line-height: 1.6; background: color-mix(in srgb, #f59e0b 12%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--line)); border-radius: 14px; padding: .9em 1.2em; }
.slide .pairs { display: grid; gap: .55em; margin-top: 1em; }
.slide .pr { display: grid; grid-template-columns: 1fr auto 1fr; gap: .8em; align-items: center; }
.slide .pr .real, .slide .pr .tech { padding: .5em .9em; border-radius: 10px; font-size: .95em; line-height: 1.4; }
.slide .pr .real { background: color-mix(in srgb, #f59e0b 14%, var(--surface)); border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--line)); }
.slide .pr .tech { background: var(--surface); border: 1px solid var(--line); font-family: var(--mono); font-size: .88em; }
.slide .pr .arr { color: var(--accent); font-weight: 700; }
@media (max-width: 760px) { .slide .pr { grid-template-columns: 1fr; } .slide .pr .arr { display: none; } }

/* flechas del diagrama de flujo fuera de las cajas */
.slide .flow { gap: 1.8em; }
.slide .flow span { position: relative; }
.slide .flow span + span { margin-left: 0; }
.slide .flow span + span::before { position: absolute; left: -1.35em; top: 50%; transform: translateY(-50%); margin: 0; content: '→'; color: var(--accent); font-weight: 700; }

/* ── Salas grupales ── */
main.room-page { max-width: 1680px; height: calc(100vh - 54px); min-height: 540px; padding: 12px 16px 16px; display: flex; flex-direction: column; }
.join-card { max-width: 460px; margin: 6vh auto 0; text-align: center; }
.join-card h1 { margin: 6px 0 10px; font-size: 30px; }
.join-card > p { color: var(--ink-2); margin: 0 0 22px; }
.join-card form { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.join-card .btn { width: 100%; justify-content: center; }
.join-ico { font-size: 42px; }
.join-err { min-height: 1.4em; margin: 0 0 8px; color: var(--bad); font-size: 14px; }

.room { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.room-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: none; }
.room-title { font-size: 15px; color: var(--ink-2); }
.room-title b { color: var(--ink); font-family: var(--mono); background: var(--surface-2); padding: 2px 8px; border-radius: 6px; }
.room-conn { font-size: 12px; font-weight: 600; }
.room-conn.ok { color: var(--ok); } .room-conn.bad { color: var(--bad); }
.people { display: flex; gap: 6px; flex-wrap: wrap; }
.who, .badge-who { --c: var(--accent); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 10px 2px 3px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--c) 55%, var(--line)); background: color-mix(in srgb, var(--c) 13%, var(--surface)); white-space: nowrap; font-family: var(--sans); }
.who i, .badge-who i { width: 20px; height: 20px; border-radius: 50%; background: var(--c); color: #fff; font: 700 11px var(--sans); display: grid; place-items: center; font-style: normal; }
.badge-who { font-size: 11.5px; padding: 1px 8px 1px 2px; line-height: 1.3; }
.badge-who i { width: 17px; height: 17px; font-size: 10px; }
.badge-who.more { padding: 1px 8px; }

.room-main { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; }
.collab { overflow: auto; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 0; font: 15px/1.9 var(--mono); }
.cl { --rc: var(--accent); display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; align-items: center; border-left: 3px solid transparent; min-height: 1.9em; }
.cl:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.cl.remote { border-left-color: var(--rc); background: color-mix(in srgb, var(--rc) 8%, transparent); }
.cl.flash { animation: clflash 1.5s ease-out; }
@keyframes clflash { 0% { background: color-mix(in srgb, var(--c) 38%, transparent); } 100% { background: transparent; } }
.cl-gutter { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding-right: 10px; user-select: none; }
.cl-num { color: var(--tk-c); font-size: 13px; min-width: 1.6em; text-align: right; }
.pdot { --c: var(--accent); width: 17px; height: 17px; border-radius: 50%; background: var(--c); color: #fff; font: 700 10px var(--sans); display: grid; place-items: center; font-style: normal; }
.cl-code { position: relative; height: 1.9em; min-width: 0; }
.cl-hl, .cl-in { position: absolute; inset: 0; margin: 0; padding: 0 6px; border: 0; background: transparent; font: inherit; white-space: pre; overflow: hidden; }
.cl-hl { pointer-events: none; color: var(--ink); }
.cl-in { width: 100%; color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--ink); outline: none; }
.cl-in::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.cl-badges { display: flex; gap: 4px; padding: 0 12px; justify-content: flex-end; flex-wrap: nowrap; }
.room-io { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.room-io .rp-stdin { height: 30px; min-height: 30px; resize: none; margin: 2px 0 6px; }
.room-io .rp-stdin-box { padding: 2px 14px; }
.room-io .rp-out-head { align-items: center; gap: 4px; justify-content: space-between; }
.room-io .rp-out-head > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.room-io .console { flex: none; height: clamp(110px, 22vh, 300px); }
@media (max-width: 720px) { .cl-badges .badge-who:nth-child(n+2) { display: none; } .cl { grid-template-columns: 3.2em minmax(0, 1fr) auto; } }
.room-io .rp-out-head .badge-who { text-transform: none; letter-spacing: 0; color: var(--console-ink); }

/* ───────── Página de curso: camino de aprendizaje (solo visual) ───────── */
main.path-page { max-width: 1040px; }
.path-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr 200px; gap: 28px; align-items: center; padding: 28px 30px; margin-bottom: 40px; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.path-hero h1 { margin: 10px 0 8px; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; }
.path-hero p { margin: 0 0 16px; color: var(--ink-2); max-width: 46em; font-size: 16px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 18px; font-size: 14px; color: var(--ink-2); }
.hero-stats b { color: var(--ink); font-size: 16px; }
.hero-art { position: relative; height: 190px; }
.hero-rocket { position: absolute; left: 50%; top: 50%; font-size: 64px; transform: translate(-50%, -50%); animation: bob 3s ease-in-out infinite; }
.orbit { position: absolute; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font: 700 18px var(--mono); color: var(--accent); animation: bob 3.6s ease-in-out infinite; }
.o1 { left: 8%; top: 8%; animation-delay: -.6s; } .o2 { right: 4%; top: 24%; animation-delay: -1.4s; } .o3 { left: 22%; bottom: 4%; animation-delay: -2.2s; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }

.path { position: relative; padding: 6px 0 10px; }
.path-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; border-left: 3px dashed var(--line); transform: translateX(-1.5px); }
.path-fill { position: absolute; top: 0; left: -3px; width: 3px; height: 0; border-radius: 3px; background: linear-gradient(180deg, var(--accent), #f59e0b); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent); }
.path-fill::after { content: ''; position: absolute; left: -2px; bottom: 0; width: 7px; height: 38px; border-radius: 6px; background: linear-gradient(180deg, transparent, #fff 80%); opacity: .85; animation: flow 2.2s ease-in-out infinite; }
@keyframes flow { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: .9; } 100% { transform: translateY(0); opacity: 0; } }

.path-start, .path-end { position: relative; z-index: 1; width: fit-content; margin: 0 auto; padding: 10px 20px; border-radius: 99px; background: var(--surface); border: 2px solid var(--accent); font-weight: 700; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.path-end { margin-top: 36px; border-style: dashed; color: var(--ink-2); }
.stage { position: relative; z-index: 1; width: fit-content; margin: 44px auto 22px; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; letter-spacing: .02em; padding: 8px 18px; border-radius: 12px; background: var(--ink); color: var(--bg); }
.stage small { opacity: .7; font-weight: 600; }
.stage-ico { font-size: 18px; }

.step { position: relative; display: flex; margin-bottom: 26px; }
.step.left { justify-content: flex-start; padding-right: calc(50% + 38px); }
.step.right { justify-content: flex-end; padding-left: calc(50% + 38px); }
.step .node { position: absolute; left: 50%; top: 26px; width: 42px; height: 42px; margin-left: -21px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); font: 700 16px var(--mono); color: var(--ink-2); z-index: 2; transition: transform .25s, background .4s, border-color .4s, color .4s, box-shadow .4s; }
.step .node.lit { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
.step:hover .node { transform: scale(1.12); }

.step-card { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); box-shadow: var(--shadow); transition: transform .2s, border-color .2s, box-shadow .2s; }
.step-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 10px 30px rgb(0 0 0 / .12); }
.step-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.state { padding: 2px 10px; border-radius: 99px; background: var(--surface-2); letter-spacing: 0; text-transform: none; }
.step-card h3 { margin: 0; font-size: 21px; }
.step-card .desc { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.learn { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; }
.learn b { display: block; margin-bottom: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.learn ul { margin: 0; padding-left: 18px; } .learn li { margin: 3px 0; }
.learn .more { display: block; margin-top: 4px; color: var(--ink-2); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); }
.go { align-self: flex-start; font-weight: 700; color: var(--accent); }
.step-card:hover .go { text-decoration: underline; }

/* aparición escalonada al hacer scroll */
.step, .stage, .path-start, .path-end { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s ease; }
.step.in, .stage.in, .path-start.in, .path-end.in { opacity: 1; transform: none; }
.step.left:not(.in) { transform: translate(-26px, 20px); } .step.right:not(.in) { transform: translate(26px, 20px); }

@media (max-width: 860px) {
  .path-hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .path-line { left: 20px; } .path-start, .path-end, .stage { margin-left: 52px; }
  .step.left, .step.right { padding: 0 0 0 54px; justify-content: stretch; }
  .step .node { left: 20px; width: 36px; height: 36px; margin-left: -18px; top: 20px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-rocket, .orbit, .path-fill::after { animation: none; }
  .step, .stage, .path-start, .path-end { opacity: 1; transform: none; transition: none; }
}

a.course .count { display: flex; flex-direction: column; align-items: flex-end; }
