/* El Árbol del Inglés — hand-written styles. No frameworks, no web fonts.
   Idea: a family register on warm paper. English is set in serif (the language
   being learned), Spanish in the system sans (our own voice). */

/* ------------------------------------------------------------------ tokens */
:root {
  --paper: #f6e9cc;
  --paper-2: #efdfbb;
  --plate: #fffaf0;
  --ink: #2b2118;
  --ink-2: #5a4a38;
  --rule: #dcc9a0;
  --leaf: #3b6a2e;
  --on-leaf: #ffffff;
  --leaf-soft: #e2ebd0;
  --apple: #a3302a;
  --on-apple: #ffffff;
  --apple-soft: #f6dcd3;
  --gold: #c9a227;
  --tip-bg: #fbf0c6;
  --tip-edge: #caa12e;
  --cmp-bg: #e4ecf5;
  --cmp-edge: #2f6fb0;
  --focus: #1d5fa8;
  --spk-A: #8a4fb5;
  --spk-B: #1f7f84;
  --spk-C: #a8611c;
  --chalk: #1f2e27;
  --chalk-ink: #eef0e4;
  --chalk-dim: #c9d1bf;
  --chalk-yellow: #f3dd83;
  --frame: #7b5a36;
  --shadow: 0 1px 0 rgb(43 33 24 / 6%), 0 3px 10px rgb(43 33 24 / 9%);
  --serif: Georgia, "Noto Serif", "Iowan Old Style", "Palatino Linotype", "DejaVu Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --measure: 46rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17130f;
    --paper-2: #211b15;
    --plate: #261f18;
    --ink: #f0e6d2;
    --ink-2: #c4b59d;
    --rule: #463a2d;
    --leaf: #93c47d;
    --on-leaf: #10200b;
    --leaf-soft: #22301c;
    --apple: #f08c80;
    --on-apple: #2a0d09;
    --apple-soft: #3a211c;
    --tip-bg: #2d2610;
    --tip-edge: #c9a227;
    --cmp-bg: #18222f;
    --cmp-edge: #6d9fd8;
    --focus: #8cb8ff;
    --spk-A: #cfa6ee;
    --spk-B: #74d0d4;
    --spk-C: #eaae6f;
    --shadow: 0 1px 0 rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 35%);
  }
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 106.25%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (min-width: 900px) { html { font-size: 112.5%; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-wrap: break-word;
}
img { max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1, h2 { font-family: var(--serif); font-weight: 400; }
p, li { text-wrap: pretty; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: .5rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 8px; }
.skip:focus { top: .5rem; }
.dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--fam, var(--ink-2)); flex: none; }
.en { font-family: var(--serif); }

/* ------------------------------------------------------------------ topbar */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  max-width: 64rem; margin: 0 auto; padding: .6rem 1rem;
}
.home-link { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.75rem; font-family: var(--serif); font-style: italic; font-size: 1.1rem; text-decoration: none; }
.home-link:hover .home-l { text-decoration: underline; }
.tools { display: flex; flex-wrap: wrap; gap: .4rem; }
.tool {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 2.75rem; padding: 0 .85rem;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--plate); color: var(--ink);
  font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.tool:hover { border-color: var(--ink-2); }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
