/*
 * AI Content Platform — Design System
 * Aesthetic: Editorial minimalism with bold accent punctuation
 * Reference: Osmo Supply with Russian-market personality
 */

/* Global: hidden attribute must ALWAYS hide, even when CSS sets display: flex/grid */
[hidden] {
  display: none !important;
}

/* ============================================
   FONTS
   ============================================ */
/* Fonts loaded via <link> in application.html.erb for faster loading */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  /* Colors — Light Theme */
  --color-primary: #A1FF62;
  --color-primary-hover: #8AE650;
  --color-primary-muted: rgba(161, 255, 98, 0.15);
  --color-accent: #6840FF;
  --color-accent-hover: #5630E0;
  --color-accent-muted: rgba(104, 64, 255, 0.1);
  --color-accent-light: rgba(104, 64, 255, 0.06);

  --color-bg: #F4F4F4;
  --color-bg-elevated: #FFFFFF;
  --color-bg-sunken: #EBEBEB;
  --color-bg-overlay: rgba(32, 29, 29, 0.6);

  --color-text: #201D1D;
  --color-text-secondary: #6B6767;
  --color-text-tertiary: #9E9999;
  --color-text-inverse: #F4F4F4;
  --color-text-on-primary: #201D1D;
  --color-text-on-accent: #FFFFFF;

  --color-border: #E0DEDE;
  --color-border-strong: #C8C4C4;
  --color-border-focus: var(--color-accent);

  --color-success: #22C55E;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;

  /* Typography */
  --font-body: 'Golos Text', system-ui, -apple-system, sans-serif;
  --font-heading: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;

  --leading-tight: 1.15;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Spacing (4px base unit) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
  --mobile-header-height: 60px;
  --content-max-width: 1200px;

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(32, 29, 29, 0.05);
  --shadow-md: 0 4px 12px rgba(32, 29, 29, 0.08);
  --shadow-lg: 0 8px 30px rgba(32, 29, 29, 0.12);
  --shadow-xl: 0 20px 60px rgba(32, 29, 29, 0.15);
  --shadow-glow-primary: 0 0 20px rgba(161, 255, 98, 0.3);
  --shadow-glow-accent: 0 0 20px rgba(104, 64, 255, 0.25);

  /* Onboarding */
  --color-accent-rgb: 104, 64, 255;
  --onb-bg-ambient: radial-gradient(circle at 50% 10%, rgba(104, 64, 255, 0.08) 0%, rgba(104, 64, 255, 0) 60%);
  --onb-card-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.1);
  --onb-card-shadow-hover: 0 30px 60px -20px rgba(104, 64, 255, 0.25);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index layers */
  --z-sidebar: 100;
  --z-header: 200;
  --z-dropdown: 300;
  --z-modal-overlay: 400;
  --z-modal: 500;
  --z-element-modal-overlay: 550;
  --z-element-modal: 560;
  --z-toast: 600;
}

/* ============================================
   DARK THEME
   ============================================ */
[data-theme="dark"] {
  color-scheme: dark;

  --color-primary: #A1FF62;
  --color-primary-hover: #8AE650;
  --color-primary-muted: rgba(161, 255, 98, 0.15);
  --color-accent: #7C5AFF;
  --color-accent-hover: #9478FF;
  --color-accent-muted: rgba(124, 90, 255, 0.15);
  --color-accent-light: rgba(124, 90, 255, 0.08);

  --color-bg: #171515;
  --color-bg-elevated: #1E1C1C;
  --color-bg-sunken: #131111;
  --color-bg-overlay: rgba(0, 0, 0, 0.7);

  --color-text: #EDEBEB;
  --color-text-secondary: #A09C9C;
  --color-text-tertiary: #6B6767;
  --color-text-inverse: #201D1D;
  --color-text-on-primary: #201D1D;
  --color-text-on-accent: #FFFFFF;

  --color-border: #2E2B2B;
  --color-border-strong: #3D3939;
  --color-border-focus: var(--color-accent);

  --color-success: #34D399;
  --color-warning: #FBBF24;
  --color-error: #F87171;
  --color-info: #60A5FA;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow-primary: 0 0 20px rgba(161, 255, 98, 0.2);
  --shadow-glow-accent: 0 0 20px rgba(124, 90, 255, 0.2);

  /* Onboarding */
  --color-accent-rgb: 124, 90, 255;
  --onb-bg-ambient: radial-gradient(circle at 50% -10%, rgba(124, 90, 255, 0.15) 0%, transparent 70%);
  --onb-card-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.3);
  --onb-card-shadow-hover: 0 30px 60px -20px rgba(124, 90, 255, 0.4);
}

/* Sidebar uses hardcoded var(--color-text) as bg — override for dark */
[data-theme="dark"] .app-sidebar {
  background: #201D1D;
  color: #F4F4F4;
}

/* Keep logo bolt dark on lime background */
[data-theme="dark"] .sidebar-logo__mark svg {
  color: #201D1D;
}

/* Select arrow recolored for dark backgrounds */
[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23A09C9C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Smooth transition when toggling theme */
body.theme-transitioning,
body.theme-transitioning *,
body.theme-transitioning *::before,
body.theme-transitioning *::after {
  transition: background-color 300ms ease, color 300ms ease,
              border-color 300ms ease, box-shadow 300ms ease,
              fill 300ms ease, stroke 300ms ease !important;
}

/* ============================================
   THEME TOGGLE (Minimalist)
   ============================================ */
.sidebar-theme-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.sidebar-theme-row__icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-theme-row__icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-theme-row__label {
  white-space: nowrap;
}

.theme-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--color-border, rgba(0, 0, 0, 0.15));
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--color-text-tertiary, rgba(0, 0, 0, 0.25));
}

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle {
  background: var(--color-accent);
}

[data-theme="dark"] .theme-toggle:hover {
  background: var(--color-accent-hover);
}

[data-theme="dark"] .theme-toggle__thumb {
  transform: translateX(16px);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle noise texture on body */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

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

a:hover {
  color: var(--color-accent-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--color-text);
}

h1 { font-size: var(--text-5xl); font-weight: var(--font-weight-extrabold); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); font-weight: var(--font-weight-semibold); }

@media (max-width: 768px) {
  h1 { font-size: 32px; }
  h2 { font-size: 26px; }
  h3 { font-size: 20px; }
}

.text-mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: 0 var(--space-8);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
  z-index: var(--z-header);
  height: var(--header-height);
}

.header-balance {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary-muted);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.header-balance:hover {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
}

.header-balance__icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-balance__amount {
  font-family: var(--font-mono);
  font-weight: var(--font-weight-bold);
}

.header-topup-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  transition: all var(--transition-fast);
  letter-spacing: 0.01em;
}

.header-topup-btn:hover {
  background: var(--color-accent-hover);
  color: var(--color-text-on-accent);
  box-shadow: var(--shadow-glow-accent);
  transform: translateY(-1px);
}

/* ---- Onboarding ---- */
.onb { max-width: 640px; margin: 0 auto; padding: 40px 20px 60px; }
.onb__step { display: flex; flex-direction: column; align-items: center; text-align: center; }
.onb__step[hidden] { display: none !important; }
/* Dark-scoped shared text */
.app-main:has(.onb) .onb__title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-style: italic;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 400; color: #fff;
  margin: 0 0 8px; line-height: 1.15;
  letter-spacing: -.01em;
}
.app-main:has(.onb) .onb__hint {
  font-size: 13px; color: rgba(255,255,255,.4);
  margin: 0 0 20px; line-height: 1.5;
}
.onb__title { font-size: 24px; font-weight: 700; color: var(--color-text); margin: 0 0 12px; line-height: 1.3; }
.onb__hint { font-size: 15px; color: var(--color-text-secondary); margin: 0 0 24px; line-height: 1.5; }

/* ── Onboarding Stage (Экран 1) ── clean rewrite ── */

/* 1. Break out of app-main constraints */
.app-main:has(.onb) {
  padding: 0;
  background: #09090f;
  overflow: hidden;
}
.app-main:has(.onb) > .app-main__inner {
  max-width: none;
  width: 100%;
  height: 100%;
}
.app-main:has(.onb) .onb {
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
/* Step1 (stage) needs full-width stretch */
.app-main:has(.onb) .onb__step:has(.onb__stage) {
  width: 100%;
  height: 100%;
  text-align: left;
  align-items: stretch;
}
/* Steps 3-7 stay full-width (each manages own layout via inner wrappers) */
.app-main:has(.onb) .onb__step:not(:has(.onb__stage)) {
  width: 100%;
  align-items: stretch;
}

/* 2. Stage — full viewport minus header */
.onb__stage {
  width: 100%;
  height: calc(100vh - var(--header-height, 64px));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 32px 48px;
  background: #09090f;
  position: relative;
  overflow: hidden;
}
.onb__stage::before {
  content: '';
  position: absolute;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  width: 600px; height: 500px;
  background: radial-gradient(ellipse, rgba(196,181,253,.06) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
.onb__stage > * { position: relative; z-index: 1; }

/* 3. Header row */
.onb__stage-top {
  width: 100%; max-width: 720px;
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 16px;
  flex-shrink: 0;
}
.onb__eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  margin-bottom: 8px;
}
.onb__eyebrow-line { width: 24px; height: 1px; background: rgba(255,255,255,.2); }
.onb__stage-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-style: italic;
  font-size: clamp(28px, 3.5vw, 48px);
  font-weight: 400; line-height: 1.08; color: #fff;
  letter-spacing: -.02em; margin: 0;
}
.onb__stage-title span { font-style: normal; color: #c4b5fd; }
.onb__stage-right { text-align: right; padding-top: 4px; flex-shrink: 0; }
.onb__stage-step-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: rgba(196,181,253,.45);
  display: block; margin-bottom: 8px;
}
.onb__stage-steps { display: flex; gap: 4px; justify-content: flex-end; }
.onb__stage-step {
  width: 16px; height: 2px; border-radius: 2px;
  background: rgba(255,255,255,.15); transition: all .3s;
}
.onb__stage-step--on { background: #c4b5fd; width: 24px; }

/* 4. Cards — ALL SAME HEIGHT, capped on wide monitors */
.onb__podium {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  width: 100%; max-width: 720px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 480px;
  padding: 24px 0;
}
.onb__pcard {
  flex: 1 1 0;
  max-width: 220px;
  min-width: 0;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.08);
  background: #0e0e18;
  padding: 0; font-family: inherit;
  transition: transform .3s cubic-bezier(.16,1,.3,1),
              box-shadow .3s cubic-bezier(.16,1,.3,1),
              border-color .25s;
}
.onb__pcard--center {
  max-width: 240px;
  border-color: rgba(196,181,253,.15);
  box-shadow: 0 0 0 1px rgba(196,181,253,.08), 0 8px 32px rgba(0,0,0,.3);
}
.onb__pcard:hover {
  border-color: rgba(196,181,253,.35);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.onb__pcard--active {
  border-color: #c4b5fd;
  box-shadow: 0 0 0 2px #c4b5fd, 0 12px 36px rgba(196,181,253,.2);
  transform: translateY(-4px);
}
.onb__pcard-media {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  pointer-events: none; display: block;
  transition: transform .5s cubic-bezier(.16,1,.3,1);
}
.onb__pcard:hover .onb__pcard-media { transform: scale(1.04); }
.onb__pcard-ov {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(9,9,15,.85) 0%, rgba(9,9,15,.2) 50%, transparent 100%);
}
.onb__pcard-num {
  position: absolute; top: 10px; left: 12px;
  font-family: 'DM Serif Display', serif; font-style: italic;
  font-size: 64px; line-height: 1;
  color: rgba(255,255,255,.04);
  pointer-events: none; transition: color .25s;
}
.onb__pcard:hover .onb__pcard-num,
.onb__pcard--active .onb__pcard-num { color: rgba(196,181,253,.08); }
.onb__pcard-check {
  position: absolute; top: 10px; right: 10px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #c4b5fd;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.4);
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
}
.onb__pcard--active .onb__pcard-check { opacity: 1; transform: scale(1); }
.onb__pcard-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px; z-index: 2;
}
.onb__pcard-title {
  font-size: 14px; font-weight: 600; color: #fff;
  margin-bottom: 3px; letter-spacing: -.01em;
  text-align: left; transition: color .2s;
}
.onb__pcard--active .onb__pcard-title,
.onb__pcard:hover .onb__pcard-title { color: #c4b5fd; }
.onb__pcard-desc {
  font-size: 11px; color: rgba(255,255,255,.4);
  line-height: 1.4; text-align: left;
}

/* 5. Bottom bar */
.onb__stage-bar {
  width: 100%; max-width: 720px;
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
  flex-shrink: 0;
}
.onb__stage-status {
  font-family: 'DM Serif Display', serif; font-style: italic;
  font-size: 15px; color: rgba(255,255,255,.25);
  transition: all .3s; margin: 0;
}
.onb__stage-status--live { color: rgba(196,181,253,.6); }
.onb__stage-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600; border-radius: 100px;
  border: 1px solid rgba(196,181,253,.15);
  background: transparent; color: rgba(196,181,253,.3);
  cursor: not-allowed; letter-spacing: -.01em;
  transition: all .3s;
  animation: onb-pulse-cta 3s ease-in-out infinite;
}
.onb__stage-cta[disabled] { opacity: 0.5; }
.onb__stage-cta--live {
  background: #c4b5fd; color: #09090f;
  border-color: #c4b5fd; cursor: pointer;
  opacity: 1; animation: none;
  box-shadow: 0 4px 20px rgba(196,181,253,.25);
}
.onb__stage-cta--live:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(196,181,253,.35);
}
@keyframes onb-pulse-cta {
  0%,100% { border-color: rgba(196,181,253,.08); }
  50% { border-color: rgba(196,181,253,.3); }
}

/* CTA button (used on other steps) */
.onb__cta {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 18px 40px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  color: var(--color-text-on-accent);
  border: 1px solid transparent; border-radius: 100px; font-size: 18px; font-weight: 600;
  cursor: pointer; text-decoration: none; font-family: inherit;
  box-shadow: 0 8px 24px rgba(var(--color-accent-rgb), 0.4);
  transition: all 0.3s ease;
}
.onb__cta:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 32px rgba(var(--color-accent-rgb), 0.5);
  filter: none;
}
.onb__cta--accent { background: var(--color-bg-sunken); color: var(--color-text); border: 1px solid var(--color-border); box-shadow: none; }
.onb__btn-secondary {
  padding: 12px 24px; background: transparent; color: var(--color-text-secondary);
  border: 1px solid var(--color-border); border-radius: 12px; font-size: 14px;
  cursor: pointer; font-family: inherit; transition: all 0.15s ease;
}
.onb__btn-secondary:hover { border-color: var(--color-text-dim); color: var(--color-text); }

/* Shimmer animation (used by photo previews on upload) */
@keyframes onb-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* CTA button (steps 3+) */
.onb__cta {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 36px;
  background: #c4b5fd; color: #09090f;
  border: none; border-radius: 100px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 20px rgba(196,181,253,.25);
  transition: all .3s cubic-bezier(.16,1,.3,1);
}
.onb__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(196,181,253,.35);
}
.onb__cta--accent {
  background: transparent; color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.12); box-shadow: none;
}
.onb__btn-secondary {
  padding: 12px 24px; background: transparent;
  color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 100px; font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: all .2s;
}
.onb__btn-secondary:hover {
  border-color: rgba(255,255,255,.25);
  color: #fff;
}

/* Disabled CTA */
.onb__cta[disabled] {
  cursor: not-allowed;
  background: rgba(196,181,253,.1);
  color: rgba(255,255,255,.35);
  box-shadow: none;
  border: 1px solid rgba(196,181,253,.15);
  pointer-events: none;
  animation: onb-pulse-border 2.5s ease-in-out infinite;
}
@keyframes onb-pulse-border {
  0%,100% { border-color: rgba(196,181,253,.08); }
  50% { border-color: rgba(196,181,253,.3); }
}

/* Gender — segmented pill */
.onb__gender {
  display: inline-flex;
  align-self: flex-start;
  flex-shrink: 0;
  flex-grow: 0;
  background: rgba(255,255,255,.04);
  padding: 3px;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,.08);
  gap: 0;
  margin: 0;
}
.onb__gender-option { cursor: pointer; }
.onb__gender-option input { display: none; }
.onb__gender-option span {
  display: block;
  padding: 8px 20px;
  border-radius: 100px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.4);
  transition: all .2s;
}
.onb__gender-option input:checked + span {
  background: rgba(196,181,253,.15);
  color: #c4b5fd;
  box-shadow: 0 2px 8px rgba(196,181,253,.1);
}

/* Loading */
.onb__loader { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 0; }
.onb__loader-spinner {
  width: 40px; height: 40px;
  border: 2px solid rgba(255,255,255,.08);
  border-top-color: #c4b5fd;
  border-radius: 50%;
  animation: onb-spin 0.8s linear infinite;
}
@keyframes onb-spin { to { transform: rotate(360deg); } }
.onb__loader-hint { font-size: 14px; color: rgba(255,255,255,.35); transition: opacity 0.3s ease; text-align: center; }
.onb__loader-wait {
  font-family: 'DM Serif Display', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(196,181,253,.55);
  margin: 4px 0 0;
  text-align: center;
}
.onb__loader-note { font-size: 12px; color: rgba(255,255,255,.25); margin-top: 8px; text-align: center; }
.onb__loader-demo { font-size: 11px; color: rgba(255,255,255,.2); max-width: 360px; margin-top: 4px; text-align: center; }
.onb__progress { width: 240px; height: 3px; background: rgba(255,255,255,.06); border-radius: 2px; overflow: hidden; }
.onb__progress-fill { height: 100%; background: #c4b5fd; border-radius: 2px; transition: width 1s linear; width: 0%; }

/* Full-screen centered step (step4, step6, stepError) — базовые правила для desktop.
   На мобиле доопределяется в @media (max-width: 768px) через position: fixed. */
.app-main:has(.onb) .onb__step--centered {
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}
.app-main:has(.onb) .onb__step--centered .onb__loader,
.app-main:has(.onb) .onb__step--centered .onb__error {
  padding: 0;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

/* Upsell block на экране ожидания видео — мягкое "демо-режим → купи платформу" */
.onb__loader-upsell {
  margin-top: 28px;
  padding-top: 20px;
  max-width: 360px;
  border-top: 1px solid rgba(255,255,255,.06);
  text-align: center;
}
.onb__loader-upsell-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(196,181,253,.85);
  background: rgba(196,181,253,.08);
  border: 1px solid rgba(196,181,253,.2);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 10px;
}
.onb__loader-upsell p {
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255,255,255,.45);
  margin: 0;
}
.onb__loader-upsell strong {
  color: rgba(255,255,255,.85);
  font-weight: 600;
}

/* Confirm sheet */
.onb__sheet-preview { margin: 24px 0; }
.onb__sheet-preview img { max-width: 100%; max-height: 400px; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); }
.onb__confirm-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Result */
.onb__result { margin: 24px 0; width: 100%; }
.onb__result-video { width: 100%; max-height: 480px; border-radius: 12px; background: #000; }
.onb__result-demo { font-size: 11px; color: rgba(255,255,255,.2); margin: 8px 0 24px; }
.onb__result-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Error */
.onb__error { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 0; }
.onb__error p { color: rgba(255,255,255,.4); font-size: 14px; }

/* Mobile */
@media (max-width: 768px) {
  .onb { padding: 20px 16px 40px; }
}
@media (max-width: 640px) {
  /* Screen 1 mobile — cards keep natural 9:16 ratio */
  .onb__stage {
    height: auto;
    min-height: calc(100dvh - var(--header-height, 64px));
    padding: 24px 16px;
    justify-content: space-between;
  }
  .onb__stage-top { max-width: 100%; flex-shrink: 0; }
  .onb__podium {
    max-width: 100%;
    max-height: none;
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px;
    padding: 16px 0;
    align-items: center;
  }
  .onb__pcard {
    flex: 1 1 0;
    max-width: none;
    aspect-ratio: 9 / 16;
    height: auto;
    align-self: auto;
  }
  .onb__pcard--center { max-width: none; }
  .onb__pcard-num { font-size: 36px; }
  .onb__pcard-title { font-size: 12px; }
  .onb__stage-bar { max-width: 100%; flex-shrink: 0; }
  .onb__pcard-desc { display: none; }
  .onb__stage-title { font-size: clamp(24px, 6vw, 34px) !important; }

}

/* ---- News bell ---- */
.header-news { position: relative; display: flex; align-items: center; }
.header-news__bell {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: none; border-radius: var(--radius-full);
  background: transparent; color: var(--color-text-secondary); cursor: pointer;
  transition: all 0.15s ease; font-family: inherit;
}
.header-news__bell:hover { background: var(--color-bg-sunken); color: var(--color-text); }
.header-news__badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px;
  padding: 0 5px; background: #ef4444; color: #fff; font-size: 11px;
  font-weight: 700; line-height: 18px; text-align: center;
  border-radius: var(--radius-full); pointer-events: none;
}
.header-news__panel {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 360px; max-height: 480px; overflow-y: auto;
  background: var(--color-bg-elevated); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 300;
}
.header-news__panel--open { display: block; }

.news-panel__header {
  padding: 14px 16px; border-bottom: 1px solid var(--color-border);
  font-weight: 600; font-size: 15px; color: var(--color-text);
}
.news-panel__list { padding: 4px 0; }
.news-panel__empty {
  padding: 32px 16px; text-align: center;
  color: var(--color-text-secondary); font-size: 14px;
}

.news-item { border-bottom: 1px solid var(--color-border); }
.news-item:last-child { border-bottom: none; }
.news-item__header {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 12px 16px; border: none; background: transparent; cursor: pointer;
  text-align: left; color: var(--color-text); font-size: 14px;
  font-family: inherit; transition: background 0.15s ease;
}
.news-item__header:hover { background: var(--color-bg-sunken); }
.news-item__title { flex: 1; font-weight: 500; }
.news-item__date { font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; }
.news-item__chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.news-item__chevron--open { transform: rotate(180deg); }
.news-item__content {
  display: none; padding: 0 16px 14px; font-size: 14px;
  color: var(--color-text-secondary); line-height: 1.6;
}
.news-item__content--open { display: block; }

.nav-drawer__badge--alert {
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: var(--radius-full); margin-left: auto;
}
.nav-drawer__news-wrap { position: relative; }

/* Mobile: hide dropdown panel — use full-screen overlay instead */
@media (max-width: 768px) {
  .header-news__panel { display: none !important; }
}

/* Mobile news overlay — full screen, slides up */
.news-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 250;
  background: var(--color-bg);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.news-overlay--open { transform: translateY(0); }

.news-overlay__header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0));
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.news-overlay__back {
  width: 40px; height: 40px; border: none; border-radius: 10px;
  background: transparent; color: var(--color-text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.news-overlay__back:active { background: var(--color-bg-sunken); }
.news-overlay__title {
  font-size: 17px; font-weight: 600; color: var(--color-text);
}
.news-overlay__content {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.header-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.header-profile:hover {
  background: var(--color-bg-sunken);
}

.header-profile__avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--text-sm);
  color: var(--color-accent);
  overflow: hidden;
}

.header-profile__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   SIDEBAR
   ============================================ */
.app-sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  background: var(--color-text);
  color: var(--color-text-inverse);
  z-index: var(--z-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  height: var(--header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo__mark {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo__mark svg {
  width: 22px;
  height: 22px;
  color: var(--color-text);
}

.sidebar-logo__text {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-3);
  gap: var(--space-1);
  overflow-y: auto;
}

.sidebar-nav__label {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  margin-top: var(--space-4);
}

.sidebar-nav__label:first-child {
  margin-top: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95);
}

.sidebar-link--active {
  background: rgba(161, 255, 98, 0.12);
  color: var(--color-primary);
}

.sidebar-link--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-link__icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-link__icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-link__badge {
  margin-left: auto;
  background: var(--color-accent);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: var(--space-2) 0;
}

.sidebar-link--muted {
  opacity: 0.55;
  font-size: var(--text-xs);
}

.sidebar-link--muted:hover {
  opacity: 0.85;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.app-main {
  grid-area: main;
  overflow-y: auto;
  padding: var(--space-8);
}

.app-main__inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-glow-primary);
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--accent {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
}

.btn--accent:hover {
  background: var(--color-accent-hover);
  color: var(--color-text-on-accent);
  box-shadow: var(--shadow-glow-accent);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--ghost:hover {
  background: var(--color-bg-sunken);
  border-color: var(--color-border-strong);
}

.btn--sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn--icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
}

.btn--full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Generate Button — special CTA */
.btn--generate {
  background: linear-gradient(135deg, var(--color-primary) 0%, #6FE038 100%);
  color: var(--color-text-on-primary);
  font-size: var(--text-base);
  font-weight: var(--font-weight-bold);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.btn--generate::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn--generate:hover::after {
  transform: translateX(100%);
}

.btn--generate:hover {
  box-shadow: var(--shadow-glow-primary), var(--shadow-md);
  transform: translateY(-2px);
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.card__body {
  padding: var(--space-5);
}

.card__header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.card__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-muted);
}

.form-input::placeholder {
  color: var(--color-text-tertiary);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B6767' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
}

/* ============================================
   PROMPT BOX — The hero component
   ============================================ */
/* ============================================
   PHOTOS PAGE LAYOUT
   ============================================ */

/* Break out of .app-main__inner max-width for full-width gallery */
.app-main:has(.photos-page) {
  padding: var(--space-4) var(--space-5);
}

.app-main:has(.photos-page) > .app-main__inner {
  max-width: none;
  width: 100%;
}

/* Fallback for browsers without :has() support */
.photos-page {
  max-width: none;
}

.photos-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - var(--space-4) * 2);
  width: 100%;
  position: relative;
}

.photos-page__results {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  padding-bottom: var(--space-6);
  scroll-behavior: smooth;
  mask-image: linear-gradient(to bottom, black calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 40px), transparent 100%);
}

