* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* === СИСТЕМА ЦВЕТОВЫХ ТЕМ (MATTE ORION STYLE) === */
:root,
:root.theme-dark,
[data-theme="theme-dark"],
body.theme-dark,
.theme-dark {
  --bg-main: #0c0d10;
  --bg-sidebar: #0e0e12;
  --bg-input: #1e1f24;
  --bg-hover: #191a20;
  --bg-hover-subtle: rgba(255, 255, 255, 0.05);
  --bg-message-user: #1e1f24;
  --border-color: rgba(255, 255, 255, 0.07);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --text-main: #e3e3e8;
  --text-dim: #8e8e96;
  --text-subtle: #71717a;
  --accent-gold: #c8cbce;
  --code-bg: #14151a;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --overlay-bg: rgba(0, 0, 0, 0.75);
  --ambient-glow: radial-gradient(circle at 50% 45%, rgba(180, 185, 195, 0.05) 0%, rgba(100, 105, 115, 0.02) 42%, rgba(12, 13, 16, 0) 72%);
  --pill-bg: #1e1f24;
  --pill-border: rgba(255, 255, 255, 0.08);
  --pill-text: #ffffff;
  --pill-placeholder: #8e8e96;
  --pill-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --pill-chip-bg: rgba(255, 255, 255, 0.05);
  --pill-chip-text: #c4c7d0;
  --pill-chip-border: rgba(255, 255, 255, 0.12);
  --send-btn-bg: #ffffff;
  --send-btn-color: #0c0d10;
  --btn-surface-bg: #18191e;
  --btn-surface-hover: #23242b;
  --btn-surface-text: #e3e3e8;
  --btn-surface-border: rgba(255, 255, 255, 0.08);
  --dropdown-bg: #14151a;
  --dropdown-border: rgba(255, 255, 255, 0.08);
  --dropdown-item-hover: #1f2028;
  --scrollbar-thumb: rgba(255, 255, 255, 0.1);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.2);
}

:root.theme-light,
[data-theme="theme-light"],
body.theme-light,
.theme-light {
  --bg-main: #f8f9fa;
  --bg-sidebar: #f0f2f5;
  --bg-input: #ffffff;
  --bg-hover: #e4e6eb;
  --bg-hover-subtle: rgba(0, 0, 0, 0.04);
  --bg-message-user: #e4e6eb;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --text-main: #1f2024;
  --text-dim: #606268;
  --text-subtle: #767a84;
  --accent-gold: #40434c;
  --code-bg: #eef1f6;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --overlay-bg: rgba(0, 0, 0, 0.35);
  --ambient-glow: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.025) 0%, rgba(0, 0, 0, 0.008) 42%, rgba(248, 249, 250, 0) 75%);
  --pill-bg: #ffffff;
  --pill-border: rgba(0, 0, 0, 0.1);
  --pill-text: #1f2024;
  --pill-placeholder: #7c8089;
  --pill-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --pill-chip-bg: rgba(0, 0, 0, 0.04);
  --pill-chip-text: #2f343b;
  --pill-chip-border: rgba(0, 0, 0, 0.08);
  --send-btn-bg: #1f2024;
  --send-btn-color: #ffffff;
  --btn-surface-bg: #ffffff;
  --btn-surface-hover: #e4e6eb;
  --btn-surface-text: #1f2024;
  --btn-surface-border: rgba(0, 0, 0, 0.08);
  --dropdown-bg: #ffffff;
  --dropdown-border: rgba(0, 0, 0, 0.1);
  --dropdown-item-hover: #f0f2f5;
  --scrollbar-thumb: rgba(0, 0, 0, 0.14);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);
}

@media (prefers-color-scheme: light) {
  :root.theme-system:not(.theme-dark),
  [data-theme="theme-system"]:not([data-theme="theme-dark"]),
  body.theme-system:not(.theme-dark),
  .theme-system:not(.theme-dark) {
    --bg-main: #f8f9fa;
    --bg-sidebar: #f0f2f5;
    --bg-input: #ffffff;
    --bg-hover: #e4e6eb;
    --bg-hover-subtle: rgba(0, 0, 0, 0.04);
    --bg-message-user: #e4e6eb;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-subtle: rgba(0, 0, 0, 0.04);
    --text-main: #1f2024;
    --text-dim: #606268;
    --text-subtle: #767a84;
    --accent-gold: #40434c;
    --code-bg: #eef1f6;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --overlay-bg: rgba(0, 0, 0, 0.35);
    --ambient-glow: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.025) 0%, rgba(0, 0, 0, 0.008) 42%, rgba(248, 249, 250, 0) 75%);
    --pill-bg: #ffffff;
    --pill-border: rgba(0, 0, 0, 0.1);
    --pill-text: #1f2024;
    --pill-placeholder: #7c8089;
    --pill-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --pill-chip-bg: rgba(0, 0, 0, 0.04);
    --pill-chip-text: #2f343b;
    --pill-chip-border: rgba(0, 0, 0, 0.08);
    --send-btn-bg: #1f2024;
    --send-btn-color: #ffffff;
    --btn-surface-bg: #ffffff;
    --btn-surface-hover: #e4e6eb;
    --btn-surface-text: #1f2024;
    --btn-surface-border: rgba(0, 0, 0, 0.08);
    --dropdown-bg: #ffffff;
    --dropdown-border: rgba(0, 0, 0, 0.1);
    --dropdown-item-hover: #f0f2f5;
    --scrollbar-thumb: rgba(0, 0, 0, 0.14);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);
  }
}

body { background-color: var(--bg-main); color: var(--text-main); height: 100vh; display: flex; overflow: hidden; -webkit-font-smoothing: antialiased; transition: background-color 0.3s ease, color 0.3s ease; }

/* === DRAG AND DROP OVERLAY === */
.drag-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(6, 6, 6, 0.85); backdrop-filter: blur(12px); z-index: 999999; display: flex; align-items: center; justify-content: center; transition: opacity 0.3s ease; }
.drag-overlay.hidden { opacity: 0; pointer-events: none; }
.drag-overlay-content { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--accent-gold); border: 2px dashed var(--accent-gold); padding: 60px 100px; border-radius: 32px; background: rgba(194, 166, 119, 0.05); pointer-events: none; animation: pulse-border 2s infinite; }
.drag-overlay-content h2 { font-weight: 500; font-size: 20px; }
.drag-overlay-content .material-symbols-rounded { font-size: 64px; }
@keyframes pulse-border { 0% { border-color: rgba(194, 166, 119, 0.3); } 50% { border-color: rgba(194, 166, 119, 1); } 100% { border-color: rgba(194, 166, 119, 0.3); } }

/* === ЭКРАН АВТОРИЗАЦИИ === */
.auth-screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: #060606; z-index: 100000; display: flex; transition: opacity 0.5s ease, visibility 0.5s; }
.auth-screen.hidden { opacity: 0; visibility: hidden; }

