/* toki pona pu — учебник. Светлая и тёмная темы, зелёный акцент, системные шрифты. */

/* Шрифт письменности sitelen pona (лигатурный: латиница -> знаки).
   Сначала пробуем локальные источники, затем файл на своём хостинге
   (положите его в assets/fonts/ — см. README), затем сеть (CDN). */
@font-face {
  font-family: 'linja pona';
  src: local('linja pona'),
       url('../fonts/linja-pona-4.9.otf') format('opentype'),
       url('https://cdn.jsdelivr.net/gh/janSame/linja-pona/linja-pona-4.9.otf') format('opentype');
  font-display: swap;
}

:root {
  color-scheme: light;
  --green: #2f6f4f;
  --green-d: #245a40;
  --green-hover: #245a40;
  --green-l: #e8f3ec;
  --ink: #1d2421;
  --muted: #5d6b63;
  --paper: #ffffff;
  --bg: #f6f8f6;
  --line: #dde6e0;
  --accent: #c8742f;
  --soft-orange-bg: #fdf6ee;
  --soft-orange-line: #f0d8bf;
  --soft-red-bg: #fdf0f0;
  --soft-red-line: #e8c4c4;
  --soft-red-ink: #a04545;
  --radius: 12px;
  --maxw: 880px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .05);
}

/* Тёмная тема: вручную (data-theme) или вслед за системой. */
[data-theme="dark"] {
  color-scheme: dark;
  --green: #2f7a55;
  --green-d: #8fd0ae;
  --green-hover: #38875f;
  --green-l: #22382c;
  --ink: #e6ece8;
  --muted: #a0b1a7;
  --paper: #1d2420;
  --bg: #141a16;
  --line: #33413a;
  --accent: #e0a05f;
  --soft-orange-bg: #2a241a;
  --soft-orange-line: #4a3c28;
  --soft-red-bg: #2c1f1f;
  --soft-red-line: #4d3434;
  --soft-red-ink: #e09a9a;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --green: #2f7a55;
    --green-d: #8fd0ae;
    --green-hover: #38875f;
    --green-l: #22382c;
    --ink: #e6ece8;
    --muted: #a0b1a7;
    --paper: #1d2420;
    --bg: #141a16;
    --line: #33413a;
    --accent: #e0a05f;
    --soft-orange-bg: #2a241a;
    --soft-orange-line: #4a3c28;
    --soft-red-bg: #2c1f1f;
    --soft-red-line: #4d3434;
    --soft-red-ink: #e09a9a;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  overflow-wrap: break-word;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

a { color: var(--green-d); }
a:hover { color: var(--accent); }

h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.9rem; margin: .2em 0 .4em; }
h2 { font-size: 1.4rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.15rem; }

p { margin: .7em 0; }

.muted { color: var(--muted); }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--green); color: #fff;
  padding: 8px 14px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ——— Шапка ——— */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header__row { display: flex; align-items: center; gap: 18px; padding: 10px 18px; }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--ink); letter-spacing: .2px; }
.brand b { color: var(--green); }
.brand__mark { color: var(--green); }
.site-nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; color: var(--ink); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: .95rem;
}
.site-nav a:hover { background: var(--green-l); }
.site-nav a.is-active { background: var(--green); color: #fff; }
.nav-toggle { display: none; margin-left: 0; font-size: 1.4rem; background: none; border: 0; cursor: pointer; color: var(--ink); }
.theme-toggle {
  background: none; border: 0; cursor: pointer; font-size: 1.2rem; line-height: 1;
  color: var(--muted); padding: 6px 8px; border-radius: 8px;
}
.theme-toggle:hover { background: var(--green-l); color: var(--green-d); }

/* ——— Подвал ——— */
.site-footer { margin-top: 60px; border-top: 1px solid var(--line); background: var(--paper); padding: 26px 0; }
.site-footer p { margin: .3em 0; font-size: .92rem; }

/* ——— Текст уроков ——— */
main { padding-top: 26px; padding-bottom: 30px; }

/* Рекламный блок РСЯ (Яндекс Реклама): отделяем от контента и центрируем. */
.ad-rtb { margin: 36px auto 0; text-align: center; min-height: 1px; }

.lead { font-size: 1.12rem; color: var(--muted); }

.tp {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--green-l); color: var(--green-d);
  padding: .02em .3em; border-radius: 5px; font-weight: 600; white-space: nowrap;
}

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin: 18px 0; box-shadow: var(--shadow);
}
.card__title { margin-top: 0; color: var(--green-d); }

