/* Aurora AI-Vision — Космическая станция: лейаут */

/* Космический фон со звёздами (canvas в starfield.js) */
.cosmic-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(30, 58, 120, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 45%),
    var(--bg-deep);
  pointer-events: none;
}
.cosmic-bg canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}
body.landing-page .cosmic-bg {
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(59, 130, 246, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(30, 58, 120, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 60% 80% at 0% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(30, 58, 120, 0.18) 0%, transparent 50%),
    var(--bg-deep);
}

/* Auth & Landing */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: transparent;
}

.landing-page {
  min-height: 100vh;
  padding: 0;
  background: transparent;
}

.landing-card {
  width: 100%; max-width: 400px; padding: var(--space-8);
}

.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--space-4);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--accent);
  border-radius: var(--radius);
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: var(--space-4);
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-3) var(--space-8);
  background: rgba(9, 11, 15, 0.72);
  backdrop-filter: blur(var(--glass-blur-strong, 20px)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur-strong, 20px)) saturate(180%);
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.landing-nav.glass { border-radius: 0; }
.landing-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}
.landing-nav .landing-cta { display: flex; gap: var(--space-2); align-items: center; }
.landing-nav .landing-cta .neon-btn {
  border-radius: var(--radius-pill, 9999px);
  padding: var(--space-2) var(--space-5);
  font-size: 0.9375rem;
  font-weight: 500;
}
.landing-nav .neon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.landing-footer {
  position: relative;
  z-index: 1;
  padding: var(--space-8) var(--space-6);
  margin-top: var(--space-10);
  border-top: 1px solid var(--glass-border);
  background: rgba(9, 11, 15, 0.5);
}
.landing-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  text-align: center;
}
.landing-footer-copy {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  width: 100%;
}
.landing-footer-nav {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
}
.landing-footer-nav a {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.landing-footer-nav a:hover { color: var(--accent); }
.landing-footer-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Landing: main container — отступ сверху больше высоты фиксированного хедера */
.landing-main {
  position: relative;
  z-index: 1;
  padding: calc(5.5rem + var(--space-8)) var(--space-6) var(--space-10);
  max-width: 1000px;
  margin: 0 auto;
  scroll-margin-top: 5.5rem;
}

/* Landing 2026: больше воздуха, шире контент */
.landing-main.landing-2026 {
  max-width: 1100px;
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}

.landing-hero {
  padding: var(--space-10) var(--space-8);
  text-align: center;
  margin-bottom: var(--space-8);
}
.landing-hero.glass {
  box-shadow: var(--shadow-md), 0 0 0 1px var(--glass-border);
}
.landing-hero-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  margin-bottom: var(--space-4);
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}
.landing-hero-lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  line-height: 1.7;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.landing-hero .hero-buttons {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

/* Hero Apple-style: бейдж, крупный заголовок, пилл-кнопки */
.landing-hero.hero-apple {
  padding: var(--space-10) var(--space-10) var(--space-10);
  border-radius: var(--radius-xl, 20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
  margin-bottom: var(--space-10);
}
.landing-hero-badge {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill, 9999px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.landing-hero.hero-apple .landing-hero-title {
  font-size: clamp(2.25rem, 5.5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--space-5);
}
.landing-hero.hero-apple .landing-hero-lead {
  font-size: 1.25rem;
  line-height: 1.6;
  max-width: 520px;
  margin-bottom: var(--space-10);
  color: var(--text-secondary);
}
.landing-hero.hero-apple .hero-buttons {
  gap: var(--space-3);
}
.hero-cta {
  border-radius: var(--radius-pill, 9999px) !important;
  padding: var(--space-3) var(--space-8) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.hero-cta:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px -4px rgba(59, 130, 246, 0.35);
}
.hero-cta-ghost {
  border-radius: var(--radius-pill, 9999px) !important;
  padding: var(--space-3) var(--space-6) !important;
  font-size: 0.9375rem !important;
  font-weight: 500 !important;
}

/* Landing blocks: общий стиль секций */
.landing-block {
  padding: var(--space-8) var(--space-8);
  margin-bottom: var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.landing-block.glass:hover {
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.08);
}
.landing-block-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.landing-block-title i {
  color: var(--accent);
  opacity: 0.9;
}
.landing-block-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  line-height: 1.6;
}
.landing-block-content p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--space-4);
}
.landing-block-content p:last-child { margin-bottom: 0; }