.auth-left { width: 40%; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 80px 48px; background: linear-gradient(135deg, #070d1a 0%, #030408 100%); border-right: 1px solid rgba(255, 255, 255, 0.03); }
.auth-left::before { content: ''; position: absolute; top: -50%; left: -50%; right: -50%; bottom: -50%; background: radial-gradient(circle at 30% 40%, rgba(20, 50, 100, 0.25), transparent 40%), radial-gradient(circle at 70% 60%, rgba(10, 30, 80, 0.15), transparent 50%); filter: blur(60px); z-index: 1; animation: auroraOrbit 15s ease-in-out infinite alternate; pointer-events: none; }
@keyframes auroraOrbit { 0% { transform: rotate(0deg) scale(1) translate(0, 0); } 50% { transform: rotate(3deg) scale(1.05) translate(2%, 3%); } 100% { transform: rotate(-3deg) scale(1.02) translate(-2%, -1%); } }
.auth-left::after { content: ''; position: absolute; inset: -100%; background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px); background-size: 50px 50px; z-index: 1; -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 50%); mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 50%); animation: moveDiagonalGrid 20s linear infinite; pointer-events: none; }
@keyframes moveDiagonalGrid { 0% { transform: translate(0, 0); } 100% { transform: translate(50px, 50px); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

.auth-left-content { position: relative; z-index: 2; margin-top: auto; margin-bottom: auto; }
.auth-promo-title { font-size: 42px; font-weight: 600; color: #ffffff; line-height: 1.25; margin-bottom: 24px; letter-spacing: -0.02em; opacity: 0; animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.auth-promo-text { font-size: 15px; line-height: 1.6; color: rgba(255, 255, 255, 0.5); margin-bottom: 32px; max-width: 380px; opacity: 0; animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s forwards; }
.auth-promo-btn { display: inline-flex; align-items: center; padding: 10px 20px; border-radius: 9999px; border: 1px solid rgba(255, 255, 255, 0.2); color: #ffffff; text-decoration: none; font-size: 13.5px; font-weight: 500; background: rgba(255, 255, 255, 0.02); transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); opacity: 0; animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s forwards; }
.auth-promo-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.5); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
.auth-promo-btn .material-symbols-rounded { transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.auth-promo-btn:hover .material-symbols-rounded { transform: translateX(4px); }

.auth-right { width: 60%; display: flex; align-items: center; justify-content: center; position: relative; background-color: #060606; }
.auth-card { width: 100%; max-width: 380px; padding: 24px; display: flex; flex-direction: column; align-items: center; opacity: 0; animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s forwards; }

/* Экран авторизации (логотип) */
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; cursor: default; }
.auth-brand-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; box-shadow: 0 0 15px rgba(255, 255, 255, 0.05); transition: box-shadow 0.4s ease, transform 0.4s ease; }
.auth-brand:hover .auth-brand-logo { box-shadow: 0 0 30px rgba(255, 255, 255, 0.15); transform: scale(1.05); }
.auth-brand-title { font-size: 26px; font-weight: 700; letter-spacing: -0.04em; color: #ffffff; display: flex; align-items: center; gap: 8px; }
.auth-brand-badge { background-color: #ffffff; color: #000000; font-size: 10px; font-weight: 800; padding: 3px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px;}

.auth-input-group { width: 100%; margin-bottom: 16px; position: relative; }
.auth-input-group input { width: 100%; padding: 14px 22px; font-size: 14px; border-radius: 9999px; border: 1px solid rgba(255, 255, 255, 0.08); background-color: rgba(255, 255, 255, 0.02); color: #ffffff; outline: none; transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.auth-input-group input::placeholder { color: rgba(255, 255, 255, 0.25); transition: color 0.3s ease; }
.auth-input-group input:focus { border-color: rgba(255, 255, 255, 0.3); background-color: rgba(255, 255, 255, 0.05); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.02); }
.auth-input-group input:focus::placeholder { color: rgba(255, 255, 255, 0.5); }
.toggle-pwd-btn { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: rgba(255, 255, 255, 0.4); cursor: pointer; display: flex; transition: color 0.2s; }
.toggle-pwd-btn:hover { color: #ffffff; }

.auth-disclaimer { font-size: 11px; line-height: 1.5; color: rgba(255, 255, 255, 0.35); margin-top: 4px; margin-bottom: 20px; text-align: center; }
.auth-disclaimer a { color: rgba(255, 255, 255, 0.6); text-decoration: none; transition: color 0.2s; }
.auth-disclaimer a:hover { color: #ffffff; }
.auth-meta { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; padding: 0 4px; }
.auth-link { font-size: 13px; color: rgba(255, 255, 255, 0.45); text-decoration: none; background: transparent; border: none; cursor: pointer; transition: 0.2s; font-weight: 500; }
.auth-link:hover { color: #ffffff; }

.auth-submit-btn { width: 100%; padding: 14px; border-radius: 9999px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; background-color: #ffffff; color: #060606; transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.auth-submit-btn:hover { background-color: rgba(255, 255, 255, 0.9); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(255, 255, 255, 0.1); }
.auth-submit-btn:active { transform: translateY(0); }
.auth-guest-link { margin-top: 24px; font-size: 13px; color: rgba(255, 255, 255, 0.4); text-decoration: none; background: transparent; border: none; cursor: pointer; transition: 0.2s; }
.auth-guest-link:hover { color: #ffffff; }
.auth-copyright { position: absolute; bottom: 32px; font-size: 11px; color: rgba(255, 255, 255, 0.25); letter-spacing: 0.02em; }
@media (max-width: 900px) { .auth-left { display: none; } .auth-right { width: 100%; } }

/* === БОКОВАЯ ПАНЕЛЬ (ORION MATTE STYLE) === */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  z-index: 20;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.3s ease, border-color 0.3s ease;
  overflow: visible;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 0;
  border-right: none;
  overflow: hidden;
}

.sidebar-inner {
  width: 260px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 14px 14px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.orion-logo-img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.logo-text {
  font-size: 17.5px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.015em;
  font-family: 'Inter', -apple-system, sans-serif;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.new-chat-btn-full {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 9999px;
  background: var(--btn-surface-bg);
  border: 1px solid var(--btn-surface-border);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px var(--shadow-color);
  box-sizing: border-box;
}

.new-chat-btn-full:hover {
  background: var(--btn-surface-hover);
  border-color: var(--border-color);
}

.new-chat-btn-full svg, .new-chat-btn-full .material-symbols-rounded {
  color: var(--text-main);
  flex-shrink: 0;
}

.menu-badge-new {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  padding: 2px 7px;
  border-radius: 9999px;
  margin-left: auto;
  letter-spacing: 0.02em;
}
.theme-light .menu-badge-new {
  background: rgba(0, 0, 0, 0.08);
  color: #374151;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 6px 4px;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  user-select: none;
}
.section-collapsible {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-dim);
  transition: color 0.2s;
}
.section-collapsible:hover {
  color: var(--text-main);
}
.history-filter-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-dim);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.sidebar-menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  width: 100%;
  text-align: left;
}

.sidebar-menu-btn:hover {
  background: var(--bg-hover);
}

.sidebar-menu-btn .material-symbols-rounded {
  font-size: 19px;
  color: var(--text-dim);
}

.sidebar-menu-btn:hover .material-symbols-rounded {
  color: var(--text-main);
}

.history-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  padding: 8px 8px 4px;
}

.sidebar-history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}

.sidebar-history::-webkit-scrollbar { width: 3px; }
.sidebar-history::-webkit-scrollbar-track { background: transparent; }
.sidebar-history::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
.sidebar-history::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.history-item:hover, .history-item.active {
  background-color: var(--bg-hover);
}

.history-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-dots-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.18s ease;
  flex-shrink: 0;
  opacity: 0.5;
}
.history-dots-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-hover);
  opacity: 1;
}

.sidebar-bottom-full {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  position: relative;
}

.user-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.user-profile-row:hover {
  background-color: var(--bg-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #2c2d35 0%, #1c1d22 100%);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  text-transform: uppercase;
}

.theme-light .user-avatar {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  color: var(--text-main);
}

.user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-plan {
  font-size: 11.5px;
  color: var(--text-dim);
}

.settings-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.user-profile-row:hover .settings-icon-wrapper {
  color: var(--text-main);
  background-color: var(--bg-hover-subtle);
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.settings-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: auto;
  width: max-content;
  min-width: 275px;
  max-width: min(340px, calc(100vw - 28px));
  box-sizing: border-box;
  background-color: var(--dropdown-bg);
  border: 1px solid var(--dropdown-border);
  border-radius: 16px;
  padding: 8px 0;
  box-shadow: 0 12px 40px var(--shadow-color);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform-origin: bottom left;
  animation: dropdownFade 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: background-color 0.3s ease, border-color 0.3s ease;
  overflow: visible;
}

.settings-dropdown.hidden { display: none; }
.dropdown-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
  width: 100%;
  overflow: visible;
}

.dropdown-item:hover { 
  background-color: var(--dropdown-item-hover); 
  color: var(--text-main);
}
.dropdown-item .material-symbols-rounded { 
  font-size: 18px; 
  color: var(--text-dim); 
  flex-shrink: 0;
}
.dropdown-divider { height: 1px; background-color: var(--border-color); margin: 6px 0; }

/* === THEME SWITCHER WIDGET (EXACT PILL WITH SATELLITE / ACTIVE DIAL) === */
.orion-theme-pill-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--btn-surface-bg);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 4px;
  gap: 4px;
  box-shadow: 0 6px 20px var(--shadow-color);
  user-select: none;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.theme-pill-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.theme-pill-btn:hover:not(.active) {
  color: var(--text-main);
  background: var(--bg-hover-subtle);
}

.theme-pill-btn.active {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  box-shadow: 0 4px 14px var(--shadow-color);
  transform: scale(1.02);
}

.theme-pill-btn svg {
  display: block;
  transition: transform 0.2s ease;
}

.theme-pill-btn:hover svg {
  transform: scale(1.08);
}

.theme-pill-btn.active svg {
  filter: drop-shadow(0 0 6px var(--shadow-color));
}

/* Dropdown specific size */
.dropdown-theme-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  box-sizing: border-box;
  width: 100%;
}

.dropdown-theme-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
}
.dropdown-theme-label .material-symbols-rounded {
  font-size: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.dropdown-theme-switcher {
  padding: 3px;
  gap: 2px;
}

.dropdown-theme-switcher .theme-pill-btn {
  width: 32px;
  height: 32px;
}

/* Settings modal theme block */
.settings-theme-block {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 16px 20px;
  margin-bottom: 20px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.settings-theme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.settings-theme-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.settings-theme-current {
  font-size: 12px;
  color: var(--accent-gold);
  font-weight: 500;
}

.theme-switcher-wrapper {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.icon-btn { background: transparent; border: none; color: var(--text-dim); width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.icon-btn:hover { background-color: var(--bg-hover); color: var(--text-main); }

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  height: 100vh;
  min-width: 0;
  z-index: 10;
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* === GEMINI AMBIENT NEBULA GLOW (MATTE) === */
.gemini-ambient-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--ambient-glow);
  z-index: 1;
  transition: background 0.4s ease;
}

.top-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
  background: transparent;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.sidebar-toggle-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.2s;
}
.sidebar-toggle-btn:hover {
  background-color: var(--bg-hover);
}
.sidebar-toggle-btn.hidden { display: none !important; }

.menu-status-dot {
  position: absolute;
  top: 6px;
  left: 17px;
  width: 5px;
  height: 5px;
  background-color: #3b82f6;
  border-radius: 50%;
  box-shadow: 0 0 6px #3b82f6;
}

.header-model-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 12px;
  transition: background-color 0.2s ease;
  font-family: inherit;
}
.header-model-btn:hover {
  background: var(--bg-hover);
}

