/* Карточный интерфейс: каждое задание — отдельная карточка на мягком фоне. */

/* Шрифты лежат рядом с сайтом: Google Fonts из России открывается через раз. */
@font-face { font-family: "Onest"; font-weight: 400; font-display: swap; src: url("fonts/onest-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-weight: 400; font-display: swap; src: url("fonts/onest-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "Onest"; font-weight: 500; font-display: swap; src: url("fonts/onest-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-weight: 500; font-display: swap; src: url("fonts/onest-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "Onest"; font-weight: 600; font-display: swap; src: url("fonts/onest-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-weight: 600; font-display: swap; src: url("fonts/onest-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "Unbounded"; font-weight: 500; font-display: swap; src: url("fonts/unbounded-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-weight: 500; font-display: swap; src: url("fonts/unbounded-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Unbounded"; font-weight: 700; font-display: swap; src: url("fonts/unbounded-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-weight: 700; font-display: swap; src: url("fonts/unbounded-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
/* Символы формул — из DejaVu Sans, тем же шрифтом подписаны картинки dm_figures. */
@font-face { font-family: "DM Math"; font-display: swap; src: url("fonts/dejavu-math.woff2") format("woff2"); }

:root {
  --bg: #0b0e14;
  --paper: #0b0e14;
  --card: #111520;
  --sunken: #080a0f;
  --surface: #151a27;
  --ink: #e6edf3;
  --muted: #8b949e;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #38bdf8;
  --accent-ink: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-border: rgba(56, 189, 248, 0.32);
  --on-accent: #04131e;
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --bad: #f43f5e;
  --bad-soft: rgba(244, 63, 94, 0.12);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px -8px rgba(0, 0, 0, 0.6);
  --wide: 46rem;
  --topbar-h: 56px;
  --subbar-h: 52px;

  /* Моноширинный шрифт только для кода; подписи, бейджи и цифры — основным шрифтом */
  --code: ui-monospace, "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
  --mono: var(--body);
  --font-mono: var(--body);
  --fg: var(--ink);
  --border: var(--line);
  --body: "Onest", "DM Math", system-ui, sans-serif;
  --display: var(--body);

  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --paper: #f8fafc;
    --card: #ffffff;
    --sunken: #f1f5f9;
    --surface: #ffffff;
    --ink: #0f172a;
    --fg: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --border: #e2e8f0;
    --line-strong: #cbd5e1;
    --accent: #0284c7;
    --accent-ink: #0369a1;
    --accent-soft: rgba(2, 132, 199, 0.1);
    --accent-border: rgba(2, 132, 199, 0.3);
    --on-accent: #ffffff;
    --ok: #059669;
    --ok-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --bad: #e11d48;
    --bad-soft: #fff1f2;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 30px -8px rgba(15, 23, 42, 0.18);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-padding-top: calc(5rem + env(safe-area-inset-top, 0px));
  /* clip, а не hidden: hidden у html и body вместе делает body отдельным скроллером,
     и липкая шапка уезжает вместе со страницей */
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
}

/* Всплывающие уведомления (тосты) — неблокирующая замена alert(). */
.dm-toast-host {
  position: fixed;
  z-index: 10000;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}
.dm-toast {
  pointer-events: auto;
  cursor: pointer;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-md, 10px);
  background: var(--card, #fff);
  color: var(--ink, #111);
  border: 1px solid var(--line, #ddd);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.18));
  font-size: 0.9rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.dm-toast.show { opacity: 1; transform: translateY(0); }
.dm-toast-error { border-left: 4px solid var(--bad, #e5484d); }
.dm-toast-warn { border-left: 4px solid var(--accent, #f5a623); }
.dm-toast-info { border-left: 4px solid var(--accent, #0ea5e9); }
.dm-toast-success { border-left: 4px solid var(--ok, #30a46c); }

/* Модальное подтверждение (async-замена confirm). */

/* Блокировка прокрутки фона при открытом мобильном меню. */

h1, h2, p { margin: 0; }
img { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- страница ---------- */

.sheet {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2.75rem 1.25rem 9rem;
  padding-bottom: calc(9rem + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}

.intro { margin-bottom: 2rem; }
h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.75rem, 5.2vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.lead { color: var(--muted); max-width: 36rem; font-size: 1.04rem; text-wrap: pretty; }
.lead p + p { margin-top: 0.5rem; }
.meta { display: flex; flex-wrap: wrap; gap: 0.4rem; color: var(--muted); font-size: 0.88rem; margin-top: 1rem; }
.muted { color: var(--muted); }

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 2.75rem 0 0.9rem 0.25rem;
}

/* ---------- кнопки и поля ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  text-decoration: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover {
  background: var(--accent-ink);
  color: var(--on-accent);
}
.btn.primary:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.quiet {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}
.btn.quiet:hover {
  background: var(--hover);
  color: var(--ink);
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
}
.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.field-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.45rem; }
.field-error { display: block; color: var(--bad); font-size: 0.85rem; margin-top: 0.4rem; }

input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="email"], input[type="search"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input[type="text"]:focus, textarea:focus, select:focus, input[type="password"]:focus, input[type="date"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="search"]:focus {
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
input:disabled, select:disabled, textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--surface);
}
textarea { resize: vertical; }

.ev-card-title,
.homework-nav-card,
.q-text,
.markdown-body {
  overflow-wrap: anywhere;
}

/* ---------- начало ---------- */

.start {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.started .start { display: none; }

.group-field input {
  max-width: 12rem;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
}
.group-field input::placeholder { color: var(--muted); opacity: 0.45; letter-spacing: 0.06em; }
.group-field input.invalid { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }

.modes { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.modes legend { padding: 0; }
.mode {
  position: relative;
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem 1rem 0.9rem 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sunken);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.mode::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 1.1rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  transition: border 0.15s;
}
.mode:hover { border-color: var(--line-strong); }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode:has(input:checked)::before { border: 5px solid var(--accent); }
.mode:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.mode-name { font-weight: 600; }
.mode-desc { color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.start .btn.primary { justify-self: start; padding: 0.85rem 2.2rem; font-size: 1.02rem; }

/* До нажатия кнопки «Начать тестирование» вопросы и сайдбар скрыты */
body.quiz:not(.started):not(.custom-test-body) .questions,
body.quiz:not(.started):not(.custom-test-body) .quiz-sidebar,
body.quiz:not(.started):not(.custom-test-body) .mode-bar,
body.quiz:not(.started):not(.custom-test-body) .finish-section,
body.quiz:not(.started):not(.custom-test-body) .feedback,
body.quiz:not(.started):not(.custom-test-body) .quiz-subtopbar .topbar-count,
body.quiz:not(.started):not(.custom-test-body) .quiz-subtopbar .progress {
  display: none !important;
}

body.quiz.started #start {
  display: none !important;
}

body.custom-test-body .questions,
body.custom-test-body .finish-section,
body.custom-test-body .quiz-subtopbar .topbar-count,
body.custom-test-body .quiz-subtopbar .progress {
  display: block !important;
}
body.custom-test-body .quiz-subtopbar .topbar-count {
  display: inline-flex !important;
}

/* ---------- задание ---------- */

.q {
  position: relative;
  padding: 1.35rem 1.5rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.q.is-answered { border-color: var(--line); border-left-color: var(--accent); }
.q.is-answered .q-num { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.q.is-right { border-color: var(--line); border-left-color: var(--ok); }
.q.is-wrong { border-color: var(--line); border-left-color: var(--bad); }

@keyframes qPulseHighlight {
  0% {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
  }
  40% {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }
  100% {
    outline: 2px solid transparent;
    outline-offset: 0;
  }
}
.q.q-pulse-highlight {
  animation: qPulseHighlight 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.q-body { min-width: 0; }
.q-text .katex, .explanation-body .katex, .opt-body .katex { white-space: normal; }
.q-text p, .explanation-body p, .explanation-body li { overflow-x: auto; overflow-y: hidden; }

.q-num {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 1.65rem;
  padding: 0 0.6rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.is-right .q-num { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.is-wrong .q-num { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.is-right .q-num::after, .is-wrong .q-num::after { font-family: var(--body); font-size: 0.76rem; font-weight: 600; }
.is-right .q-num::after { content: "верно"; }
.is-wrong .q-num::after { content: "ошибка"; }

.q-text { font-size: 1.04rem; }
.q-text > * + * { margin-top: 0.6rem; }
.q-text p { margin: 0; }
.q-text img, .explanation img, .hint img {
  display: block;
  margin: 0.9rem 0;
  border-radius: 12px;
  cursor: zoom-in;
  max-height: 26rem;
  max-width: min(100%, 30rem);
  width: auto;
}
img.fig { background: var(--card); padding: 0.4rem; border: 1px solid var(--line); }
img.photo { background: #fff; }

@media (prefers-color-scheme: dark) {
  img.fig-png { filter: invert(0.88) hue-rotate(180deg); background: #fff; }
  #zoom img.fig-png { filter: invert(0.88) hue-rotate(180deg); }
}

/* формулы KaTeX */
.katex { font-size: 1.08em; }
.math-block, .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 0.35rem 0;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 34rem) {
  .math-block .katex-display > .katex,
  .katex-display > .katex { font-size: 0.95em; }
}
.opt-body .katex { font-size: 1.04em; }
.q-text ol, .q-text ul, .explanation ol, .explanation ul { padding-left: 1.3rem; margin: 0.4rem 0; }
.q-text table, .explanation table, .note-body table, .notes-content table {
  border-collapse: collapse;
  margin: 0.8rem 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.q-text td, .q-text th, .explanation td, .explanation th, .note-body td, .note-body th, .notes-content td, .notes-content th {
  border: 1px solid var(--line);
  padding: 0.5rem 0.75rem;
}
.note-body th, .notes-content th {
  background: var(--sunken);
  font-weight: 600;
}

.note { color: var(--muted); font-size: 0.9rem; margin-top: 1rem; }

/* варианты */
.options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; margin-top: 1.1rem; }
.note + .options { margin-top: 0.5rem; }

.opt {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt:hover { border-color: var(--line-strong); background: var(--card); }
.opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-border); }
.opt-body { padding-top: 0.15rem; overflow-wrap: anywhere; min-width: 0; overflow-x: auto; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 1.5rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono, var(--mono, monospace));
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  box-sizing: border-box;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Scoped specifically for quiz option letters (A, B, C, D) */
.opt .badge {
  display: grid;
  place-items: center;
  width: 1.75rem;
  min-width: 1.75rem;
  max-width: 1.75rem;
  height: 1.75rem;
  min-height: 1.75rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}
.single .opt .badge, .single .badge { border-radius: 50%; }
.multiple .opt .badge, .multiple .badge { border-radius: var(--radius-xs); }
.opt:has(input:checked) .badge { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Unified Semantic Status Badges & Pills */
.badge-success, .badge-good, .badge.passed {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

.badge-warning, .badge-urgent, .badge.revise, .badge.pending {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

.badge-danger, .badge-expired, .badge.failed {
  background: rgba(244, 63, 94, 0.12) !important;
  color: #fb7185 !important;
  border-color: rgba(244, 63, 94, 0.35) !important;
}

.badge-muted, .badge-normal {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--muted, #94a3b8) !important;
  border-color: var(--line, rgba(255, 255, 255, 0.1)) !important;
}

.options.pictures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pictures .opt { grid-template-columns: 1fr; justify-items: center; padding: 0.65rem; }
.pictures .badge { justify-self: start; }
.pictures .opt-body img { display: block; border-radius: 8px; }
.pictures .opt-body img.fig { padding: 0; background: transparent; border: 0; }
@media (prefers-color-scheme: dark) { .pictures .opt-body img.fig-png { background: #fff; } }

/* краткий ответ */
.answer-field { margin-top: 1.1rem; }
.format { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.5rem; }
.text-input { max-width: 22rem; font-size: 1.08rem !important; }
.format-warn { color: var(--bad); font-size: 0.88rem; margin-top: 0.45rem; }

/* подсказки и кнопки у задания */
.hints { display: grid; gap: 0.5rem; margin-top: 1rem; }
.hints:not(:has(.hint:not([hidden]))) { display: none; }
.hint {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.96rem;
  animation: appear 0.2s ease-out;
}
.hint-label { font-weight: 600; font-size: 0.8rem; color: var(--accent-ink); margin-bottom: 0.25rem; }

.q-tools { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1.1rem; }
.q-tools:empty, .q-tools:not(:has(button:not([hidden]))) { display: none; }
.check-btn { display: none; }
.mode-practice .check-btn { display: inline-block; }
.mode-practice .q-tools .check-btn { border-color: var(--accent); color: var(--accent-ink); }
.q.locked .q-tools { display: none !important; }
.q.locked, .q.locked .opt, .q.locked label, .q.locked input, .q.locked .text-input, .q.locked .clear-btn, .q.locked .practice-check-btn {
  pointer-events: none !important;
  cursor: default !important;
}
.q.locked .opt:not(.key, .miss):hover { border-color: var(--line); background: var(--sunken); }
.q.locked .opt:not(.key, .miss):has(input:checked) { border-color: var(--line); background: var(--sunken); }

/* разбор */
.review { margin-top: 1.1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem; animation: appear 0.25s ease-out; }
.verdict { font-weight: 600; }
.is-right .verdict { color: var(--ok); }
.is-wrong .verdict { color: var(--bad); }
.key-line strong { font-weight: 600; }

.q.locked .opt.key { border-color: var(--ok); background: var(--ok-soft); }
.q.locked .opt.key .badge { background: var(--ok); border-color: var(--ok); color: var(--card); }
.q.locked .opt.miss { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: var(--bad-soft); }
.q.locked .opt.miss .badge { background: var(--bad); border-color: var(--bad); color: var(--card); opacity: 0.85; }
.text-input.right { border-color: var(--ok); background: var(--ok-soft); }
.text-input.wrong { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: var(--bad-soft); }

.explanation {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.explanation summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-ink);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.explanation summary::-webkit-details-marker { display: none; }
.explanation summary::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.explanation[open] summary::before { transform: rotate(45deg); }
.explanation-body { padding: 0 1rem 1rem; }

/* опора на лекцию в пояснениях: > **Слайд 12.** «…» */
.q-text blockquote, .explanation-body blockquote, .lead blockquote {
  margin: 0;
  padding: 0.65rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.94rem;
}
.lead blockquote { background: var(--accent-soft); border-color: transparent; }
.q-text blockquote > * + *, .explanation-body blockquote > * + * { margin-top: 0.4rem; }
.explanation-body blockquote ul { margin: 0.3rem 0 0; padding-left: 1.2rem; list-style: disc; }
.explanation-body li + li, .q-text li + li { margin-top: 0.3rem; }
.explanation-body table, .q-text table { font-size: 0.92rem; display: block; overflow-x: auto; max-width: 100%; }
.explanation-body th, .q-text th { background: var(--accent-soft); font-weight: 600; text-align: left; }
.explanation-body > * + * { margin-top: 0.6rem; }

.only-wrong .q.is-right { display: none; }

@keyframes appear { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- верхняя панель ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.65rem max(1.25rem, calc((100vw - var(--wide)) / 2 + 1.25rem));
  padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-back {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.35rem 0.8rem;
  margin-left: -0.8rem;
  border-radius: 999px;
  transition: background-color 0.15s;
}
.topbar-back:hover { background: var(--card); color: var(--ink); }
.topbar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted);
}
.topbar-count {
  font: inherit;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s;
}
.topbar-count:hover { transform: translateY(-1px); }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
#progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 0 2px 2px 0; transition: width 0.3s; }

/* ---------- нижняя панель: плавающая ---------- */

.actionbar {
  position: fixed;
  left: 50%;
  bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(calc(var(--wide) - 1.5rem), calc(100% - 1.5rem));
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.6rem 0.6rem 1.2rem;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
}
.started:not(.finished) .actionbar { display: flex; }
.action-note { color: var(--muted); font-size: 0.9rem; flex: 1 1 12rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-left: auto; }

/* ---------- итог ---------- */

.result {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.6rem;
  margin-bottom: 1.5rem;
  display: grid;
  gap: 1.1rem;
}
.score {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
}
.score small {
  display: inline-block;
  vertical-align: middle;
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  margin-left: 0.75rem;
}
.result-facts { color: var(--muted); margin-top: -0.4rem; }
.result-blocks { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.result-block { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.94rem; padding: 0.6rem 0.9rem; background: var(--sunken); }
.result-block + .result-block { border-top: 1px solid var(--line); }
.result-actions { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.94rem; }
.toggle input { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
.save-status { color: var(--muted); font-size: 0.86rem; }
.save-status:empty { display: none; }

/* ---------- карта заданий ---------- */

.map-grid, .result-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); gap: 0.4rem; }
.map-grid button, .result-map button {
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  aspect-ratio: 1;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--ink);
  cursor: pointer;
  position: relative;
  transition: transform 0.12s;
}
.map-grid button:hover, .result-map button:hover { transform: translateY(-1px); }
.map-grid .answered { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.map-grid .right, .result-map .right { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.map-grid .wrong, .result-map .wrong { border-color: transparent; background: var(--bad-soft); color: var(--bad); }
.map-grid .hinted::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

dialog { border: 0; padding: 0; color: var(--ink); background: var(--card); }
dialog::backdrop { background: rgba(12, 10, 24, 0.45); backdrop-filter: blur(3px); }

#map {
  width: min(28rem, 100vw);
  max-height: 80vh;
  margin: auto auto 0;
  border-radius: 24px 24px 0 0;
  padding: 1.2rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-lg);
}
@media (min-width: 40rem) { #map { margin: auto; border-radius: 24px; } }
.map-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-weight: 600; }

#zoom { background: #fff; border-radius: 16px; max-width: 96vw; max-height: 94vh; }
#zoom img { display: block; max-width: 96vw; max-height: 94vh; }

/* ---------- главная ---------- */

.tests { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.tests li { position: relative; }
.tests li::before {
  content: attr(data-num);
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: none;
  z-index: 1;
  transition: background-color 0.15s, color 0.15s, transform 0.15s;
}
.tests li:hover::before { background: var(--accent); color: var(--on-accent); transform: translateY(calc(-50% - 1px)); }
.tests a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 1rem;
  padding: 1.05rem 1.2rem 1.05rem 4.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tests a:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-lg); color: inherit; }
.t-title { font-weight: 600; font-size: 1.08rem; }
.t-meta { grid-column: 1; color: var(--muted); font-size: 0.88rem; }
.t-status { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 0.8rem; font-weight: 500; white-space: nowrap; }
.t-status:not(:empty) { padding: 0.3rem 0.75rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.t-status.done { background: var(--ok-soft); color: var(--ok); }

/* ---------- статистика ---------- */

.admin .sheet { max-width: 60rem; }
.stats th, .stats td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.stats tbody tr:last-child td { border-bottom: 0; }
.stats tbody tr:hover td { background: var(--sunken); }
.stats th { font-weight: 500; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.02em; background: var(--sunken); }
.bar { display: inline-block; height: 0.5rem; background: var(--accent); border-radius: 999px; vertical-align: middle; margin-right: 0.55rem; }
.low { color: var(--bad); font-weight: 600; }
.low .bar { background: var(--bad); }
/* ---------- экран входа в админ-панель (по центру) ---------- */

/* ---------- вкладки админ-панели ---------- */

.admin-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
  flex-wrap: wrap;
}

/* ---------- менеджер тестов ---------- */
.test-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.1rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.test-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}
.test-card-title {
  font-size: 1.12rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

/* ---------- теги и чипы метаданных ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.tag.danger { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.tag.success { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }

.test-card-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.test-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.85rem;
}
.test-card-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
}
.test-card-actions .btn.primary {
  font-weight: 600;
}

/* ---------- фильтры папок / тем ---------- */

/* ---------- современная навигация теста: десктопный сайдбар и мобильный док ---------- */

.quiz-layout {
  display: block;
  width: 100%;
  position: relative;
}
@media (min-width: 58rem) {
  .quiz-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
    max-width: 74rem;
    margin: 0 auto;
    padding: 0 1.5rem;
  }
  .quiz-layout > .sheet {
    flex: 1 1 auto;
    max-width: 46rem;
    margin: 0;
  }
}

.quiz-sidebar {
  display: none;
}
@media (min-width: 58rem) {
  .quiz-sidebar {
    display: block;
    width: 18.5rem;
    position: sticky;
    top: 4.5rem;
    height: fit-content;
    max-height: calc(100vh - 5.5rem);
    z-index: 30;
    flex-shrink: 0;
  }
}

.quiz-sidebar-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.quiz-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.quiz-sidebar-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius);
  background: var(--sunken);
  border: 1px solid var(--line);
  transition: all 0.15s ease;
}
.quiz-sidebar-back:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.quiz-sidebar-badge {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.quiz-sidebar-current-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}
.quiz-sidebar-current-info .current-label {
  color: var(--muted);
  font-size: 0.8rem;
}
.quiz-sidebar-current-info strong {
  color: var(--accent-ink);
  font-weight: 700;
}
.quiz-sidebar-current-info .current-total {
  color: var(--muted);
  margin-left: auto;
  font-size: 0.8rem;
}

.quiz-sidebar-sections {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.quiz-sidebar-sections-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.quiz-sidebar-sections-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 7.5rem;
  overflow-y: auto;
}
.quiz-sidebar-section-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
  width: 100%;
  box-sizing: border-box;
}
.quiz-sidebar-section-link:hover {
  background: var(--sunken);
  color: var(--ink);
}
.quiz-sidebar-section-link.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.quiz-sidebar-section-link .sec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  flex-shrink: 0;
  transition: background 0.12s ease;
}
.quiz-sidebar-section-link.active .sec-dot {
  background: var(--accent);
}
.quiz-sidebar-section-link .sec-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-sidebar-progress-box {
  width: 100%;
}
.quiz-sidebar-progress-bar {
  height: 6px;
  background: var(--sunken);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
#sidebar-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}

.quiz-sidebar-map-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quiz-sidebar-map-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.quiz-sidebar-map-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  max-height: 13rem;
  overflow-y: auto;
  padding: 6px;
  box-sizing: border-box;
}
.quiz-sidebar-map-grid button,
.sheet-map-grid button {
  font: inherit;
  font-size: 0.82rem;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
  padding: 0;
}
.quiz-sidebar-map-grid button:hover,
.sheet-map-grid button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.quiz-sidebar-map-grid button.answered,
.sheet-map-grid button.answered {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok);
  font-weight: 700;
}
.quiz-sidebar-map-grid button.answered:hover,
.sheet-map-grid button.answered:hover {
  background: color-mix(in srgb, var(--ok-soft) 80%, var(--ok));
  border-color: var(--ok);
  color: var(--ok);
}
.quiz-sidebar-map-grid button.flagged,
.sheet-map-grid button.flagged {
  border-color: #d97706;
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}
.quiz-sidebar-map-grid button.current,
.sheet-map-grid button.current {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
  font-weight: 700;
  z-index: 2;
}
.quiz-sidebar-map-grid button.right,
.sheet-map-grid button.right {
  background: var(--good);
  color: #fff;
  border-color: var(--good);
}
.quiz-sidebar-map-grid button.wrong,
.sheet-map-grid button.wrong {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}

.quiz-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}
.quiz-action-btn {
  justify-content: center;
  font-size: 0.86rem;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius);
}

/* Мобильный нижний док (< 58rem) */
.quiz-mobile-dock {
  display: none;
}
@media (max-width: 57.99rem) {
  .quiz-mobile-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--card) 95%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  }
  .mobile-dock-btn {
    flex: 1;
    font-size: 0.82rem;
    padding: 0.45rem 0.4rem;
    justify-content: center;
    white-space: nowrap;
  }
}

/* Выдвижная шторка карты заданий (Bottom Sheet) */
.quiz-bottom-sheet {
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--card);
  box-shadow: var(--shadow-lg);
  width: 100vw;
  max-width: 100vw;
  margin: auto auto 0 auto;
  padding: 1.25rem 1rem 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}
.quiz-bottom-sheet::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}
.sheet-map-handle {
  width: 2.5rem;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 0 auto 0.8rem;
}
.sheet-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.sheet-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
  gap: 0.45rem;
}

/* Модальный диалог карты заданий */
.sheet-map-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  max-width: 26rem;
  width: 90vw;
  margin: auto;
  color: var(--ink);
}
.sheet-map-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}
.sheet-map-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sheet-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-map-title {
  font-weight: 600;
  font-size: 1rem;
}
.sheet-map-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* Карточка завершения теста */
.finish-section {
  margin-top: 2rem;
  margin-bottom: 1.5rem;
}
.finish-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.finish-info {
  flex: 1 1 14rem;
}
.finish-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ---------- современный переключатель вкладок админки (Segmented Control) ---------- */

/* ---------- панель фильтров и KPI статистики ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.kpi-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}
.kpi-val {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}
.kpi-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- компактный аккордеон настроек в карточке задания ---------- */

/* ---------- двухколоночный макет редактора с боковой панелью на десктопе ---------- */

/* ---------- Drag and Drop Reordering ---------- */

/* ---------- Карточка вопроса: подвал и понятные кнопки ---------- */

/* ---------- кнопки сортировки (Reordering) ---------- */

.opt-move-btn, .q-action-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background-color 0.15s;
}
.opt-move-btn:hover, .q-action-btn:hover {
  color: var(--accent-ink);
  background: var(--accent-soft);
}
.q-action-btn.danger:hover {
  color: var(--bad);
  background: var(--bad-soft);
}
.opt-move-btn:disabled, .q-action-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ---------- сворачивание карточек ---------- */

/* ---------- ошибки валидации ---------- */

/* ---------- визуальный редактор (Google Forms style) ---------- */
.opt-note-box {
  margin-left: 2rem;
  margin-bottom: 0.6rem;
}
.opt-note-input {
  font-size: 0.85rem !important;
  color: var(--muted);
}
.image-upload-box {
  background: var(--sunken);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.image-preview-thumb {
  max-height: 4.5rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 2px;
}
.question-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.question-card-footer-btns {
  display: flex;
  gap: 0.4rem;
}


/* ---------- узкие экраны ---------- */

@media (max-width: 34rem) {
  :root { font-size: 16px; }
  .sheet { padding: 1.75rem 0.75rem 9rem; }
  .q { padding: 1.1rem 1rem 1.2rem; border-radius: 18px; }
  .start, .result { padding: 1.2rem; }
  .modes { grid-template-columns: 1fr; }
  .topbar-title { display: none; }
  .topbar-back { flex: 1; margin-left: -0.5rem; }
  .opt { padding: 0.7rem 0.75rem; gap: 0.7rem; }
  .tests a { padding-left: 4.1rem; }
  .tests li::before { left: 0.9rem; width: 2.3rem; height: 2.3rem; }
  .actionbar { padding-left: 1rem; border-radius: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- режим во время прохождения ---------- */

.mode-later { color: var(--muted); font-size: 0.9rem; margin-top: -0.6rem; }
.mode-bar { display: none; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin: 0 0 1rem; }
.started:not(.finished) .mode-bar { display: flex; }
.mode-bar-label { color: var(--muted); font-size: 0.9rem; }
.seg { display: inline-flex; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  font: inherit;
  font-size: 0.9rem;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}
.seg button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); font-weight: 500; }

/* подсказки — в тренировке; уже открытые остаются видны */
.hint-btn { display: none; }
.mode-practice .hint-btn:not([hidden]) { display: inline-block; }

/* ---------- «вернуться позже» ---------- */

.flag-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.q.flagged:not(.locked) .q-num::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}
.map-grid .flagged { border-style: dashed; border-color: var(--accent); }
.finished .flag-btn { display: none; }

/* ---------- примечания к ответам ---------- */

.opt-note, .answer-note {
  font-size: 0.93rem;
  color: var(--ink);
  border-top: 1px dashed var(--line);
  margin-top: 0.5rem;
  padding-top: 0.45rem;
}
.opt-note > * { margin: 0; }
.opt-note > * + * { margin-top: 0.35rem; }
.answer-note { border: 0; margin: 0; padding: 0.55rem 0.8rem; border-radius: var(--radius); background: var(--bad-soft); }
.pictures .opt-note { text-align: left; width: 100%; }

.result-kind { font-weight: 600; color: var(--accent-ink); margin-bottom: -0.5rem; }

/* ========================================================
   ВКЛАДКИ НА ГЛАВНОЙ СТРАНИЦЕ (ТЕСТЫ / КОНСПЕКТЫ)
   ======================================================== */

.home-tabs-bar {
  display: flex;
  gap: 0.5rem;
  background: var(--sunken);
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.home-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.home-tab-btn:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--card) 60%, transparent);
}
.home-tab-btn.active {
  background: var(--card);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.home-tab-count {
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink);
  font-weight: 600;
}
.home-tab-btn.active .home-tab-count {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.home-tab-panel {
  display: none;
}
.home-tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Сетка карточек конспектов на главной */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.note-card-icon {
  font-size: 2rem;
  line-height: 1;
}
.note-card-topic {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-ink);
  margin-bottom: 0.25rem;
}
.note-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
}
.note-card-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  flex-grow: 1;
}
.note-card-footer {
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}
.note-card-action {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-ink);
}

/* ========================================================
   РИДЕР КОНСПЕКТОВ (YouNote Reader)
   ======================================================== */

.notes-body-app {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.notes-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.notes-topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.notes-back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}
.notes-back-link:hover {
  color: var(--accent-ink);
}
.notes-brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}
.notes-mobile-menu-btn {
  display: none;
}

.notes-layout {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 90rem;
  margin: 0 auto;
  align-items: stretch;
}

/* Левый сайдбар YouNote */
.notes-sidebar {
  width: 19rem;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--card);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 3.5rem;
  height: calc(100vh - 3.5rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.notes-sidebar-header {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 2;
  padding-bottom: 0.5rem;
}
.notes-search-input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  box-sizing: border-box;
}
.notes-search-input:focus {
  outline: 2px solid var(--accent);
  background: var(--card);
}
.notes-tree {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.notes-tree-topic {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 0.5rem;
  padding: 0 0.5rem;
}
.notes-tree-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.notes-tree-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9rem;
  transition: all 0.12s ease;
}
.notes-tree-item:hover {
  background: var(--sunken);
  color: var(--accent-ink);
}
.notes-tree-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}
.notes-tree-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* Центральная область чтения */
.notes-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
  display: flex;
  justify-content: center;
}
.notes-article-sheet {
  width: 100%;
  max-width: 50rem;
}
.notes-breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.notes-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}
.notes-breadcrumb a:hover {
  color: var(--ink);
}
.notes-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.notes-hero-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}
.notes-title {
  margin: 0 0 0.75rem;
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.notes-meta-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.notes-desc {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Оглавление внутри статьи (мобильное / инлайн) */
.notes-inline-toc {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.3rem;
  margin-bottom: 2rem;
}
.notes-inline-toc-title {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.6rem;
}
.notes-inline-toc ul {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}
.notes-inline-toc a {
  color: var(--accent-ink);
  text-decoration: none;
}
.notes-inline-toc a:hover {
  text-decoration: underline;
}

/* Оформление текста конспекта */
.notes-body {
  font-size: 1.05rem;
  line-height: 1.7;
}
.notes-body h1, .notes-body h2, .notes-body h3 {
  letter-spacing: -0.015em;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
}
.notes-body h2 {
  font-size: 1.55rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
}
.notes-body h3 {
  font-size: 1.25rem;
}
.notes-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.notes-body th, .notes-body td {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  text-align: left;
}
.notes-body table th {
  background: var(--sunken);
  font-weight: 600;
}
.notes-body code {
  background: var(--sunken);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Callout-блоки (Заметки, Советы, Важно) */
.note-callout {
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.callout-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}
.callout-body p {
  margin: 0 0 0.6rem 0;
  font-size: 0.95rem;
  line-height: 1.55;
}
.callout-body p:last-child {
  margin-bottom: 0;
}
.callout-body ul, .callout-body ol {
  margin: 0.4rem 0 0.6rem 1.3rem;
  padding: 0;
}
.callout-body ul:last-child, .callout-body ol:last-child {
  margin-bottom: 0;
}
.callout-note {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.callout-tip {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  color: var(--text);
}
.callout-important {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  color: var(--text);
}
.callout-warning {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  color: var(--text);
}
.callout-caution {
  border-left-color: #dc2626;
  background: rgba(220, 38, 38, 0.12);
  color: var(--text);
}

/* Правая колонка TOC на широких экранах */
.notes-toc-sidebar {
  width: 16rem;
  flex-shrink: 0;
  padding: 2rem 1.25rem;
  position: sticky;
  top: 3.5rem;
  height: calc(100vh - 3.5rem);
  overflow-y: auto;
}
.notes-toc-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.8rem;
}
.notes-toc-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.toc-link {
  font-size: 0.86rem;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.12s;
}
.toc-link:hover {
  color: var(--accent-ink);
}
.toc-link-3 {
  padding-left: 0.8rem;
}

.notes-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 68rem) {
  .notes-toc-sidebar { display: none; }
}
@media (max-width: 52rem) {
  .notes-layout { flex-direction: column; }
  .notes-sidebar { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .notes-content { padding: 1.25rem 1rem; }
}

/* ========================================================
/* ========================================================
   РЕДАКТОР КОНСПЕКТОВ В АДМИНКЕ (Word-like Document Editor)
   ======================================================== */

/* Таблицы в Markdown и конспектах */
.notes-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}

.notes-body table th, .notes-body table td {
  border: 1px solid var(--line);
  padding: 0.6rem 0.85rem;
  text-align: left;
}

.notes-body table th {
  background: var(--sunken);
  font-weight: 600;
  color: var(--ink);
}

.notes-body table tr:nth-child(even) td {
  background: color-mix(in srgb, var(--sunken) 40%, transparent);
}

/* Навигация внизу конспекта */
.notes-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.notes-nav-slot {
  flex: 1;
  display: flex;
}

.notes-nav-slot:last-child {
  justify-content: flex-end;
}

/* ========================================================
   МОДАЛЬНОЕ ОКНО ПРЕДПРОСМОТРА В АДМИНКЕ
   ======================================================== */

/* ==========================================================================
   КОЛЛОКВИУМЫ: ГЛАВНАЯ СТРАНИЦА, КАРТОЧКИ (QUIZLET) И СПРАВОЧНИК
   ========================================================================== */

/* ---------- Главная страница: карточки коллоквиумов ---------- */
.colloquiums-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}
.colloquium-promo-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.colloquium-promo-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.colloquium-promo-card.full-width {
  grid-column: 1 / -1;
  background: var(--card);
  border-color: var(--accent-soft);
}
.colloquium-promo-icon {
  font-size: 2.25rem;
  line-height: 1;
  margin-bottom: 0.85rem;
}
.colloquium-promo-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.colloquium-promo-body h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--ink);
}
.colloquium-promo-body p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 1.25rem;
  flex: 1;
}
.colloquium-promo-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

