:root{
  /* базовые значения (по умолчанию теперь СВЕТЛАЯ тема) */
  --bg:#ffffff;
  --panel:#ffffff;
  --panel-2:#e5e7eb;
  --border:#d1d5db;
  --text:#111827;
  --text-dim:#6b7280;
  --accent:#2563eb;
  --accent-2:#1d4ed8;
  --success:#059669;
  --danger:#dc2626;
  --muted:#ffffff;
  --shadow:0 8px 20px rgba(15,23,42,.12);
  --radius:12px;
  --figure-h:300px;
}

/* тёмная тема (явно) */
html[data-theme="dark"],
body[data-theme="dark"]{
  --bg:#0e1117;
  --panel:#111827;
  --panel-2:#0f1623;
  --border:#232635;
  --text:#e6e6e6;
  --text-dim:#aeb3c2;
  --accent:#3b82f6;
  --accent-2:#2563eb;
  --success:#10b981;
  --danger:#ef4444;
  --muted:#1b1d24;
  --shadow:0 8px 24px rgba(0,0,0,.25);
}

/* светлая тема (если атрибут всё же выставлен явно) */
html[data-theme="light"],
body[data-theme="light"]{
  --bg:#ffffff;
  --panel:#ffffff;
  --panel-2:#e5e7eb;
  --border:#d1d5db;
  --text:#111827;
  --text-dim:#6b7280;
  --accent:#2563eb;
  --accent-2:#1d4ed8;
  --success:#059669;
  --danger:#dc2626;
  --muted:#ffffff;
  --shadow:0 8px 20px rgba(15,23,42,.12);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:14px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,"Noto Sans",Arial,"Apple Color Emoji","Segoe UI Emoji";
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

.hidden{display:none !important}
h1,h2{margin:0 0 10px}
h1{font-size:26px}
h2{font-size:20px}
p{margin:8px 0}

.container{
  max-width:1080px;
  margin:28px auto;
  padding:0 16px;
}

.panel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px 18px;
}

/* оверлей загрузки */
#loadingOverlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.94);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:999;
  font-size:15px;
  color:var(--text-dim);
}

/* кнопки */
button{
  appearance:none;
  border:1px solid var(--border);
  background:var(--muted);
  color:var(--text);
  border-radius:10px;
  padding:8px 12px;
  cursor:pointer;
  transition:.12s ease-in-out;
  font:inherit;
}
button:hover{filter:brightness(1.06)}
button:disabled{opacity:.55;cursor:not-allowed}

/* опасные действия */
.btn-danger{
  background:var(--danger);
  border-color:var(--danger);
  color:#fff;
}
.btn-danger:hover{filter:brightness(1.06)}
.btn-danger:disabled{opacity:.6;cursor:not-allowed}

/* поля */
input[type="text"],input[type="number"]{
  background:var(--muted);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:10px;
  padding:8px 10px;
  outline:none;
}
input[type="number"]{
  width:36px;
  text-align:center;
  appearance:textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance:none;
  margin:0;
}
input[type="number"]{-moz-appearance:textfield}

/* ссылки */
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}



/* массовые кнопки (ряд 2) */
#picker .bulk-controls{
  display:flex;
  align-items:center;
  gap:var(--btn-gap);
  flex-wrap:wrap;
  margin:0; /* вертикальные отступы задаёт .sub-controls */
}
#picker .bulk-controls .bulk-hint{
  font-size:12px;
  color:var(--text-dim);
  margin-left:6px;
}
#picker .bulk-controls button{
  padding:6px 10px;
  font-size:13px;
  border-radius:10px;
}

/* вертикальные отступы между рядами */
#picker{
  --block-gap:18px;
  --btn-gap:8px;
  --row-gap:var(--btn-gap);
}
#picker .sub-controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-top:var(--row-gap);
}
#picker .sub-controls .sum{
  padding:6px 10px;
  border:1px dashed var(--border);
  border-radius:10px;
  background:var(--panel-2);
  white-space:nowrap;
}
#picker .accordion{
  margin-top:var(--block-gap);
}

/* верхний блок выбора (ряд 1) */
#picker .controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:8px;
  flex-wrap:wrap;
}
#picker .controls-left{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
#picker .controls-actions-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:var(--btn-gap);
}
#picker .controls-actions-right button{
  min-width:132px;
  padding:6px 10px;
  font-size:13px;
  border-radius:10px;
}