.photos-page__results::-webkit-scrollbar {
  width: 4px;
}

.photos-page__results::-webkit-scrollbar-track {
  background: transparent;
}

.photos-page__results::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.photos-page__results::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-strong);
}

/* ============================================
   PROMPT DOCK (dark bottom bar)
   ============================================ */
.prompt-dock {
  --dock-bg: #1C1B1B;
  --dock-text: #E8E5E5;
  --dock-text-dim: #8A8686;
  --dock-border: #333030;
  --dock-hover: #2A2828;
  --dock-green: #A1FF62;

  position: sticky;
  bottom: 0;
  background: var(--dock-bg);
  border-radius: 20px;
  padding: var(--space-5) var(--space-5) var(--space-4);
  z-index: 10;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
  color: var(--dock-text);
}

/* Top section: icons + textarea */
.prompt-dock__top {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.prompt-dock__side-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
  flex-shrink: 0;
}

.prompt-dock__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--dock-text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}

.prompt-dock__icon-btn:hover {
  background: var(--dock-hover);
  color: var(--dock-text);
}

.prompt-dock__textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--dock-text);
  resize: none;
  min-height: 26px;
  max-height: 160px;
  overflow-y: auto;
  padding: 2px 0;
}

.prompt-dock__textarea::placeholder {
  color: var(--dock-text-dim);
}

.prompt-dock__char-counter {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-align: right;
  padding: 2px 0;
  line-height: 1;
}

.prompt-dock__char-counter--over {
  color: var(--color-error);
  font-weight: 600;
}

.prompt-dock__references {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding-bottom: var(--space-2);
}

/* Bottom settings bar */
.prompt-dock__bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--dock-border);
  height: 36px;
  position: relative;
}

/* Model selector */
.prompt-dock__model {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--dock-text);
  transition: background 0.15s ease;
  white-space: nowrap;
}

.prompt-dock__model:hover {
  background: var(--dock-hover);
}

.prompt-dock__model svg:first-child {
  color: var(--dock-green);
}

/* Separator */
.prompt-dock__sep {
  width: 1px;
  height: 16px;
  background: var(--dock-border);
  margin: 0 8px;
  flex-shrink: 0;
}

/* Inline setting buttons */
.prompt-dock__setting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--dock-text);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.prompt-dock__setting svg {
  flex-shrink: 0;
}

.prompt-dock__setting:hover {
  background: var(--dock-hover);
}

.prompt-dock__setting-hint {
  opacity: 0.5;
  font-size: 11px;
}

/* Quantity control */
.prompt-dock__qty {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--dock-text);
  font-weight: var(--font-weight-medium);
  position: relative;
}

.prompt-dock__qty-label {
  min-width: 28px;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--dock-text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.prompt-dock__qty-label:hover {
  background: var(--dock-hover);
}

.prompt-dock__qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--dock-text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.prompt-dock__qty-btn:hover {
  background: var(--dock-hover);
  color: var(--dock-text);
}

/* Quantity dropdown menu */
.qty-menu {
  display: flex;
  flex-direction: column;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #252323;
  border: 1px solid var(--dock-border);
  border-radius: 10px;
  padding: 4px;
  min-width: 48px;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.qty-menu__item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--dock-text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background 0.15s ease;
}

.qty-menu__item:hover {
  background: var(--dock-hover);
}

.qty-menu__item--active {
  color: var(--dock-green);
}

/* Aspect ratio selector */
.prompt-dock__setting-group {
  position: relative;
}

.ratio-menu {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #252323;
  border: 1px solid var(--dock-border);
  border-radius: 10px;
  padding: 6px;
  z-index: 20;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: fadeSlideUp 0.15s ease;
  width: max-content;
}

.ratio-menu__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--dock-text-dim);
  cursor: pointer;
  transition: all 0.12s ease;
  min-width: 44px;
}

.ratio-menu__item:hover {
  background: var(--dock-hover);
  color: var(--dock-text);
}

.ratio-menu__item--active {
  color: var(--dock-green);
  background: rgba(161, 255, 98, 0.08);
}

.ratio-menu__icon {
  border: 1.5px solid currentColor;
  border-radius: 2px;
  flex-shrink: 0;
}

.ratio-menu__label {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  font-family: var(--font-body);
  white-space: nowrap;
}

/* Token cost */
.prompt-dock__tokens {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--dock-text-dim);
  white-space: nowrap;
  margin-left: auto;
  padding-right: var(--space-3);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.prompt-dock__tokens span {
  color: var(--dock-green);
  font-weight: var(--font-weight-semibold);
}

/* Generate button */
.prompt-dock__generate {
  margin-left: auto;
  padding: 8px 24px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--dock-green);
  color: #1C1B1B;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.prompt-dock__generate:hover {
  background: #B4FF80;
  transform: scale(1.03);
  box-shadow: 0 4px 20px rgba(161, 255, 98, 0.35);
}

.prompt-dock__generate:active {
  transform: scale(0.97);
}

.prompt-dock__generate:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Quality toggle */
.prompt-dock__setting--quality {
  gap: 4px;
  transition: all 0.15s ease;
}

.prompt-dock__setting--quality svg {
  color: var(--dock-text-dim);
  transition: color 0.15s ease;
}

.prompt-dock__setting--quality-active {
  color: var(--dock-green);
}

.prompt-dock__setting--quality-active svg {
  color: var(--dock-green);
}

.prompt-dock__setting--quality-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Frame slots (Image → Video) */
.frame-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 6px;
  margin: 0 auto;
  max-width: min(340px, 100%);
}

.frame-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex: 1;
  max-width: 140px;
}

.frame-slot__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 72px;
  background: var(--dock-hover);
  border: 1.5px dashed var(--color-primary);
  border-radius: 12px;
  color: var(--dock-text-dim);
  transition: all 0.15s ease;
  position: relative;
}

.frame-slot__placeholder span {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.frame-slot:hover .frame-slot__placeholder {
  border-color: var(--color-primary-hover);
  color: var(--dock-text);
  background: rgba(161, 255, 98, 0.08);
}

.frame-slot__placeholder--loading {
  opacity: 0.5;
  pointer-events: none;
}

.frame-slot__placeholder--loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--dock-border);
  border-top-color: var(--dock-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.frame-slot__preview {
  position: relative;
  width: 100%;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid var(--color-primary);
}

.frame-slot__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.frame-slot__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.frame-slot__remove:hover {
  background: var(--color-error);
}

.frame-slots__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dock-text-dim);
  flex-shrink: 0;
  padding-bottom: 0;
}

/* Generation type dropdown menu */
.gen-type-menu {
  display: flex;
  flex-direction: column;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #252323;
  border: 1px solid var(--dock-border);
  border-radius: 10px;
  padding: 4px;
  min-width: 200px;
  z-index: 20;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: fadeSlideUp 0.15s ease;
}

.gen-type-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--dock-text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background 0.12s ease;
  text-align: left;
  white-space: nowrap;
}

.gen-type-menu__item:hover {
  background: var(--dock-hover);
}

.gen-type-menu__item--active {
  color: var(--dock-green);
}

.gen-type-menu__item svg {
  flex-shrink: 0;
}

.gen-type-menu__badge {
  margin-left: auto;
  font-size: 10px;
  color: var(--dock-text-dim);
  opacity: 0.7;
}

/* Model dropdown menu */
.model-menu {
  display: flex;
  flex-direction: column;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: #252323;
  border: 1px solid var(--dock-border);
  border-radius: 10px;
  padding: 4px;
  min-width: 260px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: fadeSlideUp 0.15s ease;
  z-index: 20;
}

.model-menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--dock-text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background 0.12s ease;
  text-align: left;
  white-space: nowrap;
}

.model-menu__item:hover {
  background: var(--dock-hover);
}

.model-menu__item--active {
  color: var(--dock-green);
}

.model-menu__item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-menu__item-desc {
  font-size: 11px;
  color: var(--dock-muted);
  font-weight: 400;
}

.model-menu-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .model-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    border-radius: 16px 16px 0 0;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 310;
    padding: var(--space-2) var(--space-4) var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0));
    animation: sheetSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
  }

  .model-menu__item {
    min-height: 48px;
    white-space: normal;
  }

  .model-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 309;
    background: rgba(0, 0, 0, 0.4);
  }

  @keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}

/* Popover (above dock) */
.prompt-dock__popover {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-lg);
  animation: fadeSlideUp 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* Active state for translate button */
.prompt-dock__icon-btn--active {
  color: var(--dock-green, #A1FF62) !important;
  background: rgba(161, 255, 98, 0.1);
}

/* Compact translation applied bar */
.prompt-dock__translation-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: rgba(161, 255, 98, 0.06);
  border: 1px solid rgba(161, 255, 98, 0.15);
  border-radius: 10px;
  animation: fadeSlideUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.prompt-dock__translation-bar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(161, 255, 98, 0.15);
  color: var(--dock-green, #A1FF62);
  flex-shrink: 0;
}

.prompt-dock__translation-bar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dock-green, #A1FF62);
  flex-shrink: 0;
}

.prompt-dock__translation-bar-text {
  font-size: 13px;
  color: var(--dock-text-dim, #8A8686);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.prompt-dock__translation-bar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--dock-text-dim, #8A8686);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.prompt-dock__translation-bar-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--dock-text, #E8E5E5);
}

/* ============================================
   @MENTION AUTOCOMPLETE DROPDOWN
   ============================================ */
.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: var(--space-3);
  right: var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow:
    0 12px 40px rgba(32, 29, 29, 0.12),
    0 4px 12px rgba(32, 29, 29, 0.06);
  max-height: 320px;
  overflow-y: auto;
  z-index: 20;
  animation: mentionReveal 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  overscroll-behavior: contain;
}

.mention-dropdown::-webkit-scrollbar {
  width: 4px;
}

.mention-dropdown::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

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

.mention-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px var(--space-4);
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.mention-item:last-child {
  border-bottom: none;
}

.mention-item:first-child {
  border-radius: 16px 16px 0 0;
}

.mention-item:last-child {
  border-radius: 0 0 16px 16px;
}

.mention-item:only-child {
  border-radius: 16px;
}

.mention-item:hover,
.mention-item--active {
  background: var(--color-accent-light);
}

.mention-item--active {
  background: var(--color-accent-muted);
}

.mention-item__image {
  width: 36px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.mention-item__image--empty {
  width: 36px;
  height: 48px;
  background: linear-gradient(135deg, var(--color-bg-sunken) 0%, var(--color-border) 100%);
  border: 1px solid var(--color-border);
}

.mention-item__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.mention-item__name {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.mention-item__mention {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: var(--font-weight-medium);
  opacity: 0.8;
}

/* Legacy prompt-box */
.prompt-box { display: none; }

/* ============================================
   SETTINGS BAR (Model, Ratio, Resolution, etc.)
   ============================================ */
.settings-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}

.settings-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.settings-group__label {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.settings-chips {
  display: flex;
  gap: var(--space-1);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 40px;
  text-align: center;
}

.chip:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.chip--active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text-on-accent);
}

.chip--active:hover {
  background: var(--color-accent-hover);
  color: var(--color-text-on-accent);
}

.settings-divider {
  width: 1px;
  height: 28px;
  background: var(--color-border);
}

/* ============================================
   GALLERY GRID (JS masonry)
   ============================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 4px;
  gap: 12px;
  width: 100%;
}

@media (max-width: 1400px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1200px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .gallery-grid {
    display: block;
    columns: 2;
    column-gap: 4px;
  }
}
@media (max-width: 480px) {
  .gallery-grid {
    gap: 3px;
  }
}

.gallery-sentinel {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}

.gallery-sentinel__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-border, rgba(255,255,255,0.1));
  border-top-color: var(--color-accent, #fff);
  border-radius: 50%;
  animation: sentinelSpin 0.7s linear infinite;
}

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

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

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

.result-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-bg-sunken);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(32, 29, 29, 0.15);
}

.result-card__image {
  width: 100%;
  display: block;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--color-bg-sunken);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.result-card__image.loaded {
  opacity: 1;
}

.result-card:hover .result-card__image {
  transform: scale(1.03);
}

/* Hover overlay with action buttons */
.result-card__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
  pointer-events: none;
}

.result-card:hover .result-card__overlay {
  opacity: 1;
  pointer-events: auto;
}

.result-card__btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.result-card__btn:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.1);
}

.result-card__btn--saved {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  pointer-events: none;
}

.result-card__btn--delete:hover {
  background: rgba(239, 68, 68, 0.8);
}

/* Drag feedback */
.result-card[draggable="true"] {
  cursor: grab;
}

.result-card[draggable="true"]:active {
  cursor: grabbing;
}

.prompt-dock--dragover {
  outline: 2px dashed var(--color-primary);
  outline-offset: -2px;
}

.result-card--video[draggable="true"] {
  cursor: grab;
}

.result-card--video[draggable="true"]:active {
  cursor: grabbing;
}

.frame-slot.slot--dragover,
.motion-slot.slot--dragover {
  border-color: var(--color-success, #22c55e);
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  animation: fadeIn 0.2s ease;
}

.lightbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
}

.lightbox__image {
  max-width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  max-height: calc(90vh - 140px);
  border-radius: var(--radius-lg);
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.lightbox__video {
  min-height: 0;
  flex: 1 1 auto;
  max-height: calc(90vh - 140px);
}

.lightbox__prompt {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
  max-width: 600px;
  text-align: center;
  line-height: var(--leading-relaxed);
}

.lightbox__details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 640px;
  width: 100%;
  flex-shrink: 0;
}

.lightbox__details-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.lightbox__details-shimmer {
  height: 12px;
  width: 60%;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.lightbox__details-shimmer--short {
  width: 35%;
}

.lightbox__tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.lightbox__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}

.lightbox__tag--prompt {
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox__tag--prompt:hover {
  background: rgba(255, 255, 255, 0.15);
}

.lightbox__tag-label {
  color: rgba(255, 255, 255, 0.45);
}

.lightbox__meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-mono, "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace);
  letter-spacing: 0.02em;
}

/* Prompt popup overlay */
.lightbox__prompt-popup {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

.lightbox__prompt-popup-content {
  position: relative;
  max-width: 560px;
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 20px 24px;
  padding-right: 72px;
}

.lightbox__prompt-popup-text {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.85);
  line-height: var(--leading-relaxed);
  word-break: break-word;
  white-space: pre-wrap;
}

.lightbox__prompt-popup-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
}

.lightbox__prompt-popup-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lightbox__prompt-popup-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

/* Lightbox details mobile styles moved to unified mobile block below */

.lightbox__actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  animation: fadeSlideUp 0.25s ease 0.1s both;
}

.lightbox__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 8px;
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.lightbox__action:hover {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  transform: translateY(-1px);
}

.lightbox__action--primary {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary);
}

.lightbox__action--primary:hover {
  background: var(--color-primary-hover);
  color: var(--color-text-on-primary);
  box-shadow: 0 4px 16px rgba(161, 255, 98, 0.3);
}

.lightbox__action--close {
  padding: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
}

.lightbox__action--close:hover {
  background: rgba(239, 68, 68, 0.6);
}

.lightbox__action--delete:hover {
  background: rgba(239, 68, 68, 0.6);
  color: white;
}

.lightbox__action--saved {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary);
  pointer-events: none;
}

.lightbox__action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.lightbox__nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  z-index: calc(var(--z-modal-overlay) + 1);
  transition: all 0.2s ease;
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.08);
}

.lightbox__nav--prev { left: var(--space-6); }
.lightbox__nav--next { right: var(--space-6); }

.lightbox__toolbar {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  right: 0;
  z-index: 10;
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}

.lightbox__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
}

.lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Lightbox mobile styles moved to unified mobile block below */

/* Error state for result cards */
.result-card--error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 180px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0%, rgba(245, 158, 11, 0.01) 100%);
  text-align: center;
  padding: var(--space-4);
}

.result-card__error-icon {
  color: #f59e0b;
  opacity: 0.85;
}

.result-card__error-text {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  max-width: 220px;
  word-break: break-word;
  color: var(--color-text-secondary);
}

.result-card__error-refund {
  font-size: 11px;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 4px;
}

.result-card__error-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
}

.result-card__error-btn {
  min-height: 44px;
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.result-card__error-btn:hover { opacity: 0.8; }

.result-card__error-btn--primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.result-card__error-btn--primary:hover {
  transform: scale(1.03);
  box-shadow: 0 0 12px rgba(var(--color-accent-rgb, 99, 102, 241), 0.3);
  opacity: 1;
}

.result-card__error-btn--ghost {
  background: transparent;
}

.result-card__cancel-btn {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 2;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.result-card--loading:hover .result-card__cancel-btn { opacity: 1; }

/* Loading skeleton for result cards */
.result-card--loading {
  overflow: hidden;
  border: 1px solid var(--color-border);
  min-height: 280px;
}

.result-card--loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: loadingSpin 0.8s linear infinite;
  z-index: 1;
}

.result-card--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    var(--color-bg-sunken) 30%,
    rgba(104, 64, 255, 0.04) 50%,
    var(--color-bg-sunken) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease infinite;
}

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

@keyframes loadingSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Gallery card entry animation */
/* Card entry handled by .masonry-ready opacity transition */

/* ============================================
   ELEMENTS GRID
   ============================================ */
.elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}

.element-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}

.element-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.element-card__image {
  aspect-ratio: 1;
  background: var(--color-bg-sunken);
  overflow: hidden;
}

.element-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.element-card__body {
  padding: var(--space-3) var(--space-4);
}

.element-card__mention {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.element-card__name {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  margin-top: var(--space-1);
  color: var(--color-text);
}

.element-card__type {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  animation: fadeIn var(--transition-base) ease;
}

.modal {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: var(--z-modal);
  animation: slideUp var(--transition-spring) ease;
  box-shadow: var(--shadow-xl);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.modal__title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
}

.modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-tertiary);
  transition: all var(--transition-fast);
}

.modal__close:hover {
  background: var(--color-bg-sunken);
  color: var(--color-text);
}

.modal__body {
  padding: var(--space-6);
}

.modal__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideInRight var(--transition-spring) ease;
  max-width: 400px;
}

.toast--success { border-left: 3px solid var(--color-success); }
.toast--error { border-left: 3px solid var(--color-error); }
.toast--warning { border-left: 3px solid var(--color-warning); }
.toast--info { border-left: 3px solid var(--color-info); }

.toast__message {
  font-size: var(--text-sm);
  flex: 1;
}

.toast__close {
  color: var(--color-text-tertiary);
  cursor: pointer;
  padding: var(--space-1);
}

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

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-full);
  line-height: 1.5;
}

.badge--success { background: rgba(34, 197, 94, 0.12); color: var(--color-success); }
.badge--warning { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); }
.badge--error { background: rgba(239, 68, 68, 0.12); color: var(--color-error); }
.badge--accent { background: var(--color-accent-muted); color: var(--color-accent); }
.badge--primary { background: var(--color-primary-muted); color: #4a7a20; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  position: relative;
}

.empty-state--centered {
  flex: 1;
  min-height: 300px;
}

.empty-state__glow {
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(104, 64, 255, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -60%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
}

.empty-state__icon {
  width: 80px;
  height: 80px;
  background: var(--color-accent-muted);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
  position: relative;
  z-index: 1;
  animation: iconFloat 3s ease-in-out infinite;
}

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

.empty-state__icon svg {
  width: 40px;
  height: 40px;
  color: var(--color-accent);
}

.empty-state__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-3);
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}

.empty-state__description {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  max-width: 400px;
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
  position: relative;
  z-index: 1;
}

.empty-state__kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  vertical-align: middle;
}

/* ============================================
   PAGE-SPECIFIC: AUTH
   ============================================ */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-page__visual {
  background: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  position: relative;
  overflow: hidden;
}

.auth-page__visual::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
  opacity: 0.15;
  top: -100px;
  right: -100px;
  animation: floatSlow 8s ease-in-out infinite alternate;
}

.auth-page__visual::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent) 0%, transparent 70%);
  opacity: 0.1;
  bottom: -80px;
  left: -80px;
  animation: floatSlow 10s ease-in-out infinite alternate-reverse;
}

@keyframes floatSlow {
  from { transform: translate(0, 0); }
  to { transform: translate(30px, -30px); }
}

.auth-page__visual-content {
  color: var(--color-text-inverse);
  text-align: center;
  z-index: 1;
}

.auth-page__visual-content h1 {
  color: var(--color-text-inverse);
  font-size: var(--text-5xl);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}

.auth-page__visual-content p {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.6);
  max-width: 360px;
}

.auth-page__visual-content h1 a {
  color: inherit;
  text-decoration: none;
}

.auth-page__visual-content h1 a:hover {
  opacity: 0.8;
}

.auth-page__form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  position: relative;
}

.auth-back-link {
  position: absolute;
  top: var(--space-6);
  left: var(--space-6);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
}

.auth-back-link:hover {
  color: var(--color-text);
}

.auth-back-link svg {
  flex-shrink: 0;
}

.auth-form {
  width: 100%;
  max-width: 400px;
}

.auth-form__header {
  margin-bottom: var(--space-8);
}

.auth-form__title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}

.auth-form__subtitle {
  color: var(--color-text-secondary);
}

.auth-form__fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.auth-form__footer {
  margin-top: var(--space-6);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.spinner--lg { width: 40px; height: 40px; border-width: 3px; }

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

/* ============================================
   FLASH MESSAGES (floating, auto-dismiss)
   ============================================ */
.flash-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  width: max-content;
  max-width: min(500px, calc(100vw - var(--space-8)));
}

.flash {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  pointer-events: auto;
  box-shadow: var(--shadow-lg);
  animation: flashSlideIn 0.3s ease forwards;
}

.flash--notice {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--color-success);
  backdrop-filter: blur(12px);
}

.flash--alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-error);
  backdrop-filter: blur(12px);
}

.flash--dismiss {
  animation: flashSlideOut 0.3s ease forwards;
}

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

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

/* ============================================
   RESPONSIVE
   ============================================ */