.header-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.header-action-btn:hover {
  background-color: var(--bg-hover);
}

.header-avatar-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #00897b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: transform 0.2s ease;
}
.header-avatar-btn:hover .user-avatar-small {
  transform: scale(1.06);
}

.hero-sparkle-wrapper {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatSparkle 3s ease-in-out infinite alternate;
}
.orion-sparkle-hero {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 0 16px rgba(78, 136, 255, 0.4));
}
@keyframes floatSparkle {
  0% { transform: translateY(0); filter: drop-shadow(0 0 14px rgba(78, 136, 255, 0.35)); }
  100% { transform: translateY(-4px); filter: drop-shadow(0 0 24px rgba(255, 82, 82, 0.45)); }
}

.gemini-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--btn-surface-bg);
  border: 1px solid var(--btn-surface-border);
  border-radius: 9999px;
  padding: 8px 16px;
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.gemini-header-btn:hover {
  background: var(--btn-surface-hover);
  border-color: var(--border-color);
}

.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 60px;
  padding-bottom: 200px;
  position: relative;
  z-index: 2;
}
.chat-scroll-area::-webkit-scrollbar { width: 6px; }
.chat-scroll-area::-webkit-scrollbar-track { background: transparent; }
.chat-scroll-area::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
.chat-scroll-area::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

.orion-layout {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  padding: 0 24px;
  min-height: 100%;
}

.hero-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 70px;
  text-align: center;
}
.hero-container.hidden { display: none !important; }

.hero-title {
  font-size: 32px;
  font-weight: 500;
  color: var(--text-main);
  text-align: center;
  letter-spacing: -0.015em;
  font-family: 'Inter', sans-serif;
  margin-bottom: 16px;
  transition: color 0.3s ease;
}

.hero-chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pill-chip-bg);
  border: 1px solid var(--pill-chip-border);
  border-radius: 9999px;
  padding: 7px 22px;
  color: var(--text-main);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.hero-chip-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  transform: scale(1.02);
}

.messages-list { display: flex; flex-direction: column; width: 100%; padding-top: 24px; padding-bottom: 24px; }
.messages-list.hidden { display: none !important; }
.chat-bottom-spacer {
  width: 100%;
  height: 120px;
  min-height: 120px;
  flex-shrink: 0;
  pointer-events: none;
}
.message-wrapper { 
  display: flex; 
  flex-direction: column; 
  width: 100%; 
  min-width: 0;
  margin-bottom: 24px; 
  contain: style;
}
.message-wrapper.user { align-items: flex-end; }
.message-wrapper.ai { align-items: flex-start; }
.message {
  padding: 14px 20px;
  border-radius: 24px;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-weight: 400;
  font-family: 'Inter', sans-serif;
  margin-bottom: 6px;
  min-width: 0;
  max-width: 100%;
  contain: style;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.message.user {
  max-width: 85%;
  min-width: 0;
  background-color: var(--bg-message-user);
  color: var(--text-main);
  border-bottom-right-radius: 4px;
  border: 1px solid var(--border-subtle);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.message.ai {
  max-width: 100%;
  width: 100%;
  min-width: 0;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 4px 0 8px 0 !important;
  margin-bottom: 4px;
  color: #e3e3e3 !important;
  font-size: 15.5px;
  line-height: 1.6 !important;
  letter-spacing: -0.005em;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.theme-light .message.ai {
  color: #27272a !important;
}

.msg-image { max-width: 320px; max-height: 280px; border-radius: 14px; object-fit: cover; margin-bottom: 8px; border: 1px solid var(--border-color); display: block; box-shadow: 0 4px 12px var(--shadow-color); }
.msg-actions { display: flex; gap: 4px; padding: 0 12px; opacity: 0; transition: opacity 0.2s; }
.message-wrapper:hover .msg-actions { opacity: 1; }
.action-btn { background: transparent; border: none; color: var(--text-dim); width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.action-btn:hover { color: var(--text-main); background-color: var(--bg-hover); }
.action-btn .material-symbols-rounded { font-size: 18px; }

/* === НИЖНЯЯ ПАНЕЛЬ ДЕЙСТВИЙ ОТВЕТА МОДЕЛИ === */
.msg-actions.ai-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  margin-top: 8px;
  opacity: 1 !important;
  transition: opacity 0.2s ease;
}

.msg-actions.ai-actions .action-btn {
  background: transparent;
  border: none;
  color: #9ca3af; /* neutral-400 */
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
  position: relative;
  padding: 0;
}

.msg-actions.ai-actions .action-btn:hover {
  color: #f3f4f6;
  background-color: rgba(255, 255, 255, 0.08);
}

.msg-actions.ai-actions .action-btn:active {
  transform: scale(0.94);
}

.theme-light .msg-actions.ai-actions .action-btn {
  color: #9ca3af;
}

.theme-light .msg-actions.ai-actions .action-btn:hover {
  color: #1f2937;
  background-color: rgba(0, 0, 0, 0.06);
}

.msg-actions.ai-actions .action-btn.btn-like.active {
  color: #34d399 !important;
  background-color: rgba(52, 211, 153, 0.12) !important;
}

.msg-actions.ai-actions .action-btn.btn-dislike.active {
  color: #f87171 !important;
  background-color: rgba(248, 113, 113, 0.12) !important;
}

.msg-actions.ai-actions .action-btn.btn-copy.copied {
  color: #34d399 !important;
}

/* Меню «Дополнительно» (⋯) */
.action-more-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.action-more-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #18191f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 165px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 50;
  animation: fadeIn 0.15s ease-out;
}

.theme-light .action-more-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.action-more-menu.hidden {
  display: none !important;
}

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: #d1d5db;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.more-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.theme-light .more-menu-item {
  color: #374151;
}

.theme-light .more-menu-item:hover {
  background-color: rgba(0, 0, 0, 0.06);
  color: #111827;
}

.action-btn.speaking-active { color: var(--accent-gold); background-color: var(--bg-hover); animation: pulse-speak 1.5s infinite; }
@keyframes pulse-speak { 0% { box-shadow: 0 0 0 0 rgba(200, 205, 215, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(200, 205, 215, 0); } 100% { box-shadow: 0 0 0 0 rgba(200, 205, 215, 0); } }

/* === ORION AI MINIMAL SPINNER & TYPING EFFECT === */
@keyframes orionSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.orion-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--text-main);
  animation: orionSpin 0.75s linear infinite;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  box-sizing: border-box;
  margin: 6px 0;
}

.theme-light .orion-spinner {
  border-color: rgba(0, 0, 0, 0.12);
  border-top-color: var(--text-main);
}

/* Курсор плавной печати в стиле Gemini / ChatGPT */
.orion-typing-cursor {
  display: inline-block;
  width: 3px;
  height: 16px;
  background-color: var(--text-main);
  border-radius: 1px;
  margin-left: 2px;
  vertical-align: -2px;
  animation: cursorBlink 0.75s ease infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Скрываем кнопки действий во время генерации */
.message-wrapper.is-generating .msg-actions {
  display: none !important;
}

.typing-indicator { color: var(--text-dim); font-size: 14px; font-weight: 500; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 0.3; } 50% { opacity: 1; } 100% { opacity: 0.3; } }
/* Сноски-бейджи на вложения/файлы (например, PNG, JPG): компактные плашки прямо в тексте — серый полупрозрачный фон, мелкий шрифт, закругленные углы */
.file-chip,
.file-badge,
.inline-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #d1d5db !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  padding: 2.5px 7px !important;
  border-radius: 5px !important;
  vertical-align: middle;
  margin: 0 2px;
  letter-spacing: 0.02em;
  font-family: 'JetBrains Mono', 'Inter', monospace;
  box-sizing: border-box;
  user-select: none;
}
.file-chip .material-symbols-rounded,
.file-badge .material-symbols-rounded {
  font-size: 13px !important;
  color: #9ca3af;
}
.theme-light .file-chip,
.theme-light .file-badge,
.theme-light .inline-file-badge {
  background: rgba(0, 0, 0, 0.06) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #374151 !important;
}

