/* ===== Токены (см. docs/STYLE.md) ===== */
:root {
  --bg: #F2F2F4; --card: #FFFFFF; --ink: #0B0B0C;
  --ink-2: rgba(11,11,12,.6); --ink-3: rgba(11,11,12,.2); --line: rgba(11,11,12,.08);
  --accent: #2C6BFF; --accent-soft: #E6EEFF;
  --sea: #DCEBFF; --sea-2: #B9D6FF; --land: #F3E7C9; --wind: #7A5CFF;
  --port: #FF3B30; --stbd: #1DB954; --yellow: #FFC400; --white-light: #FFFFFF; --night: #0E1A2B;
  --ok: #1DB954; --ok-soft: #E3F7EA; --warn: #FF9500; --warn-soft: #FFF1DE; --bad: #FF3B30; --bad-soft: #FFE6E4;
  --r-xl: 42px; --r-l: 32px; --r-m: 22px; --r-s: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
  --font: "Hafer", "Inter Tight", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.02em; margin: 0; line-height: 1.1; }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: clamp(24px, 3.4vw, 30px); }
h3 { font-size: 20px; }
p { margin: 0 0 .8em; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }

/* ===== Каркас ===== */
.app { max-width: 1080px; margin: 0 auto; padding: 0 16px 120px; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.topbar-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.02em; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; display: block; flex: none; }
.brand-iyt { height: 40px; width: auto; padding-left: 16px; border-left: 1px solid rgba(0,0,0,.12); }
@media (max-width: 1000px) { .brand-iyt { display: none; } }
.brand small { display: block; font-weight: 500; color: var(--ink-2); font-size: 12px; letter-spacing: 0; }
.nav { display: flex; gap: 4px; margin-left: auto; background: var(--card); padding: 4px; border-radius: 999px; box-shadow: var(--shadow); }
.nav a { text-decoration: none; padding: 8px 16px; border-radius: 999px; font-size: 15px; font-weight: 500; color: var(--ink-2); transition: .2s var(--ease); white-space: nowrap; }
.nav a.is-active { background: var(--accent-soft); color: var(--accent); }
.nav a:hover:not(.is-active) { color: var(--ink); }
@media (max-width: 760px) {
  /* backdrop-filter создаёт контейнер для fixed-потомков → таб-бар уезжал наверх */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .nav { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    justify-content: space-between; z-index: 30; padding: 5px; gap: 2px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
  .nav a { flex: 1 1 0; min-width: 0; min-height: 52px; padding: 6px 2px; font-size: 11px; letter-spacing: -.01em;
    text-align: center; overflow: hidden; text-overflow: ellipsis; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .nav a .ico { display: block; font-size: 20px; line-height: 1.1; margin-bottom: 2px; }
  .app { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .composer { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (min-width: 761px) { .nav a .ico { display: none; } }

.page { animation: pageIn .35s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 4px 12px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ===== Карточки и кнопки ===== */
.card { background: var(--card); border-radius: var(--r-l); padding: 24px; box-shadow: var(--shadow); border: 1px solid #fff; }
.card.xl { border-radius: var(--r-xl); padding: 32px; }
.card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.dark .muted { color: rgba(255,255,255,.6); }
.card.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.card.soft { background: transparent; box-shadow: none; border: 1.5px solid var(--ink-3); }
.card.click { cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.card.click:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 16px 40px rgba(0,0,0,.08); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px;
  background: var(--ink); color: #fff; padding: 14px 24px; font-weight: 500; font-size: 17px; text-decoration: none;
  transition: transform .15s var(--ease), opacity .15s; min-height: 50px; }
.btn:hover { opacity: .9; } .btn:active { transform: scale(.98); }
.btn.white { background: #fff; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink-3); }
.btn.accent { background: var(--accent); }
.btn.wide { width: 100%; }
.btn.sm { padding: 8px 16px; min-height: 38px; font-size: 15px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--ink-3); background: transparent; color: var(--ink);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; transition: .15s var(--ease); }
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: #0f7a37; } .tag.warn { background: var(--warn-soft); color: #a65a00; }
.tag.bad { background: var(--bad-soft); color: #c0241b; } .tag.acc { background: var(--accent-soft); color: var(--accent); }
.tag.dark { background: var(--ink); color: #fff; }

/* ===== Прогресс ===== */
.bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--ink); transition: width .8s var(--ease); }
.bar .target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .35; }
.ring { --p: 0; --c: var(--ink); width: 120px; height: 120px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg) 0); display: grid; place-items: center; flex: none; }
.ring > div { width: 82%; height: 82%; border-radius: 50%; background: var(--card); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 30px; letter-spacing: -.03em; display: block; line-height: 1; }
.ring.sm { width: 52px; height: 52px; } .ring.sm b { font-size: 14px; }
.dark .ring > div { background: var(--ink); } .dark .ring { background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255,255,255,.15) 0); }
.stat { display: flex; flex-direction: column; gap: 2px; } .stat b { font-size: 28px; letter-spacing: -.03em; line-height: 1; }

/* ===== Герой ===== */
.hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.hero .grow { flex: 1; min-width: 240px; }
.hello { margin: 24px 4px 4px; }

/* ===== Темы ===== */
.topic-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-m); background: var(--card); cursor: pointer; transition: .15s var(--ease); border: 1px solid #fff; }
.topic-row:hover { box-shadow: var(--shadow); transform: translateX(2px); }
.topic-ico { width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--bg); display: grid; place-items: center; font-size: 22px; }
.topic-row .t { flex: 1; min-width: 0; } .topic-row .t b { display: block; font-weight: 500; }
.topic-row .t span { font-size: 13px; color: var(--ink-2); }
.topic-row .lvl { width: 120px; flex: none; }
.topic-row .t span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) {
  .topic-row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; column-gap: 12px; row-gap: 10px; align-items: start; padding: 14px; }
  .topic-row > .topic-ico { grid-row: 1 / span 2; }
  .topic-row > .tag { justify-self: end; }
  .topic-row > .lvl { grid-column: 2 / 4; width: auto; display: flex; align-items: center; gap: 10px; }
  .topic-row > .lvl .bar { flex: 1; }
  .topic-row > .lvl .tiny { margin: 0 !important; min-width: 34px; }
  .topic-row:not(:has(.lvl)) > .topic-ico { grid-row: auto; }
}
/* метки в шапке вопроса не должны вылезать за карточку */
.qcard .tag { white-space: normal; text-align: left; }

