:root {
  --bg: #050816;
  --bg-elevated: #0b1020;
  --bg-card: rgba(39, 45, 70, 0.692);
  --bg-card_c: rgba(39, 45, 70, 0.692);
  --accent: #5c6bff;
  --accent-soft: rgba(92, 107, 255, 0.2);
  --text: #f5f5ff;
  --muted: #a3a3c2;
  --error: #ff4b6e;
  --radius-lg: 18px;
  --radius-md: 10px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #202430);
  background-color: #202430;
  background-image: radial-gradient(circle at top, #202430, #202430);
  color: var(--text);
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  display: flex;
}

.page {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-main {
  flex: 1 0 auto;
  padding-top: 70px; /* или margin-top, подгони под реальную высоту шапки */
}


/* HEADER */

/* HEADER */

.site-header {
  position: fixed; /* было sticky */
  top: 0;
  left: 0;
  right: 0;
  z-index: 21;
  backdrop-filter: blur(18px);
  background:
    radial-gradient(circle at top left, rgba(92, 107, 255, 0.18), rgba(5, 8, 22, 0.96));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}


.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto; /* ЛОГО | МЕНЮ | КНОПКИ */
  align-items: center;
  padding: 10px 0;
  gap: 16px;
}

.header-left {
  min-width: 0;
}

.header-center {
  display: flex;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== ЛОГО С ЛЁГКОЙ АНИМАЦИЕЙ ===== */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: radial-gradient(circle at 20% 0%, #9c6bff, #5c6bff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: logoFloat 4s ease-in-out infinite;
}

.logo-mark-inner {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-main {
  font-size: 1.1rem;
}

.logo-sub {
  font-size: 0.65rem;
  text-transform: none;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.logo:hover .logo-mark {
  transform: translateY(-1px) scale(1.03);
}

/* лёгкое «дышащее» движение */
@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

/* ===== МЕНЮ ===== */

.nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* базовый вид */

.nav-link,
.nav a {
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.08s ease;
}

/* новый, более спокойный hover без «тяжёлой» тени */

.nav-link:hover,
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(0);
}

/* основной акцент (Мои чаты, Регистрация) */

.nav-link--primary {
  background: linear-gradient(135deg, #5c6bff, #9c6bff);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-link--primary:hover {
  background: linear-gradient(135deg, #6b7cff, #aa7cff);
}

/* «призрак» */

.nav-link--ghost {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(4, 8, 24, 0.4);
  color: var(--muted);
}

.nav-link--ghost:hover {
  color: var(--text);
}

/* CTA регистрации чуть заметнее */

.nav-cta {
  padding-inline: 16px;
  font-weight: 600;
}

/* ===== КНОПКИ СПРАВА (тема, язык, аватар) ===== */

.icon-btn {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  color: inherit;
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Переключатель темы */

.theme-toggle {
  width: 36px;
  height: 32px;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.theme-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

/* по умолчанию — тёмная тема (солнце как действие) */
html[data-theme="dark"] .theme-icon-sun {
  opacity: 1;
  transform: translateY(0);
}
html[data-theme="dark"] .theme-icon-moon {
  opacity: 0;
  transform: translateY(10px);
}

/* в светлой теме показываем луну (вернуться в тёмную) */
html[data-theme="light"] .theme-icon-sun {
  opacity: 0;
  transform: translateY(-10px);
}
html[data-theme="light"] .theme-icon-moon {
  opacity: 1;
  transform: translateY(0);
}

/* Язык */

.lang-switcher {
  position: relative;
}

.lang-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(4, 8, 24, 0.7);
  color: var(--text);
  font-size: 0.8rem;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lang-caret {
  font-size: 0.7rem;
  opacity: 0.8;
}

.lang-dropdown {
  position: absolute;
  right: 0;
  margin-top: 4px;
  background: rgba(5, 8, 26, 0.98);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 4px;
  min-width: 90px;
  box-shadow: var(--shadow-soft);
  display: none;
  z-index: 100;
}

.lang-dropdown.is-open {
  display: block;
}

.lang-dropdown button {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.lang-dropdown button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Аватарка */

.avatar-wrapper {
  position: relative;
}

.avatar-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 20% 0%, #9c6bff, #5c6bff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;

}

.avatar-btn:hover .avatar-circle {
  transform: translateY(-1px);
}

/* меню под аватаркой */

.avatar-menu {
  position: absolute;
  right: 0;
  margin-top: 6px;
  background: rgba(5, 8, 26, 0.98);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 4px;
  min-width: 140px;
  box-shadow: var(--shadow-soft);
  display: none;
  z-index: 100;
}

.avatar-menu.is-open {
  display: block;
}

.avatar-menu-item {
  margin: 0;
}

.avatar-menu-btn {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.avatar-menu-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* BUTTONS */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5c6bff, #9c6bff);
  color: #fff;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(92, 107, 255, 0.3);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    opacity 0.12s ease;
}

.btn-primary:hover:not(.is-busy) {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(92, 107, 255, 0.6);
}

button.is-busy {
  opacity: 0.7;
  cursor: wait;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 9px 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  font-weight: 500;
  background: transparent;
  cursor: pointer;
}

.btn-full {
  width: 100%;
}

/* HERO */

.hero {
  padding: 40px 0 24px;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2.5fr);
  gap: 32px;
  align-items: center;
}

.hero-text h1 {
  font-size: clamp(2.1rem, 3.6vw, 2.8rem);
  margin-bottom: 10px;
}

.hero-text p {
  color: var(--muted);
  max-width: 460px;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-benefits {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  color: var(--muted);
}
.hero-benefits li {
  margin-bottom: 6px;
}

/* HERO CARD */

.hero-card {
  background: radial-gradient(circle at top left, rgba(92, 107, 255, 0.14), #050816);
  border-radius: 22px;
  padding: 18px 18px 22px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-preview-body {
  background: rgba(0, 0, 0, 0.45);
  border-radius: 18px;
  padding: 14px;
}

/* CHAT BUBBLES */

.bubble {
  padding: 9px 12px;
  border-radius: 16px;
  font-size: 0.9rem;
  margin-bottom: 15px;
  max-width: 90%;
  word-wrap: break-word;
}

.bubble-user {
  background: linear-gradient(135deg, rgba(92, 108, 255, 0.11), rgba(156, 107, 255, 0.363));
  margin-left: auto;
  color: #fff;
}

.bubble-ai {
  background: rgba(2, 2, 3, 0.212);
  margin-right: auto;
}


.bubble-main {
  margin-top:20px
}

.image-bubble {
  padding: 6px;
}

.ai-image {
  max-width: 100%;
  border-radius: 12px;
  cursor: zoom-in;
}

/* THOUGHTS */

.bubble-thoughts-block {
  max-width: 90%;
  margin-right: auto;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-lg);
}

.bubble-thoughts-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.bubble-thoughts-content {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
  line-height: 1.4;
}

/* SECTIONS / CARDS */

.section {
  padding: 28px 0;
}



.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card_c {
  background: var(--bg-card_c);
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.free-card {
  width: 100%;
  max-width: none;
  margin: 0;
}

.chat-card {
  margin: 0 auto;
  position: relative; /* чтобы кнопка сидела на карточке */
}

.card-subtitle {
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* FEATURES */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.feature-card {
  background: rgba(5, 8, 26, 0.9);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* MODEL PICKER */

.model-picker {
  margin-bottom: 10px;
}

.model-picker-top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.model-picker-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.model-picker-credits {
  font-size: 1rem;
  color: var(--muted);
  justify-content: center;
  text-align: center;
  width: auto;
  position: relative;
}

.model-pill-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.model-pill {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(25, 30, 58, 0.95);
  color: var(--text);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    opacity 0.12s ease,
    transform 0.08s ease;
}

.model-pill span {
  pointer-events: none;
}

.model-pill.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(92, 107, 255, 0.6);
  background: radial-gradient(circle at top left, rgba(92, 107, 255, 0.3), rgba(5, 8, 26, 0.95));
  transform: translateY(-1px);
}

.model-pill.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.model-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

/* FREE TRY */

.free-input-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#free-chat-form textarea {
  width: 100%;
  min-height: 110px;
  max-height: 260px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(4, 8, 25, 0.9);
  color: var(--text);
  padding: 10px 12px;
  resize: none;
  overflow-y: hidden;
  font-family: inherit;
}

#free-chat-form textarea:focus {
  outline: 2px solid var(--accent-soft);
}

.free-answer {
  margin-bottom: 14px;
  color: var(--muted);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(4, 8, 25, 0.97);
  padding: 12px;
  min-height: 80px;
}

.free-answer.empty {
  display: none;
}

/* CHAT PAGE */

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;  /* было flex-start */
  gap: 12px;
  margin-bottom: 34px;
}

.chat-title h2 {
  margin: 0;
  font-size: 1.1rem;
}

.chat-credits {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 20px;

}

.chat-window {
  margin-bottom: 10px;
}

.chat-input-panel {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-input-form textarea {
  width: 100%;
  min-height: 130px;
  max-height: 260px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(23, 28, 49, 0.9);
  color: var(--text);
  padding: 10px 12px;
  resize: none;
  overflow-y: hidden;
  font-family: inherit;
}

.chat-input-form textarea:focus {
  outline: 2px solid var(--accent-soft);
}

/* CHAT TURNS + TOOLS */

.chat-turn {
  margin-bottom: 10px;
}

.chat-user-bubble,
.chat-ai-answer {
  position: relative;
  padding-bottom: 44px;
}

.bubble-tools {
  position: absolute;
  bottom: 4px;
  display: flex;
  gap: 6px;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.chat-user-bubble .bubble-tools {
  right: 10px;
}

.chat-ai-answer .bubble-tools {
  right: 10px;
}

.chat-user-bubble:hover .bubble-tools,
.chat-ai-answer:hover .bubble-tools {
  opacity: 1;
}

.icon-btn {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  color: inherit;
  cursor: pointer;
  font-size: 0.8rem;
}

.icon-btn-1 {
  background: rgba(0, 0, 0, 0.0001);
  border-radius: 999px;
  border: 0px solid rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* редактирование */

.bubble-edit-textarea {
  width: 100%;
  min-height: 60px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 8, 26, 0.95);
  color: var(--text);
  padding: 6px 8px;
  resize: vertical;
  font-family: inherit;
}

/* input row + attachments */

.chat-input-form .input-row {
    display: block !important;
    width: 100%;
}

/* кнопка отправить должна быть НИЖЕ и занимать 100% */
.chat-input-form button[type="submit"] {
    margin-top: 12px;
    width: 100%;
}

/* input row + attachments — НОВАЯ ВЕРСИЯ */

/* формы идут колонкой, кнопка всегда СНИЗУ */
#free-chat-form,
#chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-row {
  width: 100%;
  position: relative;
}

.input-row.drag-over::before {
  content: "Перенесите сюда файлы...";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: rgba(5, 8, 26, 0.9);
  border: 1px dashed rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  z-index: 2;
}

.input-row.drag-over textarea,
.input-row.drag-over .input-attach {
  opacity: 0.25;
}

/* обёртка textarea + 📎 */
.input-row-field {
  position: relative;
  width: 100%;
}

/* textarea на всю ширину + место под иконку */
.input-row-field textarea {
  width: 100%;
  padding-right: 40px; /* место под 📎 */
  box-sizing: border-box;
}

/* 📎 внутри поля, справа внизу */
.input-row-field .input-attach {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

/* скрытый инпут файлов */
.hidden-file-input {
  display: none;
}

/* выбранные файлы (и в демо, и в чате) */
.attach-list {
  margin-bottom: 4px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.attach-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

/* CODE BLOCKS */

/* общее: пусть код не ломает разметку родителя */
.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  color: var(--muted);
}

.code-block-lang {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.code-copy-btn {
  border: none;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  background: rgba(92, 107, 255, 0.25);
  color: #fff;
  
}



.code-copy-btn:hover {
  background: rgba(92, 107, 255, 0.5);
}

.code-block pre {
  max-width: 100%;
  overflow-x: auto;
}

.hljs {
  background: transparent;
  color: #e5e7ff;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-link {
  color: #ffb86c;
  font-weight: 600;
}

.hljs-function .hljs-title,
.hljs-title,
.hljs-name {
  color: #a5ff90;
}

.hljs-string,
.hljs-attr,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
  color: #7ed6ff;
}

.hljs-comment,
.hljs-quote,
.hljs-deletion {
  color: #6b7280;
  font-style: italic;
}

.hljs-number,
.hljs-meta {
  color: #ff7ac6;
}

/* FOOTER */

.site-footer {
  flex: 0 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 0 16px;
  background: rgba(5, 8, 22, 0.98);
  flex-shrink: 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.footer-telegram {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

/* IMAGE VIEWER */

.image-viewer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.image-viewer.hidden {
  display: none;
}

/* чтобы оверлей позиционировался относительно диалога */
.image-viewer-dialog {
  position: relative;
  padding: 10px;
  background: #0a0f25b9;
}

/* затемнение и центрирование спиннера */
.iv-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.411);
  z-index: 10;
}

.iv-loader.hidden {
  display: none;
}

/* сам спиннер */
.iv-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.699);
  border-top-color: #fff; /* можешь заменить на свой accent */
  animation: iv-spin 0.8s linear infinite;
  margin-top: 40px;
}

@keyframes iv-spin {
  
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.image-viewer-title {
  font-size: 14px;
  color: #eee;
}

/* кнопки */
.iv-btn {
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  background: #222;
  color: #eee;
  cursor: pointer;
  font-size: 13px;
}

.iv-btn:hover {
  background: #333;
}

.iv-btn.iv-close {
  background: #3b1a1a;
}

.iv-btn.iv-close:hover {
  background: #552020;
}

.image-viewer-body {
  /* высота по содержимому */
  margin-top: 4px;
}

.image-viewer-scroll {
  flex: 1;
  max-height: 50vh;
  overflow: auto;          /* скролл при увеличении */
}

/* область картинки */
.image-viewer-stage {
  position: relative;
  display: inline-block;
  transform-origin: top left;
}

/* Картинки внутри пузырей чата не должны вылазить */
.chat-window .bubble .chat-image {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.image-viewer-stage img,
.image-viewer-stage canvas {
  display: block;
  max-height: 100%;
}

.image-viewer-stage img {
  position: relative;
  z-index: 1;
}

.image-viewer-stage canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* панель инструментов */
.image-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

#iv-marker-controls {
  display: none; /* показываем только в режиме редактирования */
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #ccc;
}

.iv-marker-controls {
  display: none;           /* включаем только в режиме редактирования */
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #ccc;
}

#iv-marker-size {
  width: 150px;
}

.image-viewer-edit-panel {
  display: none;
  margin-top: 8px;
}

/* текстовая область */
.iv-edit-label {
  display: block;
  font-size: 13px;
  color: #ccc;
  margin-bottom: 6px;
}

.iv-edit-label textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #0c0c0c;
  color: #eee;
  font-size: 13px;
}

.iv-apply-btn {
  margin-top: 6px;
}

/* курсор при рисовании */
.image-viewer-editing .image-viewer-stage canvas {
  cursor: crosshair;
}

#iv-edit-toggle.is-active {
  background: #4a1a1a;
}

.image-viewer-actions {
  display: flex;
  gap: 6px;
}

/* верхняя панель */
.image-viewer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

/* Картинки внутри сообщений */
.chat-window .bubble-main img,
.free-card .bubble-main img,
.chat-ai-answer .bubble-main img,
.free-answer img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  margin: 8px 0;
}

.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ======== ДОБАВКИ: заголовки + компактный текст ======== */

/* Заголовки ВОПРОС / ОТВЕТ в личном чате */
.chat-window .chat-user-bubble::before {
  content: "Запрос";
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--muted);
}

.chat-window .chat-ai-answer::before {
  content: "ИИ";
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--muted);
}

/* Заголовки ВОПРОС / ОТВЕТ в демо-блоке на главной */
#free-chat-answer .bubble-user::before {
  content: "Запрос";
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--muted);
}