@media (max-width: 520px) {
  .tools:has(#t-student) { width: 100%; flex-wrap: nowrap; }
  .tools:not(:has(#t-student)) .tool { flex: 0 0 auto; }
  .tool { flex: 1 1 auto; justify-content: center; padding: 0 .6rem; font-size: .85rem; white-space: nowrap; }
  #t-student .tool-l { font-size: 0; }
  #t-student .tool-l::after { content: "Vista estudiante"; font-size: .85rem; }
  #t-print { flex: 0 0 2.9rem; padding: 0; }
  #t-print .tool-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
.student-banner {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .4rem .8rem;
  padding: .45rem 1rem; background: var(--ink); color: var(--paper); font-size: .9rem; text-align: center;
}
.banner-exit { min-height: 2.5rem; padding: 0 .9rem; border-radius: 999px; border: 1px solid currentColor; background: transparent; cursor: pointer; font-weight: 700; }

/* ===================================================================== HOME */
main.home { padding-bottom: 2rem; }
.hero {
  position: relative; display: flex; flex-direction: column; gap: 1.2rem;
  max-width: 84rem; margin: 0 auto; padding: 1.4rem 1.1rem 0;
}
.hero-eyebrow { margin: 0; font-size: .85rem; color: var(--ink-2); font-weight: 600; letter-spacing: .01em; }
.hero h1 {
  margin: .2rem 0 .4rem; font-size: clamp(2.5rem, 9vw, 4.3rem); line-height: 1.02; font-style: italic;
  letter-spacing: -.01em;
}
.hero-sub { margin: 0; font-family: var(--serif); font-size: 1.15rem; line-height: 1.45; color: var(--ink-2); max-width: 28rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.hero-links a {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 2.6rem; padding: 0 .85rem;
  border-radius: 999px; border: 1px solid var(--rule); background: color-mix(in srgb, var(--plate) 70%, transparent);
  text-decoration: none; font-size: .9rem; font-weight: 600;
}
.hero-links a:hover { border-color: var(--ink-2); }
.hero-p { display: grid; gap: .9rem; max-width: 28rem; }
.progress { display: grid; gap: .55rem; }
.prog-l { display: flex; justify-content: space-between; font-size: .9rem; }
.prog-l strong { font-variant-numeric: tabular-nums; }
.bar { height: .6rem; border-radius: 999px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .6s ease; }
.bar-learned span { background: var(--leaf); }
.bar-taught span { background: var(--apple); }
.continue {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; padding: .95rem 1.2rem;
  border-radius: 14px; background: var(--leaf); color: var(--on-leaf); text-decoration: none;
  box-shadow: var(--shadow); font-weight: 700; font-size: 1.1rem; line-height: 1.3;
}
.continue:hover { filter: brightness(1.06); }
.continue-k { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.3rem; }
.continue { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.continue-k { grid-column: 1; }
.continue-t { grid-column: 1; }
.continue-arrow { grid-column: 2; grid-row: 1 / span 2; font-size: 1.5rem; }
.continue-sub { margin: -.4rem 0 0; font-size: .85rem; color: var(--ink-2); min-height: 1.2em; }
.hero-art { display: block; order: 3; margin: 0 -1.1rem; }
.hero-art img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: 100% 50%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 86%, transparent 100%);
}
@media (min-width: 1000px) {
  .hero.has-art {
    display: block; width: min(100%, 84rem, calc(max(560px, 84vh) * 1.5)); aspect-ratio: 3 / 2;
    padding: clamp(2rem, 5vw, 4.5rem) 0 2rem clamp(1.5rem, 3.5vw, 3.5rem);
  }
  .hero.has-art .hero-art { position: absolute; inset: 0; margin: 0; }
  .hero.has-art .hero-art img {
    width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; object-position: 100% 100%;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 96%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 5%, #000 90%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 96%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 5%, #000 90%, transparent 100%);
    mask-composite: intersect;
  }
  .hero.has-art .hero-t, .hero.has-art .hero-p { position: relative; width: 36%; max-width: 30rem; }
  .hero.has-art .hero-p { margin-top: 1.6rem; }
  .hero.has-art h1 { font-size: clamp(3rem, 5.2vw, 4.3rem); }
  .hero.has-art .hero-links a { min-height: 2.4rem; padding: 0 .7rem; font-size: .84rem; }
}
/* The painting is paper: in dark mode the hero becomes a framed sheet. */
@media (prefers-color-scheme: dark) {
  .hero.has-art {
    --paper: #f6e9cc; --plate: #fffaf0; --ink: #2b2118; --ink-2: #5a4a38; --rule: #d6c294;
    --leaf: #3b6a2e; --on-leaf: #fff; --apple: #a3302a;
    color: var(--ink); background: var(--paper); border-radius: 18px; margin-top: .8rem;
    width: calc(100% - 1.4rem); padding-bottom: 1rem;
  }
  .hero.has-art .hero-art { margin: 0; }
  .hero.has-art .hero-art img { border-radius: 0 0 18px 18px; }
}
@media (prefers-color-scheme: dark) and (min-width: 1000px) {
  .hero.has-art { width: min(calc(100% - 2rem), 84rem, calc(max(560px, 84vh) * 1.5)); }
  .hero.has-art .hero-art img { border-radius: 18px; }
}

/* ----------------------------------------------------------- tree toolbar */
.tree-area { max-width: 84rem; margin: 1.5rem auto 0; padding: 0 1rem; }
.tree-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; }
.tree-h { margin: 0; font-size: 2rem; font-style: italic; }
.seg { display: inline-flex; padding: .2rem; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--rule); }
.seg button { min-height: 2.6rem; padding: 0 1rem; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-weight: 600; font-size: .9rem; }
.seg button[aria-pressed="true"] { background: var(--plate); box-shadow: var(--shadow); }
.legend { margin: 1rem 0 .5rem; display: grid; gap: .6rem; }
.legend ul { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: 0; padding: 0; list-style: none; font-size: .88rem; }
.legend-fam li { display: inline-flex; align-items: center; gap: .4rem; }
.legend-fam .dot { width: .85rem; height: .85rem; border-radius: 3px; }
.legend-st { color: var(--ink-2); }
.legend-hint { margin: 0; font-size: .85rem; color: var(--ink-2); max-width: 60ch; }

/* ------------------------------------------------------------------- tree */
.tree { position: relative; margin-top: 1rem; }
.tree[hidden], .list[hidden] { display: none; }
.links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.links path { fill: none; stroke-width: 2; stroke-linecap: round; opacity: .38; transition: opacity .2s, stroke-width .2s; }
.links path.live { opacity: .85; }
.links circle { opacity: .6; }
.tree.tracing .links path { opacity: .1; }
.tree.tracing .links circle { opacity: .15; }
.tree.tracing .links path.hl { opacity: 1; stroke-width: 3.5; }
.band { position: relative; z-index: 1; padding: 1.6rem 0 2.2rem; border-top: 1px solid var(--rule); }
.band-head {
  position: relative; margin: 0 auto 1.4rem; padding: .6rem .8rem; max-width: 40rem; text-align: center;
  background: color-mix(in srgb, var(--paper) 86%, transparent); border-radius: 12px;
}
.band-eyebrow { margin: 0; font-size: .8rem; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.band-name { margin: .1rem 0 .2rem; font-size: 1.8rem; font-style: italic; }
.band-motto { margin: 0; font-family: var(--serif); color: var(--ink-2); line-height: 1.4; }
.band-gate, .band-count { margin: .35rem 0 0; font-size: .82rem; color: var(--ink-2); }
.band-count { font-weight: 700; color: var(--ink); }
.band-rows { display: flex; flex-direction: column; gap: 2.6rem; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem .8rem; }
@media (min-width: 1000px) {
  .band { display: grid; grid-template-columns: 13.5rem 1fr; gap: 1.5rem; }
  .band-head { position: sticky; top: 1rem; align-self: start; margin: 0; text-align: left; padding: .4rem .6rem .6rem 0; }
}

.node {
  position: relative; z-index: 1; display: flex; flex-direction: column; width: 6.6rem; min-height: 6.4rem;
  padding: .45rem .55rem .55rem; border: 1px solid var(--rule); border-top: 5px solid var(--fam);
  border-radius: 9px; background: var(--plate); color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
@media (min-width: 420px) { .node { width: 7.6rem; } }
@media (min-width: 1000px) { .node { width: 8.4rem; } }
a.node:hover { transform: translateY(-2px); }
.node-n { font-family: var(--serif); font-style: italic; font-size: 1.55rem; line-height: 1; font-variant-numeric: oldstyle-nums; }
.node-st { position: absolute; top: .35rem; right: .4rem; font-size: .95rem; line-height: 1; }
.node-k { margin-top: .3rem; font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.node-t {
  margin-top: .3rem; font-size: .76rem; line-height: 1.3; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.node-wip { margin-top: auto; padding-top: .3rem; font-size: .68rem; color: var(--ink-2); }
.node.locked { background: var(--paper-2); border-top-color: color-mix(in srgb, var(--fam) 30%, #9b9387); color: var(--ink-2); box-shadow: none; }
.node.available { border-color: var(--fam); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fam) 30%, transparent), var(--shadow); animation: glow 3s ease-in-out infinite; }
.node.learned { background: color-mix(in srgb, var(--fam) 14%, var(--plate)); }
.node.taught { background: color-mix(in srgb, var(--fam) 24%, var(--plate)); border-color: var(--fam); }
.node.missing { border-style: dashed; border-top-style: solid; box-shadow: none; }
.node.missing.locked, .node.missing { background: color-mix(in srgb, var(--paper-2) 70%, transparent); }
.node.reunion { width: min(100%, 15.5rem); border-top-width: 7px; border-color: var(--gold); background-image: linear-gradient(135deg, color-mix(in srgb, var(--gold) 20%, transparent), transparent 60%); }
.node.reunion .node-t { -webkit-line-clamp: 2; font-family: var(--serif); font-size: .9rem; font-weight: 400; font-style: italic; }
.node.kin { outline: 3px solid var(--fam); outline-offset: 2px; }
@keyframes glow {
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--fam) 16%, transparent), var(--shadow); }
}

/* ------------------------------------------------------------------- list */
.list-gen { margin: 1.4rem 0 2rem; }
.list-gen h2 { margin: 0 0 .6rem; font-size: 1.5rem; font-style: italic; }
.list-gen-k { display: block; font-family: var(--sans); font-style: normal; font-size: .78rem; font-weight: 700; color: var(--ink-2); }
.lrows { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
@media (min-width: 900px) { .lrows { grid-template-columns: 1fr 1fr; } }
.lrow {
  display: grid; grid-template-columns: 2.6rem 1fr auto; align-items: center; gap: .6rem; min-height: 3.6rem;
  padding: .5rem .8rem; border-radius: 10px; border: 1px solid var(--rule); border-left: 6px solid var(--fam);
  background: var(--plate); text-decoration: none; color: var(--ink);
}
a.lrow:hover { border-color: var(--ink-2); border-left-color: var(--fam); }
.lrow-n { font-family: var(--serif); font-style: italic; font-size: 1.45rem; line-height: 1; }
.lrow-main { display: grid; }
.lrow-t { font-weight: 600; line-height: 1.3; }
.lrow-f { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--ink-2); }
.lrow-st { font-size: 1.15rem; }
.lrow.locked { background: var(--paper-2); }
.lrow.learned { background: color-mix(in srgb, var(--fam) 12%, var(--plate)); }
.lrow.taught { background: color-mix(in srgb, var(--fam) 22%, var(--plate)); }
.lrow.missing { border-style: dashed; border-left-style: solid; background: transparent; color: var(--ink-2); }
.lrow.available { box-shadow: 0 0 0 2px color-mix(in srgb, var(--fam) 45%, transparent); }
.lrow.reunion { border-left-color: var(--gold); }

.home-foot { max-width: 46rem; margin: 3rem auto 0; padding: 1.4rem 1rem 3rem; border-top: 1px solid var(--rule); text-align: center; }
.foot-h { margin: 0 0 .3rem; font-size: 1.4rem; font-style: italic; }
.home-foot p { margin: 0 auto 1rem; color: var(--ink-2); font-size: .92rem; max-width: 36rem; }
.foot-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.75rem; padding: 0 1rem;
  border-radius: 10px; border: 1px solid var(--rule); background: var(--plate); color: var(--ink);
  font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--ink-2); }
.btn-danger { color: var(--apple); }
.foot-actions input:focus-visible + .btn, label.btn:focus-within { outline: 3px solid var(--focus); }

/* =================================================================== LESSON */
body.page-lesson { padding-bottom: 6rem; }
.lesson-head, .family-card, .doc-head { max-width: var(--measure); margin-left: auto; margin-right: auto; padding: 0 1rem; }
.lesson-head { padding-top: .8rem; }
.eyebrow { margin: 0; font-size: .85rem; font-weight: 700; color: var(--ink-2); }
.eyebrow a { text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.plate { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .2rem 1rem; margin: .5rem 0 .8rem; }
.num {
  font-family: var(--serif); font-style: italic; font-size: clamp(3.6rem, 16vw, 5.4rem); line-height: .85;
  color: color-mix(in srgb, var(--fam) 70%, var(--ink)); font-variant-numeric: oldstyle-nums;
  padding-right: .9rem; border-right: 3px solid var(--fam);
}
.plate h1 { margin: .1rem 0 .3rem; font-size: clamp(1.6rem, 5.6vw, 2.35rem); }
.title-en { margin: 0; font-family: var(--serif); font-style: italic; color: var(--ink-2); font-size: 1.05rem; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.fam-chip, .lvl {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2rem; padding: 0 .75rem; border-radius: 999px;
  font-size: .82rem; font-weight: 700; border: 1px solid var(--rule); background: var(--plate);
}
.fam-chip { background: color-mix(in srgb, var(--fam) 14%, var(--plate)); border-color: color-mix(in srgb, var(--fam) 45%, var(--rule)); }
.fam-chip .dot { background: var(--fam); }
.reunion-tag { border-color: var(--gold); }
.cando { margin: 0 0 1rem; padding: .8rem 1rem; border-radius: 12px; background: var(--plate); border: 1px solid var(--rule); font-family: var(--serif); font-size: 1.08rem; line-height: 1.5; }
.cando-l { display: block; font-family: var(--sans); font-size: .75rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.status { margin: 0 0 .8rem; font-weight: 700; min-height: 1.6em; }
.status:empty { display: none; }
.lock-note { margin: 0 0 1rem; padding: .8rem 1rem; border-radius: 12px; border: 1.5px dashed var(--ink-2); font-size: .95rem; }
.lock-note a { font-weight: 700; }
.print-cta { display: grid; gap: .6rem; margin: 0 0 1.4rem; }
@media (min-width: 520px) { .print-cta { grid-template-columns: 1fr 1fr; } }
.btn-sheet {
  display: flex; align-items: center; gap: .7rem; min-height: 3.6rem; padding: .6rem 1rem; border-radius: 14px;
  border: 2px solid var(--ink); background: var(--plate); color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
}
.btn-sheet:hover { background: var(--paper-2); }
.bs-i { font-size: 1.6rem; line-height: 1; }
.bs-t { display: grid; line-height: 1.25; }
.bs-t strong { font-size: 1.02rem; }
.bs-t small { font-size: .8rem; color: var(--ink-2); }

.family-card { margin-bottom: 1.2rem; }
.family-card > * { margin: 0; }
.family-card { display: grid; gap: .6rem 1.2rem; grid-template-columns: 1fr; }
.family-h { font-size: 1.3rem; font-style: italic; }
@media (min-width: 620px) { .family-card { grid-template-columns: 1fr 1fr; } .family-h { grid-column: 1 / -1; } }
.kin { padding: .7rem .9rem; border-radius: 12px; border: 1px solid var(--rule); background: var(--plate); }
.kin h3 { margin: 0 0 .4rem; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.kin ul { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.kin-link {
  display: flex; align-items: center; gap: .5rem; min-height: 2.6rem; padding: .3rem .6rem; border-radius: 8px;
  border-left: 4px solid var(--fam); background: color-mix(in srgb, var(--fam) 9%, transparent); text-decoration: none; line-height: 1.25; font-size: .92rem;
}
a.kin-link:hover { background: color-mix(in srgb, var(--fam) 18%, transparent); }
.kin-link.missing { color: var(--ink-2); border-left-style: dashed; }
.kin-n { font-family: var(--serif); font-style: italic; font-size: 1.2rem; }
.kin-wip { margin-left: auto; font-size: .75rem; white-space: nowrap; }
.kin-none { margin: 0; font-size: .9rem; color: var(--ink-2); }

/* sticky section chips */
.sec-nav {
  position: sticky; top: 0; z-index: 20; margin: 0 0 .5rem;
  background: color-mix(in srgb, var(--paper) 92%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
body.student .sec-nav { top: 2.9rem; }
.sec-nav ul {
  display: flex; gap: .35rem; margin: 0 auto; padding: .5rem 1rem; max-width: 64rem; list-style: none;
  overflow-x: auto; scrollbar-width: none; scroll-padding-inline: 1rem;
}
.sec-nav ul::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 2.5rem; padding: 0 .8rem; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--plate); white-space: nowrap; font-size: .85rem; font-weight: 600; text-decoration: none;
}
.chip:hover { border-color: var(--ink-2); }
.chip.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-teacher .chip { border-style: dashed; }

/* content */
.lesson-body { padding: 0 1rem; }
.sec { max-width: var(--measure); margin: 0 auto; padding-top: 1.6rem; scroll-margin-top: 4rem; }
body.student .sec { scroll-margin-top: 7rem; }
.sec > h2 { margin: .4rem 0 1rem; font-size: clamp(1.55rem, 5vw, 1.95rem); padding-bottom: .4rem; border-bottom: 1px solid var(--rule); }
.h-emoji { font-size: .85em; margin-right: .15em; }
.sec h3 { margin: 1.6rem 0 .6rem; font-size: 1.12rem; }
.sec ol, .sec ul { padding-left: 1.4rem; }
.sec li { margin: .3rem 0; }
.sec li::marker { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sec hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.sec code { font-size: .9em; padding: .1em .35em; border-radius: 5px; background: var(--paper-2); }
.sec pre { overflow-x: auto; padding: .8rem 1rem; border-radius: 10px; background: var(--paper-2); }

/* tables */
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--rule); border-radius: 10px; background: var(--plate); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 0; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.4; }
th, td { padding: .5rem .75rem; text-align: left; vertical-align: middle; }
th { background: var(--paper-2); font-size: .82rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
td { border-top: 1px solid var(--rule); }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--paper-2) 35%, transparent); }
td .say .en { font-size: 1.05em; }
td .say, .line .say, li > .say:first-child { display: inline-flex; align-items: center; max-width: 100%; vertical-align: middle; }
td .say .en, .line .say .en, li > .say:first-child .en { min-width: 0; }

/* audio */
.say { }
.say .en { font-size: 1.07em; }
.play {
  display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; margin: 0 .35rem 0 0;
  padding: 0; vertical-align: middle; border-radius: 50%; border: 2px solid var(--leaf); background: var(--plate);
  color: var(--leaf); font-size: .9rem; line-height: 1; cursor: pointer; flex: none; touch-action: manipulation;
  transition: background .15s, color .15s, transform .1s;
}
.play:hover { background: var(--leaf-soft); }
.play:active { transform: scale(.94); }
.play.listen { width: auto; padding: 0 .95rem; border-radius: 999px; font-weight: 700; font-size: .92rem; gap: .3rem; }
.say.playing .play { background: var(--leaf); color: var(--on-leaf); animation: ring 1.2s ease-out infinite; }
.say.playing .en { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--leaf) 30%, transparent) 62%); }
.say.failed .play { border-color: var(--apple); color: var(--apple); }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--leaf) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* callouts */
blockquote { margin: 1.2rem 0; padding: .2rem 1rem; border-left: 4px solid var(--rule); }
.callout { padding: .75rem 1rem; border-radius: 12px; border-left-width: 5px; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout.tip { background: var(--tip-bg); border-left-color: var(--tip-edge); }
.callout.warn { background: var(--apple-soft); border-left-color: var(--apple); }
.callout.compare { background: var(--cmp-bg); border-left-color: var(--cmp-edge); }
.callout.say { background: var(--plate); border-left-color: var(--ink-2); font-family: var(--serif); font-size: 1.05rem; }
.callout .table-wrap { background: var(--plate); }

/* answers & folds */
details { margin: 1rem 0; }
summary {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; padding: 0 1rem; border-radius: 999px;
  border: 1.5px dashed var(--ink-2); cursor: pointer; font-weight: 700; font-size: .95rem; list-style: none; user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "▸"; transition: transform .15s; }
details[open] > summary { border-style: solid; background: var(--plate); }
details[open] > summary::after { transform: rotate(90deg); }
details > :not(summary) { margin-left: .4rem; }
details[open] > summary + * { margin-top: .8rem; }
details[open] { padding-bottom: .2rem; border-left: 3px dashed var(--rule); padding-left: .2rem; margin-left: -.2rem; }
details[open] > summary { margin-left: 0; }

/* dialogue */
.dialogue { margin: 1rem 0; padding: .6rem .9rem; border-radius: 14px; border: 1px solid var(--rule); background: var(--plate); }
.play-all {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 2.75rem; margin: .2rem 0 .5rem; padding: 0 1rem;
  border-radius: 999px; border: 2px solid var(--leaf); background: transparent; color: var(--leaf); font-weight: 700; cursor: pointer;
}
.play-all[aria-pressed="true"] { background: var(--leaf); color: var(--on-leaf); }
.line { display: grid; grid-template-columns: 4.2rem 1fr; gap: .6rem; margin: 0; padding: .4rem 0; border-top: 1px dotted var(--rule); align-items: center; }
.line:first-of-type { border-top: 0; }
.who { font-weight: 800; font-size: .85rem; color: var(--spk-A); overflow-wrap: anywhere; }
.spk-B .who { color: var(--spk-B); }
.spk-C .who { color: var(--spk-C); }
.said { min-width: 0; }
.translation .line { grid-template-columns: 4.2rem 1fr; }
@media (max-width: 480px) {
  .line, .translation .line { grid-template-columns: 3.6rem minmax(0, 1fr); gap: .4rem; }
  .who { font-size: .76rem; }
  .dialogue { padding: .5rem .7rem; }
}

/* typical errors */
.bad { color: var(--ink-2); }
.wrong { text-decoration: underline wavy var(--apple); text-decoration-thickness: 1.5px; text-underline-offset: 4px; font-family: var(--serif); }
.arrow { color: var(--ink-2); }

/* self-assessment */
ul:has(> li.task) { list-style: none; padding-left: 0; }
li.task label {
  display: flex; gap: .7rem; align-items: flex-start; min-height: 2.75rem; padding: .55rem .8rem; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--plate); cursor: pointer;
}
li.task input { width: 1.35rem; height: 1.35rem; margin: .15rem 0 0; accent-color: var(--leaf); flex: none; }
li.task input:checked + span { color: var(--ink-2); }

