/* Mates desde Cero — estilos.  Diseño: papel cálido, color por nivel, discreto y legible. */

:root {
  --fs: 1;
  --bg: #f7f4ee; --surface: #ffffff; --surface-2: #fbf9f4; --ink: #232a33; --ink-2: #3a424e; --muted: #667080; --line: #e5dfd3; --line-2: #d8d0c1;
  --accent: #2f6f6a; --accent-ink: #ffffff; --accent-soft: #e2efec; --accent-2: #d9822b;
  --ok: #3a8a5c; --ok-soft: #e4f2e9; --warn: #b9801a; --warn-soft: #fbf0d9; --bad: #b8483f; --bad-soft: #f8e5e2; --info: #3f6fb5; --info-soft: #e4ecf8;
  --lv0: #4f9d7a; --lv1: #3f8fa8; --lv2: #4f6fc0; --lv3: #7a63c4; --lv4: #b25ea8; --lv5: #d0684f; --lv6: #cf8a2a; --lv7: #64707f;
  --dx-plan: #5b7fd0; --dx-calc: #d9822b; --dx-conc: #9a66c9; --dx-sign: #cf5a6e; --dx-desc: #8a929c; --dx-lect: #3a9c9c;
  --sun: #f0b45a; --hill-1: #c9dccf; --hill-2: #dbe6d8; --hill-3: #e8eddf; --trail: #b9b09c;
  --shadow: 0 1px 2px rgba(35, 42, 51, .06), 0 6px 22px rgba(35, 42, 51, .06);
  --radius: 14px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14181d; --surface: #1b2028; --surface-2: #171c23; --ink: #e7eaef; --ink-2: #cdd3dc; --muted: #97a1b0; --line: #2a313b; --line-2: #38414d;
  --accent: #62b6ac; --accent-ink: #0f1a19; --accent-soft: #1c2f2d; --accent-2: #e59a4a;
  --ok: #5cc088; --ok-soft: #1a2d23; --warn: #e0a640; --warn-soft: #33290f; --bad: #e57a70; --bad-soft: #33201e; --info: #7ea6e8; --info-soft: #1c273a;
  --lv0: #66bb95; --lv1: #58aac4; --lv2: #7592e0; --lv3: #9a86e0; --lv4: #d07cc5; --lv5: #ec8a70; --lv6: #e6a84a; --lv7: #8d99a8;
  --dx-plan: #7f9fe6; --dx-calc: #eca055; --dx-conc: #b98ae0; --dx-sign: #ee7e90; --dx-desc: #a2a9b3; --dx-lect: #5cbdbd;
  --sun: #d99a3d; --hill-1: #243a34; --hill-2: #1f3130; --hill-3: #1c2a2b; --trail: #55606c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 22px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14181d; --surface: #1b2028; --surface-2: #171c23; --ink: #e7eaef; --ink-2: #cdd3dc; --muted: #97a1b0; --line: #2a313b; --line-2: #38414d;
    --accent: #62b6ac; --accent-ink: #0f1a19; --accent-soft: #1c2f2d; --accent-2: #e59a4a;
    --ok: #5cc088; --ok-soft: #1a2d23; --warn: #e0a640; --warn-soft: #33290f; --bad: #e57a70; --bad-soft: #33201e; --info: #7ea6e8; --info-soft: #1c273a;
    --lv0: #66bb95; --lv1: #58aac4; --lv2: #7592e0; --lv3: #9a86e0; --lv4: #d07cc5; --lv5: #ec8a70; --lv6: #e6a84a; --lv7: #8d99a8;
    --dx-plan: #7f9fe6; --dx-calc: #eca055; --dx-conc: #b98ae0; --dx-sign: #ee7e90; --dx-desc: #a2a9b3; --dx-lect: #5cbdbd;
    --sun: #d99a3d; --hill-1: #243a34; --hill-2: #1f3130; --hill-3: #1c2a2b; --trail: #55606c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 22px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: calc(100% * var(--fs)); -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.55 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; outline: none; opacity: 0; transition: opacity .25s ease; }
main.is-in { opacity: 1; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); margin: 0 0 .5rem; }
h2 { font-size: 1.45rem; margin: 2rem 0 .6rem; }
h3 { font-size: 1.15rem; margin: 1.6rem 0 .4rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 65%, transparent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; z-index: 99; }
.skip:focus { left: 8px; top: 8px; }
.loading { padding: 4rem 1rem; text-align: center; color: var(--muted); }
code { font: .92em ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--accent-soft); padding: .1em .35em; border-radius: 5px; }
.hint { color: var(--muted); font-size: .92rem; margin: .5rem 0; }
.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 46rem; }
.flash { animation: flash 2.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-2) 35%, transparent); background: color-mix(in srgb, var(--accent-2) 12%, transparent); } 100% { box-shadow: none; } }

