/* Тёмная тема «игровой прогресс» мини-приложения МЦКО */
:root {
  --bg: #14161e;
  --bg2: #191c26;
  --card: #1f2330;
  --card2: #282d3d;
  --line: #343a4d;
  --text: #e4e6ee;
  --muted: #9399ad;
  --accent: #8c93cf;
  --accent-2: #6d76b4;
  --accent-soft: rgba(140, 147, 207, .16);
  --good: #6fbf9b;
  --bad: #d9808c;
  --bad-soft: rgba(217, 128, 140, .14);
  --warn: #d9b36a;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(0, 0, 0, .22);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select { font: inherit; color: var(--text); }

#app { max-width: 640px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  background: rgba(20, 22, 30, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(140, 147, 207, .08);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; font-weight: 800; color: #fff;
  background: #a9aedd;
  box-shadow: 0 6px 18px rgba(140, 147, 207, .35);
}
.brand-title { font-weight: 800; letter-spacing: .2px; }
.brand-sub { color: var(--muted); font-size: 12.5px; }
.grade-pill {
  padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(140, 147, 207, .3);
}

.view { flex: 1; padding: 14px 16px calc(96px + var(--safe-bottom)); }

/* ---------- нижние вкладки ---------- */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 6;
  width: 100%; max-width: 640px;
  display: flex; justify-content: space-around;
  padding: 8px 6px calc(8px + var(--safe-bottom));
  background: rgba(25, 28, 38, .94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 12px; color: var(--muted); font-size: 11.5px; font-weight: 600;
}
.tabs button i { font-style: normal; font-size: 20px; filter: grayscale(.4); transition: transform .15s; }
.tabs button.active { color: var(--accent); background: var(--accent-soft); }
.tabs button.active i { filter: none; transform: translateY(-1px); }
.badge {
  position: absolute; top: 2px; right: calc(50% - 22px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; font-weight: 800;
}

/* ---------- общие блоки ---------- */
h1 { font-size: 22px; margin: 4px 0 4px; font-weight: 800; }
h2 { font-size: 17px; margin: 18px 0 10px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.card.tap { transition: transform .12s, border-color .12s; }
.card.tap:active { transform: scale(.985); border-color: rgba(140, 147, 207, .45); }

.hero {
  position: relative; overflow: hidden;
  background: #2c3150;
  border: 1px solid rgba(140, 147, 207, .25); border-radius: 22px; padding: 18px;
}
.hero::after {
  content: "π  √  x²  ∑  %  ∞"; position: absolute; right: -8px; bottom: -6px;
  font-size: 34px; font-weight: 800; letter-spacing: 6px; color: rgba(169, 174, 221, .08); white-space: nowrap;
}
.hero .big { font-size: 28px; font-weight: 800; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 9px 14px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 14px; font-weight: 800;
  background: #8c93cf; color: #fff;
  box-shadow: none;
}
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card2); color: var(--text); box-shadow: none; border: 1px solid var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); box-shadow: none; border: 1px solid rgba(217, 128, 140, .35); }
.btn.sm { padding: 8px 12px; border-radius: 11px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.topic { display: flex; align-items: center; gap: 12px; }
.topic .ico {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center; font-size: 22px;
  background: var(--card2); border: 1px solid var(--line);
}
.topic .name { font-weight: 700; }
.topic .actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- задача ---------- */
.task-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.cur { background: var(--warn); }
.dots i.ok { background: var(--good); }
.dots i.no { background: var(--bad); }
.task-text { font-size: 17px; line-height: 1.55; font-weight: 600; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.opt {
  padding: 14px 10px; border-radius: 14px; font-weight: 800; font-size: 17px; text-align: center;
  background: var(--card2); border: 1.5px solid var(--line);
}
.opt:active { border-color: var(--accent); }
.opt.right { background: var(--accent-soft); border-color: var(--good); color: var(--good); }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.answer-row { display: flex; gap: 8px; margin-top: 14px; }
.sign-keys { display: flex; gap: 8px; margin-top: 8px; }
.sign-keys .btn { flex: 1; }
.sign-keys b { font-size: 18px; line-height: 1; }
.sign-keys [data-sign="frac"] b { font-size: 13px; }
.sign-keys .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
/* поле дроби столбиком */
.ans-field { flex: 1; min-width: 0; display: flex; }
.ans-field > .input { flex: 1; }
.answer-row.frac { align-items: center; }
.frac-edit { display: flex; align-items: center; gap: 8px; min-width: 0; }
.frac-edit[hidden], .frac-minus[hidden] { display: none; }
.frac-minus { font-size: 28px; font-weight: 800; line-height: 1; }
.frac-stack { display: flex; flex-direction: column; gap: 6px; flex: 0 1 88px; min-width: 60px; }
.frac-stack > i { height: 3px; border-radius: 2px; background: var(--text); }
.input.fx { flex: none; width: 100%; padding: 9px 6px; text-align: center; }
.frac-edit > .input.fx.whole { flex: 0 1 60px; width: auto; min-width: 42px; }
.frac-ico { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.frac-ico i { display: block; width: 9px; height: 6px; border: 1.5px solid currentColor; border-radius: 2px; }
.frac-ico i.bar { width: 13px; height: 0; border-width: 1.5px 0 0; border-radius: 0; }
/* дробь столбиком в ответах */
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.15; font-size: .9em; margin: 0 1px; }
.fr > span { padding: 0 3px; }
.fr > span + span { border-top: 1.5px solid currentColor; padding-top: 1px; }
.input {
  flex: 1; min-width: 0; padding: 13px 14px; border-radius: 14px; font-size: 17px; font-weight: 700;
  background: var(--bg2); border: 1.5px solid var(--line); outline: none;
}
.input:focus { border-color: var(--accent); }
.verdict { margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-weight: 800; }
.verdict.ok { background: var(--accent-soft); color: var(--good); }
.verdict.no { background: var(--bad-soft); color: var(--bad); }
.solution {
  margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--bg2);
  border: 1px dashed var(--line); font-size: 14.5px; color: #cdd0e0;
}
.solution b { color: var(--text); }
.theory { font-size: 15px; line-height: 1.6; }
.theory b { color: #c3c6e6; }

/* ---------- прогресс и статистика ---------- */
.bar { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--accent-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; padding: 12px 6px; }
.stat .v { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat .l { font-size: 12px; color: var(--muted); }
.ring {
  --p: 0; width: 120px; height: 120px; border-radius: 50%; margin: 6px auto 10px; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
}
.ring > div { width: 94px; height: 94px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  font-size: 26px; font-weight: 800; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--card2); border: 1px solid var(--line); color: var(--muted); }
.tag.good { color: var(--good); border-color: rgba(111, 191, 155, .4); }
.tag.bad { color: var(--bad); border-color: rgba(217, 128, 140, .4); }
.tag.warn { color: var(--warn); border-color: rgba(217, 179, 106, .4); }

.seg { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1 0 auto; padding: 9px 10px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--card2); color: var(--accent); }

.check { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--line); }
.check.on { border-color: var(--accent); background: var(--accent-soft); }
.check .box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); flex: none;
  display: grid; place-items: center; font-weight: 900; color: #fff; }
