/* ================================================================
   MarsGPT — Deep Space Indigo / Violet / Cyan Premium Theme
   ================================================================ */

/* ── 1. CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-deep: #030014;
  --bg-card: #0a0a1f;
  --bg-elevated: #111128;
  --bg-input: #0a0a22;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, .3);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, .2);
  --purple: #a855f7;
  --purple-glow: rgba(168, 85, 247, .2);
  --pink: #ec4899;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #fff;
  --border: #35386a;
  --border-light: rgba(129, 140, 248, .14);
  --glass-bg: rgba(10, 10, 31, .78);
  --glass-border: rgba(129, 140, 248, .22);
  --ring-ui: rgba(129, 140, 248, 0.35);
  --gradient-cta: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  --gradient-cyan: linear-gradient(135deg, #06b6d4, #0ea5e9);
  --gradient-purple: linear-gradient(135deg, #a855f7, #7c3aed);
  --gradient-text: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .6);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, .15);
  --transition: .28s cubic-bezier(.4, 0, .2, 1);
  --transition-slow: .5s cubic-bezier(.4, 0, .2, 1);
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Space Grotesk', var(--font-body);
  --container: 1200px;
  --header-h: 46px;
  /* Бренд: логотип и микротексты */
  --brand-wordmark-tracking: -0.025em;
  --brand-tagline-size: 0.5625rem;
  --brand-tagline-tracking: 0.06em;
  --brand-overline-tracking: 0.13em;
}

/* ── 2. Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }

a {
  color: var(--accent-hover);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--cyan); }

ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

::selection {
  background: var(--purple);
  color: #fff;
}

::-moz-selection {
  background: var(--purple);
  color: #fff;
}

/* ── Custom Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-deep);
}

/* ── 3. Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.18;
  color: var(--text-heading);
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
}
h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(2rem, 5vw, 3.35rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.45rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.6rem); }
h4 { font-size: 1.08rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.92rem; color: var(--text-secondary); }

p { margin-bottom: .75rem; }

.gradient-text,
.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-title {
  font-size: clamp(1.5rem, 4vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: .5rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

/* ── Star Field Background ────────────────────────────────────── */
body::before,
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}
body::before {
  background:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(165, 165, 255, .45) 50%, transparent 50%),
    radial-gradient(1px 1px at 40% 70%, rgba(200, 200, 255, .3) 50%, transparent 50%),
    radial-gradient(1.2px 1.2px at 60% 20%, rgba(180, 180, 255, .25) 50%, transparent 50%),
    radial-gradient(1px 1px at 80% 55%, rgba(150, 150, 255, .2) 50%, transparent 50%),
    radial-gradient(.8px .8px at 10% 85%, rgba(200, 200, 255, .25) 50%, transparent 50%),
    radial-gradient(1px 1px at 75% 90%, rgba(170, 170, 255, .15) 50%, transparent 50%),
    radial-gradient(1.3px 1.3px at 50% 10%, rgba(220, 220, 255, .35) 50%, transparent 50%),
    radial-gradient(.7px .7px at 90% 40%, rgba(180, 180, 255, .2) 50%, transparent 50%);
  background-size: 300px 300px;
  animation: starDrift 100s linear infinite;
}
body::after {
  background:
    radial-gradient(.6px .6px at 15% 45%, rgba(160, 160, 255, .15) 50%, transparent 50%),
    radial-gradient(.9px .9px at 55% 65%, rgba(140, 140, 255, .1) 50%, transparent 50%),
    radial-gradient(.5px .5px at 85% 15%, rgba(180, 180, 255, .15) 50%, transparent 50%),
    radial-gradient(.8px .8px at 35% 80%, rgba(130, 130, 255, .08) 50%, transparent 50%);
  background-size: 400px 400px;
  animation: starDrift 130s linear infinite reverse;
  opacity: .7;
}
@keyframes starDrift {
  to { background-position: 300px 300px; }
}

/* ── 4. Layout ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.page-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding: 2rem 0;
}

/* Лендинг: убираем полосу отступа под шапкой (hero начинается сразу) */
body.body--home main {
  padding-top: 0;
}

/* Grid Utilities */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: .25rem; }
.gap-sm { gap: .5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.gap-xl { gap: 2rem; }

/* ── 5. Header / Navigation ──────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 0;
  height: auto;
  padding: 0.14rem 0 0.12rem;
  background: rgba(3, 0, 20, .78);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  transition: background var(--transition);
}
.site-header .container,
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 0;
}
.site-header__inner .burger {
  margin-right: auto;
}

.logo-stack {
  display: flex;
  align-items: center;
  min-width: 0;
  line-height: 1.15;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  color: #fff;
  text-decoration: none;
  transition: color var(--transition), filter var(--transition);
}
.logo:hover {
  color: #fff;
}
.logo:hover .logo-planet {
  filter: drop-shadow(0 0 10px rgba(234, 88, 12, 0.5)) drop-shadow(0 0 16px rgba(168, 85, 247, 0.35));
}
.logo:focus-visible {
  outline: 2px solid var(--ring-ui);
  outline-offset: 3px;
  border-radius: 10px;
}

.logo-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  min-width: 0;
}
.logo-lockup__title {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.38rem;
  min-width: 0;
}
.logo-wordmark {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: var(--brand-wordmark-tracking);
  line-height: 1.05;
  white-space: nowrap;
  background: linear-gradient(120deg, #fff 0%, #e2e8f0 38%, #c7d2fe 72%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.logo-pro-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.14em 0.42em 0.12em;
  font-family: var(--font-heading);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: none;
  color: #99f6e4;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.38);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.18);
}
.logo-lockup__tagline {
  font-family: var(--font-body);
  font-size: var(--brand-tagline-size);
  font-weight: 500;
  letter-spacing: var(--brand-tagline-tracking);
  line-height: 1.05;
  margin-top: -0.04em;
  color: rgba(148, 163, 184, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
[data-theme="light"] .logo-lockup__tagline {
  color: rgba(100, 116, 139, 0.9);
}
.logo-lockup--drawer .logo-wordmark {
  font-size: 1.05rem;
  -webkit-text-fill-color: var(--text-heading);
  background: none;
  color: var(--text-heading);
}
.logo-lockup--drawer .logo-pro-badge {
  font-size: 0.54rem;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.12);
}
.logo-lockup--drawer .logo-lockup__tagline {
  font-size: 0.52rem;
  letter-spacing: 0.08em;
}
.logo-planet {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  position: relative;
  border-radius: 0;
  background: transparent url('/logo-mark.svg') center / contain no-repeat;
  transition: filter var(--transition);
}
.logo-planet::after {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
}

.balance-badge {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 600;
  color: var(--cyan);
  white-space: nowrap;
  transition: all var(--transition);
  box-shadow: 0 0 12px var(--cyan-glow);
}
.balance-badge:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 20px var(--cyan-glow);
}
.balance-badge svg { width: 14px; height: 14px; }

.mode-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .78rem;
}
.mode-toggle a {
  padding: .3rem .7rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.mode-toggle a.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}
.mode-toggle a:hover:not(.active) {
  color: #fff;
  background: rgba(99, 102, 241, .1);
}

/* Компактная кнопка «наверх» (фикс. левый нижний угол) */
.scroll-to-top-btn {
  position: fixed;
  z-index: 117;
  left: max(0.65rem, env(safe-area-inset-left, 0px));
  bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  color: var(--accent-hover);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    visibility 0.28s ease,
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.scroll-to-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.scroll-to-top-btn:hover {
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--cyan);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.2);
}
.scroll-to-top-btn:focus-visible {
  outline: 2px solid var(--ring-ui);
  outline-offset: 2px;
}
[data-theme="light"] .scroll-to-top-btn {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.1);
}

@media (min-width: 769px) {
  body.site-header-scroll-hidden .site-header {
    transform: none;
    pointer-events: auto;
  }
}

.burger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 11px;
  padding: 0;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.burger:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.12);
}
.burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.burger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.burger.active span:nth-child(2) {
  opacity: 0;
}
.burger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Выезжающее меню: разделы + право + баланс */
body.site-nav-open {
  overflow: hidden;
}
.site-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 108;
  background: rgba(2, 6, 23, 0.52);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
[data-theme="light"] .site-nav-backdrop {
  background: rgba(15, 23, 42, 0.28);
}
.site-nav-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.site-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  width: min(360px, 100%);
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  border-left: 1px solid var(--glass-border);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.32s ease;
}
[data-theme="light"] .site-nav-drawer {
  background: var(--bg-elevated);
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
}
.site-nav-drawer.open {
  transform: translateX(0);
  visibility: visible;
}
.site-nav-drawer__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.site-nav-drawer__brand {
  min-width: 0;
}
.site-nav-drawer__close {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-nav-drawer__close:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text);
}
.site-nav-drawer__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.75rem 1rem 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
}
.site-nav-drawer__balance {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(6, 182, 212, 0.35);
  background: rgba(6, 182, 212, 0.08);
  font-size: 1rem;
  font-weight: 700;
  color: var(--cyan);
}
.site-nav-drawer__balance--link {
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.site-nav-drawer__balance--link:hover,
.site-nav-drawer__balance--link:focus-visible {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.55);
  outline: none;
}
.site-nav-drawer__balance-hint {
  margin-left: auto;
  font-size: .75rem;
  font-weight: 500;
  opacity: .7;
}
.site-nav-drawer__balance svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.icon-wallet-balance {
  flex-shrink: 0;
  opacity: 0.95;
}
.site-nav-drawer__balance .icon-wallet-balance {
  width: 22px;
  height: 22px;
}
.balance-amount-rub {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.rub-suffix {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: var(--font-body), 'Segoe UI', 'Roboto', system-ui, sans-serif;
}
.gen-cost-rub-line {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.site-nav-drawer__section {
  margin: 0 0 0.4rem;
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: var(--brand-overline-tracking);
  text-transform: uppercase;
  color: var(--text-muted);
}
.site-nav-drawer__links {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 1rem;
}
.site-nav-drawer__links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-nav-drawer__links a:hover,
.site-nav-drawer__links a:focus-visible {
  background: rgba(99, 102, 241, 0.1);
  outline: none;
}
.site-nav-drawer__links a.is-active {
  background: rgba(99, 102, 241, 0.16);
  color: var(--accent);
  font-weight: 600;
}
.site-nav-drawer__links--legal a {
  min-height: 40px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.site-nav-drawer__sep {
  height: 1px;
  margin: 0.35rem 0 0.85rem;
  background: var(--border);
}
.site-nav-drawer__mail {
  display: block;
  margin: 0.5rem 0 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  color: var(--cyan);
  text-decoration: none;
  border-radius: var(--radius-sm);
  word-break: break-all;
}
.site-nav-drawer__mail:hover {
  text-decoration: underline;
}
.site-nav-drawer__social {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.site-nav-drawer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.site-nav-drawer__social a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}
.site-nav-drawer__copy {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── 6. Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  text-align: center;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  line-height: 1.4;
}
.btn:disabled {
  opacity: .5;
  pointer-events: none;
}

.btn--primary {
  background: var(--gradient-cta);
  background-size: 200% 200%;
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn--primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .2), transparent);
  transition: left .6s ease;
}
.btn--primary:hover::before {
  left: 100%;
}
.btn--primary:hover {
  box-shadow: 0 6px 32px rgba(99, 102, 241, .45), 0 0 60px rgba(168, 85, 247, .15);
  transform: translateY(-2px);
}
.btn--primary:active {
  transform: translateY(0);
}

.btn--secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  background-image: linear-gradient(var(--bg-card), var(--bg-card)),
                     var(--gradient-cta);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
html:not([data-theme="light"]) .btn--secondary {
  background-image: linear-gradient(var(--bg-elevated), var(--bg-elevated)),
                     linear-gradient(135deg, rgba(99, 102, 241, 0.55), rgba(168, 85, 247, 0.45));
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.15);
}
.btn--secondary:hover {
  background-image: linear-gradient(var(--bg-elevated), var(--bg-elevated)),
                     var(--gradient-cta);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}
html:not([data-theme="light"]) .btn--secondary:hover {
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.28), 0 0 24px var(--accent-glow);
}

.btn--cyan {
  background: var(--gradient-cyan);
  color: #fff;
  box-shadow: 0 4px 16px var(--cyan-glow);
}
.btn--cyan:hover {
  box-shadow: 0 6px 28px rgba(6, 182, 212, .35);
  transform: translateY(-1px);
}

.btn--purple {
  background: var(--gradient-purple);
  color: #fff;
  box-shadow: 0 4px 16px var(--purple-glow);
}
.btn--purple:hover {
  box-shadow: 0 6px 28px rgba(168, 85, 247, .35);
  transform: translateY(-1px);
}

.btn--danger {
  background: var(--error);
  color: #fff;
}
.btn--danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 16px rgba(239, 68, 68, .3);
}

.btn--ghost {
  background: none;
  color: var(--text-secondary);
  padding: .45rem .75rem;
}
.btn--ghost:hover {
  color: #fff;
  background: rgba(99, 102, 241, .08);
}

.btn--sm { padding: .4rem .9rem; font-size: .82rem; border-radius: var(--radius-sm); }
.btn--lg { padding: .85rem 2rem; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn--block { width: 100%; }

.btn--shimmer {
  animation: btnShimmer 3s ease-in-out infinite;
}
@keyframes btnShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ── 7. Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(99, 102, 241, .15), transparent 40%, transparent 60%, rgba(168, 85, 247, .1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}
.card:hover::before {
  opacity: 1;
}
.card:hover {
  border-color: rgba(99, 102, 241, .15);
}
html:not([data-theme="light"]) .card {
  border-color: rgba(129, 140, 248, 0.26);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
html:not([data-theme="light"]) .card:hover {
  border-color: rgba(165, 180, 252, 0.42);
}
html:not([data-theme="light"]) .card--solid {
  border-color: rgba(129, 140, 248, 0.3);
}

.card--solid {
  background: var(--bg-card);
  backdrop-filter: none;
}

.card--accent {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(99, 102, 241, .08);
}

.card--interactive {
  cursor: pointer;
}
.card--interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, .1);
}
.card--interactive:hover::before {
  opacity: 1;
}

/* ── 8. Forms ─────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  margin-bottom: .4rem;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: .7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .92rem;
  transition: all var(--transition);
}
html:not([data-theme="light"]) .form-input,
html:not([data-theme="light"]) .form-textarea,
html:not([data-theme="light"]) .form-select {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 0 0 1px rgba(129, 140, 248, 0.1);
}
html:not([data-theme="light"]) .form-input:focus,
html:not([data-theme="light"]) .form-textarea:focus,
html:not([data-theme="light"]) .form-select:focus {
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 24px rgba(99, 102, 241, 0.18);
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(99, 102, 241, .1);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-input--error,
.form-textarea--error {
  border-color: var(--error);
}
.form-error {
  color: var(--error);
  font-size: .8rem;
  margin-top: .3rem;
}
.form-hint {
  color: var(--text-muted);
  font-size: .8rem;
  margin-top: .3rem;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-bottom: .75rem;
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition);
  position: relative;
}
.form-check input[type="checkbox"] {
  border-radius: 4px;
}
.form-check input[type="radio"] {
  border-radius: 50%;
}
.form-check input[type="checkbox"]:checked,
.form-check input[type="radio"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.form-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.form-check input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.form-check input:focus {
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-check-label {
  font-size: .88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.form-check-label a { color: var(--accent-hover); }

/* Range Slider */
.form-range {
  width: 100%;
  height: 6px;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
.form-range::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-glow);
  transition: box-shadow var(--transition);
}
.form-range::-webkit-slider-thumb:hover {
  box-shadow: 0 0 16px var(--accent-glow);
}
.form-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* ── 9. Landing Page ──────────────────────────────────────────── */