/* ---------- Страница коллоквиумов: шапка и переключатель ---------- */
.colloquiums-app {
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.colloquiums-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.colloquiums-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.colloquiums-back-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.colloquiums-back-link:hover {
  color: var(--accent);
}
.colloquiums-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.colloquiums-mode-tabs {
  display: flex;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  gap: 0.2rem;
}
.colloquiums-mode-btn {
  background: none;
  border: none;
  padding: 0.38rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
}
.colloquiums-mode-btn.active {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.colloquiums-mode-btn:hover:not(.active) {
  color: var(--ink);
}

.colloquiums-container {
  width: 100%;
  max-width: 54rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
  flex: 1;
}

/* ---------- Панель фильтров и поиска ---------- */
.colloquiums-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.colloquiums-col-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.col-pill-btn {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.col-pill-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.col-pill-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.colloquiums-search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 16rem;
  flex: 1;
  max-width: 22rem;
}
.colloquiums-search-input {
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 0.85rem;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.colloquiums-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.clear-search-btn {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
}

/* ---------- 3D-КАРТОЧКИ (QUIZLET FLASHCARDS) ---------- */
.cards-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.card-counter-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.95rem;
}
.card-counter-label {
  color: var(--muted);
}
.card-counter-val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}
.cards-counters-stats {
  display: flex;
  gap: 0.5rem;
}
.counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.counter-badge.known {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.25);
}
.counter-badge.repeat {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.25);
}