.check.on .box { background: var(--accent); border-color: var(--accent); }
.check .t { flex: 1; font-weight: 600; font-size: 14px; }

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 40px; height: 40px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line);
  font-size: 22px; font-weight: 800; }
.stepper .n { min-width: 36px; text-align: center; font-size: 22px; font-weight: 800; }

select.input { appearance: none; }
.selwrap { position: relative; }
.selwrap select { width: 100%; padding-right: 36px; }
.selwrap::after { content: "▾"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty .e { font-size: 42px; margin-bottom: 8px; }

.loader { display: flex; justify-content: center; gap: 8px; padding: 60px 0; }
.loader span { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: b 1s infinite ease-in-out; }
.loader span:nth-child(2) { animation-delay: .15s; }
.loader span:nth-child(3) { animation-delay: .3s; }
@keyframes b { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translateX(-50%); z-index: 40;
  max-width: 90%; padding: 11px 16px; border-radius: 14px; font-weight: 700;
  background: #2c3150; border: 1px solid rgba(140, 147, 207, .4); box-shadow: var(--shadow);
}
.toast.err { background: #3a2327; border-color: rgba(217, 128, 140, .5); }
.fade { animation: fade .22s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- рисунки задач (демоверсии МЦКО) ---------- */
.figs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 12px; }
.fig { background: #fff; border-radius: 12px; padding: 8px; text-align: center; min-width: 0; overflow: hidden; }
.fig img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.fig .cap { color: #2b2f3d; font-size: 12px; font-weight: 700; margin-top: 4px; }
/* выбор своих фото учителем: превью и плитка «добавить» */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 12px; overflow: hidden;
  background: var(--bg2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; padding: 0; border: 0;
  border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; line-height: 22px; }
.thumb.add { display: flex; align-items: center; justify-content: center; border-style: dashed;
  color: var(--accent); font-size: 28px; cursor: pointer; }
.context { margin-bottom: 12px; padding: 12px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line);
  font-size: 14.5px; line-height: 1.5; }
.context summary { cursor: pointer; font-weight: 800; color: var(--accent); }

/* ---------- кабинет учителя: тема с двумя уровнями ---------- */
.tpick { padding: 11px 12px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); }
.tpick.on { border-color: rgba(140, 147, 207, .55); background: var(--accent-soft); }
.tpick .row { gap: 10px; }
.tpick .ico-s { font-size: 20px; line-height: 1; }
.tpick .t { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; }
.eye { flex: none; width: 34px; height: 34px; border-radius: 10px; font-size: 16px; line-height: 1;
  background: var(--bg2); border: 1px solid var(--line); }
.lvls { display: flex; gap: 8px; margin-top: 10px; }
.lvl { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px;
  border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--muted);
  background: var(--bg2); border: 1.5px solid var(--line); }
.lvl span { font-weight: 600; opacity: .75; }
.lvl.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.lvl.adv.on { background: var(--warn); border-color: var(--warn); }
.note { padding: 8px 10px; border-radius: 10px; font-size: 13px; color: var(--warn);
  background: rgba(217, 179, 106, .1); border: 1px solid rgba(217, 179, 106, .3); }

/* ---------- окно поверх экрана: предпросмотр задания, список задач темы ---------- */
body.noscroll { overflow: hidden; }
.sheet-bg { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(8, 9, 14, .72); animation: veil .18s ease-out; }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .5); animation: rise .22s ease-out; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 16px 10px; }
.sheet-title { font-size: 18px; font-weight: 800; }
.sheet .x { flex: none; width: 34px; height: 34px; border-radius: 50%; font-size: 15px;
  background: var(--card2); border: 1px solid var(--line); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 14px; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-bottom));
  background: var(--bg2); border-top: 1px solid var(--line); }
