/* =========================================================
   PixelSqueeze — Design System & Global Styles
   ========================================================= */

/* ── CSS Custom Properties ── */
:root {
  /* Colors – Light Mode */
  --bg-base:        #f8f9ff;
  --bg-surface:     #ffffff;
  --bg-elevated:    #f0f2ff;
  --bg-muted:       #e8eaf6;

  --text-primary:   #0f0e17;
  --text-secondary: #4a4a6a;
  --text-muted:     #6b6b85;
  --text-inverse:   #ffffff;

  --indigo-50:  #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-200: #c7d2fe;
  --indigo-400: #818cf8;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-900: #1e1b4b;

  --emerald-50:  #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;

  --border:         rgba(99, 102, 241, 0.15);
  --border-strong:  rgba(99, 102, 241, 0.3);

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 16px rgba(99,102,241,0.08), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg:   0 12px 40px rgba(99,102,241,0.15), 0 4px 12px rgba(0,0,0,0.08);
  --shadow-xl:   0 24px 60px rgba(99,102,241,0.2);

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --header-height: 64px;
  --max-width: 1120px;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --bg-base:        #0a0a14;
  --bg-surface:     #12121f;
  --bg-elevated:    #1a1a2e;
  --bg-muted:       #22223a;

  --text-primary:   #f0f0ff;
  --text-secondary: #a8a8c8;
  --text-muted:     #6b6b8a;

  --border:         rgba(99, 102, 241, 0.2);
  --border-strong:  rgba(99, 102, 241, 0.4);

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.5);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--indigo-700); text-decoration: none; }
a:hover { color: var(--indigo-600); }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; }

/* ── Typography ── */
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
h3 { font-size: clamp(1.125rem, 2vw, 1.5rem); font-weight: 600; line-height: 1.3; }
h4 { font-size: 1.125rem; font-weight: 600; }
p { color: var(--text-secondary); }

/* ── Layout ── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

[data-theme="dark"] .site-header {
  background: rgba(10,10,20,0.85);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--indigo-600), var(--indigo-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--indigo-600);
  background: var(--indigo-50);
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
  color: var(--indigo-400);
  background: rgba(99,102,241,0.1);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Theme toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--indigo-50);
  color: var(--indigo-600);
  border-color: var(--border-strong);
}

[data-theme="dark"] .theme-toggle:hover {
  background: rgba(99,102,241,0.1);
  color: var(--indigo-400);
}

.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .site-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.25rem;
    transform: translateY(-110%);
    transition: transform var(--transition-slow);
    z-index: 99;
    box-shadow: var(--shadow-lg);
  }

  .site-nav.open {
    transform: translateY(0);
  }

  .nav-link {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
  }

  .mobile-menu-btn {
    display: flex;
  }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 5rem 0 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: var(--indigo-50);
  border: 1px solid var(--indigo-100);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--indigo-600);
  margin-bottom: 1.5rem;
  animation: fadeInDown 0.5s ease both;
}

[data-theme="dark"] .hero-badge {
  background: rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.25);
  color: var(--indigo-400);
}

.hero h1 {
  margin-bottom: 1.25rem;
  animation: fadeInDown 0.5s 0.1s ease both;
}

.hero h1 .highlight {
  background: linear-gradient(135deg, var(--indigo-500), var(--emerald-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  animation: fadeInDown 0.5s 0.2s ease both;
}

.hero-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  animation: fadeInDown 0.5s 0.4s ease both;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.trust-item svg { color: var(--emerald-500); }

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone {
  margin: 0 auto;
  max-width: 680px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition);
  animation: fadeInDown 0.5s 0.3s ease both;
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.03), rgba(16,185,129,0.03));
  opacity: 0;
  transition: opacity var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--indigo-500);
  background: var(--indigo-50);
  box-shadow: var(--shadow-lg);
  transform: scale(1.01);
}

[data-theme="dark"] .drop-zone:hover,
[data-theme="dark"] .drop-zone.drag-over {
  background: rgba(99,102,241,0.05);
}

.drop-zone.drag-over::before { opacity: 1; }

.drop-zone-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, var(--indigo-100), var(--emerald-50));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--indigo-500);
  transition: transform var(--transition);
}

[data-theme="dark"] .drop-zone-icon {
  background: rgba(99,102,241,0.1);
}

.drop-zone:hover .drop-zone-icon {
  transform: scale(1.1) rotate(-3deg);
}

.drop-zone-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.drop-zone-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.btn-choose {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  transition: all var(--transition);
  letter-spacing: 0.01em;
}

.btn-choose:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.5);
}

.btn-choose:active {
  transform: translateY(0);
}

.drop-zone-formats {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   TOOL AREA
   ============================================================ */
