/* Оформление в стиле методичек (materials/template/lib.typ, палитра «Фокус»):
   синий градиент в заголовках, мягкие синие панели, шрифт Inter.
   Тема: светлая / тёмная / как в системе — атрибут data-theme у <html> (кнопка в шапке). */
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter-ExtraBold.woff2") format("woff2");
  font-weight: 800; font-style: normal; font-display: swap; }

:root {
  --g1: #1d4ed8; --g2: #3b82f6; --main: #1d4ed8; --main-hover: #1e40af;
  --bg: #f8faff; --card: #ffffff; --soft: #eff6ff; --acc: #bfdbfe; --sticky: #dbeafe;
  --text: #1b2430; --muted: #5b6676; --line: #d6e2f5; --line-soft: #e8eef8;
  --on-main: #ffffff; --tag: #eaf1fd;
  --ok: #eff6ff; --ok-edge: #3b82f6; --ok-text: #1b2430;
  --done: #dcfce7; --done-edge: #16a34a; --done-text: #14532d;
  --bad: #fff0f0; --bad-edge: #e03131; --bad-text: #b42318;
  --img-bg: #ffffff; --shadow: 0 1px 2px rgba(29, 78, 216, .06), 0 4px 14px rgba(29, 78, 216, .05);
  --code-bg: #f6f8fa; --code-fg: #24292f; --code-line: #d0d7de;
  --sx-red: #d73948; --sx-pink: #b60157; --sx-blue: #4b69c6; --sx-green: #198810;
  --sx-gray: #74747c; --sx-purple: #8b41b1; --sx-brown: #301414; --sx-teal: #1d6c76;
  --disc: #15803d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="midnight"]):not([data-theme="navy"]) {
  --g1:#334155;--g2:#60a5fa;--main:#7cb7ff;--main-hover:#a5cfff;--bg:#121417;--card:#1a1d21;--soft:#20252b;--acc:#2b3a4f;--sticky:#26303d;--text:#e8eaed;--muted:#9aa1ab;--line:#2c3138;--line-soft:#24282e;--on-main:#0c1118;--tag:#242a32;--ok:#1b2634;--ok-edge:#7cb7ff;--ok-text:#e8eaed;--done:#16301f;--done-edge:#4ade80;--done-text:#bbf7d0;--bad:#331a1d;--bad-edge:#f06262;--bad-text:#fca5a5;--img-bg:#ffffff;--shadow:none;--code-bg:#0f1317;--code-fg:#e6edf3;--code-line:#2c3138;--sx-red:#ff7b86;--sx-pink:#ff8fc4;--sx-blue:#8fb0ff;--sx-green:#56d364;--sx-gray:#9aa1ab;--sx-purple:#d2a8ff;--sx-brown:#e6c9c9;--sx-teal:#56d4dd;--disc:#4ade80;color-scheme:dark;
  }
}
:root[data-theme="dark"] {
  --g1:#334155;
  --g2:#60a5fa;
  --main:#7cb7ff;
  --main-hover:#a5cfff;
  --bg:#121417;
  --card:#1a1d21;
  --soft:#20252b;
  --acc:#2b3a4f;
  --sticky:#26303d;
  --text:#e8eaed;
  --muted:#9aa1ab;
  --line:#2c3138;
  --line-soft:#24282e;
  --on-main:#0c1118;
  --tag:#242a32;
  --ok:#1b2634;
  --ok-edge:#7cb7ff;
  --ok-text:#e8eaed;
  --done:#16301f;
  --done-edge:#4ade80;
  --done-text:#bbf7d0;
  --bad:#331a1d;
  --bad-edge:#f06262;
  --bad-text:#fca5a5;--img-bg:#ffffff;--shadow:none;--code-bg:#0f1317;--code-fg:#e6edf3;--code-line:#2c3138;--sx-red:#ff7b86;--sx-pink:#ff8fc4;--sx-blue:#8fb0ff;--sx-green:#56d364;--sx-gray:#9aa1ab;--sx-purple:#d2a8ff;--sx-brown:#e6c9c9;--sx-teal:#56d4dd;--disc:#4ade80;color-scheme:dark;
}
:root[data-theme="midnight"] {
  --g1:#312e81;
  --g2:#6366f1;
  --main:#8b9cff;
  --main-hover:#b4bfff;
  --bg:#080b16;
  --card:#0f1424;
  --soft:#141b33;
  --acc:#25306b;
  --sticky:#1a2347;
  --text:#e7e9f6;
  --muted:#9097b8;
  --line:#1f2848;
  --line-soft:#171e38;
  --on-main:#080b16;
  --tag:#18203d;
  --ok:#121a36;
  --ok-edge:#8b9cff;
  --ok-text:#e7e9f6;
  --done:#0f2a22;
  --done-edge:#34d399;
  --done-text:#b7f5de;
  --bad:#2a1220;
  --bad-edge:#f472a0;
  --bad-text:#fbb6cf;--img-bg:#ffffff;--shadow:none;--code-bg:#0f1317;--code-fg:#e6edf3;--code-line:#2c3138;--sx-red:#ff7b86;--sx-pink:#ff8fc4;--sx-blue:#8fb0ff;--sx-green:#56d364;--sx-gray:#9aa1ab;--sx-purple:#d2a8ff;--sx-brown:#e6c9c9;--sx-teal:#56d4dd;--disc:#4ade80;color-scheme:dark;
}
:root[data-theme="navy"] {
  --g1:#1e3a8a;
  --g2:#2563eb;
  --main:#60a5fa;
  --main-hover:#93c5fd;
  --bg:#0d1220;
  --card:#141b2d;
  --soft:#17223a;
  --acc:#1e3a8a;
  --sticky:#1b2a4a;
  --text:#e6ebf4;
  --muted:#9ba7ba;
  --line:#253250;
  --line-soft:#1d2840;
  --on-main:#0b1220;
  --tag:#1c2842;
  --ok:#15233f;
  --ok-edge:#60a5fa;
  --ok-text:#e6ebf4;
  --done:#123524;
  --done-edge:#4ade80;
  --done-text:#bbf7d0;
  --bad:#2c1418;
  --bad-edge:#f06262;
  --bad-text:#fca5a5;--img-bg:#ffffff;--shadow:none;--code-bg:#0f1317;--code-fg:#e6edf3;--code-line:#2c3138;--sx-red:#ff7b86;--sx-pink:#ff8fc4;--sx-blue:#8fb0ff;--sx-green:#56d364;--sx-gray:#9aa1ab;--sx-purple:#d2a8ff;--sx-brown:#e6c9c9;--sx-teal:#56d4dd;--disc:#4ade80;color-scheme:dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--card, #fff); }   /* за краем страницы (оттяжка вниз) виден цвет подвала, а не фона */
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--main); text-underline-offset: 2px; }
a:hover { color: var(--main-hover); }

/* Без системной вспышки при касании; клавиатурный фокус сохраняется. */
a, button, summary, label, [role="button"],
input[type="button"], input[type="submit"], input[type="reset"] {
  -webkit-tap-highlight-color: transparent;
}

/* Заголовок страницы — плашка с градиентом, как заголовок главы в методичке */
h1 { font-size: 1.45rem; font-weight: 800; line-height: 1.25; margin: 1.1rem 0 1rem; border-radius: 10px; padding: .75rem 1rem; }
.card h1, .narrow h1 { font-size: 1.3rem; }
/* Подзаголовок — синяя полоска слева */
h2 { font-size: 1.12rem; font-weight: 600; color: var(--main); margin: 0 0 .65rem;
  display: flex; align-items: center; gap: .5rem; }
h2::before { content: ""; flex: none; width: 4px; height: 1.05em; border-radius: 2px; background: var(--main); }
h3 { font-size: 1rem; font-weight: 600; margin: 1.1rem 0 .4rem; }
b, strong { font-weight: 600; }
code { background: var(--tag); padding: .05em .35em; border-radius: 4px; font-size: .88em; word-break: break-all; }
pre { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; overflow-x: auto; }

.wrap { max-width: 940px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); position: relative; }
.top-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding-top: .75rem; padding-bottom: .6rem; }
.brand { font-weight: 800; color: var(--main); text-decoration: none; margin-right: auto; letter-spacing: -.01em; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem .95rem; align-items: center; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a.on { color: var(--main); font-weight: 600; }
.nav a:hover { color: var(--text); }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem;
  border-radius: 999px; color: var(--muted); border: 1px solid var(--line); background: var(--soft); text-decoration: none; }
.bell:hover, .bell.on { color: var(--main); border-color: var(--g2); }
.bell .ic { display: block; width: 1.2em; height: 1.2em; margin: 0; vertical-align: 0; transform: translateY(.02em); }
.bell-n { position: absolute; top: -.35rem; right: -.35rem; min-width: 1.15rem; height: 1.15rem; padding: 0 .28rem; box-sizing: border-box;
  border-radius: 999px; background: var(--bad-edge); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.15rem; text-align: center; }
.rows li.unread { background: var(--soft); border-radius: 8px; }
.rows li.unread > a { padding-left: 1.1rem; padding-right: 1rem; }
.nbar { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 1rem; }
.notes-list .r-text .small { white-space: pre-line; }
.theme-btn { background: var(--soft); color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: .2rem .65rem; font-size: .85rem; }
.theme-btn:hover { color: var(--text); background: var(--soft); }
.theme-btn .tt { margin-left: .4rem; opacity: .8; }
.theme-menu { position: relative; }
.theme-menu > summary { list-style: none; cursor: pointer; }
.theme-menu > summary::-webkit-details-marker { display: none; }
.theme-pop { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 30; min-width: 11rem; display: flex; flex-direction: column;
  gap: .1rem; padding: .3rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.theme-pop button { text-align: left; background: none; border: 0; color: var(--text); padding: .5rem .75rem; border-radius: 8px; font-weight: 500; }
.theme-pop button:hover { background: var(--soft); color: var(--text); filter: none; }
.theme-pop button.on, .theme-pop button.on:hover { background: var(--tag); color: var(--main); font-weight: 700; }
/* Панель — как «panel» в методичке: мягкий синий фон и тонкая рамка */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem;
  margin: 0 0 1rem; box-shadow: var(--shadow); }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