/* ---------- barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; padding: .6rem clamp(.8rem, 3vw, 2rem); 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: .6rem; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand em { font-style: normal; color: var(--accent); }
.search { position: relative; flex: 1; max-width: 26rem; margin-left: auto; }
.search input { width: 100%; padding: .5rem .9rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-size: .95rem; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; z-index: 40; }
.search-results a { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .9rem; color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a:focus { background: var(--accent-soft); }
.search-results small { color: var(--muted); }
.search-none { padding: .8rem .9rem; color: var(--muted); font-size: .92rem; }
.top-tools { display: flex; gap: .3rem; }
.icon-btn { border: 1px solid transparent; background: transparent; color: var(--ink-2); width: 2.3rem; height: 2.3rem; border-radius: 10px; cursor: pointer; font: 600 1rem var(--sans); display: grid; place-items: center; }
.icon-btn:hover { background: var(--accent-soft); }
.icon-btn small { font-size: .7rem; margin-left: -1px; }

.tabs { display: flex; justify-content: center; gap: .3rem; padding: .5rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.tabs a { display: flex; align-items: center; gap: .45rem; padding: .45rem .9rem; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem; position: relative; }
.tabs a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a:hover { background: var(--accent-soft); }
.tabs a.on { background: var(--accent); color: var(--accent-ink); }
.count { font-style: normal; font-size: .72rem; background: var(--accent-2); color: #fff; min-width: 1.25rem; height: 1.25rem; border-radius: 999px; display: inline-grid; place-items: center; padding: 0 .3rem; }
.footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.4rem clamp(.8rem, 3vw, 2rem); color: var(--muted); font-size: .88rem; border-top: 1px solid var(--line); margin-top: 3rem; }

/* ---------- botones y chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.05rem; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 .95rem var(--sans); cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:hover { background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1.05rem; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; }
button.btn-quiet { padding: .35rem .6rem; border-radius: 8px; border: 0; cursor: pointer; font: 500 .9rem var(--sans); }
button.btn-quiet:hover { background: var(--accent-soft); color: var(--ink); }
.chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); padding: .35rem .8rem; border-radius: 999px; font: 500 .9rem var(--sans); cursor: pointer; }
.chip:hover { background: var(--accent-soft); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip-quiet { background: transparent; border-style: dashed; }
.chip-link { display: inline-block; padding: .3rem .8rem; border-radius: 999px; background: var(--warn-soft); color: var(--ink); text-decoration: none; font-size: .9rem; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.chip-link:hover { background: color-mix(in srgb, var(--warn) 20%, var(--warn-soft)); }
.chip-list { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.pill-here { background: var(--tone, var(--accent)); color: #fff; }
.pill-done { background: var(--ok-soft); color: var(--ok); }
.pill-weak, .pill.s-reforzar { background: var(--warn-soft); color: var(--warn); }
.pill.s-dominado { background: var(--ok-soft); color: var(--ok); }
.pill.s-nuevo { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge { font-size: .75rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.check { display: flex; align-items: flex-start; gap: .5rem; cursor: pointer; }
.check input { margin-top: .3rem; accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

.page { max-width: 1080px; margin: 0 auto; padding: 1.6rem clamp(.9rem, 3vw, 2rem) 2rem; }
.page.narrow { max-width: 780px; }
.page-head { margin-bottom: 1.2rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin: 1.2rem 0; box-shadow: var(--shadow); }
.panel h2 { margin-top: 0; font-size: 1.2rem; }
.panel.danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.empty { text-align: center; padding: 2.5rem 1rem; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); margin: 1.5rem 0; }
.empty-ico { font-size: 2.4rem; }
.empty p { max-width: 34rem; margin: .6rem auto; color: var(--ink-2); }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.2rem; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: var(--radius); margin: 1rem 0; }
.banner-actions { display: flex; gap: .5rem; }
.warn-box { background: var(--warn-soft); border-left: 4px solid var(--warn); padding: .7rem 1rem; border-radius: 8px; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .4rem 0 1rem; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }

/* ---------- anillos ---------- */
.ring { display: block; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--tone, var(--accent)); transition: stroke-dasharray .8s cubic-bezier(.3, .7, .2, 1); }
.ring-ok .ring-fg { stroke: var(--ok); }
.ring-low .ring-fg { stroke: var(--warn); }

