.themebtn{width:36px;height:36px;display:inline-grid;place-items:center;flex:none;border-radius:10px;border:1px solid var(--line-2);background:transparent;color:var(--text);cursor:pointer;padding:0}.themebtn:hover{background:var(--tint)}.themebtn svg{width:18px;height:18px}.themebtn .moon{display:none}/* Светлая тема всего сайта (кроме главной — у неё свои цвета в app/home.html).
   «:root[data-theme=light]» сборка заменяет на два селектора: :root[data-theme=light] (выбрано кнопкой) и
   :root:not([data-theme=dark]) внутри @media (prefers-color-scheme: light) (светлая тема в системе).
   Палитра — светло-голубая, в тон тёмно-синей ночной: те же синие, золото и зелёный, только темнее для текста на светлом. */
:root[data-theme=light]{
  color-scheme: light;
  --bg:#c6dcf5; --bg-2:#e4effc; --surface:#d9e8fa; --surface-2:#bcd4f1; --sunk:#f2f7fe;
  --line:rgba(16,52,110,.16); --line-2:rgba(16,52,110,.28);
  --paper:#fbfcfe; --paper-grid:#dfe8f4; --pen:#a8332a; --pen-line:rgba(200,69,58,.5);
  --text:#13223d; --muted:#44587a; --faint:#54698b; /* faint — 14-я проверка: контраст мелких подписей 4,0 → 4,8 */
  --gold:#8c5604; /* 14-я проверка: контраст 4,45 → 5,2 на #e4effc */ --gold-soft:rgba(214,140,20,.16); --on-gold:#1d1406; --gold-bg:#eba23a; --cream:#0b2447;
  --good:#167a4a; --good-soft:rgba(22,122,74,.11); --bad:#b5382a; --bad-soft:rgba(181,56,42,.09); --warn:#8a5f00;
  --text-2:#22324f; --note-text:#4a3610; --ava-fg:#eef4fb; --gold-hover:#dc922c; --tip-bg:#ffffff; --glow:#eaf4ff;
  --overlay:rgba(16,32,60,.45); --shadow:rgba(20,40,80,.16); --track:rgba(16,52,110,.13); --tint:rgba(16,52,110,.04); --gridl:rgba(16,52,110,.12);
  --good-line:rgba(22,122,74,.45); --bad-line:rgba(181,56,42,.45); --gold-line:rgba(154,96,6,.45); --warn-line:rgba(138,95,0,.4); --warn-soft:rgba(214,160,20,.14); --muted-soft:rgba(74,94,126,.09);
  --on-good:#ffffff; --thm-bg:#f8eed8; --def-bg:#d6e5f8; --heat0:#bcd2ee; --heat1:#f1dcae; --heat2:#e8bd6a; --heat3:#d4932c; --heat4:#b06d08;
}
/* кнопка «светлая / тёмная тема» в шапке: в тёмной теме — солнце, в светлой — луна */
:root[data-theme=light] .themebtn .moon{display:block}
:root[data-theme=light] .themebtn .sun{display:none}
/* рисунки к задачам нарисованы светлыми линиями для тёмного фона: на светлом — те же цвета, только тёмные */
:root[data-theme=light] figure.fig svg [stroke="#ecdfc4"]{stroke:#1b2c4b}
:root[data-theme=light] figure.fig svg [fill="#ecdfc4"]{fill:#1b2c4b}
:root[data-theme=light] figure.fig svg [stroke="#6f87a8"]{stroke:#8295b3}
:root[data-theme=light] figure.fig svg [fill="#6f87a8"]{fill:#566b8e}
:root[data-theme=light] figure.fig svg [stroke="#f2ac3f"]{stroke:#c07a0d}
:root[data-theme=light] figure.fig svg [fill="#f2ac3f"]{fill:#c07a0d}
:root[data-theme=light] figure.fig svg [stroke="#7ed9a8"]{stroke:#1a8752}
:root[data-theme=light] figure.fig svg [fill="#7ed9a8"]{fill:#1a8752}
:root[data-theme=light] figure.fig svg [stroke="#4da3ff"]{stroke:#1f68c9}
:root[data-theme=light] figure.fig svg [stroke="#dd9320"]{stroke:#a8650a} /* ветки хакенбуша (21.11.2026) */
/* текст на рисунках и графиках (13.11.2026, 12-я проверка): золотой #c07a0d на фоне рисунка давал контраст 2,8 : 1, зелёный — 3,6, серый — 4,3;
   для мелкого текста нужно 4,5. Линии и заливки остаются прежними, подписи — темнее (≈ 5 : 1 и выше). Цвет подписи задан у самого
   <text> или у группы <g fill> (db/tools/plotkit.py) — во втором случае правило для text без своего fill, чтобы не перекрасить подпись другого цвета */
:root[data-theme=light] figure.fig svg text[fill="#f2ac3f"],:root[data-theme=light] figure.fig svg tspan[fill="#f2ac3f"],:root[data-theme=light] figure.fig svg [fill="#f2ac3f"] text:not([fill]){fill:#8a5600}
:root[data-theme=light] figure.fig svg text[fill="#7ed9a8"],:root[data-theme=light] figure.fig svg tspan[fill="#7ed9a8"],:root[data-theme=light] figure.fig svg [fill="#7ed9a8"] text:not([fill]){fill:#12663d}
:root[data-theme=light] figure.fig svg text[fill="#6f87a8"],:root[data-theme=light] figure.fig svg tspan[fill="#6f87a8"],:root[data-theme=light] figure.fig svg [fill="#6f87a8"] text:not([fill]){fill:#4a5e80}
/* графики в кабинете и панели учителя */
:root[data-theme=light] .chart [fill="#9c7a44"]{fill:#e2b46a}
:root[data-theme=light] .chart [fill="#f2ac3f"]{fill:#c07a0d}
:root[data-theme=light] .chart [stroke="#7ed9a8"]{stroke:#1a8752}
:root[data-theme=light] .chart [fill="#7ed9a8"]{fill:#1a8752}
:root[data-theme=light] .chart [fill="#0a2a52"]{fill:#eef4fb}
@media (prefers-color-scheme: light){/* Светлая тема всего сайта (кроме главной — у неё свои цвета в app/home.html).
   «:root:not([data-theme=dark])» сборка заменяет на два селектора: :root[data-theme=light] (выбрано кнопкой) и
   :root:not([data-theme=dark]) внутри @media (prefers-color-scheme: light) (светлая тема в системе).
   Палитра — светло-голубая, в тон тёмно-синей ночной: те же синие, золото и зелёный, только темнее для текста на светлом. */
:root:not([data-theme=dark]){
  color-scheme: light;
  --bg:#c6dcf5; --bg-2:#e4effc; --surface:#d9e8fa; --surface-2:#bcd4f1; --sunk:#f2f7fe;
  --line:rgba(16,52,110,.16); --line-2:rgba(16,52,110,.28);
  --paper:#fbfcfe; --paper-grid:#dfe8f4; --pen:#a8332a; --pen-line:rgba(200,69,58,.5);
  --text:#13223d; --muted:#44587a; --faint:#54698b; /* faint — 14-я проверка: контраст мелких подписей 4,0 → 4,8 */
  --gold:#8c5604; /* 14-я проверка: контраст 4,45 → 5,2 на #e4effc */ --gold-soft:rgba(214,140,20,.16); --on-gold:#1d1406; --gold-bg:#eba23a; --cream:#0b2447;
  --good:#167a4a; --good-soft:rgba(22,122,74,.11); --bad:#b5382a; --bad-soft:rgba(181,56,42,.09); --warn:#8a5f00;
  --text-2:#22324f; --note-text:#4a3610; --ava-fg:#eef4fb; --gold-hover:#dc922c; --tip-bg:#ffffff; --glow:#eaf4ff;
  --overlay:rgba(16,32,60,.45); --shadow:rgba(20,40,80,.16); --track:rgba(16,52,110,.13); --tint:rgba(16,52,110,.04); --gridl:rgba(16,52,110,.12);
  --good-line:rgba(22,122,74,.45); --bad-line:rgba(181,56,42,.45); --gold-line:rgba(154,96,6,.45); --warn-line:rgba(138,95,0,.4); --warn-soft:rgba(214,160,20,.14); --muted-soft:rgba(74,94,126,.09);
  --on-good:#ffffff; --thm-bg:#f8eed8; --def-bg:#d6e5f8; --heat0:#bcd2ee; --heat1:#f1dcae; --heat2:#e8bd6a; --heat3:#d4932c; --heat4:#b06d08;
}
/* кнопка «светлая / тёмная тема» в шапке: в тёмной теме — солнце, в светлой — луна */
:root:not([data-theme=dark]) .themebtn .moon{display:block}
:root:not([data-theme=dark]) .themebtn .sun{display:none}
/* рисунки к задачам нарисованы светлыми линиями для тёмного фона: на светлом — те же цвета, только тёмные */
:root:not([data-theme=dark]) figure.fig svg [stroke="#ecdfc4"]{stroke:#1b2c4b}
:root:not([data-theme=dark]) figure.fig svg [fill="#ecdfc4"]{fill:#1b2c4b}
:root:not([data-theme=dark]) figure.fig svg [stroke="#6f87a8"]{stroke:#8295b3}
:root:not([data-theme=dark]) figure.fig svg [fill="#6f87a8"]{fill:#566b8e}
:root:not([data-theme=dark]) figure.fig svg [stroke="#f2ac3f"]{stroke:#c07a0d}
:root:not([data-theme=dark]) figure.fig svg [fill="#f2ac3f"]{fill:#c07a0d}
:root:not([data-theme=dark]) figure.fig svg [stroke="#7ed9a8"]{stroke:#1a8752}
:root:not([data-theme=dark]) figure.fig svg [fill="#7ed9a8"]{fill:#1a8752}
:root:not([data-theme=dark]) figure.fig svg [stroke="#4da3ff"]{stroke:#1f68c9}
:root:not([data-theme=dark]) figure.fig svg [stroke="#dd9320"]{stroke:#a8650a} /* ветки хакенбуша (21.11.2026) */
/* текст на рисунках и графиках (13.11.2026, 12-я проверка): золотой #c07a0d на фоне рисунка давал контраст 2,8 : 1, зелёный — 3,6, серый — 4,3;
   для мелкого текста нужно 4,5. Линии и заливки остаются прежними, подписи — темнее (≈ 5 : 1 и выше). Цвет подписи задан у самого
   <text> или у группы <g fill> (db/tools/plotkit.py) — во втором случае правило для text без своего fill, чтобы не перекрасить подпись другого цвета */
:root:not([data-theme=dark]) figure.fig svg text[fill="#f2ac3f"],:root:not([data-theme=dark]) figure.fig svg tspan[fill="#f2ac3f"],:root:not([data-theme=dark]) figure.fig svg [fill="#f2ac3f"] text:not([fill]){fill:#8a5600}
:root:not([data-theme=dark]) figure.fig svg text[fill="#7ed9a8"],:root:not([data-theme=dark]) figure.fig svg tspan[fill="#7ed9a8"],:root:not([data-theme=dark]) figure.fig svg [fill="#7ed9a8"] text:not([fill]){fill:#12663d}
:root:not([data-theme=dark]) figure.fig svg text[fill="#6f87a8"],:root:not([data-theme=dark]) figure.fig svg tspan[fill="#6f87a8"],:root:not([data-theme=dark]) figure.fig svg [fill="#6f87a8"] text:not([fill]){fill:#4a5e80}
/* графики в кабинете и панели учителя */
:root:not([data-theme=dark]) .chart [fill="#9c7a44"]{fill:#e2b46a}
:root:not([data-theme=dark]) .chart [fill="#f2ac3f"]{fill:#c07a0d}
:root:not([data-theme=dark]) .chart [stroke="#7ed9a8"]{stroke:#1a8752}
:root:not([data-theme=dark]) .chart [fill="#7ed9a8"]{fill:#1a8752}
:root:not([data-theme=dark]) .chart [fill="#0a2a52"]{fill:#eef4fb}
}/* Шапка, подвал, «хлебные крошки» и вкладки — одинаковые на всех страницах: на внутренних, на главной (app/home.html) и в задачнике.
   Цвета — переменные темы (shared.css и theme_light.css; у главной — те же имена в её :root). Меню сворачивается в кнопку «Меню» на 1000px. */
header.top{display:flex;align-items:center;gap:10px 14px;flex-wrap:wrap;padding-block:16px;border:0}
header.top .brand{display:flex;align-items:center;gap:10px;margin-right:auto;color:var(--text);text-decoration:none;min-width:0}
header.top .brand img{width:42px;height:auto;display:block}
header.top .brand b{font-family:var(--display);font-size:19px;display:block;line-height:1.1;font-weight:700;color:var(--text)}
header.top .brand small{font-size:12px;color:var(--muted);display:block;line-height:1.3}
.sitenav{display:flex;gap:2px;flex-wrap:wrap;align-items:center}
.sitenav a{color:var(--text);text-decoration:none;padding:8px 6px;border-radius:999px;font-size:14px;font-weight:500;white-space:nowrap;border:0}
.sitenav a:hover{background:var(--gold-soft)}
.sitenav a[aria-current="page"]{color:var(--gold);font-weight:600}
.navtheme{display:none;border:0;background:none;color:var(--text);font:inherit;font-size:14px;text-align:left;padding:10px 12px;border-radius:10px;cursor:pointer}
.navtheme:hover{background:var(--gold-soft)}
.hdr{display:flex;align-items:center;gap:8px;flex:none}
header.top .menu-btn{display:none;align-items:center;justify-content:center;min-height:36px;padding:6px 12px;border-radius:10px;border:1px solid var(--line-2);background:transparent;color:var(--text);font:600 14px var(--body);cursor:pointer}
header.top .menu-btn:hover{border-color:var(--gold)}
header.top a.cab{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:6px 14px;border-radius:10px;border:1px solid var(--gold-bg);background:var(--gold-bg);color:var(--on-gold);font:600 14px var(--body);text-decoration:none;white-space:nowrap}
header.top a.cab:hover{background:var(--gold-hover);border-color:var(--gold-hover)}
header.top .menu-btn,header.top a.cab{margin:0;line-height:1.2}
header.top a.cab[aria-current="page"]{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--gold)}
header.top a.cab .cab-s{display:none}
@media (max-width:1240px){
  header.top .brand small{display:none}
  .sitenav a{padding:8px 5px}
  .sitenav .srch-w{display:none}
}
@media (max-width:1000px){
  .sitenav{display:none;width:100%;order:9;flex-direction:column;align-items:stretch;background:var(--bg-2);border:1px solid var(--line);border-radius:14px;padding:6px}
  .sitenav.open{display:flex}
  .sitenav a{padding:11px 12px;border-radius:10px}
  .sitenav .srch-w{display:inline}
  header.top .menu-btn{display:inline-flex}
}
@media (max-width:560px){
  header.top{gap:8px}
  .hdr{gap:6px}
  .hdr>.themebtn{display:none}
  .sitenav .navtheme{display:block}
  header.top .brand{gap:8px}
  header.top .brand img{width:34px}
  header.top .brand b{font-size:17px}
}
@media (max-width:480px){
  header.top a.cab{padding:6px 12px}
  header.top a.cab .cab-l{display:none}
  header.top a.cab .cab-s{display:inline}
}
/* 22.11.2026: со своими шрифтами (Literata грузится и в тестах) «Мир математики» на 375 px шире прежнего на ~20 px — у вошедшего ученика
   («Меню» + «Кабинет») шапка уходила во вторую строку. Чуть меньше кегль и зазор — снова одна строка */
@media (max-width:400px){ header.top{gap:10px 8px} header.top .brand{gap:6px} header.top .brand img{width:30px} header.top .brand b{font-size:15px;letter-spacing:-.01em} header.top .menu-btn{padding:6px 10px} }
@media (max-width:360px){ header.top .brand b{font-size:14px} }
/* 23.11.2026: на 320–340 px «Меню» и «Кабинет» с названием сайта в одну строку не помещаются — остаётся логотип (у ссылки есть aria-label) */
@media (max-width:340px){ header.top .brand span{display:none} header.top .brand img{width:34px} }

/* подвал: один на всех страницах */
.sitefoot{border-top:1px solid var(--line);margin-top:30px;padding-block:24px 8px;font-size:14px;color:var(--muted);display:flex;gap:6px 16px;flex-wrap:wrap;justify-content:space-between}
.sitefoot>span{display:flex;flex-wrap:wrap;align-items:center;gap:0 2px}
.sitefoot a{color:var(--muted);text-decoration:none;border:0;display:inline-flex;align-items:center;min-height:32px;padding:0 4px;border-radius:6px}
.sitefoot a:hover{color:var(--gold)}

/* «хлебные крошки»: где страница в разделах сайта */
.crumbs{font-size:13.5px;color:var(--muted);margin:2px 0 4px;line-height:1.5}
.crumbs ol{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;align-items:center;gap:2px 0}
.crumbs li{display:inline-flex;align-items:center}
.crumbs li+li::before{content:"›";margin:0 7px;color:var(--faint,var(--muted))}
.crumbs a{color:var(--muted);text-decoration:none;border-bottom:1px solid var(--line-2)}
.crumbs a:hover{color:var(--gold);border-color:var(--gold)}
.crumbs [aria-current]{color:var(--text)}

/* вкладки раздела «Олимпиадные задачи»: по классам (olimp.html) и по разделам (zadachi.html) */
.ptabs{display:flex;gap:4px;border-bottom:1px solid var(--line-2);margin:14px 0 18px;overflow-x:auto;scrollbar-width:none}
.ptabs::-webkit-scrollbar{display:none}
.ptabs a{display:inline-flex;align-items:center;gap:6px;padding:10px 16px;margin-bottom:-1px;border:1px solid transparent;border-bottom:0;border-radius:10px 10px 0 0;color:var(--muted);text-decoration:none;font-weight:600;font-size:15px;white-space:nowrap}
.ptabs a:hover{color:var(--text);background:var(--gold-soft)}
.ptabs a[aria-current="page"]{color:var(--text);background:var(--bg);border-color:var(--line-2);box-shadow:inset 0 3px 0 var(--gold)}
.ptabs small{font-weight:500;color:var(--muted);font-size:12.5px}
@media (max-width:560px){
  /* на телефоне длинное название в крошках — в одну строку с многоточием. Любой пункт, не только последний: длинное название
     курса («Тригонометрия: от прямоугольного треугольника…») в середине крошек сдвигало 37 страниц уроков вбок (аудит 06.11.2026) */
  .crumbs li{white-space:nowrap;max-width:100%;min-width:0}
  .crumbs li>a,.crumbs li>span{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis}
  .ptabs a{padding:10px 12px}
  .ptabs small{display:none}
}
/* «Перейти к содержимому» (15.11.2026): спрятана над экраном, появляется при фокусе с клавиатуры (Tab с начала страницы) */
.skip{position:fixed;left:12px;top:10px;z-index:200;transform:translateY(-160%);opacity:0;pointer-events:none;background:var(--gold-bg);color:var(--on-gold);font:600 15px var(--body);padding:10px 16px;border-radius:10px;text-decoration:none;box-shadow:0 8px 24px var(--shadow)}
.skip:focus{transform:none;opacity:1;pointer-events:auto;outline:2px solid var(--text);outline-offset:2px}
#content:focus{outline:none}