/* Блоки в стиле Apple 2026: скругления, лейблы */
.landing-block.block-apple {
  border-radius: var(--radius-xl, 20px);
  padding: var(--space-10) var(--space-10);
  margin-bottom: var(--space-8);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.landing-block.block-apple:hover {
  box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.landing-section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
  padding: 3px 10px;
  background: rgba(59,130,246,.08);
  border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--radius-pill);
}
.landing-block.block-apple .landing-block-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}
.landing-block.block-apple .landing-block-content p {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* Короткий лид — одна строка под заголовком */
.landing-lead {
  font-size: 1.0625rem;
  color: var(--text);
  font-weight: 500;
  margin-bottom: var(--space-5);
  line-height: 1.5;
}
.landing-lead + .landing-list { margin-top: 0; }

/* Список-буллеты — сканируемый, без длинных абзацев */
.landing-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-2);
}
.landing-list li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: var(--space-3);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.landing-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}
.landing-list li:last-child { margin-bottom: 0; }

/* Аудитория — сетка коротких карточек, не параграф */
.audience-grid {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.audience-item {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: var(--space-4);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.audience-item strong {
  color: var(--text);
  font-weight: 600;
  display: block;
  margin-bottom: 0.2em;
}
@media (min-width: 640px) {
  .audience-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Компактные шаги */
.steps-compact .step p {
  font-size: 0.9375rem;
  margin: 0;
  line-height: 1.5;
}
.steps-compact .step { margin-bottom: var(--space-4); }
.steps-compact .step:last-child { margin-bottom: 0; }

/* Features grid: карточки со скриншотами */
.landing-features {
  padding-bottom: var(--space-8);
}
.landing-features .landing-section-label,
.landing-features .landing-block-title,
.landing-features .landing-block-sub {
  text-align: center;
}
.landing-features .landing-block-title {
  justify-content: center;
}
.landing-features .landing-block-sub {
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-6);
}
.feature-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.1);
}
.landing-2026 .feature-card {
  border-radius: var(--radius-xl, 20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.25);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.landing-2026 .feature-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.landing-2026 .screenshot-frame {
  border-radius: var(--radius-xl, 20px) var(--radius-xl, 20px) 0 0;
}
.landing-2026 .feature-body {
  padding: var(--space-6);
}
.landing-2026 .feature-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.feature-screenshot {
  position: relative;
  width: 100%;
}
.screenshot-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  border-bottom: 1px solid var(--glass-border);
  background: var(--bg-subtle);
  position: relative;
}
.screenshot-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.screenshot-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 0.875rem;
}
.screenshot-placeholder i {
  opacity: 0.5;
  color: var(--accent);
}
.screenshot-stream {
  background: linear-gradient(160deg, rgba(30, 58, 120, 0.25) 0%, var(--bg-subtle) 60%);
}
.screenshot-photo {
  background: linear-gradient(160deg, rgba(34, 197, 94, 0.08) 0%, var(--bg-subtle) 60%);
}
.screenshot-api {
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.12) 0%, var(--bg-subtle) 60%);
}
.feature-body {
  padding: var(--space-5);
}
.feature-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.feature-title i {
  color: var(--accent);
}
.feature-body p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Steps (как использовать) */
.landing-block .steps { margin-top: var(--space-6); }
.landing-block .step {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  align-items: flex-start;
}
.landing-block .step:last-child { margin-bottom: 0; }
.landing-block .step-num {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.2s var(--ease);
}
.landing-block .step:hover .step-num {
  transform: scale(1.05);
}
.landing-2026 .landing-block .step-num {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.25);
}
.landing-block .step p { margin-bottom: 0; color: var(--text-secondary); line-height: 1.7; }

/* Final CTA */
.landing-final {
  text-align: center;
  padding: var(--space-10) var(--space-8);
}
.landing-final .landing-block-title {
  justify-content: center;
}
.landing-final-text {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
.landing-final .hero-buttons {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}
.landing-2026 .landing-final {
  padding: var(--space-10) var(--space-10);
}
.landing-2026 .landing-final .landing-block-title {
  font-size: 1.75rem;
  font-weight: 700;
}
.landing-2026 .landing-final-text {
  font-size: 1.0625rem;
  max-width: 420px;
}
.landing-2026 .landing-final .hero-cta {
  padding: var(--space-3) var(--space-8) !important;
}

/* Legacy section classes (если где-то остались) */
.landing-section {
  padding: var(--space-10) var(--space-6);
  max-width: 720px;
  margin: 0 auto;
  border-top: 1px solid var(--glass-border);
}
.landing-section.glass {
  border-top: none;
  border: 1px solid var(--glass-border);
  margin: var(--space-6) auto;
  box-shadow: var(--shadow-sm);
}
.landing-section h2 { font-size: 1.4rem; margin-bottom: var(--space-4); color: var(--text); }
.landing-section p { color: var(--text-secondary); line-height: 1.75; margin-bottom: var(--space-4); }
.landing-section p:last-child { margin-bottom: 0; }

.auth-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.auth-footer a { margin: 0 var(--space-2); }

/* Dashboard — фон прозрачный, чтобы был виден космический starfield */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background: transparent;
}

.dashboard-main {
  flex: 1;
  margin-left: 212px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1100px;
  margin: 0;
  width: 100%;
}

