:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --secondary: #8b5cf6;
  --bg: #f9fafb;
  --white: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 0.75rem;
  --radius-lg: 1.25rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Nav ── */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}
.nav-links a {
  padding: 0.4rem 0.85rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── Page wrapper ── */
.page { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 1.75rem;
}
.badge-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.3rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--shadow);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.badge .dot.green { background: var(--success); }
.badge .dot.blue { background: var(--primary); }
.badge .dot.purple { background: var(--secondary); }

/* ── Tool cards grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  box-shadow: var(--shadow);
  display: block;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}
.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.tool-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.tool-card .arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
}

/* ── Upload area ── */
.upload-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--white);
  position: relative;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}
.upload-zone h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.upload-zone p {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.upload-zone .formats {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.format-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Settings panel ── */
.settings-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.settings-panel h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.setting-row:last-child { margin-bottom: 0; }
.setting-label {
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.setting-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Range slider */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 200px;
}
input[type="range"] {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--primary-light);
}
.slider-val {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  min-width: 36px;
  text-align: right;
}

/* Select */
select {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
select:focus { border-color: var(--primary); }

/* Toggle */
.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  left: 3px;
  top: 3px;
  transition: 0.2s;
  box-shadow: var(--shadow);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Results ── */
.results-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}
.result-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow);
}
.result-thumb {
  width: 64px;
  height: 64px;
  border-radius: 0.5rem;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.result-info { flex: 1; min-width: 0; }
.result-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.35rem;
}
.result-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.size-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
}
.size-badge.saved {
  background: var(--success-bg);
  color: var(--success);
}
.size-badge.original {
  background: var(--bg);
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 0.6rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 2px 8px rgb(99 102 241 / 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(99 102 241 / 0.45);
}
.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-success {
  background: var(--success);
  color: white;
}
.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1rem;
  border-radius: 0.75rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Layout helpers ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
.section { margin: 2.5rem 0; }
.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
}
.page-title {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.page-desc {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

/* ── Bulk action bar ── */
.bulk-bar {
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.bulk-bar span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

/* ── Privacy banner ── */
.privacy-banner {
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin: 1.5rem 0;
}
.privacy-banner .icon { font-size: 1.5rem; flex-shrink: 0; }
.privacy-banner h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 0.2rem;
}
.privacy-banner p {
  font-size: 0.82rem;
  color: #047857;
}

/* ── Footer ── */
footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}
.footer-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ── Compare slider ── */
.compare-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  user-select: none;
  cursor: col-resize;
  max-height: 400px;
}
.compare-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.compare-after {
  position: absolute;
  top: 0; left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
}
.compare-after img { width: 200%; max-width: none; }
.compare-divider {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  background: white;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}
.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.compare-label {
  position: absolute;
  top: 0.6rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 99px;
  background: rgba(0,0,0,0.6);
  color: white;
}
.compare-label.before { left: 0.6rem; }
.compare-label.after { right: 0.6rem; }

/* ── AI result box ── */
.ai-result {
  background: linear-gradient(135deg, var(--primary-light), #faf5ff);
  border: 1.5px solid #c7d2fe;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
}
.ai-result h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.ai-result p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}
.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: white;
  border: 1px solid #c7d2fe;
  border-radius: 99px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0.2rem;
}

/* ── Adense placeholder ── */
.ad-slot {
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Misc ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; }

.spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
