/* ===== Учимся дома — оформление ===== */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --line: #e2e7ef;
  --primary: #4f7cff;
  --primary-dark: #3a63db;
  --ok: #2f9e44;
  --ok-bg: #ebfbee;
  --bad: #e03131;
  --bad-bg: #fff0f0;
  --warn: #f08c00;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(30, 50, 90, .07);
  font-size: 17px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; line-height: 1.25; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.08rem; }
code, .mono, textarea.mono { font-family: "JetBrains Mono", Consolas, "Courier New", monospace; }
code { background: #eef1f7; padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.red { color: #e03131; font-weight: 700; }
mark { background: #fff3a3; padding: 0 2px; border-radius: 3px; }

/* ----- Шапка ----- */
.site-header {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--card); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20;
}
.logo { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--text); white-space: nowrap; }
.top-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top-nav a { padding: 7px 12px; border-radius: 10px; text-decoration: none; color: var(--text); white-space: nowrap; }
.top-nav a:hover { background: var(--bg); }
.top-nav a.active { background: #e7edff; color: var(--primary-dark); font-weight: 700; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: var(--bg); border-radius: 30px; padding: 4px 14px 4px 4px; cursor: pointer; font: inherit; }
.user-avatar { font-size: 1.5rem; width: 36px; height: 36px; display: grid; place-items: center; background: #fff; border-radius: 50%; }
.site-main { max-width: 1060px; margin: 0 auto; padding: 18px 20px 80px; }
@media (max-width: 640px) {
  :root { font-size: 16px; }
  .site-header { padding: 8px 12px; gap: 8px; }
  .user-name { display: none; }
  .user-btn { padding: 4px; }
  .site-main { padding: 12px 12px 60px; }
  .top-nav a { padding: 6px 8px; font-size: .9rem; }
}

/* ----- Кнопки ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 11px; border: 0; background: var(--primary); color: #fff;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: #e9eef8; color: var(--text); }
.btn-ghost:hover { background: #dbe3f2; }
.btn-danger { background: #fff0f0; color: var(--bad); }
.btn-danger:hover { background: #ffe0e0; }
.btn-success { background: var(--ok); }
.btn-success:hover { background: #237a35; }
.btn-run { background: #12b886; }
.btn-run:hover { background: #0c9a70; }
.btn-big { padding: 14px 28px; font-size: 1.1rem; border-radius: 14px; }
.btn-small { padding: 5px 11px; font-size: .85rem; border-radius: 9px; }
.btn-icon { border: 0; background: transparent; cursor: pointer; font-size: .95rem; padding: 4px 8px; border-radius: 8px; color: var(--muted); }
.btn-icon:hover:not(:disabled) { background: #eef1f7; color: var(--text); }
.btn-icon:disabled { opacity: .25; cursor: default; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 13px; font: inherit; font-size: .88rem; cursor: pointer; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-warn { border-color: #ffc078; }
.chip-warn.active { background: var(--warn); border-color: var(--warn); }

/* ----- Карточки и общие блоки ----- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); font-size: 1.1rem; }
.notice { background: #fff9db; border: 1px solid #ffe066; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; }
.notice.ok { background: var(--ok-bg); border-color: #b2f2bb; }
.notice.bad { background: var(--bad-bg); border-color: #ffc9c9; }
.crumbs { margin-bottom: 6px; }
.crumbs a { text-decoration: none; font-weight: 600; }
.section-title { margin: 28px 0 12px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #e7edff; color: var(--primary-dark); margin-left: 8px; vertical-align: middle; }
.badge-muted { background: #eceff3; color: var(--muted); }
.badge-course { background: #f3e8ff; color: #7048e8; }
.hint { color: var(--muted); font-size: .88rem; margin-bottom: 8px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Главная ----- */
.hello { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.hello h1 { margin: 0; }
.hello p { margin: 2px 0 0; }
.hello-avatar { font-size: 3rem; width: 74px; height: 74px; display: grid; place-items: center; background: #fff; border-radius: 50%; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.disc-card { display: block; text-decoration: none; color: inherit; border-top: 6px solid var(--accent, var(--primary)); transition: transform .15s, box-shadow .15s; margin: 0; }
.disc-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(30, 50, 90, .12); }
.disc-icon { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.disc-icon.big { font-size: 3.4rem; margin: 0; }
.disc-icon.small { font-size: 1.5rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; margin: 0; }
.disc-title { font-weight: 800; font-size: 1.2rem; }
.disc-desc { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.disc-meta { color: var(--muted); font-size: .82rem; margin-top: 6px; }
.disc-header { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.disc-header h1 { margin: 0; }
.progress { height: 8px; background: #e9edf5; border-radius: 6px; overflow: hidden; margin-top: 12px; flex: 1; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #51cf66, #20c997); border-radius: 6px; transition: width .3s; }

/* ----- Список тем ----- */
.topic-list { display: flex; flex-direction: column; gap: 10px; }
.topic-item { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; text-decoration: none; color: inherit; transition: transform .1s; }
.topic-item:hover { transform: translateX(3px); }
.topic-main { flex: 1; min-width: 0; }
.topic-title { font-weight: 700; font-size: 1.05rem; }
.topic-side { display: flex; align-items: center; gap: 12px; }
.mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 800; color: #fff; font-size: 1.05rem; }
.mark-5 { background: #2f9e44; } .mark-4 { background: #66a80f; } .mark-3 { background: #f08c00; } .mark-2 { background: #e03131; }

/* ----- Курс ----- */
.course-path { display: flex; flex-direction: column; gap: 14px; position: relative; padding-left: 8px; }
.chapter { display: flex; gap: 16px; align-items: center; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 16px 20px; text-decoration: none; color: inherit; border: 2px solid transparent; transition: transform .12s; }
.chapter:hover { transform: scale(1.01); border-color: #d0bfff; }
.chapter.done { border-color: #b2f2bb; }
.chapter.locked { opacity: .55; }
.chapter-num { width: 52px; height: 52px; flex: none; border-radius: 50%; background: linear-gradient(135deg, #845ef7, #5c7cfa); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; }
.chapter.done .chapter-num { background: linear-gradient(135deg, #ffd43b, #fab005); }
.chapter.locked .chapter-num { background: #ced4da; }
.chapter-title { font-weight: 800; font-size: 1.08rem; }

/* ----- Тема: вкладки, теория ----- */
.topic-h1 { margin-bottom: 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tab { padding: 9px 18px; text-decoration: none; color: var(--muted); font-weight: 700; border-radius: 10px 10px 0 0; margin-bottom: -2px; border-bottom: 3px solid transparent; }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); background: #fff; }
.theory { font-size: 1.05rem; }
.md img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 10px auto; }
.md table { border-collapse: collapse; margin: 12px 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 12px; }
.md th { background: #f1f4fa; }
.md blockquote { margin: 14px 0; padding: 12px 18px; background: #fff9db; border-left: 5px solid #fcc419; border-radius: 0 12px 12px 0; }
.md blockquote p { margin: 4px 0; }
.md details { background: #f1f4fa; border-radius: 10px; padding: 8px 14px; margin: 10px 0; }
.md summary { cursor: pointer; font-weight: 700; color: var(--primary-dark); }
.md h2 { margin-top: 1.4em; }
.md p:first-child { margin-top: 0; }
.md pre { background: #1e2433; color: #e9edf5; padding: 12px 16px; border-radius: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; color: inherit; }
.say { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; }
.say-who { flex: none; width: 74px; text-align: center; font-size: .78rem; font-weight: 700; color: #7048e8; }
.say-icon { display: block; font-size: 2.4rem; line-height: 1.1; }
.say-text { position: relative; background: #f3f0ff; border-radius: 16px; padding: 10px 16px; flex: 1; }
.say-text::before { content: ""; position: absolute; left: -9px; top: 16px; border: 9px solid transparent; border-left: 0; border-right-color: #f3f0ff; }
.say-text p { margin: 4px 0; }

/* ----- Выбор заданий ----- */
.quick-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.task-pick { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.task-pick-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.task-pick-item:hover { background: var(--bg); }
.task-pick-num { width: 26px; height: 26px; flex: none; border-radius: 50%; background: #e9eef8; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.task-pick-icon { flex: none; }
.task-pick-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level { font-size: .72rem; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.level-1 { background: #ebfbee; color: #2b8a3e; } .level-2 { background: #fff4e6; color: #d9480f; } .level-3 { background: #fff0f6; color: #c2255c; }
.last { width: 18px; font-weight: 800; text-align: center; }
.last.ok { color: var(--ok); } .last.bad { color: var(--bad); }
.pick-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }

/* ----- Решение ----- */
.test-progress { display: flex; gap: 14px; align-items: center; position: sticky; top: 62px; z-index: 5; background: var(--bg); padding: 8px 0; font-size: .88rem; color: var(--muted); }
.test-progress .progress { margin: 0; }
.task-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px; margin-bottom: 18px; border-left: 5px solid #dee2e6; transition: border-color .2s; }
.task-card.answered { border-left-color: #74c0fc; }
.task-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.task-num { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; }
.task-q { font-size: 1.08rem; margin-bottom: 12px; }
.submit-row { margin-top: 26px; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.option:hover { border-color: #a5b8ff; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-mark { width: 22px; height: 22px; flex: none; border: 2px solid #adb5bd; border-radius: 50%; display: grid; place-items: center; }
.option-mark-box { border-radius: 6px; }
.option:has(input:checked) { border-color: var(--primary); background: #f0f4ff; }
.option input:checked + .option-mark { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px #fff; }
.option input:checked + .option-mark-box { box-shadow: none; }
.option input:checked + .option-mark-box::after { content: "✓"; color: #fff; font-weight: 800; font-size: .85rem; }
.option input:focus-visible + .option-mark { outline: 3px solid #a5b8ff; }
.answer-input { width: 100%; max-width: 420px; font-size: 1.15rem; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; }
.answer-input:focus { border-color: var(--primary); outline: none; }

/* выделение букв/слов */
.palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.brush { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 13px; font: inherit; font-size: .9rem; cursor: pointer; }
.brush.active { border-color: var(--cat, var(--text)); background: color-mix(in srgb, var(--cat, #888) 14%, white); font-weight: 700; }
.brush-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--cat, #ccc); display: inline-block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; margin-bottom: 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.hl { background: #fafbfe; border: 1px dashed var(--line); border-radius: 12px; padding: 22px 14px 14px; user-select: none; -webkit-user-select: none; }
.hl-letters .hl-tokens { font-size: 2.1rem; letter-spacing: 1px; touch-action: none; font-weight: 600; }
.hl-words .hl-tokens { font-size: 1.2rem; line-height: 2.2; }
.tk { position: relative; white-space: pre-wrap; }
.tk-c { cursor: pointer; border-radius: 4px; padding: 0 1px; transition: background .1s; }
.hl-letters .tk-c { display: inline-block; min-width: .6em; text-align: center; padding: 0 2px; }
.tk-c:hover { background: #eef1f7; }
.tk-on { background: color-mix(in srgb, var(--cat) 20%, white); color: color-mix(in srgb, var(--cat) 75%, black); }
.tk-on:hover { background: color-mix(in srgb, var(--cat) 30%, white); }
.hl-words .tk-on { border-bottom: 3px solid var(--cat); }
.tk-wrong { outline: 2px dashed var(--bad); outline-offset: 1px; }
/* значки морфем (школьная разметка) */
.hl-letters .st-prefix { border-top: 3px solid var(--cat); border-radius: 0; }
.hl-letters .st-prefix.g-end { border-right: 3px solid var(--cat); }
.hl-letters .st-root { border-top: 3px solid var(--cat); border-radius: 0; }
.hl-letters .st-root.g-start { border-left: 3px solid var(--cat); border-top-left-radius: 70% 100%; }
.hl-letters .st-root.g-end { border-right: 3px solid var(--cat); border-top-right-radius: 70% 100%; }
.hl-letters .st-suffix.g-mid::before { content: "^"; position: absolute; left: 0; right: 0; top: -.95em; font-size: .9em; text-align: center; color: var(--cat); font-weight: 800; line-height: 1; }
.hl-letters .st-ending { border-top: 3px solid var(--cat); border-bottom: 3px solid var(--cat); border-radius: 0; }
.hl-letters .st-ending.g-start { border-left: 3px solid var(--cat); }
.hl-letters .st-ending.g-end { border-right: 3px solid var(--cat); }

/* порядок, пары */
.order-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.order-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
.order-num { width: 26px; height: 26px; border-radius: 50%; background: #e7edff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.order-text { flex: 1; }
.order-btns { display: flex; gap: 2px; flex: none; }
.order-btns .btn-icon { font-size: 1.1rem; padding: 6px 10px; background: #f1f4fa; }
.match { display: flex; flex-direction: column; gap: 10px; }
.match-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px; border-radius: 10px; }
.match-left { font-weight: 700; min-width: 140px; }
.match-arrow { color: var(--muted); }
.match-select { font: inherit; padding: 7px 10px; border: 2px solid var(--line); border-radius: 10px; min-width: 180px; max-width: 100%; }

/* код */
.code-editor { width: 100%; font-family: "JetBrains Mono", Consolas, monospace; font-size: .95rem; background: #1e2433; color: #e9edf5; border: 0; border-radius: 12px; padding: 14px; line-height: 1.5; tab-size: 4; resize: vertical; caret-color: #ffd43b; }
.code-actions { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.code-status { font-weight: 700; min-height: 1.4em; }
.code-status.ok { color: var(--ok); } .code-status.bad { color: var(--bad); }
.code-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
@media (max-width: 640px) { .code-cols { grid-template-columns: 1fr; } }
.code-label { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.code-out { background: #f1f3f8; border-radius: 10px; padding: 10px 12px; min-height: 48px; margin: 0; white-space: pre-wrap; word-break: break-word; font-family: "JetBrains Mono", Consolas, monospace; font-size: .9rem; }
.code-out.has-error { background: var(--bad-bg); }
.code-expected { background: var(--ok-bg); }
.code-src { background: #1e2433; color: #e9edf5; }
.code-io pre { background: #f1f3f8; padding: 8px 12px; border-radius: 8px; margin: 4px 0 10px; }

/* робот */
.robot-field-wrap { overflow-x: auto; }
.robot-grid { display: inline-grid; gap: 3px; background: #c5d3e8; padding: 3px; border-radius: 12px; margin: 6px 0 12px; }
.robot-cell { aspect-ratio: 1; background: #fff; border-radius: 6px; display: grid; place-items: center; font-size: clamp(1.1rem, 4.5vw, 1.9rem); min-width: 30px; }
.robot-cell.wall { background: #e9d8c8; }
.robot-cell.crash { background: #ffc9c9; }
.robot-grid.editable .robot-cell { cursor: pointer; }
.robot-grid.editable .robot-cell:hover { outline: 3px solid var(--primary); }
.robot-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.robot-arrows { display: flex; gap: 6px; }
.btn-arrow { font-size: 1.7rem; width: 56px; height: 56px; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; }
.btn-arrow:hover { border-color: var(--primary); background: #f0f4ff; }
.btn-arrow:active { transform: scale(.94); }
.robot-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.robot-program { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 48px; padding: 8px; background: #f8f9fc; border-radius: 12px; margin-top: 12px; }
.robot-cmd { font-size: 1.4rem; padding: 2px; border-radius: 8px; }
.robot-cmd.active { background: #ffe066; }
.robot-count { margin-left: auto; color: var(--muted); font-size: .82rem; }
.robot-msg { font-weight: 700; margin-top: 10px; min-height: 1.4em; }
.robot-msg.ok { color: var(--ok); } .robot-msg.bad { color: var(--bad); }

/* ----- Результат ----- */
.result-hero { display: flex; gap: 22px; align-items: center; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 24px; margin-bottom: 18px; border-left: 10px solid #adb5bd; }
.result-hero.mark-5 { border-color: #2f9e44; background: linear-gradient(90deg, #ebfbee, #fff 60%); }
.result-hero.mark-4 { border-color: #66a80f; background: linear-gradient(90deg, #f4fce3, #fff 60%); }
.result-hero.mark-3 { border-color: #f08c00; background: linear-gradient(90deg, #fff4e6, #fff 60%); }
.result-hero.mark-2 { border-color: #e03131; background: linear-gradient(90deg, #fff0f0, #fff 60%); }
.result-mark { font-size: 4rem; font-weight: 900; width: 100px; height: 100px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; background: #adb5bd; }
.mark-5 .result-mark { background: #2f9e44; } .mark-4 .result-mark { background: #66a80f; } .mark-3 .result-mark { background: #f08c00; } .mark-2 .result-mark { background: #e03131; }
.result-title { font-size: 1.4rem; font-weight: 800; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.review-list { display: flex; flex-direction: column; gap: 14px; }
.review-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; border-left: 6px solid; }
.review-card.is-correct { border-color: var(--ok); }
.review-card.is-wrong { border-color: var(--bad); }
.review-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: .9rem; }
.review-num { font-weight: 800; }
.review-type { color: var(--muted); }
.review-status { margin-left: auto; font-weight: 800; }
.is-correct .review-status { color: var(--ok); } .is-wrong .review-status { color: var(--bad); }
.review .option { cursor: default; }
.opt-right { border-color: #8ce99a !important; background: var(--ok-bg); }
.opt-wrong { border-color: #ffa8a8 !important; background: var(--bad-bg); }
.opt-icon { width: 22px; text-align: center; flex: none; }
.opt-note { margin-left: auto; font-size: .8rem; color: var(--muted); }
.review-label { font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
.review-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .review-cols { grid-template-columns: 1fr; } .result-hero { flex-direction: column; text-align: center; } }
.txt-ok { color: var(--ok); } .txt-bad { color: var(--bad); }
.explain { background: #fff9db; border-radius: 12px; padding: 10px 16px; margin-top: 12px; }
.explain-title { font-weight: 800; margin-bottom: 4px; }
.explain-more { margin-top: 10px; color: var(--muted); }
.explain-more summary { cursor: pointer; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ----- История ----- */
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 22px; display: flex; flex-direction: column; min-width: 140px; }
.stat b { font-size: 1.8rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f8f9fd; }
.big-emoji { font-size: 1.6rem; }

/* ----- Вход ----- */
.login-page { max-width: 460px; margin: 4vh auto; }
.login-title { text-align: center; }
.logo-big { font-size: 4rem; }
.profiles { text-align: center; margin-bottom: 16px; }
.profile-list { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.profile { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--card); border: 3px solid transparent; border-radius: 18px; padding: 14px 22px; cursor: pointer; font: inherit; font-weight: 700; box-shadow: var(--shadow); }
.profile:hover { border-color: var(--primary); }
.login-avatar { font-size: 3rem; line-height: 1.1; }
.login-card h1 { margin-top: 0; }
.login-card .btn { width: 100%; margin-top: 8px; }
.login-chosen { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; }
.login-who { margin-bottom: 10px; }
.setup-card { max-width: 540px; }

/* ----- Формы ----- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: .88rem; color: var(--muted); font-weight: 600; }
.field-title { font-weight: 800 !important; color: var(--text) !important; font-size: 1rem !important; }
input[type=text], input[type=password], input[type=number], select, textarea {
  font: inherit; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; width: 100%; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; }
.input-short { width: 110px !important; }
input[type=color] { width: 60px; height: 40px; border: 2px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; }
.check { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.row-fields { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.row-fields > .field { min-width: 140px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--card); padding: 12px 0; border-top: 1px solid var(--line); z-index: 4; }
.sub { background: #f8f9fc; border-radius: 12px; padding: 12px 16px; margin: 10px 0; }
.sub summary { cursor: pointer; font-weight: 700; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.emoji-btn { font-size: 1.35rem; border: 0; background: transparent; cursor: pointer; border-radius: 8px; padding: 2px 5px; }
.emoji-btn:hover { background: #eef1f7; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; }
.filters select { width: auto; }
ul.errors li { color: var(--bad); margin-bottom: 6px; }
.token { word-break: break-all; font-size: .95rem; }

/* ----- Админка ----- */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; background: var(--card); padding: 6px; border-radius: 14px; box-shadow: var(--shadow); }
.admin-nav a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--text); font-size: .93rem; white-space: nowrap; }
.admin-nav a:hover { background: var(--bg); }
.admin-nav a.active { background: var(--primary); color: #fff; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 10px; }
.admin-head h1, .admin-head h2 { margin: 0; }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-list-item { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 6px 12px 6px 6px; }
.admin-list-item .order-btns { flex-direction: column; }
.admin-list-item .order-btns .btn-icon { padding: 1px 8px; font-size: .75rem; background: none; }
.admin-item-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-decoration: none; color: inherit; padding: 6px; }
.chev { font-size: 1.6rem; color: #adb5bd; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.type-choice { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 2px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; }
.type-choice:hover { border-color: var(--primary); background: #f5f8ff; }
.type-icon { font-size: 1.8rem; }
.type-banner { display: flex; gap: 12px; align-items: center; background: #f5f8ff; border-radius: 12px; padding: 10px 14px; margin-bottom: 18px; }
.choices, .pairs, .cat-list { display: flex; flex-direction: column; gap: 8px; }
.choice-row, .pair-row, .cat-row { display: flex; gap: 8px; align-items: center; }
.choice-correct { display: flex; flex-direction: column; align-items: center; cursor: pointer; flex: none; width: 52px; }
.choice-correct input { width: 20px; height: 20px; }
.cat-row input[type=text] { max-width: 260px; }
.help-layout { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.help-nav { display: flex; flex-direction: column; gap: 2px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; position: sticky; top: 74px; }
.help-nav a { padding: 8px 12px; border-radius: 9px; text-decoration: none; color: var(--text); font-size: .92rem; }
.help-nav a.active { background: #e7edff; font-weight: 700; color: var(--primary-dark); }
.help { min-width: 0; }
@media (max-width: 800px) { .help-layout { grid-template-columns: 1fr; } .help-nav { position: static; } }

/* редактор текста */
.rich { border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px; background: #f6f8fc; border-bottom: 1px solid var(--line); }
.tb-btn { border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 4px 9px; cursor: pointer; font: inherit; font-size: .85rem; }
.tb-btn:hover { background: #fff; border-color: var(--line); }
.rich-cols { display: grid; grid-template-columns: 1fr 1fr; }
.rich-col { min-width: 0; }
.rich-label { font-size: .75rem; color: var(--muted); padding: 6px 12px 0; text-transform: uppercase; letter-spacing: .4px; }
.rich-text { border: 0 !important; border-radius: 0 !important; font-family: "JetBrains Mono", Consolas, monospace; font-size: .9rem; min-height: 100%; }
.rich-preview { padding: 8px 14px 14px; border-left: 1px solid var(--line); overflow: auto; max-height: 640px; }
@media (max-width: 800px) { .rich-cols { grid-template-columns: 1fr; } .rich-preview { border-left: 0; border-top: 1px solid var(--line); } }

/* ----- Модальные окна и уведомления ----- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 30, 50, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 100; overflow-y: auto; }
.modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px 20px 22px; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; width: min(92vw, 520px); }
.toast { background: #1f2933; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); transition: opacity .5s, transform .5s; }
.toast-error { background: #c92a2a; }
.toast.hide { opacity: 0; transform: translateY(10px); }
.choices > .btn, .pairs > .btn, .cat-list > .btn { align-self: flex-start; }
