/* ================================================================
   BGRemover — Retro Claymorphism Design System
   ================================================================
   A warm, tactile design inspired by clay/plasticine aesthetics
   combined with retro color palettes and modern web techniques.
   ================================================================ */

/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
  /* Color Palette — Warm Retro */
  --bg-primary: #F5EDE3;
  --bg-secondary: #FFFAF5;
  --clay-surface: #FFF0E5;
  --clay-surface-alt: #F0E6D8;

  --accent-coral: #E07A5F;
  --accent-coral-deep: #C45A3F;
  --accent-sage: #81B29A;
  --accent-sage-deep: #5D9A7D;
  --accent-navy: #3D405B;
  --accent-gold: #F2CC8F;
  --accent-lavender: #9B8EC2;
  --accent-pink: #E8A0BF;

  --text-primary: #2D2A32;
  --text-secondary: #6B6577;
  --text-muted: #9B94A7;

  /* Claymorphism Shadows */
  --clay-shadow:
    8px 8px 20px rgba(166, 146, 125, 0.25),
    -6px -6px 16px rgba(255, 255, 255, 0.7);
  --clay-shadow-inset:
    inset 2px 2px 5px rgba(255, 255, 255, 0.6),
    inset -1px -1px 3px rgba(166, 146, 125, 0.12);
  --clay-shadow-full:
    8px 8px 20px rgba(166, 146, 125, 0.25),
    -6px -6px 16px rgba(255, 255, 255, 0.7),
    inset 2px 2px 5px rgba(255, 255, 255, 0.6),
    inset -1px -1px 3px rgba(166, 146, 125, 0.12);
  --clay-shadow-hover:
    10px 10px 28px rgba(166, 146, 125, 0.30),
    -8px -8px 20px rgba(255, 255, 255, 0.8),
    inset 2px 2px 5px rgba(255, 255, 255, 0.6),
    inset -1px -1px 3px rgba(166, 146, 125, 0.12);
  --clay-shadow-pressed:
    4px 4px 10px rgba(166, 146, 125, 0.18),
    -3px -3px 8px rgba(255, 255, 255, 0.5),
    inset 3px 3px 8px rgba(166, 146, 125, 0.18),
    inset -2px -2px 5px rgba(255, 255, 255, 0.6);

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  /* Radii */
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;
  --r-full: 999px;

  /* Transitions */
  --ease-clay: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.22, 0.61, 0.36, 1);
}


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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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


/* ── Three.js Background Canvas ────────────────────────────────── */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}


/* ── Retro Grain Overlay ───────────────────────────────────────── */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}


/* ── Layout Containers ─────────────────────────────────────────── */
.section-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}


/* ── Claymorphism Components ───────────────────────────────────── */
.clay-card {
  background: var(--clay-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--clay-shadow-full);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: box-shadow 0.4s var(--ease-smooth), transform 0.4s var(--ease-clay);
}

.clay-card:hover {
  box-shadow: var(--clay-shadow-hover);
}

.clay-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--r-full);
  background: var(--clay-surface);
  box-shadow: var(--clay-shadow-full);
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
}

.clay-pill-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border-radius: var(--r-full);
  background: var(--clay-surface-alt);
  box-shadow:
    3px 3px 8px rgba(166, 146, 125, 0.2),
    -2px -2px 6px rgba(255, 255, 255, 0.6),
    inset 1px 1px 2px rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.clay-pill-sm.accent {
  background: var(--accent-coral);
  color: #fff;
}

.clay-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: var(--r-lg);
  background: var(--clay-surface);
  box-shadow: var(--clay-shadow-full);
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  transition: all 0.3s var(--ease-clay);
  position: relative;
  overflow: hidden;
}

.clay-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.clay-btn:hover {
  box-shadow: var(--clay-shadow-hover);
  transform: translateY(-2px);
}

.clay-btn:hover::before {
  opacity: 1;
}

.clay-btn:active {
  box-shadow: var(--clay-shadow-pressed);
  transform: translateY(1px) scale(0.98);
}