@media (max-width: 768px) {
  .dashboard-main { margin-left: 0; padding-bottom: 64px; }
  .aurora-sidebar {
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-right: none;
    border-top: 1px solid var(--glass-border);
  }
  .aurora-sidebar a .sidebar-label { display: none; }
  .aurora-sidebar a { margin: 0; padding: var(--space-2) var(--space-3); }
  .dashboard-content { padding: var(--space-4); }
}

.section { margin-bottom: var(--space-6); }
.section-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-4);
  letter-spacing: -.01em;
  display: flex; align-items: center; gap: var(--space-2);
}

/* Tabs */
.cosmic-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-5);
  padding: 3px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
}
.cosmic-tabs button {
  padding: 6px var(--space-4);
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color .18s var(--ease), background .18s var(--ease);
  white-space: nowrap;
}
.cosmic-tabs button:hover { color: var(--text); background: var(--surface-solid); }
.cosmic-tabs button.active {
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

.cosmic-panel { display: none; }
.cosmic-panel.active { display: block; }

/* Оплата — пакеты API-запросов */
.payment-packs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
@media (min-width: 520px) {
  .payment-packs { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
}
.payment-pack {
  position: relative;
  display: flex; flex-direction: column;
  padding: var(--space-5) var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.payment-pack:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -6px rgba(0,0,0,.35);
  border-color: rgba(255,255,255,.1);
}
.payment-pack-featured {
  border-color: rgba(59,130,246,.3);
  background: linear-gradient(160deg, rgba(59,130,246,.06) 0%, var(--glass) 100%);
  box-shadow: 0 0 0 1px rgba(59,130,246,.12);
}
.payment-pack-featured:hover {
  box-shadow: 0 12px 32px -6px rgba(59,130,246,.25), 0 0 0 1px rgba(59,130,246,.2);
}
.payment-pack-badge {
  position: absolute; top: -1px; right: var(--space-3);
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: #fff; background: var(--accent);
  padding: 2px 8px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.payment-pack-header {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: var(--space-3);
  padding-top: var(--space-2);
}
.payment-pack-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.payment-pack-count { font-size: 0.8125rem; color: var(--text-secondary); }
.payment-pack-desc { font-size: 0.8125rem; margin-bottom: var(--space-4); line-height: 1.45; flex-grow: 1; color: var(--text-muted); }
.payment-pack-price {
  font-size: 1.375rem; font-weight: 800; color: var(--text);
  margin-bottom: var(--space-4); letter-spacing: -.02em;
}
.payment-pack-btn { width: 100%; margin-top: auto; font-size: 0.875rem; padding: var(--space-2) var(--space-3); }
.payment-pack-price-custom { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.payment-pack-custom .payment-pack-count { color: var(--accent); }

/* Stream / video — контейнер подстраивается под пропорции потока, видео без чёрных рамок */
.stream-wrap .stream-view {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  /* aspect-ratio задаётся в JS по реальным размерам потока (videoWidth/videoHeight) */
}
.stream-wrap .stream-view video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  vertical-align: top;
}
/* Нативный fullscreen API (Android Chrome, десктоп) */
.stream-wrap:fullscreen,
.stream-wrap:-webkit-full-screen,
.stream-wrap.fullscreen {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 0 !important;
  margin: 0 !important;
}
.stream-wrap:fullscreen .stream-view,
.stream-wrap:-webkit-full-screen .stream-view,
.stream-wrap.fullscreen .stream-view {
  max-width: 100%; max-height: 100%;
  width: 100%; height: 100%;
}
.stream-wrap:fullscreen video,
.stream-wrap:-webkit-full-screen video,
.stream-wrap.fullscreen video {
  width: 100% !important; height: 100% !important;
  max-width: none; object-fit: contain;
}

/* ── CSS псевдо-полноэкранный режим (iOS Safari fallback) ── */
.stream-wrap.pseudo-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9000 !important;
  background: #000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
}
.stream-wrap.pseudo-fullscreen .stream-view {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: unset !important;
}
.stream-wrap.pseudo-fullscreen video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  max-width: none !important;
}

/* Кнопка ✕ — внутри видео, видна только в полноэкранном режиме */
.stream-fs-exit-btn {
  display: none;
  position: absolute;
  top: max(16px, env(safe-area-inset-top, 16px));
  right: max(16px, env(safe-area-inset-right, 16px));
  z-index: 9001;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.3);
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
  touch-action: manipulation;
}
.stream-fs-exit-btn:hover { background: rgba(0,0,0,.85); }
.stream-fs-exit-btn:active { transform: scale(.92); }

.stream-wrap:fullscreen .stream-fs-exit-btn,
.stream-wrap:-webkit-full-screen .stream-fs-exit-btn,
.stream-wrap.fullscreen .stream-fs-exit-btn,
.stream-wrap.pseudo-fullscreen .stream-fs-exit-btn { display: flex; }

