/* === DESIGN SYSTEM === */
:root {
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* UNIFIED PREMIUM SHADOW SYSTEM */
  --shadow-primary: 0px 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-secondary: 0px 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.02), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0px 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0px 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.08), 0 8px 20px rgba(15, 23, 42, 0.05);
  
  --border-subtle: 1px solid rgba(15, 23, 42, 0.06);
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --primary-subtle: #f8f9ff;
  --primary-muted: #7b7dd0;
  --primary-muted-dark: #6b68c4;
  --success: #10b981;
  --warning: #fef3c7;
  --warning-text: #78350f;
  --danger: #ef4444;
  --danger-subtle: #fee2e2;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --header-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(99, 102, 241, 0.02) 0%, transparent 50%),
    repeating-linear-gradient(60deg, transparent, transparent 60px, rgba(99, 102, 241, 0.06) 60px, rgba(99, 102, 241, 0.06) 61px),
    repeating-linear-gradient(120deg, transparent, transparent 60px, rgba(99, 102, 241, 0.06) 60px, rgba(99, 102, 241, 0.06) 61px),
    repeating-linear-gradient(0deg, transparent, transparent 60px, rgba(99, 102, 241, 0.06) 60px, rgba(99, 102, 241, 0.06) 61px),
    linear-gradient(135deg, #fafbfc 0%, #f4f6f8 50%, #fafbfc 100%);
  background-attachment: fixed;
  min-height: 100vh;
  letter-spacing: -0.01em;
}
.container { max-width: 1280px; margin: 0 auto; padding: 32px 24px; }
.header { margin-bottom: var(--spacing-md); }
.title { 
  font-size: 1.9rem; 
  font-weight: 700; 
  color: var(--text-primary); 
  margin-bottom: var(--spacing-xs); 
  letter-spacing: -0.03em;
}
.subtitle { color: var(--text-secondary); font-size: 0.9375rem; }

/* Top navigation bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  min-height: var(--header-height);
}
.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  min-width: 220px;
}
a.app-brand {
  text-decoration: none !important;
  color: inherit;
  cursor: pointer;
}
a.app-brand:hover,
a.app-brand:visited,
a.app-brand:focus,
a.app-brand:active {
  text-decoration: none !important;
  opacity: 0.9;
}
.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
  display: grid;
  place-items: center;
  color: white;
}
.brand-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand-divider {
  color: var(--text-tertiary);
  font-weight: 600;
}
.brand-context {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
}
.header-progress {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 16px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.header-actions .btn {
  height: 36px;
}

/* Subtle header upgrade pill (shown via JS for free tier users) */
.header-upgrade-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.07);
  border: 1px solid rgba(99, 102, 241, 0.22);
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: none;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.header-upgrade-btn .header-upgrade-icon {
  width: 12px;
  height: 12px;
  opacity: 0.85;
}

.header-upgrade-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.12);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.32);
}

.header-upgrade-btn:active:not(:disabled) {
  background: rgba(99, 102, 241, 0.14);
  box-shadow: none;
  transform: translateY(0);
}

.header-upgrade-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), var(--shadow-md);
}
@media (max-width: 960px) {
  .app-header-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .header-actions {
    flex-wrap: wrap;
  }
  .header-progress {
    justify-content: flex-start;
  }
}

/* PRIMARY PANELS - Main content areas */
.card { 
  background: var(--bg-primary); 
  border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-primary);
  padding: var(--spacing-xl);
  border: none;
}
#landing-view .card { 
  border: 2px dashed rgba(99, 102, 241, 0.15); 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #fafbff 0%, #f8fafc 100%);
}
.upload-area { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  padding: 4rem 2rem; 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.upload-area.drag-over { 
  background: var(--primary-subtle);
  border-color: var(--primary); 
  transform: scale(1.01);
}
.upload-icon { 
  width: 112px; 
  height: 112px; 
  background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%); 
  border-radius: 50%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  margin-bottom: var(--spacing-lg);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12), 0 4px 12px rgba(99, 102, 241, 0.08);
  border: 4px solid rgba(255, 255, 255, 0.9);
}
.upload-icon svg { width: 56px; height: 56px; color: var(--primary); }
.upload-title { 
  font-size: 1.5rem; 
  font-weight: 600; 
  color: var(--text-primary); 
  margin-bottom: var(--spacing-xs);
  letter-spacing: -0.02em;
}
.upload-subtitle { 
  font-size: 0.9375rem; 
  color: var(--text-secondary);
  font-weight: 500;
}
.editor-screen { display: grid; grid-template-columns: 1fr 400px; gap: 24px; width: 100%; align-items: start; }
.editor-left { min-width: 0; min-height: 0; padding: 0; background-color: transparent; display: flex; flex-direction: column; height: auto; width: 100%; }
.editor-left-inner { max-width: none; width: 100%; margin: 0; height: auto; min-height: min-content; display: flex; flex-direction: column; flex: 1 0 auto; }
.editor-right { 
  width: 400px; 
  min-width: 400px; 
  background: transparent; 
  border-left: none; 
  box-shadow: none; 
  border-radius: 0; 
  margin: 0; 
  height: fit-content; 
  max-height: calc(100vh - var(--header-height) - 24px);
  position: sticky;
  top: calc(var(--header-height) + 8px);
  overflow-y: auto;
  padding: 0; 
  display: flex; 
  flex-direction: column; 
  gap: 0.75rem; 
}
.editor-right::-webkit-scrollbar { display: none; }
.editor-right { scrollbar-width: none; }
@media (max-width: 1200px) { .editor-screen { grid-template-columns: 1fr; } .editor-right { max-width: none; min-width: 0; } }
@media (max-width: 1024px) { .editor-screen { grid-template-columns: 1fr; } .editor-left { padding: 0; } .editor-right { width: 100%; min-width: auto; border-left: none; box-shadow: none; } }
.sidebar-panel { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.p-6 { padding: 1.5rem; }
/* === UNIFIED BUTTON SYSTEM === */
.btn { 
  padding: 0.625rem 1.125rem; 
  font-size: 0.875rem; 
  line-height: 1.25rem;
  height: 38px;
  border-radius: var(--radius-sm); 
  border: none; 
  cursor: pointer; 
  font-weight: 600; 
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:hover:not(:disabled) { 
  transform: translateY(-1px); 
  box-shadow: var(--shadow-md);
}
.btn:active:not(:disabled) { 
  transform: translateY(0); 
  box-shadow: var(--shadow-sm);
}
.btn-icon {
  width: 38px;
  padding: 0.5rem;
  gap: 0;
  align-items: center;
  justify-content: center;
}
.btn-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Primary - Bold action (full saturation) */
.btn-primary { 
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); 
  color: white;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.08), 0 3px 8px rgba(99, 102, 241, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.06);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.18), 0 4px 12px rgba(99, 102, 241, 0.15), 0 0 0 2px rgba(99, 102, 241, 0.12);
}

/* Primary Muted - For snippet card Download buttons only (opacity-based) */
.btn-primary-muted {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); 
  color: white;
  opacity: 0.75;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.08), 0 3px 8px rgba(99, 102, 241, 0.12), 0 0 0 1px rgba(99, 102, 241, 0.06);
  border: none;
}
.btn-primary-muted:hover:not(:disabled) {
  opacity: 1;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.18), 0 4px 12px rgba(99, 102, 241, 0.15), 0 0 0 2px rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
}
.btn-primary-muted:active:not(:disabled) {
  opacity: 0.75;
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.08), 0 3px 8px rgba(99, 102, 241, 0.12);
}

/* Secondary - Outline style */
.btn-blue { 
  background: white;
  color: var(--primary);
  border: 1.5px solid rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-sm);
}
.btn-blue:hover:not(:disabled) {
  background: var(--primary-subtle);
  border-color: var(--primary);
}

/* Tertiary - Subtle */
.btn-light-blue { 
  background: var(--primary-subtle);
  color: var(--primary-dark); 
  border: 1px solid rgba(99, 102, 241, 0.15);
  box-shadow: none;
}
.btn-light-blue:hover:not(:disabled) { 
  background: rgba(99, 102, 241, 0.12); 
  border-color: rgba(99, 102, 241, 0.25);
}

/* Success */
.btn-green { 
  background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
  color: white;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.12), 0 6px 16px rgba(16, 185, 129, 0.15);
}
.btn-green:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25), 0 8px 24px rgba(16, 185, 129, 0.18);
}

/* Warning */
.btn-amber { 
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); 
  color: white;
  box-shadow: 0 1px 3px rgba(251, 191, 36, 0.12), 0 6px 16px rgba(251, 191, 36, 0.15);
}
.btn-amber:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25), 0 8px 24px rgba(251, 191, 36, 0.18);
}

/* Danger - Outline style (desaturated) */
.btn-red { 
  background: white; 
  color: var(--danger);
  border: 1.5px solid rgba(239, 68, 68, 0.3);
  box-shadow: var(--shadow-sm);
}
.btn-red:hover:not(:disabled) {
  background: var(--danger-subtle);
  border-color: var(--danger);
  box-shadow: var(--shadow-md);
}