/* Desktop protection — sidebar & header always visible on ≥769px */
@media (min-width: 769px) {
  .app-sidebar {
    display: flex !important;
  }

  .sidebar-nav {
    display: flex !important;
  }

  .app-header {
    display: flex !important;
  }

  .mobile-bottom-bar,
  .nav-drawer,
  .nav-drawer-backdrop,
  .prompt-dock__menu-btn,
  .result-card__more-btn {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
  }

  .sidebar-logo__text,
  .sidebar-link span,
  .sidebar-nav__label {
    display: none;
  }

  .sidebar-link {
    justify-content: center;
    padding: var(--space-3);
  }

  .sidebar-logo {
    justify-content: center;
    padding: var(--space-5) var(--space-3);
  }

  .sidebar-theme-row__icon,
  .sidebar-theme-row__label {
    display: none;
  }

  .sidebar-theme-row {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "main";
  }

  .app-sidebar {
    display: none;
  }

  .app-header {
    display: none;
  }

  .app-main {
    padding: var(--space-3);
    padding-bottom: calc(env(safe-area-inset-bottom, 0) + var(--space-3));
    overscroll-behavior-y: contain;
  }

  .btn {
    white-space: normal;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-page__visual {
    display: none;
  }
}

/* ============================================
   UTILITIES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.text-center { text-align: center; }
.text-secondary { color: var(--color-text-secondary); }
.text-sm { font-size: var(--text-sm); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   REFERENCE THUMBNAILS
   ============================================ */
/* Legacy - replaced by .prompt-dock__references */

.reference-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-thumb__remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.reference-thumb__remove:hover {
  background: var(--color-error);
}

/* ============================================
   TOAST TRANSITIONS
   ============================================ */
.toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.toast--hiding {
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

/* ============================================
   SAVED RESULT STATE
   ============================================ */
.result-card__action--saved {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  pointer-events: none;
}

/* ============================================
   UPLOAD DROPZONE
   ============================================ */
.upload-dropzone {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-dropzone:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.upload-dropzone--active {
  border-color: var(--color-accent);
  background: var(--color-accent-muted);
  border-style: solid;
}

.upload-dropzone__preview img {
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.upload-dropzone__placeholder svg {
  opacity: 0.6;
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle__input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--color-bg-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
}

.toggle__slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  bottom: 2px;
  background: var(--color-bg-elevated);
  border-radius: 50%;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.toggle__input:checked + .toggle__slider {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.toggle__input:checked + .toggle__slider::before {
  transform: translateX(22px);
}

/* Toggle — dark theme: make unchecked state visible */
[data-theme="dark"] .toggle__slider {
  background: #3D3939;
  border-color: #4A4545;
}

[data-theme="dark"] .toggle__slider::before {
  background: #A09C9C;
}

[data-theme="dark"] .toggle__input:checked + .toggle__slider::before {
  background: #FFFFFF;
}

/* ============================================
   VIDEO GRID & CARDS
   ============================================ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
  width: 100%;
}

.video-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-bg-sunken);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.video-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(32, 29, 29, 0.15);
}

.video-card__video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--color-bg-sunken);
}

.video-card__overlay {
  position: absolute;
  top: 0;
  right: 0;
  padding: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.video-card:hover .video-card__overlay {
  opacity: 1;
  pointer-events: auto;
}

.video-card__prompt {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Loading state */
.video-card--loading {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-sunken);
  position: relative;
  overflow: hidden;
}

.video-card--loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

.video-card__loading-text {
  font-size: 13px;
  color: var(--color-text-tertiary);
  z-index: 1;
}

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

/* ============================================
   MOTION SLOTS (Kling Motion Control)
   ============================================ */
.motion-slots,
.avatar-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 6px;
  margin: 0 auto;
  max-width: min(420px, 100%);
}

.motion-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex: 1;
  max-width: 180px;
}

.motion-slot__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 90px;
  background: var(--dock-hover);
  border: 1.5px dashed var(--color-primary);
  border-radius: 12px;
  color: var(--dock-text-dim);
  transition: all 0.15s ease;
  position: relative;
}

.motion-slot__placeholder span {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.motion-slot__placeholder small {
  font-size: 9px;
  opacity: 0.6;
  text-align: center;
  line-height: 1.3;
  padding: 0 8px;
}

.motion-slot:hover .motion-slot__placeholder {
  border-color: var(--color-primary-hover);
  color: var(--dock-text);
  background: rgba(161, 255, 98, 0.08);
}

.motion-slot__placeholder--loading {
  opacity: 0.5;
  pointer-events: none;
}

.motion-slot__placeholder--loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--dock-border);
  border-top-color: var(--dock-green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.motion-slot__preview {
  position: relative;
  width: 100%;
  height: 90px;
  border: 1.5px solid var(--color-primary);
  border-radius: 12px;
  overflow: hidden;
}

.motion-slot__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.motion-slot__video-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.motion-slot__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.motion-slot__remove:hover {
  background: var(--color-error);
}

.motion-slots__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dock-text-dim);
  flex-shrink: 0;
  padding-bottom: 0;
}

/* ============================================
   KLING 2.6 IMAGE SLOT
   ============================================ */
.kling-image-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 6px;
  margin: 0 auto;
  max-width: 200px;
}

.kling-image-slot .motion-slot {
  max-width: 200px;
}

/* Sound toggle active state */
.prompt-dock__setting--sound-active {
  color: var(--dock-green);
}

.prompt-dock__setting--sound-active svg {
  color: var(--dock-green);
}

/* Icon-only toggle buttons (compact) */
.prompt-dock__setting--icon-toggle {
  padding: 4px 6px;
}

/* Multi-Shot button */
.prompt-dock__setting--multi-shot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
}

.prompt-dock__setting--multi-shot-active {
  color: var(--dock-green);
  border-color: var(--dock-green);
}

.prompt-dock__info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: var(--dock-text-dim);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.prompt-dock__info-btn:hover {
  color: var(--dock-text);
}

.multi-shot-info-tooltip {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  z-index: 100;
  margin-bottom: var(--space-2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Multi-Shot Panel */
.multi-shot-panel {
  padding: var(--space-3) 0;
}

.multi-shot-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}

.multi-shot-item__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.multi-shot-item__number {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  flex-shrink: 0;
}

.multi-shot-item__duration {
  font-size: var(--text-xs);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  cursor: pointer;
}

.multi-shot-item__remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.multi-shot-item__remove:hover {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.1);
}

.multi-shot-item__prompt {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.4;
  resize: none;
  min-height: 48px;
  padding: 0;
}

.multi-shot-item__prompt::placeholder {
  color: var(--color-text-tertiary);
}

.multi-shot-item__char-count {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-align: right;
}

.multi-shot-item__char-count--over {
  color: var(--color-error);
  font-weight: 600;
}

.multi-shot-panel__add {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  width: 100%;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}

.multi-shot-panel__add:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.multi-shot-panel__total {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  text-align: center;
  padding: var(--space-1) 0;
}

.multi-shot-panel__total--over {
  color: var(--color-error);
  font-weight: 600;
}

/* Kling Elements Panel */
.kling-elements-panel {
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-2);
}

.kling-elements-panel__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  position: relative;
}

.kling-elements-panel__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.kling-elements-panel__add {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  width: 100%;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}

.kling-elements-panel__add:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Element card */
.kling-element-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}

.kling-element-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.kling-element-card__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.kling-element-card__remove {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.kling-element-card__remove:hover {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.1);
}

.kling-element-card__field {
  margin-bottom: var(--space-2);
}

.kling-element-card__label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-bottom: 2px;
}

.kling-element-card__input {
  width: 100%;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-2);
  outline: none;
}

.kling-element-card__input:focus {
  border-color: var(--color-primary);
}

.kling-element-card__photos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.kling-element-card__photo {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.kling-element-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kling-element-card__photo-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--color-error);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kling-element-card__photo-add {
  width: 48px;
  height: 48px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-tertiary);
  gap: 1px;
  font-size: var(--text-xs);
  transition: border-color 0.15s;
}

.kling-element-card__photo-add:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.kling-element-card__photo-add span {
  font-size: 16px;
  line-height: 1;
}

.kling-element-card__photo-count {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  width: 100%;
  margin-top: var(--space-1);
}

.kling-element-card__photo-count--warn {
  color: var(--color-warning);
}

/* Elements page tabs */
.elements-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.elements-tabs__tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.elements-tabs__tab:hover {
  color: var(--color-text);
}

.elements-tabs__tab--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Element card photo badge */
.element-card__photo-badge {
  position: absolute;
  bottom: var(--space-1);
  right: var(--space-1);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

/* Kling photos grid (edit page) */
.kling-photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.kling-photos-grid__item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.kling-photos-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kling-photos-grid__remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Kling Elements Picker (in video dock) */
.kling-elements-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.kling-elements-picker__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}

.kling-elements-picker__item:hover {
  background: var(--color-bg);
}

.kling-elements-picker__checkbox {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}

.kling-elements-picker__thumb {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.kling-elements-picker__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.kling-elements-picker__name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.kling-elements-picker__count {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.kling-elements-panel__selected {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  text-align: center;
  padding: var(--space-1) 0;
}

.kling-elements-panel__create-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-primary);
  text-decoration: none;
  padding: var(--space-2) 0;
  justify-content: center;
}

.kling-elements-panel__create-link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .multi-shot-panel {
    padding: var(--space-2) 0;
  }
  .multi-shot-item {
    padding: var(--space-2);
  }
  .multi-shot-item__prompt {
    min-height: 44px;
    font-size: var(--text-sm);
  }
  .multi-shot-info-tooltip {
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-3);
  }
  .kling-element-card {
    padding: var(--space-2);
  }
  .kling-element-card__photo {
    width: 40px;
    height: 40px;
  }
  .kling-element-card__photo-add {
    width: 40px;
    height: 40px;
  }
}

/* Prompt hint chips (avatar, seedance lip-sync) */
.avatar-prompt-hints {
  display: flex;
  gap: 6px;
  padding: 0 12px 6px;
  flex-wrap: wrap;
}

.avatar-prompt-hints__chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-family: var(--font-body);
  font-weight: var(--font-weight-medium);
  color: var(--dock-text-dim);
  background: var(--dock-hover);
  border: 1px solid var(--dock-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.avatar-prompt-hints__chip:hover {
  color: var(--dock-green);
  border-color: var(--dock-green);
  background: rgba(161, 255, 98, 0.08);
}

/* Seedance image slots */
.seedance-image-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px 0 6px;
  margin: 0 auto;
  max-width: min(440px, 100%);
}

.seedance-image-slots .motion-slot {
  max-width: 200px;
}

/* =====================================================
   SEEDANCE 2 — mode toggle (frames vs references)
   ===================================================== */
.s2-mode-toggle-wrap {
  display: flex;
  flex-direction: column;
  margin: 10px 12px 2px;
}

.s2-mode-toggle {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--dock-hover);
  border: none;
  border-radius: 10px;
}

.s2-mode-toggle__btn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 11px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--dock-text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: var(--font-body);
  font-feature-settings: "case", "ss01", "cv11";
  text-align: left;
}

.s2-mode-toggle__btn > svg {
  flex-shrink: 0;
  margin-bottom: 2px;
}

.s2-mode-toggle__btn .s2-mode-toggle__label {
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
  color: var(--dock-text);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.s2-mode-toggle__btn > small {
  font-size: 10.5px;
  line-height: 1.35;
  font-weight: var(--font-weight-normal);
  color: rgba(255, 255, 255, 0.48);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.s2-mode-toggle__btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.s2-mode-toggle__btn--active {
  background: rgba(161, 255, 98, 0.12);
  color: var(--dock-green);
}

.s2-mode-toggle__btn--active .s2-mode-toggle__label {
  color: var(--dock-green);
}

.s2-mode-toggle__btn--active > small {
  color: rgba(161, 255, 98, 0.7);
}

/* -----------------------------------------------------
   Mode help button — inline link style (no bg, no border).
   Sits quietly under the toggle, only visible on hover.
   ----------------------------------------------------- */
.s2-mode-help-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 7px 0 2px 2px;
  padding: 2px 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: var(--font-weight-normal);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.15s ease;
}

.s2-mode-help-btn:hover,
.s2-mode-help-btn--open {
  color: var(--dock-green);
}

.s2-mode-help-btn svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* -----------------------------------------------------
   Mode help card (two blocks side-by-side explaining
   frames and references modes)
   ----------------------------------------------------- */
.s2-mode-help-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(44, 43, 43, 0.98) 0%, rgba(28, 27, 27, 0.98) 100%);
  border: 1px solid var(--dock-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: s2HelpIn 0.18s ease-out;
}

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

.s2-mode-help-card__block {
  position: relative;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--dock-border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-feature-settings: "case", "ss01", "cv11";
}

.s2-mode-help-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  color: var(--dock-green);
  letter-spacing: -0.002em;
}

.s2-mode-help-card__head svg {
  flex-shrink: 0;
}

.s2-mode-help-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: -0.001em;
}

.s2-mode-help-card p + p {
  margin-top: 7px;
}

.s2-mode-help-card p strong {
  color: rgba(255, 255, 255, 0.96);
  font-weight: var(--font-weight-medium);
}

.s2-mode-help-card em {
  font-style: normal;
  color: var(--dock-green);
  font-weight: var(--font-weight-medium);
}

.s2-mode-help-card__note {
  margin-top: 10px !important;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 11.5px !important;
  color: rgba(255, 255, 255, 0.58) !important;
}

/* =====================================================
   SEEDANCE 2 — frames mode block (2 image slots)
   ===================================================== */
.s2-frames-block {
  margin: 8px 12px 4px;
}

.motion-slots--s2-frames {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 6px 0 4px;
  margin: 0 auto;
  max-width: min(440px, 100%);
}

.motion-slot--s2-frame {
  max-width: 180px;
  flex: 1;
}

/* =====================================================
   SEEDANCE 2 — references tabs (фото / видео / аудио)
   ===================================================== */
.s2-references-block {
  margin: 8px 12px 4px;
}

.s2-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--dock-hover);
  border: none;
  border-radius: 10px;
  margin-bottom: 8px;
}

.s2-tab {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--dock-text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: var(--font-body);
  font-feature-settings: "case", "ss01", "cv11";
  font-size: 11.5px;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.s2-tab__icon {
  font-size: 13px;
  line-height: 1;
}

/* Counter inside tab — just dimmed text, no pill/box */
.s2-tab__counter {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  padding: 0;
  margin-left: 2px;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.55;
  letter-spacing: 0.01em;
}

.s2-tab:hover {
  color: var(--dock-text);
  background: rgba(255, 255, 255, 0.04);
}

.s2-tab--active {
  background: rgba(161, 255, 98, 0.12);
  color: var(--dock-green);
}

.s2-tab--active .s2-tab__counter {
  opacity: 0.75;
}

.s2-inline-counter {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--dock-text-dim);
}

.s2-inline-counter.dock-section__counter--over {
  color: var(--color-error);
  background: rgba(255, 80, 80, 0.12);
}

/* ============================================
   SEEDANCE 2 REFERENCE SLOTS & SLIDER
   ============================================ */
/* Reuses .motion-slots/.motion-slot base; adds tighter sizing for 3 videos + 1 audio row */
.motion-slots--s2 {
  flex-wrap: wrap;
  max-width: min(560px, 100%);
  gap: 8px;
  row-gap: 4px;
}

.motion-slots--s2 .motion-slot {
  max-width: 120px;
  flex: 1 1 110px;
}

.motion-slots--s2 .motion-slot__placeholder {
  height: 72px;
  gap: 3px;
}

.motion-slots--s2 .motion-slot__placeholder span {
  font-size: 11px;
}

.motion-slots--s2 .motion-slot__placeholder small {
  font-size: 8px;
  padding: 0 4px;
}

.motion-slots--s2 .motion-slot__preview {
  height: 72px;
}

/* Video preview: full-cover thumbnail with duration badge + remove button */
.s2-ref-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  background: #000;
}

.s2-ref-duration {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: var(--font-weight-medium);
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 999px;
  pointer-events: none;
}

.s2-ref-audio {
  width: 100%;
  height: 28px;
}

.s2-ref-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.s2-ref-remove:hover {
  background: var(--color-error);
}

/* Duration slider inside the settings bar */
.prompt-dock__setting--slider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  color: var(--dock-text);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.prompt-dock__setting--slider svg {
  flex-shrink: 0;
  color: var(--dock-text-dim);
}

.s2-duration-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 84px;
  height: 4px;
  background: var(--dock-border);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  margin: 0;
}

.s2-duration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--color-primary);
  border: 2px solid var(--color-bg);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.s2-duration-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.s2-duration-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--color-primary);
  border: 2px solid var(--color-bg);
  border-radius: 50%;
  cursor: pointer;
}

.s2-duration-slider::-moz-range-track {
  height: 4px;
  background: var(--dock-border);
  border-radius: 999px;
}

/* =====================================================
   DOCK SECTION (reusable: Seedance 2 — and future models)
   ===================================================== */
.dock-section {
  margin: 10px 12px 4px;
  padding: 0;
}

.dock-section__header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  position: relative;
  min-height: 22px;
}

.dock-section__icon {
  font-size: 14px;
  line-height: 1;
}

.dock-section__title {
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--dock-text);
  letter-spacing: 0.01em;
}

.dock-section__badge {
  font-size: 9px;
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dock-text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--dock-border);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}

.dock-section__counter {
  margin-left: auto;
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  color: var(--dock-text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dock-section__counter--over {
  color: var(--color-error);
}

.dock-section__tooltip {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--color-bg-elevated);
  border: 1px solid var(--dock-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--dock-text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  z-index: 20;
}

.dock-section__tooltip strong {
  color: var(--dock-green);
  font-weight: var(--font-weight-semibold);
}

/* -----------------------------------------------------
   Dock section hint — clean floating text, no box.
   Gemini review: removing the bordered pill + green accent bar
   lets hint visually belong to the content below (slots) instead
   of being a separate "blockquote" island. Minimizes visual noise.
   Typography:
     - Golos Text with ss01/cv11/case OpenType features
     - 12.5px / 1.55 line-height — comfortable Cyrillic reading
     - letter-spacing 0.02em — counters dark-bg irradiation on small text
     - color 0.68 alpha — audible but secondary
   ----------------------------------------------------- */
.dock-section__hint {
  display: block;
  margin: 2px 2px 12px;
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-feature-settings: "case", "ss01", "cv11";
  font-size: 12.5px;
  line-height: 1.55;
  font-weight: var(--font-weight-normal);
  color: rgba(255, 255, 255, 0.68);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.dock-section__hint strong {
  color: rgba(255, 255, 255, 0.94);
  font-weight: var(--font-weight-semibold);
}

/* -----------------------------------------------------
   Token pill — used for @Image1, @persona_имя, @element_имя
   and similar system tokens inline in hint text.
   Designed as inline code, NOT as a button: no border,
   subtle translucent green bg, salatovy text, normal weight.
   Distinct enough to read as "variable" but doesn't shout.
   ----------------------------------------------------- */
.token {
  display: inline;
  padding: 0 5px;
  margin: 0 1px;
  background: rgba(161, 255, 98, 0.08);
  border: none;
  border-radius: 4px;
  color: #B6F588; /* light salatovy — good contrast on dock-bg */
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 11.5px;
  font-weight: var(--font-weight-normal);
  letter-spacing: 0;
  white-space: nowrap;
}

.dock-section__savings {
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  color: var(--dock-green);
  background: rgba(161, 255, 98, 0.08);
  border: 1px solid rgba(161, 255, 98, 0.22);
  border-radius: 8px;
  text-align: center;
}

/* =====================================================
   SEEDANCE 2 — photo reference slots (up to 9 — wraps to 2 rows)
   ===================================================== */
.s2-photo-slots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.s2-photo-slot {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  display: block;
}

.s2-photo-slot--empty {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}

.s2-photo-slot--empty:hover {
  border-color: rgba(161, 255, 98, 0.5);
  border-style: dashed;
  color: var(--color-primary);
  background: rgba(161, 255, 98, 0.05);
}

.s2-photo-slot--filled {
  border: 1.5px solid var(--color-primary);
}

.s2-photo-slot--filled img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.s2-photo-slot__label {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: var(--font-weight-medium);
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 999px;
  pointer-events: none;
}

.s2-photo-slot__remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.s2-photo-slot__remove:hover {
  background: var(--color-error);
}

/* =====================================================
   SEEDANCE 2 — audio reference slots (3 in a row)
   ===================================================== */
.s2-audio-slots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.s2-audio-slot {
  display: block;
  cursor: pointer;
  flex: 1 1 180px;
  min-width: 0;
  max-width: 260px;
}

.s2-audio-slot__placeholder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--dock-hover);
  border: 1.5px dashed var(--color-primary);
  border-radius: 10px;
  transition: all 0.15s ease;
  color: var(--dock-text-dim);
  height: 44px;
  box-sizing: border-box;
}

.s2-audio-slot__placeholder > svg {
  flex-shrink: 0;
  color: var(--dock-green);
}

.s2-audio-slot__placeholder span {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--dock-text);
}

.s2-audio-slot__placeholder small {
  font-size: 9px;
  opacity: 0.7;
  margin-left: auto;
  white-space: nowrap;
}

.s2-audio-slot:hover .s2-audio-slot__placeholder {
  border-color: var(--color-primary-hover);
  background: rgba(161, 255, 98, 0.08);
}

.s2-audio-slot__preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--dock-hover);
  border: 1.5px solid var(--color-primary);
  border-radius: 10px;
  position: relative;
  height: 44px;
  box-sizing: border-box;
}

.s2-audio-slot__preview audio {
  flex: 1;
  min-width: 0;
  height: 28px;
}

/* =====================================================
   Char-hint under textarea (Seedance 2 only)
   Flex row: label on the left, live character counter on the right.
   ===================================================== */
/* Char-hint container: FLEX is OK here because it has only 2 direct
   children — the label span (with text) and the counter span. Text
   inside .__label flows normally as inline (no flex inside label). */
.prompt-dock__char-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 2px 12px 0;
  padding: 6px 12px 6px 4px;
  font-family: var(--font-body);
  font-feature-settings: "case", "ss01", "cv11";
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.68);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.prompt-dock__char-hint__label {
  flex: 1 1 auto;
  min-width: 0;
  color: rgba(255, 255, 255, 0.58);
}

.prompt-dock__char-hint__label strong {
  color: rgba(255, 255, 255, 0.92);
  font-weight: var(--font-weight-semibold);
}

.prompt-dock__char-hint__counter {
  flex-shrink: 0;
  padding: 3px 9px;
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 10.5px;
  font-weight: var(--font-weight-medium);
  color: rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
}

.prompt-dock__char-hint__counter--over {
  color: #fff;
  background: rgba(231, 76, 60, 0.25);
  border-color: rgba(231, 76, 60, 0.55);
  animation: s2CounterShake 0.3s ease;
}

@keyframes s2CounterShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* Mobile: shrink slider and hide web-search label in the dense row */
@media (max-width: 640px) {
  .motion-slots--s2 {
    max-width: 100%;
  }
  .motion-slots--s2 .motion-slot {
    max-width: 96px;
    flex: 1 1 80px;
  }
  .motion-slots--s2 .motion-slot__placeholder,
  .motion-slots--s2 .motion-slot__preview {
    height: 64px;
  }
  .motion-slots--s2 .motion-slot__placeholder small {
    display: none;
  }
  .s2-duration-slider {
    width: 64px;
  }
  .dock-section {
    margin: 8px 10px 4px;
  }
  .s2-photo-slot {
    width: 54px;
    height: 54px;
  }
  .dock-section__hint {
    padding: 9px 12px 9px 20px;
    font-size: 12px;
    line-height: 1.5;
  }
  .dock-section__hint::before {
    left: 9px;
    width: 2.5px;
  }
  .s2-audio-slot__placeholder small {
    display: none;
  }
  .s2-mode-toggle-wrap {
    margin: 8px 10px 2px;
  }
  .s2-mode-toggle__btn {
    padding: 8px 10px;
  }
  .s2-mode-toggle__btn .s2-mode-toggle__label {
    font-size: 12px;
  }
  .s2-mode-toggle__btn > small {
    font-size: 10px;
  }
  .s2-mode-help-btn {
    font-size: 11px;
    padding: 4px 9px;
  }
  .s2-mode-help-card {
    grid-template-columns: 1fr; /* stack on mobile */
    padding: 10px;
    gap: 8px;
  }
  .s2-mode-help-card__block {
    padding: 10px 12px;
  }
  .s2-mode-help-card__head {
    font-size: 12px;
  }
  .s2-mode-help-card p {
    font-size: 12px;
    line-height: 1.5;
  }
  .prompt-dock__char-hint {
    font-size: 11px;
    margin: 2px 10px 0;
    padding: 6px 10px 6px 2px;
  }
  .prompt-dock__char-hint__counter {
    font-size: 10.5px;
    padding: 2px 8px;
  }
  .s2-references-block,
  .s2-frames-block {
    margin: 6px 10px 2px;
  }
  .s2-tab {
    padding: 5px 6px;
    font-size: 10.5px;
    gap: 4px;
  }
  .s2-tab__label {
    display: none;
  }
  .s2-tab__icon {
    font-size: 14px;
  }
  .motion-slot--s2-frame {
    max-width: 140px;
  }
}

/* ============================================
   VIDEO CARDS IN MASONRY
   ============================================ */
.result-card--video {
  position: relative;
  cursor: pointer;
}

.result-card__video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  object-fit: cover;
  background: var(--color-bg-sunken);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.result-card__video.loaded {
  opacity: 1;
}

.result-card__video-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  pointer-events: none;
}