.cards-progress-bar-track {
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.cards-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

.quizlet-card-stage {
  perspective: 1200px;
  width: 100%;
  height: 380px;
  min-height: 380px;
  margin: 0 auto 1.5rem;
}
.quizlet-card {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  user-select: none;
  outline: none;
}
.quizlet-card:focus-visible .quizlet-card-face {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.quizlet-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: left;
  transition: transform 0.45s cubic-bezier(0.34, 1.15, 0.64, 1);
  transform-style: preserve-3d;
  border-radius: var(--radius-lg);
}
.quizlet-card.flipped .quizlet-card-inner {
  transform: rotateY(180deg);
}

.quizlet-card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 2px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.quizlet-card:hover .quizlet-card-face {
  border-color: var(--line-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

.card-face-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.card-col-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--sunken);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.badge-status-dot {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.badge-status-dot.known {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}
.badge-status-dot.repeat {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

/* Лицевая сторона */
.quizlet-card-front .card-face-body {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 1rem 0;
}
.card-term-title {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
}
.card-face-footer {
  text-align: center;
}
.card-hint-text {
  font-size: 0.82rem;
  color: var(--muted);
  user-select: none;
}
.card-hint-text kbd {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.78rem;
}

/* Оборотная сторона */
.quizlet-card-back {
  transform: rotateY(180deg);
}
.card-term-sub {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
}
.quizlet-card-back .card-face-body.back-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.25rem 0.75rem 0;
  margin: 0.5rem 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
}
.card-def-wrap {
  margin-bottom: 0.75rem;
}
.card-def-wrap p {
  margin: 0 0 0.65rem;
}
.card-def-wrap ul, .card-def-wrap ol {
  margin: 0.35rem 0 0.65rem 1.25rem;
  padding: 0;
}
.card-def-wrap li {
  margin-bottom: 0.25rem;
}
.card-ex-wrap {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.92rem;
}
.card-examples-heading {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

/* Кнопки управления карточками */
.cards-action-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.card-nav-btn {
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.55rem 1.15rem;
}
.card-marking-actions {
  display: flex;
  gap: 0.65rem;
}
.mark-btn {
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  transition: transform 0.15s ease, background 0.15s ease;
}
.mark-repeat-btn {
  border-color: rgba(245, 158, 11, 0.4);
  color: #b45309;
}
.mark-repeat-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: #f59e0b;
}
.mark-known-btn {
  border-color: rgba(34, 197, 94, 0.4);
  color: #15803d;
}
.mark-known-btn:hover {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
}
.btn-pop {
  transform: scale(0.95);
}

.cards-keyboard-hints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.5rem;
}
.kb-hint-item kbd {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.76rem;
  color: var(--ink);
}

/* ---------- СПРАВОЧНИК / СБОРНИК ОПРЕДЕЛЕНИЙ ---------- */
.dict-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-soft);
}
.dict-count-info {
  font-size: 0.92rem;
  color: var(--muted);
}
.dict-count-info strong {
  color: var(--ink);
}
.dict-toggle-all-wrap {
  display: flex;
  gap: 0.5rem;
}
.dict-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.dict-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.dict-item:hover {
  border-color: var(--line-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.dict-item.open {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(91, 63, 217, 0.12);
}
.dict-item-header {
  width: 100%;
  background: none;
  border: none;
  padding: 1rem 1.25rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  color: var(--ink);
}
.dict-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.dict-col-pill {
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--sunken);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.dict-status-icon {
  font-size: 0.85rem;
}
.dict-item-term {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  color: var(--ink);
}
.dict-chevron {
  font-size: 0.95rem;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.dict-item.open .dict-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}
.dict-item-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.btn-to-flashcard {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--accent);
  border: 1px solid var(--line);
  transition: all 0.15s ease;
}
.btn-to-flashcard:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.dict-item-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.96rem;
  line-height: 1.6;
}
.dict-def-wrap {
  margin-top: 0.85rem;
}
.dict-def-wrap p {
  margin: 0 0 0.5rem;
}
/* Длинные формулы в определениях не должны распирать карточку —
   разрешаем горизонтальную прокрутку и перенос. */
