/* ============================================
   APP-SPECIFIC STYLES
   Layout, header, image area, empty state,
   loading, markers, history, compare slider,
   result actions, error toasts, and more
   ============================================ */

/* ============================================
   MAIN APP CONTAINER - Full viewport, no scroll
   ============================================ */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: -webkit-fill-available;
  overflow: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* When image is loaded, use grid layout for precise sizing */
.app.has-image {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "header"
    "image"
    "controls"
    "ad";
}

/* ============================================
   TOP BAR - Compact header
   ============================================ */
.top-bar {
  grid-area: header;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  position: relative;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  /* Native app-like hide on scroll */
  transition: transform 0.25s ease, opacity 0.25s ease;
  /* Ensure touch events work correctly on mobile */
  touch-action: manipulation;
}

/* Hidden state for mobile scroll behavior */
.top-bar.nav-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* Floating style when no image */
.app:not(.has-image) .top-bar {
  position: absolute;
  top: var(--safe-top);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* Nav always visible on mobile (removed hide-until-scroll behavior) */

/* Back button - shown when editing (has image) */
.back-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 14px;
  margin-left: 0;
  border-radius: 8px;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.back-btn:hover {
  color: var(--primary);
  background: var(--glow);
  border-color: var(--primary);
}

.back-btn:active {
  transform: scale(0.97);
}

.back-btn svg {
  flex-shrink: 0;
  color: currentColor;
}

/* Show back button when editing */
.app.has-image .back-btn {
  display: flex;
}

/* Ensure top-bar is above editor content but below sheets/modals */
.app.has-image .top-bar {
  position: relative;
  z-index: 150;
  isolation: isolate;
  background: var(--bg);
}

/* Ensure image area stays below top-bar in stacking order */
.app.has-image .image-area {
  z-index: 1;
}

.app.has-image .top-bar * {
  pointer-events: auto;
}

/* Logo - shown on homepage */
.logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  opacity: 0.9;
  text-decoration: none;
}

/* Hide logo when editing (back button takes its place) */
.app.has-image .logo {
  display: none;
}

/* Spacer pushes account button to the right */
.nav-spacer {
  flex: 1;
}

/* ============================================
   CREDITS BUTTON - Pill style
   ============================================ */
.credits-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  min-height: 36px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.credits-btn:hover {
  border-color: var(--primary);
  background: var(--glow);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(139, 124, 246, 0.15);
}

.credits-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.credits-btn.celebrate {
  animation: celebrateCredits 0.5s ease-out;
}

.credits-btn .free {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.credits-btn .count {
  font-weight: 600;
  color: var(--text);
}

.credits-btn .plus {
  color: var(--primary);
  font-weight: 600;
}

/* Next free edit indicator - shown when user has no credits */
.credits-btn .next-free {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ============================================
   HEADER CREDITS BADGE - Always visible when logged in
   ============================================ */
.header-credits {
  display: none; /* Hidden by default, shown when logged in */
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  margin-right: 12px;
}

.header-credits:hover {
  border-color: var(--primary);
  background: var(--glow);
}

.header-credits:active {
  transform: scale(0.96);
}

.header-credits-count {
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.header-credits-label {
  color: var(--text-muted);
  font-weight: 500;
}

/* Show when logged in */
.app.logged-in .header-credits {
  display: flex;
}

/* ============================================
   HEADER ANONYMOUS CTA - Sign in + Try Free
   ============================================ */
.header-anon-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-right: 4px;
}

.header-signin {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 2px;
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.header-signin:hover {
  color: var(--primary);
}

.header-pricing-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 8px 4px;
  transition: color 0.15s ease;
}

.header-pricing-link:hover {
  color: var(--primary);
}

.header-try-free {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.header-try-free svg {
  flex-shrink: 0;
}

.header-try-free:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.header-try-free:active {
  transform: scale(0.96);
}

/* Hide anonymous CTA when logged in */
.app.logged-in .header-anon-cta {
  display: none;
}

/* Hide user avatar button when anonymous (they use the CTA buttons) */
.app:not(.logged-in) .user-btn {
  display: none;
}

/* ============================================
   USER MENU - Button + Dropdown
   ============================================ */
.user-menu-wrapper {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  /* Fast transition for hover, instant for auth state change */
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.user-btn:active {
  transform: scale(0.92);
  background: var(--glow);
  border-color: var(--primary);
  transition: transform 0.05s ease;
}

.user-btn.logged-in {
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary);
  /* No transition delay for auth state - instant feedback */
}

/* User dropdown menu */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  /* Closing animation: smooth fade out */
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
  z-index: 1000;
  overflow: hidden;
}

.user-dropdown.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  /* Opening: instant appearance, no delay */
  transition: none;
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #f8f8f8;
  border-bottom: 1px solid var(--border);
}

.dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.dropdown-user-info {
  min-width: 0;
  flex: 1;
}

.dropdown-email {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-plan {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

.dropdown-section {
  padding: 8px;
  background: #ffffff;
}

.dropdown-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

.dropdown-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.dropdown-item:hover svg {
  color: var(--primary);
}

.dropdown-item-primary {
  background: var(--primary);
  color: white;
  justify-content: center;
  font-weight: 600;
}

.dropdown-item-primary:hover {
  background: var(--primary-hover);
}

.dropdown-item-primary svg {
  color: white;
}

.dropdown-item-primary:hover svg {
  color: white;
}

.dropdown-item-subtle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.dropdown-item-subtle:hover {
  color: var(--text);
}

.dropdown-item-muted {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
  justify-content: center;
  padding: 8px 12px;
}

.dropdown-item-muted:hover {
  color: var(--primary);
  background: transparent;
}

.dropdown-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: center;
  line-height: 1.4;
}

.dropdown-credits {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #f8f8f8;
  border-radius: 8px;
  margin-bottom: 8px;
}

.credits-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.credits-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

/* Language grid in dropdown */
.lang-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lang-chip {
  padding: 6px 10px;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s;
}

.lang-chip:hover {
  background: var(--glow);
  border-color: var(--primary);
  color: var(--primary);
}

.lang-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* NAV CTA - removed in nav redesign, hero handles upload CTA */

/* ============================================
   IMAGE AREA - Fills available space
   ============================================ */
.image-area {
  grid-area: image;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  padding: 8px;
}

/* Floating header offset when no image */
.app:not(.has-image) .image-area {
  padding-top: 56px;
}

/* ============================================
   EMPTY STATE - Premium upload area
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: rgba(139, 124, 246, 0.15) !important;
  border: 2px dashed rgba(139, 124, 246, 0.5) !important;
  border-radius: 16px;
  margin: 16px;
  width: calc(100% - 32px);
  height: calc(100% - 32px);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 4px 12px rgba(139, 124, 246, 0.2));
}

.empty-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
  text-align: center;
}

.empty-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
  max-width: 300px;
  line-height: 1.5;
}

.upload-cta {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(139, 124, 246, 0.35);
  transition: all 0.2s ease;
}

.empty-state:hover .upload-cta {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 124, 246, 0.4);
}

.empty-state:active,
.empty-state:active .upload-cta {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(139, 124, 246, 0.3);
}

.empty-state .hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.75;
}

.social-proof {
  font-size: 0.8rem;
  color: var(--text-dimmed);
  margin-top: 20px;
  opacity: 0.8;
}

.try-free-text {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 6px;
}

/* Pulse effect - subtle glow */
.pulse-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  pointer-events: none;
}

.pulse-ring {
  width: 120px;
  height: 120px;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
  opacity: 0.6;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.3;
  }
}

/* ============================================
   IMAGE CONTAINER - Fills available space
   ============================================ */
.image-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}

.image-container.visible {
  display: flex;
}

/* Image wrapper - centers image, constrained to container */
.image-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
}

/* Current image - scales to fit while maintaining aspect ratio */
#currentImage {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Result image reveal animation */
#currentImage.revealing {
  animation: imageReveal 0.4s ease-out;
}

/* Original image overlay - positioned over current image for comparison */
#originalImage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 5;
  pointer-events: none;
}

#originalImage.show {
  opacity: 1;
}

/* ============================================
   EDIT MARKERS
   ============================================ */
.edit-marker {
  position: absolute;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 20;
  display: none;
}