/* ─── Landing Hero ─────────────────────────────── */
.landing-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2rem 0;
}
.landing-hero canvas,
.landing-hero .hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.landing-hero .hero-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}
.landing-hero .hero-bg-orb--1 {
  width: 600px;
  height: 600px;
  background: rgba(99, 102, 241, .12);
  top: -200px;
  right: -100px;
  animation: float 8s ease-in-out infinite;
}
.landing-hero .hero-bg-orb--2 {
  width: 500px;
  height: 500px;
  background: rgba(168, 85, 247, .1);
  bottom: -150px;
  left: -100px;
  animation: float 10s ease-in-out infinite reverse;
}
.landing-hero .hero-bg-orb--3 {
  width: 300px;
  height: 300px;
  background: rgba(6, 182, 212, .08);
  top: 30%;
  left: 50%;
  animation: float 12s ease-in-out infinite 2s;
}

.landing-hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.landing-hero-content h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.landing-hero-content h1 .gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: gradientShift 4s ease infinite;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: text-bottom;
  animation: typing .8s step-end infinite;
}

/* ─── Landing Demo ─────────────────────────────── */
.landing-demo {
  max-width: 720px;
  margin: 0 auto 3rem;
  padding: 1.5rem;
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.landing-demo::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(99, 102, 241, .25), transparent 50%, rgba(168, 85, 247, .15));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.landing-demo-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border-light);
}
.landing-demo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.landing-demo-dot:nth-child(1) { background: #ef4444; }
.landing-demo-dot:nth-child(2) { background: #f59e0b; }
.landing-demo-dot:nth-child(3) { background: #10b981; }

.landing-demo textarea {
  width: 100%;
  min-height: 80px;
  padding: .75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .9rem;
  resize: none;
  transition: all var(--transition);
}
.landing-demo textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 30px rgba(99, 102, 241, .08);
}

.landing-demo-result {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(99, 102, 241, .04);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  min-height: 60px;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  position: relative;
}
.landing-demo-result .typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: typing .8s step-end infinite;
}

.trust-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.trust-badge {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.trust-badge svg {
  width: 14px;
  height: 14px;
  color: var(--success);
}

/* ─── Landing Stats Bar ────────────────────────── */
.landing-stats-bar {
  padding: 2rem 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, .05), rgba(168, 85, 247, .03), rgba(6, 182, 212, .04));
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
}
.landing-stats-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 2rem;
  min-width: max-content;
}
.landing-stat {
  display: flex;
  align-items: center;
  gap: .75rem;
  white-space: nowrap;
}
.landing-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.landing-stat-icon--indigo {
  background: rgba(99, 102, 241, .12);
  color: var(--accent);
}
.landing-stat-icon--cyan {
  background: rgba(6, 182, 212, .12);
  color: var(--cyan);
}
.landing-stat-icon--purple {
  background: rgba(168, 85, 247, .12);
  color: var(--purple);
}
.landing-stat-icon--pink {
  background: rgba(236, 72, 153, .12);
  color: var(--pink);
}
.landing-stat-number {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.landing-stat-label {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ─── Landing Advantages ───────────────────────── */
.landing-advantages {
  padding: 5rem 0;
}
.advantages-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.advantage-card {
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.advantage-card:hover {
  transform: translateY(-5px);
  border-color: rgba(99, 102, 241, .2);
  box-shadow: 0 8px 40px rgba(99, 102, 241, .1), 0 0 60px rgba(168, 85, 247, .05);
}

.advantage-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 1.75rem;
  position: relative;
}
.advantage-icon--indigo {
  background: linear-gradient(135deg, rgba(99, 102, 241, .15), rgba(99, 102, 241, .05));
  color: var(--accent);
  box-shadow: 0 0 20px rgba(99, 102, 241, .12);
}
.advantage-icon--cyan {
  background: linear-gradient(135deg, rgba(6, 182, 212, .15), rgba(6, 182, 212, .05));
  color: var(--cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, .12);
}
.advantage-icon--purple {
  background: linear-gradient(135deg, rgba(168, 85, 247, .15), rgba(168, 85, 247, .05));
  color: var(--purple);
  box-shadow: 0 0 20px rgba(168, 85, 247, .12);
}
.advantage-icon--pink {
  background: linear-gradient(135deg, rgba(236, 72, 153, .15), rgba(236, 72, 153, .05));
  color: var(--pink);
  box-shadow: 0 0 20px rgba(236, 72, 153, .12);
}
.advantage-icon--success {
  background: linear-gradient(135deg, rgba(16, 185, 129, .15), rgba(16, 185, 129, .05));
  color: var(--success);
  box-shadow: 0 0 20px rgba(16, 185, 129, .12);
}

.advantage-card h3 {
  font-size: 1.15rem;
  margin-bottom: .6rem;
}
.advantage-card p {
  color: var(--text-secondary);
  font-size: .9rem;
  line-height: 1.6;
}

.advantage-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--gradient-cta);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .2rem .6rem;
  border-radius: 20px;
  white-space: nowrap;
}

/* ─── Landing Comparison ───────────────────────── */
.landing-comparison {
  padding: 5rem 0;
}
.comparison-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.comparison-table {
  min-width: 700px;
}
.comparison-table th,
.comparison-table td {
  padding: .9rem 1.25rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.comparison-table th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.comparison-table th:first-child,
.comparison-table td:first-child {
  text-align: left;
  font-weight: 500;
}
.comparison-table tbody tr {
  transition: background var(--transition);
}
.comparison-table tbody tr:hover {
  background: rgba(99, 102, 241, .03);
}
.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.comparison-highlight {
  position: relative;
}
.comparison-highlight th {
  background: linear-gradient(180deg, rgba(99, 102, 241, .15), var(--bg-elevated));
  color: var(--accent-hover);
}
.comparison-table td.comparison-highlight {
  background: rgba(99, 102, 241, .04);
  border-left: 1px solid rgba(99, 102, 241, .15);
  border-right: 1px solid rgba(99, 102, 241, .15);
}

.comparison-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(16, 185, 129, .12);
  color: var(--success);
  font-size: .8rem;
  font-weight: 700;
}
.comparison-cross {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(239, 68, 68, .1);
  color: var(--error);
  font-size: .8rem;
  font-weight: 700;
}

/* ─── Landing Steps ────────────────────────────── */
.landing-steps {
  padding: 5rem 0;
}
.steps-timeline {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  position: relative;
  counter-reset: step;
}
.steps-timeline::before {
  content: '';
  position: absolute;
  top: 30px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.step-item {
  flex: 1;
  max-width: 250px;
  text-align: center;
  position: relative;
  z-index: 1;
  counter-increment: step;
  padding: 0 .75rem;
}
.step-circle {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 2px solid var(--border);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}
.step-item.active .step-circle,
.step-item:hover .step-circle {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(99, 102, 241, .1);
}
.step-item h4 {
  margin-bottom: .35rem;
  font-size: 1.05rem;
}
.step-item p {
  color: var(--text-secondary);
  font-size: .85rem;
  line-height: 1.5;
}

/* ─── Landing Models Ticker ────────────────────── */
.landing-models-ticker {
  padding: 2rem 0;
  overflow: hidden;
  position: relative;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.landing-models-ticker::before,
.landing-models-ticker::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100px;
  z-index: 2;
  pointer-events: none;
}
.landing-models-ticker::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg-deep), transparent);
}
.landing-models-ticker::after {
  right: 0;
  background: linear-gradient(270deg, var(--bg-deep), transparent);
}

.ticker-track {
  display: flex;
  gap: 1rem;
  animation: ticker 30s linear infinite;
  width: max-content;
}
.ticker-track:hover {
  animation-play-state: paused;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem 1rem;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.model-pill:hover {
  border-color: var(--accent);
  color: var(--text);
}

.model-pill--openai { border-color: rgba(16, 163, 127, .25); color: #10a37f; }
.model-pill--anthropic { border-color: rgba(214, 147, 99, .25); color: #d69363; }
.model-pill--google { border-color: rgba(66, 133, 244, .25); color: #4285f4; }
.model-pill--meta { border-color: rgba(0, 132, 255, .25); color: #0084ff; }
.model-pill--mistral { border-color: rgba(255, 123, 0, .25); color: #ff7b00; }

/* ─── Landing Testimonials ─────────────────────── */
.landing-testimonials {
  padding: 5rem 0;
}
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.testimonial {
  padding: 2rem;
}
.testimonial-stars {
  display: flex;
  gap: .15rem;
  margin-bottom: .75rem;
  color: #f59e0b;
  font-size: .9rem;
}
.testimonial-text {
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: .95rem;
  line-height: 1.7;
  position: relative;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
}
.testimonial-author {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.testimonial-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-cta);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
}
.testimonial-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
}
.testimonial-role {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ─── Landing Pricing ──────────────────────────── */
.landing-pricing {
  padding: 5rem 0;
}

.pricing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 2.5rem;
}
.pricing-toggle-label {
  font-size: .9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition);
}
.pricing-toggle-label.active {
  color: #fff;
  font-weight: 600;
}
.pricing-toggle-switch {
  width: 48px;
  height: 26px;
  background: var(--border);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}
.pricing-toggle-switch.active {
  background: var(--accent);
}
.pricing-toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
}
.pricing-toggle-switch.active::after {
  transform: translateX(22px);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.pricing-card {
  padding: 2.5rem 1.5rem;
  position: relative;
  text-align: center;
}
.pricing-card.recommended {
  border-color: var(--accent);
  box-shadow: 0 0 50px rgba(99, 102, 241, .12), 0 8px 32px rgba(0, 0, 0, .3);
}
.pricing-card.recommended::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient-cta);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gradient-cta);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: .3rem .9rem;
  border-radius: 20px;
  letter-spacing: .04em;
  white-space: nowrap;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.pricing-name {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.pricing-price {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: .25rem;
}
.pricing-price span {
  font-size: .9rem;
  color: var(--text-secondary);
  font-weight: 400;
}
.pricing-desc {
  color: var(--text-muted);
  font-size: .85rem;
  margin-bottom: 1.5rem;
}

.pricing-features {
  text-align: left;
  margin: 1.5rem 0;
}
.pricing-features li {
  padding: .4rem 0;
  color: var(--text-secondary);
  font-size: .88rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.pricing-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Landing Kids Section ─────────────────────── */
.landing-kids {
  padding: 5rem 0;
}
.kids-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.kids-content h2 {
  margin-bottom: 1rem;
}
.kids-content p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.kids-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: linear-gradient(135deg, rgba(236, 72, 153, .15), rgba(168, 85, 247, .1));
  color: var(--pink);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: .35rem .85rem;
  border-radius: 20px;
  letter-spacing: .04em;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(236, 72, 153, .2);
}

.kids-visual {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, rgba(168, 85, 247, .12), rgba(236, 72, 153, .08), rgba(6, 182, 212, .1));
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(168, 85, 247, .15);
}
.kids-visual-emoji {
  font-size: 5rem;
  animation: float 4s ease-in-out infinite;
}
.kids-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.kids-feature {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
  color: var(--text-secondary);
}
.kids-feature-icon {
  flex-shrink: 0;
  color: var(--purple);
  font-size: 1rem;
}

/* ─── Landing FAQ ──────────────────────────────── */
.landing-faq {
  padding: 5rem 0;
}
.faq-list {
  max-width: 750px;
  margin: 0 auto;
}
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:first-child {
  border-top: 1px solid var(--border);
}
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  transition: color var(--transition);
  gap: 1rem;
  user-select: none;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
}
.faq-question:hover {
  color: var(--accent-hover);
}
.faq-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(99, 102, 241, .1);
  color: var(--accent);
  font-size: .9rem;
  transition: all var(--transition);
}
.faq-item.open .faq-icon {
  background: var(--accent);
  color: #fff;
  transform: rotate(45deg);
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s cubic-bezier(.4, 0, .2, 1), padding .4s ease;
  padding: 0;
}
.faq-item.open .faq-answer {
  max-height: 400px;
  padding-bottom: 1.25rem;
}
.faq-answer p {
  color: var(--text-secondary);
  font-size: .92rem;
  line-height: 1.7;
}

/* ─── Landing CTA Final ────────────────────────── */
.landing-cta-final {
  padding: 6rem 0;
  position: relative;
  overflow: hidden;
  text-align: center;
}
.landing-cta-final::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, .08), rgba(168, 85, 247, .05), rgba(6, 182, 212, .06));
  z-index: 0;
}
.landing-cta-final > * {
  position: relative;
  z-index: 1;
}
.landing-cta-final h2 {
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  margin-bottom: 1rem;
}
.landing-cta-final p {
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 2rem;
  font-size: 1.1rem;
}
.landing-cta-final .btn--primary {
  animation: glowPulse 2.5s ease-in-out infinite;
}