/* Подсказка «двойной тап» (показывается на 2 сек при входе) */
.stream-fs-hint {
  display: none;
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9001;
  padding: 8px 16px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  color: rgba(255,255,255,.85);
  font-size: 0.8125rem;
  white-space: nowrap;
  pointer-events: none;
  animation: fsHintFadeOut 2.8s ease-out forwards;
}
.stream-wrap.pseudo-fullscreen .stream-fs-hint,
.stream-wrap.fullscreen .stream-fs-hint,
.stream-wrap:fullscreen .stream-fs-hint { display: flex; gap: 6px; align-items: center; }
@keyframes fsHintFadeOut {
  0%,60% { opacity: 1; }
  100%   { opacity: 0; pointer-events: none; }
}

.stream-controls {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.stream-controls label { font-size: 0.875rem; color: var(--text-secondary); }

.video-actions {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.video-actions .neon-btn { min-width: 100px; }

.cosmic-select {
  padding: var(--space-2) var(--space-4);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  min-width: 200px;
  font-size: 0.875rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.cosmic-select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.video-wrap {
  position: relative;
  display: inline-block;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.video-wrap video, .video-wrap canvas, .video-wrap img { display: block; max-width: 100%; }

#faceStreamWrap {
  width: 640px;
  max-width: 100%;
  padding: 0;
}
#faceStreamWrap .stream-view {
  width: 640px;
  height: 480px;
  max-width: 100%;
  overflow: hidden;
}

.current-detections {
  padding: var(--space-4);
  min-height: 56px;
  margin-top: var(--space-4);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.current-detections:empty::before { content: 'Нет данных'; color: var(--text-muted); }
.detections-list { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; }
.detections-list .error-msg { color: var(--error); }

/* Переключение видов: Панель / Чат */
.dashboard-view {
  display: none;
}
.dashboard-view.active {
  display: block;
}

/* ═══════════════════════════════════════════
   CHAT VIEW — Aurora AI  (ChatGPT-grade UI)
═══════════════════════════════════════════ */

.chat-view { height: 100%; }
.chat-view .chat-layout {
  display: flex;
  height: calc(100vh - 56px - 6rem);
  min-height: 520px;
  gap: 0;
}

/* ── Sidebar ── */
.chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  overflow: hidden;
}
.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 10px;
  gap: 8px;
}
.chat-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}
.chat-sidebar-brand i { color: var(--accent); font-size: 1rem; }
.chat-new-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  padding: 0; font-size: 0.8125rem; flex-shrink: 0;
}
.chat-new-btn:hover { background: var(--surface-solid); color: var(--text); border-color: var(--accent); }

/* Search */
.chat-search-wrap { position: relative; padding: 0 12px 10px; }
.chat-search-icon {
  position: absolute; left: 22px; top: 50%;
  transform: translateY(-55%);
  color: var(--text-muted); font-size: 0.75rem; pointer-events: none;
}
.chat-search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text); font-size: 0.8125rem;
  outline: none;
  transition: border-color .15s;
}
.chat-search-input:focus { border-color: var(--accent); }
.chat-search-input::placeholder { color: var(--text-muted); }

/* Conversation list */
.chat-conversation-list {
  flex: 1; overflow-y: auto;
  padding: 4px 8px 8px;
  display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-conversation-list::-webkit-scrollbar { width: 4px; }
.chat-conversation-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.chat-conv-group-label {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 8px 4px;
}
.chat-conv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s;
  position: relative; min-height: 38px;
}
.chat-conv-item:hover { background: var(--surface-solid); }
.chat-conv-item.active { background: var(--accent-muted); border-color: rgba(59,130,246,.2); }
.chat-conv-icon { flex-shrink: 0; font-size: 0.75rem; color: var(--text-muted); }
.chat-conv-item.active .chat-conv-icon { color: var(--accent); }
.chat-conv-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.8125rem; color: var(--text-secondary);
}
.chat-conv-item.active .chat-conv-title { color: var(--text); }
.chat-conv-actions { flex-shrink: 0; display: none; gap: 2px; }
.chat-conv-item:hover .chat-conv-actions,
.chat-conv-item.active .chat-conv-actions { display: flex; }
.chat-conv-action-btn {
  width: 22px; height: 22px; border-radius: 5px;
  border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem;
  transition: background .15s, color .15s; padding: 0;
}
.chat-conv-action-btn:hover { background: var(--border); color: var(--text); }
.chat-conv-action-btn.delete:hover { background: rgba(239,68,68,.15); color: var(--error); }

/* ── Main area ── */
.chat-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  overflow: hidden; position: relative;
}

