/* Синапс — «энцефалограмма»: миллиметровка, чернила, алый самописец. */
:root {
  --bg: #e8ede7;          /* миллиметровка */
  --paper: #f7f9f5;       /* лист */
  --grid: #d6ded5;
  --grid-2: #c6d1c6;
  --ink: #0e2019;         /* чернила */
  --ink-2: #2c4238;
  --muted: #5d7167;
  --dim: #8a9b91;
  --line: #cbd5cb;
  --line-2: #a9b8ac;
  --accent: #e5401d;      /* алый самописец */
  --accent-ink: #ffffff;
  --accent-soft: #fbe4dc;
  --accent-2: #c5320f;
  --mint: #1f7a5a;        /* зелёный сигнал */
  --amber: #b98100;
  --bad: #c62828;
  --ok: #1f7a5a;
  --code-bg: #0e2019;

  --radius: 6px;
  --radius-sm: 5px;
  --shadow-1: 0 1px 0 rgba(14, 32, 25, .06);
  --shadow-2: 0 18px 40px -22px rgba(14, 32, 25, .35);
  --display: 'Jura', 'IBM Plex Sans', system-ui, sans-serif;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: rgba(229, 64, 29, .2); }
.hidden { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }
.num { font-variant-numeric: tabular-nums; }

/* ── Кнопки и поля ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--ink); background: transparent;
  font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .12s var(--ease), box-shadow .15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 3px 3px 0 var(--ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; box-shadow: 1px 1px 0 var(--ink); transform: translate(2px, 2px); }
.btn-primary:active { box-shadow: 0 0 0 var(--ink); transform: translate(3px, 3px); }
.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(14, 32, 25, .07); color: var(--ink); border-color: transparent; }
.btn-lg { padding: 14px 22px; font-size: 16px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--bad); }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid; border-color: var(--accent-ink) var(--accent-ink) var(--accent-ink) transparent; animation: spin .7s linear infinite; }
.btn:not(.btn-primary).loading::after { border-color: var(--ink) var(--ink) var(--ink) transparent; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--paper);
  border: 1px solid var(--line-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(229, 64, 29, .18); }
.input::placeholder { color: var(--dim); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.5; }
.err { color: var(--bad); font-size: 13.5px; min-height: 18px; margin: -4px 0 8px; }
.shake { animation: shake .4s; }

/* ══ Лендинг ══ */
#landing {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-2) 1px, transparent 1px), linear-gradient(90deg, var(--grid-2) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
}
.top { position: sticky; top: 0; z-index: 30; background: rgba(232, 237, 231, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--ink); }
.top .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .01em; text-transform: lowercase; }
.logo-mark { width: 34px; height: 22px; flex: none; }
.nav { display: flex; gap: 2px; margin-left: 18px; }
.nav a { padding: 6px 12px; color: var(--ink-2); font-weight: 500; font-size: 14.5px; text-decoration: none; border-radius: 4px; }
.nav a:hover { background: rgba(14, 32, 25, .07); color: var(--ink); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* первый экран */
.hero { padding-top: 40px; padding-bottom: 72px; }
.status { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); margin: 0 0 20px; padding: 6px 12px 6px 10px; border: 1px solid var(--ink); border-radius: 999px; background: var(--paper); }
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(31, 122, 90, .18); flex: none; animation: led 1.8s ease-in-out infinite; }
.hero-title {
  font-family: var(--display); font-weight: 700; font-size: clamp(40px, 6.2vw, 86px); line-height: .96; letter-spacing: -.02em;
  margin: 0;
}
.hero-title .ln { display: block; overflow: hidden; padding-bottom: .06em; }
.hero-title .ln > span { display: inline-block; transform: translateY(105%); }
.ready .hero-title .ln > span { animation: lineUp .9s var(--ease) forwards; }
.ready .hero-title .ln:nth-child(2) > span { animation-delay: .09s; }
.hero-sub { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; margin-top: 18px; }
.hero .lead { font-size: 18.5px; color: var(--ink-2); max-width: 50ch; margin: 0; }
.hero-sub .btn { align-self: end; }