/* ── 10. Flash Messages ───────────────────────────────────────── */
.flash-messages {
  position: fixed;
  top: calc(var(--header-h) + 1rem);
  right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 420px;
  width: calc(100% - 2rem);
}
.flash {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: flashIn .4s cubic-bezier(.4, 0, .2, 1);
  font-size: .9rem;
  box-shadow: var(--shadow);
}
.flash-icon { flex-shrink: 0; font-size: 1.1rem; }
.flash-body { flex: 1; }
.flash-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition);
}
.flash-close:hover { color: #fff; }

.flash--success { border-color: rgba(16, 185, 129, .4); }
.flash--success .flash-icon { color: var(--success); }
.flash--error { border-color: rgba(239, 68, 68, .4); }
.flash--error .flash-icon { color: var(--error); }
.flash--info { border-color: rgba(6, 182, 212, .4); }
.flash--info .flash-icon { color: var(--cyan); }
.flash--warning { border-color: rgba(245, 158, 11, .4); }
.flash--warning .flash-icon { color: var(--warning); }

.flash-dismiss {
  animation: flashOut .3s ease-in forwards;
}

@keyframes flashIn {
  from { opacity: 0; transform: translateX(40px) scale(.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes flashOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ── 11. Auth Pages ───────────────────────────────────────────── */
.auth-container {
  max-width: 380px;
  margin: 3rem auto;
}
.auth-card {
  padding: 2.5rem;
  position: relative;
}
.auth-card--compact {
  padding: 2rem 1.75rem;
}
.auth-card--compact h2 {
  margin-bottom: 1.25rem;
  font-size: 1.3rem;
}
.auth-card--compact .form-group {
  margin-bottom: .85rem;
}
.auth-card--compact .form-input {
  padding: .6rem .85rem;
  font-size: .92rem;
}
.auth-card--compact .btn {
  padding: .65rem 1rem;
  font-size: .95rem;
}
.auth-card--compact .auth-links {
  margin-top: 1rem;
}
.auth-card--compact .form-check {
  margin-bottom: .5rem;
}
.auth-card--compact .form-check-label {
  font-size: .78rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.form-row {
  display: flex;
  gap: .65rem;
}
.form-row .form-group {
  flex: 1;
  min-width: 0;
}
.auth-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(99, 102, 241, .2), transparent 60%, rgba(168, 85, 247, .1));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.auth-card h2 {
  text-align: center;
  margin-bottom: 1.75rem;
  font-size: clamp(1.35rem, 4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.auth-links {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .88rem;
  color: var(--text-secondary);
}

.captcha-inline {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .55rem .85rem;
}
.captcha-q {
  color: var(--text-secondary);
  font-size: .95rem;
  white-space: nowrap;
  font-weight: 600;
}
.captcha-a {
  width: 64px !important;
  flex: 0 0 64px;
  text-align: center;
  font-size: 1rem !important;
  padding: .4rem .5rem !important;
  letter-spacing: .1em;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: .82rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.password-strength {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: .5rem;
  overflow: hidden;
}
.password-strength-bar {
  height: 100%;
  border-radius: 2px;
  transition: width .3s ease, background .3s ease;
  width: 0;
}
.password-strength-bar[data-level="1"] { width: 25%; background: var(--error); }
.password-strength-bar[data-level="2"] { width: 50%; background: var(--warning); }
.password-strength-bar[data-level="3"] { width: 75%; background: var(--cyan); }
.password-strength-bar[data-level="4"] { width: 100%; background: var(--success); }

.password-strength-text {
  font-size: .75rem;
  margin-top: .25rem;
  color: var(--text-muted);
}

.pw-hints {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .5rem;
  margin-top: .45rem;
}
.pw-rule {
  font-size: .72rem;
  padding: .15rem .45rem;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-muted);
  transition: background .2s, color .2s;
}
.pw-rule.ok {
  background: rgba(16,185,129,.15);
  color: var(--success);
}
.pw-rule.fail {
  background: rgba(239,68,68,.12);
  color: var(--error);
}

.pw-match {
  font-size: .78rem;
  margin-top: .35rem;
  min-height: 1.1em;
  transition: color .2s;
}
.pw-match--ok { color: var(--success); }
.pw-match--err { color: var(--error); }

.form-input--ok {
  border-color: var(--success) !important;
}
.form-input--ok:focus {
  box-shadow: 0 0 0 3px rgba(16,185,129,.18) !important;
}

/* ── 12. Generation Page ──────────────────────────────────────── */
.gen-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.gen-type-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.gen-type-tab {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.gen-type-tab:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}
.gen-type-tab:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.gen-type-tab.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, .25), rgba(99, 102, 241, .08));
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 20px rgba(99, 102, 241, .12);
}
.gen-type-tab .badge {
  font-size: .65rem;
}
.gen-wallet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.gen-wallet-balance,
.gen-wallet-free {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .2rem;
}
.gen-wallet.card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.balance-badge--lg {
  font-size: 1.05rem;
  font-weight: 600;
  padding: .45rem .75rem;
}
.gen-main-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.gen-main-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.gen-prompt-label {
  display: block;
  margin-bottom: .6rem;
}
.gen-prompt-area {
  padding: 1.25rem 1.35rem;
}
.form-select--model,
.form-select--ensemble {
  font-size: .74rem;
  line-height: 1.3;
}
.form-select--model option,
.form-select--ensemble option {
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-picker .model-picker__search {
  display: none;
}
.model-picker--open .model-picker__search {
  display: block;
}
.model-picker__select[size="1"] {
  cursor: pointer;
}
.model-picker--open .model-picker__select {
  max-height: 260px;
  overflow-y: auto;
}
.form-input--model-search {
  display: block;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 4px;
  font-size: .78rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input, var(--bg-card));
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.form-input--model-search:focus {
  border-color: var(--accent);
}
.form-input--model-search::placeholder {
  color: var(--text-muted);
}
.site-nav-drawer__links--cabinet {
  background: rgba(99, 102, 241, 0.06);
  border-radius: 10px;
  padding: 4px 0;
}
.gen-result-panel-header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.gen-result-panel-header .gen-result-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.gen-result-panel-header.hidden {
  display: none;
}
.gen-result-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .02em;
}
.gen-deposit-modal.modal-overlay.open {
  z-index: 200;
}
.gen-two-col {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  min-height: calc(100vh - var(--header-h) - 8rem);
}
.gen-generate-row {
  display: flex;
  gap: .75rem;
}
.gen-generate-btn {
  flex: 1;
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 600;
}
.gen-result.gen-result--main {
  min-height: 400px;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
}
.gen-result-body {
  flex: 1;
  min-height: 300px;
  display: flex;
  flex-direction: column;
}
.gen-result-body .gen-result-placeholder,
.gen-result-body .gen-loading {
  flex: 1;
  min-height: 280px;
}
.gen-result-body .md-content {
  flex: 1;
}
.gen-result-heading {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.gen-result-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.gen-result-summary {
  margin: 0;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--text-muted);
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}
.gen-result-stats {
  margin-top: .15rem;
}
.deposit-presets {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.deposit-preset.selected,
.deposit-preset-pricing.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.modal--wide {
  max-width: 560px;
}
.modal--assistant {
  max-width: 520px;
}
.assistant-modal-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.2rem;
  margin-top: 0.25rem;
}
.assistant-improved-block {
  flex-shrink: 0;
}
.assistant-model-recs {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: rgba(99, 102, 241, 0.06);
}
.assistant-model-recs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.assistant-model-recs__item {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.assistant-model-recs__role {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.assistant-model-recs__name {
  color: var(--text);
  font-weight: 600;
}
.assistant-guide {
  margin-bottom: 0.95rem;
}
.assistant-guide-lead {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0 0 0.45rem;
}
.assistant-guide-list {
  margin: 0;
  padding-left: 1.05rem;
  font-size: 0.76rem;
  line-height: 1.42;
  color: var(--text-secondary);
}
.assistant-guide-list li {
  margin-bottom: 0.4rem;
}
.assistant-guide-list li:last-child {
  margin-bottom: 0;
}
.assistant-faq {
  margin-bottom: 0.95rem;
}
.assistant-faq-title {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 0.45rem;
  color: var(--text);
}
.assistant-faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.3rem;
  background: var(--bg-elevated);
}
.assistant-faq-item summary {
  cursor: pointer;
  padding: 0.45rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 500;
  list-style: none;
}
.assistant-faq-item summary::-webkit-details-marker {
  display: none;
}
.assistant-faq-item summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.35rem;
  opacity: 0.55;
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.assistant-faq-item[open] summary::before {
  transform: rotate(90deg);
}
.assistant-faq-item p {
  margin: 0;
  padding: 0 0.55rem 0.5rem;
  font-size: 0.74rem;
  line-height: 1.42;
  color: var(--text-muted);
}
.assistant-tip-heading,
.assistant-history-heading {
  font-size: 0.76rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
  color: var(--text-secondary);
}
.assistant-tip-section {
  margin-bottom: 0.75rem;
}
.assistant-history-section {
  margin-bottom: 0;
}
.modal--settings {
  max-width: 440px;
  max-height: min(90vh, 760px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem 1.5rem;
}
.modal--settings .modal-header {
  flex-shrink: 0;
  margin-bottom: 1rem;
}
.modal-settings-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: .25rem;
}

/* Generation page — chat-style workspace (минималистичный UI) */
.gen-chat-ui {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h) - 2.5rem);
  min-height: calc(100dvh - var(--header-h) - 2.5rem);
  padding-bottom: 1rem;
}

/* Двухколоночный макет: вертикальный рейл режимов слева */
.gen-workspace-cols {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  flex: 1;
  min-height: 0;
  gap: 0;
}
.gen-workspace-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gen-mode-rail {
  flex-shrink: 0;
  width: 58px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.4rem 0;
  border-right: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(
    165deg,
    rgba(15, 23, 42, 0.65) 0%,
    rgba(15, 23, 42, 0.22) 48%,
    rgba(99, 102, 241, 0.06) 100%
  );
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}
[data-theme="light"] .gen-mode-rail {
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.94) 0%,
    rgba(248, 250, 252, 0.82) 50%,
    rgba(99, 102, 241, 0.05) 100%
  );
  border-right-color: rgba(15, 23, 42, 0.08);
  box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.04);
}

.gen-type-tabs--rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  padding: 0 0.2rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
body.body--gen-workspace .gen-mode-rail {
  min-height: 0;
}
.gen-type-tabs--rail .gen-type-tab--rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: calc(100% - 0.35rem);
  margin: 0 auto;
  padding: 0.58rem 0.15rem;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: rgba(226, 232, 240, 0.5);
  font-family: inherit;
  cursor: pointer;
  transition: color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
  box-shadow: none;
}
[data-theme="light"] .gen-type-tabs--rail .gen-type-tab--rail {
  color: rgba(51, 65, 85, 0.48);
}
.gen-type-tabs--rail .gen-type-tab--rail:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}
[data-theme="light"] .gen-type-tabs--rail .gen-type-tab--rail:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.045);
}
.gen-type-tabs--rail .gen-type-tab--rail.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.16) 0%, rgba(99, 102, 241, 0.02) 88%, transparent 100%);
  box-shadow: inset 2px 0 0 0 rgba(167, 139, 250, 0.92), 0 0 0 1px rgba(99, 102, 241, 0.08);
}
.gen-type-tabs--rail .gen-type-tab--rail:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.gen-type-tabs--rail .gen-type-tab--rail:disabled {
  opacity: 1;
  cursor: not-allowed;
}
.gen-type-tabs--rail .gen-type-tab--rail:disabled .gen-type-tab__glyph,
.gen-type-tabs--rail .gen-type-tab--rail:disabled .gen-type-tab__label {
  opacity: 0.36;
}
.gen-type-tabs--rail .gen-type-tab--rail:disabled .gen-type-tab__soon {
  opacity: 0.5;
}
.gen-type-tab__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.gen-type-tab__glyph svg {
  display: block;
}
.gen-type-tab__label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  line-height: 1.2;
  text-align: center;
  max-width: 100%;
}
.gen-type-tab__soon {
  font-size: 0.48rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1;
  margin-top: -0.05rem;
}

@media (max-height: 560px) {
  .gen-type-tabs--rail .gen-type-tab--rail {
    padding: 0.4rem 0.12rem;
    gap: 0.22rem;
  }
  .gen-type-tab__label {
    font-size: 0.55rem;
  }
}

/* Полноэкранная рабочая зона: без подвала, ввод закреплён снизу окна */
body.body--gen-workspace {
  overflow-x: hidden;
  --gen-chrome-h: 0px;
}
body.body--gen-workspace .page-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
}
body.body--gen-workspace main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0 0;
  overflow: hidden;
}
body.body--gen-workspace main > .container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.body--gen-workspace .gen-chat-ui {
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - var(--header-h) - var(--gen-chrome-h) - env(safe-area-inset-bottom, 0px) - 0.5rem);
  max-height: calc(100dvh - var(--header-h) - var(--gen-chrome-h) - env(safe-area-inset-bottom, 0px) - 0.5rem);
  padding-bottom: 0;
  margin-bottom: 0;
}
body.body--gen-workspace .gen-workspace-cols {
  flex: 1;
  min-height: 0;
  gap: 0.35rem;
}
body.body--gen-workspace main > .container.gen-page.gen-chat-ui {
  padding-left: 0.65rem;
}
body.body--gen-workspace .gen-chat-bar {
  margin-bottom: 0.45rem;
  padding-bottom: 0.45rem;
  flex-shrink: 0;
}
body.body--gen-workspace .gen-chat-stage {
  flex: 1;
  min-height: 0;
  gap: 0.45rem;
}
body.body--gen-workspace .gen-thread-shell {
  flex: 1;
  min-height: 0;
  max-height: none;
}
body.body--gen-workspace .gen-thread-head {
  padding: 0.45rem 2.35rem 0.45rem 0.75rem;
}
body.body--gen-workspace .gen-text-scale-toolbar {
  top: 0.28rem;
  right: 0.35rem;
  border-radius: 5px;
}
body.body--gen-workspace .gen-text-scale__btn {
  min-width: 24px;
  min-height: 24px;
  padding: 0.1rem 0.12rem;
}
body.body--gen-workspace .gen-text-scale__icon {
  width: 12px;
  height: 12px;
}
body.body--gen-workspace .gen-result-title {
  font-size: 0.82rem;
}
body.body--gen-workspace .gen-result-summary {
  font-size: 0.68rem;
  line-height: 1.32;
}
body.body--gen-workspace .gen-thread-head__hint {
  font-size: 0.8rem;
  line-height: 1.35;
}
body.body--gen-workspace .gen-kbd-hint {
  display: inline-block;
  padding: 0.05rem 0.28rem;
  font-size: 0.68rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-muted);
  vertical-align: baseline;
}
body.body--gen-workspace .gen-thread-free-note {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}
body.body--gen-workspace .gen-thread-body {
  flex: 1;
  min-height: 0;
  padding: 0.65rem 0.85rem 0.85rem;
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(100% - 2.75rem),
    rgba(0, 0, 0, 0.65) calc(100% - 1.1rem),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(100% - 2.75rem),
    rgba(0, 0, 0, 0.65) calc(100% - 1.1rem),
    transparent 100%
  );
}
body.body--gen-workspace .gen-thread-body .gen-result-placeholder,
body.body--gen-workspace .gen-thread-body .gen-loading {
  min-height: 120px;
}
body.body--gen-workspace .gen-thread-empty-glyph {
  font-size: 1.65rem;
}
body.body--gen-workspace .gen-thread-empty-title {
  font-size: 1rem;
  letter-spacing: -0.01em;
}
body.body--gen-workspace .gen-composer {
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.45rem 0.55rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.14);
  z-index: 3;
}
body.body--gen-workspace .gen-composer__footer {
  margin-top: 0.35rem;
}
body.body--gen-workspace .gen-composer__input {
  min-height: 44px;
  padding: 0.65rem 2.8rem 0.65rem 0.85rem;
  font-size: 0.82rem;
}
body.body--gen-workspace .gen-composer__input-field .gen-composer__input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
body.body--gen-workspace .gen-attachment-row {
  margin-bottom: 0.35rem;
}

/* Десктоп: компактнее верхняя панель (модель, +, история, шаблоны, справка) и заголовок зоны чата */
@media (min-width: 769px) {
  body.body--gen-workspace .gen-chat-bar {
    margin-bottom: 0.28rem;
    padding-bottom: 0.26rem;
    gap: 0.3rem 0.55rem;
  }
  body.body--gen-workspace .gen-chat-bar__left {
    gap: 0.35rem 0.55rem;
  }
  body.body--gen-workspace .gen-chat-bar__actions {
    gap: 0.18rem;
  }
  body.body--gen-workspace .gen-model-trigger {
    padding: 0.22rem 0.48rem 0.22rem 0.38rem;
    gap: 0.28rem;
    max-width: min(228px, 34vw);
  }
  body.body--gen-workspace .gen-model-trigger__hint {
    display: none;
  }
  body.body--gen-workspace .gen-model-trigger__name {
    font-size: 0.72rem;
  }
  body.body--gen-workspace .gen-model-trigger__icon svg {
    width: 14px;
    height: 14px;
  }
  body.body--gen-workspace .gen-model-trigger__chev {
    font-size: 0.52rem;
    margin-left: 0.02rem;
  }
  body.body--gen-workspace .gen-chat-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
  }
  body.body--gen-workspace .gen-chat-icon-btn svg {
    width: 15px;
    height: 15px;
  }
  body.body--gen-workspace .gen-thread-head {
    padding: 0.22rem 1.75rem 0.22rem 0.5rem;
  }
  body.body--gen-workspace .gen-text-scale-toolbar {
    top: 0.12rem;
    right: 0.22rem;
    border-radius: 5px;
  }
  body.body--gen-workspace .gen-text-scale__btn {
    min-width: 26px;
    min-height: 26px;
    padding: 0.07rem 0.09rem;
  }
  body.body--gen-workspace .gen-text-scale__icon {
    width: 13px;
    height: 13px;
  }
  body.body--gen-workspace .gen-thread-head__empty .gen-thread-empty-title {
    font-size: 0.76rem;
    line-height: 1.12;
    letter-spacing: -0.02em;
  }
  body.body--gen-workspace .gen-thread-empty-title-full {
    display: none;
  }
  body.body--gen-workspace .gen-thread-empty-title-short {
    display: inline;
  }
  body.body--gen-workspace .gen-thread-head__hint {
    font-size: 0.6rem;
    line-height: 1.2;
  }
  body.body--gen-workspace .gen-kbd-hint {
    padding: 0.02rem 0.14rem;
    font-size: 0.52rem;
    border-radius: 3px;
  }
  body.body--gen-workspace .gen-thread-free-note {
    margin-top: 0.15rem;
    font-size: 0.66rem;
    line-height: 1.3;
  }
  body.body--gen-workspace .gen-wallet-inline__free {
    font-size: 0.66rem;
    padding: 0.12rem 0.35rem;
  }
  body.body--gen-workspace .balance-badge--compact {
    font-size: 0.74rem;
    padding: 0.24rem 0.45rem;
  }
  body.body--gen-workspace .gen-deposit-compact {
    padding: 0.22rem 0.55rem;
    font-size: 0.72rem;
  }
}