/* Danger Outline - Ghost button for card actions (softened) */
.btn-red-outline { 
  background: transparent;
  color: #dc2626; 
  border: 1px solid #f4b4bb;
  box-shadow: none;
  opacity: 0.85;
  padding: 0.375rem 0.75rem;
}
.btn-red-outline:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
  opacity: 1;
}

/* Ghost - Minimal */
.btn-gray { 
  background: var(--bg-secondary);
  color: var(--text-secondary); 
  border: var(--border-subtle);
  box-shadow: none;
}
.btn-gray:hover:not(:disabled) { 
  background: var(--bg-tertiary);
  border-color: rgba(15, 23, 42, 0.1);
}

.btn-white { 
  background: white; 
  color: var(--text-secondary); 
  border: var(--border-subtle);
  box-shadow: var(--shadow-sm);
}
.btn-white:hover:not(:disabled) { 
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
}

.btn-sm svg {
  transition: transform 0.2s ease;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}
.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-sm { 
  padding: 0.375rem 0.875rem; 
  font-size: 0.8125rem; 
  height: 32px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--primary);
}

.btn-white-clean {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-white-clean:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.section-title { 
  font-size: 1.25rem; 
  font-weight: 700; 
  color: var(--text-primary); 
  letter-spacing: -0.02em;
}
.text-sm { font-size: 0.875rem; color: var(--text-secondary); }
.text-xs { font-size: 0.75rem; }
.text-gray-500 { color: var(--text-secondary); }
.text-gray-400 { color: var(--text-tertiary); }
.canvas-container { 
  border: var(--border-subtle); 
  border-radius: var(--radius-md); 
  overflow: visible; 
  background: #f9fafb; /* warmer tone */
  cursor: default; 
  transition: opacity 0.2s; 
  display: flex; 
  justify-content: center; 
  align-items: center;
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  width: 100%;
  min-height: 420px;
}
#canvas-wrapper { 
  flex: 1 0 auto; 
  width: 100% !important; 
  min-height: 420px; 
  height: auto;
  margin-bottom: 1.5rem; 
  display: flex; 
  justify-content: center; 
  align-items: center;
}
.canvas-viewport {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
  overflow: visible;
  user-select: none;
}
.canvas-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.overlay-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.guide-layer { 
  pointer-events: auto; 
  z-index: 2;
  cursor: crosshair;
}
.guide-layer.interactive { pointer-events: auto; }
.guide-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px dashed transparent;
  pointer-events: none;
}
.guide-line.snap-line {
  border-top-color: #ec4899;
  opacity: 0.7;
}
.guide-line.detected-line {
  border-top: 3px dashed #10b981;
  cursor: pointer;
  pointer-events: auto;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.02));
}
.guide-label {
  position: absolute;
  left: 12px;
  top: -14px;
  background: #10b981;
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.guide-instructions {
  position: absolute;
  top: 12px;
  left: 16px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.footer-overlay {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.55);
  border-top: 3px dashed #7c3aed;
  color: #f8fafc;
  display: flex;
  align-items: flex-start;
  padding: 10px 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  pointer-events: none;
}
.footer-overlay .footer-label {
  background: #5b21b6;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
}
.snippet-layer { 
  pointer-events: auto; 
  z-index: 3;
  cursor: crosshair;
}
.snippet-box { 
  position: absolute; 
  border: 3px solid #3B82F6; 
  background: transparent; 
  border-radius: 10px; 
  box-shadow: 0 10px 26px rgba(59, 130, 246, 0.08); 
  pointer-events: auto;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.3s ease;
  will-change: top, height;
}
.snippet-box.excluded {
  border-color: #64748b;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0.4;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
  pointer-events: auto;
}
.snippet-label {
  position: absolute;
  top: 10px;
  left: 12px;
  background: #3B82F6;
  color: white;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  transition: background 0.3s ease;
}
.snippet-box.excluded .snippet-label {
  background: #64748b;
  opacity: 0.7;
}
.resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 14px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}
.resize-handle::before {
  content: '';
  width: 36px;
  height: 4px;
  background: white;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
  opacity: 0.9;
}
.resize-handle.handle-top { top: -10px; }
.resize-handle.handle-bottom { bottom: -10px; }
.footer-handle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.footer-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #7c3aed 0%, #a855f7 100%);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.2);
  pointer-events: none;
}
.footer-handle {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #7c3aed;
  color: white;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.18);
  cursor: ns-resize;
  pointer-events: auto;
  user-select: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.footer-handle.snapped {
  background: #22c55e;
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
}
.footer-handle-notch {
  width: 16px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}
.snippet-list { margin-top: 16px; max-height: 600px; overflow-y: auto; }
.snippet-card { 
  border: 1px solid rgba(15, 23, 42, 0.08); 
  border-radius: 12px; 
  padding: 12px 24px; 
  transition: all 0.16s cubic-bezier(0.4, 0, 0.2, 1); 
  margin-bottom: 12px;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}
.snippet-card:hover { 
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.06);
}
.snippet-card.snippet-card-active {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.08);
  background: #f7f8ff;
}
.snippet-card.excluded {
  background: #f8f9fa;
  border-color: #e1e6ef;
  opacity: 0.6;
}
.snippet-card.excluded .snippet-title {
  color: #94a3b8;
}
.snippet-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.snippet-title {
  font-weight: 700;
  color: #334155;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.snippet-subtitle { display: none; }
.snippet-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.snippet-actions > button {
  width: 0;
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  padding: 0;
  border-width: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.snippet-card:hover .snippet-actions > button,
.snippet-card .snippet-actions > button:focus-visible,
.snippet-card .snippet-actions > button.excluded {
  width: 32px;
  min-width: 32px;
  overflow: visible;
  opacity: 1;
  margin-left: 8px;
  padding: 0;
  border-width: 1px;
  pointer-events: auto;
}
.snippet-size-pill {
  white-space: nowrap;
  opacity: 1;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  font-size: 0.78rem;
  min-width: 68px;
  text-align: center;
}
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #c53030;
  padding: 0;
}
.icon-btn:hover {
  background: #fef2f2;
  border-color: #fecdd3;
  color: #b91c1c;
  transform: translateY(-1px);
}
.icon-btn-primary {
  background: #eef2ff;
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}
.icon-btn-primary:hover {
  background: #e0e7ff;
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.2);
}
.icon-btn-destructive {
  color: #c53030;
}
.icon-btn-destructive:hover {
  background: #fef2f2;
  border-color: #fecdd3;
  color: #b91c1c;
}
.icon-btn.toggle-exclude {
  color: #475569;
}
.icon-btn.toggle-exclude:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}
.icon-btn.toggle-exclude.excluded {
  color: #ef4444;
  background: #fef2f2;
  border-color: #fecaca;
}
.icon-btn.toggle-exclude.excluded:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}
.split-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.split-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 6px;
}
.split-arrow {
  font-size: 0.75rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
  display: inline-flex;
  align-items: center;
}
.split-arrow.expanded { transform: rotate(180deg); }
.split-options { display: none; }
.tab-btn { border: none; }
.tab-btn.active { background: white; color: var(--text-primary); box-shadow: var(--shadow-sm); }
.tab-btn:not(.active) { background: transparent; color: var(--text-secondary); }
.split-pill-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  background: #f6f8fb;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 3px 4px;
}
.split-pill {
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  border-radius: 12px;
  padding: 8px 0;
  height: 34px;
  font-weight: 600;
  font-size: 0.90rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: none;
}
.split-pill:hover {
  color: #4f46e5;
}
.split-pill.active {
  background: white;
  border-color: rgba(99, 102, 241, 0.3);
  color: #3162f0;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.12);
}
.snippet-download-btn {
  width: 100%;
  height: 40px;
  margin-top: 4px;
  border-radius: 12px;
  background: white;
  border: 1.5px solid #d7dde8;
  color: #334155;
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}
.snippet-download-btn:hover {
  border-color: rgba(99, 102, 241, 0.45);
  color: #4f46e5;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
}
.group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-actions > button {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.snippet-card:hover .group-actions > button,
.snippet-card .group-actions > button:focus-visible,
.snippet-card .group-actions > button.excluded {
  opacity: 1;
}
.group-chip {
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem;
}
.child-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.snippet-child-card {
  background: #ffffff;
}
.info-box { 
  background: var(--primary-subtle);
  border-radius: var(--radius-md); 
  padding: var(--spacing-lg);
  border: none;
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-sm);
}
.info-button { 
  background: transparent; 
  border: none; 
  width: 24px; 
  height: 24px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  color: var(--text-tertiary); 
  transition: all 0.2s; 
  padding: 0; 
}
.info-button:hover { color: var(--primary); transform: scale(1.1); }
.info-button-small { 
  background: transparent; 
  border: none; 
  width: 18px; 
  height: 18px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  cursor: pointer; 
  transition: all 0.2s; 
  padding: 0; 
}
.info-button { color: var(--primary); }
.info-button:hover { color: var(--primary-dark); transform: scale(1.15); }
.info-popup { 
  position: absolute; 
  left: 0; 
  top: 100%; 
  margin-top: var(--spacing-xs); 
  background: var(--primary-subtle);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-md); 
  padding: var(--spacing-md); 
  box-shadow: var(--shadow-secondary); 
  z-index: 100; 
  min-width: 280px; 
  max-width: 320px; 
  animation: popupSlide 0.2s ease-out; 
}
@keyframes popupSlide { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.info-panel { 
  background: var(--primary-subtle);
  border-radius: var(--radius-md); 
  padding: var(--spacing-lg); 
  margin-bottom: var(--spacing-lg); 
  animation: slideDown 0.3s ease-out;
  border: none;
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-sm);
}
@keyframes slideDown { from { opacity: 0; max-height: 0; padding: 0 var(--spacing-lg); } to { opacity: 1; max-height: 500px; padding: var(--spacing-lg); } }
@keyframes slideInNotif { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutNotif { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100px); } }