/* === INTERACTION AREA & MATTE PILL BAR === */
.interaction-area {
  position: absolute;
  left: 50%;
  width: 100%;
  max-width: 740px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: top 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 100;
}
.interaction-area.center-mode {
  top: 52%;
  transform: translate(-50%, -50%);
}
.interaction-area.bottom-mode {
  top: 100%;
  transform: translate(-50%, calc(-100% - 24px));
}
.interaction-box {
  width: 100%;
  max-width: 740px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

/* ПРЕВЬЮ ИЗОБРАЖЕНИЯ / ФАЙЛА В СТРОКЕ ВВОДА */
.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--btn-surface-bg);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 16px;
  margin-bottom: 12px;
  width: fit-content;
  align-self: flex-start;
  animation: fadeIn 0.2s ease-out;
  box-shadow: 0 4px 16px var(--shadow-color);
  transition: 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.attachment-preview.hidden { display: none !important; }
.attachment-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.attachment-thumb.hidden { display: none !important; }
.attachment-name { font-size: 13px; font-weight: 500; color: var(--text-main); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#btn-remove-attachment { width: 24px; height: 24px; background: var(--bg-hover); border-radius: 50%; }
#btn-remove-attachment:hover { background: var(--border-color); }
#btn-remove-attachment span { font-size: 14px; color: var(--text-main); }

/* ТОЧНЫЙ МАТОВЫЙ ДИЗАЙН ПИЛЮЛИ (GEMINI STYLE) */
.orion-pill-bar {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 52px;
  height: auto;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 26px;
  display: flex;
  align-items: flex-end;
  padding: 8px 12px 8px 14px;
  gap: 10px;
  box-shadow: var(--pill-shadow);
  box-sizing: border-box;
  overflow: hidden;
  transition: background 0.3s ease, border-color 0.2s ease, box-shadow 0.2s ease, border-radius 0.2s ease;
}

.orion-pill-bar:focus-within {
  border-color: var(--accent-gold);
}

.pill-btn-plus {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  margin-bottom: 1px;
}

.pill-btn-plus:hover {
  color: var(--text-main);
  background: var(--bg-hover-subtle);
}

#prompt-input {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--pill-text);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.45;
  resize: none;
  min-height: 24px;
  max-height: 140px;
  overflow-x: hidden;
  overflow-y: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  padding: 5px 0;
  margin: 0;
  box-sizing: border-box;
  transition: color 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

#prompt-input::-webkit-scrollbar,
#user-input::-webkit-scrollbar,
textarea#prompt-input::-webkit-scrollbar {
  width: 4px;
}

#prompt-input::-webkit-scrollbar-track,
#user-input::-webkit-scrollbar-track,
textarea#prompt-input::-webkit-scrollbar-track {
  background: transparent;
}

#prompt-input::-webkit-scrollbar-thumb,
#user-input::-webkit-scrollbar-thumb,
textarea#prompt-input::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
  transition: background 0.2s ease;
}

#prompt-input::-webkit-scrollbar-thumb:hover,
#user-input::-webkit-scrollbar-thumb:hover,
textarea#prompt-input::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

#prompt-input::placeholder {
  color: var(--pill-placeholder);
}

.pill-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-bottom: 1px;
}

.pill-model-selector {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--pill-chip-text);
  background: var(--pill-chip-bg);
  border: 1px solid var(--pill-chip-border);
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.pill-model-selector:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.pill-btn-icon {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.2s ease;
  padding: 0;
}

.pill-btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-hover-subtle);
}

.pill-btn-icon.recording {
  color: #ff4a4a !important;
  animation: pulse-red 1.5s infinite;
}

.pill-btn-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--send-btn-bg);
  color: var(--send-btn-color);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.pill-btn-send:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.pill-btn-send.hidden {
  display: none !important;
}

.orion-disclaimer {
  font-size: 11.5px;
  color: var(--text-subtle);
  text-align: center;
  margin-top: 10px;
  font-weight: 400;
  letter-spacing: -0.01em;
  user-select: none;
  transition: color 0.3s ease;
  padding: 0 16px;
}

@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(255, 74, 74, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(255, 74, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 74, 74, 0); } }

.scroll-bottom-btn { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); background-color: var(--bg-sidebar); border: 1px solid var(--border-color); color: var(--text-main); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.3s, background-color 0.2s; z-index: 10; box-shadow: 0 4px 12px var(--shadow-color);}
.scroll-bottom-btn .material-symbols-rounded { font-size: 18px; }
.scroll-bottom-btn.visible { opacity: 1; pointer-events: auto; }
.scroll-bottom-btn:hover { background-color: var(--bg-hover); }

.message p {
  margin-top: 0;
  margin-bottom: 14px;
  line-height: 1.62;
}
.message p:last-child {
  margin-bottom: 0;
}

/* Заголовки (H2/H3): аккуратный жирный шрифт с небольшим отступом сверху и снизу (например, «Как это исправить:») */
.message h1,
.message h2,
.message h3,
.message h4,
.message-heading {
  color: #f3f4f6;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
}
.message h1 {
  font-size: 1.28rem;
  margin-top: 20px;
  margin-bottom: 10px;
}
.message h2,
.heading-h2 {
  font-size: 1.16rem;
  margin-top: 18px;
  margin-bottom: 8px;
}
.message h3,
.heading-h3 {
  font-size: 1.05rem;
  margin-top: 14px;
  margin-bottom: 6px;
}
.message h4,
.heading-h4 {
  font-size: 0.98rem;
  margin-top: 12px;
  margin-bottom: 4px;
}
.message h1:first-child,
.message h2:first-child,
.message h3:first-child,
.message h4:first-child,
.message-heading:first-child {
  margin-top: 2px;
}
.theme-light .message h1,
.theme-light .message h2,
.theme-light .message h3,
.theme-light .message h4,
.theme-light .message-heading {
  color: #111827;
}

/* Нумерованные и маркированные списки: четкие отступы слева, жирный текст в начале пункта */
.message ul,
.message ol {
  margin-top: 8px;
  margin-bottom: 14px;
  padding-left: 24px;
  margin-left: 0;
}
.message li {
  margin-bottom: 8px;
  line-height: 1.62;
  padding-left: 4px;
}
.message li:last-child {
  margin-bottom: 0;
}
.message li > strong:first-child,
.message li > b:first-child {
  color: #ffffff;
  font-weight: 700;
}
.theme-light .message li > strong:first-child,
.theme-light .message li > b:first-child {
  color: #111827;
  font-weight: 700;
}

/* Скрытие любых горизонтальных полос-разделителей (<hr>) внутри сообщений чата */
.message hr,
.message.ai hr,
.message-wrapper hr,
.chat-messages hr,
.messages-list hr,
.message-content hr,
.chat-message hr,
.ai-response hr,
.prose hr,
hr {
  display: none !important;
}

/* === ИНТЕРАКТИВНЫЙ GEMINI CANVAS / ORION ARTIFACT WIDGET === */
.code-block-wrapper {
  margin: 22px 0;
  border-radius: 22px;
  background-color: #16171b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  position: relative;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-light .code-block-wrapper {
  background-color: #f8f9fa;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 16px;
  background-color: #1e1f24;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
  gap: 12px;
}

.theme-light .code-block-header {
  background-color: #edf0f5;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

/* Left side: Sparkles, Title, Cloud, Undo, Redo */
.code-block-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1 1 auto;
}

.canvas-sparkles {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #a8c7fa;
  flex-shrink: 0;
  transition: all 0.25s ease;
  position: relative;
}

.canvas-sparkles .canvas-sparkle-path {
  fill: #a8c7fa;
  transition: fill 0.3s ease;
}

/* === СЕРО-ЧЁРНАЯ ПЕРЕЛИВАЮЩАЯСЯ АНИМАЦИЯ ИКОНКИ ПРИ ГЕНЕРАЦИИ САЙТА === */
@keyframes metallicRotatePulse {
  0% {
    transform: rotate(0deg) scale(1);
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.2));
  }
  25% {
    transform: rotate(8deg) scale(1.1);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6)) drop-shadow(0 0 10px rgba(156, 163, 175, 0.5));
  }
  50% {
    transform: rotate(0deg) scale(1.18);
    filter: drop-shadow(0 0 9px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 16px rgba(209, 213, 219, 0.6));
  }
  75% {
    transform: rotate(-8deg) scale(1.1);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6)) drop-shadow(0 0 10px rgba(156, 163, 175, 0.5));
  }
  100% {
    transform: rotate(0deg) scale(1);
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.2));
  }
}

.canvas-sparkles.is-generating,
.code-block-wrapper.is-generating .canvas-sparkles {
  animation: metallicRotatePulse 2.4s ease-in-out infinite;
}

.canvas-sparkles.is-generating .canvas-sparkle-path,
.code-block-wrapper.is-generating .canvas-sparkles .canvas-sparkle-path {
  fill: url(#canvas-shimmer-grayblack) !important;
}

/* Бейдж процесса создания интерфейса */
.canvas-generating-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, 'Google Sans', 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  user-select: none;
  flex-shrink: 0;
}