.gen-chat-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid rgba(99, 102, 241, .1);
}
.gen-chat-bar__left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
  min-width: 0;
  flex: 1;
}
.gen-chat-bar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}
.gen-chat-bar__actions {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.gen-chat-bar__toggle {
  display: flex;
  position: absolute;
  left: 50%;
  bottom: -15px;
  transform: translateX(-50%);
  width: auto;
  min-width: 80px;
  height: 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 10px;
  opacity: 0.85;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
  z-index: 10;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.gen-chat-bar__toggle::after {
  content: "Настройки";
  font-size: 0.5rem;
  margin-left: 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.gen-chat-bar__toggle:hover {
  opacity: 1;
  color: var(--accent);
  background: var(--bg-card);
}
.gen-chat-bar__toggle-icon {
  display: block;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.2s ease;
}
.gen-chat-bar.gen-chat-bar--collapsed .gen-chat-bar__toggle-icon {
  transform: rotate(180deg);
}
.gen-chat-bar.gen-chat-bar--collapsed {
  margin-bottom: 0.5rem;
  padding-bottom: 0;
  border-bottom-color: transparent;
}
.gen-chat-bar.gen-chat-bar--collapsed .gen-chat-bar__left,
.gen-chat-bar.gen-chat-bar--collapsed .gen-chat-bar__right {
  display: none;
}
.gen-type-tabs--inline {
  gap: .35rem;
}
.gen-type-tabs--inline .gen-type-tab {
  padding: .4rem .75rem;
  font-size: .8rem;
}
.gen-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  max-width: min(300px, 46vw);
  padding: .45rem .75rem .45rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.gen-model-trigger:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, .12);
}
.gen-model-trigger__icon {
  display: flex;
  color: var(--accent);
  flex-shrink: 0;
}
.gen-model-trigger__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}
.gen-model-trigger__hint {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  line-height: 1.2;
}
.gen-model-trigger__name {
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.gen-model-trigger__chev {
  font-size: .65rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: .15rem;
}
.gen-chat-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.gen-chat-icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.gen-chat-icon-btn--accent:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}
.gen-chat-icon-btn--personalization {
  position: relative;
}
.gen-chat-icon-btn--personalization.has-content::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-elevated);
}
.personalization-modal__field {
  min-height: 72px;
}
.gen-wallet-inline {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.gen-wallet-inline--btn {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  gap: .25rem;
  background: var(--bg-card);
  transition: background .15s, border-color .15s;
  font-size: .72rem;
  font-weight: 600;
  color: inherit;
  line-height: 1.2;
}
.gen-wallet-inline--btn:hover,
.gen-wallet-inline--btn:focus-visible {
  border-color: var(--accent);
  background: rgba(99, 102, 241, .06);
  outline: none;
}
.gen-wallet-inline__free {
  font-size: .72rem;
  padding: .2rem .45rem;
  border-radius: 6px;
  background: rgba(16, 185, 129, .1);
  color: var(--success);
}
.balance-badge--compact {
  font-size: .8rem;
  font-weight: 600;
  padding: .32rem .55rem;
  gap: .35rem;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
}
.gen-deposit-compact {
  white-space: nowrap;
}

/* Кнопка баланса в шапке — только моб. страница генерации (на десктопе баланс в панели чата) */
.site-header__gen-balance-btn {
  display: none;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: 0.15rem;
  padding: 0.28rem 0.55rem 0.28rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.12);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.site-header__gen-balance-btn:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.18);
}
@media (max-width: 768px) {
  body.body--gen-workspace .site-header__gen-balance-btn {
    display: inline-flex;
  }
}
@media (min-width: 769px) {
  body.body--gen-workspace .site-header__gen-balance-btn {
    display: none !important;
  }
}
/* Кнопка режимов на мобиле: узкое «ушко» у левого края по центру высоты */
.gen-mobile-rail-fab {
  display: none;
}
.gen-mode-rail-backdrop {
  display: none;
}

/* Оценка сервиса: узкая вкладка у правого края (страница генерации) */
.gen-service-rating-tab {
  display: none;
}
body.body--gen-workspace .gen-service-rating-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 115;
  width: 28px;
  min-height: 72px;
  margin: 0;
  padding: 0.35rem 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 12px 0 0 12px;
  background: var(--bg-card);
  color: var(--text-muted);
  box-shadow: -2px 0 14px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
[data-theme='light'] body.body--gen-workspace .gen-service-rating-tab {
  box-shadow: -2px 0 12px rgba(15, 23, 42, 0.06);
}
body.body--gen-workspace .gen-service-rating-tab:hover {
  color: var(--accent);
  background: var(--bg-elevated);
}
body.body--gen-workspace .gen-service-rating-tab:active {
  transform: translateY(-50%) scale(0.98);
}
body.body--gen-workspace .gen-service-rating-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.gen-service-rating-tab__glyph {
  display: flex;
  color: inherit;
  opacity: 0.92;
}
.gen-service-rating-tab__glyph svg {
  display: block;
}
.gen-service-rating-tab__label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 0.3rem;
  line-height: 1;
  max-height: 4.2rem;
  overflow: hidden;
}

.gen-rating-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.gen-rating-star {
  width: 2.15rem;
  height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.gen-rating-star:hover {
  border-color: rgba(167, 139, 250, 0.65);
  color: var(--accent);
}
.gen-rating-star.is-selected {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.88));
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
}
[data-theme='light'] .gen-rating-star.is-selected {
  color: #fff;
}

.gen-history-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.gen-history-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.gen-history-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 92vw);
  z-index: 1050;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 32px rgba(0, 0, 0, .12);
  padding: 1rem 1rem 1.25rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .22s ease;
}
.gen-history-drawer.open {
  transform: translateX(0);
}
.gen-history-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .75rem;
}
.gen-history-drawer__title {
  font-size: 1rem;
  font-weight: 600;
}
.gen-history-chat-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.gen-history-chat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .15rem;
  width: 100%;
  text-align: left;
  padding: .55rem .65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.gen-history-chat-item:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, .06);
}
.gen-history-chat-item__title {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.gen-history-chat-item__time {
  font-size: .72rem;
}
.gen-thread-messages {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  width: 100%;
  max-width: none;
}
.gen-msg--user {
  display: flex;
  justify-content: flex-end;
}
.gen-msg__inner {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  gap: 0.2rem;
}
.gen-msg--user .gen-msg__inner {
  align-items: flex-end;
}
.gen-msg--assistant .gen-msg__inner {
  max-width: 100%;
  align-items: flex-start;
}
.gen-msg__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.2rem;
  padding: 0 0.1rem;
  opacity: 0.82;
  transition: opacity 0.15s ease;
}
.gen-msg:hover .gen-msg__actions,
.gen-msg:focus-within .gen-msg__actions {
  opacity: 1;
}
.gen-msg-copy-btn {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
}
.gen-msg-copy-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}
.gen-msg-copy-sep {
  color: var(--text-muted);
  font-size: 0.65rem;
  opacity: 0.5;
  user-select: none;
}
.gen-msg--user .gen-msg__bubble {
  max-width: 100%;
  padding: .65rem .85rem;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, .18), rgba(124, 58, 237, .12));
  border: 1px solid rgba(99, 102, 241, .25);
}
.gen-msg__file {
  font-size: .78rem;
  color: var(--text-secondary);
  margin-bottom: .35rem;
}
.gen-msg__text {
  font-size: .9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.gen-msg--assistant {
  display: flex;
  justify-content: flex-start;
}
.gen-msg--assistant .md-content {
  width: 100%;
  max-width: 100%;
  padding: .5rem .72rem;
  border-radius: 12px 12px 12px 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: normal;
}
.kids-gen-result-content > .md-content.gen-result-content {
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: normal;
}
.gen-msg--assistant .md-content > *:first-child,
.kids-gen-result-content > .md-content.gen-result-content > *:first-child {
  margin-top: 0 !important;
}
.gen-msg--assistant .md-content > *:last-child,
.kids-gen-result-content > .md-content.gen-result-content > *:last-child {
  margin-bottom: 0 !important;
}
.gen-msg--assistant .md-content h1,
.kids-gen-result-content > .md-content.gen-result-content h1 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.65rem 0 0.32rem;
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--text);
}
.gen-msg--assistant .md-content h2,
.kids-gen-result-content > .md-content.gen-result-content h2 {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0.55rem 0 0.28rem;
  line-height: 1.3;
  color: var(--text);
}
.gen-msg--assistant .md-content h3,
.kids-gen-result-content > .md-content.gen-result-content h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0.48rem 0 0.22rem;
  line-height: 1.35;
  color: var(--text);
}
.gen-msg--assistant .md-content p,
.kids-gen-result-content > .md-content.gen-result-content p {
  margin: 0 0 0.42rem;
}
.gen-msg--assistant .md-content ul,
.gen-msg--assistant .md-content ol,
.kids-gen-result-content > .md-content.gen-result-content ul,
.kids-gen-result-content > .md-content.gen-result-content ol {
  margin: 0.35rem 0;
  padding-left: 1.2rem;
}
.gen-msg--assistant .md-content li,
.kids-gen-result-content > .md-content.gen-result-content li {
  margin-bottom: 0.18rem;
}
.gen-msg--assistant .md-content pre,
.kids-gen-result-content > .md-content.gen-result-content pre {
  margin: 0.45rem 0;
  padding: 0.58rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.42;
}
.gen-msg--assistant .md-content pre code,
.kids-gen-result-content > .md-content.gen-result-content pre code {
  font-size: inherit;
  line-height: inherit;
}
.gen-msg--assistant .md-content blockquote,
.kids-gen-result-content > .md-content.gen-result-content blockquote {
  margin: 0.4rem 0;
  padding: 0.42rem 0.62rem;
}
.gen-msg--assistant .md-content strong,
.kids-gen-result-content > .md-content.gen-result-content strong {
  font-weight: 600;
  color: var(--text);
}
[data-theme="light"] .gen-msg--assistant .md-content strong,
[data-theme="light"] .kids-gen-result-content > .md-content.gen-result-content strong {
  color: var(--text-heading);
}
.gen-msg--assistant .md-content .md-figure-img,
.kids-gen-result-content > .md-content.gen-result-content .md-figure-img {
  margin: 0.35rem 0;
}
.gen-msg--assistant .md-content code,
.kids-gen-result-content > .md-content.gen-result-content code {
  font-size: 0.84em;
  padding: 0.08rem 0.32rem;
}
.gen-msg--pending .gen-loading {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(99, 102, 241, .04);
}

.gen-chat-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: .75rem;
}
.gen-thread-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: min(48vh, 480px);
  min-height: min(48dvh, 480px);
  max-height: calc(100vh - var(--header-h) - 240px);
  max-height: calc(100dvh - var(--header-h) - 240px);
  padding: 0;
  overflow: hidden;
}
#result-area.gen-thread-shell {
  --gen-read-zoom: 1;
}
.gen-read-zoom-target {
  zoom: var(--gen-read-zoom);
}
.gen-thread-head {
  position: relative;
  flex-shrink: 0;
  padding: 1rem 2.85rem 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.gen-text-scale-toolbar {
  position: absolute;
  top: 0.5rem;
  right: 0.45rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.gen-text-scale__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.1rem 0.12rem;
  min-width: 20px;
  min-height: 20px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.gen-text-scale__btn:hover:not(:disabled) {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}
.gen-text-scale__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.gen-text-scale__icon {
  display: block;
  flex-shrink: 0;
  width: 11px;
  height: 11px;
}
.ensemble-confirm-list {
  margin: 0 0 0.65rem;
  padding-left: 1.1rem;
  line-height: 1.45;
}
.gen-thread-head.hidden {
  display: none;
}
.gen-thread-head__empty {
  max-width: none;
  width: 100%;
}
.gen-thread-empty-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.gen-thread-empty-title-short {
  display: none;
}
.gen-thread-body {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.35rem;
}
.gen-thread-body .gen-result-placeholder,
.gen-thread-body .gen-loading {
  min-height: 180px;
}
.gen-thread-empty-glyph {
  font-size: 2.25rem;
  line-height: 1;
  opacity: .22;
  font-weight: 300;
}
.gen-composer {
  flex-shrink: 0;
  padding: .75rem 1rem;
}
.gen-composer__row {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
}
.gen-composer__input-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.gen-composer__input-toolbar {
  margin: 0 0 0.28rem;
  min-width: 0;
}
.gen-composer__input-hint-short {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.gen-composer__hint-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.12rem;
  vertical-align: -0.2em;
  color: var(--accent);
  opacity: 0.92;
}
.gen-composer__hint-icon {
  display: block;
  flex-shrink: 0;
}
.gen-composer__input-rate-inline {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  cursor: help;
  white-space: nowrap;
}
.gen-composer__textarea-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.gen-composer__side-buttons {
  display: contents;
}
/* Общая рамка = «поле»: цифра счётчика внутри того же прямоугольника, что и ввод */
.gen-composer__textarea-wrap.gen-composer__input-field {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-input);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.gen-composer__textarea-wrap.gen-composer__input-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.gen-composer__input-field .gen-composer__input {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}
.gen-composer__input-field .gen-composer__input:focus {
  border-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}
.gen-composer__input-field .gen-composer__input {
  border-radius: 13px;
}
.gen-composer__textarea-wrap .gen-composer__input {
  width: 100%;
  box-sizing: border-box;
}
/* Дубликат #char-counter в футере при новом чипе в поле — не показывать второй раз */
.gen-panel[data-panel="text"]:has(.gen-composer__char-chip) .gen-composer__footer #char-counter {
  display: none !important;
}
.gen-composer__char-chip {
  position: absolute !important;
  left: 12px;
  bottom: 1px;
  right: auto !important;
  top: auto !important;
  z-index: 4;
  max-width: auto;
  margin: 0 !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  font-size: 0.65rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.6;
  user-select: none;
}
.gen-composer__cost-chip {
  position: absolute !important;
  left: auto !important;
  bottom: 1px;
  right: 40px;
  top: auto !important;
  z-index: 4;
  margin: 0 !important;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.28rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.35;
  user-select: none;
  display: flex;
  gap: 0.5rem;
}
.gen-composer__input::placeholder {
  font-size: 0.72rem;
  line-height: 1.32;
  color: var(--text-muted);
  opacity: 0.7;
}
.gen-improve-prompt-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform 0.15s ease;
}
.gen-improve-prompt-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent);
  color: #fff;
}
.gen-improve-prompt-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.gen-clear-prompt-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  right: auto;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: none;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  padding: 0;
}
.gen-clear-prompt-btn svg {
  width: 12px;
  height: 12px;
}
.gen-panel[data-panel="text"] .gen-clear-prompt-btn {
  top: 1px;
  left: 1px;
  right: auto;
}
.gen-clear-prompt-btn:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.gen-clear-prompt-btn[hidden] {
  display: none !important;
}
.gen-composer__input {
  /* не flex-grow: иначе высота тянется от контейнера и авто-рост по тексту (JS) не работает */
  flex: 0 0 auto;
  align-self: stretch;
  min-width: 0;
  min-height: 48px;
  box-sizing: border-box;
  /* до 10 строк: lh + вертикальные отступы поля */
  max-height: calc(10lh + 1.75rem);
  resize: none;
  padding: 0.85rem 2.85rem 1.4rem 1rem;
  line-height: 1.45;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: .76rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  overflow-y: hidden;
}
.gen-composer__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}
.btn-voice-input--composer {
  width: 44px;
  min-height: 44px;
  border-radius: 12px;
  margin-bottom: 2px;
}
/* Иконка в композере без голосового API (скрепка — только выбор файла) */
.gen-composer-icon-btn {
  flex-shrink: 0;
  width: 44px;
  min-height: 44px;
  margin-bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform .15s ease;
}
.gen-composer-icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.gen-send-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
}
.gen-send-btn--ensemble {
  background: linear-gradient(135deg, #f59e0b, #c026d3);
}
.gen-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, .35);
}
.gen-send-btn--ensemble:hover:not(:disabled) {
  box-shadow: 0 10px 28px rgba(192, 38, 211, 0.35);
}
.gen-send-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}