@media (max-width: 640px){
  #picker .controls{
    justify-content:flex-start;
  }
  #picker .controls-actions-right{
    justify-content:flex-start;
    flex-wrap:wrap;
  }
  #picker .sub-controls{
    justify-content:flex-start;
  }
}

/* компактная кнопка (как в bulk-controls) */
.btn-compact{
  padding:6px 10px;
  font-size:13px;
  border-radius:10px;
}
/* чекбокс "Перемешать задачи" */
#picker .controls .shuffle{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  color:var(--text-dim);
}
#picker .controls .shuffle input{
  margin:0;
}

/* переключатель режимов */
.mode-toggle{
  display:inline-flex;
  align-items:center;
  padding:2px;
  border-radius:999px;
  background:var(--panel-2);
  border:1px solid var(--border);
}
.mode-toggle .mode-btn{
  border:none;
  background:transparent;
  padding:6px 12px;
  border-radius:999px;
  color:var(--text-dim);
  font-size:13px;
  font-weight:500;
  box-shadow:none;
}
.mode-toggle .mode-btn:hover:not(.active){
  background:rgba(148,163,184,.12);
}
.mode-toggle .mode-btn.active{
  background:var(--accent);
  color:#fff;
  box-shadow:0 0 0 1px rgba(59,130,246,.6);
}

/* тумблер темы (стили оставляем, но сам переключатель скроем ниже) */
.theme-toggle{
  display:inline-flex;
  align-items:center;
  margin-left:8px;
}

.theme-toggle-input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.theme-toggle-label{
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:space-between;
  width:48px;
  height:24px;
  padding:2px 4px;
  border-radius:999px;
  background:var(--panel-2);
  border:1px solid var(--border);
  box-sizing:border-box;
  transition:background-color .2s ease,border-color .2s ease;
  font-size:14px;
}

.theme-toggle-icon{
  line-height:1;
  transition:opacity .2s ease,transform .2s ease;
}

/* светлая тема – акцент на солнце */
html[data-theme="light"] .theme-toggle-icon-light,
body[data-theme="light"] .theme-toggle-icon-light{
  opacity:1;
}
html[data-theme="light"] .theme-toggle-icon-dark,
body[data-theme="light"] .theme-toggle-icon-dark{
  opacity:.4;
}

/* тёмная тема – акцент на луне */
html[data-theme="dark"] .theme-toggle-icon-light,
body[data-theme="dark"] .theme-toggle-icon-light{
  opacity:.4;
}
html[data-theme="dark"] .theme-toggle-icon-dark,
body[data-theme="dark"] .theme-toggle-icon-dark{
  opacity:1;
}

/* временно скрываем тумблер темы на всех страницах */
.theme-toggle{
  display:none !important;
}

/* аккордеон (страница выбора задач и уникальные прототипы) */
.accordion{margin-top:12px}

/* контролы на странице уникальных прототипов */
.uniq-controls{
  display:flex;
  align-items:center;
  gap:10px;
  margin:10px 0 4px;
}
.node{
  /* без разделительных линий, отступы — середина между старым и текущим */
  border-bottom:none;
  padding:12px 0;
}
.node:last-child{border-bottom:none}

.node .row{
  display:flex;
  align-items:center;
}

/* отступ между счётчиком и названием */
.node .row .countbox{margin-right:20px}
.node.section .section-title{margin-left:20px}

/* секция */
.section-title{
  background:transparent;
  border:none;
  padding:0;
  color:var(--text);
  cursor:pointer;
  text-align:left;
  flex:1 1 auto;
  min-width:0;
  white-space:normal;
}

/* заголовки разделов на главной странице — чуть крупнее и полужирные */
#accordion .section-title{
  font-size:15px;
  font-weight:600;
}

/* заголовки тем на странице уникальных прототипов делаем жирными */
#uniqAccordion .section-title{
  font-weight:600;
}

/* (раньше здесь был счётчик возле каждой темы на странице УП) */

/* кнопка «Уникальные прототипы» — показываем только у раскрытой секции */
.unique-btn{
  margin-left:12px;
  display:none;
}
.node.section.show-uniq .unique-btn{
  display:inline-flex;
}

/* кнопка «Все» для темы (подраздела) */
.topic-all-btn{
  margin-left:12px;
  font-size:12px;
  padding:4px 10px;
  border-radius:999px;
}

.node .spacer{flex:1}