.result-card__prompt {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 10px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: white;
  font-size: 11px;
  line-height: 1.3;
  border-radius: 0 0 10px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.result-card--video:hover .result-card__prompt {
  opacity: 1;
}

.result-card--loading-video {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-card__loading-text {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
}

/* ============================================
   LIGHTBOX VIDEO
   ============================================ */
.lightbox__video {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 12px;
}

/* ============================================
   AUDIO TAB — Sub-tabs & Panels
   ============================================ */
.audio-subtabs {
  display: flex;
  gap: 4px;
  padding: 0 0 var(--space-3);
  border-bottom: 1px solid var(--dock-border);
  margin-bottom: var(--space-3);
  overflow-x: auto;
  scrollbar-width: none;
}

.audio-subtabs::-webkit-scrollbar { display: none; }

.audio-subtab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--dock-border);
  background: transparent;
  color: var(--dock-text-dim);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.audio-subtab:hover {
  background: var(--dock-hover);
  color: var(--dock-text);
  border-color: var(--dock-text-dim);
}

.audio-subtab--active {
  background: var(--dock-green);
  color: #1C1B1B;
  border-color: var(--dock-green);
}

.audio-subtab--active:hover {
  background: #B4FF80;
  color: #1C1B1B;
  border-color: #B4FF80;
}

.audio-subtab--active svg { stroke: #1C1B1B; }

/* Audio panel (shared) */
.audio-panel__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.audio-panel__textarea {
  width: 100%;
  background: transparent;
  border: 1px solid var(--dock-border);
  border-radius: var(--radius-md);
  outline: none;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--dock-text);
  resize: vertical;
  padding: var(--space-3);
  min-height: 60px;
  max-height: 200px;
}

.audio-panel__textarea::placeholder {
  color: var(--dock-text-dim);
}

.audio-panel__textarea:focus {
  border-color: var(--dock-green);
}

.audio-panel__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  align-items: flex-end;
}

.audio-panel__controls--compact {
  gap: var(--space-2) var(--space-4);
}

.audio-panel__controls--row {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  flex-wrap: wrap;
}

.audio-panel__control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audio-panel__label {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--dock-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.audio-panel__select {
  padding: 5px 28px 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--dock-border);
  background: var(--dock-hover);
  color: var(--dock-text);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  appearance: auto;
  min-width: 120px;
}

.audio-panel__select--sm { min-width: 90px; }

.audio-panel__select--voice { min-width: 100px; flex: 1; }

/* Voice preview row */
.audio-panel__voice-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-panel__voice-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--dock-border);
  background: transparent;
  color: var(--dock-green);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.audio-panel__voice-preview:hover {
  background: var(--dock-green);
  color: #000;
  border-color: var(--dock-green);
}

.audio-panel__voice-preview:disabled {
  opacity: 0.5;
  cursor: wait;
}

.audio-panel__voice-preview-player {
  margin-top: 6px;
}

.audio-panel__voice-preview-audio {
  width: 100%;
  height: 32px;
  border-radius: 8px;
}

.audio-panel__input {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--dock-border);
  background: transparent;
  color: var(--dock-text);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
}

.audio-panel__input:focus {
  border-color: var(--dock-green);
}

.audio-panel__input--replica {
  flex: 1;
}

/* Toggle group (TTS model selector) */
.audio-panel__toggle-group {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--dock-border);
}

.audio-panel__toggle {
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--dock-text-dim);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all 0.15s ease;
}

.audio-panel__toggle:not(:last-child) {
  border-right: 1px solid var(--dock-border);
}

.audio-panel__toggle--active {
  background: var(--dock-green);
  color: #1C1B1B;
  font-weight: var(--font-weight-bold);
}

.audio-panel__toggle:hover:not(.audio-panel__toggle--active) {
  background: var(--dock-hover);
  color: var(--dock-text);
}

/* Sliders */
.audio-panel__sliders {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

.audio-panel__slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.audio-panel__slider-row--inline {
  flex: 1;
}

.audio-panel__slider-label {
  font-size: 11px;
  color: var(--dock-text-dim);
  white-space: nowrap;
  min-width: 130px;
}

.audio-panel__slider-label span {
  color: var(--dock-green);
  font-family: var(--font-mono);
  font-weight: var(--font-weight-semibold);
}

.audio-panel__slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--dock-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.audio-panel__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dock-green);
  border: 2px solid var(--dock-bg);
  cursor: pointer;
}

.audio-panel__slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dock-green);
  border: 2px solid var(--dock-bg);
  cursor: pointer;
}

/* Details/summary expandable */
.audio-panel__details {
  border: 1px solid var(--dock-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.audio-panel__summary {
  padding: var(--space-2) var(--space-3);
  font-size: 12px;
  font-weight: var(--font-weight-medium);
  color: var(--dock-text-dim);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.audio-panel__summary:hover { color: var(--dock-text); }

.audio-panel__details[open] .audio-panel__summary {
  border-bottom: 1px solid var(--dock-border);
}

.audio-panel__advanced {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.audio-panel__checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--dock-text-dim);
  cursor: pointer;
  white-space: nowrap;
}

.audio-panel__checkbox-label input[type="checkbox"] {
  accent-color: var(--dock-green);
}

/* Dialogue replicas */
.audio-panel__replicas {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audio-panel__replica {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-panel__replica-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--dock-text-dim);
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.audio-panel__replica-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-error);
}

.audio-panel__add-replica {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px dashed var(--dock-border);
  background: transparent;
  color: var(--dock-text-dim);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  align-self: flex-start;
}

.audio-panel__add-replica:hover {
  border-color: var(--dock-green);
  color: var(--dock-green);
}

.audio-panel__add-replica:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--dock-border);
  color: var(--dock-text-dim);
}

.audio-panel__replica-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.audio-panel__char-counter {
  font-size: 11px;
  color: var(--dock-text-dim);
  font-family: var(--font-mono, monospace);
}

.audio-panel__char-counter--over {
  color: var(--color-error);
  font-weight: 600;
}

/* Audio panel bar (bottom) */
.audio-panel__bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--dock-border);
}

.audio-panel__cost {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--dock-text-dim);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.audio-panel__cost span {
  color: var(--dock-green);
  font-weight: var(--font-weight-semibold);
}

/* Tags help (dialogue) */
.audio-panel__tags-help {
  padding: var(--space-2) var(--space-3);
  font-size: 11px;
  color: var(--dock-text-dim);
  line-height: 1.8;
}

.audio-panel__tags-help code {
  font-family: var(--font-mono);
  background: var(--dock-hover);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--dock-green);
  font-size: 11px;
}

/* ============================================
   AUDIO RESULT CARDS
   ============================================ */
.result-card--audio {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  position: relative;
  min-height: 120px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-card--audio:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.result-card__audio-icon {
  color: var(--color-accent);
  opacity: 0.6;
}

.result-card__audio-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  width: 100%;
  justify-content: center;
}

.result-card__audio-bar {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--color-accent-muted);
  animation: audioWave 1.5s ease-in-out infinite alternate;
}

.result-card__audio-bar:nth-child(odd) { height: 40%; }
.result-card__audio-bar:nth-child(even) { height: 70%; }
.result-card__audio-bar:nth-child(3n) { height: 100%; }
.result-card__audio-bar:nth-child(4n) { height: 55%; }
.result-card__audio-bar:nth-child(5n) { height: 85%; }

@keyframes audioWave {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.result-card__audio-player { display: none; }

.result-card__audio-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-accent-muted);
  color: var(--color-accent);
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-card--audio .result-card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-md);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.result-card--audio:hover .result-card__overlay {
  opacity: 1;
}

.result-card__btn--play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--dock-green);
  color: #1C1B1B;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* STT result card */
.result-card--stt {
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.result-card__stt-label {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  opacity: 0.7;
}

.result-card__stt-text {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--leading-relaxed);
  word-break: break-word;
}

/* ============================================
   AUDIO PAGE LAYOUT
   ============================================ */
.audio-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  height: 100%;
}

.audio-page__header {
  flex-shrink: 0;
}

.audio-page__results {
  flex: 1;
  overflow-y: auto;
}

/* Audio results grid */
.audio-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

/* Audio result card */
.audio-result-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all 0.2s ease;
}

.audio-result-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.audio-result-card--loading {
  opacity: 0.7;
}

.audio-result-card--failed {
  border-color: rgba(239, 68, 68, 0.3);
}

.audio-result-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.audio-result-card__badge {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--color-accent-muted);
  color: var(--color-accent);
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.audio-result-card__badge--error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.audio-result-card__date {
  font-size: 11px;
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
}

.audio-result-card__player {
  width: 100%;
}

.audio-result-card__audio {
  width: 100%;
  height: 36px;
  border-radius: 8px;
}

.audio-result-card__prompt {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  line-height: var(--leading-normal);
  word-break: break-word;
}

.audio-result-card__stt-text {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: var(--leading-relaxed);
  word-break: break-word;
  background: var(--color-bg-sunken);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
}

.audio-result-card__error {
  font-size: var(--text-sm);
  color: var(--color-error);
  line-height: var(--leading-normal);
}

.audio-result-card__actions {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.audio-result-card__action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.audio-result-card__action:hover {
  background: var(--color-bg-sunken);
  color: var(--color-text);
}

.audio-result-card__action--delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.audio-result-card__loading {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  padding: var(--space-4) 0;
}

.audio-result-card__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================
   ELEMENT MODAL (save from feed)
   ============================================ */
.element-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-element-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 0.2s ease;
}

.element-modal {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: var(--z-element-modal);
  animation: slideUp var(--transition-spring) ease;
  box-shadow: var(--shadow-xl);
}

.element-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.element-modal__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.element-modal__preview {
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: center;
  background: var(--color-bg-sunken);
}

.element-modal__preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.element-modal__form {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.element-modal__error {
  padding: var(--space-3) var(--space-4);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  color: var(--color-error);
  font-size: var(--text-sm);
}

.element-modal__product-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.element-modal__sizes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.element-modal__actions {
  display: flex;
  gap: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-2);
}

@media (max-width: 768px) {
  .element-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .element-modal {
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 85vh;
  }

  .element-modal__sizes {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   PERSONAS GRID (Index page)
   ============================================ */
.personas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}

.persona-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}

.persona-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.persona-card__avatar {
  aspect-ratio: 1;
  background: var(--color-bg-sunken);
  overflow: hidden;
}

.persona-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.persona-card__avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-muted);
}

.persona-card__body {
  padding: var(--space-3) var(--space-4);
}

.persona-card__mention {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.persona-card__name {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  margin-top: var(--space-1);
  color: var(--color-text);
}

.persona-card__count {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

/* ============================================
   PERSONA SHOW (Character Sheet)
   ============================================ */
.persona-show {
  max-width: var(--content-max-width);
}

.persona-show__back {
  margin-bottom: var(--space-4);
}

.persona-show__header {
  display: flex;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  align-items: flex-start;
}

.persona-show__avatar {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-bg-sunken);
  border: 2px solid var(--color-border);
}

.persona-show__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.persona-show__avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-muted);
}

.persona-show__info {
  flex: 1;
  min-width: 0;
}

.persona-show__info h2 {
  margin-bottom: var(--space-2);
}

.persona-show__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.persona-show__actions {
  display: flex;
  gap: var(--space-2);
}

.persona-show__category {
  margin-bottom: var(--space-6);
}

.persona-show__category-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.persona-show__photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

/* ============================================
   PERSONA PHOTO CARD
   ============================================ */
.persona-photo-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-sunken);
  border: 2px solid transparent;
  transition: all var(--transition-base);
}

.persona-photo-card--primary {
  border-color: var(--color-primary);
}

.persona-photo-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.persona-photo-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--space-1);
  padding: var(--space-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.persona-photo-card:hover .persona-photo-card__overlay {
  opacity: 1;
  pointer-events: auto;
}

.persona-photo-card__action {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.persona-photo-card__action:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.persona-photo-card__action--delete:hover {
  background: rgba(239, 68, 68, 0.6);
}

.persona-photo-card__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-1) var(--space-2);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: var(--text-xs);
  text-align: center;
  backdrop-filter: blur(4px);
}

.persona-photo-card__primary-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  color: var(--color-text-on-primary);
}

/* Add photo button card */
.persona-photo-card--add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--color-border);
  cursor: pointer;
  transition: all var(--transition-base);
}

.persona-photo-card--add:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.persona-photo-card__add-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: var(--space-3);
}

.persona-photo-card__add-label svg {
  opacity: 0.5;
}


/* ============================================
   MENTION DROPDOWN — Persona Badge
   ============================================ */
.badge--persona {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(104, 64, 255, 0.1);
  color: var(--color-accent);
  font-weight: var(--font-weight-medium);
}

/* ============================================
   PHOTO PICKER (Step 2 in mention dropdown)
   Horizontal columns layout — fixed height
   ============================================ */
.photo-picker {
  display: flex;
  flex-direction: column;
  max-height: 340px;
  width: auto;
}

.photo-picker__header {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.photo-picker__back {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: none;
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--space-1) 0;
}

.photo-picker__back:hover {
  color: var(--color-accent);
}

/* Horizontal columns container */
.photo-picker__columns {
  display: flex;
  gap: var(--space-3);
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: var(--space-3);
}

/* Each category = one column — fixed width thumbnails */
.photo-picker__column {
  display: flex;
  flex-direction: column;
  width: 130px;
  flex-shrink: 0;
  min-height: 0;
}

.photo-picker__category-label {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
  padding: 0 var(--space-1);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Photos inside a column — scrollable vertically */
.photo-picker__column-photos {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 0 var(--space-1);
}

.photo-picker__column-photos::-webkit-scrollbar {
  width: 3px;
}

.photo-picker__column-photos::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.photo-picker__item {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.photo-picker__item:hover {
  border-color: var(--color-accent);
}

.photo-picker__item--selected {
  border-color: var(--color-success);
}

.photo-picker__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-picker__check {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--color-success);
  display: none;
  align-items: center;
  justify-content: center;
}

.photo-picker__item--selected .photo-picker__check {
  display: flex;
}

.photo-picker__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1px 3px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 9px;
  text-align: center;
}

.photo-picker__empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
  width: 100%;
}

.photo-picker__footer {
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.photo-picker__confirm {
  width: 100%;
}

.photo-picker__confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* When photo picker is open, dropdown adapts */
.mention-dropdown:has(.photo-picker--horizontal) {
  max-height: none;
  overflow: visible;
  left: var(--space-3);
  right: auto;
  width: auto;
}

/* ============================================
   PERSONAS — Responsive
   ============================================ */
@media (max-width: 768px) {
  .persona-show__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .persona-show__avatar {
    width: 120px;
    height: 120px;
  }

  .persona-show__meta {
    justify-content: center;
  }

  .persona-show__actions {
    justify-content: center;
  }

  .persona-show__photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .personas-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* ============================================
   GUIDE PAGES — Model reference section
   ============================================ */

/* Reveal animation */
@keyframes guideReveal {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-guide-reveal-target="item"] {
  opacity: 0;
  transform: translateY(24px);
  transition: none;
}

[data-guide-reveal-target="item"].revealed {
  animation: guideReveal 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* --- Index page --- */
.guide-index {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.guide-index__header {
  margin-bottom: 40px;
}

.guide-index__title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
}

.guide-index__subtitle {
  font-size: 15px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Grid */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.guide-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
}

.guide-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.guide-card__initial {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 16px;
  flex-shrink: 0;
}

.guide-card__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.guide-card__body {
  flex: 1;
  min-height: 0;
}

.guide-card__name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 6px;
  line-height: 1.3;
}

.guide-card__description {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.guide-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.guide-card__badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

.guide-card__badge--фото {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

.guide-card__arrow {
  font-size: 18px;
  color: var(--color-text-tertiary);
  transition: transform 0.2s, color 0.2s;
}

.guide-card:hover .guide-card__arrow {
  transform: translateX(4px);
  color: var(--color-accent);
}

/* --- Show page --- */
.guide-show {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* Back link */
.guide-show__back {
  margin-bottom: 32px;
}

.guide-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.guide-back-link:hover {
  color: var(--color-text);
}

.guide-back-link svg {
  flex-shrink: 0;
}

/* Hero */
.guide-hero {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 48px 40px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.guide-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 60%;
  height: 180%;
  background: radial-gradient(ellipse, rgba(104, 64, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.guide-hero__content {
  position: relative;
  z-index: 1;
}

.guide-hero__logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 16px;
}

.guide-hero__badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--color-accent-muted);
  color: var(--color-accent);
  margin-bottom: 16px;
}

.guide-hero__title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 12px;
  line-height: 1.2;
}

.guide-hero__description {
  font-size: 16px;
  color: var(--color-text-secondary);
  margin: 0 0 28px;
  line-height: 1.6;
  max-width: 600px;
}

.guide-hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}

.guide-hero__cta:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.guide-hero__cta svg {
  flex-shrink: 0;
  transition: transform 0.15s;
}

.guide-hero__cta:hover svg {
  transform: translateX(3px);
}

/* Sections */
.guide-section {
  margin-bottom: 48px;
}

.guide-section__title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 20px;
}

.guide-section__text {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.guide-section__text p {
  margin: 0 0 16px;
}

.guide-section__text p:last-child {
  margin-bottom: 0;
}

/* Gallery */
.guide-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.guide-gallery__item {
}

.guide-gallery__video {
  width: 100%;
  border-radius: 12px;
  background: var(--color-bg-sunken);
  display: block;
}

.guide-gallery__image {
  width: 100%;
  border-radius: 12px;
  background: var(--color-bg-sunken);
  display: block;
  object-fit: cover;
}

/* Capabilities */
.guide-capabilities {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.guide-capability {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
}

.guide-capability--reverse .guide-capability__media {
  order: 2;
}

.guide-capability--reverse .guide-capability__text {
  order: 1;
}

.guide-capability__video {
  width: 100%;
  border-radius: 10px;
  background: var(--color-bg-sunken);
  display: block;
}

.guide-capability__image {
  width: 100%;
  border-radius: 10px;
  background: var(--color-bg-sunken);
  display: block;
  object-fit: cover;
}

.guide-capability__title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 10px;
  line-height: 1.3;
}

.guide-capability__description {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Tips */
.guide-tips {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guide-tip-card {
  display: flex;
  gap: 20px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  align-items: flex-start;
}

.guide-tip-card__number {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  flex-shrink: 0;
  min-width: 44px;
}

.guide-tip-card__content {
  flex: 1;
  min-width: 0;
}

.guide-tip-card__title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 6px;
}

.guide-tip-card__description {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* Use Cases */
.guide-use-cases {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.guide-use-case {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
}

.guide-use-case__title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 8px;
}

.guide-use-case__description {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* CTA */
.guide-cta {
  text-align: center;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 48px 40px;
  margin-top: 48px;
  position: relative;
  overflow: hidden;
}

.guide-cta::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(161, 255, 98, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.guide-cta__title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
  position: relative;
}

.guide-cta__text {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0 0 24px;
  position: relative;
}

.guide-cta__button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
  position: relative;
}

.guide-cta__button:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.guide-cta__button svg {
  flex-shrink: 0;
  transition: transform 0.15s;
}

.guide-cta__button:hover svg {
  transform: translateX(3px);
}

/* ============================================
   Templates gallery
   ============================================ */

.templates-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.templates-page__header {
  margin-bottom: 32px;
}

.templates-page__title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
}

.templates-page__subtitle {
  font-size: 15px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Category tabs */
.templates-page__tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.templates-tab {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text-secondary);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor: pointer;
}

.templates-tab:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.templates-tab--active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.templates-tab--active:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
}

/* Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Card */
.template-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
}

.template-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.template-card__preview {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--color-bg-tertiary);
}

.template-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.template-card:hover .template-card__image {
  transform: scale(1.04);
}

.template-card__body {
  padding: 16px 16px 0;
  flex: 1;
}

.template-card__name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 6px;
  line-height: 1.3;
}

.template-card__description {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-top: 12px;
  border-top: 1px solid var(--color-border);
}

.template-card__badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

.template-card__model {
  font-size: 11px;
  color: var(--color-text-tertiary);
  font-weight: 500;
}

/* Templates responsive */
@media (max-width: 768px) {
  .templates-page {
    padding: 32px 16px 60px;
  }

  .templates-page__title {
    font-size: 22px;
  }

  .templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }

  .templates-page__tabs {
    gap: 6px;
    margin-bottom: 24px;
  }
}

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

  .template-card__body {
    padding: 12px 12px 0;
  }

  .template-card__name {
    font-size: 13px;
  }

  .template-card__description {
    font-size: 12px;
    -webkit-line-clamp: 1;
  }

  .template-card__footer {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* --- Template Show Page --- */
.template-show {
  max-width: 1060px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.template-show__top {
  margin-bottom: 24px;
}

.template-show__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.template-show__back:hover {
  color: var(--color-text);
}

.template-show__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.template-show__preview {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-sunken);
  aspect-ratio: 3 / 4;
}

.template-show__preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.template-show__info {
  display: flex;
  flex-direction: column;
  padding-top: var(--space-4, 16px);
}

.template-show__header {
  margin-bottom: 28px;
}

.template-show__name {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  margin: 12px 0 8px;
  line-height: 1.2;
}

.template-show__description {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

.template-show__form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.template-show__section {
  padding: 24px 0;
  border-top: 1px solid var(--color-border);
}

.template-show__section-title {
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  margin: 0 0 16px;
}

.template-show__fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-show__image-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--color-bg-sunken);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.template-show__image-hint svg {
  flex-shrink: 0;
  color: var(--color-text-tertiary);
}

.template-show__steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-show__step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.template-show__step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-accent-muted);
  color: var(--color-accent);
  font-size: 12px;
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}

.template-show__photo-notice {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--color-bg-sunken);
  border-left: 3px solid var(--color-primary);
  border-radius: 8px;
  margin-top: 24px;
}

.template-show__photo-notice-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.template-show__photo-notice-text strong {
  display: block;
  font-size: var(--text-sm);
  margin-bottom: 4px;
}

.template-show__photo-notice-text p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

.template-show__photo-notice kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 12px;
  font-family: var(--font-mono, monospace);
  background: var(--color-bg-raised, #f5f5f5);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--color-border);
}

.template-show__photo-notice-sub {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-top: 6px;
}

.template-show__format-hint {
  font-size: 13px;
  color: var(--color-text-secondary);
  padding: 12px 16px;
  background: var(--color-bg-sunken);
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.template-show__format-hint-note {
  color: var(--color-text-tertiary);
  font-size: 12px;
}

/* Model selector */
.template-show__model-select {
  margin-top: 20px;
}

.template-show__model-select-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 10px;
}

.template-show__model-options {
  display: flex;
  gap: 10px;
}

.template-show__model-option {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.template-show__model-option:hover {
  border-color: var(--color-text-tertiary);
}

.template-show__model-option:has(:checked) {
  border-color: var(--color-accent, #6c5ce7);
  background: color-mix(in srgb, var(--color-accent, #6c5ce7) 6%, transparent);
}

.template-show__model-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.template-show__model-option-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.template-show__model-option-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.template-show__model-option-desc {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

@media (max-width: 480px) {
  .template-show__model-options {
    flex-direction: column;
  }
}

/* Custom template select */
.template-select {
  position: relative;
}

.template-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg-raised, var(--color-bg));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast);
  text-align: left;
}

.template-select__trigger:hover {
  border-color: var(--color-text-tertiary);
}

.template-select__trigger svg {
  flex-shrink: 0;
  color: var(--color-text-tertiary);
}

.template-select__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-raised, var(--color-bg));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 20;
  overflow: hidden;
}