.canvas-generating-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d1d5db;
  box-shadow: 0 0 8px #ffffff;
  animation: pulseDotShimmer 1.4s ease-in-out infinite;
}

@keyframes pulseDotShimmer {
  0%, 100% {
    opacity: 0.4;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.25);
    background: #ffffff;
  }
}

.canvas-generating-text {
  background: linear-gradient(
    90deg,
    #6b7280 0%,
    #d1d5db 25%,
    #ffffff 50%,
    #9ca3af 75%,
    #4b5563 100%
  );
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: metallicTextShimmer 2.2s linear infinite;
  white-space: nowrap;
}

@keyframes metallicTextShimmer {
  0% {
    background-position: 250% center;
  }
  100% {
    background-position: -250% center;
  }
}

.code-block-wrapper.is-generating .canvas-status-cloud,
.code-block-wrapper.is-generating .canvas-history-group {
  display: none !important;
}

.canvas-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Google Sans', 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  color: #e3e3e3;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.theme-light .canvas-title {
  color: #1f1f1f;
}

.canvas-status-cloud {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8ab4f8;
  opacity: 0.85;
  cursor: default;
  flex-shrink: 0;
}

.canvas-history-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
}

.canvas-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #c4c7c5;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.canvas-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.theme-light .canvas-icon-btn {
  color: #5f6368;
}

.theme-light .canvas-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1f1f1f;
}

/* Center Pill: Код | Предпросмотр */
.code-block-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.code-tabs-pill {
  display: inline-flex;
  align-items: center;
  background: #131417;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  padding: 3px;
  gap: 2px;
}

.theme-light .code-tabs-pill {
  background: #e1e3e8;
  border-color: rgba(0, 0, 0, 0.08);
}

.code-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: #9aa0a6;
  font-family: -apple-system, BlinkMacSystemFont, 'Google Sans', 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.theme-light .code-tab-btn {
  color: #5f6368;
}

.code-tab-btn:hover {
  color: #ffffff;
}

.theme-light .code-tab-btn:hover {
  color: #1f1f1f;
}

.code-tab-btn.active {
  background: #2b2c32;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.theme-light .code-tab-btn.active {
  background: #ffffff;
  color: #1f1f1f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Right side actions: Экспортировать, Share, Fullscreen, Close */
.code-block-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
}

.canvas-export-wrap {
  position: relative;
}

.canvas-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 9999px;
  background: #282a2f;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e3e3e3;
  font-family: -apple-system, BlinkMacSystemFont, 'Google Sans', 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}

.canvas-export-btn:hover {
  background: #33363c;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
}

.theme-light .canvas-export-btn {
  background: #e1e3e8;
  border-color: rgba(0, 0, 0, 0.08);
  color: #1f1f1f;
}

.theme-light .canvas-export-btn:hover {
  background: #d4d7dc;
}

/* Export Dropdown Menu */
.canvas-export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 215px;
  background: #212227;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  padding: 6px;
  z-index: 10000;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: codePaneFadeIn 0.18s ease-out forwards;
}

.canvas-export-menu.hidden {
  display: none !important;
}

.theme-light .canvas-export-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.canvas-export-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #c4c7c5;
  font-family: -apple-system, BlinkMacSystemFont, 'Google Sans', 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.14s ease;
}

.canvas-export-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.theme-light .canvas-export-item {
  color: #444746;
}

.theme-light .canvas-export-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1f1f1f;
}

/* Code block body */
.code-block-body {
  position: relative;
  background-color: #16171b;
  border-radius: 0 0 22px 22px;
  overflow: hidden;
}

.theme-light .code-block-body {
  background-color: #f8f9fa;
}

.code-pane {
  display: none;
  opacity: 0;
  width: 100%;
}

.code-pane.active {
  display: block;
  opacity: 1;
  animation: codePaneFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes codePaneFadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.code-preview-frame-container,
.canvas-preview-container {
  position: relative;
  width: 100%;
  height: 520px;
  min-height: 480px;
  background-color: #131315;
  overflow: hidden;
  border-radius: 0 0 16px 16px;
}

.preview-loading-canvas,
.canvas-shimmer-skeleton {
  position: relative;
  width: 100%;
  height: 520px;
  background-color: #131315;
  overflow: hidden;
  border-radius: 0 0 16px 16px;
  isolation: isolate;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.code-preview-frame-container .preview-loading-canvas,
.code-preview-frame-container .canvas-shimmer-skeleton {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
}

.preview-loading-canvas.is-hidden,
.canvas-shimmer-skeleton.is-hidden,
.preview-skeleton-loader.is-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
}

/* Размытое мягкое облако света как в Gemini */
.preview-loading-canvas::before,
.canvas-shimmer-skeleton::before {
  content: "";
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(circle at 35% 40%, rgba(255, 255, 255, 0.11) 0%, transparent 50%),
    radial-gradient(circle at 65% 60%, rgba(200, 210, 230, 0.08) 0%, transparent 55%);
  filter: blur(70px);
  animation: geminiCloudBreath 4s ease-in-out infinite alternate;
  will-change: transform, opacity;
  transform: translateZ(0);
}

/* Анти-бандинг: микрошум через data-URI SVG (убирает круги и ступеньки) */
.preview-loading-canvas::after,
.canvas-shimmer-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none;
}

@keyframes geminiCloudBreath {
  0% {
    opacity: 0.45;
    transform: scale(0.92) translate(-3%, -2%);
  }
  100% {
    opacity: 0.95;
    transform: scale(1.08) translate(3%, 2%);
  }
}

.theme-light .canvas-preview-container,
.theme-light .preview-loading-canvas {
  background-color: #f1f3f5;
}

.code-preview-frame-container iframe,
.canvas-preview-iframe {
  width: 100%;
  height: 520px;
  min-height: 480px;
  border: 0;
  display: block;
  background-color: #1e1f24;
  border-radius: 0 0 16px 16px;
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.canvas-preview-iframe.is-ready {
  opacity: 1 !important;
}

/* Toast Notification */
.orion-canvas-toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #282a2f;
  color: #f1f3f4;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 8px 18px;
  font-family: -apple-system, BlinkMacSystemFont, 'Google Sans', 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.orion-canvas-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Fullscreen Live Sandbox Overlay (Gemini / Orion Canvas) */
.code-block-wrapper.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  width: 100dvw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-width: 100dvw !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 2147483647 !important;
  display: flex !important;
  flex-direction: column !important;
  background-color: #131315 !important;
  box-shadow: none !important;
  border: none !important;
  overflow: hidden !important;
}

.theme-light .code-block-wrapper.is-fullscreen {
  background-color: #f8f9fa !important;
}

.code-block-wrapper.is-fullscreen .code-block-header {
  height: 52px !important;
  flex-shrink: 0 !important;
  padding: 0 16px !important;
  border-radius: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  background-color: #1a1b1f !important;
}

.theme-light .code-block-wrapper.is-fullscreen .code-block-header {
  background-color: #edf0f5 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.code-block-wrapper.is-fullscreen .code-block-body {
  flex: 1 1 auto !important;
  height: calc(100vh - 52px) !important;
  height: calc(100dvh - 52px) !important;
  min-height: 0 !important;
  width: 100% !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}

.code-block-wrapper.is-fullscreen .code-pane,
.code-block-wrapper.is-fullscreen .code-preview-frame-container,
.code-block-wrapper.is-fullscreen .canvas-preview-container {
  height: 100% !important;
  width: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}

.code-block-wrapper.is-fullscreen .code-pane-editor pre {
  height: 100% !important;
  max-height: 100% !important;
  box-sizing: border-box !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.code-block-wrapper.is-fullscreen iframe,
.code-block-wrapper.is-fullscreen .canvas-preview-iframe {
  height: 100% !important;
  width: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  border: none !important;
  opacity: 1 !important;
}

.code-block-wrapper.is-fullscreen .preview-loading-canvas,
.code-block-wrapper.is-fullscreen .canvas-shimmer-skeleton {
  height: 100% !important;
  width: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
}

/* Снятие любых ограничений с предков при открытом Fullscreen */
body.artifact-has-fullscreen {
  overflow: hidden !important;
}

body.artifact-has-fullscreen .message-wrapper,
body.artifact-has-fullscreen .message {
  contain: none !important;
}

body.artifact-has-fullscreen .main-content {
  z-index: 2147483640 !important;
  overflow: visible !important;
}

body.artifact-has-fullscreen .chat-scroll-area {
  z-index: 2147483641 !important;
  overflow: visible !important;
}

/* Полное скрытие сайдбара, поля ввода и шапки, чтобы не перекрывали холст */
body.artifact-has-fullscreen .sidebar,
body.artifact-has-fullscreen .interaction-area,
body.artifact-has-fullscreen .chat-header,
body.artifact-has-fullscreen .scroll-bottom-btn,
body.artifact-has-fullscreen .mobile-overlay {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  z-index: -1 !important;
}

/* Переключение иконок развернуть/свернуть */
.fullscreen-expand-icon.hidden,
.fullscreen-exit-icon.hidden,
.hidden {
  display: none !important;
}

.code-block-wrapper pre {
  margin: 0 !important;
  padding: 18px 22px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  overflow-x: auto;
}

.code-block-wrapper pre code {
  font-family: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace !important;
  font-size: 13.5px !important;
  line-height: 1.62 !important;
  color: #ececf1;
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  tab-size: 4;
}

.theme-light .code-block-wrapper pre code {
  color: #18181b;
}

.code-block-wrapper pre::-webkit-scrollbar {
  height: 6px;
}
.code-block-wrapper pre::-webkit-scrollbar-track {
  background: transparent;
}
.code-block-wrapper pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}
.code-block-wrapper pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}
.theme-light .code-block-wrapper pre::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.14);
}