.clay-btn.primary {
  background: var(--accent-coral);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.clay-btn.primary:hover {
  background: var(--accent-coral-deep);
}

.clay-btn.secondary {
  background: var(--clay-surface-alt);
}

.clay-btn-sm {
  padding: 8px 20px;
  border-radius: var(--r-full);
  background: var(--accent-coral);
  color: #fff;
  box-shadow:
    4px 4px 10px rgba(166, 146, 125, 0.2),
    -2px -2px 6px rgba(255, 255, 255, 0.5),
    inset 1px 1px 2px rgba(255, 255, 255, 0.3);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.3s var(--ease-clay);
  border: none;
}

.clay-btn-sm:hover {
  background: var(--accent-coral-deep);
  transform: translateY(-1px);
}


/* ── Navigation ────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 24px;
  transition: background 0.4s, backdrop-filter 0.4s;
}

.navbar.scrolled {
  background: rgba(245, 237, 227, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-size: 1rem;
  padding: 10px 22px;
  cursor: pointer;
}

.brand-icon {
  color: var(--accent-coral);
  font-size: 1.2em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color 0.3s;
  position: relative;
}

.nav-links a:not(.clay-btn-sm):hover {
  color: var(--accent-coral);
}

.nav-links a:not(.clay-btn-sm)::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-coral);
  border-radius: 2px;
  transition: width 0.3s var(--ease-clay);
}

.nav-links a:not(.clay-btn-sm):hover::after {
  width: 100%;
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  cursor: pointer;
}

.mobile-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s;
}


/* ── Hero Section ──────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 80px;
  position: relative;
  z-index: 1;
}

.hero-content {
  text-align: center;
  max-width: 800px;
}

.hero-badge {
  margin-bottom: 32px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.badge-sparkle {
  font-size: 1.1em;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--accent-navy);
  margin-bottom: 28px;
  perspective: 800px;
}

.title-line {
  display: block;
  overflow: hidden;
}

.title-line .char {
  display: inline-block;
  transform-origin: center bottom;
}

.title-accent {
  color: var(--accent-coral);
  position: relative;
}

.title-accent::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: -4px;
  right: -4px;
  height: 14px;
  background: var(--accent-gold);
  opacity: 0.35;
  border-radius: var(--r-full);
  z-index: -1;
  transform: skewX(-3deg);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-cta {
  font-size: 1.1rem;
  padding: 18px 40px;
  margin-bottom: 48px;
  display: inline-flex;
}

.btn-arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease-clay);
}

.hero-cta:hover .btn-arrow {
  transform: translateX(4px);
}

.hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  border-radius: var(--r-xl);
  background: rgba(255, 240, 229, 0.6);
  box-shadow:
    4px 4px 12px rgba(166, 146, 125, 0.15),
    -3px -3px 8px rgba(255, 255, 255, 0.5),
    inset 1px 1px 3px rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent-coral);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(166, 146, 125, 0.2);
}


/* ── Upload Section ────────────────────────────────────────────── */
.upload-section {
  position: relative;
  z-index: 1;
  padding: 40px 0 80px;
}

.upload-card,
.processing-card,
.result-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px;
}

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  border: 3px dashed rgba(166, 146, 125, 0.3);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.4s var(--ease-clay);
  position: relative;
  background: rgba(255, 255, 255, 0.3);
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent-coral);
  background: rgba(224, 122, 95, 0.06);
  transform: scale(1.01);
}

.dropzone.drag-over {
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(224, 122, 95, 0.15);
}

.dropzone-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  color: var(--accent-coral);
  animation: float-icon 3s ease-in-out infinite;
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.dropzone-icon svg {
  width: 100%;
  height: 100%;
}

.dropzone-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--accent-navy);
  margin-bottom: 6px;
}

.dropzone-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 18px;
}

.dropzone-formats {
  display: flex;
  gap: 8px;
}

.format-badge {
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--clay-surface-alt);
  box-shadow:
    2px 2px 5px rgba(166, 146, 125, 0.12),
    -1px -1px 3px rgba(255, 255, 255, 0.5);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}


