/* school-portal — визуальный слой */
:root {
  --ink: #101319;
  --ink-2: #2b3040;
  --muted: #6b7280;
  --muted-2: #8b94a7;
  --paper: #f5f6fa;
  --card: #ffffff;
  --line: rgba(16, 19, 25, 0.08);
  --line-strong: rgba(16, 19, 25, 0.14);
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --green: #128a4d;
  --green-soft: #e6f7ee;
  --amber: #b45309;
  --amber-soft: #fef4e2;
  --red: #c02626;
  --red-soft: #fdecec;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 19, 25, .04), 0 12px 32px -18px rgba(16, 19, 25, .28);
  --shadow-lg: 0 2px 4px rgba(16, 19, 25, .05), 0 28px 60px -32px rgba(16, 19, 25, .38);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
body.bg-auth {
  background:
    radial-gradient(1200px 620px at 12% -10%, #dfe3ff 0%, rgba(223, 227, 255, 0) 60%),
    radial-gradient(1000px 560px at 92% 4%, #dcf6ee 0%, rgba(220, 246, 238, 0) 58%),
    var(--paper);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: #d8dbff; }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 256px; flex: 0 0 256px;
  padding: 22px 16px 22px 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 6px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px;
  background: linear-gradient(140deg, #4f46e5, #7c5cff 55%, #22b8a6);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 17px; letter-spacing: -.5px;
  box-shadow: 0 8px 18px -10px rgba(79, 70, 229, .9);
}
.brand-text b { display: block; font-size: 15px; letter-spacing: -.2px; }
.brand-text span { display: block; font-size: 11.5px; color: var(--muted-2); letter-spacing: .04em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 11px; color: var(--ink-2);
  font-size: 14px; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(16, 19, 25, .045); }
.nav a.on { background: #fff; box-shadow: var(--shadow); color: var(--ink); font-weight: 600; }
.nav a .ico { width: 22px; text-align: center; font-size: 15px; }
.nav a .cnt { margin-left: auto; font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.who .av { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.who .nm { min-width: 0; }
.who .nm b { display: block; font-size: 13px; line-height: 1.2; }
.who .nm span { font-size: 11px; color: var(--muted-2); }
.who button { margin-left: auto; border: 0; background: none; color: var(--muted-2); font-size: 16px; padding: 4px; border-radius: 8px; }
.who button:hover { background: rgba(16, 19, 25, .06); color: var(--ink); }

.main { flex: 1; min-width: 0; padding: 30px 34px 80px; }
.wrap { max-width: 1080px; margin: 0 auto; }

/* ---------- авторизация ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 24px;
  padding: 34px 32px 28px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.auth-card .brand { padding: 0 0 18px; }
.auth-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.4px; }
.auth-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 11px; padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: #b9bdf7; box-shadow: 0 0 0 4px #eef0ff; }
.textarea { min-height: 84px; resize: vertical; }
.btn {
  border: 0; border-radius: 11px; padding: 11px 18px; font-weight: 600; font-size: 14px;
  background: var(--accent); color: #fff; transition: transform .1s, box-shadow .15s, background .15s;
  box-shadow: 0 10px 22px -14px rgba(79, 70, 229, .9);
}
.btn:hover { background: #443ddb; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); box-shadow: none; }
.btn.ghost:hover { background: #fafbff; border-color: #cfd4ee; }
.btn.soft { background: var(--accent-soft); color: #3b34c9; box-shadow: none; }
.btn.soft:hover { background: #e4e7ff; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.btn.danger { background: var(--red-soft); color: var(--red); box-shadow: none; }
.hint { font-size: 12.5px; color: var(--muted-2); }
.err { color: var(--red); font-size: 13px; background: var(--red-soft); padding: 9px 12px; border-radius: 10px; margin-bottom: 14px; }

/* ---------- блоки ---------- */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { font-size: 27px; margin: 0; letter-spacing: -.6px; }
.top .lead { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.crumbs { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted-2); margin-bottom: 12px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 22px 24px; }
.main .wrap > .card + .card,
.main .wrap > .viz-list + .card { margin-top: 18px; }
.grid { display: grid; gap: 16px; }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { padding: 18px 20px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat .lab { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); }
.stat .val { font-size: 30px; font-weight: 750; letter-spacing: -1.2px; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .val small { font-size: 14px; font-weight: 600; color: var(--muted-2); letter-spacing: 0; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* прогресс */
.bar { height: 7px; border-radius: 99px; background: #eceef5; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6b63f0, #4f46e5); transition: width .5s ease; }
.ring { --p: 0; --c: var(--accent); width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 56px;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #eceef5 0); }
.ring > span { width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* предметы на дашборде */
.subj-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; position: relative; overflow: hidden; transition: transform .16s, box-shadow .16s; }
.subj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.subj-card::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, var(--accent)); }
.subj-head { display: flex; align-items: center; gap: 12px; }
.subj-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; background: color-mix(in srgb, var(--c, var(--accent)) 11%, #fff); }
.subj-head b { font-size: 16px; letter-spacing: -.2px; display: block; }
.subj-head span { font-size: 12px; color: var(--muted-2); }
.subj-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: #f2f4f9; color: var(--ink-2); white-space: nowrap; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.violet { background: var(--accent-soft); color: #3b34c9; }
.chip.line { background: #fff; border: 1px solid var(--line-strong); color: var(--muted); }

/* список тем */
.list { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px;
  border-bottom: 1px solid var(--line); transition: background .14s;
}
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: #fafbff; }
.row-num { width: 26px; flex: 0 0 26px; font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.row-main { min-width: 0; flex: 1; }
.row-main b { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: -.1px; }
.row-main .m { display: block; font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.row-item.done .row-main b { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }
.tick { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 22px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 800; }
.tick.empty { background: #f1f2f7; color: #c3c8d6; }
.score-pill { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; padding: 3px 9px; border-radius: 8px; }
.score-pill.g { background: var(--green-soft); color: var(--green); }
.score-pill.a { background: var(--amber-soft); color: var(--amber); }
.score-pill.r { background: var(--red-soft); color: var(--red); }

/* тема: обзор */
.topic-hero { padding: 26px 28px; }
.topic-hero h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.4px; }
.kv { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.md h2 { font-size: 18px; margin: 22px 0 8px; letter-spacing: -.3px; }
.md h3 { font-size: 15.5px; margin: 18px 0 6px; }
.md p { margin: 9px 0; }
.md ul, .md ol { margin: 9px 0; padding-left: 20px; }
.md li { margin: 4px 0; }
.md strong { font-weight: 700; }
.md code { background: #f2f4f9; padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.md blockquote { margin: 12px 0; padding: 10px 14px; border-left: 3px solid #cfd4ee; background: #fafbff; border-radius: 0 10px 10px 0; color: var(--ink-2); }
.md.fact { color: var(--ink-2); font-size: 14.5px; }

/* тест */
.test-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.part-badge { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; margin: 26px 2px 10px; display: flex; align-items: center; gap: 10px; }
.part-badge::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.task { padding: 20px 22px; margin-bottom: 12px; }
.task-head { display: flex; gap: 12px; align-items: flex-start; }
.task-n { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 9px; background: #f2f4f9; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.task-n.ok { background: var(--green-soft); color: var(--green); }
.task-n.mid { background: var(--amber-soft); color: var(--amber); }
.task-n.bad { background: var(--red-soft); color: var(--red); }
.task-body { flex: 1; min-width: 0; }
.task-prompt { font-size: 14.5px; line-height: 1.5; }
.task-prompt b { font-weight: 650; }
.task-src { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }
.task-mark { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; margin-left: 10px; }
.card.task { position: relative; padding-right: 104px; }
.task-side { position: absolute; top: 18px; right: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 82px; }
.task-side .task-mark { margin-left: 0; text-align: right; }
.task-save { display: none; font-size: 11px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; color: var(--green); }
.task-save.on { display: inline-flex; align-items: center; gap: 3px; }
.task-save b { font-size: 12px; line-height: 1; }
.task-save.pending { color: var(--muted-2); }
.task-save.error { color: var(--red); }

/* живой индикатор заполнения теста */
.chip.prog { position: relative; overflow: hidden; background: #eef0f7; padding: 5px 12px; isolation: isolate; }
.chip .prog-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(90deg, #d9ddff, #bcc3ff);
  transition: width .25s ease; z-index: -1;
}
.chip.prog .prog-text { position: relative; font-variant-numeric: tabular-nums; font-weight: 700; }
.task-answer { margin-top: 14px; }
.task-answer .input, .task-answer .textarea { font-size: 14.5px; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; margin-bottom: 8px; cursor: pointer; transition: background .13s, border-color .13s; }
.opt:hover { background: #fafbff; }
.opt input { margin: 2px 0 0; accent-color: var(--accent); }
.opt.sel { border-color: #c3c7f8; background: #f6f7ff; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 420px; }
table.tbl th, table.tbl td { padding: 9px 11px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; }
table.tbl th { background: #fafbff; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl th:last-child, table.tbl td:last-child { border-right: 0; }
table.tbl td input { width: 100%; border: 0; background: transparent; outline: none; padding: 3px 2px; font-size: 13.5px; }
table.tbl td input:focus { background: #f4f5ff; border-radius: 6px; }
table.tbl td.label { font-weight: 600; background: #fcfcff; }

.drop {
  border: 1.5px dashed #cfd5e8; border-radius: 14px; padding: 18px; text-align: center;
  color: var(--muted); font-size: 13px; background: #fbfcff; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: #a9b0f0; background: #f4f6ff; }
.drop b { color: var(--ink); display: block; margin-bottom: 3px; font-size: 13.5px; }
.shot {
  position: relative; display: inline-block; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line-strong); background: #f7f8fc; margin-top: 4px;
  box-shadow: var(--shadow);
}
.shot img {
  display: block; width: 280px; height: 190px; object-fit: cover; cursor: zoom-in;
  transition: transform .22s ease, filter .22s ease;
}
.shot:hover img { transform: scale(1.03); filter: brightness(.97); }
.shot-actions {
  position: absolute; inset: auto 0 0 0; display: flex; gap: 6px; padding: 9px;
  background: linear-gradient(transparent, rgba(8, 10, 16, .68));
  opacity: 1;
}
.shot-actions button { backdrop-filter: blur(6px); }
.shot-actions button {
  border: 0; border-radius: 9px; padding: 6px 11px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, .95); color: var(--ink); cursor: pointer;
}
.shot-actions button:hover { background: #fff; }
.shot-actions button.del { color: var(--red); }
.shot-meta { font-size: 12px; color: var(--muted-2); margin-top: 8px; }

/* модалка просмотра фото */
.lightbox {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  padding: 24px; background: rgba(8, 10, 16, .9); backdrop-filter: blur(3px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain;
  border-radius: 12px; box-shadow: 0 30px 90px -24px rgba(0, 0, 0, .85); background: #111;
}
.lightbox-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; cursor: pointer; font-size: 17px; line-height: 1;
  background: rgba(255, 255, 255, .14); color: #fff;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .26); }
body.lightbox-open { overflow: hidden; }

@media (max-width: 860px) {
  .shot img { width: 100%; max-width: 320px; height: 170px; }
  .shot-actions { opacity: 1; }
  .lightbox { padding: 12px; }
  .lightbox img { max-height: calc(100vh - 90px); }
}
.preview img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.preview .meta { font-size: 12.5px; color: var(--muted); }

.submit-bar {
  position: sticky; bottom: 0; margin-top: 22px; padding: 14px 18px;
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.submit-bar .status { font-size: 12.5px; color: var(--muted-2); }
.submit-bar .status.saved { color: var(--green); }
.submit-bar .grow { flex: 1; }

/* результат */
.result-hero { padding: 26px 28px; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.big-score { font-size: 52px; font-weight: 800; letter-spacing: -2.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.big-score small { font-size: 17px; font-weight: 600; color: var(--muted-2); letter-spacing: 0; }
.comment { margin-top: 10px; font-size: 14px; color: var(--ink-2); background: #fafbff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.mark-line { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); background: #fcfcff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.mark-line b { color: var(--ink); }

/* админка */
.tabs { display: flex; gap: 6px; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 9px 14px; border-radius: 10px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--accent-soft); color: #3b34c9; }
.tabs button:hover:not(.on) { background: #f6f7fb; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.full { grid-column: 1 / -1; }
.admin-note { font-size: 12.5px; color: var(--muted); background: #fafbff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }/* комбобокс выбора модели */
.combo { position: relative; }
.combo .input { padding-right: 34px; }
.combo-caret {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--muted-2); font-size: 11px; padding: 4px 5px;
  border-radius: 6px; line-height: 1;
}
.combo-caret:hover { background: #f1f2f7; color: var(--ink); }
.combo-panel {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 258px; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 5px;
}
.combo-item {
  padding: 8px 10px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-item b { font-weight: 700; color: var(--accent); }
.combo-tag {
  margin-left: 8px; font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
  color: #0e7a5f; background: #e3f7ef; border-radius: 5px; padding: 1px 5px; vertical-align: 1px;
}
.combo-item:hover, .combo-item.on { background: #f2f3fb; }
.combo-item.on { box-shadow: inset 2px 0 0 var(--accent); }
.combo-empty { padding: 10px 12px; font-size: 13px; color: var(--muted-2); }
.combo-foot { padding: 6px 10px 4px; font-size: 11.5px; color: var(--muted-2); border-top: 1px solid var(--line); margin-top: 4px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.data th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
table.data tr:last-child td { border-bottom: 0; }

/* тост */
#toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #101319; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 13.5px;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,.6); transition: opacity .2s, transform .2s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: #8f1d1d; }

.loading { padding: 60px 0; text-align: center; color: var(--muted-2); font-size: 13.5px; }
.skeleton { height: 92px; border-radius: var(--radius); background: linear-gradient(90deg, #eef0f6, #f7f8fc, #eef0f6); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { 0% { background-position: 0 0; } 100% { background-position: 200% 0; } }

@media (max-width: 1080px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side {
    width: auto; flex: none; height: auto; position: sticky; top: 0; z-index: 20;
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand who" "nav nav";
    align-items: center; gap: 10px; padding: 12px 14px;
    border-right: 0; border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px);
  }
  .brand { grid-area: brand; padding: 0; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; font-size: 15px; }
  .nav { grid-area: nav; display: flex; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-label, .nav a .cnt { display: none; }
  .nav a { padding: 7px 11px; white-space: nowrap; background: #fff; border: 1px solid var(--line); font-size: 13px; }
  .nav a.on { border-color: #d5d8f5; }
  .side-foot { grid-area: who; margin: 0; flex-direction: row; }
  .side-foot .hint { display: none; }
  .who { padding: 5px 6px; background: transparent; box-shadow: none; }
  .who .nm { display: none; }
  .who .av { width: 32px; height: 32px; }
  .main { padding: 18px 14px 60px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; gap: 10px; }
  .top h1 { font-size: 21px; }
  .top .lead { font-size: 13px; }
  .stat .val { font-size: 24px; }
  .topic-hero, .task, .result-hero, .card.pad { padding: 16px; }
  .submit-bar { position: static; padding: 12px 14px; }
  .card.task { padding-right: 62px; }
  .task-side { top: 14px; right: 14px; max-width: 44px; }
  .task-mark { font-size: 10.5px; }
  .task-save .sv-t { display: none; }
  .big-score { font-size: 42px; }
  table.data { font-size: 12.5px; }
  table.data th, table.data td { padding: 8px 8px; }
}

/* ================= формулы (мини-TeX) ================= */
/* вся формула — одна горизонтальная строка: и знаки, и дроби центрируются по её середине */
.tex {
  display: inline-flex; align-items: center; vertical-align: middle;
  font-family: "Times New Roman", "Georgia", serif; font-size: 1.22em;
  line-height: 1; white-space: nowrap; margin: 0 .12em;
}
.tex .tex-t { white-space: pre; }
.tex .tex-frac { display: inline-flex; flex-direction: column; align-items: center; margin: 0 .16em; }
.tex .tex-num { padding: 0 .24em .07em; line-height: 1.05; }
.tex .tex-den { padding: .07em .24em 0; line-height: 1.05; border-top: 1px solid currentColor; }
.tex .tex-sqrt { display: inline-flex; align-items: stretch; margin: 0 .08em 0 .02em; }
.tex .tex-rad {
  display: block; align-self: stretch; width: .46em; height: auto;
  overflow: visible; flex: 0 0 auto;
}
.tex .tex-radicand {
  border-top: 1.25px solid currentColor; padding: .07em .22em 0 .06em;
  display: inline-flex; align-items: center;
}
.tex .tex-sup { align-self: flex-start; font-size: .66em; line-height: 1; margin-top: -.28em; }
.tex .tex-sub { align-self: flex-end; font-size: .66em; line-height: 1; margin-bottom: -.16em; }
.tex .tex-text { font-family: inherit; font-style: normal; }
.tex .tex-vec { position: relative; }
.tex .tex-vec::before { content: "→"; position: absolute; top: -0.72em; left: 50%; transform: translateX(-50%) scale(0.7); }
.tex .tex-overline { border-top: 1px solid currentColor; }
.md .tex { font-size: 1.24em; }
.chip .tex { font-size: 1.06em; margin: 0 .06em; }
.chip .tex-frac { margin: 0 .1em; }

/* ================= визуализации ================= */
.viz-list { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; margin-bottom: 24px; }
.viz { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.viz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.viz-head b { font-size: 15px; letter-spacing: -.1px; }
.viz-head .hint { font-size: 12px; }
.viz-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.viz-chip {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 99px; padding: 5px 11px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.viz-chip:hover { background: #f6f7fc; }
.viz-chip.on { background: var(--accent-soft); border-color: #c7cbf7; color: #3b34c9; }

/* периодическая таблица */
.pct-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; max-width: 560px; }
.pct-cell {
  position: relative; aspect-ratio: 1; border: 1px solid var(--line); background: #fbfcff;
  border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 0; line-height: 1; transition: transform .12s, box-shadow .12s, background .12s;
}
.pct-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow); background: #fff; z-index: 2; }
.pct-cell.on { background: var(--accent-soft); border-color: #b9bdf7; box-shadow: 0 0 0 2px #e6e8ff; }
.pct-cell b { font-size: 13px; letter-spacing: -.02em; }
.pct-cell i { font-size: 9.5px; color: var(--muted-2); font-style: normal; margin-top: 2px; }
.pct-p1 { background: #eef2ff; } .pct-p2 { background: #f2f8f1; } .pct-p3 { background: #fdf6ec; } .pct-p4 { background: #faf1f4; }
.pct-extra-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.pct-extra { width: 34px; height: 34px; flex: 0 0 34px; background: #f7f4ff; }
.pct-extra b { font-size: 11px; } .pct-extra i { font-size: 8px; }
.pct-detail { margin-top: 14px; }
.el-card { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center;
  background: #fafbff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.el-card-head { display: flex; align-items: center; gap: 12px; }
.el-big { font-size: 30px; font-weight: 800; letter-spacing: -1px; color: var(--accent); min-width: 42px; }
.el-card-head span span { display: block; }
.el-facts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); grid-column: 1; }
.el-facts b { color: var(--ink); }
.atom-svg { grid-column: 2; grid-row: 1 / span 2; width: 168px; height: 168px; }
.atom-nuc { fill: #d94a3d; }
.atom-nuc-text { fill: #fff; font-size: 13px; font-weight: 700; text-anchor: middle; }
.atom-shell { fill: none; stroke: #c9cfe8; stroke-dasharray: 3 4; }
.atom-e { fill: #4f46e5; }
.atom-shell-label { font-size: 8.5px; fill: #8b94a7; text-anchor: middle; }
.atom-stage { display: flex; justify-content: center; padding: 6px 0 10px; }
.atom-stage .atom-svg { width: 240px; height: 240px; grid-column: auto; grid-row: auto; }

/* молекулы */
.mol-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.mol-card { margin: 0; border: 1px solid var(--line); border-radius: 14px; background: #fbfcff; padding: 6px 8px 8px; min-width: 150px; }
.mol-svg { width: 150px; height: 104px; display: block; }
.mol-atom { stroke: rgba(0,0,0,.12); stroke-width: 1; }
.mol-label { font-size: 11px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.mol-bond { stroke: #9aa2b8; stroke-width: 3; stroke-linecap: round; }
.mol-dash { stroke: #c0a0d8; stroke-width: 2.5; stroke-dasharray: 4 4; }
.mol-charge { font-size: 10px; fill: #a07ac0; text-anchor: middle; }
.mol-card figcaption { text-align: center; font-size: 12px; }
.mol-card figcaption span { display: block; color: var(--muted-2); font-size: 11px; }
.mol-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.mol-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }

/* коэффициенты */
.bal-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fbfcff; }
.bal-eq { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bal-term { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 6px; }
.bal-term i { font-style: normal; font-weight: 600; padding: 0 4px; }
.bal-term button { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; line-height: 1; font-size: 13px; }
.bal-term button:hover { background: #eef0ff; border-color: #c7cbf7; }
.bal-term b { min-width: 14px; text-align: center; font-variant-numeric: tabular-nums; }
.bal-plus { color: var(--muted-2); }
.bal-arrow { color: var(--muted-2); margin: 0 4px; }
.bal-status { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.bal-status.ok { color: var(--green); font-weight: 600; }
.bal-status.warn { color: var(--amber); }
.bal-status.bad { color: var(--red); }

/* графики */
.plot-stage, .chart-stage { width: 100%; }
.plot-svg, .chart-svg, .therm-svg { width: 100%; height: auto; display: block; }
.plot-grid { stroke: #eef0f6; stroke-width: 1; }
.plot-axis { stroke: #c7ccda; stroke-width: 1.2; }
.plot-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; }
.plot-tick { font-size: 10px; fill: #8b94a7; text-anchor: middle; }
.plot-range { width: 100%; margin-top: 10px; accent-color: var(--accent); }
.chart-grid { stroke: #eef0f6; }
.chart-zero { stroke: #c7ccda; stroke-dasharray: 3 3; }
.chart-bar { transition: fill .15s; }
.chart-bar-pos { fill: #6f74f2; }
.chart-bar-neg { fill: #e2685c; }
.chart-bar-pos:hover { fill: #4f46e5; }
.chart-bar-neg:hover { fill: #c94b3f; }
.chart-zero-strong { stroke: #9aa2b8; stroke-width: 1.6; }
.chart-tick-zero { font-weight: 700; fill: #2b3040; }
.chart-value-neg { fill: #c94b3f; }
.chart-value-inside { fill: #fff; font-weight: 700; }
.chart-bar-f { fill: #e08db0; } .chart-bar-m { fill: #6f9bf2; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.6; }
.chart-dot { fill: #fff; stroke: var(--accent); stroke-width: 2.4; }
.chart-label { font-size: 10.5px; fill: #6b7280; }
.chart-value { font-size: 10.5px; fill: #2b3040; font-weight: 600; }
.chart-tick { font-size: 10px; fill: #8b94a7; }

/* карта */
.map-wrap { width: 100%; }
.map-svg { width: 100%; height: auto; display: block; background: #f7f9fd; border-radius: 14px; }
.map-land { fill: #e8edf9; stroke: none; }
.map-outline { fill: none; stroke: #b9c2da; stroke-width: 1.4; }
.map-band { fill: rgba(79, 70, 229, .11); stroke: #dbe0f2; cursor: pointer; }
.map-band:nth-child(even) { fill: rgba(79, 70, 229, .045); }
.map-band:hover { fill: rgba(79, 70, 229, .26); }
.map-utc { font-size: 12px; fill: #6b7280; text-anchor: middle; font-weight: 600; }
.map-dot { fill: #4f46e5; opacity: .85; cursor: pointer; transition: opacity .15s; }
.map-dot:hover { opacity: 1; }
.map-dot-city { fill: #d94a3d; opacity: .55; }
.map-dot-district { fill: #0e9488; opacity: .9; }
.map-city-label { font-size: 9.5px; fill: #2b3040; }
.map-district-label { font-size: 10px; fill: #fff; text-anchor: middle; font-weight: 700; pointer-events: none; }
.map-hint-label { font-size: 12px; fill: #8b94a7; }
.map-info { margin-top: 10px; font-size: 13px; color: var(--ink-2); min-height: 20px; }

/* лента */
.tl-track { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: thin; }
.tl-point {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  border: 1px solid var(--line-strong); background: #fff; border-radius: 12px; padding: 8px 12px;
  cursor: pointer; min-width: 120px; text-align: left;
}
.tl-point b { font-size: 13px; color: var(--accent); }
.tl-point span { font-size: 11.5px; color: var(--muted); }
.tl-point.on { background: var(--accent-soft); border-color: #c7cbf7; }
.tl-detail { border-top: 1px solid var(--line); padding-top: 12px; font-size: 13.5px; }
.tl-detail b { display: block; margin-bottom: 4px; }
.tl-detail p { margin: 0; color: var(--ink-2); }

/* разбор предложения */
.syn-sentence { display: flex; gap: 6px; flex-wrap: wrap; font-size: 17px; line-height: 1.6; }
.syn-word { border: 1px dashed var(--line-strong); background: #fbfcff; border-radius: 8px; padding: 3px 8px; cursor: pointer; font-size: inherit; }
.syn-word:hover { background: #fff; border-color: #c7cbf7; }
.syn-word.on { background: var(--accent-soft); border-style: solid; border-color: #b9bdf7; }
.syn-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.syn-tag { font-size: 11.5px; color: var(--muted-2); background: #f6f7fb; border-radius: 8px; padding: 4px 8px; }
.syn-tag i { font-style: normal; font-weight: 700; color: var(--ink-2); }
.syn-tag.on { background: var(--green-soft); color: var(--green); }
.syn-scheme { margin-top: 12px; font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.syn-scheme-item b { font-weight: 700; color: var(--accent); margin-right: 4px; }

/* тепловые процессы */
.therm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.therm-grid label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.therm-grid input[type=range] { accent-color: var(--accent); }
.therm-grid b { color: var(--ink); font-size: 13px; }
.therm-grid select { border: 1px solid var(--line-strong); border-radius: 9px; padding: 6px 8px; background: #fff; }
.therm-result { font-size: 18px; display: flex; align-items: baseline; gap: 6px; }
.therm-result b { font-size: 26px; color: var(--accent); font-variant-numeric: tabular-nums; }
.therm-line { fill: none; stroke: #d94a3d; stroke-width: 2.6; }
.therm-dot { fill: #fff; stroke: #d94a3d; stroke-width: 2.4; cursor: pointer; }
.therm-dot:hover, .therm-dot.on { fill: #d94a3d; }
.therm-dot.on { stroke-width: 3; }
.therm-label { font-size: 10.5px; fill: #6b7280; }

@media (max-width: 860px) {
  .kv { flex-direction: column; align-items: stretch; }
  .kv .chip { white-space: normal; line-height: 1.4; max-width: 100%; }
  .kv .chip .tex { white-space: normal; }
  .viz { padding: 14px; }
  .pct-grid { gap: 2px; }
  .pct-cell b { font-size: 8.5px; } .pct-cell i { display: none; }
  .el-card { grid-template-columns: 1fr; }
  .el-card .atom-svg { grid-column: 1; grid-row: auto; margin: 0 auto; }
  .therm-grid { grid-template-columns: 1fr; }
  .mol-card { min-width: 132px; }
  .mol-svg { width: 128px; height: 90px; }
}

.atom-facts { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 12.5px; color: var(--muted); padding-top: 4px; }
.atom-facts b { color: var(--ink); }

/* подписи внутри столбцов — поверх заливки, поэтому правило сильнее .chart-value */
.chart-value.chart-value-inside { fill: #ffffff; font-weight: 700; }