#free-chat-answer .chat-ai-answer::before {
  content: "ИИ";
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--muted);
}

/* Компактные отступы ВНУТРИ сообщений (убираем огромные gap’ы) */
.bubble-main,
.bubble-thoughts-content {
  line-height: 1.4;
}

.bubble-main p,
.bubble-main h1,
.bubble-main h2,
.bubble-main h3,
.bubble-main h4,
.bubble-main h5,
.bubble-main h6,
.bubble-main ul,
.bubble-main think,
.bubble-main ol,
.bubble-main pre,
.bubble-main blockquote,
.bubble-thoughts-content p,
.bubble-thoughts-content h1,
.bubble-thoughts-content h2,
.bubble-thoughts-content h3,
.bubble-thoughts-content h4,
.bubble-thoughts-content h5,
.bubble-thoughts-content think,
.bubble-thoughts-content h6,
.bubble-thoughts-content ul,
.bubble-thoughts-content ol,
.bubble-thoughts-content pre,
.bubble-thoughts-content blockquote {
  margin-top: 0em !important;
  margin-bottom: 1.5em !important;
}

.bubble-main p:last-child,
.bubble-main h1:last-child,
.bubble-main h2:last-child,
.bubble-main h3:last-child,
.bubble-main h4:last-child,
.bubble-main h5:last-child,
.bubble-main h6:last-child,
.bubble-main ul:last-child,
.bubble-main ol:last-child,
.bubble-main think:last-child,
.bubble-main pre:last-child,
.bubble-main blockquote:last-child,
.bubble-thoughts-content p:last-child,
.bubble-thoughts-content h1:last-child,
.bubble-thoughts-content h2:last-child,
.bubble-thoughts-content h3:last-child,
.bubble-thoughts-content h4:last-child,
.bubble-thoughts-content h5:last-child,
.bubble-thoughts-content h6:last-child,
.bubble-thoughts-content ul:last-child,
.bubble-thoughts-content ol:last-child,
.bubble-thoughts-content think:last-child,
.bubble-thoughts-content pre:last-child,
.bubble-thoughts-content blockquote:last-child {
  margin-bottom: 0 !important;
}

