:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #141c2e;
  --muted: #5c6880;
  --line: #e0e6f0;
  --pri: #0b57d0;
  --pri-dark: #0846ad;
  --pri-soft: #e7effc;
  --ok: #15803d;
  --ok-soft: #e5f5ea;
  --bad: #c2410c;
  --bad-soft: #fdeee6;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(14, 22, 44, .05), 0 4px 16px rgba(14, 22, 44, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 20px; margin: 0 0 6px; }
h3 { font-size: 17px; margin: 0 0 4px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 28px; padding-bottom: 64px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.pad { padding: 14px 18px; margin: 0; }
.inline { display: inline; margin: 0; }
code { background: #edeff2; padding: 1px 5px; border-radius: 5px; font-size: .9em; }

/* шапка */
.top { background: #0b1d4a; color: #fff; position: sticky; top: 0; z-index: 10; }
.topin { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.logo { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.logo:hover { text-decoration: none; }
.mark { width: 32px; height: 32px; border-radius: 9px; background: var(--pri); display: grid; place-items: center; font-weight: 800; }
nav.main { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav.main a, .me a { color: #c5cdda; padding: 6px 12px; border-radius: 8px; font-size: 15px; }
nav.main a:hover, .me a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
nav.main a.on { background: rgba(255,255,255,.12); color: #fff; }
.me { display: flex; align-items: center; gap: 6px; }
.linkbtn { background: none; border: 0; color: #c5cdda; font: inherit; font-size: 15px; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.linkbtn:hover { color: #fff; background: rgba(255,255,255,.08); }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--pri); color: #fff; border: 1px solid var(--pri); padding: 10px 18px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--pri-dark); text-decoration: none; }
.btn.small { padding: 5px 12px; font-size: 14px; border-radius: 8px; }
.btn.ghost { background: transparent; color: var(--pri); border-color: #b6c5df; }
.btn.ghost:hover { background: var(--pri-soft); }
.btn.light { background: #fff; color: var(--ink); border-color: #fff; }
.btn.danger { background: transparent; color: var(--bad); border-color: #f2c7b3; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.wide { width: 100%; }

/* карточки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.subject { color: inherit; display: flex; flex-direction: column; gap: 6px; transition: transform .15s, box-shadow .15s; }
.subject:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(14,22,44,.1); }
.subject .meta { display: flex; gap: 16px; font-size: 14px; color: var(--muted); margin-top: auto; }
.section { margin: 30px 0 12px; }
.headrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.headrow .section { margin-bottom: 12px; }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.hello { margin-bottom: 20px; }

/* статистика */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: inherit; box-shadow: var(--shadow); }
.stat:hover { text-decoration: none; }
.stat b { display: block; font-size: 28px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 14px; }
.stat.warn { background: var(--warn-soft); border-color: #f6d8a8; }
.stat.warn b { color: var(--warn); }

.bar { height: 6px; background: #e6e8ed; border-radius: 99px; overflow: hidden; margin-top: 6px; min-width: 60px; }
.bar span { display: block; height: 100%; background: var(--pri); border-radius: 99px; }

/* списки */
.list { padding: 4px 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); color: inherit; flex-wrap: wrap; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: #f8f9fa; text-decoration: none; }
.grow { flex: 1; min-width: 160px; }
.num { width: 30px; height: 30px; border-radius: 50%; background: #edeff3; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--muted); flex: none; }
.num.done { background: var(--ok); color: #fff; }
.num.test { background: var(--pri-soft); color: var(--pri); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 99px; background: #edeff3; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tag.ok, .tag.st-approved { background: var(--ok-soft); color: var(--ok); }
.tag.bad, .tag.st-rejected { background: var(--bad-soft); color: var(--bad); }
.tag.st-pending { background: var(--warn-soft); color: var(--warn); }
.tag.st-blocked { background: #ececec; color: #555; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 16px; }
.tabs a { padding: 7px 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-size: 14px; }
.tabs a:hover { text-decoration: none; border-color: #b6c5df; }
.tabs a.on { background: var(--pri); border-color: var(--pri); color: #fff; }
.tabs a b { margin-left: 4px; opacity: .8; }

/* формы */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; color: #303744; }
input, textarea, select { font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #ccd2db; border-radius: 9px; padding: 10px 12px; width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(15,118,110,.25); border-color: var(--pri); }
input:disabled { background: #f0f2f5; color: var(--muted); }
.inlineform { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inlineform label { flex: 1; min-width: 160px; }
.inlineform .grow2 { flex: 2; }
.inlineform .w80 { flex: 0 0 100px; min-width: 100px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.newcard { border-style: dashed; box-shadow: none; }
.danger-zone { margin-top: 32px; text-align: right; }
details.card summary { cursor: pointer; font-weight: 600; }
details.card[open] summary { margin-bottom: 14px; }
details .card { box-shadow: none; border: 0; padding: 0; margin: 0; }
[hidden] { display: none !important; }

/* авторизация */
.auth { max-width: 420px; margin: 40px auto; }
.auth .card { padding: 30px; }
.auth h1 { margin-bottom: 4px; }
.auth .form { margin: 18px 0; }
.bigicon { font-size: 44px; margin-bottom: 6px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe3c9; }
.flash.error { background: var(--bad-soft); color: var(--bad); border: 1px solid #f2c7b3; }

/* урок */
.lesson { padding: 32px 36px; }
.lesson .content { font-size: 17px; line-height: 1.7; }
.lesson .content h2 { margin-top: 26px; font-size: 22px; }
.lesson .content h3 { margin-top: 20px; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--pri-soft); border-color: #c5d1e3; }
.callout.ok { background: var(--ok-soft); border-color: #bfe3c9; }
.callout p { margin: 0; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* тест */
.testhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { background: var(--card); border: 1px solid var(--line); padding: 4px 12px; border-radius: 99px; font-size: 14px; }
fieldset.q { border: 1px solid var(--line); min-width: 0; }
fieldset.q.missing { border-color: #f2c7b3; background: #fffaf7; }
.q legend, .qtitle { font-weight: 600; font-size: 17px; display: flex; gap: 10px; align-items: flex-start; padding: 0; flex-wrap: wrap; }
.q legend { float: left; width: 100%; margin-bottom: 4px; }
.q legend + * { clear: both; }
.qn { width: 28px; height: 28px; border-radius: 8px; background: var(--pri-soft); color: var(--pri); display: inline-grid; place-items: center; font-size: 14px; flex: none; }
.q .hint { margin: 0 0 10px 38px; clear: both; }
.options { display: grid; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; transition: background .12s, border-color .12s; }
.opt:hover { background: #f8f9fa; }
.opt.sel { border-color: var(--pri); background: var(--pri-soft); }
.opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--pri); flex: none; }
.answer-text { max-width: 420px; }
.submitbar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0; margin-top: 8px; background: var(--bg); border-top: 1px solid var(--line); }

/* результат */
.result { display: flex; align-items: center; gap: 24px; padding: 26px 30px; border-radius: var(--radius); color: #fff; margin-bottom: 8px; flex-wrap: wrap; }
.result.ok { background: linear-gradient(135deg, #15803d, #0b57d0); }
.result.bad { background: linear-gradient(135deg, #c2410c, #b45309); }
.result .score { font-size: 54px; font-weight: 800; line-height: 1; }
.result h1 { margin: 0; }
.result p { margin: 4px 0 12px; opacity: .92; }
.review { border-left-width: 1px; }
.review.is-ok .verdict { color: var(--ok); }
.review.is-bad { background: #fffaf7; border-color: #f4d6c8; }
.review.is-bad .verdict { color: var(--bad); }
.verdict { margin-left: auto; font-size: 14px; white-space: nowrap; }
.review p { margin: 8px 0 0 38px; }
.explain { background: var(--warn-soft); border-radius: 9px; padding: 9px 12px; color: #6b4410; }
.mistake .options, .mistake .answer-text { margin-top: 12px; }
.mistake .right { margin-top: 12px; }
.mistake .explain { margin: 10px 0 0; }

/* вопросы в админке */
.adminq .optlist { margin: 10px 0 0 38px; padding-left: 18px; }
.adminq .optlist li.is-correct { color: var(--ok); font-weight: 600; }
.adminq .optlist li.is-correct::after { content: "  ✓"; }
.adminq > p { margin: 8px 0 0 38px; }
.adminq .right { margin-top: 10px; display: flex; gap: 6px; justify-content: flex-end; }

/* таблицы */
.tablewrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafafb; white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.tablewrap > p { padding: 18px; margin: 0; }

@media (max-width: 760px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .two { grid-template-columns: 1fr; }
  .lesson { padding: 22px 18px; }
  .card { padding: 18px; }
  h1 { font-size: 24px; }
  .topin { gap: 8px 10px; padding-top: 8px; padding-bottom: 8px; justify-content: space-between; }
  nav.main { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; }
  nav.main a { white-space: nowrap; }
  .logo { font-size: 15px; }
  .review p, .adminq > p, .adminq .optlist, .q .hint { margin-left: 0; }
}

/* ---------- картинки в вопросах ---------- */
.qimg { margin: 6px 0 14px; }
.qimg img { display: block; max-width: 100%; max-height: 340px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.q .qimg { margin-left: 38px; }
.options.has-img { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.options.has-img .opt { position: relative; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
.options.has-img .opt input { position: absolute; top: 12px; left: 12px; z-index: 1; background: #fff; }
.options.has-img .otext { text-align: center; }
.optimg { display: block; width: 100%; height: 150px; object-fit: contain; background: #fff; border-radius: 8px; }
.opt { position: relative; }
.zoom-btn { position: absolute; top: 8px; right: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.92); border-radius: 8px; width: 32px; height: 32px; cursor: zoom-in; font-size: 15px; line-height: 1; }
.opt:not(:has(.optimg)) .zoom-btn { display: none; }

/* ответы в разборе — «фишки» с картинками */
.ans { margin: 10px 0 0 38px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.achips { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.achip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 600; }
.achip:not(:has(img)) { padding: 4px 10px; }
.achip .optimg { width: 64px; height: 64px; cursor: zoom-in; }
.right-ans .achip { border-color: #bfe3c9; background: var(--ok-soft); color: var(--ok); }
.small-chips .achip .optimg { width: 44px; height: 44px; }
.explain .achips { margin-left: 6px; }
.mistake .qimg, .mistake .ans { margin-left: 0; }

/* админ: список вариантов */
.adminq .optlist { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0 38px; padding: 0; }
.adminq .achip { font-weight: 400; }
.adminq .achip.is-correct { border-color: #bfe3c9; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.ok-mark { color: var(--ok); }
.adminq .qimg { margin-left: 38px; }

/* админ: редактор вариантов */
.flabel { font-size: 14px; font-weight: 600; color: #303744; }
.qimage-field { display: flex; flex-direction: column; gap: 6px; }
.optblock { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.optrows { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.optrow { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fafafb; }
.ocorrect { display: flex !important; flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 13px !important; color: var(--ok) !important; white-space: nowrap; cursor: pointer; }
.ocorrect input { width: 18px; height: 18px; accent-color: var(--ok); }
.oimg { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.preview:empty { display: none; }
.thumb { width: 56px; height: 56px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; display: block; transition: opacity .15s; }
.thumb.big { width: auto; max-width: 260px; height: 140px; }
.filebtn { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px !important; padding: 7px 12px; border: 1px dashed #94aacf; border-radius: 9px; background: #fff; color: var(--pri) !important; font-size: 14px !important; cursor: pointer; white-space: nowrap; }
.filebtn:hover { background: var(--pri-soft); }
.delimg { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 4px !important; font-weight: 400 !important; font-size: 13px !important; color: var(--muted) !important; }
.delimg input { width: auto; }

/* увеличение картинки */
.lightbox { position: fixed; inset: 0; background: rgba(10, 16, 14, .85); display: grid; place-items: center; z-index: 100; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; background: #fff; }
.lb-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; font-size: 18px; cursor: pointer; }

@media (max-width: 760px) {
  .optrow { grid-template-columns: auto 1fr auto; }
  .optrow .oimg { grid-column: 1 / -1; }
  .options.has-img { grid-template-columns: 1fr 1fr; }
  .optimg { height: 110px; }
  .ans, .q .qimg, .adminq .optlist, .adminq .qimg { margin-left: 0; }
}

/* ---------- видео ---------- */
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin: 10px 0 6px; padding-top: 0; }
@supports not (aspect-ratio: 16 / 9) { .video { height: 0; padding-top: 56.25%; } }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.video.file video { object-fit: contain; }
.video-alt { font-size: 13px; margin: 0 0 12px; color: var(--muted); }
.video-alt a { color: var(--muted); text-decoration: underline; }
.video-alt.show { color: var(--bad); }
.qvideo { max-width: 720px; margin: 4px 0 14px; }
.q .qvideo { margin-left: 38px; }
.mistake .qvideo { margin-left: 0; }
.lesson .video { margin: 14px 0 6px; }

/* поле «видео» в админке */
.video-field { display: flex; flex-direction: column; gap: 8px; }
.video-current { max-width: 480px; }
.video-current .video { margin-top: 0; }
.video-inputs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.video-inputs .grow { flex: 1; min-width: 220px; }
.video-preview { display: flex; flex-direction: column; gap: 4px; max-width: 360px; }
.thumb-video { width: 100%; max-height: 200px; border-radius: 10px; background: #000; }

/* индикатор загрузки */
.upload-overlay { position: fixed; inset: 0; background: rgba(10, 16, 14, .55); display: grid; place-items: center; z-index: 200; padding: 20px; }
.upload-card { background: #fff; border-radius: 14px; padding: 22px 24px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.upload-card .bar { height: 10px; }
.upload-card .bar span { width: 0; transition: width .2s; }
.upload-pct { font-weight: 700; font-size: 20px; }

/* ---------- сенсорные экраны: крупнее зоны нажатия ---------- */
@media (pointer: coarse) {
  .btn.small { min-height: 40px; padding: 8px 14px; }
  .opt { min-height: 50px; }
  nav.main a, .me a, .linkbtn { padding: 10px 12px; }
  .tabs a { padding: 9px 14px; }
}

/* ---------- телефоны ---------- */
@media (max-width: 760px) {
  .top { position: static; }
  .q .qvideo { margin-left: 0; }
  .result { padding: 20px; gap: 14px; }
  .result .score { font-size: 42px; }
  .submitbar { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .submitbar .btn { flex: 1; }
  .testhead { margin-bottom: 12px; }
  table { font-size: 14px; }
  th, td { padding: 10px 12px; }
}
@media (max-width: 380px) {
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 22px; }
  .wrap { padding: 0 14px; }
  .options.has-img { grid-template-columns: 1fr 1fr; gap: 6px; }
}
/* учитываем «чёлку» и закруглённые углы iPhone */
@supports (padding: max(0px)) {
  .wrap { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  @media (max-width: 380px) { .wrap { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); } }
}

/* поля ввода 16px: иначе iPhone приближает страницу при нажатии на поле */
input, textarea, select { font-size: 16px; }
@media (pointer: coarse) { .zoom-btn { width: 40px; height: 40px; } }

/* планшеты в портретной ориентации: меню отдельной строкой с прокруткой */
@media (max-width: 960px) {
  .topin { gap: 8px 10px; padding-top: 8px; padding-bottom: 8px; justify-content: space-between; }
  nav.main { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  nav.main::-webkit-scrollbar { display: none; }
  nav.main a { white-space: nowrap; }
}

/* ================= мобильное меню в стиле приложений ================= */
.tabbar { display: none; }
.m-title { display: none; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; vertical-align: 1px; }

@media (max-width: 820px) {
  html { -webkit-tap-highlight-color: transparent; }
  /* верхняя панель: компактная, с названием страницы */
  .top { position: sticky; top: 0; padding-top: env(safe-area-inset-top); }
  .topin { min-height: 52px; flex-wrap: nowrap; gap: 12px; padding-top: 0; padding-bottom: 0; }
  .logo-t, nav.main { display: none; }
  .logo { flex: none; }
  .mark { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
  .m-title { display: block; flex: 1; min-width: 0; color: #fff; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .has-tabbar .me { display: none; }
  .no-tabbar .me .btn.small { min-height: 34px; padding: 5px 12px; }

  /* нижняя панель вкладок */
  .has-tabbar .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--line);
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
    color: #667189; text-decoration: none; padding: 2px 0; -webkit-user-select: none; user-select: none;
  }
  .tabbar a:hover { text-decoration: none; }
  .tb-ic { position: relative; display: grid; place-items: center; width: 56px; height: 30px; border-radius: 99px; transition: background .2s, transform .12s; }
  .tb-t { font-size: 11px; font-weight: 600; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a.on { color: var(--pri); }
  .tabbar a.on .tb-ic { background: var(--pri-soft); }
  .tabbar a.on svg { stroke-width: 2.2; }
  .tabbar a:active .tb-ic { transform: scale(.9); }
  .tb-badge { position: absolute; top: -3px; left: 32px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid #fff; box-sizing: content-box; }

  /* место под панель внизу */
  .has-tabbar main.wrap { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  main.wrap { padding-top: 18px; }

  /* отклик на нажатие — как в приложениях */
  .card.subject:active, a.row:active, .stat:active { transform: scale(.985); }
  .btn:active { transform: scale(.97); }
  .crumbs { font-size: 13px; }
  .logout-row { margin-top: 18px; }
}
@media (min-width: 821px) { .logout-row { display: none; } }
@media (max-width: 820px) {
  .focus .me { display: none; }
  .m-title { opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
  .show-title .m-title, .no-h1 .m-title { opacity: 1; transform: none; }
}

/* ================= таймер теста ================= */
.submitbar { align-items: center; }
.timer { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; background: #0b1d4a; color: #fff; font-variant-numeric: tabular-nums; font-size: 17px; margin-right: auto; white-space: nowrap; }
.timer b { font-weight: 700; letter-spacing: .02em; }
.timer.warn { background: var(--warn); }
.timer.danger { background: #c2262d; animation: tpulse 1s ease-in-out infinite; }
@keyframes tpulse { 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .timer.danger { animation: none; } }
.save-state { margin-right: auto; }
.timer + .save-state { margin-right: auto; margin-left: 4px; }
.submitbar:has(.timer) .save-state { margin-right: auto; }
.timer ~ .save-state { margin-left: 0; }
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: #0b1d4a; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 300; box-shadow: 0 8px 30px rgba(0,0,0,.25); transition: opacity .5s, transform .5s; }
.toast.hide { opacity: 0; transform: translate(-50%, -12px); }
.start-card { text-align: left; }
.start-card .bigicon, .start-card h1 { text-align: center; }
.start-card .muted { text-align: center; }
.center-pills { justify-content: center; margin: 14px 0; }
.rules { margin: 8px 0 20px; padding-left: 20px; line-height: 1.6; }
.rules li { margin-bottom: 6px; }
.result-time { margin: -6px 0 12px; }
.result-time .tag { vertical-align: 1px; }
.settings-pills { margin: 4px 0 14px; }
.nowrap { white-space: nowrap; }
.data-card { margin-top: 24px; }
.data-card .path { display: block; padding: 10px 12px; margin: 6px 0 10px; background: #edeff2; border-radius: 8px; word-break: break-all; font-size: 14px; }
.active-list { margin-bottom: 12px; border-color: #c5d1e3; background: var(--pri-soft); }
.active-list .pad { padding-bottom: 4px; }

@media (max-width: 820px) {
  .timer { font-size: 16px; padding: 10px 12px; }
  .submitbar { gap: 8px; }
  .submitbar .save-state { display: none; }
  .submitbar:has(.timer) .btn.ghost { display: none; } /* в тесте на время на телефоне: таймер + «Сдать» */
  .toast { top: calc(12px + env(safe-area-inset-top)); width: max-content; max-width: calc(100% - 32px); }
}

/* ================= Python: задачи и редактор ================= */
.num.code { background: #1e293b; color: #7dd3fc; font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.num.code.done { background: var(--ok); color: #fff; font-size: 14px; }
.task-statement .headrow { margin-bottom: 6px; }
.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.example { padding: 14px 16px; margin: 0; }
.ex-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ex-cols, .test-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.example pre, .test-cols pre, .code-view { margin: 4px 0 0; padding: 8px 10px; background: #f2f4f7; border: 1px solid var(--line); border-radius: 8px; font: 14px/1.45 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; min-height: 34px; }
.linkbtn.small { font-size: 13px; color: var(--pri); padding: 2px 4px; }

.ide { padding: 0; overflow: hidden; }
.ide-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #181e28; color: #d9dee7; flex-wrap: wrap; }
.ide-file { font: 600 14px ui-monospace, Menlo, Consolas, monospace; }
.ide-status { color: #99a5b8 !important; flex: 1; min-width: 120px; }
.ide-status.err { color: #fca5a5 !important; }
.ide-actions { display: flex; gap: 8px; }
.ide-bar .btn.ghost { color: #cbd5e7; border-color: #353f4f; }
.ide-bar .btn.ghost:hover { background: #232a36; }
.ide-bar .btn.danger { background: #b42318; color: #fff; border-color: #b42318; }
.btn.run { background: #16a34a; border-color: #16a34a; min-width: 132px; }
.btn.run:hover { background: #15803d; }
.btn.run:disabled { opacity: .55; cursor: default; }
.ide.running .btn.run { opacity: .55; }

.ide-code { width: 100%; min-height: 260px; border: 0; border-radius: 0; font: 15px/1.5 ui-monospace, Menlo, Consolas, monospace; padding: 12px; background: #fbfbfc; }
.ide .CodeMirror { height: auto; min-height: 260px; font: 15px/1.55 ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; background: #fbfbfc; border-bottom: 1px solid var(--line); }
.ide .CodeMirror-scroll { min-height: 260px; max-height: 70vh; }
.ide .CodeMirror-gutters { background: #f0f2f5; border-right: 1px solid var(--line); }
.ide .CodeMirror-linenumber { color: #949eae; }
.ide .CodeMirror-activeline-background { background: #eef1f6; }
.ide .CodeMirror-matchingbracket { color: #0b57d0 !important; background: #d7e1ef; }
.ide .cm-keyword { color: #7c3aed; font-weight: 600; }
.ide .cm-builtin { color: #0369a1; }
.ide .cm-string { color: #b45309; }
.ide .cm-number { color: #0b57d0; }
.ide .cm-comment { color: #848ea0; font-style: italic; }
.ide .cm-def { color: #1d4ed8; font-weight: 600; }
.ide .cm-variable-2, .ide .cm-property { color: #0e7490; }

.ide-keys { display: none; gap: 6px; padding: 8px 10px; overflow-x: auto; background: #f0f2f5; border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.ide-keys::-webkit-scrollbar { display: none; }
.ide-keys button { flex: none; min-width: 40px; height: 38px; padding: 0 10px; border: 1px solid #ccd2db; border-radius: 8px; background: #fff; font: 600 16px ui-monospace, Menlo, Consolas, monospace; color: var(--ink); }
.ide-keys button:active { background: var(--pri-soft); }
@media (pointer: coarse) { .ide-keys { display: flex; } }

.ide-stdin { padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.ide-stdin summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.ide-stdin textarea { margin-top: 8px; font: 15px/1.45 ui-monospace, Menlo, Consolas, monospace; }
.ide-out-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #081433; color: #c8ced8; font-weight: 600; font-size: 14px; }
.ide-out-head .muted { color: #8895aa !important; flex: 1; font-weight: 400; }
.ide-out-head .linkbtn { color: #8895aa; }
.ide-out { margin: 0; min-height: 120px; max-height: 50vh; overflow: auto; padding: 12px 14px; background: #081433; color: #e6edf3; font: 14.5px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.ide-out.static { border-radius: 12px; }
.ide-out .muted, .ide-out .o-note { color: #78859b; }
.ide-out .o-err { color: #ff8a80; }
.ide-out .o-in { color: #7dd3fc; }
.ide-tests { padding: 12px 14px; border-top: 1px solid var(--line); background: #fff; }
.tests-head { font-weight: 700; margin-bottom: 8px; }
.tests-head.all-ok { color: var(--ok); }
.tests-head.some-bad { color: var(--bad); }
.test { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.test summary { cursor: pointer; font-weight: 600; }
.test.ok summary { color: var(--ok); }
.test.bad { border-color: #f2c7b3; background: #fffaf7; }
.test.bad summary { color: var(--bad); }
.test .test-cols { margin-top: 8px; }
.test pre.o-err { color: var(--bad); background: #fff3ee; padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; }
.ide-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 10px 14px; background: #fff; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ide-foot [data-saved] { margin-right: auto; }

/* админка задач */
.exrows { display: flex; flex-direction: column; gap: 10px; }
.exrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafafb; }
.exrow textarea, textarea.mono { font: 14px/1.45 ui-monospace, Menlo, Consolas, monospace; }
.review-btns { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 820px) {
  .ide-bar { padding: 8px 10px; }
  .ide-status { order: 3; flex-basis: 100%; }
  .ide-actions { margin-left: auto; }
  .ide .CodeMirror, .ide .CodeMirror-scroll { min-height: 200px; }
  .ide .CodeMirror { font-size: 15px; }
  .ide-foot .btn { flex: 1; }
  .exrow { grid-template-columns: 1fr; }
  .examples { grid-template-columns: 1fr; }
}
.ide-stdin textarea.attention { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(180, 83, 9, .2); }
/* сенсорные экраны: шрифт кода 16px (иначе iPhone приближает страницу при касании) и крупнее мелкие кнопки */
@media (pointer: coarse) {
  .ide .CodeMirror, .ide .CodeMirror textarea, .ide-stdin textarea { font-size: 16px; }
  .ide-out-head .linkbtn, .ex-head .linkbtn { min-height: 40px; padding: 8px 10px; }
}
@media (pointer: coarse) { .exrow textarea, textarea.mono { font-size: 16px; } }

/* ================= подвал сайта ================= */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }
.site-footer { flex-shrink: 0; background: #0b1d4a; color: #b5bdcc; margin-top: 24px; font-size: 15px; }
.site-footer .wrap { padding-top: 40px; padding-bottom: 22px; }
.f-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 32px 48px; }
.f-brand .logo { color: #fff; font-size: 17px; }
.f-brand p { margin: 12px 0 0; max-width: 340px; line-height: 1.6; }
.site-footer h4 { margin: 4px 0 12px; color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.site-footer a { color: #d4dbe6; }
.site-footer a:hover { color: #fff; }
.f-contacts li { display: flex; align-items: flex-start; gap: 10px; }
.f-contacts svg { flex: none; margin-top: 3px; color: #5f85bf; }
.f-soc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.soc { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); font-size: 14px; color: #e2e7f0 !important; }
.soc:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.soc svg { color: #5f85bf; }
.f-hint { margin-top: 14px !important; padding: 10px 12px; border: 1px dashed rgba(255,255,255,.25); border-radius: 10px; font-size: 14px; }
.f-hint a { color: #8eafe0; text-decoration: underline; }
.f-bottom { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; margin-top: 32px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13.5px; color: #8895aa; }

/* настройки */
.settings-form h3 { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.settings-form h3:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-link { margin-top: 18px; }
@media (min-width: 821px) { .settings-link { display: none; } }

@media (max-width: 820px) {
  /* место под нижнее меню переносим с main на страницу, чтобы подвал был над меню */
  .has-tabbar main.wrap { padding-bottom: 40px; }
  .has-tabbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .site-footer { margin-top: 8px; font-size: 14.5px; }
  .site-footer .wrap { padding-top: 28px; padding-bottom: 18px; }
  .f-grid { grid-template-columns: 1fr 1fr; gap: 24px 20px; }
  .f-brand { grid-column: 1 / -1; }
  .f-bottom { margin-top: 22px; flex-direction: column; }
  .two-fields { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .f-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .has-tabbar nav.f-col { display: none; } /* на телефоне разделы уже есть в нижнем меню */
  .has-tabbar .f-grid { grid-template-columns: 1fr; gap: 22px; }
  .site-footer h4 { margin-bottom: 10px; }
  .f-soc { gap: 6px; }
  .soc { padding: 8px 12px; min-height: 40px; }
}

/* ================= подвал: соцсети и контакты (v1.9) ================= */
.soc-title { margin: 20px 0 10px !important; }
.f-soc { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 0; }
.soc { display: inline-flex; align-items: center; gap: 9px; padding: 5px 14px 5px 5px; border-radius: 99px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); font-size: 14.5px; font-weight: 600; color: #edf0f6 !important; transition: background .15s, transform .15s; }
.soc:hover { background: rgba(255,255,255,.13); text-decoration: none; transform: translateY(-1px); }
.soc-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #363f4f; color: #fff; flex: none; }
.soc-ic svg { color: #fff !important; width: 18px; height: 18px; }
.soc-whatsapp .soc-ic { background: #25d366; }
.soc-telegram .soc-ic { background: #229ed9; }
.soc-instagram .soc-ic { background: linear-gradient(45deg, #f9a825, #e1306c 45%, #833ab4); }
.soc-youtube .soc-ic { background: #ff0033; }
.soc-website .soc-ic { background: #0b57d0; }
.soc-empty { background: transparent; border: 1px dashed rgba(255,255,255,.28); color: #99a5b8 !important; font-weight: 500; }
.soc-empty .soc-ic { background: rgba(255,255,255,.08); }
.soc-empty .soc-ic svg { color: #99a5b8 !important; }
.f-contacts li { align-items: center; }
.f-contacts svg { margin-top: 0; width: 20px; height: 20px; }
.c-empty a { color: #8895aa !important; border-bottom: 1px dashed rgba(255,255,255,.25); }
.c-empty svg { color: #657287 !important; }
.f-setup { margin: 0 0 26px; padding: 12px 16px; border-radius: 12px; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35); color: #f8d9a0; font-size: 14.5px; }
.f-setup a { color: #ffd27a; font-weight: 700; text-decoration: underline; }
.f-ver { opacity: .6; }
@media (max-width: 820px) {
  .soc { padding: 4px 12px 4px 4px; min-height: 44px; }
  .soc-ic { width: 34px; height: 34px; }
}
/* подсветка поля, к которому перешли по ссылке «+ добавить» */
.settings-form label:target input { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(15,118,110,.25); }

/* ================= доступ к курсам ================= */
.tag.access-off { background: #ececec; color: #474e59; }
.tag.access-soon { background: var(--warn-soft); color: var(--warn); }
.subject.locked { opacity: .85; background: #f7f7f8; border-style: dashed; box-shadow: none; cursor: default; }
.subject.locked:hover { transform: none; box-shadow: none; }
.subject .ends-tag { align-self: flex-start; margin-bottom: 4px; }
.subject-admin { padding: 0; gap: 0; }
.subject-admin:hover { transform: none; }
.subject-admin .sa-link { display: flex; flex-direction: column; gap: 6px; padding: 22px 22px 14px; color: inherit; flex: 1; }
.subject-admin .sa-link:hover { text-decoration: none; }
.subject-admin .sa-link:hover h2 { color: var(--pri); }
.sa-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 12px 22px 16px; border-top: 1px solid var(--line); }
.subject-admin.is-closed { background: #fafafa; }
.subject-admin.is-closed h2 { color: #58606d; }
label.check { flex-direction: row !important; align-items: center; gap: 10px !important; font-weight: 600; cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--pri); flex: none; }
label.check.big { font-size: 16px; }
.access-card { border-width: 2px; }
.access-card h3 { margin: 0; }
.access-card.access-open { border-color: #bfe3c9; }
.access-card.access-soon { border-color: #f6d8a8; background: #fffcf6; }
.access-card.access-off, .access-card.access-ended { border-color: #d7dae0; background: #fafafb; }
.access-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.locked-card .bigicon { font-size: 48px; }
/* формы в одну строку (название курса и т.п.) */
.form.inlineform { flex-direction: row; align-items: flex-end; }
.form.inlineform .btn { flex: none; }
.grid.admin-grid { align-items: start; }

/* ---------- аватарки ---------- */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover; color: #fff; font-weight: 700; letter-spacing: .02em; line-height: 1; user-select: none; background: #dde1e8; }
img.avatar { background: #edeff3; }
.avatar-empty { color: var(--muted); background: #edeff3; border: 2px dashed var(--line); }
.avatar-field { display: flex; align-items: center; gap: 18px; padding: 4px 0 6px; }
.avatar-preview { flex: none; border-radius: 50%; }
.avatar-preview .avatar { box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--line); }
.avatar-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.avatar-actions .filebtn { margin: 0; }
.avatar-actions .check { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.avatar-actions .check input { width: auto; margin: 0; }
.avatar-field.removing .avatar-preview { opacity: .35; }
.auth .avatar-field { justify-content: center; flex-direction: column; text-align: center; }
.auth .avatar-actions { align-items: center; }
.me-link { display: inline-flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who.big { gap: 18px; }
.who.big h1 { margin-bottom: 4px; }
.tb-av { box-shadow: 0 0 0 2px transparent; }
.tabbar a.on .tb-av { box-shadow: 0 0 0 2px var(--pri, #2f4e7d); }
@media (max-width: 560px) {
  .who.big { flex-direction: column; align-items: flex-start; gap: 10px; }
  .avatar-field { gap: 14px; }
}
.me a.me-link { padding: 4px 12px 4px 4px; border-radius: 99px; }
.me-link .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.15); }

/* =========================================================
   Редактор HTML/CSS/JS в стиле Sublime Text (тема Monokai)
   ========================================================= */
.num.web { background: #272822; color: #f92672; font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.num.web.done { background: var(--ok); color: #fff; font-size: 14px; }
.code-switch { display: inline-flex; gap: 4px; padding: 4px; background: #edeff3; border-radius: 12px; margin-bottom: 14px; }
.code-switch a { padding: 7px 14px; border-radius: 9px; color: var(--ink); font-size: 14px; font-weight: 600; }
.code-switch a.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--pri); }
.code-switch a:hover { text-decoration: none; }
.web-statement > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none; }
.web-statement > summary::-webkit-details-marker { display: none; }
.web-statement > summary::after { content: "▾ свернуть"; margin-left: auto; color: var(--muted); font-size: 13px; }
.web-statement:not([open]) > summary::after { content: "▸ показать условие"; }
:lang(kk) .web-statement > summary::after { content: "▾ жию"; }
:lang(kk) .web-statement:not([open]) > summary::after { content: "▸ шартты көрсету"; }
.web-statement[open] > summary { margin-bottom: 10px; }
.ws-title { font-size: 16px; }

.web-ide {
  --W: min(1440px, calc(100vw - 48px));
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  width: var(--W); margin: 0 0 16px calc((100% - var(--W)) / 2);
}
.wi-loading { background: #272822; color: #a6a69c; border-radius: 12px; padding: 60px 20px; text-align: center; font-family: var(--mono); }
.wi-window {
  display: flex; flex-direction: column; height: clamp(520px, calc(100vh - 170px), 920px);
  background: #272822; color: #f8f8f2; border: 1px solid #10110e; border-radius: 12px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(16, 20, 18, .28); font-size: 13px;
}
.wi-window button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* заголовок окна */
.wi-titlebar { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; background: #3b3c36; border-bottom: 1px solid #1a1b17; flex: none; user-select: none; }
.wi-dots { display: flex; gap: 7px; margin-right: 4px; }
.wi-dots i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.wi-dots i:nth-child(2) { background: #febc2e; }
.wi-dots i:nth-child(3) { background: #28c840; }
.wi-wtitle { flex: 1; min-width: 0; text-align: center; color: #d6d6ce; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wi-proj { color: #8f908a; }
.wi-tools { display: flex; align-items: center; gap: 2px; }
.wi-tool { height: 28px; min-width: 30px; padding: 0 8px; border-radius: 6px; color: #d6d6ce !important; font-size: 14px !important; }
.wi-tool:hover { background: rgba(255,255,255,.08) !important; }
.wi-run { background: #a6e22e !important; color: #1e1f1c !important; font-weight: 700; margin: 0 4px; }
.wi-run:hover { background: #b8f046 !important; }
.wi-auto { display: flex; align-items: center; gap: 5px; color: #c8c8c0; font-size: 12.5px; font-weight: 500; margin: 0 6px 0 0; cursor: pointer; white-space: nowrap; }
.wi-auto input { width: 14px; height: 14px; margin: 0; accent-color: #a6e22e; }
.wi-menu { position: relative; }
.wi-pop { position: absolute; right: 0; top: 34px; z-index: 30; min-width: 240px; background: #2d2e29; border: 1px solid #49483e; border-radius: 8px; padding: 5px; box-shadow: 0 10px 30px rgba(0,0,0,.4); display: flex; flex-direction: column; }
.wi-pop[hidden] { display: none; }
.wi-pop button { text-align: left; padding: 8px 10px; border-radius: 5px; color: #f8f8f2; }
.wi-pop button:hover { background: #49483e; }

/* панели */
.wi-main { --sw: 190px; flex: 1; min-height: 0; display: grid; position: relative;
  grid-template-columns: var(--sw) minmax(0, 1fr) 6px var(--pv, 45%); grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "side ed split pv"; }
.wi-main[data-layout="bottom"] { grid-template-columns: var(--sw) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 6px var(--pv, 45%);
  grid-template-areas: "side ed" "side split" "side pv"; }
.no-side .wi-main { --sw: 0px; }
.no-side .wi-side { display: none; }
.wi-side { grid-area: side; background: #1e1f1c; border-right: 1px solid #141512; overflow: auto; padding: 10px 0; user-select: none; }
.wi-side-h { font-size: 11px; letter-spacing: .08em; color: #75715e; padding: 0 14px 8px; font-weight: 700; }
.wi-folder { color: #c8c8c0; padding: 4px 14px; font-size: 13px; white-space: nowrap; }
.wi-f { display: flex !important; align-items: center; gap: 8px; width: 100%; padding: 5px 14px 5px 30px !important; text-align: left; color: #a6a69c !important; white-space: nowrap; }
.wi-f:hover { background: #2a2b26 !important; color: #f8f8f2 !important; }
.wi-f.on { background: #3e3d32 !important; color: #fff !important; }
.wi-ic { display: inline-grid; place-items: center; min-width: 18px; height: 16px; padding: 0 2px; border-radius: 3px; font: 700 9px/1 var(--mono); flex: none; }
.wi-ic.html { color: #fd971f; } .wi-ic.css { color: #66d9ef; } .wi-ic.js { color: #1e1f1c; background: #e6db74; }
.wi-ed { grid-area: ed; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #272822; }
.wi-tabs { display: flex; background: #1e1f1c; height: 36px; flex: none; overflow-x: auto; scrollbar-width: none; }
.wi-tabs::-webkit-scrollbar { display: none; }
.wi-tab { position: relative; display: flex !important; align-items: center; gap: 7px; padding: 0 16px !important; color: #8f908a !important; border-right: 1px solid #141512 !important; white-space: nowrap; font-size: 13px; }
.wi-tab:hover { color: #d6d6ce !important; }
.wi-tab.on { background: #272822 !important; color: #f8f8f2 !important; box-shadow: inset 0 2px 0 #f92672; }
.wi-dirty { display: none; width: 7px; height: 7px; border-radius: 50%; background: #e6db74; }
.wi-tab.dirty .wi-dirty { display: inline-block; }
.wi-cm { flex: 1; min-height: 0; position: relative; }
.wi-cm .CodeMirror { position: absolute; inset: 0; height: auto; font: 14px/1.6 var(--mono); }
.wi-cm .CodeMirror-gutters { background: #272822; border-right: 0; }
.wi-cm .CodeMirror-linenumber { color: #75715e; padding: 0 8px 0 6px; }
.wi-cm .CodeMirror-activeline-background { background: #3e3d32; }
.wi-cm .CodeMirror-activeline .CodeMirror-linenumber { color: #c8c8c0; }
.wi-cm .CodeMirror-foldmarker { color: #1e1f1c; background: #e6db74; border-radius: 3px; padding: 0 4px; text-shadow: none; font-family: inherit; }
.wi-cm .CodeMirror-foldgutter-open:after, .wi-cm .CodeMirror-foldgutter-folded:after { color: #75715e; }
.wi-cm .CodeMirror-matchingbracket { color: #f8f8f2 !important; border-bottom: 1px solid #f8f8f2; }
.wi-cm .CodeMirror-selected, .wi-cm .CodeMirror-focused .CodeMirror-selected { background: #49483e !important; }
.wi-cm .CodeMirror-cursor { border-left: 2px solid #f8f8f0; }
.wi-cm .CodeMirror-dialog { background: #1e1f1c; color: #f8f8f2; border-color: #49483e; font-family: var(--mono); }
.wi-cm .CodeMirror-dialog input { color: #f8f8f2; font-family: var(--mono); }
.wi-cm .cm-searching { background: rgba(230, 219, 116, .35); }
.wi-errline { background: rgba(249, 38, 114, .2); }
.emmet-abbreviation, .emmet-css-abbreviation { text-decoration: underline dotted #a6e22e; text-underline-offset: 3px; }
.emmet-abbreviation-preview { position: absolute; z-index: 20; margin-top: 4px; padding: 6px 10px; max-width: 420px; background: #1e1f1c; border: 1px solid #49483e; border-radius: 6px; box-shadow: 0 8px 22px rgba(0,0,0,.45); color: #f8f8f2; font: 12.5px/1.5 var(--mono); white-space: pre; }
.emmet-abbreviation-preview .CodeMirror { background: transparent; color: #f8f8f2; height: auto; font: inherit; }
.emmet-error { color: #f92672; }
.emmet-open-tag, .emmet-close-tag { text-decoration: underline; text-decoration-color: #75715e; text-underline-offset: 3px; }
.CodeMirror-hints { background: #2d2e29; border: 1px solid #49483e; border-radius: 6px; box-shadow: 0 10px 26px rgba(0,0,0,.45); padding: 3px; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; z-index: 2100; max-height: 240px; }
.CodeMirror-hint { color: #f8f8f2; border-radius: 4px; padding: 2px 10px; }
li.CodeMirror-hint-active { background: #49483e; color: #fff; }
.wi-keys { display: flex; gap: 4px; padding: 5px 6px; background: #1e1f1c; overflow-x: auto; flex: none; scrollbar-width: none; }
.wi-keys button { flex: none; min-width: 36px; height: 34px; border-radius: 6px; background: #3b3c36 !important; color: #f8f8f2 !important; font: 600 15px var(--mono) !important; }
.wi-status { display: flex; justify-content: space-between; gap: 12px; height: 24px; padding: 0 12px; align-items: center; background: #3b3c36; color: #c8c8c0; font-size: 12px; flex: none; white-space: nowrap; overflow: hidden; }
.wi-st-r { display: flex; gap: 16px; }
.wi-split { grid-area: split; background: #1e1f1c; cursor: col-resize; touch-action: none; position: relative; }
.wi-split::after { content: ""; position: absolute; inset: 0 2px; background: #3b3c36; transition: background .15s; }
.wi-split:hover::after, .dragging .wi-split::after { background: #a6e22e; }
[data-layout="bottom"] .wi-split { cursor: row-resize; }
[data-layout="bottom"] .wi-split::after { inset: 2px 0; }
.dragging iframe { pointer-events: none; }
.dragging { user-select: none; }

/* результат */
.wi-pv { grid-area: pv; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #1e1f1c; }
.wi-pbar { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px 0 12px; background: #1e1f1c; color: #c8c8c0; flex: none; }
.wi-pt { font-weight: 600; }
.wi-upd { color: #a6e22e; font-size: 12px; flex: 1; }
.wi-dev { display: flex; gap: 2px; background: #2d2e29; border-radius: 7px; padding: 2px; }
.wi-dev button { padding: 2px 8px; border-radius: 5px; opacity: .55; }
.wi-dev button.on { background: #49483e; opacity: 1; }
.wi-frame { flex: 1; min-height: 0; background: #fff; display: flex; justify-content: center; }
.wi-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.wi-frame.phone { background: #3b3c36 repeating-linear-gradient(45deg, transparent 0 10px, rgba(255,255,255,.03) 10px 20px); padding: 10px 0; }
.wi-frame.phone iframe { width: 375px; max-width: calc(100% - 16px); border-radius: 14px; box-shadow: 0 0 0 6px #111, 0 10px 30px rgba(0,0,0,.5); }
.wi-console { flex: 0 0 34%; min-height: 90px; display: flex; flex-direction: column; border-top: 1px solid #141512; background: #1e1f1c; font: 12.5px/1.5 var(--mono); }
.console-min .wi-console { flex-basis: auto; min-height: 0; }
.console-min .wi-log, .console-min .wi-eval { display: none; }
.console-min .wi-ctoggle::first-letter { display: inline-block; }
.wi-ch { display: flex; align-items: center; gap: 10px; padding: 0 10px; height: 28px; background: #2d2e29; color: #c8c8c0; flex: none; font-family: -apple-system, "Segoe UI", sans-serif; font-size: 12.5px; }
.wi-ctoggle { font-weight: 600; }
.wi-cc { flex: 1; color: #8f908a; }
.wi-cc.err { color: #f92672; font-weight: 700; }
.wi-cclear { color: #8f908a !important; font-size: 12px !important; }
.wi-cclear:hover { color: #f8f8f2 !important; }
.wi-log { flex: 1; overflow: auto; padding: 4px 0; }
.wi-msg { display: flex; gap: 8px; align-items: flex-start; padding: 2px 10px; border-bottom: 1px solid #262721; color: #e6e6e0; }
.wi-txt { flex: 1; white-space: pre-wrap; word-break: break-word; }
.wi-msg.info { color: #66d9ef; }
.wi-msg.warn { color: #e6db74; background: rgba(230, 219, 116, .07); }
.wi-msg.error { color: #ff6188; background: rgba(249, 38, 114, .1); }
.wi-msg.result { color: #a6e22e; }
.wi-msg.cmd { color: #8f908a; }
.wi-rep { background: #49483e; color: #f8f8f2; border-radius: 9px; padding: 0 6px; font-size: 11px; line-height: 17px; margin-top: 1px; }
.wi-loc { color: #8f908a !important; text-decoration: underline; flex: none; }
.wi-loc:hover { color: #f8f8f2 !important; }
.wi-eval { display: flex; align-items: center; gap: 6px; padding: 0 10px; border-top: 1px solid #262721; flex: none; }
.wi-eval span { color: #66d9ef; }
.wi-eval input { flex: 1; background: transparent !important; border: 0 !important; color: #f8f8f2 !important; font: inherit !important; padding: 6px 0 !important; outline: none; box-shadow: none !important; min-height: 0; }

/* подсказка по клавишам */
.wi-help { position: absolute; z-index: 40; right: 16px; top: 46px; width: min(440px, calc(100% - 32px)); background: #2d2e29; border: 1px solid #49483e; border-radius: 10px; padding: 14px 16px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.wi-help[hidden] { display: none; }
.wi-help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 14px; }
.wi-help dt { font: 12px var(--mono); color: #e6db74; white-space: nowrap; }
.wi-help dd { margin: 0; color: #d6d6ce; }
.wi-help code { color: #a6e22e; background: #1e1f1c; padding: 0 4px; border-radius: 3px; }
.wi-window { position: relative; }

/* нижняя строка: отправка */
.wi-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.wi-checkframe { position: fixed; left: -12000px; top: 0; width: 1024px; height: 768px; border: 0; opacity: 0; pointer-events: none; }
.wi-checks { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.wi-checks.busy { opacity: .6; }
.wi-checks.all { border-color: #22c55e; background: color-mix(in srgb, #22c55e 8%, var(--card)); }
.wi-ch-h { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.wi-ch-bar { flex: 1; min-width: 120px; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 25%, transparent); overflow: hidden; }
.wi-ch-bar i { display: block; height: 100%; background: #22c55e; border-radius: inherit; transition: width .4s; }
.wi-checks ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wi-checks li { display: flex; gap: 10px; align-items: baseline; }
.wi-checks li span { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; }
.wi-checks li.ok span { background: #16a34a; }
.wi-checks li.bad span { background: #dc2626; }
.wi-checks li.bad { color: var(--muted); }
.wi-ch-err { margin: 8px 0 0; color: #dc2626; font-size: 14px; }
.wt-checks { margin: 14px 0; }
.wt-checks summary { cursor: pointer; margin-bottom: 8px; }

/* полный экран */
html.wi-noscroll, html.wi-noscroll body { overflow: hidden; }
.wi-window.wi-full { position: fixed; inset: 0; z-index: 2000; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
.wi-mswitch { display: none; }

@media (max-width: 800px) {
  .web-ide { width: auto; margin: 0 0 14px; }
  .wi-window { height: max(440px, calc(100vh - 190px)); height: max(440px, calc(100svh - 190px)); border-radius: 10px; }
  .wi-window.wi-full { height: 100dvh; }
  .wi-dots, .wi-sidebtn, .wi-proj, [data-act="layout"], .wi-run span, .wi-st-r > span:last-child { display: none; }
  .wi-titlebar { gap: 6px; padding: 0 6px; }
  .wi-wtitle { text-align: left; padding-left: 4px; }
  .wi-mswitch { display: flex; gap: 4px; padding: 5px; background: #1e1f1c; flex: none; }
  .wi-mswitch button { flex: 1; height: 34px; border-radius: 7px; color: #a6a69c; font-weight: 600; font-size: 14px; }
  .wi-mswitch button.on { background: #3e3d32; color: #fff; }
  .wi-mswitch b { color: #f92672; }
  .wi-main, .wi-main[data-layout="bottom"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "only"; }
  .wi-side, .wi-split { display: none; }
  .wi-ed, .wi-pv { grid-area: only; }
  [data-view="code"] .wi-pv, [data-view="preview"] .wi-ed { visibility: hidden; pointer-events: none; }
  .wi-tab { padding: 0 12px !important; }
  .wi-cm .CodeMirror { font-size: 15px; }
  .wi-console { flex-basis: 38%; }
  .wi-foot .btn { flex: 1; }
}
/* сенсорные экраны: крупные кнопки и шрифт от 16px (иначе iPhone увеличивает страницу) */
@media (pointer: coarse) {
  .wi-titlebar { height: 48px; }
  .wi-tool { height: 38px; min-width: 40px; }
  .wi-auto { min-height: 38px; }
  .wi-tabs { height: 42px; }
  .wi-f { min-height: 38px; }
  .wi-pbar { height: 46px; }
  .wi-dev button { min-height: 36px; min-width: 42px; }
  .wi-ch { height: 40px; }
  .wi-ctoggle, .wi-cclear { min-height: 36px; padding: 0 6px !important; }
  .wi-loc { min-height: 36px; }
  .wi-mswitch button { height: 38px; }
  .wi-eval input { font-size: 16px !important; }
  .wi-cm .CodeMirror { font-size: 16px; }
  .wi-pop button { min-height: 40px; }
}
@media (pointer: coarse) { .wi-keys button { height: 38px; min-width: 40px; } }
@media (max-width: 800px) {
  .wi-status [data-lang] { display: none; }
  .wi-status > [data-pos] { flex: none; }
  .wi-st-r { min-width: 0; overflow: hidden; }
  .wi-st-r > span { overflow: hidden; text-overflow: ellipsis; }
}

/* =========================================================
   Электронная таблица в стиле Excel
   ========================================================= */
.num.xl { background: #217346; color: #fff; font-weight: 800; font-family: "Segoe UI", Arial, sans-serif; }
.num.xl.done { background: var(--ok); }
.sheet-ide { --W: min(1440px, calc(100vw - 48px)); width: var(--W); margin: 0 0 16px calc((100% - var(--W)) / 2); }
.xl-loading { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 60px 20px; text-align: center; color: var(--muted); }
.xl-window {
  --xg: #217346; --xgl: #e3f1e9; --grid: #e1e2e4; --head: #f5f5f5; --headb: #d4d6d9;
  position: relative; display: flex; flex-direction: column; height: clamp(500px, calc(100vh - 170px), 860px);
  background: #fff; border: 1px solid #c6cad0; border-radius: 12px; overflow: hidden; box-shadow: 0 14px 40px rgba(16, 32, 24, .16);
  font-family: "Segoe UI", -apple-system, Roboto, Arial, sans-serif; font-size: 13px; color: #1f1f1f;
}
.xl-window button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.xl-titlebar { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 6px 0 12px; background: var(--xg); color: #fff; flex: none; user-select: none; }
.xl-logo { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 5px; background: #fff; color: var(--xg); font-weight: 900; font-size: 15px; }
.xl-wtitle { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xl-dim { opacity: .7; font-weight: 400; }
.xl-saved { font-size: 12px; opacity: .85; white-space: nowrap; }
.xl-tbtn { width: 34px; height: 30px; border-radius: 6px; display: grid; place-items: center; color: #fff !important; }
.xl-tbtn:hover { background: rgba(255,255,255,.15) !important; }

.xl-ribbon { display: flex; align-items: center; gap: 2px; padding: 5px 8px; background: #f8f9f8; border-bottom: 1px solid #dde0e4; flex: none; overflow-x: auto; scrollbar-width: thin; }
.xl-grp { display: flex; align-items: center; gap: 1px; padding: 0 6px; border-right: 1px solid #dee1e5; flex: none; }
.xl-grp:last-child { border-right: 0; margin-left: auto; }
.xl-ribbon button { display: inline-flex; align-items: center; gap: 5px; height: 32px; min-width: 32px; padding: 0 7px; border-radius: 6px; color: #333 !important; position: relative; white-space: nowrap; }
.xl-ribbon button:hover { background: #e6e8ec !important; }
.xl-ribbon button.on { background: var(--xgl) !important; box-shadow: inset 0 0 0 1px #9fcdb2; color: var(--xg) !important; }
.xl-ribbon button span { font-size: 12.5px; }
.xl-ribbon b, .xl-ribbon i, .xl-ribbon u { font-size: 15px; font-family: Georgia, "Times New Roman", serif; }
.xl-A { font-weight: 700; font-size: 15px !important; font-family: Georgia, serif; }
.xl-cbar { position: absolute; left: 7px; right: 7px; bottom: 4px; height: 3px; border-radius: 2px; background: #c00000; }
[data-act="bg"] .xl-cbar { background: #ffff00; box-shadow: 0 0 0 1px #d8d8a0; }
.xl-fxi { font-family: Georgia, serif !important; font-style: italic; font-weight: 700; font-size: 14px !important; color: var(--xg); }
.xl-dec { font-size: 12px !important; font-weight: 600; }
.xl-dec sup { font-size: 10px; }
.xl-ribbon select { height: 30px; border: 1px solid #d3d6db; border-radius: 6px; background: #fff; font: inherit; padding: 0 6px; margin-right: 3px; min-height: 0; width: auto; }

.xl-fbar { display: flex; align-items: center; gap: 0; height: 34px; border-bottom: 1px solid #dde0e4; flex: none; background: #fff; }
.xl-name { width: 92px; height: 100%; border: 0 !important; border-right: 1px solid #dde0e4 !important; border-radius: 0 !important; padding: 0 8px !important; font: 13px "Segoe UI", Arial, sans-serif !important; text-align: center; background: #fff !important; box-shadow: none !important; min-height: 0; }
.xl-fbtns { display: flex; padding: 0 4px; }
.xl-fbtns[hidden] { display: none; }
.xl-fbtns button { width: 28px; height: 28px; border-radius: 5px; font-size: 15px; }
.xl-fbtns [data-act="ok"] { color: var(--xg) !important; font-weight: 700; }
.xl-fbtns [data-act="cancel"] { color: #c5221f !important; }
.xl-fx { padding: 0 10px; color: #777; font: italic 700 14px Georgia, serif; border-right: 1px solid #edeff1; }
.xl-formula { flex: 1; min-width: 0; height: 100%; border: 0 !important; border-radius: 0 !important; padding: 0 10px !important; font: 13.5px Consolas, "SF Mono", Menlo, monospace !important; background: #fff !important; box-shadow: none !important; min-height: 0; }
.xl-rangebtn { width: 40px; height: 100%; border-left: 1px solid #dde0e4 !important; font-size: 17px; }
.xl-rangebtn.on { background: var(--xgl) !important; color: var(--xg) !important; }

.xl-gridwrap { flex: 1; min-height: 0; overflow: auto; position: relative; background: #fff; overscroll-behavior: contain; }
.xl-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; user-select: none; -webkit-user-select: none; }
.xl-grid th, .xl-grid td { height: 24px; padding: 0 4px; border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); white-space: nowrap; overflow: hidden; line-height: 23px; box-sizing: border-box; }
.xl-grid td { cursor: cell; }
.xl-grid td.spill { overflow: visible; }
.xl-grid td.spillL { overflow: visible; position: relative; }
.xl-grid td.spillL > .sl { position: absolute; right: 4px; top: 0; white-space: nowrap; }
.xl-grid td.w { white-space: pre-wrap; word-break: break-word; line-height: 1.35; padding-top: 2px; padding-bottom: 2px; vertical-align: top; }
.xl-grid td.bd { border-right-color: #5f6368; border-bottom-color: #5f6368; box-shadow: -1px 0 0 #5f6368, 0 -1px 0 #5f6368, -1px -1px 0 #5f6368; }
.xl-grid td.err { color: #c5221f; }
.xl-grid td.xf { position: relative; }
.xl-grid td.xf::before { content: ""; position: absolute; left: 0; top: 0; border: 4px solid transparent; border-top-color: #0b8043; border-left-color: #0b8043; }
.xl-grid thead th { position: sticky; top: 0; z-index: 6; background: var(--head); color: #555; font-weight: 400; text-align: center; border-right-color: var(--headb); border-bottom-color: var(--headb); padding: 0; }
.xl-grid tbody th { position: sticky; left: 0; z-index: 5; background: var(--head); color: #555; font-weight: 400; text-align: center; border-right-color: var(--headb); border-bottom-color: var(--headb); padding: 0 2px; font-size: 12px; cursor: e-resize; }
.xl-grid thead th.xl-ch { cursor: s-resize; }
.xl-grid th.xl-corner { left: 0; z-index: 7; cursor: pointer; background: var(--head) linear-gradient(135deg, transparent 60%, #c5c7cb 60%, #c5c7cb 75%, transparent 75%); }
.xl-grid th.on { background: #d3ebdd; color: #0f5132; font-weight: 600; }
.xl-grid thead th.on { box-shadow: inset 0 -2px 0 var(--xg); }
.xl-grid tbody th.on { box-shadow: inset -2px 0 0 var(--xg); }
.xl-rsz { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; }
.xl-rsz:hover, .resizing .xl-rsz { background: rgba(33,115,70,.35); }
.xl-grid tfoot td { border: 0; padding: 10px 6px 40px; position: sticky; left: 0; background: #fff; }
.xl-more button { margin-right: 8px; padding: 5px 12px !important; border: 1px solid #d3d6db !important; border-radius: 6px; color: #555 !important; font-size: 12.5px !important; background: #fff !important; }
.xl-more button:hover { background: #f0f2f4 !important; }

.xl-sel, .xl-copy, .xl-fillprev, .xl-ref { position: absolute; pointer-events: none; box-sizing: border-box; }
.xl-sel { z-index: 3; border: 2px solid var(--xg); overflow: visible; }
.xl-tint { position: absolute; inset: 0; overflow: hidden; display: none; }
.xl-sel.multi .xl-tint { display: block; }
.xl-tint::before { content: ""; position: absolute; left: calc(var(--ax) - 2px); top: calc(var(--ay) - 2px); width: var(--aw); height: var(--ah); box-shadow: 0 0 0 4000px rgba(33, 115, 70, .1); }
.xl-fill { position: absolute; right: -5px; bottom: -5px; width: 8px; height: 8px; background: var(--xg); border: 1px solid #fff; pointer-events: auto; cursor: crosshair; touch-action: none; }
.xl-copy { z-index: 3; border: 2px dashed var(--xg); animation: xl-ants .8s linear infinite; }
@keyframes xl-ants { 50% { border-color: #8ac2a3; } }
.xl-fillprev { z-index: 3; border: 2px dashed #777; background: rgba(0,0,0,.03); }
.xl-ref { z-index: 2; border: 2px solid var(--rc); background: color-mix(in srgb, var(--rc) 9%, transparent); }
.xl-editor { position: absolute; z-index: 4; margin: 0; padding: 1px 4px; border: 2px solid var(--xg); border-radius: 0; background: #fff; font: 13px "Segoe UI", -apple-system, Roboto, Arial, sans-serif; line-height: 19px; resize: none; overflow: hidden; outline: none; box-shadow: 0 2px 8px rgba(0,0,0,.18); white-space: pre; min-height: 0; color: #1f1f1f; }
.xl-window:not(.editing) .xl-editor { opacity: 0; pointer-events: none; caret-color: transparent; box-shadow: none; }
.xl-window.editing .xl-sel .xl-fill { display: none; }

.xl-charts { position: absolute; left: 0; top: 0; z-index: 4; }
.xl-chart { position: absolute; display: flex; flex-direction: column; background: #fff; border: 1px solid #c0c4ca; border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.14); }
.xl-chart.moving { opacity: .85; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.xl-chh { display: flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-bottom: 1px solid #ebecef; cursor: move; touch-action: none; user-select: none; }
.xl-cht { flex: 1; min-width: 0; font-size: 12px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xl-chh button { width: 26px; height: 24px; border-radius: 4px; color: #666 !important; }
.xl-chh button:hover { background: #edeff1 !important; }
.xl-chb { flex: 1; min-height: 0; position: relative; padding: 6px 8px 8px; }
.xl-chb canvas { position: absolute; inset: 6px 8px 8px; }
.xl-chr { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; touch-action: none; background: linear-gradient(135deg, transparent 55%, #959ba5 55%, #959ba5 62%, transparent 62%, transparent 75%, #959ba5 75%, #959ba5 82%, transparent 82%); }

.xl-bottom { display: flex; align-items: stretch; gap: 0; height: 32px; border-top: 1px solid #dde0e4; background: #f3f4f3; flex: none; }
.xl-tabs { display: flex; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.xl-tabs::-webkit-scrollbar { display: none; }
.xl-tab { padding: 0 16px; border-right: 1px solid #dee1e5 !important; color: #444 !important; white-space: nowrap; font-size: 13px !important; }
.xl-tab:hover { background: #e7e9ec !important; }
.xl-tab.on { background: #fff !important; color: var(--xg) !important; font-weight: 600; box-shadow: inset 0 -3px 0 var(--xg); }
.xl-addsheet { width: 34px; font-size: 18px !important; color: #555 !important; }
.xl-addsheet:hover { background: #e7e9ec !important; }
.xl-stat { margin-left: auto; padding: 0 12px; display: flex; align-items: center; color: #555; font-size: 12.5px; white-space: pre; overflow: hidden; }

.xl-pop { position: absolute; z-index: 50; min-width: 220px; max-width: 320px; padding: 5px; background: #fff; border: 1px solid #d4d7dc; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.xl-pop[hidden] { display: none; }
.xl-pop > button { text-align: left; padding: 8px 12px; border-radius: 5px; font-size: 13px; }
.xl-pop > button:hover { background: #edf0f4 !important; }
.xl-pop hr { border: 0; border-top: 1px solid #ebecef; margin: 4px 2px; }
.xl-pal { display: grid; grid-template-columns: repeat(6, 26px); gap: 5px; padding: 4px; }
.xl-pal button { width: 26px; height: 26px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.xl-pal button:hover { transform: scale(1.12); }
.xl-pal .xl-none { grid-column: span 6; width: auto; height: 28px; box-shadow: inset 0 0 0 1px #d4d7dc; font-size: 12.5px; }
.xl-ac { position: absolute; z-index: 45; width: 300px; max-width: calc(100% - 8px); background: #fff; border: 1px solid #d4d7dc; border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.18); padding: 4px; display: flex; flex-direction: column; }
.xl-ac[hidden] { display: none; }
.xl-ac button { display: flex; flex-direction: column; align-items: flex-start; padding: 5px 9px; border-radius: 5px; text-align: left; }
.xl-ac button b { font: 600 13px Consolas, Menlo, monospace; color: #0f5132; }
.xl-ac button span { font-size: 11.5px; color: #666; }
.xl-ac button.on, .xl-ac button:hover { background: #e3f1e9 !important; }
.xl-tip { position: absolute; z-index: 44; max-width: min(520px, calc(100% - 8px)); padding: 6px 10px; background: #fffbe6; border: 1px solid #e6d98c; border-radius: 6px; font: 12.5px Consolas, Menlo, monospace; color: #333; box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.xl-tip[hidden] { display: none; }
.xl-tip span { font-family: "Segoe UI", Arial, sans-serif; color: #666; }
.xl-tip u { text-decoration: none; font-weight: 700; background: #fde68a; border-radius: 2px; }
.xl-modal { position: absolute; inset: 0; z-index: 60; background: rgba(20, 30, 25, .32); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px 16px; }
.xl-modal[hidden] { display: none; }
.xl-dlg { width: min(520px, 100%); max-height: calc(100% - 20px); overflow: auto; background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.3); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.xl-dh { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.xl-dh button { width: 32px; height: 32px; border-radius: 6px; font-size: 16px; }
.xl-dh button:hover { background: #edeff1 !important; }
.xl-search, .xl-lbl input { width: 100%; height: 38px; border: 1px solid #d3d6db; border-radius: 8px; padding: 0 10px; font: inherit; font-size: 14px; }
.xl-lbl { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: #444; }
.xl-flist { display: flex; flex-direction: column; max-height: 50vh; overflow: auto; border: 1px solid #ebecef; border-radius: 8px; }
.xl-flist button { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; padding: 8px 12px; text-align: left; border-bottom: 1px solid #f1f2f1 !important; }
.xl-flist button:hover { background: #f1f8f4 !important; }
.xl-flist b { color: #0f5132; font-family: Consolas, Menlo, monospace; }
.xl-flist .xl-en { color: #999; font-size: 12px; font-family: Consolas, Menlo, monospace; }
.xl-flist button > span:not(.xl-en) { grid-column: 1 / -1; color: #444; font-size: 13px; }
.xl-flist code { grid-column: 1 / -1; color: #777; font-size: 12px; background: none; padding: 0; }
.xl-types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.xl-types button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid #dde0e4 !important; border-radius: 8px; font-size: 12px !important; }
.xl-types button span { font-size: 20px; color: var(--xg); }
.xl-types button.on { border-color: var(--xg) !important; background: #e3f1e9 !important; box-shadow: inset 0 0 0 1px var(--xg); }
.xl-hint { margin: 0; color: #666; font-size: 12.5px; }
.xl-dfoot { display: flex; justify-content: flex-end; gap: 8px; }
.xl-keys { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; }
.xl-keys dt { font: 12.5px Consolas, Menlo, monospace; color: #0f5132; white-space: nowrap; }
.xl-keys dd { margin: 0; color: #444; }
.xl-toast { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 70; max-width: calc(100% - 24px); padding: 9px 14px; background: #1c222d; color: #fff; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none; }
.xl-toast[hidden] { display: none; }
.xl-window.xl-full { position: fixed; inset: 0; z-index: 2000; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }

@media (max-width: 800px) {
  .sheet-ide { width: auto; margin: 0 0 14px; }
  .xl-window { height: max(440px, calc(100vh - 190px)); height: max(440px, calc(100svh - 190px)); border-radius: 10px; }
  .xl-window.xl-full { height: 100dvh; }
  .xl-dim, .xl-ribbon button span:not(.xl-A):not(.xl-dec) { display: none; }
  .xl-grp { padding: 0 3px; }
  .xl-grp:last-child { margin-left: 0; }
  .xl-name { width: 64px; }
  .xl-fx { display: none; }
  .xl-stat { display: none; }
  .xl-types { grid-template-columns: repeat(3, 1fr); }
}
@media (pointer: coarse) {
  .xl-ribbon button { height: 38px; min-width: 38px; }
  .xl-ribbon select { height: 38px; font-size: 16px; }
  .xl-fbar { height: 42px; }
  .xl-name, .xl-formula, .xl-editor, .xl-search, .xl-lbl input { font-size: 16px !important; }
  .xl-fbtns button { width: 38px; height: 38px; }
  .xl-tbtn { width: 40px; height: 36px; }
  .xl-bottom { height: 40px; }
  .xl-addsheet { width: 44px; }
  .xl-fill { width: 18px; height: 18px; right: -10px; bottom: -10px; border-radius: 50%; border-width: 2px; }
  .xl-pop > button { min-height: 40px; }
  .xl-chh { height: 42px; }
  .xl-chh button { width: 40px; height: 38px; }
  .xl-more button { min-height: 38px; }
  .xl-dh button { width: 40px; height: 40px; }
}

/* ---------- автопроверка Excel ---------- */
.xl-autonote { margin: 0 0 10px; padding: 10px 14px; background: #eef7f1; border: 1px solid #cfe7d8; border-radius: 10px; font-size: 14px; color: #1d4d33; }
.xl-ribbon .xl-checkbtn { background: #217346 !important; color: #fff !important; font-weight: 700; padding: 0 12px; }
.xl-ribbon .xl-checkbtn:hover { background: #1a5c38 !important; }
.xl-ribbon .xl-checkbtn span { font-weight: 600; }
[data-act="check"].busy { opacity: .6; pointer-events: none; }
.xl-grid td.ck-ok { outline: 2px solid #34a853; outline-offset: -2px; }
.xl-grid td.ck-bad { outline: 2px solid #ea4335; outline-offset: -2px; }
.xl-grid td.ck-bad { background-image: linear-gradient(rgba(234, 67, 53, .08), rgba(234, 67, 53, .08)); }
.xl-checks { flex: none; max-height: 34%; display: flex; flex-direction: column; border-top: 1px solid #dde0e4; background: #fbfcfb; }
.xl-checks[hidden] { display: none; }
.xl-ckh { display: flex; align-items: center; gap: 8px; padding: 0 8px; height: 34px; flex: none; background: #f3f4f3; }
.xl-cktitle { flex: 1; text-align: left; font-weight: 600 !important; color: #333 !important; height: 100%; }
.xl-cktitle b { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 99px; background: #fde2e1; color: #b3261e; font-size: 12.5px; }
.xl-checks.all-ok .xl-cktitle b { background: #d6f0de; color: #146c2e; }
.xl-checks.collapsed .xl-ckl { display: none; }
.xl-checks.collapsed [data-ckarrow] { display: inline-block; transform: rotate(-90deg); }
.xl-ckagain { color: #217346 !important; font-size: 12.5px !important; padding: 4px 10px !important; border-radius: 6px; }
.xl-ckagain:hover { background: #e3f1e9 !important; }
.xl-ckl { overflow: auto; padding: 4px 6px 6px; }
.xl-ckrow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; width: 100%; padding: 6px 8px; border-radius: 6px; text-align: left; font-size: 13px !important; }
.xl-ckrow:hover { background: #edeff2 !important; }
.xl-ckic { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex: none; align-self: center; }
.xl-ckrow.ok .xl-ckic { background: #34a853; }
.xl-ckrow.bad .xl-ckic { background: #ea4335; }
.xl-ckrow b { font-family: Consolas, Menlo, monospace; min-width: 60px; }
.xl-ckmsg { flex: 1; min-width: 200px; color: #444; }
.xl-ckrow.ok .xl-ckmsg { color: #146c2e; }
.xl-ckdet { flex-basis: 100%; padding-left: 26px; color: #8a3a14; font-size: 12.5px; }
.xl-ckall { padding: 8px 10px; font-weight: 600; color: #146c2e; }

/* редактор проверок в форме задания */
.xl-checked { margin: 4px 0 6px; background: #fbfcfb; }
.xl-checked h3 { margin: 0; }
.xl-ck-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.xl-ck-row { display: grid; grid-template-columns: 24px 150px 1fr auto 130px 1fr auto; gap: 6px; align-items: center; }
.xl-ck-row input:not([type=checkbox]) { min-height: 36px; padding: 6px 8px; font-size: 14px; margin: 0; }
.xl-ck-row input.bad { border-color: #ea4335; background: #fff5f5; }
.xl-ck-addr, .xl-ck-fn { font-family: Consolas, Menlo, monospace; }
.xl-ck-n { color: var(--muted); font-size: 13px; text-align: right; }
.xl-ck-f { display: flex; align-items: center; gap: 4px; font-weight: 400; font-size: 13px; margin: 0; white-space: nowrap; }
.xl-ck-f input { width: auto; margin: 0; }
.xl-ck-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.xl-ck-result { white-space: pre-wrap; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; margin-bottom: 8px; }
.xl-ck-result.ok { background: #e6f4ea; color: #146c2e; }
.xl-ck-result.bad { background: #fdecea; color: #8c1d18; }
.xl-checked label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.xl-checked label.check input { width: auto; margin: 0; }
@media (max-width: 900px) {
  .xl-ck-row { grid-template-columns: 24px 1fr 1fr auto; }
  .xl-ck-row .xl-ck-fn { grid-column: 2; }
  .xl-ck-row .xl-ck-hint { grid-column: 3 / 5; }
  .xl-ck-row .btn { grid-column: 4; grid-row: 1; }
  .xl-ck-row .xl-ck-f { grid-column: 2 / 4; grid-row: 2; }
  .xl-ck-row .xl-ck-fn { grid-row: 3; }
  .xl-ck-row .xl-ck-hint { grid-row: 3; }
}
@media (max-width: 800px) {
  .xl-checks { max-height: 42%; }
  .xl-ribbon .xl-checkbtn span { display: inline !important; }
}
@media (pointer: coarse) { .xl-ckh { height: 42px; } .xl-ckrow { min-height: 40px; } .xl-ckagain { min-height: 36px; } }

/* средние экраны: часть подписей на панели прячется, остаются значки с подсказками */
.xl-ribbon [data-act="sum"] span, .xl-ribbon [data-act="rows"] span, .xl-ribbon [data-act="fx"] span { display: none; }
.xl-grp { padding: 0 4px; }
@media (max-width: 1320px) {
  .xl-ribbon [data-act="chart"] span, .xl-ribbon [data-act="formulas"] span { display: none; }
}
@media (max-width: 1100px) {
  .xl-ribbon select { width: 96px; }
  .xl-grp { padding: 0 2px; }
}
@media (pointer: coarse), (max-width: 800px) { .xl-ck-row input:not([type=checkbox]) { font-size: 16px; } }

/* =========================================================
   Тренажёры «Устройство компьютера»
   ========================================================= */
.num.pc { background: #1e293b; color: #fbbf24; font-size: 15px; }
.num.pc.done { background: var(--ok); color: #fff; }
.pc-st { color: #f59e0b; letter-spacing: 1px; font-size: 15px; white-space: nowrap; }
.pc-st i { font-style: normal; color: #d6d9dc; }
.pc-trainer { --W: min(1440px, calc(100vw - 48px)); width: var(--W); margin: 0 0 16px calc((100% - var(--W)) / 2); position: relative; }
.pc-app { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(16, 32, 24, .12); overflow: hidden; }
.pc-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafafb; }
.pc-title { font-weight: 800; font-size: 17px; flex: 1; min-width: 200px; }
.pc-stats { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #475569; flex-wrap: wrap; }
.pc-prog { width: 140px; height: 8px; border-radius: 99px; background: #e5e7eb; overflow: hidden; }
.pc-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .4s; }
.pc-mis b { color: #dc2626; }
.pc-btns { display: flex; gap: 6px; }
.pc-main { display: grid; grid-template-columns: minmax(0, 1fr) 270px; }
.pc-stage { background: #0f172a radial-gradient(circle at 30% 20%, #1e293b 0, #0f172a 60%); padding: 14px; display: flex; justify-content: center; align-items: center; min-height: 380px; }
.pc-stage::before { content: ""; position: absolute; }
.pc-svg { width: 100%; max-height: min(72vh, 680px); height: auto; display: block; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.pc-tray { border-left: 1px solid var(--line); background: #f8fafc; display: flex; flex-direction: column; min-height: 0; }
.pc-tray-h { padding: 10px 14px; font-weight: 700; font-size: 13px; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.pc-items { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 12px; overflow: auto; max-height: min(72vh, 680px); }
.pc-group { margin: 8px 4px 0; font-size: 11.5px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; }
.pc-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px 6px 6px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; text-align: left; font: inherit; font-size: 14px; font-weight: 600; color: #1e293b; cursor: grab; touch-action: pan-x; transition: border-color .15s, box-shadow .15s, transform .1s; }
.pc-item svg { flex: none; background: #f1f5f9; border-radius: 8px; padding: 2px; }
.pc-item:hover { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(37, 99, 235, .12); }
.pc-item:active { transform: scale(.98); cursor: grabbing; }
.pc-item.sel { border-color: #2563eb; box-shadow: 0 0 0 2px #bfdbfe; background: #eff6ff; }
.pc-item b { color: #2563eb; }
.pc-empty { padding: 14px; color: #16a34a; font-weight: 600; font-size: 14px; line-height: 1.4; }
.pc-ghost { position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none; filter: drop-shadow(0 8px 16px rgba(0,0,0,.35)); }
.pc-ghost svg { width: 76px; height: 57px; background: #fff; border-radius: 10px; padding: 4px; box-shadow: 0 0 0 2px #2563eb; }
.pc-msg { padding: 12px 16px; font-size: 15px; line-height: 1.45; border-top: 1px solid var(--line); min-height: 48px; }
.pc-msg.info { background: #f8fafc; color: #334155; }
.pc-msg.ok { background: #ecfdf3; color: #166534; }
.pc-msg.error { background: #fef2f2; color: #991b1b; }
.pc-msg.hint { background: #fffbeb; color: #92400e; }

/* сцена: установленные детали, зоны */
.pc-inst { opacity: 0; pointer-events: none; transition: opacity .35s; }
.pc-inst.on { opacity: 1; }
.pc-inst.pop { animation: pc-pop .5s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes pc-pop { 0% { transform: scale(1.06); filter: brightness(1.6); } 100% { transform: scale(1); filter: none; } }
.pc-cable.pop { animation: pc-pop .45s ease-out; }
.pc-inst.on .pc-blades.spin, .powered .pc-blades { animation: pc-spin 1.1s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pc-spin { to { transform: rotate(360deg); } }
.has-mb .pc-before-mb, .has-psu .pc-before-psu { display: none; }
.pc-zone { fill: transparent; stroke: none; cursor: pointer; }
.pc-app.armed .pc-zone, .pc-app.dragging .pc-zone { stroke: #60a5fa; stroke-width: 2; stroke-dasharray: 7 6; fill: rgba(96, 165, 250, .05); }
.pc-app .has-mb .pc-zone[data-zone="mb"], .pc-app svg:not(.has-mb) .pc-zone:not([data-zone="mb"]):not([data-zone="psu"]):not([data-zone="hdd"]) { stroke: none; fill: transparent; }
.pc-app.pc-connect .pc-zone[data-zone="btn"], .pc-app.pc-connect .pc-zone[data-zone="psu_sw"] { stroke: none; fill: transparent; }
.pc-zone.hover { fill: rgba(96, 165, 250, .28) !important; stroke: #93c5fd !important; stroke-dasharray: none !important; }
.pc-zone.bad { fill: rgba(239, 68, 68, .35) !important; stroke: #ef4444 !important; stroke-width: 3 !important; stroke-dasharray: none !important; }
.pc-zone.pulse { animation: pc-pulse 1s ease-in-out 2; stroke: #fbbf24 !important; stroke-width: 4 !important; stroke-dasharray: none !important; }
@keyframes pc-pulse { 50% { fill: rgba(251, 191, 36, .45); } }
.pc-app.shake .pc-stage { animation: pc-shake .35s; }
@keyframes pc-shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.psu-on .pc-rocker { fill: #22c55e; transform: translateY(13px); transition: transform .2s; }
.pc-btn { cursor: pointer; }
.powered .pc-btn { stroke: #22c55e; filter: drop-shadow(0 0 8px #22c55e); }
.powered .pc-btn-ic { stroke: #86efac; }
.powered .pc-screen { fill: #1e3a8a; transition: fill .4s; }
.powered .pc-screen-t { fill: #fff; font-weight: 700; }

/* финал */
.pc-finish { position: absolute; inset: 0; z-index: 20; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.pc-finish[hidden] { display: none; }
.pc-fcard { width: min(440px, 100%); background: #fff; border-radius: 18px; padding: 26px 24px 20px; text-align: center; box-shadow: 0 30px 60px rgba(0,0,0,.35); animation: pc-pop .5s; }
.pc-fcard h3 { margin: 6px 0 14px; font-size: 21px; }
.pc-stars { font-size: 44px; color: #f59e0b; letter-spacing: 4px; line-height: 1; }
.pc-stars span { color: #e5e7eb; }
.pc-fstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.pc-fstats div { background: #f8fafc; border-radius: 10px; padding: 10px 4px; display: flex; flex-direction: column; }
.pc-fstats b { font-size: 22px; }
.pc-fstats span { font-size: 12.5px; color: #64748b; }
.pc-fbtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* подбор комплектующих */
.pc-goal { padding: 12px 16px; background: #eff6ff; color: #1e3a8a; border-bottom: 1px solid #dbeafe; font-size: 15px; }
.pc-cmain { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.pc-cats { padding: 6px 16px 16px; }
.pc-cat h4 { margin: 14px 0 2px; font-size: 16px; }
.pc-cat p { margin: 0 0 8px; }
.pc-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pc-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; border: 1.5px solid #e2e8f0; border-radius: 10px; background: #fff; text-align: left; font: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.pc-opt:hover { border-color: #93c5fd; }
.pc-opt.on { border-color: #16a34a; background: #f0fdf4; box-shadow: 0 0 0 1px #16a34a; }
.pc-oname { font-weight: 600; font-size: 14px; color: #0f172a; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pc-chips i { font-style: normal; font-size: 11.5px; padding: 2px 7px; border-radius: 99px; background: #f1f5f9; color: #475569; }
.pc-opt > b { font-size: 14px; color: #0f5132; margin-top: auto; }
.pc-sum { position: sticky; top: 70px; margin: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafafb; display: flex; flex-direction: column; gap: 10px; }
.pc-sum-h { font-weight: 800; }
.pc-srow { display: grid; grid-template-columns: 110px 1fr; gap: 6px; font-size: 13px; padding: 3px 0; border-bottom: 1px dashed #e5e7eb; }
.pc-srow span { color: #64748b; }
.pc-srow.empty b { color: #cbd5e1; font-weight: 400; }
.pc-total { display: flex; justify-content: space-between; font-size: 16px; }
.pc-bbar { height: 8px; border-radius: 99px; background: #e5e7eb; overflow: hidden; margin: 4px 0; }
.pc-bbar i { display: block; height: 100%; background: #22c55e; }
.pc-bbar i.over { background: #ef4444; }
.pc-power { font-size: 13px; color: #92400e; }
.pc-checks { display: flex; flex-direction: column; gap: 4px; }
.pc-cres { font-weight: 700; padding: 8px 10px; border-radius: 8px; }
.pc-cres.ok { background: #dcfce7; color: #166534; }
.pc-cres.bad { background: #fee2e2; color: #991b1b; }
.pc-citem { display: flex; gap: 8px; font-size: 13px; line-height: 1.4; padding: 3px 2px; }
.pc-citem span { flex: none; font-weight: 800; }
.pc-citem.ok { color: #166534; }
.pc-citem.bad { color: #991b1b; }

/* форма тренажёра (учитель) */
.pc-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.pc-mode { display: block; margin: 0; cursor: pointer; position: relative; }
.pc-mode input { position: absolute; opacity: 0; width: 1px !important; height: 1px; left: 8px; top: 8px; margin: 0; }
.pc-mode span { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 400; }
.pc-mode small { color: var(--muted); font-size: 12.5px; }
.pc-mode input:checked + span { border-color: var(--pri); background: var(--pri-soft); box-shadow: 0 0 0 1px var(--pri); }
.pc-mode input:focus-visible + span { outline: 2px solid var(--pri); }
.pcform .pc-choose-opts { display: none; }
.pcform:has(input[name=mode][value=choose]:checked) .pc-choose-opts { display: flex; }
.pcform:has(input[name=mode][value=choose]:checked) .pc-hints-opt { display: none; }
.pcform label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.pcform label.check input { width: auto; margin: 0; }

@media (max-width: 900px) {
  .pc-trainer { width: auto; margin: 0 0 14px; }
  .pc-main, .pc-cmain { grid-template-columns: minmax(0, 1fr); }
  .pc-stage { padding: 8px; overflow-x: auto; justify-content: flex-start; min-height: 0; }
  .pc-svg { min-width: 620px; max-height: none; }
  .pc-tray { border-left: 0; border-top: 1px solid var(--line); }
  .pc-items { flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 10px; }
  .pc-group { display: none; }
  .pc-item { flex: none; width: 150px; flex-direction: column; text-align: center; font-size: 13px; padding: 8px 6px; }
  .pc-prog { width: 90px; }
  .pc-title { font-size: 16px; }
  .pc-sum { position: static; }
  .pc-head { gap: 8px; }
}
@media (pointer: coarse) { .pc-head .btn.small { min-height: 38px; } .pc-opt { min-height: 44px; } }

/* ===== 3D-тренажёр (public/pc3d) ===== */
.p3-loading { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 420px; border: 1px solid var(--line); border-radius: 14px; background: #1e2329; color: #cbd5e1; font-weight: 600; }
.p3-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #475569; border-top-color: #93c5fd; animation: pc-spin .8s linear infinite; }
.p3 { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(16, 32, 24, .12); overflow: hidden; }
.p3-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafafb; }
.p3-title { font-weight: 800; font-size: 17px; flex: 1; min-width: 200px; }
.p3-stats { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #475569; flex-wrap: wrap; }
.p3-prog { width: 140px; height: 8px; border-radius: 99px; background: #e5e7eb; overflow: hidden; }
.p3-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .4s; }
.p3-mis b { color: #dc2626; }
.p3-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.p3-main { display: grid; grid-template-columns: minmax(0, 1fr) 270px; }
.p3-stage { position: relative; height: min(74vh, 700px); min-height: 380px; background: #c9ced4; overflow: hidden; }
.p3-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; outline: none; }
.p3-canvas:active { cursor: grabbing; }
.p3-task { position: absolute; left: 12px; top: 12px; max-width: min(430px, calc(100% - 24px)); background: rgba(255, 255, 255, .94); border-radius: 12px; padding: 10px 14px; box-shadow: 0 6px 24px rgba(15, 23, 42, .18); backdrop-filter: blur(6px); font-size: 14.5px; line-height: 1.45; z-index: 3; }
.p3-task[hidden], .p3-task:empty { display: none; }
.p3-task p { margin: 4px 0 0; color: #1f2937; }
.p3-task-h { font-weight: 800; font-size: 15px; color: #0f172a; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.p3-stepn, .p3-cntr { font-weight: 600; font-size: 12px; color: #2563eb; background: #eff6ff; border-radius: 99px; padding: 1px 8px; }
.p3-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.p3-tools kbd { font: 600 11px/1 ui-monospace, monospace; background: rgba(255,255,255,.25); border-radius: 4px; padding: 2px 4px; margin-left: 4px; }
.p3-views { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 0; z-index: 3; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 16px rgba(15, 23, 42, .2); }
.p3-views button { border: 0; background: rgba(255, 255, 255, .92); padding: 7px 12px; font: 600 13px/1.2 inherit; font-family: inherit; color: #334155; cursor: pointer; border-right: 1px solid #e2e8f0; }
.p3-views button:last-child { border-right: 0; }
.p3-views button:hover { background: #eff6ff; color: #1d4ed8; }
.p3-help { position: absolute; right: 12px; bottom: 14px; max-width: 45%; font-size: 12px; color: #475569; background: rgba(255,255,255,.7); padding: 3px 8px; border-radius: 6px; z-index: 2; pointer-events: none; }
.p3-tip { position: absolute; z-index: 5; pointer-events: none; background: #0f172a; color: #fff; font-size: 13px; font-weight: 600; padding: 5px 9px; border-radius: 7px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.25); transform: translateX(-10%); max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.p3-tip[hidden], .p3-msg[hidden] { display: none; }
.p3-msg { position: absolute; right: 12px; top: 12px; width: clamp(240px, calc(100% - 470px), 400px); pointer-events: none; z-index: 4; padding: 10px 14px; border-radius: 12px; font-size: 14.5px; line-height: 1.45; box-shadow: 0 8px 28px rgba(15, 23, 42, .25); animation: p3-in .25s ease-out; }
.p3-msg.info { background: rgba(255, 255, 255, .96); color: #1f2937; }
.p3-msg.ok { background: #ecfdf3; color: #14532d; border: 1px solid #bbf7d0; }
.p3-msg.bad { background: #fef2f2; color: #7f1d1d; border: 1px solid #fecaca; }
@keyframes p3-in { from { opacity: 0; transform: translateY(-8px); } }
.p3.shake .p3-stage { animation: pc-shake .35s; }
.p3-tray { border-left: 1px solid var(--line); background: #f8fafc; display: flex; flex-direction: column; min-height: 0; }
.p3-tray-h { padding: 10px 14px 6px; font-weight: 700; font-size: 13px; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.p3-items { display: flex; flex-direction: column; gap: 5px; padding: 0 10px 12px; overflow: auto; max-height: calc(min(74vh, 700px) - 36px); }
.p3-group { margin: 8px 4px 0; font-size: 11.5px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; }
.p3-part { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; text-align: left; font: inherit; font-size: 14px; color: #0f172a; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.p3-part:hover { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(37, 99, 235, .12); }
.p3-part.sel { border-color: #2563eb; box-shadow: 0 0 0 2px #bfdbfe; background: #eff6ff; }
.p3-part.hint { animation: p3-hint 1s ease-in-out 3; border-color: #f59e0b; }
@keyframes p3-hint { 50% { background: #fef3c7; box-shadow: 0 0 0 3px #fcd34d; } }
.p3-part.done { opacity: .55; cursor: default; background: #f1f5f9; }
.p3-ic { width: 30px; height: 30px; flex: none; display: grid; place-items: center; background: #f1f5f9; border-radius: 8px; font-size: 17px; }
.p3-nm { flex: 1; line-height: 1.25; }
.p3-cnt { font-weight: 700; color: #2563eb; font-size: 13px; }
.p3-ok { color: #16a34a; font-weight: 800; }
.p3-ghost { position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border-radius: 10px; box-shadow: 0 0 0 2px #2563eb, 0 10px 24px rgba(0,0,0,.3); font-size: 14px; font-weight: 600; }
.p3:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.p3:fullscreen .p3-main { flex: 1; min-height: 0; }
.p3:fullscreen .p3-stage { height: 100%; }
.p3:fullscreen .p3-items { max-height: calc(100vh - 110px); }
@media (max-width: 900px) {
  .p3-main { grid-template-columns: minmax(0, 1fr); }
  .p3-tray, .p3-stage { min-width: 0; }
  .p3-stage { height: clamp(300px, calc(100svh - 250px), 560px); min-height: 0; }
  .p3-head { gap: 6px 10px; padding: 8px 10px; }
  .p3-title { min-width: 0; flex-basis: 100%; }
  .p3-stats { gap: 10px; font-size: 13px; }
  .p3-btns .btn.small { padding: 6px 9px; }
  .p3-tray-h { display: none; }
  .p3-items { padding-top: 8px; }
  .p3-tray { border-left: 0; border-top: 1px solid var(--line); }
  .p3-items { flex-direction: row; overflow-x: auto; overflow-y: hidden; max-height: none; padding-bottom: 10px; }
  .p3-part { width: auto; flex: none; max-width: 200px; touch-action: pan-x; }
  .p3-group { display: none; }
  .p3-title { font-size: 15px; }
  .p3-prog { width: 80px; }
  .p3-help { display: none; }
  .p3-task { font-size: 13.5px; padding: 8px 11px; }
  .p3-msg { top: auto; bottom: 54px; left: 8px; right: 8px; width: auto; font-size: 13px; padding: 8px 11px; opacity: .95; max-height: 40%; overflow: hidden; }
}
@media (max-width: 600px) {
  .p3-bl, .p3-title { display: none; }
  .p3-head { flex-wrap: nowrap; justify-content: space-between; }
  .p3-prog { display: none; }
  .p3-task { left: 8px; top: 8px; max-width: calc(100% - 16px); }
  .p3-task p { font-size: 13px; }
}
@media (pointer: coarse) {
  .p3-views button { padding: 10px 14px; font-size: 14px; }
  .p3-part { min-height: 46px; font-size: 15px; }
}

/* ===== переключатель языка ҚАЗ / РУС ===== */
.lang-sw { display: inline-flex; align-items: center; background: rgba(255,255,255,.08); border-radius: 99px; padding: 3px; gap: 2px; margin-left: auto; }
.lang-sw a { color: #c5cdda; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; padding: 5px 10px; border-radius: 99px; line-height: 1; text-decoration: none; }
.lang-sw a:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.lang-sw a.on { background: #fff; color: #0b1d4a; }
.lang-sw + .me { margin-left: 0; }
@media (max-width: 760px) {
  .lang-sw { flex: none; margin-left: 0; }
  .lang-sw a { padding: 7px 9px; font-size: 12px; }
  .focus .lang-sw { display: none; }
}

/* ---------- SQL-тренажёр ---------- */
.code-switch { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.code-switch::-webkit-scrollbar { display: none; }
.code-switch a { flex: none; white-space: nowrap; }
.md-code, .sq-code { margin: 10px 0; padding: 10px 12px; background: #f0f2f5; border: 1px solid var(--line); border-radius: 10px; font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; overflow-x: auto; }
.md-code code { background: none; padding: 0; font: inherit; }
.sq-code.small { font-size: 12.5px; margin: 6px 0 0; }
.sq-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.sq-main { min-width: 0; }
.sq-main > .card + .card, .sq-main > .card + h2 { margin-top: 14px; }
.sq-side { position: sticky; top: 96px; max-height: calc(100vh - 110px); overflow: auto; padding: 14px; min-width: 0; }
.sq-side h3 { margin-bottom: 2px; }
@media (max-width: 960px) {
  .sq-grid { grid-template-columns: minmax(0, 1fr); }
  .sq-side { position: static; max-height: none; }
}
.sq-box { padding: 14px 16px; }
.sq-box h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sq-expect { border-left: 4px solid var(--pri); }
.sq-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; background: #fff; -webkit-overflow-scrolling: touch; }
.sq-table table { border-collapse: collapse; width: 100%; font-size: 14px; }
.sq-table th, .sq-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.sq-table th { background: #f0f2f5; font: 600 13px ui-monospace, Menlo, Consolas, monospace; color: #2f3745; position: sticky; top: 0; }
.sq-table tr:last-child td { border-bottom: 0; }
.sq-table tbody tr:nth-child(even) td { background: #fafafb; }
.sq-num { font-variant-numeric: tabular-nums; color: #0369a1; }
.sq-null { color: #949eae; font-size: 12px; }
.sq-cnt { margin: 4px 2px 0; }
.sq-out { min-height: 110px; max-height: 60vh; overflow: auto; padding: 12px 14px; background: #fff; }
.sq-out .sq-table { margin-top: 0; }
.sq-out > p.muted { margin: 0; }
.sq-err { color: #b42318; background: #fef3f2; border: 1px solid #fecdca; border-radius: 10px; padding: 10px 12px; word-break: break-word; }
.sq-done { color: var(--ok); margin: 8px 0 0; font-weight: 600; }
.sq-sub { margin: 14px 0 0; font-size: 14px; }
.sq-verdict { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sq-verdict.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #a7dcb6; }
.sq-verdict.bad { background: var(--bad-soft); color: #9a3412; border: 1px solid #f6c8ad; }
.sq-verdict .btn { margin-left: auto; }
.sq-hint { padding: 10px 14px; background: var(--warn-soft); color: #7c4a03; border-bottom: 1px solid var(--line); font-size: 15px; }
.sq-ide .ide-out-head { background: #f0f2f5; color: var(--ink); border-top: 1px solid var(--line); }
.sq-ide .ide-out-head .muted { color: var(--muted) !important; }
.sq-ide .ide-keys button { font-size: 14px; }
.sq-ide .CodeMirror, .sq-ide .CodeMirror-scroll { min-height: 150px; }
.sq-ide .cm-keyword { color: #7c3aed; font-weight: 600; }
.sq-ide .cm-builtin, .sq-ide .cm-type { color: #0369a1; }
.sq-ide .cm-string { color: #b45309; }
.sq-ide .cm-number { color: #15803d; }
.sq-ide .cm-comment { color: #848ea0; font-style: italic; }
.sq-tbl { border-top: 1px solid var(--line); padding: 8px 0; }
.sq-tbl:first-of-type { margin-top: 8px; }
.sq-tbl summary { cursor: pointer; font-family: ui-monospace, Menlo, Consolas, monospace; }
.sq-tbl summary b { color: var(--pri); }
.sq-tbl summary b:hover { text-decoration: underline; }
.sq-cols { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; }
.sq-col { border: 1px solid var(--line); background: #f8f9fa; border-radius: 6px; padding: 2px 7px; font: 12.5px ui-monospace, Menlo, Consolas, monospace; color: var(--ink); cursor: pointer; }
.sq-col i { color: var(--muted); font-style: normal; font-size: 11px; }
.sq-col:hover { border-color: var(--pri); background: var(--pri-soft); }
.sq-side .sq-table { font-size: 12.5px; }
.sq-side .sq-table table { font-size: 12.5px; }
.sq-side .sq-table th, .sq-side .sq-table td { padding: 4px 7px; max-width: 160px; }
.sq-progress { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.sq-bar { flex: 1; max-width: 260px; height: 8px; border-radius: 99px; background: #e0e6f0; overflow: hidden; }
.sq-bar i { display: block; height: 100%; background: var(--pri); border-radius: inherit; transition: width .3s; }
.CodeMirror-hints { z-index: 50; font: 13px ui-monospace, Menlo, Consolas, monospace; }

/* ---------- Системы счисления ---------- */
.num.ns { background: #ede9fe; color: #6d28d9; font-size: 10.5px; letter-spacing: -.02em; }
.num.ns.done { background: var(--ok); color: #fff; font-size: 14px; }
.ns-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 14px 16px; }
.ns-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin: 0; }
.ns-form input, .ns-form select { font: 600 18px ui-monospace, Menlo, Consolas, monospace; padding: 8px 10px; min-width: 0; }
.ns-fnum { flex: 1 1 180px; }
.ns-form select { width: 84px; }
.ns-swap { align-self: flex-end; height: 42px; }
.ns-ex { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 16px; }
.ns-chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 10px; font: 13px ui-monospace, Menlo, Consolas, monospace; cursor: pointer; color: var(--ink); }
.ns-chip:hover { border-color: #7c3aed; color: #6d28d9; }
.ns-head { font: 700 26px/1.3 ui-monospace, Menlo, Consolas, monospace; margin: 4px 0 6px; overflow-wrap: anywhere; }
.ns-n { white-space: nowrap; }
.ns-n sub, .ns-sum sub, .ns-final sub, .ns-qt sub { font-size: .6em; color: #6d28d9; font-weight: 700; }
.ns-plan { background: #f5f3ff; border: 1px solid #ddd6fe; color: #4c1d95; border-radius: 10px; padding: 8px 12px; margin: 6px 0 12px; font-size: 15px; }
.ns-player { padding: 16px; margin-bottom: 18px; }
.ns-st { margin-bottom: 18px; }
.ns-st h4 { margin: 0 0 10px; font: 700 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #4c1d95; }
.ns-stn { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #7c3aed; color: #fff; font-size: 12px; margin-right: 4px; }
.ns-sol { font: 17px/1.5 ui-monospace, Menlo, Consolas, monospace; overflow-x: auto; padding: 2px; }
.ns-sol [data-s] { transition: opacity .25s, background .25s; }
.ns-sol [data-s]:not(.on) { visibility: hidden; opacity: 0; }
.ns-sol.practice .ns-row:not(.on), .ns-sol.practice tr[data-s]:not(.on), .ns-sol.practice .ns-sum:not(.on), .ns-sol.practice .ns-final:not(.on) { display: none; }
.ns-sol .now:not(.ns-stage):not(.ns-digits):not(.ns-groups) { background: #fef9c3; border-radius: 6px; }
.ns-sol tr.now td { background: #fef9c3; }
.ns-cap { min-height: 52px; margin: 12px 0 8px; padding: 10px 12px; background: #f8fafc; border-left: 4px solid #7c3aed; border-radius: 8px; font-size: 16px; }
.ns-ctrl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ns-cnt { color: var(--muted); font-size: 13px; min-width: 64px; text-align: center; }
.ns-note { font-size: 12px; color: var(--muted); font-family: system-ui, sans-serif; }
/* развёрнутая запись */
.ns-digits { display: flex; align-items: flex-end; gap: 4px; margin-bottom: 10px; }
.ns-dg { display: flex; flex-direction: column; align-items: center; }
.ns-pos { font-size: 12px; color: #7c3aed; font-weight: 700; }
.ns-d { display: grid; place-items: center; width: 40px; height: 46px; border: 2px solid #c4b5fd; border-radius: 8px; background: #fff; font-size: 24px; font-weight: 700; }
.ns-dg.fr .ns-d { border-style: dashed; }
.ns-dg.comma .ns-d { border: 0; width: 12px; background: none; }
.ns-base { font-size: 14px; color: #6d28d9; font-weight: 700; align-self: flex-end; margin-left: 2px; }
.ns-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.ns-row { padding: 2px 6px; width: max-content; }
.ns-f sup { color: #7c3aed; }
.ns-sum, .ns-final { margin-top: 8px; padding: 8px 10px; background: #f0fdf4; border-radius: 8px; width: max-content; max-width: 100%; overflow-wrap: anywhere; }
.ns-final { font-size: 19px; font-weight: 700; }
.ns-slot { display: inline-block; min-width: 1ch; }
.ns-ans { font-weight: 800; color: #15803d; }
.ns-slot.good { color: #15803d; font-weight: 700; }
.ns-slot.shown { color: #b45309; font-weight: 700; }
/* деление */
.ns-divwrap { position: relative; display: inline-block; padding-right: 150px; max-width: 100%; }
.ns-div { border-collapse: collapse; width: auto; }
.ns-div th { font: 600 12px system-ui, sans-serif; color: var(--muted); text-align: left; padding: 2px 8px; }
.ns-div td { padding: 3px 8px; border-bottom: 1px dashed #e0e6f0; white-space: nowrap; }
.ns-dv { text-align: right; font-weight: 700; }
.ns-op { color: var(--muted); }
.ns-rem { background: #f5f3ff; font-weight: 800; color: #6d28d9; text-align: center; }
.ns-arrow { position: absolute; right: 116px; top: 26px; bottom: 4px; width: 24px; display: flex; align-items: center; }
.ns-arrow::before { content: ""; position: absolute; left: 50%; top: 6px; bottom: 6px; border-left: 3px solid #7c3aed; }
.ns-arrow.up::after, .ns-arrow.down::after { content: ""; position: absolute; left: calc(50% - 7px); border: 7px solid transparent; }
.ns-arrow.up::after { top: -6px; border-bottom: 10px solid #7c3aed; }
.ns-arrow.down::after { bottom: -6px; border-top: 10px solid #7c3aed; }
.ns-arrow span { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); width: 110px; font: 600 12px/1.3 system-ui, sans-serif; color: #6d28d9; }
/* группы */
.ns-groups { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.ns-grp { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; border: 2px solid; }
.ns-grp.g0 { border-color: #93c5fd; background: #eff6ff; }
.ns-grp.g1 { border-color: #fca5a5; background: #fef2f2; }
.ns-grp.g2 { border-color: #86efac; background: #f0fdf4; }
.ns-grp.g3 { border-color: #fcd34d; background: #fffbeb; }
.ns-grp.comma { border: 0; background: none; font-size: 26px; padding: 0; align-self: center; }
.ns-bits { font-size: 22px; font-weight: 700; letter-spacing: 2px; }
.ns-bits.big { font-size: 26px; }
.ns-pad { color: #b4bbc6; }
.ns-gd { min-height: 30px; font-size: 20px; font-weight: 800; color: #4c1d95; }
.ns-gd::before { content: "↓"; display: block; text-align: center; font-size: 13px; color: var(--muted); font-weight: 400; }
/* сложение */
.ns-addt { border-collapse: collapse; font-size: 22px; width: auto; }
.ns-addt td { width: 34px; height: 34px; text-align: center; padding: 0; }
.ns-carry td { font-size: 14px; color: #dc2626; height: 20px; vertical-align: bottom; }
.ns-plus td { border-bottom: 2px solid var(--ink); }
.ns-plus td:first-child { border-bottom: 0; color: var(--muted); }
.ns-resrow td { font-weight: 800; color: #15803d; }
/* ввод */
.ns-in { font: 700 17px ui-monospace, Menlo, Consolas, monospace; padding: 3px 6px; border: 2px solid #a78bfa; border-radius: 7px; text-align: center; background: #fff; min-width: 3ch; text-transform: uppercase; }
.ns-in:focus { outline: 3px solid #ddd6fe; border-color: #7c3aed; }
.ns-in.bad { border-color: #dc2626; background: #fef2f2; animation: ns-shake .35s; }
@keyframes ns-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.ns-prompt { min-height: 44px; margin-bottom: 12px; padding: 10px 12px; background: #f5f3ff; border-radius: 10px; font-size: 16px; }
.ok-t { color: #15803d; }
.bad-t { color: #b42318; }
.ns-qhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.ns-dots { display: flex; gap: 5px; flex: 1; }
.ns-dots i { width: 14px; height: 14px; border-radius: 50%; background: #e0e6f0; display: block; }
.ns-dots i.cur { background: #a78bfa; box-shadow: 0 0 0 3px #ede9fe; }
.ns-dots i.ok { background: #16a34a; }
.ns-dots i.mid { background: #f59e0b; }
.ns-dots i.bad { background: #dc2626; }
.ns-q { padding: 16px; }
.ns-qt { font-size: 21px; margin-bottom: 10px; }
.ns-qt .ns-n { font-family: ui-monospace, Menlo, Consolas, monospace; }
.ns-qfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.ns-next:empty { display: none; }
.ns-free { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.ns-free input { font: 700 20px ui-monospace, Menlo, Consolas, monospace; width: 13ch; padding: 6px 10px; text-transform: uppercase; }
.ns-fb { min-height: 26px; font-weight: 600; }
.ns-done { text-align: center; padding: 28px 16px; }
.ns-stars { font-size: 44px; color: #f59e0b; letter-spacing: 6px; }
.ns-stars i { font-style: normal; color: #e0e6f0; }
.ns-score b { font-size: 34px; }
/* лампочки */
.ns-bulbs { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; max-width: 560px; }
.ns-bulb { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); min-width: 0; }
.ns-bulb:disabled { cursor: default; color: var(--ink); }
.ns-w { font-weight: 700; font-size: 13px; }
.ns-lamp { width: 28px; height: 28px; border-radius: 50%; background: #e5e7eb; border: 2px solid #cbd5e1; transition: background .2s, box-shadow .2s; }
.ns-bulb.on .ns-lamp { background: #fde047; border-color: #f59e0b; box-shadow: 0 0 14px #facc15; }
.ns-bit { font: 800 18px ui-monospace, Menlo, Consolas, monospace; }
.ns-p { font-size: 11px; color: var(--muted); }
.ns-bsum { margin: 10px 0 0; font: 16px ui-monospace, Menlo, Consolas, monospace; min-height: 24px; overflow-wrap: anywhere; }
.ns-binfo { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font: 700 16px ui-monospace, Menlo, Consolas, monospace; }
.ns-two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-top: 8px; align-items: start; }
.ns-two .card { padding: 16px; }
.ns-reft td, .ns-reft th { padding: 3px 10px; text-align: center; }
.ns-basechk { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; }
@media (max-width: 760px) {
  .ns-two { grid-template-columns: minmax(0, 1fr); }
  .ns-sol { font-size: 15px; }
  .ns-d { width: 32px; height: 40px; font-size: 20px; }
  .ns-head { font-size: 21px; }
  .ns-qt { font-size: 18px; }
  .ns-bulbs { gap: 3px; }
  .ns-divwrap { padding-right: 112px; }
  .ns-arrow { right: 82px; }
  .ns-arrow span { width: 80px; font-size: 11px; }
  .ns-lamp { width: 22px; height: 22px; }
  .ns-w { font-size: 11px; }
  .ns-ctrl .btn { padding-left: 10px; padding-right: 10px; }
}

/* ---------- тесты: название с переименованием, вкладки ---------- */
.ttl-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ttl-edit h1 { margin: 0; }
.rename { position: relative; }
.rename > summary { list-style: none; cursor: pointer; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 15px; }
.rename > summary::-webkit-details-marker { display: none; }
.rename > summary:hover { border-color: var(--pri); }
.rename[open] > summary { background: var(--pri-soft); border-color: var(--pri); }
.rename-form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.rename-form input[name=title] { flex: 1 1 260px; min-width: 0; }
.ttl-edit:has(.rename[open]) { flex-direction: column; align-items: stretch; }
.ttl-edit:has(.rename[open]) .rename > summary { position: absolute; right: 0; top: -40px; }
.ttl-edit:has(.rename[open]) > h1, .ttl-edit:has(.rename[open]) > b { display: none; }
.results-table .ttl-edit b { font-size: 15px; }
.results-table .rename > summary { width: 26px; height: 26px; font-size: 12px; }
.test-tabs { margin-top: 16px; }
.test-tabs a b { margin-left: 4px; opacity: .75; }
.res-stats .stat b { display: block; font-size: 26px; }
.res-stats .stat span { color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .results-table thead { display: none; }
  .results-table, .results-table tbody, .results-table tr, .results-table td { display: block; width: 100%; }
  .results-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .results-table tr:last-child { border-bottom: 0; }
  .results-table td { border: 0 !important; padding: 3px 4px !important; }
  .results-table td[data-label] { display: flex; justify-content: space-between; gap: 10px; }
  .results-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 400; }
  .results-table td:last-child { padding-top: 8px !important; }
  .results-table td:last-child .btn { width: 100%; justify-content: center; }
}
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- обложка курса ---------- */
.subj-cover { margin: -22px -22px 8px; aspect-ratio: 2 / 1; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: #edeff3; }
.subj-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.subject.locked .subj-cover img { filter: grayscale(.6); }
.sdesc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.subj-head { margin-bottom: 8px; }
.subj-head.has-cover { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 22px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.subj-banner { aspect-ratio: 2 / 1; overflow: hidden; border-radius: 10px; background: #edeff3; }
.subj-banner img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.subj-desc { color: var(--muted); }
.subj-desc p { margin: 6px 0; }
.cover-field { margin: 4px 0 12px; }
@media (max-width: 760px) {
  .subj-head.has-cover { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
  .subj-cover { margin: -18px -18px 8px; }
  .subject-admin .subj-cover { margin: -22px -22px 8px; }
}

/* ---------- пароль ---------- */
.forgot-link { margin: 10px 0 0; font-size: 14px; }
.pw-box { display: flex; gap: 16px; align-items: flex-start; border: 2px solid #f59e0b; background: #fffbeb; }
.pw-box .bigicon { font-size: 34px; margin: 0; }
.pw-box h3 { margin-bottom: 6px; }
.pw-code { font: 700 22px ui-monospace, Menlo, Consolas, monospace; background: #fff; border: 1px dashed #f59e0b; border-radius: 8px; padding: 3px 10px; letter-spacing: 1px; }

/* ---------- онлайн ---------- */
.online-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; margin-right: 6px; vertical-align: middle; animation: ndot 2s infinite; }
@keyframes ndot { 50% { box-shadow: 0 0 0 5px #dcfce7; } }
.online-t { color: #15803d; font-size: 13px; }
.seen-page { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.is-online td:first-child { box-shadow: inset 3px 0 0 #22c55e; }
.who-tabs { margin-bottom: 4px; }
.online-line { margin: -4px 0 12px; font-size: 15px; }

/* ---------- рейтинг ---------- */
.top3 { padding: 18px 20px; }
.top3 h2 { margin: 0; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 16px 0 6px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 150px; text-align: center; }
.pod .avatar { box-shadow: 0 0 0 3px #fff, 0 4px 14px rgba(0,0,0,.15); }
.pod-medal { font-size: 30px; line-height: 1; }
.pod-name { font-size: 14px; line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pod-pts { font-size: 13px; color: var(--muted); }
.pod-step { width: 100%; margin-top: 6px; border-radius: 10px 10px 0 0; display: grid; place-items: center; font: 800 26px system-ui; color: #fff; }
.pod-1 .pod-step { height: 92px; background: linear-gradient(#fbbf24, #f59e0b); }
.pod-2 .pod-step { height: 66px; background: linear-gradient(#cbd5e1, #94a3b8); }
.pod-3 .pod-step { height: 48px; background: linear-gradient(#fdba74, #ea8a4c); }
.pod.me .pod-name { color: var(--pri); }
.my-rank { text-align: center; margin: 10px 0 0; border-top: 1px solid var(--line); padding-top: 10px; }
.rating-list .rrow { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.rating-list .rrow:last-child { border-bottom: 0; }
.rrow.me { background: var(--pri-soft); }
.rrow.rtop { background: #fffbeb; }
.rrow.rtop.me { background: linear-gradient(90deg, #fffbeb, var(--pri-soft)); }
.rpos { width: 34px; text-align: center; font: 800 18px system-ui; color: var(--muted); flex: none; }
.rrow.rtop .rpos { font-size: 26px; }
.rpos.big { font-size: 40px; width: 56px; }
.rpts { text-align: right; flex: none; }
.rpts b { display: block; font-size: 20px; line-height: 1.1; }
.rpts small { color: var(--muted); font-size: 12px; }
.rchips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.rchip { font-size: 12px; background: #f0f2f5; border-radius: 99px; padding: 1px 8px; color: var(--muted); }
.my-rank-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.how-points { padding: 12px 18px; }
.how-points ul { margin: 8px 0 0; padding-left: 20px; }
@media (max-width: 520px) {
  .podium { gap: 6px; }
  .pod { width: 31%; }
  .pod .avatar { width: 48px !important; height: 48px !important; font-size: 18px !important; }
  .rating-list .rrow { padding: 10px 12px; gap: 8px; }
}

/* ---------- заявка на рассмотрении: каталог и демо ---------- */
.pending-card { display: flex; gap: 18px; align-items: center; }
.pending-card .bigicon { font-size: 44px; margin: 0; }
.pending-card h1 { font-size: 22px; }
.demo-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.locked-row { opacity: .7; }
.demo-tag { background: #ede9fe; color: #6d28d9; }

/* ---------- вопрос «Соединить стрелками» ---------- */
.match { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px clamp(40px, 12vw, 140px); margin: 8px 0 4px; }
.match-col { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 2; justify-content: space-around; }
.match-svg { position: absolute; inset: 0; z-index: 1; overflow: visible; pointer-events: none; }
.match-svg .mline { pointer-events: stroke; cursor: pointer; }
.match-svg .mline:hover { stroke-width: 5; }
.mitem { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; min-height: 46px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.match-col.right .mitem { justify-content: flex-start; }
.mitem .mtext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mitem .mdot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #94a3b8; background: #fff; flex: none; }
.mitem:hover { border-color: #94a3b8; }
.mitem.picked { border-color: var(--pri); background: var(--pri-soft); transform: scale(1.02); }
.mitem.picked .mdot { background: var(--pri); border-color: var(--pri); }
.mitem.linked { border-color: var(--mc); }
.mitem.linked .mdot { background: var(--mc); border-color: var(--mc); }
.achip.pair.ok { border-color: #86efac; background: #f0fdf4; }
.achip.pair.bad { border-color: #fca5a5; background: #fef2f2; }
@media (max-width: 520px) { .match { gap: 8px 34px; } .mitem { padding: 8px; font-size: 14px; gap: 6px; } }

/* ---------- вопрос «Заполнить пропуски» ---------- */
.fill-text { font-size: 17px; line-height: 2.3; }
.fill-text input.blank { display: inline-block; min-width: 4ch; max-width: 100%; padding: 2px 8px; margin: 0 2px; border: 0; border-bottom: 2px solid var(--pri); border-radius: 6px 6px 0 0; background: #f0f5fd; font: inherit; line-height: 1.5; text-align: center; }
.fill-text input.blank:focus { outline: 2px solid #99bef6; background: #fff; }
.word-bank { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.wchip { border: 1px solid #99bef6; background: #f0f5fd; color: #0846ad; border-radius: 99px; padding: 4px 12px; font: 600 14px system-ui; cursor: pointer; }
.wchip:hover { background: #ccdffb; }
.fill-view { line-height: 1.9; }
.blank-ans { padding: 1px 6px; border-radius: 6px; }
.blank-ans.ok { background: #dcfce7; color: #166534; }
.blank-ans.bad { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.right-ans .blank-ans.ok, .explain .blank-ans.ok { text-decoration: none; }
/* админка: пары */
.pairrows { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.pairrow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.pair-arrow { color: var(--pri); font-weight: 700; }

/* ---------- поделиться ---------- */
.share-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; }
.share-label { font-weight: 600; margin-right: 4px; }
.sbtn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 14px system-ui; cursor: pointer; text-decoration: none !important; }
.sbtn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.sbtn.tg { background: #229ed9; border-color: #229ed9; color: #fff; }
.sbtn.fb { background: #1877f2; border-color: #1877f2; color: #fff; }
.sbtn:hover { filter: brightness(.95); }

/* ---------- шапка: всё в одну строку ---------- */
@media (min-width: 821px) {
  .top .wrap.topin { max-width: 1320px; }
  .topin { flex-wrap: nowrap; gap: 14px; }
  .logo { flex: none; }
  nav.main { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  nav.main::-webkit-scrollbar { display: none; }
  nav.main a { white-space: nowrap; flex: none; }
  nav.main.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
  nav.main.fade-l { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px); mask-image: linear-gradient(to right, transparent, #000 36px); }
  nav.main.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
  .lang-sw, .me { flex: none; }
  .me { white-space: nowrap; }
  .me-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
}
/* на средних экранах — компактнее: имя прячется (остаётся аватарка), пункты меню плотнее */
@media (min-width: 821px) and (max-width: 1280px) {
  .me-name { display: none; }
  .me a.me-link { padding: 4px; }
  nav.main a { padding: 6px 9px; font-size: 14.5px; }
}
@media (min-width: 821px) and (max-width: 1060px) {
  .logo-t { display: none; }
  .topin { gap: 10px; }
  nav.main a { padding: 6px 8px; font-size: 14px; }
}
/* планшеты: раньше меню уходило на вторую строку — теперь остаётся в одной */
@media (min-width: 821px) and (max-width: 960px) {
  nav.main { order: 0; flex: 1 1 auto; }
  .topin { padding-top: 0; padding-bottom: 0; justify-content: flex-start; }
}

/* ---------- Логика: элементы, схемы, таблицы ---------- */
.num.lg { background: #fef3c7; color: #92400e; font-size: 13px; }
.num.lg.done { background: var(--ok); color: #fff; }
.lg-body { fill: #fff; stroke: #1f2937; stroke-width: 2.2; stroke-linejoin: round; }
.lg-nofill { fill: none; }
.lg-lead { stroke: #1f2937; stroke-width: 2.2; }
.lg-label { font: 700 15px system-ui, sans-serif; text-anchor: middle; fill: #1f2937; }
.lg-val { font: 800 17px ui-monospace, Menlo, Consolas, monospace; fill: #64748b; }
.lg-val.on { fill: #16a34a; }
.lg-q { font: 800 20px system-ui; fill: #7c3aed; }
.lg-icon { display: block; overflow: visible; max-width: 100%; height: auto; }
.lg-center { display: flex; justify-content: center; margin: 8px 0; }
.lg-style { display: inline-flex; align-items: center; gap: 4px; background: #edeff3; border-radius: 10px; padding: 3px; }
.lg-style .muted { padding: 0 6px; }
.lg-style button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; font: 600 13px system-ui; cursor: pointer; color: var(--ink); }
.lg-style button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--pri); }
.lg-taskbar { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
/* поле схемы */
.lg-board { background: #f8fafc; background-image: radial-gradient(#d7dee5 1px, transparent 1px); background-size: 20px 20px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; touch-action: none; }
.lg-board.static { touch-action: auto; max-width: 760px; margin: 8px auto; }
.lg-svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.lg-wire { fill: none; stroke: #64748b; stroke-width: 3; stroke-linecap: round; }
.lg-wire.v1 { stroke: #16a34a; stroke-width: 3.5; }
.lg-wire.v0 { stroke: #94a3b8; }
.lg-wire.vn { stroke: #cbd5e1; stroke-dasharray: 6 5; }
.lg-wire.pending { stroke: #7c3aed; stroke-dasharray: 6 4; pointer-events: none; }
[data-lg-editor] .lg-wire, .lg-ed .lg-wire { cursor: pointer; }
[data-lg-editor] .lg-wire:hover, .lg-ed .lg-wire:hover { stroke: #dc2626; stroke-width: 5; }
.lg-gate { cursor: grab; }
.lg-gate .lg-hit { fill: transparent; }
.lg-gate.sel .lg-body { stroke: #7c3aed; stroke-width: 3; }
.lg-gate.v1 .lg-lead:last-of-type { stroke: #16a34a; }
.lg-pin { fill: #fff; stroke: #7c3aed; stroke-width: 2; cursor: crosshair; }
.lg-pin:hover { fill: #ede9fe; r: 8; }
.lg-name { font: 700 18px system-ui, sans-serif; fill: #1f2937; }
.lg-switch { fill: #cbd5e1; stroke: #94a3b8; stroke-width: 1.5; }
.lg-switch.on { fill: #86efac; stroke: #16a34a; }
.lg-knob { fill: #fff; stroke: #64748b; stroke-width: 1.5; }
.lg-input.clickable { cursor: pointer; }
.lg-bit { font: 700 13px ui-monospace, monospace; fill: #475569; }
.lg-lamp { fill: #f1f5f9; stroke: #64748b; stroke-width: 2; }
.lg-lamp.on { fill: #fde047; stroke: #ca8a04; filter: drop-shadow(0 0 8px #facc15); }
.lg-lamp.off { fill: #e2e8f0; }
.lg-lampv { font: 800 14px ui-monospace, monospace; fill: #1f2937; }
/* редактор */
.lg-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lg-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.lg-pal { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 4px 8px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: 600 12px system-ui; color: var(--ink); }
.lg-pal:hover { border-color: #7c3aed; background: #f5f3ff; }
.lg-pal .lg-icon { width: 54px; }
.lg-acts { display: flex; gap: 6px; }
.lg-help { margin: 4px 0 8px; }
.lg-under { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; margin-top: 10px; }
.lg-expr { font-size: 16px; }
.lg-expr > div { margin-bottom: 4px; }
.lg-f { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; color: #4c1d95; }
.lg-f.big, p.lg-f.big, .lg-f.big { font-size: 22px; }
.lg-warn { color: #b42318; font-weight: 600; margin-bottom: 4px; }
.lg-livetable .lg-table { font-size: 14px; }
.lg-edcard, .lg-setup { padding: 14px 16px; }
.lg-exprform { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.lg-exprform label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1 1 260px; margin: 0; }
.lg-exprform input { font: 600 17px ui-monospace, Menlo, Consolas, monospace; }
.lg-ops-help { margin: 6px 0 8px; }
.lg-inouts { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.lg-inouts label { display: flex; align-items: center; gap: 6px; font-size: 14px; margin: 0; }
.lg-inouts select { width: auto; padding: 4px 8px; }
/* таблицы истинности */
.lg-table { border-collapse: collapse; font: 15px ui-monospace, Menlo, Consolas, monospace; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lg-table th, .lg-table td { padding: 5px 12px; text-align: center; border-bottom: 1px solid var(--line); }
.lg-table th { background: #f0f2f5; font-weight: 700; white-space: nowrap; }
.lg-table th.fcol, .lg-table td.fcol { background: #fffbeb; }
.lg-table th.stepcol { color: #6d28d9; font-size: 13px; }
.lg-table td.b1 { color: #15803d; font-weight: 800; }
.lg-table td.b0 { color: #64748b; }
.lg-table tr.hi td { background: #ecfdf5; }
.lg-table tr.hi td.fcol { background: #d1fae5; }
.lg-table.fill td { padding: 3px 6px; }
.lg-tw { display: flex; justify-content: center; overflow-x: auto; border: 0; background: none; box-shadow: none; }
.lg-cell { width: 44px; height: 34px; border: 2px solid #c4b5fd; border-radius: 8px; background: #fff; font: 800 17px ui-monospace, monospace; cursor: pointer; color: #4c1d95; }
.lg-cell:hover { background: #f5f3ff; }
.lg-cell.good { border-color: #22c55e; background: #f0fdf4; color: #166534; }
.lg-cell.bad { border-color: #ef4444; background: #fef2f2; color: #991b1b; }
.lg-cell.shown { border-color: #f59e0b; color: #92400e; }
.lg-cell:disabled { cursor: default; }
/* ответы */
.lg-bin { display: flex; justify-content: center; gap: 16px; margin: 12px 0; }
.lg-bbtn { width: 84px; height: 64px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: 800 30px ui-monospace, monospace; cursor: pointer; color: var(--ink); }
.lg-bbtn:hover:not(:disabled) { border-color: var(--pri); background: var(--pri-soft); }
.lg-bbtn.right { border-color: #22c55e; background: #dcfce7; color: #166534; }
.lg-bbtn.wrong { border-color: #ef4444; background: #fee2e2; color: #991b1b; }
.lg-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 12px 0; }
.lg-choice { text-align: left; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-size: 16px; cursor: pointer; color: var(--ink); }
.lg-choice:hover:not(:disabled) { border-color: var(--pri); }
.lg-choice.right { border-color: #22c55e; background: #f0fdf4; }
.lg-choice.wrong { border-color: #ef4444; background: #fef2f2; }
.lg-steps { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.lg-why { margin-top: 8px; }
.lg-story { background: #fffbeb; border-left: 4px solid #f59e0b; padding: 10px 12px; border-radius: 8px; font-size: 16px; }
.lg-target { margin: 8px 0; }
.lg-target summary { cursor: pointer; font-weight: 600; }
.lg-q .lg-ed { margin-top: 6px; }
/* справочник */
.lg-refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.lg-ref { padding: 14px; margin: 0; }
.lg-ref h3 { margin: 6px 0 2px; font-size: 16px; }
.lg-ref .lg-f.big { font-size: 18px; margin: 2px 0 6px; }
.lg-ref-icons { display: flex; gap: 12px; justify-content: center; }
.lg-ref-icons > div { display: flex; flex-direction: column; align-items: center; }
.lg-ref-icons small { color: var(--muted); font-size: 11px; }
@media (max-width: 760px) {
  .lg-under { grid-template-columns: minmax(0, 1fr); }
  .lg-pal { padding: 3px 5px 5px; }
  .lg-pal .lg-icon { width: 42px; }
  .lg-bbtn { width: 72px; height: 56px; }
  .lg-table th, .lg-table td { padding: 4px 7px; }
  .lg-cell { width: 38px; }
}

.lg-table { width: auto !important; }
.lg-tw .lg-table { margin: 0 auto; }
@media (pointer: coarse) {
  /* на сенсорных экранах кружки-выводы шире «ловят» палец */
  .lg-pin { stroke-width: 12px; stroke: rgba(124, 58, 237, .28); paint-order: stroke; }
}

/* ===== уроки: таблицы, заметки, картинки ===== */
.content .md-table { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; }
.content .md-table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.content .md-table th { background: var(--pri-soft); color: var(--pri-dark); text-align: left; font-weight: 700; }
.content .md-table th, .content .md-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.content .md-table tr:last-child td { border-bottom: 0; }
.content .md-table tbody tr:nth-child(even) td { background: #fafafb; }
.md-note { margin: 16px 0; padding: 12px 16px; border-radius: 12px; border-left: 5px solid #94a3b8; background: #f1f5f9; font-size: 16px; line-height: 1.6; }
.md-note p { margin: 0 0 4px; }
.md-note p:last-child { margin: 0; }
.md-note.tip { background: #ecfdf5; border-color: #10b981; }
.md-note.warn { background: #fff7ed; border-color: #f97316; }
.md-note.key { background: #eef2ff; border-color: #6366f1; }
.md-note.fun { background: #fdf4ff; border-color: #c026d3; }
.md-fig { margin: 16px 0; text-align: center; }
.md-fig img { max-width: 100%; height: auto; border-radius: 12px; }
.md-fig figcaption { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* ===== интерактивные элементы уроков ===== */
.cs-widget { margin: 20px 0; padding: 16px 18px 18px; border: 1px solid #c7d2fe; border-radius: 16px; background: linear-gradient(180deg, #f8faff, #fff 60%); font-size: 15px; line-height: 1.5; }
.cs-widget.plain { padding: 0; border: 0; background: none; }
.cs-whead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 12px; }
.cs-whead b { font-size: 17px; }
.cs-wtag { background: #4f46e5; color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.cs-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.cs-cnt { color: var(--muted); font-size: 14px; min-width: 40px; text-align: center; }
.cs-icon { display: block; flex: none; }
.cs-shake { animation: csShake .4s; }
@keyframes csShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* схема компьютера */
.cs-arch { display: grid; grid-template-columns: 1fr 44px 1.15fr 44px 1fr; grid-template-areas: "input a1 cpu a2 output" ". . a3 . ." ". . ram a4 storage"; gap: 6px; align-items: center; }
.cs-ab { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); text-align: center; transition: .2s; min-height: 108px; justify-content: center; }
.cs-ab:hover { border-color: #a5b4fc; }
.cs-ab.on { border-color: #4f46e5; background: #eef2ff; box-shadow: 0 0 0 4px rgba(79, 70, 229, .15); transform: translateY(-2px); }
.cs-abic { display: flex; gap: 4px; }
.cs-ab b { font-size: 14px; line-height: 1.25; }
.cs-cpuin { display: flex; gap: 6px; }
.cs-cpuin i { font-style: normal; font-size: 12px; font-weight: 700; background: #e0e7ff; color: #3730a3; border-radius: 6px; padding: 1px 7px; }
.cs-ar { font-size: 28px; color: #cbd5e1; text-align: center; font-weight: 700; transition: .2s; }
.cs-ar.on { color: #4f46e5; transform: scale(1.25); }
.cs-archtext { margin-top: 12px; min-height: 52px; padding: 10px 14px; background: #fff; border: 1px dashed #c7d2fe; border-radius: 12px; }

/* системный блок */
.cs-inside { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cs-pc { width: 100%; height: auto; display: block; }
.cs-part { cursor: pointer; transition: opacity .2s; outline: none; }
.cs-part:hover > :first-child, .cs-part:focus-visible > :first-child { stroke: #4f46e5; stroke-width: 4; }
.cs-pc:has(.cs-part.on) .cs-part:not(.on) { opacity: .45; }
.cs-part.on > :first-child { stroke: #4f46e5; stroke-width: 5; }
.cs-part.found { animation: csPulse .7s; }
@keyframes csPulse { 50% { opacity: .3; } }
.cs-pinfo { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 100px; }
.cs-pi { display: flex; gap: 12px; align-items: flex-start; }
.cs-pi h4 { margin: 0 0 4px; font-size: 17px; }
.cs-pi p { margin: 0 0 6px; }
.cs-gamemsg { font-size: 15px; }

/* клавиатура */
.cs-klegend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cs-kl { border: 0; border-radius: 99px; padding: 4px 11px; font: 600 13px/1.4 inherit; font-family: inherit; cursor: pointer; opacity: .85; }
.cs-kl.on { opacity: 1; box-shadow: 0 0 0 2px var(--ink); }
.cs-kbdwrap { overflow-x: auto; padding-bottom: 4px; }
.cs-kbd { display: flex; gap: 12px; min-width: 860px; padding: 10px; background: #334155; border-radius: 12px; }
.cs-kblock { display: flex; flex-direction: column; gap: 4px; }
.cs-kblock.kb-main { flex: 15; }
.cs-kblock.kb-cur { flex: 3; }
.cs-kblock.kb-num { flex: 4; }
.cs-krow { display: flex; gap: 4px; min-height: 34px; }
.cs-key { flex: 1; min-width: 0; height: 34px; border: 0; border-radius: 6px; font: 600 12px/1 system-ui, sans-serif; color: #1e293b; cursor: pointer; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); padding: 0 3px; white-space: nowrap; overflow: hidden; transition: transform .08s, filter .2s; }
.cs-key.gap { visibility: hidden; }
.cs-key.press { transform: translateY(2px); box-shadow: none; }
.cs-kbd:has(.hl) .cs-key:not(.hl) { filter: grayscale(.9) brightness(.75); }
.g-func { background: #fcd34d; }
.g-alnum { background: #e2e8f0; }
.g-ctrl { background: #fca5a5; }
.g-cursor { background: #86efac; }
.g-num { background: #93c5fd; }
.cs-kinfo { margin-top: 10px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; min-height: 48px; }
.cs-ktip { margin-top: 6px; color: #3730a3; }

/* галерея */
.cs-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.cs-gcard { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 12px 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.cs-gcard b { font-size: 14px; line-height: 1.25; }
.cs-gcard span { font-size: 13px; color: var(--muted); line-height: 1.35; }

/* сортировка */
.cs-pool, .cs-orderpool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 20px; margin-bottom: 12px; }
.cs-card { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; background: #fff; border: 2px solid var(--line); border-radius: 12px; font: 600 14px/1.25 inherit; font-family: inherit; color: var(--ink); cursor: grab; touch-action: none; user-select: none; max-width: 240px; text-align: left; transition: border-color .15s, box-shadow .15s; }
.cs-card:hover { border-color: #a5b4fc; }
.cs-card.sel { border-color: #4f46e5; box-shadow: 0 0 0 4px rgba(79, 70, 229, .2); }
.cs-card.right { border-color: #22c55e; background: #f0fdf4; cursor: default; }
.cs-card.wrong { border-color: #f97316; background: #fff7ed; cursor: default; }
.cs-card:disabled { opacity: 1; color: var(--ink); }
.cs-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) rotate(-3deg); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.cs-bins { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 10px; }
.cs-bin { border: 2px dashed #a5b4fc; border-radius: 14px; background: #f8faff; min-height: 130px; cursor: pointer; transition: .15s; outline: none; }
.picking .cs-bin { border-color: #4f46e5; background: #eef2ff; }
.cs-bin.over, .cs-bin:focus-visible { border-style: solid; background: #e0e7ff; }
.cs-binh { padding: 8px 10px; font-weight: 700; font-size: 14px; text-align: center; border-bottom: 1px dashed #c7d2fe; color: #3730a3; }
.cs-binc { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.cs-binc .cs-card { max-width: none; font-size: 13px; }
.cs-binc .cs-icon { width: 34px; height: 34px; }
.cs-fb { margin-top: 10px; min-height: 24px; }

/* пирамида */
.cs-pyr { display: grid; grid-template-columns: 70px 1fr 70px; gap: 6px; align-items: stretch; }
.cs-pyrside { display: flex; flex-direction: column; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.2; }
.cs-pyrside span { font-size: 22px; color: #4f46e5; }
.cs-pyrside.l { justify-content: flex-start; gap: 6px; }
.cs-pyrside.r { justify-content: flex-end; gap: 6px; }
.cs-pyrstack { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cs-lvl { width: var(--w); min-width: 120px; padding: 10px 6px; border: 0; color: #fff; background: var(--c); font: 700 14px/1.2 inherit; font-family: inherit; cursor: pointer; clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%); transition: filter .2s, transform .2s; }
.cs-lvl:hover { filter: brightness(1.1); }
.cs-lvl.on { transform: scale(1.04); box-shadow: 0 0 0 3px #1e293b inset; }
.cs-widget .cs-pinfo { margin-top: 12px; }
.cs-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.cs-facts span { background: #f1f5f9; border-radius: 8px; padding: 3px 9px; }

/* носители */
.cs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cs-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: 600 13px/1.2 inherit; font-family: inherit; color: var(--ink); cursor: pointer; }
.cs-chip small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.cs-chip.on { border-color: #4f46e5; background: #eef2ff; }
.cs-chip.mini { padding: 4px 11px; font-size: 16px; }
.cs-emo { font-size: 22px; }
.cs-fit { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.cs-fitn { font-size: 26px; margin-bottom: 8px; }
.cs-cap { display: grid; grid-template-columns: repeat(25, 1fr); gap: 3px; margin-bottom: 8px; }
.cs-cap i { aspect-ratio: 1; border-radius: 3px; background: #e2e8f0; }
.cs-cap i.on { background: #6366f1; }

/* единицы */
.cs-ladder { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; margin-bottom: 14px; }
.cs-rung { padding: 6px 12px; border-radius: 10px; background: #e2e8f0; font-weight: 700; }
.cs-rung.on { background: #4f46e5; color: #fff; }
.cs-step { font-size: 12px; color: var(--muted); }
.cs-step.on { color: #4f46e5; font-weight: 700; }
.cs-uform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.cs-uform input { width: 130px; font-size: 18px; text-align: right; }
.cs-uform select { width: auto; font-size: 16px; }
.cs-ures { margin-top: 12px; text-align: center; }
.cs-ubig { font-size: 22px; margin-bottom: 6px; overflow-wrap: anywhere; }
.cs-ubig b { color: #4f46e5; }

/* ASCII и Юникод */
.cs-tin { display: block; font-weight: 600; font-size: 14px; }
.cs-tin input, .cs-tin textarea { font: 18px/1.4 ui-monospace, Menlo, Consolas, monospace; margin-top: 4px; }
.cs-cards { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.cs-cc { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 6px 6px 5px; background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; line-height: 1.3; }
.cs-cc b { font: 700 22px/1.2 ui-monospace, Menlo, Consolas, monospace; }
.cs-cc small { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
.cs-cc.bad { background: #fff7ed; border-color: #fdba74; }
.cs-cc.u { border-width: 2px; }
.cs-cc.b1, .cs-alegend .b1 { border-color: #86efac; }
.cs-cc.b2, .cs-alegend .b2 { border-color: #93c5fd; }
.cs-cc.b3, .cs-alegend .b3 { border-color: #fcd34d; }
.cs-cc.b4, .cs-alegend .b4 { border-color: #f9a8d4; }
.cs-bytes { display: flex; gap: 2px; }
.cs-bytes i { font: 600 11px/1 ui-monospace, Menlo, Consolas, monospace; font-style: normal; background: #f1f5f9; border-radius: 4px; padding: 3px 3px; }
.cs-sum { width: 100%; margin: 6px 0 0; font-size: 14px; }
.cs-alegend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; font-size: 12px; }
.cs-alegend span { padding: 2px 8px; border-radius: 6px; border: 2px solid transparent; }
.cs-atwrap { overflow-x: auto; }
.cs-atable { border-collapse: separate; border-spacing: 2px; margin: 0 auto; font-size: 13px; }
.cs-atable th { color: var(--muted); font-weight: 600; font-size: 11px; padding: 0 2px; }
.cs-atable td { padding: 0; }
.cs-atable button { width: 30px; height: 30px; border: 0; border-radius: 5px; font: 600 14px/1 ui-monospace, Menlo, Consolas, monospace; cursor: pointer; color: #1e293b; padding: 0; }
.cs-atable button small { font-size: 8px; font-family: system-ui, sans-serif; }
.cs-atable button.sel { outline: 3px solid #4f46e5; }
.cs-atable .g-ctl, .cs-alegend .g-ctl { background: #e2e8f0; color: #64748b; }
.cs-atable .g-sym, .cs-alegend .g-sym { background: #fef3c7; }
.cs-atable .g-dig, .cs-alegend .g-dig { background: #bbf7d0; }
.cs-atable .g-up, .cs-alegend .g-up { background: #bfdbfe; }
.cs-atable .g-lo, .cs-alegend .g-lo { background: #fbcfe8; }
.cs-adetail { margin-top: 10px; text-align: center; min-height: 30px; font-size: 16px; }
.cs-kaz { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.cs-usum { margin-top: 8px; }
.cs-vrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.cs-vrow label { flex: 1 1 160px; font-weight: 600; font-size: 14px; }
.cs-vrow label.cs-nfield { flex: 0 1 100px; }

/* ===== тренажёр ===== */
.cs-q .cs-bigicon { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 10px; }
.cs-q .cs-bigicon .cs-icon { width: 150px; height: 150px; }
.cs-devname { font-size: 20px; font-weight: 700; }
.cs-task { text-align: center; font-size: 18px; margin: 6px 0 10px; }
.cs-task.big { font-size: 22px; }
.cs-task .mono, .cs-task.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }
.cs-anchor { text-align: center; color: #3730a3; background: #eef2ff; border-radius: 10px; padding: 6px 12px; margin: 0 auto 10px; max-width: 520px; font-size: 15px; }
.cs-ch { font: 700 26px/1 ui-monospace, Menlo, Consolas, monospace; }
.cs-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.cs-choice { padding: 12px 14px; background: #fff; border: 2px solid var(--line); border-radius: 12px; font: 600 16px/1.35 inherit; font-family: inherit; color: var(--ink); cursor: pointer; text-align: center; }
.cs-choice:hover:not(:disabled) { border-color: #a5b4fc; background: #f8faff; }
.cs-choice.right { border-color: #22c55e; background: #f0fdf4; }
.cs-choice.wrong { border-color: #ef4444; background: #fef2f2; }
.cs-choice:disabled { cursor: default; color: var(--ink); }
.cs-choices.icons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cs-choices.icons .cs-choice { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; }
.cs-inform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 8px 0; }
.cs-inform input { width: 220px; font: 600 20px/1.3 ui-monospace, Menlo, Consolas, monospace; text-align: center; }
.cs-inform input.right { border-color: #22c55e; background: #f0fdf4; }
.cs-inform input.wrong { border-color: #ef4444; background: #fef2f2; }
.cs-unit { font-size: 18px; font-weight: 600; }
.cs-explain { margin-top: 8px; padding: 10px 14px; background: #f8fafc; border-left: 4px solid #6366f1; border-radius: 8px; color: var(--ink); font-size: 15px; line-height: 1.55; }
.cs-bcs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.cs-bc { display: inline-flex; flex-direction: column; align-items: center; min-width: 30px; padding: 3px 5px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.cs-bc b { font-family: ui-monospace, Menlo, Consolas, monospace; }
.cs-bc i { font-style: normal; font-size: 12px; color: #4f46e5; font-weight: 700; }
.cs-slots { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0; margin: 6px 0 14px; }
.cs-slot { display: flex; align-items: center; gap: 6px; min-width: 120px; min-height: 52px; padding: 4px 8px 4px 4px; border: 2px dashed #a5b4fc; border-radius: 12px; background: #f8faff; }
.cs-slot > span { flex: none; width: 24px; height: 24px; border-radius: 50%; background: #4f46e5; color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.cs-slot.filled { border-style: solid; border-color: transparent; background: none; }
.cs-slot .cs-card { cursor: default; }
.cs-orderpool .cs-card { cursor: pointer; }
.num.cs { background: #eef2ff; color: #4338ca; }
.num.cs.done { background: var(--ok-soft); color: var(--ok); }

@media (max-width: 760px) {
  .cs-widget { padding: 12px 12px 14px; margin: 16px -6px; }
  .cs-arch { grid-template-columns: 1fr; grid-template-areas: "input" "a1" "cpu" "a3" "ram" "a4" "storage" "a2" "output"; }
  .cs-ar { transform: rotate(90deg); font-size: 22px; line-height: 1; }
  .cs-ar.on { transform: rotate(90deg) scale(1.25); }
  .cs-ar.v { transform: none; }
  .cs-ab { min-height: 0; flex-direction: row; padding: 8px 10px; }
  .cs-inside { grid-template-columns: 1fr; }
  .cs-bins { grid-template-columns: 1fr; }
  .cs-bin { min-height: 64px; }
  .cs-binc { flex-direction: row; flex-wrap: wrap; }
  .cs-binc .cs-card { font-size: 12px; }
  .cs-choices { grid-template-columns: 1fr; }
  .cs-choices.icons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-pyr { grid-template-columns: 48px 1fr 48px; }
  .cs-lvl { min-width: 0; font-size: 12px; }
  .cs-task.big { font-size: 19px; }
  .cs-q .cs-bigicon .cs-icon { width: 120px; height: 120px; }
  .cs-cap { grid-template-columns: repeat(20, 1fr); }
  .cs-atable button { width: 24px; height: 26px; font-size: 12px; }
}
.cs-photo { object-fit: contain; background: #fff; border-radius: 10px; }
.cs-gcard .cs-photo, .cs-pi .cs-photo { border: 1px solid var(--line); }
.cs-phgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.cs-phcell { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; padding: 12px 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.cs-phcell.has { border-color: #86efac; }
.cs-phimg { width: 120px; height: 120px; display: grid; place-items: center; background: #f8fafc; border-radius: 12px; overflow: hidden; }
.cs-phimg img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.cs-phcell b { font-size: 14px; line-height: 1.25; }
.cs-phcell .filebtn.small { font-size: 13px; padding: 5px 10px; }
.cs-phcell .filebtn.picked { border-color: var(--pri); background: var(--pri-soft); }
.cs-phsave { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 35%); text-align: right; }
.cs-phimg img.thumb { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; }
.cs-hn { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 14px; }
.cs-hgrid { display: grid; grid-template-columns: repeat(var(--c, 8), minmax(0, 1fr)); gap: 3px; max-width: 640px; }
.cs-hgrid span { text-align: center; font: 600 12px/26px ui-monospace, Menlo, Consolas, monospace; background: #e0e7ff; color: #3730a3; border-radius: 5px; transition: .25s; }
.cs-hgrid span.out { background: #f1f5f9; color: #cbd5e1; }
.cs-hq { margin-top: 12px; min-height: 36px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 16px; }
.cs-hbits { margin-top: 6px; font-size: 14px; min-height: 22px; }
.cs-hbits i { font-style: normal; padding: 0 2px; }
.cs-hbits i.b1 { color: #16a34a; }
.cs-hbits i.b0 { color: #dc2626; }
.cs-hcalc { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #c7d2fe; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cs-hcalc input { width: 90px; font-size: 17px; text-align: center; }
@media (max-width: 760px) { .cs-hgrid span { font-size: 10px; line-height: 22px; } }
.cs-binc .cs-card, .cs-slot .cs-card { pointer-events: none; }

/* ===== компьютерные сети ===== */
.cs-card.txt { padding: 8px 12px; }
.nt-tabs, .nt-n { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 14px; }
.nt-wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.nt-board { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.nt-svg { width: 100%; height: auto; display: block; }
.nt-wire { stroke: #64748b; stroke-width: 3; stroke-linecap: round; }
.nt-wire.bus { stroke: #1e293b; stroke-width: 6; }
.nt-wire.drop { stroke-width: 2.5; }
.nt-hit { stroke: transparent; stroke-width: 16; cursor: pointer; }
.nt-edge:hover .nt-wire { stroke: #f97316; }
.nt-edge.broken .nt-wire { stroke: #ef4444; stroke-dasharray: 6 6; }
.nt-node { cursor: pointer; }
.nt-pc.from rect:first-child { fill: #c7d2fe; stroke: #4f46e5; stroke-width: 3; }
.nt-pc.ok rect:first-child { fill: #bbf7d0; }
.nt-pc.bad rect:first-child { fill: #fecaca; }
.nt-sw.down rect:first-child { fill: #ef4444; }
.nt-info h4 { margin: 0 0 4px; }
.nt-pro, .nt-con { margin: 6px 0 0; font-size: 14px; }
.nt-status { margin-top: 10px; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.nt-status.ok { background: #f0fdf4; color: #15803d; }
.nt-status.bad { background: #fef2f2; color: #b91c1c; }
.nt-pic { display: flex; justify-content: center; margin: 4px 0 10px; }
.nt-pic .nt-svg { max-width: 460px; pointer-events: none; }
.nt-octs { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 4px; margin: 12px 0 8px; }
.nt-octs.dim { opacity: .35; }
.nt-oct { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.nt-oct > b { font: 700 24px/1 ui-monospace, Menlo, Consolas, monospace; }
.nt-oct small { color: var(--muted); font-size: 11px; }
.nt-dot { font: 700 26px/1 ui-monospace, monospace; padding-bottom: 26px; }
.nt-bits { display: flex; gap: 2px; }
.nt-bits button { width: 22px; height: 28px; border: 0; border-radius: 4px; font: 700 14px/1 ui-monospace, Menlo, Consolas, monospace; cursor: pointer; padding: 0; }
.nt-bits button.b1 { background: #4f46e5; color: #fff; }
.nt-bits button.b0 { background: #e2e8f0; color: #64748b; }
.nt-ipinfo { text-align: center; font-size: 15px; }
.nt-mform { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.nt-mform label { flex: 1 1 180px; }
.nt-mform input[type=range] { width: 100%; margin-top: 10px; }
.nt-tw { overflow-x: auto; margin-top: 10px; }
.nt-mt { border-collapse: collapse; font-size: 14px; }
.nt-mt th { text-align: left; padding: 5px 10px 5px 0; white-space: nowrap; color: var(--muted); font-weight: 600; }
.nt-mt td { padding: 5px 8px; white-space: nowrap; }
.nt-mt tr.res td, .nt-mt tr.res th { color: #15803d; font-weight: 700; }
.nt-mt tr.bc td.nt-dec { color: #b45309; }
.nt-dec { font-weight: 700; font-size: 15px; }
.nt-bin i, .nt-legend i { font-style: normal; padding: 0 1px; border-radius: 2px; }
.nt-bin i.n, .nt-legend i.n { background: #e0e7ff; }
.nt-bin i.h, .nt-legend i.h { background: #ffedd5; }
.nt-bin i.b1 { font-weight: 800; }
.nt-bin i.b0 { color: #94a3b8; }
.nt-sep { color: var(--muted); padding: 0 2px; }
.nt-legend { font-size: 13px; margin: 6px 0; }
.nt-bt { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.nt-bt th { text-align: left; padding: 2px 10px 2px 0; color: var(--muted); font-weight: 600; white-space: nowrap; }
.nt-bt td { padding: 2px 6px; }
.nt-bt td.mono i { font-style: normal; display: inline-block; width: 15px; text-align: center; }
.nt-bt td.mono i.b1 { color: #4338ca; font-weight: 800; }
.nt-bt td.mono i.b0 { color: #94a3b8; }
.nt-bt tr.res td, .nt-bt tr.res th { color: #15803d; font-weight: 700; border-top: 2px solid #86efac; }
.nt-find { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.nt-find label { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.nt-find input { width: auto; margin: 0; }
.nt-sform { display: flex; flex-wrap: wrap; gap: 10px; }
.nt-sform label { flex: 1 1 200px; font-weight: 600; font-size: 14px; padding: 8px; border-radius: 10px; border: 2px solid transparent; }
.nt-sform label.find { border-color: #a5b4fc; background: #eef2ff; }
.nt-sform label span { display: flex; gap: 6px; margin-top: 4px; }
.nt-sform input { min-width: 0; }
.nt-sform select { width: auto; }
.nt-pk { display: grid; grid-template-columns: 1fr 70px 1fr; gap: 10px; margin-top: 10px; }
.nt-pk h5 { margin: 0 0 6px; font-size: 14px; }
.nt-pcol { display: flex; flex-direction: column; gap: 5px; min-height: 60px; }
.nt-packet { display: flex; flex-direction: column; padding: 6px 9px; background: #fff; border: 1px solid #c7d2fe; border-left: 4px solid #6366f1; border-radius: 8px; font-size: 13px; }
.nt-packet small { color: var(--muted); font-size: 11px; }
.nt-packet.arrived { animation: ntIn .45s ease-out; border-left-color: #22c55e; }
@keyframes ntIn { from { opacity: 0; transform: translateX(-30px); } }
.nt-net { display: flex; flex-direction: column; justify-content: center; gap: 8px; align-items: center; }
.nt-net span { width: 44px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: #ccdffb; color: #0b57d0; font-weight: 800; font-size: 12px; border: 2px solid #5e96ea; transition: .2s; }
.nt-net span.on { background: #0b57d0; color: #fff; }
.nt-msg { margin-top: 10px; min-height: 22px; }
.nt-uparts { font: 600 18px/1.6 ui-monospace, Menlo, Consolas, monospace; word-break: break-all; margin: 10px 0; }
.u-p { background: #fce7f3; } .u-h { background: #dbeafe; } .u-d { background: #fef3c7; } .u-f { background: #dcfce7; }
.nt-uparts span { border-radius: 4px; padding: 1px 3px; }
.num.net { background: #e0f2fe; color: #0369a1; }
.num.net.done { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 760px) {
  .nt-wrap { grid-template-columns: 1fr; }
  .nt-pk { grid-template-columns: 1fr 50px 1fr; gap: 6px; }
  .nt-packet small { display: none; }
  .nt-bits button { width: 17px; height: 24px; font-size: 12px; }
  .nt-oct > b { font-size: 18px; }
}
.nt-bt { width: auto !important; } .nt-bt td:last-child { padding-left: 14px; font-weight: 700; }
@media (max-width: 760px) { .nt-octs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 6px; } .nt-dot { display: none; } }

/* ================= журнал: группы, посещаемость, оценки (v1.27) ================= */
.jr-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.jr-group { display: grid; gap: 8px; color: var(--ink); text-decoration: none !important; transition: border-color .15s, transform .12s; }
.jr-group:hover { border-color: #b6c5df; }
.jr-gh { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 18px; }
.jr-gs { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.jr-range { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; padding: 12px 16px; margin-bottom: 14px; }
.jr-range label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.jr-range input { width: auto; }
.jr-wrap { max-height: 75vh; overflow: auto; }
.jr-table { font-size: 14px; width: auto; min-width: 100%; }
.jr-table th, .jr-table td { padding: 8px 10px; }
.jr-table thead th { position: sticky; top: 0; z-index: 2; }
.jr-table .jr-who { position: sticky; left: 0; z-index: 1; background: var(--card); min-width: 190px; text-align: left; font-weight: 600; color: var(--ink); font-size: 14px; white-space: nowrap; }
.jr-table thead .jr-who { z-index: 3; background: #fafafb; color: var(--muted); font-size: 13px; }
.jr-table .jr-who .who { color: inherit; text-decoration: none; gap: 8px; }
.jr-n { color: var(--muted); width: 30px; text-align: center !important; }
.jr-day { text-align: center !important; padding: 6px 4px !important; }
.jr-day a { display: grid; color: var(--ink); font-weight: 700; line-height: 1.2; }
.jr-day small { color: var(--muted); font-weight: 500; }
.jr-cell, .jr-sum { text-align: center !important; }
.jr-sum { background: #fafafb; white-space: nowrap; }
.jr-gone .jr-who, .jr-gone { opacity: .7; }
.jr-red { color: var(--bad); }
.jr-c { display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 5px; border-radius: 7px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.jr-c.p { color: var(--ok); background: var(--ok-soft); }
.jr-c.a { color: var(--bad); background: var(--bad-soft); }
.jr-c.l { color: #b45309; background: #fef3c7; }
.jr-c.e { color: #4b5563; background: #eceff1; }
.jr-c.none { color: #c0c5ce; background: none; }
.jr-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 10px 2px; }
.jr-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.jr-last { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.jr-last .jr-c { min-width: 24px; height: 22px; font-size: 12px; }
/* состав группы */
.jr-mtools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.jr-mtools input[type=search] { flex: 1 1 220px; width: auto; }
.jr-mlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; max-height: 60vh; overflow: auto; padding: 2px; }
.jr-m { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px !important; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400 !important; }
.jr-m:has(input:checked) { border-color: var(--pri); background: var(--pri-soft); }
.jr-m input { width: 20px; height: 20px; flex: none; accent-color: var(--pri); }
.jr-m .grow { display: grid; min-width: 0; }
.jr-m .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-m[hidden] { display: none !important; }
.jr-free { margin: 0; font-weight: 400 !important; font-size: 14px; }
/* отметки на занятии */
.jr-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 2px 8px; }
.jr-rows { padding: 0; }
.jr-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto 110px minmax(140px, 1fr); gap: 10px 14px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.jr-row:last-child { border-bottom: 0; }
.jr-rwho { display: flex; align-items: center; gap: 10px; min-width: 0; }
.jr-rwho > span { min-width: 0; }
.jr-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fafafb; }
.jr-st { position: relative; cursor: pointer; margin: 0 !important; }
.jr-st input { position: absolute; opacity: 0; pointer-events: none; }
.jr-st span { display: block; padding: 8px 12px; font-size: 14px; font-weight: 700; color: var(--muted); border-left: 1px solid var(--line); white-space: nowrap; transition: background .12s, color .12s; }
.jr-st:first-child span { border-left: 0; }
.jr-st input:focus-visible + span { outline: 2px solid var(--pri); outline-offset: -2px; }
.jr-st.p input:checked + span { background: var(--ok); color: #fff; }
.jr-st.a input:checked + span { background: var(--bad); color: #fff; }
.jr-st.l input:checked + span { background: #d97706; color: #fff; }
.jr-st.e input:checked + span { background: #6b7280; color: #fff; }
.jr-grade, .jr-cm { margin: 0; width: 100%; min-height: 40px; }
.jr-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 35%); }
@media (max-width: 820px) {
  .jr-row { grid-template-columns: 1fr 96px; padding: 12px; }
  .jr-rwho { grid-column: 1 / -1; }
  .jr-seg { width: 100%; }
  .jr-st { flex: 1; }
  .jr-st span { padding: 10px 4px; text-align: center; }
  .jr-cm { grid-column: 1 / -1; }
  .jr-row .jr-seg { grid-column: 1; }
  .has-tabbar .jr-savebar { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .jr-savebar .btn { flex: 1; }
  .jr-table .jr-who { min-width: 140px; }
  .jr-table .jr-who .avatar { display: none; }
}

/* ================= телефон: без подвала (v1.27) ================= */
@media (max-width: 820px) {
  .site-footer { display: none; }
  .has-tabbar main.wrap { padding-bottom: 24px; }
  .tb-ic { width: min(56px, 100%); }
}
.jr-range { margin-top: 12px; }
@media (max-width: 820px) {
  .jr-range { display: grid; grid-template-columns: 1fr 1fr; padding: 10px 12px; }
  .jr-range input { width: 100%; min-width: 0; }
  .jr-range .btn { grid-column: span 1; }
  .tabbar:has(a:nth-child(7)) .tb-t { font-size: 10px; letter-spacing: -.2px; }
  .tabbar:has(a:nth-child(7)) .tb-ic { width: min(48px, 100%); }
}
@media (max-width: 820px) {
  .jr-range { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .jr-range label { min-width: 0; }
  .jr-range input[type=date] { min-width: 0; max-width: 100%; padding-left: 8px; padding-right: 6px; }
  .jr-row { grid-template-columns: 1fr 112px; }
}

/* ================= бренд: логотип и заставка (v1.28) ================= */
.mark.has-img { background: #fff; padding: 3px; overflow: hidden; }
.mark.has-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-logo { display: block; width: fit-content; text-align: center; margin: 0 auto 14px; }
.auth-logo img { width: min(220px, 60vw); height: auto; }

.splash { display: none; }
.sp-on body { overflow: hidden; }
.sp-on .splash {
  display: flex; position: fixed; inset: 0; z-index: 9999; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; cursor: pointer; -webkit-user-select: none; user-select: none;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
.sp-glow { position: absolute; left: 50%; top: 46%; width: 150vmax; height: 150vmax; margin: -75vmax 0 0 -75vmax; pointer-events: none; opacity: 0;
  background: radial-gradient(circle closest-side, rgba(37, 132, 255, .16), rgba(41, 200, 250, .07) 35%, rgba(255, 255, 255, 0) 70%); }
.sp-on .splash { overflow: hidden; }
.sp-logo { position: relative; display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2.4vh, 22px); }
.sp-emblem { position: relative; width: min(150px, 34vw); aspect-ratio: 320 / 330; }
.sp-word { position: relative; width: min(360px, 74vw); aspect-ratio: 760 / 158; }
.sp-emblem img, .sp-word img { position: absolute; inset: 0; width: 100%; height: 100%; }
.sp-tag { width: min(240px, 50vw); height: auto; }
.sp-shine { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  -webkit-mask: url(/brand/m.png) center / 100% 100% no-repeat; mask: url(/brand/m.png) center / 100% 100% no-repeat;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .85) 48%, transparent 66%) -150% 0 / 250% 100% no-repeat; }
.sp-bar { position: absolute; left: 50%; bottom: calc(48px + env(safe-area-inset-bottom)); width: min(180px, 46vw); height: 4px; margin-left: calc(min(180px, 46vw) / -2);
  border-radius: 99px; background: #e8eef7; overflow: hidden; }
.sp-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #0b5ced, #2bc4f5); }
/* исходное состояние — пока картинки не загрузились */
.sp-m, .sp-cap, .sp-my, .sp-qty, .sp-tag { opacity: 0; }

.sp-go .sp-glow { animation: sp-glow 3.4s ease-out forwards; }
.sp-go .sp-m { animation: sp-m .8s cubic-bezier(.2, .9, .3, 1.25) forwards; }
.sp-go .sp-cap { animation: sp-cap 1s cubic-bezier(.3, .7, .3, 1) .5s forwards; transform-origin: 70% 30%; }
.sp-go .sp-shine { animation: sp-shine 1s ease-in-out 1.5s forwards; }
.sp-go .sp-my { animation: sp-left .65s cubic-bezier(.2, .8, .3, 1) 1s forwards; }
.sp-go .sp-qty { animation: sp-right .65s cubic-bezier(.2, .8, .3, 1) 1.15s forwards; }
.sp-go .sp-tag { animation: sp-type .8s steps(14, end) 1.85s forwards; }
.sp-go .sp-logo { animation: sp-breathe 1.2s ease-in-out 2.5s; }
.sp-go .sp-bar i { animation: sp-bar 3.2s cubic-bezier(.4, 0, .2, 1) forwards; }
.splash.sp-out { animation: sp-out .6s ease forwards; pointer-events: none; }
.splash.sp-out .sp-logo { animation: sp-zoom .6s ease forwards; }

@keyframes sp-glow { 0% { opacity: 0; transform: scale(.3); } 40% { opacity: 1; } 100% { opacity: 1; transform: scale(.75); } }
@keyframes sp-m { 0% { opacity: 0; transform: scale(.35) rotate(-10deg); filter: blur(8px); } 60% { opacity: 1; filter: blur(0); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes sp-cap {
  0% { opacity: 0; transform: translateY(-120%) rotate(-35deg); }
  45% { opacity: 1; transform: translateY(4%) rotate(6deg); }
  62% { transform: translateY(-3%) rotate(-4deg); }
  78% { transform: translateY(0) rotate(2deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes sp-shine { 0% { opacity: 1; background-position: -150% 0; } 100% { opacity: 1; background-position: 150% 0; } }
@keyframes sp-left { 0% { opacity: 0; transform: translateX(-24%); filter: blur(4px); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes sp-right { 0% { opacity: 0; transform: translateX(24%); filter: blur(4px); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes sp-type { 0% { opacity: 1; clip-path: inset(0 100% 0 0); } 100% { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes sp-breathe { 50% { transform: scale(1.035); } }
@keyframes sp-bar { to { width: 100%; } }
@keyframes sp-out { to { opacity: 0; visibility: hidden; } }
@keyframes sp-zoom { to { transform: scale(1.12); filter: blur(6px); } }
@media (prefers-reduced-motion: reduce) {
  .sp-go .sp-m, .sp-go .sp-cap, .sp-go .sp-my, .sp-go .sp-qty, .sp-go .sp-tag { animation: sp-fade .5s ease forwards; }
  .sp-go .sp-shine, .sp-go .sp-logo, .splash.sp-out .sp-logo { animation: none; }
  .sp-go .sp-bar i { animation-duration: 1.4s; }
}
@keyframes sp-fade { to { opacity: 1; } }

/* ================= цвета бренда MYQTY (v1.30) ================= */
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, #0b57d0, #1a8cf0 55%, #2bc4f5); pointer-events: none; }
.site-footer { background: #0a1838; }