.dict-def-wrap,
.card-back-def,
.card-examples-content {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}
.dict-ex-wrap {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  margin-top: 0.75rem;
  font-size: 0.92rem;
}
.dict-ex-heading {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.dict-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

/* ========================================================
   КОМПЛЕКСНАЯ МОБИЛЬНАЯ АДАПТАЦИЯ (MOBILE FIRST UI/UX)
   ======================================================== */

button, input, select, textarea, a, .opt, .col-pill-btn, .home-tab-btn, .quizlet-card-face {
  touch-action: manipulation;
}

@media (max-width: 768px) {
  :root {
    --wide: 100%;
  }

  /* Защита от авто-зума на iOS при фокусе в поле ввода */
  input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    font-size: 16px !important;
  }

  /* Безопасные отступы для iPhone (Safe Area Insets) */
  .topbar:not(.platform-topbar), .notes-topbar, .colloquiums-topbar, .admin-topbar {
    padding-top: max(0.6rem, env(safe-area-inset-top));
    padding-left: max(0.85rem, env(safe-area-inset-left));
    padding-right: max(0.85rem, env(safe-area-inset-right));
  }

  .sheet {
    padding-left: max(0.85rem, env(safe-area-inset-left));
    padding-right: max(0.85rem, env(safe-area-inset-right));
    padding-bottom: max(6rem, calc(5rem + env(safe-area-inset-bottom)));
  }

  /* Формулы KaTeX: плавный горизонтальный скролл на смартфонах */
  .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding: 0.4rem 0;
    margin: 0.6rem 0;
  }
  .katex {
    max-width: 100%;
  }

  /* ---------- 1. Главная страница (Студент) ---------- */
  .intro h1 {
    font-size: 1.55rem;
    line-height: 1.25;
  }
  .intro .lead {
    font-size: 0.95rem;
  }
  .home-tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding: 0.25rem;
    gap: 0.35rem;
  }
  .home-tabs-bar::-webkit-scrollbar {
    display: none;
  }
  .home-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
  }
  .topic-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 0.25rem;
  }
  .topic-filters::-webkit-scrollbar {
    display: none;
  }
  .topic-filter-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .tests a {
    padding-left: 3.8rem;
    padding-right: 0.85rem;
    min-height: 3.5rem;
  }
  .tests li::before {
    left: 0.75rem;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.85rem;
  }
  .notes-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .colloquiums-home-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .colloquium-promo-card {
    padding: 1.2rem 1rem;
  }
  .colloquium-promo-footer {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  .colloquium-promo-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* ---------- 2. Прохождение теста ---------- */
  .q {
    padding: 1.15rem 0.95rem;
    border-radius: 16px;
    margin-bottom: 1rem;
  }
  .q-text {
    font-size: 1rem;
  }
  .opt {
    min-height: 48px;
    padding: 0.75rem 0.85rem;
    gap: 0.75rem;
    border-radius: 12px;
  }
  .opt .badge {
    width: 1.9rem;
    height: 1.9rem;
  }
  .q-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .q-tools .btn {
    flex: 1 1 calc(50% - 0.4rem);
    justify-content: center;
    padding: 0.5rem 0.6rem;
    font-size: 0.82rem;
  }
  .actionbar {
    left: 0.75rem;
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    border-radius: 18px;
    padding: 0.65rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .actionbar .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  /* ---------- 3. Конспекты и теория (YouNote) ---------- */
  .notes-topbar {
    padding: max(0.6rem, env(safe-area-inset-top)) 1rem 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .notes-mobile-menu-btn {
    display: inline-flex !important;
  }
  .notes-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 85vw;
    max-width: 320px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--line);
    padding-top: max(1.2rem, env(safe-area-inset-top));
  }
  .notes-sidebar.open {
    transform: translateX(0);
  }
  .notes-content {
    padding: 1.25rem 0.85rem 4rem;
  }
  .notes-article-sheet {
    max-width: 100%;
  }
  .notes-header .notes-title {
    font-size: 1.45rem;
  }
  .notes-footer-nav {
    flex-direction: column;
    gap: 0.6rem;
    align-items: stretch;
  }
  .notes-footer-nav .notes-nav-slot {
    width: 100%;
  }
  .notes-footer-nav .btn {
    width: 100%;
    justify-content: center;
  }

  /* ---------- 4. Коллоквиумы (Quizlet и Справочник) ---------- */
  .colloquiums-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: max(0.6rem, env(safe-area-inset-top)) 1rem 0.6rem;
  }
  .colloquiums-topbar-left {
    justify-content: space-between;
  }
  .colloquiums-mode-tabs {
    width: 100%;
    display: flex;
  }
  .colloquiums-mode-btn {
    flex: 1;
    justify-content: center;
  }
  .colloquiums-container {
    padding: 1.25rem 0.85rem 4rem;
  }
  .colloquiums-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .colloquiums-col-pills {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 0.25rem;
  }
  .colloquiums-col-pills::-webkit-scrollbar {
    display: none;
  }
  .col-pill-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .colloquiums-search-box {
    min-width: 100%;
    max-width: 100%;
  }
  .quizlet-card-stage {
    height: 380px;
    min-height: 380px;
    max-height: 56vh;
  }
  .quizlet-card-face {
    padding: 1.35rem 1rem;
    border-radius: 18px;
  }
  .card-term-title {
    font-size: 1.28rem;
    line-height: 1.35;
  }
  .cards-action-toolbar {
    flex-direction: column;
    gap: 0.65rem;
  }
  .card-marking-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }
  .card-marking-actions .mark-btn {
    flex: 1;
    min-height: 48px;
    font-size: 0.95rem;
    font-weight: 600;
    justify-content: center;
  }
  .card-nav-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
  .dict-item-header {
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .dict-item-term {
    font-size: 1.02rem;
  }
  .dict-item-body {
    padding: 0 1rem 1rem;
  }

  /* ---------- 5. Панель преподавателя (Admin) ---------- */
  .test-card {
    padding: 1.15rem 1rem;
  }
  .test-card-actions {
    gap: 0.4rem;
  }
  .test-card-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* ==========================================================================
   SORT-ME.ORG INSPIRED PLATFORM STYLES:
   NAVBAR, HERO, LEADERBOARD, PROFILE, CONTESTS, AUTH MODAL
   ========================================================================== */

/* ---------- 1. Платформенный Navbar ---------- */

.topbar-inner {
  /* Хедер несёт класс .topbar, который задаёт display:flex, поэтому .topbar-inner
     становится flex-элементом и без width:100% сжимается по содержимому —
     тогда max-width, margin:auto и space-between ниже не дают никакого эффекта. */
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  min-height: var(--topbar-h, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-sizing: border-box;
}

.topbar-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.platform-burger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.38rem 0.75rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.platform-burger:hover,
.platform-burger.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.topbar-nav-footer {
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

/* User Capsule in Topbar */

.btn-logout {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--muted);
}

.btn-logout:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Subtopbar for quizzes inside platform layout */
.quiz-subtopbar {
  position: sticky;
  top: 52px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.quiz-subtopbar-inner {
  max-width: var(--wide);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1.25rem;
  box-sizing: border-box;
}

.quiz-subtopbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.quiz-subtopbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.quiz-subtopbar .topbar-back {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  transition: all 0.15s ease;
}

.quiz-subtopbar .topbar-back:hover {
  background: var(--line);
  color: var(--ink);
}

.quiz-subtopbar .topbar-title {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.quiz-subtopbar .topbar-count {
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.quiz-subtopbar .progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
}

.quiz-subtopbar .progress > div {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.2s ease;
}

.quiz.platform-body .sheet {
  padding-top: 1.5rem;
}

/* Quick Access Portal Grid (4 Key Course Sections) */
.portal-modules-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.portal-module-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.portal-module-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}

.portal-module-card.highlight {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: var(--card);
}

.portal-module-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.portal-module-body {
  flex: 1;
  min-width: 0;
}

.portal-module-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  color: var(--ink);
}

.portal-module-sub {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-module-arrow {
  color: var(--muted);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.portal-module-card:hover .portal-module-arrow {
  transform: translateX(3px);
  color: var(--accent-ink);
}

@media (max-width: 64rem) {
  .portal-modules-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 36rem) {
  .portal-modules-grid {
    grid-template-columns: 1fr;
  }
  .quiz-subtopbar .topbar-title {
    display: none;
  }
}

/* ---------- 2. Главная страница (Портал & Hero) ---------- */

/* Карточка модуля — целиком ссылка: кликабельна вся площадь, а не кнопка
   в подвале. Поэтому сбрасываем цвет и подчёркивание ссылки. */

/* Бывшая кнопка в подвале: теперь только визуальная подсказка «сюда можно
   нажать» — вложенная ссылка внутри ссылки была бы невалидной разметкой. */

.platform-container {
  max-width: 78rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem;
}

/* Active contest notification banner */

.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
}

.live-dot.pulse {
  animation: pulseDot 1.4s infinite ease-in-out;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.home-contest-title {
  margin: 0 0 0.2rem 0;
  font-size: 1.15rem;
}

/* Student Snapshot Card on Main Page */

/* Portal 2-Column Layout */

.portal-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 1.75rem;
  align-items: flex-start;
}

/* ---------- 3. Страница Рейтинга (Leaderboard) ---------- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  font-family: var(--font-display, inherit);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem 0;
}

.page-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 45rem;
}

.rating-rule-pill {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--sunken);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.leaderboard-toolbar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.groups-filter-scroll {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 0.2rem;
}

.group-filter-pill {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.group-filter-pill:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.group-filter-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.leaderboard-search-input {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--sunken);
  font-size: 0.85rem;
  width: 240px;
}

.leaderboard-card-wrapper {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
}

.leaderboard-table td {
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr:hover {
  background: var(--sunken);
}

.top-rank-1 {
  background: rgba(234, 179, 8, 0.08);
}
.top-rank-2 {
  background: rgba(148, 163, 184, 0.08);
}
.top-rank-3 {
  background: rgba(217, 119, 6, 0.08);
}

.is-me-row {
  background: rgba(59, 130, 246, 0.08) !important;
  font-weight: 600;
}

.rank-badge {
  font-size: 1.1rem;
  font-weight: 700;
}

.group-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-family: monospace;
}

.rating-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

.me-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #3b82f6;
  color: #fff;
  margin-left: 0.45rem;
}

/* ---------- 4. Страница Профиля (Profile) ---------- */

.profile-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.profile-card-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.profile-avatar-lg {
  font-size: 3rem;
  line-height: 1;
}

.profile-name {
  font-family: var(--font-display, inherit);
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 0.35rem 0;
}

.profile-meta-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meta-pill {
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--muted);
}

.meta-pill.group {
  font-weight: 700;
  color: var(--ink);
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.profile-stat-box {
  display: flex;
  flex-direction: column;
}

.stat-box-val {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--ink);
}

.stat-box-val.highlight {
  color: var(--accent);
}

.stat-box-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-section {
  margin-bottom: 2.5rem;
}

.profile-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1.15rem 0;
}

.profile-topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.profile-topic-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.profile-topic-card.passed {
  border-color: rgba(34, 197, 94, 0.4);
}

.profile-topic-card.in-progress {
  border-color: rgba(249, 115, 22, 0.4);
}

.topic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.topic-tag {
  font-size: 0.75rem;
  color: var(--muted);
}

.topic-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.topic-status-pill.passed {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.topic-status-pill.in-progress {
  background: rgba(249, 115, 22, 0.15);
  color: #ea580c;
}

.topic-status-pill.not-started {
  background: var(--sunken);
  color: var(--muted);
}

.topic-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.85rem 0;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--sunken);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.topic-score-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
}

.profile-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.profile-table th {
  padding: 0.75rem 1rem;
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}

.profile-table td {
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--line);
}

.profile-auth-prompt {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  max-width: 32rem;
  margin: 2rem auto;
}

.prompt-icon {
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
}

/* ---------- 5. Онлайн-квизы ---------- */

.contest-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.contest-card.live {
  border: 2px solid #22c55e;
  background: var(--card);
}

.contest-card.finished {
  opacity: 0.85;
}

.contest-card-title {
  margin: 0 0 0.35rem 0;
  font-size: 1.15rem;
}

.contest-card-meta {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.contest-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* Contest Room */

.contest-room-body {
  padding: 0;
  margin: 0;
}

.contest-room-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 2px solid var(--line);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.contest-room-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.contest-exit-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.contest-exit-link:hover {
  color: var(--ink);
}

.contest-group-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--sunken);
  border: 1px solid var(--line);
}

.contest-timer-badge {
  background: var(--sunken);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 800;
}

.contest-timer-badge.warning {
  border-color: #ef4444;
  color: #ef4444;
  animation: pulseTimer 1s infinite;
}

@keyframes pulseTimer {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.contest-room-layout {
  max-width: 52rem;
  margin: 1.5rem auto 5rem;
  padding: 0 1rem;
}

.contest-room-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 0.75rem 1.5rem;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.contest-footer-inner {
  max-width: 52rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.contest-result-card {
  text-align: center;
  background: var(--card);
  border: 2px solid #22c55e;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  margin: 2rem auto;
}

.result-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.result-score {
  font-size: 1.5rem;
  margin: 0.75rem 0;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* ---------- 6. Модальное окно авторизации (Auth Modal) ---------- */

.auth-modal-dialog, .standings-modal-dialog {
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  background: transparent;
  max-width: 32rem;
  width: min(32rem, calc(100vw - 1.5rem));
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.standings-modal-dialog {
  max-width: 48rem;
  width: min(48rem, calc(100vw - 1.5rem));
}

.auth-modal-dialog::backdrop, .standings-modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.auth-modal-box, .standings-modal-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  box-sizing: border-box;
  max-width: 100%;
}

.auth-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  line-height: 1;
  font-size: 1.15rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  z-index: 20;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.auth-close-btn:hover {
  color: var(--ink);
  background: var(--sunken);
  border-color: var(--accent);
}

.auth-modal-header {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  position: relative;
  max-width: 100%;
}

.standings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-right: 2.5rem;
  position: relative;
  max-width: 100%;
}

.auth-modal-title {
  margin: 0;
  /* Отступ под кнопку закрытия держим на заголовке, а не на всём header:
     иначе сегмент-контрол «Вход / Регистрация» уже полей ввода под ним. */
  padding-right: 2.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.auth-tabs {
  /* Сегмент-контрол: две вкладки делят ширину поровну. Перенос строк оставлен
     на случай длинных подписей на узких экранах. */
  display: flex;
  flex-wrap: wrap;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  gap: 0.25rem;
  width: 100%;
  box-sizing: border-box;
}

.auth-tab-btn {
  border: 0;
  /* flex-basis: 0 — обе вкладки ровно по половине ширины независимо от
     длины подписи («Вход» и «Регистрация» одинаковые). */
  flex: 1 1 0;
  min-width: 0;
  background: transparent;
  padding: 0.45rem 0.8rem;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-tab-btn:hover {
  color: var(--ink);
}

.auth-tab-btn.active {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Второстепенные действия формы («Забыли пароль?», «Назад ко входу») —
   текстовые ссылки под соответствующим полем, а не отдельные вкладки. */
.auth-inline-link {
  align-self: flex-start;
  margin-top: 0.4rem;
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}

.auth-inline-link:hover {
  text-decoration: underline;
}

.auth-back-link {
  align-self: center;
  color: var(--muted);
}

/* ---------- Вход через Telegram ---------- */

.auth-social {
  margin-top: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

/* Разделитель «или»: линия слева и справа от подписи. */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  color: var(--muted);
  font-size: 0.78rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1 1 0;
  height: 1px;
  background: var(--line);
}

/* Виджет Telegram приходит как iframe фиксированной ширины — центрируем. */
.auth-telegram-mount {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 2.5rem;
}

.auth-telegram-mount iframe {
  max-width: 100%;
}

.auth-telegram-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.form-input {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.form-error {
  font-size: 0.82rem;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

/* ---------- 7. Адаптивность для мобильных телефонов ---------- */

@media (max-width: 1024px) {
  .platform-burger {
    display: inline-flex;
  }
}

@media (max-width: 768px) {

  .portal-layout {
    grid-template-columns: 1fr;
  }

  .profile-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }

  .profile-card-main {
    flex-direction: column;
    text-align: center;
  }

  .profile-meta-pills {
    justify-content: center;
  }

  .contest-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .contest-card-actions {
    width: 100%;
  }

  .contest-card-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .contest-room-topbar {
    padding: 0.65rem 1rem;
  }

  .contest-timer-badge {
    padding: 0.25rem 0.65rem;
    font-size: 1.05rem;
  }

  /* Admin panel mobile responsiveness */
  .admin-topbar {
    padding: 0.65rem 1rem;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .admin .sheet {
    padding: 1.25rem 0.85rem 4rem;
  }

  .admin-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    gap: 0.4rem;
    scrollbar-width: none;
  }

  .admin-tabs::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 480px) {
  .topbar-inner {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .auth-modal-box {
    padding: 1.25rem 0.85rem;
  }

  .auth-close-btn {
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    font-size: 1rem;
  }

  .auth-modal-header {
    margin-bottom: 1rem;
    gap: 0.65rem;
  }

  .auth-modal-title {
    padding-right: 2.25rem;
    font-size: 1.15rem;
  }

  .auth-tabs {
    gap: 0.25rem;
  }

  .auth-tab-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
  }
}

/* ---------- 7. Pretest Modal Card & Favorites ---------- */

.pretest-modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2.5rem;
  box-shadow: var(--shadow-lg);
  max-width: 36rem;
  margin: 1.5rem auto 3rem;
}

.pretest-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.favorite-btn {
  color: var(--muted);
  transition: all 0.15s ease;
}

.favorite-btn:hover {
  color: #f59e0b;
}

.favorite-btn.active, .favorite-btn[aria-pressed="true"] {
  color: #d97706;
  background: #fef3c7;
  border-color: #fde68a;
  font-weight: 600;
}

.restore-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.restore-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 8. Каталог тренажёров и Генератор тестов ---------- */

.test-generator-card {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.generator-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.generator-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.generator-title {
  margin: 0 0 0.35rem 0;
  font-size: 1.35rem;
}

.generator-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 52rem;
}

.generator-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.generator-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.generator-label {
  font-weight: 600;
  font-size: 0.88rem;
  min-width: 170px;
  color: var(--ink);
}

.generator-pills {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.gen-pill {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.gen-pill:hover {
  border-color: var(--line-strong);
}

.gen-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.gen-select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  min-width: 280px;
}

.tests-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tests-search-input {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  min-width: 240px;
}

.tests-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.25rem;
}

.test-catalog-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: var(--shadow);
}

.test-catalog-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-strong);
}

.test-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.test-topic-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--muted);
}

.test-status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--muted);
}

.test-status-badge.in-progress {
  background: rgba(234, 179, 8, 0.15);
  color: #b45309;
}

.test-status-badge.done {
  background: var(--ok-soft);
  color: var(--ok);
}

