/* Pienso — Nutrición Animal I
   Tema claro: papel crema + verde forraje + dorado trigo.
   Tema oscuro: espresso + dorado. Contraste AA verificado (ver scripts/qa_pienso.py). */

:root {
  --paper: #f7f3ea;
  --paper-2: #fffdf8;
  --paper-3: #eee7d6;
  --line: #e0d7c2;
  --line-strong: #c9bfa6;
  --ink: #1f1a14;
  --ink-2: #5b5245;
  --ink-3: #6f6555;
  --forraje: #2d5a3a;
  --forraje-2: #1f4229;
  --forraje-soft: #dde9dc;
  --trigo: #c49a2e;
  --trigo-ink: #7a5b10;
  --trigo-soft: #f4e8c6;
  --on-primary: #ffffff;
  --primary-bg: var(--forraje);
  --primary-bg-2: var(--forraje-2);
  --primary-ink: var(--on-primary);
  --ok: #286b3a;
  --ok-bg: #dfeedf;
  --ok-line: #8fbf98;
  --bad: #a3372a;
  --bad-bg: #f8e3de;
  --bad-line: #e0a79c;
  --rubor: #f2d7c9;
  --rubor-2: #f8e6dc;
  --rubor-ink: #8a3d22;
  --shadow: 0 1px 2px rgba(120, 80, 30, 0.05), 0 14px 34px -14px rgba(120, 80, 30, 0.22);
  --shadow-soft: 0 1px 1px rgba(120, 80, 30, 0.04), 0 8px 22px -12px rgba(120, 80, 30, 0.16);
  --radius: 22px;
  --radius-sm: 16px;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-ui: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #1c1712;
  --paper-2: #26201a;
  --paper-3: #302820;
  --line: #3a3128;
  --line-strong: #4e4335;
  --ink: #f3ead8;
  --ink-2: #c4b69d;
  --ink-3: #9a8e78;
  --forraje: #93c99f;
  --forraje-2: #a9d6b3;
  --forraje-soft: #243527;
  --trigo: #e0c56a;
  --trigo-ink: #e0c56a;
  --trigo-soft: #3a3020;
  --on-primary: #1c1712;
  --primary-bg: #e0c56a;
  --primary-bg-2: #ead38a;
  --primary-ink: #1c1712;
  --ok: #8fd39b;
  --ok-bg: #203a28;
  --ok-line: #3f7a4d;
  --bad: #f2a195;
  --bad-bg: #4a241f;
  --bad-line: #8a4a40;
  --rubor: #4a2f26;
  --rubor-2: #3b2822;
  --rubor-ink: #f5c7b4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px -14px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 1px 1px rgba(0, 0, 0, 0.25), 0 8px 22px -12px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0; color: var(--ink); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--trigo); outline-offset: 3px; border-radius: 6px; }
.ico { width: 24px; height: 24px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.app {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 4px; }
.brand-mark { width: 22px; height: 44px; color: var(--trigo); }
.brand-name { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  transition: background-color .2s ease, color .2s ease;
}
.icon-btn:hover { background: var(--paper-3); color: var(--ink); }
.icon-btn .ico-moon { display: none; }
:root[data-theme="dark"] .icon-btn .ico-moon { display: block; }
:root[data-theme="dark"] .icon-btn .ico-sun { display: none; }

.view {
  flex: 1;
  padding: 6px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  outline: none;
  animation: view-in .42s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  margin: 0 auto;
  max-width: 680px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: color-mix(in srgb, var(--paper-2) 92%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 6;
}
.tab {
  position: relative;
  min-height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--ink-3);
  transition: color .2s ease;
}
.tab .ico { width: 26px; height: 26px; }
.tab[aria-current="page"] { color: var(--forraje); }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--trigo);
}
.tab-badge {
  position: absolute; top: 9px; left: calc(50% + 6px);
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
:root[data-theme="dark"] .tab-badge { color: #1c1712; }

/* ---------- Primitives ---------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px;
  border-radius: 18px;
  font-weight: 700; font-size: 17px;
  transition: transform .15s ease, background-color .2s ease, box-shadow .2s ease, opacity .2s ease;
  text-align: center;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--primary-bg); color: var(--primary-ink); box-shadow: 0 8px 20px -10px rgba(45, 90, 58, .55); }
.btn-primary:hover { background: var(--primary-bg-2); }
.btn-ghost { background: transparent; color: var(--forraje); border: 1.5px solid var(--line-strong); }
.btn-ghost:hover { background: var(--paper-3); }
.btn-soft { background: var(--paper-3); color: var(--ink); }
.btn-soft:hover { background: var(--line); }
.btn-block { width: 100%; }
.btn-lg { min-height: 60px; font-size: 18px; border-radius: 18px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 160px; }
.link-btn { color: var(--forraje); font-weight: 700; min-height: 48px; display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; }
.link-btn.danger { color: var(--bad); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--paper-3); color: var(--ink-2);
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.01em;
}
.pill .ico { width: 16px; height: 16px; }
.pill-trigo { background: var(--trigo-soft); color: var(--trigo-ink); }
.pill-forraje { background: var(--forraje-soft); color: var(--forraje); }
:root[data-theme="light"] .pill-forraje { color: var(--forraje-2); }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.small { font-size: 14.5px; }
.stack > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { font-size: 22px; }

.back-row { display: flex; align-items: center; margin: 2px 0 8px -10px; }
.back-link { display: inline-flex; align-items: center; gap: 2px; min-height: 48px; padding: 0 10px 0 4px; color: var(--ink-2); font-weight: 600; font-size: 15.5px; border-radius: 12px; }
.back-link:hover { color: var(--ink); background: var(--paper-3); }

/* ---------- Inicio ---------- */
.hero { padding: 10px 2px 4px; }
.hero-greet { font-size: 15.5px; color: var(--ink-2); font-weight: 600; }
.hero h1 { font-size: 34px; margin-top: 4px; }
.hero h1 em { font-style: italic; color: var(--forraje); }
.hero-sub { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.exam-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 10px; border-radius: 999px;
  background: var(--trigo-soft); color: var(--trigo-ink); font-weight: 700; font-size: 14.5px;
}
.exam-chip .ico { width: 18px; height: 18px; }
.exam-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--trigo); }

