/* Дизайн «Леммиум» из макетов автора: спокойный учебник. Бумажный фон, антиква в заголовках и в тексте конспекта,
   один синий акцент, границы вместо теней. Этот файл подключается после style.css и переопределяет его. */
:root {
  --bg: #ECE6D9; --surface: #F6F2E9; --sunken: #E4DDCD;
  --line: #D9D0BF; --line-strong: #C9BEA9;
  --text: #231F1A; --text-2: #5E564B; --text-3: #5E564B;
  --accent: #2D4BB0; --accent-ink: #2D4BB0; --accent-hover: #223B8F; --accent-weak: #DCE1F1; --on-accent: #FFFFFF;
  --ok: #231F1A; --ok-weak: transparent; --warn: #94461A; --warn-fill: #B4561A; --warn-weak: #F3E0CF;
  --side: #E1D9C8; --side-line: #D2C8B5; --side-sunken: #D8CFBC;
  --dot-micro: #9C7A45; --dot-calc: #7D6FA8;
  --ui: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: Literata, Georgia, 'Times New Roman', serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12141B; --surface: #1A1D26; --sunken: #20232E;
  --line: #2A2E3A; --line-strong: #363B4A;
  --text: #ECE6DA; --text-2: #A39E94; --text-3: #A39E94;
  --accent: #8EA4FF; --accent-ink: #8EA4FF; --accent-hover: #AAB9FF; --accent-weak: #1F2640; --on-accent: #0E1120;
  --ok: #ECE6DA; --ok-weak: transparent; --warn: #F0B57E; --warn-fill: #E9A15E; --warn-weak: #2B2018;
  --side: #0D0F15; --side-line: #22252F; --side-sunken: #151821;
  --dot-micro: #B89868; --dot-calc: #9A8FC4;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12141B; --surface: #1A1D26; --sunken: #20232E;
    --line: #2A2E3A; --line-strong: #363B4A;
    --text: #ECE6DA; --text-2: #A39E94; --text-3: #A39E94;
    --accent: #8EA4FF; --accent-ink: #8EA4FF; --accent-hover: #AAB9FF; --accent-weak: #1F2640; --on-accent: #0E1120;
    --ok: #ECE6DA; --ok-weak: transparent; --warn: #F0B57E; --warn-fill: #E9A15E; --warn-weak: #2B2018;
    --side: #0D0F15; --side-line: #22252F; --side-sunken: #151821;
    --dot-micro: #B89868; --dot-calc: #9A8FC4;
    color-scheme: dark;
  }
}

body { font-size: 15px; line-height: 1.5; }

/* Движение. Страницы не «въезжают» блоками при каждом открытии: это и читалось как шаблон.
   Вместо этого браузер плавно перетекает со страницы на страницу, а боковая панель стоит на месте. */
@view-transition { navigation: auto; }
.side { view-transition-name: side; }
.main { view-transition-name: main; }
::view-transition-old(main) { animation: vt-out .14s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(main) { animation: vt-in .22s cubic-bezier(0, 0, .2, 1) .06s both; }
::view-transition-group(side) { animation: none; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(4px); } }
.main > * { animation: none; }
a.cell:hover { transform: none; }
a.resume:hover .resume-go .icon, .btn-lg:hover .icon { transform: translateX(3px); }
.row, .nav-item, .hist-item, .source, a.resume, .card, .ask-chips a { transition-duration: .12s; }
.row:hover { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.btn { transition: background-color .12s var(--ease), border-color .12s var(--ease), transform .08s var(--ease); }
.btn:active { transform: translateY(1px); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(main), ::view-transition-new(main) { animation: none; } }
h1, h2, .resume-title, .view-title, .stat-value, .price-num, .empty-card h2, .card h3, .steps h3, .task > h2 { font-family: var(--serif); font-weight: 500; }
h1 { font-size: 36px; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: 20px; letter-spacing: -.01em; }
.link, .file, .source-title, .resume-go, .solution summary { color: var(--accent-ink); }
.kicker, .toc-title, .chat-label, .sample-kicker { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }

/* Логотип: слово антиквой и квадрат «∎» вместо точки */
.brand { font-family: var(--serif); font-weight: 500; font-size: 22px; letter-spacing: -.02em; display: inline-flex; align-items: baseline; }
.brand i { display: inline-block; width: 6px; height: 6px; margin-left: 4px; background: var(--accent); border-radius: 1.5px; }

/* Боковая панель */
.side { background: var(--side); border-right-color: var(--side-line); }
.nav-item { border-radius: 10px; }
.nav-item:hover { background: var(--side-sunken); }
.nav-item[aria-current] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--side-line); }
.access { border-color: var(--side-line); border-radius: 14px; background: var(--surface); }
.side-foot { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.side-foot .access { margin-top: 0; }
.theme { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 2px; background: var(--side-sunken); border-radius: 10px; }
.theme button { position: relative; height: 32px; border: 0; background: none; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; transition: color .2s var(--ease); }
.theme-pill { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--side-line); transition: transform .2s var(--ease); }
:root[data-theme="dark"] .theme-pill { transform: translateX(100%); }
.theme button[aria-pressed="true"] { color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-pill { transform: translateX(100%); } }