main > h1:has(~ .narrow), main > h1:has(+ .narrow) { max-width: 560px; margin-left: auto; margin-right: auto; }
.brand { display: inline-flex; align-items: center; gap: .55rem; }
.logo { width: 34px; height: 34px; flex: none; }
.muted { color: var(--muted); }
.mailrules { background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--main, #7cb7ff); border-radius: 10px;
  padding: .7rem .9rem; margin: 0 0 1rem; }
.mailrules > summary { margin: 0; font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: .4rem; cursor: pointer; list-style: none; }
.mailrules > summary::-webkit-details-marker { display: none; }
.mailrules > summary::after { content: "+"; margin-left: auto; flex: none; width: 1.5rem; height: 1.5rem; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 50%; background: var(--line); }
.mailrules[open] > summary::after { content: "–"; background: var(--main); color: var(--on-main); }
.mailrules[open] > summary { margin-bottom: .4rem; }
details.mailrules { margin: 1rem 0 0; }
.mailrules ul { margin: 0; padding-left: 1.2rem; }
.mailrules li { margin: .25rem 0; overflow-wrap: anywhere; }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.bad { color: var(--bad-text); }

/* Сообщения: «Совет» (синяя полоска) и «Ловушка» (красная полоска) */
.flash { padding: .65rem .85rem; border-radius: 0 8px 8px 0; margin: 0 0 1rem; }
.flash.toast { position: sticky; top: .6rem; z-index: 40; box-shadow: var(--shadow); }   /* липнет только всплывающее сообщение после действия (одно на странице); остальные плашки — в общем потоке, друг на друга не налезают */
.flash.ok { background: var(--ok); color: var(--ok-text); border-left: 4px solid var(--ok-edge); }
.flash.bad { background: var(--bad); color: var(--bad-text); border-left: 4px solid var(--bad-edge); }

/* Плашки — как pill в методичке */
.tag { display: inline-block; white-space: nowrap; background: var(--tag); color: var(--main); border-radius: 999px;
  padding: .3em .85em; font-size: .78rem; line-height: 1.35; font-weight: 600; letter-spacing: .01em; }
