/* ═══════════════════════════════════════════
   AI CREATOR — Global Styles
   Palette: white #ffffff, ink #1a1a1a
   Fonts: Playfair Display (brand headings), Inter (UI + bot text)
   ═══════════════════════════════════════════ */

:root {
  --bg: #ffffff;
  --sidebar-bg: #f7f7f8;
  --hover: #f5f5f5;
  --active: #ebebeb;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #757575;
  --danger: #bf3b3b;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --sidebar-w: 280px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #root { height: 100%; height: 100dvh; overflow: hidden; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
::selection { background: rgba(26,26,26,.08); }
button, input, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ═══ LAYOUT ═══ */
.app { display: flex; height: 100vh; }


/* ═══ COOKIE BANNER ═══ */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  max-width: 340px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  animation: cookieBannerIn 0.35s ease-out;
}
@keyframes cookieBannerIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.cookie-banner-text {
  margin: 0 0 12px;
}
.cookie-banner-link {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.12s;
}
.cookie-banner-link:hover { color: #229ED9; }
.cookie-banner-accept {
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, transform 0.12s;
}
.cookie-banner-accept:hover { background: #000; }
.cookie-banner-accept:active { transform: translateY(1px); }
@media (max-width: 540px) {
  .cookie-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
    margin: 0;
    padding: 16px 18px 16px;
  }
  .cookie-banner-text { margin-bottom: 14px; }
  .cookie-banner-accept {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: 10px;
  }
}

/* ═══ ANIMATIONS ═══ */
.fade-in {
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes popup-in {
  from { opacity: 0; transform: scale(0.95) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sheet-up {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}


/* ═══════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 88px;          /* ниже кнопок лайтбокса (закрыть/скачать), ~1.5 высоты кнопки от верха */
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  max-width: 320px;
  transition: opacity 0.2s;
}
.toast:hover { opacity: 0.85; }
.toast-type-icon { display: flex; flex-shrink: 0; color: var(--muted); }
.toast-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.toast-title { font-size: 13px; color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-subtitle { font-size: 12px; color: var(--muted); font-weight: 400; }
.toast-arrow { font-size: 13px; color: var(--muted); margin-left: auto; flex-shrink: 0; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@media (max-width: 768px) {
  .toast-container { top: 64px; right: 8px; left: 8px; }
  .toast { max-width: 100%; }
}

/* Accessibility: respect reduced motion preference for CSS animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* RefAlbum — альбом референсов в отправленном сообщении (shared/components/RefAlbum.js,
   используется в image и video). Ряды + ширины по аспекту (flex-grow) → без обрезки и пустот. */
.ref-album {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 380px;
  max-width: 100%;
  margin-bottom: 8px;
}
/* 3+ рефов — компактнее: уже альбом → мельче плитки, меньше места в чате */
.ref-album-compact { width: 300px; }
.ref-row {
  display: flex;
  gap: 3px;
}
.ref-img {
  flex: 1 1 0;            /* ширину внутри ряда задаёт inline flex-grow ∝ аспект */
  min-width: 0;
  object-fit: cover;     /* страховка от субпиксельных зазоров (бокс уже = аспекту) */
  border-radius: 8px;
  display: block;
  cursor: pointer;
}
/* Одиночная картинка — целиком, по своему аспекту, без растягивания на всю ширину. */
.ref-album-single { display: block; width: auto; }
.ref-album-single .ref-img {
  flex: none;
  width: auto;
  max-width: 280px;
  max-height: 320px;
}

/* ═══ LOGIN SCREEN ═══ */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  min-height: 100vh;
  background: var(--bg);
  overflow: visible;
}
.login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 300px;
}
.login-logo {
  margin-bottom: 4px;
}
.login-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 8px;
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}
.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.login-input:focus {
  border-color: var(--ink);
}
.login-btn {
  width: 100%;
  padding: 10px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 4px;
}
.login-btn:hover:not(:disabled) {
  opacity: 0.85;
}
.login-btn:disabled {
  opacity: 0.4;
  cursor: default;
}


/* ═══ PROFILE POPUP ═══ */
.profile-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--sb-border);
  border-radius: 12px;
  padding: 8px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 200;
}
.profile-popup-email {
  padding: 10px 16px 8px;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-popup-sep {
  height: 1px;
  background: var(--sb-border);
  margin: 4px 0;
}
.profile-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.profile-popup-item:hover {
  background: var(--sb-hover);
}
.profile-popup-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.profile-popup-logout {
  color: #e53e3e;
}
.profile-popup-logout:hover {
  background: rgba(229,62,62,0.08);
}


/* ═══ DOCS PAGE ═══ */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}
.docs-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s;
}
.docs-item:hover {
  background: var(--sb-hover);
}
.docs-item-title {
  font-size: 15px;
}
.docs-item svg {
  color: var(--muted);
  flex-shrink: 0;
}