/* лента самописца */
.tape { position: relative; height: 112px; margin: 26px 0 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); background: rgba(247, 249, 245, .55); }
.tape::before, .tape::after {
  content: ''; position: absolute; left: 0; right: 0; height: 9px; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 24px), repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 120px);
  background-size: 100% 5px, 100% 9px; background-repeat: no-repeat;
}
.tape::before { top: 0; }
.tape::after { bottom: 0; transform: scaleY(-1); }
.tape canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tape-label { position: absolute; left: 0; bottom: -26px; font-size: 12.5px; color: var(--muted); }
.tape-label b { color: var(--accent); font-weight: 600; }

/* консоль: вопрос + каналы */
.console { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 22px; margin-top: 40px; align-items: start; }
.plate { position: relative; background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius); }
/* метки совмещения по углам */
.plate::before, .plate::after {
  content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border-color: var(--accent); border-style: solid;
}
.plate::before { top: -7px; left: -7px; border-width: 2px 0 0 2px; }
.plate::after { bottom: -7px; right: -7px; border-width: 0 2px 2px 0; }
.plate-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.plate-head h2 { white-space: nowrap; }
.plate-head h2 { font-family: var(--display); font-weight: 700; font-size: 20px; margin: 0; letter-spacing: .01em; }
.plate-head span { font-size: 13px; color: var(--muted); }

.ask-form { padding: 16px 18px 18px; }
.ask-form textarea {
  width: 100%; min-height: 108px; max-height: 260px; resize: none; border: 0; outline: none; background: none; padding: 0;
  font-size: 18px; line-height: 1.5; color: var(--ink);
}
.ask-form textarea::placeholder { color: var(--dim); }
.ask-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.ask-meta { font-size: 13px; color: var(--muted); }
.ask-meta .over { color: var(--bad); font-weight: 600; }
.ask-ideas { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 16px; }
.ask-ideas button { border: 1px solid var(--line-2); background: transparent; border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s; }
.ask-ideas button:hover { border-color: var(--ink); background: #fff; }
.answer { border-top: 1px solid var(--ink); padding: 18px; animation: fadeUp .35s var(--ease); }
.answer-who { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.answer .body { font-size: 16px; line-height: 1.65; }
.answer.streaming .body > :last-child::after { content: ''; display: inline-block; width: 8px; height: 1.05em; background: var(--accent); vertical-align: -2px; margin-left: 3px; animation: blink 1s steps(1) infinite; }
.answer-cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; background: var(--accent-soft); border-radius: var(--radius-sm); font-size: 14.5px; color: var(--ink-2); animation: fadeUp .4s var(--ease); }
.answer-cta b { color: var(--ink); }
.answer .msg-err { margin-top: 10px; }

.channels-list { list-style: none; margin: 0; padding: 6px 0; }
.ch { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 18px; transition: background .2s; }
.ch + .ch { border-top: 1px solid var(--line); }
.ch .led { width: 8px; height: 8px; background: var(--line-2); box-shadow: none; animation: none; transition: background .2s, box-shadow .2s; }
.ch.lit { background: rgba(229, 64, 29, .05); }
.ch.lit .led { background: var(--accent); box-shadow: 0 0 0 3px rgba(229, 64, 29, .2), 0 0 10px rgba(229, 64, 29, .6); }
.ch-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ch-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-vendor { grid-column: 2; font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.ch-price { grid-row: 1 / 3; grid-column: 3; text-align: right; font-weight: 600; font-size: 14.5px; }
.ch-price small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.ch-free { font-size: 11px; font-weight: 700; color: var(--mint); border: 1px solid currentColor; border-radius: 3px; padding: 0 5px; flex: none; }
.channels-foot { padding: 12px 18px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-2); flex: none; }
.badge.b-дешёвая { background: rgba(31, 122, 90, .12); color: var(--mint); }
.badge.b-быстрая { background: rgba(185, 129, 0, .13); color: var(--amber); }
.badge.b-флагман { background: var(--ink); color: var(--paper); }

/* секции */
.section { padding-top: 104px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.section h2 { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 4vw, 48px); line-height: 1.02; letter-spacing: -.01em; margin: 0; max-width: 16ch; }
.section-head p { color: var(--muted); margin: 0; max-width: 46ch; }
/* шаги — отметки на одной линии */
.steps { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 2px solid var(--ink); }
.step { position: relative; padding: 30px 28px 0 0; }
.step::before { content: ''; position: absolute; top: -9px; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--ink); }
.step.in::before { background: var(--accent); border-color: var(--accent); transition: background .3s .4s, border-color .3s .4s; }
.step-n { font-family: var(--display); font-weight: 700; font-size: 52px; line-height: 1; color: var(--ink); margin-bottom: 10px; }
.step h3 { margin: 0 0 6px; font-size: 18px; }
.step p { margin: 0; color: var(--ink-2); font-size: 15px; max-width: 32ch; }
.faq { max-width: 860px; }
.faq details { border-bottom: 1px solid var(--ink); }
.faq details:first-of-type { border-top: 1px solid var(--ink); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0; font-weight: 600; font-size: 17.5px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--accent); transition: transform .3s var(--ease); line-height: 1; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 18px; color: var(--ink-2); max-width: 70ch; }
.faq details[open] p { animation: fadeUp .35s var(--ease); }