/* Progress toast (Compressing/Exporting popup with cancel) */
.progress-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-primary);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInNotif 0.3s ease-out;
}
.progress-toast .notif-text {
  flex: 1;
  min-width: 0;
}
.progress-toast .close-toast {
  margin-left: auto;
  padding: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
}
.progress-toast .close-toast:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}
@keyframes spinning { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spinning { animation: spinning 1s linear infinite; }
.disabled-group { opacity: 0.5; pointer-events: none; filter: grayscale(1); transition: opacity 0.3s; }
.pulse-highlight { animation: pulse-purple 1s ease; }
@keyframes pulse-purple { 
  0% { transform: scale(1); background: var(--primary); }
  50% { transform: scale(1.1); background: var(--primary-light); }
  100% { transform: scale(1); background: var(--primary); }
}
@keyframes btn-pulse-loop {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
.attention-grabber { animation: btn-pulse-loop 2s infinite; border-color: var(--primary); color: var(--primary); }
.handle-attention {
  background-color: #818cf8 !important;
  border: 2px solid white !important;
  z-index: 50 !important;
}
.handle-attention::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.7);
  animation: pulse-ring-only 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
  z-index: -1;
  pointer-events: none;
}
@keyframes pulse-ring-only {
  0% { box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.7); }
  70% { box-shadow: 0 0 0 20px rgba(129, 140, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(129, 140, 248, 0); }
}

.info-title { 
  font-weight: 600; 
  color: var(--primary-dark); 
  font-size: 0.9375rem; 
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.01em;
}
.info-list { font-size: 0.8125rem; color: var(--primary); list-style: none; }
.info-list li { margin-bottom: 0.25rem; }
.empty-state { 
  text-align: center; 
  padding: 4rem 1.5rem;
}
.empty-icon { 
  width: 88px; 
  height: 88px; 
  background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%); 
  border-radius: 50%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  margin: 0 auto var(--spacing-lg);
  border: 1px solid rgba(99, 102, 241, 0.08);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.1), 0 2px 8px rgba(99, 102, 241, 0.06);
}
.empty-icon svg { 
  width: 44px; 
  height: 44px; 
  color: var(--primary); 
}
input[type="file"] { display: none; }
.hidden { display: none; }

/* Pro feature badge (shown to Free users on gated UI) */
.pro-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-left: 8px;
  color: var(--primary-dark);
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.22);
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Near-limit usage warning banner (profile dropdown) */
.usage-warning-banner {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35;
  background: rgba(99, 102, 241, 0.10);
  border: 1px solid rgba(99, 102, 241, 0.18);
  color: var(--primary-dark);
}
.usage-warning-banner[data-variant="warn"] {
  background: rgba(99, 102, 241, 0.10);
  border-color: rgba(99, 102, 241, 0.18);
  color: var(--primary-dark);
}
.usage-warning-banner[data-variant="danger"] {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.22);
  color: #92400e;
}

/* Profile dropdown: injected subscription/usage UI (via updateSubscriptionUI) */
.profile-stats-title {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.usage-stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.usage-stat-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.usage-stat-value {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.usage-upgrade-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.usage-upgrade-link {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.usage-upgrade-link:hover {
  color: var(--primary);
}

.subscription-meta-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.subscription-tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--primary-dark);
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.22);
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.is-pro-tier .subscription-tier-badge {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-color: rgba(99, 102, 241, 0.28);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.18);
}

.subscription-billing-link {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.subscription-billing-link:hover {
  color: var(--primary);
}

/* Download dropdown (Download Snippets button) */
#download-dropdown-menu .dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
#download-dropdown-menu .dropdown-item svg {
  flex-shrink: 0;
  color: #94a3b8;
  margin-top: 2px;
  transition: color 0.15s ease;
}
#download-dropdown-menu .dropdown-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
#download-dropdown-menu .dropdown-item-text strong {
  font-weight: 525;
  color: #374151;
}
#download-dropdown-menu .dropdown-item-desc {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-tertiary);
  line-height: 1.3;
}
#download-dropdown-menu .dropdown-item:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.08) 100%);
  color: var(--text-primary);
}
#download-dropdown-menu .dropdown-item:hover svg {
  color: #10b981;
}
#download-dropdown-menu .dropdown-item:active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(5, 150, 105, 0.14) 100%);
}
#download-dropdown-menu .dropdown-item:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.4);
  outline-offset: 1px;
}
/* Klaviyo option uses primary/purple accent */
#dropdown-klaviyo:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(79, 70, 229, 0.08) 100%);
}
#dropdown-klaviyo:hover svg {
  color: var(--primary);
}
#dropdown-klaviyo:active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14) 0%, rgba(79, 70, 229, 0.14) 100%);
}
/* Dropdown container - enhanced prominence */
#download-dropdown-menu {
  background: white;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 12px 24px -2px rgba(0, 0, 0, 0.12),
    0 24px 48px -4px rgba(16, 185, 129, 0.1),
    0 0 0 1px rgba(16, 185, 129, 0.06);
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}
/* Dropdown animation - override .hidden to use opacity/transform for smooth transitions */
#download-dropdown-menu.hidden {
  display: block !important;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  visibility: hidden;
}

/* Anonymous campaign usage progress (download dropdown) */
.campaign-progress-inner {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.campaign-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.campaign-progress-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.25;
}

.campaign-progress-bar-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

.campaign-progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--success);
  transition: width 0.4s ease, background-color 0.2s ease;
}

.campaign-progress-bar-fill.near-limit {
  background: #f59e0b;
}

.campaign-progress-bar-fill.at-limit {
  background: var(--danger);
}

.campaign-progress-cta {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.campaign-progress-cta:hover {
  text-decoration: underline;
}

.campaign-progress-separator {
  height: 1px;
  background: #f1f5f9;
  margin: 6px 0 6px;
}

.brand-item:hover {
  background-color: #f1f5f9;
  color: var(--primary);
}
.brand-item.active {
  background-color: #eff6ff;
  color: var(--primary);
  font-weight: 600;
}
.brand-item-edit-btn:hover {
  background-color: #e2e8f0;
  color: var(--primary);
}

/* Brand selector visible only when logged in */
.brand-selector-auth-only { display: none !important; }

.brand-api-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary);
  background: var(--primary-subtle);
  padding: 2px 6px;
  border-radius: 4px;
}

#landing-view { display: block; }
#editor-screen { display: none; }
.footer-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1200px) {
  .footer-split-grid {
    grid-template-columns: 1fr;
  }
}
.exclusion-controls { 
  background: var(--primary-subtle);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-md); 
  padding: var(--spacing-lg); 
  box-shadow: var(--shadow-secondary);
  position: relative;
}
.exclusion-title { 
  font-weight: 600; 
  color: var(--text-primary); 
  margin-bottom: var(--spacing-md); 
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}
.input-group { display: flex; gap: var(--spacing-xs); align-items: center; flex-wrap: wrap; }
.input-group input { 
  padding: 0.625rem; 
  border: var(--border-subtle); 
  border-radius: var(--radius-sm); 
  width: 100px; 
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s;
}
.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.input-group label { font-size: 0.875rem; color: var(--text-secondary); font-weight: 500; }

