/* ═══════════════════════════════════════════════════════════════════════════
   Epsilon Harmonics — Claymorphism Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Palette */
  --clay-bg:          #f0eeff;
  --clay-surface:     #ffffff;
  --clay-primary:     #7c3aed;
  --clay-primary-dk:  #5b21b6;
  --clay-secondary:   #a78bfa;
  --clay-accent:      #f59e0b;
  --clay-muted:       #ede9fe;
  --clay-text:        #1e1b4b;
  --clay-subtext:     #6d6a8a;
  --clay-success:     #10b981;
  --clay-error:       #ef4444;

  /* Neomorphic Claymorphism: Inner highlights for glossy inflation + outer soft neomorphic shadows */
  --shadow-clay-sm:   inset 2px 2px 5px rgba(255,255,255,0.85), inset -2px -2px 5px rgba(124,58,237,0.1), 4px 4px 10px rgba(124,58,237,0.12), -4px -4px 10px rgba(255,255,255,0.85);
  --shadow-clay-md:   inset 4px 4px 10px rgba(255,255,255,0.9), inset -4px -4px 10px rgba(124,58,237,0.15), 8px 8px 20px rgba(124,58,237,0.15), -8px -8px 20px rgba(255,255,255,0.9);
  --shadow-clay-lg:   inset 6px 6px 15px rgba(255,255,255,0.9), inset -6px -6px 15px rgba(124,58,237,0.2), 12px 12px 28px rgba(124,58,237,0.18), -12px -12px 28px rgba(255,255,255,0.95);
  --shadow-clay-hover: inset 8px 8px 20px rgba(255,255,255,0.95), inset -8px -8px 20px rgba(124,58,237,0.25), 16px 16px 36px rgba(124,58,237,0.22), -16px -16px 36px rgba(255,255,255,0.95);

  /* Border radii */
  --radius-sm:  12px;
  --radius-md:  20px;
  --radius-lg:  32px;
  --radius-xl:  48px;
  --radius-pill: 999px;

  /* Typography */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Spacing scale */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;  --sp-8: 64px;

  /* Animation easing */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Transition durations */
  --dur-fast:   120ms;
  --dur-mid:    280ms;
  --dur-slow:   520ms;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background-color: var(--clay-bg);
  color: var(--clay-text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   @keyframes — Animation Catalogue
   ═══════════════════════════════════════════════════════════════════════════ */

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

@keyframes heroFloat {
  0%, 100% { transform: translateY(0px) rotate(-2deg); }
  50%       { transform: translateY(-18px) rotate(2deg); }
}

@keyframes epsilonGlow {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(124,58,237,.4)); }
  50%       { filter: drop-shadow(0 0 28px rgba(167,139,250,.7)); }
}

@keyframes sineScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@keyframes wiggle {
  0%,100% { transform: rotate(0deg) scale(1); }
  20%     { transform: rotate(-2deg) scale(1.02); }
  40%     { transform: rotate(2deg) scale(1.02); }
  60%     { transform: rotate(-1deg) scale(1.01); }
  80%     { transform: rotate(1deg) scale(1.01); }
}

@keyframes springPop {
  0%   { opacity: 0; transform: scale(0.6); }
  60%  { transform: scale(1.08); }
  80%  { transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes orbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes pulsePlanet {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.8; }
}

@keyframes progressFill {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes shimmer {
  from { transform: translateX(-150%); }
  to   { transform: translateX(150%); }
}

@keyframes epsilonPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.12); opacity: 0.85; }
}

@keyframes badgeBounce {
  0%  { opacity: 0; transform: scale(0.4) translateY(-12px); }
  60% { transform: scale(1.15) translateY(3px); }
  80% { transform: scale(0.95) translateY(-1px); }
  100%{ opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes barGrow {
  from { width: 0; }
  to   { width: var(--bar-pct); }
}

@keyframes blobDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -20px) scale(1.06); }
  66%       { transform: translate(-20px, 15px) scale(0.96); }
}