.template-select__option {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.template-select__option:hover {
  background: var(--color-bg-sunken);
}

.template-show__form .btn--generate {
  margin-top: 28px;
}

/* Template photo reminder banner (gallery page) */
.template-photo-reminder {
  width: 100%;
  padding: 12px 16px;
  background: var(--color-primary);
  color: #000;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
}

.template-photo-reminder button {
  background: none;
  border: none;
  color: #000;
  font-size: 18px;
  margin-left: 8px;
  cursor: pointer;
}

/* Template show responsive */
@media (max-width: 768px) {
  .template-show {
    padding: 20px 16px 60px;
  }

  .template-show__layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .template-show__preview {
    aspect-ratio: 3 / 4;
    max-height: 480px;
  }

  .template-show__name {
    font-size: var(--text-xl);
  }
}

/* --- Mobile responsive --- */
@media (max-width: 768px) {
  .guide-index {
    padding: 32px 16px 60px;
  }

  .guide-index__title {
    font-size: 22px;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .guide-show {
    padding: 24px 16px 60px;
  }

  .guide-hero {
    padding: 32px 24px;
    border-radius: 16px;
  }

  .guide-hero__title {
    font-size: 24px;
  }

  .guide-hero__description {
    font-size: 14px;
  }

  .guide-section__title {
    font-size: 18px;
  }

  .guide-gallery {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .guide-capability {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .guide-capability--reverse .guide-capability__media {
    order: 0;
  }

  .guide-capability--reverse .guide-capability__text {
    order: 0;
  }

  .guide-use-cases {
    grid-template-columns: 1fr;
  }

  .guide-cta {
    padding: 32px 24px;
  }

  .guide-cta__title {
    font-size: 20px;
  }
}

/* ============================================
   AI CHAT — Prompt Helper
   ============================================ */

/* Backdrop */
/* ============================================
   AI CHAT — BOTTOM PANEL
   ============================================ */

/* Panel — sticky at bottom of .app-main scroll container */
.ai-chat-panel {
  display: none;
  flex-direction: column;
  height: var(--ai-chat-height, 340px);
  min-height: 200px;
  max-height: 70vh;
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 16px rgba(32, 29, 29, 0.05);
  position: relative;
}

.ai-chat-panel--open {
  display: flex;
  position: sticky;
  bottom: 0;
  z-index: 5;
}

/* Gallery page: shrink photos-page to make room for chat panel */
.app-main:has(.ai-chat-panel--open) .photos-page {
  height: calc(100vh - var(--header-height) - var(--space-4) * 2 - var(--ai-chat-height, 340px));
}

/* --- Resize handle --- */
.ai-chat-panel__resize-handle {
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 10px;
  cursor: ns-resize;
  z-index: 2;
}

.ai-chat-panel__resize-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.ai-chat-panel__resize-handle:hover::after,
.ai-chat-panel--resizing .ai-chat-panel__resize-handle::after {
  background: var(--color-accent);
}

/* --- Drop zone overlay --- */
.ai-chat-panel__drop-zone {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  background: rgba(104, 64, 255, 0.06);
  border: 2px dashed var(--color-accent);
  border-radius: var(--radius-md);
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  z-index: 10;
  pointer-events: none;
}

.ai-chat-panel__drop-zone:not([hidden]) {
  display: flex;
}

/* --- Drop hint bar (shown when panel closed, user drags near bottom) --- */
.ai-chat-drop-hint {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  z-index: var(--z-modal);
  animation: ai-chat-slide-up 0.2s ease-out;
}

@keyframes ai-chat-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Header — compact, integrated */
.ai-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.ai-chat-panel__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
}

.ai-chat-panel__title svg {
  color: var(--color-accent);
  flex-shrink: 0;
}

.ai-chat-panel__action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.ai-chat-panel__action-btn:hover {
  background: var(--color-bg-sunken);
  color: var(--color-text);
}

/* Messages */
.ai-chat-panel__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-behavior: smooth;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle, rgba(104, 64, 255, 0.18) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Welcome — compact, centered in available space */
.ai-chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-3);
  flex: 1;
  padding: var(--space-3) var(--space-4);
}

.ai-chat-welcome__text {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  line-height: var(--leading-relaxed);
  max-width: 360px;
}

.ai-chat-welcome__hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.ai-chat-welcome__hint {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.ai-chat-welcome__hint:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-muted);
  color: var(--color-accent);
  box-shadow: var(--shadow-glow-accent);
}

/* Chat Bubbles */
.ai-chat-bubble {
  max-width: 88%;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  word-break: break-word;
}

.ai-chat-bubble--user {
  align-self: flex-end;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border-bottom-right-radius: var(--radius-sm);
}

.ai-chat-bubble--assistant {
  align-self: flex-start;
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: var(--radius-sm);
}

.ai-chat-bubble__image {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  display: block;
  object-fit: cover;
}

.ai-chat-bubble__text {
  white-space: pre-wrap;
}

.ai-chat-bubble__text strong {
  font-weight: var(--font-weight-semibold);
}

.ai-chat-bubble__text ul,
.ai-chat-bubble__text ol {
  padding-left: var(--space-4);
  margin: var(--space-2) 0;
}

.ai-chat-bubble__text li {
  margin-bottom: var(--space-1);
}

.ai-chat-bubble__error {
  color: var(--color-error);
}

/* Code in bubbles */
.ai-chat-code {
  display: block;
  background: var(--color-bg-sunken);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: var(--space-2) 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  overflow-x: auto;
  white-space: pre;
}

.ai-chat-inline-code {
  background: var(--color-bg-sunken);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Bubble actions */
.ai-chat-bubble__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.ai-chat-bubble__action {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.ai-chat-bubble__action:hover {
  color: var(--color-text);
  background: var(--color-bg-sunken);
}

/* Typing indicator */
.ai-chat-typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.ai-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  animation: ai-chat-bounce 1.4s infinite ease-in-out both;
}

.ai-chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-chat-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ai-chat-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Image Preview (multi-image) */
.ai-chat-panel__preview {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  flex-shrink: 0;
  overflow-x: auto;
}

.ai-chat-panel__preview-item {
  position: relative;
  flex-shrink: 0;
}

.ai-chat-panel__preview-item img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  display: block;
}

.ai-chat-panel__preview-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-error);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.ai-chat-panel__preview-add {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.ai-chat-panel__preview-add:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Cost indicator */
.ai-chat-panel__cost {
  font-size: 11px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Multiple images in bubble */
.ai-chat-bubble__images {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.ai-chat-bubble__images .ai-chat-bubble__image {
  width: 80px;
  height: 80px;
}

/* Input area */
.ai-chat-panel__input {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  flex-shrink: 0;
}

.ai-chat-panel__textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: var(--leading-normal);
  max-height: 120px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.ai-chat-panel__textarea:focus {
  border-color: var(--color-accent);
}

.ai-chat-panel__textarea::placeholder {
  color: var(--color-text-tertiary);
}

.ai-chat-panel__attach-btn,
.ai-chat-panel__send-btn,
.ai-chat-panel__stop-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.ai-chat-panel__attach-btn {
  background: transparent;
  color: var(--color-text-secondary);
}

.ai-chat-panel__attach-btn:hover {
  background: var(--color-bg-sunken);
  color: var(--color-text);
}

/* Gallery picker button — visible on all screens */
.ai-chat-panel__gallery-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.ai-chat-panel__gallery-btn:hover {
  background: var(--color-bg-sunken);
  color: var(--color-text);
}

.ai-chat-panel__send-btn {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
}

.ai-chat-panel__send-btn:hover {
  background: var(--color-accent-hover);
}

.ai-chat-panel__stop-btn {
  background: var(--color-error);
  color: white;
}

.ai-chat-panel__stop-btn:hover {
  background: #dc2626;
}

/* Respect [hidden] on elements with explicit display */
.ai-chat-panel__stop-btn[hidden],
.ai-chat-panel__send-btn[hidden],
.ai-chat-panel__preview[hidden] {
  display: none;
}

/* Header actions group */
.ai-chat-panel__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.ai-chat-panel__action-btn--active {
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

/* Chat History Panel */
.ai-chat-panel__history {
  flex: 1;
  overflow-y: auto;
  border-bottom: 1px solid var(--color-border);
}

.ai-chat-panel__history[hidden] {
  display: none;
}

.ai-chat-panel__messages[hidden] {
  display: none;
}

.ai-chat-history__list {
  display: flex;
  flex-direction: column;
}

.ai-chat-history__empty {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
}

.ai-chat-history__item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

.ai-chat-history__item:hover {
  background: var(--color-bg-sunken);
}

.ai-chat-history__item--active {
  background: var(--color-accent-muted);
}

.ai-chat-history__item-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.ai-chat-history__item-title {
  font-size: var(--text-sm);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ai-chat-history__item-date {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-chat-history__item-delete {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-right: var(--space-2);
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.ai-chat-history__item:hover .ai-chat-history__item-delete {
  opacity: 1;
}

.ai-chat-history__item-delete:hover {
  color: var(--color-error);
  background: var(--color-bg-sunken);
}

/* Gallery picker grid */
.ai-chat-gallery-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: var(--space-3);
  max-height: 200px;
  overflow-y: auto;
  background: var(--color-bg-elevated);
}

.ai-chat-gallery-picker__item {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ai-chat-gallery-picker__item:hover,
.ai-chat-gallery-picker__item:active {
  border-color: var(--color-accent);
}

.ai-chat-gallery-picker__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.ai-chat-gallery-picker__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-4);
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
}

.ai-chat-gallery-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
}

.ai-chat-gallery-picker__title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
}

.ai-chat-gallery-picker__close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* Responsive — mobile fullscreen chat */
@media (max-width: 768px) {
  /* FULLSCREEN CHAT */
  .ai-chat-panel--open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100% !important;
    max-height: none !important;
    z-index: 9999;
    border-radius: 0;
    box-shadow: none;
    border: none;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    animation: none;
    transform: none !important;
  }

  /* Header — fixed top bar */
  .ai-chat-panel__header {
    flex-shrink: 0;
    padding: var(--space-3) var(--space-4);
    padding-top: env(safe-area-inset-top, var(--space-3));
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
  }

  /* Messages — scrollable middle */
  .ai-chat-panel__messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: var(--space-3);
  }

  /* Welcome hints — compact */
  .ai-chat-welcome {
    justify-content: flex-start;
    padding-top: var(--space-6);
    flex: unset;
  }

  .ai-chat-welcome__hints {
    flex-direction: column;
    gap: var(--space-2);
  }

  .ai-chat-welcome__hint {
    white-space: normal;
    text-align: center;
  }

  /* Image preview */
  .ai-chat-panel__preview {
    flex-shrink: 0;
    padding: var(--space-2) var(--space-4);
  }

  /* Input — fixed bottom */
  .ai-chat-panel__input {
    flex-shrink: 0;
    padding: var(--space-3) var(--space-4);
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom, var(--space-3)));
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
  }

  .ai-chat-panel__textarea {
    font-size: 16px; /* prevent iOS zoom */
  }

  .ai-chat-panel__send-btn,
  .ai-chat-panel__attach-btn,
  .ai-chat-panel__stop-btn,
  .ai-chat-panel__gallery-btn {
    min-width: 44px;
    min-height: 44px;
  }

  /* Bubbles */
  .ai-chat-bubble {
    max-width: 85%;
  }

  .ai-chat-bubble__image {
    max-width: 200px;
    max-height: 200px;
  }

  /* Gallery picker — нормальная сетка */
  .ai-chat-gallery-picker-wrap {
    padding: var(--space-3);
    background: var(--color-bg-sunken);
    border-radius: var(--radius-lg);
    margin: var(--space-2);
  }

  .ai-chat-gallery-picker__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
  }

  .ai-chat-gallery-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ai-chat-gallery-picker__item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .ai-chat-gallery-picker__item:active {
    border-color: var(--color-accent);
    opacity: 0.8;
  }

  .ai-chat-gallery-picker__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
  }

  /* Resize handle — не нужен */
  .ai-chat-panel__resize-handle {
    display: none;
  }

  /* Drop zone — не нужна на мобильном */
  .ai-chat-panel__drop-zone {
    display: none;
  }

  /* Backdrop — не нужен, чат fullscreen */
  .ai-chat-backdrop {
    display: none;
  }

  /* History panel */
  .ai-chat-panel__history {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================
   CUSTOM CONFIRM DIALOG
   ============================================ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.confirm-overlay--closing {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.confirm-dialog {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 380px;
  width: calc(100% - var(--space-8));
  box-shadow: var(--shadow-xl);
  animation: fadeSlideUp 0.2s ease;
}

.confirm-dialog__message {
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-6);
}

.confirm-dialog__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

.confirm-dialog__btn {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border);
}

.confirm-dialog__btn--cancel {
  background: transparent;
  color: var(--color-text-secondary);
}

.confirm-dialog__btn--cancel:hover {
  background: var(--color-bg-sunken);
  color: var(--color-text);
}

.confirm-dialog__btn--confirm {
  background: var(--color-error);
  color: white;
  border-color: var(--color-error);
}

.confirm-dialog__btn--confirm:hover {
  background: #DC2626;
  transform: translateY(-1px);
}

/* ============================================
   PAGE-SPECIFIC: LANDING
   ============================================ */

/* --- Landing: Layout & Container --- */
.landing {
  background: #0D0B0B;
  color: #EDEBEB;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  isolation: isolate;
  position: relative;
  z-index: 1;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  max-width: 100vw;
  --landing-bg: #0D0B0B;
  --landing-bg-alt: #111010;
  --landing-bg-card: #1A1717;
  --landing-border: #2A2626;
  --landing-text: #EDEBEB;
  --landing-text-dim: #8A8585;
  --landing-primary: #A1FF62;
  --landing-accent: #7C5AFF;
}

/* Noise texture overlay */
.landing::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.landing section,
.landing-section,
.landing-hero,
.landing-capabilities,
.landing-models,
.landing-elements,
.landing-board,
.landing-templates,
.landing-assistant,
.landing-steps,
.landing-networks,
.landing-for-whom,
.landing-faq,
.landing-cta-section,
.landing-footer {
  position: relative;
  z-index: 1;
}

.landing img,
.landing video,
.landing picture,
.landing canvas,
.landing svg {
  position: relative !important;
  z-index: 1 !important;
}

.landing-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.landing-container--narrow {
  max-width: 760px;
}

/* --- Landing: Section Dividers --- */
.landing-section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--landing-primary) 30%, var(--landing-accent) 70%, transparent 100%);
  opacity: 0.3;
  max-width: 800px;
  margin: 0 auto;
}

/* --- Landing: Header --- */
.landing-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgb(13, 11, 11);
  padding: var(--space-4) 0;
  transition: box-shadow var(--transition-base), padding var(--transition-base);
}

.landing-header--scrolled {
  background: rgb(13, 11, 11);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: var(--space-3) 0;
}

.landing-header__inner,
.landing-mobile-nav {
  position: relative;
  z-index: 2;
}

.landing-header__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.landing-header__logo {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: #EDEBEB;
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.landing-header__nav {
  display: flex;
  gap: var(--space-6);
}

.landing-header__link {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.landing-header__link:hover,
.landing-header__link--active {
  color: #ffffff;
}

.landing-header__actions {
  display: flex;
  gap: var(--space-3);
}

.landing-header__btn.btn--ghost {
  color: rgba(255, 255, 255, 0.7);
  border-color: #2A2626;
}

.landing-header__btn.btn--ghost:hover {
  color: #ffffff;
  border-color: #444;
  background: rgba(255, 255, 255, 0.05);
}

/* --- Landing: Burger Menu --- */
.landing-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 1001;
}

.landing-burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: #EDEBEB;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.landing-burger--open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.landing-burger--open span:nth-child(2) {
  opacity: 0;
}

.landing-burger--open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Landing: Mobile Nav --- */
.landing-mobile-nav {
  display: none;
  flex-direction: column;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  background: rgb(13, 11, 11);
  border-top: 1px solid #2A2626;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
}

.landing-mobile-nav--open {
  max-height: 400px;
  padding: var(--space-6);
}

.landing-mobile-nav__link {
  font-size: var(--text-lg);
  color: #EDEBEB;
  text-decoration: none;
  padding: var(--space-3) 0;
  border-bottom: 1px solid #2A2626;
}

.landing-mobile-nav__actions {
  display: flex;
  gap: var(--space-3);
  padding-top: var(--space-3);
}

/* --- Landing: Hero (Centered Vertical) --- */
.landing-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px var(--space-6) var(--space-16);
  overflow: hidden;
}

.landing-hero__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.landing-hero__orb--1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--landing-primary) 0%, transparent 70%);
  opacity: 0.1;
  top: -120px;
  right: -100px;
  animation: floatSlow 8s ease-in-out infinite alternate;
}

.landing-hero__orb--2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--landing-accent) 0%, transparent 70%);
  opacity: 0.08;
  bottom: -80px;
  left: -120px;
  animation: floatSlow 10s ease-in-out infinite alternate-reverse;
}

.landing-hero__content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  width: 100%;
  animation: heroFadeIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

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

.landing-hero__title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5.2vw, 3.8rem);
  font-weight: var(--font-weight-extrabold);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-5);
  color: var(--landing-text);
}

.landing-hero__line1 {
  display: block;
  white-space: nowrap;
}

.landing-hero__accent {
  background: linear-gradient(135deg, var(--landing-primary) 0%, var(--landing-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-hero__subtitle {
  font-size: clamp(var(--text-lg), 2.5vw, var(--text-xl));
  color: var(--landing-text-dim);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* Hero badges — clean inline text */
.landing-hero__badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.landing-hero__badge {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--landing-text-dim);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.landing-hero__badge-sep {
  color: rgba(255, 255, 255, 0.15);
  font-size: var(--text-lg);
  user-select: none;
}



/* --- Landing: Demo Window (macOS style) --- */
.landing-demo {
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
}

.landing-demo__titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #1A1717;
  border-bottom: 1px solid var(--landing-border);
}

.landing-demo__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.landing-demo__dot--red { background: #FF5F57; }
.landing-demo__dot--yellow { background: #FFBD2E; }
.landing-demo__dot--green { background: #28C840; }

.landing-demo__titlebar-text {
  font-size: var(--text-xs);
  color: var(--landing-text-dim);
  margin-left: var(--space-3);
}

.landing-demo__body {
  padding: var(--space-6);
  position: relative;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.landing-demo__watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  opacity: 0.06;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  color: var(--landing-text);
  transition: opacity 0.3s ease;
}

.landing-demo__input-row {
  display: flex;
  align-items: center;
  background: #0D0B0B;
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  min-height: 52px;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 2;
}

.landing-demo__input {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--landing-text);
}

.landing-demo__plain-text {
  white-space: pre-wrap;
}

.landing-demo__cursor {
  display: none;
  color: var(--landing-primary);
  font-weight: bold;
  animation: blink 1s step-end infinite;
}

.landing-demo__cursor--active {
  display: inline;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Mention chips */
.landing-demo__mention {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  background: rgba(255, 255, 255, 0.04);
  transition: opacity 0.3s;
}

.landing-demo__mention--complete {
  opacity: 1;
}

.landing-demo__mention-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.landing-demo__mention-label {
  font-family: var(--font-body);
}

/* Generate button */
.landing-demo__btn {
  display: block;
  width: 100%;
  padding: var(--space-3);
  background: linear-gradient(135deg, var(--landing-primary), #6FE038);
  color: #0D0B0B;
  font-weight: var(--font-weight-bold);
  font-size: var(--text-sm);
  border: none;
  border-radius: var(--radius-lg);
  cursor: default;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  z-index: 2;
}

.landing-demo__btn--pressed {
  transform: scale(0.97);
  box-shadow: 0 0 20px rgba(161, 255, 98, 0.3);
}

/* Loader */
.landing-demo__loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--landing-text-dim);
  font-size: var(--text-sm);
  z-index: 3;
}

.landing-demo__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--landing-border);
  border-top-color: var(--landing-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.landing-demo__result {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--landing-bg-card);
  z-index: 2;
  overflow: hidden;
}

.landing-demo__result-img {
  width: 100%;
  max-height: 100%;
  border-radius: var(--radius-lg);
  display: block;
  object-fit: contain;
  transition: filter 0.5s ease-out, opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* Phase 1: Heavy blur — while prompt is typing */
.landing-demo__result--phase-blur {
  z-index: 0;
  background: transparent;
}
.landing-demo__result--phase-blur .landing-demo__result-img {
  filter: blur(40px);
  opacity: 0.15;
  transform: scale(1.05);
}

/* Phase 2: Medium blur — during "Генерация..." */
.landing-demo__result--phase-gen {
  z-index: 0;
  background: transparent;
}
.landing-demo__result--phase-gen .landing-demo__result-img {
  filter: blur(20px);
  opacity: 0.4;
  transform: scale(1.03);
  transition: filter 2.5s ease-out, opacity 2.5s ease-out, transform 2.5s ease-out;
}

/* Phase 3: Fully revealed */
.landing-demo__result--phase-done {
  z-index: 4;
  background: var(--landing-bg-card);
}
.landing-demo__result--phase-done .landing-demo__result-img {
  filter: blur(0);
  opacity: 1;
  transform: scale(1);
  transition: filter 0.5s ease-out, opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* --- Landing: Placeholder Images --- */
.placeholder-img {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--landing-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  color: var(--landing-text-dim);
  font-size: var(--text-xs);
  min-height: 180px;
  text-align: center;
  padding: var(--space-4);
}

.placeholder-img::after {
  content: attr(data-label);
}

.placeholder-img--sm {
  min-height: 80px;
}

.placeholder-img--circle {
  border-radius: 50%;
  width: 80px;
  height: 80px;
  min-height: 0;
}

/* --- Landing: Sections --- */
.landing-section {
  padding: 80px 0;
}

.landing-section--alt {
  background: var(--landing-bg-alt);
}

.landing-section__title {
  font-family: var(--font-heading);
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  font-weight: var(--font-weight-bold);
  text-align: center;
  margin-bottom: var(--space-3);
  color: var(--landing-text);
}

.landing-section__subtitle {
  text-align: center;
  color: var(--landing-text-dim);
  font-size: var(--text-lg);
  margin-bottom: var(--space-12);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Landing: Capability Cards --- */
.landing-capabilities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.landing-cap-card {
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
}

.landing-cap-card:hover {
  border-color: rgba(161, 255, 98, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(161, 255, 98, 0.06);
}

.landing-cap-card__media {
  aspect-ratio: 3 / 4;
  overflow: hidden;
}

.landing-cap-card__img,
.landing-cap-card__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.landing-cap-card__media--audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(161, 255, 98, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 30% 70%, rgba(90, 50, 180, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(161, 255, 98, 0.04) 0%, transparent 40%),
    linear-gradient(160deg, #141414 0%, #0a0a0a 100%);
  position: relative;
  overflow: hidden;
}

.landing-cap-card__audio-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  transform: translate(-50%, -55%);
  border-radius: 50%;
  border: 1px solid rgba(161, 255, 98, 0.04);
  box-shadow:
    0 0 0 40px rgba(161, 255, 98, 0.02),
    0 0 0 80px rgba(161, 255, 98, 0.015),
    0 0 0 120px rgba(161, 255, 98, 0.01);
  pointer-events: none;
}

.landing-cap-card__play {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(161, 255, 98, 0.3);
  background: rgba(161, 255, 98, 0.08);
  color: var(--landing-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.landing-cap-card__play:hover {
  background: rgba(161, 255, 98, 0.15);
  border-color: rgba(161, 255, 98, 0.5);
  transform: scale(1.05);
}

.landing-cap-card__play-icon.hidden {
  display: none;
}

.landing-cap-card__waves {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
}

.landing-cap-card__waves span {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: rgba(161, 255, 98, 0.25);
  transition: height 0.2s ease, background 0.2s ease;
}

.landing-cap-card__waves.playing span {
  background: var(--landing-primary);
  animation: wave 0.6s ease-in-out infinite alternate;
}

.landing-cap-card__waves.playing span:nth-child(1) { animation-delay: 0s; }
.landing-cap-card__waves.playing span:nth-child(2) { animation-delay: 0.1s; }
.landing-cap-card__waves.playing span:nth-child(3) { animation-delay: 0.2s; }
.landing-cap-card__waves.playing span:nth-child(4) { animation-delay: 0.3s; }
.landing-cap-card__waves.playing span:nth-child(5) { animation-delay: 0.4s; }
.landing-cap-card__waves.playing span:nth-child(6) { animation-delay: 0.15s; }
.landing-cap-card__waves.playing span:nth-child(7) { animation-delay: 0.35s; }

@keyframes wave {
  0% { height: 8px; }
  100% { height: 28px; }
}

.landing-cap-card__info {
  padding: var(--space-5) var(--space-6);
}

.landing-cap-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
  color: var(--landing-text);
}

.landing-cap-card__text {
  color: var(--landing-text-dim);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* --- Landing: My Models Section --- */
.landing-mymodels {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-8);
  align-items: start;
}

.landing-mymodels__persona {
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
}

.landing-mymodels__avatar {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.landing-mymodels__avatar-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--landing-primary);
}

.landing-mymodels__name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--landing-primary);
  margin-bottom: var(--space-3);
}

.landing-mymodels__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-bottom: var(--space-5);
}

.landing-mymodels__tag {
  font-size: var(--text-xs);
  color: var(--landing-text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--landing-border);
}

.landing-mymodels__photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.landing-mymodels__photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--landing-border);
}

.landing-mymodels__results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.landing-mymodels__result-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--landing-border);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.landing-mymodels__result-img:hover {
  transform: scale(1.03);
  border-color: var(--landing-primary);
}

/* --- Landing: Elements Section (two-column) --- */
.landing-elements {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-6);
  align-items: center;
}

.landing-elements__library {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.landing-elements__card {
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--landing-text-dim);
  transition: border-color var(--transition-fast);
  overflow: hidden;
}

.landing-elements__card:hover {
  border-color: rgba(124, 90, 255, 0.3);
}

.landing-elements__card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
  margin-bottom: var(--space-2);
}