.slider-container { display: flex; flex-direction: column; gap: 0.5rem; }
.slider-container input[type="range"] { width: 100%; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.panel-meta { display: flex; align-items: center; gap: 10px; }
.panel-body { margin-top: 0.75rem; }
.panel-chevron { width: 18px; height: 18px; color: var(--text-tertiary); transition: transform 0.2s ease, color 0.2s ease; }
.panel-pill { background: white; border: 1px solid rgba(15, 23, 42, 0.08); color: var(--text-secondary); font-size: 0.75rem; padding: 4px 10px; border-radius: 999px; font-weight: 600; }
.panel-collapsed { padding-bottom: 1rem; }
.panel-collapsed .panel-body { display: none; }
.panel-collapsed .panel-chevron { transform: rotate(0deg); color: var(--text-tertiary); opacity: 0.7; }
.panel-collapsed .panel-header { opacity: 0.65; }
/* Export settings drawer inside snippets card. Visibility is controlled by app.js (inline display on #export-settings-body); do not set display here to avoid ghost UI. */
.export-settings-drawer {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 12px 1.25rem 8px;
  margin-top: 0;
  margin-bottom: 0;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.settings-drawer-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
#export-settings-body .input-group,
#export-settings-body .input-group input,
#export-settings-body .input-group label,
#export-settings-body .input-group span,
#export-settings-body .quality-label {
  font-size: 13px;
}
#export-settings-body .input-group input {
  height: 32px;
  line-height: 1.4;
}
/* Compression Method: modest spacing above and below the toggle */
#export-settings-body .compression-method-group {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0;
  gap: 6px;
}
#export-settings-body .compression-method-group > span {
  margin-bottom: 0;
}
#export-settings-body .segmented-control {
  margin-top: 0;
  margin-bottom: 0;
}

/* Advanced compression usage hint (free tier, when Advanced is selected) */
.compression-usage-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin: 0;
  padding: 0;
  left: 0;
  text-align: left;
  opacity: 0;
  transition: opacity 0.2s ease;
  overflow: hidden;
  max-height: 0;
  margin-top: 0;
  white-space: nowrap;
}
.compression-usage-hint.is-visible {
  opacity: 1;
  max-height: 2em;
  margin-top: 6px;
}
.compression-usage-hint.is-warning {
  color: #f59e0b;
}
.compression-usage-hint.is-limit {
  color: #ef4444;
  font-weight: 600;
}
.compression-usage-hint a {
  color: inherit;
  text-decoration: none;
}
.compression-usage-hint a:hover {
  text-decoration: underline;
}
/* Advanced toggle option when limit reached (red text, still clickable) */
.segmented-control label.compression-advanced-at-limit span,
.segmented-control label.compression-advanced-at-limit input[type="radio"]:checked + span {
  color: #ef4444;
}

/* Snippets card header (clickable to toggle export drawer) */
.snippets-card-header {
  margin-bottom: 4px;
}
#export-settings-header.expanded #export-summary {
  display: none;
}

/* Wrapper for list + download controls; overlay sits on this when inactive */
#snippets-content-wrapper {
  position: relative;
}

/* Full-width primary Download All button below export drawer */
#download-all {
  width: 100%;
  height: 46px;
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
#download-all:hover:not(:disabled) {
  filter: brightness(105%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -2px rgba(16, 185, 129, 0.5);
}
#download-all svg {
  flex-shrink: 0;
}
.panel-activated .panel-meta { display: none; }
.panel-preupload { background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.05)); border: 1px solid rgba(99, 102, 241, 0.16); box-shadow: inset 0 1px 3px rgba(99, 102, 241, 0.1); padding: 12px 16px !important; }
.panel-preupload .panel-header { color: var(--text-secondary); }
.panel-preupload .panel-header svg { color: var(--text-secondary); }
.panel-preupload .panel-meta { display: flex; }
.panel-preupload .info-button-small { display: none; }
.inactive-block { position: relative; opacity: 0.55; pointer-events: none; filter: grayscale(0.1); }
.inactive-overlay { 
  position: absolute; 
  inset: 0; 
  display: none; 
  align-items: center; 
  justify-content: center; 
  gap: 8px;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.8));
  color: var(--text-secondary); 
  font-weight: 600; 
  font-size: 0.875rem; 
  text-align: center; 
  padding: 1rem; 
  border-radius: inherit;
}
.inactive-block .inactive-overlay { display: flex; }
.snippets-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 24px 24px 18px;
  background: var(--bg-primary);
  box-shadow: var(--shadow-primary);
  border: 1px solid rgba(15, 23, 42, 0.04);
  border-radius: var(--radius-lg);
}
.canvas-empty-state {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.25rem;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.03), rgba(148, 163, 184, 0.05));
  border: 1.5px dashed rgba(99, 102, 241, 0.2);
  border-radius: inherit;
  text-align: center;
}
.canvas-empty-state .upload-area { width: min(520px, 88%); padding: 4rem 3rem; background: white; border-radius: 14px; border: 1px solid rgba(99, 102, 241, 0.15); box-shadow: var(--shadow-lg); }
.canvas-empty-state .upload-icon { width: 88px; height: 88px; box-shadow: 0 10px 26px rgba(99, 102, 241, 0.12), 0 4px 12px rgba(99, 102, 241, 0.08); }
.canvas-empty-state .upload-title { font-size: 1.35rem; }
.canvas-empty-state .upload-subtitle { color: var(--text-secondary); }

/* Compact Workflow Stepper */
.progress-dots { 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  gap: 2rem;
  position: relative;
}

.progress-step { 
  display: flex; 
  align-items: center; 
  gap: 0.5rem; 
  font-size: 0.8125rem; 
  color: var(--text-tertiary); 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  position: relative;
  white-space: nowrap;
}
.progress-step.active { color: var(--primary); font-weight: 600; }
.progress-step.complete { color: var(--text-secondary); }
.progress-dot { 
  width: 32px; 
  height: 32px; 
  border-radius: 50%; 
  background: #ffffff;
  border: 2px solid #e2e8f0;
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 600; 
  font-size: 0.75rem; 
  color: #94a3b8;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  flex-shrink: 0;
}
.progress-step.active .progress-dot { 
  background: var(--primary); 
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
  transform: scale(1.08);
}
.progress-step.complete .progress-dot { 
  background: #10b981; 
  color: white;
  border-color: #10b981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}
.app-header .progress-dots {
  gap: 1rem;
}
.app-header .progress-dots::before {
  content: '';
  position: absolute;
  left: 32px;
  right: 32px;
  height: 1px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.14));
  top: 50%;
  transform: translateY(-50%);
  z-index: 0;
}
.app-header .progress-step {
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  z-index: 1;
}
.app-header .progress-dot {
  width: 28px;
  height: 28px;
}

/* Clickable progress-footer step */
#progress-footer.clickable {
  cursor: pointer;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
#progress-footer.clickable:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}
#progress-footer.clickable:active {
  transform: translateY(0);
}
#progress-footer.attention-grabber {
  animation: btn-pulse-loop 2s infinite;
}

/* Floating Command Bar: premium capsule (Figma-style tool palette) */
#command-bar {
  position: fixed;
  top: 50%;
  left: 32px;
  transform: translateY(-50%);
  z-index: 100;
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  padding: 12px 0;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.05);
  opacity: 0.85;
}
#command-bar.hidden { display: none !important; }

#command-bar .zoom-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  text-align: center;
}
#command-bar .zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
#command-bar .zoom-level {
  min-width: 0;
  font-size: 0.75rem;
}
#command-bar .snap-toggle-container {
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  border: none;
  gap: 0;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}
#command-bar .snap-text {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  text-transform: uppercase;
  flex-shrink: 0;
  transition: color 0.2s ease;
}
#command-bar .snap-toggle-container:has(.snap-toggle.active) .snap-text {
  color: #3b82f6;
}
/* Vertical switch: slim capsule, dot slides down when active */
#command-bar .snap-toggle {
  width: 24px;
  height: 44px;
  border-radius: 22px;
}
#command-bar .snap-toggle::after {
  width: 18px;
  height: 18px;
  top: 2px;
  left: 2px;
  transform: none;
}
#command-bar .snap-toggle.active::after {
  transform: translateY(18px);
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}
.zoom-controls { display: flex; gap: var(--spacing-xs); align-items: center; margin-bottom: var(--spacing-lg); justify-content: center; }
.zoom-btn { 
  width: 36px; 
  height: 36px; 
  border-radius: var(--radius-sm); 
  border: var(--border-subtle); 
  background: var(--bg-primary); 
  cursor: pointer; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 600; 
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
}
.zoom-btn:hover:not(:disabled) { 
  background: var(--bg-secondary); 
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--primary);
}
.zoom-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.zoom-level { 
  font-size: 0.875rem; 
  color: var(--text-secondary); 
  min-width: 60px; 
  text-align: center; 
  font-weight: 600;
}

.snap-toggle-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-left: var(--spacing-md);
  padding-left: var(--spacing-md);
  border-left: 1px solid #e2e8f0;
}

.snap-toggle-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.snap-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background-color: #e2e8f0;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.snap-toggle:hover {
  background-color: #cbd5e1;
}

.snap-toggle.active {
  background-color: #dbeafe;
  border-color: #93c5fd;
}

