/* Deutsch Dicht · sistema visual v3
   Tokens → base → estructura → componentes → bloques de lección → vistas → responsive. */

/* ───────────── Tokens ───────────── */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-de: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f5f4ef; --surface: #ffffff; --surface-2: #faf9f6; --sunken: #eeece6; --overlay: rgba(23, 25, 29, .38);
  --ink: #18191d; --ink-2: #3f434b; --muted: #676d77; --faint: #9a9fa8;
  --line: #e4e1d9; --line-2: #d3cfc5;
  --accent: #1d5a4f; --accent-2: #174a41; --accent-ink: #ffffff; --accent-soft: #e2eee9; --accent-line: #b5d3c8;
  --good: #1d7849; --good-soft: #e4f3ea; --bad: #b02731; --bad-soft: #fbe8e9; --warn: #946000; --warn-soft: #fbf0d9;
  --m: #2457a3; --m-soft: #e7eef9; --f: #ad2a3a; --f-soft: #fbe8eb; --n: #22784a; --n-soft: #e3f2e8; --p: #8a5808; --p-soft: #f6edda;
  --akk: #b4520a; --dat: #6a3db3; --gen: #0d7088; --verb: #1d5a4f;
  --hl-bg: #e2eee9; --hl-ink: #174a41;
  --r: 14px; --r-s: 10px; --r-xs: 7px;
  --shadow: 0 1px 2px rgba(17, 19, 23, .04), 0 2px 10px rgba(17, 19, 23, .04);
  --shadow-lg: 0 18px 50px rgba(17, 19, 23, .16), 0 2px 6px rgba(17, 19, 23, .06);
  --sidebar: 248px; --gutter: 48px; --page: 1120px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1013; --surface: #16191d; --surface-2: #1b1f24; --sunken: #111317; --overlay: rgba(0, 0, 0, .55);
  --ink: #ebe9e4; --ink-2: #c8cad0; --muted: #959ba5; --faint: #6c727c;
  --line: #262a30; --line-2: #343941;
  --accent: #6cc3ac; --accent-2: #86d3be; --accent-ink: #0a1714; --accent-soft: #152d27; --accent-line: #275a4e;
  --good: #63cb93; --good-soft: #13301f; --bad: #f1858c; --bad-soft: #3a191c; --warn: #e6b65e; --warn-soft: #32260f;
  --m: #8bb7f2; --m-soft: #172840; --f: #f2939d; --f-soft: #3a1a20; --n: #81d3a2; --n-soft: #14301e; --p: #e6bd6c; --p-soft: #332711;
  --akk: #f2a560; --dat: #b99cf2; --gen: #62c4dc; --verb: #6cc3ac;
  --hl-bg: #173a32; --hl-ink: #9be0cc;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
  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(--bg); color: var(--ink); font: 15px/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