.sim-cta {
  margin-top: 20px;
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  width: 100%; min-height: 92px; padding: 18px 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--forraje) 0%, var(--forraje-2) 100%);
  color: #ffffff; text-align: left;
  box-shadow: 0 14px 34px -14px rgba(31, 66, 41, .7);
  transition: transform .15s ease, box-shadow .2s ease;
}
:root[data-theme="dark"] .sim-cta { background: linear-gradient(135deg, #e0c56a 0%, #c9a94a 100%); color: #1c1712; box-shadow: 0 14px 34px -14px rgba(224, 197, 106, .35); }
.sim-cta:active { transform: scale(.99); }
.sim-cta .sim-ico { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,.14); }
:root[data-theme="dark"] .sim-cta .sim-ico { background: rgba(28,23,18,.12); }
.sim-cta .sim-ico .ico { width: 28px; height: 28px; }
.sim-cta .sim-title { font-family: var(--font-display); font-size: 23px; font-weight: 700; letter-spacing: -0.01em; }
.sim-cta .sim-sub { font-size: 14.5px; opacity: .88; margin-top: 2px; }
.sim-cta .sim-arrow { margin-left: auto; opacity: .85; }
.sim-cta .deco { position: absolute; right: -8px; bottom: -22px; width: 52px; height: 104px; opacity: .18; }

.errors-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  border: 1px solid var(--bad-line);
  background: var(--bad-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--ink);
  min-height: 72px;
  transition: transform .15s ease;
}
.errors-card:active { transform: scale(.99); }
.errors-card .count { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--bad); color: #fff; font-weight: 800; font-size: 20px; flex: none; }
:root[data-theme="dark"] .errors-card .count { color: #1c1712; }
.errors-card .t { font-weight: 700; }
.errors-card .s { color: var(--ink-2); font-size: 14.5px; }
.errors-card .ico { margin-left: auto; color: var(--bad); }

.unit-list { display: grid; gap: 12px; }
.unit-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  padding: 14px 16px 14px 14px;
  min-height: 86px;
  transition: transform .15s ease, box-shadow .2s ease;
}
.unit-card:hover { box-shadow: var(--shadow); }
.unit-card:active { transform: scale(.99); }
.unit-num { font-family: var(--font-display); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--trigo-ink); font-weight: 700; }
.unit-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.unit-meta { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; }
.unit-card .ico { color: var(--ink-3); margin-left: auto; }

.ring { width: 56px; height: 56px; flex: none; position: relative; }
.ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--rubor); stroke-width: 5; }
:root[data-theme="dark"] .ring .track { stroke: var(--line-strong); }
.ring .bar { fill: none; stroke: var(--forraje); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray .8s cubic-bezier(.2,.8,.2,1); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13.5px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.ring.is-zero .pct { color: var(--ink-3); }

.home-foot { margin-top: 34px; text-align: center; color: var(--ink-3); font-size: 14px; }
.home-foot .link-btn { font-size: 14.5px; }

/* ---------- Unidad ---------- */
.unit-head { padding: 4px 2px 0; }
.unit-head h1 { font-size: 28px; margin-top: 4px; }
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--paper-3);
  border-radius: 16px; padding: 4px; margin: 16px 0 18px;
  gap: 4px;
}
.seg a {
  min-height: 46px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; font-weight: 700; font-size: 15.5px; color: var(--ink-2);
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.seg a[aria-current="page"] { background: var(--paper-2); color: var(--forraje); box-shadow: var(--shadow-soft); }
:root[data-theme="light"] .seg a[aria-current="page"] { color: var(--forraje-2); }

/* Repaso */
.lead {
  font-family: var(--font-display); font-size: 19px; line-height: 1.45; color: var(--ink);
  padding: 2px 2px 8px;
}
.lead::first-letter {
  font-size: 3.4em; float: left; line-height: .82; padding: 6px 8px 0 0;
  color: var(--trigo-ink); font-weight: 700;
}
.tema { padding: 18px 18px 14px; }
.tema-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tema h3 { font-size: 20px; }
.tema ul { list-style: none; margin: 12px 0 0; padding: 0; }
.tema li { position: relative; padding: 7px 0 7px 22px; color: var(--ink); }
.tema li + li { border-top: 1px dashed var(--line); }
.tema li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--trigo); }

/* Tarjetas */
.flash-wrap { display: flex; flex-direction: column; gap: 14px; }
.flash-meter { display: flex; align-items: center; justify-content: space-between; color: var(--ink-2); font-size: 14.5px; font-weight: 600; }
.flash-scene { perspective: 1400px; touch-action: pan-y; }
.flash {
  position: relative; width: 100%; min-height: 320px;
  display: block; text-align: left;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.2,.8,.2,1);
  border-radius: 24px;
}
.flash.is-flipped { transform: rotateY(180deg); }
.flash.is-leaving-left { transition: transform .25s ease, opacity .25s ease; transform: translateX(-60px) rotate(-3deg); opacity: 0; }
.flash.is-leaving-right { transition: transform .25s ease, opacity .25s ease; transform: translateX(60px) rotate(3deg); opacity: 0; }
.flash-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 22px 22px 20px;
  border-radius: 24px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.flash-face.back { transform: rotateY(180deg); background: linear-gradient(160deg, var(--paper-2), var(--forraje-soft)); }