/* Встроенный код: темная подложка, моноширинный шрифт, мягкое закругление углов (border-radius 4-6px) */
.message code:not(.code-block-wrapper code),
.inline-code {
  font-family: 'JetBrains Mono', Menlo, Monaco, Consolas, monospace !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #e3e3e3 !important;
  padding: 2.5px 6.5px !important;
  border-radius: 5px !important;
  font-size: 13.5px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  white-space: pre-wrap;
  word-break: break-word;
}
.theme-light .message code:not(.code-block-wrapper code),
.theme-light .inline-code {
  background-color: rgba(0, 0, 0, 0.06) !important;
  color: #18181b !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Цитаты: темная подложка, мягкое закругление углов (border-radius 4-6px) */
.message blockquote {
  margin: 14px 0 !important;
  padding: 8px 14px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border-left: 3px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: 5px !important;
  color: #c4c7d0 !important;
  font-style: normal !important;
}
.message blockquote p {
  margin-bottom: 6px !important;
}
.message blockquote p:last-child {
  margin-bottom: 0 !important;
}
.theme-light .message blockquote {
  background: rgba(0, 0, 0, 0.03) !important;
  border-left-color: rgba(0, 0, 0, 0.25) !important;
  color: #4b5563 !important;
}

/* Фолбэк для преформатированного текста вне обёртки */
.message pre:not(.code-block-wrapper pre) {
  background-color: var(--code-bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border-color);
}


.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--overlay-bg); backdrop-filter: blur(8px); align-items: center; justify-content: center; z-index: 9999; }
.modal-overlay:not(.hidden) { display: flex; }
#forgot-modal,
#reset-pwd-modal {
  z-index: 300000 !important;
}
#forgot-modal:not(.hidden),
#reset-pwd-modal:not(.hidden) {
  display: flex !important;
}
#forgot-modal.hidden,
#reset-pwd-modal.hidden {
  display: none !important;
}
.modal-content { background: var(--bg-sidebar); border: 1px solid var(--border-color); border-radius: 24px; padding: 32px; max-width: 480px; width: 90%; box-shadow: 0 20px 50px var(--shadow-color); transition: background-color 0.3s ease; }
.modal-content h2 { margin-bottom: 16px; font-weight: 600; font-size: 22px; letter-spacing: -0.02em; color: var(--text-main); font-family: 'Inter', sans-serif;}
.tos-text { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin-bottom: 28px; }
.tos-text ul { margin-left: 20px; margin-top: 12px; }
.tos-text li { margin-bottom: 8px; }
.tos-text strong { color: var(--text-main); font-weight: 500; }
.accept-btn { width: 100%; padding: 14px; background: var(--text-main); color: var(--bg-main); border: none; border-radius: 16px; font-weight: 600; font-size: 15px; cursor: pointer; transition: opacity 0.2s; font-family: 'Inter', sans-serif;}
.accept-btn:hover { opacity: 0.8; }

/* === SUBSCRIPTIONS FULL-SCREEN OVERLAY (CHATGPT STYLE) === */
#subscriptions-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 99999 !important;
  background-color: var(--bg-main) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-radius: 0 !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

#subscriptions-modal.hidden {
  display: none !important;
}

#subscriptions-modal::-webkit-scrollbar {
  width: 6px;
}
#subscriptions-modal::-webkit-scrollbar-track {
  background: transparent;
}
#subscriptions-modal::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

.subscriptions-close-btn {
  position: fixed;
  top: 24px;
  right: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--btn-surface-bg);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100000;
  transition: all 0.2s ease;
  box-shadow: none;
  padding: 0;
}
.subscriptions-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  transform: scale(1.06);
  border-color: var(--text-dim);
  box-shadow: none;
}
.subscriptions-close-btn .material-symbols-rounded {
  font-size: 22px;
}

.subscriptions-content-wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 64px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: subscriptionsFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes subscriptionsFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.subscriptions-header {
  text-align: center;
  margin-bottom: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 680px;
}

.subscriptions-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin-bottom: 10px;
  line-height: 1.25;
  text-align: center;
}

.subscriptions-subtitle {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 18px;
  text-align: center;
  max-width: 580px;
}

.subscriptions-current-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  font-size: 13.5px;
  color: var(--text-main);
  box-shadow: none;
}

.subscriptions-current-status-pill .status-label {
  color: var(--text-dim);
  font-weight: 400;
}

.subscriptions-current-status-pill .status-plan-badge {
  color: var(--accent-gold);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.02em;
}

/* Сетка карточек тарифов (строгий плоский дизайн без свечений) */
.subscriptions-cards-grid {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 24px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto 36px;
}

.subscription-card {
  flex: 1;
  max-width: 440px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s ease, transform 0.2s ease;
  box-sizing: border-box;
  box-shadow: none;
}

.subscription-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}
.theme-light .subscription-card:hover {
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: none;
}

.subscription-card.sub-card-pro {
  background: var(--bg-sidebar);
  border: 1px solid var(--accent-gold);
  box-shadow: none;
}
.subscription-card.sub-card-pro:hover {
  border-color: #d6b788;
  box-shadow: none;
}
.theme-light .subscription-card.sub-card-pro {
  background: var(--bg-sidebar);
  border: 1px solid #bfa16f;
  box-shadow: none;
}

.sub-card-badge {
  position: absolute;
  top: -11px;
  right: 22px;
  background: var(--accent-gold);
  color: #121316;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: none;
}

.sub-card-top {
  display: flex;
  flex-direction: column;
  margin-bottom: 22px;
}

.sub-card-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pro-crown-icon {
  color: var(--accent-gold);
  font-size: 22px;
}

.sub-card-desc {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.45;
  min-height: 40px;
  margin-bottom: 18px;
}

.sub-card-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 20px;
}

.price-value {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1;
}

.price-period {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
}

.sub-card-btn {
  width: 100%;
  padding: 13px 20px;
  border-radius: 14px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-main);
  box-sizing: border-box;
}

.sub-card-btn:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}

.sub-card-btn-current {
  background: var(--btn-surface-bg);
  color: var(--text-dim);
  border: 1px solid var(--border-color);
  cursor: default;
}

.sub-card-btn-pro {
  background: var(--text-main);
  color: var(--bg-main);
  border: 1px solid transparent;
  box-shadow: none;
}
.sub-card-btn-pro:hover {
  opacity: 0.94;
  transform: translateY(-1px);
  box-shadow: none;
}
.sub-card-btn-pro .material-symbols-rounded {
  font-size: 18px;
  transition: transform 0.2s ease;
}
.sub-card-btn-pro:hover .material-symbols-rounded {
  transform: translateX(3px);
}

.sub-card-features-block {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sub-card-features-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.sub-card-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.sub-card-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.45;
}

.check-icon {
  font-size: 18px;
  color: var(--accent-gold);
  flex-shrink: 0;
  margin-top: 1px;
}

.subscriptions-footer-note {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 520px;
  margin: 0 auto;
}

.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); z-index: 15; }
.mobile-overlay.active { display: block; }

@media (min-width: 769px) {
  .header-model-btn { display: none !important; }
  .header-action-btn { display: none !important; }
  .header-avatar-btn { display: none !important; }
  .sidebar-header-actions .sidebar-search-btn { display: none; }
  .sidebar.collapsed ~ .main-content .sidebar-toggle-btn { display: flex !important; }
}