.landing-elements__card-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--landing-text-secondary);
  margin-bottom: 2px;
}

.landing-elements__card-handle {
  display: block;
  font-weight: var(--font-weight-medium);
  color: var(--landing-accent);
  font-size: var(--text-xs);
}

.landing-elements__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--landing-text-dim);
  flex-shrink: 0;
}

.landing-elements__result-wrap {
  display: flex;
  align-items: center;
}

.landing-elements__result {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-lg);
  display: block;
}

/* --- Landing: Board Section --- */
.landing-section--board {
  background: radial-gradient(ellipse at center, rgba(120, 140, 80, 0.18) 0%, rgba(80, 100, 50, 0.08) 40%, #0a0a0a 80%);
}

.landing-board__img {
  width: 100%;
  display: block;
  border-radius: 12px;
  box-shadow:
    0 0 40px rgba(161, 255, 98, 0.08),
    0 0 80px rgba(161, 255, 98, 0.04),
    0 8px 32px rgba(0, 0, 0, 0.4);
}

/* --- Landing: Templates Section --- */
.landing-section--templates {
  background: radial-gradient(ellipse at center, rgba(120, 100, 200, 0.14) 0%, rgba(90, 70, 160, 0.06) 40%, #0a0a0a 80%);
}

.landing-templates__img {
  width: 100%;
  display: block;
  border-radius: 12px;
  box-shadow:
    0 0 40px rgba(140, 120, 220, 0.08),
    0 0 80px rgba(140, 120, 220, 0.04),
    0 8px 32px rgba(0, 0, 0, 0.4);
}

.landing-templates__cta {
  text-align: center;
  margin-top: var(--space-6);
}

/* --- Landing: AI Assistant Section --- */
.landing-assistant__chat {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.landing-assistant__msg {
  display: flex;
  gap: var(--space-4);
}

.landing-assistant__msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--landing-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  color: var(--landing-text-dim);
  flex-shrink: 0;
}

.landing-assistant__msg-avatar--bot {
  background: linear-gradient(135deg, var(--landing-primary), var(--landing-accent));
  color: #0D0B0B;
}

.landing-assistant__msg-body {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--landing-text-dim);
  line-height: var(--leading-relaxed);
}

.landing-assistant__msg-body p {
  margin-top: var(--space-2);
}

.landing-assistant__ref-img {
  width: 160px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-lg);
  display: block;
}

img.landing-assistant__msg-avatar {
  object-fit: cover;
}

/* --- Landing: Filter Tabs --- */
.landing-filter {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  margin-bottom: var(--space-8);
}

.landing-filter__tab {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--landing-text-dim);
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.landing-filter__tab:hover {
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--landing-text);
}

.landing-filter__tab--active {
  background: rgba(161, 255, 98, 0.1);
  border-color: var(--landing-primary);
  color: var(--landing-primary);
}

/* --- Landing: Models Grid --- */
.landing-models {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
}

.landing-model {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-4);
  transition: all var(--transition-fast);
  text-align: center;
  position: relative;
}

.landing-model:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: #1F1C1C;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.landing-model__logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  object-fit: cover;
}

.landing-model__type {
  font-size: 0.625rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.landing-model__type--photo {
  background: rgba(161, 255, 98, 0.15);
  color: var(--landing-primary);
}

.landing-model__type--video {
  background: rgba(124, 90, 255, 0.15);
  color: var(--landing-accent);
}

.landing-model__type--audio {
  background: rgba(251, 191, 36, 0.15);
  color: #FBBF24;
}

.landing-model__name {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--landing-text);
  line-height: 1.3;
}

/* NEW badge on models */
.landing-model__badge-new {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  font-size: 0.55rem;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--landing-primary);
  color: #0D0B0B;
}

/* --- Landing: Steps --- */
.landing-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-5);
  margin-top: var(--space-10);
}

.landing-step {
  text-align: center;
  max-width: 240px;
  flex: 0 1 240px;
}

.landing-step__number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--landing-primary);
  color: var(--landing-primary);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-5);
  box-shadow: 0 0 20px rgba(161, 255, 98, 0.15), inset 0 0 12px rgba(161, 255, 98, 0.05);
}

.landing-step__title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-3);
  color: var(--landing-text);
}

.landing-step__text {
  color: var(--landing-text-dim);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.landing-step__arrow {
  display: flex;
  align-items: center;
  padding-top: 18px;
  color: rgba(161, 255, 98, 0.3);
  flex-shrink: 0;
}

/* --- Landing: For Whom --- */
.landing-for-whom {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

.landing-for-whom__card {
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  transition: all var(--transition-base);
}

.landing-for-whom__card:hover {
  border-color: rgba(124, 90, 255, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(124, 90, 255, 0.06);
}

.landing-for-whom__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: rgba(124, 90, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-5);
  color: var(--landing-accent);
}

.landing-for-whom__card h3 {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
  color: var(--landing-text);
}

.landing-for-whom__card p {
  color: var(--landing-text-dim);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* --- Landing: Pricing Packages (for /pricing page) --- */
.landing-pricing-packages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  align-items: stretch;
  margin-bottom: var(--space-12);
}

.landing-pricing-pkg {
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  position: relative;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.landing-pricing-pkg:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.landing-pricing-pkg--featured {
  border-color: rgba(161, 255, 98, 0.25);
}

.landing-pricing-pkg--featured:hover {
  border-color: rgba(161, 255, 98, 0.4);
  box-shadow: 0 8px 32px rgba(161, 255, 98, 0.08);
}

.landing-pricing-pkg__badge {
  align-self: center;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 12px;
  border-radius: var(--radius-full);
  background: var(--landing-primary);
  color: #0D0B0B;
  white-space: nowrap;
  min-height: 22px;
  display: flex;
  align-items: center;
  margin-bottom: var(--space-2);
}

.landing-pricing-pkg__badge--hidden {
  visibility: hidden;
}

.landing-pricing-pkg__badge--best {
  background: linear-gradient(135deg, var(--landing-primary), var(--landing-accent));
  color: #fff;
}

.landing-pricing-pkg__amount {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  color: var(--landing-text);
  margin-bottom: var(--space-3);
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.landing-pricing-pkg__price {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--landing-primary);
  margin-bottom: var(--space-2);
}

.landing-pricing-pkg__note {
  font-size: var(--text-sm);
  color: var(--landing-text-dim);
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Landing: Pricing Section Backgrounds --- */
.pricing-section--plans {
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(191, 255, 0, 0.04) 0%, transparent 70%),
    #0a0a0a;
}

.pricing-section--capabilities {
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(191, 255, 0, 0.03) 0%, transparent 60%),
    #0d0d0d;
}

.pricing-section--advantages {
  background:
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(191, 255, 0, 0.035) 0%, transparent 70%),
    #0a0a0a;
}

.pricing-section--faq {
  background: #0c0c0c;
}

.pricing-section--cta {
  background:
    radial-gradient(ellipse 50% 70% at 50% 50%, rgba(191, 255, 0, 0.05) 0%, transparent 60%),
    #0a0a0a;
}

/* --- Landing: Pricing Best Card --- */
.landing-pricing-pkg--best {
  border-color: #BFFF00;
}
.landing-pricing-pkg--best:hover {
  border-color: #BFFF00;
  box-shadow: 0 8px 32px rgba(191, 255, 0, 0.12);
}

/* --- Landing: Pricing CTA --- */
.landing-pricing-pkg__cta {
  margin-top: auto;
  padding-top: var(--space-5);
}

.pricing-receipt-email {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 4px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-md, 8px);
  background: var(--color-surface, rgba(255, 255, 255, 0.05));
  color: var(--color-text, #fff);
  outline: none;
  transition: border-color 0.2s;
}

.pricing-receipt-email:focus {
  border-color: var(--color-primary, #BFFF00);
}

.pricing-receipt-email::placeholder {
  color: var(--text-muted, #888);
}

.pricing-receipt-hint {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted, #888);
  margin-bottom: 8px;
}

.landing-pricing-pkg__legal {
  display: block;
  margin-top: var(--space-2);
  font-size: 0.7rem;
  color: var(--text-muted, #888);
  text-align: center;
}
.landing-pricing-pkg__legal a {
  color: var(--text-muted, #888);
  text-decoration: underline;
}

/* --- Landing: Create Grid --- */
.landing-create-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  max-width: 760px;
  margin: 0 auto var(--space-6);
}

.landing-create-card {
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
  transition: all var(--transition-base);
}
.landing-create-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.landing-create-card__icon {
  font-size: 2rem;
  margin-bottom: var(--space-3);
}

.landing-create-card__title {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  color: var(--landing-text);
  margin-bottom: var(--space-2);
}

.landing-create-card__desc {
  font-size: var(--text-sm);
  color: var(--landing-text-dim);
}

.landing-create-note {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--landing-text-dim);
  max-width: 560px;
  margin: 0 auto;
}

/* --- Landing: FAQ --- */
.landing-faq {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.landing-faq__item {
  background: var(--landing-bg-card);
  border: 1px solid var(--landing-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.landing-faq__item:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.landing-faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-5) var(--space-6);
  background: none;
  border: none;
  color: var(--landing-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  text-align: left;
}

.landing-faq__chevron {
  flex-shrink: 0;
  transition: transform var(--transition-base);
  color: var(--landing-text-dim);
}

.landing-faq__item--open .landing-faq__chevron {
  transform: rotate(180deg);
}

.landing-faq__answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow), padding var(--transition-slow);
}

.landing-faq__item--open .landing-faq__answer {
  max-height: 300px;
  padding: 0 var(--space-6) var(--space-5);
}

.landing-faq__answer p {
  color: var(--landing-text-dim);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* --- Landing: CTA --- */
.landing-cta {
  padding: 80px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--landing-bg) 0%, #121010 50%, var(--landing-bg) 100%);
}

.landing-cta__title {
  font-family: var(--font-heading);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-4xl));
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-4);
  color: var(--landing-text);
}

.landing-cta__text {
  color: var(--landing-text-dim);
  font-size: var(--text-lg);
  margin-bottom: var(--space-8);
}

.landing-cta__btn {
  font-size: var(--text-lg) !important;
  padding: var(--space-5) var(--space-12) !important;
}

/* --- Landing: Footer --- */
.landing-footer {
  border-top: 1px solid var(--landing-border);
  padding: var(--space-8) 0 var(--space-6);
}

.landing-footer__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-8);
}

.landing-footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.landing-footer__logo {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: var(--font-weight-bold);
  color: var(--landing-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.landing-footer__copy {
  font-size: var(--text-xs);
  color: var(--landing-text-dim);
  line-height: 1.6;
}

.landing-footer__requisites {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.landing-footer__requisites-title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--landing-text);
  margin-bottom: var(--space-1);
}

.landing-footer__requisites span {
  font-size: var(--text-xs);
  color: var(--landing-text-dim);
  opacity: 0.7;
  line-height: 1.5;
}

.landing-footer__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.landing-footer__nav-title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--landing-text);
  margin-bottom: var(--space-1);
}

.landing-footer__nav a {
  font-size: var(--text-sm);
  color: var(--landing-text-dim);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.landing-footer__nav a:hover {
  color: var(--landing-text);
}

/* Utility */
.hidden {
  display: none !important;
}

/* --- Landing: Responsive 1024px --- */
@media (max-width: 1024px) {
  .landing-capabilities {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
  }

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

  .landing-header__nav,
  .landing-header__actions {
    display: none;
  }

  .landing-burger {
    display: flex;
  }

  .landing-mobile-nav {
    display: flex;
  }

  .landing-mymodels {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
  }

  .landing-elements {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .landing-elements__library {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
  }

  .landing-elements__card {
    padding: var(--space-1);
  }

  .landing-elements__card-img {
    margin-bottom: var(--space-1);
  }

  .landing-elements__card-label {
    font-size: 0.625rem;
  }

  .landing-elements__card-handle {
    font-size: 0.625rem;
  }

  .landing-elements__arrow {
    transform: rotate(90deg);
  }

  .landing-elements__result {
    width: 100%;
    max-height: none;
    aspect-ratio: 3 / 4;
  }

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

/* --- Landing: Responsive 768px --- */
@media (max-width: 768px) {
  .landing-hero {
    min-height: auto;
    padding-top: 100px;
    padding-bottom: var(--space-12);
  }

  .landing-hero__title {
    font-size: clamp(1.6rem, 7vw, 2.4rem);
  }


  .landing-section {
    padding: 60px 0;
  }

  .landing-section__subtitle {
    margin-bottom: var(--space-8);
  }

  .landing-models {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .landing-model__logo {
    width: 40px;
    height: 40px;
  }

  .landing-model__name {
    font-size: var(--text-xs);
  }

  .landing-steps {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .landing-step {
    max-width: 320px;
    flex: none;
    position: relative;
    padding-bottom: var(--space-6);
  }

  .landing-step__arrow {
    padding: var(--space-1) 0;
    color: rgba(161, 255, 98, 0.2);
  }

  .landing-step__arrow svg {
    display: block;
    transform: rotate(90deg);
  }

  .landing-for-whom {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
  }

  .landing-footer__inner {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    text-align: center;
  }

  .landing-footer__brand {
    align-items: center;
  }

  .landing-footer__requisites {
    align-items: center;
  }

  .landing-footer__nav {
    align-items: center;
  }

  .landing-cta {
    padding: 60px 0;
  }

  .landing-cta__btn {
    font-size: var(--text-base) !important;
    padding: var(--space-4) var(--space-8) !important;
  }

  .landing-pricing-packages {
    grid-template-columns: 1fr;
    max-width: 340px;
    margin: 0 auto var(--space-12);
  }

  .landing-create-grid {
    grid-template-columns: 1fr;
    max-width: 320px;
  }

  .landing-mymodels__results {
    grid-template-columns: 1fr;
  }

  .landing-assistant__chat {
    padding: var(--space-4);
  }

  .landing-board__img {
    border-radius: 8px;
  }

  .landing-templates__img {
    border-radius: 8px;
  }

  .pricing-section--plans {
    background:
      radial-gradient(ellipse 100% 40% at 50% 0%, rgba(191, 255, 0, 0.04) 0%, transparent 70%),
      #0a0a0a;
  }

  .pricing-section--capabilities {
    background:
      radial-gradient(ellipse 100% 50% at 50% 100%, rgba(191, 255, 0, 0.03) 0%, transparent 60%),
      #0d0d0d;
  }

  .pricing-section--advantages {
    background:
      radial-gradient(ellipse 100% 40% at 50% 50%, rgba(191, 255, 0, 0.035) 0%, transparent 70%),
      #0a0a0a;
  }

  .pricing-section--cta {
    background:
      radial-gradient(ellipse 100% 50% at 50% 50%, rgba(191, 255, 0, 0.05) 0%, transparent 60%),
      #0a0a0a;
  }
}

/* --- Landing: Responsive 480px --- */
@media (max-width: 480px) {
  .landing-hero__badges {
    gap: var(--space-2);
  }

  .landing-hero__badge {
    font-size: var(--text-xs);
  }

  .landing-hero__badge-sep {
    font-size: var(--text-sm);
  }

  .landing-demo__body {
    padding: var(--space-4);
    min-height: 320px;
  }

  .landing-demo__input-row {
    font-size: var(--text-xs);
    padding: var(--space-3);
  }

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

  .landing-elements__card-label,
  .landing-elements__card-handle {
    font-size: 0.5625rem;
  }
}

/* ============================================
   LEGAL PAGES
   ============================================ */
.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 80px var(--space-6) var(--space-10);
}

.legal-page h1 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--landing-text);
  margin-bottom: var(--space-2);
}

.legal-page__date {
  font-size: var(--text-sm);
  color: var(--landing-text-dim);
  margin-bottom: var(--space-8);
}

.legal-page h2 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--landing-text);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

.legal-page p,
.legal-page li {
  font-size: var(--text-sm);
  color: var(--landing-text-dim);
  line-height: 1.7;
  margin-bottom: var(--space-3);
}

.legal-page ul,
.legal-page ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.legal-page a {
  color: var(--landing-accent, #A1FF62);
  text-decoration: underline;
}

/* --- Footer: legal info (deprecated, now using __requisites) --- */

/* ============================================
   FORM CHECKBOX
   ============================================ */
.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.form-checkbox input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  cursor: pointer;
  margin-top: 2px;
  transition: all var(--transition-fast);
}

.form-checkbox input[type="checkbox"]:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.form-checkbox input[type="checkbox"]:checked::after {
  content: "\2713";
  display: block;
  text-align: center;
  color: #000;
  font-size: 12px;
  line-height: 18px;
  font-weight: bold;
}

.form-checkbox__text a {
  color: var(--color-accent);
  text-decoration: underline;
}

/* ============================================
   COOKIE BANNER
   ============================================ */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: var(--space-4) var(--space-6);
}

.cookie-banner__inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.cookie-banner__text {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.cookie-banner__text a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
}

/* --- Cookie banner & footer: responsive 768px --- */
@media (max-width: 768px) {
  .cookie-banner__inner {
    flex-direction: column;
    text-align: center;
  }

  .cookie-banner {
    z-index: 200;
    padding: var(--space-3) var(--space-4);
  }
}

/* ============================================
   WELCOME BANNER (zero balance onboarding)
   ============================================ */
.welcome-banner {
  position: relative;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-success);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-4) var(--space-4) 0;
}

.welcome-banner__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--color-text-tertiary);
  cursor: pointer;
  line-height: 1;
  padding: var(--space-1);
}

.welcome-banner__close:hover {
  color: var(--color-text);
}

.welcome-banner__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}

.welcome-banner__text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-4);
  line-height: 1.5;
}

.welcome-banner__btn {
  display: inline-flex;
}

/* --- Welcome Bonus Banner --- */
.welcome-bonus-banner {
  position: relative;
  background: linear-gradient(135deg, var(--color-primary-muted), transparent);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-4) var(--space-4) 0;
  text-align: center;
  animation: welcomeBonusFadeIn 0.5s ease-out;
}

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

.welcome-bonus-banner__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--color-text-tertiary);
  cursor: pointer;
  line-height: 1;
  padding: var(--space-1);
}

.welcome-bonus-banner__close:hover {
  color: var(--color-text);
}

.welcome-bonus-banner__icon {
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.welcome-bonus-banner__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}

.welcome-bonus-banner__text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* --- Account Referral Section --- */
.account-referral__description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--space-4);
}

.account-referral__link-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-3);
}

.account-referral__input {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  cursor: text;
  user-select: all;
}

.account-referral__stats {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

/* --- Sidebar / Drawer referral highlight --- */
.sidebar-link--referral {
  color: var(--color-primary);
}

.nav-drawer__link--referral {
  color: var(--color-primary);
}

/* --- Button success state (clipboard feedback) --- */
.btn--success {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

@media (max-width: 480px) {
  .account-referral__link-row {
    flex-direction: column;
  }
  .account-referral__link-row .btn {
    width: 100%;
  }
}

/* ============================================
   HEADER — ZERO BALANCE
   ============================================ */
.header-balance__amount--zero {
  color: var(--color-warning);
}

/* ============================================
   TOAST LINK (balance warning)
   ============================================ */
.toast__link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.toast__link:hover {
  opacity: 0.8;
}

/* ============================================
   PRICING — PAYMENT INFO
   ============================================ */
.pricing-payment-info {
  text-align: center;
  margin-top: var(--space-6);
}

.pricing-payment-icons {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.pricing-payment-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.02em;
}

.pricing-payment-note {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.pricing-payment-note a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pricing-payment-note a:hover {
  color: #fff;
}

/* ============================================
   PRICING — MODAL STUB
   ============================================ */
.pricing-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.pricing-modal {
  position: relative;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 420px;
  width: calc(100% - var(--space-8));
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
}

.pricing-modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-4);
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-tertiary);
  cursor: pointer;
  line-height: 1;
}

.pricing-modal__close:hover {
  color: var(--color-text);
}

.pricing-modal__title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}

.pricing-modal__text {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-5);
  line-height: 1.5;
}

/* ============================================
   BUTTON: DANGER
   ============================================ */
.btn--danger {
  background: var(--color-error);
  color: #fff;
}
.btn--danger:hover {
  background: #dc2626;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}
.btn--danger:active {
  transform: translateY(0);
}

/* ============================================
   HEADER DROPDOWN
   ============================================ */
.header-profile {
  position: relative;
}

.header-profile__avatar {
  cursor: pointer;
}

.header-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 160px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.2));
  z-index: 300;
  padding: var(--space-2) 0;
  overflow: hidden;
}

.header-dropdown--open {
  display: block;
}

.header-dropdown__item {
  display: block;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.header-dropdown__item:hover {
  background: var(--color-bg-sunken);
}

.header-dropdown__item--danger {
  color: var(--color-error);
}

.header-dropdown__item--danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* ============================================
   ACCOUNT PAGE
   ============================================ */
.account-page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

.account-page__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-6);
}

.account-section {
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}

.account-section__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-4);
}

.account-section__link {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-accent);
  text-decoration: none;
}

.account-section__link:hover {
  text-decoration: underline;
}

.account-section__empty {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

/* Account info rows */
.account-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.account-info-row:last-of-type {
  border-bottom: none;
}

.account-info-row__label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.account-info-row__value {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

/* Account balance */
.account-balance {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.account-balance__amount {
  font-family: var(--font-mono, monospace);
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-text);
}

.account-balance__label {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}

/* Account transactions table */
.account-transactions {
  overflow-x: auto;
  margin-top: var(--space-3);
}

.account-transactions__table {
  width: 100%;
  border-collapse: collapse;
}

.account-transactions__table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}

.account-transactions__table tbody td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border);
}

.account-transactions__date {
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.account-transactions__amount {
  font-family: var(--font-mono, monospace);
  text-align: right;
}

.account-transactions__plus {
  color: var(--color-success);
}

.account-transactions__minus {
  color: var(--color-error);
}

/* Password form */
.account-password-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 400px;
}

/* Danger section */
.account-danger {
  border-color: rgba(239, 68, 68, 0.3);
}

.account-danger__text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}

/* Delete modal */
.account-delete-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  align-items: center;
  justify-content: center;
}

.account-delete-modal--open {
  display: flex;
}

.account-delete-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.account-delete-modal__content {
  position: relative;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 420px;
  width: 90%;
  z-index: 1;
}

.account-delete-modal__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
}

.account-delete-modal__text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.account-delete-modal__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.account-delete-modal__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ============================================
   ACCOUNT PAGE — RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .account-page {
    padding: var(--space-4) var(--space-3);
  }

  .account-section {
    padding: var(--space-4);
  }

  .account-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }

  .account-balance__amount {
    font-size: var(--text-2xl);
  }

  .account-transactions__table thead th,
  .account-transactions__table tbody td {
    padding: var(--space-2) var(--space-3);
  }

  .account-delete-modal__actions {
    flex-direction: column;
  }

  .account-delete-modal__actions .btn {
    width: 100%;
  }
}

/* Header dropdown responsive */
@media (max-width: 640px) {
  .header-dropdown {
    right: calc(-1 * var(--space-2));
    min-width: 140px;
  }
}

/* ============================================
   GENERATION EXPIRY BADGE
   ============================================ */
.gen-expiry-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.9);
  color: #fff;
  z-index: 2;
  pointer-events: none;
}

/* ============================================
   MOBILE DASHBOARD ADAPTATION
   ============================================ */

/* --- Table responsive wrapper --- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- Product sizes grid (elements form) --- */
.product-sizes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

/* --- Header mobile-only dropdown items --- */
.header-dropdown__item--mobile-only {
  display: none;
}

/* --- Theme toggle small variant (for dropdown) --- */
.theme-toggle--sm {
  transform: scale(0.85);
  margin-left: auto;
}

/* --- Touch devices: hide overlay, show ⋯ button --- */
.result-card__more-btn {
  display: none;
}

.card-action-sheet-backdrop {
  display: none;
}

.card-action-sheet {
  display: none;
}