/* ═══ LOGIN TOGGLE ═══ */
.login-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s;
  padding: 0;
}
.login-toggle:hover {
  color: var(--ink);
}


/* ═══ VERIFY EMAIL SCREEN ═══ */
.verify-info {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  margin: 0 0 8px;
}
.verify-info strong {
  color: var(--ink);
  font-weight: 500;
}
.verify-success {
  font-size: 13px;
  color: #2e7d32;
  text-align: center;
  padding: 6px 10px;
}
.verify-code-input {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 28px;
  text-align: center;
  letter-spacing: 12px;
  font-weight: 500;
  outline: none;
  font-family: var(--font-mono, 'SF Mono', Menlo, monospace);
  transition: border-color 0.15s;
}
.verify-code-input:focus {
  border-color: var(--ink);
}
.verify-code-input::placeholder {
  letter-spacing: 8px;
  color: var(--border);
}
.verify-resend-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px;
  transition: color 0.15s;
}
.verify-resend-btn:hover:not(:disabled) {
  color: var(--ink);
}
.verify-resend-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.verify-change-email {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}
.verify-logout {
  margin-top: 12px;
  opacity: 0.6;
}


/* ═══ PROFILE PAGE ═══ */
.profile-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 48px 48px 80px;
}
.settings-layout {
  width: 100%;
  max-width: 880px;
}
.profile-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 24px;
  transition: color 0.15s, background 0.15s;
}
.profile-back:hover {
  color: var(--ink);
  background: rgba(0,0,0,0.04);
}
.profile-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 32px;
}

/* Settings two-column layout */
.settings-body {
  display: flex;
  gap: 0;
  align-items: flex-start;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 220px;
  flex-shrink: 0;
  padding-right: 8px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
  text-align: left;
}
.settings-nav-item:hover {
  color: var(--ink);
}
.settings-nav-item.active {
  background: var(--hover);
  color: var(--ink);
}
.settings-nav-chevron {
  display: none;
}
.settings-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border-light);
  flex-shrink: 0;
}
.settings-content {
  flex: 1;
  min-width: 0;
  padding-left: 40px;
  max-width: 560px;
}
.settings-content-mobile {
  display: none;
}
.settings-back-mobile,
.settings-title-mobile {
  display: none;
}

/* Settings cards */
.s-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.s-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
}
.s-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  min-height: 48px;
}
.s-card-row-last {
  border-bottom: none;
}
.s-card-row-action {
  cursor: pointer;
  transition: background 0.12s;
}
.s-card-row-action:hover {
  background: var(--hover);
}
.s-card-label {
  font-size: 14px;
  color: var(--ink);
}
.s-card-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.s-card-value {
  font-size: 14px;
  color: var(--muted);
}
.s-card-action {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.s-card-action:hover {
  color: var(--ink);
}
.s-card-pw-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px;
}
.s-status-active {
  color: #22c55e;
  font-weight: 500;
}
.s-status-canceled {
  color: var(--danger);
  font-weight: 500;
}
.s-danger-btn {
  align-self: flex-start;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.s-danger-btn:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}