@keyframes uploadIconBounce {
  0%,100% { transform: translateY(0); }
  40%     { transform: translateY(-8px); }
  60%     { transform: translateY(-5px); }
}

@keyframes confettiDrop {
  to { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

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

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

@keyframes rippleExpand {
  from { transform: scale(0); opacity: 0.5; }
  to   { transform: scale(2.5); opacity: 0; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Ambient Background Blobs
   ═══════════════════════════════════════════════════════════════════════════ */
.ambient-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(72px);
  pointer-events: none;
  z-index: -1;
  animation: blobDrift 12s ease-in-out infinite;
}
.blob-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(167,139,250,.25), transparent 70%);
  top: -120px; right: -100px;
  animation-delay: 0s;
}
.blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(245,158,11,.15), transparent 70%);
  bottom: -80px; left: -60px;
  animation-delay: -6s;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Navbar
   ═══════════════════════════════════════════════════════════════════════════ */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1.5px solid rgba(167,139,250,.2);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(124,58,237,.07);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  transition: transform var(--dur-mid) var(--ease-spring);
}
.navbar-brand:hover { transform: scale(1.04); }

.brand-logo {
  height: 38px;
  width: auto;
  transition: transform var(--dur-mid) var(--ease-spring);
}
.hero-logo {
  width: 140px;
  height: auto;
  animation: heroFloat 4s ease-in-out infinite, epsilonGlow 4s ease-in-out infinite;
  display: inline-block;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--clay-text);
  letter-spacing: -0.02em;
}
.navbar-tagline {
  font-size: 0.78rem;
  color: var(--clay-subtext);
  font-weight: 500;
  display: none;
}
@media (min-width: 640px) { .navbar-tagline { display: block; } }

/* ═══════════════════════════════════════════════════════════════════════════
   Clay Component System
   ═══════════════════════════════════════════════════════════════════════════ */

/* Card */
.clay-card {
  background: var(--clay-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-clay-md);
  border: 2px solid rgba(167,139,250,.22);
  padding: var(--sp-6);
  transition:
    box-shadow var(--dur-mid) var(--ease-out),
    transform   var(--dur-mid) var(--ease-out);
}
.clay-card:hover {
  box-shadow: var(--shadow-clay-hover);
  transform: translateY(-4px);
}

/* Primary Button */
.clay-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--clay-primary), var(--clay-secondary));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 0 var(--clay-primary-dk), 0 8px 24px rgba(124,58,237,.25);
  transition:
    transform  var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-spring),
    opacity    var(--dur-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}
.clay-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--clay-primary-dk), 0 12px 32px rgba(124,58,237,.35);
}
.clay-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--clay-primary-dk), 0 4px 12px rgba(124,58,237,.2);
}
.clay-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* Secondary Button */
.clay-btn-secondary {
  background: var(--clay-muted);
  color: var(--clay-primary);
  box-shadow: 0 6px 0 #c4b5fd, 0 8px 20px rgba(124,58,237,.12);
}
.clay-btn-secondary:hover:not(:disabled) {
  box-shadow: 0 8px 0 #a78bfa, 0 12px 28px rgba(124,58,237,.2);
}
.clay-btn-secondary:active:not(:disabled) {
  box-shadow: 0 2px 0 #c4b5fd, 0 4px 10px rgba(124,58,237,.1);
}

/* Ghost Button */
.clay-btn-ghost {
  background: transparent;
  color: var(--clay-subtext);
  box-shadow: none;
  border: 2px solid rgba(167,139,250,.3);
}
.clay-btn-ghost:hover:not(:disabled) {
  color: var(--clay-primary);
  border-color: var(--clay-secondary);
  box-shadow: none;
  transform: translateY(-2px);
}
.clay-btn-ghost:active:not(:disabled) { transform: translateY(0); }

/* Ripple effect injected by JS */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  pointer-events: none;
  animation: rippleExpand 600ms var(--ease-out) forwards;
}