/* Welcome screen */
.chat-welcome {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
  padding: 32px 24px; overflow-y: auto;
}
.chat-welcome-inner { max-width: 540px; width: 100%; text-align: center; }
.chat-welcome-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--accent-muted), rgba(139,92,246,.12));
  border: 1px solid rgba(59,130,246,.3);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; color: var(--accent);
}
.chat-welcome-title {
  font-size: 1.625rem; font-weight: 700;
  color: var(--text); margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.chat-welcome-sub {
  font-size: 0.9375rem; color: var(--text-muted);
  margin: 0 0 24px; line-height: 1.55;
}
.chat-suggestions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.chat-suggestion-btn {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary); font-size: 0.8125rem;
  line-height: 1.4; text-align: left; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chat-suggestion-btn i { margin-top: 1px; color: var(--accent); flex-shrink: 0; font-size: 0.8125rem; }
.chat-suggestion-btn:hover { background: var(--bg-subtle); border-color: var(--accent); color: var(--text); }

/* ── Messages ── */
.chat-container {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
}
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px 0 4px;
  display: flex; flex-direction: column; gap: 0;
  scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Message row */
.chat-msg-row {
  display: flex; padding: 8px 24px; gap: 14px;
  position: relative; transition: background .1s;
  animation: chatMsgIn .18s var(--ease-out);
}
.chat-msg-row:hover { background: rgba(255,255,255,.018); }
.chat-msg-row.user { flex-direction: row-reverse; }

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

/* Avatar */
.chat-msg-avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; margin-top: 2px;
}
.chat-msg-row.assistant .chat-msg-avatar {
  background: linear-gradient(135deg, var(--accent-muted), rgba(139,92,246,.15));
  border: 1px solid rgba(59,130,246,.3);
  color: var(--accent);
}
.chat-msg-row.user .chat-msg-avatar {
  background: var(--accent-muted);
  border: 1px solid rgba(59,130,246,.3);
  color: var(--accent);
  font-size: 0.6875rem; font-weight: 700;
}

/* Content wrapper */
.chat-msg-content { flex: 1; min-width: 0; max-width: 720px; }
.chat-msg-row.user .chat-msg-content {
  display: flex; flex-direction: column; align-items: flex-end;
}

/* Sender label */
.chat-msg-sender {
  font-size: 0.6875rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 4px;
  letter-spacing: .01em;
}
.chat-msg-row.user .chat-msg-sender { color: rgba(255,255,255,.4); }

/* User bubble */
.chat-msg-bubble {
  display: inline-block;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  word-break: break-word; line-height: 1.55;
  font-size: 0.9375rem; max-width: 100%;
  white-space: pre-wrap;
}

/* Assistant body (no bubble) */
.chat-msg-body {
  word-break: break-word; line-height: 1.72;
  color: var(--text); font-size: 0.9375rem;
}
.chat-msg-body p { margin: 0 0 .45em; }
.chat-msg-body p:last-child { margin-bottom: 0; }
.chat-msg-body p:empty { display: none; }
.chat-msg-body h1,.chat-msg-body h2,.chat-msg-body h3,.chat-msg-body h4 {
  margin: .8em 0 .3em; font-weight: 700; color: var(--text); line-height: 1.3;
}
.chat-msg-body h1:first-child,.chat-msg-body h2:first-child,.chat-msg-body h3:first-child { margin-top: 0; }
.chat-msg-body h1 { font-size: 1.25rem; }
.chat-msg-body h2 { font-size: 1.1rem; }
.chat-msg-body h3 { font-size: 1rem; }
.chat-msg-body ul,.chat-msg-body ol { margin: .25em 0 .5em; padding-left: 1.5em; }
.chat-msg-body li { margin: .2em 0; }
.chat-msg-body strong { font-weight: 600; color: var(--text); }
.chat-msg-body em { color: var(--text-secondary); }
.chat-msg-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.chat-msg-body blockquote {
  margin: .5em 0; padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-solid);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}
.chat-msg-body table { width: 100%; border-collapse: collapse; margin: .5em 0; font-size: .875rem; }
.chat-msg-body th { background: var(--surface-solid); color: var(--text); font-weight: 600; }
.chat-msg-body td,.chat-msg-body th { border: 1px solid var(--border); padding: 5px 10px; }
.chat-msg-body .katex { font-size: 1em; }
.chat-msg-body .katex-display { margin: .5em 0; overflow-x: auto; }

/* Code blocks */
.chat-msg-body pre.chat-code-block {
  margin: .75em 0;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono); font-size: .8125rem;
}
.chat-code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid var(--border); gap: 8px;
}
.chat-code-lang {
  font-size: .6875rem; font-weight: 500;
  color: var(--text-muted); text-transform: lowercase; letter-spacing: .03em;
}
.chat-code-copy-btn {
  padding: 3px 9px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-muted);
  font-size: .6875rem; cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font-sans);
}
.chat-code-copy-btn:hover { background: var(--surface-solid); color: var(--text); }
.chat-code-copy-btn.copied { color: var(--success); border-color: var(--success); }
.chat-msg-body pre.chat-code-block code {
  display: block; padding: 14px 16px;
  overflow-x: auto; color: var(--text-secondary);
  line-height: 1.55; white-space: pre;
  background: none; border: none;
}
.chat-msg-body code:not(.chat-code-block code) {
  padding: .15em .45em;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono); font-size: .85em;
  color: var(--accent);
}

