/* ============================================================
   Система оформления: тетрадная клетка, плашки, мятные карточки,
   звёзды-наклейки. Основана на образце «Обществознание ЕГЭ».
   Все цвета и шрифты — в переменных ниже: менять нужно только их.
   ============================================================ */

/* Шрифты. Основной вариант — Google Fonts (подключён в <head> страниц).
   Если хотите хранить шрифты у себя, положите файлы в public/fonts (см. README) — они подхватятся сами. */
@font-face {
  font-family: "Montserrat Local";
  src: url("/fonts/Montserrat-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Caveat Local";
  src: url("/fonts/Caveat-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #f7f7f4;
  --grid: rgba(60, 64, 58, 0.13);
  --ink: #131313;
  --ink-soft: #4b524a;
  --pill: #e8ebe4;
  --mint: #dfe7d6;
  --sage: #9aaa8b;
  --sage-ink: #131313;
  --card: rgba(255, 255, 255, 0.82);
  --line: #cfd6c7;
  --focus: #5d7350;
  --ok: #2f6b3a;
  --ok-bg: #d3ecd2;
  --bad: #a3361f;
  --bad-bg: #f6d9d1;
  --part: #7a5b10;
  --part-bg: #f4e8c5;
  --font-display: "Montserrat", "Montserrat Local", "Segoe UI", Arial, sans-serif;
  --font-hand: "Caveat", "Caveat Local", "Segoe Script", cursive;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1f1c; --grid: rgba(255, 255, 255, 0.07); --ink: #f1f3ee; --ink-soft: #b7c0b2;
    --pill: #2a312b; --mint: #2d362e; --sage: #7e9070; --sage-ink: #101310;
    --card: rgba(36, 42, 37, 0.88); --line: #414c41; --focus: #b5c9a6;
    --ok: #8fd09a; --ok-bg: #223a27; --bad: #f0a190; --bad-bg: #432722;
    --part: #e6c26a; --part-bg: #41361a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1f1c; --grid: rgba(255, 255, 255, 0.07); --ink: #f1f3ee; --ink-soft: #b7c0b2;
  --pill: #2a312b; --mint: #2d362e; --sage: #7e9070; --sage-ink: #101310;
  --card: rgba(36, 42, 37, 0.88); --line: #414c41; --focus: #b5c9a6;
  --ok: #8fd09a; --ok-bg: #223a27; --bad: #f0a190; --bad-bg: #432722;
  --part: #e6c26a; --part-bg: #41361a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--grid) 1.5px, transparent 1.5px);
  background-size: 46px 46px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.55;
  padding: 28px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px));
}
.wrap { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.wrap.wide { max-width: 1280px; }
.wrap.narrow { max-width: 560px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Украшения ---------- */
.star { width: 38px; height: 38px; flex: none; }
.star path { fill: var(--sage); stroke: var(--ink); stroke-width: 1.1; stroke-linejoin: round; }
.plate {
  background: var(--pill); border-radius: 18px; margin: 0;
  font-weight: 900; text-transform: uppercase; line-height: 1.05; letter-spacing: 0.01em;
  padding: 0.18em 0.42em 0.22em; max-width: 100%; overflow-wrap: anywhere;
}
.plate.big { font-size: clamp(1.35rem, 6.6vw, 3.9rem); }
.plate.mid { font-size: clamp(1.4rem, 5vw, 2.4rem); }
.plate.sm { font-size: clamp(1.05rem, 3.4vw, 1.5rem); }
.plate.bare { background: transparent; padding-left: 0; padding-right: 0; }
.tag {
  background: var(--sage); color: var(--sage-ink); border-radius: 20px 20px 20px 6px;
  font-weight: 800; font-size: 0.95rem; padding: 0.45em 0.95em; line-height: 1.2; display: inline-block;
}
.wave { display: block; width: min(100%, 200px); height: 14px; color: var(--sage); margin-top: 4px; }
.sticker {
  transform: rotate(-6deg); background: var(--pill); border-radius: 22px 22px 22px 6px;
  font-family: var(--font-hand); font-weight: 700; font-size: clamp(1.25rem, 3.6vw, 1.8rem); line-height: 1.1;
  padding: 0.5em 0.9em 0.62em; text-align: center; position: relative; display: inline-block;
}
.sticker::after {
  content: ""; position: absolute; left: 14%; right: 14%; bottom: 0.4em; height: 6px; color: var(--ink);
  background: radial-gradient(circle at 50% 0, transparent 55%, currentColor 57%, currentColor 68%, transparent 70%) 0 0 / 14px 6px repeat-x;
  opacity: 0.8;
}
.hand { font-family: var(--font-hand); font-weight: 700; font-size: 1.3em; }

/* ---------- Верхняя панель ---------- */
.topbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand .star { width: 30px; height: 30px; }

/* ---------- Кнопки и поля ---------- */
.btn {
  font: inherit; font-weight: 800; font-size: 0.92rem; cursor: pointer; border: 0; border-radius: 16px;
  background: var(--sage); color: var(--sage-ink); padding: 0.7em 1.2em; transition: transform .15s ease;
  text-decoration: none; display: inline-block; line-height: 1.25; text-align: center;
}
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.small { font-size: 0.84rem; padding: 0.5em 1em; }
.btn.tiny { font-size: 0.78rem; padding: 0.35em 0.8em; border-radius: 12px; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.soft { background: var(--pill); color: var(--ink); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.active { background: var(--ink); color: var(--bg); }
.ibtn {
  font: inherit; font-weight: 800; cursor: pointer; border: 0; width: 2rem; height: 2rem; border-radius: 10px;
  background: var(--pill); color: var(--ink); display: inline-grid; place-items: center; padding: 0; line-height: 1;
}
.ibtn:hover { background: var(--sage); }
.ibtn:disabled { opacity: 0.35; cursor: default; background: var(--pill); }
.hint { color: var(--ink-soft); font-size: 0.88rem; font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.txt {
  font: inherit; font-weight: 600; color: var(--ink); background: var(--bg); border: 2px solid var(--ink);
  border-radius: 12px; padding: 0.55em 0.8em; min-width: 0; width: 100%;
}
textarea.txt { resize: vertical; line-height: 1.45; min-height: 3.2em; }
select.txt { width: auto; cursor: pointer; }
input.txt.num-in { width: 5.5rem; text-align: center; }
.txt.ok { border-color: var(--ok); background: var(--ok-bg); }
.txt.bad { border-color: var(--bad); background: var(--bad-bg); }
.txt:disabled { opacity: 0.7; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .lbl, .lbl2 { font-weight: 800; font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.nowrap { flex-wrap: nowrap; }
.row > .grow { flex: 1 1 12rem; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--focus); width: 1.15rem; height: 1.15rem; flex: none; cursor: pointer; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  font: inherit; font-weight: 800; font-size: 0.84rem; cursor: pointer; border: 2px solid var(--ink); background: transparent;
  color: var(--ink); border-radius: 12px; padding: 0.4em 0.9em;
}
.seg button[aria-pressed="true"] { background: var(--sage); color: var(--sage-ink); }

/* ---------- Карточки ---------- */
.card {
  background: var(--card); border-radius: 24px; padding: 20px 22px 22px; backdrop-filter: blur(2px);
}
.card.mint { background: var(--mint); }
.card.pad-sm { padding: 14px 16px; border-radius: 20px; }
.card-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title h2 { font-size: 1.05rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; }
.pill { font-size: 0.78rem; font-weight: 800; padding: 0.2em 0.75em; border-radius: 999px; background: var(--pill); color: var(--ink-soft); white-space: nowrap; }
.pill.live { background: var(--ok-bg); color: var(--ok); }
.pill.done { background: var(--mint); color: var(--ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.part { background: var(--part-bg); color: var(--part); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.pending { background: var(--sage); color: var(--sage-ink); }
.pill.off { background: var(--pill); color: var(--ink-soft); opacity: 0.8; }

/* ---------- Блоки урока (общий вид у ученика, учителя и в конструкторе) ---------- */
.lesson { display: flex; flex-direction: column; gap: 18px; }
.block-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.block-head .plate { font-size: clamp(1.1rem, 3.6vw, 1.6rem); }
.prose { max-width: 70ch; display: flex; flex-direction: column; gap: 10px; overflow-wrap: anywhere; }
.prose p { margin: 0; }
.prose ul, .prose ol { margin: 0; padding-left: 1.5em; display: flex; flex-direction: column; gap: 4px; }
.prose b { font-weight: 800; }
.block-text { padding: 18px 22px; }
.figure { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.figure img { max-width: 100%; max-height: 560px; border-radius: 16px; display: block; background: #fff; }
.figure figcaption { color: var(--ink-soft); font-style: italic; font-size: 0.92rem; }
.source { background: var(--mint); border-radius: 22px; padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 8px; }
.source .src-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.source .src-title { font-weight: 900; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.06em; }
.source .src-author { color: var(--ink-soft); font-style: italic; font-size: 0.9rem; }
.source .prose { font-size: 0.98rem; max-width: 74ch; }

.task { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; align-items: start; }
.num {
  background: var(--sage); color: var(--sage-ink); font-weight: 900; font-size: 1.15rem;
  min-width: 2.7rem; height: 2.7rem; padding: 0 0.6rem; display: grid; place-items: center;
  border-radius: 14px 14px 14px 4px;
}
.body { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.lead { font-weight: 700; max-width: 70ch; overflow-wrap: anywhere; }
.lead p + p { margin-top: 8px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; }
ol.opts { margin: 0; padding-left: 1.5em; display: flex; flex-direction: column; gap: 6px; max-width: 70ch; overflow-wrap: anywhere; }
ol.opts li::marker { font-weight: 800; }
.scroll { overflow-x: auto; max-width: 100%; }
table.match { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 420px; font-size: 0.95rem; background: var(--mint); border-radius: 16px; overflow: hidden; }
table.match th { text-align: left; font-weight: 800; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 10px 14px; background: var(--sage); color: var(--sage-ink); }
table.match td { padding: 9px 14px; vertical-align: top; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
table.match td:first-child { width: 55%; }

/* Поле ответа */
.check { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; background: var(--pill); border-radius: 18px; max-width: 74ch; width: 100%; }
.check .row { gap: 10px; }
.cells { display: flex; flex-wrap: wrap; gap: 8px; }
.cell2 { display: grid; grid-template-columns: auto 3rem; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; font-weight: 800; background: var(--bg); }
.cell2 b { padding: 6px 10px; background: var(--sage); color: var(--sage-ink); display: grid; place-items: center; }
.cell2 input { border: 0; text-align: center; font: inherit; font-weight: 800; font-size: 1.1rem; background: transparent; color: var(--ink); width: 3rem; min-width: 0; padding: 6px 0; outline: none; }
.cell2:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.cell2.ok { border-color: var(--ok); }
.cell2.ok input { background: var(--ok-bg); color: var(--ok); }
.cell2.bad { border-color: var(--bad); }
.cell2.bad input { background: var(--bad-bg); color: var(--bad); }
.result { font-weight: 700; font-size: 0.92rem; }
.result:empty { display: none; }
.check.ok .result { color: var(--ok); }
.check.part .result { color: var(--part); }
.check.bad .result { color: var(--bad); }
.teacher-note { background: var(--card); border-radius: 12px; padding: 8px 12px; font-size: 0.92rem; font-weight: 600; }
.teacher-note b { font-weight: 900; }

details.answer { margin-top: 2px; }
details.answer summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  background: var(--pill); border-radius: 14px; padding: 0.5em 1em; font-weight: 800; font-size: 0.88rem;
}
details.answer summary::-webkit-details-marker { display: none; }
details.answer summary::before { content: "+"; font-weight: 900; font-size: 1.1rem; width: 1ch; text-align: center; }
details.answer[open] summary::before { content: "−"; }
details.answer .ans {
  margin-top: 10px; background: var(--mint); border-radius: 16px; padding: 14px 16px; max-width: 74ch; font-size: 0.95rem;
  display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere;
}
.key { font-weight: 900; letter-spacing: 0.04em; }

/* ---------- Доска ---------- */
.board-wrap { background: #fff; border-radius: 22px; overflow: hidden; border: 2px solid var(--ink); }
canvas.board { display: block; width: 100%; aspect-ratio: 16 / 9; touch-action: none; background: #fff; }
canvas.board.draw { cursor: crosshair; }
.board-tools { padding: 8px 12px; border-top: 2px solid var(--ink); background: var(--pill); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Библиотека ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.lesson-card { display: flex; flex-direction: column; gap: 10px; }
.lesson-card h3 { font-size: 1.1rem; font-weight: 900; overflow-wrap: anywhere; }
.lesson-card .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--card); border-radius: 18px; padding: 12px 16px; }
.list-item .grow { flex: 1 1 14rem; min-width: 0; }
.list-item .t { font-weight: 800; overflow-wrap: anywhere; }
.empty-state { text-align: center; padding: 28px 16px; color: var(--ink-soft); font-weight: 600; }

/* ---------- Конструктор ---------- */
.ed { display: flex; flex-direction: column; gap: 14px; }
.ed-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-head .tag { font-size: 0.82rem; }
.ed-list { display: flex; flex-direction: column; gap: 10px; }
.ed-row { display: flex; align-items: center; gap: 10px; }
.ed-row .badge { background: var(--sage); color: var(--sage-ink); font-weight: 900; border-radius: 10px 10px 10px 3px; min-width: 2.1rem; height: 2.1rem; display: grid; place-items: center; flex: none; padding: 0 0.4rem; }
.ed-row .txt { flex: 1; }
.ed-row label.chk { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.84rem; white-space: nowrap; }
.add-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--mint); border-radius: 20px; padding: 12px 14px; }
.add-bar .lbl { font-weight: 900; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.06em; margin-right: 4px; }
.thumb { max-width: 260px; max-height: 160px; border-radius: 12px; display: block; background: #fff; }
.editor-bar { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--card); backdrop-filter: blur(6px); border-radius: 20px; padding: 10px 14px; }
.dirty-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--part); display: inline-block; }

/* ---------- Урок учителя ---------- */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.live-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.code-big { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 900; letter-spacing: 0.22em; font-family: ui-monospace, Menlo, Consolas, monospace; }
.lb { position: relative; }
.lb.hid { opacity: 0.55; }
.lb.hid > .card, .lb.hid > .source, .lb.hid > .figure, .lb.hid > .block-head { outline: 2px dashed var(--sage); outline-offset: 4px; }
.lb-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.lb-bar .state { font-size: 0.78rem; font-weight: 800; color: var(--ink-soft); }
.class-box { margin-top: 10px; background: var(--pill); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.stu { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); gap: 4px 12px; background: var(--card); border-radius: 14px; padding: 10px 12px; align-items: start; }
.stu .nm { font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.stu .ans-line { white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 600; min-height: 1.4em; }
.stu .ans-line.empty { color: var(--ink-soft); font-style: italic; font-weight: 500; }
.stu .score-line { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; display: inline-block; }
.dot.on { background: var(--ok); }
.side-stu { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.side-stu:first-child { border-top: 0; }
.side-stu .nm { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.scorebox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scorebox input.pts { width: 4.4rem; text-align: center; }
.scorebox input.cm { flex: 1 1 10rem; min-width: 8rem; }

/* ---------- Результаты ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: 20px; }
table.res { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.92rem; }
table.res th, table.res td { padding: 9px 12px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.res th { background: var(--sage); color: var(--sage-ink); font-weight: 800; font-size: 0.8rem; position: sticky; top: 0; }
table.res th:first-child, table.res td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; font-weight: 800; }
table.res th:first-child { background: var(--sage); z-index: 2; }
table.res td.c { cursor: pointer; font-weight: 800; }
table.res td.c:hover { filter: brightness(0.95); outline: 2px solid var(--ink); outline-offset: -2px; }
table.res td.ok { background: var(--ok-bg); color: var(--ok); }
table.res td.part { background: var(--part-bg); color: var(--part); }
table.res td.bad { background: var(--bad-bg); color: var(--bad); }
table.res td.pending { background: var(--sage); color: var(--sage-ink); }
table.res td.none { color: var(--ink-soft); font-weight: 500; }
table.res tfoot td { font-weight: 800; background: var(--pill); }
.cell-man { font-size: 0.65rem; vertical-align: super; margin-left: 2px; }
.bar { height: 10px; border-radius: 6px; background: var(--pill); overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: var(--sage); }

dialog.modal {
  border: 0; border-radius: 26px; padding: 22px 24px; background: var(--bg); color: var(--ink);
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow-y: auto; font-family: var(--font-display);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
dialog.modal::backdrop { background: rgba(19, 19, 19, 0.45); }
.kv { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 6px 14px; }
.kv dt { font-weight: 800; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); padding-top: 3px; }
.kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; font-weight: 600; }

/* ---------- Ученик ---------- */
.stu-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.stu-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.new-flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 6px var(--sage); } 100% { box-shadow: 0 0 0 0 transparent; } }
.waiting { text-align: center; padding: 34px 16px; font-weight: 700; color: var(--ink-soft); }

/* ---------- Прочее ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; max-width: min(92vw, 520px);
  background: var(--ink); color: var(--bg); border-radius: 16px; padding: 0.7em 1.2em; font-weight: 700; font-size: 0.92rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}
.toast.err { background: var(--bad); color: #fff; }
.hero { position: relative; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; padding-top: 6px; }
.hero .star.s1 { position: absolute; top: 4px; right: max(0px, 8%); width: clamp(30px, 6vw, 52px); height: clamp(30px, 6vw, 52px); }
.hero .star.s2 { position: absolute; top: 96px; right: 0; width: clamp(24px, 4vw, 36px); height: clamp(24px, 4vw, 36px); transform: rotate(14deg); }
.conn { position: fixed; top: 10px; right: 12px; z-index: 40; }

@media (max-width: 980px) {
  .live-grid, .stu-grid { grid-template-columns: 1fr; }
  .live-side, .stu-side { position: static; max-height: none; }
}
@media (max-width: 560px) {
  .conn { top: auto; bottom: 10px; right: 10px; }
  body { padding-top: 18px; }
  .task { grid-template-columns: 1fr; }
  .num { width: fit-content; }
  .card { padding: 16px 16px 18px; border-radius: 20px; }
  .stu { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .hero .star.s2 { top: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; } .btn:hover { transform: none; } .new-flash { animation: none; }
}
@media print { body { background: #fff; } .topbar, .editor-bar, .add-bar, .tools { display: none !important; } }

/* ---------- Маркер поверх блоков урока ---------- */
.task-material { display: flex; flex-direction: column; gap: 12px; }
.markable { position: relative; }
canvas.mark-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; touch-action: none; }
canvas.mark-layer.draw { pointer-events: auto; cursor: crosshair; }
.marks-bar { position: sticky; top: 8px; z-index: 30; border: 2px solid var(--ink); border-radius: 16px; }

/* PDF-материал в уроке */
.file-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.file-card .grow { flex: 1 1 200px; min-width: 0; }
.file-ico { flex: none; width: 52px; height: 64px; border-radius: 10px; background: var(--mint, #e5ecdf); border: 2px solid var(--ink, #111); display: grid; place-items: center; font-weight: 900; font-size: .8rem; letter-spacing: .04em; }
.file-title { font-weight: 800; overflow-wrap: anywhere; }