.edit-marker.visible {
  display: block;
}

.edit-marker-inner {
  width: 100%;
  height: 100%;
  border: 3px solid var(--marker);
  border-radius: 50%;
  background: var(--marker-bg);
  animation: marker-pulse 1.5s ease-in-out infinite;
}

.edit-marker-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  background: var(--marker);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-num {
  font-size: 10px;
  font-weight: 700;
  color: white;
}

.clear-marker-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  z-index: 25;
  display: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.clear-marker-btn:hover {
  background: white;
  border-color: var(--error);
  color: var(--error);
  transform: scale(1.02);
}

.clear-marker-btn.visible {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================
   IMAGE TIP - Subtle hint
   ============================================ */
.image-tip {
  text-align: center;
  width: 100%;
  padding: 8px 16px;
  font-size: 0.75rem;
  color: var(--text-dimmed);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.image-tip.visible {
  opacity: 1;
}

.image-tip .shimmer {
  background: linear-gradient(
    90deg,
    var(--text-dimmed) 0%,
    var(--text-muted) 50%,
    var(--text-dimmed) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s ease-in-out infinite;
}

/* ============================================
   LOADING OVERLAY - Elevated AI Processing
   ============================================ */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.loading-overlay.visible {
  display: flex;
  animation: loadingFadeIn 0.4s ease-out;
}

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

/* Shimmer effect that sweeps across the overlay */
.loading-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(139, 124, 246, 0.08) 40%,
    rgba(139, 124, 246, 0.12) 50%,
    rgba(139, 124, 246, 0.08) 60%,
    transparent 80%
  );
  background-size: 200% 100%;
  animation: loadingShimmer 2.5s ease-in-out infinite;
  pointer-events: none;
}

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

/* Centered progress card */
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px 40px;
  background: white;
  border-radius: 24px;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 1;
  max-width: 320px;
  animation: loadingCardIn 0.5s ease-out 0.1s both;
}

@keyframes loadingCardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Circular progress ring */
.loading-ring {
  width: 100px;
  height: 100px;
  position: relative;
}

.loading-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.loading-ring-bg {
  fill: none;
  stroke: rgba(139, 124, 246, 0.15);
  stroke-width: 8;
}

.loading-ring-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283; /* 2 * PI * 45 */
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 0.4s ease-out;
}

.loading-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.loading-percent {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.loading-percent-sign {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Status message */
.loading-message {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  animation: loadingPulse 2s ease-in-out infinite;
}

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

/* Progress stages indicator */
.loading-stages {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 12px 0;
}

.loading-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.loading-stage.active {
  opacity: 1;
}

.loading-stage.completed {
  opacity: 0.7;
}

.loading-stage.active .stage-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(139, 124, 246, 0.2);
  animation: stagePulse 1.5s ease-in-out infinite;
}

.loading-stage.completed .stage-dot {
  background: var(--primary);
}

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

.stage-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s ease;
}

.loading-stage span {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.loading-stage.active span {
  color: var(--primary);
}

.loading-stage-line {
  width: 32px;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  margin-bottom: 18px;
  border-radius: 1px;
  transition: background 0.3s ease;
}

.loading-stage-line.completed {
  background: var(--primary);
}

/* Tip or fun fact */
.loading-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(139, 124, 246, 0.06);
  border-radius: 12px;
  max-width: 100%;
  animation: tipFadeIn 0.5s ease-out 0.6s both;
}

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

.loading-tip-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.loading-tip-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================
   CHANGE PHOTO BUTTON - Floating pill
   ============================================ */
.change-photo-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  z-index: 15;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.change-photo-btn:hover {
  background: white;
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(139, 124, 246, 0.2);
}

/* ============================================
   BOTTOM CONTROLS - Fixed at bottom
   ============================================ */
.controls {
  grid-area: controls;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.controls.hidden {
  display: none;
}

/* ============================================
   EDIT ACTIONS
   ============================================ */
.edit-actions {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-actions.hidden {
  display: none;
}

.action-row {
  display: flex;
  gap: 10px;
}

/* Icon-only button (for change photo) */
.action-row .btn-secondary {
  flex: 0;
  padding: 14px 18px;
  font-size: 1.2rem;
}

/* ============================================
   RESULT ACTIONS - Clean grid layout
   ============================================ */
.result-actions {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 0;
  width: 100%;
}

.result-actions.visible {
  display: grid;
  animation: result-actions-in 0.25s ease-out;
}

@keyframes result-actions-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Action button base */
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 56px;
}

.action-btn svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* Primary action (Save) - Prominent */
.action-btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.action-btn-primary:active {
  transform: scale(0.95);
}

/* Secondary actions */
.action-btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.action-btn-secondary:active {
  transform: scale(0.95);
  background: var(--bg-secondary);
}

/* Add Photo button - dashed border */
#addPhotoBtn {
  border-style: dashed;
}

/* Hide Add Photo when 2 photos present - show 3-column grid */
body.has-two-photos .result-actions {
  grid-template-columns: repeat(3, 1fr);
}

body.has-two-photos #addPhotoBtn {
  display: none;
}

/* ============================================
   SOFT UPSELL BANNER - Shown after successful edit
   ============================================ */
.soft-upsell-banner {
  display: none; /* Hidden by default, JS shows when appropriate */
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(139, 124, 246, 0.08) 0%, rgba(124, 58, 237, 0.12) 100%);
  border: 1px solid rgba(139, 124, 246, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 12px;
  /* Ensure proper touch targets and visibility */
  position: relative;
  z-index: 10;
  min-height: 48px; /* Minimum touch target height */
}

.soft-upsell-banner.visible {
  display: flex;
}

.soft-upsell-text {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
}

.soft-upsell-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 44px; /* iOS recommended touch target */
  touch-action: manipulation;
}

.soft-upsell-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.soft-upsell-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.soft-upsell-dismiss:hover {
  opacity: 1;
}

/* ============================================
   RATE LIMIT BANNER - Shown when 3 free edits/hour exhausted
   Fixed position below header, similar to error toast
   ============================================ */
.rate-limit-banner {
  position: fixed;
  top: calc(60px + var(--safe-top));
  left: 16px;
  right: 16px;
  max-width: 500px;
  margin: 0 auto;
  z-index: 299; /* Just below error toast (300) */
  display: none; /* Hidden by default, JS shows when rate limited */
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

.rate-limit-banner.visible {
  display: flex;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.rate-limit-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.rate-limit-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.rate-limit-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rate-limit-title {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.rate-limit-title strong {
  font-weight: 700;
  color: #b45309;
  font-variant-numeric: tabular-nums;
}

.rate-limit-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rate-limit-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.rate-limit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

@media (max-width: 480px) {
  .rate-limit-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .rate-limit-btn {
    width: 100%;
    text-align: center;
  }
}

/* Credits remaining - scarcity indicator */
.credits-remaining {
  display: none; /* Hidden by default, JS shows when appropriate */
  justify-content: center;
  padding: 8px 0 0 0;
}

.credits-remaining.visible {
  display: flex;
}

.credits-remaining span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Done editing button - shows after "Edit more" */
.done-editing-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s ease;
}

.done-editing-btn:hover {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--primary-light);
}

.done-editing-btn.hidden {
  display: none;
}

/* ============================================
   ERROR TOAST
   ============================================ */
.error-toast {
  position: fixed;
  top: calc(60px + var(--safe-top));
  left: 16px;
  right: 16px;
  background: var(--error);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

.error-toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Trust-building technical error toast */
.error-toast.technical-error {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  padding: 16px;
  line-height: 1.4;
}

.technical-error-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.technical-error-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.technical-error-text {
  flex: 1;
}

.technical-error-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.technical-error-subtitle {
  opacity: 0.95;
  font-size: 0.85rem;
}

/* ============================================
   EDIT HISTORY - Polished timeline strip
   ============================================ */
.history-strip {
  display: none;
  padding: 12px 0;
  flex-shrink: 0;
}

.history-strip.visible {
  display: block;
}

.history-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 2px;
}

.history-scroll::-webkit-scrollbar {
  display: none;
}

.history-items {
  display: flex;
  gap: 10px;
  align-items: center;
  /* Container is not interactive - items inside are */
  cursor: default;
}

.history-item {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-secondary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  /* Ensure touch tap highlight for mobile feedback */
  -webkit-tap-highlight-color: rgba(139, 124, 246, 0.3);
  /* Prevent text selection on rapid clicks */
  user-select: none;
  -webkit-user-select: none;
}

.history-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--glow), 0 4px 16px rgba(139, 124, 246, 0.25);
  transform: scale(1.08);
}

