/* Rediseño v1.2: paleta DuoPogo saturada, fondo blanco y fuente redondeada (Nunito, licencia OFL) */
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400 900; font-display: swap; src: url('fonts/nunito-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400 900; font-display: swap; src: url('fonts/nunito-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f4f7f8;
  --ink: #2b3a42;
  --ink-soft: #4b5a61;
  --muted: #7b8a91;
  --line: #e3e8eb;
  --line-dark: #cfd8dc;
  --brand: #3cb46e;
  --brand-dark: #2a9157;
  --brand-tint: #dcf7e7;
  --petrol: #1f6f78;
  --blue: #2fa6de;
  --blue-dark: #1c86b8;
  --blue-tint: #def3fd;
  --purple: #8f6af5;
  --purple-dark: #6f4ad6;
  --orange: #ff9d2e;
  --gold: #ffc533;
  --accent: #ffb020;
  --ok: #3cb46e;
  --ok-dark: #2a9157;
  --ok-bg: #dcf7e7;
  --ko: #ef5a5a;
  --ko-dark: #cc3d3d;
  --ko-bg: #ffe5e5;
  --locked: #e3e8eb;
  --radius: 16px;
  --shadow: 0 4px 0 var(--line);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131f24;
    --surface: #18262c;
    --soft: #1f3038;
    --ink: #eef5f7;
    --ink-soft: #c8d6dc;
    --muted: #93a7b0;
    --line: #34474f;
    --line-dark: #456069;
    --brand-tint: #1d3b2b;
    --blue-tint: #183747;
    --ok-bg: #1d3b2b;
    --ko-bg: #46262a;
    --locked: #34474f;
  }
}
:root[data-theme="dark"] {
    --bg: #131f24;
    --surface: #18262c;
    --soft: #1f3038;
    --ink: #eef5f7;
    --ink-soft: #c8d6dc;
    --muted: #93a7b0;
    --line: #34474f;
    --line-dark: #456069;
    --brand-tint: #1d3b2b;
    --blue-tint: #183747;
    --ok-bg: #1d3b2b;
    --ko-bg: #46262a;
    --locked: #34474f;
  }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; cursor: pointer; }

/* Cabecera */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; gap: 12px;
}
.brand { font-weight: 800; font-size: 22px; color: var(--brand); letter-spacing: -.5px; }
.stats { display: flex; gap: 14px; font-weight: 700; }
.stat { display: flex; align-items: center; gap: 4px; }

/* Ruta de niveles */
.unit {
  background: var(--brand); color: #fff; border-radius: var(--radius);
  padding: 14px 16px; margin: 6px 0 18px; box-shadow: var(--shadow);
}
.unit small { opacity: .85; display: block; }
.unit strong { font-size: 18px; }
.path { display: flex; flex-direction: column; align-items: center; gap: 22px; padding-bottom: 40px; }
.node {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; padding: 0;
}
.node .disc {
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center; font-size: 32px;
  background: var(--brand); box-shadow: 0 6px 0 var(--brand-dark);
  transition: transform .1s;
}
.node:active .disc { transform: translateY(4px); box-shadow: 0 2px 0 var(--brand-dark); }
.node.done .disc { background: var(--accent); box-shadow: 0 6px 0 #c47f22; }
.node.locked .disc { background: var(--locked); box-shadow: 0 6px 0 rgba(0,0,0,.12); filter: grayscale(1); }
.node.locked { cursor: not-allowed; }
.node .label { font-weight: 700; }
.node .sub { font-size: 13px; color: var(--muted); margin-top: -6px; }
.node .stars { font-size: 13px; letter-spacing: 2px; min-height: 18px; }
.footer-note { text-align: center; color: var(--muted); font-size: 13px; padding: 0 0 24px; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }

/* Lección */
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 14px 0; }
.icon-btn { background: none; border: 0; font-size: 22px; padding: 4px 8px; color: var(--muted); }
.bar { flex: 1; height: 14px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }
.hearts { font-weight: 700; color: var(--ko); min-width: 44px; text-align: right; }

.content { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 8px 0 24px; }
.tag {
  align-self: flex-start; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent);
  padding: 4px 10px; border-radius: 99px;
}
.prompt { font-size: 21px; font-weight: 700; margin: 0; }

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  text-align: left; background: var(--surface); border: 2px solid var(--line);
  border-radius: 14px; padding: 14px 16px; box-shadow: 0 3px 0 var(--line);
}
.opt.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); box-shadow: 0 3px 0 var(--brand); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 3px 0 var(--ok); }
.opt.wrong { border-color: var(--ko); background: var(--ko-bg); box-shadow: 0 3px 0 var(--ko); }
.opt:disabled { cursor: default; }
.tf { flex-direction: row; }
.tf .opt { flex: 1; text-align: center; font-weight: 700; padding: 20px; }

.sentence {
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: 16px; font-size: 18px; line-height: 2.1;
}
.blank {
  display: inline-block; min-width: 90px; border: 0; border-bottom: 2px solid var(--muted);
  background: none; padding: 0 8px; margin: 0 2px; text-align: center; font-weight: 700; line-height: 1.6;
}
.blank.filled { border-bottom-color: var(--brand); color: var(--brand); }
.blank.next { border-bottom-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px;
  padding: 10px 14px; box-shadow: 0 3px 0 var(--line); font-weight: 600;
}
.chip.used { visibility: hidden; }
.answer-line {
  min-height: 64px; border-bottom: 2px solid var(--line); padding: 8px 0;
  display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start;
}

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .opt { text-align: center; padding: 12px 8px; font-size: 15px; }
.match .opt.paired { opacity: .45; border-color: var(--ok); }

