/* =========================================================
   Оформление платформы. Две темы: «графит» и «молоко».
   Матовое стекло = слой фона + blur + очень тонкая рамка.
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  /* длинные запасные списки: если Google Fonts недоступны или в шрифте нет
     нужного знака, браузер возьмёт следующий, а не покажет «ромбик» */
  --display: 'Unbounded', 'Inter', 'Segoe UI', system-ui, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', Arial, 'Apple Color Emoji', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'DejaVu Sans Mono', 'Liberation Mono', monospace;

  --r-lg: 30px;  /* «айсовские» скругления */
  --r-md: 20px;
  --r-sm: 14px;
  --pad: clamp(16px, 3vw, 26px);

  --ok: #62E0A6;
  --bad: #FF7D8D;
  --warn: #FFC77A;
}

html[data-theme='dark'] {
  --bg: #08090D;
  --bg-2: #0E1017;
  --ink: #EDEFF6;
  --ink-2: #9AA1B6;
  --ink-3: #626A82;
  --glass: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .085);
  --line: rgba(255, 255, 255, .085);
  --line-2: rgba(255, 255, 255, .16);
  --accent: #8B9BFF;
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --blob-1: #3B49C9;
  --blob-2: #1E7F6B;
  --blob-3: #6A3AA8;
}
html[data-theme='light'] {
  --bg: #EDEFF4;
  --bg-2: #F7F8FB;
  --ink: #12141A;
  --ink-2: #5A6176;
  --ink-3: #8C93A6;
  --glass: rgba(255, 255, 255, .62);
  --glass-2: rgba(255, 255, 255, .82);
  --line: rgba(18, 20, 26, .07);
  --line-2: rgba(18, 20, 26, .14);
  --accent: #4E5DD8;
  --shadow: 0 20px 46px rgba(30, 38, 66, .13);
  --blob-1: #A9B6FF;
  --blob-2: #9BE7D2;
  --blob-3: #D9C2FF;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* мягкие световые пятна под стеклом */
body::before, body::after {
  content: ''; position: fixed; z-index: 0; pointer-events: none;
  width: 62vw; height: 62vw; border-radius: 50%;
  filter: blur(90px); opacity: .5;
}
body::before { top: -22vw; left: -14vw; background: radial-gradient(circle, var(--blob-1), transparent 65%); }
body::after { bottom: -26vw; right: -16vw; background: radial-gradient(circle, var(--blob-2), transparent 65%); }
.blob-3 {
  position: fixed; z-index: 0; pointer-events: none;
  top: 30vh; right: 8vw; width: 34vw; height: 34vw; border-radius: 50%;
  background: radial-gradient(circle, var(--blob-3), transparent 65%);
  filter: blur(100px); opacity: .35;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- стеклянные поверхности ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: var(--shadow);
}
.card { padding: var(--pad); }
.soft { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-md); }

/* ---------- каркас ---------- */
#app { position: relative; z-index: 1; min-height: 100%; }
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; max-width: 1280px; margin: 0 auto; padding: 22px; }