.snap-toggle::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: white;
  top: 1px;
  left: 1px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.snap-toggle.active::after {
  transform: translateX(22px);
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}
.quality-label { 
  font-size: 0.875rem; 
  color: var(--primary); 
  display: flex; 
  justify-content: space-between;
  font-weight: 600;
}
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-lg); margin-bottom: var(--spacing-lg); }
@media (max-width: 768px) { .controls-grid { grid-template-columns: 1fr; } }
/* Segmented Control for Radio Buttons */
.segmented-control {
  display: flex;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 4px;
  width: 100%;
  position: relative;
  border: 1px solid #e2e8f0;
}

.segmented-control label {
  flex: 1;
  text-align: center;
  cursor: pointer;
  position: relative;
  z-index: 1;
  margin: 0;
}

.segmented-control input[type="radio"] {
  display: none;
}

.segmented-control span {
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.segmented-control input[type="radio"]:checked + span {
  background-color: white;
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.segmented-control label:hover span:not(.active) {
  color: var(--text-primary);
}

/* --- LANDING PAGE STYLES --- */
.hero-section {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - var(--header-height));
  padding: clamp(56px, 8vh, 96px) 0 0;
  padding-top: calc(clamp(56px, 8vh, 96px) + 1px);
  margin-top: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: left;
}

.hero-glow {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(99, 102, 241, 0) 65%);
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.9;
  animation: pulse-glow 12s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
  0% { opacity: 0.65; transform: translate(-50%, -50%) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

.hero-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr 1.06fr;
  gap: 52px;
  align-items: center;
}

.hero-left {
  max-width: 640px;
}

.hero-title {
  font-size: clamp(2.25rem, 3.4vw, 3.25rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: 18ch;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  max-width: 58ch;
  line-height: 1.6;
}

.hero-compat {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
}

.hero-compat-label {
  color: var(--text-tertiary);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: -0.01em;
}

.hero-compat-items {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
}

.hero-compat-dot {
  color: var(--text-tertiary);
  font-weight: 800;
}

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.hero-upload {
  width: 100%;
  background: white;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(15, 23, 42, 0.08);
  cursor: pointer;
  border-radius: 18px;
}

.hero-upload.upload-area {
  padding: 4.5rem 2.5rem;
}

.hero-upload .upload-icon {
  width: 124px;
  height: 124px;
}

.hero-upload .upload-icon svg {
  width: 60px;
  height: 60px;
}

.hero-upload:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 56px rgba(15, 23, 42, 0.10), 0 10px 24px rgba(15, 23, 42, 0.06);
  border-color: rgba(99, 102, 241, 0.22);
}

.hero-upload:active {
  transform: translateY(-2px);
}

.hero-upload-meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 0.875rem;
}

.hero-upload-sep {
  opacity: 0.7;
}

.scroll-hint {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 0.875rem;
  animation: bounce 2s infinite;
  text-decoration: none;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  border-radius: 12px;
  padding: 10px 12px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.scroll-hint:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-secondary);
  transform: translateY(-1px);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.landing-section-header {
  margin: 0 auto 28px;
  max-width: 920px;
  text-align: center;
}

.landing-section-title {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.landing-section-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* === CAMPAIGN USAGE BAR === */
.usage-bar-section {
  padding: 0 0 28px;
}

.usage-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: white;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
}

.usage-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.usage-bar-track {
  flex: 1;
  height: 8px;
  background: #eef0f7;
  border-radius: 999px;
  overflow: hidden;
  min-width: 60px;
}

.usage-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
}

.usage-bar-count {
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.usage-bar-used {
  font-weight: 700;
  color: var(--text-primary);
}

.usage-bar-limit-text {
  font-weight: 500;
  color: var(--text-tertiary);
}

.usage-bar-upgrade {
  padding-left: 16px;
  border-left: 1px solid rgba(15, 23, 42, 0.10);
  flex-shrink: 0;
}

.usage-bar-upgrade-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.usage-bar-upgrade-link:hover {
  opacity: 0.75;
}

@media (max-width: 600px) {
  .usage-bar {
    flex-wrap: wrap;
    gap: 12px;
  }
  .usage-bar-track {
    order: 3;
    flex-basis: 100%;
  }
  .usage-bar-upgrade {
    border-left: none;
    padding-left: 0;
  }
}


.features-section {
  background: transparent;
  padding: 64px 0 72px;
  border-top: none;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  backdrop-filter: blur(6px);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  border-color: rgba(99, 102, 241, 0.22);
}

.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.06) 100%);
  color: var(--primary-dark);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(99, 102, 241, 0.16);
}

.workflow-section {
  padding: 80px 0;
  background: radial-gradient(circle at 10% 0%, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0) 55%),
              radial-gradient(circle at 90% 70%, rgba(148, 163, 184, 0.10) 0%, rgba(148, 163, 184, 0) 55%);
  border-top: none;
  border-radius: 24px;
}

.workflow-content {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 56px;
  align-items: center;
}

.workflow-text h2 {
  font-size: 2.1rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.workflow-text p {
  margin-bottom: 2rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.workflow-list li {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  list-style: none;
  position: relative;
  padding-left: 1.5rem;
}

.workflow-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 800;
}

.workflow-image {
  width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0,0,0,0.03);
  background: white;
  transform: perspective(1000px) rotateY(-2deg);
  transition: transform 0.3s ease;
}

.workflow-image:hover {
  transform: perspective(1000px) rotateY(0deg);
}

/* === HOW IT WORKS SECTION (Zig-Zag Video Layout) === */
.how-it-works-section {
  padding: 40px 0 96px;
  background: transparent;
}

.how-it-works-section .landing-section-header {
  margin-bottom: 56px;
}

.hiw-steps {
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.hiw-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 56px;
  align-items: center;
}

/* Reverse layout for alternating rows (Video Left, Text Right) */
.hiw-row.hiw-row-reverse {
  grid-template-columns: 1.2fr 1fr;
}

.hiw-row.hiw-row-reverse .hiw-text {
  order: 2;
}

.hiw-row.hiw-row-reverse .hiw-video {
  order: 1;
}

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

.hiw-step-number {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hiw-step-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
}

.hiw-step-copy {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
  max-width: 48ch;
}

.hiw-video {
  position: relative;
}

.hiw-video video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  box-shadow: 
    0 20px 50px -12px rgba(0, 0, 0, 0.15),
    0 8px 24px -8px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  background: #f8fafc;
}

/* Responsive: Stack vertically on tablet/mobile */
@media (max-width: 960px) {
  .how-it-works-section {
    padding: 32px 0 64px;
  }

  .hiw-steps {
    gap: 56px;
  }

  .hiw-row,
  .hiw-row.hiw-row-reverse {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* On mobile, always show Text first, Video second */
  .hiw-row .hiw-text,
  .hiw-row.hiw-row-reverse .hiw-text {
    order: 1;
  }

  .hiw-row .hiw-video,
  .hiw-row.hiw-row-reverse .hiw-video {
    order: 2;
  }

  .hiw-step-title {
    font-size: 1.5rem;
  }

  .hiw-step-copy {
    font-size: 1rem;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .how-it-works-section {
    padding: 24px 0 48px;
  }

  .hiw-steps {
    gap: 40px;
  }

  .hiw-row,
  .hiw-row.hiw-row-reverse {
    gap: 20px;
  }

  .hiw-step-title {
    font-size: 1.35rem;
  }

  .hiw-video video {
    border-radius: var(--radius-md);
  }
}

.cta-section {
  padding: 86px 0 52px;
  background: transparent;
}

.cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.92) 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-md);
}

.cta-copy h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.cta-copy p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 1.05rem;
}

.cta-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.cta-actions .btn,
.cta-actions label.btn {
  height: 46px;
  font-size: 0.95rem;
  padding: 0 20px;
}

.cta-btn {
  border-radius: 999px;
  padding-left: 22px;
  padding-right: 22px;
}

.cta-secondary {
  border-radius: 999px;
}

.faq-section {
  padding: 56px 0 96px;
  background: transparent;
}

.faq-grid {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.faq-item {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.15s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "＋";
  color: var(--text-tertiary);
  font-weight: 900;
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "－";
}

.faq-item summary:hover {
  background: rgba(248, 250, 252, 0.9);
}

.faq-content {
  padding: 0 16px 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 0.95rem;
}

.faq-content p strong {
  color: var(--text-primary);
}

/* Focus-visible: keep interactions keyboard-friendly */
.upload-area:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.hero-upload:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), var(--shadow-xl);
}

.scroll-hint:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text-secondary);
}

.faq-item summary:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px rgba(99, 102, 241, 0.22);
  background: rgba(248, 250, 252, 0.9);
}

@media (prefers-reduced-motion: reduce) {
  .hero-glow,
  .scroll-hint {
    animation: none !important;
  }
  .hero-upload,
  .feature-card,
  .workflow-image,
  .scroll-hint {
    transition: none !important;
  }
  .hero-upload:hover,
  .feature-card:hover,
  .scroll-hint:hover,
  .workflow-image:hover {
    transform: none !important;
  }
}