.test-status-badge.attempted {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.test-catalog-title {
  margin: 0 0 0.45rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.test-catalog-title a {
  text-decoration: none;
  color: var(--ink);
}

.test-catalog-title a:hover {
  color: var(--accent);
}

.test-catalog-desc {
  margin: 0 0 1rem 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
}

.test-catalog-footer {
  display: flex;
  justify-content: flex-start;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.test-tasks-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

/* Favorites Grid */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.favorite-item-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.favorite-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.favorite-q-badge {
  color: #d97706;
}

.favorite-snippet {
  margin: 0 0 0.85rem 0;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.4;
}

/* Weak Spots Problem Areas in Profile */
.problem-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--bad);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.problem-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.problem-card-q {
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.problem-card-footer {
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   8. ПРАКТИКИ И СЕМИНАРЫ (PRACTICES)
   ========================================================================== */

.practices-subbar,
.homeworks-subbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 1.5rem;
  height: var(--subbar-h, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: var(--topbar-h, 56px);
  z-index: 85;
  box-sizing: border-box;
}

.practices-subbar-title,
.homeworks-subbar-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.practices-subbar-controls,
.homeworks-subbar-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.group-filter-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.group-filter-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.practices-mobile-menu-btn,
.homeworks-mobile-menu-btn {
  display: none;
}

.practices-layout,
.homeworks-layout {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 96rem;
  margin: 0 auto;
  align-items: stretch;
  min-height: calc(100vh - var(--topbar-h, 56px) - var(--subbar-h, 52px));
}

.practices-sidebar,
.homeworks-sidebar {
  width: 21rem;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--sunken);
  overflow-y: auto;
  position: sticky;
  top: calc(var(--topbar-h, 56px) + var(--subbar-h, 52px));
  height: calc(100vh - var(--topbar-h, 56px) - var(--subbar-h, 52px));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.practices-sidebar-header,
.homeworks-sidebar-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
  box-sizing: border-box;
}

.practices-list,
.homeworks-cards-list {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.practices-topic-group {
  margin-bottom: 0.75rem;
}

.practices-topic-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  margin-bottom: 0.25rem;
}

.practice-nav-card {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.practice-nav-card:hover {
  border-color: var(--accent);
  background: var(--bg);
  transform: translateY(-1px);
}

.practice-nav-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.practice-card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.practice-card-icon {
  font-size: 1.1rem;
  line-height: 1.2;
}

.practice-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.practices-content,
.homeworks-content {
  flex: 1;
  min-width: 0;
  padding: 2.25rem 2.5rem;
  overflow-y: auto;
  background: var(--bg);
  box-sizing: border-box;
}

.practices-article-sheet,
.homeworks-detail-sheet {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.75rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.practice-header,
.hw-detail-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
}

.practice-meta-row,
.hw-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.practice-main-title,
.hw-main-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

/* ==========================================================================
   9. ДОМАШНИЕ ЗАДАНИЯ (HOMEWORKS & SUBMISSIONS)
   ========================================================================== */

.hw-nav-card {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hw-nav-card:hover {
  border-color: var(--accent);
  background: var(--bg);
  transform: translateY(-1px);
}

.hw-nav-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.hw-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.hw-card-topic {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.hw-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.hw-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.82rem;
}

.hw-max-score {
  font-weight: 600;
  color: var(--muted);
}

.hw-status-badge {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.hw-status-badge.status-none {
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--muted);
}

.hw-status-badge.status-pending {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.hw-status-badge.status-passed {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.hw-status-badge.status-revise {
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.35);
  color: #fb923c;
}

.hw-status-badge.status-failed {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

/* Meta badges in Homeworks and Practices (engineering micro-badges) */
.hw-meta-row .badge,
.practice-meta-row .badge,
.hw-meta-row .badge-deadline,
.badge-topic,
.badge-group-info,
.badge-score,
.badge-deadline {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.35rem !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 1.65rem !important;
  max-width: 100% !important;
  padding: 0.22rem 0.65rem !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--mono) !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  border: 1px solid var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
}

.hw-meta-row .badge-topic,
.practice-meta-row .badge-topic,
.badge-topic {
  background: var(--accent-soft) !important;
  border-color: var(--accent-border) !important;
  color: var(--accent) !important;
}

.hw-meta-row .badge-group-info,
.practice-meta-row .badge-group-info,
.badge-group-info {
  background: var(--sunken) !important;
  border-color: var(--line) !important;
  color: var(--muted) !important;
}

.hw-meta-row .badge-score,
.badge-score {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fbbf24 !important;
}

@media (prefers-color-scheme: dark) {
  .hw-meta-row .badge-score,
  .badge-score {
    color: #fbbf24 !important;
  }
}

.badge-deadline.badge-normal {
  background: var(--sunken) !important;
  border-color: var(--line) !important;
  color: var(--muted) !important;
}

.badge-deadline.badge-urgent {
  background: rgba(244, 63, 94, 0.12) !important;
  border-color: rgba(244, 63, 94, 0.4) !important;
  color: #fb7185 !important;
}

.badge-deadline.badge-expired {
  background: rgba(244, 63, 94, 0.08) !important;
  border-color: rgba(244, 63, 94, 0.25) !important;
  color: #f43f5e !important;
}

@media (max-width: 640px) {
  .hw-meta-row .badge,
  .practice-meta-row .badge,
  .badge-topic,
  .badge-group-info,
  .badge-score,
  .badge-deadline {
    font-size: 0.78rem !important;
    padding: 0.2rem 0.6rem !important;
    min-height: 1.65rem !important;
  }
}

/* Submission Section */
.hw-submission-section {
  margin-top: 2.25rem;
  border-top: 2px dashed var(--line);
  padding-top: 1.75rem;
}

.hw-auth-callout {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.hw-auth-callout-icon {
  font-size: 2.2rem;
}

.hw-auth-callout-text h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.hw-auth-callout-text p {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.hw-current-submission-card {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
}

.hw-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.hw-sub-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.hw-sub-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.hw-file-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
}

.hw-teacher-feedback {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--card);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.hw-teacher-feedback .feedback-title {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
  color: var(--ink);
}

.hw-teacher-feedback .feedback-text {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink);
}

/* Upload Box */
.hw-upload-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.hw-upload-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--ink);
}

.hw-upload-desc {
  margin: 0 0 1.25rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.pdf-dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  background: var(--sunken);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdf-dropzone:hover,
.pdf-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.dropzone-icon {
  font-size: 2.5rem;
}

.dropzone-text {
  font-size: 0.98rem;
  color: var(--ink);
}

.dropzone-limit {
  font-size: 0.82rem;
  color: var(--muted);
}

.selected-file-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.65rem 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.selected-file-row .file-icon {
  font-size: 1.2rem;
}

.selected-file-row .file-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
}

.selected-file-row .file-size {
  font-size: 0.82rem;
  color: var(--muted);
}

.selected-file-row .file-remove-btn {
  margin-left: auto;
  color: var(--bad);
}

.upload-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.25rem;
}

.upload-feedback {
  font-size: 0.9rem;
  font-weight: 600;
}

.upload-feedback.error {
  color: #ef4444;
}

.upload-feedback.success {
  color: #22c55e;
}

.upload-feedback.info {
  color: var(--accent);
}

/* Mobile responsive for practices & homeworks */
@media (max-width: 900px) {
  .practices-layout,
  .homeworks-layout {
    flex-direction: column;
  }

  .practices-sidebar,
  .homeworks-sidebar {
    position: fixed;
    top: calc(var(--topbar-h, 56px) + var(--subbar-h, 52px));
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - var(--topbar-h, 56px) - var(--subbar-h, 52px));
    z-index: 95;
    display: none;
    background: var(--card);
  }

  .practices-sidebar.open,
  .homeworks-sidebar.open {
    display: flex;
  }

  .practices-mobile-menu-btn,
  .homeworks-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  }

  .practices-content,
  .homeworks-content {
    padding: 1.25rem 1rem;
  }

  .practices-article-sheet,
  .homeworks-detail-sheet {
    padding: 1.5rem 1.25rem;
  }

  .practice-main-title,
  .hw-main-title {
    font-size: 1.35rem;
  }
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.contests-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.contests-group-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.contests-search-wrap {
  flex: 1;
  max-width: 20rem;
  min-width: 14rem;
}

.contests-search-input {
  width: 100%;
}

/* ========================================================
   FLOATING FEEDBACK LAUNCHER & DIALOG
   ======================================================== */

.floating-feedback-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.15s ease-in-out;
}

.floating-feedback-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: none;
}

/* ========================================================
   SCHEDULE & CALENDAR COMPONENT
   ======================================================== */

.schedule-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 0.85rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.schedule-view-toggles {
  display: flex;
  gap: 0.25rem;
  background: var(--bg);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.schedule-nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.schedule-current-period {
  font-weight: 700;
  font-size: 1rem;
  min-width: 140px;
  text-align: center;
  font-family: var(--font-mono);
  color: var(--accent);
}

.schedule-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.schedule-filters .filter-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.schedule-filters .filter-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.schedule-calendar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 520px;
}

/* Week Grid */
.schedule-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-height: 520px;
  border-collapse: collapse;
}