/* RESPONSIVE */

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 16px;
  position: relative;
}


.chat-sidebar {
  position: relative;
  background: rgba(4, 8, 20, 0.9);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.chat-sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* состояние "сайдбар скрыт" (если когда-то пригодится полностью прятать колонку) */
.chat-layout.sidebar-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.chat-layout.sidebar-hidden .chat-sidebar {
  display: none;
}

/* нормальное состояние кнопки */
.chat-sidebar-toggle {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(5, 8, 26, 0.9);
  color: var(--text);
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.chat-layout.sidebar-collapsed .chat-sidebar {
  padding: 8px 4px;
  background: transparent;
  min-height: auto;
}

/* всё внутри кроме кнопки скрываем */
.chat-layout.sidebar-collapsed .chat-sidebar-title,
.chat-layout.sidebar-collapsed .btn-new-chat,
.chat-layout.sidebar-collapsed .chat-list,
.chat-layout.sidebar-collapsed .chat-edit-toggle-btn,
.chat-layout.sidebar-collapsed .chat-sidebar-bulk-actions {
  display: none;
}

/* кнопка: прилипает к верху и скроллится вместе со страницей */
.chat-layout.sidebar-collapsed .chat-sidebar-toggle {
  position: sticky;
  top: 10px;
  left: 0;
  transform: none;
  padding: 6px 10px;
}

/* свернутый сайдбар: оставляем узкую колонку под кнопку */
.chat-layout.sidebar-collapsed {
  grid-template-columns: 48px minmax(0, 1fr);
}

.chat-sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.chat-scroll-buttons {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}

.chat-scroll-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(5, 8, 26, 0.95);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-scroll-btn:hover {
  background: rgba(92, 107, 255, 0.3);
}

/* можно чуть приглушить на очень маленьких экранах */
@media (max-width: 640px) {
  .chat-scroll-buttons {
    right: 12px;
    bottom: 12px;
  }
}

.btn-new-chat {
  font-size: 0.8rem;
  padding: 6px 10px;
}

.chat-list {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding-right: 4px;

  /* плавный скролл */
  scroll-behavior: smooth;

  /* тонкий аккуратный скроллбар */
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) transparent;
}

.chat-list::-webkit-scrollbar {
  width: 6px;
}

.chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-list::-webkit-scrollbar-thumb {
  background: rgba(92, 107, 255, 0.5);
  border-radius: 999px;
}

.chat-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  background: rgba(12, 16, 36, 0.8);
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease, color 0.12s ease;
}

