/* TrueGPT — тёмная тема по умолчанию, светлая через [data-theme="light"] */

:root {
  --bg: #0e0e12;
  --bg-side: #131318;
  --surface: #1a1a21;
  --surface-2: #212129;
  --hover: rgba(255, 255, 255, .06);
  --active: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #ececf1;
  --muted: #9a9aa6;
  --faint: #6b6b77;
  --user: #26262f;
  --accent: #8b6cff;
  --accent-soft: #b9a6ff;
  --ok: #36d1c4;
  --bad: #ff5c7a;
  --grad: linear-gradient(120deg, #8b6cff, #ff5ca8 45%, #ffb547 85%);
  --gold: linear-gradient(120deg, #ffd66b, #ff9f43 55%, #ffd66b);
  --code-bg: #0a0a0e;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --sb-w: 268px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-side: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --hover: rgba(0, 0, 0, .05);
  --active: rgba(0, 0, 0, .08);
  --line: rgba(0, 0, 0, .08);
  --line-2: rgba(0, 0, 0, .13);
  --text: #16161b;
  --muted: #66666f;
  --faint: #9a9aa4;
  --user: #f0f0f4;
  --accent-soft: #6a4de0;
  --code-bg: #111117;
  --shadow: 0 12px 40px rgba(20, 20, 50, .12);
  color-scheme: light;
}

@property --a {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background .3s, color .3s;
}
button { font: inherit; }
::selection { background: rgba(139, 108, 255, .35); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

.i { width: 20px; height: 20px; flex: none; }
[data-theme="light"] .only-dark, :root:not([data-theme="light"]) .only-light { display: none; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, transform .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.94); }

.btn {
  height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text);
  font-weight: 600; font-size: 14px;
  cursor: pointer; transition: transform .15s, opacity .2s, background .2s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

/* ——— шар ——— */
.orb {
  display: inline-block; flex: none; position: relative;
  border-radius: 50%;
  background: conic-gradient(from var(--a), #8b6cff, #ff5ca8, #ffb547, #36d1c4, #8b6cff);
  animation: orbspin 8s linear infinite;
}
.orb::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 48%);
  mix-blend-mode: soft-light;
}
.orb-sm { width: 22px; height: 22px; }
.orb-xl {
  width: 92px; height: 92px;
  box-shadow: 0 0 60px rgba(139, 108, 255, .45), 0 0 140px rgba(255, 92, 168, .22);
  animation: orbspin 6s linear infinite, blob 9s ease-in-out infinite, rise .7s var(--ease) both;
}
.app.pro .brand .orb { box-shadow: 0 0 0 2px var(--bg-side), 0 0 0 3.5px #ffc542; }

/* ——— каркас ——— */
.app { display: flex; height: 100vh; height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

.sidebar {
  width: var(--sb-w); flex: none;
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  transition: margin-left .35s var(--ease), background .3s;
}
.app.sb-collapsed .sidebar { margin-left: calc(-1 * var(--sb-w)); }
.backdrop { display: none; }

.sb-head { display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 2px 0 6px; margin-bottom: 4px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-name b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.pro-badge { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 2px 6px; border-radius: 6px; background: var(--gold); color: #2a1800; animation: pop .4s var(--ease); }

.new-chat {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 10px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s;
}
.new-chat .i { width: 18px; height: 18px; }
.new-chat:hover { background: var(--hover); }
.new-chat kbd { margin-left: auto; font: 11px var(--font); color: var(--faint); opacity: 0; transition: opacity .15s; }
.new-chat:hover kbd { opacity: 1; }

.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border-radius: 10px; color: var(--muted); background: var(--hover); }
.search .i { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 14px var(--font); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }

.chat-list { flex: 1; overflow-y: auto; margin: 4px -6px 0; padding: 0 6px; }
.group-t { font-size: 12px; font-weight: 600; color: var(--faint); padding: 14px 10px 6px; }
.chat-item {
  display: flex; align-items: center; gap: 4px;
  height: 36px; padding: 0 4px 0 10px;
  border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 14px;
  transition: background .15s;
  animation: fade .3s both;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.ct { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct.typing::after { content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 1px; vertical-align: -2px; background: var(--accent); animation: blink .8s steps(1) infinite; }
.ci-acts { display: none; gap: 1px; }
.chat-item:hover .ci-acts, .chat-item.active .ci-acts { display: flex; }
.ci-acts button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.ci-acts button:hover { color: var(--text); background: var(--hover); }
.ci-acts button:last-child:hover { color: var(--bad); }
.ci-acts .i { width: 15px; height: 15px; }
.ct-edit { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--accent); border-radius: 7px; outline: 0; background: var(--surface); color: var(--text); font: 14px var(--font); }
.list-empty { padding: 30px 10px; text-align: center; color: var(--faint); font-size: 13.5px; }

.sb-foot { border-top: 1px solid var(--line); padding-top: 8px; }
.plan { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 6px; border: 0; border-radius: 12px; background: transparent; color: var(--text); text-align: left; cursor: pointer; transition: background .15s; }
.plan:hover { background: var(--hover); }
.avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 700; font-size: 13px; }
.app.pro .avatar { box-shadow: 0 0 0 2px var(--bg-side), 0 0 0 4px #ffc542; }
.plan-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.plan-text b, .plan-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-text b { font-size: 13.5px; font-weight: 600; }
.plan-text small { font-size: 12px; color: var(--muted); }
.pill { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill .i { width: 13px; height: 13px; }
.app.pro .pill { background: var(--gold); color: #2a1800; border-color: transparent; }

/* ——— верхняя панель ——— */
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 10px; position: relative; z-index: 10; }
.spacer { flex: 1; }
.sb-open, .mobile-new { display: none; }
.app.sb-collapsed .sb-open, .app.sb-collapsed .mobile-new { display: grid; }

.model-picker { position: relative; }
.model-btn { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 17px; font-weight: 600; cursor: pointer; transition: background .15s; }
.model-btn:hover { background: var(--hover); }
.model-btn .i { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.model-btn[aria-expanded="true"] .i { transform: rotate(180deg); }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  width: 330px; max-width: calc(100vw - 24px);
  padding: 6px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: var(--shadow);
  transform-origin: top left;
  animation: menuIn .18s var(--ease);
}
.mi { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; transition: background .15s; }
.mi:hover { background: var(--hover); }
.mi-t { flex: 1; display: flex; flex-direction: column; }
.mi-t b { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.mi-t em { font-style: normal; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: rgba(139, 108, 255, .18); color: var(--accent-soft); }
.mi-t small { font-size: 12.5px; color: var(--muted); }
.mi-check { opacity: 0; transition: opacity .15s; }
.mi-check .i { width: 18px; height: 18px; }
.mi.on .mi-check { opacity: 1; }
.mi-foot { margin-top: 4px; padding: 8px 12px 6px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }

/* ——— лента ——— */
.scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.thread { width: 100%; max-width: 800px; margin: 0 auto; padding: 8px 24px 48px; }
.main.empty .thread { margin: auto; padding-bottom: 24px; }

.welcome { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px 0; }
.welcome .orb-xl { margin-bottom: 26px; }
.headline {
  margin: 0; min-height: 1.25em;
  font-size: clamp(26px, 4.4vw, 38px); font-weight: 700; line-height: 1.25; letter-spacing: -.028em;
  background: linear-gradient(90deg, var(--text) 0%, var(--text) 38%, #b9a6ff 50%, #ff8cc6 60%, var(--text) 72%, var(--text) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 7s ease-in-out infinite;
}
.sub { margin: 10px 0 34px; color: var(--muted); animation: rise .6s .1s var(--ease) both; }
.cards { width: 100%; max-width: 640px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 1px;
  padding: 14px 16px;
  border: 1px solid var(--line-2); border-radius: 16px;
  background: var(--surface); color: var(--text); text-align: left;
  cursor: pointer;
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
  animation: rise .55s var(--d) var(--ease) both;
}
.card::before {
  content: ''; position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(120% 90% at 0% 0%, rgba(139, 108, 255, .16), transparent 60%);
  transition: opacity .3s;
}
.card:hover { transform: translateY(-3px); border-color: rgba(139, 108, 255, .5); box-shadow: 0 10px 30px rgba(139, 108, 255, .12); }
.card:hover::before { opacity: 1; }
.card-e { font-size: 20px; margin-bottom: 6px; }
.card b { font-size: 14.5px; font-weight: 600; }
.card small { font-size: 13px; color: var(--muted); }

.shared-title { padding: 18px 0 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.shared-title small { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.shared-title h1 { margin: 2px 0 0; font-size: 26px; letter-spacing: -.02em; }

.msg { display: flex; margin: 20px 0; animation: rise .4s var(--ease) both; }
.msg.user { flex-direction: column; align-items: flex-end; }
.bubble {
  max-width: min(78%, 620px);
  padding: 10px 16px;
  border-radius: 20px 20px 6px 20px;
  background: var(--user);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-files { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; gap: 8px; max-width: 80%; margin-bottom: 6px; }
.fthumb img { display: block; max-width: 240px; max-height: 240px; border-radius: 14px; border: 1px solid var(--line); }
.fchip { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); }
.fchip-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; font-size: 18px; background: linear-gradient(135deg, rgba(139, 108, 255, .28), rgba(255, 92, 168, .24)); }
.fchip-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; text-align: left; }
.fchip-t b { max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13.5px; font-weight: 500; }
.fchip-t small { font-size: 12px; color: var(--muted); }

.msg.bot { gap: 14px; }
.avatar-bot { width: 30px; height: 30px; flex: none; display: grid; place-items: center; margin-top: 1px; border: 1px solid var(--line); border-radius: 50%; transition: box-shadow .3s; }
.msg.live .avatar-bot { box-shadow: 0 0 0 3px rgba(139, 108, 255, .18), 0 0 18px rgba(255, 92, 168, .35); }
.msg.live .avatar-bot .orb { animation: orbspin 1.1s linear infinite, breathe 1.2s ease-in-out infinite; }
.body { flex: 1; min-width: 0; padding-top: 3px; }

.actions { display: flex; align-items: center; gap: 2px; margin: 6px 0 0 -6px; opacity: 0; transition: opacity .2s; }
.msg.user .actions { margin: 4px -6px 0 0; }
.msg:hover .actions, .msg:focus-within .actions, .msg.bot:last-child .actions { opacity: 1; }
.msg.live .actions { visibility: hidden; }
.act { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.act .i { width: 16px; height: 16px; }
.act:hover { background: var(--hover); color: var(--text); }
.act:active { transform: scale(.9); }
.act-like.on { color: var(--ok); }
.act-dislike.on { color: var(--bad); }
.act-speak.on { color: var(--accent); animation: breathe 1s ease-in-out infinite; }
.act-regen { display: none; }
.msg.bot:last-child .act-regen { display: grid; }
.is-shared .act-regen { display: none !important; }
.act-regen:hover .i { animation: spin .6s var(--ease); }
.model-tag { margin-left: 8px; font-size: 12px; color: var(--faint); }

/* думает */
.thinking { height: 26px; display: flex; align-items: center; }
.shimmer {
  background: linear-gradient(90deg, var(--faint) 0%, var(--faint) 35%, var(--text) 50%, var(--faint) 65%, var(--faint) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.8s linear infinite;
}
.shimmer.swap { animation: shimmer 1.8s linear infinite, swap .35s var(--ease); }
.caret { display: inline-block; width: 10px; height: 10px; margin-left: 4px; border-radius: 50%; background: var(--text); vertical-align: 0; animation: breathe 1s ease-in-out infinite; }

.reason { margin-bottom: 10px; }
.reason-head { display: inline-flex; align-items: center; gap: 6px; padding: 3px 0; border: 0; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
.reason-head:hover { color: var(--text); }
.reason-head .i { width: 16px; height: 16px; }
.reason-head .chev { transition: transform .25s var(--ease); }
.reason.open .chev { transform: rotate(90deg); }
.reason-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--ease); }
.reason.open .reason-body { grid-template-rows: 1fr; }
.reason-body ul { min-height: 0; overflow: hidden; margin: 0; padding: 0 0 0 16px; list-style: none; border-left: 2px solid var(--line-2); color: var(--muted); font-size: 14px; line-height: 1.55; }
.reason-body li { padding: 3px 0; animation: fade .3s both; }
.reason-body li:first-child { padding-top: 6px; }
.reason-body li:last-child { padding-bottom: 6px; }
.reason-research ul { border-left-color: rgba(139, 108, 255, .4); }
li.step { display: flex; align-items: center; gap: 10px; }
li.step::before { content: ''; width: 14px; height: 14px; flex: none; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .7s linear infinite; }
li.step.done::before { content: '✓'; display: grid; place-items: center; border: 0; background: var(--ok); color: #06231f; font-size: 9px; font-weight: 900; animation: pop .3s var(--ease); }

.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.src { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; animation: pop .3s var(--ease) both; }
.src:nth-child(2) { animation-delay: .06s; }
.src:nth-child(3) { animation-delay: .12s; }
.src-fav { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--grad); color: #fff; font-size: 10px; font-weight: 700; }
.src small { color: var(--faint); }

/* markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .8em; }
.md h2, .md h3, .md h4, .md h5 { margin: 1.1em 0 .45em; line-height: 1.3; letter-spacing: -.012em; }
.md h2 { font-size: 1.4em; }
.md h3 { font-size: 1.17em; }
.md h4, .md h5 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md li { margin: .2em 0; }
.md li::marker { color: var(--muted); }
.md blockquote { margin: 0 0 .8em; padding: 2px 0 2px 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.md hr { margin: 1.3em 0; border: 0; border-top: 1px solid var(--line-2); }
.md strong { font-weight: 650; }
.md a { color: var(--accent-soft); }
.md code { padding: 2px 6px; border-radius: 6px; background: var(--hover); font: .87em var(--mono); }
.md .code { margin: 12px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--code-bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 6px 5px 14px; background: rgba(255, 255, 255, .045); color: #9a9aa6; font: 12px var(--mono); }
.code-head button { padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: #9a9aa6; font-size: 12px; cursor: pointer; }
.code-head button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.md pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: #e6e6ef; font: 13.5px/1.55 var(--mono); }
.md pre code { padding: 0; background: none; font: inherit; }
.stopped { color: var(--faint); font-size: 13.5px; font-style: italic; }

/* ——— композер ——— */
.composer-wrap { position: relative; flex: none; width: 100%; max-width: 820px; margin: 0 auto; padding: 0 20px 10px; }
.to-bottom {
  position: absolute; left: 50%; bottom: calc(100% + 10px); z-index: 5;
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; cursor: pointer;
  transform: translate(-50%, 8px); transition: opacity .2s, transform .25s var(--ease);
}
.to-bottom .i { width: 18px; height: 18px; }
.to-bottom.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }

.composer {
  position: relative;
  padding: 10px 10px 8px 16px;
  border: 1px solid var(--line-2); border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color .25s, background .3s;
}
.composer::before {
  content: ''; position: absolute; inset: -1px; z-index: 0; border-radius: inherit; padding: 1.5px;
  background: var(--grad); background-size: 200% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s; pointer-events: none;
}
.composer:focus-within { border-color: transparent; }
.composer:focus-within::before { opacity: .85; }
.composer.busy::before { opacity: 1; animation: flow 2.4s linear infinite; }
.app.pro .composer::before { background: var(--gold); background-size: 200% 100%; opacity: .75; }
.app.pro .composer { border-color: transparent; }

.composer textarea {
  display: block; width: 100%; max-height: 220px;
  padding: 4px 0; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--text);
  font: 16px/1.5 var(--font);
}
.composer textarea::placeholder { color: var(--faint); transition: color .2s; }
.composer.recording textarea::placeholder { color: var(--bad); }
.composer-bar { display: flex; align-items: center; gap: 4px; margin: 6px 0 0 -6px; }
.tool {
  height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: color .2s, background .2s, border-color .2s;
}
.tool .i { width: 16px; height: 16px; }
.tool:hover { color: var(--text); background: var(--hover); }
.tool.on { color: var(--accent-soft); border-color: rgba(139, 108, 255, .5); background: rgba(139, 108, 255, .13); }
.mic.rec { color: var(--bad); background: rgba(255, 92, 122, .14); animation: micPulse 1.1s ease-out infinite; }
.send {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--text); color: var(--bg);
  cursor: pointer; transition: transform .2s var(--ease), opacity .2s;
}
.send .i { width: 18px; height: 18px; }
.send:disabled { opacity: .25; cursor: default; }
.send:not(:disabled):hover { transform: scale(1.07); }
.send .ic-stop, .composer.busy .send .ic-send { display: none; }
.composer.busy .send .ic-stop { display: block; }
.composer.busy .send { animation: ring 1.5s ease-out infinite; }

.attachments { display: none; flex-wrap: wrap; gap: 8px; margin: 2px 0 10px -6px; }
.attachments.has { display: flex; }
.att {
  position: relative; max-width: 240px;
  display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 7px;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface-2);
  animation: pop .3s var(--ease);
}
.att-img { width: 64px; height: 64px; padding: 0; }
.att-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 13px; }
.att-x {
  position: absolute; top: -7px; right: -7px;
  width: 22px; height: 22px; display: grid; place-items: center;
  border: 2px solid var(--surface); border-radius: 50%;
  background: var(--text); color: var(--bg); cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.att-x .i { width: 12px; height: 12px; stroke-width: 3; }
.att:hover .att-x { opacity: 1; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .7s linear infinite; }

.shared-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); color: var(--muted); font-size: 14px; box-shadow: var(--shadow); }
.disclaimer { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ——— перетаскивание ——— */
.drop {
  position: absolute; inset: 0; z-index: 45;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drop.show { opacity: 1; }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 56px; border: 2px dashed rgba(139, 108, 255, .6); border-radius: 28px; text-align: center; transform: scale(.94); transition: transform .3s var(--ease); }
.drop.show .drop-card { transform: none; }
.drop-icon { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 20px; background: var(--grad); color: #fff; animation: bob 1.2s ease-in-out infinite; }
.drop-icon .i { width: 30px; height: 30px; }
.drop-card b { font-size: 20px; }
.drop-card span { color: var(--muted); }

/* ——— тосты, модалки, конфетти ——— */
.toasts { position: fixed; left: 50%; bottom: 120px; z-index: 60; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
  pointer-events: auto; opacity: 0; transform: translateY(12px) scale(.96);
  transition: opacity .25s, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast button { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .5); backdrop-filter: blur(8px); opacity: 0; transition: opacity .2s; }
.modal.show { opacity: 1; }
.modal-card {
  position: relative; width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 28px; border: 1px solid var(--line-2); border-radius: 22px;
  background: var(--surface); box-shadow: var(--shadow);
  transform: translateY(12px) scale(.97); transition: transform .3s var(--ease);
}
.modal.show .modal-card { transform: none; }
.modal-card.plans { width: min(940px, 100%); }
.modal-card h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.muted { margin: 0 0 22px; color: var(--muted); }
.link-input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 12px; outline: 0; background: var(--surface-2); color: var(--text); font: 13px var(--mono); }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface-2); }
.plan-pro { border: 1.5px solid transparent; background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--grad) border-box; }
.plan-h { display: flex; align-items: center; justify-content: space-between; }
.plan-h b { font-size: 18px; }
.tag { padding: 3px 8px; border-radius: 999px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 700; }
.price { display: flex; align-items: baseline; gap: 6px; }
.price span { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.price s { color: var(--faint); }
.price small { color: var(--muted); }
.plan-card ul { flex: 1; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.plan-card li { display: flex; align-items: flex-start; gap: 8px; }
.plan-card li .i { width: 16px; height: 16px; margin-top: 3px; color: var(--ok); }
.plan-pro .btn.primary { background: var(--grad); color: #fff; }

.confetti { position: fixed; left: 50%; top: 42%; z-index: 70; pointer-events: none; }
.confetti i { position: absolute; width: 8px; height: 13px; border-radius: 2px; opacity: 0; animation: confetti 1.9s cubic-bezier(.15, .7, .3, 1) var(--d) forwards; }

/* ——— телефон ——— */
@media (max-width: 800px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: min(84vw, 300px); margin-left: 0 !important;
    transform: translateX(-100%); transition: transform .35s var(--ease);
    box-shadow: var(--shadow);
  }
  .app.sb-open .sidebar { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .app.sb-open .backdrop { opacity: 1; pointer-events: auto; }
  .sb-open, .mobile-new { display: grid; }
  .new-chat kbd { display: none; }
  .topbar { padding: 0 6px; }
  .model-btn { font-size: 16px; padding: 0 6px; }
  .thread { padding: 4px 16px 32px; }
  .composer-wrap { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .tool { width: 34px; padding: 0; justify-content: center; }
  .tool span { display: none; }
  .bubble { max-width: 88%; }
  .actions { opacity: 1; }
  .att-x { opacity: 1; }
  .cards { gap: 8px; }
  .card { padding: 12px; }
  .card:nth-child(n+3) { display: none; }
  .plan-grid { grid-template-columns: 1fr; }
  .disclaimer { font-size: 11px; }
  .toasts { bottom: 130px; }
  .welcome .orb-xl { width: 72px; height: 72px; }
}
@media (hover: none) {
  .actions, .att-x, .ci-acts { opacity: 1; }
  .chat-item .ci-acts { display: flex; }
}

/* ——— анимации ——— */
@keyframes orbspin { to { --a: 360deg; } }
@keyframes blob {
  0%, 100% { border-radius: 50%; }
  33% { border-radius: 58% 42% 55% 45% / 46% 56% 44% 54%; }
  66% { border-radius: 44% 56% 46% 54% / 56% 44% 58% 42%; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes breathe { 50% { transform: scale(.8); opacity: .7; } }
@keyframes shimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } }
@keyframes sheen { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0% 0; } }
@keyframes flow { to { background-position: -200% 0; } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--text) 40%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes micPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 92, 122, .45); } 100% { box-shadow: 0 0 0 12px rgba(255, 92, 122, 0); } }
@keyframes confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  35% { opacity: 1; transform: translate(calc(var(--x) * .6), var(--y)) rotate(calc(var(--r) * .4)); }
  100% { opacity: 0; transform: translate(var(--x), 420px) rotate(var(--r)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* без JS — хотя бы текст для людей и поисковиков */
.noscript { max-width: 560px; margin: 20vh auto 0; padding: 0 16px; text-align: center; color: var(--muted); }
.noscript h1 { color: var(--text); letter-spacing: -.02em; }