/* Десктоп: компактнее микрофон, скрепка, палочка и отправить в рабочей зоне */
@media (min-width: 769px) {
  body.body--gen-workspace .gen-composer__row {
    gap: 0.38rem;
    align-items: flex-end;
  }
  body.body--gen-workspace .btn-voice-input--composer {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 9px;
    margin-bottom: 0;
  }
  body.body--gen-workspace .btn-voice-input--composer svg {
    width: 17px;
    height: 17px;
  }
  body.body--gen-workspace .gen-composer-icon-btn {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 9px;
    border-width: 1px;
    margin-bottom: 0;
  }
  body.body--gen-workspace .gen-composer-icon-btn .gen-attach-btn__visual svg {
    width: 17px;
    height: 17px;
  }
  body.body--gen-workspace .gen-send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
  }
  body.body--gen-workspace .gen-send-btn svg {
    width: 17px;
    height: 17px;
  }
}

.gen-composer__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
  margin-top: .28rem;
  padding: 0 .08rem;
}
.gen-composer__footer-costs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.18rem 0.5rem;
  justify-content: flex-end;
}
.gen-ensemble-cost-hint {
  white-space: nowrap;
}
.gen-composer__meta {
  font-size: .72rem;
  color: var(--text-muted);
}

.gen-composer__chain-hint-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.22rem;
  margin-top: 0.06rem;
  padding: 0 .08rem;
}
.gen-composer__chain-hint-row--dismissed {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.gen-composer__chain-hint {
  display: inline;
  margin: 0;
  padding: 0;
  font-size: 0.6rem;
  line-height: 1.2;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  cursor: help;
  opacity: 0.84;
}
.gen-chain-hint-dismiss {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  min-width: 15px;
  min-height: 15px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  opacity: 0.58;
  -webkit-tap-highlight-color: rgba(99, 102, 241, 0.12);
  transition: color 0.15s, opacity 0.15s, transform 0.1s;
}
.gen-chain-hint-dismiss__glyph {
  display: block;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
}
.gen-chain-hint-dismiss:hover {
  color: var(--accent, #a5b4fc);
  opacity: 1;
}
.gen-chain-hint-dismiss:active {
  transform: scale(0.92);
}
.gen-chain-hint-dismiss:focus-visible {
  outline: 2px solid var(--accent, #6366f1);
  outline-offset: 2px;
}

.gen-free-model-hint {
  margin: 0 0 .5rem;
  padding: .55rem .75rem;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--text-secondary);
  background: rgba(99, 102, 241, .08);
  border: 1px solid rgba(99, 102, 241, .2);
  border-radius: 10px;
}

.gen-thread-free-note {
  margin-top: .5rem;
  color: var(--text-secondary);
  max-width: none;
}

.gen-error-hint {
  max-width: 32rem;
  line-height: 1.45;
}

.gen-attach-btn {
  color: var(--cyan);
}

.gen-attach-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}
.gen-attach-label {
  position: relative;
  overflow: hidden;
}
.gen-attach-btn__visual {
  display: inline-flex;
  pointer-events: none;
}
.gen-attach-file-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.gen-attachment-row {
  margin: 0 0 0.35rem;
}

.gen-attachment-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.28rem;
  max-height: 5.5rem;
  overflow-y: auto;
}

.gen-attachment-progress {
  margin: 0;
  line-height: 1.3;
  font-size: 0.72rem;
}

.gen-attachment-clear-all {
  margin-top: 0.25rem;
  align-self: flex-start;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
}

.gen-attachment-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.45rem;
  border-radius: 8px;
  border: 1px solid rgba(6, 182, 212, .35);
  background: rgba(6, 182, 212, .06);
  max-width: 100%;
  flex: 1 1 auto;
  min-width: min(100%, 9.5rem);
}
.gen-attachment-chip--error {
  border-color: rgba(239, 68, 68, .45);
  background: rgba(239, 68, 68, .06);
}

.gen-attachment-chip__icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  line-height: 1;
}

.gen-attachment-chip__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.4rem;
}

.gen-attachment-chip__name {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.gen-attachment-chip__meta {
  font-size: 0.65rem;
  line-height: 1.25;
  flex: 1 1 auto;
  min-width: 0;
}
.gen-attachment-chip__meta:not(:empty)::before {
  content: '·';
  margin-right: 0.3rem;
  opacity: 0.55;
}

.gen-attachment-chip__x {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color .15s, background .15s;
  padding: 0;
  margin: -2px 0;
}

.gen-attachment-chip__x:hover {
  color: var(--error);
  background: rgba(239, 68, 68, .08);
}

.gen-result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
}
.gen-result-header .gen-result-heading {
  flex: 1;
  padding-right: .5rem;
}
.gen-prompt-with-voice {
  position: relative;
  display: flex;
  gap: .5rem;
  align-items: stretch;
}
.gen-prompt-with-voice .gen-prompt,
.gen-prompt-with-voice .form-textarea {
  flex: 1;
  min-width: 0;
}
.btn-voice-input {
  flex-shrink: 0;
  width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition), transform .15s ease;
}
.btn-voice-input:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-voice-input.is-recording {
  border-color: var(--error);
  color: var(--error);
  background: rgba(239, 68, 68, .08);
  animation: voicePulse 1.2s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .25); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.gen-prompt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .5rem;
  font-size: .82rem;
  color: var(--text-muted);
}
.gen-char-count {
  font-variant-numeric: tabular-nums;
}

.gen-result {
  padding: 1.5rem;
  min-height: 200px;
  position: relative;
}
.gen-result-content {
  line-height: 1.7;
  font-size: .95rem;
  white-space: pre-wrap;
  word-break: break-word;
  width: 100%;
  max-width: none;
}
.gen-result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  color: var(--text-muted);
  text-align: center;
  gap: .75rem;
}
.gen-result-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: .3;
}

.gen-model-info {
  padding: 1rem;
  font-size: .85rem;
}
.gen-model-info h4 {
  font-size: .95rem;
  margin-bottom: .75rem;
}
.gen-model-info .row {
  display: flex;
  justify-content: space-between;
  padding: .3rem 0;
  color: var(--text-secondary);
}
.gen-model-info .row span:last-child {
  color: var(--text);
  font-weight: 500;
}
.gen-model-desc {
  font-style: italic;
  line-height: 1.4;
}
.badge--ru {
  display: inline-block;
  background: #2e7d32;
  color: #fff;
  font-size: .75rem;
  padding: 0.1em 0.5em;
  border-radius: 4px;
  font-weight: 600;
}

button.collapsible-header.gen-model-info-collapsible__toggle {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  padding-left: 0;
  padding-right: 0;
  margin: 0;
  color: inherit;
}
.gen-model-info-collapsible__inner {
  padding-bottom: 0.25rem;
}

.gen-cost {
  font-weight: 600;
  color: var(--cyan);
  font-size: .7rem;
}

.gen-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
}

.gen-neural-spinner {
  width: 48px;
  height: 48px;
  position: relative;
}
.gen-neural-spinner::before,
.gen-neural-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.gen-neural-spinner::before {
  border-top-color: var(--accent);
  border-right-color: var(--purple);
  animation: spin .8s linear infinite;
}
.gen-neural-spinner::after {
  border-bottom-color: var(--cyan);
  border-left-color: var(--pink);
  animation: spin 1.2s linear infinite reverse;
  inset: 6px;
}

/* System prompt collapsible */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: .6rem 0;
  user-select: none;
  transition: color var(--transition);
}
.collapsible-header:hover {
  color: var(--accent-hover);
}
.collapsible-header::after {
  content: '▸';
  font-size: .8rem;
  transition: transform var(--transition);
}
.collapsible-header.open::after {
  transform: rotate(90deg);
}
.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}
.collapsible-body.open {
  max-height: 500px;
}

/* Model selector */
.model-card {
  padding: .65rem .85rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .88rem;
}
.model-card:hover {
  background: rgba(99, 102, 241, .06);
  border-color: var(--border);
}
.model-card.active {
  background: rgba(99, 102, 241, .1);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(99, 102, 241, .1);
}
.model-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}
.model-card-name {
  font-weight: 600;
  color: var(--text);
}
.model-card-price {
  font-size: .75rem;
  color: var(--text-muted);
}

/* Prompt Templates */
.template-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-height: 280px;
  overflow-y: auto;
}
.template-item {
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  border: 1px solid transparent;
}
.template-item:hover {
  background: rgba(99, 102, 241, .06);
  color: var(--text);
  border-color: var(--border);
}
.gen-history-item {
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  cursor: default;
  font-size: .85rem;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

/* Assistant Panel */
.assistant-tip-section .assistant-tip {
  padding: 0.55rem 0.7rem;
  min-height: 0;
  font-size: 0.78rem;
  line-height: 1.45;
}
.assistant-tip {
  padding: .85rem;
  background: rgba(6, 182, 212, .06);
  border: 1px solid rgba(6, 182, 212, .15);
  border-radius: var(--radius);
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  min-height: 60px;
}

/* ── 13. Profile Pages ────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.profile-balance {
  text-align: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
.profile-balance::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(6, 182, 212, .06), transparent 60%);
  pointer-events: none;
}
.profile-balance .amount {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--cyan);
  margin: .5rem 0;
  position: relative;
  text-shadow: 0 0 30px var(--cyan-glow);
}
.profile-balance .currency {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(99, 102, 241, .04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .85rem;
  transition: all var(--transition);
  text-align: center;
}
.quick-action:hover {
  background: rgba(99, 102, 241, .1);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(99, 102, 241, .1);
}
.quick-action-icon { font-size: 1.5rem; }

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.stat-card {
  text-align: center;
  padding: 1.25rem;
}
.stat-card-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: .25rem;
}
.stat-card-label {
  color: var(--text-muted);
  font-size: .82rem;
}

/* ── 14. Pricing Page ─────────────────────────────────────────── */
.pricing-tabs {
  display: flex;
  gap: .25rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: .25rem;
  width: fit-content;
  margin: 0 auto 2rem;
  border: 1px solid var(--border);
}
.pricing-tab {
  padding: .55rem 1.2rem;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: .9rem;
  cursor: pointer;
  transition: all var(--transition);
}
.pricing-tab:hover {
  color: var(--text);
}
.pricing-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}

.price-cheap { color: var(--success); }
.price-medium { color: var(--warning); }
.price-expensive { color: var(--error); }

.pricing-model-table {
  width: 100%;
}
.pricing-model-table th {
  text-align: left;
  padding: .65rem 1rem;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.pricing-model-table td {
  padding: .65rem 1rem;
  font-size: .88rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.pricing-model-table tbody tr {
  transition: background var(--transition);
}
.pricing-model-table tbody tr:hover {
  background: rgba(99, 102, 241, .04);
}

/* ── Tables ────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.table {
  min-width: 600px;
}
.table th,
.table td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.table th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.table td { color: var(--text); }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(99, 102, 241, .03); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Modals ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 0, 20, .7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all .3s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  max-height: min(85vh, calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 2rem));
  max-height: min(85dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 2rem));
  overflow-y: auto;
  transform: translateY(20px) scale(.97);
  transition: transform .3s ease;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, .08);
}
html:not([data-theme="light"]) .modal {
  border-color: rgba(129, 140, 248, 0.38);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(99, 102, 241, 0.12), 0 0 56px rgba(99, 102, 241, 0.14);
}
.modal.modal--assistant {
  padding: 1rem 1.15rem 1.1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 640px, calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.25rem));
  max-height: min(92dvh, 640px, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.25rem));
}
.modal.modal--narrow {
  max-width: 440px;
  padding: 1.25rem 1.35rem 1.35rem;
}
.modal.modal--narrow .modal-header {
  margin-bottom: 0.35rem;
  padding-bottom: 0;
}
.modal.modal--narrow .modal-settings-body {
  padding-top: 0;
}
.modal.modal--assistant .modal-header {
  flex-shrink: 0;
  margin-bottom: 0.35rem;
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-header h3 { margin: 0; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: #fff; }

/* ── Loading / Spinners ───────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.spinner--lg { width: 40px; height: 40px; border-width: 4px; }

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, rgba(99, 102, 241, .06) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Status Dots ──────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, .6);
}
.status-dot--degraded {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, .6);
}
.status-dot--offline {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, .6);
}

/* ── Hero Section (Generic) ───────────────────────────────────── */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
  position: relative;
}
.hero h1 {
  margin-bottom: .75rem;
}
.hero h1 span {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}
.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.mars-3d {
  width: 180px;
  height: 180px;
  margin: 0 auto 2rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #818cf8, #6366f1 40%, #4f46e5 70%, #312e81);
  box-shadow:
    inset -20px -10px 40px rgba(0, 0, 0, .5),
    0 0 60px rgba(99, 102, 241, .3),
    0 0 120px rgba(168, 85, 247, .1);
  animation: marsRotate 20s linear infinite;
  position: relative;
}
.mars-3d::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 25% 40%, rgba(255, 255, 255, .1) 0, transparent 50%),
    radial-gradient(circle at 55% 30%, rgba(168, 85, 247, .25) 0, transparent 30%),
    radial-gradient(circle at 70% 60%, rgba(99, 102, 241, .2) 0, transparent 25%);
}
@keyframes marsRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Features Grid ────────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.feature-card {
  text-align: center;
  padding: 2rem 1.5rem;
}
.feature-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 1.6rem;
}
.feature-icon--indigo { background: rgba(99, 102, 241, .12); color: var(--accent); }
.feature-icon--cyan { background: rgba(6, 182, 212, .12); color: var(--cyan); }
.feature-icon--purple { background: rgba(168, 85, 247, .12); color: var(--purple); }
.feature-icon--pink { background: rgba(236, 72, 153, .12); color: var(--pink); }
.feature-card h3 { margin-bottom: .5rem; font-size: 1.15rem; }
.feature-card p { color: var(--text-secondary); font-size: .92rem; }

