/* Kira — mini app. Ч/б стиль эмодзи-пака Kira: белый контур, чёрная заливка, пульсирующие точки и ASCII. */

:root {
  --bg: #000;
  --card: #0d0d0d;
  --card-hi: #161616;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #fff;
  --muted: #8c8c8c;
  --dim: #555;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --dots: radial-gradient(circle, rgba(255, 255, 255, 0.16) 1px, transparent 1.6px);
  --safe-top: var(--tg-content-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { font: 400 15px/1.3 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
canvas { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: #fff; color: #000; }

/* Точечная рамка по всему периметру экрана */
.frame-field {
  position: fixed; left: 50%; top: 0; transform: translateX(-50%);
  width: min(480px, 100%); height: 100vh; height: 100dvh;
  pointer-events: none; z-index: 0;
  transition: opacity 0.5s;
}
body.chat-has-messages:not(.screen-settings) .frame-field { opacity: 0.45; }
body.screen-settings .frame-field { opacity: 0.25; }

.app {
  max-width: 480px; margin: 0 auto; position: relative; z-index: 1;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
}
.tg .app { height: var(--tg-viewport-stable-height, 100dvh); }
.screen { display: none; flex-direction: column; }
.screen.is-active { display: flex; flex: 1; min-height: 0; animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Анимированные эмодзи Kira ---------- */
.kemoji { display: inline-block; width: 28px; height: 28px; flex: none; opacity: 0; transition: opacity 0.3s; }
.kemoji.is-ready { opacity: 1; }
.kemoji svg { width: 100% !important; height: 100% !important; }

/* ---------- Общие элементы ---------- */
.icon-btn { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.55); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn--sm { width: 34px; height: 34px; background: none; }
.icon-btn:active { background: #fff; color: #000; }

.model-chip {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  height: 38px; padding: 0 12px 0 14px;
  border-radius: 999px;
  font: 500 13.5px var(--mono);
}
.model-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-chip svg { width: 15px; height: 15px; flex: none; color: var(--muted); }

.card { background: rgba(13, 13, 13, 0.92); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card__label { font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: #fff; }
.card__label::before { content: "▚ "; color: var(--muted); }

.row {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 56px; padding: 10px 16px;
  position: relative;
}
.row:active { background: rgba(255, 255, 255, 0.05); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; border-top: 1px dashed rgba(255, 255, 255, 0.08); }
.row__emoji { width: 32px; height: 32px; }
.row__title { flex: 1 0 auto; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__value { color: var(--muted); font: 400 13px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.row--accent .row__title { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 4px; }
.chev { width: 18px; height: 18px; flex: none; color: var(--dim); }
.soon { padding: 3px 8px; border-radius: 6px; border: 1px dashed var(--line-strong); color: var(--muted); font: 400 11.5px var(--mono); }

.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font: 700 10.5px var(--mono); letter-spacing: 0.08em; background: #fff; color: #000; }

.group-title { font: 700 13px var(--mono); text-transform: uppercase; letter-spacing: 0.14em; padding: 22px 4px 10px; }
.group-title::before { content: "// "; color: var(--muted); }

/* ---------- Чат ---------- */
/* Шапка как в Telegram: плавающие «стеклянные» кнопки, чат прокручивается под ними */
.chat { position: relative; }
.bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-top)) 10px 8px;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar .icon-btn, .bar__pill {
  background: rgba(16, 16, 16, 0.72);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.bar .icon-btn { width: 44px; height: 44px; }
.bar__pill {
  justify-self: center; max-width: 100%; min-width: 0;
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px 0 18px; border-radius: 999px;
}
.bar__pill-text { display: flex; flex-direction: column; align-items: center; min-width: 0; line-height: 1.15; }
.bar__pill-text b { font: 700 14px var(--mono); letter-spacing: 0.04em; }
.bar__pill-text small { max-width: 100%; color: var(--muted); font: 400 11px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__pill svg { width: 15px; height: 15px; flex: none; color: var(--muted); transition: transform 0.3s cubic-bezier(0.2, 1.2, 0.35, 1); }
body.models-open .bar__pill svg { transform: rotate(180deg); }
.chat__scroll {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Сообщения мягко растворяются у краёв скролла */
  padding-top: calc(64px + var(--safe-top));
  -webkit-mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
}
.chat__scroll::-webkit-scrollbar { display: none; }

.chat__empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 24px;
  flex: 1; min-height: 100%;
}
.chat.has-messages .chat__empty { display: none; }
.chat:not(.has-messages) .chat__scroll { overflow: hidden; }
.chat__mascot { position: relative; width: 168px; height: 168px; }
.chat__mascot::before {
  content: ""; position: absolute; inset: 8%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 68%);
  animation: breathe 3.6s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.12); opacity: 0.6; } }
.chat__mascot img { width: 100%; height: 100%; object-fit: contain; }
.chat__hello { margin-top: 18px; font: 700 26px/1.2 var(--mono); letter-spacing: -0.03em; }
.chat__hello-name { display: inline-block; min-height: 1.2em; }
.chat__hello-dim { color: var(--muted); font-weight: 400; }

.messages { display: flex; flex-direction: column; gap: 20px; padding: 8px 16px 24px; }
.msg { animation: rise 0.25s ease both; font-size: 16px; line-height: 1.5; }
.msg--static { animation: none; }
.msg--user { align-self: flex-end; max-width: 82%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg__bubble {
  padding: 10px 15px; border-radius: 20px 20px 4px 20px;
  background: #fff; color: #000;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg__atts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* ---------- Вложения ---------- */
.attachments { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -8px 10px -8px; padding: 0 8px; scroll-padding: 8px; }
.attachments::-webkit-scrollbar { display: none; }
.att {
  position: relative; flex: none;
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 12px 0 8px;
  border-radius: 14px; background: #000; border: 1px solid var(--line-strong);
  animation: att-in 0.32s cubic-bezier(0.2, 1.2, 0.35, 1) both;
}
@keyframes att-in { from { opacity: 0; transform: scale(0.85); } }
.att--image { width: 56px; padding: 0; overflow: hidden; }
.att--image img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.msg__atts .att--image { width: 120px; height: 120px; border-radius: 16px; }
.msg__atts .att--image img { filter: none; }
.att__ext {
  width: 40px; height: 40px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: #fff; color: #000; font: 700 10.5px var(--mono); letter-spacing: 0.04em;
}
.att__info { display: flex; flex-direction: column; min-width: 0; max-width: 150px; }
.att__info b { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att__info small { color: var(--muted); font: 400 11px var(--mono); margin-top: 2px; }
/* Крестик — внутри карточки, чтобы ничего не вылезало за края */
.att__rm {
  width: 24px; height: 24px; flex: none; margin-left: -2px;
  border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.12); color: #fff;
}
.att--image .att__rm { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; margin: 0; background: rgba(0, 0, 0, 0.7); border: 1px solid rgba(255, 255, 255, 0.5); }
.att__rm svg { width: 11px; height: 11px; }

/* Голосовое: кнопка проигрывания, столбики из точек и длительность */
.att--voice { padding-right: 14px; }
.att__play { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #000; }
.att__play svg { width: 16px; height: 16px; }
.att__peaks { display: flex; align-items: center; gap: 1.5px; height: 30px; }
.att__peaks i {
  width: 3px; height: calc(var(--h) * 28px); min-height: 3px; border-radius: 2px;
  background: repeating-linear-gradient(to bottom, #fff 0 3px, transparent 3px 5px);
}
.att.is-playing .att__peaks i { animation: peak-play 0.9s ease-in-out infinite; }
.att.is-playing .att__peaks i:nth-child(odd) { animation-delay: 0.15s; }
@keyframes peak-play { 50% { opacity: 0.4; } }
.att__time { font: 400 12px var(--mono); color: var(--muted); }

/* ---------- Запись голоса ---------- */
.composer.is-recording > textarea,
.composer.is-recording > .composer__row,
.composer.is-recording > .attachments { display: none; }
.recorder { display: flex; flex-direction: column; gap: 10px; animation: rec-in 0.36s cubic-bezier(0.2, 1.2, 0.35, 1) both; }
@keyframes rec-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.recorder__text {
  min-height: 22px; max-height: 66px; overflow: hidden;
  font: 400 15px/1.45 var(--font); color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.recorder__text.has-text { color: #fff; }
.recorder__row { display: flex; align-items: center; gap: 8px; margin-left: -8px; }
.recorder__dot {
  width: 9px; height: 9px; flex: none; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 calc(var(--lvl, 0) * 7px) rgba(255, 255, 255, 0.22);
  animation: rec-dot 1s ease-in-out infinite;
}
@keyframes rec-dot { 50% { opacity: 0.35; } }
.recorder__time { font: 500 13px var(--mono); min-width: 38px; }
.recorder__wave { flex: 1; min-width: 0; height: 30px; }
/* Кнопка «готово» дышит в такт голосу */
.recorder__done { box-shadow: 0 0 0 calc(var(--lvl, 0) * 12px) rgba(255, 255, 255, 0.16); transition: box-shadow 0.08s linear; }
.msg--ai { display: flex; gap: 10px; align-items: flex-start; }
/* Вместо круглой аватарки — живая Кира (моргает), пока думает — Кира в очках */
.msg__avatar { width: 44px; height: 44px; flex: none; margin: -6px 0 -6px -8px; display: grid; place-items: center; }
.msg__avatar .kemoji { width: 26px; height: 26px; }
.msg__body { flex: 1; min-width: 0; padding-top: 5px; }
.msg__text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Ответ проявляется сверху вниз мягкой волной: анимируется одна маска, без сотен элементов */
@property --rv { syntax: "<length-percentage>"; inherits: false; initial-value: 100%; }
.msg__text.is-revealing {
  -webkit-mask-image: linear-gradient(#000 calc(var(--rv) - 48px), rgba(0, 0, 0, 0.25) calc(var(--rv) - 16px), transparent var(--rv));
  mask-image: linear-gradient(#000 calc(var(--rv) - 48px), rgba(0, 0, 0, 0.25) calc(var(--rv) - 16px), transparent var(--rv));
  animation: reveal-wave var(--reveal-dur, 1s) cubic-bezier(0.33, 0.1, 0.25, 1) both, reveal-lift var(--reveal-dur, 1s) ease-out both;
}
@keyframes reveal-wave { from { --rv: 0%; } to { --rv: calc(100% + 48px); } }
@keyframes reveal-lift { from { transform: translateY(6px); } }
.msg__tools { display: flex; gap: 2px; margin-top: 8px; margin-left: -8px; animation: rise 0.4s ease both; }
.msg__tools button { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.msg__tools button:active { background: rgba(255, 255, 255, 0.08); color: #fff; }
.msg__tools svg { width: 17px; height: 17px; }

/* «Кира думает»: волна по сетке точек + переливающаяся подпись */
.think { display: flex; align-items: center; gap: 12px; padding: 7px 0; animation: think-in 0.35s ease both; }
.think.is-leaving { animation: think-out 0.24s ease both; }
@keyframes think-in { from { opacity: 0; filter: blur(4px); transform: translateY(4px); } }
@keyframes think-out { to { opacity: 0; filter: blur(5px); transform: translateY(-4px); } }
.think__grid { display: grid; grid-template-columns: repeat(7, 5px); grid-auto-rows: 5px; gap: 3px; }
.think__grid i {
  width: 5px; height: 5px; border-radius: 50%; background: #fff;
  opacity: 0.12; transform: scale(0.5);
  animation: think-wave 1.5s ease-in-out infinite;
  animation-delay: calc((var(--x) + var(--y) * 1.5) * 0.08s);
}
@keyframes think-wave {
  0%, 100% { opacity: 0.12; transform: scale(0.5); }
  35% { opacity: 1; transform: scale(1.05); }
  60% { opacity: 0.35; transform: scale(0.7); }
}
.think__label {
  font: 500 12.5px var(--mono); letter-spacing: 0.04em;
  background: linear-gradient(90deg, #555 0%, #555 38%, #fff 50%, #555 62%, #555 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer-text 1.8s linear infinite;
}
@keyframes shimmer-text { from { background-position: 100% 0; } to { background-position: -160% 0; } }
/* Аватар Киры «дышит», пока она думает */
.msg--ai.is-thinking .msg__avatar { animation: avatar-ring 1.5s ease-out infinite; }
@keyframes avatar-ring {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
  100% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

.composer-wrap {
  position: relative; z-index: 10; flex: none;
  padding: 6px 12px calc(12px + var(--safe-bottom));
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px 10px; padding: 0 12px; }
.chips::-webkit-scrollbar { display: none; }
.chat.has-messages .chips { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px;
  background: #000; border: 1px solid var(--line-strong);
  font: 400 13px var(--mono); white-space: nowrap;
}
.chip--accent { background: #fff; color: #000; border-color: #fff; }
.composer {
  background: #0d0d0d; border: 1px solid var(--line-strong);
  border-radius: 24px; padding: 12px 8px 8px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer:focus-within { border-color: #fff; box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.15); }
.composer textarea {
  display: block; width: 100%; max-height: 120px; padding-right: 8px;
  background: none; border: 0; outline: 0; resize: none;
  color: #fff; font: 400 16px/1.4 var(--font); caret-color: #fff;
}
.composer textarea::placeholder { color: var(--dim); }
.composer__row { display: flex; align-items: center; gap: 6px; margin: 8px 0 0 -8px; }
.composer__model { flex: 1; min-width: 0; color: var(--dim); font: 400 11.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 2px; }
.send {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; color: #000;
  transition: background 0.2s, transform 0.12s;
}
.send:active { transform: scale(0.92); }
.send:disabled { background: #1a1a1a; color: var(--dim); cursor: default; }
.send svg { width: 20px; height: 20px; }

/* ---------- Кольцо лимита у поля ввода ---------- */
.limit-ring { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.limit-ring:active { background: rgba(255, 255, 255, 0.08); }
.limit-ring svg { width: 24px; height: 24px; transform: rotate(-90deg); }
.limit-ring__track { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 3.2; stroke-dasharray: 1.6 2.4; }
.limit-ring__fill {
  fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray 0.9s cubic-bezier(0.2, 0.9, 0.3, 1);
}
/* Лимит почти исчерпан — кольцо мягко мигает */
.limit-ring.is-low .limit-ring__fill { animation: ring-warn 1.6s ease-in-out infinite; }
@keyframes ring-warn { 50% { opacity: 0.45; } }

/* ---------- Мини-меню лимитов ---------- */
.limits { position: fixed; inset: 0; z-index: 42; }
.limits__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); animation: fade 0.2s ease both; }
.limits__menu {
  position: fixed;
  padding: 12px;
  background-color: #070707;
  background-image: var(--dots); background-size: 7px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: 5px 5px 0 rgba(255, 255, 255, 0.1), 0 20px 50px rgba(0, 0, 0, 0.7);
  animation: limits-up 0.42s cubic-bezier(0.2, 1.25, 0.35, 1) both;
}
@keyframes limits-up {
  from { opacity: 0; transform: translateY(12px) scale(0.85); clip-path: inset(100% 0 0 0 round 20px); }
  50% { opacity: 1; }
  to { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round 20px); }
}
@keyframes limits-down { to { opacity: 0; transform: translateY(10px) scale(0.92); clip-path: inset(100% 0 0 0 round 20px); } }
.limits.is-closing .limits__menu { animation: limits-down 0.2s cubic-bezier(0.4, 0, 1, 1) both; }
.limits.is-closing .limits__backdrop { animation: fade-out 0.2s ease both; }

.limits__head { display: flex; justify-content: space-between; align-items: center; padding: 2px 2px 10px; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: 0.14em; }
.limits__plan { padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line-strong); font-weight: 700; letter-spacing: 0.08em; }
.limits__list { display: flex; flex-direction: column; gap: 6px; }
.limits__item { padding: 10px 12px; border-radius: 14px; background: #000; border: 1px solid var(--line); animation: item-in 0.34s ease both; }
.limits__item + .limits__item { animation-delay: 0.06s; }
.limits__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font: 400 12.5px var(--mono); }
.limits__row b { font: 700 13px var(--mono); }
.limits__row--sub { margin-top: 6px; color: var(--muted); font-size: 11px; }
/* Шкала из «пикселей»: заполненная часть — белые сегменты */
.meter { position: relative; height: 8px; margin-top: 8px; border-radius: 3px; overflow: hidden; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 5px, transparent 5px 7px); }
.meter i {
  position: absolute; inset: 0 auto 0 0; width: var(--p);
  background: repeating-linear-gradient(90deg, #fff 0 5px, transparent 5px 7px);
  animation: meter-fill 0.8s cubic-bezier(0.2, 0.9, 0.3, 1) 0.1s both;
}
@keyframes meter-fill { from { width: 0; } }
.limits__note { margin: 10px 2px 0; color: var(--muted); font: 400 11.5px/1.4 var(--mono); }
.limits__cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  height: 42px; margin-top: 10px; border-radius: 12px;
  background: #fff; color: #000; font: 700 13px var(--mono);
}
.limits__cta svg { width: 15px; height: 15px; }

/* ---------- Меню чатов (слева) ---------- */
.drawer { position: fixed; inset: 0; z-index: 35; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fade 0.22s ease both; }
.drawer__panel {
  position: absolute; left: 8px; top: calc(8px + var(--safe-top)); bottom: calc(8px + var(--safe-bottom));
  width: min(82vw, 330px);
  border-radius: 26px; overflow: hidden;
  border: 1px solid var(--line-strong);
  display: flex; flex-direction: column;
  padding: 14px 12px 12px;
  background-color: #050505;
  background-image: var(--dots); background-size: 7px 7px;
  box-shadow: 6px 6px 0 rgba(255, 255, 255, 0.06), 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: drawer-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.drawer.is-closing .drawer__panel { animation: drawer-out 0.2s ease both; }
.drawer.is-closing .drawer__backdrop { animation: fade-out 0.2s ease both; }
@keyframes drawer-in { from { transform: translateX(calc(-100% - 12px)); } }
@keyframes drawer-out { to { transform: translateX(calc(-100% - 12px)); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

.drawer__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 2px 12px; }
.drawer__brand { display: flex; align-items: center; gap: 8px; font: 700 20px var(--mono); letter-spacing: 0.04em; }
.drawer__brand canvas { width: 34px; height: 34px; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 14px; margin-bottom: 6px;
  border-radius: 999px; background: #000; border: 1px solid var(--line-strong);
}
.search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font: 400 13.5px var(--mono); }
.search input::placeholder { color: var(--dim); }

.drawer__list { flex: 1; overflow-y: auto; margin: 0 -12px; padding: 0 12px; scrollbar-width: none; }
.drawer__list::-webkit-scrollbar { display: none; }
/* Дата — по центру, между тонкими линиями */
.drawer__group {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 4px 8px;
  font: 600 13px var(--font); color: #d4d4d4; letter-spacing: 0.01em;
}
.drawer__group::before { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22)); }
.drawer__group::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent); }
.drawer__chat {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 14px; margin-bottom: 4px;
  border-radius: 16px; font-size: 15px;
  background: rgba(0, 0, 0, 0.75); border: 1px solid rgba(255, 255, 255, 0.06);
}
.drawer__chat > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer__tag { flex: none; padding: 1px 6px; border-radius: 6px; border: 1px dashed currentColor; font: 400 10.5px var(--mono); font-style: normal; opacity: 0.7; }
.drawer__chat:active { background: #161616; }
.drawer__chat.is-active { background: #fff; color: #000; font-weight: 500; }
.drawer__empty { padding: 24px 10px; color: var(--dim); font: 400 13px var(--mono); }

.drawer__pro {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin-top: 10px; padding: 10px 12px; border-radius: 14px;
  background: #000; border: 1px solid #fff; box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.18);
}
.drawer__pro .kemoji { width: 30px; height: 30px; }
.drawer__pro > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer__pro b { font: 700 14px var(--mono); }
.drawer__pro small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.drawer__me { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 8px 6px; border-radius: 12px; background: #050505; }
.drawer__me:active { background: #161616; }
.drawer__me > svg { width: 20px; height: 20px; color: var(--muted); }
.drawer__avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; overflow: hidden; border: 1px solid var(--line-strong); }
.drawer__me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer__me-text b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer__me-text small { color: var(--muted); font: 400 11.5px var(--mono); margin-top: 1px; }

/* Аватар: фото Telegram в ч/б или первая буква */
[data-profile-avatar] img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.08); }
.avatar-initial { width: 100%; height: 100%; display: grid; place-items: center; background: #000; background-image: var(--dots); background-size: 5px 5px; font: 700 1em var(--mono); }
.drawer__avatar .avatar-initial { font-size: 15px; }

/* ---------- Настройки ---------- */
.profile {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(64px + var(--safe-top)) 16px 34px;
  min-height: 330px;
}
.profile__field { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.profile::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(42% 34% at 50% 42%, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0) 80%); }
.profile__back { position: absolute; left: 12px; top: calc(12px + var(--safe-top)); }
.tg .profile__back { display: none; }
.profile__avatar {
  width: 112px; height: 112px; border-radius: 50%; overflow: hidden;
  border: 2px solid #fff; box-shadow: 6px 6px 0 rgba(255, 255, 255, 0.16);
  font-size: 44px;
}
.profile__name { margin-top: 16px; font: 700 24px/1.2 var(--mono); letter-spacing: -0.02em; }
.profile__handle { margin-top: 4px; color: var(--muted); font: 400 14px var(--mono); }
.profile__id { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.7); font: 400 12.5px var(--mono); color: var(--muted); }
.profile__id b { color: #fff; font-weight: 500; }
.profile__id svg { width: 15px; height: 15px; }
.settings { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.settings::-webkit-scrollbar { display: none; }
.settings__body { padding: 0 12px; }
.footnote { text-align: center; color: var(--dim); font: 400 11.5px/1.6 var(--mono); padding: 26px 0 calc(26px + var(--safe-bottom)); }

/* ---------- Выбор модели ---------- */
.popover { position: fixed; inset: 0; z-index: 40; }

/* «Жалюзи»: 12 полос по очереди переворачиваются сверху вниз и закрывают экран */
.blinds { position: absolute; inset: 0; display: flex; flex-direction: column; perspective: 900px; }
.blinds i {
  flex: 1; margin-bottom: -1px;
  background: #050505;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  will-change: transform, opacity;
  transform-origin: 50% 0; backface-visibility: hidden;
  animation: blind-in 0.5s cubic-bezier(0.2, 0.85, 0.25, 1) both;
  animation-delay: calc(var(--i) * 0.035s);
}
@keyframes blind-in { from { transform: rotateX(-90deg); opacity: 0.2; } }
/* Закрытие: сначала уходит содержимое, затем полосы складываются снизу вверх */
.popover.is-closing .blinds i {
  transform-origin: 50% 100%;
  animation: blind-out 0.38s cubic-bezier(0.45, 0, 0.6, 1) both;
  animation-delay: calc(0.12s + (11 - var(--i)) * 0.03s);
}
@keyframes blind-out { 0% { transform: none; opacity: 1; } 100% { transform: rotateX(90deg); opacity: 0; } }

.popover__menu {
  position: absolute; inset: 0; z-index: 1;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  padding: calc(14px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}
.popover__menu::-webkit-scrollbar { display: none; }
.popover__head, .popover__list { max-width: 448px; margin: 0 auto; }
.popover.is-closing .popover__menu { animation: menu-fade 0.16s ease both; }
@keyframes menu-fade { to { opacity: 0; transform: translateY(-8px); } }

.popover__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 6px 2px 18px;
  animation: item-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1) 0.32s both;
}
.popover__title { font: 700 30px/1.1 var(--mono); letter-spacing: -0.02em; }
.popover__hint { color: var(--muted); font: 400 12.5px var(--mono); margin-top: 6px; }
.popover__list { display: flex; flex-direction: column; gap: 8px; }

.model {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 16px 16px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.85); border: 1px solid var(--line-strong);
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  animation: item-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) both;
  animation-delay: calc(0.38s + var(--i, 0) * 0.06s);
}
@keyframes item-in { from { opacity: 0; transform: translateY(-10px); } }
.model:active { transform: scale(0.98); border-color: var(--line-strong); }
.model[aria-selected="true"] { background: #fff; color: #000; border-color: #fff; }
.model[aria-selected="true"] .model__desc { color: #555; }
.model[aria-selected="true"] .badge { background: #000; color: #fff; }
.model__body { flex: 1; min-width: 0; }
.model__name { font: 600 15.5px var(--mono); display: flex; align-items: center; gap: 6px; }
.model__desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; line-height: 1.25; }
.model svg { width: 20px; height: 20px; flex: none; }

/* Стрелка у кнопки модели поворачивается, пока меню открыто */
.model-chip svg { transition: transform 0.3s cubic-bezier(0.2, 1.2, 0.35, 1); }
body.models-open .model-chip svg { transform: rotate(180deg); }

/* ---------- Pro ---------- */
.paywall { position: fixed; inset: 0; z-index: 45; background: var(--bg); overflow-y: auto; animation: slide .25s ease; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.paywall__inner { max-width: 480px; margin: 0 auto; padding: calc(12px + var(--safe-top)) 12px 130px; display: flex; flex-direction: column; gap: 12px; }
.paywall__back { position: absolute; left: 10px; top: calc(12px + var(--safe-top)); z-index: 2; }
.tg .paywall__back { display: none; }

.segment { display: flex; align-self: center; padding: 4px; border-radius: 999px; border: 1px solid var(--line-strong); gap: 2px; }
.segment button { height: 38px; padding: 0 16px 0 10px; border-radius: 999px; font: 700 13px var(--mono); color: #fff; display: flex; align-items: center; gap: 6px; }
.segment button.is-active { background: #fff; color: #000; }
.segment__emoji { width: 24px; height: 24px; }
.segment button.is-active .segment__emoji { filter: invert(1); }

.compare__head, .compare__row { display: grid; grid-template-columns: 1fr 44px 44px; align-items: center; gap: 4px; padding: 0 16px; }
.compare__head { padding-top: 14px; padding-bottom: 6px; font: 700 11px var(--mono); color: var(--muted); letter-spacing: 0.08em; }
.compare__head > span:nth-child(n+2) { text-align: center; }
.compare__pro { color: #fff; }
.compare__row { min-height: 58px; padding-top: 8px; padding-bottom: 8px; }
.compare__row + .compare__row { border-top: 1px dashed rgba(255, 255, 255, 0.08); }
.compare__title { font-size: 15px; font-weight: 500; }
.compare__sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.inline-coin { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; margin: 0 1px; }
.compare__dash { width: 14px; height: 2px; background: var(--dim); margin: 0 auto; border-radius: 1px; }
.compare__check { width: 20px; height: 20px; margin: 0 auto; color: #fff; }
.logos { display: inline-flex; gap: 2px; }
.logos span { min-width: 15px; height: 15px; padding: 0 2px; border-radius: 4px; border: 1px solid var(--line-strong); display: grid; place-items: center; font: 700 8.5px var(--mono); color: #fff; }

.plans { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 4px 12px; }
.plans::-webkit-scrollbar { display: none; }
.plan {
  position: relative; flex: 0 0 148px; overflow: hidden;
  padding: 12px 14px; border-radius: 16px;
  background: var(--card); border: 1.5px solid var(--line);
}
.plan.is-selected { border-color: #fff; background-color: #0d0d0d; background-image: var(--dots); background-size: 6px 6px; box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.15); }
.plan__period { display: flex; align-items: center; gap: 6px; font: 500 14px var(--mono); }
.plan__off { height: 18px; padding: 0 5px; border-radius: 4px; background: #fff; color: #000; font: 700 11px var(--mono); display: inline-flex; align-items: center; }
.plan__price { margin-top: 14px; font: 700 17px var(--mono); display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.plan__old { color: var(--dim); font-size: 12px; font-weight: 400; text-decoration: line-through; }
.plan__stars { display: flex; align-items: center; gap: 4px; color: var(--muted); font: 400 12.5px var(--mono); margin-top: 4px; }
.plan__stars svg { width: 12px; height: 12px; }
.plan__tick { position: absolute; right: 8px; top: 8px; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #000; display: none; place-items: center; }
.plan__tick svg { width: 13px; height: 13px; }
.plan.is-selected .plan__tick { display: grid; }
.plan__hit { position: absolute; right: -24px; bottom: 12px; transform: rotate(-45deg); background: #fff; color: #000; font: 700 9px var(--mono); letter-spacing: 0.1em; padding: 2px 26px; }

.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 100%; border-radius: 16px; font: 700 15px var(--mono); text-align: center; }
.btn--dark { flex-direction: row; gap: 10px; height: 54px; border: 1px solid var(--line-strong); margin-top: 8px; }
.btn--dark svg { width: 20px; height: 20px; }
.btn--primary { height: 58px; background: #fff; color: #000; box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.2); }
.btn--primary small { font: 400 11px var(--font); opacity: .6; }
.btn:active { transform: scale(.985); }
.paywall__cta { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(14px + var(--safe-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.paywall__cta .btn { max-width: 456px; margin: 0 auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(150px + var(--safe-bottom)); transform: translateX(-50%);
  background: #fff; color: #000;
  padding: 9px 14px; border-radius: 10px; font: 500 13px var(--mono); z-index: 60; white-space: nowrap;
  box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.2);
}
.toast::before { content: "> "; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- «Думает»: Кира в очках вместо аватара ---------- */
.msg--ai.is-thinking .msg__avatar { animation: none; }
.msg__kira { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Видео-вложения и просмотр ---------- */
.att[data-view] { cursor: zoom-in; }
.att--video video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; filter: grayscale(1); }
.msg__atts .att--video video { filter: none; }
.att__badge { position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.6); color: #fff; pointer-events: none; }
.att__badge svg { width: 11px; height: 11px; margin-left: 1px; }

.viewer { position: fixed; inset: 0; z-index: 170; }
.viewer__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.94); animation: fade 0.22s ease both; }
.viewer__stage {
  position: absolute; inset: calc(64px + var(--safe-top)) 12px calc(24px + var(--safe-bottom));
  display: grid; place-items: center; pointer-events: none;
  animation: viewer-in 0.34s cubic-bezier(0.2, 1.1, 0.35, 1) both;
}
.viewer__stage img, .viewer__stage video { max-width: 100%; max-height: 100%; border-radius: 16px; pointer-events: auto; background: #000; }
@keyframes viewer-in { from { opacity: 0; transform: scale(0.92); } }
.viewer.is-closing .viewer__stage { animation: viewer-out 0.2s ease both; }
.viewer.is-closing .viewer__backdrop { animation: fade-out 0.2s ease both; }
@keyframes viewer-out { to { opacity: 0; transform: scale(0.94); } }
.viewer__bar {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-top)) 12px 10px 16px;
}
.viewer__meta { display: flex; flex-direction: column; min-width: 0; }
.viewer__meta b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer__meta small { color: var(--muted); font: 400 11.5px var(--mono); margin-top: 2px; }

/* ---------- Лимит закончился ---------- */
.lockbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 12px; border-radius: 24px;
  background: #0d0d0d; border: 1px dashed rgba(255, 255, 255, 0.35);
  animation: rec-in 0.4s cubic-bezier(0.2, 1.2, 0.35, 1) both;
}
.lockbar__emoji { width: 34px; height: 34px; }
.lockbar__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lockbar__text b { font: 700 14px var(--mono); }
.lockbar__text small { color: var(--muted); font: 400 12px var(--mono); margin-top: 2px; font-variant-numeric: tabular-nums; }
.lockbar__btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 12px; border-radius: 999px; background: #fff; color: #000; font: 700 13px var(--mono); box-shadow: 3px 3px 0 rgba(255, 255, 255, 0.25); }
.lockbar__btn svg { width: 15px; height: 15px; }
.chat.is-locked .chips { display: none; }

.limit-card {
  position: relative; overflow: hidden;
  margin: 8px 2px 4px; padding: 18px 16px 16px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  border-radius: 26px; border: 1px solid rgba(255, 255, 255, 0.28);
  background-color: #070707; background-image: var(--dots); background-size: 7px 7px;
  box-shadow: 6px 6px 0 rgba(255, 255, 255, 0.08);
  animation: limit-pop 0.6s cubic-bezier(0.2, 1.25, 0.35, 1) both;
}
@keyframes limit-pop { from { opacity: 0; transform: translateY(18px) scale(0.92); } }
/* Сверху вниз по карточке пробегает «скан» */
.limit-card::after {
  content: ""; position: absolute; left: 0; right: 0; top: -40%; height: 40%; pointer-events: none;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.07), transparent);
  animation: scan 3.2s ease-in-out 0.6s infinite;
}
@keyframes scan { to { top: 110%; } }
.limit-card > * { animation: item-in 0.45s ease both; }
.limit-card > :nth-child(2) { animation-delay: 0.12s; }
.limit-card > :nth-child(3) { animation-delay: 0.18s; }
.limit-card > :nth-child(4) { animation-delay: 0.24s; }
.limit-card > :nth-child(5) { animation-delay: 0.3s; }
.limit-card > :nth-child(6) { animation-delay: 0.36s; }
.limit-card > :nth-child(7) { animation-delay: 0.42s; }
.limit-card__art { width: 132px; height: 132px; margin: -6px 0 2px; }
.limit-card__art img { width: 100%; height: 100%; object-fit: contain; }
.limit-card__title { font: 700 20px var(--mono); letter-spacing: -0.01em; }
.limit-card__text { color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 6px; max-width: 300px; }
.limit-card__timer { margin-top: 10px; font: 700 34px/1 var(--mono); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.limit-card__meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; margin-top: 16px; font: 400 11.5px var(--mono); color: var(--muted); }
.limit-card__meter .meter { margin-top: 0; }
.meter--full i { animation: meter-fill 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) 0.3s both, meter-blink 1.6s ease-in-out 1.3s infinite; }
@keyframes meter-blink { 50% { opacity: 0.4; } }
.limit-card__cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  height: 48px; margin-top: 16px; border-radius: 16px;
  background: #fff; color: #000; font: 700 14px var(--mono);
  box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.2);
}
.limit-card__cta svg { width: 16px; height: 16px; }
.limit-card__ghost {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  height: 46px; margin-top: 8px; border-radius: 16px;
  background: #000; border: 1px solid var(--line-strong);
  font: 600 13px var(--mono); color: #fff; text-align: center;
}
.limit-card__ghost:active { background: #161616; }
/* Чёрные волосы Киры на чёрном фоне — тонкий светлый контур */
.msg__kira, .limit-card__art img { filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.75)) drop-shadow(0 0 6px rgba(255, 255, 255, 0.12)); }

/* Кнопка напоминания: иконка + состояние «поставлено» */
.limit-card__ghost svg { width: 17px; height: 17px; flex: none; }
.limit-card__ghost.is-set {
  cursor: default; color: #000; background: #fff; border-color: #fff;
  animation: remind-set 0.55s cubic-bezier(0.2, 1.3, 0.35, 1) both;
}
.limit-card__ghost.is-set svg { animation: check-pop 0.5s cubic-bezier(0.2, 1.5, 0.35, 1) 0.1s both; }
@keyframes remind-set {
  0% { transform: scale(0.94); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); }
  60% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { transform: none; box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.18); }
}
@keyframes check-pop { from { transform: scale(0) rotate(-30deg); } }

/* Плашка сверху: выезжает из-под шапки и не закрывает кнопки внизу */
.notice {
  position: fixed; left: 50%; top: calc(64px + var(--safe-top)); z-index: 70;
  width: min(440px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 10px; border-radius: 20px;
  background-color: #070707; background-image: var(--dots); background-size: 7px 7px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 5px 5px 0 rgba(255, 255, 255, 0.12), 0 16px 40px rgba(0, 0, 0, 0.7);
  transform: translateX(-50%);
  animation: notice-in 0.55s cubic-bezier(0.2, 1.3, 0.35, 1) both;
}
.notice.is-leaving { animation: notice-out 0.3s cubic-bezier(0.4, 0, 1, 1) both; }
@keyframes notice-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-24px) scale(0.9); clip-path: inset(0 0 100% 0 round 20px); }
  to { opacity: 1; transform: translateX(-50%); clip-path: inset(0 0 0 0 round 20px); }
}
@keyframes notice-out { to { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(0.95); } }
.notice__emoji { width: 36px; height: 36px; }
.notice__text { display: flex; flex-direction: column; min-width: 0; }
.notice__text b { font: 700 13.5px var(--mono); }
.notice__text small { color: var(--muted); font: 400 11.5px var(--mono); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ---------- Нет доступа к микрофону ---------- */
.composer.is-mic-error { animation: shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
.composer.is-mic-error > textarea,
.composer.is-mic-error > .composer__row,
.composer.is-mic-error > .attachments { display: none; }
@keyframes shake {
  15%, 75% { transform: translateX(-5px); }
  30%, 90% { transform: translateX(5px); }
  45% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
}
.mic-error { display: flex; align-items: center; gap: 10px; min-height: 52px; animation: rec-in 0.36s cubic-bezier(0.2, 1.2, 0.35, 1) both; }
.mic-error.is-leaving { animation: mic-out 0.22s ease both; }
@keyframes mic-out { to { opacity: 0; transform: translateY(4px); } }
.mic-error__icon {
  position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  animation: mic-pulse 1.8s ease-out 0.5s infinite;
}
.mic-error__icon svg { width: 22px; height: 22px; animation: mic-jitter 0.5s steps(2) 0.1s 3; }
/* Перечёркивание «рисуется» поверх микрофона */
.mic-error__slash { stroke-dasharray: 24; stroke-dashoffset: 24; animation: slash-draw 0.4s cubic-bezier(0.6, 0, 0.3, 1) 0.25s forwards; }
@keyframes slash-draw { to { stroke-dashoffset: 0; } }
@keyframes mic-jitter { 50% { transform: translate(1px, -1px); } }
@keyframes mic-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); } 100% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); } }
.mic-error__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mic-error__text b { font: 700 13.5px var(--mono); }
.mic-error__text small { color: var(--muted); font-size: 12.5px; line-height: 1.3; margin-top: 3px; }

/* ---------- Уровень мышления ---------- */
.composer__spacer { flex: 1; }
.effort-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px 0 9px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  font: 500 12px var(--mono); color: #e6e6e6; white-space: nowrap;
}
.effort-chip:active { background: rgba(255, 255, 255, 0.08); }
/* Мини-индикатор: 4 столбика-«деления», горят до выбранного уровня */
.effort-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.effort-bars i { width: 3px; border-radius: 1.5px; background: rgba(255, 255, 255, 0.22); transition: background 0.25s, transform 0.3s cubic-bezier(0.2, 1.4, 0.35, 1); }
.effort-bars i:nth-child(1) { height: 5px; }
.effort-bars i:nth-child(2) { height: 8px; }
.effort-bars i:nth-child(3) { height: 11px; }
.effort-bars i:nth-child(4) { height: 13px; }
.effort-bars[data-level="1"] i:nth-child(-n+1),
.effort-bars[data-level="2"] i:nth-child(-n+2),
.effort-bars[data-level="3"] i:nth-child(-n+3),
.effort-bars[data-level="4"] i { background: currentColor; animation: bar-bounce 0.42s cubic-bezier(0.2, 1.4, 0.35, 1) both; }
.effort-bars i:nth-child(2) { animation-delay: 0.04s; }
.effort-bars i:nth-child(3) { animation-delay: 0.08s; }
.effort-bars i:nth-child(4) { animation-delay: 0.12s; }
@keyframes bar-bounce { from { transform: scaleY(0.3); transform-origin: bottom; } }

.effort__viz {
  display: grid; grid-template-columns: repeat(18, 1fr); gap: 5px 0;
  padding: 14px 10px; margin-bottom: 8px; border-radius: 14px;
  background: #000; border: 1px solid var(--line);
}
.effort__viz i {
  justify-self: center; width: 6px; height: 6px; border-radius: 50%;
  background: #fff; opacity: 0.1; transform: scale(0.55);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 1.4, 0.35, 1);
  transition-delay: calc(var(--x) * 18ms);
}
.effort__viz i.is-on { opacity: 1; transform: scale(1); animation: brain-wave var(--speed, 1.5s) ease-in-out infinite; animation-delay: calc(var(--x) * 0.06s + var(--y) * 0.09s); }
@keyframes brain-wave { 50% { opacity: 0.3; transform: scale(0.65); } }

.effort__list { display: flex; flex-direction: column; gap: 6px; }
.effort__opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border-radius: 14px;
  background: #000; border: 1px solid var(--line);
  animation: item-in 0.34s ease both; animation-delay: calc(0.08s + var(--i) * 0.05s);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.effort__opt .effort-bars { height: 16px; }
.effort__opt[aria-checked="true"] { background: #fff; color: #000; border-color: #fff; }
.effort__opt[aria-checked="true"] .effort__desc, .effort__opt[aria-checked="true"] .effort__time { color: #555; }
.effort__opt[aria-checked="true"] .badge { background: #000; color: #fff; }
.effort__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.effort__name { display: flex; align-items: center; gap: 6px; font: 700 13.5px var(--mono); }
.effort__desc { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.3; }
.effort__time { flex: none; color: var(--muted); font: 400 11px var(--mono); }

/* «Думает»: подпись уровня и скорость волны зависят от уровня мышления */
.think__grid i { animation-duration: var(--speed, 1.5s); }
.think__effort { margin-left: auto; padding: 2px 7px; border-radius: 6px; border: 1px dashed rgba(255, 255, 255, 0.3); color: var(--muted); font: 400 10.5px var(--mono); }

/* ---------- Сравнение моделей ---------- */
.cmp { max-width: 448px; margin: 22px auto 0; animation: item-in 0.45s ease 0.7s both; }
.cmp__title { font: 700 13px var(--mono); text-transform: uppercase; letter-spacing: 0.14em; padding: 0 2px 10px; }
.cmp__wrap { overflow-x: auto; border-radius: 18px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.85); scrollbar-width: none; }
.cmp__wrap::-webkit-scrollbar { display: none; }
.cmp__table { width: 100%; border-collapse: collapse; font: 400 12px var(--mono); }
.cmp__table thead th { padding: 11px 4px; color: var(--muted); font-weight: 500; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; text-align: center; border-bottom: 1px solid var(--line-strong); }
.cmp__table thead th:first-child { text-align: left; padding-left: 14px; }
.cmp__table tbody tr { cursor: pointer; animation: item-in 0.4s ease both; animation-delay: calc(0.8s + var(--i) * 0.07s); transition: background 0.2s; }
.cmp__table tbody tr + tr { border-top: 1px dashed rgba(255, 255, 255, 0.08); }
.cmp__table tbody tr:active { background: rgba(255, 255, 255, 0.06); }
.cmp__table tbody th { padding: 12px 8px 12px 14px; text-align: left; font: 600 12.5px var(--mono); white-space: nowrap; }
.cmp__table td { padding: 12px 4px; text-align: center; white-space: nowrap; }
.cmp__table tr.is-current { background: #fff; color: #000; }
.cmp__dots { display: inline-flex; gap: 3px; }
.cmp__dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
/* Заполненные точки «набегают» слева направо */
.cmp__dots i:nth-child(1) { --k: 1; }
.cmp__dots i:nth-child(2) { --k: 2; }
.cmp__dots i:nth-child(3) { --k: 3; }
.cmp__dots i:nth-child(4) { --k: 4; }
.cmp__dots i:nth-child(5) { --k: 5; }
.cmp__dots i { --on: clamp(0, calc(var(--n) - var(--k) + 1), 1); }
.cmp__dots i { background: rgba(255, 255, 255, calc(0.16 + var(--on) * 0.84)); }
.cmp__table tr.is-current .cmp__dots i { background: rgba(0, 0, 0, calc(0.16 + var(--on) * 0.84)); }
.cmp__mult { font-weight: 700; }
.cmp__yes { width: 16px; height: 16px; margin: 0 auto; }
.cmp__no { display: block; width: 10px; height: 2px; margin: 0 auto; background: var(--dim); border-radius: 1px; }
.cmp__note { color: var(--dim); font: 400 11px/1.4 var(--mono); padding: 10px 2px 0; }

/* ---------- Ползунок уровня мышления ---------- */
.effort__slider { display: flex; justify-content: center; padding: 6px 0 4px; }
.es { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.es__shell { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.es__label {
  position: absolute; top: 2px; z-index: 2; pointer-events: none; white-space: nowrap;
  font: 700 11.5px/16px var(--mono); letter-spacing: 0.04em; color: #fff;
}
/* Смена подписи: старая уходит вверх, новая выезжает снизу */
.es__text { display: inline-block; }
.es__text.is-swap { animation: es-swap 0.22s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes es-swap { from { opacity: 0; transform: translateY(5px); filter: blur(2px); } }
.es__track {
  position: absolute; left: 0; right: 0; bottom: 0; height: 32px;
  border-radius: 16px; overflow: hidden; cursor: pointer; outline: none;
}
.es__track:focus-visible { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); }
/* Пройденная часть — точки, как во всём интерфейсе Kira */
.es__fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.35) 1px, transparent 1.5px);
  background-size: 5px 5px;
}
.es__thumb {
  position: absolute; top: 50%; height: 27.2px; margin-top: -13.6px; border-radius: 14px;
  background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.es[data-dragging="true"] .es__thumb { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.14), 0 2px 10px rgba(0, 0, 0, 0.6); }
.es__tick {
  position: absolute; top: 50%; width: 2px; border-radius: 1px; transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.35); pointer-events: none; transition: background 0.15s;
}
.es__tick[data-passed="true"] { background: rgba(255, 255, 255, 0.7); }
.es__tick[data-on-thumb="true"] { background: rgba(0, 0, 0, 0.55); }
.es__tick[data-active="true"] { background: #fff; }

.effort__info {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
  padding: 12px; border-radius: 14px; background: #000; border: 1px solid var(--line);
  animation: item-in 0.3s ease both;
}
.effort__info .effort-bars { height: 16px; color: #fff; }

.assistant-fields{padding:20px;display:grid;gap:16px}.assistant-fields textarea,.assistant-fields select,.assistant-fields input:not([type=checkbox]){width:100%;background:var(--bg);color:var(--text);border:1px solid #555;border-radius:12px;padding:12px;font:inherit}.assistant-fields p{line-height:1.55;opacity:.8}