/* ── Slide-up utility (triggered by IntersectionObserver) ─────────────── */
.slide-up {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity    var(--dur-slow) var(--ease-out),
    transform  var(--dur-slow) var(--ease-out);
}
.slide-up.visible {
  opacity: 1;
  transform: translateY(0);
}
.stagger-1 { transition-delay:  80ms; }
.stagger-2 { transition-delay: 160ms; }
.stagger-3 { transition-delay: 240ms; }
.stagger-4 { transition-delay: 320ms; }
.stagger-5 { transition-delay: 400ms; }
.stagger-6 { transition-delay: 480ms; }

/* ═══════════════════════════════════════════════════════════════════════════
   Hero Section
   ═══════════════════════════════════════════════════════════════════════════ */
.hero {
  position: relative;
  text-align: center;
  padding: var(--sp-8) var(--sp-5) var(--sp-7);
  overflow: hidden;
}

.hero-sine-wrap {
  position: absolute;
  bottom: 0; left: 0;
  width: 200%;
  pointer-events: none;
  animation: sineScroll 14s linear infinite;
}
.hero-sine { width: 100%; }
.sine-path-1 { fill: rgba(167,139,250,.12); }
.sine-path-2 { fill: rgba(245,158,11,.07); }

.hero-content {
  position: relative;
  z-index: 1;
  animation: fadeSlideUp var(--dur-slow) var(--ease-out) both;
}

.hero-epsilon-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: var(--sp-4);
}
.hero-epsilon {
  font-family: var(--font-display);
  font-size: clamp(5rem, 14vw, 10rem);
  font-weight: 800;
  color: var(--clay-primary);
  display: block;
  animation: heroFloat 4s ease-in-out infinite, epsilonGlow 4s ease-in-out infinite;
  line-height: 1;
}
.hero-epsilon-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(124,58,237,.18), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--clay-text);
  letter-spacing: -0.04em;
  line-height: 1.15;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.3em;
  margin-bottom: var(--sp-2);
}
.hero-word {
  display: inline-block;
  opacity: 0;
  animation: fadeSlideUp 500ms var(--ease-spring) forwards;
}
.hero-word.stagger-1 { animation-delay: 100ms; }
.hero-word.stagger-2 { animation-delay: 200ms; }
.hero-word.stagger-3 { animation-delay: 300ms; }
.hero-word.stagger-4 { animation-delay: 400ms; }

.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  font-weight: 700;
  color: var(--clay-primary);
  opacity: 0;
  animation: fadeSlideUp 500ms var(--ease-spring) 500ms forwards;
}
.hero-description {
  color: var(--clay-subtext);
  font-size: 1.05rem;
  max-width: 420px;
  margin: var(--sp-3) auto 0;
  opacity: 0;
  animation: fadeSlideUp 500ms var(--ease-spring) 600ms forwards;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Upload Section
   ═══════════════════════════════════════════════════════════════════════════ */
.upload-section {
  max-width: 680px;
  margin: 0 auto var(--sp-8);
  padding: 0 var(--sp-5);
}

.upload-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* Dropzone */
.clay-dropzone {
  border: 3px dashed var(--clay-secondary);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #f5f3ff, var(--clay-muted));
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--dur-mid) var(--ease-out),
    background   var(--dur-mid) var(--ease-out),
    transform    var(--dur-mid) var(--ease-spring),
    box-shadow   var(--dur-mid) var(--ease-out);
}
.clay-dropzone:hover,
.clay-dropzone:focus-within {
  border-color: var(--clay-primary);
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  box-shadow: 0 0 0 4px rgba(124,58,237,.12);
}
.clay-dropzone.drag-over {
  border-style: solid;
  border-color: var(--clay-primary);
  transform: scale(1.02);
  box-shadow: var(--shadow-clay-md);
  animation: wiggle 400ms var(--ease-out);
}

.dropzone-icon-wrap {
  margin-bottom: var(--sp-4);
}
.dropzone-icon {
  width: 72px; height: 72px;
  margin: 0 auto;
  transition: transform var(--dur-mid) var(--ease-spring);
}
.clay-dropzone:hover .dropzone-icon { animation: uploadIconBounce 700ms var(--ease-spring); }