/* ── Steps (Generic) ──────────────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  counter-reset: step;
  margin: 2rem 0;
}
.step {
  text-align: center;
  counter-increment: step;
  position: relative;
  padding: 1.5rem 1rem;
}
.step::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto .75rem;
  border-radius: 50%;
  background: var(--gradient-cta);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 0 20px var(--accent-glow);
}
.step h4 { margin-bottom: .35rem; }
.step p { color: var(--text-secondary); font-size: .88rem; }

/* ── Stats ─────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.stat-item {
  text-align: center;
  padding: 1.5rem;
}
.stat-number {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: .25rem;
}
.stat-label {
  color: var(--text-secondary);
  font-size: .9rem;
}

/* ── Section Helpers ──────────────────────────────────────────── */
.section {
  padding: 3rem 0;
}
.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-header h2 { margin-bottom: .5rem; }
.section-header p {
  color: var(--text-secondary);
  max-width: 550px;
  margin: 0 auto;
}

/* ── 15. Footer ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
  margin-top: auto;
  color: var(--text-secondary);
  font-size: .85rem;
  background: linear-gradient(180deg, transparent, rgba(10, 10, 31, .5));
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col h4 {
  font-family: var(--font-heading);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin-bottom: 0.7rem;
}
.footer-col a {
  display: block;
  padding: .2rem 0;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.footer-col a:hover {
  color: var(--accent-hover);
  padding-left: .25rem;
}
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: .75rem;
}
.site-footer__author {
  margin: 0.1rem 0 0;
  padding-top: 0.22rem;
  width: 100%;
  display: flex;
  justify-content: center;
  text-align: center;
}
.site-footer__author-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.38rem 0.12rem;
  line-height: 1.15;
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--accent-hover);
  border-radius: 5px;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.08) 0%, rgba(6, 182, 212, 0.04) 100%);
  border: 1px solid rgba(129, 140, 248, 0.28);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.18) inset,
    0 1px 5px rgba(99, 102, 241, 0.08);
  transition: border-color var(--transition), box-shadow var(--transition), color var(--transition);
}
.site-footer__author-frame:hover {
  border-color: rgba(129, 140, 248, 0.42);
  color: var(--cyan);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.16) inset,
    0 1px 8px rgba(99, 102, 241, 0.12);
}
[data-theme="light"] .site-footer__author-frame {
  background: linear-gradient(145deg, rgba(79, 70, 229, 0.05) 0%, rgba(8, 145, 178, 0.03) 100%);
  border-color: rgba(79, 70, 229, 0.18);
  color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.75) inset,
    0 1px 5px rgba(79, 70, 229, 0.06);
}
[data-theme="light"] .site-footer__author-frame:hover {
  border-color: rgba(79, 70, 229, 0.32);
  color: var(--accent-hover);
}
.footer-social {
  display: flex;
  gap: .75rem;
}
.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.footer-social a:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: translateY(-2px);
}

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  margin-top: 2rem;
}
.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 .5rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  transition: all var(--transition);
}
.pagination a {
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.pagination a:hover {
  background: rgba(99, 102, 241, .1);
  color: #fff;
  border-color: var(--accent);
}
.pagination .active {
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Subscription ─────────────────────────────────────────────── */
.subscription-card {
  padding: 2rem;
}
.sub-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .7rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}
.sub-status--active { background: rgba(16, 185, 129, .15); color: var(--success); }
.sub-status--expired { background: rgba(239, 68, 68, .15); color: var(--error); }
.sub-status--none { background: rgba(100, 116, 139, .15); color: var(--text-secondary); }

/* ── Cost Calculator ──────────────────────────────────────────── */
.calculator {
  padding: 2rem;
}
.calculator .result {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--cyan);
  text-align: center;
  margin-top: 1rem;
  text-shadow: 0 0 20px var(--cyan-glow);
}

/* ── History ──────────────────────────────────────────────────── */
.history-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: rgba(99, 102, 241, .04); }
.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .35rem;
}
.history-item-prompt {
  color: var(--text-secondary);
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item-details {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.history-item.expanded .history-item-details {
  display: block;
}
.history-tag {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* ── Markdown Content ─────────────────────────────────────────── */
.md-content h1,
.md-content h2,
.md-content h3 { margin-top: 1.5rem; margin-bottom: .75rem; }
.md-content p { margin-bottom: .75rem; }
.md-content strong { font-weight: 700; color: #fff; }
.md-content em { font-style: italic; color: var(--text-secondary); }
.md-content code {
  background: var(--bg-elevated);
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .88em;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  border: 1px solid var(--border-light);
}
.md-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}
.md-content pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: .87rem;
  line-height: 1.6;
}
.md-content ul,
.md-content ol {
  margin: .75rem 0;
  padding-left: 1.5rem;
}
.md-content ul { list-style: disc; }
.md-content ol { list-style: decimal; }
.md-content li { margin-bottom: .3rem; color: var(--text-secondary); }
.md-content blockquote {
  border-left: 3px solid var(--accent);
  padding: .75rem 1rem;
  margin: 1rem 0;
  background: rgba(99, 102, 241, .05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.md-content a { color: var(--accent-hover); }

/* ── Tooltip ──────────────────────────────────────────────────── */
.tooltip {
  position: relative;
  display: inline-flex;
  cursor: help;
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: .78rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all .2s ease;
  border: 1px solid var(--border);
  pointer-events: none;
  z-index: 50;
  box-shadow: var(--shadow);
}
.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ── Filter Bar ───────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; }

/* ── Badge ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge--success { background: rgba(16, 185, 129, .15); color: var(--success); }
.badge--warning { background: rgba(245, 158, 11, .15); color: var(--warning); }
.badge--error { background: rgba(239, 68, 68, .15); color: var(--error); }
.badge--info { background: rgba(6, 182, 212, .15); color: var(--cyan); }
.badge--purple { background: rgba(168, 85, 247, .15); color: var(--purple); }
.badge--accent { background: rgba(99, 102, 241, .15); color: var(--accent); }
.badge--pink { background: rgba(236, 72, 153, .15); color: var(--pink); }

/* ── Sidebar Toggle ───────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-toggle:hover {
  border-color: var(--accent);
  color: #fff;
}

/* ── 16. Utility Classes ──────────────────────────────────────── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-accent { color: var(--accent); }
.text-cyan { color: var(--cyan); }
.text-purple { color: var(--purple); }
.text-pink { color: var(--pink); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .78rem; }
.text-lg { font-size: 1.15rem; }

.font-heading { font-family: var(--font-heading); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 2.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 2.5rem; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-0 { padding: 0; }
.p-1 { padding: .5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.hidden { display: none; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-word { word-break: break-word; }
.whitespace-pre { white-space: pre-wrap; }
.relative { position: relative; }
.absolute { position: absolute; }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.opacity-50 { opacity: .5; }
.pointer { cursor: pointer; }
.no-select { user-select: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── 17. Animations ───────────────────────────────────────────── */
.fade-in {
  animation: fadeIn .5s ease-out;
}
.slide-up {
  animation: slideUp .5s ease-out;
}
.slide-down {
  animation: slideDown .4s ease-out;
}
.scale-in {
  animation: scaleIn .35s ease-out;
}
.slide-in-right {
  animation: slideInRight .4s ease-out;
}

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

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 4px 20px var(--accent-glow);
  }
  50% {
    box-shadow: 0 4px 40px rgba(99, 102, 241, .5), 0 0 80px rgba(168, 85, 247, .2);
  }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(99, 102, 241, .2); }
  50% { border-color: rgba(168, 85, 247, .4); }
}

@keyframes revealLine {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-8px) rotate(1deg); }
  66% { transform: translateY(4px) rotate(-1deg); }
}

/* ── 18. Light Theme ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg-deep: #f0f2f8;
  --bg-card: #ffffff;
  --bg-elevated: #f5f6fb;
  --bg-input: #eef0f6;
  --accent: #4f46e5;
  --accent-hover: #6366f1;
  --accent-glow: rgba(79, 70, 229, .12);
  --cyan: #0891b2;
  --cyan-glow: rgba(8, 145, 178, .08);
  --purple: #7c3aed;
  --purple-glow: rgba(124, 58, 237, .08);
  --pink: #db2777;
  --text: #1e1b4b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-heading: #1e1b4b;
  --border: #e2e8f0;
  --border-light: rgba(79, 70, 229, .06);
  --glass-bg: rgba(255, 255, 255, .85);
  --glass-border: rgba(79, 70, 229, .1);
  --gradient-cta: linear-gradient(135deg, #4f46e5, #7c3aed, #db2777);
  --gradient-text: linear-gradient(135deg, #4f46e5, #7c3aed, #db2777);
  --shadow: 0 4px 24px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .08);
  --shadow-glow: 0 4px 20px rgba(79, 70, 229, .06);
}

[data-theme="light"] body::before,
[data-theme="light"] body::after {
  opacity: 0;
}

[data-theme="light"] .site-header {
  background: rgba(240, 242, 248, .85);
}

[data-theme="light"] .logo {
  color: var(--text-heading);
}
[data-theme="light"] .logo-wordmark {
  background: linear-gradient(118deg, #0f172a 0%, #334155 45%, #4f46e5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
[data-theme="light"] .logo-lockup--drawer .logo-wordmark {
  background: none;
  -webkit-text-fill-color: var(--text-heading);
  color: var(--text-heading);
}
[data-theme="light"] .logo-pro-badge {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.35);
  box-shadow: 0 0 12px rgba(13, 148, 136, 0.12);
}

[data-theme="light"] .modal-overlay {
  background: rgba(30, 27, 75, .25);
}

[data-theme="light"] .card {
  box-shadow: 0 2px 12px rgba(0, 0, 0, .04);
}

[data-theme="light"] .card::before {
  background: linear-gradient(135deg, rgba(79, 70, 229, .08), transparent 40%, transparent 60%, rgba(124, 58, 237, .05));
}

[data-theme="light"] .btn--primary {
  box-shadow: 0 4px 16px rgba(79, 70, 229, .2);
}
[data-theme="light"] .btn--primary:hover {
  box-shadow: 0 6px 24px rgba(79, 70, 229, .3);
}

[data-theme="light"] .landing-cta-final::before {
  background: linear-gradient(135deg, rgba(79, 70, 229, .04), rgba(124, 58, 237, .02), rgba(8, 145, 178, .03));
}

[data-theme="light"] .site-footer {
  background: linear-gradient(180deg, transparent, rgba(240, 242, 248, .5));
}

[data-theme="light"] .landing-models-ticker::before {
  background: linear-gradient(90deg, var(--bg-deep), transparent);
}
[data-theme="light"] .landing-models-ticker::after {
  background: linear-gradient(270deg, var(--bg-deep), transparent);
}

[data-theme="light"] ::selection {
  background: var(--accent);
}

[data-theme="light"] .md-content strong {
  color: var(--text-heading);
}

[data-theme="light"] .profile-balance .amount {
  text-shadow: none;
}

/* ── 19. Neural Network Background ────────────────────────────── */
#neural-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .88;
}

body.body--gen-workspace #neural-bg {
  opacity: 1;
}

[data-theme="light"] #neural-bg {
  opacity: .96;
}

[data-theme="light"] body.body--gen-workspace #neural-bg {
  opacity: 1;
}

body.neural-active::before,
body.neural-active::after {
  display: none;
}

/* ── 20. Theme Toggle Button ──────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform .5s cubic-bezier(.4, 0, .2, 1);
  position: absolute;
}
.theme-toggle:hover svg {
  transform: rotate(30deg);
}
.theme-toggle .icon-moon {
  display: none;
}
[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}
[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* ── 21. Enhanced Visual Effects ──────────────────────────────── */

.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: background-color .5s ease, color .5s ease, border-color .5s ease, box-shadow .5s ease, opacity .5s ease !important;
}

@keyframes gradientOrb {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: .6; }
  25% { transform: translate(40px, -30px) scale(1.15); opacity: .8; }
  50% { transform: translate(-30px, 40px) scale(.9); opacity: .5; }
  75% { transform: translate(30px, 20px) scale(1.08); opacity: .7; }
}

@keyframes borderGradientRotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.floating-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: gradientOrb 15s ease-in-out infinite;
  will-change: transform;
}
.floating-orb--1 {
  width: 400px;
  height: 400px;
  background: rgba(99, 102, 241, .1);
  top: -100px;
  right: -80px;
}
.floating-orb--2 {
  width: 350px;
  height: 350px;
  background: rgba(168, 85, 247, .08);
  bottom: -80px;
  left: -60px;
  animation-delay: -5s;
}
.floating-orb--3 {
  width: 250px;
  height: 250px;
  background: rgba(6, 182, 212, .07);
  top: 40%;
  left: 30%;
  animation-delay: -10s;
}

[data-theme="light"] .floating-orb--1 { background: rgba(79, 70, 229, .06); }
[data-theme="light"] .floating-orb--2 { background: rgba(124, 58, 237, .05); }
[data-theme="light"] .floating-orb--3 { background: rgba(8, 145, 178, .04); }

@keyframes nodeGlow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(168, 85, 247, .1); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes electricPulse {
  0% { opacity: 0; transform: translateX(-100%); }
  50% { opacity: 1; }
  100% { opacity: 0; transform: translateX(100%); }
}

.card--glow:hover {
  box-shadow: var(--shadow-lg), 0 0 60px var(--accent-glow);
}

.hover-lift {
  transition: transform var(--transition), box-shadow var(--transition);
}
.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg), 0 0 40px var(--accent-glow);
}

.section-glow {
  position: relative;
  overflow: hidden;
}
.section-glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--purple), var(--cyan), transparent);
  transform: translateX(-50%);
  opacity: .4;
}