/* темы (подразделы) — убираем жирный шрифт */
.node.topic .title{
  font-weight:400;
}

/* дети */
.children{
  margin:8px 0 6px 32px;
  display:none;
}
.node.section.expanded>.children{display:block}

/* счётчики */
.countbox{
  display:flex;
  align-items:center;
  gap:6px;
}
.countbox .btn{
  width:28px;
  height:28px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  background:var(--muted);
  color:var(--text);
  border-radius:8px;
}
.countbox .btn:active{transform:translateY(1px)}

/* шапка раннера */
.run-head{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
}

.run-head .timer{
  margin-left:auto;
  background:var(--panel-2);
  border:1px solid var(--border);
  padding:6px 10px;
  border-radius:10px;
}

/* блок действий в шапке (лист задач) */
.run-head .actions{
  margin-left:auto;
  display:flex;
  gap:8px;
}

/* обёртка вопроса в режиме тестирования */
.qwrap{
  display:flex;
  gap:15px;
}
.qtext{
  flex:2;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.qfig{
  flex:1;
  display:flex;
  justify-content:flex-start;
  min-height:var(--figure-h);
  padding:4px;
  background:#ffffff;
  border:1px solid var(--border);
  border-radius:0;
}
.qfig img{
  max-height:calc(var(--figure-h) - 8px);
  max-width:100%;
  width:auto;
  height:auto;
  object-fit:contain;
  border:none;
  border-radius:0;
  background:transparent;
}

/* ответ */
.answer-row{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:22px;
}
.answer-row input[type="text"]{
  width:220px;
}

/* результат */
.result{
  margin-top:8px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--panel-2);
}
.result.ok{
  border-color:#0ea572;
  background:rgba(16,185,129,.12);
}
.result.bad{
  border-color:#cf3d3d;
  background:rgba(239,68,68,.12);
}

/* навигация */
.nav{
  margin-top:12px;
  display:flex;
  gap:8px;
}

/* сводка */
#summary .stats{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:8px;
  margin-top:8px;
}
#summary .stats>div{
  background:var(--panel-2);
  border:1px solid var(--border);
  padding:10px;
  border-radius:10px;
}
#summary .actions{
  margin-top:10px;
  display:flex;
  gap:8px;
}

/* небольшая подпись "Всего задач" в режиме списка */
.list-meta{
  margin:4px 0 8px;
  font-size:13px;
  color:var(--text-dim);
}

/* общий вариант — на всех страницах с раннером */
#runner{
  padding-bottom:40px;
}

/* мобильная версия */
@media (max-width:640px){
  .qwrap{flex-direction:column}
  .qfig{min-height:auto}
  input[type="number"]{width:56px}

  /* шапка выбора задач */
  #picker .controls-right{
    width:100%;
    align-items:flex-start;
  }
  #picker .controls-right .right-actions{
    align-items:flex-start;
  }

  /* аккордеон на узких экранах:
     текст раздела остаётся в одной строке со счётчиком,
     но может переноситься внутри себя на 2+ строки */
  .node .row{
    align-items:flex-start;
  }
  .node.section .section-title{
    margin-left:12px;
  }
  .node .row .countbox{
    margin-right:12px;
  }
  .unique-btn{
    margin-left:8px;
  }
  .topic-all-btn{
    margin-left:8px;
    margin-top:4px; /* чуть оторвать кнопку, если текст на две строки */
  }
}

/* компактный режим строк аккордеона на десктопе (но без линий) */
@media (min-width:900px){
  /* середина между очень плотным (4px) и текущим (12px) вариантом */
  .accordion .node{
    padding:8px 0;
  }

  /* компактнее кнопки - и + */
  .accordion .countbox .btn{
    width:24px;
    height:24px;
    padding:0;
    border-radius:6px;
  }

  /* компактнее поле количества */
  .accordion .countbox input[type="number"],
  .accordion .countbox .count{
    padding:4px 6px;
    height:24px;
    font-size:13px;
  }

  /* заголовок раздела чуть мельче и плотнее по строке */
  #accordion .section-title{
    font-size:14px;
    line-height:1.2;
  }

  /* меньше зазор между счётчиком и заголовком */
  .accordion .node .row .countbox{
    margin-right:12px;
  }
}

/* ------- общие карточки задач (лист + уникальные + тест) ------- */

.uniq-list,
.task-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:8px;
}