/* Botón principal y hoja de feedback */
.actions { position: sticky; bottom: 0; padding: 12px 0 16px; background: var(--bg); }
.primary {
  width: 100%; border: 0; border-radius: 14px; padding: 15px;
  background: var(--brand); color: #fff; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  box-shadow: 0 4px 0 var(--brand-dark);
}
.primary:disabled { background: var(--locked); box-shadow: none; color: var(--muted); cursor: default; }
.primary.ok { background: var(--ok); box-shadow: 0 4px 0 #1f7041; }
.primary.ko { background: var(--ko); box-shadow: 0 4px 0 #a33232; }
.secondary {
  width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 13px;
  background: var(--surface); font-weight: 700; margin-top: 10px;
}
.feedback {
  border-radius: 14px; padding: 14px 16px; margin-bottom: 12px;
  animation: up .2s ease-out;
}
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.ko { background: var(--ko-bg); color: var(--ko); }
.feedback h3 { margin: 0 0 4px; font-size: 18px; }
.feedback p { margin: 0; color: var(--ink); }
.feedback .sol { margin-top: 6px; font-weight: 700; color: var(--ink); }
@keyframes up { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Lectura del artículo y resultados */
.reading { background: var(--surface); border-radius: var(--radius); padding: 18px; border: 2px solid var(--line); }
.reading p { margin: 0 0 10px; }
.reading p:last-child { margin: 0; }
.center { text-align: center; }
.big-emoji { font-size: 64px; margin: 24px 0 8px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.kpi { background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 12px 6px; text-align: center; }
.kpi b { display: block; font-size: 22px; }
.kpi span { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.muted { color: var(--muted); }

.stats .sound-btn { padding: 0 2px; font-size: 18px; }
.lesson-top .sound-btn { font-size: 18px; padding: 4px; }

/* v0.3: meta diaria, práctica, dominio, simulacro */
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.goal { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.goal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.goal-bar { flex: none; height: 12px; }
.goal-bar > i { background: var(--accent); }
.practice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.pcard {
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 3px 0 var(--line);
  padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
}
.pcard b { font-size: 14px; line-height: 1.2; }
.pcard small { font-size: 12px; color: var(--muted); }
.pcard.hot { border-color: var(--brand); box-shadow: 0 3px 0 var(--brand); }
.pcard.hot small { color: var(--brand); font-weight: 700; }
.pcard.warn { border-color: var(--ko); box-shadow: 0 3px 0 var(--ko); }
.pcard.warn small { color: var(--ko); font-weight: 700; }
.pico { font-size: 24px; }
.node .disc { position: relative; }
.crown { position: absolute; top: -14px; right: -6px; font-size: 24px; }
.node.exam .disc { background: #6b4fbb; box-shadow: 0 6px 0 #4d378c; }
.node.exam.locked .disc { background: var(--locked); box-shadow: 0 6px 0 rgba(0,0,0,.12); }
.hearts.free { color: var(--brand); font-size: 20px; }
.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 10;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600;
  width: max-content; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2);
  animation: up .2s ease-out; transition: opacity .3s;
}
.toast.out { opacity: 0; }
.combo { font-weight: 800; color: var(--accent); margin-bottom: 4px; font-size: 17px; }
.write-input {
  font: inherit; font-size: 18px; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); width: 100%;
}
.write-input:focus { outline: none; border-color: var(--brand); }
.write-input.right { border-color: var(--ok); background: var(--ok-bg); }
.write-input.wrong { border-color: var(--ko); background: var(--ko-bg); }
.clock { font-weight: 700; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.clock.low { color: var(--ko); }
.mastery { display: flex; flex-direction: column; gap: 10px; }
.mrow { padding-left: 14px; }
.mrow.main { padding-left: 0; margin-top: 8px; }
.mrow.main .mhead { font-weight: 700; }
.mhead { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.mbar { flex: none; height: 10px; }
.mbar.hi > i { background: var(--ok); }
.mbar.mid > i { background: var(--accent); }
.mbar.lo > i { background: var(--brand); }
.review { display: flex; flex-direction: column; gap: 10px; }
.rev { background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.rev p { margin: 4px 0 0; }
.rev .bad { color: var(--ko); }
.rev .good { color: var(--ok); font-weight: 700; }
.content h3 { margin: 8px 0 0; }

/* v0.4: mascota y animaciones */
.brand { display: flex; align-items: center; gap: 6px; }
.hello { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.hello-croc { flex: none; }
.bubble {
  position: relative; margin: 0; background: var(--surface); border: 2px solid var(--line);
  border-radius: 16px; padding: 10px 14px; font-weight: 600; font-size: 15px;
  animation: bubble-in .45s .15s cubic-bezier(.2, 1.4, .4, 1) backwards;
}
.bubble::before {
  content: ''; position: absolute; left: -9px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%) rotate(45deg);
  background: var(--surface); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line);
}
@keyframes bubble-in { from { opacity: 0; transform: scale(.6) translateX(-20px); } }
.intro-head { display: flex; align-items: center; gap: 12px; }
.intro-head .prompt { margin-top: 6px; }
.hero-croc { display: block; margin: 12px auto 0; }

/* Feedback con la mascota */
.feedback { display: flex; gap: 12px; align-items: flex-start; }
.fb-croc { flex: none; margin-top: -4px; animation: pop-in .35s cubic-bezier(.2, 1.5, .4, 1) backwards; }
.fb-text { flex: 1; min-width: 0; }
.combo { animation: combo-pop .5s cubic-bezier(.2, 1.6, .4, 1) backwards; transform-origin: left center; }
@keyframes combo-pop { from { transform: scale(.3); opacity: 0; } }
@keyframes pop-in { from { transform: scale(.3) rotate(-10deg); opacity: 0; } }

/* Entrada de pantallas */
#app.enter > *:not(.static) { animation: screen-in .32s ease-out backwards; }
#app.enter > *:nth-child(2) { animation-delay: .04s; }
#app.enter > *:nth-child(3) { animation-delay: .08s; }
#app.enter > *:nth-child(4) { animation-delay: .12s; }
#app.enter > *:nth-child(5) { animation-delay: .16s; }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px); } }

/* Camino: nodos que aparecen, nodo actual que late */
.path .node .disc { animation: pop-in .4s cubic-bezier(.2, 1.4, .4, 1) backwards; }
.path .node:nth-child(2) .disc { animation-delay: .08s; }
.path .node:nth-child(3) .disc { animation-delay: .16s; }
.path .node:nth-child(4) .disc { animation-delay: .24s; }
.path .node:nth-child(5) .disc { animation-delay: .32s; }
.path .node:nth-child(6) .disc { animation-delay: .4s; }
.node.current .disc::after {
  content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 4px solid var(--brand);
  opacity: .5; animation: ring 1.6s ease-out infinite;
}
.node.exam.current .disc::after { border-color: #6b4fbb; }
@keyframes ring { from { transform: scale(.9); opacity: .6; } to { transform: scale(1.25); opacity: 0; } }
.start-bubble {
  background: var(--surface); color: var(--brand); border: 2px solid var(--line); font-weight: 800; font-size: 13px;
  text-transform: uppercase; padding: 6px 12px; border-radius: 12px; position: relative; margin-bottom: 4px;
  animation: hover-y 1.2s ease-in-out infinite alternate;
}
.start-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; background: var(--surface);
  border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg);
}
@keyframes hover-y { to { transform: translateY(-5px); } }

/* Racha, vidas, barras y respuestas */
.flame .flame-ico { display: inline-block; animation: flame 1.1s ease-in-out infinite alternate; transform-origin: 50% 90%; }
@keyframes flame { from { transform: scale(1) rotate(-4deg); } to { transform: scale(1.15) rotate(4deg); } }
.hearts.lost .heart-ico { display: inline-block; animation: heart-lost .6s ease-out; }
@keyframes heart-lost { 30% { transform: scale(1.6); filter: grayscale(1); } 60% { transform: scale(.8) rotate(-15deg); } }
.bar > i { position: relative; }
.bar > i::after { content: ''; position: absolute; left: 6px; right: 6px; top: 3px; height: 3px; border-radius: 99px; background: rgba(255,255,255,.35); }
.goal-bar > i { animation: grow 1s .2s ease-out backwards; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.opt.right { animation: right-pop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes right-pop { 50% { transform: scale(1.04); } }
.chip, .opt, .pcard, .node .disc { transition: transform .12s; }
.chip:active, .opt:active, .pcard:active { transform: scale(.96); }
.primary:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }

/* Confeti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px;
  animation-name: confetti-fall; animation-timing-function: cubic-bezier(.25, .6, .4, 1); animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .9; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* v0.5: imágenes de marca */
.brand-logo { height: 36px; width: auto; display: block; }
.croc-img { width: auto; display: block; user-select: none; -webkit-user-drag: none; transform-origin: 50% 100%; animation: img-bob 2.6s ease-in-out infinite; }
.hero-croc { margin: 12px auto 0; }
.croc-img.m-cheer { animation: img-jump .8s cubic-bezier(.3, 0, .4, 1) infinite; }
.croc-img.m-wave { animation: img-wave 1.4s ease-in-out infinite; }
.croc-img.m-sad { animation: img-sad 3s ease-in-out infinite; }
.croc-img.m-think, .croc-img.m-read { animation: img-bob 3.2s ease-in-out infinite; }
.croc-img.m-sleep { animation: img-breathe 3.6s ease-in-out infinite; }
.croc-img.m-happy { animation: img-bounce 1.8s ease-in-out infinite; }
.fb-croc { animation: pop-in .35s cubic-bezier(.2, 1.5, .4, 1) backwards, img-bob 2.6s .4s ease-in-out infinite; }
.fb-croc.m-cheer { animation: pop-in .35s cubic-bezier(.2, 1.5, .4, 1) backwards, img-jump .8s .4s cubic-bezier(.3, 0, .4, 1) infinite; }
.fb-croc.m-sad { animation: pop-in .35s cubic-bezier(.2, 1.5, .4, 1) backwards, img-sad 3s .4s ease-in-out infinite; }
@keyframes img-bob { 50% { transform: translateY(-4px) scale(1.01, .99); } }
@keyframes img-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px) rotate(-2deg); } 60% { transform: translateY(0) scale(1.03, .97); } }
@keyframes img-jump { 0%, 100% { transform: translateY(0) scale(1.04, .96); } 45% { transform: translateY(-16px) scale(.98, 1.03); } }
@keyframes img-wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes img-sad { 50% { transform: rotate(-2deg) translateY(3px); } }
@keyframes img-breathe { 50% { transform: scale(1.03, .97); } }
.illus {
  width: 100%; height: auto; display: block; border-radius: var(--radius); background: #f6f4ef;
  animation: pop-in .5s cubic-bezier(.2, 1.3, .4, 1) backwards;
}
.welcome { justify-content: center; }
.welcome .illus { margin-top: 12px; }

/* v0.6: temario completo */
.practice.four { grid-template-columns: repeat(4, 1fr); }
.practice.four .pcard b { font-size: 13px; }
@media (max-width: 380px) { .practice.four { grid-template-columns: repeat(2, 1fr); } }
.continue {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--brand); color: #fff; border: 0; border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 18px; box-shadow: 0 4px 0 var(--brand-dark);
}
.continue small { display: block; opacity: .85; font-size: 12px; }
.continue b { font-size: 17px; }
.continue .tnum { background: rgba(255,255,255,.2); color: #fff; }
.continue .go { margin-left: auto; font-size: 26px; font-weight: 800; }
.block { margin-bottom: 20px; }
.block-head { display: flex; flex-direction: column; margin: 0 0 10px; }
.block-head strong { font-size: 18px; }
.block-head small { font-size: 13px; }
.temas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tema-card {
  display: flex; align-items: flex-start; gap: 10px; text-align: left; min-width: 0;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px;
  padding: 10px; box-shadow: 0 3px 0 var(--line);
}
.tema-card:active { transform: translateY(2px); box-shadow: none; }
.tema-card.soon { opacity: .55; }
.tema-card.complete { border-color: var(--accent); box-shadow: 0 3px 0 var(--accent); }
.tnum {
  flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand); font-weight: 800; font-size: 14px;
}
.tbody { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.tbody b { font-size: 14px; line-height: 1.2; }
.tbody small { font-size: 12px; }
.tbar { flex: none; height: 8px; }
.tema-card.complete .tbar > i { background: var(--accent); }
.tema-head { margin-bottom: 14px; }
.tema-head .prompt { font-size: 19px; }
.top-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.small { font-size: 13px; }
.reading .art-head { margin: 14px 0 6px; font-size: 15px; color: var(--brand); }
.reading .art-head:first-child { margin-top: 0; }
.reading p.note { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-radius: 10px; padding: 8px 10px; font-size: 15px; }
.reading { max-height: 55vh; overflow-y: auto; }
.pre-box {
  margin: 0; padding: 12px 14px; background: var(--surface); border: 2px solid var(--line); border-radius: 12px;
  font: 600 18px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; word-break: break-word;
}
.pre-box.small { font-size: 14px; padding: 8px 10px; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table, .sheet { border-collapse: collapse; width: 100%; font-size: 14px; background: var(--surface); }
.data-table caption { text-align: left; font-weight: 700; padding: 0 0 6px; }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table thead th { text-align: left; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.sheet { font-family: Calibri, "Segoe UI", system-ui, sans-serif; }
.sheet th { background: color-mix(in srgb, var(--ink) 8%, var(--surface)); color: var(--muted); font-weight: 600; padding: 3px 6px; border: 1px solid var(--line); text-align: center; }
.sheet td { border: 1px solid var(--line); padding: 4px 6px; min-width: 56px; }
.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet td.active { outline: 2px solid #217346; outline-offset: -2px; }
.timebar { flex: none; height: 6px; }
.timebar > i { background: var(--brand); transition: width .25s linear; }
.timebar.low > i { background: var(--ko); }
.num-row { display: flex; align-items: center; gap: 10px; }
.num-row .write-input { flex: 1; }
.num-unit { font-weight: 700; color: var(--muted); }
.cls-row { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 10px; }
.cls-item { font-weight: 600; }
.segs { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { flex: 1; min-width: 0; padding: 8px 6px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 14px; }
.seg.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); font-weight: 700; }
.seg.right { border-color: var(--ok); background: var(--ok-bg); }
.seg.wrong { border-color: var(--ko); background: var(--ko-bg); }
.kbd-show { text-align: center; font-weight: 700; padding: 14px; border: 2px dashed var(--line); border-radius: 12px; min-height: 56px; }
.keys-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.key {
  min-width: 48px; padding: 10px 12px; border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 10px;
  background: var(--surface); font: 700 15px ui-monospace, Consolas, monospace;
}
.key.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.answer-line.stack, .chips.stack { flex-direction: column; align-items: stretch; }
.chips.stack .chip, .answer-line.stack .chip { text-align: left; }

/* Selector de oposición y examen de Administrativo */
.mode-bar { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.mode-seg { display: flex; gap: 6px; flex: 1; min-width: 0; }
.welcome .mode-seg { max-width: 360px; margin: 0 auto; width: 100%; }
.mode-btn { flex: 1; min-width: 0; padding: 8px 6px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); color: inherit; font: inherit; font-size: 14px; cursor: pointer; }
.mode-btn.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); font-weight: 700; }
.sup-choice { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.sup-card { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius); background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.sup-card:hover { border-color: var(--brand); }
.sup-card small { color: var(--muted, inherit); opacity: .85; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.case-box { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; font-size: 14px; max-height: 40vh; overflow: auto; }
.case-box summary { font-weight: 700; cursor: pointer; }
.case-box p { margin: 8px 0 0; }

/* ===================== Rediseño v1.2 ===================== */
/* Base: tipografía redondeada y gruesa, blanco limpio */
body { font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 17px; line-height: 1.45; color: var(--ink); background: var(--bg); font-weight: 600; }
b, strong, h1, h2, h3 { font-weight: 800; }
.prompt { font-size: 23px; font-weight: 800; line-height: 1.25; letter-spacing: -.2px; color: var(--ink); }
.muted { color: var(--muted); }
.ico { display: inline-block; vertical-align: middle; flex: none; }
.icon-btn { color: var(--line-dark); display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; min-width: 40px; min-height: 40px; }
.icon-btn:hover { background: var(--soft); color: var(--muted); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 12px; }

/* Botones 3D: sombra inferior sólida que se «hunde» al pulsar */
.primary, .secondary, .ghost {
  font-family: inherit; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; font-size: 15px;
  border-radius: 16px; min-height: 50px; padding: 13px 18px; transition: transform .08s, box-shadow .08s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
}
.primary { background: var(--brand); color: #fff; border: 0; box-shadow: 0 4px 0 var(--brand-dark); }
.primary:hover:not(:disabled) { filter: brightness(1.06); }
.primary:not(:disabled):active { transform: translateY(4px); box-shadow: 0 0 0 var(--brand-dark); }
.primary:disabled { background: var(--locked); color: var(--muted); box-shadow: 0 4px 0 var(--line-dark); opacity: .9; }
.primary.ok { background: var(--ok); box-shadow: 0 4px 0 var(--ok-dark); }
.primary.ko { background: var(--ko); box-shadow: 0 4px 0 var(--ko-dark); }
.primary.ok:active, .primary.ko:active { box-shadow: none; }
.secondary { background: var(--surface); color: var(--blue); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); margin-top: 12px; }
.secondary:active { transform: translateY(4px); box-shadow: none; }
.ghost { background: none; border: 0; color: var(--blue); min-height: 44px; margin-top: 6px; }
.link-btn { color: var(--blue); font-weight: 800; text-decoration: none; }
.primary.loading { opacity: .7; }

/* Tarjetas: borde de 2px y borde inferior más grueso */
.card, .pcard, .opt, .chip, .tema-card, .kpi, .reading, .sentence, .rev, .continue, .sup-card, .bubble, .mrow.main, .seg, .key, .cls-item {
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 0 var(--line);
}
.card { padding: 14px 16px; }
.opt { padding: 14px 16px; font-weight: 700; color: var(--ink-soft); }
.opt:hover:not(:disabled) { background: var(--soft); }
.opt.sel, .seg.sel, .key.sel { border-color: #84d0f2; background: var(--blue-tint); color: var(--blue-dark); box-shadow: 0 4px 0 #84d0f2; }
.opt.right, .seg.right { border-color: #8fdcab; background: var(--ok-bg); color: var(--ok-dark); box-shadow: 0 4px 0 #8fdcab; }
.opt.wrong, .seg.wrong { border-color: #f5a3a3; background: var(--ko-bg); color: var(--ko-dark); box-shadow: 0 4px 0 #f5a3a3; }
.chip { padding: 10px 14px; font-weight: 800; color: var(--ink-soft); }
.chip:active, .opt:active, .pcard:active, .tema-card:active, .choice-card:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }
.tf .opt { font-size: 18px; }
.tag {
  background: none; padding: 0; color: var(--purple); font-weight: 900; font-size: 13px; letter-spacing: .9px; text-transform: uppercase;
}
.sentence { font-weight: 700; }
.blank { border-bottom-width: 3px; border-color: var(--line-dark); }
.blank.filled { color: var(--blue-dark); border-color: var(--blue); }
.write-input { border: 2px solid var(--line); background: var(--soft); border-radius: 14px; font-family: inherit; font-weight: 700; }
.write-input:focus { border-color: var(--blue); background: var(--surface); }

/* Cabecera de la portada */
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg); margin: 0 -16px 12px; padding: 10px 16px;
  border-bottom: 2px solid var(--line);
}
.brand-logo { height: 32px; }
.stats { gap: 6px; align-items: center; }
.stat { font-weight: 900; font-size: 16px; gap: 3px; padding: 4px 6px; border-radius: 12px; }
.stat.streak { color: var(--orange); }
.stat.streak.off { color: var(--line-dark); }
.stat.ice { color: var(--blue); }
.stat.xp { color: #e3a400; }
.avatar-btn { border: 0; background: none; padding: 0; margin-left: 4px; border-radius: 50%; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 900; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }

/* Portada: saludo, meta, práctica, temario */
.hello { align-items: flex-end; }
.bubble { font-weight: 700; color: var(--ink-soft); padding: 12px 14px; }
.bubble::before { border-color: var(--line); }
.goal-head strong, .goal-title { display: inline-flex; align-items: center; gap: 8px; }
.bar { background: var(--line); height: 16px; border-radius: 99px; }
.bar > i { background: var(--brand); }
.goal-bar > i { background: var(--gold); }
.pcard { padding: 12px 6px 10px; gap: 6px; }
.pcard b { font-size: 14px; color: var(--ink); }
.pcard small { font-weight: 700; }
.pcard.hot { border-color: #84d0f2; box-shadow: 0 4px 0 #84d0f2; }
.pcard.hot small { color: var(--blue-dark); }
.pcard.warn { border-color: #f5a3a3; box-shadow: 0 4px 0 #f5a3a3; }
.pico { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 0; }
.c-blue { color: var(--blue); background: var(--blue-tint); }
.c-red { color: var(--ko); background: var(--ko-bg); }
.c-purple { color: var(--purple); background: color-mix(in srgb, var(--purple) 16%, transparent); }
.c-petrol { color: var(--petrol); background: color-mix(in srgb, var(--petrol) 14%, transparent); }
.block-head strong { font-size: 20px; font-weight: 900; }
.tema-card { padding: 12px 14px; }
.tnum { font-weight: 900; border-radius: 14px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.14); }
.continue { border-color: var(--brand); box-shadow: 0 4px 0 var(--brand-dark); background: var(--brand); color: #fff; }
.continue small, .continue b, .continue .go { color: #fff; }
.unit { border-radius: var(--radius); box-shadow: 0 4px 0 color-mix(in srgb, var(--brand) 60%, #000); background: var(--brand); }
.mode-seg { background: var(--soft); border: 2px solid var(--line); border-radius: 14px; padding: 4px; }
.mode-btn { font-weight: 800; border-radius: 10px; }
.mode-btn.on { background: var(--surface); color: var(--blue-dark); box-shadow: 0 2px 0 var(--line); }

/* Camino de niveles */
.node .disc { width: 72px; height: 72px; background: var(--brand); box-shadow: 0 8px 0 var(--brand-dark); }
.node .label { font-weight: 800; }
.node.done .disc { background: var(--gold); box-shadow: 0 8px 0 #d9a100; }
.node.locked .disc { background: var(--locked); box-shadow: 0 8px 0 var(--line-dark); filter: none; }
.node.exam .disc { background: var(--purple); box-shadow: 0 8px 0 var(--purple-dark); }
.node:active .disc { transform: translateY(6px); box-shadow: 0 2px 0 var(--brand-dark); }
.start-bubble { color: var(--brand); border-color: var(--line); font-weight: 900; }

/* Lección: barra gruesa, vidas y pie de comprobación a lo ancho */
.lesson-top { gap: 10px; }
.lesson-top .bar { height: 16px; }
.lesson-top .bar > i { background: var(--brand); }
.hearts { display: inline-flex; align-items: center; gap: 4px; color: var(--ko); font-weight: 900; font-size: 18px; }
.hearts.free { color: var(--blue); }
.actions { margin: 0 -16px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); background: var(--bg); }
.actions:has(.feedback) { border-top: 0; }
.actions:has(.feedback.ok) { background: var(--ok-bg); }
.actions:has(.feedback.ko) { background: var(--ko-bg); }
.feedback { background: none !important; padding: 0 0 12px; border: 0; }
.feedback h3 { font-size: 22px; font-weight: 900; }
.feedback.ok h3 { color: var(--ok-dark); }
.feedback.ko h3 { color: var(--ko-dark); }
.feedback p { color: var(--ink-soft); font-weight: 600; }
.feedback .sol { color: inherit; font-weight: 800; }
.feedback.ok .sol { color: var(--ok-dark); }
.feedback.ko .sol { color: var(--ko-dark); }
.kpi b { font-size: 24px; font-weight: 900; }
.kpi span { font-weight: 800; letter-spacing: .6px; }
.toast { background: var(--ink); color: var(--bg); font-weight: 800; border-radius: 14px; }

/* Barra de navegación inferior */
#app:has(.tabbar) { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; gap: 2px;
  background: var(--bg); border-top: 2px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; max-width: 104px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none;
  border: 2px solid transparent; border-radius: 14px; padding: 6px 2px; color: var(--muted); font-weight: 800; font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px;
}
.tab.on { color: var(--blue-dark); background: var(--blue-tint); border-color: #84d0f2; }
.tab .avatar { box-shadow: none; }

/* Portada de bienvenida, registro e inicio de sesión */
.splash { min-height: 100dvh; display: flex; flex-direction: column; padding: 24px 0 calc(20px + env(safe-area-inset-bottom)); }
.splash-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.splash-logo { width: min(260px, 70vw); height: auto; }
.splash-claim { margin: 0; font-size: 21px; font-weight: 800; color: var(--ink-soft); max-width: 320px; }
.splash-actions { display: flex; flex-direction: column; gap: 0; }
.onb-top { display: flex; align-items: center; gap: 10px; padding: 14px 0; }
.onb-top .bar { flex: 1; }
.onb-bar > i { transition: width .4s cubic-bezier(.3, 1.4, .5, 1); }
.guide { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 8px; }
.guide .croc-img { flex: none; }
.guide .bubble { font-size: 18px; color: var(--ink); }
.choice-list { display: flex; flex-direction: column; gap: 12px; }
.choice-card {
  display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 0 var(--line); font-family: inherit;
}
.choice-card.sel { border-color: #84d0f2; background: var(--blue-tint); box-shadow: 0 4px 0 #84d0f2; }
.choice-txt { display: flex; flex-direction: column; flex: 1; }
.choice-txt b { font-size: 17px; }
.choice-txt small { color: var(--muted); font-weight: 700; }
.choice-ico { width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: #fff; box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); }
.choice-ico.c0 { background: var(--brand); } .choice-ico.c1 { background: var(--petrol); } .choice-ico.c2 { background: var(--purple); } .choice-ico.c3 { background: var(--orange); }
.goal-xp { font-weight: 900; color: var(--muted); }
.choice-card.sel .goal-xp { color: var(--blue-dark); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.field {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 2px solid var(--line); border-radius: 14px;
  background: var(--soft); color: var(--line-dark);
}
.field:focus-within { border-color: var(--blue); background: var(--surface); color: var(--blue); }
.field-input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink); padding: 14px 0; outline: none; }
.form-error { margin: 0; color: var(--ko-dark); font-weight: 800; min-height: 0; }
.form-error:empty { display: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 800; margin: 18px 0 6px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 2px; background: var(--line); }
.google-btn { color: var(--ink-soft); }
.test-note { text-align: center; color: var(--muted); font-size: 13px; font-weight: 700; margin: 14px 0 0; }
.privacy-note a { color: var(--blue-dark); text-decoration: underline; }
.sync-line { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.sync-line.sync-ok { color: var(--ok-dark); }
.sync-line.sync-error, .sync-line.sync-offline { color: var(--ink-soft); }
.eyebrow { display: block; color: var(--muted); font-weight: 900; font-size: 12px; letter-spacing: .9px; text-transform: uppercase; margin: 8px 0 2px; }
.acc-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.acc-chip {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 10px 12px; font-family: inherit;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 3px 0 var(--line);
}
.acc-chip span { display: flex; flex-direction: column; min-width: 0; }
.acc-chip small { color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(19, 31, 36, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.modal-card {
  width: 100%; max-width: 520px; background: var(--bg); border-radius: 22px 22px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; animation: sheet-up .25s cubic-bezier(.2, 1, .3, 1); max-height: 90dvh; overflow: auto;
}
.modal-head { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.modal-head b { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(40%); } }

/* Perfil */
.profile-head { display: flex; align-items: center; gap: 16px; padding: 8px 0 4px; }
.profile-head .prompt { margin: 0; }
.profile-head p { margin: 2px 0 0; }
.section-title { font-size: 20px; font-weight: 900; margin: 18px 0 4px; }
.pstats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pstat { display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 0 var(--line); }
.pstat span { display: flex; flex-direction: column; }
.pstat b { font-size: 20px; font-weight: 900; line-height: 1.1; }
.pstat small { color: var(--muted); font-weight: 700; font-size: 13px; }
.settings { display: flex; flex-direction: column; gap: 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; font-weight: 800; }
.set-col { display: flex; flex-direction: column; gap: 8px; font-weight: 800; }
.set-col .mode-seg { display: flex; }
.set-col .mode-btn { flex: 1; }
.plist { padding: 4px 0; }
.prow {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; background: none; border: 0; font: inherit; font-weight: 800;
  color: var(--ink-soft); text-align: left;
}
.prow + .prow { border-top: 2px solid var(--line); }
.prow span { flex: 1; }
.prow .ico-chevron { color: var(--line-dark); }
.prow.danger { color: var(--ko); }
.guest-card { display: flex; gap: 12px; align-items: center; }
.guest-card .primary { margin-top: 8px; }

@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .opt.sel, :where(:root:not([data-theme="light"])) .seg.sel, :where(:root:not([data-theme="light"])) .key.sel, :where(:root:not([data-theme="light"])) .choice-card.sel, :where(:root:not([data-theme="light"])) .pcard.hot, :where(:root:not([data-theme="light"])) .tab.on { border-color: #2b6f91; box-shadow: 0 4px 0 #2b6f91; color: #8fd3f4; }
  :where(:root:not([data-theme="light"])) .tab.on { box-shadow: none; }
  :where(:root:not([data-theme="light"])) .opt.right, :where(:root:not([data-theme="light"])) .seg.right { border-color: #2f7a4d; box-shadow: 0 4px 0 #2f7a4d; color: #8fe3b0; }
  :where(:root:not([data-theme="light"])) .opt.wrong, :where(:root:not([data-theme="light"])) .seg.wrong { border-color: #8a3a3f; box-shadow: 0 4px 0 #8a3a3f; color: #ffaaaa; }
  :where(:root:not([data-theme="light"])) .stat.xp { color: var(--gold); }
  :where(:root:not([data-theme="light"])) .feedback.ok h3, :where(:root:not([data-theme="light"])) .feedback.ok .sol { color: #8fe3b0; }
  :where(:root:not([data-theme="light"])) .feedback.ko h3, :where(:root:not([data-theme="light"])) .feedback.ko .sol { color: #ffaaaa; }
}
:where(:root[data-theme="dark"]) .opt.sel, :where(:root[data-theme="dark"]) .seg.sel, :where(:root[data-theme="dark"]) .key.sel, :where(:root[data-theme="dark"]) .choice-card.sel, :where(:root[data-theme="dark"]) .pcard.hot, :where(:root[data-theme="dark"]) .tab.on { border-color: #2b6f91; box-shadow: 0 4px 0 #2b6f91; color: #8fd3f4; }
:where(:root[data-theme="dark"]) .tab.on { box-shadow: none; }
:where(:root[data-theme="dark"]) .opt.right, :where(:root[data-theme="dark"]) .seg.right { border-color: #2f7a4d; box-shadow: 0 4px 0 #2f7a4d; color: #8fe3b0; }
:where(:root[data-theme="dark"]) .opt.wrong, :where(:root[data-theme="dark"]) .seg.wrong { border-color: #8a3a3f; box-shadow: 0 4px 0 #8a3a3f; color: #ffaaaa; }
:where(:root[data-theme="dark"]) .stat.xp { color: var(--gold); }
:where(:root[data-theme="dark"]) .feedback.ok h3, :where(:root[data-theme="dark"]) .feedback.ok .sol { color: #8fe3b0; }
:where(:root[data-theme="dark"]) .feedback.ko h3, :where(:root[data-theme="dark"]) .feedback.ko .sol { color: #ffaaaa; }

/* ---------- Guardia Civil: marcar errores, figuras y ficha ---------- */
.mark-sentence { line-height: 2.4; }
.mark-w { font: inherit; background: none; border: none; border-bottom: 2px solid var(--brand); padding: 0 3px; margin: 0 1px; color: inherit; cursor: pointer; border-radius: 4px; }
.mark-w.sel { background: color-mix(in srgb, var(--ko) 16%, transparent); border-bottom-color: var(--ko); text-decoration: line-through; text-decoration-color: var(--ko); }
.mark-w.right { background: var(--ok-bg); border-bottom-color: var(--ok); }
.mark-w.wrong { background: var(--ko-bg); border-bottom-color: var(--ko); }
.mark-w.missed { background: var(--ko-bg); outline: 2px dashed var(--ko); }
.mark-line.sel { border-color: var(--ko); background: var(--ko-bg); box-shadow: 0 3px 0 var(--ko); }
.mark-line.missed { outline: 2px dashed var(--ko); }
.mark-line.sel.right { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 3px 0 var(--ok); }
.mark-line.sel.wrong { border-color: var(--ko); background: var(--ko-bg); }
.fig { display: flex; justify-content: center; margin: 8px 0 12px; }
.fig svg { max-width: 100%; height: auto; color: var(--ink); }
.fig-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.fig-opts .opt { display: flex; justify-content: center; padding: 10px; }
.opt-fig { margin: 0; }
.opt-fig svg { width: 96px; height: 96px; }
.rev .opt-fig svg { width: 64px; height: 64px; vertical-align: middle; }
.continue.info { margin-top: 0; }
.ficha .data-table th, .ficha .data-table td { font-size: 14px; }
/* Tres oposiciones en el selector: partir palabras largas en vez de cortarlas */
.mode-seg .mode-btn { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; line-height: 1.2; }

/* Bloques plegables de la portada */
.block-toggle {
  width: 100%; text-align: left; gap: 6px; padding: 14px; margin: 0 0 10px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 var(--line);
}
.block-toggle:active { transform: translateY(2px); box-shadow: none; }
.block-toggle.complete { border-color: var(--accent); box-shadow: 0 3px 0 var(--accent); }
.bh-top { display: flex; align-items: center; gap: 8px; }
.bh-top strong { flex: 1; min-width: 0; line-height: 1.2; }
.bh-chev { flex: none; display: grid; place-items: center; color: var(--muted, currentColor); transition: transform .2s; }
.block-toggle.open .bh-chev { transform: rotate(90deg); }
.bh-prog { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.bh-prog .bar { height: 12px; }
.bh-prog b { flex: none; min-width: 44px; text-align: right; font-size: 14px; }
.block-toggle.complete .bar > i { background: var(--accent); }
.temas[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .bh-chev { transition: none; } }

/* Tema elegido en el Perfil (claro, oscuro o el del sistema) */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Oposición en el Perfil: lista con el nombre completo */
.mode-list { display: flex; flex-direction: column; gap: 8px; }
.mode-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px;
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px; font-weight: 400;
}
.mode-opt > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.mode-opt small { font-size: 12px; }
.mode-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-dark); }
.mode-opt.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.mode-opt.on .mode-dot { border-color: var(--brand); background: radial-gradient(circle, var(--brand) 0 5px, transparent 6px); }
.welcome .mode-list { max-width: 360px; margin: 0 auto; width: 100%; }
.mode-name { margin: 4px 0 12px; font-size: 14px; }

/* v1.3.3: mejoras visuales */
/* Logo: versión clara y oscura, sin caja blanca */
.brand-logo.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .brand-logo.logo-light { display: none; }
  :where(:root:not([data-theme="light"])) .brand-logo.logo-dark { display: block; }
}
:where(:root[data-theme="dark"]) .brand-logo.logo-light { display: none; }
:where(:root[data-theme="dark"]) .brand-logo.logo-dark { display: block; }

/* Portada: tarjeta de hoy con anillo de meta */
.today { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 14px; }
.today-croc { flex: none; }
.today-text { flex: 1; min-width: 0; }
.today-text b { display: block; font-size: 15px; font-weight: 900; }
.today-text p { margin: 2px 0 0; font-size: 14px; line-height: 1.35; color: var(--ink-soft); font-weight: 600; }
.ring { position: relative; flex: none; width: 64px; height: 64px; }
.ring svg { display: block; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 7; }
.ring-fg { fill: none; stroke: var(--gold); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .8s ease-out; }
.ring.hit .ring-fg { stroke: var(--brand); }
.ring-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.ring-num b { font-size: 17px; font-weight: 900; }
.ring-num small { font-size: 11px; color: var(--muted); font-weight: 700; }

/* Portada: accesos en filas */
.quick { padding: 4px 0; margin: 0 0 18px; }
.qrow {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: 0; padding: 10px 14px; min-height: 60px; color: var(--ink);
}
.qrow + .qrow { border-top: 2px solid var(--line); }
.qrow:active { background: var(--soft); }
.qico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--blue); background: var(--blue-tint); }
.qrow.go .qico { color: var(--brand-dark); background: var(--brand-tint); }
.qrow.hot .qico { color: #fff; background: var(--blue); }
.qtext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qtext small { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.qtext b { font-size: 16px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.qrow.hot .qtext small { color: var(--blue-dark); }
.qrow > svg { flex: none; color: var(--line-dark); }
.home-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: 22px; font-weight: 900; }
.home-title small { font-size: 13px; font-weight: 700; }
.tnum svg { display: block; }

/* Camino: el zigzag mueve solo el disco, y los textos caben en la pantalla */
.path .node { width: 100%; max-width: 340px; }
.path .node:nth-child(4n+2) .disc { margin-right: 112px; }
.path .node:nth-child(4n+4) .disc { margin-left: 112px; }
.node .disc { color: #fff; }
.node.locked .disc { color: var(--muted); }
.node .label, .node .sub { max-width: 100%; text-align: center; overflow-wrap: anywhere; line-height: 1.25; padding: 0 8px; }
.node .label { font-size: 16px; }
.node .sub { margin-top: -2px; font-size: 12px; }
.node .start-bubble { align-self: center; }

/* Lectura: referencia legal debajo del título */
.intro-ref { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.lesson-top strong { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }

/* Dominio: bloques y temas plegables */
details.mblock, details.mtema { margin: 0; }
details.mblock > summary, details.mtema > summary { list-style: none; cursor: pointer; }
details.mblock > summary::-webkit-details-marker, details.mtema > summary::-webkit-details-marker { display: none; }
details.mblock[open] > summary .bh-chev { transform: rotate(90deg); }
details.mblock > .mastery { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
details.mtema > summary {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 0 var(--line);
}
details.mtema > summary .mrow.main { flex: 1; min-width: 0; margin: 0; border: 0; box-shadow: none; background: none; padding: 0; }
details.mtema > summary > svg { flex: none; color: var(--muted); transition: transform .2s; }
details.mtema[open] > summary > svg { transform: rotate(90deg); }
.munits { display: flex; flex-direction: column; gap: 10px; padding: 10px 4px 4px 10px; }

/* Ficha: tarjetas en vez de tablas */
.fcards { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .fcards { grid-template-columns: 1fr 1fr; } }
.fcard { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 0 var(--line); }
.fcard > b { font-size: 16px; font-weight: 900; }
.fcard > span { color: var(--ink-soft); font-weight: 600; }
.fnote { align-self: flex-start; font-weight: 800; color: var(--blue-dark); background: var(--blue-tint); border-radius: 99px; padding: 2px 10px; }
.pgrid { display: grid; grid-template-columns: auto repeat(3, 1fr); gap: 4px 10px; align-items: center; margin-top: 4px; font-variant-numeric: tabular-nums; }
.pgrid small { font-size: 12px; font-weight: 800; color: var(--muted); text-align: right; }
.pgrid span { text-align: right; font-weight: 800; }
.pgrid .pg-who { text-align: left; font-weight: 700; color: var(--ink-soft); }
.small { font-size: 13px; }

/* Ejercicios: contenido centrado en vertical y opciones más grandes */
.content.ex { justify-content: safe center; padding-top: 12px; gap: 18px; }
.content.ex .opt { min-height: 58px; font-size: 17px; }
@media (min-height: 760px) { .content.ex .prompt { font-size: 25px; } }
@media (prefers-reduced-motion: reduce) { details.mtema > summary > svg, .ring-fg { transition: none; } }
.tc-meta { display: inline-flex; align-items: center; gap: 6px; }
.tc-crown { display: inline-flex; color: var(--gold); }
.bh-prog .bar { flex: 1; min-width: 0; }

/* Reportar preguntas */
.report-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 0; background: none; border: 0;
  font: inherit; font-size: 13px; font-weight: 800; color: var(--muted); cursor: pointer;
}
.report-btn:hover:not(:disabled), .report-btn:focus-visible { color: var(--ink-soft); text-decoration: underline; }
.report-btn:disabled { cursor: default; opacity: .8; }
.feedback .report-btn { color: var(--ink-soft); }
.report-q { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.report-reason { text-align: left; font-weight: 700; padding: 12px 14px; }
.report-note {
  width: 100%; font: inherit; font-weight: 600; color: var(--ink); background: var(--soft); resize: vertical;
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px;
}
.report-note:focus { outline: none; border-color: var(--blue); background: var(--surface); }
.report-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.report-actions .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 0; color: var(--ink-soft); }
.report-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.report-item { display: flex; flex-direction: column; gap: 6px; }
.report-item p { margin: 0; }
.report-meta, .report-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-meta .tag { margin: 0; }
.report-meta small { flex: none; white-space: nowrap; }
.report-foot small { min-width: 0; overflow-wrap: anywhere; }
.offscreen { position: fixed; left: -9999px; top: 0; }

/* Estadísticas de estudio */
.stats-page .kpis { margin: 8px 0 12px; }
.stats-page .kpi b { font-size: 19px; }
.stat-card { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.stat-card > b { font-size: 16px; font-weight: 900; }
.stat-card .kpis { margin: 4px 0; }
.stat-card p { margin: 0; }
.chart-wrap { display: flex; flex-direction: column; gap: 4px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-axis { stroke: var(--line-dark); stroke-width: 1; }
.chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-label { fill: var(--muted); font-size: 11px; font-weight: 700; font-family: inherit; }
.chart-label.strong { fill: var(--ink-soft); font-weight: 900; }
.chart-bar { fill: var(--brand); transition: opacity .15s; }
.chart-hit { cursor: pointer; outline: none; }
.chart-wrap svg:has(.chart-bar.on) .chart-bar:not(.on) { opacity: .45; }
.chart-line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--blue); stroke: var(--surface); stroke-width: 2; }
.chart-dot.on { r: 6; }
.chart-hit:focus-visible .chart-bar, .chart-hit:focus-visible .chart-dot { stroke: var(--ink); stroke-width: 2; }
.chart-caption { margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.tacc-list { display: flex; flex-direction: column; gap: 14px; }
.acc-row { display: flex; flex-direction: column; gap: 4px; }
.acc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.acc-head b { font-variant-numeric: tabular-nums; }
.acc-name { font-weight: 800; color: var(--ink-soft); min-width: 0; }
.acc-bar { flex: none; height: 10px; }
.acc-bar > i::after { display: none; }
.sim-list { display: flex; flex-direction: column; }
.sim-row { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 10px 0; }
.sim-row + .sim-row { border-top: 2px solid var(--line); }
.sim-row small { grid-column: 1; }
.sim-row .spark { grid-column: 2; grid-row: 1 / span 2; }