@media (max-width: 960px) {
  .hero-section {
    text-align: center;
    padding-top: 56px;
  }
  .hero-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .hero-left {
    max-width: none;
  }
  .hero-title {
    max-width: none;
  }
  .hero-compat {
    justify-content: center;
  }
  .workflow-content {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .cta-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .cta-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  .faq-grid {
    grid-template-columns: 1fr;
  }
}

/* --- FOOTER / DOCK STYLES --- */
.site-footer {
  padding: 1.5rem 0;
  background: white;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.875rem;
  z-index: 100;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
}
.footer-left a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}
.footer-left a:hover { color: var(--primary); }
.sep { margin: 0 8px; color: var(--text-tertiary); }

/* --- EDITOR MODE STYLES --- */
body.editor-mode #landing-view {
  display: none !important;
}
body.editor-mode #editor-screen {
  display: grid; 
  height: auto;
  min-height: 100vh;
  overflow: visible;
  padding-bottom: 0;
}

/* Make the left side (Canvas) grow naturally */
body.editor-mode .editor-left {
  height: auto;
  overflow: visible;
  padding-right: 0;
  scroll-behavior: auto;
}

/* Make the right side (Settings) sticky */
body.editor-mode .editor-right {
  position: sticky;
  top: 80px; /* Header height + padding */
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 4px;
  height: fit-content;
}

body.editor-mode .site-footer {
  position: relative;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: white;
  padding: 24px 0;
  margin-top: 0;
  width: 100%;
}

/* --- HISTORY MODAL STYLES --- */
.history-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  background: white;
  position: relative;
  transform: translateZ(0);
  will-change: transform;
}
.history-item:hover {
  transform: translateY(-2px) translateZ(0);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}
.history-item .history-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.15s ease;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.history-item:hover .history-delete-btn {
  opacity: 1;
  transform: scale(1);
}
.history-item .history-delete-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
}
.history-item .history-delete-btn:hover svg {
  color: #dc2626;
}
.history-item .history-delete-btn svg {
  width: 14px;
  height: 14px;
  color: #94a3b8;
  transition: color 0.15s ease;
}
.history-thumb {
  height: 120px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transform: translateZ(0);
}
.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translateZ(0);
}
.history-meta {
  padding: 12px;
}
.history-name {
  font-weight: 600;
  color: #334155;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-date {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 4px;
}

/* --- LOGGED-IN LANDING PAGE STYLES --- */

/* Recent Projects Section */
.recent-projects-section {
  padding: clamp(32px, 5vh, 64px) 0 clamp(48px, 8vh, 96px);
  background: var(--bg-secondary, #f8fafc);
}

.recent-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.recent-projects-section .history-item {
  background: white;
  position: relative;
}

.recent-projects-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
  font-size: 0.95rem;
}

/* Marketing sections wrapper - no special styles needed, 
   visibility controlled via JS */
#marketing-sections {
  display: block;
}

/* === MOBILE RESPONSIVE (Tablets & Phones) - Tighten landing page sections === */
@media (max-width: 768px) {
  /* Tighten landing page sections on mobile */
  .features-section {
    padding: 40px 0 32px !important;
  }
  .workflow-section {
    padding: 40px 0 !important;
  }
  .cta-section {
    padding: 40px 0 !important;
  }
  .faq-section {
    padding: 40px 0 60px !important;
  }
  .recent-projects-section {
    padding: 32px 0 40px !important;
  }
  .landing-section-header {
    margin-bottom: 24px !important;
  }
  .workflow-content {
    gap: 32px !important;
  }
  .hero-section {
    padding-bottom: 32px !important;
  }
}

/* === MOBILE RESPONSIVE (Small Phones) === */
@media (max-width: 480px) {
  /* Phase 1: Header cleanup - hide progress on landing, compact layout */
  body:not(.editor-mode) .header-progress {
    display: none;
  }
  body:not(.editor-mode) .app-header-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
  }
  .header-divider {
    display: none;
  }
  .app-header {
    padding: 0;
  }

  /* Phase 2: Hero section mobile optimization */
  .hero-section {
    padding-top: 32px;
    min-height: auto;
    padding-bottom: 32px;
  }
  .hero-title {
    font-size: 1.875rem;
  }
  .hero-subtitle {
    font-size: 1rem;
    line-height: 1.5;
  }
  .hero-upload.upload-area {
    padding: 2.5rem 1.5rem;
  }
  .hero-upload .upload-icon {
    width: 80px;
    height: 80px;
  }
  .hero-upload .upload-icon svg {
    width: 40px;
    height: 40px;
  }

  /* Phase 3: Touch-friendly sizing */
  .btn {
    min-height: 44px;
    padding: 12px 20px;
  }
  .header-actions .btn {
    min-height: 44px;
  }
  #login-btn {
    min-height: 44px;
    padding: 10px 20px;
  }

  /* Phase 4: Content sections polish */
  .features-grid {
    gap: 12px;
  }
  .feature-card {
    padding: 20px;
  }
  .faq-section {
    padding: 40px 0 60px !important;
  }
  .site-footer {
    padding: 20px 16px;
  }
  .footer-inner {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
  }

  /* Phase 5: Global mobile polish */
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  body {
    overflow-x: hidden;
  }
}

/* === Brand Selector (matches Snippets / Compression panels) === */
.brand-selector-section {
  background: var(--bg-primary);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm) var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-primary);
}

.brand-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xs);
}
.brand-section-header label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  font-weight: 600;
}
.brand-section-header .link-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  font-weight: 500;
}
.brand-section-header .link-btn:hover {
  color: var(--text-primary);
}

.brand-controls-row {
  display: flex;
  gap: var(--spacing-xs);
  align-items: center;
}

.brand-select-wrapper {
  flex-grow: 1;
  position: relative;
}
.brand-select-wrapper select {
  width: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: var(--border-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  appearance: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.brand-select-wrapper::after {
  content: '▼';
  font-size: 8px;
  color: var(--text-tertiary);
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.brand-select-wrapper select:hover {
  border-color: rgba(15, 23, 42, 0.1);
}

.brand-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.brand-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: rgba(15, 23, 42, 0.1);
}
.brand-action-btn.delete-mode {
  color: var(--danger);
}

/* === PRICING SECTION (Landing Page) === */
.pricing-section {
  padding: 80px 0 96px;
  background: transparent;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

/* Safety: never show pricing while actively using the editor */
body.editor-mode .pricing-section,
body.editor-mode .pricing-compare-section {
  display: none !important;
}

/* --- Pricing Comparison Section --- */
.pricing-compare-section {
  padding: 80px 0 64px;
  background: transparent;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

/* Pricing Cards (Landing Page) */
.pricing-cards {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.pricing-card {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-primary);
  padding: 26px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateZ(0);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.pricing-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: var(--shadow-xl);
}

.pricing-card--pro {
  border-color: rgba(99, 102, 241, 0.22);
  box-shadow: 0 18px 52px rgba(99, 102, 241, 0.14), var(--shadow-primary);
}

.pricing-card--pro:hover {
  border-color: rgba(99, 102, 241, 0.32);
  box-shadow: 0 24px 64px rgba(99, 102, 241, 0.18), var(--shadow-xl);
}

.pricing-card--pro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.pricing-card-header {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.pricing-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pricing-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.pricing-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
  white-space: nowrap;
}

.pricing-card-price {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.pricing-card-price-from {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pricing-card-price-amount {
  font-size: 2.15rem;
}

.pricing-card-price-period {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.pricing-card-subtitle {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

.pricing-card-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-card-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 2.25rem; /* Keep Free and Pro feature rows aligned side-by-side */
}

.pricing-feature-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  margin-top: 1px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.04);
  color: var(--text-tertiary);
}

.pricing-feature-icon--check {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.22);
  color: var(--primary-dark);
}

.pricing-feature-icon--info {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.10);
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.pricing-feature-icon--dash {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.08);
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

.pricing-feature-text {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.35;
  font-weight: 600;
}

.pricing-card-cta {
  margin-top: 18px;
  display: flex;
}

.pricing-card-cta-btn {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  justify-content: center;
}

.pricing-card-bestfor {
  margin-top: 10px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 768px) {
  .pricing-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .pricing-card {
    padding: 22px 18px;
    border-radius: 16px;
  }
}

.pricing-compare-table-wrap {
  max-width: 860px;
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pricing-compare-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-primary);
  overflow: hidden;
  font-size: 0.92rem;
}

.pricing-compare-table thead th {
  padding: 18px 24px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-align: left;
  border-bottom: 2px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.8);
}

.pricing-compare-table thead th.pricing-compare-feature-col {
  width: 36%;
}

.pricing-compare-table thead th.pricing-compare-plan-col {
  width: 32%;
  text-align: center;
  color: var(--text-primary);
}

.pricing-compare-table thead th.pricing-compare-plan-col--pro {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.pricing-compare-table tbody td {
  padding: 14px 24px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  color: var(--text-secondary);
  text-align: center;
  vertical-align: middle;
}

.pricing-compare-table tbody tr:last-child td {
  border-bottom: none;
}

.pricing-compare-table tbody td.pricing-compare-label {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
}

.pricing-compare-table tbody td.pricing-compare-pro-cell {
  color: var(--text-primary);
  font-weight: 500;
}

.pricing-compare-check {
  color: var(--primary);
  font-weight: 700;
  margin-right: 4px;
}

.pricing-compare-pro-cell .pricing-compare-check {
  color: var(--primary);
}

.pricing-compare-dash {
  color: var(--text-tertiary);
  font-size: 1.1em;
}

.pricing-compare-best-for td {
  background: rgba(248, 250, 252, 0.6);
  font-style: italic;
}

/* CTA buttons under comparison */
.pricing-compare-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

.pricing-compare-cta-free,
.pricing-compare-cta-pro {
  min-width: 200px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 28px;
}

.pricing-compare-cta-free {
  border: 1px solid rgba(99, 102, 241, 0.22);
}

/* Pro Usage Scaling – Hover Popup Trigger */
.pricing-scaling-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}

.pricing-scaling-icon {
  color: var(--primary);
  opacity: 0.7;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.pricing-scaling-trigger:hover .pricing-scaling-icon {
  opacity: 1;
}

/* The popup tooltip */
.pricing-scaling-popup {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  min-width: 240px;
  background: white;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  padding: 14px 16px;
  pointer-events: none;
  flex-direction: column;
  gap: 0;
}

/* Arrow */
.pricing-scaling-popup::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: white;
  border-top: 1px solid rgba(15, 23, 42, 0.10);
  border-left: 1px solid rgba(15, 23, 42, 0.10);
}

.pricing-scaling-trigger:hover .pricing-scaling-popup {
  display: flex;
  pointer-events: auto;
}

.pricing-scaling-popup-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  text-align: center;
}

.pricing-scaling-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 0.85rem;
}

