/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
  --bg-deep: #050510;
  --bg-primary: #0a0a1a;
  --bg-card: rgba(255, 255, 255, 0.025);
  --bg-card-hover: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(255, 255, 255, 0.04);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(139, 92, 246, 0.3);

  --text-primary: #f0f0f8;
  --text-secondary: #94949e;
  --text-muted: #5a5a6e;

  --accent-violet: #8b5cf6;
  --accent-cyan: #22d3ee;
  --accent-emerald: #34d399;
  --accent-rose: #fb7185;
  --accent-amber: #fbbf24;

  --gradient-main: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 50%, #22d3ee 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(6, 182, 212, 0.08) 100%);
  --gradient-glow: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(139, 92, 246, 0.06), transparent 40%);

  --shadow-glow: 0 0 60px rgba(139, 92, 246, 0.08);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);

  --radius: 12px;
  --radius-lg: 20px;
  --radius-pill: 100px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); font-size: 0.82em; }
code { font-family: var(--mono); font-size: 0.85em; background: rgba(139,92,246,0.12); padding: 2px 6px; border-radius: 4px; color: var(--accent-violet); }

/* ============================================
   Background Effects
   ============================================ */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.bg-blobs {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}

.blob {
  position: absolute; border-radius: 50%;
  filter: blur(140px); opacity: 0.35;
  animation: drift 25s ease-in-out infinite;
}
.blob-1 { width: 500px; height: 500px; background: rgba(139, 92, 246, 0.25); top: -15%; left: -10%; }
.blob-2 { width: 400px; height: 400px; background: rgba(6, 182, 212, 0.2); top: 50%; right: -15%; animation-delay: -8s; }
.blob-3 { width: 300px; height: 300px; background: rgba(236, 72, 153, 0.15); bottom: -10%; left: 40%; animation-delay: -16s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.05); }
  66% { transform: translate(-30px, 40px) scale(0.95); }
}

.bg-noise {
  position: fixed; inset: 0; z-index: 0;
  opacity: 0.03; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================
   Header
   ============================================ */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(5, 5, 16, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-primary);
}

.logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--gradient-main);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}
.logo-icon-sm { width: 24px; height: 24px; border-radius: 6px; }

.logo-text {
  font-size: 1rem; font-weight: 700; letter-spacing: -0.02em;
}

.logo-version {
  font-size: 0.6rem; font-weight: 600;
  padding: 2px 6px; border-radius: var(--radius-pill);
  background: rgba(139, 92, 246, 0.15); color: var(--accent-violet);
}

.header-nav { display: flex; gap: 8px; }

.nav-link {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: var(--bg-glass); border: 1px solid var(--border);
  transition: all 0.25s var(--ease);
  text-decoration: none;
}
.nav-link:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* ============================================
   Main
   ============================================ */
.main { position: relative; z-index: 1; padding-bottom: 80px; }

/* ============================================
   Hero
   ============================================ */
.hero {
  text-align: center; padding: 72px 0 48px;
  position: relative;
}

.hero-glow {
  position: absolute; top: 20%; left: 50%; transform: translateX(-50%);
  width: 600px; height: 300px;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.12), transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: var(--radius-pill);
  background: var(--gradient-subtle);
  border: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 600; color: var(--accent-cyan);
  margin-bottom: 28px;
  animation: fadeUp 0.6s var(--ease) both;
}

.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900; line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  animation: fadeUp 0.6s var(--ease) 0.1s both;
}

.gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1rem; color: var(--text-secondary);
  max-width: 480px; margin: 0 auto 32px;
  line-height: 1.7;
  animation: fadeUp 0.6s var(--ease) 0.2s both;
}

.hero-stats {
  display: inline-flex; align-items: center; gap: 24px;
  padding: 14px 28px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  animation: fadeUp 0.6s var(--ease) 0.3s both;
}