.flash-face .eyebrow { display: flex; justify-content: space-between; align-items: center; }
.flash-face .body { flex: 1; display: grid; place-items: center; text-align: center; padding: 14px 4px; }
.flash-face .front-text { font-family: var(--font-display); font-size: 23px; line-height: 1.3; font-weight: 600; }
.flash-face .back-text { font-size: 19px; line-height: 1.45; }
.flash-face .hint { display: inline-flex; align-items: center; gap: 6px; justify-content: center; color: var(--ink-3); font-size: 13.5px; font-weight: 600; }
.flash-face .hint .ico { width: 16px; height: 16px; }
.flash-face .espiga-corner { position: absolute; right: 14px; bottom: 10px; width: 22px; height: 44px; color: var(--trigo); opacity: .45; }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flash-actions .btn-review { background: var(--trigo-soft); color: var(--trigo-ink); }
.flash-actions .btn-know { background: var(--ok-bg); color: var(--ok); }
.flash-nav { display: flex; justify-content: space-between; align-items: center; }
.flash-nav .icon-btn { border: 1.5px solid var(--line-strong); color: var(--ink-2); }
.flash-nav .icon-btn:disabled { opacity: .35; }
.flash-done { text-align: center; padding: 28px 18px; }
.flash-done .big { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--forraje); }
.tag-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Pregunta ---------- */
.q-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.progress { height: 6px; border-radius: 3px; background: var(--paper-3); overflow: hidden; flex: 1; }
:root[data-theme="dark"] .progress { background: var(--line-strong); }
.progress > i { display: block; height: 100%; width: calc(var(--p, 0) * 1%); background: var(--trigo); border-radius: 3px; transition: width .4s ease; }
.q-count { font-size: 14px; font-weight: 700; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.q-card { padding: 20px 18px 18px; }
.q-kind { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-text { font-family: var(--font-display); font-size: 21px; line-height: 1.35; font-weight: 600; margin-top: 12px; }
.q-text mark { background: var(--trigo-soft); color: var(--trigo-ink); padding: 0 .15em; border-radius: 4px; }
.opts { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 60px; padding: 12px 14px 12px 12px;
  text-align: left;
  border-radius: 18px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  transition: border-color .15s ease, background-color .15s ease, transform .12s ease;
  font-size: 17px; line-height: 1.35;
}
:root[data-theme="dark"] .opt { background: var(--paper-3); }
.opt:not(:disabled):hover { border-color: var(--line-strong); }
.opt:not(:disabled):active { transform: scale(.99); }
.opt .letter {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
  background: var(--paper-2); color: var(--ink-2); border: 1.5px solid var(--line);
}
:root[data-theme="dark"] .opt .letter { background: var(--paper-2); }
.opt .mark { margin-left: auto; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; flex: none; }
.opt .mark .ico { width: 16px; height: 16px; color: #fff; }
.opt.is-selected { border-color: var(--forraje); background: var(--forraje-soft); }
.opt.is-selected .letter { background: var(--forraje); color: var(--on-primary); border-color: var(--forraje); }
:root[data-theme="dark"] .opt.is-selected .letter { color: #1c1712; }
.opt.is-correct { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ink); }
.opt.is-correct .letter { background: var(--ok); color: #fff; border-color: var(--ok); }
.opt.is-correct .mark { display: grid; background: var(--ok); }
.opt.is-wrong { border-color: var(--bad-line); background: var(--bad-bg); }
.opt.is-wrong .letter { background: var(--bad); color: #fff; border-color: var(--bad); }
.opt.is-wrong .mark { display: grid; background: var(--bad); }
:root[data-theme="dark"] .opt.is-correct .letter, :root[data-theme="dark"] .opt.is-wrong .letter,
:root[data-theme="dark"] .opt .mark .ico { color: #1c1712; }
.opt.is-dim { opacity: .62; }
.opts-vf { grid-template-columns: 1fr 1fr; }
.opts-vf .opt { flex-direction: column; justify-content: center; gap: 6px; min-height: 84px; text-align: center; font-weight: 700; font-size: 18px; }
.opts-vf .opt .letter { width: 40px; height: 40px; border-radius: 50%; font-family: var(--font-display); font-size: 19px; }
.opts-vf .opt .mark { margin: 0; position: absolute; top: 10px; right: 10px; }
.opts-vf .opt { position: relative; }

.feedback { margin-top: 16px; border-radius: 16px; padding: 14px 16px; border: 1.5px solid var(--line); animation: fb-in .3s ease both; }
.feedback.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.feedback.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.feedback .verdict { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.bad .verdict { color: var(--bad); }
.feedback .verdict .badge { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.feedback.ok .verdict .badge { background: var(--ok); }
.feedback.bad .verdict .badge { background: var(--bad); }
.feedback .verdict .badge .ico { width: 18px; height: 18px; color: #fff; }
:root[data-theme="dark"] .feedback .verdict .badge .ico { color: #1c1712; }
.feedback .expl { margin-top: 10px; color: var(--ink); }
.trap {
  margin-top: 12px; display: flex; gap: 10px; align-items: flex-start;
  background: var(--trigo-soft); color: var(--ink);
  border-radius: 12px; padding: 10px 12px;
}
.trap .ico { width: 20px; height: 20px; color: var(--trigo-ink); flex: none; margin-top: 2px; }
.trap b { color: var(--trigo-ink); }
.pageref { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--ink-2); font-size: 14.5px; font-weight: 700; }
.pageref .ico { width: 17px; height: 17px; }
.q-actions { margin-top: 16px; }
@keyframes fb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.feedback.ok .verdict .badge { animation: pop .45s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(40,107,58,.0); } 40% { box-shadow: 0 0 0 6px rgba(40,107,58,.18); } 100% { box-shadow: 0 0 0 0 rgba(40,107,58,0); } }
.opt.is-correct.just-answered { animation: glow .9s ease both; }

/* Resumen de práctica */
.result-hero { text-align: center; padding: 26px 18px 22px; }
.result-hero .score { font-family: var(--font-display); font-size: 64px; font-weight: 700; line-height: 1; color: var(--forraje); letter-spacing: -0.03em; }
.result-hero .score small { font-size: 26px; color: var(--ink-3); font-weight: 600; letter-spacing: 0; }
.result-hero .verdict-line { margin-top: 10px; font-size: 17px; color: var(--ink-2); }
.result-hero .espiga-empty { width: 30px; height: 60px; color: var(--trigo); margin-bottom: 6px; }
.breakdown { display: grid; gap: 12px; }
.bd-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.bd-row .name { font-weight: 700; font-size: 15.5px; }
.bd-row .num { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 14.5px; font-weight: 700; }
.bd-row .progress { grid-column: 1 / -1; height: 8px; border-radius: 4px; }
.bd-row .progress > i { background: var(--forraje); border-radius: 4px; }
.review-item { padding: 16px; }
.review-item .q { font-family: var(--font-display); font-size: 18px; font-weight: 600; line-height: 1.35; }
.review-item .ans { margin-top: 10px; display: grid; gap: 6px; font-size: 15.5px; }
.review-item .ans .row { display: flex; gap: 8px; align-items: flex-start; }
.review-item .ans .row .ico { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.review-item .ans .row.ok { color: var(--ok); font-weight: 700; }
.review-item .ans .row.bad { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.review-item .expl { margin-top: 10px; color: var(--ink); font-size: 15.5px; }

/* ---------- Simulacro config ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 16px 0 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  color: var(--ink-2); font-weight: 700; font-size: 15px;
  transition: all .15s ease;
}
.chip .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line-strong); display: grid; place-items: center; }
.chip .box .ico { width: 14px; height: 14px; display: none; color: var(--on-primary); }
.chip[aria-pressed="true"] { background: var(--forraje-soft); border-color: var(--forraje); color: var(--ink); }
.chip[aria-pressed="true"] .box { background: var(--forraje); border-color: var(--forraje); }
.chip[aria-pressed="true"] .box .ico { display: block; }
:root[data-theme="dark"] .chip[aria-pressed="true"] .box .ico { color: #1c1712; }
.seg-count { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg-count .chip { justify-content: center; padding: 0; font-size: 17px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.switch { position: relative; width: 54px; height: 32px; border-radius: 16px; background: var(--line-strong); transition: background-color .2s ease; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
.switch[aria-checked="true"] { background: var(--forraje); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
:root[data-theme="dark"] .switch[aria-checked="true"]::after { background: #1c1712; }
.avail { color: var(--ink-3); font-size: 14px; }
.timer { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); font-size: 15px; }
.timer .ico { width: 18px; height: 18px; }

/* ---------- Vacíos ---------- */
.empty { text-align: center; padding: 44px 18px 30px; color: var(--ink-2); }
.espiga-empty { width: 36px; height: 72px; color: var(--trigo); display: block; margin: 0 auto 14px; opacity: .9; }
.empty h2 { font-size: 24px; color: var(--ink); margin-bottom: 8px; }
.loading { text-align: center; padding: 70px 18px; color: var(--ink-3); }
.loading .espiga-empty { animation: sway 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* ---------- Escritorio ---------- */
@media (min-width: 720px) {
  .view { padding-left: 24px; padding-right: 24px; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .tabbar { border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 18px 18px 0 0; }
  .hero h1 { font-size: 40px; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .flash { transition: none; }
  .flash.is-flipped { transform: none; }
  .flash.is-flipped .front { visibility: hidden; }
  .flash.is-flipped .back { transform: none; }
  .flash-face.back { transform: none; visibility: hidden; }
  .flash.is-flipped .flash-face.back { visibility: visible; }
}

/* ====================================================================== */
/* Recorrido: ruta, estaciones, juegos, caso, trampas, labs                */
/* ====================================================================== */
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }
.center { text-align: center; }
.lema { font-family: var(--font-display); font-style: italic; font-size: 17.5px; color: var(--ink-2); margin-top: 8px; line-height: 1.4; }
.unit-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.unit-head-row .ring { margin-top: 6px; }
.pill-bad { background: var(--bad-bg); color: var(--bad); }

/* Ruta: espina dorada con nodos */
.ruta { list-style: none; margin: 0; padding: 0 0 0 0; position: relative; }
.ruta::before { content: ""; position: absolute; left: 27px; top: 10px; bottom: 36px; width: 2px; background: repeating-linear-gradient(to bottom, var(--trigo) 0 6px, transparent 6px 12px); opacity: .7; }
.ruta-top { position: relative; height: 54px; }
.ruta-espiga { position: absolute; left: 14px; top: -6px; width: 28px; height: 56px; color: var(--trigo); }
.ruta-step { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; margin-bottom: 14px; }
.ruta-node { position: relative; z-index: 1; display: grid; place-items: center; }
.ruta-node .ring { background: var(--paper); border-radius: 50%; box-shadow: 0 0 0 4px var(--paper); }
.ruta-step.is-done .ring .bar { stroke: var(--trigo); }
.ruta-step.is-done .ring .pct { color: var(--trigo-ink); }
.ruta .unit-card { min-height: 92px; padding: 14px 14px 14px 16px; }
.unit-body { display: block; min-width: 0; flex: 1; }
.unit-body > span { display: block; }

/* Pestañas desplazables */
.seg-scroll { display: flex; grid-template-columns: none; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; border-radius: 0; background: transparent; gap: 6px; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll a { flex: none; padding: 0 16px; min-height: 44px; border-radius: 999px; background: var(--paper-3); scroll-snap-align: center; border: 1.5px solid transparent; }
.seg-scroll a[aria-current="page"] { background: var(--forraje); color: var(--on-primary); box-shadow: none; }
:root[data-theme="light"] .seg-scroll a[aria-current="page"] { color: #fff; }
:root[data-theme="dark"] .seg-scroll a[aria-current="page"] { background: var(--trigo); color: #1c1712; }

/* En 30 segundos */
.en30 { margin-top: 28px; background: linear-gradient(160deg, var(--trigo-soft), var(--paper-2) 70%); border-color: var(--trigo); border-width: 1.5px; }
.en30-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.en30-head .ico { color: var(--trigo-ink); }
.en30-head h2 { font-size: 22px; }
.en30-head .small { flex-basis: 100%; }
.en30-list { margin: 12px 0 0; padding: 0 0 0 4px; list-style: none; counter-reset: en30; }
.en30-list li { counter-increment: en30; position: relative; padding: 9px 0 9px 36px; line-height: 1.45; }
.en30-list li + li { border-top: 1px dashed var(--line-strong); }
.en30-list li::before { content: counter(en30); position: absolute; left: 0; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--trigo-ink); color: var(--paper); font-family: var(--font-display); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
:root[data-theme="dark"] .en30-list li::before { background: var(--trigo); color: #1c1712; }

/* Estaciones */
.aprende-meter { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.stations { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.station { display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 14px; min-height: 76px; transition: transform .15s ease, box-shadow .2s ease; }
.station:active { transform: scale(.99); }
.station-num { width: 40px; height: 40px; border-radius: 13px; flex: none; display: grid; place-items: center; background: var(--paper-3); color: var(--ink-2); font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.station.is-done .station-num { background: var(--ok-bg); color: var(--ok); }
.station.is-done .station-num .ico { width: 22px; height: 22px; }
.station-body { display: block; flex: 1; min-width: 0; }
.station-body > * { display: block; }
.station-body .pill { display: inline-flex; margin-bottom: 4px; }
.station-title { font-family: var(--font-display); font-size: 18.5px; font-weight: 700; line-height: 1.25; }
.station .ico:last-child { color: var(--ink-3); flex: none; }
.station-eyebrow { margin: 10px 0 8px; }
.station-frame { animation: view-in .3s ease both; }
.station-frame.slide-left { animation: slide-left .3s ease both; }
.station-frame.slide-right { animation: slide-right .3s ease both; }
@keyframes slide-left { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slide-right { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.idea { position: relative; padding: 20px 20px 18px; overflow: hidden; }
.idea h3 { font-size: 24px; margin-top: 10px; }
.idea-text { margin-top: 12px; font-size: 17px; line-height: 1.55; }
.clave { margin: 16px 0 0; padding: 14px 16px; border-left: 4px solid var(--trigo); background: var(--trigo-soft); border-radius: 6px 14px 14px 6px; }
.clave p { font-family: var(--font-display); font-size: 19px; line-height: 1.4; font-weight: 600; margin-top: 4px; }
.idea .espiga-corner { position: absolute; right: 12px; bottom: -8px; width: 26px; height: 52px; color: var(--trigo); opacity: .35; }
.idea .pageref { margin-top: 14px; }
.step-nav { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 16px; }

/* Juegos */
.game-row .game-kind { background: var(--trigo-soft); color: var(--trigo-ink); }
.game-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 4px; }
.game-head h2 { font-size: 23px; }
.game-head .pill { flex: none; margin-top: 4px; }
.match-board { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-tile { position: relative; min-height: 64px; padding: 12px 12px; border-radius: 16px; background: var(--paper-2); border: 1.5px solid var(--line); text-align: left; font-weight: 700; font-size: 15.5px; line-height: 1.3; display: flex; align-items: center; justify-content: space-between; gap: 8px; transition: transform .15s ease, border-color .15s ease, background-color .15s ease; }
.match-tile.def { font-weight: 500; font-size: 15px; background: var(--paper-3); }
:root[data-theme="dark"] .match-tile { background: var(--paper-3); }
:root[data-theme="dark"] .match-tile.def { background: var(--paper-2); }
.match-tile.is-selected { border-color: var(--forraje); background: var(--forraje-soft); }
.match-tile.is-matched { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); opacity: .85; }
.match-tile.is-matched .ico { width: 18px; height: 18px; flex: none; }
.match-tile.pop { animation: pop .4s cubic-bezier(.2,.9,.3,1.3) both; }
.shake { animation: shake .4s ease both; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.pool { margin-top: 12px; min-height: 48px; }
.chip.is-selected { background: var(--forraje-soft); border-color: var(--forraje); color: var(--ink); }
.chip.is-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.chip.is-bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.chip:disabled { opacity: .7; }
.chip.is-ok:disabled, .chip.is-bad:disabled { opacity: 1; }
.buckets { display: grid; gap: 10px; margin-top: 14px; }
.bucket { text-align: left; padding: 14px 16px; border-radius: 18px; border: 2px dashed var(--line-strong); background: var(--paper-2); min-height: 72px; display: block; transition: border-color .15s ease, background-color .15s ease; }
.bucket.is-target { border-color: var(--forraje); border-style: solid; background: var(--forraje-soft); cursor: pointer; }
.bucket:disabled { cursor: default; }
.bucket-title { display: block; font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.bucket-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bucket-items .pill .ico { width: 14px; height: 14px; }
.order-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.order-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 16px; background: var(--paper-2); border: 1.5px solid var(--line); min-height: 64px; }
:root[data-theme="dark"] .order-row { background: var(--paper-3); }
.order-row .letter { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 800; background: var(--paper-3); color: var(--ink-2); }
:root[data-theme="dark"] .order-row .letter { background: var(--paper-2); }
.order-row .txt { flex: 1; font-size: 16px; line-height: 1.35; }
.order-btns { display: flex; flex-direction: column; gap: 2px; }
.order-btns .icon-btn { width: 44px; height: 30px; border-radius: 10px; }
.order-btns .icon-btn:disabled { opacity: .3; }
.order-row.is-correct { border-color: var(--ok-line); background: var(--ok-bg); }
.order-row.is-correct .letter { background: var(--ok); color: #fff; }
.order-row.is-wrong { border-color: var(--bad-line); background: var(--bad-bg); }
.order-row.is-wrong .letter { background: var(--bad); color: #fff; }
:root[data-theme="dark"] .order-row.is-correct .letter, :root[data-theme="dark"] .order-row.is-wrong .letter { color: #1c1712; }
.order-row .mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.order-row.is-correct .mark { background: var(--ok); } .order-row.is-wrong .mark { background: var(--bad); }
.order-row .mark .ico { width: 16px; height: 16px; color: #fff; }
:root[data-theme="dark"] .order-row .mark .ico { color: #1c1712; }
.game-done { margin-top: 16px; }

/* Caso */
.caso h2 { font-size: 24px; margin-top: 10px; }
.escenario { margin-top: 12px; font-family: var(--font-display); font-size: 18px; line-height: 1.5; }
.escenario::first-letter { font-size: 3em; float: left; line-height: .85; padding: 4px 8px 0 0; color: var(--trigo-ink); font-weight: 700; }

/* Trampas */
.trampa-card { padding: 16px 18px; }
.trampa-conf, .trampa-acl { display: flex; gap: 12px; align-items: flex-start; }
.trampa-conf .ico { color: var(--bad); flex: none; margin-top: 2px; }
.trampa-acl { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.trampa-acl .ico { color: var(--ok); flex: none; margin-top: 2px; }
.trampa-card .conf { font-family: var(--font-display); font-size: 18.5px; font-weight: 600; line-height: 1.35; }
.trampa-card .eyebrow { margin-bottom: 2px; }
.trampa-card .pageref { margin-top: 10px; }

/* Labs */
.lab-head h2 { font-size: 26px; margin-top: 8px; }
.lab-head .muted { margin-top: 8px; }
.lab-head { margin-bottom: 18px; }
.lab-card h3 { font-size: 21px; }
.lab-card .small { margin-top: 4px; }
.lab-out { margin-top: 14px; display: grid; gap: 10px; }
.lab-check { margin-top: 10px; }
.lab-warn { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); font-weight: 600; border: 1.5px solid var(--bad-line); }
.slider { margin-top: 14px; }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 15.5px; }
.slider-top output { font-variant-numeric: tabular-nums; color: var(--forraje); font-weight: 800; }
.range { width: 100%; margin: 8px 0 0; -webkit-appearance: none; appearance: none; height: 44px; background: transparent; }
.range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: var(--line-strong); }
.range::-moz-range-track { height: 8px; border-radius: 4px; background: var(--line-strong); }
.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-bg); border: 3px solid var(--paper-2); box-shadow: 0 2px 6px rgba(0,0,0,.25); margin-top: -10px; }
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-bg); border: 3px solid var(--paper-2); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.fields { display: grid; gap: 10px; margin-top: 12px; }
.fields-2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; position: relative; }
.field-label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.field .num, .field .txt-in { width: 100%; min-height: 50px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--paper-2); color: var(--ink); font: inherit; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.field .txt-in { font-weight: 600; font-size: 16px; }
.field .num:focus, .field .txt-in:focus { border-color: var(--forraje); outline: none; box-shadow: 0 0 0 3px var(--forraje-soft); }
.field-unit { position: absolute; right: 14px; bottom: 14px; font-size: 13.5px; color: var(--ink-3); font-weight: 700; pointer-events: none; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kv .num { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--forraje); white-space: nowrap; font-size: 17px; }
.kv.total { border-bottom: 0; border-top: 2px solid var(--line-strong); padding-top: 12px; }
.kv.total .num { color: var(--trigo-ink); font-size: 19px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.stat-label { font-weight: 700; color: var(--ink-2); font-size: 15px; }
.stat-val { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--forraje); letter-spacing: -0.02em; line-height: 1; }
.stat-val small { font-size: 18px; color: var(--ink-3); font-family: var(--font-ui); }
.wbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; margin-bottom: 4px; }
.wbar-top .num { font-weight: 800; font-variant-numeric: tabular-nums; }
.wbar-bar { height: 10px; border-radius: 5px; }
.c-carb .wbar-bar > i { background: var(--trigo); }
.c-fat .wbar-bar > i { background: var(--forraje); }
.c-prot .wbar-bar > i { background: var(--ink-3); }

/* Deshidratación */
.dehy-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; margin-top: 12px; }
.dehy-svg { width: 100%; height: auto; display: block; }
.drop-outline { fill: var(--paper-3); stroke: var(--line-strong); stroke-width: 2; }
.drop-water { fill: #4f93c9; transition: y .35s ease, height .35s ease, fill .35s ease; }
.drop-water.lvl-mild { fill: #c49a2e; }
.drop-water.lvl-severe { fill: #d2623f; }
.drop-water.lvl-dead { fill: #6d6d6d; }
.drop-wave { fill: none; stroke: rgba(255,255,255,.65); stroke-width: 2; }
.drop-text { font-family: var(--font-display); font-weight: 700; font-size: 30px; fill: var(--ink); }
.dehy.lvl-ok .drop-text, .dehy.lvl-mild .drop-text { fill: #ffffff; }
.dehy.lvl-dead .drop-text { fill: #ffffff; }
.dehy.lvl-severe .drop-text { fill: #ffffff; }
.dehy-side { display: grid; gap: 8px; align-content: center; }
.dehy-msg { font-size: 15.5px; line-height: 1.45; }
.marks { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin-top: -6px; padding: 0 2px; }
.marks .mark-10 { margin-left: 40%; color: var(--bad); }
.marks .mark-20 { color: var(--ink-2); }

/* Cascada de energía */
.cascade { margin-top: 16px; display: grid; gap: 6px; }
.casc-row { display: grid; grid-template-columns: 112px 1fr 56px; gap: 10px; align-items: center; }
.casc-label { display: grid; line-height: 1.2; }
.casc-label b { font-family: var(--font-display); font-size: 20px; color: var(--forraje); }
.casc-label span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.casc-bar { height: 34px; border-radius: 10px; background: var(--paper-3); overflow: hidden; }
:root[data-theme="dark"] .casc-bar { background: var(--line-strong); }
.casc-bar > i { display: block; height: 100%; width: calc(var(--p, 0) * 1%); border-radius: 10px; background: linear-gradient(90deg, var(--forraje-2), var(--forraje)); transition: width .35s ease; }
:root[data-theme="dark"] .casc-bar > i { background: linear-gradient(90deg, #5f9d6c, var(--forraje)); }
.casc-row:first-child .casc-bar > i, .casc-row:nth-of-type(1) .casc-bar > i { background: linear-gradient(90deg, var(--trigo-ink), var(--trigo)); }
.casc-val { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.casc-row.is-empty .casc-val { color: var(--bad); }
.casc-loss { display: flex; align-items: center; gap: 6px; padding-left: 122px; font-size: 13.5px; font-weight: 700; color: var(--bad); }
.casc-loss .ico { width: 16px; height: 16px; }

/* Comparador de especies */
.sp-chips { margin: 6px 0 14px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-card { padding: 14px; }
.sp-card h3 { font-size: 22px; }
.sp-card .pageref { margin-top: 4px; font-size: 13px; }
.fact { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.fact p { font-size: 14.5px; line-height: 1.45; margin-top: 6px; }
.fact .pill { font-size: 12.5px; padding: 3px 9px; }
.fact .small { display: block; margin-top: 4px; font-size: 12.5px; }
.lab-card .q-text { font-size: 19px; margin: 10px 0 14px; }

/* Pearson */
.pearson { margin-top: 12px; }
.pearson-svg { width: 100%; height: auto; display: block; }
.ps-box { fill: var(--paper-3); stroke: var(--line-strong); stroke-width: 2; }
.ps-cross { stroke: var(--trigo); stroke-width: 2.5; stroke-linecap: round; }
.ps-center { fill: var(--forraje); }
:root[data-theme="dark"] .ps-center { fill: var(--trigo); }
.ps-t { font-family: var(--font-ui); font-size: 13px; fill: var(--ink-2); font-weight: 700; }
.ps-center-t { fill: #fff; font-size: 16px; font-family: var(--font-display); }
:root[data-theme="dark"] .ps-center-t { fill: #1c1712; }
.ps-name { font-size: 12.5px; fill: var(--ink-3); }
.ps-val { font-size: 17px; fill: var(--ink); font-family: var(--font-display); }
.ps-parts { fill: var(--ink-3); font-size: 12.5px; }
.ps-pct { fill: var(--forraje); font-size: 18px; font-family: var(--font-display); }

/* Simulacro en curso */
.sim-top { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; }
.sim-config .eyebrow { margin-bottom: 2px; }

@media (max-width: 400px) {
  .compare { grid-template-columns: 1fr; }
  .dehy-row { grid-template-columns: 124px 1fr; }
  .casc-row { grid-template-columns: 96px 1fr 50px; }
  .casc-loss { padding-left: 106px; }
  .fields-2 { grid-template-columns: 1fr 1fr; }
}

/* Pulidos tras captura */
.sim-cta > span:nth-child(2) { display: block; min-width: 0; flex: 1; }
.sim-cta .sim-title, .sim-cta .sim-sub { display: block; }
.ring.is-zero .bar { display: none; }

/* Pulidos 2 */
.unit-head h1 { font-size: 26px; }
.unit.is-sub .lema, .unit.is-sub > .back-row { display: none; }
.unit.is-sub .unit-head h1 { font-size: 21px; }
.unit.is-sub .unit-head-row .ring { width: 44px; height: 44px; margin-top: 0; }
.unit.is-sub .unit-head-row .ring svg { width: 44px; height: 44px; }
.unit.is-sub .unit-head-row .ring .pct { font-size: 11.5px; }
.unit.is-sub .seg { margin-top: 10px; margin-bottom: 8px; }
.unit.is-sub .seg a { min-height: 40px; font-size: 14.5px; padding: 0 13px; }
.stat { flex-direction: column; align-items: flex-start; gap: 2px; }
.casc-row { grid-template-columns: 104px 1fr 62px; }
.casc-val { font-size: 15.5px; }
@media (max-width: 400px) { .casc-row { grid-template-columns: 92px 1fr 58px; } .casc-loss { padding-left: 102px; } }
@media (hover: none) {
  .icon-btn:hover { background: transparent; color: var(--ink-2); }
  .unit-card:hover { box-shadow: var(--shadow-soft); }
}

/* ====================================================================== */
/* Medios cinematográficos                                                 */
/* ====================================================================== */
.media-img, .unit-thumb-img, .station-thumb-img, .station-figure-img, .home-hero-img, .uhero-poster, .uhero-video { display: block; object-fit: cover; }

/* Héroe del inicio: ciclo de portadas con el CTA montado encima */
.home-hero { position: relative; margin: 18px -16px 0; height: 210px; overflow: hidden; background: var(--paper-3); }
@media (min-width: 720px) { .home-hero { margin-left: 0; margin-right: 0; border-radius: 24px; height: 260px; } }
.home-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.4s ease; transform: scale(1.02); }
.home-hero-img.is-on { opacity: 1; }
.home-hero-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(20,15,10,.05) 30%, rgba(20,15,10,.62) 100%); pointer-events: none; }
.home-hero-cap { position: absolute; left: 16px; bottom: 54px; display: flex; flex-direction: column; gap: 2px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.45); min-height: 44px; justify-content: flex-end; }
@media (min-width: 720px) { .home-hero-cap { left: 22px; } }
.home-hero-cap .eyebrow { color: #f1dc93; }
.home-hero-cap .cap-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.2; }
.home.has-hero .sim-cta { margin: -38px 4px 0; position: relative; z-index: 1; box-shadow: 0 18px 38px -14px rgba(20,15,10,.6); }
@media (min-width: 720px) { .home.has-hero .sim-cta { margin-left: 16px; margin-right: 16px; } }

/* Continuar */
.continue-card { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 14px; padding: 12px 16px; border-radius: var(--radius); background: var(--forraje-soft); border: 1px solid var(--line); color: var(--ink); min-height: 72px; transition: transform .15s ease; }
.continue-card:active { transform: scale(.99); }
.continue-card .c-ico { width: 48px; height: 48px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--forraje); color: var(--on-primary); }
.continue-card .c-ico .ico { width: 22px; height: 22px; }
.continue-card .c-body { display: block; flex: 1; min-width: 0; }
.continue-card .c-body > span { display: block; }
.continue-card .t { font-weight: 800; }
.continue-card .s { color: var(--ink-2); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-card > .ico { color: var(--forraje); flex: none; }
.continue-card + .errors-card { margin-top: 12px; }
.errors-card { margin-top: 14px; }

/* Miniaturas en la ruta */
.unit-card.has-thumb { padding-left: 10px; }
.unit-thumb { width: 72px; height: 72px; border-radius: 14px; overflow: hidden; flex: none; background: var(--paper-3); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.unit-thumb-img { width: 100%; height: 100%; }
@media (max-width: 360px) { .unit-thumb { width: 60px; height: 60px; } }

/* Héroe de unidad con video */
.uhero { position: relative; margin: -6px -16px 0; height: 220px; overflow: hidden; background: #1c1712; color: #fff; }
@media (min-width: 720px) { .uhero { margin-left: 0; margin-right: 0; border-radius: 24px; height: 280px; } }
.uhero-poster, .uhero-video { position: absolute; inset: 0; width: 100%; height: 100%; }
.uhero-video { opacity: 0; transition: opacity .6s ease; }
.uhero.is-playing .uhero-video { opacity: 1; }
.uhero-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(20,15,10,.42) 0%, rgba(20,15,10,.05) 32%, rgba(20,15,10,.22) 55%, rgba(20,15,10,.86) 100%); pointer-events: none; }
.uhero-back { position: absolute; left: 8px; top: 6px; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 12px 0 6px; color: #fff; font-weight: 700; font-size: 15px; border-radius: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.uhero-text { position: absolute; left: 16px; right: 72px; bottom: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.uhero-text .eyebrow { color: #f1dc93; }
.uhero-text h1 { color: #fff; font-size: 25px; margin-top: 2px; }
.uhero-text .lema { color: #f3ead8; font-size: 15.5px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.uhero-ring { position: absolute; right: 12px; bottom: 14px; }
.uhero-ring .ring { background: rgba(28,23,18,.55); border-radius: 50%; box-shadow: 0 0 0 3px rgba(28,23,18,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.uhero-ring .ring .track { stroke: rgba(255,255,255,.28); }
.uhero-ring .ring .bar { stroke: #e0c56a; }
.uhero-ring .ring .pct, .uhero-ring .ring.is-zero .pct { color: #fff; }
.uhero-btn { position: absolute; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; border-radius: 999px; background: rgba(28,23,18,.62); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.22); font-weight: 700; z-index: 2; transition: background-color .2s ease; }
.uhero-btn:hover { background: rgba(28,23,18,.82); }
.uhero-btn:focus-visible { outline-color: #fff; }
.uhero-sound { right: 10px; top: 8px; width: 44px; height: 44px; }
.uhero-sound .ico { width: 22px; height: 22px; }
.uhero-sound[aria-pressed="true"] { background: rgba(224,197,106,.92); color: #1c1712; border-color: transparent; }
.uhero-play { left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 0 20px 0 14px; font-size: 16px; }
.uhero-play .ico { width: 24px; height: 24px; }
.unit.has-hero .seg { margin-top: 14px; }

/* Ilustraciones de estación */
.station-thumb { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; flex: none; background: var(--paper-3); }
.station-thumb-img { width: 100%; height: 100%; }
.station-figure { margin: 0 0 12px; border-radius: 18px; overflow: hidden; background: var(--paper-3); box-shadow: var(--shadow-soft); }
.station-figure-img { width: 100%; height: 150px; }

@media (prefers-reduced-motion: reduce) {
  .home-hero-img { transition: none; }
}

/* Girasol: ornamento cálido (pétalos en dorado, centro y tallo en verde) */
.girasol { stroke: var(--trigo); color: var(--forraje); display: block; }
.girasol .petal { stroke: var(--trigo); }
.girasol-hero { position: absolute; right: 2px; top: 6px; width: 46px; height: 53px; opacity: .95; }
.hero { position: relative; }
.hero .hero-greet, .hero h1 { padding-right: 56px; }
.girasol-bloom { width: 64px; height: 74px; margin: 0 auto 8px; transform-origin: 50% 43%; animation: bloom .9s cubic-bezier(.2,.9,.3,1.25) both; }
@keyframes bloom { 0% { transform: scale(.35) rotate(-50deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.done-sub { font-family: var(--font-display); font-size: 20px; color: var(--ink); margin-top: -6px; margin-bottom: 8px; }
.done-kicker { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--trigo-ink); }
@media (prefers-reduced-motion: reduce) { .girasol-bloom { animation: none; } }


/* ====================================================================== */
/* Fase 3: acuarelas, rubor, figuras, celebraciones                        */
/* ====================================================================== */
.pill-rubor { background: var(--rubor); color: var(--rubor-ink); }
.pill-rubor .ico { width: 16px; height: 16px; }

/* Acuarelas: en claro, multiply funde el fondo crema con el papel; en oscuro, disco crema. */
.acuarela { display: block; line-height: 0; }
.acuarela img { display: block; width: 100%; height: 100%; object-fit: contain; }
:root[data-theme="light"] .acuarela img { mix-blend-mode: multiply; }
:root[data-theme="dark"] .acuarela { background: #f3efe3; border-radius: 50%; box-shadow: 0 0 0 4px rgba(243,239,227,.12), var(--shadow-soft); }
:root[data-theme="dark"] .acuarela img { border-radius: 50%; }
.girasol-hero { position: absolute; right: -4px; top: 0; width: 92px; height: 92px; transform: rotate(7deg); transform-origin: 50% 85%; animation: sway 6s ease-in-out infinite; }
:root[data-theme="dark"] .girasol-hero { width: 84px; height: 84px; right: 0; top: 4px; }
@keyframes sway { 0%, 100% { transform: rotate(5deg); } 50% { transform: rotate(10deg); } }
.hero .hero-greet, .hero h1 { padding-right: 96px; }
.ramito-bloom { width: 170px; height: 170px; margin: 0 auto 2px; animation: ramito-in .8s cubic-bezier(.2,.8,.2,1) both; }
@keyframes ramito-in { from { opacity: 0; transform: translateY(14px) scale(.92); } to { opacity: 1; transform: none; } }
.ramito-empty { width: 170px; height: 170px; margin: 0 auto 6px; animation: ramito-in .8s cubic-bezier(.2,.8,.2,1) both; }
:root[data-theme="dark"] .ramito-bloom, :root[data-theme="dark"] .ramito-empty { width: 150px; height: 150px; margin-bottom: 12px; }
.flash-done.is-celebration { background: linear-gradient(170deg, var(--rubor-2) 0%, var(--paper-2) 58%); border-color: var(--rubor); }
.flash-done.is-celebration .big { color: var(--forraje); }
.done-kicker { color: var(--rubor-ink); }
.empty.is-happy h2 { color: var(--forraje); }
.girasol, .girasol-bloom { display: none; }

/* Figuras (infografías) */
.figura { margin: 0; }
.figura-img { display: block; border-radius: 20px; overflow: hidden; }
.figura-img img { display: block; width: 100%; height: auto; }
:root[data-theme="light"] .figura-img img { mix-blend-mode: multiply; }
:root[data-theme="dark"] .figura-img { background: #f7f3ea; padding: 6px; box-shadow: var(--shadow-soft); }
:root[data-theme="dark"] .figura-img img { border-radius: 14px; }
.figura figcaption { margin-top: 8px; font-size: 14px; color: var(--ink-2); text-align: center; font-style: italic; font-family: var(--font-display); padding: 0 8px; }
.station-frame .figura { margin-top: 14px; }

/* Escritorio: un poco más de aire */
@media (min-width: 720px) {
  .card { padding: 22px; }
  .girasol-hero { width: 104px; height: 104px; right: 4px; }
  .hero .hero-greet, .hero h1 { padding-right: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .girasol-hero { animation: none; transform: rotate(7deg); }
  .ramito-bloom, .ramito-empty { animation: none; }
}