.rail { position: sticky; top: 22px; align-self: start; padding: 18px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 18px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 17px;
  background: linear-gradient(150deg, var(--accent), transparent 140%);
  border: 1px solid var(--line-2); color: #fff;
}
html[data-theme='light'] .brand-mark { color: #fff; }
.brand-name { font-family: var(--display); font-weight: 500; letter-spacing: -.02em; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 500; transition: background .18s, color .18s;
}
.nav a:hover { background: var(--glass-2); color: var(--ink); }
.nav a.on { background: var(--glass-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.nav .ico { width: 18px; text-align: center; opacity: .85; font-size: 15px; }
.rail-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }

main { min-width: 0; display: flex; flex-direction: column; gap: 18px; padding-bottom: 90px; }

/* ---------- типографика ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -.025em; margin: 0; }
h1 { font-size: clamp(24px, 4vw, 36px); line-height: 1.08; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; line-height: 1.6; }
.muted { color: var(--ink-2); font-size: 14px; }
.tiny { font-size: 12px; color: var(--ink-3); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }

/* ---------- элементы управления ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--glass); backdrop-filter: blur(14px); cursor: pointer;
  font-size: 14px; font-weight: 500; transition: transform .15s, background .18s, border-color .18s;
}
.btn:hover { background: var(--glass-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 10px 26px -12px var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn.block { width: 100%; }

input, select, textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(10px);
  transition: border-color .18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2);
  cursor: pointer; transition: background .16s, color .16s, border-color .16s;
}
.chip:hover { background: var(--glass-2); color: var(--ink); }
.chip.on { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.tag { font-family: var(--mono); font-size: 11px; padding: 4px 8px; border-radius: 7px; background: var(--glass-2); border: 1px solid var(--line); color: var(--ink-2); }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* ---------- сетки ---------- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }

/* ---------- метрика ---------- */
.metric { padding: 18px; }
.metric .v { font-family: var(--display); font-size: 30px; font-weight: 500; line-height: 1; letter-spacing: -.03em; }
.metric .k { font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.metric .hint { font-size: 11px; color: var(--ink-3); margin-top: 3px; font-family: var(--mono); }

/* ---------- ПОДПИСЬ ПРОЕКТА: лента заданий ---------- */
.strip-wrap { overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.strip { display: flex; gap: 7px; min-width: max-content; }
.cell {
  --fill: var(--ink-3);
  position: relative; width: 46px; flex: 0 0 46px; height: 62px; border-radius: 15px;
  background: var(--glass); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 8px; cursor: pointer; overflow: hidden;
  transition: transform .16s, border-color .16s;
}
.cell:hover { transform: translateY(-3px); border-color: var(--line-2); }
.cell .n { font-family: var(--mono); font-size: 13px; font-weight: 600; z-index: 2; }
.cell .p { font-size: 9px; z-index: 2; color: var(--ink-3); font-family: var(--mono); margin-top: 2px; }
.cell .bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--h, 0%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--fill) 55%, transparent), var(--fill));
  opacity: .55; transition: height .5s cubic-bezier(.2, .8, .2, 1);
}
.cell.blank { border-style: dashed; opacity: .6; }
.cell.done { --fill: var(--ok); }
.cell.mid { --fill: var(--warn); }
.cell.weak { --fill: var(--bad); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-3); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 5px; }

/* ---------- задача ---------- */
.task { display: flex; flex-direction: column; gap: 14px; }
.task-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-no {
  font-family: var(--display); font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 22%, transparent); border: 1px solid var(--line-2);
}
.task-text { font-size: 15.5px; line-height: 1.7; white-space: pre-wrap; }
.source {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding-top: 10px; border-top: 1px dashed var(--line);
}
.source b { font-weight: 600; color: var(--ink-2); }
.verdict { padding: 14px 16px; border-radius: var(--r-md); font-size: 14px; line-height: 1.6; border: 1px solid var(--line-2); }
.verdict.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.verdict.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 38%, transparent); }
.verdict.neutral { background: var(--glass-2); }
.solution { font-size: 14px; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; }