.tool-area {
  padding: 2rem 0 4rem;
}

/* ── Tabs ── */
.tabs-container {
  max-width: 760px;
  margin: 0 auto 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0.375rem;
  display: flex;
  gap: 0.25rem;
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  flex: 1;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  color: white;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

/* ── Settings Panel ── */
.settings-panel {
  max-width: 760px;
  margin: 0 auto 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  display: none;
}

.settings-panel.visible {
  display: block;
  animation: fadeIn 0.25s ease;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.setting-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.setting-label span {
  font-weight: 700;
  color: var(--indigo-500);
  text-transform: none;
  font-size: 1rem;
}

/* Quality Slider */
.slider-wrapper { position: relative; }

.quality-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-muted);
  outline: none;
  transition: all var(--transition);
}

.quality-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
  transition: transform var(--transition);
}

.quality-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.quality-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
}

/* Select */
.setting-select {
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.setting-select:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* Input */
.setting-input {
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition);
  width: 100%;
}

.setting-input:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-sep {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Aspect ratio toggle */
.aspect-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.aspect-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--indigo-500);
  cursor: pointer;
}

/* Process button */
.btn-process {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem;
  margin-top: 1.5rem;
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  color: white;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  transition: all var(--transition);
  letter-spacing: 0.02em;
}

.btn-process:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.5);
}

.btn-process:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   RESULTS
   ============================================================ */
.results-header {
  max-width: 760px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.results-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.results-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--indigo-500);
  color: var(--indigo-600);
  background: var(--indigo-50);
}

.btn-primary-sm {
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.btn-primary-sm:hover {
  box-shadow: 0 4px 14px rgba(99,102,241,0.45);
  transform: translateY(-1px);
}

.results-list {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Result Card */
.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition);
  animation: slideInUp 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.result-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.result-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all var(--transition);
  background: var(--bg-muted);
}

.result-thumb:hover {
  border-color: var(--indigo-500);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.result-sizes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  flex-wrap: wrap;
}

.size-original {
  color: var(--text-muted);
  text-decoration: line-through;
}

.size-arrow { color: var(--text-muted); }

.size-new {
  font-weight: 600;
  color: var(--text-primary);
}

.badge-saved {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--emerald-50);
  color: var(--emerald-700);
  border: 1px solid var(--emerald-100);
}

[data-theme="dark"] .badge-saved {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.2);
  color: var(--emerald-400);
}

.badge-larger {
  background: var(--indigo-50);
  color: var(--indigo-600);
  border-color: var(--indigo-100);
}

[data-theme="dark"] .badge-larger {
  background: rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.2);
  color: var(--indigo-400);
}

/* Progress bar */
.result-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-muted);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.result-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo-500), var(--emerald-500));
  border-radius: 2px;
  transition: width 0.6s ease;
}

.result-card-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--indigo-50);
  color: var(--indigo-600);
  border-color: var(--border-strong);
}

.btn-icon.danger:hover {
  background: #fff5f5;
  color: var(--rose-500);
  border-color: var(--rose-400);
}

[data-theme="dark"] .btn-icon.danger:hover {
  background: rgba(244,63,94,0.1);
}

/* Processing state */
.result-card.processing {
  opacity: 0.7;
}