.tag.bad { background: var(--bad); color: var(--bad-text); }
.tag.ok { background: var(--done); color: var(--done-text); }
.tag.warn { background: var(--tag); color: var(--muted); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
.list li:last-child { border-bottom: 0; }
.tiles { list-style: none; padding: 0; margin: 0 0 1rem; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.tiles > li > a { display: flex; flex-direction: column; gap: .2rem; background: var(--soft); border: 1px solid var(--line);
  border-radius: 10px; padding: .8rem .9rem; text-decoration: none; color: var(--text); height: 100%;
  transition: border-color .15s, transform .15s; }
.tiles > li > a b { color: var(--main); }
.tiles > li > a:hover { border-color: var(--g2); transform: translateY(-1px); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl td, .tbl th { text-align: left; padding: .5rem .45rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl th { font-size: .82rem; color: var(--main); font-weight: 600; background: var(--soft); }
.tbl tr.muted td { color: var(--muted); }
.actions { white-space: nowrap; text-align: right; }

.form { display: flex; flex-direction: column; gap: .8rem; }
.form > p { margin: 0; }
.form + .form { margin-top: 1.5rem; }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.form.grid2 > button, .form.grid2 > input[type=hidden], .form.grid2 > fieldset, .form.grid2 > label.check { grid-column: 1 / -1; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .45rem 0; }
.row input[name=answer] { flex: 1 1 160px; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .95rem; }
label.check { flex-direction: row; align-items: flex-start; gap: .5rem; }
label.check input { margin-top: .2rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; display: flex; flex-direction: column; gap: .3rem; }
legend { color: var(--main); font-size: .9rem; font-weight: 600; padding: 0 .3rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: .5rem .65rem; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--g2); outline-offset: 0; border-color: var(--g2); }
/* галочки и переключатели в стиле сайта (вместо системных синих) */
input[type=checkbox], input[type=radio] { -webkit-appearance: none; appearance: none; width: 1.2rem; height: 1.2rem; flex: none; margin: 0; padding: 0;
  display: inline-block; position: relative; vertical-align: middle; cursor: pointer; background: var(--card);
  border: 1.5px solid var(--g2); border-radius: 6px; transition: background .12s, border-color .12s, box-shadow .12s; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--main); }
input[type=checkbox]::after { content: ""; position: absolute; left: 50%; top: 50%; width: .7rem; height: .7rem; background: var(--on-main, #fff); transform: translate(-50%, -50%) scale(0); transition: transform .12s;
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 20%, 86% 6%, 38% 72%); }
input[type=radio]::after { content: ""; position: absolute; left: 50%; top: 50%; width: .55rem; height: .55rem; border-radius: 50%; background: var(--on-main, #fff); transform: translate(-50%, -50%) scale(0); transition: transform .12s; }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--main); border-color: var(--main); }
input[type=checkbox]:checked::after, input[type=radio]:checked::after { transform: translate(-50%, -50%) scale(1); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--g2); outline-offset: 2px; }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: default; }
input[type=file] { padding: .35rem; }

button, .btn { font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px; padding: .55rem 1.05rem;
  background: linear-gradient(110deg, var(--g1), var(--g2)); color: #fff; text-decoration: none; display: inline-block;
  line-height: 1.3; }
button:hover, .btn:hover { color: #fff; filter: brightness(1.07); }
button:disabled { opacity: .5; cursor: default; filter: none; }
button.secondary, .btn.secondary { background: var(--soft); color: var(--main); border: 1px solid var(--line); }
button.secondary:hover, .btn.secondary:hover { color: var(--main-hover); border-color: var(--g2); filter: none; }
button.danger { background: var(--bad); color: var(--bad-text); border: 1px solid var(--bad-edge); }
button.danger:hover { color: var(--bad-text); }
form.mailtest { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
form.mailtest p { margin: 0 0 .6rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; color: var(--main); padding: 0; font-weight: 400; border: 0; }
button.link:hover { text-decoration: underline; filter: none; color: var(--main-hover); }
/* Опасные действия-ссылки (отменить, отключить, удалить) не кричат красным: цвет появляется при наведении */
button.link.danger, a.danger, summary.danger { color: var(--muted); }
button.link.danger:hover, a.danger:hover, summary.danger:hover { color: var(--bad-text); }
button.link.danger { background: none; border: 0; }
form.inline { display: inline; }
details { margin-top: .8rem; }
summary { cursor: pointer; color: var(--main); font-weight: 600; }

.tabs { display: flex; gap: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { text-decoration: none; color: var(--muted); padding-bottom: .35rem; }
.tabs a.on { color: var(--main); border-bottom: 2px solid var(--main); font-weight: 600; }

/* Картинки заданий всегда на белом: они свёрстаны для бумаги */
.task-img { max-width: 100%; height: auto; background: var(--img-bg); border-radius: 8px; display: block;
  margin: .6rem 0; border: 1px solid var(--line-soft); padding: 4px; }
.media { max-width: 100%; }
.text { white-space: pre-wrap; margin: .3rem 0; }
.part { margin: .6rem 0; }
.file { word-break: break-word; display: inline-block; padding: .25rem .7rem; border-radius: 999px; background: var(--tag);
  color: var(--main); text-decoration: none; font-weight: 600; font-size: .92rem; border: 1px solid transparent; }
.file:hover { border-color: var(--g2); background: var(--soft); }

.grid-nums { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.num { width: 2.6rem; height: 2.6rem; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  text-decoration: none; color: var(--main); background: var(--card); border: 1.5px solid var(--g2); font-weight: 600; }
.num.s1 { background: linear-gradient(110deg, var(--g1), var(--g2)); color: #fff; border-color: transparent; }
.num.s0 { background: var(--bad); color: var(--bad-text); border-color: var(--bad-edge); }
.state { margin-left: auto; flex: none; white-space: nowrap; display: inline-block; padding: .15em .6em; line-height: 1.3; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--tag); color: var(--muted); }
.list li.st-row, .list li:has(> .state) { display: flex; align-items: center; gap: .75rem; }
.st-row .st-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.state.ok { background: var(--done); color: var(--done-text); }
.state.no { background: var(--bad); color: var(--bad-text); }

@media (max-width: 600px) {
  h1 { font-size: 1.25rem; }
  .form.grid2 { grid-template-columns: 1fr; }
  .tbl, .tbl tbody { display: block; width: 100%; max-width: 100%; }
  .tbl td { display: block; border: 0; padding: .15rem 0; min-width: 0; max-width: 100%; }
  .tbl tr { display: block; border-bottom: 1px solid var(--line-soft); padding: .45rem 0; }
  .tbl tr:has(> th) { display: none; }
  .tbl td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .85rem; }
  .tbl td.sname { font-size: 1.05rem; padding-bottom: .25rem; }
  .actions { text-align: left; }
  .tbl .acts { justify-content: flex-start; }
}
.actions form.inline + form.inline, li form.inline { margin-left: .8rem; }
.form > button { align-self: flex-start; }

/* ---- Задания текстом (HTML из materials, формулы — MathML) ---- */
.t-html { font-size: 1.02rem; line-height: 1.6; margin: .3rem 0 .6rem; overflow-wrap: anywhere; }
.t-html p { margin: .5rem 0; }
.t-html math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math; font-size: 1.08em; }
/* overflow на самом <math> в Safari/iOS (WebKit) прячет формулу целиком — прокрутку даёт контейнер */
.t-html math[display="block"] { margin: .7rem 0; }
.t-html:has(math[display="block"]) { overflow-x: auto; }
.t-html .t-eq { margin: .7rem 0; text-align: center; overflow-x: auto; }
.t-html .t-ft { font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif; font-size: 1.1em; }
.t-html table { border-collapse: collapse; margin: .6rem 0; max-width: 100%; display: block; overflow-x: auto; }
.t-html table td, .t-html table th { border: 1px solid var(--line); padding: .3rem .55rem; text-align: center; }
.t-html table.t-grid { display: table; width: 100%; }
.t-html table.t-grid > tbody > tr > td, .t-html table.t-grid > tr > td { border: 0; text-align: left; padding: .2rem .6rem .2rem 0;
  vertical-align: top; }
.t-html img { display: block; width: auto; max-width: 100%; max-height: 26rem; height: auto; object-fit: contain; margin: .6rem auto; background: var(--img-bg); border-radius: 6px; padding: 4px; }
.t-html figure { margin: .6rem 0; text-align: center; }
.t-html figcaption { font-size: .85rem; color: var(--muted); }
/* код: фон и цвета подсветки берутся из переменных темы (--code-*) */
.t-html pre { background: var(--code-bg); color: var(--code-fg); border: 1px solid var(--code-line); border-radius: 8px; padding: .6rem .8rem;
  overflow-x: auto; font-size: .9rem; }
.c-d73948{color:var(--sx-red)}.c-b60157{color:var(--sx-pink)}.c-4b69c6{color:var(--sx-blue)}.c-198810{color:var(--sx-green)}
.c-74747c{color:var(--sx-gray)}.c-8b41b1{color:var(--sx-purple)}.c-301414{color:var(--sx-brown)}.c-1d6c76{color:var(--sx-teal)}
.t-html code { background: none; padding: 0; word-break: normal; }
.t-html :not(pre) > code { background: var(--tag); padding: .05em .35em; border-radius: 4px; }
.t-html ul, .t-html ol { padding-left: 1.4rem; }
.t-common { background: var(--soft); border-radius: 8px; padding: .5rem .8rem; margin-bottom: .6rem; }
.t-solution { background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--g2);
  border-radius: 0 8px 8px 0; padding: .4rem .9rem; }
.t-label { font-weight: 600; color: var(--main); margin: .3rem 0 !important; }
.t-html .w5{max-width:5%}.t-html .w10{max-width:10%}.t-html .w15{max-width:15%}.t-html .w20{max-width:20%}.t-html .w25{max-width:25%}.t-html .w30{max-width:30%}
.t-html .w35{max-width:35%}.t-html .w40{max-width:40%}.t-html .w45{max-width:45%}.t-html .w50{max-width:50%}.t-html .w55{max-width:55%}.t-html .w60{max-width:60%}.t-html .w65{max-width:65%}
.t-html .w70{max-width:70%}.t-html .w75{max-width:75%}.t-html .w80{max-width:80%}.t-html .w85{max-width:85%}.t-html .w90{max-width:90%}.t-html .w95{max-width:95%}.t-html .w100{max-width:100%}


/* Списки-ссылки: вся строка нажимается, без подчёркивания */
.rows { list-style: none; margin: 0 -.35rem; padding: 0; }
.rows li + li { border-top: 1px solid var(--line-soft); }
main ul.rows li > a { display: flex; align-items: center; margin: 0; gap: 1rem; padding: 1.25rem .6rem; border-radius: 8px;
  text-decoration: none; color: var(--text); transition: background .12s; }
main ul.rows li > a:hover { background: var(--soft); color: var(--text); }
main ul.rows li > a:hover .r-go { color: var(--main); transform: translateX(2px); }
.rows .r-text { display: flex; flex-direction: column; gap: .4rem; min-width: 0; flex: 1; }
.rows .r-text b { font-weight: 600; font-size: 1.05rem; line-height: 1.3; }
.rows .r-text .small { line-height: 1.4; }
.rows .r-go { flex: none; color: var(--muted); font-size: 1.4rem; line-height: 1; transition: transform .12s, color .12s; }

.spoiler { margin: .6rem 0 0; }
.spoiler p { margin: .4rem 0 0; }

/* Кнопки-навигация сверху страницы («назад», «показать все») */
.crumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }
.pill { display: inline-flex; align-items: center; padding: .38rem .85rem; border-radius: 999px; font-size: .92rem;
  font-weight: 600; text-decoration: none; background: var(--card); color: var(--main); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: border-color .15s, background .15s; }
.pill:hover { border-color: var(--g2); background: var(--soft); color: var(--main-hover); }
.pill.alt { background: var(--tag); border-color: transparent; }
.pill.alt:hover { border-color: var(--g2); }
.crumbs + h1 { margin-top: .8rem; }

/* Логотип в шапке: цвета из темы (inline-стили запрещены CSP, поэтому всё через классы) */
.logo .lg1 { stop-color: var(--g2); }
.logo .lg2 { stop-color: var(--g1); }
.logo .lt { fill: url(#lg); }
.logo .le { fill: none; stroke: var(--main); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.logo .lx { fill: var(--text); font: 800 9.5px "Inter", serif; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
select { max-width: 100%; }

/* Расписание: календарь по месяцам */
.pill.static { cursor: default; background: var(--soft); }
.pill.static:hover { border-color: var(--line); background: var(--soft); color: var(--main); }
.cal-card { padding: .6rem; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: .8rem; color: var(--main); font-weight: 600; padding: .35rem; text-align: left; }
.cal td { vertical-align: top; height: 92px; padding: .3rem; border: 1px solid var(--line-soft); }
.cal td.out { background: var(--soft); opacity: .6; }
.cal td.today { background: var(--tag); border-color: var(--g2); }
.cal .dnum { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .2rem; }
.cal .dwd { display: none; }
.cal .chip { display: block; font-size: .74rem; line-height: 1.25; margin: 0 0 .2rem; padding: .15rem .35rem;
  border-radius: 6px; background: var(--tag); color: var(--main); text-decoration: none; overflow: hidden; }
.cal .chip.done, .legend .chip.done { background: var(--done); color: var(--done-text); box-shadow: inset 3px 0 0 var(--done-edge); }
.cal .chip.trial, .legend .chip.trial { outline: 1px dashed var(--main); outline-offset: -1px; }
.cal .chip.trial.done, .legend .chip.trial.done { outline-color: var(--done-edge); }
.cal a.chip:hover { filter: brightness(.96); }
@media (max-width: 700px) {
  .cal thead { display: none; }
  .cal, .cal tbody, .cal tr { display: block; }
  .cal td { display: none; height: auto; border: 0; border-bottom: 1px solid var(--line-soft); padding: .55rem .2rem; }
  .cal td.has, .cal td.today { display: block; }
  .cal td.out { opacity: 1; background: none; }
  .cal .dnum { font-size: .9rem; color: var(--text); }
  .cal .dwd { display: inline; color: var(--muted); }
  .cal .chip { font-size: .9rem; padding: .3rem .5rem; }
}

/* Меню: на компьютере — строка ссылок, на телефоне — кнопка «Меню» и крупный список (без JavaScript) */
input.navtoggle, .burger { display: none; }
.nav .inline button.link { color: var(--muted); font-weight: 400; }
.nav .inline button.link:hover { color: var(--text); text-decoration: none; }
@media (max-width: 700px) {
  .top-row { flex-wrap: wrap; gap: .4rem; padding-top: .6rem; padding-bottom: .6rem; }
  .brand { margin-right: 0; }
  .theme-menu { margin-left: auto; }
  .theme-btn { padding: .32rem .7rem; font-size: 1rem; font-weight: 600; color: var(--text); background: var(--soft); line-height: 1.55; }
  .theme-btn .tt { display: none; }
  .bell { order: 2; }
  .burger { display: inline-flex; flex-direction: row; align-items: center; white-space: nowrap; gap: .55rem; order: 3; cursor: pointer; margin-left: 0;
    padding: .32rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: var(--text); font-weight: 600; }
  .burger span { display: block; width: 16px; height: 2px; background: var(--text); border-radius: 2px; box-shadow: 0 5px 0 var(--text), 0 -5px 0 var(--text); }
  .burger span + span, .burger span + span + span { display: none; }
  .burger b { font-weight: 600; }
  .navtoggle:focus-visible ~ .top-row .burger { outline: 2px solid var(--g2); }
  .nav { display: none; order: 4; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; margin-top: .4rem;
    border-top: 1px solid var(--line-soft); }
  .navtoggle:checked ~ .top-row .nav { display: flex; }
  .nav .inline { display: block; padding: 0; border-bottom: 1px solid var(--line-soft); }
  .nav a { display: block; padding: .8rem .3rem;  border-bottom: 1px solid var(--line-soft); font-size: 1.05rem; }
  .nav a.on { color: var(--main); font-weight: 700; background: var(--soft); border-radius: 8px; padding-left: .7rem; }
  .nav .inline button.link { width: 100%; text-align: left; padding: .8rem .3rem; font-size: 1.05rem; }
}

#me .form { margin-bottom: 20px; }
#me .form:last-child { margin-bottom: 0; }

/* Вопросы и ответы: ответ открывается по нажатию на вопрос */
.faq { padding-top: .4rem; padding-bottom: .4rem; }
.faq h2 { margin-bottom: .2rem; }
.faq details { margin: 0; border-top: 1px solid var(--line-soft); }
.faq details:first-of-type { border-top: 0; }
.faq summary, .fold > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .85rem 0; color: var(--text); font-weight: 600; }
.faq summary::-webkit-details-marker, .fold > summary::-webkit-details-marker { display: none; }
.faq summary::after, .fold > summary::after { content: "+"; flex: none; width: 1.7rem; height: 1.7rem; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 50%; background: var(--tag); color: var(--main); font-size: 1.1rem; }
.faq details[open] summary::after, .fold[open] > summary::after { content: "–"; background: var(--main); color: var(--on-main); }
.faq summary:hover { color: var(--main); }
.faq .ans { padding: 0 0 1rem; color: var(--text); }
.faq .ans p, .faq .ans ol, .faq .ans ul { margin: .4rem 0 0; }
.faq .ans ol, .faq .ans ul { padding-left: 1.3rem; }
.faq .ans li { margin: .25rem 0; }

.grow { flex: 1 1 220px; }
.rv-admin { margin-top: .8rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.page-msg { margin-top: 2rem; }

/* Ссылки в таблицах уроков выглядят как кнопки-метки, а не как подчёркнутый текст */
.tbl a { text-decoration: none; font-weight: 600; }
.tbl td.nowrap > a { display: inline-block; padding: .28rem .7rem; border-radius: 999px; background: var(--tag);
  color: var(--main); border: 1px solid transparent; transition: border-color .15s, background .15s; }
.tbl td.nowrap > a:hover { border-color: var(--g2); background: var(--soft); color: var(--main-hover); }
.tbl a:hover { color: var(--main-hover); }
.tbl .actions > a + form.inline, .tbl .actions > form.inline + a { margin-left: .9rem; }
.tbl .actions .link, .tbl .actions a { font-size: .95rem; }

/* Сворачиваемая секция: заголовок — кнопка */
.fold > summary { padding: 0; cursor: pointer; }
.fold > summary h2 { margin: 0; }
.fold[open] > summary { margin-bottom: .65rem; }

/* Заголовок секции под рядом кнопок — с воздухом */
.crumbs { margin-bottom: .4rem; }
h2.sec { margin: 2rem 0 1rem; }
.crumbs + .crumbs, .crumbs + .cal-card { margin-top: 1rem; }
section.card, details.card { scroll-margin-top: 1rem; }

/* Количество заданий в банке: метки вместо строки через запятую */
.counts { margin: .3rem 0 .6rem; }
.counts p { margin: 0 0 .4rem; }

/* Таблицы уроков: одинаковые колонки (дата, описание, действия) в каждом блоке */
@media (min-width: 601px) {
  .tbl.cols { table-layout: fixed; }
  .tbl.cols td:first-child { width: 9.5rem; }
  .tbl.cols td:last-child { width: 14rem; text-align: right; }
}

/* Подпись под календарём: как выглядит каждый вид занятия */
.legend { list-style: none; margin: .2rem 0 1.2rem; padding: 0; display: grid; gap: .4rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: .6rem; }
.legend .chip, .legend .swatch { flex: none; min-width: 3.6rem; text-align: center; font-size: .74rem; font-weight: 600; padding: .15rem .35rem;
  border-radius: 6px; background: var(--tag); color: var(--main); }
.legend .swatch { background: var(--tag); border: 1px solid var(--g2); }

/* Блоки сводки (оплаты, конспекты, ДЗ): одинаковые колонки — ученик, описание, действия */
.tbl.sumrows td:first-child { font-weight: 600; }
.tbl .acts { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .4rem 1.1rem; }
.tbl .acts .link, .tbl .acts a { font-size: .95rem; font-weight: 600; }
@media (min-width: 601px) {
  .tbl.sumrows { table-layout: fixed; }
  .tbl.sumrows td:first-child { width: 11rem; }
  .tbl.sumrows td:last-child { width: 17rem; }
}
.prewrap { white-space: pre-wrap; }

/* Значки в стиле сайта: линии цвета текста */
.ic { width: 1.05em; height: 1.05em; flex: none; vertical-align: -.17em; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; margin-right: .3em; }
.state .ic, .tag .ic { width: .95em; height: .95em; margin-right: .25em; vertical-align: -.14em; }

/* Вложенные раскрывашки без стандартной стрелки: «+ Добавить…» в одну линию с текстом */
details.sub { margin: .5rem 0 0; }
details.sub > summary { list-style: none; display: inline-flex; align-items: center; gap: .4rem; padding: .2rem 0; }
details.sub > summary::-webkit-details-marker { display: none; }
details.sub > summary::before { content: "+"; display: inline-flex; align-items: center; justify-content: center; width: 1.3rem; height: 1.3rem;
  border-radius: 50%; background: var(--soft); border: 1px solid var(--line); font-size: 1rem; line-height: 1; }
details.sub[open] > summary::before { content: "–"; }
details.sub > form { margin-top: .6rem; }

/* Поле со ссылкой: один клик выделяет всё, остаётся скопировать */
.copy-field { width: 100%; user-select: all; -webkit-user-select: all; font-family: ui-monospace, monospace; font-size: .9rem; }

/* Быстрый переход между заданиями */
.pager { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; align-items: center; }
.pager a, .pager b { min-width: 2.1rem; padding: .3rem .5rem; text-align: center; border-radius: .6rem; border: 1px solid var(--line); text-decoration: none; }
.pager b { background: var(--main); border-color: var(--main); color: var(--on-main); }

/* Таблица «что присылать»: сайт и почта отдельно */
.kinds { width: 100%; border-collapse: collapse; margin: .2rem 0 .9rem; }
.kinds th, .kinds td { padding: .45rem .4rem; border-bottom: 1px solid var(--line-soft); text-align: center; }
.kinds th:first-child, .kinds td:first-child { text-align: left; }
.kinds th { font-size: .85rem; color: var(--muted); font-weight: 600; }

.code { font-family: ui-monospace, Consolas, monospace; font-size: 1.5rem; letter-spacing: .12em; }
#board canvas { background: #fff; border: 1px solid var(--line, #ccc); border-radius: 8px; display: block; }
.btools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .6rem; }
.bwrap { position: relative; }
.btools.left { position: absolute; left: 8px; top: 8px; flex-direction: column; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 12px; padding: 6px; z-index: 5; box-shadow: 0 2px 8px rgba(0,0,0,.12); margin: 0; overflow-y: auto; }
.btools button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: 8px; background: transparent; color: inherit; border: 0; cursor: pointer; }
.btools button:hover { background: var(--tag, #eee); }
.btools button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btools button.on { background: var(--accent, #2563eb); color: #fff; outline: 0; }
.btools .sep { display: block; height: 1px; background: var(--line, #d1d5db); margin: 3px 4px; }
.bpanel { position: absolute; display: flex; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); box-shadow: 0 2px 8px rgba(0,0,0,.12); }.bpanel .sw { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.bpanel .sw button { width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 2px solid var(--line, #d1d5db); padding: 0; cursor: pointer; }
.bpanel .sw button.on { border-color: var(--accent, #2563eb); box-shadow: 0 0 0 2px var(--accent, #2563eb); }
.bpanel .wid { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; }
.bpanel .wid input { width: 120px; }
.bpanel #b-fill { padding: 0; border: 1px solid var(--line, #d1d5db); background: transparent; border-radius: 8px; color: inherit; }
.bpanel #b-fill svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bpanel #b-fill.on { background: var(--accent, #2563eb); color: #fff; }
.bzoom { position: absolute; right: 8px; bottom: 12px; display: flex; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 12px; z-index: 5; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.bzoom button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 6px; }
.bzoom button:hover { background: var(--tag, #eee); }
.bfollow { position: absolute; right: 8px; top: 8px; z-index: 6; }.btext { position: absolute; z-index: 7; min-width: 120px; background: rgba(255,255,255,.9); border: 1px dashed #2563eb; font-family: system-ui, sans-serif; resize: both; padding: 2px 4px; line-height: 1.25; }
#board canvas { height: 76vh; min-height: 420px; }
#board canvas { max-width: none; width: 100%; }
.btools.left { display: grid; grid-template-columns: repeat(2, 38px); gap: 2px; flex-wrap: nowrap; }
.btools.left .sep { grid-column: 1 / -1; }
.btools.left #b-follow { display: none; }
.bpanel { left: 108px; }.bpanel .wid { flex-direction: row; white-space: nowrap; }
.bpanel .wid output { min-width: 1.6em; }
[hidden] { display: none !important; }

/* ---- доска: страницы, рамки, группы, подсказки, диалоги, нижняя панель ---- */
#board canvas { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.btools button, .bfly button, .bpages button { color: inherit; }
.bfly { position: absolute; z-index: 8; display: flex; gap: 2px; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 12px; padding: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.bfly button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: 8px; background: transparent; border: 0; cursor: pointer; }
.bfly button:hover { background: var(--tag, #eee); }
.bfly button.on { background: var(--accent, #2563eb); color: #fff; }
.bfly button svg, .bgrip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btools .grp { position: relative; }
.bgrip { grid-column: 1 / -1; display: flex; gap: 4px; justify-content: center; align-items: center; height: 14px; cursor: grab; touch-action: none; border-radius: 6px; }
.bgrip:hover { background: var(--tag, #eee); }
.bgrip i { width: 4px; height: 4px; border-radius: 50%; background: #9ca3af; display: block; }
.bgrip.h { grid-column: auto; flex-direction: column; width: 14px; height: auto; align-self: stretch; }
.btip { position: absolute; z-index: 20; background: #111827; color: #fff; font-size: .8rem; line-height: 1.25; padding: 5px 9px; border-radius: 7px; max-width: 260px; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.bpages { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 2px; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 12px; padding: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.pgtabs { display: flex; gap: 2px; overflow-x: auto; max-width: 100%; min-width: 0; scrollbar-width: none; }
.pgtabs button { flex: none; }
.pgtabs::-webkit-scrollbar { display: none; }
.bpages button { min-width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; padding: 0 9px; white-space: nowrap; }
.bpages button:hover { background: var(--tag, #eee); }
.bdlg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 12; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 14px; padding: 14px 16px; width: min(420px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.bdlg.wide { width: min(640px, calc(100% - 24px)); }
.bdlg h3 { margin: 0 0 .5rem; }
.bdlg textarea { width: 100%; box-sizing: border-box; font-size: 1.05rem; }
.bdlg textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; }
.bdlg ul { margin: .4rem 0 0; padding: 0; list-style: none; max-height: 240px; overflow-y: auto; }
.bdlg li { display: flex; gap: .3rem; margin-bottom: .25rem; }
.bdlg .row { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.bdlg .wid { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; font-size: .9rem; }
#fx-pv { width: 100%; height: auto; background: #fff; border: 1px solid var(--line, #d1d5db); border-radius: 8px; margin-top: .4rem; display: block; }
.fxkeys { display: flex; flex-wrap: wrap; margin: .4rem 0; }
.fxkeys button { cursor: pointer; }
.tpf { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.tpf label { display: flex; flex-direction: column; font-size: .85rem; gap: 2px; }
.tpf label.chk { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: .4rem; }
#board:fullscreen, #board:-webkit-full-screen { background: #fff; width: 100vw; height: 100vh; }
#board:fullscreen canvas, #board:-webkit-full-screen canvas { height: 100vh; border: 0; border-radius: 0; }
.bzoom button:disabled { opacity: .4; cursor: default; }
#board.pfs { position: fixed; inset: 0; z-index: 1000; background: #fff; }
#board.pfs canvas { height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
.btools.left { max-height: calc(100% - 16px); }
.btools, .bfly, .bpanel, .bzoom, .bpages, .bfollow, .btip { -webkit-user-select: none; user-select: none; }

/* Доска: карточки учеников на странице «Доска» */
.bcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; margin-top: .8rem; }
.bcard { display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; border-radius: 14px; border: 1px solid var(--line, #d1d5db); background: var(--card, #fff); color: inherit; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: transform .12s, box-shadow .12s, border-color .12s; }
.bcard:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(37,99,235,.18); border-color: var(--accent, #2563eb); }
.bcard-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.2rem; color: #fff; background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.bcard-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bcard-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard-go { font-size: .85rem; font-weight: 600; color: var(--accent, #2563eb); white-space: nowrap; }

/* ---- подвал: два блока ---- */
.foot2 { margin-top: 2rem; border-top: 1px solid var(--line, #d1d5db); background: var(--card, #fff); }
.foot2-in { display: flex; flex-wrap: wrap; gap: 1.2rem 3rem; justify-content: space-between; padding-top: 1.2rem; padding-bottom: 1.6rem; color: var(--muted); font-size: .88rem; }
.foot2-docs { display: flex; flex-direction: column; gap: .35rem; min-width: 200px; }
.foot2-h { color: inherit; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .2rem; display: block; }
.foot2-docs a { display: inline-flex; align-items: center; gap: .5rem; color: var(--text, inherit); text-decoration: none; padding: .15rem 0; }
.foot2-docs a:hover { color: var(--accent, #2563eb); }
.foot2-docs svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .75; flex: none; }
.foot2-info { display: flex; flex-direction: column; gap: .7rem; max-width: 520px; }

/* ---- доска: выпадающие метки, панель цвета, нижняя панель, окна ---- */
.btools .grp::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 9px; height: 9px; background: currentColor; opacity: .5; border: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M8.2 2.6 L8.2 8.2 L2.6 8.2 Z' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M8.2 2.6 L8.2 8.2 L2.6 8.2 Z' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.btools .grp.on::after { opacity: .85; }
.bpanel { }
.bpanel .pill { border-radius: 50%; border: 2px solid var(--line, #d1d5db); background: var(--card, #fff); padding: 0; display: grid; place-items: center; cursor: pointer; }
.bpanel .pill:hover { border-color: var(--accent, #2563eb); }
.bpanel .pill i { display: block; border-radius: 50%; background: #111; }
.bpanel .pill .wdot { width: 6px; height: 6px; background: #111; }
.bpanel .pill .cdot { width: 24px; height: 24px; border: 1px solid rgba(0,0,0,.18); }
.bpop { position: absolute; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); box-shadow: 0 8px 26px rgba(0,0,0,.25); }
.bpop-w { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.bpop-w input { flex: 1; }
.bpop-w output { min-width: 1.8em; text-align: right; font-size: .85rem; }.pal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; justify-items: center; }
.pal button { width: 40px; height: 40px; border-radius: 50%; background: var(--c); border: 2px solid rgba(0,0,0,.18); padding: 0; cursor: pointer; position: relative; }
.pal button:hover { transform: scale(1.08); }
.pal button.on { box-shadow: 0 0 0 2px var(--card, #fff), 0 0 0 4px var(--accent, #2563eb); }
.pal button.on::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #111; font-weight: 700; text-shadow: 0 0 3px #fff; }.bzoom { padding: 5px; gap: 3px; flex-wrap: wrap; justify-content: flex-end; align-items: center; max-width: calc(100% - 16px); }
.bzoom button { min-width: 34px; height: 34px; border-radius: 10px; }
.bzoom .dk { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; background: transparent; }
.bzoom .dk svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bzoom .dk.on { background: var(--accent, #2563eb); color: #fff; }
.bzoom .dk.danger { color: #b91c1c; }
.bzoom .dk.danger:hover { background: #fee2e2; }
#b-full { background: var(--tag, #eee); border-radius: 50%; width: 36px; height: 36px; }
#b-full:hover { background: var(--accent, #2563eb); color: #fff; }
.bzoom .sep.v { width: 1px; height: 24px; background: var(--line, #d1d5db); margin: 0 3px; }
#b-scan .i-on, #b-scan .i-off { display: contents; }
#b-scan:not(.on) .i-on { display: none; }
#b-scan.on .i-off { display: none; }
.bx { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--tag, #eee); color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 3px; }
.bx:hover { background: #fee2e2; color: #b91c1c; }
.bdlg h3 { padding-right: 40px; }
.fxtabs { display: flex; gap: 4px; flex-wrap: wrap; margin: .5rem 0 .2rem; }
.fxtabs button { border: 0; background: transparent; color: inherit; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: .9rem; }
.fxtabs button:not(.on):hover { background: var(--tag, #eee); }
.bnote { position: absolute; right: 8px; top: 8px; z-index: 6; background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; border-radius: 10px; padding: 5px 10px; font-size: .8rem; }
.tchip { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 12px; padding: 6px 10px; box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: calc(100% - 340px); font-size: .88rem; }
.tchip button { border: 1px solid var(--line, #d1d5db); background: transparent; color: inherit; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: .85rem; }
.tc-files:not([hidden]) { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; min-width: 0; }
.tc-files a { overflow-wrap: anywhere; }
.tchip button:hover { background: var(--tag, #eee); }
.bk-top { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin: .3rem 0 .6rem; }
.bk-top .chk { display: flex; gap: .4rem; align-items: center; font-size: .9rem; }
.bk-rows { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line, #d1d5db); border-radius: 10px; }
.bk-row { display: grid; grid-template-columns: 34px 34px 34px 1fr auto; gap: 6px; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--line-soft, #eee); }
.bk-row:last-child { border-bottom: 0; }
.bk-row button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line, #d1d5db); background: transparent; color: inherit; font-size: 1.1rem; padding: 0; cursor: pointer; }
.bk-row button:hover { background: var(--tag, #eee); }
.bk-n { text-align: center; background: var(--tag, #f3f4f6); border-radius: 8px; padding: 4px 0; font-weight: 600; }
.bk-name { padding-left: 8px; }
.bk-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .7rem; }
.bk-find { margin-top: .6rem; font-size: .88rem; }
.bk-find textarea { margin: .4rem 0; width: 100%; box-sizing: border-box; }
#sol-img { max-width: 100%; border: 1px solid var(--line, #d1d5db); border-radius: 8px; background: #fff; }
.bpages { max-width: calc(100% - 360px); }
/* телефон: полоска страниц не по центру, а правее колонки инструментов, иначе ширина уходит в минус и вкладки страниц пропадают */
@media (max-width: 700px) { .bpages { left: 100px; transform: none; max-width: calc(100% - 108px); } }
.bk-top label.chk { display: flex; flex-direction: row; align-items: center; gap: .4rem; }
.bk-top label.chk input { margin: 0; }
#fx-pv { max-height: 150px; object-fit: contain; }

/* мягкое выделение выбранных кнопок доски (вместо сплошной синей заливки) */
.btools button.on, .bfly button.on, .bzoom .dk.on, .bpanel #b-fill.on { background: rgba(37,99,235,.13); color: #1d4ed8; box-shadow: inset 0 0 0 1.5px rgba(37,99,235,.35); }
.btools button.on:hover, .bfly button.on:hover { background: rgba(37,99,235,.2); }
.bpages .pgtab.on { background: rgba(37,99,235,.13); color: #1d4ed8; font-weight: 600; box-shadow: inset 0 0 0 1.5px rgba(37,99,235,.3); }
.fxtabs button.on { background: rgba(37,99,235,.13); color: #1d4ed8; font-weight: 600; }
.tchip button.on { opacity: 1; background: var(--done); border-color: var(--done-edge); color: var(--done-text); }
.bk-row.on { background: rgba(37,99,235,.06); }
.btools .grp.live { box-shadow: inset 0 0 0 2px rgba(34,197,94,.55); }
:root[data-theme="dark"] .btools button.on, :root[data-theme="dark"] .bfly button.on, :root[data-theme="dark"] .bzoom .dk.on,
:root[data-theme="dark"] .bpages .pgtab.on, :root[data-theme="dark"] .fxtabs button.on { color: #93c5fd; background: rgba(96,165,250,.2); }

/* меню выбора — вертикальные; панель цвета и толщины видна только при смене кисти */
.bfly { flex-direction: column; }
.bfly[data-fly="shapes"] { display: grid; grid-template-columns: repeat(4, 38px); }

/* заголовок страницы — спокойная светлая плашка вместо яркого градиента */
h1 { color: var(--main); background: color-mix(in srgb, var(--main) 9%, var(--card, #fff));
  border: 1px solid color-mix(in srgb, var(--main) 18%, transparent); border-left: 4px solid var(--main); }

/* шапка: «Тема», колокольчик и «Меню» на одной линии */
.top-row > * { align-self: center; }
.theme-menu { display: flex; align-items: center; margin-top: 0; margin-bottom: 0; }
.theme-menu > summary { display: flex; align-items: center; }
.theme-btn { box-sizing: border-box; height: 2.1rem; display: inline-flex; align-items: center; padding-top: 0; padding-bottom: 0; line-height: 1; }
.bell { flex: none; }
@media (max-width: 700px) {
  .theme-btn, .burger { height: 2.3rem; box-sizing: border-box; padding-top: 0; padding-bottom: 0; align-items: center; }
  .bell { width: 2.3rem; height: 2.3rem; }
}

/* подвал — всегда внизу экрана, даже на коротких страницах */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main.wrap { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
body > .foot2 { margin-top: 2rem; flex: none; }
.bowner { font-size: 1.05rem; font-weight: 600; margin: .4rem 0 .6rem; color: var(--text); }
main.wrap > :first-child:not(.crumbs):not(.flash) { margin-top: 1.1rem; }

/* ссылки внутри текста: цветом, без подчёркивания; при наведении — лёгкая подложка */
main p a:not([class]), main li a:not([class]), main summary a:not([class]), main td a:not([class]), main label a:not([class]), main small a:not([class]) {
  text-decoration: none; color: var(--main); border-radius: 5px; padding: 0 .2em; margin: 0 -.2em; transition: background .12s; }
main p a:not([class]):hover, main li a:not([class]):hover, main summary a:not([class]):hover, main td a:not([class]):hover, main label a:not([class]):hover, main small a:not([class]):hover {
  background: color-mix(in srgb, var(--main) 12%, transparent); color: var(--main-hover); text-decoration: none; }
.foot2-docs a:hover { text-decoration: none; background: color-mix(in srgb, var(--main) 10%, transparent); border-radius: 6px; }

/* панель цвета и толщины: колонка под меню кисти; панель у выбранной фигуры */
.bpanel { bottom: auto; right: auto; max-width: none; flex-direction: column; flex-wrap: nowrap; gap: 6px; padding: 6px 4px; border-radius: 12px; z-index: 9; align-items: center; }
/* меню и панель цвета — одна карточка без шва: тень каждой части обрезана со стороны стыка, между ними тонкая линия-разделитель */
.bpanel.att { border-top-left-radius: 0; border-top-right-radius: 0; border-top-color: transparent; box-shadow: 0 4px 14px rgba(0,0,0,.18); clip-path: inset(0 -24px -24px -24px); margin: 0; }
.bpanel.att::before { content: ""; position: absolute; top: 0; left: 10px; right: 10px; height: 1px; background: var(--line, #d1d5db); opacity: .7; }
.bfly.joined { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; box-shadow: 0 -2px 14px rgba(0,0,0,.18); clip-path: inset(-24px -24px 0 -24px); }
.bpanel .pill { width: 34px; height: 34px; }
.bpanel #b-fill { width: 34px; height: 34px; }
.bobar { position: absolute; z-index: 7; display: flex; align-items: center; gap: 6px; padding: 5px 7px; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.bobar .pill { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line, #d1d5db); background: var(--card, #fff); padding: 0; display: grid; place-items: center; cursor: pointer; }
.bobar .pill:hover { border-color: var(--accent, #2563eb); }
.bobar .pill i { display: block; border-radius: 50%; background: #111; }
.bobar .pill .wdot { width: 6px; height: 6px; }
.bobar .pill .cdot { width: 22px; height: 22px; border: 1px solid rgba(0,0,0,.18); }
.bobar #o-dp, .bobar #o-fill { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line, #d1d5db); background: transparent; border-radius: 10px; color: inherit; cursor: pointer; }
.bobar #o-dp svg, .bobar #o-fill svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bobar #o-dp:hover { border-color: var(--accent, #2563eb); }
.bobar #o-fill.on { background: rgba(37,99,235,.13); color: #1d4ed8; box-shadow: inset 0 0 0 1.5px rgba(37,99,235,.35); }
.bpop { z-index: 10; }
/* свои поля ввода и вопросы на доске (системные окна выводят из полного экрана) */
.binl { position: absolute; z-index: 20; box-sizing: border-box; height: 32px; padding: 0 10px; font: inherit; border: 2px solid var(--accent, #2563eb); border-radius: 8px; background: var(--card, #fff); color: var(--text, #111); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.bask { position: absolute; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: .9rem; white-space: nowrap; }
.bask button { padding: .3rem .8rem; border-radius: 8px; border: 1px solid var(--line, #d1d5db); background: transparent; color: inherit; cursor: pointer; }
.bask .bad { color: #b91c1c; border-color: rgba(185,28,28,.4); font-weight: 600; }
.bask .y { background: rgba(37,99,235,.13); color: #1d4ed8; border-color: rgba(37,99,235,.35); font-weight: 600; }
/* сворачивание тулбара */
.btools .tbmin { grid-column: 1 / -1; width: 100%; height: 22px; }
.btools .tbmin svg { width: 16px; height: 16px; transition: transform .15s; }
.btools.min .tbmin svg { transform: rotate(180deg); }
.btools.min { grid-template-columns: 38px; }
.btools.min > :not(.bgrip):not(.tbmin):not([data-tool="select"]):not([data-group="draw"]):not([data-group="shapes"]):not([data-tool="text"]) { display: none; }

/* окно цвета: одна колонка, ползунки с подписями, палитра и свой цвет последним квадратом */
.bpop { padding: 12px; border-radius: 14px; }
.bpop-row { display: grid; align-items: center; gap: .5rem; margin-bottom: .55rem; font-size: .85rem; }
.bpop-l { color: var(--muted); }
.bpop-row output { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.bpop .pal { display: grid; }
.bpop .pal button { width: 100%; border-radius: 50%; border: 2px solid transparent; background: var(--c); padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.bpop .swc { position: relative; display: block; width: 100%; height: 26px; margin-top: 8px; border-radius: 8px; cursor: pointer; background: linear-gradient(90deg, #ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #a855f7, #ec4899); }
.bpop .swc input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.bpanel .pill.cs.act { border-color: var(--accent, #2563eb); box-shadow: 0 0 0 2px rgba(37,99,235,.3); }

/* окно формулы: компактнее; кнопки — вариант B (белая карточка с тонкой линией) */
#fxbox { width: min(560px, 94vw); }
.fxkeys { gap: 6px; }
.fxkeys button { min-width: 38px; height: 36px; padding: 0 9px; border: 1px solid #e2e8f0; background: #fff; border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); color: #0f172a; font-size: .98rem; }
.fxkeys button:hover { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }
:root[data-theme="dark"] .fxkeys button { background: var(--card, #1a1d21); border-color: var(--line, #2c3138); color: var(--text, #e8eaed); box-shadow: none; }
.fxkeys button { display: inline-flex; align-items: center; justify-content: center; }
.kfr { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-size: .78rem; }
.kfr span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 3px 1px; }
.kfr span:last-child { padding: 1px 3px 0; }
.bpop-row select { grid-column: 2 / span 2; width: 100%; padding: .25rem .4rem; border-radius: 8px; border: 1px solid var(--line, #d1d5db); background: var(--card, #fff); color: inherit; font: inherit; }
.bpop-row { grid-template-columns: 96px 1fr 40px; }
.bpop-l { font-size: .8rem; white-space: nowrap; }
#board #fx-pv { height: 110px; min-height: 0; max-height: none; width: 100%; object-fit: contain; }

/* банк: каждый экзамен — своя карточка-ссылка */
a.xlink { text-decoration: none; color: inherit; margin-bottom: 1rem; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "t go" "c go"; column-gap: 1rem; row-gap: .15rem; align-items: center; }
a.xlink h2 { grid-area: t; min-width: 0; margin: 0; }
a.xlink .xl-count { grid-area: c; font-weight: 400; white-space: nowrap; padding-left: calc(4px + .5rem); }
a.xlink .r-go { grid-area: go; width: .8rem; text-align: center; color: var(--muted); font-size: 1.4rem; }
a.xlink:hover { background: var(--hover, rgba(37,99,235,.06)); }

/* заливка: образец цвета и «без заливки» */
.bobar #o-fill .cdot { border-radius: 6px; }
.bobar #o-fill.none .cdot { background: linear-gradient(135deg, transparent 46%, #ef4444 47%, #ef4444 53%, transparent 54%) !important; }
.bpop .nofill { display: block; width: 100%; margin: 0 0 8px; padding: 5px 8px; border: 1px solid var(--line, #d1d5db); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: .85rem; cursor: pointer; }
.bpop .nofill:hover { border-color: var(--accent, #2563eb); }
.bpop .pal button.on::after { content: none; }

/* поле ввода текста на доске: по размеру текста, без растягивания на всю ширину */
#board .btext { width: 120px; min-width: 0; box-sizing: content-box; resize: none; overflow: hidden; white-space: pre; border: 0; border-radius: 2px; padding: 0; margin: 0; line-height: 1.25; background: transparent; outline: 1px dashed rgba(37,99,235,.7); outline-offset: 3px; }

/* палитра в окне: ровная сетка 8×3 по ширине окна */
.bpop .pal { grid-template-columns: repeat(8, minmax(0, 1fr)); justify-items: stretch; gap: 7px; }
.bpop .pal button { height: auto; min-width: 0; aspect-ratio: 1; box-sizing: border-box; }
.bpop .pal button:hover { transform: none; border-color: rgba(37,99,235,.55); }
.bpop .pal button.on { border-color: var(--accent, #2563eb); box-shadow: inset 0 0 0 2px var(--card, #fff), inset 0 0 0 1px rgba(0,0,0,.12); }
.bpop { width: 264px; }

/* ползунок толщины: клин (тонкий → толстый), значение видно по заливке, круглого бегунка нет */
#b-width { -webkit-appearance: none; appearance: none; height: 30px; background: transparent; cursor: pointer; --p: 0%; --d: 8px; }
#b-width::-webkit-slider-runnable-track { height: 14px; border-radius: 0; background: linear-gradient(90deg, var(--main, #0a7cff) var(--p), #d9dee6 var(--p));
  clip-path: polygon(0 45%, 100% 0, 100% 100%, 0 55%); }
#b-width::-moz-range-track { height: 14px; background: linear-gradient(90deg, var(--main, #0a7cff) var(--p), #d9dee6 var(--p));
  clip-path: polygon(0 45%, 100% 0, 100% 100%, 0 55%); }
#b-width::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 24px; border: 0; background: transparent; box-shadow: none; margin-top: -5px; }
#b-width::-moz-range-thumb { width: 12px; height: 24px; border: 0; background: transparent; box-shadow: none; }
/* ползунок прозрачности: полоса, заливка до значения (на 100% доходит до края) */
#b-op { -webkit-appearance: none; appearance: none; height: 30px; background: transparent; cursor: pointer; --p: 0%; }
#b-op::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--main, #0a7cff) var(--p), #d9dee6 var(--p)); }
#b-op::-moz-range-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--main, #0a7cff) var(--p), #d9dee6 var(--p)); }
#b-op::-webkit-slider-thumb { -webkit-appearance: none; width: 8px; height: 24px; border-radius: 4px; border: 2px solid #fff; background: var(--main, #0a7cff); box-shadow: 0 0 0 1px rgba(0,0,0,.25); margin-top: -6px; }
#b-op::-moz-range-thumb { width: 8px; height: 24px; border-radius: 4px; border: 2px solid #fff; background: var(--main, #0a7cff); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.bk-row:has(.bk-tg) { grid-template-columns: 34px 34px 34px 1fr auto auto; }
.bk-row .bk-tg { width: auto; border-radius: 16px; padding: 0 10px; font-size: .85rem; }
.bk-row.bk-child { padding-left: 34px; background: rgba(0,0,0,.025); }
details.types { margin-top: .3rem; font-size: .9rem; }
details.types summary { cursor: pointer; color: var(--main); }
/* плитки: одинаковый размер, выбор типа — выпадающая панель поверх (не растягивает сетку) */
.tiles > li { display: flex; position: relative; }
.tiles > li > a { flex: 1; min-height: 5.6rem; }
.tiles > li:has(.types) > a { padding-bottom: 2.2rem; }
.tiles details.types { position: absolute; right: .55rem; bottom: .5rem; margin: 0; }
.tiles details.types > summary { list-style: none; cursor: pointer; font-size: .8rem; padding: .15rem .55rem; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--main); }
.tiles details.types > summary::-webkit-details-marker { display: none; }
.tiles details.types[open] > summary { border-color: var(--g2); }
.tiles details.types > ul { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; width: 250px; max-width: 80vw; margin: 0; padding: .3rem .7rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20,30,60,.18); list-style: none; }
.tiles details.types > ul li { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; padding: .35rem 0; border-top: 1px solid var(--line-soft, #e5e7eb); }
.tiles details.types > ul li:first-child { border-top: 0; }
.tiles details.types > ul a { display: inline; background: none; border: 0; padding: 0; min-height: 0; color: var(--main); text-decoration: none; }
.tiles details.types > ul a:hover { text-decoration: underline; transform: none; }

.nrow { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; }
.nrow .r-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.nrow .btn { flex: none; white-space: nowrap; }

.mt1 { margin-top: 1rem; }
.w-amount { max-width: 11rem; }

/* меню правого клика на доске */
.bctx { position: absolute; z-index: 40; min-width: 190px; padding: 6px; display: flex; flex-direction: column; gap: 1px;
  background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 12px; box-shadow: 0 10px 28px rgba(15,23,42,.2); }
.bctx button { text-align: left; border: 0; background: transparent; color: var(--text, #111); padding: 8px 12px; border-radius: 8px; font: inherit; font-size: .92rem; cursor: pointer; }
.bctx button:hover:not(:disabled) { background: var(--tag, #eef2ff); color: var(--main); }
.bctx button:disabled { opacity: .4; cursor: default; }
.bctx .sep { display: block; height: 1px; margin: 4px 6px; background: var(--line-soft, #e5e7eb); }
#b-win { background: var(--tag, #eee); border-radius: 50%; width: 36px; height: 36px; }
#b-win:hover, #b-win.on { background: var(--accent, #2563eb); color: #fff; }

/* предпросмотр конспекта: листы PDF, перестановка и исключение */
.bprev { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(15,23,42,.45); }
.bprev-card { display: flex; flex-direction: column; width: min(980px, 100%); max-height: 100%; padding: 14px 16px; background: var(--card, #fff); border: 1px solid var(--line, #d1d5db); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.bprev-h { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.bprev-n { color: var(--muted, #6b7280); font-size: .9rem; }
.bprev-t { margin: .3rem 0 0; color: var(--muted, #6b7280); font-size: .85rem; }
.bprev-g { overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 10px 0; padding: 2px; }
.bprev-s { margin: 0; padding: 6px; border: 1px solid var(--line, #d1d5db); border-radius: 10px; background: var(--card, #fff); cursor: pointer; }
.bprev-s.big { grid-column: 1 / -1; }
.bprev-s.off { opacity: .45; }
#board .bprev-p canvas, .bprev-p canvas { display: block; width: 100% !important; height: auto !important; min-height: 0 !important; max-width: 100%; border: 1px solid #e5e7eb !important; border-radius: 0 !important; background: #fff; }
.bprev-s figcaption { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .8rem; }
.bprev-s .no { min-width: 1.6em; text-align: center; border-radius: 999px; background: rgba(37,99,235,.13); color: #1d4ed8; font-weight: 700; }
.bprev-s .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bprev-s .bt { display: inline-flex; gap: 3px; }
.bprev-s .bt button { width: 26px; height: 26px; padding: 0; border: 1px solid var(--line, #d1d5db); border-radius: 7px; background: transparent; color: inherit; cursor: pointer; }
.bprev-s .bt button:disabled { opacity: .3; cursor: default; }
.bprev-f { display: flex; justify-content: flex-end; gap: 8px; }
.bprev-f button { padding: .45rem 1rem; border-radius: 8px; border: 1px solid var(--line, #d1d5db); background: transparent; color: inherit; cursor: pointer; }
.bprev-f .y { background: rgba(37,99,235,.13); color: #1d4ed8; border-color: rgba(37,99,235,.35); font-weight: 600; }
.bprev-f .y:disabled { opacity: .5; cursor: default; }

/* подбор заданий в ДЗ */
#hwpick .bk-rows { max-height: 42vh; }
.hp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; margin: .8rem 0; }
.hp-card { border: 1px solid var(--line, #d1d5db); border-radius: 10px; padding: .5rem; background: var(--card, #fff); display: flex; flex-direction: column; gap: .4rem; }
.hp-card img { background: var(--img-bg); width: 100%; max-height: 240px; object-fit: contain; object-position: top left; }
.hp-card .hp-html { max-height: 240px; overflow: auto; font-size: .9rem; }
.hp-cap { display: flex; flex-direction: column; gap: .3rem; }
.hp-btns { display: flex; gap: .4rem; }
.hp-btns button { padding: .25rem .7rem; font-size: .85rem; }

/* на светлой теме подпись кнопок в окне заданий не должна становиться белой на светлом фоне при наведении */
.bk-row button:hover, .bk-row .bk-tg:hover, .bk-tg:hover { color: var(--text, #1f2937); }

/* Отзывы */
.rv { margin-bottom: .9rem; }
.rv-text { margin: 0 0 .6rem; padding: .2rem 0 .2rem 1rem; border-left: 3px solid var(--acc); white-space: pre-wrap; overflow-wrap: anywhere; }
.rv-by { margin: 0 0 .5rem; color: var(--muted); }
.rv-by b { color: var(--text); }
.rv-reply { margin: .6rem 0 0; padding: .55rem .8rem; background: var(--soft); border-radius: 10px; font-size: .95em; }
.rv-imgs { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 0; }
.rv-imgs img { border: 1px solid var(--line); border-radius: 8px; max-height: 160px; width: auto; height: auto; }

.row.fields { align-items: flex-end; gap: .7rem 1rem; }
.row.fields label { flex: 1 1 12rem; min-width: 0; }
.row.fields label select,
.row.fields label input:not([type=checkbox]):not([type=radio]) { width: 100%; }
.row.fields button { flex: none; }

.old-price { color: var(--muted, #6b7280); font-weight: 400; margin-left: .35em; }
.pr-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin: .5rem 0; }
.pr-head h3 { margin: 0; }
.pr-cancel summary { cursor: pointer; list-style: none; font-size: .85rem; padding: .25rem .7rem; }
.pr-cancel summary::-webkit-details-marker { display: none; }
.pr-cancel[open] { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pr-big td, .pr-big th { font-size: 1.05rem; padding: .75rem .6rem; }
.pr-how { background: var(--soft); border-radius: 8px; padding: .6rem .8rem; margin: .75rem 0; }
.mail-body { white-space: pre-wrap; font: inherit; background: var(--soft); border-radius: 8px; padding: .6rem .8rem; margin: .4rem 0 0; }

/* верхние вкладки на широком экране: отдельная строка на всю ширину, вкладки поровну */
@media (min-width: 701px) {
  .top-row { padding-bottom: 0; }
  .nav { flex: 1 0 100%; gap: 0; margin: .15rem -16px 0; padding: 0 16px; border-top: 1px solid var(--line-soft); }
  .nav > a, .nav > .inline { flex: 1 1 auto; text-align: center; padding: .6rem .5rem; border-bottom: 3px solid transparent; white-space: nowrap; }
  .nav > a:hover { background: var(--soft); }
  .nav > a.on { background: var(--soft); border-bottom-color: var(--main); }
  .nav > .inline { display: flex; justify-content: center; }
  .nav > .inline button.link { padding: 0; }
}
.mail-list, .mail-list th, .mail-list td, .mail-list tr { border: 0 !important; }
.mail-list td { padding-top: .6rem; padding-bottom: .6rem; }
.mail-list tbody tr:not(:last-child) { border-bottom: 1px solid var(--line-soft) !important; }
.card > form.mailtest:first-child { margin-top: 0; padding-top: 0; border-top: 0; margin-bottom: .8rem; }
@media (max-width: 600px) { .mail-list td { padding: .15rem 0; } .mail-list tbody tr { padding: .6rem 0; } }
.rv-det { margin: .5rem 0 0; }
.rv-det > summary { cursor: pointer; color: var(--main); font-weight: 600; font-size: .92rem; }

.disc { color: var(--disc); font-size: .85em; font-weight: 600; white-space: nowrap; }
br + .old-price { margin-left: 0; }
.legend-box { margin: .4rem 0 1.2rem; }
.legend-box > summary { display: inline-block; cursor: pointer; }
.legend-box .legend { margin-top: .7rem; }
.t-alg { margin: .2rem 0; }
.t-step { margin: .8rem 0; }
.t-step strong { display: block; margin-bottom: .15rem; }
.sv-row td { border-top: 0; padding-top: 0; }
.sv-det summary { display: inline-block; cursor: pointer; }
.sv-det img { max-width: 100%; margin-top: .6rem; }

/* Прикрепление файлов (attach.js): плашки как в мессенджерах */
.att-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.att { margin-top: .35rem; }
.att-drop { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding: .6rem .8rem; border: 1.5px dashed var(--line);
  border-radius: 10px; background: var(--soft); cursor: pointer; transition: border-color .12s, background .12s; }
.att-drop:hover, .att-drop:focus-visible, .att-over .att-drop { border-color: var(--main); background: var(--acc); outline: none; }
.att-btn { color: var(--main); font-weight: 600; }
.att-hint { color: var(--muted); font-size: .85rem; }
.att-list { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.att-chip, .att-have li { display: flex; align-items: center; gap: .6rem; min-width: 0; padding: .35rem .5rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); }
.att-th { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: var(--acc); color: var(--text); font-size: .68rem; font-weight: 700; text-align: center; }
.att-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-pdf { background: var(--bad); color: var(--bad-text); }
.att-video, .att-zip { background: var(--tag); }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { color: var(--muted); font-size: .8rem; }
.att-x { flex: none; width: 1.9rem; height: 1.9rem; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--soft);
  color: var(--text); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.att-x:hover { background: var(--bad); color: var(--bad-text); border-color: var(--bad-edge); }
.att-err { margin: .4rem 0 0; color: var(--bad-text); background: var(--bad); border-left: 3px solid var(--bad-edge); border-radius: 6px; padding: .35rem .6rem; font-size: .875rem; }
.att-have { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
@media (max-width: 480px) { .att-drop { padding: .7rem; } .att-th { width: 2.3rem; height: 2.3rem; } }

/* Банк заданий: спокойные кнопки, номера страниц, сложность, компактные плитки */
.qnav { gap: .25rem; margin: .8rem 0 .3rem; container-type: inline-size; flex-wrap: nowrap; }
.qnav .btn { padding: .35rem .7rem; font-size: .92rem; white-space: nowrap; }
.qnav .btn.secondary { background: transparent; border-color: transparent; color: var(--muted); }
.qnav .btn.secondary:hover { background: var(--tag); color: var(--main); }
.qnav .btn.next { background: var(--main); color: var(--on-main); margin-left: auto; }
.qnav .btn.next:hover { background: var(--main-hover); color: var(--on-main); filter: none; }
.qnav .s, .qnav .a { display: none; }
@container (max-width: 430px) { .qnav .f { display: none; } .qnav .s { display: inline; } }
@container (max-width: 270px) { .qnav .s { display: none; } .qnav .a { display: inline; } .qnav .btn { padding: .35rem .6rem; } }
.pager { gap: .2rem; margin-top: .2rem; }
.pager a, .pager b { min-width: 1.9rem; padding: .2rem .3rem; font-size: .9rem; border-radius: 6px; border-color: transparent; color: var(--muted); }
.pager a:hover { background: var(--tag); color: var(--main); }
.pager b { background: var(--tag); color: var(--main); border-color: var(--line); }
.pager .gap { color: var(--muted); padding: 0 .1rem; }
@media (max-width: 900px) { .pager .d7, .pager .d8, .pager .d9 { display: none; } }
@media (max-width: 640px) { .pager .d4, .pager .d5, .pager .d6 { display: none; } .pager a, .pager b { min-width: 1.75rem; } }
nav.row > .btn:not(.secondary):not(.next) { background: var(--main); color: var(--on-main); }
nav.row > .btn:not(.secondary):not(.next):hover { background: var(--main-hover); color: var(--on-main); filter: none; }
nav.row > .btn.secondary { background: var(--card); }
nav.qnav > .btn.secondary { background: transparent; }
.diff { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; font-size: .9rem; color: var(--muted); margin: .6rem 0; }
main .diff a, main .diff b { min-width: 1.9rem; padding: .15rem .55rem; text-align: center; border-radius: 6px; text-decoration: none; color: var(--muted); margin: 0; }
main .diff a:hover { background: var(--tag); color: var(--main); }
main .diff b { background: var(--tag); color: var(--main); border: 1px solid var(--line); padding: calc(.15rem - 1px) calc(.55rem - 1px); }
main .tiles { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; }
main .tiles > li > a { margin: 0; background: var(--card); min-height: 3.4rem; padding: .6rem 5rem .6rem 1rem; flex-direction: row; align-items: center; gap: .7rem; border-radius: 10px; text-decoration: none; }
main .tiles > li:has(.types) > a { padding-bottom: .6rem; }
main .tiles > li > a b { font-size: 1.15rem; line-height: 1.2; white-space: nowrap; flex: none; }
main .tiles > li > a .muted { font-size: .85rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
main .tiles > li > a:hover { background: var(--soft); transform: none; }
.tiles details.types { right: .5rem; bottom: auto; top: calc(50% - .95rem); }
.tiles > li:has(details[open]) { z-index: 40; }
.tiles details.types > summary { user-select: none; -webkit-user-select: none; }
.tiles details.types > summary { font-size: .88rem; padding: .3rem .7rem; background: transparent; border-color: transparent; color: var(--muted); }
.tiles details.types > summary:hover { background: var(--tag); color: var(--main); }

/* плитки номеров: длинная подпись обрезается многоточием и не вылезает за плитку */
.tiles > li { min-width: 0; }
main .tiles > li > a { min-width: 0; overflow: hidden; box-sizing: border-box; }
main .tiles > li > a .muted { flex: 1 1 0; }

/* Условие и решение на телефоне: не шире экрана, код и формулы прокручиваются сами */
.sv-det, .sv-det .t-html { min-width: 0; max-width: 100%; }
.sv-det .t-html pre { max-width: 100%; }

/* число рядом с ползунком редактируется: видно, что в него можно щёлкнуть и вписать значение */
output.numedit { cursor: text; border-radius: 6px; padding: 1px 5px; border: 1px solid var(--line, rgba(128,128,128,.35)); min-width: 2.2em; outline: none; }
output.numedit:focus { border-color: var(--accent, #2563eb); box-shadow: 0 0 0 2px rgba(37,99,235,.25); }

/* Цепочки вычислений в решениях переносятся целыми частями, без уменьшения шрифта. */
.t-solution .math-flow {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  max-width: 100%; gap: .35em .3em; vertical-align: middle;
}
.t-solution .math-flow > math { flex: 0 0 auto; margin: 0; }

/* Searchable personal time zone picker. */
.tz-picker { display:flex; flex-direction:column; gap:.8rem; min-width:0; }
.tz-picker [hidden] { display:none !important; }
.tz-picker input { width:100%; min-width:0; }
.tz-results { margin:0; border:1px solid var(--line,#bfd0ef); border-radius:12px; overflow:hidden; }
.tz-results [role="option"] { padding:.65rem .8rem; cursor:pointer; overflow-wrap:anywhere; }
.tz-results [role="option"]:hover, .tz-results [aria-selected="true"] { background:var(--soft,#eef5ff); color:var(--blue,#204ddd); }
.tz-picker > p { margin:0; }
.tz-picker > button { align-self:flex-start; max-width:100%; }
.tz-picker > p:empty { display:none; }