.sheet-foot .btn { padding: 13px 14px; }
.pv-task { padding: 12px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); }
.pv-task .task-text { font-size: 15px; line-height: 1.5; margin-top: 8px; }
.pv-task .context { margin-top: 8px; margin-bottom: 0; }
.pv-task details.ans { margin-top: 10px; }
.pv-task details.ans summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--accent); }
@keyframes veil { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------- мотивация: серия, достижения, рейтинг ---------- */
.streak-card { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.streak-card .flame { font-size: 40px; line-height: 1; }
.streak-card .big-n { font-size: 20px; font-weight: 800; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ach { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center;
  opacity: .45; filter: grayscale(1); }
.ach.got { opacity: 1; filter: none; border-color: var(--accent); }
.ach .i { font-size: 26px; }
.ach .t { font-weight: 800; font-size: 12.5px; margin-top: 4px; }
.ach .d { color: var(--muted); font-size: 11px; margin-top: 2px; line-height: 1.3; }
.board > div { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.board > div:last-child { border-bottom: 0; }
.board .me { color: var(--accent); font-weight: 800; }
.code { font-size: 20px; letter-spacing: 3px; }
.pv-rm { margin-top: 10px; }
.pv-gone { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
  border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
.pv-in { margin-top: 10px; font-weight: 700; font-size: 13.5px; color: var(--accent); }
.pick-topic { display: block; width: 100%; padding: 12px 14px; text-align: left; }

/* ---------- учитель: ответы ученика в выданном задании ---------- */
.hw-ans { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.5; }
.hw-ans b { font-size: 15px; word-break: break-word; }
.hw-ans.ok { border-color: rgba(111, 191, 155, .4); }
.hw-ans.ok b.given { color: var(--good); }
.hw-ans.no { border-color: rgba(217, 128, 140, .4); background: var(--bad-soft); }
.hw-ans.no b.given { color: var(--bad); }
.hw-ans.wait { color: var(--muted); border-style: dashed; }
.pv-task.marked { border-color: var(--bad); opacity: .62; }
.pv-task.off { opacity: .6; border-style: dashed; }
.hw-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.hw-sub { margin: 16px 0 8px; font-weight: 800; font-size: 14px; color: var(--muted); }

/* ---------- тема «игровой прогресс»: объёмные кнопки, уровень игрока, путь по темам ---------- */
.brand-title, h1, h2, .hero .big, .stat .v, .ring > div, .opt, .btn { font-family: "Rubik", system-ui, sans-serif; }
.tabs button i { display: block; width: 24px; height: 24px; filter: none; }
.tabs button i svg { width: 24px; height: 24px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active i { transform: translateY(-2px); }
.tabs button.active { color: #fff; background: rgba(140, 147, 207, .16); box-shadow: inset 0 -3px 0 var(--accent); border-radius: 12px 12px 6px 6px; }
.logo { background: #d9b36a; color: #2b2312; box-shadow: 0 3px 0 #9a7d45; }
.grade-pill { background: var(--card2); color: #fff; border: 1px solid var(--line); box-shadow: 0 3px 0 var(--line); }

.btn { background: #8c93cf; color: #fff; box-shadow: 0 3px 0 #5a6296; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #5a6296; }
.btn.ghost { background: var(--card2); box-shadow: 0 4px 0 var(--line); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--line); }
.btn.danger { box-shadow: 0 4px 0 rgba(217, 128, 140, .25); }
.btn.sm { box-shadow: 0 3px 0 #5a6296; }
.btn.ghost.sm { box-shadow: 0 3px 0 var(--line); }
.chip { border-bottom-width: 3px; }
.chip.on { background: var(--accent); color: #fff; box-shadow: 0 3px 0 #5a6296; }
.seg button.on { background: var(--accent); color: #fff; box-shadow: 0 2px 0 #5a6296; }
.card { background: var(--card); box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.hero { background: #2c3150; border-color: rgba(140, 147, 207, .4); }

/* игрок: уровень и опыт */
.player { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 22px; border: 1px solid rgba(140, 147, 207, .4);
  background: #252a40; }
.lvl-badge { flex: none; width: 62px; height: 62px; border-radius: 18px; display: grid; place-content: center; text-align: center;
  background: #d9b36a; color: #2b2312; box-shadow: 0 4px 0 #9a7d45; }
.lvl-badge b { font-family: "Rubik", sans-serif; font-size: 28px; line-height: 1; font-weight: 800; }
.lvl-badge span { font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.p-main { flex: 1; min-width: 0; }
.p-name { font-family: "Rubik", sans-serif; font-weight: 800; font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.xp { height: 12px; border-radius: 8px; background: rgba(0, 0, 0, .35); margin: 10px 0 6px; overflow: hidden; box-shadow: inset 0 2px 0 rgba(0, 0, 0, .25); }
.xp > i { display: block; height: 100%; min-width: 12px; border-radius: 8px; background: #d9b36a; box-shadow: none; transition: width .8s cubic-bezier(.16, 1, .3, 1); }
.p-sub { font-size: 12.5px; color: #b8bcd6; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.q { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 12px; font-weight: 700; font-size: 13px;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.q svg { width: 16px; height: 16px; fill: currentColor; }
.q.fire { color: var(--warn); }
.q.ok { color: var(--good); }

/* путь по темам */
.path { position: relative; display: grid; gap: 14px; padding-left: 0; }
.node { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start; }
.node:not(:last-child)::before { content: ""; position: absolute; left: 27px; top: 58px; bottom: -14px; width: 4px; border-radius: 2px;
  background: repeating-linear-gradient(180deg, var(--line) 0 6px, transparent 6px 12px); }
.node.done:not(:last-child)::before { background: var(--warn); }
.pin { --p: 0; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); position: relative; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.pin > span { width: 44px; height: 44px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; font-size: 22px; }
.node.done .pin { background: var(--warn); }
.node.done .pin > span { background: #d9b36a; }
.node.done .pin::after { content: "★"; position: absolute; right: -4px; top: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #d9b36a; font-size: 13px; box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.node .card { padding: 12px 14px; }
.node .name { font-family: "Rubik", sans-serif; font-weight: 700; line-height: 1.3; }
.node .prog { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.node .prog .bar { flex: 1; height: 7px; }
.node .prog .bar > i { background: var(--accent-2); }
.node.done .prog .bar > i { background: #d9b36a; }
.node .prog b { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.node .actions { margin-top: 12px; }

/* задача */
.opt { border-width: 2px; border-bottom-width: 5px; transition: transform .08s, border-color .12s; }
.opt:active { transform: translateY(3px); border-bottom-width: 2px; margin-top: 3px; }
.opt.right { background: rgba(111, 191, 155, .16); animation: pop .35s cubic-bezier(.34, 1.56, .64, 1); }
.opt.wrong { animation: shake .35s; }
@keyframes pop { 0% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes shake { 20% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 80% { transform: translateX(-3px); } }
.dots i { width: 22px; height: 7px; border-radius: 4px; }
.dots { gap: 4px; }
.verdict { position: relative; font-family: "Rubik", sans-serif; font-size: 16px; }
.verdict.ok { background: rgba(111, 191, 155, .14); border: 1px solid rgba(111, 191, 155, .35); }
.verdict.no { border: 1px solid rgba(217, 128, 140, .35); }
.xp-pop { position: absolute; right: 12px; top: -12px; padding: 3px 10px; border-radius: 10px; font-weight: 800; font-size: 13px;
  color: #2b2312; background: #d9b36a; box-shadow: 0 3px 0 #9a7d45; animation: floatup .9s ease-out both; }
@keyframes floatup { 0% { transform: translateY(10px) scale(.6); opacity: 0; } 30% { transform: translateY(-4px) scale(1.1); opacity: 1; } 100% { transform: translateY(-10px); opacity: 1; } }
.stars { display: flex; justify-content: center; gap: 6px; margin: 6px 0 2px; }
.stars span { font-size: 40px; line-height: 1; color: var(--line); transform: scale(.4); opacity: 0; animation: starIn .5s cubic-bezier(.34, 1.56, .64, 1) forwards; animation-delay: calc(var(--i) * .22s); }
.stars span.on { color: var(--warn);  }
@keyframes starIn { to { transform: scale(1); opacity: 1; } }
.solution { background: var(--bg2); }
.ring { background: conic-gradient(var(--warn) calc(var(--p) * 1%), var(--line) 0); }
.stat .v { color: var(--warn); }
.ach.got { border-color: var(--warn); box-shadow: 0 3px 0 rgba(217, 179, 106, .25); }
.board .me { color: var(--warn); }
.toast { background: #2c3150; border-color: rgba(140, 147, 207, .5); }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* матовая версия: кнопки и выбранные пункты темнее, чтобы белый текст читался */
.btn, .chip.on, .seg button.on, .lvl.on { background: #636ca8; border-color: #636ca8; color: #fff; }
.btn { box-shadow: 0 3px 0 #464d7e; }
.btn:active { box-shadow: 0 1px 0 #464d7e; }
.btn.sm, .chip.on { box-shadow: 0 3px 0 #464d7e; }
.seg button.on { box-shadow: 0 2px 0 #464d7e; }
.btn.ghost { background: var(--card2); border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); border-color: rgba(217, 128, 140, .35); box-shadow: none; }

/* ---------- мягкая тема (24.10.2026): без «объёмных» подложек, спокойнее шрифт, круглее углы, пастельные цвета ---------- */
:root {
  --bg: #1a1c26; --bg2: #1f2230; --card: #242838; --card2: #2b3043; --line: #353a50;
  --text: #e9eaf2; --muted: #a2a6bc;
  --accent: #a6ace8; --accent-2: #8d94d8; --accent-soft: rgba(166, 172, 232, .14);
  --good: #86cdb0; --bad: #e59aa4; --bad-soft: rgba(229, 154, 164, .13); --warn: #e6c48e;
  --radius: 22px; --shadow: 0 8px 24px rgba(0, 0, 0, .18);
  --btn: #6b74bd; --btn-2: #7a82c8;
}
body { background: radial-gradient(900px 480px at 85% -10%, rgba(141, 148, 216, .13), transparent 60%), var(--bg); background-attachment: fixed; }
h1, h2, .brand-title, .p-name, .sheet-title { font-weight: 600; }
h2 { font-size: 16px; color: #d9dbea; }
.top { background: rgba(26, 28, 38, .86); border-bottom-color: rgba(255, 255, 255, .04); }
.logo { background: linear-gradient(145deg, #b4b9ee, #8d94d8); color: #fff; box-shadow: 0 6px 16px rgba(141, 148, 216, .3); border-radius: 14px; font-weight: 600; }
.grade-pill { background: var(--accent-soft); color: var(--accent); border: 0; box-shadow: none; font-weight: 600; }
.card { border-color: rgba(255, 255, 255, .05); box-shadow: var(--shadow); }

.btn, .btn.sm { background: linear-gradient(145deg, var(--btn-2), var(--btn)); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(107, 116, 189, .28); font-weight: 600; border-radius: 16px; transition: transform .1s, box-shadow .1s; }
.btn.sm { border-radius: 13px; }
.btn:active { transform: scale(.98); box-shadow: 0 3px 10px rgba(107, 116, 189, .22); }
.btn.ghost, .btn.ghost.sm { background: rgba(255, 255, 255, .05); color: var(--text); border: 1px solid rgba(255, 255, 255, .07); box-shadow: none; }
.btn.ghost:active { box-shadow: none; }
.btn.danger { background: var(--bad-soft); color: var(--bad); border-color: rgba(229, 154, 164, .3); box-shadow: none; }
.sign-keys .btn.on { background: var(--accent-soft); border-color: rgba(166, 172, 232, .5); color: var(--accent); }

.chip { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .06); border-bottom-width: 1px; font-weight: 500; }
.chip.on, .seg button.on, .lvl.on { background: var(--btn); border-color: var(--btn); color: #fff; box-shadow: 0 4px 12px rgba(107, 116, 189, .3); font-weight: 600; }
.seg { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .05); border-radius: 16px; }
.seg button { font-weight: 500; border-radius: 12px; }

.player { background: linear-gradient(145deg, #2d3252, #262a40); border: 1px solid rgba(166, 172, 232, .16); border-radius: 24px; box-shadow: var(--shadow); }
.lvl-badge { background: linear-gradient(145deg, #f2d8ab, #e2bc82); color: #4a3a1c; box-shadow: 0 6px 14px rgba(226, 188, 130, .22); border-radius: 20px; }
.lvl-badge b { font-weight: 600; }
.xp { height: 10px; background: rgba(255, 255, 255, .07); box-shadow: none; }
.xp > i { background: linear-gradient(90deg, #e2bc82, #f2d8ab); }
.q { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .06); box-shadow: none; font-weight: 500; border-radius: 999px; }

.pin { box-shadow: none; }
.node:not(:last-child)::before { width: 2px; left: 27px; background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .13) 0 4px, transparent 4px 9px); }
.node.done:not(:last-child)::before { background: rgba(226, 188, 130, .5); }
.node.done .pin { background: #e2bc82; }
.node.done .pin > span { background: #f2d8ab; }
.node.done .pin::after { box-shadow: none; color: #c99a52; }
.node .name { font-weight: 600; }
.bar { background: rgba(255, 255, 255, .07); }
.node .prog .bar > i { background: var(--accent-2); }

.task-text { font-weight: 500; }
.opt { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); border-bottom-width: 1px; border-radius: 16px; font-weight: 600; }
.opt:active { transform: scale(.98); border-bottom-width: 1px; margin-top: 0; }
.opt.right { border-color: var(--good); color: var(--good); }
.opt.wrong { border-color: var(--bad); color: var(--bad); }
.input { background: rgba(0, 0, 0, .14); border: 1px solid rgba(255, 255, 255, .09); border-radius: 16px; font-weight: 600; }
.verdict { font-weight: 600; border-radius: 16px; }
.solution, .context { border: 1px solid rgba(255, 255, 255, .06); border-radius: 16px; }
.theory b { color: #cfd2f4; font-weight: 600; }
.dots i { height: 6px; }

.tabs { background: rgba(31, 34, 48, .92); border-top-color: rgba(255, 255, 255, .05); }
.tabs button { font-weight: 500; }
.tabs button.active { color: var(--accent); background: var(--accent-soft); box-shadow: none; border-radius: 14px; }
.tabs button[hidden] { display: none; }
.toast { background: #2d3252; border-color: rgba(166, 172, 232, .3); border-radius: 16px; font-weight: 500; }
.xp-pop { background: #f2d8ab; box-shadow: none; }
.ach.got { border-color: rgba(226, 188, 130, .6); box-shadow: none; }
.stat .v, .board .me { color: var(--warn); }
.sheet { border-radius: 24px 24px 0 0; }

/* ---------- шпаргалка по классу ---------- */
.cheat-card { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 14px; text-align: left;
  border-radius: 20px; background: linear-gradient(145deg, rgba(166, 172, 232, .17), rgba(166, 172, 232, .06));
  border: 1px solid rgba(166, 172, 232, .22); transition: transform .1s; }
.cheat-card:active { transform: scale(.985); }
.cc-ico { flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: rgba(166, 172, 232, .2); color: var(--accent); }
.cc-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cc-t b { font-weight: 600; }
.cc-t small { margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.cc-go { font-size: 26px; line-height: 1; color: var(--accent); }
.ch-head { padding: 2px 2px 6px; }
.ch-title { font-size: 21px; font-weight: 600; margin-bottom: 2px; }
.ch-btns { display: flex; gap: 8px; margin-top: 12px; }
.ch-btns .btn { flex: 1; }
.ch-sec { margin-top: 10px; }
.ch-h { font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.ch-it { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .05); }
.ch-f { flex: 0 1 auto; font-weight: 500; }
.ch-f.prose { font-weight: 400; }
.ch-n { flex: 1 1 38%; min-width: 34%; text-align: right; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.ch-rule { padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .05); color: #d5d7e6; font-size: 14px; }
.ch-h + .ch-it, .ch-h + .ch-rule { border-top: 0; }
.cheat sub { font-size: .72em; line-height: 0; }
/* мягкая тема: средняя жирность вместо полужирной в кнопках и названиях */
.btn, .btn.sm, .chip.on, .seg button.on, .lvl.on, .opt, .node .name, .cc-t b, .ch-h { font-weight: 500; }
.node .prog b, .tag, .q { font-weight: 500; }
h1, h2, .brand-title, .p-name, .ch-title { font-weight: 600; }

/* ---------- цветовая палитра: все цвета берутся из переменных ниже (сама палитра — в конце файла) ---------- */
body { background: radial-gradient(900px 480px at 85% -10%, var(--glow), transparent 60%), var(--bg); color: var(--text); }
h2 { color: var(--heading); }
.top { background: var(--top-bg); border-bottom-color: var(--line-a); }
.brand-title { color: var(--heading); }
.logo { background: linear-gradient(145deg, var(--btn-2), var(--btn)); color: #fff; box-shadow: 0 6px 16px var(--btn-glow); }
.card, .chip, .q, .opt, .solution, .context, .ch-it, .ch-rule { border-color: var(--line-a); }
.card { background: var(--card); box-shadow: var(--shadow); }
.btn, .btn.sm { background: linear-gradient(145deg, var(--btn-2), var(--btn)); box-shadow: 0 6px 16px var(--btn-glow); }
.btn:active { box-shadow: 0 3px 10px var(--btn-glow); }
.btn.ghost, .btn.ghost.sm, .chip, .q, .opt, .seg { background: var(--fill-a); border-color: var(--line-a); color: var(--text); }
.chip, .q, .seg button { color: var(--muted); }
.q.ok { color: var(--good); }
.q.fire { color: var(--warn); }
.chip.on, .seg button.on, .lvl.on { background: var(--btn); border-color: var(--btn); color: #fff; box-shadow: 0 4px 12px var(--btn-glow); }
.player { background: var(--player-bg); border-color: var(--line-acc); }
.p-sub { color: var(--muted); }
.lvl-badge { background: linear-gradient(145deg, var(--gold-2), var(--gold)); color: var(--gold-ink); box-shadow: 0 6px 14px var(--gold-glow); }
.xp, .bar { background: var(--fill-b); }
.xp > i { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.pin { background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--fill-b) 0); }
.pin > span { background: var(--card2); }
.node:not(:last-child)::before { background: repeating-linear-gradient(180deg, var(--line-b) 0 4px, transparent 4px 9px); }
.node.done:not(:last-child)::before { background: var(--gold); }
.node.done .pin { background: var(--gold); }
.node.done .pin > span { background: var(--gold-2); }
.node.done .pin::after { background: var(--card); color: var(--gold); }
.node.done .prog .bar > i { background: var(--gold); }
.node .prog .bar > i, .bar > i { background: var(--accent-2); }
.input { background: var(--input-bg); border-color: var(--line-b); color: var(--text); }
.input:focus { border-color: var(--accent); }
.solution, .context { background: var(--bg2); color: var(--solution-text); }
.theory b, .solution b { color: var(--strong); }
.tabs { background: var(--tabs-bg); border-top-color: var(--line-a); }
.tabs button { color: var(--muted); }
.tabs button.active { color: var(--accent); background: var(--accent-soft); }
.grade-pill { background: var(--accent-soft); color: var(--accent); }
.toast { background: var(--toast-bg); border-color: var(--line-acc); color: var(--text); box-shadow: var(--shadow); }
.toast.err { background: var(--bad-soft); border-color: var(--bad); }
.xp-pop { background: var(--gold-2); color: var(--gold-ink); }
.ring { background: conic-gradient(var(--warn) calc(var(--p) * 1%), var(--fill-b) 0); }
.ring > div { background: var(--card); }
.cheat-card { background: linear-gradient(145deg, var(--accent-soft), transparent); border-color: var(--line-acc); }
.cc-ico { background: var(--accent-soft); color: var(--accent); }
.cc-go, .ch-h, .context summary { color: var(--accent); }
.ch-rule { color: var(--solution-text); }
.sheet { background: var(--card); border-color: var(--line-a); }
.sheet-foot, .pv-task { background: var(--bg2); border-color: var(--line-a); }
.tag { background: var(--fill-a); border-color: var(--line-a); }
.frac-stack > i { background: var(--text); }
.verdict.ok { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.verdict.no { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.opt.right { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.sign-keys .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* палитра «Светлая мята» */
:root { color-scheme: light;
  --bg: #f2f6f4; --bg2: #e9f0ed; --card: #ffffff; --card2: #eef4f1; --line: #d6e1dc;
  --text: #24302c; --muted: #66766f; --heading: #2a3833; --strong: #23705c; --solution-text: #3b4945;
  --accent: #2f8f78; --accent-2: #4fb096; --accent-soft: rgba(47, 143, 120, .12); --glow: rgba(79, 176, 150, .14);
  --good: #2f8a5f; --good-soft: rgba(47, 138, 95, .1); --bad: #c4505f; --bad-soft: rgba(196, 80, 95, .09); --warn: #b97f22;
  --btn: #2d8a73; --btn-2: #3c9c84; --btn-glow: rgba(45, 138, 115, .25);
  --gold: #f0bf62; --gold-2: #f8dca3; --gold-ink: #5a4214; --gold-glow: rgba(240, 191, 98, .3);
  --line-a: rgba(36, 48, 44, .08); --line-b: rgba(36, 48, 44, .14); --line-acc: rgba(47, 143, 120, .22);
  --fill-a: rgba(36, 48, 44, .035); --fill-b: rgba(36, 48, 44, .08); --input-bg: #f7faf9;
  --top-bg: rgba(242, 246, 244, .9); --tabs-bg: rgba(255, 255, 255, .95); --toast-bg: #ffffff;
  --player-bg: linear-gradient(145deg, #dff1ea, #f4faf7); --shadow: 0 6px 18px rgba(30, 70, 58, .08); }