.dropzone-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--clay-text);
  margin-bottom: var(--sp-2);
}
.dropzone-sublabel {
  font-size: 0.85rem;
  color: var(--clay-subtext);
}

/* File preview */
.preview-wrap { animation: springPop var(--dur-slow) var(--ease-spring) both; }
.preview-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  box-shadow: var(--shadow-clay-sm);
  border-radius: var(--radius-md);
}
.preview-img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--clay-muted);
}
.preview-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.preview-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--clay-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.preview-size { font-size: 0.8rem; color: var(--clay-subtext); }
.preview-remove {
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--clay-error);
  border: 1.5px solid rgba(239,68,68,.3);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease-out);
}
.preview-remove:hover { background: rgba(239,68,68,.08); border-color: var(--clay-error); }

/* Output type pills */
.output-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--clay-text);
  margin-bottom: var(--sp-3);
}
.output-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.output-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: var(--clay-muted);
  border: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--clay-subtext);
  transition: all var(--dur-mid) var(--ease-spring);
  user-select: none;
}
.output-pill input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.output-pill:hover {
  border-color: var(--clay-secondary);
  color: var(--clay-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-clay-sm);
}
.output-pill.active, .output-pill:has(input:checked) {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-color: var(--clay-primary);
  color: var(--clay-primary);
  box-shadow: var(--shadow-clay-sm);
}
.pill-icon { font-size: 1.1rem; }

/* Generate button */
.generate-btn {
  width: 100%;
  justify-content: center;
  font-size: 1.1rem;
  padding: 18px 32px;
  letter-spacing: -0.01em;
}
.btn-icon { transition: transform var(--dur-mid) var(--ease-spring); }
.generate-btn:hover:not(:disabled) .btn-icon { transform: translateX(6px); }

/* ═══════════════════════════════════════════════════════════════════════════
   How It Works
   ═══════════════════════════════════════════════════════════════════════════ */
.how-it-works {
  max-width: 1100px;
  margin: 0 auto var(--sp-8);
  padding: 0 var(--sp-5);
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--clay-text);
  text-align: center;
  margin-bottom: var(--sp-6);
  letter-spacing: -0.03em;
}
.steps-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  overflow-x: auto;
  padding-bottom: var(--sp-3);
}
.step-item {
  flex: 1;
  min-width: 160px;
  text-align: center;
  padding: var(--sp-5) var(--sp-4);
}
.step-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--clay-secondary);
  font-weight: 500;
  margin-bottom: var(--sp-2);
}
.step-icon {
  font-size: 2rem;
  margin-bottom: var(--sp-3);
  display: block;
}
.step-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--clay-text);
  margin-bottom: var(--sp-2);
}
.step-desc { font-size: 0.83rem; color: var(--clay-subtext); }

.step-connector {
  flex-shrink: 0;
  align-self: center;
  font-size: 1.2rem;
  color: var(--clay-secondary);
  opacity: 0.6;
  margin-top: -20px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Processing Page
   ═══════════════════════════════════════════════════════════════════════════ */
.processing-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 140px);
  gap: var(--sp-6);
  padding: var(--sp-7) var(--sp-5) var(--sp-8);
}

/* ── Processing Card ──────────────────────────────────────────────────── */
.processing-card {
  width: min(560px, 100%);
  text-align: center;
}
.processing-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--clay-text);
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-2);
}
.processing-subtitle {
  color: var(--clay-subtext);
  font-size: 1rem;
  margin-bottom: var(--sp-5);
}

/* Progress bar */
.progress-track {
  position: relative;
  height: 10px;
  background: var(--clay-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--sp-3);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--clay-primary), var(--clay-secondary), var(--clay-accent));
  background-size: 200% 100%;
  border-radius: var(--radius-pill);
  transition: width 600ms var(--ease-out);
  animation: progressFill 2s linear infinite;
}
.progress-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.4) 50%, transparent 100%);
  animation: shimmer 1.8s ease-in-out infinite;
}

/* Frame progress (video rendering counter) */
.frame-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--clay-subtext);
  margin-bottom: var(--sp-4);
  padding: 0 var(--sp-2);
}
.frame-progress-pct {
  font-weight: 700;
  color: var(--clay-primary);
  font-size: 0.9rem;
}