.de, [lang="de"] { font-family: var(--font-de); }
.ui { font-family: var(--font-ui); }
.mono { font-family: var(--font-mono); font-size: .9em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.s { width: 15px; height: 15px; }
svg.i.l { width: 22px; height: 22px; }
svg.i.fill { fill: currentColor; stroke: none; }

/* ───────────── Estructura ───────────── */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px 18px; border-right: 1px solid var(--line); background: var(--surface-2); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 600 22px/1 var(--font-de); letter-spacing: -.04em; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 520; }
.nav a:hover { background: var(--sunken); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-2); }
.nav a .i { color: var(--muted); }
.nav a.active .i { color: var(--accent); }
.nav .de-label { margin-left: auto; font: italic 12px var(--font-de); color: var(--faint); }
.nav .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 650; display: grid; place-items: center; }
.nav a.active .de-label { color: var(--accent); }
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.today-mini { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.today-mini .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.today-mini strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.prefs { display: flex; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.icon-btn { width: 36px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.motto { padding: 0 8px; font: italic 13px/1.4 var(--font-de); color: var(--muted); }
.main { min-width: 0; }
.page { max-width: calc(var(--page) + 2 * var(--gutter)); margin: 0 auto; padding: 36px var(--gutter) 80px; }
.page.wide { max-width: 1320px; }
.loading { padding: 80px; color: var(--muted); }

/* Encabezado de página */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { font-size: 11.5px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.eyebrow .sep { color: var(--faint); }
.page-head h1 { font-size: 32px; margin-top: 8px; }
.page-head .lede { margin-top: 8px; color: var(--muted); font-size: 15.5px; max-width: 680px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .i { color: var(--faint); }

/* ───────────── Componentes ───────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.tight { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { font-size: 16px; }
.card-head .sub { font-size: 13px; color: var(--muted); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.stack.l { gap: 28px; }
.stack.xl { gap: 44px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn .kbd { margin-left: 4px; }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid currentColor; font: 600 11px var(--font-ui); opacity: .55; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; background: var(--sunken); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent-2); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.outline { background: transparent; border: 1px solid var(--line-2); }
.level { display: inline-grid; place-items: center; height: 22px; min-width: 30px; padding: 0 6px; border-radius: 6px; font: 700 11.5px var(--font-ui); letter-spacing: .02em; background: var(--ink); color: var(--surface); }
.bar { height: 6px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.bar.good > span { background: var(--good); }
.ring { --v: 0; width: 44px; height: 44px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--v) * 1%), var(--sunken) 0); display: grid; place-items: center; flex: none; }
.ring::before { content: attr(data-label); width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.kpi { display: grid; gap: 4px; }
.kpi .v { font-size: 28px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .v small { font-size: 15px; color: var(--muted); font-weight: 600; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .d { font-size: 12px; color: var(--faint); }
.input, .select { height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 13px; width: 100%; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box { position: relative; }
.search-box .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-box .input { padding-left: 40px; height: 46px; font-size: 15.5px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button, .tabs a { position: relative; border: 0; background: none; padding: 12px 14px 13px; font-weight: 620; color: var(--muted); display: inline-flex; align-items: center; gap: 9px; font-size: 14.5px; }
.tabs button:hover, .tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs [aria-selected="true"] { color: var(--ink); }
.tabs [aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tabs .num { font: 700 11px var(--font-ui); color: var(--faint); }
.tabs .de-tab { font-family: var(--font-de); font-weight: 600; font-size: 15.5px; }
.tabs .meta { font-size: 12px; color: var(--faint); font-weight: 600; }
.notice { border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--ink); padding: 12px 16px; border-radius: 12px; display: flex; gap: 12px; align-items: flex-start; }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); background: var(--warn-soft); }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 20px; margin: 10px 0 6px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 550; box-shadow: var(--shadow-lg); transition: .2s; z-index: 60; max-width: calc(100vw - 32px); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); max-width: 440px; width: calc(100vw - 32px); }
dialog::backdrop { background: var(--overlay); }
dialog h2 { font-size: 18px; margin-bottom: 8px; }
dialog p { color: var(--muted); margin-bottom: 20px; }

/* Texto alemán anotado */
.hl { background: var(--hl-bg); color: var(--hl-ink); border-radius: 4px; padding: 0 2px; font-weight: 650; }
.g-m { color: var(--m); } .g-f { color: var(--f); } .g-n { color: var(--n); } .g-p { color: var(--p); }
.c-N { font-weight: 650; text-decoration: underline 2px; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); }
.c-A { color: var(--akk); font-weight: 650; } .c-D { color: var(--dat); font-weight: 650; } .c-G { color: var(--gen); font-weight: 650; }
.c-V { color: var(--verb); font-weight: 700; }
.art { font-weight: 650; }
.strike { text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 1.5px; }
.say { border: 0; background: none; padding: 0; color: inherit; font: inherit; display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; text-align: left; }
.say:hover { color: var(--accent); }
.say .i { color: var(--faint); width: 15px; height: 15px; }
.say:hover .i, .say[data-state="playing"] .i { color: var(--accent); }
.audio-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); display: inline-grid; place-items: center; color: var(--ink-2); flex: none; }
.audio-btn:hover { border-color: var(--accent); color: var(--accent); }
.audio-btn[data-state="playing"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.audio-btn.lg { width: 44px; height: 44px; }

/* ───────────── Curso ───────────── */
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-bottom: 40px; }
.continue { display: flex; flex-direction: column; gap: 18px; background: linear-gradient(135deg, var(--surface), var(--surface-2)); }
.continue .title { font: 600 30px/1.15 var(--font-de); letter-spacing: -.01em; }
.continue .sub { color: var(--muted); margin-top: 4px; }
.continue .meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.continue .meta span { display: inline-flex; align-items: center; gap: 6px; }
.today { display: grid; gap: 14px; align-content: start; }
.today-list { display: grid; gap: 2px; }
.today-item { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 10px; color: var(--ink); }
.today-item:hover { background: var(--sunken); text-decoration: none; }
.today-item .n { width: 34px; height: 34px; border-radius: 10px; background: var(--sunken); display: grid; place-items: center; color: var(--ink-2); }
.today-item strong { display: block; font-size: 14px; }
.today-item span { font-size: 12.5px; color: var(--muted); }
.today-item .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.module { margin-top: 34px; }
.module-head { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 14px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.module-code { font: 700 13px var(--font-ui); color: var(--accent); letter-spacing: .04em; }
.module-title { font: 600 20px var(--font-de); }
.module-title span { font: 500 14px var(--font-ui); color: var(--muted); margin-left: 10px; }
.module-progress { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.units { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.unit-tile { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 172px; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: border-color .15s, transform .15s, box-shadow .15s; }
.unit-tile:hover { text-decoration: none; border-color: var(--accent-line); transform: translateY(-1px); box-shadow: var(--shadow); }
.unit-tile.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.unit-tile .top { display: flex; justify-content: space-between; align-items: center; }
.unit-tile .num { font: 700 12px var(--font-ui); color: var(--faint); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.unit-tile .t { font: 600 16.5px/1.25 var(--font-de); }
.unit-tile .s { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.unit-tile .bottom { margin-top: auto; display: grid; gap: 6px; }
.unit-tile .state { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; }
.unit-tile.done .num { color: var(--good); }
.status-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--faint); }
.status-dot.done { background: var(--good-soft); color: var(--good); }
.status-dot.progress { background: var(--accent-soft); color: var(--accent); }

/* ───────────── Unidad ───────────── */
.unit-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; margin-bottom: 22px; }
.unit-head h1 { font: 600 40px/1.08 var(--font-de); letter-spacing: -.015em; margin-top: 10px; }
.unit-head .sub { font-size: 17px; color: var(--muted); margin-top: 8px; }
.unit-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.unit-meta span { display: inline-flex; align-items: center; gap: 6px; }
.unit-score { display: grid; justify-items: end; gap: 6px; text-align: right; }
.unit-score .ring { width: 64px; height: 64px; }
.unit-score .ring::before { width: 52px; height: 52px; font-size: 13px; }
.unit-tabs { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); margin: 0 calc(-1 * var(--gutter)) 28px; padding: 0 var(--gutter); }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 44px; align-items: start; }
.toc { position: sticky; top: 76px; display: grid; gap: 2px; font-size: 13px; }
.toc .label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.toc a { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.toc a:hover { background: var(--sunken); color: var(--ink); text-decoration: none; }
.toc a.active { color: var(--accent-2); background: var(--accent-soft); }
.toc a b { font-weight: 700; font-size: 11px; color: var(--faint); padding-top: 1px; font-variant-numeric: tabular-nums; }
.toc .de { font-style: italic; }
.section { scroll-margin-top: 80px; }
.section-head { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 14px; margin-bottom: 18px; }
.section-head .n { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); display: grid; place-items: center; font: 700 13px var(--font-ui); color: var(--ink-2); background: var(--surface); font-variant-numeric: tabular-nums; }
.section-head h2 { font: 600 22px var(--font-de); }
.section-head h2 span { font: 500 14px var(--font-ui); color: var(--muted); margin-left: 10px; }
.section-head .aside { font-size: 13px; color: var(--muted); }
.goals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; counter-reset: goal; }
.goal { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--ink-2); }
.goal::before { counter-increment: goal; content: counter(goal); width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-2); font-weight: 700; display: grid; place-items: center; font-size: 13px; }