.pricing-scaling-popup-row > span:first-child {
  color: var(--text-secondary);
}

.pricing-scaling-popup-row > span:last-child {
  font-weight: 700;
  color: var(--text-primary);
}

.pricing-scaling-popup-row--contact > span:last-child {
  color: var(--primary);
  font-weight: 700;
}

@media (max-width: 768px) {
  .pricing-compare-section {
    padding: 56px 0 48px;
  }
  .pricing-compare-table thead th,
  .pricing-compare-table tbody td {
    padding: 12px 14px;
    font-size: 0.82rem;
  }
  .pricing-compare-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .pricing-compare-cta-free,
  .pricing-compare-cta-pro {
    min-width: 0;
    width: 100%;
    text-align: center;
  }
  .pricing-scaling-popup {
    left: auto;
    right: -8px;
    transform: none;
    min-width: 210px;
  }
  .pricing-scaling-popup::before {
    left: auto;
    right: 20px;
    transform: rotate(45deg);
  }
}

.pricing-section .pricing-header {
  margin: 0 auto 36px;
  max-width: 920px;
  text-align: center;
}

.pricing-section .pricing-title {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.pricing-section .pricing-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

.pricing-section .pricing-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
  max-width: 980px;
  margin: 0 auto;
}

.pricing-section .pricing-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-primary);
  padding: 28px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  backdrop-filter: blur(6px);
}

.pricing-section .pricing-card--free {
  background: rgba(255, 255, 255, 0.86);
}

.pricing-section .pricing-card--free::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(148, 163, 184, 0.02) 100%);
  pointer-events: none;
}

.pricing-section .pricing-card--pro {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: var(--shadow-xl);
  color: white;
}

.pricing-section .pricing-card--pro::before {
  content: '';
  position: absolute;
  inset: -40%;
  z-index: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 60%);
  transform: rotate(8deg);
  pointer-events: none;
}

.pricing-section .pricing-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.26);
  color: rgba(255, 255, 255, 0.95);
}

.pricing-section .pricing-plan,
.pricing-section .pricing-features,
.pricing-section .pricing-cta {
  position: relative;
  z-index: 1;
}

.pricing-section .pricing-plan-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.pricing-section .pricing-card--pro .pricing-plan-name {
  color: white;
}

.pricing-section .pricing-price-row {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.pricing-section .pricing-price {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.05;
}

.pricing-section .pricing-card--pro .pricing-price {
  color: white;
}

.pricing-section .pricing-price-suffix {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-tertiary);
}

.pricing-section .pricing-card--pro .pricing-price-suffix {
  color: rgba(255, 255, 255, 0.75);
}

.pricing-section .pricing-features {
  list-style: none;
  margin: 18px 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.95rem;
  font-weight: 600;
}

.pricing-section .pricing-card--pro .pricing-features {
  color: rgba(255, 255, 255, 0.9);
}

.pricing-section .pricing-features li {
  position: relative;
  padding-left: 26px;
}

.pricing-section .pricing-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--success);
  font-weight: 900;
}

.pricing-section .pricing-card--pro .pricing-features li::before {
  color: rgba(255, 255, 255, 0.9);
}

.pricing-section .pricing-cta {
  width: 100%;
  height: 46px;
  border-radius: 999px;
}

.pricing-section .pricing-card--free .pricing-cta {
  border-color: rgba(99, 102, 241, 0.22);
}

.pricing-section .pricing-card--pro .pricing-cta {
  background: rgba(255, 255, 255, 0.96);
  color: var(--primary-dark);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.pricing-section .pricing-card--pro .pricing-cta:hover:not(:disabled) {
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
}

.pricing-section .pricing-scale {
  max-width: 980px;
  margin: 32px auto 0;
}

.pricing-section .pricing-scale-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.pricing-section .pricing-scale-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pricing-section .pricing-scale-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 12px 16px;
  align-items: center;
}

.pricing-section .pricing-scale-row + .pricing-scale-row {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.pricing-section .pricing-scale-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.pricing-section .pricing-scale-price {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
}

.pricing-section .pricing-contact-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
}

.pricing-section .pricing-contact-link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .pricing-section {
    padding: 56px 0 64px;
  }
  .pricing-section .pricing-cards {
    grid-template-columns: 1fr;
  }
  .pricing-section .pricing-card {
    padding: 24px;
  }
}

/* === UPGRADE MODAL (Tier Selection) === */
.upgrade-modal {
  position: fixed;
  inset: 0;
  display: none; /* hidden by default; shown via JS */
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2200;
}

.upgrade-modal.is-open {
  display: flex;
}

.upgrade-modal .upgrade-modal-card {
  width: 100%;
  max-width: 520px;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  padding: 24px 24px 20px;
  position: relative;
  border: 1px solid rgba(15, 23, 42, 0.08);
  animation: slideDown 0.3s ease-out;
  max-height: 90vh;
  overflow: auto;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.upgrade-modal .upgrade-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.upgrade-modal .upgrade-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transform: translateY(-1px);
}

.upgrade-modal .upgrade-modal-close:active {
  transform: translateY(0);
}

.upgrade-modal .upgrade-modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.upgrade-modal .upgrade-modal-header {
  padding-right: 44px; /* keep text clear of close button */
}

.upgrade-modal .upgrade-modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.upgrade-modal .upgrade-modal-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* Pro badge */
.upgrade-modal .upgrade-modal-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

/* Feature checklist — 3 rows × 2 columns */
.upgrade-modal .upgrade-modal-features {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.upgrade-modal .upgrade-modal-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.upgrade-modal .upgrade-modal-feature-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upgrade-modal .upgrade-modal-feature-icon svg {
  width: 11px;
  height: 11px;
}

.upgrade-modal .upgrade-modal-feature-highlight {
  color: var(--primary);
  font-weight: 700;
}

/* Divider */
.upgrade-modal .upgrade-modal-divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
  margin: 16px 0 14px;
}

/* Volume label */
.upgrade-modal .upgrade-modal-volume-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

/* Volume selector — 4-column tile grid */
.upgrade-modal .upgrade-modal-volume-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-top: 12px;
}

.upgrade-modal .upgrade-modal-error {
  display: none; /* hidden by default; toggled via JS */
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--danger-subtle);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #b91c1c;
  font-size: 0.875rem;
  font-weight: 600;
}

.upgrade-modal .upgrade-modal-error.is-visible {
  display: block;
}

.upgrade-modal .upgrade-modal-options {
  margin-top: 0;
}

.upgrade-modal .upgrade-modal-options.is-hidden {
  display: none;
}

/* Volume tier — compact square tile */
.upgrade-modal .upgrade-modal-tier {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(15, 23, 42, 0.12);
  background: white;
  cursor: pointer;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upgrade-modal .upgrade-modal-tier:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.03);
}

.upgrade-modal .upgrade-modal-tier:active {
  background: rgba(99, 102, 241, 0.06);
}

.upgrade-modal .upgrade-modal-tier:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

.upgrade-modal .upgrade-modal-tier.is-selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
}

