/* Синапс — «лабораторная» палитра: индиго, химия — фиолетовый, физика — синий, биология — зелёный. */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #eef0f8;
  --border: #dfe3f0;
  --grid: #e8ebf5;
  --text: #1c2033;
  --muted: #646b85;
  --primary: #4f46e5;
  --primary-ink: #ffffff;
  --primary-soft: #e6e5fd;
  --accent: #f5a524;
  --accent-soft: #fdf1d8;
  --ok: #17935f;
  --ok-soft: #dcf5e8;
  --bad: #d63a4a;
  --bad-soft: #fde2e5;
  --chem: #7c5cff;
  --phys: #2f80ed;
  --bio: #1fa572;
  --shadow: 0 1px 2px rgba(28, 32, 51, .05), 0 6px 20px rgba(28, 32, 51, .06);
  --radius: 16px;
  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1220; --surface: #181c2e; --surface-2: #222740; --border: #2e3452; --grid: #252a44;
    --text: #e9ebf5; --muted: #9aa1bf; --primary: #8b85ff; --primary-ink: #0f1220; --primary-soft: #2a2858;
    --accent: #ffbf47; --accent-soft: #3d3218; --ok: #3fd18f; --ok-soft: #163a2a; --bad: #ff6b7a; --bad-soft: #43202a;
    --chem: #a28bff; --phys: #5ea3ff; --bio: #3fd18f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1220; --surface: #181c2e; --surface-2: #222740; --border: #2e3452; --grid: #252a44;
  --text: #e9ebf5; --muted: #9aa1bf; --primary: #8b85ff; --primary-ink: #0f1220; --primary-soft: #2a2858;
  --accent: #ffbf47; --accent-soft: #3d3218; --ok: #3fd18f; --ok-soft: #163a2a; --bad: #ff6b7a; --bad-soft: #43202a;
  --chem: #a28bff; --phys: #5ea3ff; --bio: #3fd18f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .75em; }