/* ---------------------------------------------------------- teacher board */
.sec.teacher {
  --ink: var(--chalk-ink); --ink-2: var(--chalk-dim); --rule: rgb(238 240 228 / 22%); --plate: #26372f; --paper-2: #2c3e35;
  --leaf: #b9e3a2; --on-leaf: #13240d; --leaf-soft: rgb(185 227 162 / 16%); --apple: #ffb3a8; --apple-soft: rgb(255 179 168 / 12%);
  --tip-bg: rgb(243 221 131 / 10%); --tip-edge: var(--chalk-yellow); --cmp-bg: rgb(140 184 255 / 10%); --cmp-edge: #9ec3ff; --focus: #ffe38a;
  max-width: calc(var(--measure) + 3rem); margin: 2.4rem auto 1rem; padding: 1.2rem 1.1rem 1.6rem;
  color: var(--ink); background: radial-gradient(120% 80% at 25% 10%, #2b3f35 0%, var(--chalk) 60%, #1a2721 100%);
  border: .65rem solid var(--frame); border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / 25%), inset 0 0 50px rgb(0 0 0 / 35%), 0 3px 0 #5a4126, 0 12px 28px rgb(0 0 0 / 22%);
}
.sec.teacher > h2 { color: #fff; border-bottom: 2px dashed rgb(255 255 255 / 30%); }
.sec.teacher a { color: #cfe6ff; }
.sec.teacher h3 { color: #fff; }
.step { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.step-n { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--chalk-yellow); }
.step-t { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; }
.step-min { font-size: .78rem; font-weight: 700; padding: .05rem .55rem; border-radius: 999px; border: 1px solid rgb(255 255 255 / 40%); color: var(--chalk-dim); }
.sec.teacher .callout.say { background: rgb(243 221 131 / 9%); border-left-color: var(--chalk-yellow); font-size: 1.1rem; }
.sec.teacher .play { background: transparent; }
.needs { padding: .6rem .8rem; border: 1.5px dashed rgb(255 255 255 / 35%); border-radius: 10px; }
.teacher-print { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.sec.teacher .btn-sheet { min-height: 2.75rem; padding: .3rem .9rem; border-radius: 999px; border: 2px solid var(--chalk-ink); background: transparent; color: var(--chalk-ink); box-shadow: none; font-weight: 700; font-size: .92rem; }
.sec.teacher .btn-sheet:hover { background: rgb(255 255 255 / 8%); }
/* "Antes de la clase": a paper note taped to the board */
.prep {
  --ink: #2b2118; --ink-2: #5a4a38; --rule: #dcc9a0; --plate: #fffaf0; --paper-2: #efdfbb;
  --leaf: #3b6a2e; --on-leaf: #fff; --leaf-soft: #e2ebd0; --focus: #1d5fa8;
  position: relative; margin: 1.6rem .2rem 1.4rem; padding: 1.1rem 1rem .6rem; color: var(--ink);
  background: #fbf2da; border-radius: 3px; box-shadow: 0 2px 0 rgb(0 0 0 / 18%), 0 10px 20px rgb(0 0 0 / 28%);
}
.prep::before {
  content: ""; position: absolute; top: -.7rem; left: 50%; width: 6.5rem; height: 1.4rem; transform: translateX(-50%) rotate(-3deg);
  background: rgb(255 250 225 / 70%); box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
}
.sec.teacher .prep h3 { margin-top: 0; color: var(--ink); font-family: var(--serif); font-weight: 400; font-size: 1.3rem; }
.sec.teacher .prep a { color: #1d5fa8; }

/* -------------------------------------------------------------------- quiz */
.quiz { display: grid; gap: .9rem; margin: 1.2rem 0; }
.quiz-top { margin: 0; font-size: .9rem; color: var(--ink-2); font-weight: 600; }
.q { padding: .9rem 1rem 1rem; border-radius: 14px; border: 1px solid var(--rule); background: var(--plate); }
.q-n { margin: 0; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.q-text { margin: .25rem 0 .8rem; font-size: 1.08rem; font-weight: 600; }
.opts { display: grid; gap: .5rem; }
.opt {
  display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 3rem; padding: .5rem .8rem; text-align: left;
  border-radius: 10px; border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; line-height: 1.35;
}
.opt::before {
  content: attr(data-letter); display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 1.5px solid var(--ink-2); font-size: .8rem; font-weight: 800;
}
.opt:hover:not(:disabled) { border-color: var(--ink-2); }
.opt:disabled { cursor: default; }
.opt.is-right { border-color: var(--leaf); background: var(--leaf-soft); }
.opt.is-right::before { content: "✓"; background: var(--leaf); border-color: var(--leaf); color: var(--on-leaf); }
.opt.is-wrong { border-color: var(--apple); background: var(--apple-soft); }
.opt.is-wrong::before { content: "✗"; background: var(--apple); border-color: var(--apple); color: var(--on-apple); }
.opt.is-dim { color: var(--ink-2); }
.typed { display: flex; flex-wrap: wrap; gap: .5rem; }
.typed input {
  flex: 1 1 12rem; min-width: 0; min-height: 3rem; padding: 0 .85rem; border-radius: 10px; border: 1.5px solid var(--rule);
  background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 1.1rem;
}
.typed input:focus { border-color: var(--ink-2); }
.typed input.is-right { border-color: var(--leaf); background: var(--leaf-soft); }
.typed input.is-wrong { border-color: var(--apple); background: var(--apple-soft); }
.btn-main {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 3rem; padding: 0 1.15rem; border-radius: 10px;
  border: 0; background: var(--leaf); color: var(--on-leaf); font-weight: 800; cursor: pointer; text-decoration: none;
}
.btn-main:disabled { opacity: .5; cursor: default; }
.fb { margin: .7rem 0 0; padding: .55rem .8rem; border-radius: 10px; font-size: .95rem; }
.fb:empty { display: none; }
.fb.ok { background: var(--leaf-soft); }
.fb.no { background: var(--apple-soft); }
.fb .fb-k { font-weight: 800; }
.quiz-score { padding: 1rem 1.1rem; border-radius: 14px; border: 2px solid var(--rule); background: var(--plate); text-align: center; }
.quiz-score[hidden] { display: none; }
.quiz-score.pass { border-color: var(--leaf); background: var(--leaf-soft); }
.quiz-score .big { display: block; font-family: var(--serif); font-style: italic; font-size: 2.2rem; line-height: 1.1; }
.quiz-score p { margin: .4rem 0 .8rem; }
.btn-ghost { min-height: 2.75rem; padding: 0 1rem; border-radius: 10px; border: 1.5px solid var(--ink-2); background: transparent; font-weight: 700; cursor: pointer; }

/* ------------------------------------------------------------------- pager */
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; align-items: stretch; max-width: var(--measure); margin: 3rem auto 1rem; padding: 0 1rem; }
.pager a { display: grid; align-content: center; min-height: 3.4rem; padding: .5rem .8rem; border-radius: 12px; border: 1px solid var(--rule); background: var(--plate); text-decoration: none; font-size: .9rem; line-height: 1.3; }
.pager a:hover { border-color: var(--ink-2); }
.pager-next { text-align: right; }
.pager-k { font-size: .75rem; font-weight: 800; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.pager-home { font-weight: 700; text-align: center; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr 1fr; } .pager-home { grid-column: 1 / -1; grid-row: 2; } }

/* ------------------------------------------------------------- action bar */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) minmax(0, 1fr) auto; gap: .35rem; align-items: stretch;
  padding: .5rem max(.5rem, calc((100vw - 48rem) / 2)) calc(.5rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--plate) 94%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule); box-shadow: 0 -4px 16px rgb(0 0 0 / 8%);
}
.ab-nav {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.9rem; border-radius: 12px;
  border: 1px solid var(--rule); background: var(--paper); text-decoration: none; font-size: 1.35rem; line-height: 1;
}
.ab-nav.is-off { opacity: .3; }
.ab-toggle {
  display: flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.9rem; padding: .25rem .55rem; border-radius: 12px;
  border: 2px solid var(--leaf); background: var(--paper); cursor: pointer; font-weight: 800; font-size: .88rem; line-height: 1.15; text-align: left;
}
.ab-taught { border-color: var(--apple); }
.ab-ico { font-size: 1.2rem; }
.ab-txt { display: grid; }
.ab-date { font-size: .7rem; font-weight: 600; }
.ab-date:empty { display: none; }
.ab-learned[aria-pressed="true"] { background: var(--leaf); color: var(--on-leaf); }
.ab-taught[aria-pressed="true"] { background: var(--apple); color: var(--on-apple); }
@media (max-width: 480px) {
  .ab-nav { min-width: 2.5rem; font-size: 1.2rem; }
  .ab-toggle { padding: .2rem .4rem; gap: .3rem; font-size: .82rem; }
  .ab-ico { font-size: 1.05rem; }
}
@media (max-width: 360px) { .ab-toggle { font-size: .76rem; } .ab-home { display: none; } .actionbar { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; } }

/* ------------------------------------------------------------ student view */
body.student .teacher, body.student details, body.student .chip-teacher, body.student .btn-chuleta,
body.student .teacher-print { display: none !important; }

/* --------------------------------------------------------------------- doc */
.doc-head { padding-top: 1rem; }
.doc-head h1 { margin: .3rem 0 1rem; font-size: clamp(2rem, 7vw, 2.8rem); font-style: italic; }
.placement-result .result-box { padding: 1rem 1.1rem; border-radius: 14px; border: 2px solid var(--leaf); background: var(--leaf-soft); }
.gen-scores { list-style: none; padding: 0; display: grid; gap: .35rem; }
.gen-scores li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .7rem; border-radius: 8px; background: var(--plate); border: 1px solid var(--rule); }
.gen-scores .low { border-color: var(--apple); }

.resources { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; max-width: var(--measure); margin: 0 auto 2rem; padding: 0 1rem; }
.resources a {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 2.6rem; padding: 0 .85rem; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--plate); text-decoration: none; font-size: .88rem; font-weight: 600;
}
.resources a:hover { border-color: var(--ink-2); }
.vocab-tools { position: sticky; top: 0; z-index: 20; padding-top: .6rem; padding-bottom: .6rem; background: color-mix(in srgb, var(--paper) 94%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.vq-l { display: block; font-size: .8rem; font-weight: 800; color: var(--ink-2); margin-bottom: .25rem; }
.vq-row { display: flex; gap: .6rem; align-items: center; }
.vq-row input {
  flex: 1; min-width: 0; min-height: 3rem; padding: 0 .9rem; border-radius: 12px; border: 1.5px solid var(--rule);
  background: var(--plate); color: var(--ink); font-size: 1.05rem;
}
.vq-row input:focus { border-color: var(--ink-2); }
.vq-n { font-size: .85rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vq-csv { margin: .5rem 0 0; }
.doc-vocabulario .sec { scroll-margin-top: 8rem; }
.sec[hidden], tr[hidden] { display: none; }

/* ------------------------------------------------------------ toast, party */
.toast {
  position: fixed; left: 50%; bottom: 6.5rem; z-index: 60; transform: translate(-50%, 1rem); max-width: calc(100vw - 2rem);
  padding: .7rem 1.1rem; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.confetti span { position: absolute; top: -3rem; font-size: 1.6rem; animation: fall var(--d, 3s) cubic-bezier(.3, .2, .6, 1) var(--delay, 0s) forwards; }
@keyframes fall { to { transform: translate(var(--dx, 0), 110vh) rotate(var(--r, 360deg)); } }

/* ============================================================ PRINT SHEETS */
body.page-sheet { background: #d8d0bf; }
@media (prefers-color-scheme: dark) { body.page-sheet { background: #121010; } }
.sheet-bar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .5rem 1rem;
  background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid var(--rule);
}
.sheet-bar-sp { flex: 1; }
.tool-main { background: var(--leaf); color: var(--on-leaf); border-color: var(--leaf); }
.tool[hidden] { display: none; }
.sheet {
  color-scheme: light; --ink: #111; --ink-2: #444; --rule: #999; --plate: #fff; --paper-2: #eee; --fam-print: #555;
  width: min(100% - 1rem, 210mm); margin: 1rem auto 3rem; padding: 12mm 13mm; background: #fff; color: #111;
  box-shadow: 0 2px 18px rgb(0 0 0 / 25%); font-size: 10pt; line-height: 1.36;
}
.sheet .say, .sheet li > .say:first-child, .sheet td .say, .sheet .line .say { display: inline; }

@media screen and (max-width: 700px) {
  .sheet { padding: 5mm 4mm; font-size: 11pt; }
  .split2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .split2 > table { min-width: 0; }
  .sheet table { display: block; overflow-x: auto; max-width: 100%; }
  .sheet-chuleta .ssec-teacher, .ans-cols, .sheet .dialogue, .sheet .cols, .examples { columns: 1; }
  .sheet-name { flex-wrap: wrap; gap: 3mm; }
  .sheet-name span, .sheet-name span:last-child { flex: 1 1 100%; }
}
.sheet-head { display: flex; gap: 5mm; align-items: flex-start; padding-bottom: 3mm; border-bottom: 2pt solid #111; }
.sheet-num { flex: none; font-family: var(--serif); font-style: italic; font-size: 34pt; line-height: .9; padding-right: 4mm; border-right: 3pt solid var(--fam); }
.sheet-k { margin: 0; font-size: 7.5pt; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #444; }
.sheet h1 { margin: 1mm 0 .5mm; font-size: 17pt; line-height: 1.15; }
.sheet-en { margin: 0; font-family: var(--serif); font-style: italic; color: #444; }
.sheet-name { display: flex; gap: 8mm; margin: 4mm 0 2mm; font-weight: 700; }
.sheet-name span { display: flex; flex: 1; align-items: baseline; gap: 2mm; }
.sheet-name span:last-child { flex: .5; }
.sheet-name .blank { flex: 1; width: auto; }
.sheet-cando { margin: 2mm 0 1mm; font-size: 9.5pt; }
.ssec { margin-top: 5mm; }
.ssec > h2 { margin: 0 0 2mm; padding-bottom: 1mm; font-size: 12.5pt; border-bottom: .75pt solid #111; break-after: avoid; }
.sheet h3 { margin: 3mm 0 1.2mm; font-size: 10.5pt; break-after: avoid; }
.sheet p { margin: 1.4mm 0; }
.sheet ol, .sheet ul { margin: 1mm 0; padding-left: 6mm; }
.sheet li { margin: .8mm 0; break-inside: avoid; }
.sheet table { font-size: 9.5pt; line-height: 1.3; border: .75pt solid #555; }
.sheet th { background: #eee; color: #111; font-size: 8.5pt; padding: 1.2mm 2mm; border: .5pt solid #777; white-space: normal; }
.sheet td { padding: .7mm 1.8mm; border: .5pt solid #999; background: #fff !important; }
.sheet th { padding: .8mm 1.8mm; }
.split2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; align-items: start; }
.split2 table { margin: 1mm 0; font-size: 8.8pt; }
.sheet pre { margin: 2mm 0; padding: 2mm 3mm; overflow-x: auto; border: .5pt solid #999; border-radius: 1.5mm; font-size: 8.5pt; line-height: 1.25; background: #fff; }
.sheet table { margin: 2mm 0; break-inside: auto; }
.sheet tr { break-inside: avoid; }
.sheet .en { font-size: 1em; }
.sheet blockquote, .sheet .callout { margin: 2mm 0; padding: 1.5mm 3mm; background: #fff; border: .75pt solid #999; border-left: 2.5pt solid #333; border-radius: 1.5mm; break-inside: avoid; }
.sheet .callout.say { font-family: var(--serif); font-style: italic; font-size: 1em; }
.sheet .h-emoji { font-size: .9em; }
.blank { display: inline-block; width: 20mm; height: 1em; vertical-align: -.2em; border-bottom: .9pt solid #222; }
.w-row { display: flex; align-items: baseline; max-width: 100%; }
.w-t { flex: 0 1 auto; min-width: 0; max-width: 72%; }
.write { flex: 1 1 14mm; min-width: 10mm; height: 1.1em; margin-left: 2mm; border-bottom: .75pt solid #777; }
.sheet .cols { columns: 2; column-gap: 8mm; }
.lines span { display: block; height: 8mm; border-bottom: .75pt solid #888; }
.examples { columns: 2; column-gap: 8mm; }
.heard { font-weight: 700; }
.sheet .dialogue { margin: 2mm 0; padding: 0; border: 0; background: none; columns: 2; column-gap: 8mm; }
.sheet .line { display: grid; grid-template-columns: 12mm 1fr; gap: 1.5mm; padding: .4mm 0; border: 0; align-items: baseline; break-inside: avoid; }
.sheet .who { color: #111; font-size: 9pt; }
.sheet .ex { break-inside: auto; }
.sheet .kin, .sheet .needs { border-color: #999; }
.sheet-foot { margin-top: 6mm; padding-top: 1.5mm; border-top: .5pt solid #999; font-size: 7.5pt; color: #555; }
/* teacher cheat sheet: compact, two columns */
.sheet-chuleta { font-size: 9pt; line-height: 1.35; }
.sheet-chuleta .ssec-teacher { columns: 2; column-gap: 7mm; column-rule: .5pt solid #ccc; }
.sheet-chuleta .ssec-teacher > h2 { column-span: all; }
.sheet-chuleta .prep { margin: 0 0 2.5mm; padding: 2mm 3mm; background: #fff; border: 1pt dashed #333; border-radius: 1.5mm; box-shadow: none; break-inside: auto; }
.sheet-chuleta .prep::before { content: none; }
.sheet-chuleta .prep, .sheet-chuleta .needs { column-span: all; }
.sheet-chuleta .prep h3, .sheet-chuleta h3 { font-size: 9.5pt; margin: 2.5mm 0 1mm; }
.sheet-chuleta .step { display: block; }
.sheet-chuleta .step-n { color: #111; font-size: 8pt; }
.sheet-chuleta .step-t { font-size: 10pt; font-weight: 700; font-family: var(--sans); }
.sheet-chuleta .step-min { color: #333; border-color: #777; font-size: 7.5pt; }
.sheet-chuleta .needs { margin: 0 0 2mm; padding: 1.5mm 2mm; border: .75pt dashed #777; border-radius: 1.5mm; }
.ans-cols { columns: 2; column-gap: 7mm; column-rule: .5pt solid #ccc; }
.ans { break-inside: avoid; margin-bottom: 2.5mm; }
.ans h3 { margin-top: 0; }
.quiz-key li { margin: .6mm 0; }
.qa { overflow-wrap: anywhere; }
.or { color: #666; }

/* ================================================================= motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}

/* ================================================================== print */
@media print {
  :root {
    --paper: #fff; --paper-2: #f0f0f0; --plate: #fff; --ink: #000; --ink-2: #333; --rule: #999;
    --leaf: #000; --on-leaf: #fff; --leaf-soft: #fff; --apple: #000; --apple-soft: #fff; --tip-bg: #fff; --cmp-bg: #fff;
    --tip-edge: #555; --cmp-edge: #555; --shadow: none;
  }
  @page { margin: 11mm 12mm; }
  html { font-size: 11pt; }
  body { background: #fff !important; color: #000; padding: 0 !important; }
  .topbar, .sec-nav, .actionbar, .pager, .skip, .toast, .student-banner, .print-cta, .play, .play-all, .confetti,
  .hero-art, .tree-bar, .legend, .home-foot, .lock-note, .status, .sheet-bar, .quiz-actions, .teacher-print,
  .continue, .hero-links, .links { display: none !important; }
  a { text-decoration: none; color: inherit; }
  .say .en { font-weight: 600; }
  .sec { padding-top: .6rem; }
  .sec > h2 { break-after: avoid; }
  h3 { break-after: avoid; }
  table, .callout, .q, .line, li.task, .kin { break-inside: avoid; }
  .table-wrap { overflow: visible; border-color: #999; }
  .sec.teacher {
    --ink: #000; --ink-2: #333; --rule: #999; --plate: #fff; --paper-2: #f0f0f0; --leaf: #000; --tip-bg: #fff; --cmp-bg: #fff;
    background: #fff; color: #000; border: 1.5pt solid #000; box-shadow: none; margin: 1rem 0; max-width: none;
  }
  .sec.teacher > h2, .sec.teacher h3 { color: #000; border-color: #000; }
  .prep { background: #fff; box-shadow: none; border: 1pt dashed #000; }
  .prep::before { content: none; }
  details { border: 0 !important; padding: 0 !important; }
  summary { border: 0; padding: 0; min-height: 0; }
  summary::after { content: none; }
  .quiz .opt { min-height: 0; padding: .15rem .4rem; border: 0; background: none; }
  .quiz .opt.is-right, .quiz .opt.is-wrong { background: none; }
  .quiz .typed input { border: 0; border-bottom: 1px solid #000; border-radius: 0; background: none; }
  .quiz .typed .btn-main, .quiz .fb, .quiz-score { display: none !important; }
  .q { border: 0; padding: .3rem 0; }
  .node { box-shadow: none; animation: none; }
  .sheet { width: auto; margin: 0; padding: 0; box-shadow: none; font-size: 9.4pt; line-height: 1.27; }
  .sheet table { font-size: 8.8pt; line-height: 1.22; }
  .sheet td { padding: .45mm 1.6mm; }
  .sheet th { padding: .6mm 1.6mm; font-size: 8pt; }
  .sheet h3 { margin: 2.2mm 0 .8mm; font-size: 9.8pt; }
  .sheet p { margin: 1mm 0; }
  .sheet li { margin: .45mm 0; }
  .sheet .ssec > h2 { font-size: 11.5pt; margin-bottom: 1.4mm; }
  .sheet-name { margin: 2.5mm 0 1mm; }
  .sheet-chuleta { font-size: 8.8pt; }
  .sheet .ssec { margin-top: 3.2mm; }
  .sheet-head { padding-bottom: 2mm; }
  .sheet .lines span { height: 7mm; }
  .sheet .split2 table { font-size: 8.3pt; line-height: 1.22; }
  .sheet .split2 td { padding: .45mm 1.4mm; }
  .sheet .line { padding: .2mm 0; }
  .sheet-foot { display: none; }
  /* Compact variant for long worksheets (tools/pdf.mjs retries with ?fit=1). */
  body.fit .sheet { font-size: 8.7pt; line-height: 1.2; }
  body.fit .sheet table, body.fit .sheet .split2 table { font-size: 8pt; line-height: 1.15; }
  body.fit .sheet td { padding: .3mm 1.3mm; }
  body.fit .sheet .ssec { margin-top: 2.4mm; }
  body.fit .sheet .ssec > h2 { font-size: 10.5pt; margin-bottom: 1mm; }
  body.fit .sheet h3 { margin: 1.6mm 0 .6mm; font-size: 9pt; }
  body.fit .sheet .lines span { height: 6.5mm; }
  body.fit .sheet-num { font-size: 26pt; }
  body.fit .sheet h1 { font-size: 14pt; }
  body.page-sheet { background: #fff; }
  .sheet-foot { break-before: avoid; }
  .resources, .vocab-tools { display: none !important; }
  /* Pronunciation key: one compact page to take to school. */
  .doc-clave { font-size: 9pt; line-height: 1.35; }
  .doc-clave .doc-head h1 { font-size: 16pt; margin: 0 0 2mm; }
  .doc-clave .eyebrow { display: none; }
  .doc-clave .sec { padding-top: 1mm; max-width: none; }
  .doc-clave .sec > h2 { font-size: 12pt; margin: 2mm 0 1.5mm; padding-bottom: 1mm; }
  .doc-clave p, .doc-clave li { margin: 1mm 0; }
  .doc-clave table { font-size: 8.5pt; }
  .doc-clave th, .doc-clave td { padding: .8mm 1.6mm; }
  .doc-clave .table-wrap { margin: 1.5mm 0; }
  .doc-clave .callout { padding: 1.5mm 3mm; margin: 2mm 0; }
  .doc-clave .lesson-body { padding: 0; }
}

/* Phone edition: preserve the design while meeting a 44px touch target. */
@media (pointer: coarse), (max-width: 700px) {
  .play { min-width: 2.75rem; min-height: 2.75rem; }
  .ab-nav { min-width: 2.75rem; }
}
/* Let quiz tracks and option text shrink instead of imposing min-content width. */
.quiz, .opts { grid-template-columns: minmax(0, 1fr); }
.q, .opt > span { min-width: 0; }
.opt > span { overflow-wrap: anywhere; }
@media (max-width: 360px) {
  .tools:has(#t-student) { flex-wrap: wrap; }
}