/* ---------- portada ---------- */
.hero { background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 70%, var(--bg)) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); padding: 1.6rem clamp(.9rem, 3vw, 2rem) 1.4rem; }
.hero-in, .hero-cards { max-width: 1080px; margin: 0 auto; }
.hero-in { display: grid; grid-template-columns: 1.05fr 1fr; gap: 1.5rem; align-items: center; }
.hero-copy h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.hero-sub { font-size: 1.08rem; color: var(--ink-2); max-width: 32rem; margin: .4rem 0 1rem; }
.hero-sub em { font-style: normal; font-weight: 700; color: var(--ink); }
.hero-stats { display: flex; gap: 1.4rem; flex-wrap: wrap; color: var(--muted); font-size: .95rem; }
.hero-stats b { color: var(--ink); font-size: 1.3rem; margin-right: .2rem; }
.hero-art-wrap { border-radius: 20px; overflow: hidden; background: color-mix(in srgb, var(--sun) 14%, var(--surface)); border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 640 / 300; }
.hero-art { width: 100%; height: 100%; display: block; }
.art-sun { fill: var(--sun); opacity: .55; }
.art-hill.h1 { fill: var(--hill-1); } .art-hill.h2 { fill: var(--hill-2); } .art-hill.h3 { fill: var(--hill-3); }
.art-trail { fill: none; stroke: var(--trail); stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 1 9; }
.art-trail-fg { fill: none; stroke: var(--accent); stroke-width: 4.5; stroke-linecap: round; transition: stroke-dasharray 1.4s cubic-bezier(.3, .7, .2, 1); }
.art-node circle { fill: var(--surface); stroke: var(--trail); stroke-width: 2.4; }
.art-node text { font: 700 10px var(--sans); fill: var(--muted); }
.art-node.start circle { fill: var(--accent); stroke: var(--accent); }
.art-node.started circle { stroke: var(--accent); }
.art-node.cur circle { stroke: var(--accent-2); stroke-width: 3; }
.art-node.done circle { fill: var(--accent); stroke: var(--accent); } .art-node.done text { fill: #fff; }
.art-flag path:first-child { stroke: var(--ink-2); stroke-width: 2.2; fill: none; stroke-linecap: round; }
.flag-cloth { fill: var(--accent-2); } .flag-base { fill: var(--accent-2); stroke: var(--surface); stroke-width: 2; }
.hero-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem; }
.card { display: flex; flex-direction: column; gap: .25rem; padding: 1rem 1.15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
a.card:hover { border-color: var(--accent); transform: translateY(-1px); transition: transform .15s; }
.card strong { font-size: 1.08rem; line-height: 1.3; }
.card-eyebrow { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.card-sub { font-size: .9rem; color: var(--muted); }
.card-go { margin-top: auto; padding-top: .4rem; color: var(--accent); font-weight: 600; font-size: .95rem; }
.week-dots { display: flex; gap: .55rem; margin: .35rem 0 .3rem; }
.wd { display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .72rem; color: var(--muted); }
.wd i { width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 2px solid var(--line-2); }
.wd.on i { background: color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }
.wd.hi i { background: var(--accent); }
.week-sum { font-size: .88rem; color: var(--muted); }
.strip-weak { max-width: 1080px; margin: 1rem auto 0; padding: 0 clamp(.9rem, 3vw, 2rem); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.strip-h { font-weight: 700; font-size: .9rem; color: var(--warn); }
.strip-more { margin-left: auto; font-size: .9rem; }

/* ---------- ruta por niveles ---------- */
.route { max-width: 1080px; margin: 0 auto; padding: 1.4rem clamp(.9rem, 3vw, 2rem); }
.route-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.route-head h2 { margin: 0; }
.legend { display: flex; gap: 1rem; list-style: none; padding: 0; margin: .4rem 0; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: .35rem; }
.lg { width: .8rem; height: .8rem; border-radius: 4px; display: inline-block; }
.lg-mastered { background: var(--ok); } .lg-progress { background: var(--accent); opacity: .55; } .lg-weak { background: var(--warn); } .lg-soon { background: var(--line-2); opacity: .55; } .lg-new { background: var(--surface); border: 1.5px solid var(--line-2); }
.route-list { margin-top: 1rem; }
.lv { display: grid; grid-template-columns: 64px 1fr; gap: 1.2rem; }
.lv-rail { display: flex; flex-direction: column; align-items: center; }
.lv-node { position: relative; width: 64px; height: 64px; flex: none; color: var(--tone); background: var(--surface); border-radius: 50%; box-shadow: var(--shadow); }
.lv-node .ring-fg { stroke: var(--tone); }
.lv-ico { position: absolute; inset: 0; display: grid; place-items: center; }
.lv-line { position: relative; flex: 1; width: 0; margin: .3rem 0; border-left: 3px dotted var(--line-2); min-height: 1.5rem; }
.lv-line::after { content: ""; position: absolute; left: -3px; top: 0; width: 3px; height: calc(var(--p) * 100%); background: var(--tone); border-radius: 3px; }
.lv:last-child .lv-line { display: none; }
.lv-body { padding-bottom: 1.6rem; min-width: 0; }
.lv-head { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--tone); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.lv.is-current .lv-head { border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone), var(--shadow); }
.lv.is-empty { opacity: .8; }
.lv-eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--tone); font-weight: 700; }
.lv-head h2 { margin: .1rem 0 .3rem; font-size: 1.5rem; }
.lv-desc { margin: 0 0 .6rem; color: var(--ink-2); max-width: 46rem; }
.lv-meta { display: flex; gap: .5rem 1.1rem; flex-wrap: wrap; align-items: center; font-size: .88rem; color: var(--muted); }
.lv-meta b { color: var(--ink); }
.lv-chaps { margin-top: .6rem; }
.lv-chaps summary { cursor: pointer; padding: .4rem .2rem; color: var(--ink-2); font-weight: 600; font-size: .92rem; list-style: none; display: flex; align-items: center; gap: .5rem; }
.lv-chaps summary::-webkit-details-marker { display: none; }
.lv-chaps summary::before { content: "▸"; transition: transform .15s; color: var(--tone); }
.lv-chaps[open] summary::before { transform: rotate(90deg); }
.lv-sum-n { font-size: .75rem; background: var(--line); border-radius: 99px; padding: 0 .5rem; color: var(--muted); }
.chapters { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .55rem; }
.chap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.chap a, .chap.s-soon { display: grid; grid-template-columns: 38px 1fr; gap: .1rem .7rem; align-items: center; padding: .55rem .75rem; text-decoration: none; color: var(--ink); }
.chap a:hover { border-radius: 12px; background: var(--accent-soft); }
.chap-ring { grid-row: span 2; position: relative; width: 38px; height: 38px; display: grid; place-items: center; --tone: var(--accent); }
.chap-ring .ring { position: absolute; inset: 0; }
.chap-ring b { font-size: .78rem; color: var(--muted); }
.chap-title { font-weight: 600; font-size: .94rem; line-height: 1.25; }
.chap-badge { font-size: .76rem; color: var(--muted); }
.chap.s-dominado .ring-fg { stroke: var(--ok); } .chap.s-dominado .chap-ring b { color: var(--ok); } .chap.s-dominado .chap-badge { color: var(--ok); }
.chap.s-reforzar { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); } .chap.s-reforzar .ring-fg { stroke: var(--warn); } .chap.s-reforzar .chap-badge { color: var(--warn); font-weight: 600; }
.chap.s-curso .chap-badge { color: var(--accent); }
.chap.s-soon { opacity: .55; border-style: dashed; cursor: default; }