sub, sup { font-size: .72em; line-height: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .7rem; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.mono { font-family: var(--mono); letter-spacing: .08em; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
.row.center { justify-content: center; }
.row.between { justify-content: space-between; }
.ok-text { color: var(--ok); font-weight: 700; }
.bad-text { color: var(--bad); font-weight: 700; }
.f { white-space: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--surface); padding: .5rem 1rem; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Каркас ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem; padding-top: calc(.6rem + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.logo { font-weight: 900; font-size: 1.35rem; color: var(--text); letter-spacing: -.02em; display: flex; align-items: center; gap: .5rem; }
.logo-mark { width: 28px; height: 28px; border-radius: 9px; background: url(../assets/icon.svg) center / cover; display: inline-block; }
.header-stats { display: flex; gap: .4rem; margin-left: auto; align-items: center; }
.stat-chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 700; font-size: .9rem; color: var(--text); white-space: nowrap;
}
.stat-chip.hot { background: var(--accent-soft); border-color: var(--accent); }
.mini-progress { width: 38px; height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; display: inline-block; }
.mini-progress span { display: block; height: 100%; background: var(--accent); }
.flame { filter: grayscale(1); opacity: .5; }
.flame.on { filter: none; opacity: 1; }
.layout { display: flex; max-width: 1320px; margin: 0 auto; }
.nav {
  position: sticky; top: 58px; align-self: flex-start; width: 212px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 2px; padding: 1rem .6rem; height: calc(100vh - 58px); overflow-y: auto;
}
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 12px; color: var(--text); font-weight: 600; position: relative; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.nav-icon { font-size: 1.15rem; width: 1.5rem; text-align: center; }
.badge { margin-left: auto; background: var(--bad); color: #fff; font-size: .7rem; border-radius: 999px; padding: 0 .45rem; font-weight: 800; }
main { flex: 1; min-width: 0; padding: 1.5rem 1.25rem 4rem; }
main:focus, main:focus-visible { outline: none; }
body.focus-mode .nav { display: none; }
body.focus-mode main { max-width: 820px; margin: 0 auto; }

@media (max-width: 860px) {
  .layout { display: block; }
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; width: auto; height: auto; z-index: 30;
    flex-direction: row; overflow-x: auto; padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); gap: 0; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex-direction: column; gap: 0; padding: .3rem .5rem; font-size: .66rem; min-width: 66px; text-align: center; }
  .nav-icon { font-size: 1.25rem; }
  .badge { position: absolute; top: 0; right: 8px; }
  main { padding: 1rem 16px 6rem; }
  .topbar { padding-left: 16px; padding-right: 16px; gap: .5rem; }
  .logo { font-size: 1.15rem; }
  .stat-chip { padding: .2rem .5rem; font-size: .8rem; }
  .mini-progress { display: none; }
  h1 { font-size: 1.45rem; }
}
@media (max-width: 420px) { .header-stats .stat-chip:nth-child(2) { display: none; } }

/* ---------- Компоненты ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); display: block; color: var(--text);
}
a.card { transition: transform .15s, border-color .15s; }
a.card:hover { transform: translateY(-2px); border-color: var(--c, var(--primary)); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.card-grid > .card { margin: 0; }
.page-header { margin-bottom: 1rem; }
.back-link { display: inline-block; margin-bottom: .4rem; font-weight: 700; }
.section-title { margin: 1.5rem 0 .75rem; }
.big-emoji { font-size: 3.4rem; line-height: 1; margin-bottom: .5rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: 12px; border: 2px solid var(--border); border-bottom-width: 4px;
  background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; transition: transform .08s, filter .15s; text-align: center;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn.primary { background: var(--primary); border-color: color-mix(in srgb, var(--primary) 65%, black); color: var(--primary-ink); }
.btn.danger { background: var(--bad); border-color: color-mix(in srgb, var(--bad) 65%, black); color: #fff; }
.btn.big { padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn.small { padding: .32rem .7rem; font-size: .85rem; border-bottom-width: 3px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; font-size: 1.1rem; width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); font-weight: 800;
}
.icon-btn:hover { background: var(--surface-2); }

.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.progress.thick { height: 14px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 999px; transition: width .35s ease; }
.progress.subj .progress-fill { background: var(--c, var(--primary)); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.chip {
  border: 2px solid var(--border); background: var(--surface); border-radius: 999px; padding: .35rem .8rem; color: var(--text);
  cursor: pointer; font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: .35rem;
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.segmented { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 12px; gap: 2px; margin-bottom: .75rem; flex-wrap: wrap; }
.segmented button { border: none; background: transparent; padding: .4rem .85rem; border-radius: 9px; cursor: pointer; font-weight: 600; }
.segmented button.active { background: var(--surface); box-shadow: var(--shadow); font-weight: 800; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 6px; background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 45%, var(--text)); margin-top: .3rem; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.level-pill { display: inline-block; font-size: .78rem; font-weight: 800; padding: .2rem .65rem; border-radius: 999px; color: #fff; }
.level-pill.l1 { background: #20a77a; } .level-pill.l2 { background: #2f80ed; } .level-pill.l3 { background: #7c5cff; } .level-pill.l4 { background: #e0457b; }
.level-head { display: flex; align-items: center; gap: .75rem; margin: 1.4rem 0 .6rem; flex-wrap: wrap; }

input[type=text], input[type=search], input:not([type]), select {
  border: 2px solid var(--border); background: var(--surface); border-radius: 12px; padding: .55rem .8rem; max-width: 100%;
}
input[type=text], input[type=search] { width: 100%; }
input[type=text]:focus, input[type=search]:focus, select:focus { border-color: var(--primary); outline: none; }
select { cursor: pointer; }
.search { margin: .25rem 0 .5rem; max-width: 420px; }
.field { margin: .6rem 0; display: block; }
.field .label { font-weight: 700; margin-bottom: .3rem; display: inline-block; }
.switch { display: flex; align-items: center; gap: .45rem; cursor: pointer; font-weight: 600; margin: .4rem 0; }
.switch input { width: 18px; height: 18px; accent-color: var(--primary); }
input[type=range] { accent-color: var(--primary); width: 100%; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; margin: .55rem 0; align-items: center; }
.slider input { grid-column: 1 / -1; }
.slider-label { font-weight: 600; font-size: .9rem; }
.slider-val { font-family: var(--mono); font-size: .85rem; font-weight: 700; color: var(--primary); }

.answer-input { font-size: 1.15rem; font-weight: 700; text-align: center; }
.answer-input.left { text-align: left; font-size: 1rem; flex: 1; min-width: 200px; }
.answer-input.correct { border-color: var(--ok); background: var(--ok-soft); }
.answer-input.wrong { border-color: var(--bad); background: var(--bad-soft); }

/* ---------- Тосты, модалки ---------- */
.toasts { position: fixed; top: 70px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: .65rem 1rem; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); animation: slideIn .3s ease; transition: opacity .4s, transform .4s; }
.toast.gold { background: var(--accent); color: #2b211b; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateX(20px); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } }
.xp-pop { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 70; font-weight: 900; font-size: 1.4rem; color: var(--accent); text-shadow: 0 2px 8px rgba(0, 0, 0, .2); animation: floatUp 1.2s ease forwards; pointer-events: none; }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, 20px); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -30px); } }
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); max-width: 460px; width: 100%; padding: 1.25rem; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