/* ── 22. Responsive Design ────────────────────────────────────── */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
  .gen-two-col {
    grid-template-columns: 1fr;
  }
  .gen-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 90;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .gen-sidebar.open {
    transform: translateX(0);
  }
  .gen-sidebar-close { display: inline-flex; }
  #open-settings-sidebar { display: inline-flex; }

  .sidebar-toggle {
    display: inline-flex;
  }

  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .advantages-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps-timeline {
    flex-wrap: wrap;
    gap: 1.5rem;
  }
  .steps-timeline::before {
    display: none;
  }
  .step-item {
    flex: 0 0 calc(50% - .75rem);
    max-width: none;
  }

  .kids-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .comparison-table {
    min-width: 600px;
  }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
  :root {
    --header-h: 42px;
  }

  .site-header {
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  }
  body.site-header-scroll-hidden .site-header {
    transform: translateY(-100%);
    pointer-events: none;
  }

  /* Страница генерации: поле ввода снизу — поднимаем «наверх», чтобы не перекрывать */
  body.body--gen-workspace .scroll-to-top-btn.is-visible {
    bottom: max(5.35rem, calc(env(safe-area-inset-bottom, 0px) + 4.85rem));
  }

  /* Высоты окон: динамический вьюпорт + safe-area (резка, индикатор «домой») */
  .page-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
  }
  .modal-overlay {
    padding: max(1rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px))
      max(1rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
  }
  .modal {
    max-height: min(85vh, calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 2rem));
    max-height: min(85dvh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 2rem));
  }
  .modal.modal--assistant {
    max-height: min(
      90vh,
      calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.25rem)
    );
    max-height: min(
      90dvh,
      calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.25rem)
    );
  }
  .site-nav-drawer {
    top: env(safe-area-inset-top, 0px);
    bottom: env(safe-area-inset-bottom, 0px);
  }
  .gen-history-drawer {
    top: env(safe-area-inset-top, 0px);
    bottom: env(safe-area-inset-bottom, 0px);
  }

  .logo-wordmark {
    font-size: 1.08rem;
  }
  .logo-lockup__tagline {
    font-size: 0.5rem;
    letter-spacing: 0.05em;
  }

  .burger {
    width: 40px;
    height: 40px;
  }
  .site-header__inner .burger {
    order: 10;
    margin-right: 0;
  }
  .site-header__inner .logo-stack {
    margin-right: auto;
  }

  .header-actions {
    gap: .4rem;
  }
  .mode-toggle { font-size: .72rem; }
  .theme-toggle {
    width: 32px;
    height: 32px;
  }
  .theme-toggle svg {
    width: 16px;
    height: 16px;
  }

  .floating-orb { display: none; }

  .landing-hero {
    min-height: auto;
    padding: 4rem 0 3rem;
  }
  .landing-hero-content h1 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }

  .hero { padding: 2rem 0; }
  .mars-3d { width: 120px; height: 120px; }

  .features-grid { grid-template-columns: 1fr; }
  .advantages-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .testimonials-grid { grid-template-columns: 1fr; }

  .steps-timeline {
    flex-direction: column;
    align-items: center;
  }
  .step-item {
    flex: none;
    width: 100%;
    max-width: 300px;
  }

  .kids-layout {
    grid-template-columns: 1fr;
  }
  .kids-features {
    grid-template-columns: 1fr;
  }

  .profile-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { width: 100%; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }

  .auth-card { padding: 1.5rem; }
  .auth-card--compact { padding: 1.25rem; }
  .form-row { flex-direction: column; gap: 0; }

  .landing-stats-bar .container {
    justify-content: flex-start;
    padding: 0 1.25rem;
  }

  .landing-demo {
    margin: 0 1rem 3rem;
  }

  .section-subtitle {
    padding: 0 1rem;
  }

  .section-glow::after {
    display: none;
  }

  .btn {
    min-height: 44px;
  }

  .form-input,
  .form-textarea,
  .form-select {
    min-height: 44px;
    font-size: 16px;
  }

  .gen-type-tabs--inline {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: .2rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .gen-mode-rail {
    width: 50px;
    padding: 0.3rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
  }
  .gen-type-tabs--rail .gen-type-tab--rail {
    padding: 0.5rem 0.1rem;
    gap: 0.25rem;
  }
  .gen-type-tab__glyph svg {
    width: 20px;
    height: 20px;
  }
  .gen-type-tab__label {
    font-size: 0.5rem;
    letter-spacing: 0.12em;
  }
  .gen-chat-bar__left {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }
  .gen-chat-bar__actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .gen-model-trigger {
    max-width: none;
  }
  .gen-thread-shell {
    max-height: none;
    min-height: 38vh;
    min-height: 38dvh;
  }

  body.body--gen-workspace .gen-thread-shell {
    min-height: 0;
  }
  body.body--gen-workspace .gen-chat-icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  /* Моб. генерация: постоянная шапка (логотип, баланс, бургер, тема) + узкий FAB режимов */
  body.body--gen-workspace .header-actions .mode-toggle {
    display: none;
  }

  body.body--gen-workspace .site-header {
    padding: 0.12rem 0 0.14rem;
    min-height: 0;
  }
  body.body--gen-workspace .site-header .container,
  body.body--gen-workspace .site-header__inner {
    gap: 0.35rem;
    min-height: 0;
  }
  body.body--gen-workspace .site-header__inner .burger {
    width: 34px;
    height: 34px;
    margin-right: -13px;
    gap: 4px;
    flex-shrink: 0;
  }
  body.body--gen-workspace .site-header__inner .burger span {
    width: 16px;
  }
  body.body--gen-workspace .site-header__inner .burger.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  body.body--gen-workspace .site-header__inner .burger.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
  body.body--gen-workspace .logo-planet {
    width: 26px;
    height: 26px;
  }
  body.body--gen-workspace .site-header__inner .logo-wordmark {
    font-size: 0.95rem;
  }
  body.body--gen-workspace .logo-lockup__tagline {
    font-size: 0.48rem;
  }
  body.body--gen-workspace .site-header__inner .logo-pro-badge {
    font-size: 0.48rem;
    padding: 0.1em 0.32em 0.08em;
  }
  body.body--gen-workspace .site-header__gen-balance-btn {
    padding: 0.18rem 0.42rem 0.18rem 0.34rem;
    font-size: 0.72rem;
    gap: 0.28rem;
    margin-left: 0;
    max-width: min(42vw, 9.5rem);
  }
  body.body--gen-workspace .site-header__gen-balance-btn .balance-amount-rub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.body--gen-workspace .site-header__gen-balance-btn .icon-wallet-balance {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
  body.body--gen-workspace .header-actions {
    gap: 0.25rem;
    flex-shrink: 0;
  }
  body.body--gen-workspace .theme-toggle {
    width: 30px;
    height: 30px;
  }
  body.body--gen-workspace .theme-toggle svg {
    width: 15px;
    height: 15px;
  }

  /* Узкое «ушко» режимов — компактное на мобиле, меньше перекрывает чат */
  body.body--gen-workspace .gen-mobile-rail-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 116;
    width: 19px;
    min-width: 19px;
    height: 34px;
    margin: 0;
    padding: 0 1px 0 0;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 9px 9px 0;
    background: var(--bg-card);
    color: var(--accent);
    box-shadow: 1px 0 8px rgba(0, 0, 0, 0.09);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      opacity 0.2s ease,
      transform 0.2s ease,
      box-shadow 0.2s ease;
  }
  body.body--gen-workspace .gen-mobile-rail-fab svg {
    width: 12px;
    height: 12px;
  }
  [data-theme='light'] body.body--gen-workspace .gen-mobile-rail-fab {
    box-shadow: 1px 0 8px rgba(15, 23, 42, 0.05);
  }
  body.body--gen-workspace .gen-mobile-rail-fab:active {
    transform: translateY(-50%) scale(0.96);
  }
  body.gen-mobile-rail-open .gen-mobile-rail-fab {
    opacity: 0;
    pointer-events: none;
  }

  /* Оценка справа — только иконка, узкая полоска */
  body.body--gen-workspace .gen-service-rating-tab {
    width: 19px;
    min-height: 0;
    padding: 0.22rem 0.08rem;
    border-radius: 9px 0 0 9px;
    box-shadow: -1px 0 8px rgba(0, 0, 0, 0.09);
  }
  [data-theme='light'] body.body--gen-workspace .gen-service-rating-tab {
    box-shadow: -1px 0 8px rgba(15, 23, 42, 0.05);
  }
  body.body--gen-workspace .gen-service-rating-tab__label {
    display: none;
  }
  body.body--gen-workspace .gen-service-rating-tab__glyph svg {
    width: 12px;
    height: 12px;
  }
  body.body--gen-workspace .gen-service-rating-tab:active {
    transform: translateY(-50%) scale(0.96);
  }

  body.body--gen-workspace .gen-thread-head__hint {
    display: none;
  }

  .gen-mode-rail-backdrop {
    display: none;
  }
  body.body--gen-workspace .gen-mode-rail-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 118;
    background: rgba(15, 23, 42, 0.42);
    -webkit-tap-highlight-color: transparent;
  }
  [data-theme='light'] body.body--gen-workspace .gen-mode-rail-backdrop.is-open {
    background: rgba(15, 23, 42, 0.28);
  }

  body.body--gen-workspace .gen-mode-rail {
    position: fixed;
    left: 0;
    top: calc(env(safe-area-inset-top, 0px) + var(--header-h));
    bottom: env(safe-area-inset-bottom, 0px);
    width: 58px;
    height: auto;
    z-index: 120;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.33, 1, 0.68, 1);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
  }
  body.body--gen-workspace .gen-mode-rail.is-open {
    transform: translateX(0);
  }

  body.body--gen-workspace main > .container.gen-page.gen-chat-ui {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }
  body.body--gen-workspace .gen-workspace-cols {
    gap: 0;
  }
  body.body--gen-workspace .gen-chat-bar {
    align-items: flex-start;
    gap: 0.22rem;
    margin-bottom: 0.2rem;
    padding-bottom: 0.14rem;
    border-bottom: none;
  }
  body.body--gen-workspace .gen-chat-bar__left {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.28rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  body.body--gen-workspace .gen-chat-bar__left::-webkit-scrollbar {
    display: none;
  }
  body.body--gen-workspace .gen-chat-bar__actions {
    gap: 0.15rem;
    flex-wrap: nowrap;
  }
  /* Баланс уже в шапке — сумму в ₽ в этой строке не дублируем */
  body.body--gen-workspace .gen-chat-bar__right .gen-wallet-inline--btn {
    display: none !important;
  }
  body.body--gen-workspace .gen-chat-bar__toggle {
    display: flex;
    position: absolute;
    left: 50%;
    bottom: -15px;
    transform: translateX(-50%);
    width: auto;
    min-width: 80px;
    height: 10px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 10px;
    opacity: 0.85;
    transition: opacity var(--transition), color var(--transition), background var(--transition);
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin: 0;
  }
  body.body--gen-workspace .gen-chat-bar__toggle::after {
    content: "Настройки";
    font-size: 0.5rem;
    margin-left: 6px;
    font-weight: 600;
    letter-spacing: 0.02em;
  }
  body.body--gen-workspace .gen-chat-bar.gen-chat-bar--collapsed {
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0;
    border-bottom-color: transparent;
  }
  body.body--gen-workspace .gen-chat-bar.gen-chat-bar--collapsed .gen-chat-bar__left,
  body.body--gen-workspace .gen-chat-bar.gen-chat-bar--collapsed .gen-chat-bar__right {
    display: none;
  }
  body.body--gen-workspace .gen-model-trigger {
    flex-shrink: 0;
    max-width: min(34vw, 132px);
    padding: 0.22rem 0.38rem 0.22rem 0.36rem;
    gap: 0.2rem;
    min-height: 0;
    line-height: 1.2;
  }
  body.body--gen-workspace .gen-model-trigger__hint {
    display: none;
  }
  body.body--gen-workspace .gen-model-trigger__icon {
    display: none;
  }
  body.body--gen-workspace .gen-model-trigger__chev {
    display: none;
  }
  body.body--gen-workspace .gen-model-trigger__name {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  /* «Новый чат», «История» и др. иконки панели — минимальный размер */
  body.body--gen-workspace .gen-chat-icon-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    border-radius: 7px;
    padding: 0;
  }
  body.body--gen-workspace .gen-chat-icon-btn svg {
    width: 13px;
    height: 13px;
  }
  /* «Мой контекст» — чуть крупнее и заметнее, иначе теряется в горизонтальной прокрутке панели */
  body.body--gen-workspace #open-personalization-modal {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    border-color: rgba(99, 102, 241, 0.5);
    flex-shrink: 0;
  }
  body.body--gen-workspace #open-personalization-modal svg {
    width: 17px !important;
    height: 17px !important;
  }

  /* Компактная «шапка» треда: подпись и блок метаданных */
  body.body--gen-workspace .gen-thread-head {
    padding: 0.14rem 1.9rem 0.14rem 0.32rem;
  }
  body.body--gen-workspace .gen-text-scale-toolbar {
    top: 0.05rem;
    right: 0.1rem;
    padding: 0;
    border-radius: 5px;
  }
  body.body--gen-workspace .gen-text-scale__btn {
    min-width: 24px;
    min-height: 24px;
    padding: 0.07rem 0.09rem;
  }
  body.body--gen-workspace .gen-text-scale__icon {
    width: 12px;
    height: 12px;
  }
  body.body--gen-workspace .gen-result-title {
    font-size: 0.62rem;
    line-height: 1.15;
    margin: 0;
  }
  body.body--gen-workspace .gen-result-summary {
    font-size: 0.52rem;
    line-height: 1.2;
    margin: 0.06rem 0 0;
  }
  body.body--gen-workspace .gen-thread-head__empty .gen-thread-empty-title {
    font-size: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.1;
    color: var(--text-muted);
    margin-bottom: 0.04rem;
  }
  body.body--gen-workspace .gen-thread-head__empty .gen-thread-empty-title-full {
    display: none;
  }
  body.body--gen-workspace .gen-thread-head__empty .gen-thread-empty-title-short {
    display: inline;
  }
  body.body--gen-workspace .gen-thread-free-note {
    font-size: 0.55rem;
    line-height: 1.25;
    margin-top: 0.06rem;
  }

  /* Сама зона переписки — меньше внутренние поля и «пустой» экран; чуть запас от боковых «ушек» */
  body.body--gen-workspace .gen-thread-body {
    padding: 0.38rem calc(0.42rem + 8px)
      calc(0.48rem + min(14rem, 46vh) + env(safe-area-inset-bottom, 0px));
  }
  body.body--gen-workspace .gen-thread-body .gen-result-placeholder,
  body.body--gen-workspace .gen-thread-body .gen-loading {
    min-height: 64px;
  }
  body.body--gen-workspace .gen-thread-body .gen-result-placeholder p {
    font-size: 0.68rem;
    line-height: 1.25;
  }
  body.body--gen-workspace .gen-thread-body .gen-thread-empty-glyph {
    font-size: 1.25rem;
    margin-bottom: 0.15rem;
  }

  body.body--gen-workspace .gen-composer__input-toolbar {
    display: none;
  }
  body.body--gen-workspace .gen-composer {
    position: fixed;
    left: max(0.35rem, env(safe-area-inset-left, 0px));
    right: max(0.35rem, env(safe-area-inset-right, 0px));
    bottom: 0;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0.32rem 0.42rem calc(0.32rem + env(safe-area-inset-bottom, 0px));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  body.body--gen-workspace .gen-composer__row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    column-gap: 0.32rem;
    row-gap: 0;
  }
  body.body--gen-workspace .gen-composer__side-buttons {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.3rem;
    align-self: end;
  }
  body.body--gen-workspace .gen-composer__side-buttons--left {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
  }
  body.body--gen-workspace .gen-composer__input-shell {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    min-width: 0;
  }
  body.body--gen-workspace .gen-composer__side-buttons--right {
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
  }
  body.body--gen-workspace .btn-voice-input--composer,
  body.body--gen-workspace .gen-composer-icon-btn {
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    margin-bottom: 0;
    border-radius: 8px;
    border-width: 1px;
  }
  body.body--gen-workspace .btn-voice-input--composer svg,
  body.body--gen-workspace .gen-composer-icon-btn .gen-attach-btn__visual svg {
    width: 17px;
    height: 17px;
  }
  body.body--gen-workspace .gen-send-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 10px;
  }
  body.body--gen-workspace .gen-send-btn svg {
    width: 18px;
    height: 18px;
  }
  body.body--gen-workspace .gen-composer__textarea-wrap.gen-composer__input-field {
    border-radius: 12px;
  }
  body.body--gen-workspace .gen-composer__input {
    min-height: 48px;
    max-height: calc(18lh + 1.5rem);
    padding: 0.55rem 2.7rem 1.25rem 0.6rem;
    font-size: 13px;
    line-height: 1.45;
    border-radius: 12px;
  }
  body.body--gen-workspace .gen-composer--input-expanded .gen-composer__input {
    min-height: 140px;
    max-height: calc(26lh + 2.25rem);
    padding: 0.1rem 0.3rem 17.0rem 0.3rem;
  }
  body.body--gen-workspace .gen-composer__textarea-wrap.gen-composer__input-field .gen-composer__input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 11px !important;
  }
  body.body--gen-workspace .gen-improve-prompt-btn {
    width: 22px;
    height: 22px;
    top: 2px;
    right: 2px;
    border-radius: 7px;
	margin: -10px;
  }
  .gen-panel[data-panel="text"] .gen-clear-prompt-btn {
	  top: -3px;
	  left: -3px;
  }
  body.body--gen-workspace .gen-improve-prompt-btn svg {
    width: 14px;
    height: 14px;
  }
  body.body--gen-workspace .gen-composer__footer {
    margin-top: 0.14rem;
  }
  body.body--gen-workspace .gen-composer__meta {
    font-size: 0.5rem;
  }
  body.body--gen-workspace .gen-composer__chain-hint-row {
    margin-top: 0.02rem;
    padding: 0 .02rem;
    gap: 0.16rem;
    z-index: 12;
  }
  body.body--gen-workspace .gen-composer__chain-hint {
    font-size: 0.52rem;
    line-height: 1.18;
    margin: 0;
    opacity: 0.88;
  }
  body.body--gen-workspace .gen-chain-hint-dismiss {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
  }
  body.body--gen-workspace .gen-chain-hint-dismiss__glyph {
    font-size: 0.94rem;
  }
  body.body--gen-workspace .gen-composer__char-chip {
    left: 10px;
    bottom: 1px;
    right: auto;
    max-width: auto;
    padding: 0;
    font-size: 0.5rem;
    opacity: 0.6;
  }
  body.body--gen-workspace .gen-composer__cost-chip {
    left: auto;
    bottom: 1px;
    right: 25px;
    padding: 0;
    font-size: 0.34rem;
    opacity: 0.35;
  }
  body.body--gen-workspace .gen-composer__input::placeholder {
    font-size: 0.6rem;
    line-height: 1.3;
    opacity: 0.68;
  }

  body.body--gen-workspace .gen-thread-shell {
    z-index: 1;
  }
  body.body--gen-workspace .gen-composer {
    z-index: 4;
  }
}