.note {
  border-left: 4px solid var(--accent); background: var(--soft-orange-bg); padding: 12px 16px;
  border-radius: 0 10px 10px 0; margin: 18px 0;
}
.note b { color: var(--accent); }

/* Примеры */
.ex-list { list-style: none; padding: 0; margin: 0; }
.ex { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ex:last-child { border-bottom: 0; }
.ex__tp { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; color: var(--green-d); font-size: 1.05rem; }
.ex__ru { color: var(--muted); }
@media (min-width: 620px) {
  .ex { grid-template-columns: 1fr 1fr; align-items: baseline; gap: 16px; }
}

/* Словарик */
.vocab__table { width: 100%; border-collapse: collapse; }
.vocab__table th, .vocab__table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.vocab__table thead th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.vocab__table tbody th { font-family: "Iowan Old Style", Palatino, Georgia, serif; color: var(--green-d); white-space: nowrap; }
.vocab__pos { color: var(--muted); font-size: .9rem; white-space: nowrap; }

/* Кнопки */
.btn {
  display: inline-block; border: 0; border-radius: 9px; padding: 11px 20px; font-size: 1rem; font-weight: 700;
  cursor: pointer; text-decoration: none; font-family: inherit; transition: transform .05s ease, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-hover); color: #fff; }
.btn--ghost { background: transparent; color: var(--green-d); border: 1.5px solid var(--green); }
.btn--ghost:hover { background: var(--green-l); }
.btn--lg { padding: 14px 28px; font-size: 1.08rem; }

/* ——— Задания (открыты всем) ——— */
.exercises { margin-top: 34px; border-top: 2px solid var(--line); padding-top: 6px; }
.exercises__title { color: var(--green-d); }
.exercises__hint { color: var(--muted); font-size: .95rem; }

/* Задания */
.task-list { list-style: none; padding: 0; margin: 12px 0 0; counter-reset: none; }
.task { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task__n {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.task__body { flex: 1 1 auto; }
.task__q { margin: 0 0 6px; }
.task__label { font-weight: 700; color: var(--green-d); }
.task__hint { color: var(--muted); }
.task__opts { margin: 6px 0; padding-left: 0; list-style: none; }
.task__opts li { margin: 4px 0; }
.task__opt {
  display: block; width: 100%; max-width: 460px; text-align: left; font: inherit; cursor: pointer;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
}
.task__opt:hover { border-color: var(--green); }
.task__opt .task__letter { color: var(--muted); margin-right: 2px; }
.task__opt.is-right { background: var(--green-l); border-color: var(--green); color: var(--green-d); font-weight: 700; }
.task__opt.is-wrong { background: var(--soft-red-bg); border-color: var(--soft-red-line); color: var(--soft-red-ink); }
.task.is-locked .task__opt { cursor: default; }
.task.is-locked .task__opt:not(.is-right):not(.is-wrong) { opacity: .6; }

.task__io { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 2px; }
.task__input {
  flex: 1 1 220px; max-width: 380px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 1rem; font-family: inherit; background: var(--paper); color: var(--ink);
}
.task__btn { padding: 9px 16px; background: var(--green); color: #fff; }
.task__btn:hover { background: var(--green-hover); }

.task__verdict { margin: 6px 0 0; font-weight: 600; }
.task__verdict.is-ok { color: var(--green-d); }
.task__verdict.is-bad { color: var(--accent); }

.answer { margin-top: 6px; }
.answer summary { cursor: pointer; color: var(--accent); font-weight: 600; width: max-content; }
.answer__body { margin-top: 6px; padding: 10px 14px; background: var(--green-l); border-radius: 8px; }

.self-grade { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: .95rem; }
.self-grade__btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 6px 12px;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
}
.self-grade__btn--yes:hover { border-color: var(--green); color: var(--green-d); }
.self-grade__btn--no:hover { border-color: var(--soft-red-line); color: var(--soft-red-ink); }

.ex-footer { margin-top: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ex-score { margin: 0; font-weight: 700; color: var(--green-d); }
.ex-reset {
  font: inherit; font-size: .88rem; cursor: pointer; background: none; border: 0;
  color: var(--muted); text-decoration: underline; padding: 0;
}
.ex-reset:hover { color: var(--accent); }

/* ——— Форма подписки ——— */
.dm-form { margin: 14px 0 6px; min-height: 40px; }

/* ——— Лендинг ——— */
.hero { text-align: center; padding: 40px 0 10px; }
.hero h1 { font-size: 2.3rem; }
.hero .lead { max-width: 620px; margin: 0 auto 20px; }
.hero__cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.features { display: grid; gap: 16px; margin: 26px 0; }
@media (min-width: 680px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin: 0 0 6px; color: var(--green-d); }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }

.subscribe-cta { background: var(--green-l); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin: 30px 0; text-align: center; }
.subscribe-cta .dm-form { max-width: 420px; margin: 14px auto 0; }

/* «Продолжить обучение» и «Слово дня» на главной */
.continue-card { border-left: 4px solid var(--green); }
.continue-card h2 { margin-top: 0; }
.wod { text-align: center; }
.wod__head { display: flex; align-items: baseline; justify-content: center; gap: 14px; flex-wrap: wrap; }
.wod__glyph { font-family: "linja pona", serif; font-size: 3rem; color: var(--green-d); line-height: 1.2; }
.wod__word { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; font-size: 2rem; color: var(--green-d); }
.wod__gloss { font-size: 1.05rem; margin-top: 2px; }
.wod .ex { border-bottom: 0; justify-content: center; }
.wod .ex-list { max-width: 560px; margin: 0 auto; }

/* ——— Программа (оглавление) ——— */
.toc { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.toc__item {
  display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
}
.toc__item:hover { border-color: var(--green); color: var(--ink); }
.toc__num { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 800; }
.toc__main { flex: 1 1 auto; }
.toc__title { font-weight: 700; }
.toc__sum { color: var(--muted); font-size: .92rem; }
.toc__check { flex: 0 0 auto; color: var(--green); font-weight: 800; opacity: 0; }
.toc__item.done .toc__check { opacity: 1; }
.toc__item.done .toc__num { background: var(--green-hover); }
/* Карточки повторений и экзамена в программе */
.toc__item--review .toc__num { background: var(--accent); }

/* Полоса прогресса на странице «Программа» */
.progress-line { margin: 14px 0 4px; }
.progress-line[hidden] { display: none; }
.progress-line__track { background: var(--line); border-radius: 99px; height: 10px; overflow: hidden; }
.progress-line__bar { background: var(--green); height: 100%; width: 0; border-radius: 99px; transition: width .3s ease; }
.progress-line__label { display: block; color: var(--muted); font-size: .9rem; margin-top: 4px; }

/* ——— Навигация между уроками ——— */
.lesson-head { margin-bottom: 4px; }
.lesson-head .crumb { color: var(--muted); font-size: .9rem; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin: 36px 0 0; flex-wrap: wrap; }
.lesson-nav a { flex: 1 1 45%; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; text-decoration: none; box-shadow: var(--shadow); }
.lesson-nav a:hover { border-color: var(--green); }
.lesson-nav .dir { display: block; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.lesson-nav .ttl { font-weight: 700; color: var(--green-d); }
.lesson-nav .next { text-align: right; }
.lesson-done { margin: 26px 0 0; }

/* Кнопка отметки прогресса */
.mark-done { background: var(--paper); border: 1.5px solid var(--green); color: var(--green-d); border-radius: 9px; padding: 10px 18px; font-weight: 700; cursor: pointer; font-family: inherit; }
.mark-done.is-done { background: var(--green); color: #fff; }

/* ——— Словарь (страница) ——— */
.dict-search { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; font-family: inherit; margin: 8px 0 16px; background: var(--paper); color: var(--ink); }
.dict-table { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.dict-table th, .dict-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.dict-table thead th { background: var(--green); color: #fff; font-size: .85rem; }
.dict-table tbody th { font-family: "Iowan Old Style", Palatino, Georgia, serif; color: var(--green-d); white-space: nowrap; }
.dict-row[hidden] { display: none; }
.dict-count { color: var(--muted); font-size: .9rem; }
/* Колонка знака sitelen pona */
.dict-glyph { font-family: "linja pona", serif; font-size: 1.55rem; color: var(--green-d); line-height: 1.2; }

/* Кнопка произношения (появляется, когда на хостинге есть mp3) */
.play-audio {
  display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 6px;
  border-radius: 50%; border: 1px solid var(--green); background: var(--paper); color: var(--green-d);
  font-size: .7rem; cursor: pointer; vertical-align: middle;
}
.play-audio:hover { background: var(--green-l); }

/* ——— Устойчивые сочетания (идиомы) ——— */
.idiom-group { margin: 28px 0; }
.idiom-group h2 { margin-bottom: 8px; }
.idiom-group .muted { margin-top: 0; }

/* ——— sitelen pona (бонус) ——— */
.sp-sample { font-family: "linja pona", "nasin nanpa", sans-serif; font-size: 2rem; line-height: 1.6; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 16px 0; }
.sp-cell { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.sp-cell .glyph { font-family: "linja pona", "nasin nanpa", serif; font-size: 2.2rem; display: block; min-height: 1.4em; color: var(--green-d); }
.sp-cell .rom { font-weight: 700; }
.sp-cell .ru { font-size: .85rem; color: var(--muted); }

/* ——— Тексты для чтения ——— */
.text-subtitle { margin: 0 0 10px; }
.text-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.badge {
  display: inline-block; font-size: .8rem; font-weight: 700; padding: 3px 11px; border-radius: 999px;
  background: var(--green-l); color: var(--green-d); border: 1px solid var(--line);
}
.badge--tale { background: var(--soft-orange-bg); color: var(--accent); border-color: var(--soft-orange-line); }
.badge--orig { background: var(--green-l); color: var(--green-d); border-color: var(--line); }
.badge--soft { background: var(--paper); color: var(--muted); }

/* Параллельное чтение строится на тех же .ex, но чуть просторнее. */
.reader-card { padding: 8px 20px; }
.reader .ex { padding: 11px 0; }
.reader .ex__tp { font-size: 1.08rem; }
@media (min-width: 620px) {
  .reader .ex { grid-template-columns: 1fr 1fr; gap: 22px; }
}

/* Режим «скрыть перевод»: перевод строки открывается по нажатию. */
.reader-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 18px 0 10px; }
.reader-tools__btn { padding: 8px 16px; font-size: .95rem; }
.reader-tools__hint { font-size: .9rem; }
.reader.hide-ru .ex { cursor: pointer; }
.reader.hide-ru .ex__ru { visibility: hidden; }
.reader.hide-ru .ex.revealed .ex__ru { visibility: visible; }

/* Песенка/стих внутри сказки. */
.ex--song { background: var(--green-l); border-radius: 10px; padding: 12px 14px; border-bottom: 0; margin: 4px 0; }
.ex--song .ex__tp { line-height: 1.75; }

/* Тот же текст без перевода — для чтения вслух. */
.read-tp-wrap { margin: 18px 0; }
.read-tp-wrap > summary { cursor: pointer; color: var(--accent); font-weight: 700; width: max-content; }
.read-tp { margin-top: 10px; }
.read-tp__line {
  display: block; font-family: "Iowan Old Style", Palatino, Georgia, serif;
  color: var(--green-d); font-size: 1.1rem; line-height: 1.85; padding: 2px 0;
}

/* В оглавлении текстов вместо номера — символ. */
.toc__num--text { font-size: 1.3rem; background: var(--green-l); color: var(--green-d); }

/* ——— Тренажёр слов (карточки) ——— */
.flash-controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.tool-select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit;
  background: var(--paper); color: var(--ink); cursor: pointer;
}
.flash-card {
  display: block; width: 100%; min-height: 230px; padding: 24px; text-align: center; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  font: inherit; color: var(--ink);
}
.flash-card:hover { border-color: var(--green); }
.flash-card .glyph { display: block; font-family: "linja pona", serif; font-size: 3.4rem; color: var(--green-d); line-height: 1.3; min-height: 1.3em; }
.flash-front { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; font-size: 2rem; color: var(--green-d); }
.flash-front--ru { font-family: inherit; font-size: 1.3rem; color: var(--ink); }
.flash-back { display: block; margin-top: 10px; }
.flash-back .flash-word { display: inline-block; font-size: 1.2rem; margin-bottom: 6px; }
.flash-back .flash-word:empty { display: none; }
.flash-back .flash-def { display: block; font-size: 1.05rem; }
.flash-back .flash-ex { display: block; color: var(--muted); font-size: .95rem; margin-top: 8px; }
.flash-back .flash-ex:empty { display: none; }
.flash-tip { display: block; }
.flash-tip { color: var(--muted); font-size: .9rem; margin-top: 14px; }
.flash-grade { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.flash-grade .btn--no { background: var(--soft-red-bg); color: var(--soft-red-ink); border: 1px solid var(--soft-red-line); }
.flash-grade .btn--no:hover { border-color: var(--soft-red-ink); }
.flash-stats { color: var(--muted); font-size: .92rem; }
.flash-done { text-align: center; padding: 30px 10px; }

/* ——— Игра «Собери предложение» ——— */
.gm-prompt { font-size: 1.1rem; }
.gm-answer {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 54px;
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 8px 10px; margin: 10px 0;
}
.gm-answer:empty::before { content: 'Нажимайте на слова внизу, чтобы собрать предложение…'; color: var(--muted); font-size: .92rem; }
.gm-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; min-height: 46px; }
.gm-tile {
  font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 700; font-size: 1.05rem;
  color: var(--green-d); background: var(--green-l); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 13px; cursor: pointer;
}
.gm-tile:hover { border-color: var(--green); }
.gm-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.gm-result { font-weight: 600; }
.gm-result.is-ok { color: var(--green-d); }
.gm-result.is-bad { color: var(--accent); }
.gm-streak { color: var(--muted); font-size: .92rem; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--paper); flex-direction: column; padding: 8px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; }
  .nav-toggle { display: block; padding: 6px 10px; }
  .site-header__row { position: relative; padding: 10px 14px; gap: 12px; }
  .theme-toggle { margin-left: auto; }
  .lesson-nav a { flex: 1 1 100%; }
  .lesson-nav .next { text-align: left; }

  .wrap { padding: 0 14px; }
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.25rem; }
  .hero { padding: 26px 0 6px; }
  .hero h1 { font-size: 1.7rem; }
  .card { padding: 14px; }
  .note { padding: 10px 12px; }

  /* Длинные фразы токи пона должны переноситься, а не распирать страницу. */
  .tp { white-space: normal; }
  .vocab__table tbody th .tp, .dict-table tbody th .tp { white-space: nowrap; }

  /* Таблицы словарика и словаря: вместо колонок — стопка «карточек».
     Узкому экрану три-четыре колонки не помещаются (см. колонку «Значение»),
     поэтому строка раскладывается так: слово + класс, ниже — значение. */
  .vocab__table thead, .dict-table thead { display: none; }
  .vocab__table, .vocab__table tbody,
  .dict-table, .dict-table tbody { display: block; width: 100%; }
  .vocab__table tr, .dict-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .vocab__table tr:last-child, .dict-table tr:last-child { border-bottom: 0; }
  .vocab__table th, .vocab__table td,
  .dict-table th, .dict-table td { display: block; padding: 0; border-bottom: 0; }
  .vocab__table tbody th, .dict-table tbody th { display: inline-block; font-size: 1.05rem; }
  td.vocab__pos { display: inline; margin-left: 8px; white-space: normal; }
  .dict-table { box-shadow: none; border-radius: 0; background: transparent; }
  .dict-table td.muted:last-child { font-size: .85rem; margin-top: 2px; }
  td.dict-glyph { display: inline-block; margin-left: 8px; font-size: 1.3rem; vertical-align: middle; }

  .task { gap: 10px; }
}

/* ——— Справочник: инструменты ——— */
.tool-input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 1.05rem; font-family: inherit; margin: 8px 0 4px; background: var(--paper); color: var(--ink);
}
.tool-area {
  width: 100%; min-height: 120px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1rem; font-family: inherit; margin: 8px 0 4px; resize: vertical;
  background: var(--paper); color: var(--ink);
}
.tool-result { margin: 10px 0 0; }
.tool-result[hidden] { display: none; }
.tool-msg { color: var(--accent); font-weight: 600; margin: 6px 0; }
.name-result {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.6rem; font-weight: 700; color: var(--green-d); margin: 8px 0 2px;
}

/* Чипы пословного разбора */
.gl-flow { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.gl {
  display: inline-flex; flex-direction: column; gap: 1px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; max-width: 100%;
}
.gl b { font-family: "Iowan Old Style", Palatino, Georgia, serif; color: var(--green-d); font-size: 1.02rem; }
.gl small { color: var(--muted); font-size: .8rem; }
.gl--name { background: var(--soft-orange-bg); border-color: var(--soft-orange-line); }
.gl--name b { color: var(--accent); }
.gl--unknown { background: var(--soft-red-bg); border-color: var(--soft-red-line); }
.gl--unknown b { color: var(--soft-red-ink); }
.gl--idiom { background: var(--green-l); border-color: var(--green); }
.gl-stat { color: var(--muted); font-size: .9rem; }

/* ——— Шпаргалка (все 120 слов) ——— */
.cheat { columns: 2; column-gap: 26px; margin: 18px 0; }
.cheat__lesson { break-inside: avoid; margin: 0 0 16px; }
.cheat__lesson h2 { font-size: 1.02rem; margin: 0 0 6px; color: var(--green-d); border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.cheat__item { display: flex; gap: 8px; align-items: baseline; padding: 1.5px 0; font-size: .95rem; }
.cheat__item b { font-family: "Iowan Old Style", Palatino, Georgia, serif; color: var(--green-d); flex: 0 0 auto; min-width: 72px; }
.cheat__item span { color: var(--muted); }
@media (max-width: 640px) {
  .cheat { columns: 1; }
}

/* ——— Печать ———
   Прячем навигацию, рекламу и кнопки; печатаем всегда в светлой палитре;
   шпаргалка раскладывается в три колонки. */
@media print {
  :root, [data-theme="dark"] {
    --green: #2f6f4f; --green-d: #245a40; --green-hover: #245a40; --green-l: #fff;
    --ink: #000; --muted: #444; --paper: #fff; --bg: #fff; --line: #ccc;
    --accent: #8a4d1b; --soft-orange-bg: #fff; --soft-red-bg: #fff;
    --shadow: none;
  }
  .site-header, .site-footer, .ad-rtb, .skip-link, .lesson-nav, .lesson-done,
  .js-print, .no-print, .btn, .dm-form, .subscribe-cta, .nav-toggle, .theme-toggle,
  .reader-tools, .ex-footer, .task__io { display: none !important; }
  body { background: #fff; font-size: 12px; }
  main { padding-top: 0; }
  .card, .toc__item { box-shadow: none; }
  .tp { background: none; padding: 0; }
  .cheat { columns: 3; column-gap: 18px; }
  .cheat__lesson h2 { break-after: avoid; }
  .cheat__item { break-inside: avoid; }
}