/* сама карточка */
.ws-item,
.task-card{
  background:var(--panel-2);
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px 12px;
}

/* в светлой теме фон карточки делаем белым */
html[data-theme="light"] .ws-item,
body[data-theme="light"] .ws-item,
html[data-theme="light"] .task-card,
body[data-theme="light"] .task-card{
  background:#ffffff;
}

/* "номер" задачи / прототипа */
.ws-num,
.task-num{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:3px 8px;
  border-radius:6px;
  border:2px solid var(--border);
  font-weight:600;
  font-size:13px;
  margin-bottom:4px;
}

/* подсветка номера задачи в итоговом экране ДЗ */
.task-num.ok{ border-color:#166534; }
.task-num.bad{ border-color:#b91c1c; }

/* текст условия */
.ws-stem,
.task-stem{
  margin-top:2px;
  overflow-wrap:anywhere;
}

/* ответ */
.ws-ans,
.task-ans{
  margin-top:6px;
}

.ws-ans summary,
.task-ans summary{
  cursor:pointer;
}

/* картинка в карточке (лист задач, уникальные, тест) */
.ws-fig,
.task-fig{
  margin:15px 0 6px;
  padding:4px;
  background:#ffffff;
  border:1px solid var(--border);
  border-radius:0;
}

.ws-fig img,
.task-fig img{
  max-width:100%;
  max-height:260px;
  object-fit:contain;
  display:block;
  border:none;
  border-radius:0;
  background:transparent;
}

/* в светлой теме делаем фон/рамку вокруг картинок более лёгкими */
html[data-theme="light"] .ws-fig,
body[data-theme="light"] .ws-fig,
html[data-theme="light"] .task-fig,
body[data-theme="light"] .task-fig{
  border:none;
  background:transparent;
  padding:0;
}

/* одиночная карточка вопроса в режиме тестирования */
.q-card{
  margin-top:8px;
}

/* фикс для SVG-рендера MathJax, чтобы корень не обрезался */
mjx-container[jax="SVG"] > svg{
  overflow:visible;
}

/* общие ограничения для формул, чтобы не вылезали за панель */
mjx-container{
  max-width:100%;
  overflow-x:auto;
}

/* фокус */
button:focus,
input:focus{
  outline:2px solid rgba(59,130,246,.35);
  outline-offset:2px;
}

/* hw_create: верхняя панель + авторизация */
.create-head { display:flex; justify-content:space-between; align-items:center; }
.create-head-right { display:inline-flex; align-items:center; gap:8px; flex-wrap:wrap; margin-left:auto; }


.page-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.page-head-right {
  display:inline-flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.btn.small {
  padding:6px 10px;
  font-size:13px;
  border-radius:10px;
}

.added-head {
  display:flex;
  align-items:center;
  gap:10px;
}

/* hw_create: мини-карточки добавленных задач (вместо таблицы) */
.fixed-mini-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.fixed-mini-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  display:grid;
  grid-template-columns:46px 1fr 160px 44px;
  gap:10px;
  align-items:end;
}

.fixed-mini-num{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  border-radius:10px;
  border:2px solid var(--border);
  font-weight:600;
  font-size:13px;
}

.fixed-mini-field{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.fixed-mini-label{
  font-size:12px;
  color:var(--text-dim);
}

.fixed-mini-del{
  height:36px;
  border-radius:12px;
  padding:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  line-height:1;
}

@media (max-width: 720px){
  .fixed-mini-card{
    grid-template-columns:46px 1fr 44px;
    grid-template-areas:
      "num q del"
      "num t del";
    align-items:center;
  }
  .fixed-mini-num{ grid-area:num; }
  .fixed-mini-q{ grid-area:q; }
  .fixed-mini-t{ grid-area:t; }
  .fixed-mini-del{ grid-area:del; }
}


/* hw_create: превью‑карточки добавленных задач (номер + условие + картинка) */
.fixed-prev-card{
  align-items:flex-start;
}
.fixed-prev-card .fixed-mini-num{
  flex-shrink:0;
  margin-top:2px;
}
.fixed-prev-card .fixed-mini-del{
  flex-shrink:0;
  align-self:flex-start;
}
.fixed-prev-card .fixed-prev-body{
  min-width:0;
}

.icon-btn {
  width:36px;
  min-width:36px;
  height:36px;
  /* центр символа примерно на 45% высоты (т.е. отступ от низа ~55%) */
  padding:0 0 4px 0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--card, var(--panel));
  cursor:pointer;
  font-size:22px;
  line-height:1;
  text-align:center;
}
.icon-btn:hover { background:rgba(0,0,0,.03); }


.auth-mini { display:inline-flex; align-items:center; gap:8px; flex-wrap:wrap; position:relative; }
.auth-email { opacity:.85; }

.editable-wrap { display:flex; flex-direction:column; gap:6px; }
.editable-btn {
  width:100%;
  text-align:left;
  padding:10px 12px;
  border:1px dashed var(--border);
  border-radius:12px;
  background:transparent;
}
.editable-btn:hover { background:rgba(148,163,184,.12); }
.editable-muted { opacity:.85; }

.link-box {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--panel-2);
}
.link-box .link-label { opacity:.85; }
.link-box .link-meta { opacity:.75; font-size:12px; }

.tiny-btn { padding:4px 8px; font-size:12px; border-radius:10px; }

.topic-auto { opacity:.85; }

/* ---------- modal task picker (hw_create) ---------- */
.modal {
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;
}
.modal-backdrop {
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.35);
}
.modal-card {
  position:relative;
  width:min(980px, calc(100vw - 24px));
  max-height:calc(100vh - 24px);
  overflow:hidden;
  border-radius:16px;
  border:1px solid var(--border);
  background:var(--card);
  box-shadow:0 20px 50px rgba(0,0,0,.22);
  display:flex;
  flex-direction:column;
  min-height:320px;
}
.modal-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  background:var(--panel-2);
}
.modal-title { font-size:16px; }