/* Step indicators */
.step-indicators {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  text-align: left;
}
.step-indicator {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--clay-muted);
  transition: all var(--dur-mid) var(--ease-out);
  opacity: .45;
}
.step-indicator.active {
  opacity: 1;
  background: linear-gradient(90deg, #ede9fe, #f5f3ff);
  border-left: 4px solid var(--clay-primary);
}
.step-indicator.done {
  opacity: 1;
  background: linear-gradient(90deg, #d1fae5, #ecfdf5);
  border-left: 4px solid var(--clay-success);
}
.step-ind-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--clay-secondary);
  flex-shrink: 0;
  transition: background var(--dur-mid) var(--ease-out);
}
.step-indicator.active .step-ind-dot { background: var(--clay-primary); animation: pulsePlanet 1s ease-in-out infinite; }
.step-indicator.done .step-ind-dot   { background: var(--clay-success); }
.step-ind-label { flex: 1; font-weight: 600; font-size: 0.9rem; }
.step-ind-check { opacity: 0; transition: opacity var(--dur-mid) var(--ease-spring); color: var(--clay-success); font-weight: 700; }
.step-indicator.done .step-ind-check { opacity: 1; }

/* Error state */
.error-state {
  text-align: center;
  padding: var(--sp-6) 0 var(--sp-3);
  animation: springPop var(--dur-slow) var(--ease-spring);
}
.error-icon { font-size: 2.5rem; margin-bottom: var(--sp-3); }
.error-message {
  color: var(--clay-error);
  font-weight: 600;
  margin-bottom: var(--sp-5);
}

/* ── Sketch Preview Card (during processing) ──────────────────────────── */
.sketch-preview-card {
  width: min(560px, 100%);
  animation: springPop var(--dur-slow) var(--ease-spring) both;
}
.sketch-preview-body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--sp-4);
  background: var(--clay-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-clay-sm);
  margin-top: var(--sp-3);
}
.sketch-img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

/* ── Formula Preview Card (during processing) ──────────────────────────── */
.formula-preview-card {
  width: min(560px, 100%);
  animation: springPop var(--dur-slow) var(--ease-spring) both;
}
.formula-ready-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  animation: badgeBounce 700ms var(--ease-spring) both;
}