/* ---------- capítulo ---------- */
.chapter-layout { max-width: 1180px; margin: 0 auto; padding: 1.4rem clamp(.9rem, 3vw, 2rem) 2rem; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 2.4rem; }
.toc { position: sticky; top: 4.6rem; align-self: start; font-size: .92rem; max-height: calc(100vh - 6rem); overflow: auto; }
.toc-box summary { font-weight: 700; cursor: pointer; margin-bottom: .4rem; color: var(--ink-2); }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: .32rem .8rem; color: var(--muted); text-decoration: none; margin-left: -2px; border-left: 2px solid transparent; }
.toc li a:hover { color: var(--ink); }
.toc li a.on { color: var(--tone); border-left-color: var(--tone); font-weight: 600; }
.tp { display: flex; align-items: center; gap: .7rem; margin-top: 1rem; padding: .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: .88rem; color: var(--muted); }
.tp .ring { --tone: var(--tone); flex: none; } .tp b { color: var(--ink); font-size: 1rem; }
.chapter { min-width: 0; max-width: 780px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: .6rem; }
.crumbs a { color: var(--muted); }
.ch-title-row { display: flex; align-items: center; gap: .8rem; }
.ch-icon { color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, var(--surface)); border-radius: 14px; padding: .55rem; display: grid; }
.ch-title-row h1 { margin: 0; }
.ch-head { padding-bottom: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.ch-meta { display: flex; gap: .5rem 1.2rem; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .92rem; margin-top: .5rem; }
.ch-req { margin-top: .8rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .9rem; color: var(--muted); }
.req { display: inline-flex; gap: .35rem; align-items: center; padding: .15rem .65rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); text-decoration: none; color: var(--ink-2); font-size: .85rem; }
.req i { font-style: normal; color: var(--muted); } .req-dominado i { color: var(--ok); } .req-reforzar i { color: var(--warn); }
.req-soon { opacity: .55; border-style: dashed; }
.ch-foot { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.ch-foot-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.ch-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.2rem; }
.ch-nav-a { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1.1rem; border: 1px solid var(--line-2); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--surface); }
.ch-nav-a:hover { border-color: var(--accent); }
.ch-nav-a small { color: var(--muted); } .ch-nav-a.next { text-align: right; grid-column: 2; }