.hero-stat { text-align: center; }
.hero-stat-value {
  display: block; font-family: var(--mono);
  font-size: 0.95rem; font-weight: 700;
  color: var(--accent-violet);
}
.hero-stat-label {
  font-size: 0.68rem; font-weight: 500;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hero-stat-divider {
  width: 1px; height: 28px;
  background: var(--border);
}

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

/* ============================================
   Upload Zone
   ============================================ */
.upload-section {
  margin-bottom: 40px;
  animation: fadeUp 0.6s var(--ease) 0.4s both;
}

.upload-zone {
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 56px 32px;
  text-align: center; cursor: pointer;
  transition: all 0.3s var(--ease);
  background: var(--bg-card);
  position: relative;
}

.upload-zone::before {
  content: ''; position: absolute; inset: 0;
  border-radius: var(--radius-lg);
  background: var(--gradient-subtle);
  opacity: 0; transition: opacity 0.3s var(--ease);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent-violet);
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.1);
}
.upload-zone:hover::before, .upload-zone.dragover::before { opacity: 1; }
.upload-zone > * { position: relative; z-index: 1; }

.upload-ring {
  width: 80px; height: 80px; margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--bg-glass); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  animation: float 3s ease-in-out infinite;
}

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

.upload-text {
  font-size: 1.05rem; font-weight: 600; margin-bottom: 4px;
}
.upload-subtext {
  font-size: 0.82rem; color: var(--text-muted); margin-bottom: 16px;
}

.upload-badges {
  display: flex; gap: 8px; justify-content: center;
}
.upload-badge {
  font-size: 0.68rem; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.15);
  color: var(--text-muted);
  font-family: var(--mono);
}

/* ============================================
   Processing Overlay
   ============================================ */
.processing-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 5, 16, 0.88);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s var(--ease);
}

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

.processing-card {
  text-align: center; padding: 48px 56px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.processing-spinner {
  position: relative; width: 64px; height: 64px;
  margin: 0 auto 24px;
}

.spinner-ring {
  position: absolute; inset: 0;
  border: 2px solid rgba(255,255,255,0.05);
  border-top-color: var(--accent-violet);
  border-right-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-icon {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent-violet); opacity: 0.5;
}

.processing-text {
  font-size: 1rem; font-weight: 700; margin-bottom: 4px;
}
.processing-sub {
  font-size: 0.78rem; color: var(--text-muted);
}

/* ============================================
   Results
   ============================================ */
.results-section { animation: fadeUp 0.5s var(--ease); }

.comparison {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 16px; align-items: center;
  margin-bottom: 24px;
}

.comparison-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: border-color 0.25s var(--ease);
}
.comparison-card:hover { border-color: var(--border-hover); }

.comparison-card-result { border-color: var(--border-accent); }

.card-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}

.card-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.card-dot-original { background: var(--text-muted); }
.card-dot-compressed { background: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); }

.card-label {
  font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
  flex: 1;
}
.card-format {
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: var(--radius-pill);
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-violet);
}

.image-preview {
  background: rgba(0, 0, 0, 0.3); border-radius: 8px;
  padding: 12px; margin-bottom: 14px;
  display: flex; justify-content: center; align-items: center;
  min-height: 140px;
}
.image-preview canvas {
  max-width: 100%; max-height: 160px;
  border-radius: 4px; image-rendering: pixelated;
}

.card-meta { display: flex; flex-direction: column; gap: 6px; }
.meta-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem;
}
.meta-row span:first-child { color: var(--text-muted); }
.meta-row .mono { color: var(--text-primary); font-weight: 600; }

/* Arrow */
.comparison-arrow {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 8px;
}
.arrow-line {
  width: 1px; height: 32px;
  background: linear-gradient(to bottom, transparent, var(--border-hover), transparent);
}
.arrow-badge {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  color: var(--accent-emerald); white-space: nowrap;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.15);
}

/* ============================================
   Validation
   ============================================ */
.validation {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 28px;
}

.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: all 0.25s var(--ease);
}

.check-item.pass {
  border-color: rgba(52, 211, 153, 0.2);
  background: rgba(52, 211, 153, 0.03);
}
.check-item.fail {
  border-color: rgba(251, 113, 133, 0.2);
  background: rgba(251, 113, 133, 0.03);
}

.check-icon { font-size: 1.1rem; width: 28px; text-align: center; flex-shrink: 0; }
.check-info { display: flex; flex-direction: column; gap: 1px; }
.check-name { font-size: 0.82rem; font-weight: 600; }
.check-detail {
  font-family: var(--mono); font-size: 0.72rem;
  color: var(--text-muted);
}

/* ============================================
   Download Area
   ============================================ */