/* ---------- Главная ---------- */
.hero { display: flex; gap: 1.5rem; align-items: center; justify-content: space-between;
  background: radial-gradient(circle at 90% 10%, color-mix(in srgb, var(--bio) 22%, transparent), transparent 45%),
    radial-gradient(circle at 70% 90%, color-mix(in srgb, var(--phys) 20%, transparent), transparent 45%),
    linear-gradient(135deg, var(--primary-soft), var(--surface)); }
.hero-text { flex: 1; min-width: 0; }
.hero-kicker { font-weight: 800; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: .3rem; }
.hero h1 { font-size: 2.1rem; }
.hero .btn.big { white-space: normal; }
.hero-goal { text-align: center; flex-shrink: 0; }
.ring { position: relative; width: 88px; height: 88px; margin: 0 auto; }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.1; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.subject-card { margin: 0; border-top: 5px solid var(--c); }
.subject-icon { font-size: 2.3rem; }
.next-up { color: var(--c); font-weight: 700; margin-top: .3rem; }
.action-card { display: flex; gap: .9rem; align-items: center; }
.action-card.warn { border-color: var(--accent); }
.action-icon { font-size: 2rem; width: 52px; height: 52px; border-radius: 14px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fact-card { border-left: 5px solid var(--accent); }
.fact-label { font-weight: 800; margin-bottom: .3rem; }
.how-list li { margin: .4rem 0; }
@media (max-width: 640px) { .hero { flex-direction: column; align-items: stretch; } .hero h1 { font-size: 1.6rem; } }

/* ---------- Курс ---------- */
.subject-hero { display: flex; gap: 1.25rem; align-items: center; border-top: 6px solid var(--c); }
.subject-hero-icon { font-size: 3.6rem; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.module-card { margin: 0; display: flex; gap: .9rem; align-items: flex-start; }
.module-card h3 { margin-bottom: .25rem; }
.module-card p { margin-bottom: .4rem; }
.module-card.complete { border-color: var(--ok); }
.module-card .progress-fill { background: var(--c); }
.module-icon { font-size: 1.8rem; width: 50px; height: 50px; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stars-count { color: var(--accent); font-weight: 800; }
.stars { display: inline-flex; gap: 1px; font-size: 1.1rem; }
.star { color: var(--border); }
.star.on { color: var(--accent); }
.lesson-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.lesson-row { display: flex; gap: .9rem; align-items: center; margin: 0; padding: .9rem 1.1rem; }
.lesson-num { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.lesson-row.done .lesson-num { background: var(--ok); color: #fff; }
.terms dl { margin: 0; display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: .4rem 1rem; }
.terms dt { font-weight: 800; }
.terms dd { margin: 0; color: var(--muted); }
@media (max-width: 600px) { .terms dl { grid-template-columns: 1fr; } .terms dd { margin-bottom: .5rem; } .subject-hero { flex-direction: column; align-items: flex-start; } }

/* Урок */
.lesson-page { max-width: 780px; margin: 0 auto; }
.crumbs { margin-bottom: .5rem; }
.lesson-title { font-size: 2rem; }
.read-progress { position: sticky; top: 58px; z-index: 5; height: 4px; background: var(--surface-2); border-radius: 2px; margin-bottom: 1.25rem; }
.read-progress-fill { height: 100%; width: 0; background: var(--c); border-radius: 2px; transition: width .1s; }
.theory { font-size: 1.04rem; }
.theory > p { margin-bottom: 1em; }
.theory-h { margin-top: 1.5rem; }
.theory-list { padding-left: 1.3rem; margin: 0 0 1em; }
.theory-list li { margin: .35rem 0; }
.callout { border-radius: 14px; padding: .9rem 1.1rem; margin: 1rem 0; background: var(--surface-2); border-left: 5px solid var(--muted); }
.callout-label { font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; }
.callout.key { background: var(--primary-soft); border-color: var(--primary); }
.callout.med { background: color-mix(in srgb, var(--bad) 9%, var(--surface)); border-color: var(--bad); }
.callout.fact { background: var(--accent-soft); border-color: var(--accent); }
.callout.warn { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: #e07b00; }
.lab-link, .gen-link { display: flex; gap: .9rem; align-items: center; color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.lab-link:hover, .gen-link:hover { filter: brightness(.98); }
.lab-link-icon { font-size: 2rem; }
.lab-arrow { margin-left: auto; font-size: 1.4rem; font-weight: 800; color: var(--c); }
.formula { text-align: center; padding: 1rem; margin: 1rem 0; border-radius: 14px; border: 2px dashed var(--border); background: var(--surface); }
.formula-main { font-size: 1.22rem; font-weight: 600; font-family: 'Times New Roman', Georgia, serif; }
.formula-main i { font-style: italic; }
.formula-note { font-size: .88rem; color: var(--muted); margin-top: .3rem; }
.table-wrap { overflow-x: auto; margin: 1rem 0; -webkit-overflow-scrolling: touch; }
.data-table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.data-table th, .data-table td { padding: .5rem .65rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data-table th { background: var(--surface-2); font-weight: 700; }
.inline-q { border: 2px solid var(--primary-soft); border-radius: 14px; padding: .9rem 1.1rem; margin: 1.2rem 0; background: var(--surface); }
.lesson-cta { margin-top: 2rem; border: 2px solid var(--c); }
.lesson-nav .btn { max-width: 48%; }

/* ---------- Вопросы и тесты ---------- */
.quiz { max-width: 760px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; position: sticky; top: 58px; background: var(--bg); padding: .4rem 0; z-index: 5; }
.quiz-top .progress { margin: 0; }
.quiz-counter { font-weight: 800; white-space: nowrap; }
.lives { white-space: nowrap; }
.timer { font-weight: 800; font-family: var(--mono); white-space: nowrap; }
.timer.urgent { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.question { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.inline-q .question { box-shadow: none; border: none; padding: 0; background: none; }
.q-tag { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: .4rem; }
.q-text { font-size: 1.15rem; font-weight: 600; margin-bottom: .4rem; }
.q-hint { margin-bottom: .8rem; }
.q-figure { margin: .5rem 0; }
.options { display: flex; flex-direction: column; gap: .5rem; margin: .6rem 0; }
.options.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.option {
  display: flex; gap: .7rem; align-items: center; text-align: left; padding: .7rem .9rem; border-radius: 12px;
  border: 2px solid var(--border); border-bottom-width: 4px; background: var(--surface); cursor: pointer; font-weight: 600; transition: border-color .15s, background .15s;
}
.option:hover:not([disabled]) { border-color: var(--primary); }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option.right { border-color: var(--ok); background: var(--ok-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option[disabled] { cursor: default; }
.opt-key { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; flex-shrink: 0; color: var(--muted); }
.opt-box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border); flex-shrink: 0; }
.option.selected .opt-box { background: var(--primary); border-color: var(--primary); }
.tf-btn { justify-content: center; font-size: 1.05rem; }
.num-row { display: flex; gap: .6rem; align-items: center; }
.num-row .answer-input { max-width: 260px; }
.unit { font-weight: 700; color: var(--muted); }
.q-actions { margin-top: .8rem; }
.q-feedback:not(:empty) { margin-top: .8rem; border-radius: 12px; padding: .8rem 1rem; background: var(--surface-2); }
.is-correct .q-feedback { background: var(--ok-soft); }
.is-wrong .q-feedback { background: var(--bad-soft); }
.fb-head { font-weight: 800; font-size: 1.05rem; }
.fb-head.ok { color: var(--ok); } .fb-head.bad { color: var(--bad); }
.fb-right { margin-top: .3rem; font-weight: 700; }
.fb-explain { margin-top: .4rem; font-size: .95rem; }
.fb-note { font-weight: 700; color: #b26a00; margin-bottom: .3rem; }
.q-next { margin-top: 1rem; text-align: right; }
.repeat-note { text-align: center; font-weight: 700; color: var(--accent); margin-bottom: .6rem; }
.chip-bank { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.order-line { min-height: 46px; border: 2px dashed var(--border); border-radius: 12px; padding: .4rem .4rem .4rem 2rem; display: flex; flex-direction: column; gap: .3rem; margin: .5rem 0; }
.order-line li.chip { cursor: pointer; }
.order-line li.right { border-color: var(--ok); background: var(--ok-soft); }
.order-line li.wrong { border-color: var(--bad); background: var(--bad-soft); }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.match-row { display: flex; justify-content: space-between; gap: .5rem; align-items: center; padding: .4rem .5rem; border-radius: 10px; border: 2px solid var(--border); margin-bottom: .4rem; }
.match-row.right { border-color: var(--ok); background: var(--ok-soft); }
.match-row.wrong { border-color: var(--bad); background: var(--bad-soft); }
.match-row select { width: auto; padding: .3rem .5rem; }
.match-opt { padding: .45rem .6rem; border-radius: 10px; background: var(--surface-2); margin-bottom: .4rem; }
@media (max-width: 600px) { .match-grid { grid-template-columns: 1fr; } }
.equation { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; font-size: 1.25rem; font-weight: 600; margin: .6rem 0; }
.eq-term { display: inline-flex; align-items: center; gap: .15rem; }
.coef-input { width: 46px; text-align: center; padding: .3rem; font-size: 1.1rem; font-weight: 800; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); }
.coef-input.correct { border-color: var(--ok); background: var(--ok-soft); }
.coef-input.wrong { border-color: var(--bad); background: var(--bad-soft); }
.eq-arrow { font-weight: 900; color: var(--primary); }
.result { padding: 2rem 1.25rem; }
.result-score { font-size: 2.2rem; font-weight: 900; margin: .3rem 0; }
.mistakes { text-align: left; margin: 1rem 0; }
.mistakes summary { cursor: pointer; font-weight: 700; }
.mistake-item { border-top: 1px solid var(--border); padding: .6rem 0; }
.result-trainers { margin-top: 1rem; }

/* ---------- Тренажёры ---------- */
.trainer-card, .mix-card, .lab-card, .game-card { display: flex; gap: .9rem; align-items: flex-start; }
.trainer-icon, .lab-card-icon, .game-icon { font-size: 1.7rem; width: 50px; height: 50px; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mix-card { border: 2px dashed var(--c); }
.mastery { font-size: .72rem; font-weight: 800; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); }
.mastery.m1 { background: #ffe4cc; color: #9a4a00; } .mastery.m2 { background: #d7e8ff; color: #1d4f9a; } .mastery.m3 { background: #ffe9a8; color: #7a5600; }
.trainer-page { max-width: 820px; margin: 0 auto; }
.trainer-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.trainer-stats { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

/* ---------- Лаборатории ---------- */
.lab { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.lab-stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem; overflow: hidden; }
.lab-side { display: flex; flex-direction: column; gap: .75rem; }
.lab-side > .callout, .lab-side > .card { margin: 0; }
.lab-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .8rem 1rem; }
.lab-panel-title { font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .3rem; }
.lab-canvas { width: 100%; height: auto; display: block; touch-action: pan-y; }
.readout { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.readout:last-child { border-bottom: none; }
.readout-label { color: var(--muted); }
.readout-val { font-family: var(--mono); font-weight: 700; text-align: right; }
.readout-unit { color: var(--muted); font-size: .85em; }
@media (max-width: 980px) { .lab { grid-template-columns: 1fr; } }
.kv { width: 100%; border-collapse: collapse; font-size: .92rem; margin: .5rem 0; }
.kv td { padding: .3rem .2rem; border-bottom: 1px dashed var(--border); }
.kv td:first-child { color: var(--muted); }
.kv td:last-child { font-weight: 700; text-align: right; }

/* Таблица Менделеева */
.ptable-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1rem; align-items: start; }
.ptable-scroll { overflow-x: auto; padding-bottom: .5rem; }
.ptable { display: grid; grid-template-columns: repeat(18, minmax(40px, 1fr)); grid-template-rows: repeat(7, auto) 12px auto auto; gap: 3px; min-width: 760px; }
.el { border: none; border-radius: 6px; padding: 3px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.05; color: #1c2033; min-height: 46px; transition: transform .1s, opacity .2s, box-shadow .1s; }
.el:hover { transform: scale(1.12); z-index: 2; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.el.sel { outline: 3px solid var(--text); z-index: 3; }
.el.dim { opacity: .18; }
.el-z { font-size: .58rem; align-self: flex-start; padding-left: 2px; }
.el-sym { font-weight: 800; font-size: 1rem; }
.el-name { font-size: .5rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-gap { font-size: .6rem; display: flex; align-items: center; justify-content: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 6px; }
.ptable-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: .5rem 0 .8rem; font-size: .82rem; }
.leg { display: inline-flex; align-items: center; gap: .35rem; }
.leg i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; font-style: normal; font-size: .7rem; text-align: center; line-height: 14px; font-weight: 800; }
.ptable-detail { margin: 0; position: sticky; top: 70px; }
.el-detail-head { display: flex; gap: 1rem; align-items: center; margin-bottom: .5rem; }
.el-big { width: 84px; height: 84px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #1c2033; flex-shrink: 0; }
.el-big-z { font-size: .8rem; font-weight: 700; }
.el-big-sym { font-size: 2rem; font-weight: 900; line-height: 1; }
.el-big-mass { font-size: .72rem; }
@media (max-width: 1100px) { .ptable-wrap { grid-template-columns: 1fr; } .ptable-detail { position: static; } }
.bohr .shell { transform-origin: center; transform-box: view-box; animation: spin linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bohr .shell { animation: none; } }

/* Конструктор атома */
.atom-view { display: flex; justify-content: center; }
.atom-view svg { width: 100%; max-width: 380px; height: auto; }
.counter { display: grid; grid-template-columns: 14px 1fr auto 36px auto; gap: .5rem; align-items: center; margin: .3rem 0; }
.cnt-dot { width: 14px; height: 14px; border-radius: 50%; }
.cnt-val { text-align: center; font-family: var(--mono); font-size: 1.1rem; }
.atom-notation { font-size: 2.6rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: .1rem; font-family: 'Times New Roman', serif; }
.iso { display: inline-flex; flex-direction: column; font-size: 1rem; line-height: 1.1; text-align: right; }
.iso sup, .iso sub { font-size: 1rem; line-height: 1.1; }
.iso-chg { font-size: 1.1rem; align-self: flex-start; }

/* Калькулятор */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.calc-grid > .card { margin: 0; }
.calc-out { margin-top: .8rem; }
.big-eq { font-size: 1.3rem; font-weight: 600; margin: .6rem 0; word-break: break-word; }
.stack-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: .6rem 0; }
.stack-bar div { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: .8rem; }

/* pH */
.flask-svg { display: block; margin: .3rem auto; }
.ph-gradient { height: 18px; border-radius: 9px; background: linear-gradient(90deg, rgb(200,20,30), rgb(240,100,30) 21%, rgb(245,200,40) 36%, rgb(60,170,70) 50%, rgb(30,120,180) 64%, rgb(50,60,170) 79%, rgb(100,30,130)); }
.ph-scale { position: relative; height: 180px; margin-top: .2rem; }
.ph-item { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.ph-item:nth-child(even) { top: 70px; }
.ph-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.ph-name { font-size: .68rem; writing-mode: vertical-rl; transform: rotate(180deg); margin-top: 4px; max-height: 100px; color: var(--muted); }

/* Осмос, клетка, сердце */
.osmo-svg, .cell-svg, .heart-svg, .circuit-svg { width: 100%; height: auto; display: block; }
.cell-part { cursor: pointer; transition: filter .15s, opacity .15s; }
.cell-part:hover { filter: brightness(1.1) drop-shadow(0 0 4px rgba(0, 0, 0, .35)); }
.cell-part.sel { filter: drop-shadow(0 0 6px var(--accent)) brightness(1.08); }
.cell-info { margin: 0; }

/* ДНК */
.strand-row { display: grid; grid-template-columns: 170px 1fr; gap: .6rem; align-items: center; margin: .45rem 0; }
.strand-label { font-size: .82rem; color: var(--muted); font-weight: 700; }
.strand, .codons, .protein { display: flex; flex-wrap: wrap; gap: 3px; }
.nt { width: 26px; height: 30px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 700; border: none; color: #1c2033; font-size: .95rem; }
button.nt { cursor: pointer; }
button.nt:hover { transform: translateY(-2px); box-shadow: 0 3px 8px rgba(0, 0, 0, .2); }
.nt-A { background: #ff8a80; } .nt-T { background: #ffd180; } .nt-G { background: #b9f6ca; } .nt-C { background: #80d8ff; } .nt-U { background: #ffe57f; }
.codon { font-family: var(--mono); font-weight: 700; padding: .25rem .4rem; border-radius: 6px; background: var(--surface-2); font-size: .9rem; min-width: 86px; text-align: center; }
.codon.anti { background: color-mix(in srgb, var(--bio) 14%, var(--surface)); }
.aa { padding: .3rem .55rem; border-radius: 999px; font-weight: 800; font-size: .85rem; color: #1c2033; min-width: 52px; text-align: center; }
@media (max-width: 600px) { .strand-row { grid-template-columns: 1fr; gap: .2rem; } .nt { width: 22px; height: 26px; font-size: .82rem; } .codon { min-width: 0; } }

/* Пеннет */
.cross-x { font-size: 1.5rem; font-weight: 900; color: var(--muted); }
.punnett { border-collapse: separate; border-spacing: 4px; margin: .6rem auto; }
.punnett th, .punnett td { padding: .5rem .6rem; text-align: center; border-radius: 10px; min-width: 64px; }
.punnett td { color: #1c2033; border: 1px solid rgba(0, 0, 0, .12); }
.punnett th.gamete { background: var(--surface-2); font-family: var(--mono); }
.punnett .corner { color: var(--muted); font-size: .8rem; }
.tally { padding-left: 1.1rem; margin: 0; }
.tally li { margin: .25rem 0; }

/* ---------- Справочник ---------- */
.ref-tabs .chip { font-size: .85rem; }
.sol-table th, .sol-table td { text-align: center; padding: .35rem .3rem; font-size: .85rem; min-width: 38px; }
.sol-r { background: color-mix(in srgb, var(--ok) 22%, var(--surface)); }
.sol-m { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.sol-n { background: color-mix(in srgb, var(--bad) 22%, var(--surface)); }
.sol-x { background: var(--surface-2); color: var(--muted); }
.sol-table tbody tr:hover td, .sol-table tbody tr:hover th { outline: 1px solid var(--primary); }
.activity { display: flex; flex-wrap: wrap; gap: 4px; margin: 1rem 0 .4rem; }
.act-item { padding: .45rem .55rem; border-radius: 8px; font-weight: 800; background: hsl(calc(10 + var(--t) * 200), 70%, 75%); color: #1c2033; }
.act-item.hydrogen { background: var(--text); color: var(--bg); }
.code-table td { padding: .3rem; }
.codon-cell { font-size: .85rem; padding: .12rem .3rem; border-radius: 5px; }
.codon-cell.stop { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.codon-cell.start { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.code-table .third div { font-size: .85rem; padding: .12rem 0; color: var(--muted); font-weight: 700; }
.aa-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.aa-chip { padding: .25rem .6rem; border-radius: 999px; background: var(--surface-2); font-size: .86rem; }
.formula-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.formula-card { border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; }
.formula-card .formula-main { font-size: 1.08rem; }
.glossary .gl-item { border-bottom: 1px solid var(--border); padding: .6rem 0; }
.glossary .tag { margin-left: .5rem; }

/* ---------- Экзамен, карточки ---------- */
.exam-setup .segmented { margin-bottom: 0; }
.weak-list { display: flex; flex-direction: column; gap: .5rem; }
.weak-item { display: grid; grid-template-columns: 1fr auto; gap: 0 1rem; color: var(--text); padding: .4rem .6rem; border-radius: 10px; }
.weak-item:hover { background: var(--surface-2); }
.weak-item .progress { grid-column: 1 / -1; margin: .2rem 0 0; }
.mistake-item.ok { border-left: 3px solid var(--ok); padding-left: .6rem; }
.mistake-item.bad { border-left: 3px solid var(--bad); padding-left: .6rem; }
.flashcard { min-height: 230px; border-radius: 20px; padding: 1.5rem; margin: 1rem auto; max-width: 620px; background: var(--surface); border: 2px solid var(--border); border-top: 6px solid var(--c); box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .8rem; text-align: center; cursor: pointer; }
.flash-meta { font-size: .8rem; color: var(--muted); font-weight: 700; }
.flash-term { font-size: 1.7rem; font-weight: 800; }
.flash-def { font-size: 1.1rem; }
.flash-back { border-top: 2px dashed var(--border); padding-top: .8rem; width: 100%; animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; max-width: 620px; margin: 0 auto; }
.grade { flex-direction: column; gap: 0; }
.grade small { font-weight: 500; font-size: .7rem; color: var(--muted); }
.grade.g0 { border-color: var(--bad); } .grade.g1 { border-color: #e07b00; } .grade.g2 { border-color: var(--phys); } .grade.g3 { border-color: var(--ok); }
@media (max-width: 520px) { .grade-row { grid-template-columns: 1fr 1fr; } }
.deck-list { display: flex; flex-direction: column; gap: .3rem; }
.deck-row { display: flex; gap: .8rem; align-items: center; padding: .35rem 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.deck-strength { width: 120px; }
.deck-strength .progress { margin: 0; }

/* ---------- Игры ---------- */
.game-page { max-width: 760px; margin: 0 auto; }
.game-head { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-bottom: 1rem; flex-wrap: wrap; }
.game-prompt { text-align: center; margin: 1rem 0 1.25rem; }
.game-big { font-size: 2.4rem; font-weight: 900; display: block; }
.game-statement { font-size: 1.3rem; font-weight: 700; }
.memory-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-top: 1rem; }
.mem-tile { min-height: 110px; border-radius: 14px; border: 2px solid var(--border); background: var(--primary); color: var(--primary-ink); cursor: pointer; padding: .5rem; font-size: .82rem; font-weight: 600; transition: transform .2s; }
.mem-tile .mem-front { display: none; }
.mem-tile .mem-back { font-size: 2rem; font-weight: 900; }
.mem-tile.open { background: var(--surface); color: var(--text); transform: rotateY(0); }
.mem-tile.open .mem-front { display: block; }
.mem-tile.open .mem-back { display: none; }
.mem-front.term { font-weight: 800; font-size: 1rem; }
.mem-tile.done { background: var(--ok-soft); border-color: var(--ok); color: var(--text); cursor: default; }
@media (max-width: 560px) { .memory-board { grid-template-columns: repeat(3, 1fr); } .mem-tile { font-size: .72rem; min-height: 100px; } }

/* ---------- Профиль ---------- */
.profile-hero { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.avatar { width: 76px; height: 76px; border-radius: 22px; background: linear-gradient(135deg, var(--chem), var(--phys), var(--bio)); color: #fff; font-size: 2.2rem; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.stat-tile { margin: 0; text-align: center; padding: 1rem .6rem; }
.stat-icon { font-size: 1.5rem; }
.stat-val { font-size: 1.5rem; font-weight: 900; }
.subj-progress { margin: .6rem 0 1rem; }
.heatmap { display: grid; grid-template-rows: repeat(7, 13px); grid-auto-flow: column; grid-auto-columns: 13px; gap: 3px; overflow-x: auto; padding-bottom: .4rem; }
.hm-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); }
.hm1 { background: color-mix(in srgb, var(--primary) 30%, var(--surface-2)); }
.hm2 { background: color-mix(in srgb, var(--primary) 55%, var(--surface-2)); }
.hm3 { background: color-mix(in srgb, var(--primary) 80%, var(--surface-2)); }
.hm4 { background: var(--primary); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.ach { margin: 0; text-align: center; opacity: .45; filter: grayscale(1); }
.ach.got { opacity: 1; filter: none; border-color: var(--accent); }
.ach-icon { font-size: 2rem; }
.settings select { width: auto; }