.chat-list-item:hover {
  background: rgba(22, 30, 60, 0.95);
  color: var(--text);
}

.chat-list-item.is-active {
  background: linear-gradient(
    135deg,
    rgba(92, 107, 255, 0.15),
    rgba(156, 107, 255, 0.2)
  );
  color: var(--text);
}

.chat-list-main {
  flex: 1;
  min-width: 0;
}

.chat-list-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-meta {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

.chat-list-menu {
  position: relative;
  margin-left: 6px;
}

.chat-list-menu-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease;
  cursor: pointer;
}

.chat-list-item:hover .chat-list-menu-btn,
.chat-list-item.is-active .chat-list-menu-btn {
  opacity: 1;
}

.chat-list-menu-btn:hover {
  color: var(--text);
}

.chat-empty-placeholder {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 20px 10px;
}

/* было position: absolute */
.chat-list-menu-popup {
  position: fixed;            /* поверх всего интерфейса */
  margin-top: 0;
  background: #050816;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 4px;
  min-width: 140px;           /* слегка шире, чтобы влезало два пункта */
  z-index: 1000;
  display: none;
}

.chat-list-menu-popup.is-open {
  display: block;
}

.chat-list-menu-popup button {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--error);
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
}

.chat-list-menu-popup button:hover {
  background: rgba(255, 75, 110, 0.1);
}