/* Message actions */
.chat-msg-actions {
  display: flex; gap: 4px; margin-top: 6px;
  opacity: 0; transition: opacity .15s;
}
.chat-msg-row:hover .chat-msg-actions { opacity: 1; }
.chat-msg-action-btn {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-subtle);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; transition: all .15s; padding: 0;
}
.chat-msg-action-btn:hover { background: var(--surface-solid); color: var(--text); }
.chat-msg-action-btn.copied { color: var(--success); border-color: var(--success); }

/* Typing indicator */
.chat-msg-row.typing .chat-msg-body {
  display: flex; align-items: center; gap: 4px;
  min-height: 24px; padding: 6px 0;
}
.chat-typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted);
  animation: chatTypingBounce 1.4s ease-in-out infinite;
}
.chat-typing-dot:nth-child(2) { animation-delay: .18s; }
.chat-typing-dot:nth-child(3) { animation-delay: .36s; }
@keyframes chatTypingBounce {
  0%,60%,100% { transform: translateY(0); opacity: .35; }
  30%          { transform: translateY(-6px); opacity: 1; }
}

/* ── Input area ── */
.chat-input-area {
  padding: 12px 20px 14px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.chat-input-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 10px 10px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: border-color .2s, box-shadow .2s;
}
.chat-input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.chat-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: .9375rem; line-height: 1.55;
  resize: none; max-height: 180px; min-height: 24px;
  overflow-y: hidden; font-family: var(--font-sans); padding: 0;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  -webkit-tap-highlight-color: transparent;
}
.chat-input:focus,
.chat-input:focus-visible {
  outline: none;
  box-shadow: none;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--accent); color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; flex-shrink: 0;
  transition: background .15s, opacity .15s, transform .1s; padding: 0;
}
.chat-send-btn:disabled { background: var(--border); color: var(--text-muted); cursor: default; opacity: .55; }
.chat-send-btn:not(:disabled):hover { background: var(--accent-hover); transform: scale(1.06); }
.chat-send-btn:not(:disabled):active { transform: scale(.96); }
.chat-input-options { margin-top: 8px; }
.chat-web-search-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8125rem; color: var(--text-muted);
  background: transparent; border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 12px;
  cursor: pointer; transition: color .2s, background .2s, border-color .2s, box-shadow .2s;
}
.chat-web-search-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.chat-web-search-btn.chat-web-search-on {
  color: var(--accent);
  background: var(--accent-muted);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb, 99, 102, 241), 0.35);
}
.chat-web-search-btn.chat-web-search-on:hover {
  background: var(--accent-muted);
  box-shadow: 0 0 16px rgba(var(--accent-rgb, 99, 102, 241), 0.45);
}

.chat-input-hint {
  text-align: center; font-size: .6875rem;
  color: var(--text-muted); margin: 6px 0 0;
}

/* ── Mobile chat topbar (только на мобильных) ── */
.chat-mobile-topbar { display: none; }
.chat-sidebar-close-btn { display: none; }
.chat-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 199;
  cursor: pointer;
  animation: chatBackdropIn .2s var(--ease-out);
}
.chat-sidebar-backdrop.visible { display: block; }
@keyframes chatBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  /* Chat view — убираем лишние отступы, используем полный экран */
  .chat-view {
    margin: calc(-1 * var(--space-3));
    height: calc(100dvh - 52px - 68px);
    min-height: 400px;
  }
  .chat-view .chat-layout {
    flex-direction: row;      /* sidebar — drawer, не сверху */
    height: 100%;
    min-height: 0;
    gap: 0;
  }

  /* Sidebar — выдвижной drawer слева */
  .chat-sidebar {
    position: fixed;
    top: 52px; bottom: 68px; left: 0;
    width: 82%; max-width: 300px;
    height: auto; max-height: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border-right: 1px solid var(--border);
    border-bottom: none;
    transform: translateX(-105%);
    transition: transform .25s var(--ease-out);
    z-index: 200;
    box-shadow: 4px 0 32px rgba(0,0,0,.5);
  }
  .chat-sidebar.mobile-open { transform: translateX(0); }
  .chat-sidebar-close-btn { display: flex; }

  /* Chat main — занимает весь экран */
  .chat-main {
    flex: 1; width: 100%; min-width: 0;
    border-radius: 0;
    overflow: hidden;
  }

  /* Mobile topbar */
  .chat-mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 48px;
    flex-shrink: 0;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
  }
  .chat-mobile-title {
    font-size: 0.9375rem; font-weight: 600;
    color: var(--text);
    display: flex; align-items: center; gap: 8px;
  }
  .chat-mobile-title i { color: var(--accent); }
  .chat-mobile-menu-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    border: none; background: transparent;
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    transition: background .15s, color .15s;
    padding: 0; flex-shrink: 0;
  }
  .chat-mobile-menu-btn:hover { background: var(--surface-solid); color: var(--text); }

  /* Welcome screen on mobile */
  .chat-welcome { padding: 20px 16px; }
  .chat-welcome-title { font-size: 1.375rem; }
  .chat-welcome-sub { font-size: 0.875rem; }
  .chat-welcome-icon { width: 48px; height: 48px; font-size: 1.25rem; }
  .chat-suggestions { grid-template-columns: 1fr; gap: 8px; }
  .chat-suggestion-btn { padding: 10px 12px; font-size: 0.8125rem; }

  /* Messages */
  .chat-messages { padding: 12px 0 4px; }
  .chat-msg-row { padding: 6px 12px; gap: 10px; }
  .chat-msg-avatar { width: 28px; height: 28px; font-size: 0.75rem; }
  .chat-msg-body { font-size: 0.9rem; }
  .chat-msg-bubble { font-size: 0.9rem; padding: 8px 12px; }
  .chat-msg-sender { font-size: 0.625rem; }
  .chat-msg-content { max-width: 100%; }

  /* Input area */
  .chat-input-area { padding: 10px 12px 12px; }
  .chat-input-box { padding: 8px 8px 8px 14px; border-radius: 20px; }
  .chat-input { font-size: 16px !important; }
  .chat-send-btn { width: 32px; height: 32px; font-size: 0.8125rem; }
  .chat-input-hint { display: none; }
}