.download-area {
  display: flex; gap: 12px; justify-content: center;
  margin-bottom: 64px; flex-wrap: wrap;
}

.download-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 28px; font-family: var(--font);
  font-size: 0.9rem; font-weight: 700; color: #fff;
  background: var(--gradient-main); border: none;
  border-radius: var(--radius); cursor: pointer;
  transition: all 0.25s var(--ease);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.25);
}
.download-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.35);
}
.download-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.reupload-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px; font-family: var(--font);
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: all 0.25s var(--ease);
}
.reupload-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ============================================
   Guide
   ============================================ */
.section-title {
  font-size: 1.3rem; font-weight: 800;
  text-align: center; margin-bottom: 36px;
  letter-spacing: -0.02em;
}

.steps {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 0; margin-bottom: 56px; flex-wrap: wrap;
}

.step {
  display: flex; align-items: flex-start; gap: 14px;
  max-width: 180px;
}

.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gradient-main);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.25);
}

.step-content h3 {
  font-size: 0.85rem; font-weight: 700; margin-bottom: 4px;
}
.step-content p {
  font-size: 0.75rem; color: var(--text-muted); line-height: 1.5;
}

.step-connector {
  width: 40px; height: 1px; margin-top: 16px;
  background: linear-gradient(90deg, var(--border-hover), transparent);
  flex-shrink: 0;
}

/* ============================================
   Tech Cards
   ============================================ */
.tech-section {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-bottom: 48px;
}

.tech-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: all 0.3s var(--ease);
  position: relative; overflow: hidden;
}
.tech-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--gradient-main); transform: scaleX(0);
  transition: transform 0.3s var(--ease);
}
.tech-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}
.tech-card:hover::before { transform: scaleX(1); }

.tech-icon { font-size: 1.5rem; margin-bottom: 12px; }
.tech-card h3 {
  font-size: 0.88rem; font-weight: 700; margin-bottom: 8px;
}
.tech-card p {
  font-size: 0.78rem; color: var(--text-secondary); line-height: 1.6;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border);
  background: rgba(5, 5, 16, 0.6);
  backdrop-filter: blur(10px);
}

.footer-inner {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 32px; padding: 40px 24px;
  align-items: start;
}


.footer-logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 0.9rem; margin-bottom: 6px;
}
.footer-tagline {
  font-size: 0.75rem; color: var(--text-muted);
}

.footer-credits { text-align: center; }
.credit-title {
  font-size: 0.68rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.credit-name {
  font-size: 1.05rem; font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.credit-role {
  font-size: 0.75rem; color: var(--text-secondary);
  margin-bottom: 10px;
}
.credit-links {
  display: flex; gap: 12px; justify-content: center;
}
.credit-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 12px; border-radius: var(--radius-pill);
  background: var(--bg-glass); border: 1px solid var(--border);
  transition: all 0.25s var(--ease);
}
.credit-link:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.footer-tech { text-align: right; }
.footer-tech-label {
  font-size: 0.68rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.tech-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tech-badge {
  font-family: var(--mono); font-size: 0.65rem; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.12);
  color: var(--text-muted);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 24px; text-align: center;
}
.footer-bottom p {
  font-size: 0.72rem; color: var(--text-muted);
}

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  padding: 10px 22px; border-radius: var(--radius);
  font-family: var(--font); font-size: 0.82rem; font-weight: 600;
  color: #fff; z-index: 300;
  opacity: 0; transition: all 0.3s var(--ease);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  max-width: 90vw;
}
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: linear-gradient(135deg, #059669, #10b981); }
.toast-error { background: linear-gradient(135deg, #dc2626, #f43f5e); }
.toast-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .comparison { grid-template-columns: 1fr; gap: 12px; }
  .comparison-arrow { flex-direction: row; padding: 8px 0; }
  .arrow-line { width: 32px; height: 1px; }
  .tech-section { grid-template-columns: 1fr; }
  .steps { flex-direction: column; align-items: center; }
  .step { max-width: 300px; }
  .step-connector { width: 1px; height: 24px; margin: 0 0 0 16px; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-tech { text-align: center; }
  .tech-badges { justify-content: center; }
  .credit-links { justify-content: center; }
  .hero-stats { flex-direction: column; gap: 12px; padding: 20px 24px; }
  .hero-stat-divider { width: 40px; height: 1px; }
}