.chat-list-empty {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 8px 4px;
}

.chat-main {
  display: flex;
  flex-direction: column;
}

/* ====== АДАПТИВ ====== */

@media (max-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-card {
    order: -1;
  }

  .model-pill-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* было @media (max-width: 900px) — можно чуть поднять, если нужно */
@media (max-width: 900px) {

  .public-chat-layout {
    display: block;
  }

  .public-chat-sidebar {
    position: static;
    margin-top: 16px;
  }
  
  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .chat-sidebar {
    order: 1;
    min-height: auto;
    position: relative;   /* на мобиле не прилипает */
    max-height: none;
  }

  .chat-main {
    order: 2;
  }

  .chat-sidebar-toggle {
    display: none;
  }

    /* ⬇️ вот это добавляем */
  .chat-list {
    /* примерно 5 элементов по ~40px */
    max-height: calc(5 * 40px);
  }
}

@media (min-width: 901px) {
  /* сам сайдбар прилипает при скролле страницы */
  .chat-sidebar {
    position: sticky;
    top: 88px;                /* чтобы не заехать под шапку, как в public-chat-sidebar */
    align-self: flex-start;
    max-height: calc(100vh - 110px);  /* чтобы влезал в окно */
    overflow: hidden;         /* скролл только у списка */
  }

  /* в списке максимум ~15 записей */
  .chat-list {
    max-height: calc(20 * 40px);
  }
}

/* ОБЩИЕ стили для прикреплённых файлов (и ПК, и мобилка) */

.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-attachment-card {
  width: 120px;
  padding: 8px;
  border-radius: 8px;
  background: #252525;
  border: 1px solid #333;
  font-size: 11px;
  line-height: 1.3;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.chat-attachment-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  width: 100%;
}

.chat-attachment-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 4px;
}

.chat-attachment-icon {
  font-size: 26px;
  margin-bottom: 4px;
}

.chat-attachment-name {
  text-align: center;
  word-break: break-all;
}

/* дальше уже свои @media, если нужно что-то ДОПРАВИТЬ на мобиле */
@media (max-width: 640px) {
  /* тут можешь оставить только мелкие изменения, либо вообще ничего */
}

@media (max-width: 640px) {

  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .chat-credits {
    align-self: flex-start;
  }
  .header-inner {
    flex-direction: column;
  }

  .model-picker-top-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .model-pill-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Контейнер превью файлов внутри одного сообщения */
  .chat-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px; /* чтобы был отступ от текста */
  }

  /* Карточка одного вложения (как маленький блок) */
  .chat-attachment-card {
    width: 120px;
    padding: 8px;
    border-radius: 8px;
    background: #252525;
    border: 1px solid #333;
    font-size: 11px;
    line-height: 1.3;
    display: flex;
    justify-content: center;
    align-items: stretch;
  }

  /* Ссылка, чтобы всё внутри карточки кликалось */
  .chat-attachment-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
  }

  /* Превью картинки */
  .chat-attachment-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 4px;
  }

  /* Иконка для не-картинок */
  .chat-attachment-icon {
    font-size: 26px;
    margin-bottom: 4px;
  }

  /* Имя файла под превью */
  .chat-attachment-name {
    text-align: center;
    word-break: break-all;
  }

  .chat-window .bubble img {
    max-width: 100%;
    height: auto;
  }

    .code-block {
    overflow-x: auto;             /* контейнер тоже может скроллиться по X */
  }

  .code-block pre {
    white-space: pre-wrap;        /* перенос строк */
    word-break: break-word;       /* перенос «слов»/токенов */
  }

    /* на всякий, чтобы оболочка тоже не вылезала */
  .chat-window .bubble,
  .free-answer,
  .bubble-main {
    max-width: 100%;
  }
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.chat-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-header-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.chat-header-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  color: var(--muted);
}

.chat-date-icon {
  font-size: 0.9rem;
}

/* тумблер */

.chat-public-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 8, 26, 0.8);
  padding: 4px 10px 4px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
}

.chat-public-switch {
  position: relative;
  width: 40px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.15s ease;
}