@media (hover: none) {
  .result-card__overlay {
    display: none;
  }

  .result-card:hover {
    transform: none;
  }

  .result-card:hover .result-card__image {
    transform: none;
  }

  .result-card__more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
  }

  .result-card__more-btn:active {
    background: rgba(0, 0, 0, 0.7);
  }

  /* Action sheet backdrop */
  .card-action-sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 299;
    background: rgba(0, 0, 0, 0);
    transition: background 0.25s ease;
  }

  .card-action-sheet-backdrop--visible {
    display: block;
    background: rgba(0, 0, 0, 0.4);
  }

  /* Action sheet */
  .card-action-sheet {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    background: var(--color-bg-elevated);
    border-radius: 16px 16px 0 0;
    padding: var(--space-2) var(--space-4);
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 20px));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    max-height: 70dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .card-action-sheet--open {
    transform: translateY(0);
  }

  .card-action-sheet__handle {
    width: 36px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin: 0 auto var(--space-3);
  }

  .card-action-sheet__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3);
    border: none;
    background: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    text-decoration: none;
    min-height: 48px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .card-action-sheet__item:active {
    background: var(--color-bg-sunken);
  }

  .card-action-sheet__item--danger {
    color: var(--color-danger, #ef4444);
  }

  .card-action-sheet__divider {
    height: 1px;
    background: #333030 !important;
    margin: var(--space-1) 0;
  }

  /* FIX-6: Hardcoded dark theme for action sheet (body-appended, CSS vars unreliable) */
  .card-action-sheet {
    background: #1E1C1C !important;
    color: #E8E5E5 !important;
    border-radius: 16px 16px 0 0;
  }
  .card-action-sheet__item {
    color: #E8E5E5 !important;
  }
  .card-action-sheet__item:active {
    background: #2A2828 !important;
  }
  .card-action-sheet__item--danger {
    color: #FF6B6B !important;
  }
  .card-action-sheet__handle {
    background: #555 !important;
  }
  .card-action-sheet-backdrop--visible {
    background: rgba(0, 0, 0, 0.5) !important;
  }
}

/* ============================================
   MOBILE HEADER (back button)
   ============================================ */
.mobile-header {
  display: none;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: var(--space-2) var(--space-2);
    background: var(--color-bg);
  }

  .mobile-header__back {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }

  .mobile-header__back:active {
    background: var(--color-bg-sunken);
  }

  .mobile-header__title {
    flex: 1;
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
}

/* ============================================
   MOBILE BOTTOM BAR & NAVIGATION DRAWER
   ============================================ */
.mobile-bottom-bar {
  display: none;
}

.prompt-dock__menu-btn {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-bar {
    display: block;
  }

  .prompt-dock__menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .prompt-dock__menu-btn:active {
    background: var(--color-bg-sunken);
  }

  body.drawer-open .prompt-dock,
  body.action-sheet-open .prompt-dock {
    display: none;
  }
}

/* --- Navigation Drawer --- */
.nav-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              backdrop-filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              -webkit-backdrop-filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-drawer-backdrop--visible {
  display: block;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.nav-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--color-bg-elevated);
  border-radius: 20px 20px 0 0;
  padding: var(--space-2) var(--space-4) var(--space-4);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  overscroll-behavior: contain;
  max-height: 80vh;
  overflow-y: auto;
}

.nav-drawer--open {
  transform: translateY(0);
}

.nav-drawer__handle {
  width: 40px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 0 auto var(--space-4);
}

.nav-drawer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-drawer__section-label {
  font-size: 12px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.nav-drawer__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  text-decoration: none;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.nav-drawer__link:active {
  background: var(--color-bg-sunken);
}

.nav-drawer__link--active {
  background: var(--color-primary-muted);
  color: var(--color-primary);
}

.nav-drawer__link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav-drawer__link-icon svg {
  width: 20px;
  height: 20px;
}

.nav-drawer__divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2) 0;
}

.nav-drawer__user-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
}

.nav-drawer__balance {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.nav-drawer__balance-icon {
  display: flex;
  color: var(--color-primary);
}

.nav-drawer__balance-amount {
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}

.nav-drawer__topup-btn {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}

.nav-drawer__link--danger {
  color: var(--color-danger, #ef4444);
}

.nav-drawer__link--muted {
  opacity: 0.55;
  font-size: 0.85rem;
}

.nav-drawer__link--muted:hover {
  opacity: 0.85;
}

.nav-drawer__link--disabled {
  opacity: 0.4;
  pointer-events: none;
}

.nav-drawer__badge {
  margin-left: auto;
  background: var(--color-accent);
  color: white;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}

/* GUARD-1: Prevent horizontal overscroll bounce */
body {
  overscroll-behavior-x: none;
}

/* ============================================
   MOBILE DASHBOARD — @media 768px
   ============================================ */
@media (max-width: 768px) {

  /* FIX-C v7: Dark background — covers iOS keyboard accessory bar gap */
  html {
    background-color: #1E1C1C !important;
  }
  body {
    background-color: var(--color-bg) !important;
  }
  body.keyboard-open {
    background-color: #1E1C1C !important;
  }
  .app-main {
    background-color: var(--color-bg);
    overflow-x: hidden !important;
  }
  .app-main__inner { max-width: 100% !important; padding-left: 0 !important; padding-right: 0 !important; }
  .card { max-width: 100%; box-sizing: border-box; }
  .upload-dropzone { padding: var(--space-4) !important; min-height: 150px !important; }
  .app-main h1, .app-main h2 { word-wrap: break-word; overflow-wrap: break-word; }

  /* --- Gallery: grid masonry (left-to-right order) --- */
  .gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 4px;
    gap: 4px;
    padding: 2px;
  }

  .result-card {
    border-radius: 8px;
    display: inline-block;
    width: 100%;
  }

  .result-card__image {
    width: 100%;
    height: auto;
    display: block;
  }

  .result-card:hover {
    transform: none;
    box-shadow: none;
  }

  .photos-page__results {
    padding-bottom: calc(200px + env(safe-area-inset-bottom, 0));
  }

  .photos-page {
    height: calc(100dvh - var(--space-2) * 2);
    overscroll-behavior: contain;
  }

  /* --- Prompt dock: compact mobile --- */
  .prompt-dock {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 0);
    left: 0;
    right: 0;
    z-index: 150;
    border-radius: 12px 12px 0 0;
    padding: var(--space-2) var(--space-3);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .prompt-dock__bar {
    flex-wrap: wrap;
    height: auto;
    gap: 6px;
    align-items: center;
  }

  .prompt-dock__setting-group {
    flex-shrink: 0;
  }

  .prompt-dock__model {
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .prompt-dock__sep {
    display: none;
  }

  .prompt-dock__generate {
    width: 100%;
    margin-top: 4px;
    min-height: 40px;
    font-size: var(--text-sm);
  }

  .prompt-dock__setting {
    padding: 6px 10px;
    min-height: 32px;
    font-size: var(--text-xs);
  }

  .prompt-dock__icon-btn {
    width: 36px;
    height: 36px;
  }

  .prompt-dock__textarea {
    font-size: 16px;
    min-height: 36px;
    padding: var(--space-2);
  }

  .mention-dropdown {
    position: fixed !important;
    left: var(--space-2) !important;
    right: var(--space-2) !important;
    top: auto !important;
    max-width: 100vw;
    max-height: 40vh;
    z-index: 310;
    margin-bottom: 0;
  }

  .prompt-dock__qty-btn {
    width: 32px;
    height: 32px;
  }

  .ratio-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    max-height: 50vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
    z-index: 310;
    background: var(--color-bg-elevated);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    animation: sheetSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .ratio-menu__item {
    min-height: 48px;
    font-size: 14px;
    border-radius: 10px;
  }

  .qty-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
    z-index: 310;
    background: var(--color-bg-elevated);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    animation: sheetSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .motion-slots,
  .avatar-slots {
    flex-direction: row;
    gap: 8px;
    padding: 8px 12px 4px;
    max-width: 100%;
  }

  .motion-slot {
    max-width: none;
  }

  .motion-slot__placeholder {
    height: 72px;
    gap: 2px;
  }

  .motion-slot__placeholder small {
    display: none;
  }

  /* --- Lightbox: fullscreen mobile viewer --- */
  .lightbox-overlay {
    padding: 0;
  }

  .lightbox {
    width: 100%;
    height: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    background: #000;
  }

  .lightbox__image,
  .lightbox__video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    flex: 1;
    min-height: 0;
  }

  .lightbox__nav {
    display: none;
  }

  .lightbox__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0));
    justify-content: stretch;
  }

  .lightbox__action {
    flex: 1 1 calc(50% - 4px);
    min-width: calc(50% - 4px);
    min-height: 40px;
    font-size: 12px;
    padding: 8px 10px;
    text-align: center;
    white-space: nowrap;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  .lightbox__prompt-popup-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  }

  .lightbox__details {
    max-width: 100%;
    padding: 0 12px;
    gap: 5px;
  }

  .lightbox__tags {
    gap: 4px;
  }

  .lightbox__tag {
    padding: 2px 8px;
    font-size: 10px;
  }

  .lightbox__meta {
    font-size: 10px;
  }

  /* --- Tables --- */
  .table-responsive td,
  .table-responsive th {
    white-space: nowrap;
    font-size: var(--text-xs);
  }

  /* --- Account page --- */
  .account-page {
    padding: 0;
  }

  .account-section {
    border-radius: var(--radius-md);
  }

  /* --- Elements: 2 columns --- */
  .elements-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }

  /* --- Personas: 2 columns --- */
  .personas-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }

  .persona-show__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .persona-show__avatar {
    width: 100px;
    height: 100px;
  }

  .persona-show__meta {
    justify-content: center;
  }

  .persona-show__actions {
    justify-content: center;
  }

  .persona-show__photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  /* --- Audio page --- */
  .audio-panel__main {
    margin-bottom: calc(env(safe-area-inset-bottom, 0) + var(--space-2));
  }

  .audio-panel__controls {
    flex-direction: column;
  }

  .audio-panel__select--voice {
    width: 100%;
  }

  .audio-panel__replicas {
    max-height: 40vh;
    overflow-y: auto;
  }

  /* --- Guides --- */
  .guide-grid {
    grid-template-columns: 1fr;
  }

  /* --- Touch targets — global --- */
  input,
  textarea,
  select {
    font-size: 16px;
  }

  .form-input,
  .form-select {
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .btn--sm {
    min-height: 36px;
  }

  /* FIX-1: iOS auto-zoom prevention — override .form-input specificity */
  input.form-input,
  textarea.form-input,
  select.form-select,
  .form-input,
  .form-select {
    font-size: 16px !important;
  }

  /* FIX-2: Body-appended menus — hardcoded dark theme (CSS vars lost on body-append) */
  .model-menu {
    background: #1E1C1C !important;
    color: #E8E5E5 !important;
  }
  .model-menu__item {
    color: #E8E5E5 !important;
  }
  .model-menu__item:hover,
  .model-menu__item:active {
    background: #2A2828 !important;
  }
  .model-menu__item--active {
    color: #A1FF62 !important;
  }
  .model-menu__item-desc {
    color: #8A8686 !important;
  }

  .ratio-menu {
    background: #1E1C1C !important;
    color: #E8E5E5 !important;
  }
  .ratio-menu__item {
    color: #E8E5E5 !important;
  }
  .ratio-menu__item:hover,
  .ratio-menu__item:active {
    background: #2A2828 !important;
  }
  .ratio-menu__item--active {
    color: #A1FF62 !important;
  }
  .ratio-menu__label {
    color: inherit !important;
  }

  .qty-menu {
    background: #1E1C1C !important;
    color: #E8E5E5 !important;
  }
  .qty-menu__item {
    color: #E8E5E5 !important;
  }
  .qty-menu__item:hover,
  .qty-menu__item:active {
    background: #2A2828 !important;
  }
  .qty-menu__item--active {
    color: #A1FF62 !important;
  }

  .mention-dropdown {
    background: #1E1C1C !important;
    color: #E8E5E5 !important;
  }

  /* FIX-4: Horizontal overflow fixes */
  .flex.justify-between.items-center.mb-6 {
    flex-wrap: wrap;
    gap: 8px;
  }
  .flex.justify-between.items-center.mb-6 > h2,
  .flex.justify-between.items-center.mb-6 > div:first-child {
    width: 100%;
  }

  .flex.gap-3 {
    flex-wrap: wrap;
  }

  dl[style*="grid-template-columns: 140px"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }

  .audio-results-grid {
    grid-template-columns: 1fr !important;
  }

  .audio-panel__replica {
    flex-direction: column;
    gap: 8px;
  }
  .audio-panel__replica > * {
    width: 100% !important;
    min-width: 0 !important;
  }

  .persona-show__actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* FIX-D v7: Dock — compact first row (row wrap + order) */
  .prompt-dock__top {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 12px !important;
  }
  .prompt-dock__menu-btn { flex-shrink: 0 !important; order: 1; }
  .prompt-dock__side-actions { flex-shrink: 0 !important; order: 2; }
  .prompt-dock__references {
    order: 3; flex: 1 1 auto !important; min-width: 0 !important;
    display: flex; flex-wrap: nowrap !important;
    overflow-x: auto !important; -webkit-overflow-scrolling: touch;
    gap: 4px !important; padding: 0 !important; padding-bottom: 0 !important;
  }
  .reference-thumb {
    width: 40px !important; height: 40px !important;
    min-width: 40px !important; flex-shrink: 0 !important;
  }
  .prompt-dock__textarea {
    order: 10; flex-basis: 100% !important;
    width: 100% !important; min-height: 60px;
  }

  /* FIX-E: Audio page — compensate fixed dock */
  .audio-page__results {
    padding-bottom: calc(280px + env(safe-area-inset-bottom, 20px)) !important;
  }
  .audio-page {
    overflow-x: hidden;
  }
  .prompt-dock--audio {
    max-height: 42vh !important;
    overflow-y: auto;
  }

  /* FIX v7: Audio — compact cards */
  .audio-result-card { padding: var(--space-2) var(--space-3) !important; gap: var(--space-2) !important; }
  .audio-result-card p, .audio-result-card__transcript {
    font-size: 13px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
  }
  .audio-result-card__actions { gap: 6px !important; font-size: 12px; }
  .audio-results-grid { gap: var(--space-2) !important; }

  /* --- Overscroll behavior --- */
  .lightbox-overlay,
  .nav-drawer,
  .ai-chat-panel--open {
    overscroll-behavior: contain;
  }
}

/* --- Landscape mobile (touch devices 600-1024px wide in landscape) --- */
@media (max-width: 1024px) and (orientation: landscape) and (hover: none) {
  .app-sidebar {
    display: none !important;
  }

  .app-header {
    display: none !important;
  }

  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "main";
  }

  .mobile-bottom-bar {
    display: block;
  }

  .prompt-dock__menu-btn {
    display: flex;
  }

  .prompt-dock {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 0);
    left: 0;
    right: 0;
    z-index: 150;
    border-radius: 12px 12px 0 0;
  }

  .gallery-grid {
    columns: 3;
  }

  .result-card__more-btn {
    display: flex !important;
  }

  .result-card__overlay {
    display: none;
  }
}

/* --- Mobile: max-width 480px --- */
@media (max-width: 480px) {
  .product-sizes-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    gap: 3px;
  }

  .result-card {
    border-radius: 6px;
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .nav-drawer,
  .nav-drawer-backdrop,
  .lightbox-overlay,
  .prompt-dock {
    transition: none !important;
  }
}

/* ============================================
   PAYMENT RESULT PAGES
   ============================================ */
.payment-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 50vh;
  padding: 48px 24px;
  max-width: 480px;
  margin: 0 auto;
}

.payment-result__icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.payment-result__icon--success {
  background: rgba(161, 255, 98, 0.15);
  color: var(--color-primary);
}

.payment-result__icon--fail {
  background: rgba(255, 98, 98, 0.15);
  color: #ff6262;
}

.payment-result__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-text);
}

.payment-result__text {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.payment-result__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* =========================================================================

/* =========================================================================
   CONVERSATIONS — ChatGPT-style with LIGHT/DARK theme support
   =========================================================================
   Theme syncs with the app's data-theme attribute on <html>.
   All colors use CSS variables so switching themes is instant.
   ========================================================================= */

/* ---- Theme variables ---------------------------------------------------- */
[data-theme="light"] .conv-page,
.conv-page {
  --conv-bg: #ffffff;
  --conv-sidebar-bg: #f7f7f8;
  --conv-sidebar-hover: rgba(0, 0, 0, 0.04);
  --conv-sidebar-active: rgba(0, 0, 0, 0.06);
  --conv-sidebar-border: rgba(0, 0, 0, 0.06);
  --conv-msg-user-bg: #f7f7f8;
  --conv-text: #0d0d0d;
  --conv-text-secondary: #6e6e80;
  --conv-text-dim: #999;
  --conv-code-bg: #f4f4f4;
  --conv-code-text: #0d0d0d;
  --conv-code-copy-bg: #e8e8e8;
  --conv-code-copy-shadow: #f4f4f4;
  --conv-input-bg: #f4f4f4;
  --conv-input-border: rgba(0, 0, 0, 0.1);
  --conv-border: rgba(0, 0, 0, 0.08);
  --conv-accent: #10a37f;
  --conv-send-bg: #0d0d0d;
  --conv-send-color: #ffffff;
  --conv-welcome-hint-border: rgba(0, 0, 0, 0.1);
  --conv-welcome-hint-hover: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .conv-page {
  --conv-bg: #212121;
  --conv-sidebar-bg: #171717;
  --conv-sidebar-hover: rgba(255, 255, 255, 0.06);
  --conv-sidebar-active: rgba(255, 255, 255, 0.08);
  --conv-sidebar-border: rgba(255, 255, 255, 0.06);
  --conv-msg-user-bg: #2f2f2f;
  --conv-text: #ececec;
  --conv-text-secondary: #b4b4b4;
  --conv-text-dim: #666;
  --conv-code-bg: #0d0d0d;
  --conv-code-text: #e8e8e8;
  --conv-code-copy-bg: #2a2a2a;
  --conv-code-copy-shadow: #0d0d0d;
  --conv-input-bg: #303030;
  --conv-input-border: rgba(255, 255, 255, 0.1);
  --conv-border: rgba(255, 255, 255, 0.06);
  --conv-accent: #10a37f;
  --conv-send-bg: #ececec;
  --conv-send-color: #212121;
  --conv-welcome-hint-border: rgba(255, 255, 255, 0.1);
  --conv-welcome-hint-hover: rgba(255, 255, 255, 0.03);
}

/* ---- Body bg sync (prevent white strips) -------------------------------- */
html:has(.conv-page),
body:has(.conv-page) {
  overflow: hidden;
  height: 100dvh;
  margin: 0;
  padding: 0;
}
[data-theme="dark"] body:has(.conv-page),
[data-theme="dark"] html:has(.conv-page) {
  background-color: #212121 !important;
}
[data-theme="light"] body:has(.conv-page),
[data-theme="light"] html:has(.conv-page) {
  background-color: #ffffff !important;
}

/* ---- Sidebar overlay ---------------------------------------------------- */
.conv-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  -webkit-tap-highlight-color: transparent;
}
.conv-sidebar-overlay:not([hidden]) { display: block; }

/* ---- Hide Rails mobile-header on conversations page (we have our own) ---- */
.app-layout:has(.conv-page) > .mobile-header {
  display: none !important;
}

/* ---- App-main takeover -------------------------------------------------- */
.app-main:has(.conv-page) {
  padding: 0;
  overflow: hidden;
}
.app-main:has(.conv-page) > .app-main__inner {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- Page container ----------------------------------------------------- */
.conv-page {
  display: flex;
  flex: 1;
  height: 100%;
  min-height: 0;
  background: var(--conv-bg);
  color: var(--conv-text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  position: relative;
}

/* ---- Sidebar ------------------------------------------------------------ */
.conv-sidebar {
  flex: 0 0 260px;
  background: var(--conv-sidebar-bg);
  border-right: 1px solid var(--conv-sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.conv-sidebar__header { padding: 14px 12px 12px; }

.conv-sidebar__new-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--conv-border);
  border-radius: 10px;
  color: var(--conv-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}
.conv-sidebar__new-btn:hover { background: var(--conv-sidebar-hover); }
.conv-sidebar__new-btn svg { flex-shrink: 0; }

.conv-sidebar__model-picker { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.conv-sidebar__model-label { font-size: 10px; font-weight: 500; color: var(--conv-text-dim); text-transform: uppercase; letter-spacing: 0.04em; padding: 0 2px; }
.conv-sidebar__model-select {
  padding: 7px 10px;
  background: var(--conv-sidebar-hover);
  border: 1px solid var(--conv-border);
  border-radius: 8px;
  color: var(--conv-text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.conv-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 6px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(128,128,128,0.2) transparent;
}
.conv-sidebar__list::-webkit-scrollbar { width: 5px; }
.conv-sidebar__list::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.2); border-radius: 3px; }
.conv-sidebar__empty { padding: 20px 12px; text-align: center; color: var(--conv-text-dim); font-size: 12px; }

.conv-sidebar__group { margin-top: 10px; }
.conv-sidebar__group:first-child { margin-top: 4px; }
.conv-sidebar__group-label { padding: 6px 10px 4px; font-size: 10px; font-weight: 600; color: var(--conv-text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

.conv-sidebar__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  margin: 1px 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
}
.conv-sidebar__item:hover { background: var(--conv-sidebar-hover); }
.conv-sidebar__item:hover .conv-sidebar__item-menu-btn { opacity: 1; }
.conv-sidebar__item--active { background: var(--conv-sidebar-active); }
.conv-sidebar__item-icon {
  flex-shrink: 0; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--conv-text-dim); opacity: 0.6;
}
.conv-sidebar__item--active .conv-sidebar__item-icon { opacity: 0.9; }
.conv-sidebar__item-title { flex: 1; min-width: 0; font-size: 13px; color: var(--conv-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-sidebar__item--active .conv-sidebar__item-title { color: var(--conv-text); }

/* ⋯ menu trigger */
.conv-sidebar__item-menu-btn {
  flex-shrink: 0; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 5px;
  color: var(--conv-text-dim); cursor: pointer;
  opacity: 0; transition: opacity 0.15s ease;
  font-size: 16px; letter-spacing: 1px;
}
.conv-sidebar__item-menu-btn:hover { color: var(--conv-text); }

/* Dropdown menu */
.conv-sidebar__menu {
  position: absolute;
  right: 8px;
  top: 100%;
  min-width: 160px;
  background: var(--conv-sidebar-bg);
  border: 1px solid var(--conv-border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 50;
}
.conv-sidebar__menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--conv-text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s ease;
  text-align: left;
}
.conv-sidebar__menu-item:hover { background: var(--conv-sidebar-hover); }
.conv-sidebar__menu-item--danger { color: #ff6b6b; }
.conv-sidebar__menu-item--danger:hover { background: rgba(255,80,80,0.1); }
.conv-sidebar__menu-item svg { flex-shrink: 0; color: var(--conv-text-dim); }
.conv-sidebar__menu-item--danger svg { color: #ff6b6b; }

/* Model cards in sidebar */
.conv-sidebar__models { padding: 0 10px 8px; }
.conv-sidebar__models-label { font-size: 10px; font-weight: 600; color: var(--conv-text-dim); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 2px 6px; }
.conv-sidebar__model-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--conv-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
  text-align: left;
}
.conv-sidebar__model-card:hover { background: var(--conv-sidebar-hover); }
.conv-sidebar__model-card svg { flex-shrink: 0; color: var(--conv-text-secondary); }

/* ---- Main area ---------------------------------------------------------- */
.conv-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: var(--conv-bg);
}

/* Mobile header — with safe-area padding for notch/status-bar */
.conv-main__mobile-header {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  background: var(--conv-bg);
  border-bottom: 1px solid var(--conv-border);
}
.conv-main__menu-btn, .conv-main__back-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 7px;
  color: var(--conv-text); cursor: pointer;
}
.conv-main__back-btn { text-decoration: none; }
.conv-main__mobile-title { font-size: 14px; font-weight: 500; color: var(--conv-text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Messages ----------------------------------------------------------- */
.conv-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(128,128,128,0.15) transparent;
}
.conv-messages::-webkit-scrollbar { width: 6px; }
.conv-messages::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.15); border-radius: 3px; }
.conv-messages * { max-width: 100%; word-break: break-word; }

/* ---- Welcome ------------------------------------------------------------ */
.conv-welcome {
  max-width: 500px;
  margin: 12% auto 0;
  text-align: center;
  color: var(--conv-text-secondary);
  padding: 0 20px;
}
.conv-welcome__icon {
  width: 56px; height: 56px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--conv-text-secondary);
  opacity: 0.7;
}
.conv-welcome__title { font-size: 22px; font-weight: 600; color: var(--conv-text); margin: 0 0 8px; letter-spacing: -0.01em; }
.conv-welcome__desc { font-size: 14px; line-height: 1.6; color: var(--conv-text-dim); margin: 0; max-width: 380px; }
.conv-welcome__hints { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.conv-welcome__hint {
  display: inline-block;
  padding: 12px 20px;
  background: transparent;
  border: 1px solid var(--conv-welcome-hint-border);
  border-radius: 16px;
  color: var(--conv-text-secondary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  max-width: 340px;
  width: 100%;
}
.conv-welcome__hint:hover {
  border-color: var(--conv-text-dim);
  background: var(--conv-welcome-hint-hover);
  color: var(--conv-text);
}

/* ---- Messages ----------------------------------------------------------- */
.conv-msg { max-width: 768px; margin: 0 auto 22px; padding: 0; }
.conv-msg--user { background: var(--conv-msg-user-bg); border-radius: 18px; padding: 12px 18px 14px; }
.conv-msg--assistant { padding: 4px 0 8px; }
.conv-msg--error .conv-msg__body { color: #ff8080; }

.conv-msg__header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.conv-msg__role { font-size: 13px; font-weight: 600; color: var(--conv-text-secondary); }
.conv-msg__cost { font-size: 11px; color: var(--conv-text-dim); font-variant-numeric: tabular-nums; }

.conv-msg__body { font-size: 15px; line-height: 1.75; color: var(--conv-text); word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap; }
.conv-msg__body.md-body { white-space: normal; }

.conv-msg__image { display: block; max-width: 300px; max-height: 300px; border-radius: 12px; margin-bottom: 8px; border: 1px solid var(--conv-border); }

/* Action buttons under assistant messages — icon-only, like ChatGPT */
.conv-msg__footer { margin-top: 8px; display: flex; gap: 4px; }
.conv-msg__copy {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: transparent; border: none; border-radius: 6px;
  color: var(--conv-text-dim); cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  padding: 0;
}
.conv-msg__copy:hover { color: var(--conv-text); background: var(--conv-sidebar-hover); }
.conv-msg__copy svg { width: 16px; height: 16px; }

/* Streaming cursor */
.conv-msg--streaming .conv-msg__body::after {
  content: "▋"; display: inline-block; color: var(--conv-accent); margin-left: 2px;
  animation: conv-cursor-blink 1s steps(2) infinite;
}
@keyframes conv-cursor-blink { 50% { opacity: 0; } }

/* ---- Markdown ----------------------------------------------------------- */
.md-body { line-height: 1.75; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { color: var(--conv-text); font-weight: 600; margin: 18px 0 8px; }
.md-body h1 { font-size: 20px; } .md-body h2 { font-size: 17px; } .md-body h3 { font-size: 15px; }
.md-body p { margin: 10px 0; }
.md-body strong { color: var(--conv-text); font-weight: 600; }
.md-body a { color: var(--conv-accent); text-decoration: underline; }
.md-body ul, .md-body ol { margin: 10px 0 10px 20px; padding: 0; }
.md-body li { margin: 6px 0; } .md-body li::marker { color: var(--conv-text-dim); }
.md-body blockquote { margin: 12px 0; padding: 8px 16px; border-left: 3px solid var(--conv-border); color: var(--conv-text-secondary); }

/* Tables */
.md-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
  overflow-x: auto;
  display: block;
}
.md-body thead { border-bottom: 2px solid var(--conv-border); }
.md-body th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--conv-text);
  white-space: nowrap;
}
.md-body td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--conv-border);
  color: var(--conv-text);
}
.md-body tr:last-child td { border-bottom: none; }
.md-body tbody tr:hover { background: var(--conv-sidebar-hover); }

/* Inline code */
.md-body code {
  padding: 2px 6px;
  background: var(--conv-sidebar-hover);
  border-radius: 4px;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--conv-text);
}

/* Code blocks */
.md-body pre {
  position: relative;
  margin: 14px 0;
  padding: 0;
  background: var(--conv-code-bg);
  border: 1px solid var(--conv-border);
  border-radius: 10px;
  overflow: hidden;
}
.md-body pre code {
  display: block;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--conv-code-text);
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0;
}