/* ---------- список ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { padding: 14px 16px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--line); transition: border-color .16s, transform .16s; }
.item:hover { border-color: var(--line-2); transform: translateX(2px); }
.item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.clip { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- прогресс ---------- */
.bar-line { height: 7px; border-radius: 99px; background: var(--glass-2); overflow: hidden; border: 1px solid var(--line); }
.bar-line i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--ok))); transition: width .6s cubic-bezier(.2, .8, .2, 1); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 46px; }
.spark i { flex: 1; min-width: 3px; border-radius: 3px 3px 1px 1px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.spark i.zero { background: var(--glass-2); }

/* ---------- вход ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth { width: 100%; max-width: 430px; padding: 30px; }
.auth h1 { font-size: 27px; margin-bottom: 8px; }
.switch { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); margin: 18px 0; }
.switch button { flex: 1; padding: 9px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.switch button.on { background: var(--glass-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---------- прочее ---------- */
.err { color: var(--bad); font-size: 13px; }
.empty { padding: 34px 20px; text-align: center; color: var(--ink-3); font-size: 14px; }
.toast-box { position: fixed; z-index: 60; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 11px 18px; border-radius: 999px; font-size: 13.5px; animation: rise .3s ease; max-width: 90vw; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.fade { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }

.tabbar { display: none; }

/* ---------- телефон ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
  .rail { position: static; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; }
  .rail .nav, .rail .rail-foot { display: none; }
  .brand { padding: 0; }
  main { padding-bottom: 96px; }
  .tabbar {
    display: flex; position: fixed; z-index: 50; bottom: 12px; left: 12px; right: 12px;
    padding: 7px; justify-content: space-between; border-radius: 26px;
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 2px; border-radius: 18px; font-size: 10px; color: var(--ink-3);
  }
  .tabbar a.on { background: var(--glass-2); color: var(--ink); }
  .tabbar .ico { font-size: 17px; }
  .metric .v { font-size: 25px; }
}

/* =========================================================
   Добавлено во второй партии: иконки, картинки к заданиям,
   теория, редактор предмета, запрет случайного выделения.
   ========================================================= */

/* Случайное выделение текста при тапе и прокрутке — выключено везде,
   кроме содержательных мест: условие, разбор, теория, поля ввода. */
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.selectable, input, textarea, select, .task-text, .solution, .theory-body, .source {
  -webkit-user-select: text;
  user-select: text;
}

/* ---------- свои иконки ---------- */
.ico { display: inline-flex; align-items: center; justify-content: center; }
.nav .ico { width: 20px; height: 20px; opacity: .8; }
.nav .ico svg { width: 19px; height: 19px; }
.nav a.on .ico { opacity: 1; color: var(--accent); }
.tabbar .ico svg { width: 21px; height: 21px; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.brand { text-decoration: none; }

/* ---------- картинки в заданиях ---------- */
.shots { display: flex; gap: 10px; flex-wrap: wrap; }
.shots img {
  /* важно: у SVG без явных размеров браузер может дать нулевую высоту,
     поэтому задаём ширину явно, а высоту считаем по пропорции */
  width: min(100%, 460px); height: auto; min-height: 60px;
  border-radius: var(--r-md);
  border: 1px solid var(--line); background: #fff; display: block;
}
.shots-edit { display: flex; gap: 8px; flex-wrap: wrap; }
.shot-mini { position: relative; }
.shot-mini img {
  width: 92px; height: 72px; object-fit: cover; border-radius: var(--r-sm);
  border: 1px solid var(--line); display: block;
}
.shot-mini button {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); cursor: pointer;
  font-size: 14px; line-height: 1; display: grid; place-items: center;
}
.task-tools { gap: 8px; }

/* ---------- теория ---------- */
.theory-body {
  margin-top: 14px; font-size: 15px; line-height: 1.75; white-space: pre-wrap;
  color: var(--ink); max-width: 66ch;
}
.theory h2 { font-size: 21px; }
.cell.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ---------- редактор предмета ---------- */
.nrow {
  display: flex; gap: 8px; align-items: center; padding: 8px;
  border-radius: var(--r-sm); border: 1px solid var(--line); margin-bottom: 8px;
  background: var(--glass);
}
.nrow input, .nrow select { padding: 9px 11px; border-radius: 10px; }
.nrow > input:first-of-type { flex: 1 1 180px; min-width: 120px; }
.nrow .btn { padding: 7px 10px; }
@media (max-width: 700px) {
  .nrow { flex-wrap: wrap; }
  .nrow > input:first-of-type { flex: 1 1 100%; }
}

/* поле выбора цвета */
input[type='color'] { cursor: pointer; }

/* моноширинные вставки в подсказках */
code {
  font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: 7px;
  background: var(--glass-2); border: 1px solid var(--line); white-space: nowrap;
}

/* =========================================================
   Партия 4: исходные тексты и проверка развёрнутых ответов
   ========================================================= */
.passage {
  margin: 4px 0 2px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--glass);
  overflow: hidden;
}
.passage > summary {
  cursor: pointer; padding: 12px 16px; font-size: 13.5px; color: var(--ink-2);
  display: flex; align-items: center; gap: 10px; list-style: none;
  transition: background .16s;
}
.passage > summary::-webkit-details-marker { display: none; }
.passage > summary::after {
  content: ''; margin-left: auto; width: 7px; height: 7px; opacity: .55;
  border-right: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor;
  transform: rotate(45deg); transition: transform .2s;
}
.passage[open] > summary::after { transform: rotate(225deg); }
.passage > summary:hover { background: var(--glass-2); color: var(--ink); }
.ptag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
}
.passage-body {
  padding: 4px 18px 18px; font-size: 15px; line-height: 1.8; white-space: pre-wrap;
  color: var(--ink); max-width: 68ch; border-top: 1px solid var(--line);
  padding-top: 16px; margin-top: 0;
}