.schedule-day-column {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.schedule-day-column:last-child {
  border-right: none;
}

.schedule-day-column.today {
  background: rgba(56, 189, 248, 0.03);
}

.schedule-day-header {
  padding: 0.75rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.schedule-day-header .day-name {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.schedule-day-header .day-num {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.schedule-day-header .today-badge {
  color: var(--accent);
  background: var(--accent-soft);
  width: 28px;
  height: 28px;
  line-height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
}

.schedule-day-events {
  padding: 0.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.schedule-day-events .no-events {
  color: var(--muted);
  text-align: center;
  padding: 2rem 0;
  font-size: 0.85rem;
  opacity: 0.4;
}

/* Event Cards */
.schedule-event-card {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.schedule-event-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.schedule-event-card.type-lecture {
  border-left-color: #38bdf8;
}

.schedule-event-card.type-practice {
  border-left-color: #10b981;
}

.schedule-event-card.type-extra_lecture {
  border-left-color: #a855f7;
}

.schedule-event-card.type-consultation {
  border-left-color: #f59e0b;
}

.ev-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
}

.ev-badge-type {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}

.ev-time {
  font-family: var(--font-mono);
  color: var(--muted);
}

.ev-card-title {
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}

.ev-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ev-meta-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Month Grid */
.schedule-month-table {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.schedule-month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}

.month-head-cell {
  padding: 0.6rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.schedule-month-body {
  display: flex;
  flex-direction: column;
}

.month-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-height: 95px;
  border-bottom: 1px solid var(--border);
}

.month-row:last-child {
  border-bottom: none;
}

.month-cell {
  border-right: 1px solid var(--border);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
}

.month-cell:last-child {
  border-right: none;
}

.month-cell.other-month {
  opacity: 0.3;
  background: rgba(0, 0, 0, 0.15);
}

.month-cell.today {
  background: rgba(56, 189, 248, 0.04);
}

.month-cell-header {
  text-align: right;
  margin-bottom: 0.25rem;
}

.month-date-num {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.month-cell-events {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}

.month-event-pill {
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  border-left: 2px solid var(--accent);
}

.month-event-pill:hover {
  border-color: var(--accent);
}

.month-more-badge {
  font-size: 0.7rem;
  color: var(--accent);
  text-align: center;
  font-family: var(--font-mono);
}

/* ========================================================
   ELECTRONIC SPREADSHEET (GRADES TABLE)
   ======================================================== */

.grades-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.grades-tabs-scroll {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.grades-group-tab {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.grades-group-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.grades-group-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: none;
}

.grades-sheet-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.grades-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.grades-spreadsheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.grades-spreadsheet-table th,
.grades-spreadsheet-table td {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.grades-spreadsheet-table th {
  background: rgba(255, 255, 255, 0.02);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}

.grades-spreadsheet-table .col-fixed-num {
  width: 45px;
  text-align: center;
}

.grades-spreadsheet-table .col-fixed-name {
  min-width: 220px;
}

.grades-spreadsheet-table .col-fixed-group {
  width: 90px;
  text-align: center;
  font-family: var(--font-mono);
}

.grades-spreadsheet-table .col-task {
  min-width: 110px;
  text-align: center;
}

.grades-spreadsheet-table .col-task .col-title {
  font-size: 0.82rem;
  font-weight: 600;
}

.grades-spreadsheet-table .col-task .col-max {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.grades-spreadsheet-table .col-total {
  width: 90px;
  text-align: center;
  background: rgba(56, 189, 248, 0.04);
  font-family: var(--font-mono);
  color: var(--accent);
}

.grades-spreadsheet-table td.cell-score {
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
}

.grades-spreadsheet-table td.cell-score.editable {
  cursor: text;
  transition: background 0.15s ease, outline 0.15s ease;
}

.grades-spreadsheet-table td.cell-score.editable:hover {
  background: rgba(56, 189, 248, 0.08);
  outline: 1px dashed var(--accent);
}

.grades-spreadsheet-table td.cell-score.editing {
  background: rgba(56, 189, 248, 0.15) !important;
  outline: 2px solid var(--accent) !important;
}

.grades-spreadsheet-table td.cell-score.saving {
  opacity: 0.5;
  background: rgba(245, 158, 11, 0.15) !important;
}

.grades-spreadsheet-table td.cell-score.saved {
  background: rgba(16, 185, 129, 0.2) !important;
}

.grades-spreadsheet-table td.cell-score.error {
  background: rgba(244, 63, 94, 0.2) !important;
}

.grades-spreadsheet-table td.cell-score.cell-calculated {
  background: rgba(56, 189, 248, 0.05);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: default;
}

.grades-spreadsheet-table td.cell-score.cell-calculated:hover {
  background: rgba(56, 189, 248, 0.12);
}

.grades-spreadsheet-table tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.grades-spreadsheet-table .col-fixed-name,
.grades-spreadsheet-table td.cell-name {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}

.grades-spreadsheet-table th.col-fixed-name {
  z-index: 3;
}

.col-header-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.col-fx-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
}

.submission-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.sub-image-thumb {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.sub-image-thumb:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

/* ========================================================
   REQUESTS PAGE
   ======================================================== */

.requests-grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 1.5rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .requests-grid-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ========================================================
   TYPOVIK SIDEBAR CARDS & ADMIN COLLAPSIBLE DRAWER
   ======================================================== */

.homework-nav-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  font-family: inherit;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.homework-nav-card:hover {
  border-color: var(--accent-border);
  background: rgba(56, 189, 248, 0.04);
}

.homework-nav-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.hw-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.hw-card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Admin All-Tabs Collapsible Drawer */

/* ========================================================
   PERFORMANCE & MOBILE LAYOUT POLISH
   ======================================================== */

.dict-item,
.test-catalog-card,
.contest-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 150px;
}

@media (max-width: 768px) {
  /* Reduce GPU overdraw on mobile by avoiding stacked backdrop blurs */
  .practices-subbar,
  .homeworks-subbar,
  .notes-subbar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--card) !important;
  }

  .topbar-feedback-text {
    display: none;
  }

  .schedule-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.75rem;
  }

  .schedule-filters {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .schedule-filters .form-input {
    width: 100% !important;
  }

  .schedule-view-switcher {
    width: 100%;
    display: flex;
  }

  .schedule-view-switcher .btn {
    flex: 1;
    justify-content: center;
  }

  .schedule-week-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .schedule-day-col {
    min-height: auto;
  }

  .floating-feedback-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
  }

  .grades-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .grades-filters {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .grades-filters .form-input {
    width: 100% !important;
  }
}

@media (max-width: 540px) {

  /* На узких экранах сокращаем кнопку до «Вход», иначе длинная подпись
     выталкивает бургер-меню за край и делает его недоступным. */
  .auth-reg-suffix {
    display: none;
  }
}


/* ==========================================================================
   Шапка сайта и главная. По устройству — как админка: плоские карточки
   с тонкой рамкой, кнопки одной высоты, иконки Lucide, один шрифт.
   Цвета — из токенов сайта, поэтому светлая и тёмная темы работают сами.
   ========================================================================== */

:root {
  --hover: color-mix(in srgb, var(--ink) 6%, transparent);
  --radius-card: 0.75rem;
  --radius-control: 0.5rem;
}

.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* ---------- кнопки шапки и главной ---------- */

.site-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 2.25rem;
  padding: 0 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.site-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.site-btn-ghost:hover,
.site-btn-ghost[aria-expanded="true"] { background: var(--hover); }
.site-btn-outline {
  background: var(--card);
  border-color: var(--line);
}
.site-btn-outline:hover { background: var(--hover); }
.site-btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.site-btn-primary:hover { background: var(--accent-ink); color: var(--on-accent); }
/* Без gap: иначе между «Вход» и « / Регистрация» лишний пробел */
#btn-auth-open { gap: 0; }

.site-btn-icon {
  width: 2.25rem;
  padding: 0;
  color: var(--muted);
}
.site-btn-icon:hover { color: var(--ink); }

/* ---------- шапка ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header-inner {
  max-width: 78rem;
  /* Вместе с рамкой ровно --topbar-h: под эту высоту выставлены липкие подпанели страниц */
  height: calc(var(--topbar-h) - 1px);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.site-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}
.site-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.site-brand-name {
  font-family: "Unbounded", var(--body);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.site-brand-sub {
  font-family: var(--code);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.site-header-actions,
.site-auth {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.site-user {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  min-width: 0;
}
.site-user:hover { background: var(--hover); }
.site-user .icon { color: var(--muted); }
.site-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-user-group { color: var(--muted); }
.site-user-pts {
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Меню разделов — выпадающая панель под кнопкой, как поповер в админке */
.site-nav {
  position: fixed;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 0.35rem);
  right: max(0.75rem, calc((100vw - 78rem) / 2 + 0.75rem));
  z-index: 110;
  width: 16.5rem;
  max-height: calc(100dvh - var(--topbar-h) - 1.5rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.site-nav.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.site-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 105;
}
.site-nav-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.15rem 0.15rem 0.35rem 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}
.site-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-control);
  color: var(--ink);
  font-size: 0.875rem;
  text-decoration: none;
}
.site-nav-link .icon { color: var(--muted); }
.site-nav-link:hover { background: var(--hover); }
.site-nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.site-nav-link.active .icon { color: var(--accent); }

.floating-feedback-btn {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.floating-feedback-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ---------- главная ---------- */

.home-main {
  max-width: 78rem;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 5rem;
}

.home-header { margin-bottom: 1.75rem; }
.home-header h1 {
  margin: 0 0 0.35rem;
  font-family: var(--body);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.home-header .home-brand {
  font-family: "Unbounded", var(--body);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.home-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.home-muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.home-section { margin-top: 2rem; }
.home-section h2 {
  margin: 0 0 0.75rem;
  font-family: var(--body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.home-card,
.home-contest,
.home-me,
.home-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.home-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  column-gap: 0.85rem;
  row-gap: 0.2rem;
  padding: 1rem 1.1rem;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow);
}
.home-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.home-card-icon {
  grid-row: 1 / span 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-control);
  background: var(--accent-soft);
  color: var(--accent);
}
.home-card-icon .icon { width: 1.1rem; height: 1.1rem; }
.home-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 2.25rem;
  margin-top: -0.4rem;
}
.home-card-desc {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}
.home-card-meta {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.home-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.home-badge-live {
  background: var(--ok-soft);
  color: var(--ok);
}
.home-badge .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: home-pulse 1.6s ease-in-out infinite;
}
@keyframes home-pulse { 50% { opacity: 0.35; } }

.home-contest {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1.1rem;
}
.home-contest-text { flex: 1; min-width: 0; }
.home-contest-title { font-weight: 600; }

.home-me {
  margin-bottom: 1rem;
  padding: 1.1rem;
}
.home-me-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.home-me-name { font-weight: 600; font-size: 1.05rem; }
.home-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.home-stat {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-card) - 0.15rem);
}
.home-stat-label { color: var(--muted); font-size: 0.78rem; }
.home-stat-value {
  margin-top: 0.15rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.home-panel { padding: 1rem 1.1rem 0.6rem; }
.home-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.home-panel-head h2 { margin: 0; }
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
}
.home-link:hover { text-decoration: underline; }

.home-top {
  margin: 0;
  padding: 0;
  list-style: none;
}
.home-top li {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto 3.5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.home-top li:first-child { border-top: 0; }
.home-top li.is-me {
  background: var(--accent-soft);
  border-radius: var(--radius-control);
}
.home-top-rank {
  color: var(--muted);
  text-align: center;
}
.home-top li:nth-child(-n + 3) .home-top-rank { color: var(--ink); font-weight: 600; }
.home-top-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-top-group { color: var(--muted); font-size: 0.8rem; }
.home-top-pts {
  text-align: right;
  font-weight: 600;
}

@media (max-width: 960px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .site-header-inner { padding: 0 0.75rem; }
  .site-brand-sub { display: none; }
  .site-brand-name { font-size: 1rem; }
  .site-btn-label,
  .auth-reg-suffix,
  .site-user-group,
  .site-user-pts { display: none; }
  .site-nav {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
  }
  .site-nav-head { display: flex; }

  .home-main { padding: 1.5rem 1rem 5rem; }
  .home-header h1 { font-size: 1.45rem; }
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
  .home-card { padding: 0.85rem 0.95rem; }
  .home-contest { flex-wrap: wrap; }
  .home-contest .site-btn { width: 100%; }
  .home-stats { gap: 0.5rem; }
  .home-stat { padding: 0.6rem 0.65rem; }
  .home-stat-value { font-size: 1.1rem; }
  .floating-feedback-btn { width: 2.5rem; padding: 0; justify-content: center; }
  .floating-feedback-btn .feedback-label { display: none; }
}


/* ==========================================================================
   Единый вид мелких элементов на всех страницах — как в админке.
   Фильтры-«пилюли» и вкладки: одинаковая высота, мягкая подсветка выбранного.
   Бейджи: одна форма и шрифт, цвет у каждого свой.
   ========================================================================== */

.group-filter-pill,
.gen-pill,
.col-pill-btn,
.grades-group-tab,
.home-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.group-filter-pill:hover,
.gen-pill:hover,
.col-pill-btn:hover,
.grades-group-tab:hover,
.home-tab-btn:hover {
  background: var(--hover);
  border-color: var(--line);
  color: var(--ink);
}
.group-filter-pill.active,
.gen-pill.active,
.col-pill-btn.active,
.grades-group-tab.active,
.home-tab-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 500;
}

.badge-deadline,
.badge-group-info,
.badge-score,
.badge-topic,
.card-col-badge,
.contest-group-badge,
.contest-timer-badge,
.counter-badge,
.dict-col-pill,
.ev-badge-type,
.favorite-q-badge,
.hw-status-badge,
.meta-pill,
.me-pill,
.group-pill,
.pretest-badge,
.quiz-sidebar-badge,
.rating-rule-pill,
.test-status-badge,
.test-topic-badge,
.topic-status-pill,
.topic-tag,
.tag {
  border-radius: 999px;
  font-family: var(--body) !important;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

/* Иконки-эмодзи в заголовках выносок не нужны: тип выноски понятен по цвету и названию */
.callout-icon { display: none; }

.page-title {
  font-family: var(--body);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dropzone-icon {
  display: inline-flex;
  color: var(--accent);
}
.dropzone-icon .icon { width: 1.5rem; height: 1.5rem; }

/* ---------- рейтинг ---------- */
.top-rank-1, .top-rank-2, .top-rank-3 { background: transparent; }
.top-rank-1 .rank-badge, .top-rank-2 .rank-badge, .top-rank-3 .rank-badge { font-weight: 700; color: var(--ink); }
.is-me-row { background: var(--accent-soft) !important; font-weight: 500; }

/* ---------- профиль ---------- */
.profile-avatar-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 600;
}
.profile-name { font-family: var(--body); font-size: 1.5rem; font-weight: 600; }

/* ---------- квизы: статус слева, название и детали, действия справа ---------- */
.contest-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "status title actions" "status meta actions";
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.2rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.contest-card.live { border: 1px solid var(--line); }
.contest-card.finished { opacity: 1; }
.contest-card-status {
  grid-area: status;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.75rem;
  font-weight: 500;
}
.contest-card-status.finished { background: var(--sunken); color: var(--muted); }
.contest-card-title { grid-area: title; margin: 0; font-size: 1rem; font-weight: 600; }
.contest-card-meta { grid-area: meta; gap: 0.75rem; font-size: 0.84rem; }
.contest-card-actions { grid-area: actions; }
.live-dot { width: 6px; height: 6px; background: currentColor; }
.contest-card-status .live-dot { background: currentColor; }
@keyframes pulseDot { 50% { opacity: 0.35; } }

@media (max-width: 600px) {
  .contest-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "status" "title" "meta" "actions";
    justify-items: start;
    row-gap: 0.4rem;
  }
}

.contest-room-topbar { border-bottom-width: 1px; }
.timer-icon { display: none; }

/* ---------- телефоны: ничего не вылезает за край экрана ---------- */
.colloquiums-col-pills,
.grades-tabs-scroll { min-width: 0; max-width: 100%; }
.grades-toolbar > * { min-width: 0; max-width: 100%; }

@media (max-width: 600px) {
  .site-user { width: 2.25rem; padding: 0; justify-content: center; }
  .site-user-name { display: none; }

  .dict-actions-bar { flex-wrap: wrap; gap: 0.5rem; }
  .dict-toggle-all-wrap { flex-wrap: wrap; }

  .practices-subbar-controls,
  .homeworks-subbar-controls { gap: 0.4rem; min-width: 0; }
  .group-filter-label { display: none; }

  .schedule-view-toggles,
  .schedule-nav-controls { width: 100%; min-width: 0; }
  .schedule-view-toggles .btn { flex: 1; padding-left: 0.4rem; padding-right: 0.4rem; }

  .contest-room-topbar { flex-wrap: wrap; padding: 0.6rem 0.9rem; gap: 0.5rem; }
  .contest-room-brand { flex-wrap: wrap; gap: 0.4rem 0.6rem; min-width: 0; }
  .contest-user-info { display: none; }
}

.notes-breadcrumb { flex-wrap: wrap; row-gap: 0.15rem; }

@media (max-width: 600px) {
  .notes-breadcrumb { display: block; line-height: 1.6; }
  .practices-subbar-title,
  .homeworks-subbar-title { font-size: 0.9rem; min-width: 0; overflow:hidden; text-overflow:ellipsis; display:block; }
  .practices-subbar-controls,
  .homeworks-subbar-controls { flex-shrink:0; }
  .practices-subbar-controls select,
  .homeworks-subbar-controls select { min-width: 6.25rem; }
}


/* ==========================================================================
   Страницы разделов в том же духе, что админка и главная:
   нейтральные рамки, выделение — мягким фоном, а не цветной обводкой,
   метаданные — строкой текста, а не россыпью цветных плашек.
   ========================================================================== */

/* ---------- поля ввода: одна высота и один размер шрифта везде ---------- */
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]):not([type="range"]):not([type="color"]),
select,
textarea,
.form-input,
.form-select {
  min-height: 2.25rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.4;
}
textarea { min-height: 5rem; }
select { padding-right: 2rem; }
select option { background: var(--card); color: var(--ink); }
input:not([type="radio"]):not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: transparent;
}
.form-group { gap: 0.35rem; }
.form-label,
.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- сегментные переключатели (вид расписания, режим коллоквиума, вход/регистрация) ---------- */
.schedule-view-toggles,
.colloquiums-mode-tabs,
.auth-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.schedule-view-toggles .btn,
.schedule-view-btn,
.colloquiums-mode-tabs button,
.auth-tab-btn {
  min-height: 1.85rem;
  padding: 0.25rem 0.75rem;
  border: 0 !important;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: none;
}
.schedule-view-toggles .btn.active,
.schedule-view-btn.active,
.colloquiums-mode-tabs button.active,
.colloquiums-mode-tabs button[aria-selected="true"],
.auth-tab-btn.active {
  background: var(--card) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow);
}
.schedule-current-period { color: var(--ink); font-weight: 600; }

/* ---------- выделенный пункт в боковых списках ---------- */
.homework-nav-card,
.hw-nav-card,
.practice-nav-card {
  border: 1px solid transparent !important;
  border-radius: var(--radius-md);
  background: transparent;
  box-shadow: none;
}
.homework-nav-card:hover,
.hw-nav-card:hover,
.practice-nav-card:hover { background: var(--hover) !important; }
.homework-nav-card.active,
.hw-nav-card.active,
.practice-nav-card.active {
  background: var(--accent-soft) !important;
  box-shadow: none !important;
}
.notes-tree-item.active { background: var(--accent-soft); }
.notes-tree-icon, .notes-hero-icon { display: none !important; }

/* ---------- метаданные строкой: «Отношения · для всех групп · до 10 баллов · до 10 ноября» ---------- */
.hw-meta-row,
.hw-card-top-row,
.hw-card-bottom-row { flex-wrap: wrap; gap: 0; }
.hw-meta-row .badge,
.practice-meta-row .badge,
.hw-card-top-row .badge,
.hw-card-top-row > span,
.hw-card-top > span {
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  color: var(--muted) !important;
  font-size: 0.8125rem;
  font-weight: 400;
}
.hw-meta-row .badge + .badge::before,
.practice-meta-row .badge + .badge::before,
.hw-card-top-row > span + span::before,
.hw-card-top > span + span::before {
  content: "·";
  margin: 0 0.45rem;
  color: var(--muted);
}
.hw-meta-row { margin-bottom: 0.5rem; }

/* Блоки внутри задания: без цветной полосы слева и пунктира */
.hw-teacher-feedback,
.note-callout {
  border: 1px solid var(--line) !important;
  border-left-width: 1px !important;
  border-radius: var(--radius-md);
  background: var(--sunken) !important;
}
.hw-submission-section { border-top: 1px solid var(--line); }
.pdf-dropzone { border-width: 1px; }
.hw-card-top { display: flex; flex-wrap: wrap; align-items: baseline; }

/* ---------- коллоквиумы ---------- */
.dict-item { border-radius: var(--radius-lg); box-shadow: none; }
.dict-item.open { border-color: var(--line); box-shadow: none; }
.dict-item.open .dict-chevron { color: var(--muted); }
.dict-col-pill {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 400;
}
.dict-item-header { align-items: flex-start; }

/* ---------- каталог тренажёров ---------- */
.test-catalog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.test-catalog-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow);
}
.test-card-topic { color: var(--muted); font-size: 0.8125rem; }
.test-catalog-title { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.35; }
.test-catalog-title a { color: inherit; text-decoration: none; }
/* Вся карточка кликабельна */
.test-catalog-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.test-catalog-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.test-catalog-footer {
  display: flex;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}