.history-item:not(.active):hover {
  border-color: var(--primary-light, #a5a0f6);
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Active/pressed state for click feedback */
.history-item:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.history-item.active:active {
  transform: scale(1.02);
}

/* Focus state for accessibility and keyboard navigation */
.history-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-color: var(--primary);
}

.history-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
  /* Let clicks pass through to parent */
  pointer-events: none;
}

.history-item:hover img {
  transform: scale(1.05);
}

.history-item .step-num {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: white;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  /* Let clicks pass through to parent */
  pointer-events: none;
}

.history-item.original .step-num {
  background: linear-gradient(135deg, var(--primary), #9f8cf7);
}

.history-prompt {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 16px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ============================================
   BEFORE/AFTER COMPARISON SLIDER
   ============================================ */
.compare-slider-container {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 10;
  pointer-events: none;
}

.compare-slider-container.visible {
  display: block;
  pointer-events: auto;
}

.compare-slider-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.compare-slider-clip img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.compare-slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: white;
  cursor: ew-resize;
  z-index: 15;
  box-shadow: 0 0 8px rgba(0,0,0,0.3);
}

.compare-slider-handle::before,
.compare-slider-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-slider-handle::before {
  left: -18px;
  transform: translateY(-50%);
}

.compare-slider-handle::after {
  display: none;
}

.compare-slider-arrows {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.compare-slider-label {
  position: absolute;
  top: 12px;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  z-index: 5;
}

.compare-slider-label.before {
  left: 12px;
}

.compare-slider-label.after {
  right: 12px;
}

/* After image - background layer */
.compare-after-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
}

.compare-slider-clip {
  z-index: 2;
}

/* Floating compare button on image */
.compare-float-btn {
  display: none;
  position: absolute;
  bottom: 50px;
  left: 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  transition: all 0.15s;
  z-index: 10;
}

/* Show only when there's a result - with attention animation */
body.has-result .compare-float-btn {
  display: inline-flex;
  animation: compare-btn-pop 0.5s ease-out 0.5s both;
}

@keyframes compare-btn-pop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.compare-float-btn:hover {
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
}

.compare-float-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.compare-float-btn svg {
  opacity: 0.9;
}

/* ============================================
   HOMEPAGE CONTENT SECTION
   ============================================ */

/* Hide homepage content and footer when in editor mode (image uploaded) */
.app.has-image ~ .homepage-content,
.app.has-image ~ .seo-footer {
  display: none;
}

.homepage-content {
  background: var(--bg);
  overflow-x: hidden;
  width: 100%;
}

/* Section Bands - Full-width sections with contained content */
.section-band {
  padding: 56px 24px;
}

.section-band-subtle {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 32px 24px; /* Tighter for testimonial */
}

@media (max-width: 768px) {
  .section-band-subtle {
    padding: 24px 16px;
  }
}

.section-band-features {
  background: var(--bg);
}

.band-inner {
  max-width: 640px;
  margin: 0 auto;
}

.band-inner-wide {
  max-width: 960px;
}

/* Testimonial Spotlight */
.testimonial-spotlight {
  text-align: center;
}

.testimonial-spotlight .quote-mark {
  opacity: 0.08;
  margin-bottom: 12px;
}

.testimonial-spotlight blockquote {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 20px 0;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.testimonial-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.testimonial-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.testimonial-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.testimonial-divider {
  color: var(--text-muted);
  opacity: 0.5;
}

.testimonial-note {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============================================
   USE CASE SHOWCASES - Creative Differentiated Sections
   ============================================ */

/* Base showcase block */
.showcase-block {
  padding: 48px 24px;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Animation enhancement - start visible, animate when JS adds class */
.showcase-block[data-animate] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.showcase-block[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fallback: show content if JS hasn't run after 2s */
@media (prefers-reduced-motion: no-preference) {
  .showcase-block[data-animate] {
    animation: showcase-fallback 0s 2s forwards;
  }
}

@keyframes showcase-fallback {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.showcase-inner {
  width: 100%;
  max-width: none;
  padding: 0 48px;
  box-sizing: border-box;
}

/* Shared typography */
.showcase-headline {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 16px 0;
}

.showcase-headline-xl {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: white;
  margin: 0 0 20px 0;
}

.showcase-subline {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
  max-width: 500px;
}

.showcase-subline-light {
  font-size: 1.15rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.7);
  margin: 0 0 40px 0;
  max-width: 480px;
}

.showcase-text-center {
  text-align: center;
  margin-bottom: 48px;
}

.showcase-text-center .showcase-subline {
  margin: 0 auto;
}

.showcase-chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: rgba(139, 124, 246, 0.1);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.showcase-micro-prompt {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 20px 0 0 0;
}

/* Split layout */
.showcase-split {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 48px;
  align-items: center;
}

.showcase-left-col {
  padding-right: 20px;
}

/* === SHOWCASE CONTENT ROW - Horizontal layout === */
.showcase-content-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 48px;
  align-items: center;
}

.showcase-content-row.reverse {
  grid-template-columns: 1.2fr 1fr;
}

.showcase-content-row.reverse .showcase-text-side {
  order: 2;
}

.showcase-content-row.reverse .showcase-image-side {
  order: 1;
}

.showcase-text-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.showcase-text-side .showcase-headline {
  margin: 0;
}

.showcase-text-side .showcase-subline {
  margin: 0;
}

.showcase-image-side {
  width: 100%;
}

/* Before/After Pair */
.before-after-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ba-image {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.ba-image img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.ba-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0,0,0,0.6);
  color: white;
}

/* === REMOVAL SECTION === */
.showcase-removal {
  background: var(--bg);
}

/* === BACKGROUNDS SECTION === */
.showcase-backgrounds {
  background: var(--bg-subtle);
}

.prompt-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.prompt-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 100px;
}


/* === COMBINE SECTION === */
.showcase-combine {
  background: var(--bg);
}

.combine-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.combine-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
}

.combine-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--glow);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.combine-plus,
.combine-arrow {
  color: var(--text-muted);
  font-weight: 600;
  opacity: 0.5;
}

.combine-result {
  background: var(--glow);
  border-color: var(--primary);
  color: var(--primary);
}

.combine-result svg {
  color: var(--primary);
}

.combine-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.combine-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.combine-input-img {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.combine-input-img img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.combine-output {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.combine-output img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.combine-img-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0,0,0,0.6);
  color: white;
}

/* === SMART MODE SECTION === */
.showcase-smart {
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  padding: 64px 24px;
  overflow-x: hidden;
}

.smart-header {
  text-align: center;
  margin-bottom: 32px;
}

.smart-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.15);
  padding: 8px 20px;
  border-radius: 100px;
  border: 1px solid rgba(167, 139, 250, 0.3);
  margin-bottom: 20px;
}

.showcase-headline-light {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: white;
  margin: 0;
  line-height: 1.2;
}

/* Prompt display */
.smart-prompt-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 40px;
}

.smart-prompt-display .prompt-quote {
  font-size: 2rem;
  color: #a78bfa;
  opacity: 0.5;
  font-family: Georgia, serif;
}

.smart-prompt-display p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.9);
  margin: 0;
  font-style: italic;
}

/* Cascade timeline */
.smart-cascade {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  overflow-x: auto;
  padding: 8px 0;
}

.cascade-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.cascade-img {
  width: 180px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  margin-bottom: 12px;
}

.cascade-img img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.cascade-final .cascade-img {
  box-shadow: 0 8px 32px rgba(167, 139, 250, 0.3), 0 8px 24px rgba(0,0,0,0.4);
  border: 2px solid rgba(167, 139, 250, 0.5);
}