/* ── Epicycle Loader (Big — below card, with logo) ──────────────────────── */
.epicycle-loader-big {
  position: relative;
  width: 280px;
  height: 280px;
  margin-top: var(--sp-4);
}
.orbit-big {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  border: 2px solid rgba(124,58,237,.15);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.orbit-big-1 { width:  80px; height:  80px; animation: orbit 1.0s linear infinite; }
.orbit-big-2 { width: 120px; height: 120px; animation: orbit 1.6s linear infinite; }
.orbit-big-3 { width: 168px; height: 168px; animation: orbit 2.4s linear infinite; }
.orbit-big-4 { width: 216px; height: 216px; animation: orbit 3.5s linear infinite; }
.orbit-big-5 { width: 270px; height: 270px; animation: orbit 5.0s linear infinite; }

.orbit-big .planet {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-top: -6px;
  animation: pulsePlanet 1.2s ease-in-out infinite;
}
.orbit-big .planet-1 { background: var(--clay-primary);    animation-delay:   0ms; }
.orbit-big .planet-2 { background: var(--clay-accent);     animation-delay: 200ms; }
.orbit-big .planet-3 { background: #ec4899;                animation-delay: 400ms; }
.orbit-big .planet-4 { background: #14b8a6;                animation-delay: 600ms; }
.orbit-big .planet-5 { background: var(--clay-secondary);  animation-delay: 800ms; }

.loader-center-big {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.loader-logo {
  width: 64px;
  height: auto;
  animation: epsilonPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(124,58,237,.35));
}

/* Keep old small loader for compatibility but we won't use it on processing page */
.epicycle-loader {
  position: relative;
  width: 220px;
  height: 220px;
}
.orbit {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  border: 1.5px solid rgba(124,58,237,.18);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.orbit-1 { width:  60px; height:  60px; animation: orbit 1.0s linear infinite; }
.orbit-2 { width:  96px; height:  96px; animation: orbit 1.6s linear infinite; }
.orbit-3 { width: 132px; height: 132px; animation: orbit 2.4s linear infinite; }
.orbit-4 { width: 168px; height: 168px; animation: orbit 3.5s linear infinite; }
.orbit-5 { width: 210px; height: 210px; animation: orbit 5.0s linear infinite; }
.planet {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: -5px;
  animation: pulsePlanet 1.2s ease-in-out infinite;
}
.planet-1 { background: var(--clay-primary);    animation-delay:   0ms; }
.planet-2 { background: var(--clay-accent);     animation-delay: 200ms; }
.planet-3 { background: #ec4899;                animation-delay: 400ms; }
.planet-4 { background: #14b8a6;                animation-delay: 600ms; }
.planet-5 { background: var(--clay-secondary);  animation-delay: 800ms; }
.loader-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.loader-epsilon {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--clay-primary);
  animation: epsilonPulse 2s ease-in-out infinite;
}


/* ═══════════════════════════════════════════════════════════════════════════
   Results Page
   ═══════════════════════════════════════════════════════════════════════════ */
.results-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--sp-7) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.results-header { text-align: center; }
.results-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 18px;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: var(--sp-3);
  animation: badgeBounce 700ms var(--ease-spring) both;
}
.results-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--clay-text);
  letter-spacing: -0.04em;
  margin-bottom: var(--sp-2);
}
.results-subtitle { color: var(--clay-subtext); font-size: 1rem; }

/* Image row */
.results-images-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-5);
}
.result-card { overflow: hidden; }
.result-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1.5px solid var(--clay-muted);
}
.result-card-icon { font-size: 1.3rem; }
.result-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--clay-text);
  flex: 1;
}
.result-card-sub { font-size: 0.78rem; color: var(--clay-subtext); }

.result-img-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--clay-muted);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-img {
  width: 100%;
  object-fit: contain;
  max-height: 340px;
  transition: transform var(--dur-slow) var(--ease-out);
}
.result-img:hover { transform: scale(1.03); }
.img-placeholder { color: var(--clay-subtext); font-size: 0.88rem; }

/* GIF card */
.gif-card { position: relative; }
.gif-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  background: #f8f7ff;
}
.result-gif { width: 100%; display: block; }
.gif-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: var(--sp-3) var(--sp-4);
  background: linear-gradient(to top, rgba(30,27,75,.5), transparent);
  opacity: 0;
  transition: opacity var(--dur-mid) var(--ease-out);
}
.gif-wrap:hover .gif-overlay { opacity: 1; }
.gif-overlay-label {
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Formula card */
.formula-general {
  background: var(--clay-muted);
  border-radius: var(--radius-md);
  padding: var(--sp-5) var(--sp-6);
  text-align: center;
  border: 1.5px solid rgba(167,139,250,.3);
}
.formula-code {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  color: var(--clay-primary);
  font-weight: 500;
}

/* Coefficients table */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
.coefficients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.coefficients-table th {
  background: var(--clay-primary);
  color: #fff;
  padding: 10px 14px;
  text-align: right;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.coefficients-table th:first-child { text-align: left; border-radius: var(--radius-sm) 0 0 0; }
.coefficients-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.coefficients-table td {
  padding: 9px 14px;
  text-align: right;
  border-bottom: 1px solid var(--clay-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--clay-text);
}
.coefficients-table td:first-child { text-align: left; font-weight: 600; color: var(--clay-primary); }
.coeff-row:nth-child(even) td { background: #faf9ff; }
.coeff-row:last-child td { border-bottom: none; }
.coeff-row { transition: background var(--dur-fast) var(--ease-out); }
.coeff-row:hover td { background: var(--clay-muted); }

.coeff-bar-cell { width: 80px; vertical-align: middle; }
.coeff-bar-track {
  height: 6px;
  background: var(--clay-muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.coeff-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--clay-primary), var(--clay-secondary));
  border-radius: var(--radius-pill);
  transition: width 800ms var(--ease-out);
}

/* Download section */
.download-section { text-align: center; }
.download-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--clay-text);
  margin-bottom: var(--sp-5);
  letter-spacing: -0.03em;
}
.download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  justify-content: center;
}
.download-btn { min-width: 180px; justify-content: center; }
.download-btn-icon { font-size: 1.1rem; }