.test-catalog-footer > * + *::before { content: "·"; margin-right: 0.45rem; color: var(--muted); }
.test-tasks-count { font-weight: 400; color: var(--muted); }
.test-catalog-footer .test-status-badge {
  padding: 0;
  border: 0;
  background: none !important;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
}
.test-catalog-footer .test-status-badge.in-progress { color: var(--accent); }
.test-catalog-footer .test-status-badge.done { color: var(--ok); }
.test-catalog-footer .test-status-badge.attempted { color: var(--warning); }

.tests-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1rem !important;
}
.topic-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.topic-filter-btn {
  min-height: 2rem;
  padding: 0.25rem 0.75rem !important;
  color: var(--muted) !important;
  font-size: 0.8125rem !important;
}
.topic-filter-btn:hover { color: var(--ink) !important; }
.topic-filter-btn.active {
  background: var(--accent-soft) !important;
  border-color: var(--accent-border) !important;
  color: var(--accent) !important;
}
.tests-search-input { width: 16rem; max-width: 100%; }

/* Случайный вариант — компактная карточка под каталогом */
.test-generator-card {
  margin-top: 2.5rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-lg);
  background: var(--card) !important;
  box-shadow: none !important;
}
.generator-header { margin-bottom: 1rem; padding: 0; border: 0; }
.generator-title { margin: 0 0 0.2rem; font-size: 1.05rem; font-weight: 600; }
.generator-desc { margin: 0; color: var(--muted); font-size: 0.86rem; }
.generator-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
}
.generator-row { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; margin: 0; }
.generator-label { font-size: 0.8125rem; font-weight: 500; color: var(--muted); min-width: 0; }
.gen-select { min-width: 13rem; }
.generator-actions { margin: 0; }
.generator-pills { gap: 0.35rem; }

/* ---------- заявки ---------- */
.requests-layout,
.requests-grid { gap: 1.5rem; }

@media (max-width: 600px) {
  .tests-search-input { width: 100%; }
  .tests-search-box { width: 100%; }
  .gen-select { min-width: 0; width: 100%; }
  .generator-row { width: 100%; }
}
.hw-card-top [class*="deadline"],
.hw-card-top .badge {
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  color: var(--muted) !important;
  font-size: 0.8125rem;
  font-weight: 400;
}

/* ---------- заявки: две карточки, поля с отступами ---------- */
.request-form-card,
.requests-history-card {
  min-width: 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  align-self: start;
}
.request-form-card .card-title,
.requests-history-card .card-title { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 600; }
#consult-request-form { display: grid; grid-template-columns:minmax(0,1fr); gap: 0.9rem; }
#consult-request-form .form-group { min-width:0; }
.request-history-item { overflow-wrap:anywhere; }
#consult-request-form .btn { margin-top: 0.25rem; }


/* ==========================================================================
   Конспекты: удобно читать. Колонка текста ~70 знаков, спокойная типографика,
   формулы крупнее и с прокруткой, если не влезают, таблицы в рамке,
   определения и теоремы — блоками с мягкой подложкой.
   ========================================================================== */

.notes-body-app { --notes-pad: 2.5rem; }

.notes-subbar { display: none; }

.notes-layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr) 15rem;
  max-width: 88rem;
  margin: 0 auto;
}

.notes-sidebar {
  width: auto;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 1.25rem 0.75rem 2rem;
  background: transparent;
  border-right: 1px solid var(--line);
  gap: 0.75rem;
}
.notes-sidebar-header { background: var(--bg); padding: 0 0.25rem 0.25rem; }
.notes-search-input { background: transparent; }
.notes-tree { gap: 0.25rem; }
.notes-tree-topic {
  margin: 0.9rem 0 0.25rem;
  padding: 0 0.6rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.notes-tree-item {
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}
.notes-tree-item:hover { background: var(--hover); color: var(--ink); }
.notes-tree-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.notes-content {
  padding: 2.25rem var(--notes-pad) 5rem;
  display: block;
}
.notes-article-sheet {
  max-width: 44rem;
  margin: 0 auto;
}

/* ---------- шапка конспекта ---------- */
.notes-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.notes-topic { color: var(--accent); font-size: 0.86rem; font-weight: 500; margin-bottom: 0.5rem; }
.notes-title {
  margin: 0;
  font-family: var(--body);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.notes-desc { margin: 0.75rem 0 0; color: var(--muted); font-size: 1rem; line-height: 1.6; }

/* ---------- текст ---------- */
.notes-body {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink);
  overflow-wrap: break-word;
}
.notes-body > :first-child { margin-top: 0; }
.notes-body p { margin: 0 0 1em; }
.notes-body strong { font-weight: 600; }
.notes-body a { color: var(--accent); text-underline-offset: 3px; }

/* Первый h1 в файле повторяет название конспекта — в шапке оно уже есть */
.notes-body > h1:first-child { display: none; }

.notes-body h1, .notes-body h2, .notes-body h3, .notes-body h4 {
  position: relative;
  font-family: var(--body);
  color: var(--ink);
  scroll-margin-top: calc(var(--topbar-h) + 1.25rem);
  text-transform: none;
  letter-spacing: -0.01em;
}
.notes-body h2 {
  margin: 2.75rem 0 1rem;
  padding: 0;
  border: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}
.notes-body h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
}
.notes-body h4 { margin: 1.5rem 0 0.5rem; font-size: 1.05rem; font-weight: 600; }
.heading-anchor {
  margin-left: 0.4rem;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.notes-body h2:hover .heading-anchor,
.notes-body h3:hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }

.notes-body ul, .notes-body ol { margin: 0 0 1em; padding-left: 1.5em; }
.notes-body li { margin: 0.3em 0; }
.notes-body li::marker { color: var(--muted); }
.notes-body li > p { margin: 0.25em 0; }

.notes-body hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.notes-body blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}

.notes-body code {
  padding: 0.12em 0.4em;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  border: 1px solid var(--line);
  font-family: var(--code);
  font-size: 0.86em;
}
.notes-body pre {
  margin: 1.25rem 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--sunken);
  font-size: 0.88rem;
  line-height: 1.55;
}
.notes-body pre code { padding: 0; border: 0; background: none; }

/* ---------- формулы ---------- */
.notes-body .katex { font-size: 1.08em; }
.notes-body .katex-display {
  margin: 1.1rem 0;
  padding: 0.35rem 0.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  /* Полоса прокрутки появляется только у длинных формул и не налезает на них */
  scrollbar-width: thin;
}
.notes-body .katex-display > .katex-display { margin: 0; padding: 0; overflow: visible; }
.notes-body .katex-display .katex { font-size: 1.15em; }

/* ---------- таблицы ---------- */
.table-wrap {
  margin: 1.5rem 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.notes-body table {
  display: table;
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}
.notes-body table th,
.notes-body table td {
  padding: 0.55rem 0.85rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.notes-body th {
  background: var(--sunken);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.notes-body tr:last-child td { border-bottom: 0; }
.notes-body table tr:nth-child(even) td { background: transparent; }
.notes-body tbody tr:hover td { background: var(--hover); }

/* ---------- определения, теоремы, замечания ----------
   Заголовок вида «Заметка» убираем: у блоков в конспектах своя жирная первая фраза
   («Теорема о …», «Множеством называется …»). Тип блока виден по цвету подложки. */
.notes-body .note-callout {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem;
  border: 0 !important;
  border-radius: var(--radius-lg);
  background: var(--sunken) !important;
}
.notes-body .note-callout .callout-header { display: none; }
.notes-body .note-callout,
.notes-body .note-callout .callout-body { color: var(--ink) !important; }
.notes-body .note-callout .callout-body > :last-child { margin-bottom: 0; }
.notes-body .note-callout .callout-body > :first-child { margin-top: 0; }
.notes-body .callout-note { background: var(--accent-soft) !important; }
.notes-body .callout-important { background: color-mix(in srgb, #8b5cf6 12%, transparent) !important; }
.notes-body .callout-tip { background: var(--ok-soft) !important; }
.notes-body .callout-warning,
.notes-body .callout-caution { background: var(--warning-soft) !important; }

/* ---------- картинки ---------- */
.notes-body figure { margin: 1.5rem 0; text-align: center; }
.notes-body figure img { max-width: 100%; height: auto; border-radius: var(--radius-md); }
.notes-body figcaption { margin-top: 0.5rem; color: var(--muted); font-size: 0.86rem; }

/* ---------- оглавление ---------- */
.notes-toc-sidebar {
  width: auto;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 2.25rem 1rem 2rem 0.5rem;
}
.notes-toc-title { margin-bottom: 0.6rem; color: var(--ink); font-size: 0.8125rem; font-weight: 600; }
.notes-toc-links { gap: 0; border-left: 1px solid var(--line); }
.toc-link {
  display: block;
  margin-left: -1px;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.toc-link-3 { padding-left: 1.6rem; font-size: 0.8rem; }
.toc-link:hover { color: var(--ink); }
.toc-link.active { border-left-color: var(--accent); color: var(--accent); }

.notes-toc-inline {
  display: none;
  margin: 0 0 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.notes-toc-inline summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}
.notes-toc-inline ul { margin: 0; padding: 0 1rem 0.9rem 2rem; font-size: 0.9rem; line-height: 1.7; }
.notes-toc-inline .toc-level-3 { margin-left: 1rem; list-style: circle; }
.notes-toc-inline a { color: var(--ink); text-decoration: none; }
.notes-toc-inline a:hover { color: var(--accent); }

/* ---------- предыдущий / следующий ---------- */
.notes-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.notes-pager-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
}
.notes-pager-card.next { text-align: right; grid-column: 2; }
.notes-pager-card:hover { border-color: var(--accent-border); }
.notes-pager-label { color: var(--muted); font-size: 0.8rem; }
.notes-pager-title { font-weight: 600; font-size: 0.92rem; line-height: 1.35; }

@media (max-width: 80rem) {
  .notes-layout { grid-template-columns: 16rem minmax(0, 1fr); }
  .notes-toc-sidebar { display: none !important; }
  .notes-toc-inline { display: block; }
}

@media (max-width: 52rem) {
  .notes-body-app { --notes-pad: 1rem; }
  .notes-layout { display: block; }
  .notes-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--line);
  }
  .notes-subbar-title { font-weight: 600; font-size: 0.95rem; }
  .notes-sidebar { background: var(--card); }
  .notes-sidebar-header { background: var(--card); }
  .notes-content { padding-top: 1.5rem; }
  .notes-title { font-size: 1.6rem; }
  .notes-body { font-size: 1rem; line-height: 1.7; }
  .notes-body h2 { font-size: 1.3rem; margin-top: 2.25rem; }
  .notes-body h3 { font-size: 1.1rem; }
  .notes-pager { grid-template-columns: 1fr; }
  .notes-pager-card.next { grid-column: auto; }
}

.profile-isu-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}
.profile-isu-title { font-weight: 600; margin-bottom: 0.15rem; }
.profile-isu-row { display: flex; gap: 0.5rem; }
.profile-isu-row .form-input { width: 7.5rem; }
.profile-isu-card .form-error { flex-basis: 100%; }

/* ---------- ошибки под полями форм ---------- */
.form-group .field-error {
  margin-top: 0.3rem;
  color: var(--bad);
  font-size: 0.8125rem;
  line-height: 1.35;
}
.form-input.is-invalid,
input.is-invalid {
  border-color: var(--bad) !important;
}
.form-input.is-invalid:focus,
input.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--bad-soft) !important;
}
.profile-isu-row { flex-wrap: wrap; }
.profile-isu-row .field-error { flex-basis: 100%; margin-top: 0; }


/* Stable loading slots and readable numeric data. */
.skeleton { display:block; border-radius:8px; background:linear-gradient(90deg,var(--card),var(--line),var(--card)); background-size:200% 100%; animation:skeleton-pulse 1.5s infinite; }
.auth-skeleton { width:180px; height:36px; }
@keyframes skeleton-pulse { to { background-position:-200% 0; } }
@media (prefers-reduced-motion:reduce) { .skeleton { animation:none; } }
.schedule-list-container { display:grid; gap:24px; }
.sched-date-group { overflow:hidden; border:1px solid var(--line); border-radius:12px; }
.sched-date-heading { padding:12px 16px; font-weight:600; text-transform:capitalize; }
.sched-date-items { display:grid; gap:12px; padding:0 12px 12px; }
.cell-group,.cell-score,.cell-total,.col-max,.contest-group-btn { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-variant-numeric:tabular-nums; }
.contests-group-tabs,.grades-group-tabs { display:flex; flex-wrap:wrap; gap:8px; }
[hidden] { display:none !important; }

#contests-group-filters { display:flex; flex-wrap:wrap; gap:8px; }
.group-pill,.home-stat-value { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-variant-numeric:tabular-nums; }

