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

:root {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --surface2: #242424;
  --accent: #c084fc;       /* soft violet */
  --accent2: #818cf8;      /* indigo */
  --text: #f0f0f0;
  --text-muted: #888;
  --border: #333;
  --radius: 16px;
  --tab-h: 64px;
  --top-h: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  overflow: hidden;
}

#app { height: 100%; position: relative; }

/* ── Screens ──────────────────────────────────────────────────────── */
.screen {
  display: none;
  height: 100%;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ── Loading ──────────────────────────────────────────────────────── */
#loading {
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty hero (no avatar) ───────────────────────────────────────── */
#screen-empty {
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}
.empty-hero { max-width: 340px; }
.empty-hero .empty-icon { font-size: 72px; margin-bottom: 16px; }
.empty-icon-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 44px;
  margin-bottom: 18px;
  filter: drop-shadow(0 4px 14px rgba(192,132,252,0.3));
}
.empty-icon-row span {
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}
.empty-icon-row span:nth-child(1) { animation-delay: 0s;   }
.empty-icon-row span:nth-child(2) { animation-delay: 0.2s; }
.empty-icon-row span:nth-child(3) { animation-delay: 0.4s; }
.empty-icon-row span:nth-child(4) { animation-delay: 0.6s; }
.empty-icon-row span:nth-child(5) { animation-delay: 0.8s; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.empty-hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
  min-height: 20px;
}
.empty-hint.success { color: #22c55e; }
.empty-hint.error   { color: #ef4444; }
.empty-hero h1 {
  font-size: 26px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}
.empty-hero p { color: var(--text-muted); line-height: 1.5; margin-bottom: 32px; }

/* ── Top bar ──────────────────────────────────────────────────────── */
.top-bar {
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.app-title { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.credits-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.credits-btn:active { background: var(--accent); }

/* ── Tab content ──────────────────────────────────────────────────── */
.tab-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.tab {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 16px 16px calc(var(--tab-h) + var(--safe-bottom) + 8px);
}
.tab.active { display: block; }

/* ── Bottom nav ───────────────────────────────────────────────────── */
.bottom-nav {
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  padding: 6px 0;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 10px; font-weight: 500; }

.nav-create {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  margin: 6px 4px;
  flex: 1.3;
}
.nav-create .nav-icon, .nav-create .nav-label { color: white; }
.nav-create.active { color: white; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:active, .btn-secondary:active { opacity: 0.8; transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  margin-bottom: 10px;
}
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-large { padding: 18px; font-size: 17px; }

/* ── Slider ───────────────────────────────────────────────────────── */
.slider-container {
  position: relative;
  height: 340px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--surface);
}
.slider {
  display: flex;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.25,0.46,0.45,0.94);
}
.slide {
  min-width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface2);
}
.slide img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.slider-btn.prev { left: 10px; }
.slider-btn.next { right: 10px; }
.slider-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transition: background 0.2s;
}
.dot.active { background: white; }

/* ── Home actions ─────────────────────────────────────────────────── */
.home-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── Section title ────────────────────────────────────────────────── */
.section-title {
  font-size: 18px; font-weight: 700;
  margin-bottom: 14px;
}

/* ── Create cards ─────────────────────────────────────────────────── */
.create-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.create-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.create-card:active { transform: scale(0.97); border-color: var(--accent); }
.create-card-icon { font-size: 36px; margin-bottom: 8px; }
/* Миниатюра активного аватара вместо эмодзи на карточке "Примерка".
   Аватар хранится как 2×4 turnaround sheet; через background-size+position
   показываем только ячейку row1/col0 — front face & shoulders close-up. */
.create-card-icon.has-avatar {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  border-radius: 50%;
  overflow: hidden;
  background-color: var(--surface2);
  background-size: 400% 200%;          /* каждая ячейка = размер контейнера */
  background-position: 0% 100%;        /* row 1, col 0 = front face close-up */
  background-repeat: no-repeat;
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.35);
  font-size: 0;                        /* спрячет любой случайный текст внутри */
}
.create-card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.create-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.4; }
.create-card-cost {
  font-size: 13px; font-weight: 700;
  color: var(--accent);
}
.create-note { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }

/* ── History grid ─────────────────────────────────────────────────── */
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.history-item {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  position: relative;
}
.history-item img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.history-badge {
  position: absolute;
  bottom: 6px; left: 6px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 8px;
}
.history-note { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }

/* Переключатель «Все / Избранное» */
.history-toggle {
  display: flex;
  background: var(--surface2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin: 10px 0;
}
.history-toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.history-toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Иконка избранного на карточке истории — заменяет trash */
.card-fav-btn {
  position: absolute !important;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s, transform 0.1s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.card-fav-btn:active { transform: scale(0.9); }
.card-fav-btn.is-fav { background: rgba(239, 68, 68, 0.9); }

/* Видео-плашка поверх миниатюры в истории */
.history-video-indicator {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.65);
  color: white;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 2;
}

/* Детальный экран генерации */
.history-detail-card {
  max-width: 480px;
  max-height: 92vh;
}
.history-detail-body {
  overflow-y: auto;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.history-detail-media {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 65vh;
}
.history-detail-media img,
.history-detail-media video {
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  background: #000;
}
.history-detail-media img { cursor: zoom-in; }
/* Кнопка «во весь экран» поверх превью */
.media-fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  z-index: 5;
  padding: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.media-fullscreen-btn:active { transform: scale(0.92); background: rgba(0,0,0,0.9); }
.history-detail-section { display: flex; flex-direction: column; gap: 6px; }
.history-detail-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.history-detail-prompt {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.history-detail-prompt:empty::before {
  content: '—';
  color: var(--text-muted);
}
.history-detail-refs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.history-detail-refs img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface2);
  cursor: zoom-in;
}
.history-detail-refs-empty {
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 0;
}

.btn-danger {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: white;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-danger:active { opacity: 0.85; transform: scale(0.98); }

/* Fullscreen viewer (изображение или видео на весь экран) */
#fullscreen-overlay {
  background: rgba(0, 0, 0, 0.96);
  padding: 0;
}
.fullscreen-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.fullscreen-content img,
.fullscreen-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.fullscreen-close {
  position: absolute !important;
  top: 16px;
  right: 16px;
  font-size: 24px;
  color: #fff;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  z-index: 1100;
}
.empty-state { text-align: center; padding: 40px 0; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ── Avatars grid ─────────────────────────────────────────────────── */
.avatars-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.avatar-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}

/* Кнопка удаления — корзина в правом верхнем углу карточки */
.card-delete-btn {
  position: absolute !important;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10;
  transition: background 0.15s, transform 0.1s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.card-delete-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}
.card-delete-btn:hover  { background: rgba(239, 68, 68, 0.9); }
.card-delete-btn:active { background: rgba(239, 68, 68, 1); transform: scale(0.9); }

/* Слайдер: каждый .slide должен быть позиционированным контекстом
   для абсолютной кнопки удаления */
.slide { position: relative; }
.avatar-card.active-av { border-color: var(--accent); }
.avatar-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.avatar-card-label {
  font-size: 11px;
  padding: 4px 8px;
  color: var(--text-muted);
}

/* ── Profile ──────────────────────────────────────────────────────── */
.profile-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}
.profile-avatar-icon { font-size: 56px; margin-bottom: 10px; }
.profile-name { font-size: 20px; font-weight: 700; }
.profile-username { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-item {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.stat-value { font-size: 22px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.profile-actions { display: flex; flex-direction: column; gap: 10px; }

/* Language selector */
.lang-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.lang-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.lang-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.lang-option {
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}
.lang-option:active { transform: scale(0.97); }
.lang-option.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(192,132,252,0.15), rgba(129,140,248,0.15));
  color: var(--accent);
}
.lang-flag { font-size: 18px; }

/* ── Видео-генерация ─────────────────────────────────────────────────── */
.video-editor { max-height: 92vh; max-width: 480px; }
.video-editor-body {
  overflow-y: auto;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.video-section { display: flex; flex-direction: column; gap: 8px; }
.video-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.video-count {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.video-duration-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.video-duration-btn {
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: border-color 0.15s, background 0.15s;
}
.video-duration-btn .dur { font-size: 16px; font-weight: 700; }
.video-duration-btn .cost { font-size: 11px; color: var(--text-muted); }
.video-duration-btn.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(192,132,252,0.15), rgba(129,140,248,0.15));
}
.video-duration-btn.active .cost { color: var(--accent); }

.video-avatars-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.video-avatar-card {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface2);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
}
.video-avatar-card.selected { border-color: var(--accent); }
.video-avatar-card img { width: 100%; height: 100%; object-fit: cover; object-position: 12.5% 75%; }

.video-scenes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.video-scene-cell, .video-scene-add {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface2);
}
.video-scene-cell img { width: 100%; height: 100%; object-fit: cover; }
.video-scene-add {
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 32px;
  font-weight: 300;
  transition: border-color 0.15s, color 0.15s;
}
.video-scene-add:hover { border-color: var(--accent); color: var(--accent); }

/* Badge "@image_N" поверх картинки */
.video-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: ui-monospace, 'SF Mono', monospace;
  letter-spacing: 0.3px;
  z-index: 2;
}

#video-prompt {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
}
#video-prompt:focus { outline: none; border-color: var(--accent); }
.video-prompt-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.video-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 0;
}

/* Плавающая пилюля прогресса */
.video-progress-pill {
  position: fixed;
  top: calc(var(--top-h) + 12px);
  right: 12px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 16px rgba(192, 132, 252, 0.4);
  cursor: pointer;
  animation: pulse 2s infinite;
}
.video-progress-pill.hidden { display: none; }
.video-progress-icon { font-size: 14px; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(192, 132, 252, 0.4); }
  50%      { box-shadow: 0 4px 22px rgba(192, 132, 252, 0.7); }
}

/* ── Имидж-разбор: кнопки выбора цели ───────────────────────────────── */
.imagemaker-goals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.imagemaker-goal {
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 12px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
  font-family: inherit;
  line-height: 1.3;
}
.imagemaker-goal:active { transform: scale(0.97); }
.imagemaker-goal.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(192,132,252,0.18), rgba(129,140,248,0.18));
  color: var(--accent);
}

/* ── Tab actions ──────────────────────────────────────────────────── */
.tab-actions { margin-top: 16px; }

/* ── Overlays ──────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fade-in 0.2s ease;
}
.overlay.hidden { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.processing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  max-width: 280px;
}
.processing-card .loading-spinner { margin: 0 auto 18px; }
.processing-card p { font-size: 15px; font-weight: 600; }
.processing-card .processing-sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90vh;
}
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
}
.result-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
#result-img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
}
.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
}
.result-actions button { margin: 0; }