.layer-block { margin-top: 26px; }
.layer-title { display: flex; align-items: center; gap: 10px; margin: 0 4px 10px; }
.layer-title h3 { font-size: 22px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ===== Карта знаний ===== */
.kmap { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kmap-layer { background: var(--card); border-radius: var(--r-l); padding: 18px; box-shadow: var(--shadow); }
.kmap-layer header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.kmap-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.tile { aspect-ratio: 1; border-radius: 18px; display: flex; flex-direction: column; justify-content: space-between; padding: 8px; cursor: pointer;
  font-size: 11px; line-height: 1.1; font-weight: 500; transition: transform .15s var(--ease); position: relative; overflow: hidden; color: var(--ink); }
.tile:hover { transform: scale(1.06); z-index: 2; }
.tile b { font-size: 16px; letter-spacing: -.02em; }
.tile.l0 { background: var(--bg); color: var(--ink-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 5px; vertical-align: -2px; margin-right: 6px; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 14px; font-size: 13px; max-width: 260px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ===== Карточка урока ===== */
.lesson { max-width: 760px; margin: 0 auto; }
.lesson-top { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; }
.back { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); display: grid; place-items: center; font-size: 20px; box-shadow: var(--shadow); flex: none; }
.dots { display: flex; gap: 4px; flex: 1; } .dots i { height: 4px; flex: 1; border-radius: 4px; background: var(--ink-3); transition: background .3s; }
.dots i.on { background: var(--ink); }
.lcard { background: var(--card); border-radius: var(--r-xl); padding: 28px; box-shadow: var(--shadow); animation: pageIn .35s var(--ease); }
@media (max-width: 520px) { .lcard { padding: 20px; border-radius: var(--r-l); } }
.lcard h2 { margin-bottom: 14px; }
.lcard .body { font-size: 17px; } .lcard .body ul, .lcard .body ol { padding-left: 1.2em; margin: 0 0 .8em; } .lcard .body li { margin: .25em 0; }
.figure { margin: 18px -8px; border-radius: var(--r-l); background: linear-gradient(180deg,#F7FAFF,#EEF3FB); padding: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(44,107,255,.06); }
.figure svg { border-radius: 22px; }
.figure svg { width: 100%; height: auto; display: block; font-family: var(--font); }
.keypoints { background: var(--bg); border-radius: var(--r-m); padding: 16px 18px; margin-top: 16px; }
.keypoints h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.keypoints ul { margin: 0; padding-left: 1.1em; } .keypoints li { margin: 4px 0; }
.mnemo { margin-top: 12px; border-radius: var(--r-m); padding: 14px 18px; background: var(--accent-soft); color: #173e9e; font-weight: 500; }
.mnemo::before { content: "💡 "; }
.update { margin-top: 12px; border-radius: var(--r-m); padding: 14px 18px; background: var(--warn-soft); font-size: 15px; }
.update b { display: block; margin-bottom: 4px; }
.update .was { text-decoration: line-through; color: var(--ink-2); }

/* ===== Анимации ===== */
.anim { margin: 18px -8px; border-radius: var(--r-m); background: var(--bg); padding: 14px; }
.anim-controls { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.anim-caption { font-size: 15px; color: var(--ink); background: var(--card); border-radius: var(--r-s); padding: 10px 14px; margin: 8px 0 0; min-height: 3em; }
.anim svg { width: 100%; height: auto; display: block; }
.anim-badge { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }

/* ===== Квиз ===== */
.quiz { max-width: 720px; margin: 0 auto; }
.qcard { background: var(--card); border-radius: var(--r-xl); padding: 28px; box-shadow: var(--shadow); animation: pageIn .3s var(--ease); }
@media (max-width: 520px) { .qcard { padding: 20px; border-radius: var(--r-l); } }
.qtext { font-size: 21px; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; margin: 8px 0 18px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; border: 1.5px solid var(--line); background: var(--bg); border-radius: var(--r-m); padding: 14px 16px; font-size: 16px; display: flex; gap: 12px; align-items: flex-start; transition: .15s var(--ease); }
.opt:hover:not([disabled]) { border-color: var(--ink); background: #fff; }
.opt .k { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 1.5px solid var(--ink-3); display: grid; place-items: center; font-size: 13px; font-weight: 600; background: #fff; }
.opt.sel { border-color: var(--accent); background: #fff; } .opt.sel .k { background: var(--accent); color: #fff; border-color: var(--accent); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); } .opt.right .k { background: var(--ok); color: #fff; border-color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); } .opt.wrong .k { background: var(--bad); color: #fff; border-color: var(--bad); }
.opt[disabled] { cursor: default; }
.feedback { margin-top: 16px; border-radius: var(--r-m); padding: 16px 18px; animation: pageIn .3s var(--ease); }
.feedback.ok { background: var(--ok-soft); } .feedback.bad { background: var(--bad-soft); }
.feedback h4 { margin: 0 0 6px; font-size: 17px; }
.inline-card { margin-top: 14px; border: 1.5px solid var(--line); border-radius: var(--r-l); padding: 18px; background: #fff; }
.inline-card .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; }
.ai-box { margin-top: 12px; border-radius: var(--r-m); padding: 14px 18px; background: var(--accent-soft); font-size: 16px; }
.ai-box .lbl { color: var(--accent); font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.qbar { display: flex; gap: 12px; align-items: center; margin: 20px 0 14px; }
.qbar .bar { flex: 1; }
.result-hero { text-align: center; padding: 40px 24px; }
.big-num { font-size: 72px; font-weight: 600; letter-spacing: -.05em; line-height: 1; }

/* ===== Онбординг ===== */
.onb { max-width: 720px; margin: 0 auto; padding-top: 30px; }
.self-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.self-row:first-child { border-top: 0; }
.self-row .t { flex: 1; min-width: 200px; } .self-row .t b { font-weight: 500; display: block; } .self-row .t span { font-size: 13px; color: var(--ink-2); }
.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg button.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.field input, .field select, textarea { font: inherit; border: 1.5px solid var(--line); background: var(--bg); border-radius: var(--r-s); padding: 13px 16px; outline: none; color: var(--ink); }
.field input:focus, textarea:focus { border-color: var(--ink); background: #fff; }

/* ===== Графики ===== */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 12px; fill: var(--ink-2); }

/* ===== Чат ===== */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 12px 16px; border-radius: 22px; font-size: 16px; animation: pageIn .25s var(--ease); }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 8px; }
.msg.ai { align-self: flex-start; background: var(--card); border-bottom-left-radius: 8px; box-shadow: var(--shadow); }
.msg p:last-child { margin: 0; }
.composer { display: flex; gap: 8px; position: sticky; bottom: 84px; background: var(--card); padding: 8px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.1); margin-top: 16px; }
@media (min-width: 761px) { .composer { bottom: 16px; } }
.composer input { flex: 1; border: 0; outline: none; font: inherit; padding: 0 14px; background: transparent; }
.typing::after { content: "…"; animation: blink 1s infinite; } @keyframes blink { 50% { opacity: .2; } }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; z-index: 200; font-size: 15px; animation: pageIn .3s var(--ease); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ===== Светлые акценты вместо чёрных плашек ===== */
.card.tint { background: var(--accent-soft); border-color: var(--accent-soft); box-shadow: none; }
.onb-hello { text-align: center; max-width: 520px; margin: 8vh auto 0; }
.onb-hello .wave { font-size: 52px; animation: wave 1.6s var(--ease) 1; transform-origin: 70% 70%; }
@keyframes wave { 0%,100% { transform: rotate(0) } 20% { transform: rotate(16deg) } 40% { transform: rotate(-8deg) } 60% { transform: rotate(12deg) } }
.big-input { font-size: 22px !important; text-align: center; padding: 18px !important; border-radius: 22px !important; }
.steps3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 20px 0; }
.steps3 > div { background: var(--bg); border-radius: var(--r-m); padding: 14px 16px; }
.steps3 span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.steps3 b { display: block; font-weight: 500; }

/* ===== UX-ревью: экран ошибки, диагностика, самооценка, доступность ===== */
#fb { scroll-margin-top: 90px; }
.opt.dim { opacity: .5; }
.opt.right .k, .opt.wrong .k { font-size: 0; }
.opt.right .k::after { content: "✓"; font-size: 15px; }
.opt.wrong .k::after { content: "✕"; font-size: 13px; }
.feedback.neutral { background: var(--bg); }
.feedback h4 { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.fb-right { font-size: 18px; font-weight: 500; line-height: 1.35; }
.fb-block { margin-top: 10px; padding: 16px 18px; border-radius: var(--r-m); background: var(--bg); }
.fb-block .lbl, .fb-more summary { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
.fb-block p:last-child { margin-bottom: 0; }
.fb-why-wrong { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.fb-keys { margin: 0; padding-left: 1.1em; } .fb-keys li { margin: 4px 0; }
.fb-more { margin-top: 10px; }
.fb-more summary { cursor: pointer; list-style: none; display: flex; align-items: center; min-height: 44px; padding: 0 4px; margin: 0; }
.fb-more summary::-webkit-details-marker { display: none; }
.fb-more summary::after { content: "↓"; margin-left: 8px; } .fb-more[open] summary::after { content: "↑"; }
.fb-retry { margin: 12px 4px 0; }
.qnext { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5; margin-top: 16px;
  padding-top: 18px; background: linear-gradient(to bottom, transparent, var(--card) 45%); }
.diag-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 22px; }
.diag-split > div { background: var(--bg); border-radius: var(--r-m); padding: 14px 8px; }
.diag-split b { display: block; font-size: 30px; letter-spacing: -.03em; line-height: 1; }
.diag-split span { font-size: 13px; color: var(--ink-2); }
.self-card { min-height: 420px; display: flex; flex-direction: column; }
.self-ico { font-size: 44px; line-height: 1; margin-bottom: 14px; }
.self-q { font-size: 19px; line-height: 1.35; margin: 14px 0 0; font-weight: 500; }
.self-opts { display: grid; gap: 8px; margin-top: auto; padding-top: 22px; }
.self-opt { display: flex; gap: 14px; align-items: center; text-align: left; min-height: 60px; padding: 12px 18px;
  border-radius: var(--r-m); border: 1.5px solid var(--line); background: var(--bg); font-size: 17px; transition: .15s var(--ease); }
.self-opt:hover { border-color: var(--ink); background: #fff; }
.self-opt:active { transform: scale(.98); }
.self-opt .k { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 1.5px solid var(--ink-3); display: grid; place-items: center; font-size: 13px; font-weight: 600; background: #fff; }
.self-opt b { font-weight: 500; display: block; } .self-opt small { display: block; font-size: 13px; color: var(--ink-2); }
.back[disabled] { opacity: .3; pointer-events: none; }
.linkbtn { border: 0; background: none; color: var(--ink-2); text-decoration: underline; font-size: inherit; min-height: 44px; padding: 0 8px; }
@media (min-width: 640px) { .self-opts { grid-template-columns: repeat(3, 1fr); } .self-opt { flex-direction: column; align-items: flex-start; min-height: 96px; } }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
.opt:focus-visible, .self-opt:focus-visible, .tile:focus-visible, .topic-row:focus-visible { outline-offset: 3px; }
.qbar .bar, .bar { background: rgba(11,11,12,.08); }      /* дорожка прогресса была цвета фона страницы — невидима */
.seg button, .chip { min-height: 44px; }                   /* было ~32–34px */
.btn.sm { min-height: 44px; }

.self-card .tag, .lcard > .tag { align-self: flex-start; }

/* ===== Адаптивная модель v2 + UX P1: карта, динамика, итог, «Сегодня», доступность ===== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a.topic-row { text-decoration: none; color: inherit; }
.topic-row .lvl .pct { margin-top: 4px; text-align: right; }
.chip.is-active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); } /* без чёрных плашек */
.chip { text-decoration: none; }
.card.tint-soft { background: var(--accent-soft); border-color: var(--accent-soft); box-shadow: none; }
.train { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.pace { box-shadow: none; background: var(--accent-soft); border-color: var(--accent-soft); padding: 16px 20px; }
.pace.late { background: var(--warn-soft); border-color: var(--warn-soft); }

/* недельная цель: 7 точек Пн–Вс */
.week { display: flex; gap: 6px; margin-top: 12px; }
.week .wd { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.week .wd i { width: 22px; height: 22px; border-radius: 50%; background: rgba(11,11,12,.07); display: block; }
.week .wd.on i { background: var(--accent); }
.week .wd.now i { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.week .wd small { font-size: 11px; color: var(--ink-2); }

/* вопрос «Уверен / Сомневаюсь» */
.conf { display: flex; flex-direction: column; gap: 8px; }
.fb-danger { margin: 10px 0 0; font-size: 15px; }
.fb-mc { background: var(--warn-soft); }
.kbd-hint { margin: 12px 0 0; }
@media (hover: none), (max-width: 760px) { .kbd-hint { display: none; } }

/* свой диалог вместо confirm() */
.sheet-wrap { position: fixed; inset: 0; z-index: 300; background: rgba(11,11,12,.32); display: flex; align-items: flex-end; justify-content: center; padding: 16px; animation: pageIn .2s var(--ease); }
.sheet { background: var(--card); border-radius: var(--r-l); padding: 24px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.2); margin-bottom: env(safe-area-inset-bottom); }
.sheet-acts { display: grid; gap: 8px; margin-top: 18px; }
@media (min-width: 761px) { .sheet-wrap { align-items: center; } }

/* карта знаний: сводка + три статуса заливкой */
.segbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: rgba(11,11,12,.06); }
.segbar i { display: block; min-width: 6px; }
.seglegend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.seglegend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.seglegend b { color: var(--ink); font-weight: 600; }
.segbar .s-done, .seglegend .s-done { background: var(--ok); }
.segbar .s-close, .seglegend .s-close { background: var(--warn); }
.segbar .s-weak, .seglegend .s-weak { background: var(--bad); }
.segbar .s-new, .seglegend .s-new { background: rgba(11,11,12,.18); }
.kmap-tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tile { aspect-ratio: auto; min-height: 96px; text-decoration: none; color: var(--ink); gap: 6px; border: 1.5px solid transparent; }
.tile.s-done { background: var(--ok-soft); } .tile.s-close { background: var(--warn-soft); }
.tile.s-weak { background: var(--bad-soft); } .tile.s-new { background: transparent; border: 1.5px dashed var(--ink-3); }
.tile-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.tile-top b { font-size: 16px; }
.tile-name { font-size: 12px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-st { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: var(--ink-2); }
.tile.s-done .tile-st { color: #0f7a37; } .tile.s-close .tile-st { color: #a65a00; } .tile.s-weak .tile-st { color: #c0241b; }
.only-narrow { display: none; }
@media (max-width: 600px) { .only-wide { display: none; } .only-narrow { display: flex; } }

/* полосы по разделам (вместо радара на телефоне, рост за неделю) */
.lbar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(60px, 1fr) 44px; align-items: center; gap: 4px 10px; font-size: 14px; }
.lbar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbar > b { text-align: right; font-weight: 600; }
.lbar > small { grid-column: 2 / 4; font-size: 12px; color: var(--ink-2); margin-top: -2px; }
.lbar > small.down { color: #c0241b; } .lbar > small.up { color: #0f7a37; }
@media (min-width: 601px) { .lbar { grid-template-columns: minmax(0, 220px) 1fr 44px 64px; } .lbar > small { grid-column: auto; margin: 0; text-align: right; } }

/* динамика */
.cool-row, .mc-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.cool-row:first-child, .mc-row:first-child { border-top: 0; }
.cool-row .grow, .mc-row > span { flex: 1; min-width: 0; text-decoration: none; }
.cool-row b { font-weight: 500; }
.act { display: flex; gap: 8px; margin-top: 8px; }
.act-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; font-size: 11px; color: var(--ink-2); }
.act-days span { line-height: 1; display: flex; align-items: center; }
.act-grid { display: grid; grid-template-rows: repeat(7, minmax(14px, 22px)); grid-auto-flow: column; grid-auto-columns: minmax(14px, 22px); gap: 4px; }
.act-grid i { border-radius: 5px; background: rgba(11,11,12,.06); }
.act-grid i.on { background: var(--accent); }
.act-grid i.now { box-shadow: inset 0 0 0 2px var(--accent); }
.act-grid i.fut { background: transparent; border: 1px dashed var(--line); }
.chart text { font-size: inherit; }
.expert summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
@media (max-width: 600px) { .card { padding: 18px; } .card.xl { padding: 24px; } }
.tile-top > span { font-size: 18px; line-height: 1; }
.cool-row .grow b, .cool-row .grow span { display: block; }
.cool-row .btn { flex: none; }
@media (max-width: 600px) {
  .stats3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stats3 .card { padding: 14px 12px; border-radius: var(--r-m); }
  .stats3 .stat b { font-size: 22px; }
  .stats3 .stat span { font-size: 12px; line-height: 1.25; }
}

/* превью темы на шаге самооценки */
.self-preview { margin: 14px 0 4px; }
.self-preview svg { max-height: 260px; }
.self-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.self-topics .tag { white-space: normal; font-weight: 500; }

/* Personal memory aids and assessment controls. */
.memory { margin-top: 18px; padding: 18px; border: 1.5px solid var(--line); border-radius: var(--r-m); }
.memory summary { cursor: pointer; font-weight: 600; min-height: 44px; display: list-item; padding: 8px 0; }
.memory p { margin: 10px 0; }
.memory label { display: block; margin-top: 16px; }
.memory textarea { width: 100%; min-height: 90px; resize: vertical; font: inherit; padding: 12px; border: 1.5px solid var(--ink-3); border-radius: 12px; background: var(--card); color: var(--ink); margin: 6px 0 12px; }
.memory-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.exam-clock { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 58px; white-space: nowrap; }
.exam-review { padding: 18px 0; border-bottom: 1px solid var(--line); }
.exam-review h4 { margin: 0 0 10px; }
.resume { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; }
.resume p { margin: 8px 0 0; }
@media (max-width: 400px) { .qbar { flex-wrap: wrap; } .qbar .bar { flex-basis: 40%; } }

/* Long Russian titles and keyboard controls stay usable at 320 CSS px / zoom. */
.memory, .qcard, .lcard, .hero .grow, .resume > div { min-width: 0; overflow-wrap: anywhere; }
.memory .chip { white-space: normal; text-align: left; }
.exam-review h4, .qtext { overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ===== Визуальные мнемоники (docs/MNEMONICS.md): крупный образ, миниатюры вариантов, «ваш образ» ===== */
.memory[open] > summary { margin-bottom: 6px; }
.mn-hero { margin: 4px 0 0; }
.mn-pic { border-radius: var(--r-m); background: linear-gradient(180deg,#F7FAFF,#EEF3FB); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(44,107,255,.08); }
.mn-pic svg { display: block; width: 100%; height: auto; font-family: var(--font); }
figure.mn-hero figcaption { margin-top: 10px; font-weight: 600; font-size: 17px; line-height: 1.35; color: var(--ink); }
.mn-textcard { border-radius: var(--r-m); padding: 14px 16px; background: var(--accent-soft); color: #173e9e; }
.mn-textcard p { margin: 6px 0 0; } .mn-textcard .mn-cap { font-weight: 600; font-size: 17px; color: var(--ink); }
.mn-textcard .mn-md p { margin: 6px 0 0; } .mn-textcard .mn-md ul, .mn-textcard .mn-md ol { margin: 6px 0 0; padding-left: 1.2em; }
.mn-kind { display: inline-block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-right: 6px; }
.mn-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 4px; }
.mn-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.mn-thumb { display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: inherit; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-s, 12px); padding: 8px; min-height: 44px; cursor: pointer; min-width: 0; }
.mn-thumb:hover { border-color: var(--accent); } .mn-thumb.is-pinned { border-color: var(--ok); }
.mn-thumb .mn-pic { border-radius: 10px; }
.mn-thumb-text { display: block; font-size: 14px; line-height: 1.35; background: var(--accent-soft); color: #173e9e; border-radius: 10px; padding: 8px 10px; flex: 1; overflow-wrap: anywhere; }
.mn-thumb-text .mn-kind { display: block; font-size: 11px; margin-bottom: 2px; }
.mn-clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.mn-thumb-cap { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.mn-thumb-cap .mn-kind { display: block; font-size: 11px; margin-bottom: 2px; }
.mn-own { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.mn-own textarea { min-height: 64px; }
.mn-mini { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 8px; border-radius: var(--r-m); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.mn-mini .mn-pic { width: 120px; flex: none; border-radius: 10px; }
.mn-mini-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; font-size: 22px; background: var(--accent-soft); border-radius: 10px; }
.mn-mini-t { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; } .mn-mini-t b { font-weight: 600; line-height: 1.3; }
.fb-remember .mn-hero { margin-bottom: 10px; }
@media (max-width: 420px) { .mn-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mn-mini .mn-pic { width: 96px; } }

/* ===== Глоссарий: термин в тексте, поповер, экран «Словарь» ===== */
.gl-term { text-decoration: underline dotted; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: var(--accent); cursor: help; border-radius: 4px; }
.gl-term:hover, .gl-term[aria-expanded="true"] { background: var(--accent-soft); }
.gl-term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gl-pop { position: absolute; z-index: 120; background: var(--card); color: var(--ink); border-radius: var(--r-s); padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18), 0 0 0 1px var(--line); font-size: 15px; line-height: 1.4; max-height: 70vh; overflow: auto; overflow-wrap: anywhere; }
.gl-pop[hidden] { display: none; }
.gl-pop p { margin: 6px 0 0; } .gl-pop .gl-long { margin-top: 6px; } .gl-pop .gl-long p { margin: 6px 0 0; }
.gl-pop .linkbtn { min-height: 32px; }
.gl-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.gl-row { margin: 10px 0 0; }
.gl-search input { width: 100%; }
.gl-entry { background: var(--card); border-radius: var(--r-s); padding: 10px 14px; box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; }
.gl-entry summary { cursor: pointer; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.gl-entry .gl-long p { margin: 8px 0 0; }
/* значки обозначений судов рядом с терминами (огни ночью + знаки днём) */
.gl-sig { display: inline-flex; vertical-align: middle; margin: -6px 3px -6px 5px; padding: 3px 4px; border-radius: 6px; background: #fff; box-shadow: 0 0 0 1px var(--line); line-height: 0; }
.gl-sig svg { width: auto; }
.gl-sigbig { display: flex; gap: 12px; align-items: center; margin: 8px 0; padding: 8px 10px; background: var(--bg); border-radius: 12px; }
.gl-sigbig svg { height: auto; max-height: 72px; width: auto; }
/* поиск по курсу */
.search-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 8px 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 15px; min-height: 40px; }
.search-btn:hover { color: var(--ink); }
.topbar-in .nav { margin-left: 8px; }
@media (max-width: 760px) { .search-btn-t { display: none; } .search-btn { padding: 8px 12px; } }
.search-field input { font-size: 18px; }
.search-hit .t b { font-weight: 500; }
.search-snip { display: block; margin-top: 4px; font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.search mark { background: #FFF1B8; color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- онлайн-режим: вход, аккаунт, кабинет администратора ---------- */
.auth-card { max-width: 480px; margin: 0 auto; }
.auth-err { color: #c0241b; font-size: 14px; min-height: 1.2em; margin: 0 0 8px; }
.auth-note { background: var(--accent-soft); color: #173e9e; border-radius: var(--r-s); padding: 12px 14px; font-size: 15px; margin-top: 12px; }
.viewas-bar { position: sticky; top: 0; z-index: 60; background: #FFF4D6; color: #6b4a00; padding: 10px 16px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.adm-h { font-size: 20px; margin: 26px 0 10px; }
.adm-user { margin-bottom: 12px; padding: 18px 20px; }
.adm-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.adm-ready { display: flex; flex-direction: column; align-items: flex-end; } .adm-ready b { font-size: 26px; line-height: 1; }
.adm-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--ink-2); }
.adm-act { margin-top: 12px; gap: 8px; flex-wrap: wrap; }

/* Логотипы на экране входа */
.auth-logos { display: flex; align-items: center; justify-content: center; gap: 28px; margin: 0 0 18px; }
.auth-logos img:first-child { width: 112px; height: 112px; }
.auth-logos img:last-child { width: 150px; height: auto; }