/* hw_create: кнопка закрытия окна добавления задач */
#taskPickerModal #tpClose{
  width:36px;
  height:36px;
  /* центр символа примерно на 45% высоты (т.е. отступ от низа ~55%) */
  padding:0 0 4px 0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
  line-height:1;
  text-align:center;
}
.modal-body {
  display:grid;
  grid-template-columns:320px 1fr;
  min-height:0;
  flex:1;
}

.tp-nav {
  overflow:auto;
  padding:10px;
  border-right:1px solid var(--border);
  background:var(--panel);
}

.tp-main {
  display:flex;
  flex-direction:column;
  min-height:0;
}

.tp-main-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  background:var(--panel-2);
}

.tp-main-actions { display:flex; align-items:center; gap:10px; }

.tp-list {
  overflow:auto;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.tp-item {
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--panel);
}

.tp-item-left { flex:1; min-width:0; }
.tp-item-meta { font-size:12px; opacity:.8; margin-bottom:6px; }
.tp-item-stem { font-size:14px; line-height:1.35; }

.tp-preview { display:flex; gap:10px; align-items:flex-start; }
.tp-fig {
  width:96px;
  max-width:96px;
  height:auto;
  /* без рамки/скруглений: картинка без видимого контейнера и без обрезки углов */
  border-radius:0;
  border:none;
  background:transparent;
  display:block;
}

.tp-item-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.tp-ctr-btn {
  width:32px;
  height:32px;
  /* центр символа примерно на 45% высоты (т.е. отступ от низа ~55%) */
  padding:0 0 3px 0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--card, var(--panel));
  cursor:pointer;
  font-size:18px;
  line-height:1;
  text-align:center;
}

.tp-ctr-btn:disabled { opacity:.5; cursor:default; }
.tp-ctr-val { min-width:20px; text-align:center; }
.tp-ctr-cap { font-size:12px; opacity:.75; }

.tp-hint { padding:0 12px 12px; }

.tp-sec summary,
.tp-topic summary {
  cursor:pointer;
  padding:6px 8px;
  border-radius:10px;
}
.tp-sec summary:hover,
.tp-topic summary:hover { background:rgba(148,163,184,.12); }

.tp-sec-body {
  padding-left:6px;
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-top:6px;
}

.tp-types { padding:6px 0 6px 8px; }
.tp-types-list { display:flex; flex-direction:column; gap:6px; }
.tp-type-btn {
  text-align:left;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--card);
  cursor:pointer;
}
.tp-type-btn:hover { background:rgba(148,163,184,.12); }
.tp-type-btn.active { outline:2px solid rgba(148,163,184,.35); }

@media (max-width: 860px) {
  .modal-body { grid-template-columns:1fr; }
  .tp-nav { border-right:none; border-bottom:1px solid var(--border); max-height:240px; }
}