/* Processing State */
.processing-card {
  text-align: center;
}

.processing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.progress-ring-container {
  position: relative;
  width: 120px;
  height: 120px;
}

.progress-ring {
  width: 100%;
  height: 100%;
}

.progress-ring-bg {
  stroke: rgba(166, 146, 125, 0.12);
}

.progress-ring-fill {
  stroke: var(--accent-coral);
  transition: stroke-dashoffset 0.4s var(--ease-smooth);
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--accent-coral);
}

.processing-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--accent-navy);
}

.processing-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.processing-dots {
  display: flex;
  gap: 6px;
}

.processing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-coral);
  animation: dot-bounce 1.4s ease-in-out infinite;
}

.processing-dots span:nth-child(2) { animation-delay: 0.2s; }
.processing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}


/* Result State */
.result-card {
  padding: 36px;
}

.comparison-view {
  display: flex;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 28px;
}

.comparison-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-label {
  align-self: flex-start;
}

.panel-image-wrap {
  flex: 1;
  min-width: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clay-surface-alt);
  box-shadow:
    inset 3px 3px 8px rgba(166, 146, 125, 0.15),
    inset -2px -2px 5px rgba(255, 255, 255, 0.5);
  min-height: 220px;
  position: relative;
  padding: 16px;
  box-sizing: border-box;
}

.panel-image-wrap img,
.panel-image-wrap canvas {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}

.panel-image-wrap.checkerboard {
  background-image:
    linear-gradient(45deg, #e8e3dc 25%, transparent 25%),
    linear-gradient(-45deg, #e8e3dc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8e3dc 75%),
    linear-gradient(-45deg, transparent 75%, #e8e3dc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: #f5f0ea;
  transition: background-color 0.4s var(--ease-smooth);
}

.panel-image-wrap.solid-bg {
  background-image: none !important;
  transition: background-color 0.4s var(--ease-smooth);
}

.comparison-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.divider-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow:
    3px 3px 8px rgba(166, 146, 125, 0.2),
    -2px -2px 5px rgba(255, 255, 255, 0.6),
    inset 1px 1px 2px rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--accent-navy);
}

/* Crop & Transform Toolbar */
.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-bottom: 2px;
}

.crop-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.clay-btn-xs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--clay-surface-alt);
  color: var(--text-primary);
  box-shadow:
    2px 2px 6px rgba(166, 146, 125, 0.2),
    -2px -2px 5px rgba(255, 255, 255, 0.8),
    inset 1px 1px 2px rgba(255, 255, 255, 0.5);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  border: none;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s var(--ease-clay);
  white-space: nowrap;
}

.clay-btn-xs * {
  pointer-events: none;
}

.clay-btn-xs:hover {
  transform: translateY(-1px);
  color: var(--accent-coral);
  box-shadow:
    3px 3px 8px rgba(166, 146, 125, 0.28),
    -2px -2px 6px rgba(255, 255, 255, 0.9);
}

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

.clay-btn-xs.active {
  background: var(--accent-coral);
  color: #fff;
  box-shadow:
    inset 2px 2px 5px rgba(0, 0, 0, 0.2),
    inset -1px -1px 3px rgba(255, 255, 255, 0.3);
}

.clay-btn-xs.primary {
  background: var(--accent-coral);
  color: #fff;
}

.clay-btn-xs.primary:hover {
  background: var(--accent-coral-deep);
  color: #fff;
}

.clay-btn-xs.secondary {
  background: var(--clay-surface);
  color: var(--text-secondary);
}

.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  z-index: 25;
  touch-action: none;
}

.crop-box {
  position: absolute;
  box-shadow: 0 0 0 9999px rgba(18, 22, 33, 0.65);
  border: 2px solid #ffffff;
  cursor: move;
  box-sizing: border-box;
}