.try-again-wrap { text-align: center; }
.try-again-btn { font-size: 0.95rem; }
.try-arrow { transition: transform var(--dur-mid) var(--ease-spring); }
.try-again-btn:hover .try-arrow { transform: translateX(-6px); }

/* ═══════════════════════════════════════════════════════════════════════════
   Toast Notifications
   ═══════════════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}
.toast {
  background: var(--clay-surface);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-clay-md);
  border: 2px solid rgba(167,139,250,.25);
  font-weight: 600;
  font-size: 0.9rem;
  pointer-events: all;
  animation: toastIn var(--dur-mid) var(--ease-spring) both;
  max-width: 320px;
}
.toast.toast-error  { border-color: rgba(239,68,68,.4); color: var(--clay-error); }
.toast.toast-success{ border-color: rgba(16,185,129,.4); color: var(--clay-success); }
.toast.toast-out    { animation: toastOut var(--dur-mid) var(--ease-in-out) both; }

/* ═══════════════════════════════════════════════════════════════════════════
   Error Page
   ═══════════════════════════════════════════════════════════════════════════ */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 160px);
  padding: var(--sp-6);
}
.error-page-card {
  max-width: 400px;
  text-align: center;
  animation: springPop var(--dur-slow) var(--ease-spring);
}
.error-page-icon { font-size: 3rem; margin-bottom: var(--sp-3); }
.error-page-title {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 800;
  color: var(--clay-primary);
  margin-bottom: var(--sp-2);
}
.error-page-msg { color: var(--clay-subtext); margin-bottom: var(--sp-6); }

/* ═══════════════════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════════════════ */
.site-footer {
  text-align: center;
  padding: var(--sp-6) var(--sp-5);
  color: var(--clay-subtext);
  font-size: 0.83rem;
  border-top: 1.5px solid rgba(167,139,250,.15);
  background: rgba(255,255,255,.4);
  backdrop-filter: blur(8px);
}
.site-footer p { margin-bottom: var(--sp-2); }
.footer-heart { color: #ef4444; }
.footer-formula {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--clay-primary);
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Confetti (JS-spawned)
   ═══════════════════════════════════════════════════════════════════════════ */
.confetti-piece {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
  animation: confettiDrop linear forwards;
  z-index: 10000;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Claymorphic Image Editor Modal
   ═══════════════════════════════════════════════════════════════════════════ */
.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-4);
  transition: opacity var(--dur-mid) var(--ease-out);
  overflow-y: auto;
}
.editor-modal[hidden] {
  display: none !important;
}
.editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 75, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.editor-card {
  position: relative;
  width: min(720px, 100%);
  margin: var(--sp-4) auto;
  display: flex;
  flex-direction: column;
  background: var(--clay-surface);
  z-index: 10001;
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  animation: springPop var(--dur-slow) var(--ease-spring) both;
}
.editor-header {
  margin-bottom: var(--sp-4);
  text-align: center;
}
.editor-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--clay-text);
  margin-bottom: var(--sp-1);
}
.editor-subtitle {
  font-size: 0.88rem;
  color: var(--clay-subtext);
}
.editor-workspace {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clay-muted);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  overflow: hidden;
  box-shadow: inset 2px 2px 6px rgba(0,0,0,0.06), inset -2px -2px 6px rgba(255,255,255,0.7);
  margin-bottom: var(--sp-4);
  min-height: 320px;
}
.canvas-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}
.canvas-container canvas {
  max-width: 100%;
  max-height: 360px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-clay-sm);
  cursor: crosshair;
  display: block;
}
.editor-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}
.tool-group {
  display: flex;
  gap: var(--sp-2);
}
.tool-btn {
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-pill);
  transition: all var(--dur-fast) var(--ease-out);
}
.tool-btn.active {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  color: var(--clay-primary);
  border: 2px solid var(--clay-primary);
  box-shadow: var(--shadow-clay-sm);
}
.settings-group {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.control-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--clay-subtext);
}
.clay-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--clay-muted);
  outline: none;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.1);
}
.clay-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--clay-primary);
  cursor: pointer;
  box-shadow: var(--shadow-clay-sm);
  border: 2px solid #ffffff;
  transition: transform var(--dur-fast);
}
.clay-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.utility-group {
  display: flex;
  gap: var(--sp-2);
}
.editor-footer {
  display: flex;
  justify-content: center;
}
.editor-footer .generate-btn {
  max-width: 320px;
}