@media (max-width: 480px) {
  .chat-view {
    margin: calc(-1 * var(--space-2));
    height: calc(100dvh - 48px - 68px);
  }
  .chat-sidebar { top: 48px; }
  .chat-mobile-topbar { height: 44px; padding: 0 12px; }
  .chat-msg-row { padding: 5px 10px; gap: 8px; }
  .chat-input-area { padding: 8px 10px 10px; }
}

/* API документация (настройки) */
.api-doc-block {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.api-doc-block:first-of-type { margin-top: var(--space-4); padding-top: 0; border-top: none; }
.api-doc-h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.api-doc-pre {
  margin: 0;
  padding: var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}
.api-doc-pre code { background: none; border: none; padding: 0; color: inherit; }
@media (max-width: 768px) {
  .api-doc-pre { font-size: 0.75rem; padding: var(--space-3); word-break: break-all; }
  .api-doc-h3 { font-size: 0.875rem; }
  .api-type-tabs { width: 100% !important; }
  .api-type-tabs button { flex: 1; justify-content: center; }
  .quota-stats { flex-direction: column; gap: var(--space-2); }
  .quota-stats .neon-btn { align-self: flex-start; }
}

/* ═══════════════════════════════════════════════════════
   MOBILE / RESPONSIVE  — полная адаптация
═══════════════════════════════════════════════════════ */

/* ── Tablets (≤ 1024px) ── */
@media (max-width: 1024px) {
  .landing-main, .landing-main.landing-2026 {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
  .features-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .dashboard-content { max-width: 100%; }
}

/* ── Mobile-tablet (≤ 768px) ── */
@media (max-width: 768px) {

  /* === Topbar === */
  .cosmic-topbar { height: 52px; padding: 0 var(--space-4); gap: var(--space-3); }
  .cosmic-topbar .system-status { display: none; }
  .cosmic-topbar .brand-text { display: none; }
  .cosmic-topbar .profile { gap: var(--space-2); }
  #userEmail { display: none; }

  /* === Landing nav === */
  .landing-nav { padding: var(--space-3) var(--space-4); }
  .landing-nav-inner { gap: var(--space-3); }
  .landing-nav .brand-text { font-size: 1rem; }
  .landing-nav .landing-cta .neon-btn {
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
  }

  /* === Landing main === */
  .landing-main, .landing-main.landing-2026 {
    padding: calc(4rem + var(--space-6)) var(--space-4) var(--space-6);
  }

  /* === Landing hero === */
  .landing-hero.hero-apple {
    padding: var(--space-8) var(--space-5) var(--space-8);
    margin-bottom: var(--space-6);
  }
  .landing-hero.hero-apple .landing-hero-title {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }
  .landing-hero.hero-apple .landing-hero-lead {
    font-size: 1rem;
    margin-bottom: var(--space-8);
  }
  .hero-buttons { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .hero-cta, .hero-cta-ghost {
    text-align: center;
    width: 100%;
  }

  /* === Landing blocks === */
  .landing-block.block-apple {
    padding: var(--space-6) var(--space-5);
    margin-bottom: var(--space-5);
    border-radius: var(--radius-lg);
  }
  .landing-block.block-apple .landing-block-title { font-size: 1.25rem; }
  .features-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .audience-grid { grid-template-columns: 1fr; }
  .landing-final .hero-buttons { flex-direction: column; align-items: stretch; }

  /* === Auth card === */
  .auth-card {
    padding: var(--space-6) var(--space-5);
    border-radius: var(--radius-lg);
    max-width: 100%;
  }
  .auth-title { font-size: 1.25rem; }
  .auth-brand-text { font-size: 1rem; }

  /* === Dashboard sidebar (bottom bar) === */
  .aurora-sidebar {
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; max-height: none;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: var(--space-2) var(--space-2);
    border-right: none;
    border-top: 1px solid var(--glass-border);
    gap: 0;
  }
  .aurora-sidebar a {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 6px var(--space-2);
    font-size: 0.625rem;
    border: none;
    border-radius: var(--radius);
    min-width: 0;
  }
  .aurora-sidebar a .sidebar-icon { font-size: 1.125rem; width: auto; }
  .aurora-sidebar a .sidebar-label {
    display: block;
    font-size: 0.625rem;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60px;
  }

  /* === Dashboard main === */
  .dashboard-main { margin-left: 0; padding-bottom: 68px; }
  .dashboard-content { padding: var(--space-3) var(--space-4); }
  .dashboard-content > section.glow-card { padding: var(--space-4) !important; }

  /* === Detection tabs === */
  .cosmic-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cosmic-tabs::-webkit-scrollbar { display: none; }

  /* === Payment cards === */
  .payment-packs { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .payment-pack { padding: var(--space-4) var(--space-3); }
  .payment-pack-price { font-size: 1.125rem; }

  /* === Settings / telegram block === */
  .telegram-block { padding: 0; }

  /* === Face swap inputs === */
  .face-swap-inputs { grid-template-columns: 1fr !important; }

  /* === Stream controls === */
  .stream-controls { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .cosmic-select { min-width: 100%; width: 100%; }

  /* === Video actions === */
  .video-actions { flex-wrap: wrap; }
  .video-actions .neon-btn { flex: 1; min-width: 90px; justify-content: center; }
}

/* ── Small phones (≤ 480px) ── */
@media (max-width: 480px) {

  /* === Auth === */
  .auth-page { padding: var(--space-4); align-items: flex-start; padding-top: var(--space-10); }
  .auth-card { padding: var(--space-5) var(--space-4); }

  /* === Landing hero === */
  .landing-hero.hero-apple { padding: var(--space-6) var(--space-4); }
  .landing-hero.hero-apple .landing-hero-title { font-size: 1.625rem; letter-spacing: -.025em; }
  .landing-hero.hero-apple .landing-hero-lead { font-size: 0.9375rem; }
  .landing-hero-badge { font-size: 0.6875rem; }

  /* === Landing blocks === */
  .landing-block.block-apple { padding: var(--space-5) var(--space-4); }
  .landing-section-label { font-size: 0.625rem; }
  .audience-item { padding: var(--space-3); font-size: 0.875rem; }

  /* === Landing steps === */
  .landing-block .step-num { width: 32px; height: 32px; font-size: 0.875rem; }

  /* === Landing nav === */
  .landing-nav-inner .landing-cta .neon-btn.ghost { display: none; }

  /* === Dashboard topbar === */
  .cosmic-topbar { height: 48px; padding: 0 var(--space-3); }
  .topbar-brand .brand-logo { width: 24px; height: 24px; }

  /* === Dashboard content === */
  .dashboard-content { padding: var(--space-3); }
  .dashboard-content > section.glow-card { padding: var(--space-3) !important; }

  /* === Tabs === */
  .cosmic-tabs button { padding: 6px var(--space-3); font-size: 0.8125rem; }

  /* === Payment cards === */
  .payment-packs { grid-template-columns: 1fr; }

  /* === Section glow-card == */
  .glow-card { border-radius: var(--radius); }

  /* === Quota block === */
  .quota-stats { flex-direction: column; align-items: flex-start !important; gap: var(--space-2) !important; }
}

/* ── Very small (≤ 360px) ── */
@media (max-width: 360px) {
  .landing-hero.hero-apple .landing-hero-title { font-size: 1.5rem; }
  .auth-card { padding: var(--space-4) var(--space-3); }
  .aurora-sidebar a .sidebar-label { display: none; }
  .aurora-sidebar a { padding: 8px var(--space-2); }
  .neon-btn { font-size: 0.875rem; padding: var(--space-2) var(--space-4); }
}

/* ── Страница «только чат» (chat.ai-vision-aurora.ru / chat.php) ── */
body.chat-only-page .chat-only-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}
body.chat-only-page .chat-only-topbar {
  flex-shrink: 0;
}
body.chat-only-page .chat-only-content {
  flex: 1;
  margin-left: 0;
  padding: 0;
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body.chat-only-page .chat-view .chat-layout {
  height: calc(100vh - 56px);
  min-height: 400px;
}