.cta-band { position: relative; overflow: hidden; margin-top: 104px; background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 48px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.cta-band h2 { color: var(--paper); font-size: clamp(28px, 3.6vw, 42px); max-width: 18ch; }
.cta-band canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .9; }
.cta-band > :not(canvas) { position: relative; }
.cta-band .btn-primary { box-shadow: 3px 3px 0 var(--paper); }

.foot { margin-top: 80px; border-top: 1px solid var(--ink); padding: 26px 0 40px; font-size: 13.5px; color: var(--muted); background: var(--bg); }
.foot .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.foot p { margin: 0; max-width: 60ch; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { text-decoration: none; color: var(--ink-2); }
.foot-links a:hover { color: var(--accent); }

.rv { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.rv.in { opacity: 1; transform: none; }

/* ══ Приложение (чат) ══ */
body.in-app { overflow: hidden; background: var(--paper); }
.app .logo { font-size: 20px; }
.app { display: grid; grid-template-columns: 280px 1fr; height: 100vh; height: 100dvh; }
.side { display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--ink); min-height: 0; }
.side-top { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 12px; }
.side-top .logo { padding: 4px 6px; font-size: 18px; }
.new-chat { justify-content: flex-start; gap: 10px; }
.new-chat svg { width: 18px; height: 18px; }
.chat-list { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.chat-group { font-size: 12px; font-weight: 700; color: var(--dim); padding: 12px 8px 6px; }
.chat-item {
  position: relative; display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; cursor: pointer;
  text-align: left; padding: 9px 10px; border-radius: 10px; font-size: 14.5px; color: var(--ink-2); transition: background .15s;
}
.chat-item:hover { background: rgba(13, 17, 23, .05); }
.chat-item.on { background: var(--paper); box-shadow: inset 3px 0 0 var(--accent); color: var(--ink); font-weight: 600; }
.chat-item .ct { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-item .cx { opacity: 0; border: 0; background: none; cursor: pointer; padding: 2px 4px; border-radius: 6px; color: var(--muted); font-size: 15px; line-height: 1; }
.chat-item:hover .cx, .chat-item.on .cx { opacity: 1; }
.chat-item .cx:hover { background: rgba(13, 17, 23, .08); color: var(--ink); }
.chat-item.enter { animation: slideIn .4s var(--ease); }
.side-empty { color: var(--dim); font-size: 13.5px; padding: 14px 10px; }
.side-bottom { padding: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.bal-card { background: var(--paper); border: 1px solid var(--ink); border-radius: 6px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bal-card small { display: block; font-size: 12px; color: var(--muted); }
.bal-card b { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.bal-card b.low { color: var(--bad); }
.bal-card.bump { animation: bump .5s var(--spring); }
.acct { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; border: 0; background: none; cursor: pointer; width: 100%; text-align: left; position: relative; }
.acct:hover { background: rgba(13, 17, 23, .05); }
.acct-ava { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.acct-mail { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.menu {
  position: absolute; z-index: 40; min-width: 220px; background: var(--paper); border: 1px solid var(--ink); border-radius: 6px;
  box-shadow: var(--shadow-2); padding: 6px; animation: menuIn .18s var(--ease);
}
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; cursor: pointer; border-radius: 9px; font-size: 14.5px; text-decoration: none; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--bg); }
.acct-menu { bottom: calc(100% + 6px); left: 0; right: 0; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.main-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--ink); background: rgba(247, 249, 245, .92); backdrop-filter: blur(8px); position: relative; z-index: 5; }
.burger { display: none; }
.model-btn { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 5px; border: 1px solid var(--ink); background: var(--paper); cursor: pointer; font-weight: 700; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.model-btn:hover { border-color: var(--line-2); box-shadow: var(--shadow-1); }
.model-btn .mb-price { font-weight: 500; font-size: 13px; color: var(--muted); }
.model-btn svg { width: 14px; height: 14px; color: var(--muted); transition: transform .2s; }
.model-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.model-menu { top: calc(100% + 4px); left: 16px; width: min(440px, calc(100vw - 32px)); max-height: min(520px, 70vh); overflow-y: auto; }
.model-menu button { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 12px; }
.model-menu .mm-t { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.model-menu .mm-d { grid-column: 1; font-size: 13px; color: var(--muted); }
.model-menu .mm-p { grid-row: 1 / 3; grid-column: 2; align-self: center; text-align: right; font-size: 13.5px; font-weight: 600; }
.model-menu .mm-p small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.model-menu button.on { background: var(--accent-soft); }
.mode-pill { margin-left: auto; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(245, 165, 36, .15); color: #a86a06; }

.thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.thread-inner { max-width: 780px; margin: 0 auto; padding: 28px 20px 24px; display: flex; flex-direction: column; gap: 26px; }
.msg { display: flex; flex-direction: column; animation: msgIn .4s var(--ease); }
.msg-user { align-items: flex-end; }
.msg-user .bubble { background: var(--bg); color: var(--ink); padding: 11px 16px; border: 1px solid var(--line-2); border-radius: 10px 10px 2px 10px; max-width: 82%; white-space: pre-wrap; word-wrap: break-word; font-size: 15.5px; }
.msg-ai .who { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.who-dot { width: 20px; height: 20px; border-radius: 4px; background: var(--ink); display: grid; place-items: center; }
.who-dot svg { width: 12px; height: 12px; }
.msg-ai .body { font-size: 15.5px; line-height: 1.65; color: var(--ink); word-wrap: break-word; }
.msg-ai .meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; color: var(--dim); min-height: 26px; }
.msg-ai .meta .btn-sm { color: var(--muted); }
.msg-ai.streaming .body > :last-child::after { content: ''; display: inline-block; width: 7px; height: 1.05em; background: var(--accent); vertical-align: -2px; margin-left: 3px; border-radius: 2px; animation: blink 1s steps(1) infinite; }
.msg-err { background: #fff4f4; border: 1px solid #ffd4d6; color: #9d1c20; padding: 10px 14px; border-radius: 12px; font-size: 14.5px; margin-top: 8px; }
.thinking { display: inline-flex; gap: 6px; padding: 8px 0; }
.thinking i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: think 1.2s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; background: #5b74ff; }
.thinking i:nth-child(3) { animation-delay: .3s; background: var(--mint); }

/* Markdown в ответах */
.body p { margin: 0 0 12px; }
.body p:last-child, .body ul:last-child, .body ol:last-child, .body pre:last-child { margin-bottom: 0; }
.body h1, .body h2, .body h3, .body h4 { margin: 18px 0 8px; line-height: 1.3; letter-spacing: -.01em; }
.body h1 { font-size: 22px; } .body h2 { font-size: 19px; } .body h3, .body h4 { font-size: 16.5px; }
.body ul, .body ol { margin: 0 0 12px; padding-left: 22px; }
.body li { margin: 3px 0; }
.body li::marker { color: var(--accent); }
.body a { color: var(--accent); text-underline-offset: 2px; }
.body blockquote { margin: 0 0 12px; padding: 4px 0 4px 14px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.body code { font-family: var(--mono); font-size: .88em; background: #e3eae2; padding: 1px 6px; border-radius: 3px; }
.body hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.body table { border-collapse: collapse; margin: 0 0 12px; font-size: 14.5px; display: block; overflow-x: auto; }
.body th, .body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.body th { background: var(--bg); }
.code { margin: 0 0 12px; border-radius: 6px; overflow: hidden; background: var(--code-bg); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px; background: #183026; color: #9fb8ad; font-size: 12.5px; font-family: var(--mono); }
.code-head button { background: none; border: 0; color: #c4cede; cursor: pointer; font: 600 12.5px var(--font); padding: 4px 8px; border-radius: 6px; }
.code-head button:hover { background: rgba(255, 255, 255, .08); }
.code pre { margin: 0; padding: 14px; overflow-x: auto; }
.code pre code { background: none; padding: 0; color: #e4efe8; font-size: 13.5px; line-height: 1.6; }

/* пустой чат */
.empty-chat { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 20px; gap: 8px; }
.empty-chat h2 { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 3.6vw, 40px); letter-spacing: -.01em; margin: 10px 0 4px; }
.empty-chat p { color: var(--muted); margin: 0 0 18px; }
.orb { width: 64px; height: 64px; }
.orb .o-ring { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: .25; transform-origin: 32px 32px; animation: ring 3s var(--ease) infinite; }
.orb .o-ring:nth-of-type(2) { animation-delay: 1s; }
.orb .o-core { fill: var(--accent); }
.empty-chat .orb { width: 72px; height: 72px; }
.suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 640px; width: 100%; }
.suggest button { text-align: left; padding: 12px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 14.5px; color: var(--ink-2); transition: border-color .15s, transform .2s var(--spring), box-shadow .2s; }
.suggest button:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.suggest button b { display: block; color: var(--ink); font-size: 14.5px; margin-bottom: 2px; }

/* поле ввода */
.composer-wrap { padding: 8px 16px 14px; background: linear-gradient(transparent, var(--paper) 30%); }
.composer {
  max-width: 780px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 16px;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 rgba(14, 32, 25, .12);
  transition: border-color .15s, box-shadow .2s;
}
.composer:focus-within { border-color: var(--ink); box-shadow: 4px 4px 0 var(--accent); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: none; padding: 8px 0; max-height: 240px; line-height: 1.5; font-size: 15.5px; }
.send { width: 40px; height: 40px; border-radius: 5px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; transition: background .15s, transform .2s var(--spring), opacity .2s; }
.send:hover { background: var(--accent-2); }
.send:disabled { opacity: .35; cursor: default; }
.send svg { width: 18px; height: 18px; }
.send .i-stop { display: none; }
.send.stop { background: var(--ink); }
.send.stop .i-send { display: none; }
.send.stop .i-stop { display: block; }
.send:not(:disabled):active { transform: scale(.9); }
.composer-hint { max-width: 780px; margin: 8px auto 0; display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--dim); padding: 0 6px; }
.composer-hint b { color: var(--muted); font-weight: 600; }

/* ── Модальные окна, уведомления ── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(13, 17, 23, .35); backdrop-filter: blur(4px); animation: fade .2s; }
.modal-box { width: 100%; max-width: 420px; background: var(--paper); border: 1px solid var(--ink); border-radius: 8px; padding: 26px; position: relative; box-shadow: 0 30px 80px -20px rgba(16, 24, 40, .4); animation: modalIn .35s var(--spring); max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-box.wide { max-width: 520px; }
.modal-box h2 { margin: 0 0 6px; font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: 0; }
.modal-box .sub { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }
.modal-close { position: absolute; top: 14px; right: 14px; }
.switch { text-align: center; margin-top: 14px; font-size: 14.5px; color: var(--muted); }
.switch button { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; }
.consent { font-size: 12.5px; color: var(--muted); text-align: center; margin: 12px 0 0; }
.consent a { color: var(--ink-2); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.quick button { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; font-weight: 600; font-size: 14px; transition: border-color .15s, background .15s; }
.quick button:hover, .quick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 10px; }
.tabs button { position: relative; background: none; border: 0; cursor: pointer; padding: 9px 10px; font-weight: 700; font-size: 14px; color: var(--muted); }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.hist-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.hist-row:last-child { border-bottom: 0; }
.hist-row small { color: var(--muted); }
.st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.st.paid { background: rgba(18, 161, 80, .1); color: var(--ok); }
.st.created { background: var(--bg); color: var(--muted); }
.st.failed { background: rgba(229, 72, 77, .1); color: var(--bad); }
.empty { color: var(--dim); text-align: center; padding: 18px 0; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 6px; font-weight: 600; font-size: 14.5px; box-shadow: var(--shadow-2); animation: toastIn .4s var(--spring) forwards; max-width: calc(100% - 32px); display: flex; gap: 10px; align-items: center; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.toast.ok::before { background: var(--mint); }
.toast.bad::before { background: var(--bad); }

/* ── Документы ── */
.legal { max-width: 820px; padding-top: 44px; }
.legal-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 26px; flex-wrap: wrap; }
.legal-tabs a { padding: 7px 12px; border-radius: 9px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.legal-tabs a.on { background: var(--accent-soft); color: var(--accent); }
.legal h1 { font-family: var(--display); font-weight: 700; font-size: clamp(32px, 4.6vw, 48px); letter-spacing: -.01em; line-height: 1.1; margin: 0 0 8px; }
.legal-date { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.legal p, .legal li { color: var(--ink-2); max-width: 72ch; }
.legal p { margin: 0 0 13px; }
.legal a { color: var(--accent); }
.legal-list { list-style: none; padding: 0; margin: 30px 0 0; counter-reset: sec; }
.legal-list > li { counter-increment: sec; padding: 24px 0 10px; border-top: 1px solid var(--line); }
.legal-list h2 { display: flex; gap: 12px; align-items: baseline; font-size: 19px; margin: 0 0 12px; color: var(--ink); }
.legal-list h2::before { content: counter(sec); color: var(--accent); font-size: 15px; font-weight: 800; min-width: 24px; }
.legal-list ul { padding-left: 20px; margin: 0 0 13px; }
.fill { background: rgba(245, 165, 36, .16); color: #9a5f04; border-radius: 5px; padding: 0 5px; }
.read-progress { position: fixed; top: 64px; left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: left; transform: scaleX(0); z-index: 31; }

/* ── Кадры ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes lineUp { to { transform: none; } }
@keyframes demoIn { to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px rgba(0, 184, 148, .06); } }
@keyframes think { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
@keyframes ring { 0% { transform: scale(.5); opacity: .5; } 100% { transform: scale(1.1); opacity: 0; } }
@keyframes bump { 40% { transform: scale(1.05); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes menuIn { from { opacity: 0; transform: translateY(4px) scale(.98); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes lmPulse { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translate(14px, -10px); opacity: 0; } }
@keyframes led { 50% { box-shadow: 0 0 0 6px rgba(31, 122, 90, .05); } }

/* ── Адаптив ── */
@media (max-width: 980px) {
  .console { grid-template-columns: 1fr; }
  .hero-sub { grid-template-columns: 1fr; }
  .hero-sub .btn { justify-self: start; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow-2); }
  .app.side-open .side { transform: none; }
  .app.side-open::after { content: ''; position: fixed; inset: 0; background: rgba(14, 32, 25, .35); z-index: 45; animation: fade .2s; }
  .burger { display: inline-flex; }
}
@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; border-top: 0; border-left: 2px solid var(--ink); margin-left: 8px; }
  .step { padding: 0 0 30px 28px; }
  .step::before { top: 4px; left: -9px; }
  .step-n { font-size: 40px; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .nav { display: none; }
  .hero { padding-top: 32px; }
  .hero-sub .btn { display: none; }
  .tape { height: 96px; margin-left: -16px; margin-right: -16px; }
  .tape-label { left: 16px; }
  .ch-name { flex-wrap: wrap; row-gap: 2px; }
  .ch-name span { white-space: normal; }
  .ch { padding: 10px 14px; }
  .status { font-size: 13px; border-radius: 12px; }
  .console { margin-top: 40px; }
  .plate::before, .plate::after { display: none; }
  .ask-form textarea { font-size: 16.5px; min-height: 96px; }
  .ask-row { flex-wrap: wrap; }
  .ask-row .btn { width: 100%; }
  .cta-band { padding: 30px 22px; }
  .suggest { grid-template-columns: 1fr; }
  .suggest button:nth-child(n+3) { display: none; }
  .composer-hint .kbd { display: none; }
  .model-btn .mb-price { display: none; }
  .msg-user .bubble { max-width: 90%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .hero-title .ln > span { transform: none !important; }
  .rv { opacity: 1 !important; transform: none !important; }
}
.acct-wrap { position: relative; }