/* ------- hw: отступы поля ответа + центрирование кнопки ------- */
.hw-panel{ padding-bottom:0; }
.hw-panel .run-body{
  display:flex;
  flex-direction:column;
  padding-bottom:24px; /* отступ снизу равен отступу над кнопкой */
}
.hw-panel .hw-answer-row{
  margin-top:18px; /* увеличенный отступ между условием и полем ответа */
}
.hw-panel .hw-answer-row input[type="text"]{
  width:220px;
}
.hw-panel .hw-bottom{
  display:flex;
  justify-content:center; /* кнопка по центру */
  margin-top:24px;        /* отступ от последней карточки до кнопки */
}

/* ------- hw: итоговый экран (статистика/отчет) ------- */
.hw-summary-head{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:12px;
}

.hw-summary-head h2{ margin:0; }

.hw-summary-head #restart{
  margin-left:auto;
  white-space:nowrap;
}

/* Отступ от условия задачи до блока "Ваш ответ" (две строки) */
.hw-review-answers{
  margin-top:1.8em;
}

/* hw_create: меню аккаунта */
.user-menu-btn { white-space: nowrap; }

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 2500;
}

.user-menu-item {
  width: 100%;
  display: block;
  text-align: left;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.user-menu-item:hover {
  background: rgba(148,163,184,.12);
}

.user-menu-item:active {
  background: rgba(148,163,184,.18);
}

.user-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

.user-menu-item.danger {
  color: var(--danger);
}


/* ===== Patch2: students/stats UI ===== */

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

.students-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(260px, 1fr));
  gap:10px;
}

.student-card{ cursor:pointer; padding:12px; }
.student-title{ font-size:18px; margin-bottom:6px; }

.student-metrics{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}

.student-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:10px;
}

.student-problem{
  border-color: rgba(220,38,38,.55);
  box-shadow: 0 0 0 2px rgba(220,38,38,.08);
}

.stat-mini{
  border:1px solid var(--border);
  border-radius:12px;
  padding:8px 10px;
  min-width:150px;
  background: rgba(148,163,184,.08);
}

.stat-mini-label{ font-size:11px; color: var(--text-dim); margin-bottom:2px; }
.stat-mini-value{ font-size:13px; }

.stat-gray   { background: rgba(148,163,184,.10); }
.stat-green  { background: rgba(5,150,105,.12); border-color: rgba(5,150,105,.35); }
.stat-lime   { background: rgba(132,204,22,.14); border-color: rgba(132,204,22,.35); }
.stat-yellow { background: rgba(234,179,8,.14); border-color: rgba(234,179,8,.35); }
.stat-red    { background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.35); }

/* ===== Patch 3A: умная тренировка (панель прогресса) ===== */
.smart-panel{
  margin: 10px 0 0;
  padding: 10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background: rgba(148,163,184,.06);
}
.smart-panel.hidden{ display:none; }

.smart-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.smart-title{ font-size:13px; color: var(--text); }
.smart-sub{ font-size:12px; color: var(--text-dim); }

.smart-tags{ display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.smart-tag{
  font-size:12px;
  padding:4px 8px;
  border:1px solid var(--border);
  border-radius:999px;
  background: rgba(148,163,184,.08);
}

.smart-actions{ display:flex; gap:8px; }
.smart-actions button{ padding:6px 10px; border-radius:10px; }


/* ===== Patch 3C: умное ДЗ (рекомендации + план) ===== */

.err{ color: var(--danger); }

.smart-hw-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.smart-hw-panel{
  margin-top:10px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: rgba(148,163,184,.05);
}

.smart-hw-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  align-items:start;
}

@media (max-width: 860px){
  .smart-hw-grid{ grid-template-columns: 1fr; }
}

.smart-hw-subhead{
  font-size:12px;
  color: var(--text-dim);
  margin: 4px 0 8px;
}

.smart-hw-list{
  display:grid;
  gap:10px;
}

.smart-topic{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  background: rgba(148,163,184,.06);
}

.smart-topic .row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.smart-topic .name{
  font-size:14px;
}

.smart-topic .meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:6px;
}

.smart-topic .actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
  margin-top:10px;
}

.smart-topic input[type="number"]{
  width: 70px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
}

.smart-hw-total{
  margin-top:10px;
  padding:8px 10px;
  border:1px dashed var(--border);
  border-radius:12px;
  background: rgba(148,163,184,.04);
  display:inline-block;
}