.note-admin-history { margin:0 0 24px; padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--card); font:14px/1.5 var(--body); }
.note-history-meta { display:flex; flex-wrap:wrap; gap:8px 20px; margin-bottom:12px; color:var(--muted); }
.note-admin-history summary { cursor:pointer; padding:8px 0; }
.note-history-list { display:grid; gap:8px; margin:8px 0; }
.note-history-event { border-top:1px solid var(--line); }
.note-history-versions { display:grid; gap:12px; padding:12px 0; }
.note-history-versions pre { white-space:pre-wrap; overflow:auto; max-height:400px; overflow-wrap:anywhere; font:12px/1.5 var(--code,monospace); }
@media(min-width:1000px) { .note-history-versions {grid-template-columns:minmax(0,1fr) minmax(0,1fr);} }
/* The inbox loads once after authentication; full messages load on opening. */
.notification-count{font-family:var(--font-mono);font-size:.72rem;background:var(--accent);color:white;border-radius:1rem;min-width:1.2rem;padding:.1rem .3rem}
.notification-dialog{width:min(36rem,calc(100vw - 2rem));max-height:80vh;padding:1.25rem;border:1px solid var(--line);border-radius:var(--radius,16px);background:var(--card);color:var(--ink);box-shadow:0 12px 50px #0003}
.notification-dialog::backdrop{background:#0006}.notification-header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.notification-header h2{font-size:1.2rem;margin:0}.notification-list{margin-top:1rem}.notification-item{padding:1rem 0;border-top:1px solid var(--line);overflow-wrap:anywhere}.notification-item.unread{border-left:3px solid var(--accent);padding-left:.75rem}.notification-item a{font-weight:600;color:var(--accent)}.notification-item p{white-space:pre-wrap;margin:.5rem 0}.notification-item small{color:var(--muted);margin-right:1rem}

/* Keep all identity columns visible while scrolling the gradebook. */
.grades-spreadsheet-table { --grade-num: 45px; --grade-name: 220px; --grade-group: 90px; border-collapse: separate; border-spacing: 0; }
.grades-spreadsheet-table :is(.col-fixed-num,.cell-num) { position:sticky; left:0; width:var(--grade-num); min-width:var(--grade-num); max-width:var(--grade-num); z-index:3; background:var(--surface); }
.grades-spreadsheet-table :is(.col-fixed-name,.cell-name) { position:sticky; left:var(--grade-num); width:var(--grade-name); min-width:var(--grade-name); max-width:var(--grade-name); overflow:hidden; text-overflow:ellipsis; z-index:3; background:var(--surface); }
.grades-spreadsheet-table :is(.col-fixed-group,.cell-group) { position:sticky; left:calc(var(--grade-num) + var(--grade-name)); width:var(--grade-group); min-width:var(--grade-group); max-width:var(--grade-group); z-index:3; background:var(--surface); box-shadow:2px 0 var(--border); }
.grades-spreadsheet-table thead :is(.col-fixed-num,.col-fixed-name,.col-fixed-group) { z-index:5; background:var(--surface); }
.grades-spreadsheet-table tr:hover :is(.cell-num,.cell-name,.cell-group) { background:var(--surface); }
#grades-table-container .table-responsive { max-height:75vh; overflow:auto; }
@media(max-width:600px) { .grades-spreadsheet-table { --grade-num:36px; --grade-name:150px; --grade-group:75px; } }

.home-tile { min-width:0; display:flex; }
.home-tile .home-card { width:100%; height:100%; box-sizing:border-box; }
.home-tile[hidden], [data-layout-hidden] { display:none !important; }
.home-layout-dialog { width:min(42rem,calc(100vw - 2rem)); max-height:85vh; overflow:auto; border:1px solid var(--border); border-radius:var(--radius-lg); padding:1.5rem; background:var(--surface); color:var(--ink); }
.home-layout-dialog::backdrop { background:#0008; }
.home-layout-dialog p { color:var(--muted); }
.home-layout-list { display:grid; gap:.5rem; margin:1rem 0; }
.home-layout-row { display:flex; align-items:center; gap:.5rem; border:1px solid var(--border); border-radius:8px; padding:.5rem; }
.home-layout-label { display:flex; align-items:center; gap:.5rem; flex:1; }
.home-layout-extra { display:flex; flex-wrap:wrap; gap:1rem; margin:1rem 0; }
.home-layout-add { display:flex; flex-wrap:wrap; gap:.5rem; }
.home-layout-add input { flex:1; min-width:10rem; padding:.6rem; border:1px solid var(--border); border-radius:6px; background:var(--bg); color:inherit; }
.home-layout-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.5rem; margin-top:1rem; }

.loading-placeholder { display:grid; gap:14px; padding:20px 0; min-width:0; }
.loading-list { min-height:280px; align-content:start; }
.loading-list .skeleton { height:76px; }
.loading-document { min-height:420px; align-content:start; }
.loading-document .skeleton { height:22px; }
.loading-document .skeleton:first-of-type { height:36px; margin-bottom:18px; }
.loading-table { min-height:280px; align-content:start; }
.loading-table .skeleton { height:24px; }
#home-top5-leaderboard:has(.loading-placeholder) { min-height:280px; }
#active-contests-list, #finished-contests-list { min-height:240px; }
#homework-detail-sheet, #typovik-detail-sheet, #practice-detail-sheet { min-height:420px; }
#grades-table-container { min-height:350px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

.grades-spreadsheet-table :is(.col-fixed-num,.cell-num,.col-fixed-name,.cell-name,.col-fixed-group,.cell-group) { box-sizing:border-box; }

/* Timetable cells stay readable and can scroll on narrow displays. */
.schedule-calendar-card { min-width:0; }
.schedule-viewport { overflow:auto; }
.schedule-week-grid { min-width:1050px; grid-template-columns:repeat(7,minmax(150px,1fr)); }
.schedule-month-table { min-width:1050px; }
.schedule-day-column,.month-cell { min-width:0; }
.schedule-event-card { display:block; width:100%; text-align:left; color:var(--ink); font:inherit; white-space:normal; overflow-wrap:anywhere; cursor:pointer; }
.schedule-event-card:focus-visible,.month-event-pill:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.schedule-moved { margin-top:.5rem; color:var(--warning); font-size:.8rem; }
.schedule-event-card.type-early_submission,.month-event-pill.type-early_submission { border-left:3px solid var(--ok); }
.agenda-trigger { gap:.4rem; }
.agenda-list { min-height:240px; display:grid; gap:.75rem; margin-top:1rem; }
.agenda-item { border:1px solid var(--line); border-left:3px solid var(--accent); border-radius:8px; padding:.8rem 1rem; }
.agenda-item small { display:block; color:var(--muted); margin-bottom:.4rem; }
.agenda-item a { display:block; font-weight:600; color:var(--ink); }
.agenda-item p { white-space:pre-wrap; color:var(--muted); margin:.4rem 0 0; font-size:.9rem; }
.agenda-item.urgency-urgent,.agenda-item.urgency-overdue { border-left-color:var(--bad); }
.agenda-item.urgency-urgent small,.agenda-item.urgency-overdue small { color:var(--bad); }
.agenda-item.urgency-soon { border-left-color:var(--warning); }
@media(max-width:600px){ .agenda-trigger-label {display:none;} .agenda-trigger {min-width:34px;font-size:1.25rem;padding:.3rem;} }

.agenda-trigger.has-urgent {border-color:var(--bad);color:var(--bad);}
.agenda-count {font-size:.75rem;font-weight:600;}
.grade-budget-note {margin:0;padding:1rem;color:var(--muted);font-size:.875rem;}
.score-locked {color:var(--muted);background:var(--card);}
.grade-lock-reason {display:block;max-width:16rem;font-size:.7rem;color:var(--warning);}
.score-locked.editable:not(:focus)::after {content:"Не учтено: нужен зачёт ДЗ";display:block;font-size:.7rem;color:var(--warning);}

/* Account tools are part of the initial HTML, including their fixed-size badges. */
.site-tool-slot { display:inline-flex; align-items:center; flex-shrink:0; }
.site-tool-slot[hidden], .home-editor-actions[hidden], .home-editor-hint[hidden], .home-editor-error[hidden], .home-add-tile[hidden], #home-customize[hidden] { display:none !important; }
.notification-trigger, .agenda-trigger { position:relative; }
.notification-trigger .notification-count, .agenda-trigger .agenda-count { position:absolute; top:-3px; right:-3px; min-width:16px; height:16px; padding:0 4px; border-radius:999px; background:var(--accent); color:var(--on-accent); font-size:10px; line-height:16px; pointer-events:none; }
.site-user { max-width:22rem; }
.site-user-pts { min-width:3ch; text-align:center; }
#home-student-card { min-height:176px; box-sizing:border-box; }
#home-student-card[hidden] { display:none !important; }

/* Keep text-button geometry independent of the initial fallback font. */
#platform-burger { width:108px; flex-shrink:0; }
#btn-auth-open { width:164px; }
.site-auth > a[href="/admin/"] { width:88px; }
#agenda-trigger { width:136px; flex-shrink:0; }
@media(max-width:600px) {
  .practices-subbar,.homeworks-subbar {padding:0 1rem;gap:.5rem;}
  #platform-burger, #agenda-trigger { width:36px; min-width:36px; padding:0; }
  #btn-auth-open { width:64px; }
}

.home-editor-heading { flex-wrap:wrap; gap:.75rem; min-height:32px; }
.home-editor-actions { display:flex; align-items:center; flex-wrap:wrap; gap:.4rem; }
.home-editor-hint { margin:.25rem 0 1rem; color:var(--muted); font-size:.85rem; }
.home-editor-error { color:var(--bad); font-size:.85rem; }
.home-tile { position:relative; }
.home-tile-tools { display:none; position:absolute; inset:.45rem .45rem auto; align-items:center; justify-content:space-between; z-index:2; }
.home-tile-handle, .home-tile-hide, .home-widget-hide, .home-add-close { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; padding:4px; border:0; border-radius:6px; background:transparent; color:var(--muted); cursor:pointer; }
.home-tile-tools svg, .home-widget-hide svg, .home-add-close svg { width:18px; height:18px; }
.home-tile-handle { cursor:grab; touch-action:none; }
.home-tile-handle:hover, .home-add-close:hover { background:var(--hover); color:var(--ink); }
.home-tile-hide:hover, .home-widget-hide:hover { background:var(--bad-soft); color:var(--bad); }
.home-grid.is-editing .home-tile-tools { display:flex; }
.home-grid.is-editing .home-card { padding-top:2.65rem; cursor:default; }
.home-grid.is-editing .home-card:hover { transform:none; box-shadow:none; }
.home-grid.is-editing .home-tile { border-radius:var(--radius-card); }
.home-grid.is-editing .home-tile:focus-within { outline:2px solid var(--accent); outline-offset:3px; }
.home-grid .home-tile.is-dragging { opacity:.25; outline:2px dashed var(--accent); }
.home-drag-ghost { position:fixed; top:0; left:0; z-index:1000; pointer-events:none; opacity:.95; filter:drop-shadow(0 8px 15px #0002); }
.home-drag-ghost .home-card { padding-top:2.65rem; }
.home-drag-ghost .home-tile-tools { display:none; }
.home-add-tile { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.6rem; min-height:120px; padding:1.25rem; border:1px dashed var(--accent-border); border-radius:var(--radius-card); background:var(--accent-soft); color:var(--accent); font:inherit; font-size:.9rem; cursor:pointer; }
.home-add-tile svg { width:24px; height:24px; }
.home-add-tile:hover { border-color:var(--accent); }
.home-editable-widget { position:relative; }
.home-widget-hide { display:none; position:absolute; right:-10px; top:-10px; border:1px solid var(--line); background:var(--card); }
.home-editing .home-widget-hide { display:inline-flex; }
.home-layout-dialog { width:min(32rem,calc(100vw - 2rem)); max-height:85dvh; box-sizing:border-box; border-color:var(--line); border-radius:var(--radius-card); background:var(--card); padding:1.25rem; }
.home-add-heading { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.home-layout-dialog h2 { margin:0; font:600 1.1rem var(--body); }
.home-layout-dialog h3 { margin:0 0 .75rem; font:600 .9rem var(--body); }
.home-hidden-list { display:grid; gap:.5rem; padding:1.25rem 0; }
.home-hidden-list h3, .home-hidden-list p { margin:0; }
.home-restore-tile { display:flex; align-items:center; gap:.6rem; padding:.6rem .75rem; border:1px solid var(--line); border-radius:var(--radius-control); background:var(--card); color:var(--ink); font:inherit; font-size:.875rem; text-align:left; cursor:pointer; }
.home-restore-tile:hover { background:var(--hover); border-color:var(--accent-border); }
.home-restore-tile svg { width:16px; height:16px; flex-shrink:0; color:var(--accent); }
.home-layout-add { display:grid; grid-template-columns:1fr; border-top:1px solid var(--line); padding-top:1rem; }
.home-layout-add input { box-sizing:border-box; width:100%; min-width:0; border-color:var(--line); font:inherit; font-size:.875rem; }
.home-layout-add .home-editor-error { margin:0; }
@media(max-width:600px) {
  .site-user { max-width:8rem; }
  .site-header-actions { gap:.2rem; }
  .home-editor-actions { width:100%; }
  .home-editor-actions .btn { flex:1; padding:.4rem .6rem; }
  .home-editing .home-editor-heading h2 { width:100%; }
}

.home-editing .home-editor-heading { position:sticky; top:var(--topbar-h); z-index:20; padding:.5rem 0; background:var(--bg); }

/* Название материала уже показано в шапке документа, как и в конспектах. */
.practice-body-content > h1:first-child,
.hw-tasks-container > h1:first-child { display:none; }

.subbar-title-short {display:none;}
@media(max-width:600px) {
  .subbar-title-full {display:none;}
  .subbar-title-short {display:inline;}
  .practices-subbar-controls select,
  .homeworks-subbar-controls select {width:6.25rem;}
  .schedule-view-toggles {flex-wrap:wrap;}
  .schedule-view-toggles .btn {flex:1 1 auto;}
  .schedule-nav-controls {flex-wrap:wrap;}
  .schedule-current-period {min-width:0;flex:1;}
  #btn-sched-today {width:100%;}
  .schedule-filters .filter-item {flex-wrap:wrap;min-width:0;}
  .schedule-filters .form-input,.schedule-filters select {min-width:0;max-width:100%;}
}

/* Компактная верхняя карточка: место появляется только при наличии актуального. */
.home-feed {touch-action:pan-y pinch-zoom;margin:0 0 1.5rem;border:1px solid var(--accent-border);border-radius:var(--radius-lg);background:var(--card);overflow:hidden;min-width:0;}
.home-feed-slide {display:flex;align-items:center;gap:1.25rem;padding:1rem 1.25rem;min-height:132px;}
.home-feed-copy {flex:1;min-width:0;}
.home-feed-meta {display:flex;flex-wrap:wrap;align-items:center;gap:.35rem .75rem;color:var(--muted);font-size:.75rem;margin-bottom:.45rem;}
.home-feed-kind {color:var(--accent-ink);font-weight:600;}
.home-feed-kind.kind-reschedule,.home-feed-kind.kind-cancelled,.home-feed-overdue {color:var(--bad);}
.home-feed-title {display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:var(--ink);font-size:1.05rem;font-weight:600;line-height:1.4;text-decoration:none;overflow-wrap:anywhere;}
.home-feed-title:hover {color:var(--accent-ink);}
.home-feed-message {margin:.35rem 0 0;color:var(--muted);font-size:.85rem;line-height:1.5;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.home-feed-open {flex-shrink:0;}
.home-feed-navigation {display:flex;align-items:center;justify-content:center;gap:.4rem;border-top:1px solid var(--line);padding:.25rem .75rem;}
.home-feed-arrow,.home-feed-dot {display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;border:0;background:transparent;color:var(--muted);font:inherit;cursor:pointer;padding:0;min-width:32px;min-height:32px;border-radius:var(--radius-sm);}
.home-feed-arrow:hover,.home-feed-dot:hover {background:var(--accent-soft);color:var(--accent-ink);}
.home-feed-dots {display:flex;align-items:center;min-width:0;}
.home-feed-dot {min-width:24px;}
.home-feed-dot span {display:block;width:5px;height:5px;border-radius:50%;background:var(--line-strong);}
.home-feed-dot[aria-current] span {width:7px;height:7px;background:var(--accent);}
.home-feed-counter {color:var(--muted);font-size:.7rem;min-width:3em;text-align:center;}
.home-feed :is(a,button):focus-visible {outline:2px solid var(--accent);outline-offset:2px;}
@media(max-width:600px){.home-feed-slide{align-items:flex-start;gap:.75rem;padding:1rem;flex-wrap:wrap;}.home-feed-copy{flex-basis:100%;}.home-feed-open{margin-left:auto;}.home-feed-navigation{gap:.15rem;padding-inline:.4rem;}.home-feed-dot{min-width:22px;}.home-feed-title{font-size:1rem;}}