/* ── Not Satisfied Section (inside editor modal) ──────────────────────── */
.not-satisfied-section {
  margin-top: var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--clay-muted);
  padding: 0;
  overflow: hidden;
  transition: box-shadow var(--dur-mid) var(--ease-out);
}
.not-satisfied-section[open] {
  box-shadow: var(--shadow-clay-sm);
}
.not-satisfied-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--clay-primary);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background var(--dur-fast);
}
.not-satisfied-toggle::-webkit-details-marker { display: none; }
.not-satisfied-toggle::after {
  content: '▸';
  margin-left: auto;
  font-size: 1.1rem;
  transition: transform var(--dur-mid) var(--ease-spring);
}
.not-satisfied-section[open] .not-satisfied-toggle::after {
  transform: rotate(90deg);
}
.not-satisfied-toggle:hover {
  background: rgba(124, 58, 237, 0.06);
}
.not-satisfied-icon {
  font-size: 1.2rem;
}

.not-satisfied-body {
  padding: 0 var(--sp-5) var(--sp-5);
  animation: fadeSlideUp var(--dur-mid) var(--ease-out) both;
}
.not-satisfied-intro {
  font-size: 0.88rem;
  color: var(--clay-subtext);
  line-height: 1.65;
  margin-bottom: var(--sp-4);
}

/* Steps */
.not-satisfied-steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.ns-step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.ns-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clay-primary), var(--clay-secondary));
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.ns-step-text {
  font-size: 0.85rem;
  color: var(--clay-text);
}

/* Prompt box */
.ns-prompt-box {
  background: var(--clay-surface);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.05), inset -2px -2px 5px rgba(255,255,255,0.6);
  margin-bottom: var(--sp-4);
  max-height: 200px;
  overflow-y: auto;
}
.ns-prompt-text {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--clay-text);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* Action buttons */
.ns-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.ns-copy-btn {
  font-size: 0.9rem;
  padding: 10px 20px;
}
.ns-link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--clay-surface);
  border: 2px solid var(--clay-muted);
  color: var(--clay-text);
  text-decoration: none;
  transition: all var(--dur-fast) var(--ease-out);
}
.ns-link-btn:hover {
  border-color: var(--clay-primary);
  color: var(--clay-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-clay-sm);
}

.ns-hint {
  font-size: 0.82rem;
  color: var(--clay-subtext);
  line-height: 1.6;
  padding: var(--sp-3) var(--sp-4);
  background: rgba(124, 58, 237, 0.06);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--clay-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .steps-row { flex-direction: column; }
  .step-connector { display: none; }
  .clay-card { padding: var(--sp-5); }
  .output-pills { flex-direction: column; }
  .download-buttons { flex-direction: column; align-items: center; }
  .epicycle-loader { width: 160px; height: 160px; }
  .orbit-5 { width: 155px; height: 155px; }
  .orbit-4 { width: 120px; height: 120px; }
  .orbit-3 { width: 88px; height: 88px; }
  .orbit-2 { width: 58px; height: 58px; }
  .orbit-1 { width: 32px; height: 32px; }
  .ns-actions { flex-direction: column; }
  .ns-link-btn { text-align: center; justify-content: center; }
}