.crop-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, transparent 33.33%, rgba(255, 255, 255, 0.35) 33.33%, rgba(255, 255, 255, 0.35) calc(33.33% + 1px), transparent calc(33.33% + 1px), transparent 66.66%, rgba(255, 255, 255, 0.35) 66.66%, rgba(255, 255, 255, 0.35) calc(66.66% + 1px), transparent calc(66.66% + 1px)),
    linear-gradient(to bottom, transparent 33.33%, rgba(255, 255, 255, 0.35) 33.33%, rgba(255, 255, 255, 0.35) calc(33.33% + 1px), transparent calc(33.33% + 1px), transparent 66.66%, rgba(255, 255, 255, 0.35) 66.66%, rgba(255, 255, 255, 0.35) calc(66.66% + 1px), transparent calc(66.66% + 1px));
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid var(--accent-coral);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
  z-index: 22;
}

.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle-n { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.handle-s { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.handle-w { top: calc(50% - 6px); left: -6px; cursor: ew-resize; }
.handle-e { top: calc(50% - 6px); right: -6px; cursor: ew-resize; }

.crop-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--clay-surface-alt);
  box-shadow:
    inset 2px 2px 5px rgba(166, 146, 125, 0.12),
    inset -1px -1px 3px rgba(255, 255, 255, 0.6);
  margin-top: 10px;
}

.crop-aspect-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crop-hint {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

.aspect-btn {
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid rgba(166, 146, 125, 0.25);
  background: var(--clay-surface);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.aspect-btn.active, .aspect-btn:hover {
  background: var(--accent-coral);
  color: #fff;
  border-color: var(--accent-coral);
}

.crop-confirm-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ================================================================
   Subject Transform (Move & Diagonal Stretch)
   ================================================================ */
.transform-overlay {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  -webkit-user-select: none;
  z-index: 25;
  touch-action: none;
  pointer-events: auto;
}

.transform-box {
  position: absolute;
  border: 2px dashed var(--accent-coral);
  box-shadow: 0 0 0 1px #ffffff, 0 0 14px rgba(224, 122, 95, 0.45);
  cursor: move;
  box-sizing: border-box;
  pointer-events: auto;
  transition: background-color 0.2s;
}

.transform-box:hover,
.transform-box.dragging {
  border-color: var(--accent-coral-deep);
  background: rgba(224, 122, 95, 0.08);
}

.transform-move-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: rgba(30, 36, 48, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  opacity: 0.92;
  transition: opacity 0.2s;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.transform-box.dragging .transform-move-indicator {
  opacity: 0.2;
}

.transform-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border: 3px solid var(--accent-coral);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  z-index: 30;
  pointer-events: auto;
  transition: transform 0.15s var(--ease-smooth), background-color 0.15s;
  box-sizing: border-box;
  touch-action: none;
}

.transform-handle::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
}

.transform-handle:hover,
.transform-handle:active {
  transform: scale(1.35);
  background: var(--accent-coral);
  border-color: #ffffff;
}

/* 4 Corner Diagonal Handles */
.transform-handle.handle-nw { top: -8px; left: -8px; cursor: nwse-resize; }
.transform-handle.handle-ne { top: -8px; right: -8px; cursor: nesw-resize; }
.transform-handle.handle-se { bottom: -8px; right: -8px; cursor: nwse-resize; }
.transform-handle.handle-sw { bottom: -8px; left: -8px; cursor: nesw-resize; }

/* 4 Edge Handles */
.transform-handle.handle-n { top: -8px; left: calc(50% - 8px); cursor: ns-resize; }
.transform-handle.handle-s { bottom: -8px; left: calc(50% - 8px); cursor: ns-resize; }
.transform-handle.handle-w { top: calc(50% - 8px); left: -8px; cursor: ew-resize; }
.transform-handle.handle-e { top: calc(50% - 8px); right: -8px; cursor: ew-resize; }

/* Transform Actions Bar */
.transform-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--clay-surface-alt);
  box-shadow:
    inset 2px 2px 5px rgba(166, 146, 125, 0.12),
    inset -1px -1px 3px rgba(255, 255, 255, 0.6);
  margin-top: 10px;
}