/* Floating "Popular" badge above tile top border */
.upgrade-modal .upgrade-modal-tier-popular {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Volume number */
.upgrade-modal .upgrade-modal-tier-vol {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}

.upgrade-modal .upgrade-modal-tier.is-selected .upgrade-modal-tier-vol {
  color: var(--text-primary);
}

/* Price inside tile */
.upgrade-modal .upgrade-modal-tier-price {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-tertiary);
  line-height: 1;
}

.upgrade-modal .upgrade-modal-tier.is-selected .upgrade-modal-tier-price {
  color: var(--primary);
}

.upgrade-modal .upgrade-modal-tier-price-mo {
  font-weight: 500;
}

/* Current plan badge for Pro users (injected by JS) */
.upgrade-modal .upgrade-modal-tier-current-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 7px;
  border-radius: 999px;
}

/* CTA button — full width */
.upgrade-modal .upgrade-modal-cta-btn {
  width: 100%;
  margin-top: 14px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.upgrade-modal .upgrade-modal-cta-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.upgrade-modal .upgrade-modal-cta-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.upgrade-modal .upgrade-modal-cta-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25), 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* Trust signal */
.upgrade-modal .upgrade-modal-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.upgrade-modal .upgrade-modal-loading {
  display: none; /* hidden by default; toggled via JS */
  margin-top: 18px;
  padding: 20px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(99, 102, 241, 0.25);
  background: rgba(248, 250, 252, 0.95);
  box-shadow: var(--shadow-sm);
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: left;
}

.upgrade-modal .upgrade-modal-loading.is-active {
  display: flex;
}

@keyframes upgrade-loading-pulse {
  0%, 100% {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: var(--shadow-sm);
  }
  50% {
    border-color: rgba(99, 102, 241, 0.40);
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.10), var(--shadow-sm);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .upgrade-modal .upgrade-modal-loading.is-active {
    animation: upgrade-loading-pulse 1.8s ease-in-out infinite;
  }
}

.upgrade-modal .upgrade-modal-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid rgba(99, 102, 241, 0.18);
  border-top-color: var(--primary);
  animation: spinning 1s linear infinite;
  flex-shrink: 0;
}

.upgrade-modal .upgrade-modal-loading-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upgrade-modal .upgrade-modal-loading-title {
  font-weight: 800;
  color: var(--text-primary);
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.upgrade-modal .upgrade-modal-loading-subtitle {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Onboarding: "Continue with Free" button */
.upgrade-modal .upgrade-modal-footer-actions {
  display: flex;
  justify-content: center;
  width: 100%;
}
.upgrade-modal .upgrade-modal-continue-free {
  width: 100%;
  margin-top: 10px;
  height: 46px;
  padding: 0;
  border-radius: 10px;
  background: white;
  border: 1.5px solid rgba(15, 23, 42, 0.13);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.upgrade-modal .upgrade-modal-continue-free:hover {
  background: var(--bg-secondary);
  border-color: rgba(15, 23, 42, 0.18);
  box-shadow: var(--shadow-sm);
}
.upgrade-modal .upgrade-modal-continue-free:active {
  background: var(--bg-tertiary);
  box-shadow: none;
}
.upgrade-modal .upgrade-modal-continue-free:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* Onboarding variant styling */
.upgrade-modal[data-context="onboarding"] .upgrade-modal-card {
  border-color: rgba(99, 102, 241, 0.22);
  box-shadow: 0 18px 52px rgba(99, 102, 241, 0.16), var(--shadow-xl);
}

.upgrade-modal .upgrade-modal-note {
  margin-top: 14px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  font-weight: 600;
}

.upgrade-modal .upgrade-modal-note a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
}

.upgrade-modal .upgrade-modal-note a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .upgrade-modal {
    padding: 12px;
  }
  .upgrade-modal .upgrade-modal-card {
    padding: 20px 16px 16px;
    border-radius: 16px;
  }
  .upgrade-modal .upgrade-modal-features {
    grid-template-columns: 1fr;
  }
  .upgrade-modal .upgrade-modal-tier-vol {
    font-size: 1.2rem;
  }
}

/* === LIMIT MODAL (Plan Limits) === */
.limit-modal {
  position: fixed;
  inset: 0;
  display: none; /* hidden by default; shown via JS */
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2250;
}

.limit-modal.is-open {
  display: flex;
}

.limit-modal .limit-modal-card {
  width: 100%;
  max-width: 520px;
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  padding: 28px;
  position: relative;
  border: 1px solid rgba(15, 23, 42, 0.08);
  animation: slideDown 0.3s ease-out;
  max-height: 85vh;
  overflow: auto;
  text-align: center;
}

.limit-modal .limit-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.limit-modal .limit-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transform: translateY(-1px);
}

.limit-modal .limit-modal-close:active {
  transform: translateY(0);
}

.limit-modal .limit-modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.22);
}

.limit-modal .limit-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid rgba(245, 158, 11, 0.28);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.16);
  color: var(--warning-text);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto 14px;
}

.limit-modal .limit-modal-icon svg {
  width: 30px;
  height: 30px;
}

@keyframes limit-icon-pulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(245, 158, 11, 0.16); }
  50% { box-shadow: 0 14px 34px rgba(245, 158, 11, 0.22); }
}

@media (prefers-reduced-motion: no-preference) {
  #limit-modal.is-open .limit-modal-icon {
    animation: limit-icon-pulse 2.8s ease-in-out infinite;
  }
}

.limit-modal .limit-modal-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.limit-modal .limit-modal-message {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}

.limit-modal .limit-modal-usage {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.92);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.limit-modal .limit-modal-usage-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.limit-modal .limit-modal-usage-label {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.limit-modal .limit-modal-usage-value {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
}

.limit-modal .limit-modal-progress {
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.limit-modal .limit-modal-progress-bar {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.18);
}

/* Checkout success modal extras (reuses limit-modal base) */
#checkout-success-modal .limit-modal-icon {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border: 1px solid rgba(16, 185, 129, 0.28);
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.16);
  color: var(--success);
}
#checkout-success-modal .limit-modal-close:focus-visible {
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22);
}
.checkout-success-spinner-wrap {
  display: flex;
  justify-content: center;
  margin: 14px 0 8px;
  padding: 16px 14px;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.14);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(79, 70, 229, 0.04) 100%);
  box-shadow: var(--shadow-sm);
}
.checkout-success-features {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: left;
}
.checkout-success-features li {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 0.85rem;
  font-weight: 700;
}

.checkout-success-features li::before {
  content: '✓';
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.22);
  color: var(--success);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.limit-modal .limit-modal-secondary.checkout-success-billing-btn {
  border: 1px solid rgba(99, 102, 241, 0.22);
  background: white;
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
}

.limit-modal .limit-modal-secondary.checkout-success-billing-btn:hover:not(:disabled) {
  background: var(--bg-secondary);
  box-shadow: var(--shadow-md);
}

.limit-modal .limit-modal-secondary.checkout-success-billing-btn:active:not(:disabled) {
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-sm);
}

.limit-modal .limit-modal-secondary.checkout-success-billing-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), var(--shadow-md);
}

@keyframes checkout-success-bloom {
  0% { transform: scale(0.96); box-shadow: 0 10px 24px rgba(16, 185, 129, 0.10); }
  60% { transform: scale(1.06); box-shadow: 0 18px 44px rgba(16, 185, 129, 0.22); }
  100% { transform: scale(1); box-shadow: 0 10px 24px rgba(16, 185, 129, 0.16); }
}

@media (prefers-reduced-motion: no-preference) {
  #checkout-success-modal[data-state="active"] .limit-modal-icon {
    animation: checkout-success-bloom 0.6s ease-out 1;
  }
}

.limit-modal .limit-modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.limit-modal .limit-modal-primary,
.limit-modal .limit-modal-secondary {
  height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 0.9rem;
}

.limit-modal .limit-modal-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  box-shadow: none;
  font-weight: 800;
}

.limit-modal .limit-modal-secondary:hover:not(:disabled) {
  background: var(--bg-secondary);
  color: var(--primary-dark);
}

.limit-modal .limit-modal-secondary:active:not(:disabled) {
  background: var(--bg-tertiary);
}

.limit-modal .limit-modal-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

@media (prefers-reduced-motion: no-preference) {
  .limit-modal .limit-modal-primary--pulse {
    position: relative;
    z-index: 0;
  }

  .limit-modal .limit-modal-primary--pulse::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 999px;
    z-index: -1;
    pointer-events: none;
    animation: btn-pulse-loop 2.2s infinite;
  }
}

@media (max-width: 480px) {
  .limit-modal {
    padding: 16px;
  }
  .limit-modal .limit-modal-card {
    padding: 22px 18px;
    border-radius: 14px;
  }
  .limit-modal .limit-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .limit-modal .limit-modal-primary,
  .limit-modal .limit-modal-secondary {
    width: 100%;
  }
}