.chat-public-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.chat-public-switch.is-on {
  background: var(--accent);
}

.chat-public-switch.is-on .chat-public-knob {
  transform: translateX(20px);
}

.chat-header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--text);
  padding: 4px 10px;
  cursor: pointer;
}

.chat-header-action-danger {
  border-color: rgba(255, 75, 110, 0.4);
  color: #ffb9c6;
}

/* публичные карточки */

.public-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.public-card {
  background: rgba(5, 8, 26, 0.9);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.public-card-title {
  font-size: 1rem;
  margin: 0 0 6px;
}

.public-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.public-card-excerpt {
  font-size: 0.85rem;
  color: var(--muted);
}

.public-empty {
  margin-top: 12px;
  color: var(--muted);
}

/* ===== ПУБЛИЧНЫЕ ВОПРОСЫ: СПИСОК ===== */

.public-page-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.public-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}

.public-header-main h1 {
  margin-bottom: 4px;
}

.public-header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 30px;
}

.public-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.public-search {
  flex: 1 1 220px;
}

.public-search-input {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 8, 22, 0.9);
  color: var(--text);
}

.public-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.public-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.public-filter-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.public-filter-btn.is-active {
  background: rgba(92, 107, 255, 0.25);
  color: var(--text);
}

.public-sort-select {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 8, 22, 0.9);
  color: var(--text);
  padding: 4px 8px;
  font-size: 0.8rem;
}

.public-card-updated {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ===== ПУБЛИЧНЫЙ ЧАТ: ЛЕЙАУТ ===== */

/* Лейаут страницы публичного чата */
.public-chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1.2fr);
  gap: 20px;
  align-items: flex-start;
}

/* Основная колонка */
.public-chat-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Сайдбар с "Ещё публичные вопросы" — делаем липким */
.public-chat-sidebar {
  position: sticky;
  top: 88px; /* отступ от верхнего края, чтобы не наезжать на шапку */
  align-self: flex-start;
}



@media (max-width: 960px) {
  /* Общий лейаут страницы публичного чата */
  .public-chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(260px, 1.2fr);
    gap: 24px;
    align-items: flex-start;
  }

  .public-chat-sidebar {
    order: -1;
  }
}

/* Хлебные крошки */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8rem;
  margin-bottom: 10px;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs-current {
  color: var(--text);
}

/* Панель действий в публичном чате */

.public-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

/* Сайдбар */

.public-sidebar-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.public-sidebar-title {
  font-size: 1rem;
  margin-bottom: 4px;
}

.public-sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.public-sidebar-item a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--muted);
  padding: 4px 6px;
  border-radius: var(--radius-md);
  transition: background 0.12s ease, color 0.12s ease;
}

.public-sidebar-item a:hover {
  background: rgba(22, 30, 60, 0.95);
  color: var(--text);
}

.public-sidebar-item-title {
  font-weight: 500;
}

.public-sidebar-item-date {
  font-size: 0.75rem;
  opacity: 0.8;
}

.public-sidebar-more-link {
  font-size: 0.85rem;
  margin-top: 6px;
  text-decoration: none;
  color: var(--muted);
}

.public-sidebar-more-link:hover {
  text-decoration: underline;
}

/* Мобильная версия: сайдбар снизу и на полную ширину */
@media (max-width: 768px) {
  .public-chat-layout {
    display: flex;
    flex-direction: column;
  }

  .public-chat-main,
  .public-chat-sidebar {
    width: 100% !important;     /* растянуть оба блока */
    max-width: 100% !important; /* убрать возможные ограничения */
  }

  .public-chat-sidebar .public-counter{
    order: 2;
    margin-top: 16px;
  }

  .public-header{
    flex-direction: column;
    align-items: normal;  /* чтобы всё прижалось к левому краю */
  }

  .public-header-meta {
    align-self: flex-start;      /* подстраховка, чтобы блок не выравнивался вправо */
    margin-top: -10px;
  }
}



/* ===== Toast "Успешно скопировано" ===== */

.copy-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(5, 8, 26, 0.96);
  border: 1px solid rgba(92, 107, 255, 0.45);
  color: #fff;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  z-index: 3000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.copy-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.is-hidden {
  display: none;
}


/* ====== Массовое удаление чатов (режим "карандаш") ====== */

/* обёртка справа в хедере уже есть, только чуть меняем отступы */
.chat-sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Кнопка-карандаш */
.chat-edit-toggle-btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 16, 36, 0.9);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 9px;
  font-size: 0.9rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.08s ease,
    box-shadow 0.12s ease,
    opacity 0.12s ease;
}

.chat-edit-toggle-btn:hover {
  opacity: 1;
  background: rgba(20, 26, 52, 0.95);
  box-shadow: 0 0 0 1px rgba(92, 107, 255, 0.35);
}

.chat-edit-toggle-btn.is-active {
  border-color: var(--error);
  background: rgba(255, 75, 110, 0.12);
  color: #ffb9c9;
  box-shadow: 0 0 0 1px rgba(255, 75, 110, 0.45);
  opacity: 1;
}

/* Панель массовых действий */