/* ───────────── Bloques de lección ───────────── */
.blocks { display: grid; gap: 18px; }
.blk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 24px; }
.blk > h3 { font-size: 15px; font-weight: 650; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.blk > h3 .tag { font: 700 10.5px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.blk-note-text { margin-top: 14px; font-size: 13.5px; color: var(--muted); padding-top: 12px; border-top: 1px dashed var(--line); }
.concepts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.concepts.single { grid-template-columns: minmax(0, 1fr); }
.concept { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; display: grid; gap: 8px; align-content: start; }
.concept .cterm { font: 600 19px/1.25 var(--font-de); color: var(--accent-2); }
.concept p { color: var(--ink-2); font-size: 14.5px; }
.concept .ex { display: grid; gap: 4px; margin-top: 4px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-s); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td, .tbl tr:last-child th { border-bottom: 0; }
.tbl thead th { background: var(--surface-2); font: 650 11.5px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tbl tbody th { font-weight: 600; color: var(--ink-2); background: var(--surface-2); white-space: nowrap; }
.tbl td.de { font-size: 15.5px; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.slots { display: grid; gap: 6px; }
.slots-head, .slots-row { display: grid; gap: 6px; }
.slots-head span { font: 650 11px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 12px; }
.slot { padding: 11px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font: 16px/1.35 var(--font-de); min-height: 44px; }
.slot.verb { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); font-weight: 650; text-align: center; }
.slot.empty { background: transparent; border-style: dashed; }
.pairs { display: grid; gap: 10px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); align-items: center; gap: 8px; }
.pair .side { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font: 16px/1.4 var(--font-de); }
.pair .side.to { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.pair .arrow { display: grid; place-items: center; color: var(--accent); }
.pair .gloss { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin-top: -4px; padding-left: 4px; }
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.formula .part { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); font: 600 15px var(--font-de); }
.formula .part.key { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.formula .op { color: var(--faint); font-weight: 700; font-size: 18px; }
.formula-ex { margin-top: 12px; display: grid; gap: 6px; }
.term-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.term-list.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.term-list.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.term-list.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.term { display: grid; grid-template-columns: minmax(0, auto) 1fr; gap: 4px 12px; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--surface); }
.term .de { font-size: 15.5px; }
.term .m { color: var(--muted); font-size: 13.5px; }
.term.num-term { grid-template-columns: 34px 1fr; }
.term.num-term .k { font: 700 14px var(--font-ui); color: var(--faint); font-variant-numeric: tabular-nums; }
.letters { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.letter { display: grid; justify-items: center; gap: 2px; padding: 10px 4px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.letter:hover { border-color: var(--accent); }
.letter b { font: 600 22px/1 var(--font-de); }
.letter span { font-size: 11.5px; color: var(--muted); }
.letter i { font: 11px var(--font-mono); color: var(--faint); font-style: normal; }
.sounds { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.sound { display: grid; grid-template-columns: 160px 70px minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.sound:last-child { border-bottom: 0; }
.sound .g { font: 650 16px var(--font-de); }
.sound .ipa { font: 13px var(--font-mono); color: var(--accent-2); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; justify-self: start; }
.sound .words { display: flex; flex-wrap: wrap; gap: 6px; }
.sound .note { font-size: 13px; color: var(--muted); }
.word-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); font: 15px var(--font-de); color: var(--ink); }
.word-chip:hover { border-color: var(--accent); color: var(--accent); }
.word-chip .i { width: 13px; height: 13px; color: var(--faint); }
.word-chip[data-state="playing"] { border-color: var(--accent); background: var(--accent-soft); }
.minimal { display: grid; gap: 8px; }
.minimal-head, .minimal-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 10px; align-items: center; }
.minimal-head span { font: 650 11px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.minimal-row .word-chip { justify-content: space-between; height: 38px; font-size: 16px; }
.minimal-row .m { font-size: 13px; color: var(--muted); }
.callout { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 16px 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); font-size: 14.5px; color: var(--ink-2); }
.callout .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); }
.callout b.k { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.callout.tip .ic { background: var(--accent-soft); color: var(--accent); }
.callout.warn .ic { background: var(--warn-soft); color: var(--warn); }
.callout.l1 { border-color: color-mix(in srgb, var(--f) 22%, var(--line)); }
.callout.l1 .ic { background: var(--f-soft); color: var(--f); font: 700 12px var(--font-ui); }

/* Expresiones, errores, ejemplos */
.lines { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.line { display: grid; grid-template-columns: 32px minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .de { font-size: 16.5px; line-height: 1.4; }
.line .tr { color: var(--muted); font-size: 14px; }
.errors { display: grid; gap: 10px; }
.err { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.err .wrong, .err .right { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font: 16px var(--font-de); }
.err .wrong { background: color-mix(in srgb, var(--bad-soft) 60%, var(--surface)); color: var(--ink-2); }
.err .wrong .i { color: var(--bad); }
.err .right { background: color-mix(in srgb, var(--good-soft) 60%, var(--surface)); border-left: 1px solid var(--line); }
.err .right .i { color: var(--good); }
.err .why { grid-column: 1 / -1; padding: 9px 16px 11px; font-size: 13.5px; color: var(--muted); border-top: 1px solid var(--line); }

/* Vocabulario */
.vocab-group { display: grid; gap: 10px; }
.vocab-ext { border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--surface-2); padding: 0 16px; }
.vocab-ext > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; font-weight: 650; color: var(--ink-2); }
.vocab-ext > summary::-webkit-details-marker { display: none; }
.vocab-ext > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; flex: none; }
.vocab-ext[open] > summary::before { transform: rotate(45deg); }
.vocab-ext > summary > span:first-of-type { flex: 1; }
.vocab-ext[open] { padding-bottom: 16px; }
.vocab-ext[open] > .vocab-group + .vocab-group, .vocab-ext[open] > p + .vocab-group { margin-top: 14px; }
.vocab-group h3 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; }
.gender-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gender-col { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.gender-col > header { padding: 10px 14px; font: 700 14px var(--font-de); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.gender-col.m > header { color: var(--m); background: var(--m-soft); }
.gender-col.f > header { color: var(--f); background: var(--f-soft); }
.gender-col.n > header { color: var(--n); background: var(--n-soft); }
.gender-col > header small { font: 600 11.5px var(--font-ui); opacity: .8; }
.vw { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.vw:last-child { border-bottom: 0; }
.vw .hw { font: 15.5px var(--font-de); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.vw .pl { font-size: 12.5px; color: var(--faint); font-family: var(--font-de); }
.vw .m { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.vw .st { grid-row: 1; grid-column: 2; }
.vtable .tbl td, .vtable .tbl th { padding: 9px 12px; }
.deck-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); display: inline-block; }
.deck-dot.new { background: var(--accent-line); }
.deck-dot.learning { background: var(--warn); }
.deck-dot.young { background: var(--accent); }
.deck-dot.mature { background: var(--good); }
.summary { border: 1px solid var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); border-radius: var(--r); padding: 24px; }
.summary ol { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.summary li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; font-size: 15px; color: var(--ink); }
.summary li::before { counter-increment: s; content: counter(s); width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.unit-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 40px; }
.unit-foot a { min-width: 0; overflow-wrap: anywhere; }
.unit-foot a { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.unit-foot a:hover { border-color: var(--accent-line); text-decoration: none; }
.unit-foot a.next { text-align: right; }
.unit-foot small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
.unit-foot span { font: 600 17px var(--font-de); }

/* ───────────── Ejercicios ───────────── */
.practice { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.phases { position: sticky; top: 76px; display: grid; gap: 18px; }
.phase h4 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; }
.phase h4 .de { font: italic 600 13px var(--font-de); letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); font: 650 12px var(--font-ui); color: var(--muted); display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.dot:hover { border-color: var(--faint); }
.dot.ok { background: var(--good-soft); border-color: transparent; color: var(--good); }
.dot.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.dot.help { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.dot.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); color: var(--ink); }
.ex-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px 32px; box-shadow: var(--shadow); display: grid; gap: 22px; }
.ex-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.ex-instr { font-size: 15px; color: var(--ink-2); font-weight: 550; }
.ex-q { font: 25px/1.4 var(--font-de); color: var(--ink); }
.ex-q .gap { display: inline-block; min-width: 76px; border-bottom: 2px solid var(--accent); margin: 0 3px; color: var(--accent); text-align: center; }
.ex-source { display: grid; gap: 6px; }
.ex-source .lab { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.ex-source .src { font-size: 21px; line-height: 1.4; color: var(--ink); }
.ex-input { height: 54px; font: 21px var(--font-de); border-radius: 12px; padding: 0 16px; }
.gap-inputs { display: grid; gap: 10px; }
.gap-inputs label { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 10px; font-size: 12px; color: var(--faint); font-weight: 700; }
.umlauts { display: flex; gap: 6px; }
.umlauts button { width: 38px; height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); font: 600 16px var(--font-de); }
.umlauts button:hover { border-color: var(--accent); }
.options { display: grid; gap: 10px; }
.options.cols { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); text-align: left; font-size: 16px; transition: border-color .12s, background .12s; }
.option .k { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line-2); display: grid; place-items: center; font: 700 12px var(--font-ui); color: var(--muted); flex: none; }
.option:hover { border-color: var(--faint); }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.option[aria-pressed="true"] .k { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option .de { font-size: 17px; }
.tokens-answer { min-height: 64px; padding: 12px; border-radius: 12px; border: 1.5px dashed var(--line-2); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface-2); }
.tokens-answer:empty::before { content: attr(data-placeholder); color: var(--faint); font-size: 14px; padding-left: 4px; }
.tokens-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.token { height: 42px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font: 17px var(--font-de); box-shadow: 0 1px 0 var(--line); }
.token:hover { border-color: var(--accent); }
.token[disabled] { opacity: .25; box-shadow: none; }
.tokens-answer .token { background: var(--accent-soft); border-color: var(--accent-line); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.match-col { display: grid; gap: 8px; align-content: start; }
.match-item { min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); text-align: left; font: 16px var(--font-de); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.match-item:hover { border-color: var(--faint); }
.match-item.sel { border-color: var(--accent); background: var(--accent-soft); }
.match-item.paired { border-style: dashed; color: var(--muted); }
.match-item .tagn { font: 700 11px var(--font-ui); color: var(--accent); min-width: 18px; height: 18px; border-radius: 5px; background: var(--accent-soft); display: grid; place-items: center; }
.match-item.ok { border-color: var(--good); background: var(--good-soft); }
.match-item.no { border-color: var(--bad); background: var(--bad-soft); }
.listen-stage { display: flex; align-items: center; gap: 14px; }
.rf { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ex-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ex-actions .grow { flex: 1; }
.feedback { border-radius: 14px; padding: 16px 18px; display: grid; gap: 6px; border: 1px solid; }
.feedback.ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.feedback.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.feedback.near, .feedback.help { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.feedback .head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.feedback.ok .head { color: var(--good); } .feedback.bad .head { color: var(--bad); } .feedback.near .head, .feedback.help .head { color: var(--warn); }
.feedback .ans { font: 19px var(--font-de); color: var(--ink); }
.feedback .why { color: var(--ink-2); font-size: 14px; }
.feedback .fine { color: var(--muted); font-size: 12.5px; }
.ex-done { display: grid; gap: 16px; justify-items: center; text-align: center; padding: 36px 24px; }
.ex-done .big { font-size: 44px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ───────────── Repaso ───────────── */
.review-top { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.review-top .card { padding: 16px 18px; }
.pace-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 26px; flex-wrap: wrap; }
.stage { max-width: 680px; margin: 0 auto; display: grid; gap: 16px; }
.flash { position: relative; min-height: 340px; display: grid; align-content: center; justify-items: center; gap: 14px; text-align: center; padding: 40px 32px 36px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.flash .kind { position: absolute; top: 18px; left: 22px; right: 22px; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 650; letter-spacing: .04em; }
.flash .front { font: 600 44px/1.15 var(--font-de); letter-spacing: -.01em; }
.flash .front.l1 { font: 600 30px/1.3 var(--font-ui); letter-spacing: -.01em; }
.flash .hint { font-size: 14px; color: var(--muted); }
.flash .back { width: 100%; display: grid; gap: 14px; justify-items: center; padding-top: 18px; border-top: 1px solid var(--line); }
.flash .answer { font: 600 28px/1.3 var(--font-de); }
.flash .answer.l1 { font-family: var(--font-ui); font-size: 22px; font-weight: 600; }
.flash .forms { font: 15px var(--font-de); color: var(--ink-2); display: flex; gap: 6px 14px; flex-wrap: wrap; justify-content: center; }
.flash .forms span { white-space: nowrap; }
.flash .forms b { font: 650 10.5px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-right: 5px; }
.flash .example { max-width: 520px; display: grid; gap: 3px; font-size: 14px; color: var(--muted); }
.flash .example .de { font-size: 17px; color: var(--ink); }
.flash .note { font-size: 13px; color: var(--muted); max-width: 520px; }
.ratings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rate { display: grid; gap: 3px; justify-items: center; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); }
.rate b { font-size: 14.5px; }
.rate small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rate .kbd { opacity: .4; }
.rate:hover { border-color: var(--faint); }
.rate.again b { color: var(--bad); } .rate.hard b { color: var(--warn); } .rate.good b { color: var(--good); } .rate.easy b { color: var(--accent); }
.reveal-btn { height: 54px; border-radius: 14px; font-size: 16px; }
.session-foot { display: flex; justify-content: center; gap: 18px; font-size: 12.5px; color: var(--faint); }

/* ───────────── Lecturas ───────────── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.reading-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.reading-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 186px; }
.reading-card:hover { text-decoration: none; border-color: var(--accent-line); box-shadow: var(--shadow); }
.reading-card .t { font: 600 19px/1.25 var(--font-de); }
.reading-card .s { font-size: 13px; color: var(--muted); }
.reading-card .bottom { margin-top: auto; display: flex; gap: 12px; color: var(--faint); font-size: 12.5px; align-items: center; }
.reading-card .bottom .grow { flex: 1; }
.reader-head { max-width: 760px; margin: 0 auto 26px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.reader-head h1 { font: 600 38px/1.12 var(--font-de); letter-spacing: -.01em; }
.reader-head .sub { color: var(--muted); font-size: 16px; }
.reader-bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 10px; margin: 0 calc(-1 * var(--gutter)) 24px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.reader { max-width: 760px; margin: 0 auto; display: grid; gap: 22px; }
.reader.parallel { max-width: 1120px; }
.para { display: grid; gap: 8px; }
.reader.parallel .para { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.para .de-text { font: 19.5px/1.75 var(--font-de); color: var(--ink); }
.para .tr-text { font-size: 15px; line-height: 1.65; color: var(--muted); }
.reader:not(.parallel) .para .tr-text { padding-left: 14px; border-left: 2px solid var(--line); }
.para.dialog { grid-template-columns: 96px minmax(0, 1fr); column-gap: 18px; }
.reader.parallel .para.dialog { grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr); }
.para.dialog .who { font: 650 12px var(--font-ui); letter-spacing: .04em; color: var(--accent); padding-top: 6px; text-align: right; }
.para.dialog .tr-text { grid-column: 2; }
.reader.parallel .para.dialog .tr-text { grid-column: 3; }
.w { cursor: pointer; border-radius: 4px; padding: 0 1px; margin: 0 -1px; transition: background .1s; }
.w:hover, .w.on { background: var(--accent-soft); color: var(--accent-2); }
.w.new { text-decoration: underline dotted 1.5px; text-decoration-color: var(--faint); text-underline-offset: 5px; }
.sent { border-radius: 6px; transition: background .2s; }
.sent.playing { background: color-mix(in srgb, var(--warn-soft) 80%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn-soft) 80%, transparent); }
.reader-side { max-width: 760px; margin: 40px auto 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.gloss-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.gloss-grid .term { border-right: 1px solid var(--line); }
.questions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.question { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 16px 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.question .qq { font: 17.5px/1.4 var(--font-de); display: flex; gap: 10px; }
.question .qq b { font: 700 12px var(--font-ui); color: var(--faint); padding-top: 4px; }
.question .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.question .opts .btn { white-space: normal; text-align: left; height: auto; min-height: 32px; padding-top: 6px; padding-bottom: 6px; }
.question .qq span { min-width: 0; }
.source-note { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }

/* Ventana de palabra */
.popup { position: fixed; z-index: 40; width: 320px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 16px; display: grid; gap: 10px; }
.popup[hidden] { display: none; }
.popup .p-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.popup .p-token { font: 600 22px var(--font-de); }
.popup .p-lemma { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font: 16px var(--font-de); }
.popup .p-mean { font-size: 14.5px; color: var(--ink); }
.popup .p-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.popup .p-forms { font: 13.5px var(--font-de); color: var(--muted); }
.popup .p-ctx { font-size: 13px; color: var(--ink-2); background: var(--sunken); border-radius: 9px; padding: 8px 10px; }
.popup .p-others { font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; }
.popup .p-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ───────────── Referencia ───────────── */
.ref-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; align-items: start; }
.ref-nav { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; display: grid; gap: 14px; padding-right: 6px; }
.ref-nav h4 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 6px 0 4px 8px; }
.ref-nav a { display: block; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); font-size: 13.5px; }
.ref-nav a:hover { background: var(--sunken); text-decoration: none; }
.ref-nav a.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.ref-nav a .de { font-style: italic; color: var(--faint); font-size: 12.5px; display: block; }
.topic-head { display: grid; gap: 8px; margin-bottom: 22px; }
.topic-head h1 { font: 600 34px/1.12 var(--font-de); }
.topic-head .sub { color: var(--muted); font-size: 16px; }
.topic-summary { font-size: 15.5px; color: var(--ink-2); max-width: 760px; }
.dict-row { display: grid; grid-template-columns: 34px minmax(0, 1.25fr) minmax(0, 1fr) 70px 36px; gap: 14px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.dict-row:hover { background: var(--surface-2); text-decoration: none; }
.dict-row .hw { font: 16px var(--font-de); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dict-row .hw small { font-size: 12.5px; color: var(--faint); }
.dict-row .m { font-size: 13.5px; color: var(--muted); }
.dict-list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.dict-list .dict-row:last-child { border-bottom: 0; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.entry-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.entry-head h1 { font: 600 42px/1.1 var(--font-de); display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.entry-head .line2 { font: 17px var(--font-de); color: var(--ink-2); margin-top: 8px; }
.entry-head .mean { font-size: 18px; margin-top: 10px; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 14px 0; font-size: 13px; color: var(--muted); }
.pg-nums { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pg-nums .pg { min-width: 34px; height: 32px; padding: 0 8px; border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 13px var(--font-ui); cursor: pointer; font-variant-numeric: tabular-nums; }
.pg-nums .pg:hover { border-color: var(--line-2); background: var(--surface-2); }
.pg-nums .pg.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pg-nums .gap { padding: 0 2px; color: var(--faint); }
.pg-jump .select { height: 32px; width: auto; max-width: 260px; font-size: 13px; }
.alpha-bar { display: flex; flex-wrap: wrap; gap: 3px; }
.alpha-bar button, .alpha-bar span { min-width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: var(--r-xs); font: 650 12.5px var(--font-ui); }
.alpha-bar button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.alpha-bar button:hover { background: var(--surface-2); border-color: var(--line-2); }
.alpha-bar button.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.alpha-bar .off { color: var(--faint); opacity: .5; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Consulta universal de palabras */
.wl { cursor: pointer; border-radius: 3px; transition: background .12s, box-shadow .12s; }
.wl:hover { background: var(--hl-bg); box-shadow: 0 0 0 2px var(--hl-bg); }
.wl.on { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.wl:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.p-lemma .audio-btn { margin-left: 2px; }

/* ───────────── Progreso ───────────── */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px var(--font-ui); fill: var(--muted); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.module-progress-list { display: grid; gap: 0; }
.mp-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 140px 70px; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mp-row:last-child { border-bottom: 0; }

/* ───────────── Móvil ───────────── */
.mobile-bar { display: none; }
@media (max-width: 1180px) {
  .units { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lesson-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .reading-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  :root { --gutter: 22px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .mobile-bar a { display: grid; justify-items: center; gap: 2px; padding: 5px 6px; border-radius: 9px; font-size: 10.5px; font-weight: 600; color: var(--muted); position: relative; min-width: 52px; }
  .mobile-bar a.active { color: var(--accent); }
  .mobile-bar a:hover { text-decoration: none; }
  .mobile-bar .count { position: absolute; top: 0; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  .mobile-top { display: flex !important; }
  .page { padding: 18px var(--gutter) 96px; }
  .hero, .g2, .g3, .goals, .concepts { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .practice { grid-template-columns: minmax(0, 1fr); }
  .phases { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .ref-layout { grid-template-columns: minmax(0, 1fr); }
  .ref-nav { position: static; max-height: none; }
  .gender-cols { grid-template-columns: minmax(0, 1fr); }
  .unit-head { grid-template-columns: minmax(0, 1fr); }
  .unit-score { justify-items: start; text-align: left; }
  .reader.parallel .para, .reader.parallel .para.dialog { grid-template-columns: minmax(0, 1fr); }
  .reader.parallel .para.dialog .tr-text { grid-column: 1; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 14.5px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head h1 { font-size: 26px; }
  .unit-head h1, .reader-head h1, .entry-head h1 { font-size: 30px; }
  .units, .reading-grid { grid-template-columns: minmax(0, 1fr); }
  .unit-tile { min-height: 0; }
  .module-head { grid-template-columns: auto 1fr; }
  .module-head .module-progress { grid-column: 1 / -1; }
  .module-title span { display: block; margin: 2px 0 0; }
  .letters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .sound { grid-template-columns: 1fr auto; }
  .sound .words, .sound .note { grid-column: 1 / -1; }
  .term-list.c3, .term-list.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .term-list.c2, .gloss-grid { grid-template-columns: minmax(0, 1fr); }
  .line { grid-template-columns: 32px 1fr; }
  .line .tr { grid-column: 2; }
  .pair { grid-template-columns: minmax(0, 1fr); }
  .pair .arrow { transform: rotate(90deg); height: 22px; }
  .err { grid-template-columns: minmax(0, 1fr); }
  .err .right { border-left: 0; border-top: 1px solid var(--line); }
  .minimal-head, .minimal-row { grid-template-columns: 1fr 1fr; }
  .minimal-row .m { grid-column: 1 / -1; }
  .ex-card { padding: 22px 18px; }
  .ex-q { font-size: 21px; }
  .flash { padding: 46px 18px 26px; min-height: 300px; }
  .flash .front { font-size: 34px; }
  .ratings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dict-row { grid-template-columns: 30px minmax(0, 1fr) 30px; }
  .dict-row .m { grid-column: 2; }
  .dict-row .u { display: none; }
  .phases { grid-template-columns: minmax(0, 1fr); }
  .match { gap: 8px 10px; }
  .mp-row { grid-template-columns: 54px minmax(0, 1fr) 54px; }
  .mp-row .bar { display: none; }
  .tabs { overflow-x: auto; }
  .tabs button, .tabs a { padding: 12px 10px; white-space: nowrap; }
  .para.dialog { grid-template-columns: minmax(0, 1fr); }
  .para.dialog .who { text-align: left; padding: 0; }
  .para.dialog .tr-text { grid-column: 1; }
  .entry-head { grid-template-columns: minmax(0, 1fr); }
  .slots-head { display: none !important; }
  .slots-row { grid-template-columns: 1fr !important; gap: 4px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; z-index: 20; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Huecos en línea */
.gap-q { line-height: 2.1; }
.gap-in { font: inherit; color: var(--accent-2); border: 0; border-bottom: 2px solid var(--accent); background: var(--accent-soft); border-radius: 6px 6px 0 0; padding: 0 6px; margin: 0 3px; text-align: center; min-width: 3ch; max-width: 100%; }
.gap-in:focus { outline: none; background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); box-shadow: 0 2px 0 var(--accent); }
.gap-in[readonly] { background: transparent; }
.reader-bar.embedded { top: 49px; }

/* Poesía en la biblioteca */
.reader.verse .de-text, .reader.verse .tr-text { white-space: pre-line; }
.reader.verse .de-text { font-size: 1.12em; line-height: 1.75; }

/* Los hijos de grids nunca fuerzan desborde horizontal (tablas largas se desplazan dentro de .tbl-wrap) */
.blocks { grid-template-columns: minmax(0, 1fr); }
.stack > *, .entry > *, .ref-layout > *, .lesson-layout > *, .grid > *, .blocks > *, .concepts > *, .callout > * { min-width: 0; }
.entry-head h1, .topic-head h1, .unit-head h1 { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .tabs a > .small { display: none; }
  .tabs a, .tabs button { padding-left: 10px; padding-right: 10px; }
}