/* ответ ученика на развёрнутое задание */
.answer-box {
  margin-top: 10px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--glass-2); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.65; white-space: pre-wrap; max-height: 260px; overflow: auto;
}

/* =========================================================
   Партия 5: ключи к варианту и печать
   ========================================================= */
.keys { margin-top: 4px; }
.keys h3 { font-family: var(--display); font-size: 15px; margin-bottom: 10px; }
.keys-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}
.keys-table td:first-child { width: 64px; color: var(--ink-2); }
.keys-table td:last-child { width: 64px; text-align: right; color: var(--ink-3); }

/* ---------- печатный вид ---------- */
@media print {
  @page { margin: 14mm 12mm; }
  html, body { background: #fff !important; color: #000 !important; }
  body::before, body::after, .blob-3 { display: none !important; }
  .rail, .tabbar, .no-print, .toast-box, .task-tools, .legend, .spark { display: none !important; }
  .shell { display: block !important; max-width: none; padding: 0; }
  main { gap: 0 !important; padding: 0 !important; }

  /* стекло на бумаге — это серые пятна, убираем всё */
  .glass, .soft, .card, .item, .passage, .verdict, .answer-box {
    background: #fff !important; border: 0 !important; box-shadow: none !important;
    backdrop-filter: none !important; border-radius: 0 !important;
    padding-left: 0 !important; padding-right: 0 !important;
  }
  .glass.card.task {
    border-top: 1px solid #ccc !important; padding: 10px 0 !important;
    break-inside: avoid; page-break-inside: avoid;
  }
  .task-no {
    background: #eee !important; color: #000 !important; border: 1px solid #999 !important;
    border-radius: 4px !important;
  }
  .tag { border-color: #bbb !important; color: #444 !important; }
  .task-text, .passage-body { color: #000 !important; font-size: 12pt; }
  h1 { font-size: 18pt; } h2 { font-size: 13pt; }

  /* исходный текст печатается целиком, если его раскрыли */
  .passage > summary { list-style: none; font-weight: 600; padding: 8px 0 !important; }
  .passage > summary::after { display: none; }
  .passage[open] .passage-body { display: block !important; border-top: 0 !important; }

  /* поля для ответа вместо интерактивных элементов */
  input[type='text'], input:not([type]), textarea {
    border: 0 !important; border-bottom: 1px solid #000 !important; border-radius: 0 !important;
    background: transparent !important; min-height: 0 !important; padding: 2px 0 !important;
  }
  textarea { min-height: 90px !important; border: 1px solid #999 !important; }
  .chips[data-pts] { display: none !important; }

  /* ключи печатаются на отдельной странице и только если их попросили */
  #keysBox { display: none; }
  body.print-keys #keysBox {
    display: block !important; break-before: page; page-break-before: always;
  }
  body.print-keys #printBox { display: block !important; }
  body.print-keys #printBox .chips, body.print-keys #printBox .row,
  body.print-keys #printBox p, body.print-keys #printBox .eyebrow,
  body.print-keys #printBox h2 { display: none !important; }
  .keys-table td { border-bottom: 1px solid #ccc !important; }
}

/* мини-диаграмма наполнения по номерам задания */
.mini-bars {
  display: flex; align-items: flex-end; gap: 3px; height: 74px; margin-top: 10px;
  padding: 8px 10px; border-radius: var(--r-md);
  background: var(--glass); border: 1px solid var(--line);
}
.mini-bars i {
  flex: 1; min-width: 3px; border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent));
  height: 3%; transition: height .7s cubic-bezier(.2,.8,.2,1);
}

/* =========================================================
   Группы в боковом меню
   ========================================================= */
.nav-group { margin-bottom: 4px; }
.nav-title {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; cursor: pointer; padding: 9px 12px 5px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); transition: color .15s;
}
.nav-title:hover { color: var(--ink-2); }
.nav-title i {
  width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .2s; opacity: .7;
}
.nav-group.closed .nav-title i { transform: rotate(-45deg); }
.nav-links { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.nav-group.closed .nav-links { display: none; }

/* =========================================================
   Аккуратные таблицы
   ========================================================= */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--glass); }