.chat-sidebar-bulk-actions {
  display: none;
  padding: 6px 10px;
  margin: 4px -4px 4px;
  border-radius: 10px;
  background: rgba(54, 54, 54, 0.397);
  border: 1px solid rgba(54, 54, 54, 0.089);
  font-size: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-sidebar-bulk-actions.is-visible {
  display: flex;
}

.chat-sidebar-bulk-actions .bulk-actions-left,
.chat-sidebar-bulk-actions .bulk-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-sidebar-bulk-actions .bulk-actions-label {
  color: var(--muted);
}

/* Кнопка с крестиком слева (icon-btn уже есть в стилях) */
.bulk-actions-cancel {
  font-size: 0.8rem;
}

/* Линковые кнопки (Выбрать все / Снять выделение) */

.btn-link {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  color: var(--accent);
  opacity: 0.9;
  transition: opacity 0.12s ease, text-decoration-color 0.12s ease;
}

.btn-link:hover:not(:disabled) {
  text-decoration: none;
  opacity: 1;
}

.btn-link:disabled {
  opacity: 0.4;
  cursor: default;
  text-decoration: none;
}

/* Красная кнопка удаления */

.btn-danger,
.btn.btn-danger {
  border: none;
  background: var(--error);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.05s ease, opacity 0.12s ease;
}

.btn-danger:hover:not(:disabled),
.btn.btn-danger:hover:not(:disabled) {
  background: #ff2450;
  transform: translateY(-1px);
}

.btn-danger:disabled,
.btn.btn-danger:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Чекбокс и вид списка в режиме редактирования */

.chat-list-select {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
}

.chat-list-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent); /* красивый цвет галочки */
}

/* Активируется, когда JS добавляет класс is-edit-mode на .chat-list */
.chat-list.is-edit-mode .chat-list-select {
  display: flex;
}

.chat-list.is-edit-mode .chat-list-item {
  cursor: default;
}



/* Меню "⋯" делаем полупрозрачным и неактивным в режиме выбора */
.chat-list.is-edit-mode .chat-list-menu {
  opacity: 0.25;
  pointer-events: none;
}

/* ===== ГАМБУРГЕР ===== */

.header-burger {
  display: none;                  /* по умолчанию скрыт, покажем в @media */
  border: none;
  background: transparent;
  padding: 0;
  width: 32px;
  height: 24px;
  border-radius: 999px;
  cursor: pointer;
  outline: none;

  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.header-burger span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9); /* тёмная тема — белые */
  display: block;
}

.header-burger span + span {
  margin-top: 4px;
}

/* анимация крестика */
.site-header.is-menu-open .header-burger span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}
.site-header.is-menu-open .header-burger span:nth-child(2) {
  opacity: 0;
}
.site-header.is-menu-open .header-burger span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* ===== МОБИЛЬНОЕ МЕНЮ (выпадашка под шапкой) ===== */

.mobile-menu {
  display: none;
  padding: 4px 0 8px;
}

.mobile-menu.is-open {
  display: block;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

/* кнопки по ширине контейнера */
.mobile-nav .nav-link,
.mobile-nav .nav-link--primary,
.mobile-nav .nav-link--ghost {
  width: 100%;
  text-align: center;
}

/* ===== МОБИЛЬНАЯ ШАПКА: ОДНА СТРОКА ===== */

@media (max-width: 640px) {
  .site-header .container {
    padding: 10px 16px;
  }

  .header-inner {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;      /* не даём им ломаться странно */
  }

  .header-left {
    flex: 1 1 auto;          /* логотип занимает всё слева */
    min-width: 0;
  }

  .header-right {
    flex: 0 0 auto;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 14px;
  }

  .header-center {
    display: none !important;
  }

  /* ссылки вход/рег/выход прячем, остаётся только тема + бургер */
  .header-right .nav-link,
  .header-right .nav-link--primary,
  .header-right .nav-link--ghost,
  .header-right form {
    display: none !important;
  }

  .theme-toggle {
    display: inline-flex !important;
  }

  .header-burger {
    display: inline-flex !important;
  }
}


/* история пользователя */
.user-history-md {
  white-space: pre-line;   /* сохраняет \n и последовательности пробелов */
  word-break: break-word;
  tab-size: 2;
}

/* текущие сообщения пользователя (пузырь) */
.bubble-user .bubble-main {
  white-space: pre-line;
  word-break: break-word;
  tab-size: 2;
}

/* ===========================
   AUTH (login / register)
   =========================== */

.auth-section {
  padding: 40px 0;
}

.auth-section .container {
  display: flex;
  justify-content: center;   /* по центру по горизонтали */
}

.auth-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;   /* дублируем, если используешь auth-wrapper */
}

.auth-card {
  margin: 0 auto;   
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
  padding: 22px 20px 24px;
}

/* Можно комбинировать с базовой карточкой:
   <div class="card auth-card"> ... */
.auth-card.card {
  padding: 22px 20px 24px;
}

.auth-title {
  margin: 0 0 4px;
  font-size: 1.4rem;
  font-weight: 600;
}

.auth-subtitle {
  margin: 0 0 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.form-group input {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(4, 8, 24, 0.85);
  color: var(--text);
  padding: 9px 11px;
  font-size: 0.9rem;
  outline: none;
  transition:
    border-color 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease;
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(92, 107, 255, 0.6);
  background: rgba(4, 8, 24, 0.96);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

/* Сообщения об ошибке (если используешь) */
.alert-error {
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 75, 110, 0.7);
  background: rgba(255, 75, 110, 0.12);
  color: #ffb9c9;
  font-size: 0.85rem;
  padding: 8px 10px;
}

/* Разделитель "или" */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

/* Соц. кнопки */

.auth-socials {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-social {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(4, 8, 24, 0.8);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    transform 0.08s ease,
    box-shadow 0.12s ease;
}

.btn-social:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.26);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.btn-social-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
}