/* Формы: 10 у кнопок и полей, 14 у карточек, 999 у меток */
.btn { border-radius: 10px; height: 40px; padding: 0 16px; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-quiet { border-color: var(--line-strong); }
.search, textarea, .seg, .toc, .formula, .fixes, .report, .files, .trial-about, .table-wrap, .source, .photo { border-radius: 10px; }
.resume, .subject, .rows, .note, .reader-side, .chat-page, .empty-card, .stat, .feed, .solution, .card, .price, .hero-view > div { border-radius: 14px; }
.chip { border-radius: 999px; height: 24px; padding: 0 10px; background: transparent; border: 1px solid var(--line); color: var(--text-2); }
.chip-ok { color: var(--text); border-color: var(--line-strong); }
.chip-warn { background: var(--warn-weak); border-color: transparent; color: var(--warn); }

/* Главная: приветствие и поле вопроса */
.hello { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.hello-meta { color: var(--text-2); font-size: 14px; }
.ask { display: flex; flex-direction: column; gap: 14px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 20px; }
.ask h2 { font-size: 30px; letter-spacing: -.015em; line-height: 1.2; }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; min-width: 0; height: 48px; padding: 0 16px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; outline: none; font-size: 16px; transition: border-color .15s var(--ease); }
.ask-form input:focus { border-color: var(--accent); }
.ask-form .btn { height: 48px; }
.ask-hint { font-size: 13px; color: var(--text-2); }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-chips a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--text-2); transition: border-color .15s var(--ease), color .15s var(--ease); }
.ask-chips a:hover { border-color: var(--line-strong); color: var(--text); }
/* Первый экран главной по макету: по центру, без карточки, с «дышащими» линиями */
:root { --orb-glow: rgba(45, 75, 176, .20); --orb-outer: #2D4BB0; --orb-core: #5C76D6; --orb-mid: #1E3488; }
:root[data-theme="dark"] { --orb-glow: rgba(142, 164, 255, .30); --orb-outer: #6F86F0; --orb-core: #EEF1FF; --orb-mid: #B9C6FF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --orb-glow: rgba(142, 164, 255, .30); --orb-outer: #6F86F0; --orb-core: #EEF1FF; --orb-mid: #B9C6FF; } }
.ask-hero { align-items: center; text-align: center; gap: 20px; padding: 12px 0 28px; background: none; border: 0; }
.ask-hero .ask-hi { font-size: 52px; font-weight: 600; line-height: 1.08; letter-spacing: -.025em; }
.ask-hero .ask-q { font-size: 28px; font-weight: 500; line-height: 1.2; letter-spacing: -.015em; color: var(--text-2); }
.ask-meta { color: var(--text-2); font-size: 15px; margin-top: -8px; }
.ask-hero .orb { margin: -12px 0; }
.ask-hero .ask-form { width: 100%; max-width: 760px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; transition: border-color .15s var(--ease); }
.ask-hero .ask-form:focus-within { border-color: var(--accent); }
.ask-hero .ask-form input { border: 0; background: none; height: 44px; }
.ask-hero .ask-form .btn { height: 44px; }
.ask-hero .ask-chips { justify-content: center; max-width: 860px; }
.orb { position: relative; width: 100%; max-width: 760px; height: 200px; }
.orb svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lm-glow { position: absolute; inset: 0; background: radial-gradient(ellipse 42% 38% at 50% 50%, var(--orb-glow) 0%, transparent 72%); animation: lmGlow 3.6s ease-in-out infinite; }
.orb-outer { stop-color: var(--orb-outer); }
.orb-core { stop-color: var(--orb-core); }
.orb-mid { stroke: var(--orb-mid); }
.lm-a, .lm-b, .lm-c { transform-box: view-box; transform-origin: 400px 100px; }
.lm-a { animation: lmBreathA 3.6s ease-in-out infinite; }
.lm-b { animation: lmBreathB 4.4s ease-in-out infinite; }
.lm-c { animation: lmBreathC 5.2s ease-in-out infinite; }
/* Пока человек печатает вопрос, линии дышат быстрее */
.ask-hero:focus-within .lm-a { animation-duration: 1.8s; }
.ask-hero:focus-within .lm-b { animation-duration: 2.2s; }
.ask-hero:focus-within .lm-c { animation-duration: 2.6s; }
@keyframes lmBreathA { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.45); } }
@keyframes lmBreathB { 0%, 100% { transform: scaleY(.55); } 50% { transform: scaleY(1.2); } }
@keyframes lmBreathC { 0%, 100% { transform: scaleY(.8) scaleX(1); } 50% { transform: scaleY(.35) scaleX(.94); } }
@keyframes lmGlow { 0%, 100% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .lm-a, .lm-b, .lm-c, .lm-glow { animation: none !important; } }
@media (max-width: 860px) {
  .orb { height: 110px; margin: -4px 0; }
  .ask-hero { gap: 14px; padding: 4px 0 20px; }
  .ask-hero .ask-hi { font-size: 32px; }
  .ask-hero .ask-q { font-size: 20px; }
  .ask-hero .ask-form { flex-direction: column; padding: 8px; gap: 8px; }
  .ask-hero .ask-form input { width: 100%; padding: 0 8px; }
  .ask-hero .ask-form .btn { width: 100%; }
  .ask-chips a { max-width: 100%; white-space: normal; height: auto; min-height: 36px; padding: 6px 12px; text-align: left; }
  .resume { flex-direction: column; align-items: flex-start; }
  .resume-go { align-self: stretch; justify-content: center; height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; }
  .block-head { flex-direction: column; align-items: flex-start; }
  .legend { gap: 4px 12px; }
  .cell { min-width: 48px; height: 40px; }
  .note-head { gap: 8px; }
  .focus-btn { display: none; }
  .btn, .nav-item, .tabs a { min-height: 44px; }
  .land .hero h1 { font-size: 34px; }
  .land-nav .btn { height: 40px; }
  .hero-view { padding: 10px; }
  .price { text-align: left; }
}
/* Внутри Telegram у сайта своя шапка не нужна такой высокой, а низ не должен прятаться под панелью приложения */
body.in-tg .main { padding-bottom: 72px; }
body.in-tg .side { position: sticky; top: 0; z-index: 4; }
.verified-line { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.verified-line .icon { width: 14px; height: 14px; }

.resume { padding: 28px; gap: 24px; }
.resume-num, .row-num, .note-num, .step-num, .hero-kicker { color: var(--text-2); }
.resume-title { font-size: 30px; letter-spacing: -.015em; line-height: 1.2; }
.resume-kicker { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.subject-name { display: inline-flex; align-items: center; gap: 8px; font-family: var(--ui); font-weight: 600; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--text-3); }
.dot-micro { background: var(--dot-micro); }
.dot-calc { background: var(--dot-calc); }

/* Карта курса: состояния различаются не только цветом, но и светлотой */
.cell { border-radius: 8px; }
.cell-none { background: transparent; border-color: var(--line-strong); color: var(--text-2); }
.cell-opened { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-ink); }
.cell-ok { background: var(--text); border-color: var(--text); color: var(--surface); }
.cell-no { background: var(--warn-fill); border-color: var(--warn-fill); color: #FFFFFF; }
:root[data-theme="dark"] .cell-no { color: #1A1206; }
.cell-missing { border: 1px dashed var(--line-strong); color: var(--text-3); }

/* Чтение: антиква 18/1.7, строка не длиннее 68 знаков */
.note { padding: 40px 48px 32px; }
.note-head h1 { font-size: 36px; }
.note .prose { font-family: var(--serif); font-size: 18px; line-height: 1.7; max-width: 68ch; }
.note .prose h2 { font-size: 24px; line-height: 1.25; margin: 40px 0 12px; }
.note .prose h3 { font-family: var(--serif); font-weight: 600; font-size: 19px; }
.note .prose table, .note .prose .formula, .fixes .prose, .msg-bot .prose { font-family: var(--ui); }
.note .prose .formula { font-size: 16px; }
.msg-bot .prose, .solution .prose { font-size: 15px; line-height: 1.6; }
.solution .prose { font-family: var(--ui); max-width: none; }
.task .prose { max-width: 72ch; }
.toc a.is-here { color: var(--accent-ink); }
.mark[data-mark="ok"] [data-value="ok"] { color: var(--text); }
.focus-btn { margin-left: auto; }
body.is-focus .side, body.is-focus .reader-side, body.is-focus .crumbs { display: none; }
body.is-focus .shell { display: block; }
body.is-focus .main { max-width: none; }
body.is-focus .reader { display: block; max-width: 860px; margin: 0 auto; }

/* Чат по макету: история слева, шаги поиска над ответом */
.chat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; margin-top: 16px; align-items: start; }
.chat-layout .chat-page { margin-top: 0; }
.hist { display: flex; flex-direction: column; gap: 2px; padding: 16px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; max-height: calc(100vh - 220px); overflow-y: auto; }
.hist-title { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); padding: 0 8px 8px; }
.hist-item { display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 0; background: none; border-radius: 10px; text-align: left; cursor: pointer; transition: background-color .15s var(--ease); }
.hist-item:hover { background: var(--sunken); }
.hist-q { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-meta, .hist-empty { font-size: 12px; color: var(--text-2); }
.hist-empty { padding: 0 8px; }
.steps-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; font-size: 13px; color: var(--text-2); }
.step { display: inline-flex; align-items: center; gap: 6px; animation: rise .2s var(--ease) both; }
.step::before { content: ''; width: 6px; height: 6px; border-radius: 1.5px; background: var(--accent); animation: blink 1s var(--ease) infinite; }
.step.is-done::before { animation: none; background: var(--text-2); }
.step + .step::after { content: none; }
.answer-kicker { display: inline-flex; margin-bottom: 8px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.notice { padding: 12px 16px; margin-bottom: 20px; background: var(--warn-weak); color: var(--warn); border-radius: 10px; font-size: 14px; }
.conn { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.conn > h2 { margin-bottom: 0; }
.conn-row { display: flex; gap: 8px; width: 100%; }
.conn-url { flex: 1; min-width: 0; display: flex; align-items: center; min-height: 40px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; font: 400 13px var(--mono); overflow-wrap: anywhere; }
.conn-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feed code { font: 400 13px var(--mono); }
@media (max-width: 860px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .hist { max-height: 180px; }
  .conn-row { flex-direction: column; }
  .conn-steps { grid-template-columns: minmax(0, 1fr); }
}
.msg-user { background: var(--sunken); border-radius: 14px 14px 4px 14px; }
.stat-value { font-family: var(--mono); font-weight: 400; font-size: 40px; letter-spacing: -.03em; }
th { background: var(--sunken); }
.progress { background: var(--accent); }

/* Лендинг */
.land .hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(38px, 4.6vw, 64px); line-height: 1.05; letter-spacing: -.02em; }
.land .sec h2 { font-size: 36px; }
.fact-num, .price-num { font-family: var(--mono); font-weight: 400; }
/* Меняющееся слово стоит на своей строке вместе с запятой, поэтому остальной заголовок не прыгает */
.roll { display: block; width: max-content; max-width: 100%; color: var(--accent-ink); white-space: nowrap; }
.roll.is-out { animation: roll-out .22s var(--ease) forwards; }
.roll.is-in { animation: roll-in .22s var(--ease); }
@keyframes roll-out { to { opacity: 0; transform: translateY(-.35em); } }
@keyframes roll-in { from { opacity: 0; transform: translateY(.35em); } }

@media (max-width: 860px) {
  h1, .note-head h1 { font-size: 28px; }
  .note { padding: 24px 18px; }
  .note .prose { font-size: 17px; }
  .ask { padding: 20px; }
  .ask h2, .resume-title { font-size: 24px; }
  .ask-form { flex-direction: column; }
  .side-foot { display: none; }
  .side.is-open .side-foot { display: flex; }
  .side.is-open .access { display: flex; }
}