.profile-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.profile-input:focus {
  border-color: var(--ink);
}
.profile-password-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}
.profile-save-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.profile-save-btn:hover:not(:disabled) {
  opacity: 0.85;
}
.profile-save-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.profile-cancel-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.profile-cancel-link:hover {
  color: var(--ink);
}
.profile-email-edit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-input-inline {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  outline: none;
  width: 180px;
  transition: border-color 0.15s;
}
.profile-input-inline:focus {
  border-color: var(--ink);
}
.profile-inline-ok {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.profile-inline-ok:hover:not(:disabled) {
  opacity: 0.85;
}
.profile-inline-cancel {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.profile-inline-cancel:hover {
  color: var(--ink);
}
.profile-edit-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  text-decoration: underline;
  transition: color 0.15s;
}
.profile-edit-btn:hover {
  color: var(--ink);
}
.profile-action-btn {
  align-self: flex-start;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.profile-action-btn:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.profile-form-error {
  font-size: 13px;
  color: var(--danger);
}
.profile-form-success {
  font-size: 13px;
  color: #22c55e;
}

/* ═══ LEGAL PAGE ═══ */
.legal-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px;
}
.legal-container {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
}
.legal-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 20px;
}
.legal-text {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
}
.legal-markdown h1, .legal-markdown h2, .legal-markdown h3 {
  color: var(--ink);
  margin: 24px 0 10px;
  font-weight: 600;
}
.legal-markdown h1 { font-size: 22px; margin-top: 0; }
.legal-markdown h2 { font-size: 18px; }
.legal-markdown h3 { font-size: 16px; }
.legal-markdown p { margin: 0 0 12px; }
.legal-markdown ul, .legal-markdown ol { padding-left: 22px; margin: 0 0 12px; }
.legal-markdown li { margin: 4px 0; }
.legal-markdown blockquote {
  border-left: 3px solid var(--border);
  padding: 4px 14px;
  margin: 0 0 12px;
  color: var(--muted);
  font-style: italic;
}
.legal-markdown strong { color: var(--ink); font-weight: 600; }
.legal-markdown em { font-style: italic; }


/* ═══ LANDING PAGE ═══ */
.lp-page {
  /* body имеет overflow:hidden — лендинг должен скроллиться внутри себя */
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-overflow-scrolling: touch;
}
.lp-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero */
.lp-hero {
  position: relative;
  padding: 120px 0 100px;
  text-align: center;
  overflow: hidden;
}
.lp-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 30% 20%, rgba(255, 200, 150, 0.22), transparent 60%),
    radial-gradient(ellipse 50% 40% at 75% 30%, rgba(180, 200, 255, 0.20), transparent 60%),
    radial-gradient(ellipse 70% 60% at 50% 80%, rgba(220, 180, 255, 0.16), transparent 60%);
  filter: blur(30px);
  z-index: 0;
}
.lp-hero .lp-container { position: relative; z-index: 1; }
.lp-hero-title {
  font-family: var(--font-heading);
  font-size: 64px;
  font-weight: 400;
  line-height: 1.08;
  margin: 0 0 24px;
  color: var(--ink);
  letter-spacing: -1px;
}
.lp-hero-subtitle {
  font-size: 19px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 auto 40px;
  max-width: 560px;
}

/* CTA-кнопка */
.lp-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #229ED9;
  color: #fff;
  padding: 14px 26px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.lp-cta:hover { background: #1c8bc1; }
.lp-cta:active { transform: translateY(1px); }

/* Feature-блоки (чередующиеся) */
.lp-feature-block {
  padding: 90px 0;
  border-top: 1px solid var(--border-light);
}
.lp-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}
.lp-feature-block.lp-reverse .lp-feature-content { order: 2; }
.lp-feature-block.lp-reverse .lp-feature-visual-wrap { order: 1; }

.lp-feature-h {
  font-family: var(--font-heading);
  font-size: 38px;
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 20px;
  color: var(--ink);
  letter-spacing: -0.5px;
}
.lp-feature-desc {
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 460px;
}
.lp-feature-desc strong {
  color: var(--ink);
  font-weight: 600;
}
/* Чек-листы — две колонки */
.lp-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  column-count: 2;
  column-gap: 28px;
}
.lp-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--ink);
  break-inside: avoid;
  margin-bottom: 12px;
}
.lp-checklist li:last-child { margin-bottom: 0; }
.lp-checklist li svg {
  color: var(--ink);
  flex-shrink: 0;
  margin-top: 3px;
}

/* Декоративные визуалы */
.lp-feature-visual-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 320px;
}
.lp-visual {
  position: relative;
  width: 100%;
  max-width: 420px;
}