.transform-controls-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.transform-hint {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

.transform-confirm-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* Color Picker */
.color-options {
  margin-bottom: 24px;
}

.color-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-navy);
  margin-bottom: 14px;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s var(--ease-clay);
  position: relative;
  background: var(--clay-surface);
  box-shadow:
    3px 3px 8px rgba(166, 146, 125, 0.2),
    -2px -2px 5px rgba(255, 255, 255, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.5);
  padding: 3px;
  overflow: hidden;
}

.swatch span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.swatch svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.swatch.original-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clay-surface-alt);
}

.swatch.original-swatch svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent-navy);
}

.swatch:hover {
  transform: scale(1.15);
  box-shadow:
    4px 4px 12px rgba(166, 146, 125, 0.25),
    -3px -3px 8px rgba(255, 255, 255, 0.7);
}

.swatch.active {
  border-color: var(--accent-coral);
  box-shadow:
    0 0 0 3px rgba(224, 122, 95, 0.3),
    3px 3px 8px rgba(166, 146, 125, 0.2),
    -2px -2px 5px rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
}

.swatch-custom {
  position: relative;
  width: 38px;
  height: 38px;
}

.custom-color-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  background: var(--clay-surface);
  box-shadow:
    3px 3px 8px rgba(166, 146, 125, 0.2),
    -2px -2px 5px rgba(255, 255, 255, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: var(--text-muted);
  transition: all 0.3s var(--ease-clay);
}

.custom-color-label svg {
  width: 18px;
  height: 18px;
}

.custom-color-label:hover {
  transform: scale(1.15);
  color: var(--accent-coral);
}

#custom-color {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}


/* Download Actions */
.download-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.download-actions .clay-btn {
  flex: 1;
  min-width: 160px;
  justify-content: center;
  padding: 14px 24px;
  font-size: 0.95rem;
}

.download-actions .clay-btn svg {
  flex-shrink: 0;
}


/* ── Features Section ──────────────────────────────────────────── */
.features-section {
  position: relative;
  z-index: 1;
  padding: 100px 0;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  text-align: center;
  color: var(--accent-navy);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 56px;
  font-size: 1.05rem;
  line-height: 1.6;
}

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

.feature-card {
  padding: 36px 28px;
  text-align: center;
  transition: transform 0.4s var(--ease-clay), box-shadow 0.4s;
}

.feature-card:hover {
  transform: translateY(-6px);
}

.feature-icon {
  font-size: 2.8rem;
  margin-bottom: 18px;
  display: inline-block;
  animation: icon-wobble 4s ease-in-out infinite;
}

@keyframes icon-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

.feature-card:nth-child(2) .feature-icon { animation-delay: -1s; }
.feature-card:nth-child(3) .feature-icon { animation-delay: -2s; }
.feature-card:nth-child(4) .feature-icon { animation-delay: -3s; }

.feature-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--accent-navy);
  margin-bottom: 10px;
}

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


/* ── How It Works Section ──────────────────────────────────────── */
.howto-section {
  position: relative;
  z-index: 1;
  padding: 80px 0 100px;
}

.steps-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.step-card {
  padding: 36px 28px;
  text-align: center;
  flex: 0 1 240px;
  min-width: 200px;
}

.step-number {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  font-size: 0.85rem;
  background: var(--accent-coral);
  color: #fff;
}

.step-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent-navy);
  margin-bottom: 8px;
}

.step-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
}

.step-arrow {
  font-size: 1.8rem;
  color: var(--accent-gold);
  font-weight: 700;
  flex-shrink: 0;
}


/* ── FAQ Section ───────────────────────────────────────────────── */
.faq-section {
  position: relative;
  z-index: 1;
  padding: 80px 0 120px;
}

.faq-list {
  max-width: 720px;
  margin: 40px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.faq-item {
  padding: 0;
  overflow: hidden;
}

.faq-item summary {
  padding: 22px 28px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent-navy);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color 0.3s;
  user-select: none;
}

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