@media (min-width: 769px) {
  body.body--gen-workspace .gen-mode-rail-backdrop {
    display: none !important;
  }
  body.body--gen-workspace .gen-mode-rail.is-open {
    transform: none;
  }
  body.body--gen-workspace .gen-mobile-rail-fab {
    display: none !important;
  }
}

/* Small mobile: < 480px */
@media (max-width: 480px) {
  .site-nav-drawer {
    width: 100%;
    max-width: 100%;
  }
  .site-header__inner {
    gap: 0.45rem;
  }
  .site-header__inner .logo-wordmark {
    font-size: 1.02rem;
  }
  .site-header__inner .logo-planet {
    width: 28px;
    height: 28px;
  }
  .site-header__inner .logo-pro-badge {
    font-size: 0.52rem;
    padding: 0.12em 0.36em 0.1em;
  }
  .steps { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.75rem; }
  .hero-subtitle { font-size: 1rem; }
  .pricing-price { font-size: 1.8rem; }
  .quick-actions { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: center; }
  .hero-cta .btn { width: 100%; }

  .landing-hero .hero-bg-orb {
    display: none;
  }

  .trust-badges {
    flex-direction: column;
    gap: .5rem;
  }

  .balance-badge {
    padding: .25rem .5rem;
    font-size: .75rem;
  }

  .mode-toggle {
    display: none;
  }
}

/* ── Onboarding Tutorial ──────────────────────────────────────── */
.gt-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(3, 0, 20, 0.52);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: auto;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.gt-overlay--visible {
  opacity: 1;
}
.gt-overlay--hiding {
  opacity: 0;
  pointer-events: none;
}
.gt-overlay--solid {
  background: rgba(3, 0, 20, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.gt-overlay--spotlight {
  --gt-spot-x: 0px;
  --gt-spot-y: 0px;
  --gt-spot-w: 0px;
  --gt-spot-h: 0px;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.gt-overlay--spotlight::after {
  content: '';
  position: absolute;
  left: var(--gt-spot-x);
  top: var(--gt-spot-y);
  width: var(--gt-spot-w);
  height: var(--gt-spot-h);
  border-radius: var(--radius);
  box-shadow: 0 0 0 9999px rgba(3, 0, 20, 0.48), 0 0 30px 8px rgba(99, 102, 241, 0.25), inset 0 0 0 2px rgba(129, 140, 248, 0.35);
  pointer-events: none;
  transition: left .35s ease, top .35s ease, width .35s ease, height .35s ease;
}

.gt-card {
  position: fixed;
  z-index: 100001;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.12);
  padding: 1.25rem 1.5rem 1.15rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .3s ease, transform .3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  overscroll-behavior: contain;
}
.gt-card::-webkit-scrollbar {
  width: 5px;
}
.gt-card::-webkit-scrollbar-track {
  background: transparent;
}
.gt-card::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.gt-card--visible {
  opacity: 1;
  transform: none;
}
.gt-card--hiding {
  opacity: 0;
  transform: translateY(12px) !important;
  pointer-events: none;
}

.gt-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.gt-card__step-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  background: rgba(99, 102, 241, 0.12);
  padding: 0.2em 0.65em;
  border-radius: 100px;
}
.gt-card__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
  transition: color .2s;
}
.gt-card__close:hover {
  color: var(--text);
}

.gt-card__title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.55rem;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gt-card__text {
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}
.gt-card__text b {
  color: var(--text);
  font-weight: 600;
}
.gt-card__text i {
  color: var(--text-secondary);
  font-style: italic;
}

.gt-card__progress {
  height: 3px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 2px;
  margin-bottom: 0.85rem;
  overflow: hidden;
}
.gt-card__progress-bar {
  height: 100%;
  background: var(--gradient-cta);
  border-radius: 2px;
  transition: width .35s ease;
}

.gt-card__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.gt-card__nav-main {
  display: flex;
  gap: 0.5rem;
}

.gt-btn {
  padding: 0.42rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  white-space: nowrap;
}
.gt-btn--primary {
  background: var(--gradient-cta);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}
.gt-btn--primary:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
  filter: brightness(1.1);
}
.gt-btn--secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.gt-btn--secondary:hover {
  color: var(--text);
  border-color: var(--border);
}
.gt-btn--ghost {
  background: transparent;
  color: var(--text-muted);
}
.gt-btn--ghost:hover {
  color: var(--text-secondary);
}

.gt-arrow {
  position: fixed;
  z-index: 100002;
  width: 16px;
  height: 8px;
  display: none;
  pointer-events: none;
  transition: top .25s ease, left .25s ease;
}
.gt-arrow--up::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--bg-elevated);
  filter: drop-shadow(0 -2px 3px rgba(99, 102, 241, 0.25));
}
.gt-arrow--down::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--bg-elevated);
  filter: drop-shadow(0 2px 3px rgba(99, 102, 241, 0.25));
}
.gt-arrow--left::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid var(--bg-elevated);
  filter: drop-shadow(-2px 0 3px rgba(99, 102, 241, 0.25));
}
.gt-arrow--right::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid var(--bg-elevated);
  filter: drop-shadow(2px 0 3px rgba(99, 102, 241, 0.25));
}

body.gt-active {
  overflow: hidden;
}

@keyframes tutorialBadgePulse {
  0%, 100% { opacity: 1; transform: scale(1); text-shadow: 0 0 6px rgba(250, 204, 21, .8), 0 0 2px rgba(0,0,0,.6); }
  50% { opacity: .55; transform: scale(1.18); text-shadow: 0 0 14px rgba(250, 204, 21, 1), 0 0 2px rgba(0,0,0,.6); }
}

@media (max-width: 768px) {
  .gt-card {
    width: calc(100vw - 20px);
    max-height: 55vh;
    padding: 1rem 1.1rem 0.95rem;
  }
  .gt-card__text {
    font-size: 0.82rem;
    line-height: 1.55;
  }
}
@media (max-width: 520px) {
  .gt-card {
    width: calc(100vw - 16px);
    max-height: 50vh;
    padding: 0.85rem 0.9rem 0.8rem;
  }
  .gt-card__title {
    font-size: 0.95rem;
  }
  .gt-card__text {
    font-size: 0.78rem;
    line-height: 1.5;
  }
  .gt-btn {
    padding: 0.38rem 0.72rem;
    font-size: 0.78rem;
  }
  .gt-card__nav {
    flex-wrap: wrap;
  }
  .gt-card__header {
    margin-bottom: 0.45rem;
  }
  .gt-card__progress {
    margin-bottom: 0.55rem;
  }
}
@media (max-height: 600px) {
  .gt-card {
    max-height: 48vh;
  }
}

/* ── Media generation panels ──────────────────────────────────── */

.gen-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.gen-panel[hidden] {
  display: none !important;
}

.gen-media-panel-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Image panel: mode switcher always visible under title (not buried in scrollable composer) */
.gen-image-bar-head {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  max-width: min(100%, 28rem);
}

.img-mode-tabs {
  display: flex;
  width: 100%;
  gap: 0;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.35);
}

.img-mode-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  line-height: 1.2;
}

.img-mode-tab:hover:not(.is-active) {
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-primary);
}

.img-mode-tab.is-active {
  background: var(--accent, #6366f1);
  color: #fff;
}

.img-mode-tab svg {
  flex-shrink: 0;
  opacity: 0.95;
}

.gen-media-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  gap: 0;
}

.gen-media-result {
  flex: 1;
  min-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border-bottom: none;
}

.gen-media-result__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  text-align: center;
  opacity: .7;
}

.gen-media-result__content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gen-media-composer {
  flex-shrink: 0;
  border-radius: 0;
}

.gen-media-composer__form {
  padding: 0.75rem 1rem;
}

.gen-media-composer__row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  position: relative;
}

.gen-media-composer__row-pair {
  display: flex;
  gap: 0.75rem;
}

.gen-media-composer__input {
  flex: 1;
  resize: vertical;
  min-height: 48px;
  padding-bottom: 1.4rem;
}

.gen-media-composer__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.35rem;
}

/* Image result cards */
.gen-media-image-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(15, 23, 42, 0.3);
}

.gen-media-image-card__img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.15);
}

.gen-media-image-card__meta {
  padding: 0.5rem 0.75rem;
}

.gen-media-image-card__actions {
  padding: 0 0.75rem 0.5rem;
}

/* Audio result cards */
.gen-media-audio-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.3);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gen-media-audio-card__player {
  width: 100%;
  border-radius: var(--radius);
}

.gen-media-audio-card__meta {
  font-size: 0.8rem;
}

.gen-media-audio-card__actions {
  display: flex;
  gap: 0.5rem;
}

/* Error messages */
.gen-media-error {
  color: var(--error, #ef4444);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
}

/* Code model picker */
.code-model-list {
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.code-model-item {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.12s;
}

.code-model-item:hover {
  background: rgba(99, 102, 241, 0.12);
}

.code-model-item.active {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.code-model-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
  width: fit-content;
}

/* Code panel thread messages */
.gen-thread-message {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.gen-thread-message--user {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.gen-thread-message--assistant {
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--border);
}

.gen-thread-message__role {
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
  opacity: 0.7;
}

.gen-thread-message__body {
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}

.gen-thread-message__meta {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  opacity: 0.6;
}

/* Code blocks in results */
.gen-code-block {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0.5rem 0;
}

.gen-code-inline {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
}

/* Model description text under selectors */
.gen-model-desc {
  min-height: 1.2em;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* History cost warning badge */
.gen-code-history-warn {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  white-space: nowrap;
  animation: gen-warn-pulse 2.5s ease-in-out infinite;
}

@keyframes gen-warn-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── Code panel workspace (Cursor-like layout) ──────────────────── */

.gen-code-workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.gen-code-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Sidebar files panel */
.gen-code-files-panel {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gen-code-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.gen-code-files-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
  font-size: 0.8rem;
}

.gen-code-files-tree .tree-dir {
  padding: 0.2rem 0.75rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gen-code-files-tree .tree-file {
  display: block;
  padding: 0.25rem 0.75rem 0.25rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  border-radius: 0;
  font-family: var(--ff-mono, monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s;
}

.gen-code-files-tree .tree-file:hover {
  background: rgba(99, 102, 241, 0.1);
}

.gen-code-files-tree .tree-file.active {
  background: rgba(99, 102, 241, 0.18);
}

/* ── Code block wrappers (used in code responses) ──────────────── */

.gen-code-block-wrap {
  margin: 0.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  overflow: hidden;
}

.gen-code-block__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
}

.gen-code-block__filepath {
  flex: 1;
  font-family: var(--ff-mono, monospace);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.gen-code-block__lang-badge {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent, #6366f1);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.gen-code-block__actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.gen-code-block__btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}

.gen-code-block__btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.gen-code-block-wrap .gen-code-block {
  border: none;
  border-radius: 0;
  margin: 0;
}

/* ── Inline file panel in assistant messages ────────────────────── */

.gen-file-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.gen-file-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.gen-file-panel__list {
  padding: 0.25rem 0;
}

.gen-file-panel__dir {
  padding: 0.2rem 0.75rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.gen-file-panel__file {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem 0.3rem 1.25rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--ff-mono, monospace);
  transition: background 0.1s;
}

.gen-file-panel__file:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* ── Code settings modal enhancements ──────────────────────────── */

#code-settings-modal .model-picker {
  position: relative;
}

#code-settings-modal .form-select--model {
  max-height: 200px;
}

#code-settings-modal .gen-model-info .row {
  padding: 0.25rem 0;
  font-size: 0.82rem;
}

/* ── Toast notification ────────────────────────────────────────── */

.gen-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated, #1e293b);
  color: var(--text, #fff);
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.gen-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive adjustments for media + code ───────────────────── */

@media (max-width: 640px) {
  .gen-media-composer__row-pair {
    flex-direction: column;
    gap: 0;
  }
  .gen-media-image-card__img {
    max-height: 300px;
  }
  .gen-code-files-panel {
    display: none;
  }
  .gen-code-workspace {
    flex-direction: column;
  }
  .gen-code-block__header {
    flex-wrap: wrap;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .gen-code-files-panel {
    width: 180px;
  }
}

/* ── Privacy widget: стили в views/generate.php (инлайн <style>) — страница /generate ── */

/* ── Profile local-storage info card ──────────────────────────── */

.profile-local-storage-note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius, 8px);
  margin-bottom: 1rem;
}

.profile-local-storage-note__icon {
  flex-shrink: 0;
  color: var(--accent, #6366f1);
  opacity: 0.7;
  margin-top: 0.1rem;
}

.profile-local-storage-note__text {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary, #8888a0);
  margin: 0;
}

.profile-local-storage-note__text strong {
  color: var(--text, #e2e8f0);
}


/* ── Print ─────────────────────────────────────────────────────── */
@media print {
  body::before, body::after { display: none; }
  #neural-bg { display: none; }
  .site-header, .site-footer, .flash-messages { display: none; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; background: #fff; backdrop-filter: none; }
  .card::before { display: none; }
  .gradient-text, .text-gradient {
    -webkit-text-fill-color: currentColor;
    background: none;
  }
  .floating-orb { display: none; }
}

/* ── Prefers Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  #neural-bg,
  #hero-canvas,
  #kids-bg { display: none; }
  body.neural-active::before,
  body.neural-active::after { display: block; }
  .floating-orb,
  .landing--float-particle,
  .landing--glow-line { display: none; }
  .landing--ticker-track { animation: none; }
}