.result-card.processing .result-thumb {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================================
   BEFORE/AFTER MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title { font-size: 1rem; font-weight: 700; }

.btn-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-close:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

/* Comparison slider */
.comparison-container {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  user-select: none;
  cursor: ew-resize;
  background: #222;
  max-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comparison-img {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
}

.comparison-before {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.comparison-before img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.comparison-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: white;
  cursor: ew-resize;
  left: 50%;
  transform: translateX(-50%);
}

.divider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
}

.comparison-labels {
  position: absolute;
  top: 0.75rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 0.75rem;
  pointer-events: none;
}

.comparison-label {
  padding: 0.25rem 0.625rem;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
}

/* ============================================================
   PRIVACY BANNER
   ============================================================ */
.privacy-banner {
  max-width: 760px;
  margin: 2rem auto;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--emerald-50), var(--indigo-50));
  border: 1px solid var(--emerald-100);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

[data-theme="dark"] .privacy-banner {
  background: linear-gradient(135deg, rgba(16,185,129,0.07), rgba(99,102,241,0.07));
  border-color: rgba(16,185,129,0.15);
}

.privacy-banner-icon {
  color: var(--emerald-600);
  flex-shrink: 0;
}

.privacy-banner-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.privacy-banner-text strong {
  color: var(--text-primary);
}

/* ============================================================
   HOW IT WORKS
   ============================================================ */
.how-section {
  padding: 4rem 0;
  background: var(--bg-elevated);
}

[data-theme="dark"] .how-section {
  background: var(--bg-surface);
}

.section-title {
  text-align: center;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  text-align: center;
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 3rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  position: relative;
}

.step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-slow);
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.step-num {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.25rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
}

.step-1 .step-num { background: linear-gradient(135deg, var(--indigo-100), var(--indigo-200)); color: var(--indigo-700); }
.step-2 .step-num { background: linear-gradient(135deg, var(--emerald-100), #a7f3d0); color: var(--emerald-700); }
.step-3 .step-num { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }

[data-theme="dark"] .step-1 .step-num { background: rgba(99,102,241,0.15); color: var(--indigo-400); }
[data-theme="dark"] .step-2 .step-num { background: rgba(16,185,129,0.15); color: var(--emerald-400); }
[data-theme="dark"] .step-3 .step-num { background: rgba(251,191,36,0.15); color: var(--amber-400); }

.step-card h3 { margin-bottom: 0.625rem; }
.step-card p { font-size: 0.9375rem; }

/* ============================================================
   FAQ
   ============================================================ */
.faq-section {
  padding: 4rem 0;
}

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.faq-item:hover {
  border-color: var(--border-strong);
}

.faq-item.open {
  border-color: var(--indigo-200);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .faq-item.open {
  border-color: rgba(99,102,241,0.3);
}

.faq-question {
  width: 100%;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: none;
  text-align: left;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: color var(--transition);
}

.faq-question:hover { color: var(--indigo-600); }
[data-theme="dark"] .faq-question:hover { color: var(--indigo-400); }

.faq-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--indigo-500);
  transition: transform var(--transition);
}

.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding var(--transition);
  padding: 0 1.5rem;
}

.faq-item.open .faq-answer {
  max-height: 600px;
  padding: 0 1.5rem 1.25rem;
}

.faq-answer p {
  font-size: 0.9375rem;
  line-height: 1.7;
}

/* ============================================================
   CONTENT SECTION (below fold)
   ============================================================ */
.content-section {
  padding: 4rem 0;
  background: var(--bg-elevated);
}

[data-theme="dark"] .content-section {
  background: var(--bg-surface);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .content-grid { grid-template-columns: 1fr; }
}

.content-block h2 {
  margin-bottom: 1rem;
  font-size: 1.75rem;
}

.content-block h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.625rem;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.content-block p {
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  line-height: 1.8;
}

.content-block ul, .content-block ol {
  margin: 0.75rem 0 1rem 1.25rem;
}

.content-block li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  line-height: 1.7;
}

/* Comparison Table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1.5rem 0;
}

.compare-table th {
  background: var(--indigo-50);
  color: var(--indigo-700);
  font-weight: 700;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--indigo-100);
}

[data-theme="dark"] .compare-table th {
  background: rgba(99,102,241,0.1);
  color: var(--indigo-400);
  border-color: rgba(99,102,241,0.2);
}

.compare-table td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.compare-table tr:last-child td { border-bottom: none; }

.compare-table tr:hover td {
  background: var(--bg-elevated);
}

.check { color: var(--emerald-500); font-weight: 700; }
.cross { color: var(--rose-500); font-weight: 700; }

/* Step guide */
.guide-steps {
  counter-reset: guide;
  list-style: none;
  margin: 1rem 0;
}