.faq-item summary::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--accent-coral);
  font-weight: 700;
  transition: transform 0.3s var(--ease-clay);
  flex-shrink: 0;
  margin-left: 16px;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item[open] summary {
  color: var(--accent-coral);
}

.faq-item p {
  padding: 0 28px 22px;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.7;
}

.faq-item a {
  color: var(--accent-coral);
  font-weight: 500;
  border-bottom: 1px solid currentColor;
}

.faq-item code {
  background: var(--clay-surface-alt);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85em;
  font-family: 'SF Mono', 'Fira Code', monospace;
}


/* ── Footer ────────────────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  padding: 48px 24px;
  text-align: center;
  border-top: 1px solid rgba(166, 146, 125, 0.15);
}

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

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-navy);
  margin-bottom: 12px;
}

.footer-brand .brand-icon {
  color: var(--accent-coral);
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
}

.footer-links a {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--accent-coral);
}

.footer-copy {
  color: var(--text-muted);
  font-size: 0.78rem;
}


/* ── Animations ────────────────────────────────────────────────── */
.hero-badge,
.hero-title .title-line,
.hero-subtitle,
.hero-cta,
.hero-stats {
  opacity: 0;
  transform: translateY(30px);
}

[data-anim="feature"],
[data-anim="step"] {
  opacity: 0;
  transform: translateY(40px);
}


/* ── Error Toast ───────────────────────────────────────────────── */
.error-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #C45A3F;
  color: #fff;
  padding: 14px 28px;
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 30px rgba(196, 90, 63, 0.4);
  z-index: 10000;
  transition: transform 0.5s var(--ease-clay);
  pointer-events: none;
}

.error-toast.show {
  transform: translateX(-50%) translateY(0);
}


/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .comparison-view {
    flex-direction: column;
    gap: 20px;
  }

  .comparison-divider {
    transform: rotate(90deg);
    padding: 4px 0;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .hero-title {
    font-size: clamp(2.2rem, 8vw, 3.5rem);
  }

  .hero-stats {
    flex-direction: column;
    gap: 12px;
    padding: 20px 28px;
  }

  .stat-divider {
    width: 40px;
    height: 1px;
  }

  .upload-card,
  .processing-card,
  .result-card {
    padding: 24px 16px;
  }

  .dropzone {
    padding: 40px 20px;
  }

  .download-actions {
    flex-direction: column;
  }

  .download-actions .clay-btn {
    width: 100%;
  }

  .steps-grid {
    flex-direction: column;
    gap: 20px;
  }

  .step-arrow {
    transform: rotate(90deg);
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .crop-toolbar {
    gap: 6px;
    flex-wrap: wrap;
  }

  .clay-btn-xs {
    padding: 6px 12px;
    font-size: 0.75rem;
    min-height: 32px;
  }
}

@media (max-width: 640px) {
  .panel-header-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .crop-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .transform-actions-bar,
  .crop-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }

  .transform-controls-group,
  .crop-aspect-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }

  .transform-confirm-btns,
  .crop-confirm-btns {
    display: flex;
    justify-content: stretch;
    gap: 8px;
    width: 100%;
  }

  .transform-confirm-btns .clay-btn-xs,
  .crop-confirm-btns .clay-btn-xs {
    flex: 1;
    justify-content: center;
    padding: 8px 14px;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 100px 16px 60px;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .hero-cta {
    padding: 16px 28px;
    font-size: 1rem;
  }

  .panel-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .crop-toolbar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .crop-toolbar .clay-btn-xs {
    flex: 1 1 auto;
    min-width: 110px;
    justify-content: center;
  }

  .color-swatches {
    gap: 8px;
  }

  .swatch {
    width: 32px;
    height: 32px;
  }

  .swatch-custom {
    width: 32px;
    height: 32px;
  }

  .custom-color-label {
    width: 32px;
    height: 32px;
  }

  .aspect-btn {
    padding: 4px 10px;
    font-size: 0.72rem;
    min-height: 28px;
  }
}
