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

:root {
  --indigo: #6366f1;
  --violet: #8b5cf6;
  --indigo-light: #eef2ff;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 8px 40px rgba(99,102,241,.10), 0 2px 8px rgba(0,0,0,.06);
  --transition: .22s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #fafafa;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* ── Background blobs ── */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .35;
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #6366f1 0%, #8b5cf6 100%);
  top: -180px; left: -160px;
}
.blob-2 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #a78bfa 0%, #38bdf8 100%);
  bottom: -140px; right: -140px;
}

/* ── Header ── */
header {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

.badge-free {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--indigo);
  background: var(--indigo-light);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(99,102,241,.2);
}

/* ── Hero ── */
.hero {
  max-width: 700px;
  text-align: center;
  padding: 32px 24px 8px;
  position: relative;
  z-index: 10;
}

.hero-tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  color: var(--text);
  margin-bottom: 18px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Main / Card ── */
main {
  width: 100%;
  max-width: 900px;
  padding: 32px 24px 24px;
  position: relative;
  z-index: 10;
  flex: 1;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* ── Drop zone ── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 32px;
  cursor: pointer;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin: 4px;
  transition: background var(--transition), border-color var(--transition);
  outline: none;
}

.dropzone:hover,
.dropzone:focus,
.dropzone.drag-over {
  background: var(--indigo-light);
  border-color: var(--indigo);
}

.drop-icon { margin-bottom: 4px; }

.drop-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.drop-sub {
  font-size: .85rem;
  color: var(--text-muted);
}

.btn-upload {
  margin-top: 10px;
  padding: 10px 26px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-upload:hover { opacity: .88; transform: translateY(-1px); }
.btn-upload:active { transform: translateY(0); }

/* ── Preview area ── */
.preview-area { padding: 28px 28px 0; }

.preview-panels {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0;
  align-items: start;
}

.divider-v {
  background: var(--border);
  height: 100%;
  min-height: 260px;
  align-self: stretch;
  margin: 0 20px;
}

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

.panel-label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.img-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  max-height: 380px;
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* Checkerboard for transparent images */
.checker {
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #f3f4f6;
}

.img-wrap img {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

/* ── Processing overlay ── */
.processing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(249,250,251,.92);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: var(--radius-sm);
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--indigo-light);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#processingText {
  font-size: .9rem;
  font-weight: 500;
  color: var(--indigo);
}

.error-msg {
  font-size: .9rem;
  color: #dc2626;
  text-align: center;
  padding: 16px;
}

/* ── Actions ── */
.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px 0 24px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff;
}
.btn-primary:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--indigo-light); color: var(--indigo); border-color: var(--indigo); }

/* ── Features strip ── */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

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

.feature div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feature strong {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}

.feature span {
  font-size: .75rem;
  color: var(--text-muted);
}

/* ── Footer ── */
footer {
  padding: 24px;
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
  position: relative;
  z-index: 10;
}

/* ── Toast notifications ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1f2937;
  color: #f9fafb;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 999;
  transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .35s;
  opacity: 0;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.error { background: #dc2626; }

/* ── Responsive ── */
@media (max-width: 680px) {
  .preview-panels {
    grid-template-columns: 1fr;
  }
  .divider-v {
    display: none;
  }
  .features {
    grid-template-columns: 1fr 1fr;
  }
  .hero h1 { font-size: 2rem; }
}

@media (max-width: 420px) {
  .features { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .btn-primary, .btn-secondary { justify-content: center; }
}