@media (max-width: 768px) {
  /* 0. ФИКСАЦИЯ СТРАНИЦЫ И ПОЛНОЕ УСТРАНЕНИЕ «ПЛАВАНИЯ» НА IPHONE / SAFARI */
  html, body {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .main-content {
    height: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    position: relative !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Защита от автозума в iOS Safari при фокусе полей ввода */
  input,
  textarea,
  select,
  .auth-input-group input {
    font-size: 16px !important;
  }

  /* 1. БОКОВОЕ МЕНЮ (DRAWER ПО РЕФЕРЕНСУ GEMINI) */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 84vw);
    transform: translateX(0);
    z-index: 10000;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    box-shadow: 10px 0 40px var(--shadow-color);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease, border-color 0.3s ease;
  }
  .sidebar.collapsed {
    width: min(320px, 84vw);
    transform: translateX(-100%);
    border-right: none;
    pointer-events: none;
  }
  .sidebar-inner {
    width: 100%;
    height: 100%;
    padding: max(16px, env(safe-area-inset-top, 16px)) 16px max(16px, env(safe-area-inset-bottom, 16px));
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }
  .mobile-overlay {
    z-index: 9999;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  /* 2. ВЕРХНЯЯ ШАПКА (GEMINI MOBILE HEADER) С ПОДДЕРЖКОЙ NOTCH / DYNAMIC ISLAND */
  .top-header {
    height: calc(56px + env(safe-area-inset-top, 0px)) !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
    padding-bottom: 0 !important;
    padding-left: max(14px, env(safe-area-inset-left, 14px)) !important;
    padding-right: max(14px, env(safe-area-inset-right, 14px)) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--bg-main);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    z-index: 80;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease;
  }
  .sidebar-toggle-btn {
    display: flex !important;
  }
  .header-model-btn {
    display: inline-flex;
    font-size: 15.5px;
  }

  /* 3. ОСНОВНАЯ ОБЛАСТЬ ЧАТА */
  .chat-scroll-area {
    padding-top: calc(56px + env(safe-area-inset-top, 0px) + 8px) !important;
    padding-bottom: 0;
    height: 100% !important;
    height: 100dvh !important;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    overflow-x: hidden !important;
  }
  .orion-layout {
    padding: 0 14px;
    padding-bottom: calc(150px + env(safe-area-inset-bottom, 20px) + var(--keyboard-offset, 0px));
    box-sizing: border-box;
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  .chat-bottom-spacer {
    height: calc(140px + env(safe-area-inset-bottom, 20px) + var(--keyboard-offset, 0px));
    min-height: calc(140px + env(safe-area-inset-bottom, 20px) + var(--keyboard-offset, 0px));
  }
  .scroll-bottom-btn {
    bottom: calc(85px + env(safe-area-inset-bottom, 14px) + var(--keyboard-offset, 0px)) !important;
    z-index: 95;
    transition: bottom 0.15s ease-out;
  }
  .msg-actions {
    opacity: 0.85;
    padding: 2px 4px;
    margin-top: 4px;
  }
  .action-btn {
    width: 32px;
    height: 32px;
  }

  /* 4. ГЛАВНЫЙ ЭКРАН (HERO) */
  .hero-container {
    padding-bottom: 40px;
  }
  .hero-title {
    font-size: 28px;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
  }
  .hero-chip-btn {
    display: none;
  }

  /* 5. НИЖНЯЯ ПИЛЮЛЯ ВВОДА: ФИКСИРОВАННАЯ ВНИЗУ, БЕЗ СКАЧКОВ И ПЛАВАНИЯ */
  .interaction-area,
  .interaction-area.center-mode,
  .interaction-area.bottom-mode {
    position: fixed !important;
    top: auto !important;
    bottom: calc(max(12px, env(safe-area-inset-bottom, 12px)) + var(--keyboard-offset, 0px)) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 14px !important;
    z-index: 90 !important;
    pointer-events: none;
    box-sizing: border-box;
    transform: none !important;
    transition: bottom 0.15s ease-out !important;
  }
  .interaction-area .interaction-box {
    pointer-events: auto;
    width: 100%;
    max-width: 600px;
    min-width: 0;
    box-sizing: border-box;
  }
  .orion-pill-bar {
    min-height: 52px;
    height: auto;
    min-width: 0;
    max-width: 100%;
    padding: 7px 10px 7px 12px;
    gap: 8px;
    border-radius: 26px;
    align-items: flex-end;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    box-shadow: var(--pill-shadow);
    box-sizing: border-box;
    overflow: hidden;
    transition: background 0.3s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  }
  .orion-pill-bar .pill-model-selector {
    display: none !important;
  }
  #prompt-input {
    font-size: 16px !important; /* Строгая защита от автозума на iOS Safari */
    min-height: 24px;
    max-height: 130px;
    padding: 6px 0;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
  .pill-btn-plus {
    width: 34px;
    height: 34px;
    margin-bottom: 1px;
  }
  .pill-actions-right {
    gap: 6px;
    margin-bottom: 1px;
  }
  .pill-btn-icon,
  .pill-btn-send {
    width: 34px;
    height: 34px;
  }
  .orion-disclaimer {
    display: none; /* Убираем дисклеймер на мобилках для чистоты интерфейса под референс */
  }
  }

  /* 6. СООБЩЕНИЯ И ЭЛЕМЕНТЫ */
  .message {
    font-size: 14.5px;
    padding: 12px 16px;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
    max-width: 100%;
  }
  .message.user {
    max-width: 90%;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .message.ai {
    padding: 4px 0 8px 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    line-height: 1.6 !important;
    font-size: 15px !important;
    color: #e3e3e3 !important;
  }
  .history-item {
    padding: 10px 12px;
    font-size: 13.5px;
  }
  .history-dots-btn {
    opacity: 0.75;
  }

  /* 7. ВЫПАДАЮЩИЕ МЕНЮ И МОДАЛКИ */
  .settings-dropdown.mobile-header-dropdown {
    position: fixed;
    top: 62px;
    right: 14px;
    left: auto;
    bottom: auto;
    width: max-content;
    min-width: 275px;
    max-width: calc(100vw - 28px);
    box-sizing: border-box;
    z-index: 10001;
    transform: none;
    box-shadow: 0 16px 40px var(--shadow-color);
    background-color: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    overflow: visible;
  }
  .settings-dropdown:not(.mobile-header-dropdown) {
    position: absolute;
    width: max-content;
    min-width: 100%;
    max-width: calc(100vw - 28px);
    box-sizing: border-box;
    left: 0;
    right: auto;
    bottom: calc(100% + 8px);
    background-color: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    overflow: visible;
  }
  .modal-content {
    max-width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px 18px;
    border-radius: 20px;
  }
  .subscriptions-close-btn {
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
  }
  .subscriptions-content-wrap {
    padding: 56px 16px 40px;
  }
  .subscriptions-header {
    margin-bottom: 24px;
  }
  .subscriptions-title {
    font-size: 24px;
  }
  .subscriptions-subtitle {
    font-size: 13.5px;
    margin-bottom: 14px;
  }
  .subscriptions-current-status-pill {
    padding: 5px 12px;
    font-size: 12.5px;
  }
  .subscriptions-cards-grid {
    flex-direction: column;
    gap: 20px;
    max-width: 440px;
    margin-bottom: 24px;
  }
  .subscription-card {
    padding: 24px 20px;
    max-width: 100%;
  }
  .sub-card-desc {
    min-height: auto;
    margin-bottom: 14px;
  }
  .price-value {
    font-size: 32px;
  }
  .sub-card-features {
    gap: 10px;
  }
  .sub-card-features li {
    font-size: 13px;
  }
}

/* === FUSED 3-POD SOURCES BAR (ИСТОЧНИКИ В СЕТИ ПО РЕФЕРЕНСУ) === */
:root {
  --fused-bg: #141416;
  --fused-capsule-bg: #222225;
  --fused-border: rgba(255, 255, 255, 0.14);
  --fused-capsule-border: rgba(255, 255, 255, 0.16);
  --fused-text: #ededed;
  --fused-dim: #999999;
}

.theme-light {
  --fused-bg: #ebebef;
  --fused-capsule-bg: #ffffff;
  --fused-border: rgba(0, 0, 0, 0.12);
  --fused-capsule-border: rgba(0, 0, 0, 0.14);
  --fused-text: #111111;
  --fused-dim: #666666;
}

.orion-sources-container {
  margin-bottom: 18px;
  animation: fadeIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

.orion-fused-bar {
  display: inline-flex;
  align-items: center;
  height: 44px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
  user-select: none;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.orion-fused-bar::-webkit-scrollbar { display: none; }

.fused-pod {
  background: var(--fused-bg);
  height: 44px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  border-top: 1px solid var(--fused-border);
  border-bottom: 1px solid var(--fused-border);
}

.fused-pod-globe {
  width: 44px;
  border-radius: 22px 0 0 22px;
  border-left: 1px solid var(--fused-border);
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.theme-light .fused-pod-globe {
  color: #111111;
}

.fused-pod-links {
  padding: 0 4px;
}

.fused-capsule {
  display: inline-flex;
  align-items: center;
  height: 32px;
  background: var(--fused-capsule-bg);
  border: 1px solid var(--fused-capsule-border);
  border-radius: 16px;
  padding: 0 12px;
  gap: 10px;
  box-sizing: border-box;
}

.fused-source-link {
  color: var(--fused-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', -apple-system, sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.fused-source-link:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.theme-light .fused-source-link:hover {
  color: #000000;
}

.fused-divider {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}

.theme-light .fused-divider {
  background: rgba(0, 0, 0, 0.18);
}

.fused-pod-action {
  border-radius: 0 22px 22px 0;
  border-right: 1px solid var(--fused-border);
  padding: 0 5px 0 4px;
  flex-shrink: 0;
}

.fused-capsule-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  background: var(--fused-capsule-bg);
  border: 1px solid var(--fused-capsule-border);
  border-radius: 16px;
  padding: 0 12px;
  box-sizing: border-box;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fused-text);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.fused-capsule-btn:hover,
.fused-capsule-btn.active {
  background: #2b2b2e;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.28);
}

.fused-arrow-icon {
  transition: transform 0.22s ease;
}

.fused-capsule-btn.active .fused-arrow-icon {
  transform: rotate(180deg);
}

.theme-light .fused-capsule-btn:hover,
.theme-light .fused-capsule-btn.active {
  background: #f5f5f7;
  color: #000000;
}

.fused-bridge-svg {
  display: block;
  flex-shrink: 0;
  margin-left: -0.5px;
  margin-right: -0.5px;
}

.fused-bridge-fill {
  fill: var(--fused-bg);
}

.fused-bridge-stroke {
  stroke: var(--fused-border);
}

/* === ВЫПАДАЮЩАЯ ПАНЕЛЬ ИСТОЧНИКОВ (DEEP RESEARCH PANEL) === */
.orion-sources-panel {
  margin-top: 10px;
  width: 100%;
  max-width: 680px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 14px 16px;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-light .orion-sources-panel {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.orion-sources-panel.hidden {
  display: none !important;
}

.sources-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sources-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.sources-panel-count-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.sources-panel-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.sources-panel-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.sources-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.sources-panel-grid::-webkit-scrollbar {
  width: 5px;
}
.sources-panel-grid::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
}

.sources-panel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-hover-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.18s ease;
  min-width: 0;
}

.sources-panel-item:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.theme-light .sources-panel-item:hover {
  border-color: rgba(0, 0, 0, 0.2);
}

.source-item-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-main);
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.source-item-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex-grow: 1;
}

.source-item-domain {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-item-title {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.source-item-arrow {
  color: var(--text-dim);
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
}

.sources-panel-item:hover .source-item-arrow {
  opacity: 1;
  color: var(--text-main);
  transform: translate(2px, -2px);
}

@media (max-width: 768px) {
  .sources-panel-grid {
    grid-template-columns: 1fr;
    max-height: 280px;
  }
}

/* Стилизация ссылок в ответах ассистента */
.message a {
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 3px;
  transition: all 0.2s ease;
}
.message a:hover {
  text-decoration-color: var(--text-main);
  opacity: 0.85;
}
.theme-light .message a {
  text-decoration-color: rgba(0, 0, 0, 0.3);
}

/* Гарантированное отображение кнопки сайдбара при свернутом сайдбаре */
.sidebar.collapsed ~ .main-content .sidebar-toggle-btn {
  display: flex !important;
}




/* === ORION FOLLOW-UP SUGGESTION CARDS (IMAGE 76cce58a STYLE) === */
.orion-suggestions-container {
  margin-top: 18px;
  margin-bottom: 8px;
  width: 100%;
  animation: fadeInSuggestions 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInSuggestions {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.orion-suggestions-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.orion-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

@media (max-width: 640px) {
  .orion-suggestions-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.orion-suggestion-card {
  background: #18191d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  position: relative;
  outline: none;
}

.orion-suggestion-card:hover {
  background: #222329;
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.orion-suggestion-card:active {
  transform: scale(0.985);
}

.orion-suggestion-card:focus-visible {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.orion-suggestion-card .suggestion-text {
  font-size: 13.5px;
  font-weight: 450;
  line-height: 1.42;
  color: #e3e3e8;
  text-align: left;
  word-break: break-word;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.orion-suggestion-card .suggestion-arrow {
  margin-top: 12px;
  color: #8e8e96;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition: color 0.2s ease, transform 0.2s ease;
}

.orion-suggestion-card:hover .suggestion-arrow {
  color: #ffffff;
  transform: translateX(3px);
}

/* Светлая тема */
.theme-light .orion-suggestion-card {
  background: #f0f2f5;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.theme-light .orion-suggestion-card:hover {
  background: #e4e6eb;
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.theme-light .orion-suggestion-card .suggestion-text {
  color: #1f2024;
}

.theme-light .orion-suggestion-card .suggestion-arrow {
  color: #606268;
}

.theme-light .orion-suggestion-card:hover .suggestion-arrow {
  color: #1f2024;
}

/* ============================================================
   RESPONSIVE DESIGN ДЛЯ ХОЛСТА (CANVAS) И ВСЕХ УСТРОЙСТВ
   ============================================================ */

/* Планшеты и смартфоны (<= 768px) */
@media (max-width: 768px) {
  .code-block-wrapper {
    margin: 14px 0 !important;
    border-radius: 16px !important;
    max-width: 100% !important;
  }

  .code-block-header {
    height: 48px !important;
    padding: 0 10px !important;
    gap: 8px !important;
  }

  .canvas-header-left {
    gap: 6px !important;
    min-width: 0 !important;
  }

  .canvas-title {
    max-width: 130px !important;
    font-size: 13px !important;
  }

  .canvas-status-cloud {
    display: none !important;
  }

  .canvas-export-btn {
    padding: 0 !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    justify-content: center !important;
  }

  .canvas-export-btn span,
  .canvas-export-btn svg:last-child {
    display: none !important;
  }

  .canvas-icon-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .code-tabs-pill {
    padding: 2px !important;
  }

  .code-tab-btn {
    padding: 4px 10px !important;
    font-size: 12px !important;
  }

  /* В обычном режиме в чате на мобильных - адаптивная высота */
  .preview-loading-canvas,
  .canvas-shimmer-skeleton,
  .code-preview-frame-container iframe,
  .canvas-preview-iframe {
    height: clamp(320px, 52vh, 460px) !important;
    min-height: 280px !important;
  }

  /* В полноэкранном режиме на мобильных */
  .code-block-wrapper.is-fullscreen .code-block-header {
    height: 48px !important;
    padding: 0 12px !important;
  }

  .code-block-wrapper.is-fullscreen .code-block-body {
    height: calc(100vh - 48px) !important;
    height: calc(100dvh - 48px) !important;
  }
}

/* Компактные смартфоны (<= 480px) */
@media (max-width: 480px) {
  .code-block-wrapper {
    margin: 10px 0 !important;
    border-radius: 14px !important;
  }

  .code-block-header {
    height: 46px !important;
    padding: 0 8px !important;
    gap: 6px !important;
  }

  .canvas-header-left {
    gap: 5px !important;
  }

  .canvas-title {
    max-width: 95px !important;
    font-size: 12px !important;
  }

  .canvas-history-group {
    display: none !important;
  }

  .code-tab-btn {
    padding: 3px 8px !important;
    font-size: 11px !important;
  }

  .canvas-icon-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  .canvas-export-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  .preview-loading-canvas,
  .canvas-shimmer-skeleton,
  .code-preview-frame-container iframe,
  .canvas-preview-iframe {
    height: clamp(300px, 48vh, 400px) !important;
    min-height: 260px !important;
  }

  .code-block-wrapper.is-fullscreen .code-block-header {
    height: 46px !important;
    padding: 0 8px !important;
  }

  .code-block-wrapper.is-fullscreen .code-block-body {
    height: calc(100vh - 46px) !important;
    height: calc(100dvh - 46px) !important;
  }

  .code-block-wrapper pre {
    padding: 12px 14px !important;
  }

  .code-block-wrapper pre code {
    font-size: 12px !important;
  }

  .canvas-export-menu {
    min-width: 180px !important;
    max-width: calc(100vw - 20px) !important;
  }
}

/* Сверхкомпактные экраны (<= 360px) */
@media (max-width: 360px) {
  .canvas-share-btn {
    display: none !important;
  }

  .canvas-title {
    max-width: 75px !important;
  }
}

/* Вспомогательные стили фиксации сообщений и изображений (из patch_style.css) */
.chat-messages {
  padding-bottom: 120px !important;
  overflow-y: auto !important;
}

.chat-messages img,
.messages-list img.msg-image,
.message-content img {
  max-width: 100% !important;
  max-height: 420px !important;
  border-radius: 12px !important;
  object-fit: contain !important;
  display: block !important;
  margin: 10px 0 !important;
}

/* === ORION DESKTOP SYSTEM ACTIONS & TOAST === */
.orion-desktop-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999999;
  background: rgba(14, 14, 20, 0.95);
  border: 1px solid rgba(229, 184, 105, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  color: #f3f3f6;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 500;
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
}
.orion-desktop-toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.orion-desktop-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(229, 184, 105, 0.12);
  border: 1px solid rgba(229, 184, 105, 0.25);
  color: #e5b869;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
  margin: 4px 0;
}

@keyframes orion-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.orion-spin {
  animation: orion-spin 0.9s linear infinite;
}