/* Чат-визуал — пузыри */
.lp-visual-chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 4px;
}
.lp-bubble {
  border-radius: 18px;
  padding: 14px 18px;
  max-width: 88%;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lp-bubble-user {
  background: #f3f3f3;
  color: var(--ink);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  min-width: 50%;
}
.lp-bubble-bot {
  background: #f3f3f3;
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  min-width: 75%;
}
.lp-bubble-line {
  display: block;
  height: 9px;
  border-radius: 4px;
  background: #d8d8d8;
}
/* Картинки-визуал — наложенные карточки */
.lp-visual-images {
  height: 320px;
  display: block;
}
.lp-img-card {
  position: absolute;
  width: 180px;
  height: 220px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.10);
  overflow: hidden;
}
.lp-img-card-1 {
  left: 0;
  top: 30px;
  transform: rotate(-7deg);
  background: linear-gradient(135deg, #ffcfb5 0%, #ff8b6b 100%);
}
.lp-img-card-2 {
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #c4d5ff 0%, #6e8cd6 100%);
  z-index: 2;
}
.lp-img-card-3 {
  right: 0;
  top: 50px;
  transform: rotate(7deg);
  background: linear-gradient(135deg, #e0c4ff 0%, #a474d6 100%);
}
.lp-img-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Видео-визуал — стилизованный плеер */
.lp-visual-video {
  max-width: 380px;
}
.lp-player {
  background: var(--ink);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}
.lp-player-screen {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  background:
    radial-gradient(ellipse 60% 60% at 30% 30%, rgba(255, 180, 140, 0.5), transparent 60%),
    radial-gradient(ellipse 70% 60% at 70% 70%, rgba(140, 170, 255, 0.5), transparent 60%),
    linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lp-player-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  padding-left: 4px;
}
.lp-player-bar {
  margin-top: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}
.lp-player-progress {
  width: 38%;
  height: 100%;
  background: #fff;
}

/* Mid CTA */
.lp-mid-cta {
  padding: 20px 0 80px;
  text-align: center;
}

/* Footer — тёмная тема */
.lp-footer {
  padding: 56px 0 28px;
  background: #0f0f0f;
  color: #b8b8b8;
}
.lp-footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding-top: 16px;
  padding-bottom: 32px;
}
.lp-footer-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #777;
  margin-bottom: 14px;
}
.lp-footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lp-footer-text {
  font-size: 13px;
  line-height: 1.6;
  color: #d0d0d0;
  margin: 0;
}
.lp-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: #d0d0d0;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.12s;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.lp-link:hover { color: #fff; }
.lp-link-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.lp-link-icon svg { color: #888; flex-shrink: 0; }
.lp-link-icon:hover svg { color: #fff; }
.lp-footer-disclaimer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
  padding-bottom: 8px;
  font-size: 12px;
  color: #777;
  line-height: 1.55;
  max-width: 460px;
  text-align: center;
}
.lp-footer-disclaimer p {
  margin: 0 0 10px;
}
.lp-footer-disclaimer p:last-child { margin-bottom: 0; }

/* Адаптив — мобильные */
@media (max-width: 860px) {
  .lp-hero { padding: 80px 0 60px; }
  .lp-hero-title { font-size: 40px; letter-spacing: -0.5px; }
  .lp-hero-title br { display: none; }
  .lp-hero-subtitle { font-size: 16px; }

  .lp-feature-block { padding: 60px 0; }
  .lp-feature-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  /* На мобиле всегда: текст сверху, визуал снизу */
  .lp-feature-block.lp-reverse .lp-feature-content { order: 1; }
  .lp-feature-block.lp-reverse .lp-feature-visual-wrap { order: 2; }
  .lp-feature-h { font-size: 28px; }
  .lp-feature-visual-wrap { min-height: 260px; }
  .lp-checklist { column-count: 1; }

  .lp-visual-images { height: 260px; }
  .lp-img-card { width: 140px; height: 175px; }

  .lp-mid-cta { padding: 40px 0 60px; }

  .lp-footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* Legal document tables keep their columns on narrow screens. */
.legal-markdown .legal-table-wrap { overflow-x: auto; margin: 16px 0; }
.legal-markdown table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal-markdown th, .legal-markdown td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.legal-markdown th { font-weight: 600; }
.legal-markdown td:not(:first-child), .legal-markdown th:not(:first-child) { white-space: nowrap; }

/* ═══ MOBILE HEADER (hidden on desktop) ═══ */
.mobile-header { display: none; }

.desktop-header {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 28px;
}
.desktop-header-model {
  font-size: 14px;
  font-weight: 400;
  color: rgba(0,0,0,0.7);
  flex-shrink: 0;
}
/* Чип памяти прижат к правому краю (как на телефоне): слева — что за модель,
   справа — её настройка. Стили самого чипа — в chat.css */
.desktop-header .ctx-chip { margin-left: auto; }


/* ═══ MOBILE ADAPTATION ═══ */
@media (max-width: 768px) {
  html { touch-action: manipulation; }

  /* ── 1. Viewport containment ── */
  html, body, #root { height: 100%; height: 100dvh; overflow: hidden; }
  .app { height: 100dvh; overflow: hidden; flex-direction: column; }
  .main-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
  .chat-container { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
  .image-generator { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
  .chat-messages { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px; }
  .skeleton-overlay { padding: 0 16px; }
  .chat-container .chat-messages { display: flex; flex-direction: column; }
  .chat-container .input-area { padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px)); }
  .image-generator .chat-messages { display: flex; flex-direction: column; }
  .image-generator .input-area { padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px)); }
  .video-generator .chat-messages { display: flex; flex-direction: column; }
  .video-generator .input-area { padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px)); }

  .desktop-header { display: none; }

  /* ── 2. Mobile header ── */
  .mobile-header {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    position: relative;
    z-index: 1001;
  }
  .mobile-header-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 8px;
    transition: opacity 0.1s;
  }
  .mobile-header-menu:active {
    opacity: 0.7;
  }
  .mobile-header-menu span {
    width: 20px;
    height: 2px;
    background: var(--muted);
    border-radius: 2px;
  }
  .mobile-header-model {
    font-size: 14px;
    font-weight: 400;
    color: rgba(0,0,0,0.7);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
  }
  /* Модель центрирована абсолютом → чип уводим вправо, к свободному краю */
  .mobile-header .ctx-chip {
    margin-left: auto;
    height: 40px;
    font-size: 12px;
  }
  /* Тесно: остаётся «мозг + 8К». Слово убираем — смысл несёт иконка,
     число сокращаем (8 000 → 8К). Так чип узкий и не наезжает на центрированную модель. */
  .mobile-header .ctx-chip-label { display: none; }
  .mobile-header .ctx-chip-value { display: none; }
  .mobile-header .ctx-chip-value-short { display: inline; }

  /* Мягкое проявление хедера при закрытии клавиатуры — маскирует «впрыгивание»,
     когда iOS роняет страницу вниз. Триггерится транзиентным body.kb-closing (ChatInput). */
  body.kb-closing .mobile-header {
    animation: mobileHeaderReveal 0.5s ease-out;
  }
  @keyframes mobileHeaderReveal {
    from { opacity: 0; transform: translateY(-32px); }
    to   { opacity: 1; transform: translateY(0); }
  }


  /* ── 3. Fonts (Apple HIG 17px body) ── */
  .message-row.user .message-bubble { font-size: 17px; }
  .message-row.bot .message-bubble { font-size: 17px; }
  .chip { font-size: 15px; padding: 10px 16px; }
  pre { font-size: 13px !important; }
  .error-text { font-size: 15px; }

  /* ── 4. Message spacing ── */
  .messages-list { padding: 16px 0 75px; contain: none; }
  .message-row { padding: 5px 0; }
  .message-row.user .message-bubble { max-width: 82%; padding: 11px 15px; line-height: 1.75; }
  .message-row.bot .message-bubble { max-width: 100%; padding: 8px 0; line-height: 1.75; }
  .message-row.bot .message-bubble p { padding: 0 4px; }

  /* ── 5. Touch targets (min 44px) ── */
  .chip { min-height: 44px; display: inline-flex; align-items: center; }
  .scroll-to-bottom-btn { width: 44px; height: 44px; }
  .retry-btn { min-height: 44px; padding: 10px 18px; font-size: 14px; }
  .code-copy-btn { min-height: 44px; padding: 4px 10px; }

  /* ── 6. Welcome screen ── */
  .welcome-screen { justify-content: center; padding: 28px 20px; }

  .sidebar-toggle { display: none; }

  /* Sidebar drawer */
  .sidebar {
    position: absolute;
    left: 0;
    top: 48px;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    background: var(--sb-bg);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Overlay */
  .sidebar-overlay {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
  }
  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Main content full width */
  .main-content {
    margin-left: 0;
    width: 100%;
  }

  /* Drop zone useless on touch */
  .drop-zone-overlay { display: none; }

  .messages-area { padding: 12px 8px; }

  /* Touch-friendly inputs */
  .input-area { padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .chat-input-area {
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .chat-input-area textarea,
  .chat-textarea {
    font-size: 17px; /* под размер сообщений на мобиле (.message-bubble = 17px); ≥16px — iOS Safari не зумит при фокусе */
  }
  .attach-btn { width: 44px; height: 44px; }
  .chat-input-area .send-btn,
  .send-btn {
    min-width: 44px;
    min-height: 44px;
  }
  input, textarea, select { font-size: 16px; }
  .input-hint { display: none; }

  /* Hover → always visible on touch */
  .code-copy-btn span { display: none; }
  .image-preview-remove { opacity: 1; width: 28px; height: 28px; }
  .ig-ref-remove { opacity: 1; width: 28px; height: 28px; }

  .chip-row { gap: 6px; }

  /* Code blocks */
  pre { padding: 10px 12px !important; }
  pre code span { word-break: break-all !important; white-space: pre-wrap !important; }

  /* Image / Video results → 1 column */
  .ig-results-grid,
  .vg-results-grid {
    grid-template-columns: 1fr;
  }

  /* Overlays always visible (no hover on touch) */
  .ig-result-overlay,
  .vg-result-card .ig-result-overlay {
    opacity: 1;
  }
  .ig-result-remove,
  .vg-result-remove {
    opacity: 0.8;
  }

  /* Prompt input */
  .ig-input textarea,
  .vg-input textarea {
    font-size: 16px;
  }

  /* Stacked textarea — more breathing room */
  .input-wrapper.ig-stacked .chat-textarea {
    padding-bottom: 14px;
  }

  /* Video controls bar — two rows on mobile */
  .video-generator .ig-controls-bar {
    flex-wrap: wrap;
  }
  .video-generator .ig-controls-right {
    flex-wrap: wrap;
    width: 100%;
    margin-left: 0;
  }
  .video-generator .ig-controls-right .send-btn {
    margin-left: auto;
  }

  /* Frame refs → column */
  .ig-frame-refs {
    flex-direction: column;
  }

  /* (old model-card mobile overrides removed) */
  .vms-container {
    padding: 32px 16px 16px;
  }
  .vms-cards {
    max-width: 100%;
  }
  .vms-back {
    position: static;
    margin: 0 auto 8px;
  }

  /* Lightbox + Confirm: absolute вместо fixed — чтобы iOS Safari не красил чёлку */
  .ig-lightbox,
  .confirm-overlay {
    position: absolute;
  }
  .ig-lightbox-toolbar {
    padding: 0 12px;
  }
  .ig-lightbox-media {
    padding: 0 12px 12px;
  }

  /* ig-popover: position:fixed в base CSS, мобильных переопределений не нужно */

  /* Sidebar mobile UX */
  .sidebar-brand { display: none; }
  .sidebar-label { font-size: 11px; padding: 14px 20px 8px; }
  .sidebar-nav { gap: 4px; }
  .nav-item { padding: 14px 14px; font-size: 15px; gap: 12px; min-height: 48px; }
  .nav-icon { width: 24px; height: 24px; }
  .nav-icon svg { width: 20px; height: 20px; }
  .tab-row { padding: 8px 14px; font-size: 14px; gap: 10px; min-height: 40px; }
  .tab-row:active { background: var(--sb-active); transition: background 0.05s; }
  .tab-row-icon { width: 20px; height: 20px; }
  .tab-row-icon svg { width: 16px; height: 16px; }
  .tab-dots-wrap { width: 44px; height: 44px; opacity: 0.5; }
  .tab-pin-icon { margin-right: -4px; }
  /* Context menu — попап рядом с кнопкой (как на десктопе), увеличенные touch targets */
  .ctx-item { padding: 12px 16px; font-size: 15px; gap: 12px; min-height: 44px; }
  .ctx-icon { width: 22px; }
  .ctx-icon svg { width: 17px; height: 17px; }

  /* Login */
  .login-form {
    padding: 20px 16px;
    width: 100%;
  }
  .login-input {
    font-size: 16px;
    min-height: 48px;
  }
  .login-btn { min-height: 48px; font-size: 16px; }
  .confirm-btn-no, .confirm-btn-yes { min-height: 48px; font-size: 16px; }
  .vms-title { font-size: 22px; }

  /* Settings — mobile */
  .profile-page {
    padding: 20px 16px 40px;
  }
  .settings-layout {
    width: 100%;
  }
  .settings-top-back {
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    -webkit-tap-highlight-color: transparent;
  }
  .settings-back-desktop,
  .settings-title-desktop {
    display: none;
  }
  .settings-back-mobile,
  .settings-title-mobile {
    display: inline-flex;
  }
  .settings-title-mobile {
    display: block;
  }
  .profile-title {
    font-size: 24px;
    margin-bottom: 16px;
  }
  .settings-body {
    flex-direction: column;
    gap: 0;
    position: relative;
    overflow: hidden;
  }
  .settings-divider {
    display: none;
  }
  .settings-content-desktop {
    display: none;
  }

  /* Nav list — card style with slide transition */
  .settings-nav {
    min-width: 0;
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    padding-right: 0;
    gap: 0;
    transform: translateX(0);
    opacity: 1;
    transition: transform 350ms cubic-bezier(0.2, 0, 0, 1),
                opacity 250ms cubic-bezier(0.2, 0, 0, 1);
  }
  .settings-drilled .settings-nav {
    transform: translateX(-30%);
    opacity: 0;
    pointer-events: none;
    position: absolute;
  }
  .settings-nav-item {
    padding: 15px 16px;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
    font-size: 16px;
    color: var(--ink);
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
  }
  .settings-nav-item:last-child {
    border-bottom: none;
  }
  .settings-nav-item.active {
    background: none;
  }
  .settings-nav-item:active {
    background: var(--hover);
    transition: background 0.05s ease;
  }
  .settings-nav-chevron {
    display: block;
    color: var(--muted);
  }

  /* Drill-down content — slide in from right */
  .settings-content-mobile {
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transition: transform 350ms cubic-bezier(0.2, 0, 0, 1),
                opacity 250ms cubic-bezier(0.2, 0, 0, 1);
  }
  .settings-drilled .settings-content-mobile {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    position: relative;
  }

  /* Cards in mobile */
  .s-card {
    border-color: var(--border);
    border-radius: 12px;
  }
  .s-card-row {
    padding: 15px 16px;
  }
  .s-card-row-action {
    -webkit-tap-highlight-color: transparent;
  }
  .s-card-pw-form {
    padding: 16px;
  }

  /* Email edit — stacked on mobile */
  .profile-email-edit {
    flex-wrap: wrap;
    gap: 8px;
  }
  .profile-input-inline {
    font-size: 16px;
    width: 100%;
  }

  /* Inputs & buttons */
  .profile-input {
    font-size: 16px;
    min-height: 48px;
  }
  .profile-save-btn {
    font-size: 16px;
    min-height: 48px;
    padding: 10px 24px;
  }
  .s-danger-btn {
    font-size: 14px;
    min-height: 48px;
    padding: 10px 20px;
  }

  /* Legal */
  .legal-page {
    padding: 16px;
  }

  /* Sidebar footer touch targets */
  .sidebar-footer { padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
  .sidebar-footer-user { min-height: 44px; padding: 8px; margin: -8px; border-radius: 10px; }
  .sidebar-footer-email { font-size: 15px; }
  .sidebar-avatar { width: 32px; height: 32px; font-size: 13px; }
  .sidebar-balance { font-size: 13px; }
  .sidebar-support-wrap { padding: 10px 16px; }
  .sidebar-support { font-size: 13px; }

  /* Profile popup touch targets */
  .profile-popup-email { font-size: 14px; }
  .profile-popup-item { font-size: 16px; min-height: 48px; padding: 12px 16px; }
  .profile-popup-item svg { width: 18px; height: 18px; }

  /* Grab handle убран — ctx-menu теперь попап, не bottom sheet */

  /* Tooltips — hide on touch */
  .nav-tooltip {
    display: none;
  }
}

/* ═══ PWA ═══ */
@media (display-mode: standalone) {
  body.keyboard-open .input-area {
    padding-bottom: 6px;
  }
  body.keyboard-open .chat-input-area {
    padding-bottom: 8px;
  }
}