/* лёгкий оттенок под конкретных провайдеров — без ядовитых цветов */
.btn-google .btn-social-icon {
  color: #fca5a5;
}

.btn-telegram .btn-social-icon {
  color: #93c5fd;
}

.btn-yandex .btn-social-icon {
  color: #facc15;
}

.btn-vk .btn-social-icon {
  color: #93c5fd;
}

/* "Уже есть аккаунт / Нет аккаунта" */

.auth-alt {
  margin-top: 8px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--muted);
}

.auth-alt a {
  color: var(--accent);
  text-decoration: none;
}

.auth-alt a:hover {
  text-decoration: underline;
}

/* Немного адаптива */

@media (max-width: 640px) {
  .auth-section {
    padding: 24px 0;
  }

  .auth-card {
    padding: 20px 16px 22px;
  }
}

.code-input {
  letter-spacing: 0.35em;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.auth-form-resend {
  margin-top: 6px;
}


/* ====== PRICING / ТАРИФЫ ====== */

.pricing-page {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.pricing-intro h1 {
  margin-bottom: 10px;
}

.pricing-intro p {
  max-width: 640px;
}

.pricing-balance {
  margin-top: 8px;
  font-weight: 500;
}

.pricing-note {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* сетка тарифов */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1024px) {
  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .pricing-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pricing-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pricing-card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pricing-title {
  margin: 0;
  font-size: 1rem;
}

.pricing-credits {
  font-size: 0.9rem;
  color: var(--muted);
}

.pricing-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pricing-price-main {
  font-size: 1.2rem;
  font-weight: 600;
}

.pricing-price-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pricing-cta {
  margin-top: auto;
}

.pricing-btn {
  width: 100%;
}

/* выделяем популярный тариф */

.pricing-card--popular {
  position: relative;
}

.pricing-card-label {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(92, 107, 255, 0.22);
}

/* нижний блок */

.pricing-extra {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .pricing-extra {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pricing-extra-block ul {
  padding-left: 18px;
  margin-top: 8px;
}

.pricing-help {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.pricing-auth-hint {
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 8, 26, 0.85);
  font-size: 0.9rem;
  color: var(--muted);
}

/* ====== Профиль / личный кабинет ====== */

.profile-section {
  padding: 32px 0 40px;
}

.profile-title {
  font-size: 1.55rem;
  margin: 0 0 18px;
}

.profile-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-card-title {
  font-size: 1rem;
  font-weight: 600;
}

.profile-card-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}

.profile-badge {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  white-space: nowrap;
}

.profile-ref-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.profile-ref-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.profile-ref-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 8, 26, 0.98);
  color: var(--text);
  font-size: 0.9rem;
  padding: 8px 12px;
  min-width: 0;
}

.profile-ref-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(92, 107, 255, 0.45);
}

.profile-ref-note {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.profile-credits-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-credits-balance {
  font-size: 1.3rem;
  font-weight: 600;
}

.profile-credits-topup {
  white-space: nowrap;
}

.profile-history-list {
  margin-top: 4px;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-history-item {
  display: grid;
  grid-template-columns: minmax(0, 2fr) auto auto;
  gap: 4px 12px;
  font-size: 0.85rem;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.profile-history-reason {
  font-weight: 500;
}

.profile-history-date {
  font-size: 0.78rem;
  color: var(--muted);
}

.profile-history-model {
  align-self: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-history-amount {
  align-self: center;
  justify-self: end;
  font-weight: 600;
  font-size: 0.9rem;
}

.profile-history-amount--minus {
  color: #ff9cae;
}

.profile-history-amount--plus {
  color: #7dffa6;
}

.profile-history-empty {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* мобильная адаптация */
@media (max-width: 640px) {
  .profile-history-item {
    grid-template-columns: minmax(0, 1fr);
  }
  .profile-history-model,
  .profile-history-amount {
    justify-self: flex-start;
  }

  .profile-card {
    padding: 16px 14px;
  }
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.alert-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #bbf7d0;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

/* ===== 404 PAGE ===== */

.section-404 {
  padding: 80px 0;
  text-align: center;
}

.error-card {
  max-width: 520px;
  margin: 0 auto;
  background: radial-gradient(circle at top, rgba(68,87,255,0.14), rgba(5,8,26,0.65));
  padding: 40px 32px;
  border-radius: 22px;
  border: 1px solid rgba(148,163,255,0.18);
  box-shadow: 0 18px 45px rgba(15,23,42,0.6);
}

.error-code {
  font-size: 5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #4457ff, #7a5cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

.error-title {
  font-size: 1.8rem;
  margin-bottom: 14px;
  color: #e5e7eb;
}

.error-text {
  color: #9ca3af;
  font-size: 1rem;
  margin-bottom: 26px;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.btn-big {
  padding: 12px 20px !important;
  font-size: 1rem !important;
  border-radius: 999px;
}