.cascade-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cascade-edits {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.cascade-edits span {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.05);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.cascade-arrow {
  color: rgba(167, 139, 250, 0.4);
  font-size: 1.5rem;
  margin-top: 60px;
  flex-shrink: 0;
}

/* Value stats */
.smart-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px 32px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  max-width: 500px;
  margin: 0 auto;
}

.value-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.value-number {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  line-height: 1;
}

.value-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.value-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.1);
}


/* Final CTA */
.final-cta {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  border-top: 1px solid var(--border);
}

.final-cta h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
}

.final-cta p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 24px 0;
}

.final-cta .hero-upload-btn {
  font-size: 1rem;
  padding: 14px 28px;
}

/* Mobile responsive */
@media (max-width: 900px) {
  .showcase-content-row,
  .showcase-content-row.reverse {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .showcase-content-row.reverse .showcase-text-side,
  .showcase-content-row.reverse .showcase-image-side {
    order: unset;
  }

  .showcase-text-side {
    text-align: center;
  }

  .showcase-text-side .showcase-subline {
    margin: 0 auto;
  }

  .prompt-examples {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .section-band {
    padding: 32px 16px;
  }

  .testimonial-spotlight blockquote {
    font-size: 1.1rem;
  }

  .showcase-block {
    padding: 40px 16px;
  }

  .showcase-inner {
    padding: 0 8px;
  }

  .showcase-headline {
    font-size: 1.5rem;
  }

  .showcase-headline-xl {
    font-size: 1.75rem;
  }

  .showcase-subline {
    font-size: 0.95rem;
  }

  .before-after-pair {
    gap: 12px;
  }

  .ba-image img {
    border-radius: 8px;
  }

  /* Smart mode mobile */
  .showcase-smart {
    padding: 48px 16px;
  }

  .showcase-headline-light {
    font-size: 1.5rem;
  }

  .smart-prompt-display p {
    font-size: 0.95rem;
  }

  .smart-cascade {
    gap: 8px;
    justify-content: flex-start;
    padding-left: 16px;
    padding-right: 16px;
    margin-left: -16px;
    margin-right: -16px;
  }

  .cascade-img {
    width: 140px;
  }

  .cascade-edits span {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .cascade-arrow {
    font-size: 1.2rem;
    margin-top: 45px;
  }

  .smart-value {
    gap: 20px;
    padding: 20px 24px;
  }

  .value-number {
    font-size: 1.5rem;
  }

  .value-label {
    font-size: 0.65rem;
  }

  .final-cta {
    padding: 48px 16px;
  }

  .final-cta h2 {
    font-size: 1.35rem;
  }

  .final-cta p {
    font-size: 0.9rem;
  }

  /* Combine section mobile */
  .combine-flow {
    justify-content: center;
  }

  .combine-inputs {
    gap: 8px;
  }

  /* Footer links - larger touch targets on mobile */
  .seo-footer-links {
    gap: 2px 8px;
  }

  .seo-footer-links a {
    padding: 12px 6px;
    font-size: 0.9rem;
  }

  .seo-footer-international p {
    line-height: 2.2;
  }

  .seo-footer-international a {
    padding: 12px 8px;
  }
}

/* Legacy - keep for compatibility */
.homepage-content-inner {
  max-width: 900px;
  margin: 0 auto;
}

/* Value Proposition */
.value-prop {
  text-align: center;
  margin-bottom: 48px;
}

.value-prop h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.3;
}

.value-prop p {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Use Cases Grid */
.use-cases {
  margin-bottom: 48px;
}

.use-cases h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  text-align: center;
}

.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.use-case-card {
  display: block;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.use-case-card:hover {
  border-color: var(--primary);
  background: var(--card-hover);
}

.use-case-card .icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.use-case-card .title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.use-case-card .desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* FAQ Section */
.faq-section {
  margin-bottom: 24px;
}

.faq-section h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  text-align: center;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}

.faq-question {
  width: 100%;
  padding: 16px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.faq-question:hover {
  background: var(--card-hover);
}

.faq-question .toggle {
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.faq-item.open .faq-question .toggle {
  transform: rotate(45deg);
}

.faq-answer {
  display: none;
  padding: 0 16px 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.faq-item.open .faq-answer {
  display: block;
}

/* ============================================
   SEO FOOTER
   ============================================ */
.seo-footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  padding: 32px 20px 24px;
  margin-top: auto;
}

.seo-footer-inner {
  max-width: 1000px;
  margin: 0 auto;
}

.seo-footer-section {
  margin-bottom: 24px;
}

.seo-footer-section:last-child {
  margin-bottom: 0;
}

.seo-footer-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.seo-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.seo-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
  padding: 10px 4px;
  display: inline-block;
}

.seo-footer-links a:hover {
  color: var(--primary);
}

.seo-footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 24px;
}

.seo-footer-bottom p {
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.seo-footer-international {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 24px;
}

.seo-footer-international p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.international-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}

.seo-footer-international a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  padding: 10px 6px;
  display: inline-block;
}

.seo-footer-international a:hover {
  color: var(--primary);
}

/* ============================================
   MOBILE RESPONSIVE - Small screens
   ============================================ */
@media (max-width: 375px) {
  .top-bar {
    padding: 12px 16px;
  }

  .empty-title {
    font-size: 1.3rem;
  }

  .empty-subtitle {
    font-size: 0.9rem;
    max-width: 260px;
  }

  .upload-cta {
    padding: 12px 24px;
    font-size: 0.95rem;
  }

  .controls {
    padding: 12px;
  }
}

/* ============================================
   TABLET/DESKTOP RESPONSIVE
   ============================================ */
@media (min-width: 600px) {
  .homepage-content {
    padding: 0; /* Sections handle their own padding */
  }

  .value-prop h2 {
    font-size: 1.75rem;
  }

  .use-cases-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .faq-list {
    gap: 8px;
  }
}

/* Tablet: slightly larger thumbnails */
@media (min-width: 768px) {
  .history-item {
    width: 56px;
    height: 56px;
  }

  .history-item .step-num {
    font-size: 9px;
    padding: 2px 6px;
  }

  .seo-footer {
    padding: 40px 24px 32px;
  }

  .seo-footer-sections {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
  }

  .seo-footer-section {
    margin-bottom: 0;
  }

  .seo-footer-links {
    flex-direction: column;
    gap: 8px;
  }
}

/* ============================================
   DESKTOP - Centered, stacked layout
   ============================================ */
@media (min-width: 900px) {
  .app {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0;
  }

  /* Top bar */
  .top-bar {
    position: relative;
    padding: 16px 24px;
    background: var(--bg);
    border-bottom: none;
  }

  /* Override absolute positioning on desktop for empty state */
  .app:not(.has-image) .top-bar {
    position: relative;
    left: auto;
    right: auto;
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
  }

  .logo {
    font-size: 1.1rem;
  }

  /* Image area - centered, constrained */
  .image-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0; /* Reset: header is position:relative on desktop, in flow */
    min-height: 0;
  }

  .image-container img {
    border-radius: 12px;
  }

  /* Empty state */
  .empty-state .icon {
    font-size: 4rem;
  }

  .empty-title {
    font-size: 2rem;
  }

  .empty-subtitle {
    font-size: 1.05rem;
    max-width: 400px;
  }

  .upload-cta {
    padding: 16px 32px;
    font-size: 1.05rem;
  }

  /* History strip - centered inline */
  .history-strip {
    padding: 12px 0;
  }

  .history-strip .history-items {
    justify-content: center;
  }

  .history-item {
    width: 60px;
    height: 60px;
  }

  /* Controls - centered below image */
  .controls {
    padding: 16px 0 24px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }

  .controls.hidden {
    display: none;
  }

  /* Prompt - clean, full width */
  .prompt-input {
    font-size: 1rem;
    padding: 14px 18px;
    min-height: 52px;
  }

  /* Edit actions on desktop - keep column layout */
  .edit-actions {
    gap: 12px;
  }

  .edit-btn {
    flex: 0 0 auto;
    min-width: 140px;
  }

  /* Result actions - larger gap on big screens */
  .result-actions {
    gap: 12px;
  }

  /* Compare hint */
  .compare-hint {
    bottom: auto;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Hover states */
  .credits-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px var(--glow);
  }

  .user-btn:hover {
    border-color: var(--primary);
    color: var(--text);
  }

  .history-item:hover:not(.active) {
    transform: scale(1.08);
    border-color: var(--primary);
  }
}