.tbl th {
  text-align: left; padding: 11px 14px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  background: var(--glass-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--glass-2); }
.tbl td.num, .tbl th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl.compact th, .tbl.compact td { padding: 8px 12px; font-size: 13px; }
.tbl .tag { font-size: 11px; }

/* =========================================================
   Компактная печать: экономим бумагу
   ========================================================= */
@media print {
  body.print-compact main { column-count: 2; column-gap: 12mm; }
  body.print-compact .glass.card.task {
    break-inside: avoid; page-break-inside: avoid;
    padding: 6px 0 !important; margin: 0 0 6px !important;
    border-top: 1px solid #ccc !important;
  }
  body.print-compact .task-text, body.print-compact .passage-body { font-size: 10.5pt; line-height: 1.35; }
  body.print-compact .page-head, body.print-compact h1 { column-span: all; }
  body.print-compact .glass.card:not(.task) { column-span: all; }
  body.print-compact .shots img { max-width: 74mm; }
  body.print-compact textarea { min-height: 42px !important; }
  body.print-compact .source { font-size: 7.5pt; }
  body.print-compact .task-no { padding: 1px 5px !important; font-size: 9pt; }
  /* задания с рисунком не рвём и не сжимаем в колонку слишком сильно */
  body.print-compact .glass.card.task:has(.shots) { column-span: all; }
}

/* =========================================================
   Печатный отчёт «класс к экзамену»
   ========================================================= */