.guide-steps li {
  counter-increment: guide;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.guide-steps li::before {
  content: counter(guide);
  min-width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--indigo-500), var(--indigo-700));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   OVERALL PROGRESS BAR
   ============================================================ */
.overall-progress {
  max-width: 760px;
  margin: 0 auto 1.25rem;
  height: 6px;
  background: var(--bg-muted);
  border-radius: 3px;
  overflow: hidden;
  transition: opacity var(--transition);
}

.overall-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo-500), var(--emerald-500));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.setting-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
  line-height: 1.5;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-brand p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.875rem;
  max-width: 260px;
  line-height: 1.7;
}

.footer-col h4, .footer-col-heading {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--indigo-500); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ============================================================
   BLOG PAGE
   ============================================================ */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.blog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-slow);
  box-shadow: var(--shadow-sm);
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.blog-card-body {
  padding: 1.5rem;
}

.blog-card-tag {
  display: inline-block;
  padding: 0.2rem 0.625rem;
  background: var(--indigo-50);
  color: var(--indigo-600);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
}

[data-theme="dark"] .blog-card-tag {
  background: rgba(99,102,241,0.1);
  color: var(--indigo-400);
}

.blog-card h3 {
  font-size: 1.0625rem;
  margin-bottom: 0.625rem;
}

.blog-card h3 a {
  color: var(--text-primary);
  transition: color var(--transition);
}

.blog-card h3 a:hover { color: var(--indigo-600); }

.blog-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Blog article */
.article-hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.article-body {
  max-width: 740px;
}

.article-body h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
}

.article-body h3 {
  font-size: 1.125rem;
  margin: 2rem 0 0.75rem;
}

.article-body p {
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.85;
}

.article-body ul, .article-body ol {
  margin: 0.875rem 0 1.25rem 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
  font-size: 1rem;
  color: var(--text-secondary);
}

.article-body .callout {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--indigo-50);
  border-left: 4px solid var(--indigo-500);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

[data-theme="dark"] .article-body .callout {
  background: rgba(99,102,241,0.07);
}

.article-body .callout p { color: var(--text-secondary); }

/* ============================================================
   UTILITY / ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--indigo-500);
  outline-offset: 2px;
}

/* Page layouts */
.page-hero {
  padding: 3.5rem 0 2.5rem;
  background: linear-gradient(135deg, var(--indigo-50), var(--bg-base));
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .page-hero {
  background: linear-gradient(135deg, rgba(99,102,241,0.07), var(--bg-base));
}

.page-hero h1 { margin-bottom: 0.875rem; }
.page-hero p { font-size: 1.0625rem; max-width: 600px; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color var(--transition);
}

.breadcrumb a:hover { color: var(--indigo-500); }
.breadcrumb-sep { color: var(--text-muted); }

/* Responsive adjustments */
@media (max-width: 640px) {
  .hero { padding: 3.5rem 0 2rem; }
  .tabs-container { flex-direction: column; }
  .results-header { flex-direction: column; align-items: flex-start; }
  .result-card { flex-wrap: wrap; }
  .result-card-actions { width: 100%; justify-content: flex-end; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .comparison-container { max-height: 45vh; }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  display: none;
}

.empty-state.visible {
  display: block;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--indigo-700);
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  z-index: 300;
  animation: slideInUp 0.3s ease;
  max-width: 320px;
}

.toast.success { background: var(--emerald-600); }
.toast.error   { background: var(--rose-500); }

/* Keep wide data tables usable on narrow screens without widening the page. */
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.table-scroll table { min-width: 540px; }

.article-body a, .footer-bottom a { text-decoration: underline; text-underline-offset: 0.15em; }
#quality-val, #quality-val-convert, #quality-val-resize, #png-colors-val { color: var(--indigo-700); }
[data-theme="dark"] { --text-muted: #a8a8c8; }

.setting-label span { color: var(--indigo-700); }