/* ============================================
   LARGER SCREENS
   ============================================ */
@media (min-width: 1200px) {
  .app:not(.has-image) {
    max-width: 1000px;
  }

  .app:not(.has-image) .controls {
    max-width: 650px;
  }
}

/* ============================================
   DESKTOP SIDE-BY-SIDE EDITOR
   Image on left, controls on right, no scrolling
   ============================================ */
@media (min-width: 1024px) {
  .app.has-image {
    display: grid;
    grid-template-columns: 1fr 420px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "header header"
      "image sidebar"
      "ad ad";
    max-width: none;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }

  .app.has-image .top-bar {
    grid-area: header;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
  }

  .app.has-image .image-area {
    grid-area: image;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-secondary);
    min-height: 0;
    overflow: hidden;
  }

  .app.has-image .image-container {
    max-width: 100%;
    max-height: 100%;
  }

  .app.has-image .image-container img {
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* Right sidebar with controls */
  .app.has-image .controls {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--bg);
    border-left: 1px solid var(--border);
    border-top: none;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: none;
    width: 100%;
    /* Hide scrollbar unless actually scrolling */
    scrollbar-gutter: stable;
  }

  /* Hide scrollbar when not needed (content fits) */
  .app.has-image .controls::-webkit-scrollbar {
    width: 6px;
  }

  .app.has-image .controls::-webkit-scrollbar-track {
    background: transparent;
  }

  .app.has-image .controls::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }

  .app.has-image .controls::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
  }

  .app.has-image .controls.hidden {
    display: none;
  }

  /* Edit card styling for sidebar */
  .app.has-image .edit-card {
    background: var(--bg-secondary);
    border-radius: 14px;
    padding: 16px;
    border: 1px solid var(--border);
  }

  .app.has-image .edit-actions {
    max-width: none;
  }

  .app.has-image .prompt-input {
    font-size: 0.95rem;
    min-height: 60px;
  }

  /* Quality toggle - stack vertically in sidebar */
  .app.has-image .edit-card-footer {
    flex-direction: column;
    gap: 12px;
  }

  .app.has-image .footer-left {
    width: 100%;
  }

  .app.has-image .quality-toggle {
    width: 100%;
  }

  .app.has-image .quality-pill {
    flex: 1;
  }

  .app.has-image .edit-btn {
    width: 100%;
    padding: 14px;
    font-size: 0.95rem;
  }

  /* Sticky submit button - always visible at bottom of sidebar */
  .app.has-image .edit-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  .app.has-image .edit-card-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    padding-top: 16px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    z-index: 2;
  }

  /* Ensure controls panel doesn't have extra padding at bottom */
  .app.has-image .controls {
    padding-bottom: 0;
  }

  .app.has-image .edit-card {
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .app.has-image .edit-card-footer {
    padding-bottom: 20px;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Quick edit section - compact in sidebar */
  .app.has-image .quick-edit-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .app.has-image .quick-edit-grid {
    gap: 8px;
  }

  .app.has-image .quick-edit-btn {
    padding: 10px 12px;
    min-height: 40px;
    font-size: 0.8rem;
  }

  /* Result actions in sidebar - 2x2 grid on desktop */
  .app.has-image .result-actions {
    margin-top: auto;
    padding-top: 20px;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .app.has-image.has-two-photos .result-actions,
  body.has-two-photos .app.has-image .result-actions {
    grid-template-columns: repeat(3, 1fr);
  }

  /* History strip in sidebar - polished timeline */
  .app.has-image .history-strip {
    margin: 16px 0;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
  }

  .app.has-image .history-strip .history-items {
    justify-content: flex-start;
  }

  .app.has-image .history-item {
    width: 52px;
    height: 52px;
  }

  /* Reference image button */
  .app.has-image .reference-btn {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
  }
}

/* ============================================
   MOBILE UI/UX PARITY
   Full-screen app-like experience
   ============================================ */

/* Viewport lock - prevents browser chrome jank (only when editing) */
html:has(.app.has-image),
body:has(.app.has-image) {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
  overscroll-behavior: none;
  /* Note: touch-action: none removed - it blocks button clicks */
}

.app.has-image {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
}

/* Only disable touch gestures on the image area, not buttons */
.app.has-image .image-container {
  touch-action: pan-y pinch-zoom;
}

/* Prevent any horizontal overflow on mobile */
@media (max-width: 768px) {
  .app.has-image,
  .app.has-image * {
    max-width: 100vw;
  }

  /* Hide nav bar in editor mode - touch events broken on iOS Safari */
  .app.has-image .top-bar {
    display: none;
  }

  .app.has-image .image-container {
    overflow: hidden;
    overscroll-behavior: none;
  }

  /* Controls need visible overflow for banners, but prevent horizontal scroll */
  .app.has-image .controls {
    overflow-x: hidden;
    overflow-y: visible;
    overscroll-behavior: none;
  }

  /* Allow vertical touch on controls for scrolling if needed */
  .app.has-image .controls {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  /* Allow touch on image for tap interactions */
  .app.has-image .image-container {
    touch-action: manipulation;
  }
}

/* ============================================
   MOBILE TOUCH TARGETS (768px and below)
   All interactive elements 44px+ minimum
   ============================================ */
@media (max-width: 768px) {
  /* Header buttons */
  .credits-btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .user-btn {
    width: 44px;
    height: 44px;
  }

  /* Header credits badge - mobile touch targets */
  .header-credits {
    min-height: 44px;
    padding: 10px 14px;
  }

  /* Header anonymous CTA - mobile adjustments */
  .header-anon-cta {
    gap: 8px;
  }

  .header-pricing-link {
    display: none; /* Hide on mobile - pricing section is visible on scroll */
  }

  .header-signin {
    padding: 10px 8px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .header-try-free {
    padding: 10px 14px;
    min-height: 44px;
    gap: 6px;
  }

  /* Nav CTA - hide on mobile homepage (redundant with hero CTA) */
  /* Exception: show when user has free edit (green "Upload — Free" button) */
  .app:not(.has-image) .nav-cta:not(.has-free) {
    display: none;
  }

  /* Nav CTA - touch friendly (when visible in other states) */
  .nav-cta {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 0.9rem;
  }

  /* Mobile back button - show when editing, hide logo */
  .app.has-image .back-btn {
    display: flex;
    min-height: 44px;
  }

  .app.has-image .logo {
    display: none;
  }

  /* User dropdown - use bottom sheet on mobile instead */
  .user-dropdown {
    display: none !important;
  }

  /* Override user button to open bottom sheet on mobile */
  .user-btn {
    /* JS handles opening bottom sheet on mobile */
  }

  /* Quality pills */
  .quality-pill {
    min-height: 44px;
    padding: 8px 12px;
  }

  /* Edit button */
  .edit-btn {
    min-height: 48px;
    padding: 14px 24px;
  }

  /* Change photo button - hide on mobile (user can cancel and upload new) */
  .change-photo-btn {
    display: none;
  }

  /* Clear marker button */
  .clear-marker-btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* Hide compare slider on mobile - doesn't work well with touch */
  .compare-slider-container,
  .compare-float-btn {
    display: none !important;
  }

  /* Hide Upload button when editing on mobile */
  .app.has-image .nav-cta {
    display: none !important;
  }

  /* Default history strip */
  .history-strip {
    padding: 4px 0;
  }

  .history-item {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  .history-scroll {
    padding: 2px 12px;
    gap: 6px;
  }

}

/* ============================================
   HISTORY STRIP - Scroll UX enhancements
   ============================================ */
.history-strip {
  position: relative;
}

.history-scroll {
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  padding: 4px 16px;
  /* Enable horizontal touch scrolling, prevent accidental vertical scroll */
  touch-action: pan-x;
  cursor: grab;
}

.history-scroll:active {
  cursor: grabbing;
}

.history-item {
  scroll-snap-align: center;
}

/* Fade edge indicators for scroll */
.history-strip::before,
.history-strip::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s;
}

.history-strip::before {
  left: 0;
  background: linear-gradient(to right, var(--bg), transparent);
}

.history-strip::after {
  right: 0;
  background: linear-gradient(to left, var(--bg), transparent);
}

.history-strip.can-scroll-left::before,
.history-strip.can-scroll-right::after {
  opacity: 1;
}

/* ============================================
   MOBILE IMAGE OPTIMIZATION
   Maximize image space, compact controls
   ============================================ */
@media (max-width: 768px) {
  /* Image takes priority - reduce padding */
  .image-container {
    padding: 4px;
  }

  /* More compact controls on mobile - maximize image space */
  .app.has-image .controls {
    padding: 6px 10px;
    padding-bottom: calc(6px + var(--safe-bottom));
    gap: 4px;
  }

  /* Prompt input - must be 16px+ to prevent iOS zoom */
  .prompt-input {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 16px;
  }

  /* Compact action row - put quality and button on same line */
  .action-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .quality-toggle {
    flex-shrink: 0;
  }

  .edit-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.9rem;
    min-height: 44px;
  }

  /* ============================================
     MOBILE RESULT STATE - Maximum image focus
     ============================================ */
  body.has-result .image-container {
    padding: 2px;
  }

  /* Ultra-compact controls when result is showing */
  body.has-result .app.has-image .controls {
    padding: 6px 10px;
    padding-bottom: calc(6px + var(--safe-bottom));
    gap: 4px;
  }

  /* Prompt input after result - still usable for continued editing */
  body.has-result .prompt-input {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 16px;
  }

  /* Compact action row after result */
  body.has-result .action-row {
    gap: 6px;
  }

  body.has-result .quality-pill {
    padding: 6px 10px;
    font-size: 0.7rem;
    min-height: 34px;
  }

  body.has-result .edit-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    min-height: 38px;
  }

  /* Hide history strip when result is showing */
  body.has-result .history-strip {
    display: none;
  }

  /* Result action buttons - compact grid on mobile */
  body.has-result .result-actions {
    padding: 8px 0 0;
    gap: 6px;
  }

  body.has-result .action-btn {
    padding: 10px 6px;
    font-size: 0.7rem;
    gap: 3px;
    min-height: 52px;
  }

  body.has-result .action-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Reference button - compact in result state */
  body.has-result .reference-btn {
    padding: 6px 10px;
    min-height: 34px;
  }

  body.has-result .reference-btn-text {
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) and (max-height: 750px) {
  /* Extra small screens - keep prompt but make more compact */
  body.has-result .prompt-input {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 16px; /* Must stay 16px+ to prevent iOS zoom */
  }

  /* Keep action row but make it minimal */
  body.has-result .action-row {
    gap: 4px;
  }

  body.has-result .quality-toggle-wrapper {
    display: none; /* Hide quality on very small screens */
  }

  body.has-result .reference-btn {
    padding: 4px 8px;
    min-height: 32px;
  }

  body.has-result .reference-btn-text {
    display: none; /* Just show icon on tiny screens */
  }

  /* Compact controls */
  body.has-result .controls {
    padding: 4px 8px;
    padding-bottom: calc(4px + var(--safe-bottom));
  }

  /* Smaller history strip */
  .history-strip {
    padding: 6px 0;
    margin: 8px 0;
  }

  .history-item {
    width: 48px;
    height: 48px;
  }

  /* Compact quality toggle */
  .quality-toggle {
    gap: 4px;
  }

  .quality-pill {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  /* Hide less important elements when space is tight */
  .edit-card-footer .footer-right {
    display: none;
  }
}

/* Extra compact for very small phones */
@media (max-width: 380px) {
  .prompt-input {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 16px; /* Must stay 16px+ to prevent iOS zoom */
  }

  .edit-btn {
    padding: 10px 16px;
  }
}

/* ============================================
   VERY SMALL SCREENS (480px and below)
   Extra compact for small phones
   ============================================ */
@media (max-width: 480px) {
  .reference-card-hint {
    display: none;
  }
}

/* ============================================
   SHORT SCREENS (500px height and below)
   Compact UI when height is limited
   ============================================ */
@media (max-height: 500px) {
  .history-strip {
    padding: 8px 0;
  }

  .history-item {
    width: 48px;
    height: 48px;
  }
}

/* ============================================
   MOBILE IMAGE OPTIMIZATION
   Ensure images fill maximum available space
   ============================================ */
@media (max-width: 768px) {
  /* Image container stretches to fill image-area height
     (overrides parent's align-items: center which would shrink-wrap) */
  .image-container {
    flex: 1;
    min-height: 0;
    align-self: stretch;
  }

  /* Image wrapper fills container fully */
  .image-wrapper {
    flex: 1;
    width: 100%;
    min-height: 0;
    align-self: stretch; /* Override parent's align-items: center */
  }

  /* Main image fills available space - scale up small images */
  #currentImage {
    transition: max-height 0.2s ease;
    /* Fill container while maintaining aspect ratio */
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  /* ============================================
     MOBILE IMAGE AREA LAYOUT FIX
     Fix excessive spacing and layout issues
     ============================================ */

  /* When image is loaded, use top-aligned layout instead of centered */
  .app.has-image .image-area {
    justify-content: flex-start;
    padding: 8px 8px 0;
  }

  /* Image container takes available space but doesn't force centering */
  .app.has-image .image-container {
    flex: 1 1 auto;
    max-height: calc(100% - 80px); /* Leave room for photo strip */
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Photo strip - compact and aligned to bottom of image area */
  .app.has-image .photo-strip {
    flex-shrink: 0;
    margin-top: auto;
  }

  /* When two photos, tighten up the layout */
  .app.has-image .photo-strip.two-photos {
    padding: 8px 12px 4px;
  }

  /* Smooth transitions for layout changes */
  .image-area {
    transition: max-height 0.15s ease, padding 0.15s ease;
  }

  .controls {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  /* Reference card smooth show/hide - note: can't animate display:none,
     so we rely on the JS to add/remove .visible class for entrance animation */
  .reference-card.visible {
    animation: slideIn 0.15s ease-out;
  }

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

/* ============================================
   CREDIT BADGE - Compact pill in nav
   ============================================ */
.credit-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-subtle);
  border: none;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.credit-badge:hover {
  background: var(--glow);
}

.credit-badge:active {
  transform: scale(0.96);
}

.credit-badge .credit-count {
  font-weight: 700;
  color: var(--primary);
}

.credit-badge .credit-label {
  color: var(--text-muted);
  font-weight: 500;
}

/* Credit badge states */
.credit-badge.plenty {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.credit-badge.low {
  background: transparent;
  border-color: #f59e0b;
  color: #d97706;
}

.credit-badge.low .credit-icon {
  color: #f59e0b;
  opacity: 1;
}

.credit-badge.critical {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
  animation: subtleGlow 2s ease-in-out infinite;
}

.credit-badge.critical .credit-icon {
  color: #f59e0b;
  opacity: 1;
}

.credit-badge.zero {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
  animation: subtlePulse 2s ease-in-out infinite;
}

.credit-badge.zero .credit-icon {
  color: #ef4444;
  opacity: 1;
}

.credit-badge.subscriber {
  background: var(--glow);
  border-color: var(--primary);
  color: var(--primary);
}

.credit-badge.subscriber .credit-icon {
  color: var(--primary);
  opacity: 1;
}

/* Gift state - makes free edit feel special */
.credit-badge.has-gift {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #10b981;
  color: #047857;
}

.credit-badge.has-gift .credit-count {
  color: #059669;
}

.credit-badge.has-gift .credit-label {
  color: #047857;
}

.credit-badge.has-gift::before {
  content: '🎁';
  margin-right: 4px;
  font-size: 0.9em;
}

/* Attention animation for recovery after modal dismiss */
.credit-badge.attention {
  animation: badgeAttention 0.5s ease-out 3;
}

@keyframes subtleGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
  50% {
    box-shadow: 0 0 8px 2px rgba(245, 158, 11, 0.25);
  }
}

@keyframes subtlePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.2);
  }
}

@keyframes badgeAttention {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 12px 4px rgba(139, 124, 246, 0.4);
  }
}

/* Credit badge always visible - important for conversion */
.credit-badge {
  display: flex;
}

/* Make zero state more prominent for conversion */
.credit-badge.zero {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1.5px solid #ef4444;
  color: #dc2626;
  animation: subtlePulse 2s ease-in-out infinite;
  font-weight: 600;
}

.credit-badge.zero .credit-count,
.credit-badge.zero .credit-label {
  color: #dc2626;
}

/* NAV CTA state styles - removed in nav redesign */



/* ============================================
   FULLSCREEN IMAGE LIGHTBOX (Mobile)
   Tap image to expand fullscreen
   ============================================ */
.image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.image-lightbox.visible {
  display: flex;
  opacity: 1;
}

.image-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Tap hint on mobile image */
@media (max-width: 768px) {
  .image-container.has-result .image-wrapper {
    cursor: zoom-in;
  }
}

/* ============================================
   HOMEPAGE V2 - Editorial Design System
   ============================================ */

/* === SOCIAL PROOF BAND === */
.proof-band {
  padding: 48px 24px;
  background: linear-gradient(180deg, var(--bg) 0%, #f7f6fc 100%);
  border-bottom: 1px solid var(--border);
}

.proof-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

.proof-quote-mark {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 6rem;
  line-height: 0.5;
  color: var(--primary);
  opacity: 0.15;
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.proof-quote {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  margin: 0 0 24px 0;
  letter-spacing: -0.01em;
  position: relative;
}

.proof-attribution {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.proof-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.proof-author {
  text-align: left;
}

.proof-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.proof-context {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .proof-band {
    padding: 32px 20px;
  }

  .proof-quote {
    font-size: 1.2rem;
  }

  .proof-quote-mark {
    font-size: 4rem;
    top: -12px;
  }
}

/* === CAPABILITIES SECTION === */
.capabilities-section {
  /* No padding - articles handle their own */
}

.capability {
  padding: 64px 24px;
  background: var(--bg);
  overflow: hidden;
}

.capability--alt {
  background: #fafbfc;
}

.capability[data-animate] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.capability[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

.capability-inner {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 48px;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
}

.capability-inner--reverse {
  grid-template-columns: 1.1fr 1fr;
}

.capability-inner--reverse .capability-content {
  order: 2;
}

.capability-inner--reverse .capability-visual {
  order: 1;
}

.capability-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.capability-number {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.1em;
}

.capability-headline {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
}

.capability-description {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
  max-width: 400px;
}

.capability-prompt {
  display: inline-block;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 6px;
  width: fit-content;
}

/* Prompt chips */
.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.prompt-chip {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: white;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 100px;
  transition: border-color 0.2s, color 0.2s;
}

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

/* Combine equation */
.combine-equation {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.eq-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: white;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
}

.eq-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(139, 124, 246, 0.12);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.eq-op {
  color: var(--text-dimmed);
  font-weight: 500;
  font-size: 1.1rem;
}

.eq-result {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(139, 124, 246, 0.08);
  border: 1px solid rgba(139, 124, 246, 0.25);
  padding: 8px 14px;
  border-radius: 8px;
}

.eq-result svg {
  stroke: var(--primary);
}

/* === BEFORE/AFTER VISUALS === */
.capability-visual {
  width: 100%;
}

.ba-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ba-figure {
  margin: 0;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.ba-figure img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.ba-figure figcaption {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0,0,0,0.65);
  color: white;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* Combine grid */
.combine-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 12px;
}

.combine-input {
  margin: 0;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.combine-input img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.combine-input figcaption,
.combine-result figcaption {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0,0,0,0.65);
  color: white;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.combine-result {
  grid-column: 1 / -1;
  margin: 0;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
}

.combine-result img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

/* === CAPABILITIES MOBILE === */
@media (max-width: 800px) {
  .capability {
    padding: 48px 20px;
  }

  .capability-inner,
  .capability-inner--reverse {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .capability-inner--reverse .capability-content {
    order: 1;
  }

  .capability-inner--reverse .capability-visual {
    order: 2;
  }

  .capability-headline {
    font-size: 2rem;
  }

  .capability-description {
    font-size: 1rem;
  }
}

/* ============================================
   PRICING V9 - Premium Conversion-Optimized
   ============================================ */
.pricing-v9 {
  padding: 80px 24px 100px;
  background: linear-gradient(180deg, #faf9fe 0%, #f3f1fb 100%);
  position: relative;
  overflow: hidden;
}

.pricing-v9::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 124, 246, 0.3), transparent);
}

/* Decorative background elements */
.pricing-v9::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(139, 124, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.pricing-v9-inner {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.pricing-v9-header {
  text-align: center;
  margin-bottom: 32px;
}

.pricing-v9-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary);
  margin: 0 0 12px 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pricing-v9-eyebrow::before,
.pricing-v9-eyebrow::after {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--primary);
  opacity: 0.4;
}

.pricing-v9-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 12px 0;
}

.pricing-v9-lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* Social Proof */
.pricing-v9-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
}

.pricing-v9-avatars {
  display: flex;
  margin-right: 4px;
}

.avatar-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid white;
  margin-left: -8px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.avatar-dot:first-child {
  margin-left: 0;
}

.avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid white;
  margin-left: -10px;
  object-fit: cover;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.avatar-img:first-child {
  margin-left: 0;
}

.pricing-v9-social-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pricing-v9-social-text strong {
  color: var(--text);
  font-weight: 600;
}

/* Pricing Cards Grid */
.pricing-v9-cards {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
  align-items: start;
}

/* Individual Card */
.pricing-v9-card {
  font-family: inherit;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
  background: white;
  border: 2px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.pricing-v9-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(139, 124, 246, 0.15);
  border-color: rgba(139, 124, 246, 0.3);
}

/* Hero Card (Standard) */
.pricing-v9-card--hero {
  padding: 36px 28px;
  border-color: var(--primary);
  background: linear-gradient(180deg, white 0%, #faf9ff 100%);
  box-shadow:
    0 4px 20px rgba(139, 124, 246, 0.12),
    0 0 0 1px rgba(139, 124, 246, 0.1);
  z-index: 2;
}

.pricing-v9-card--hero:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow:
    0 20px 50px rgba(139, 124, 246, 0.25),
    0 0 0 2px var(--primary);
}

.pricing-v9-card--hero .pricing-v9-card-glow {
  position: absolute;
  inset: -2px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  opacity: 0.15;
  z-index: -1;
  filter: blur(20px);
  pointer-events: none;
}

/* Badge */
.pricing-v9-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(139, 124, 246, 0.4);
}

/* Card Header */
.pricing-v9-card-header {
  margin-bottom: 20px;
}

.pricing-v9-tier-name {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.pricing-v9-card--hero .pricing-v9-tier-name {
  font-size: 1.25rem;
}

.pricing-v9-tier-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Credits - Hero Metric */
.pricing-v9-card-credits {
  margin-bottom: 16px;
  padding: 16px 0;
  border-top: 1px solid rgba(139, 124, 246, 0.1);
  border-bottom: 1px solid rgba(139, 124, 246, 0.1);
}

.pricing-v9-credits-num {
  display: block;
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.pricing-v9-card--hero .pricing-v9-credits-num {
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pricing-v9-credits-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

/* Price */
.pricing-v9-card-price {
  margin-bottom: 20px;
}

.pricing-v9-price {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.pricing-v9-card--hero .pricing-v9-price {
  font-size: 1.4rem;
}

/* PPP strikethrough on homepage pricing */
.pricing-v9-price .price-original {
  text-decoration: line-through;
  opacity: 0.5;
  font-weight: 500;
  margin-right: 4px;
}

.pricing-v9-per-edit {
  display: block;
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 600;
  margin-top: 4px;
}

/* CTA Button */
.pricing-v9-card-cta {
  display: block;
  padding: 12px 24px;
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s;
}

.pricing-v9-card:hover .pricing-v9-card-cta {
  background: rgba(139, 124, 246, 0.1);
  color: var(--primary);
}

.pricing-v9-card--hero .pricing-v9-card-cta {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  padding: 14px 28px;
  box-shadow: 0 4px 12px rgba(139, 124, 246, 0.3);
}

.pricing-v9-card--hero:hover .pricing-v9-card-cta {
  background: linear-gradient(135deg, var(--primary-hover), #4f46e5);
  box-shadow: 0 6px 20px rgba(139, 124, 246, 0.4);
}

/* Benefits */
.pricing-v9-benefits {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 32px;
}

.pricing-v9-benefit {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pricing-v9-benefit svg {
  width: 18px;
  height: 18px;
  stroke: var(--success);
  flex-shrink: 0;
}

/* One-time Alternative */
.pricing-v9-onetime {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.pricing-v9-onetime-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pricing-v9-onetime-btn {
  font-family: inherit;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
}

.pricing-v9-onetime-btn:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Free Tier */
.pricing-v9-free {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 100px;
  width: fit-content;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.pricing-v9-free svg {
  color: var(--primary);
  flex-shrink: 0;
}

.pricing-v9-free span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pricing-v9-free strong {
  color: var(--text);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .pricing-v9 {
    padding: 60px 20px 80px;
  }

  .pricing-v9-title {
    font-size: 2rem;
  }

  .pricing-v9-cards {
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Reorder: Standard first on mobile */
  .pricing-v9-card--hero {
    order: -1;
  }

  .pricing-v9-card {
    padding: 24px 20px;
  }

  .pricing-v9-card--hero {
    padding: 28px 24px;
  }

  .pricing-v9-credits-num {
    font-size: 2.5rem;
  }

  .pricing-v9-card--hero .pricing-v9-credits-num {
    font-size: 3rem;
  }

  .pricing-v9-benefits {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .pricing-v9-onetime {
    flex-direction: column;
    gap: 4px;
  }
}

/* ============================================
   SMART SECTION - Dark Editorial
   ============================================ */
.smart-section {
  padding: 80px 24px;
  background: linear-gradient(165deg, #0d0d14 0%, #151520 50%, #1a1a28 100%);
  overflow: hidden;
}

.smart-section[data-animate] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.smart-section[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

.smart-section-inner {
  max-width: 1000px;
  margin: 0 auto;
}

.smart-section-header {
  text-align: center;
  margin-bottom: 40px;
}

.smart-section-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.25);
  padding: 8px 18px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.smart-section-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: white;
  margin: 0;
  line-height: 1.2;
}

/* Prompt block */
.smart-prompt-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 48px;
  padding: 0 16px;
}

.smart-prompt-mark {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.5rem;
  color: #a78bfa;
  opacity: 0.4;
  line-height: 1;
}

.smart-prompt-text {
  font-size: 1.15rem;
  font-style: italic;
  color: rgba(255,255,255,0.85);
  margin: 0;
  text-align: center;
}

/* Cascade v2 */
.smart-cascade-v2 {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  margin-bottom: 48px;
  overflow-x: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.cascade-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
}

.cascade-item img {
  width: 160px;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.cascade-item--final img {
  border: 2px solid rgba(167, 139, 250, 0.5);
  box-shadow: 0 8px 32px rgba(167, 139, 250, 0.3), 0 8px 24px rgba(0,0,0,0.4);
}

.cascade-item-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.4);
}

.cascade-item-ops {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: 160px;
}

.cascade-item-ops span {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.05);
  padding: 3px 7px;
  border-radius: 4px;
}

.cascade-arrow-v2 {
  color: rgba(167, 139, 250, 0.35);
  font-size: 1.4rem;
  margin-top: 50px;
  flex-shrink: 0;
}

/* Stats */
.smart-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px 32px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  max-width: 420px;
  margin: 0 auto;
}

.smart-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.smart-stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  line-height: 1;
}

.smart-stat-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.smart-stat-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,0.08);
}

/* === SMART MOBILE === */
@media (max-width: 600px) {
  .smart-section {
    padding: 56px 16px;
  }

  .smart-section-title {
    font-size: 1.7rem;
  }

  .smart-prompt-text {
    font-size: 1rem;
  }

  .cascade-item img {
    width: 130px;
  }

  .smart-stats {
    gap: 20px;
    padding: 20px 24px;
  }

  .smart-stat-num {
    font-size: 1.6rem;
  }
}

/* ============================================
   FINAL CTA V2
   ============================================ */
.final-cta-v2 {
  text-align: center;
  padding: 72px 24px;
  background: var(--bg);
}

.final-cta-v2-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 12px 0;
}

.final-cta-v2-lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 28px 0;
}

.final-cta-v2-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(139, 124, 246, 0.3);
}

.final-cta-v2-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 124, 246, 0.4);
}

.final-cta-v2-btn:active {
  transform: scale(0.98);
}

@media (max-width: 500px) {
  .final-cta-v2 {
    padding: 56px 20px;
  }

  .final-cta-v2-title {
    font-size: 1.6rem;
  }
}

/* ============================================
   EDITOR AD BAR
   Bottom strip for free users in editor (part of grid layout)
   ============================================ */

.editor-ad-bar {
  display: none;
  grid-area: ad;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  padding-bottom: calc(8px + var(--safe-bottom));
  text-align: center;
  overflow: hidden;
  min-height: 0;
  /* Mobile: 50px ad + 16px padding */
  height: 66px;
  max-height: 66px !important;
}

/* Desktop: larger 728x90 leaderboard format */
@media (min-width: 768px) {
  .editor-ad-bar {
    height: 106px; /* 90px ad + 16px padding */
    max-height: 106px !important;
  }
}

/* Only show when visible class is added AND app has image */
.app.has-image .editor-ad-bar.visible {
  display: block;
}

/* Hide for paid users (via body class) */
body.paid-user .editor-ad-bar {
  display: none !important;
}

/* Responsive ad sizing */
.editor-ad-bar .adsbygoogle {
  display: block !important;
  margin: 0 auto;
  /* Mobile: 320x50 */
  width: 320px;
  height: 50px;
}

/* Desktop: 728x90 leaderboard */
@media (min-width: 768px) {
  .editor-ad-bar .adsbygoogle {
    width: 728px;
    height: 90px;
  }
}

/* Clip any oversized ad content */
.editor-ad-bar ins,
.editor-ad-bar iframe {
  overflow: hidden !important;
}

/* Interstitial Ad Overlay (shown during edit generation for free users) */
.interstitial-ad-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 66px; /* Leave room for editor ad bar (mobile: 50px ad + 16px padding) */
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Desktop: larger ad bar */
@media (min-width: 768px) {
  .interstitial-ad-overlay {
    bottom: 106px; /* 90px ad + 16px padding */
  }
}

.interstitial-ad-overlay.visible {
  display: flex;
}

.interstitial-ad-container {
  max-width: 400px;
  max-height: 90vh;
  width: 100%;
  background: var(--bg);
  border-radius: 16px;
  overflow: hidden;
  overflow-y: auto;
}

.interstitial-ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.interstitial-ad-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.interstitial-ad-timer {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.interstitial-ad-content {
  width: 100%;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
}

.interstitial-ad-content .adsbygoogle {
  width: 100%;
  min-height: 250px;
}

.interstitial-ad-footer {
  padding: 16px 20px;
  text-align: center;
}

.interstitial-ad-skip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
  transition: all 0.2s ease;
}

.interstitial-ad-skip.enabled {
  cursor: pointer;
  opacity: 1;
  color: var(--text);
}

.interstitial-ad-skip.enabled:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.interstitial-ad-upgrade {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-dimmed);
}

.interstitial-ad-upgrade a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.interstitial-ad-upgrade a:hover {
  text-decoration: underline;
}

/* Edit progress bar inside interstitial ad */
.interstitial-ad-progress {
  padding: var(--space-3) var(--space-5) 0;
}

.interstitial-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.interstitial-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-pill);
  transition: width 0.4s ease-out;
  background-size: 200% 100%;
  animation: interstitial-shimmer 1.5s ease-in-out infinite;
}

.interstitial-progress-fill.complete {
  background: var(--success);
  animation: interstitial-complete 0.4s ease-out;
}

.interstitial-progress-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-2);
  font-variant-numeric: tabular-nums;
  transition: color var(--transition-slow);
}

.interstitial-progress-label.complete {
  color: var(--success);
  font-weight: 600;
}

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

@keyframes interstitial-complete {
  0% { transform: scaleY(1); }
  50% { transform: scaleY(2.5); }
  100% { transform: scaleY(1); }
}

/* Hide interstitial ad for paid users */
body.paid-user .interstitial-ad-overlay {
  display: none !important;
}