/* Code copy button — icon only, opaque bg, shadow to hide scrolling text */
.conv-code { position: relative; }
.conv-code__copy {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--conv-code-copy-bg);
  border: 1px solid var(--conv-border);
  border-radius: 6px;
  color: var(--conv-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 2;
  box-shadow: -6px 0 10px var(--conv-code-copy-shadow);
}
.conv-code__copy:hover { color: var(--conv-text); background: var(--conv-sidebar-active); }
.conv-code__copy svg { width: 14px; height: 14px; }

/* ---- Input dock --------------------------------------------------------- */
.conv-input {
  flex-shrink: 0;
  padding: 8px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--conv-bg);
  max-width: 808px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 10;
}

.conv-attachments { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.conv-attachment { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid var(--conv-border); }
.conv-attachment img { width: 100%; height: 100%; object-fit: cover; }
.conv-attachment__remove { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; background: rgba(0,0,0,0.6); border: none; border-radius: 50%; color: #fff; font-size: 14px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.conv-attachment__remove:hover { background: #ff4d4d; }

.conv-input__row {
  display: flex;
  align-items: flex-end;
  gap: 0;
  background: var(--conv-input-bg);
  border: 1px solid var(--conv-input-border);
  border-radius: 24px;
  padding: 4px 4px 4px 14px;
  transition: border-color 0.15s ease;
}
.conv-input__row:focus-within { border-color: var(--conv-text-dim); }

.conv-input__attach-btn {
  flex-shrink: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 50%;
  color: var(--conv-text-secondary); cursor: pointer; margin-bottom: 2px;
}
.conv-input__attach-btn:hover { color: var(--conv-text); }

.conv-input__textarea {
  flex: 1; min-height: 24px; max-height: 200px;
  padding: 6px 8px; background: transparent; border: none;
  color: var(--conv-text); font-family: inherit;
  font-size: 16px; line-height: 1.45;
  resize: none; outline: none;
}
.conv-input__textarea::placeholder { color: var(--conv-text-dim); }
.conv-input__textarea:disabled { opacity: 0.5; }

.conv-input__send-btn, .conv-input__stop-btn {
  flex-shrink: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; cursor: pointer;
  transition: all 0.15s ease; margin-bottom: 2px;
}
.conv-input__send-btn { background: var(--conv-send-bg); color: var(--conv-send-color); }
.conv-input__send-btn:hover { opacity: 0.85; }
.conv-input__stop-btn { background: var(--conv-send-bg); color: var(--conv-send-color); }

/* ---- Context bar -------------------------------------------------------- */
.conv-context-bar { max-width: 768px; margin: 8px auto 0; display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--conv-text-dim); }
.conv-context-bar__label { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.conv-context-bar__label span { color: var(--conv-text-secondary); }
.conv-context-bar__track { flex: 1; height: 3px; background: var(--conv-sidebar-hover); border-radius: 999px; overflow: hidden; }
.conv-context-bar__fill { height: 100%; width: 0; background: var(--conv-accent); border-radius: 999px; transition: width 0.3s ease, background 0.2s ease; }
.conv-context-bar--warning .conv-context-bar__fill { background: #ffaa00; }
.conv-context-bar--warning .conv-context-bar__label { color: #ffaa00; }
.conv-context-bar--full .conv-context-bar__fill { background: #ff4d4d; }
.conv-context-bar--full .conv-context-bar__label::after { content: " — почти заполнен"; color: #ff8080; }

/* ---- Settings ----------------------------------------------------------- */
.conv-settings { max-width: 768px; margin: 6px auto 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 2px; }
.conv-settings::-webkit-scrollbar { display: none; }
.conv-settings__btn {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: transparent;
  border: 1px solid var(--conv-border); border-radius: 999px;
  color: var(--conv-text-dim); font-family: inherit; font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all 0.15s ease; white-space: nowrap;
}
.conv-settings__btn:hover { color: var(--conv-text-secondary); border-color: var(--conv-text-dim); }
.conv-settings__btn--active { background: var(--conv-sidebar-active); border-color: var(--conv-text-dim); color: var(--conv-text); }
.conv-settings__btn-icon { font-size: 12px; }

/* ---- Mobile: JAILBREAK from Rails layout --------------------------------
   Key technique (per Gemini): position: fixed + 100dvh on .conv-page itself.
   This rips the chat out of the broken .app-layout flex chain and pins it
   directly to the dynamic viewport. Safari's toolbar height is now handled
   by dvh automatically — env(safe-area-inset-bottom) only covers the Home
   Indicator (~34px), and 100dvh covers the rest. ----------------------------- */
@media (max-width: 768px) {

  /* 1. Block body scroll, prevent iOS pull-to-refresh */
  html:has(.conv-page),
  body:has(.conv-page) {
    touch-action: none;
  }

  /* 2. JAILBREAK: conv-page becomes a fixed full-screen overlay */
  .conv-page {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100dvh !important;
    width: 100vw !important;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--conv-bg);
  }

  .conv-main__mobile-header { display: flex; }

  /* Sidebar: still fixed, now relative to conv-page's stacking context */
  .conv-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
    z-index: 100; transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 30px rgba(0,0,0,0.6);
  }
  .conv-sidebar--open { transform: translateX(0); }

  /* 3. Main chat fills remaining height */
  .conv-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    height: 100%;
  }

  /* 4. Messages: the ONE scrollable area */
  .conv-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 12px 14px 12px;
  }

  /* 5. Input dock: natural order, safe-area for Home Indicator only */
  .conv-input {
    flex-shrink: 0;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background-color: var(--conv-bg);
    border-top: 1px solid var(--conv-border);
  }
  .conv-input__row { border-radius: 20px; padding: 3px 3px 3px 12px; }
  .conv-settings { margin: 6px 4px 0; }
  .conv-context-bar { margin: 4px 4px 0; }

  .conv-msg { margin-bottom: 14px; }
  .conv-msg--user { padding: 10px 14px 12px; border-radius: 16px; }
  .conv-msg__body { font-size: 15px; }

  .conv-welcome { margin-top: 10%; }
  .conv-welcome__title { font-size: 20px; }
  .conv-welcome__hint { font-size: 13px; padding: 10px 16px; }

  /* Mobile header */
  .conv-main__mobile-header {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  /* Table: prevent first column from being too narrow */
  .md-body th:first-child,
  .md-body td:first-child {
    min-width: 80px;
  }
}

/* ============================================================
   ШАГ 2 ОНБОРДИНГА — v4
   Desktop: обычный поток внутри .app-main (унаследованный height)
   Mobile:  position: fixed прибит к viewport (обход WebKit багов)
   ============================================================ */

/* Закрепляем высоту .onb__step для шага 2 — без этого .upload2 { height: 100% }
   ссылается на intrinsic-размер родителя, overflow-y: auto на main не работает,
   и контент обрезается .app-main { overflow: hidden } на узких viewport-ах. */
.app-main:has(.onb) .onb__step:has(.upload2) {
  height: 100%;
  min-height: 0;
}

/* ------- Базовый контейнер (desktop-first) ------- */
.upload2 {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #09090f;
  color: #fff;
  padding: 32px 48px;
  box-sizing: border-box;
  font-family: 'DM Sans', sans-serif;
}

/* Step indicator — абсолютно в правом верхнем углу, не мешает заголовку */
.upload2__step-indicator {
  position: absolute;
  top: 32px;
  right: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 2;
}
.upload2__step-label {
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.upload2__step-dots { display: flex; gap: 4px; }
.upload2__step-dot {
  width: 24px; height: 2px;
  background: rgba(255,255,255,.15);
  border-radius: 1px;
}
.upload2__step-dot--on { background: #c4b5fd; }

/* ------- Head: eyebrow + title ------- */
.upload2__head {
  flex: 0 0 auto;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding-right: 100px; /* место под step-indicator */
}
.upload2__eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,.4);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 12px;
}
.upload2__eyebrow-line {
  width: 24px; height: 1px;
  background: rgba(255,255,255,.3);
}
.upload2__title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-style: italic;
  font-size: clamp(24px, 2.6vw, 36px);
  font-weight: 400;
  line-height: 1.15;
  color: #fff;
  letter-spacing: -.02em;
  margin: 0;
  text-align: left;
}
.upload2__title span {
  font-style: normal;
  color: #c4b5fd;
}

/* ------- Main: центральная рабочая зона ------- */
.upload2__main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 18px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}

.upload2__dropzone {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  padding: 24px 16px;
  border: 1px dashed rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
  color: rgba(255,255,255,.4);
  cursor: pointer;
  transition: all .3s cubic-bezier(.16,1,.3,1);
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}
.upload2__dropzone:hover {
  background: rgba(196,181,253,.04);
  border-color: rgba(196,181,253,.3);
  color: #fff;
  box-shadow: 0 0 32px rgba(196,181,253,.12);
}
.upload2__dropzone-icon { color: #c4b5fd; }
.upload2__dropzone-title {
  font-size: 15px; font-weight: 600; color: #fff;
}
.upload2__dropzone-hint {
  font-size: 12px;
  color: rgba(255,255,255,.3);
  line-height: 1.5;
}

.upload2__previews {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.upload2__previews:empty { display: none; }

/* JS-сгенерированные превьюшки (до этого момента CSS отсутствовал) */
.onb__photo-preview {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  background: #0e0e18;
  border: 1px solid rgba(255,255,255,.08);
}
.onb__photo-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
/* Loading state: subtle dimmer + centered spinner so it reads as "uploading",
   not "broken". No backdrop-filter (janky on mid-range hardware). */
.onb__photo-preview--loading::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(9,9,15,.55);
  z-index: 1;
}
.onb__photo-preview--loading::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: #c4b5fd;
  border-radius: 50%;
  animation: onb-spin 0.8s linear infinite;
  z-index: 2;
}
.onb__photo-preview--failed {
  border-color: rgba(239,68,68,.5);
  opacity: .6;
}
.onb__photo-preview--failed::after {
  content: '!';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #ef4444;
  font-family: 'DM Sans', sans-serif;
  font-size: 22px; font-weight: 700;
  background: rgba(9,9,15,.4);
}

/* Status text states: subtle color cues without screaming */
.upload2__status[data-state="uploading"] {
  color: rgba(196,181,253,.7);
  font-style: italic;
}
.upload2__status[data-state="ready"] {
  color: #c4b5fd;
  font-style: normal;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
}
.upload2__status[data-state="error"] {
  color: #ef4444;
  font-style: normal;
}

.upload2__gender {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  align-self: center;
}
.upload2__gender-option {
  position: relative;
  padding: 10px 28px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s;
  color: rgba(255,255,255,.5);
  font-size: 14px;
  font-weight: 500;
}
.upload2__gender-option input {
  position: absolute; opacity: 0; pointer-events: none;
}
.upload2__gender-option:has(input:checked) {
  background: rgba(196,181,253,.15);
  color: #fff;
}

.upload2__examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upload2__examples-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: center;
}
.upload2__examples-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.upload2__example {
  position: relative;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  background: #0e0e18;
}
.upload2__example-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.upload2__example-tag {
  position: absolute;
  bottom: 10px; left: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

/* ------- Foot: status + CTA ------- */
.upload2__foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}
.upload2__status {
  font-family: 'DM Serif Display', serif;
  font-style: italic;
  font-size: 14px;
  color: rgba(255,255,255,.25);
  margin: 0;
}
.upload2__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  background: #c4b5fd;
  color: #09090f;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .3s cubic-bezier(.16,1,.3,1);
}
.upload2__cta:disabled {
  background: rgba(196,181,253,.15);
  color: rgba(255,255,255,.3);
  cursor: not-allowed;
}
.upload2__cta:not(:disabled):hover {
  background: #d4c5ff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(196,181,253,.3);
}

/* ============================================================
   MOBILE (≤768px) — включаем position: fixed
   ============================================================ */
@media (max-width: 768px) {
  .upload2 {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 50;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0));
  }
  .upload2__step-indicator {
    top: 20px;
    right: 16px;
  }
  .upload2__head {
    padding-right: 80px; /* место под step-indicator на мобилке */
  }
  .upload2__title {
    font-size: clamp(22px, 5.5vw, 28px);
    line-height: 1.2;
  }
  .upload2__main {
    padding: 16px 0;
    gap: 18px;
  }
  .upload2__dropzone {
    padding: 28px 16px;
  }
  .upload2__examples-grid {
    gap: 6px;
  }
  .upload2__example {
    height: auto;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
  }
  .upload2__example-tag {
    font-size: 9px;
    bottom: 6px;
    left: 8px;
  }
  .upload2__cta {
    padding: 12px 22px;
    font-size: 14px;
  }
}

/* Маленькие телефоны */
@media (max-width: 380px) {
  .upload2__dropzone { padding: 22px 12px; }
  .upload2__gender-option { padding: 8px 18px; font-size: 13px; }
  .upload2__main { gap: 14px; }
}

/* Скрываем .mobile-header когда шаг 2 активен — только на мобилке */
@media (max-width: 768px) {
  body:has(.onb__step:not([hidden]) .upload2) .mobile-header {
    display: none;
  }
}

/* ============================================================
   ШАГ 5 ОНБОРДИНГА — ВЫБОР ОБРАЗА ИЗ ДВУХ ВАРИАНТОВ
   Архитектура повторяет .upload2: desktop in-flow height:100%,
   mobile position:fixed inset:0 — тот же паттерн, тот же скроллинг.
   ============================================================ */

/* Пробрасываем высоту .onb__step для любого изолированного шага */
.app-main:has(.onb) .onb__step:has(.sheet-choice) {
  height: 100%;
  min-height: 0;
}

.sheet-choice {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #09090f;
  color: #fff;
  padding: 32px 48px;
  box-sizing: border-box;
  font-family: 'DM Sans', sans-serif;
}

.sheet-choice__step-indicator {
  position: absolute;
  top: 32px;
  right: 48px;
  z-index: 2;
}
.sheet-choice__step-label {
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sheet-choice__head {
  flex: 0 0 auto;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding-right: 160px; /* место под step-indicator */
}
.sheet-choice__eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,.4);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 12px;
}
.sheet-choice__eyebrow-line {
  width: 24px; height: 1px;
  background: rgba(255,255,255,.3);
}
.sheet-choice__title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-style: italic;
  font-size: clamp(24px, 2.6vw, 36px);
  font-weight: 400;
  line-height: 1.15;
  color: #fff;
  letter-spacing: -.02em;
  margin: 0;
  text-align: left;
}
.sheet-choice__title span {
  font-style: normal;
  color: #c4b5fd;
}

.sheet-choice__main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 0;
  overflow: hidden;
}

.sheet-choice__option {
  position: relative;
  display: block;
  height: 100%;
  max-height: 460px;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  overflow: hidden;
  background: #0e0e18;
  cursor: pointer;
  font-family: inherit;
  transition: transform .3s cubic-bezier(.16,1,.3,1),
              border-color .25s,
              box-shadow .3s cubic-bezier(.16,1,.3,1);
}
.sheet-choice__option img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  pointer-events: none;
}
.sheet-choice__option::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(9,9,15,.85) 0%, transparent 100%);
  pointer-events: none;
}
.sheet-choice__label {
  position: absolute; bottom: 14px; left: 16px;
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.85);
  letter-spacing: .01em;
  z-index: 1;
}
.sheet-choice__check {
  position: absolute; top: 12px; right: 12px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #c4b5fd;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.4);
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  z-index: 2;
}
.sheet-choice__option:hover {
  border-color: rgba(196,181,253,.35);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
}
.sheet-choice__option--active {
  border-color: #c4b5fd;
  box-shadow: 0 0 0 2px #c4b5fd, 0 14px 40px rgba(196,181,253,.25);
  transform: translateY(-3px);
}
.sheet-choice__option--active .sheet-choice__check {
  opacity: 1;
  transform: scale(1);
}
.sheet-choice__option--active .sheet-choice__label {
  color: #c4b5fd;
}

/* Slot ещё генерируется (partial results): тайл заблокирован, поверх — спиннер */
.sheet-choice__option--loading {
  cursor: progress;
  pointer-events: none;
  background: #1a1a24;
  border-color: rgba(255,255,255,.06);
}
.sheet-choice__option--loading img {
  opacity: 0.15;
  filter: blur(2px);
}
.sheet-choice__option--loading::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 40px; height: 40px;
  margin: -20px 0 0 -20px;
  border: 2px solid rgba(255,255,255,.1);
  border-top-color: #c4b5fd;
  border-radius: 50%;
  animation: onb-spin 0.9s linear infinite;
  z-index: 3;
}
.sheet-choice__option--loading .sheet-choice__label {
  color: rgba(255,255,255,.35);
}
.sheet-choice__option--loading .sheet-choice__check {
  display: none;
}

/* Slot провалился окончательно (retry budget исчерпан) */
.sheet-choice__option--error {
  cursor: not-allowed;
  pointer-events: none;
  background: #2a1a1a;
  border-color: rgba(239,68,68,.25);
}
.sheet-choice__option--error img { display: none; }
.sheet-choice__option--error::after {
  content: '⚠';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  color: rgba(239,68,68,.55);
}

.sheet-choice__foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}
.sheet-choice__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  color: rgba(255,255,255,.45);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}
.sheet-choice__back:hover {
  border-color: rgba(255,255,255,.2);
  color: rgba(255,255,255,.8);
}
.sheet-choice__hint {
  font-family: 'DM Serif Display', serif;
  font-style: italic;
  font-size: 14px;
  color: rgba(255,255,255,.25);
  margin: 0;
  transition: color .2s;
}
.sheet-choice__hint[data-state="ready"] {
  color: rgba(196,181,253,.7);
}
.sheet-choice__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  background: #c4b5fd;
  color: #09090f;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .3s cubic-bezier(.16,1,.3,1);
}
.sheet-choice__cta:disabled {
  background: rgba(196,181,253,.15);
  color: rgba(255,255,255,.3);
  cursor: not-allowed;
}
.sheet-choice__cta:not(:disabled):hover {
  background: #d4c5ff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(196,181,253,.3);
}

/* ============================================================
   Mobile ≤768px — position: fixed (как у .upload2)
   ============================================================ */
@media (max-width: 768px) {
  .sheet-choice {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 50;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0));
  }
  .sheet-choice__step-indicator {
    display: none; /* лишний шум на мобилке */
  }
  .sheet-choice__head {
    padding-right: 0;
  }
  .sheet-choice__title {
    font-size: clamp(26px, 7vw, 32px);
    line-height: 1.18;
  }
  /* На мобилке 2 карточки рядом, центрированы вертикально (grid, не flex) */
  .sheet-choice__main {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-content: center;
    gap: 10px;
    padding: 16px 0;
    max-width: 100%;
    overflow: visible;
  }
  .sheet-choice__option {
    height: auto;
    max-height: none;
    width: 100%;
    border-radius: 12px;
  }
  .sheet-choice__label {
    font-size: 11px;
    bottom: 10px;
    left: 12px;
  }
  .sheet-choice__check {
    width: 22px; height: 22px;
    top: 8px; right: 8px;
  }
  .sheet-choice__cta {
    padding: 12px 22px;
    font-size: 14px;
  }
  .sheet-choice__hint {
    font-size: 12px;
  }

  /* Mobile header скрыть на шаге 5 — как на шаге 2 */
  body:has(.onb__step:not([hidden]) .sheet-choice) .mobile-header {
    display: none;
  }

  /* Полноэкранно-центрированные шаги (step4, step6, stepError) на мобиле.
     Всё продублировано на 100vw + margin-inline:auto, чтобы на iOS Safari
     не съезжало влево из-за наследованного align-items/text-align. */
  .onb__step--centered {
    position: fixed;
    inset: 0;
    width: 100vw;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
    background: #09090f;
    box-sizing: border-box;
    text-align: center;
  }
  .onb__step--centered .onb__loader {
    padding: 0;
    gap: 18px;
    width: 100%;
    max-width: 320px;
    margin-inline: auto;
    align-items: center;
  }
  .onb__step--centered .onb__loader > * {
    margin-inline: auto;
  }
  .onb__step--centered .onb__title {
    text-align: center;
    font-size: clamp(22px, 6.5vw, 28px);
    margin: 0;
    width: 100%;
  }
  .onb__step--centered .onb__progress {
    margin-inline: auto;
  }
  /* Error step: ресетим padding у .onb__error, он мешает вертикальной центровке */
  .onb__step--centered .onb__error {
    padding: 0;
    gap: 14px;
    width: 100%;
    max-width: 320px;
    margin-inline: auto;
    align-items: center;
  }
  .onb__step--centered .onb__error > * {
    margin-inline: auto;
  }
  body:has(.onb__step--centered:not([hidden])) .mobile-header {
    display: none;
  }
}

@media (max-width: 380px) {
  .sheet-choice__main { gap: 8px; }
  .sheet-choice__head { padding-right: 110px; }
}