/* ---------- prosa del capítulo ---------- */
.prose { font-family: var(--serif); font-size: 1.08rem; line-height: 1.75; color: var(--ink); }
.prose h2, .prose h3, .prose h4, .prose .callout-title, .prose table, .prose .ex, .prose .rv { font-family: var(--sans); }
.prose h2 { margin: 2.6rem 0 .8rem; padding-top: .6rem; font-size: 1.55rem; border-top: 1px solid var(--line); }
.prose > h2:first-child { border-top: 0; margin-top: 1rem; }
.prose h3 { font-size: 1.2rem; color: var(--ink-2); }
.prose p { margin: .85rem 0; }
.prose ul, .prose ol { padding-left: 1.5rem; } .prose li { margin: .35rem 0; }
.prose li > p { margin: .3rem 0; }
.prose strong { color: var(--ink); }
.prose img, .prose svg:not(.lv-icon) { max-width: 100%; height: auto; }
.prose .katex-display { margin: 1.1rem 0; overflow-x: auto; overflow-y: hidden; padding: .2rem 0; }
.prose .katex { font-size: 1.08em; }
.math-error { color: var(--bad); background: var(--bad-soft); padding: 0 .3rem; font-family: monospace; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.prose table, .page table { border-collapse: collapse; width: 100%; font-size: .96rem; }
.prose th, .prose td, .page th, .page td { border: 1px solid var(--line-2); padding: .45rem .75rem; text-align: left; vertical-align: top; }
.prose th, .page th { background: var(--surface-2); font-weight: 600; }
.prose td .katex-display { margin: .3rem 0; }
.prose blockquote { margin: 1rem 0; padding: .2rem 1.1rem; border-left: 4px solid var(--line-2); color: var(--ink-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* figuras (recta numérica, fracciones) */
.fig { margin: 1.4rem 0; text-align: center; font-family: var(--sans); }
.fig svg { max-width: 100%; height: auto; color: var(--ink-2); overflow: visible; }
.fig figcaption { font-size: .9rem; color: var(--muted); margin-top: .35rem; }
.fig .ax { stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.fig .tk { stroke: currentColor; stroke-width: 1.5; }
.fig .lb { fill: currentColor; font: 600 13px var(--sans); text-anchor: middle; }
.fig .arc { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.fig .seg { stroke-width: 7; stroke-linecap: butt; opacity: .55; }
.fig .end { stroke-width: 2.5; }
.fig .end.open { fill: var(--surface) !important; }
.fig .pt-accent, .fig .end-accent, .fig .mk-accent { fill: var(--accent); } .fig .lb-accent { fill: var(--accent); } .fig .arc-accent, .fig .seg-accent, .fig .end-accent { stroke: var(--accent); }
.fig .pt-ok, .fig .end-ok, .fig .mk-ok { fill: var(--ok); } .fig .lb-ok { fill: var(--ok); } .fig .arc-ok, .fig .seg-ok, .fig .end-ok { stroke: var(--ok); }
.fig .pt-warn, .fig .end-warn, .fig .mk-warn { fill: var(--warn); } .fig .lb-warn { fill: var(--warn); } .fig .arc-warn, .fig .seg-warn, .fig .end-warn { stroke: var(--warn); }
.fig .pt-bad, .fig .end-bad, .fig .mk-bad { fill: var(--bad); } .fig .lb-bad { fill: var(--bad); } .fig .arc-bad, .fig .seg-bad, .fig .end-bad { stroke: var(--bad); }
.fig .pt-info, .fig .end-info, .fig .mk-info { fill: var(--info); } .fig .lb-info { fill: var(--info); } .fig .arc-info, .fig .seg-info, .fig .end-info { stroke: var(--info); }
.fr-row { display: flex; gap: 1.6rem 2rem; flex-wrap: wrap; justify-content: center; align-items: flex-end; }
.fr-item svg { display: block; margin: 0 auto; max-width: 100%; } .fr-item svg[viewBox="0 0 100 100"] { width: 96px; }
.fr-cell { fill: var(--surface); stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.fr-on { fill-opacity: .6; } .fr-accent { fill: var(--accent); } .fr-ok { fill: var(--ok); } .fr-warn { fill: var(--warn); } .fr-bad { fill: var(--bad); } .fr-info { fill: var(--info); }
.fr-txt { font: 700 1.05rem var(--serif); margin-top: .3rem; }
.vn-u { fill: var(--surface); stroke: var(--line-2); stroke-width: 2; } .vn-u.vn-on { fill: var(--accent); fill-opacity: .4; }
.vn-on { fill: var(--accent); fill-opacity: .45; } .vn-off { fill: var(--surface); }
.vn-line { fill: none; stroke: currentColor; stroke-width: 2.4; }
.vn-name { fill: currentColor; font: 700 16px var(--serif); text-anchor: middle; font-style: italic; }
.vn-txt { fill: currentColor; font: 600 13px var(--sans); text-anchor: middle; }

.callout { margin: 1.4rem 0; padding: .9rem 1.2rem 1rem; border-radius: 12px; border: 1px solid var(--cb, var(--line-2)); border-left-width: 5px; background: var(--cbg, var(--surface)); font-family: var(--serif); }
.callout-title { font-weight: 700; font-size: .98rem; color: var(--cc, var(--ink)); display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .1rem; }
.callout-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; opacity: .85; }
.callout-body > :first-child { margin-top: .4rem; } .callout-body > :last-child { margin-bottom: 0; }
.c-definicion { --cc: var(--info); --cb: color-mix(in srgb, var(--info) 45%, transparent); --cbg: var(--info-soft); }
.c-idea { --cc: var(--accent); --cb: color-mix(in srgb, var(--accent) 45%, transparent); --cbg: var(--accent-soft); }
.c-ejemplo { --cc: var(--ok); --cb: color-mix(in srgb, var(--ok) 45%, transparent); --cbg: var(--ok-soft); }
.c-atencion { --cc: var(--warn); --cb: color-mix(in srgb, var(--warn) 50%, transparent); --cbg: var(--warn-soft); }
.c-truco { --cc: var(--accent-2); --cb: color-mix(in srgb, var(--accent-2) 45%, transparent); --cbg: color-mix(in srgb, var(--accent-2) 10%, var(--surface)); }
.c-error { --cc: var(--bad); --cb: color-mix(in srgb, var(--bad) 45%, transparent); --cbg: var(--bad-soft); }
.c-resumen { --cc: var(--lv3); --cb: color-mix(in srgb, var(--lv3) 45%, transparent); --cbg: color-mix(in srgb, var(--lv3) 9%, var(--surface)); }
.c-recuerda { --cc: var(--muted); --cb: var(--line-2); --cbg: var(--surface-2); }
.c-curiosidad { --cc: var(--lv4); --cb: color-mix(in srgb, var(--lv4) 40%, transparent); --cbg: color-mix(in srgb, var(--lv4) 8%, var(--surface)); }
.c-metodo { --cc: var(--lv2); --cb: color-mix(in srgb, var(--lv2) 45%, transparent); --cbg: color-mix(in srgb, var(--lv2) 8%, var(--surface)); }
.c-ejemplo ol, .c-metodo ol { counter-reset: st; list-style: none; padding-left: 0; }
.c-ejemplo ol > li, .c-metodo ol > li { counter-increment: st; position: relative; padding-left: 2.3rem; margin: .7rem 0; }
.c-ejemplo ol > li::before, .c-metodo ol > li::before { content: counter(st); position: absolute; left: 0; top: .12rem; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--cc); color: #fff; font: 700 .8rem var(--sans); display: grid; place-items: center; }

/* ---------- ejercicios ---------- */
.ex-host { margin: 1.4rem 0; }
.ex { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1.1rem 1.3rem 1.2rem; box-shadow: var(--shadow); font-family: var(--sans); font-size: 1rem; line-height: 1.55; }
.ex-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .5rem; }
.ex-title { font-weight: 700; color: var(--tone, var(--accent)); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
.ex-level { color: var(--tone, var(--accent)); font-size: .7rem; letter-spacing: 1px; }
.ex-head .btn-quiet { margin-left: auto; }
.ex-q { font-family: var(--serif); font-size: 1.08rem; }
.ex-q p { margin: .5rem 0; }
.ex-work { display: block; margin: .9rem 0 .4rem; font-size: .86rem; color: var(--muted); }
.ex-work em { font-style: normal; opacity: .85; }
.ex-work textarea { display: block; width: 100%; margin-top: .3rem; padding: .55rem .75rem; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--surface-2); color: var(--ink); font: .95rem/1.5 ui-monospace, Consolas, monospace; resize: vertical; min-height: 3.2rem; }
.ex-step { margin: .8rem 0; padding: .2rem 0 .2rem .9rem; border-left: 3px solid transparent; }
.ex-step.is-guia { border-left-color: var(--line-2); background: color-mix(in srgb, var(--info) 5%, transparent); border-radius: 0 10px 10px 0; padding: .5rem .8rem; }
.ex-step.ok { border-left-color: var(--ok); } .ex-step.bad { border-left-color: var(--bad); } .ex-step.near { border-left-color: var(--warn); }
.ex-step-q { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; font-weight: 600; margin-bottom: .35rem; }
.ex-step-q .katex { font-weight: 400; }
.ex-input-row { display: flex; align-items: center; gap: .5rem; }
.ex-input { flex: 1; min-width: 0; max-width: 32rem; padding: .6rem .85rem; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font: 1.08rem ui-monospace, "Cascadia Mono", Consolas, monospace; }
.ex-input:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.ex-unit { color: var(--muted); }
.ex-mark { font-weight: 800; font-size: 1.15rem; width: 1.4rem; text-align: center; }
.ok .ex-mark { color: var(--ok); } .bad .ex-mark { color: var(--bad); } .near .ex-mark { color: var(--warn); }
.ex-preview { display: none; margin-top: .3rem; color: var(--muted); font-size: .95rem; }
.ex-preview.on { display: block; } .ex-preview::before { content: "Se lee así: "; font-size: .78rem; }
.ex-keys { display: none; gap: .3rem; margin-top: .4rem; flex-wrap: wrap; }
.ex-step:focus-within .ex-keys { display: flex; }
@media (pointer: coarse) { .ex-keys { display: flex; } }
.key { min-width: 2rem; height: 1.9rem; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); font: 600 .92rem var(--sans); cursor: pointer; }
.key:hover { background: var(--accent-soft); }
.ex-step-msg { font-size: .9rem; margin-top: .3rem; color: var(--warn); } .bad .ex-step-msg { color: var(--bad); }
.ex-step-msg p { margin: 0; }
.tag { display: inline-block; font: 700 .68rem var(--sans); text-transform: uppercase; letter-spacing: .07em; padding: .12rem .5rem; border-radius: 5px; background: var(--line); color: var(--ink-2); white-space: nowrap; }
.tag.t-planteamiento { background: color-mix(in srgb, var(--dx-plan) 20%, transparent); color: var(--dx-plan); }
.tag.t-calculo { background: color-mix(in srgb, var(--dx-calc) 20%, transparent); color: var(--dx-calc); }
.tag.t-comprobacion { background: var(--ok-soft); color: var(--ok); }
.tag.t-concepto { background: color-mix(in srgb, var(--dx-conc) 20%, transparent); color: var(--dx-conc); }
.tag.t-signo { background: color-mix(in srgb, var(--dx-sign) 20%, transparent); color: var(--dx-sign); }
.tag.t-resultado { background: var(--accent-soft); color: var(--accent); }
.ex-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.hint-card { margin: .7rem 0 0; padding: .6rem .9rem; background: var(--warn-soft); border-radius: 10px; border-left: 4px solid var(--warn); font-size: .96rem; }
.hint-card .md p { margin: .2rem 0; }
.hint-n { font: 700 .72rem var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--warn); }
.ex-feedback:not(:empty) { margin-top: 1rem; padding: .8rem 1rem; border-radius: 10px; border-left: 5px solid var(--line-2); background: var(--surface-2); }
.ex-feedback.ok { border-color: var(--ok); background: var(--ok-soft); } .ex-feedback.bad { border-color: var(--bad); background: var(--bad-soft); }
.ex-feedback.warn { border-color: var(--warn); background: var(--warn-soft); } .ex-feedback.info { border-color: var(--info); background: var(--info-soft); }
.diag { display: flex; gap: .6rem; align-items: flex-start; margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed color-mix(in srgb, currentColor 25%, transparent); font-size: .95rem; }
.diag-dot { flex: none; width: .8rem; height: .8rem; margin-top: .4rem; border-radius: 50%; background: var(--c); }
.ex-solution { margin-top: 1rem; }
.sol-wrap { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); }
.sol-wrap > summary { cursor: pointer; padding: .65rem 1rem; font-weight: 600; color: var(--accent); }
.sol { padding: 0 1.1rem 1.1rem; }
.sol-h { margin: .2rem 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sol-steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.sol-step { counter-increment: s; position: relative; display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; padding: .7rem 0 .7rem 2.6rem; border-bottom: 1px solid var(--line); }
.sol-step:last-child { border-bottom: 0; }
.sol-step::before { content: counter(s); position: absolute; left: 0; top: .75rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font: 700 .8rem var(--sans); color: var(--muted); }
.sol-step .tag { align-self: start; justify-self: start; margin-top: .2rem; }
.sol-step .md { font-family: var(--serif); min-width: 0; } .sol-step .md p { margin: .25rem 0; } .sol-step .md .katex-display { margin: .5rem 0; overflow-x: auto; }
.sol-answer { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; padding: .7rem 1rem; background: var(--accent-soft); border-radius: 10px; }
.sol-answer > span { font: 700 .72rem var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.res-sep::after { content: "   ·   "; white-space: pre; color: var(--muted); }
.res-label { font-size: .9rem; color: var(--muted); }
.sol-review { display: inline-block; margin-top: .7rem; font-size: .93rem; }
.sol-mine { margin-top: .9rem; padding: .6rem .9rem; background: var(--surface); border: 1px dashed var(--line-2); border-radius: 10px; }
.sol-mine-h { font: 700 .72rem var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.sol-mine pre { margin: .3rem 0; white-space: pre-wrap; font: .92rem ui-monospace, Consolas, monospace; }
.dx-picker { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.dx-picker-h { font-weight: 600; font-size: .95rem; margin-bottom: .5rem; }
.dx-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.hint-inline { font-weight: 400; color: var(--muted); font-size: .85rem; }
.dx-advice { margin-top: .6rem; font-size: .93rem; color: var(--ink-2); } .dx-advice:empty { display: none; }
.ex-after-row { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- repaso, cuaderno ---------- */
.rev-head { display: flex; justify-content: space-between; align-items: baseline; } .rev-count { color: var(--muted); font-weight: 600; }
.rev-why { color: var(--muted); font-size: .92rem; }
.nb-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat b { font-size: 1.9rem; line-height: 1.1; color: var(--accent); } .stat span { color: var(--muted); font-size: .88rem; }
.nb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 0 1.2rem; }
.weak-row { display: grid; grid-template-columns: 1fr 5.5rem auto; gap: .8rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.weak-row:last-child { border-bottom: 0; }
.weak-title { font-weight: 600; text-decoration: none; color: var(--ink); } .weak-title:hover { text-decoration: underline; }
.weak-lv { display: flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.weak-tags { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }
.dx-tag { font-size: .74rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.weak-bar { position: relative; height: 1.4rem; background: var(--line); border-radius: 99px; overflow: hidden; }
.weak-bar i { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--ok) 55%, transparent); border-radius: 99px; }
.weak-bar span { position: relative; display: block; text-align: center; font: 700 .78rem/1.4rem var(--sans); }
.dx-bars { display: flex; flex-direction: column; gap: .55rem; }
.dx-bar { display: grid; grid-template-columns: 9.5rem 1fr 2rem; gap: .7rem; align-items: center; font-size: .92rem; }
.dx-name { display: flex; align-items: center; gap: .45rem; } .dx-name i { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; }
.dx-track { height: .7rem; background: var(--line); border-radius: 99px; overflow: hidden; } .dx-track i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.dx-track i.g { background: var(--ok); } .dx-track i.a { background: var(--warn); } .dx-track i.r { background: var(--bad); }
.dx-bar b { text-align: right; }
.advice { margin-top: 1rem; padding: .8rem 1rem; background: var(--accent-soft); border-radius: 10px; font-size: .95rem; }
.heat { display: flex; flex-direction: column; gap: .5rem; margin: .8rem 0; }
.heat-row { display: grid; grid-template-columns: 9rem 1fr; gap: .8rem; align-items: center; }
.heat-lv { display: flex; align-items: center; gap: .4rem; color: var(--tone); font-size: .9rem; } .heat-lv b { color: var(--ink-2); font-weight: 600; }
.heat-cells { display: flex; gap: .3rem; flex-wrap: wrap; }
.hc { width: 1.25rem; height: 1.25rem; border-radius: 5px; background: var(--surface); border: 1.5px solid var(--line-2); display: block; }
a.hc:hover { transform: scale(1.2); }
.hc.s-curso { background: color-mix(in srgb, var(--accent) 50%, var(--surface)); border-color: var(--accent); }
.hc.s-dominado { background: var(--ok); border-color: var(--ok); } .hc.s-reforzar { background: var(--warn); border-color: var(--warn); }
.hc.soon { background: var(--line); border-color: transparent; opacity: .5; }
.queue, .history { list-style: none; padding: 0; margin: 0; }
.queue li, .history li { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.queue li:last-child, .history li:last-child { border-bottom: 0; }
.q-t { flex: 1; display: flex; flex-direction: column; } .q-t small { color: var(--muted); }
.history li { font-size: .92rem; } .h-t { flex: 1; min-width: 0; } .h-d { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.h-mark { width: 1.3rem; font-weight: 800; } .h-ok .h-mark { color: var(--ok); } .h-fail .h-mark { color: var(--bad); }

/* ---------- exámenes ---------- */
.presets { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; } .presets-h { font-weight: 600; color: var(--muted); font-size: .9rem; }
.exam-topics details { border: 1px solid var(--line); border-radius: 12px; margin: .5rem 0; background: var(--surface-2); }
.exam-topics summary { cursor: pointer; padding: .6rem 1rem; font-weight: 600; }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: .4rem 1rem; padding: .3rem 1rem 1rem; }
.form-row { display: flex; gap: 1rem 1.5rem; flex-wrap: wrap; margin: 1rem 0; }
.form-row label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--muted); font-weight: 600; }
select, input[type=range] { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); }
.form-msg { color: var(--warn); min-height: 1.3rem; font-size: .92rem; }
.hist-table { width: 100%; border-collapse: collapse; font-size: .95rem; } .hist-table th, .hist-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; }
.nota { font-size: 1.05rem; } .nota-ok { color: var(--ok); } .nota-low { color: var(--warn); }
.exam-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: start; }
.exam-tools { display: flex; gap: .7rem; align-items: center; }
.timer { font: 700 1.5rem ui-monospace, Consolas, monospace; padding: .3rem .9rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); }
.timer.low { color: var(--bad); border-color: var(--bad); }
.exam-list { display: flex; flex-direction: column; gap: 1.1rem; margin: 1.2rem 0; }
.qcard { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1rem 1.3rem 1.2rem; box-shadow: var(--shadow); }
.qcard-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .3rem; } .qcard-ch { color: var(--muted); font-size: .85rem; }
.print-work { display: none; }
.exam-submit { text-align: center; padding: 1rem 0 2rem; }
.result-head { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.result-ring { position: relative; width: 132px; height: 132px; flex: none; }
.result-nota { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.result-nota b { font-size: 2.4rem; line-height: 1; } .result-nota span { color: var(--muted); font-size: .8rem; }
.result-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.topic-bars { display: flex; flex-direction: column; gap: .55rem; } .tb { display: grid; grid-template-columns: 1fr 7rem 2.6rem; gap: .7rem; align-items: center; font-size: .92rem; } .tb b { text-align: right; }
.rv-tabs { display: flex; gap: .5rem; margin: 1.5rem 0 .8rem; }
.rv { background: var(--surface); border: 1px solid var(--line-2); border-left: 6px solid var(--line-2); border-radius: var(--radius); padding: 1rem 1.3rem; margin: 1rem 0; font-family: var(--sans); box-shadow: var(--shadow); }
.rv-ok { border-left-color: var(--ok); } .rv-near { border-left-color: var(--warn); } .rv-bad { border-left-color: var(--bad); }
.rv-head { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; } .rv-chapter { color: var(--muted); font-size: .85rem; } .rv-score { margin-left: auto; font-weight: 800; }
.rv-ok .rv-score { color: var(--ok); } .rv-near .rv-score { color: var(--warn); } .rv-bad .rv-score { color: var(--bad); }
.rv-table { font-size: .93rem; } .rv-glyph { font-weight: 800; margin-right: .3rem; }
.rv-correcto .rv-glyph { color: var(--ok); } .rv-error .rv-glyph, .rv-trampa .rv-glyph { color: var(--bad); } .rv-formato .rv-glyph, .rv-ilegible .rv-glyph, .rv-vacio .rv-glyph { color: var(--warn); }
.rv-msg { color: var(--warn); font-size: .86rem; } .rv-q { min-width: 8rem; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .chapter-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .toc { position: static; max-height: none; } .toc-box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; } .toc-box:not([open]) summary { margin: 0; }
  .toc-progress { display: none; }
  .hero-in { grid-template-columns: 1fr; } .hero-art-wrap { order: -1; max-height: 210px; }
  .hero-cards { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { padding-bottom: 4rem; }
  .topbar { flex-wrap: wrap; gap: .5rem; } .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; } .top-tools { margin-left: auto; }
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; border: 0; border-top: 1px solid var(--line-2); padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom)); flex-wrap: nowrap; justify-content: space-around; gap: 0; background: var(--surface); }
  .tabs a { flex-direction: column; gap: .1rem; font-size: .68rem; padding: .3rem .4rem; border-radius: 10px; flex: 1; text-align: center; } .tabs a svg { width: 22px; height: 22px; }
  .count { position: absolute; top: 0; right: 18%; }
  .lv { grid-template-columns: 44px 1fr; gap: .7rem; } .lv-node { width: 44px; height: 44px; } .lv-node .ring { width: 44px; height: 44px; } .lv-ico svg { width: 22px; height: 22px; }
  .lv-head { padding: .8rem .9rem; }
  .ex { padding: .9rem 1rem 1rem; } .ex-input { font-size: 1rem; }
  .weak-row { grid-template-columns: 1fr auto; } .weak-bar { grid-column: 1 / -1; grid-row: 2; }
  .dx-bar { grid-template-columns: 7.5rem 1fr 1.6rem; } .heat-row { grid-template-columns: 1fr; gap: .2rem; }
  .sol-step { grid-template-columns: 1fr; padding-left: 2.4rem; }
  .ch-nav { grid-template-columns: 1fr; } .ch-nav-a.next { grid-column: auto; }
  .footer { padding-bottom: 5rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- impresión (exámenes en blanco y correcciones) ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --ink-2: #222; --muted: #444; --line: #bbb; --line-2: #999; --shadow: none; }
  .topbar, .tabs, .footer, .skip, .ex-keys, .ex-preview, .ex-actions, .exam-tools, .exam-submit, .rv-tabs, .result-actions, .ex-mark, .hint { display: none !important; }
  body { background: #fff; padding: 0; display: block; } main { opacity: 1 !important; }
  .qcard, .rv, .ex { break-inside: avoid; box-shadow: none; }
  .ex-input { border: 0; border-bottom: 1.5px solid #000; border-radius: 0; background: transparent; min-height: 2rem; }
  .exam-page .ex-step-q { font-weight: 600; }
  .print-work { display: block; height: 4.5cm; border: 1px dashed #999; border-radius: 6px; padding: .3rem .6rem; color: #777; font-size: .85rem; margin-top: .7rem; }
  .sol-wrap { border: 0; } .sol-wrap > summary { display: none; }
  a { color: #000; text-decoration: none; }
}