.report-sheet {
  background: #fff; color: #14171F; padding: 22px 26px;
  border-radius: var(--r-md); border: 1px solid var(--line);
}
.report-sheet .tbl { background: #fff; font-size: 12.5px; }
.report-sheet .tbl th { background: #F3F5FB; color: #5A6172; }
.report-sheet .tbl td { color: #14171F; border-color: #E3E7F0; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding-bottom: 12px; border-bottom: 2px solid #14171F; }
.report-foot { margin-top: 16px; padding-top: 10px; border-top: 1px solid #E3E7F0; color: #7A8296; }

@media print {
  body.print-report aside, body.print-report .tabbar, body.print-report .no-print { display: none !important; }
  body.print-report main { padding: 0 !important; max-width: none !important; }
  body.print-report .report-sheet { border: 0; padding: 0; border-radius: 0; }
  body.print-report .report-sheet .tbl { page-break-inside: auto; }
  body.print-report .report-sheet tr { page-break-inside: avoid; }
  body.print-report .tag { border: 1px solid #999 !important; background: none !important; color: #14171F !important; }
}

/* =========================================================
   Экран «Сегодня»
   ========================================================= */
.today-hero { display: flex; gap: 26px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.today-left { flex: 1 1 320px; }
.today-right { flex: 0 0 auto; }
.btn.big { font-size: 16px; padding: 15px 28px; border-radius: var(--r-md); }

/* кольцо дневной цели */
.ring { position: relative; width: 150px; height: 150px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .ring-bg { stroke: var(--line); }
.ring .ring-fg { stroke: var(--accent); transition: stroke-dasharray .8s cubic-bezier(.2,.8,.2,1); }
.ring-mid {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
.ring-mid b { font-size: 32px; font-family: var(--mono); line-height: 1; }
.ring-mid span { font-size: 11.5px; color: var(--ink-3); }

/* календарь занятий */
.heat { display: flex; gap: 4px; flex-wrap: wrap; }
.heat i {
  width: 16px; height: 16px; border-radius: 4px;
  background: var(--glass-2); border: 1px solid var(--line);
}
.heat i.on { background: var(--accent); border-color: transparent; }

/* сессия */
.session-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.session-top .bar { flex: 1; height: 8px; border-radius: 4px; background: var(--glass-2); overflow: hidden; border: 1px solid var(--line); }
.session-top .bar i { display: block; height: 100%; background: var(--accent); transition: width .5s ease; }
.session-why { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.done-mark {
  width: 74px; height: 74px; margin: 0 auto; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 38px;
  display: flex; align-items: center; justify-content: center;
}
@media (max-width: 720px) {
  .today-hero { flex-direction: column-reverse; align-items: flex-start; }
  .ring { width: 118px; height: 118px; }
  .ring-mid b { font-size: 26px; }
}

/* плитки раздела «Материалы» */
.tile { display: block; text-decoration: none; color: inherit; transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile .ico { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--glass-2); color: var(--accent); }

/* переключатель роли и выбор возможностей */
.view-switch { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.hat {
  display: flex; gap: 10px; align-items: flex-start; flex: 1 1 220px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--glass); border: 1px solid var(--line); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.hat:hover { border-color: var(--accent); }
.hat.on { border-color: var(--accent); background: var(--glass-2); }
.hat input { width: auto; margin: 3px 0 0; flex: 0 0 auto; }

/* =========================================================
   Модальные окна (замена системных confirm/prompt)
   ========================================================= */
.modal-wrap { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-back { position: absolute; inset: 0; background: rgba(6, 8, 16, .62); backdrop-filter: blur(3px); }
.modal {
  position: relative; width: min(460px, 100%); max-height: 86vh; overflow: auto;
  background: var(--bg-2, var(--glass)); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.modal h3 { font-family: var(--display); font-size: 19px; line-height: 1.3; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.modal-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.modal-choice {
  text-align: left; padding: 13px 15px; border-radius: var(--r-sm);
  background: var(--glass); border: 1px solid var(--line); color: var(--ink);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.modal-choice:hover { border-color: var(--accent); background: var(--glass-2); }
.modal-choice b { display: block; font-size: 14.5px; }
.modal-choice span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .btn { flex: 0 0 auto; }
.btn.danger { background: var(--bad, #D6553F); color: #fff; border-color: transparent; }

/* =========================================================
   Телефон: кнопка меню в шапке + просторнее интерфейс
   ========================================================= */
.rail-more { display: none; }
@media (max-width: 900px) {
  .rail-more {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 42px; height: 42px; padding: 0 11px; flex: 0 0 auto;
    border-radius: 13px; background: var(--glass-2); border: 1px solid var(--line); cursor: pointer;
  }
  .rail-more span { display: block; height: 2px; border-radius: 2px; background: var(--ink-2); }
  .brand-sub.num { display: none; }           /* версия сборки — только на большом экране */

  .shell { padding: 12px; gap: 12px; }
  main { padding-bottom: 104px; }

  /* воздух: на телефоне всё читалось слишком тесно */
  .card { padding: 18px 16px; border-radius: 18px; }
  .glass.card + .glass.card { margin-top: 14px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
  .page-head h1 { font-size: 26px; line-height: 1.2; }
  h2 { font-size: 18px; }
  .grid.g2, .grid.g3, .grid.g4 { grid-template-columns: 1fr; gap: 12px; }
  .row { flex-wrap: wrap; gap: 10px; }
  .row > * { min-width: 0; }

  /* кнопки и поля — под палец */
  .btn { min-height: 46px; padding: 12px 18px; font-size: 14.5px; }
  .btn.sm { min-height: 40px; padding: 10px 14px; }
  input, select, textarea { min-height: 46px; font-size: 16px; }  /* 16px — иначе iOS зумит страницу */
  .chip { min-height: 36px; display: inline-flex; align-items: center; }

  /* таблицы прокручиваются, а не ломают вёрстку */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 520px; }

  /* задание читается крупнее */
  .task-text { font-size: 16px; line-height: 1.62; }
  .modal { padding: 18px; border-radius: 20px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}
@media (max-width: 420px) {
  .tabbar a { font-size: 9.5px; }
  .page-head h1 { font-size: 23px; }
}

/* согласие при регистрации */
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; cursor: pointer; line-height: 1.5; }
.consent input { width: auto; min-height: 0; margin: 2px 0 0; flex: 0 0 auto; }
.consent a { color: var(--accent); }

/* ---------- компактная форма входа и регистрации ---------- */
.auth .field { margin-top: 12px; }
.auth .field label { font-size: 12.5px; margin-bottom: 6px; }
.auth-row { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.chips.sm .chip { padding: 7px 12px; font-size: 13px; min-height: 0; }
.auth-more { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.auth-more summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); list-style: none; }
.auth-more summary::-webkit-details-marker { display: none; }
.auth-more summary::after { content: '+'; float: right; color: var(--ink-3); }
.auth-more[open] summary::after { content: '–'; }
.auth-more input { width: 100%; }
.auth .consent { margin-top: 12px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 13px; }
.auth-links a { color: var(--ink-3); text-decoration: none; }
.auth-links a:hover { color: var(--accent); }

/* настоящий логотип вместо буквы */
.brand-logo { width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; display: block; }

/* =========================================================
   ТЕЛЕФОН — второй проход (плавность и плотность)
   ========================================================= */
@media (max-width: 900px) {
  /* ПЛАВНОСТЬ. Размытие фона под каждой стеклянной карточкой телефон
     пересчитывает в каждом кадре прокрутки — отсюда подлагивания.
     Заменяем на плотный фон: выглядит так же, работает в разы легче. */
  .glass, .tabbar, .modal, .soft {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  html[data-theme='light'] .glass { background: rgba(255, 255, 255, .96); }
  html[data-theme='dark'] .glass { background: rgba(20, 22, 32, .97); }
  html[data-theme='light'] .tabbar { background: rgba(255, 255, 255, .98); }
  html[data-theme='dark'] .tabbar { background: rgba(18, 20, 30, .98); }
  .glass { box-shadow: 0 4px 16px rgba(10, 12, 25, .06); }
  /* светящиеся пятна с размытием 90–100px — тоже тяжёлые, на телефоне убираем */
  body::before, body::after, .blob-3 { display: none !important; }
  html[data-theme='light'] body { background: linear-gradient(180deg, #F3F4FA 0%, #ECEEF6 100%); }
  html[data-theme='dark'] body { background: linear-gradient(180deg, #0B0C12 0%, #0E1017 100%); }

  /* ШАПКА. Переключатель ролей уже есть в меню «☰» — в шапке он
     дублировался и выстраивался столбиком на полэкрана */
  .rail .view-switch { display: none !important; }
  .rail { padding: 10px 12px; gap: 10px; }
  .brand { min-width: 0; flex: 1 1 auto; gap: 10px; }
  .brand > div { min-width: 0; }
  .brand-name { font-size: 16px; }
  .brand-sub {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 62vw; display: block;
  }
  .brand-logo { width: 38px; height: 38px; }

  /* ПЛОТНОСТЬ. Цифры — по две в ряд, а не по одной на экран */
  .grid.g3, .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .metric { padding: 13px 14px; }
  .metric .v { font-size: 22px; }
  .metric .k { font-size: 11.5px; margin-top: 6px; }
  .metric .hint { font-size: 10.5px; }

  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 23px; }
  .card { padding: 16px 15px; }
  .glass.card + .glass.card { margin-top: 12px; }

  /* НИЖНИЕ ВКЛАДКИ: подпись в одну строку, без переносов */
  .tabbar { bottom: 10px; left: 10px; right: 10px; padding: 6px; }
  .tabbar a {
    font-size: 10.5px; padding: 7px 2px; gap: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  }
  main { padding-bottom: 104px; }

  /* кнопки в строке карточки — переносятся ровно, не налезают */
  .item .row { gap: 8px; }
  .item .row .btn { flex: 1 1 auto; }

  /* всплывающие уведомления — над нижними вкладками, а не под ними */
  .toast-box { bottom: 92px; }
}
@media (max-width: 900px) {
  /* пары цифр — тоже в ряд; обычные карточки в .g2 остаются столбиком */
  .grid.g2:has(> .metric) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
}
