/* ===================================
   Sral — Ultra-Lightweight Modern CSS
   No Tailwind, no bloat, just ~9KB
   =================================== */

:root {
  /* Colors */
  --rose-50: #fff1f2;
  --rose-100: #ffe4e6;
  --rose-300: #fda4af;
  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --rose-900: #881337;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --gray-950: #0a0a0a;

  /* Semantic tokens */
  --bg: #f2f2f7;           /* iOS system background */
  --bg-elevated: #ffffff;
  --text: #1c1c1e;
  --text-muted: #6c6c70;
  --border: rgba(0, 0, 0, 0.08);
  --shadow-sm: rgba(0, 0, 0, 0.08);
  --shadow-md: rgba(0, 0, 0, 0.14);

  /* Glass recipe tokens (light) */
  --glass-bg: radial-gradient(ellipse 130% 90% at 50% 0%,
    rgba(255,255,255,0.72) 0%,
    rgba(255,255,255,0.48) 45%,
    rgba(255,255,255,0.28) 100%);
  --glass-blur: blur(20px) saturate(200%);
  --glass-shadow:
    0 12px 40px -8px rgba(0,0,0,0.18),
    0 2px 4px rgba(0,0,0,0.08),
    inset 0 0 0 1px rgba(255,255,255,0.7),
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 -1px 0 rgba(255,255,255,0.25),
    inset 0 0 12px rgba(255,255,255,0.12);
  --glass-sheen: radial-gradient(ellipse 110% 55% at 50% -10%,
    rgba(255,255,255,0.65) 0%,
    rgba(255,255,255,0) 65%);
  --glass-rim:
    inset 0 0 0 0.5px rgba(255,255,255,0.8),
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(255,255,255,0.2);

  /* Spacing */
  --font-sans: ui-sans-serif, -apple-system, system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Consolas', monospace;

  /* Radius — iOS uses bigger radii */
  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.125rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Dark mode ──────────────────────────────────────────────── */
.dark {
  --bg: #0e0e12;
  --bg-elevated: #1c1c1e;
  --text: #f2f2f7;
  --text-muted: #8e8e93;
  --border: rgba(255,255,255,0.1);
  --shadow-sm: rgba(0,0,0,0.35);
  --shadow-md: rgba(0,0,0,0.5);

  --glass-bg: radial-gradient(ellipse 130% 90% at 50% 0%,
    rgba(255,255,255,0.14) 0%,
    rgba(255,255,255,0.08) 45%,
    rgba(255,255,255,0.04) 100%);
  --glass-shadow:
    0 12px 40px -8px rgba(0,0,0,0.55),
    0 2px 4px rgba(0,0,0,0.3),
    inset 0 0 0 1px rgba(255,255,255,0.12),
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 rgba(255,255,255,0.06),
    inset 0 0 12px rgba(255,255,255,0.03);
  --glass-sheen: radial-gradient(ellipse 110% 55% at 50% -10%,
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0) 65%);
  --glass-rim:
    inset 0 0 0 0.5px rgba(255,255,255,0.14),
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 rgba(255,255,255,0.05);
}

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Rich layered background — colorful blobs give glass surfaces something
   vivid to refract (flat bg = flat glass) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 15% 5%,  rgba(244,63,94,0.22)  0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 85% 90%, rgba(244,63,94,0.18)  0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 70% 15%, rgba(251,113,133,0.14) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 25% 80%, rgba(253,164,175,0.12) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
.dark body::before, .dark::before {
  background:
    radial-gradient(ellipse 70% 55% at 15% 5%,  rgba(244,63,94,0.28)  0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 85% 90%, rgba(244,63,94,0.22)  0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 70% 15%, rgba(251,113,133,0.16) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 25% 80%, rgba(253,164,175,0.10) 0%, transparent 50%);
}

/* ── Reusable glass surface ──────────────────────────────────
   Apply .glass to any element. For specular sheen + rim,
   the element must have position:relative and overflow:hidden.
   Use isolation:isolate to contain blend modes.              */
.glass {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  isolation: isolate;
}
/* Top specular arc — catches simulated light from above */
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--glass-sheen);
  opacity: 1;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 1;
}
/* Hairline rim — edge diffraction */
.glass::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--glass-rim);
  pointer-events: none;
  z-index: 2;
}
.glass > * { position: relative; z-index: 3; }

/* Fallback for browsers without backdrop-filter */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255,255,255,0.82); }
  .dark .glass { background: rgba(28,28,30,0.88); }
}

#app {
  position: relative;
  z-index: 1;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
@media (min-width: 640px) { #app { padding: 3rem 1.5rem; } }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
select, input { font-family: inherit; }

/* ===== HEADER ===== */
header { margin-bottom: var(--space-xl); }

.header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--rose-500);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.35);
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
@media (min-width: 640px) { h1 { font-size: 2.25rem; } }

.brand-light {
  color: var(--rose-500);
}

.lang-btn {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.3125rem 0.75rem;
  transition: color var(--transition), transform var(--transition);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}
.lang-btn::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: var(--glass-sheen); mix-blend-mode: screen; pointer-events: none; z-index: 1;
}
.lang-btn::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: var(--glass-rim); pointer-events: none; z-index: 2;
}
.lang-btn span, .lang-btn { position: relative; z-index: 3; }
.lang-btn:hover { color: var(--rose-500); transform: translateY(-1px); }

.theme-btn {
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.3125rem 0.5rem;
  transition: color var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}
.theme-btn::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: var(--glass-sheen); mix-blend-mode: screen; pointer-events: none; z-index: 1;
}
.theme-btn::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: var(--glass-rim); pointer-events: none; z-index: 2;
}
.theme-btn svg { width: 1rem; height: 1rem; position: relative; z-index: 3; }
.theme-btn:hover { color: var(--rose-500); transform: rotate(20deg) scale(1.1); }

.subtitle {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ===== INSTALL BANNER ===== */
.install-banner {
  display: none;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--rose-500), #f97316);
  color: white;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow:
    0 8px 32px -4px rgba(244,63,94,0.45),
    0 2px 4px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 0 0 1px rgba(255,255,255,0.18);
  overflow: hidden;
  position: relative;
}
/* Top shine on the banner */
.install-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 110% 55% at 50% -10%,
    rgba(255,255,255,0.35) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.install-banner > * { position: relative; z-index: 1; }
.install-banner.visible { display: flex; }

.install-banner-info { display: flex; align-items: center; gap: 0.75rem; }
.install-icon-wrap {
  width: 2.5rem; height: 2.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.install-title { font-weight: 700; font-size: 0.9375rem; }
.install-desc { font-size: 0.8125rem; opacity: 0.9; margin-top: 0.1rem; }
.install-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.btn-install {
  background: white;
  color: var(--rose-600);
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.btn-install:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.btn-dismiss {
  color: rgba(255,255,255,0.75);
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  line-height: 0;
}
.btn-dismiss:hover { color: white; }

/* ===== DROPZONE ===== */
.dropzone {
  position: relative;
  padding: 3rem 2rem;
  border-radius: var(--radius-2xl);
  text-align: center;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  /* glass applied via class in HTML */
}
.dropzone:hover {
  transform: translateY(-2px);
  box-shadow:
    0 20px 60px -12px rgba(244,63,94,0.2),
    0 2px 4px rgba(0,0,0,0.08),
    inset 0 0 0 1px rgba(244,63,94,0.35),
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 -1px 0 rgba(255,255,255,0.25);
}
.dropzone.dragover {
  transform: scale(1.015);
  box-shadow:
    0 24px 70px -10px rgba(244,63,94,0.35),
    0 2px 4px rgba(0,0,0,0.1),
    inset 0 0 0 2px rgba(244,63,94,0.6),
    inset 0 1px 0 rgba(255,255,255,0.95);
}

.dropzone-content { display: flex; flex-direction: column; align-items: center; gap: 0.875rem; pointer-events: none; }
.dropzone-icon { width: 3rem; height: 3rem; color: var(--gray-400); }
.dropzone-text { font-weight: 500; font-size: 1rem; }
.dropzone-text .highlight { color: var(--rose-500); font-weight: 600; }
.dropzone-hint { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }
#file-input { display: none; }

/* ===== SECTIONS ===== */
section { margin-top: 1.75rem; }

.section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

/* ===== PRESETS (GLASSMORPHISM CARDS) ===== */
.presets {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 640px) { .presets { grid-template-columns: repeat(3, 1fr); } }

.preset-card {
  padding: 1rem 1.125rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  user-select: none;
  color: var(--text);
  /* .glass handles bg, blur, shadow, rim, sheen */
}
.preset-card:hover { transform: translateY(-3px); }
.preset-card.selected {
  box-shadow:
    0 16px 48px -8px rgba(244,63,94,0.3),
    0 2px 4px rgba(0,0,0,0.1),
    inset 0 0 0 1.5px rgba(244,63,94,0.7),
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 0 20px rgba(244,63,94,0.08);
  color: var(--rose-600);
}
.dark .preset-card.selected { color: var(--rose-400); }
.preset-card:active { transform: scale(0.98); }

.preset-title { font-weight: 700; font-size: 0.9375rem; color: inherit; }
.preset-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ===== SLIDERS & CONTROLS ===== */
.controls { display: flex; flex-direction: column; gap: 1.125rem; margin-top: 1.5rem; }

.control-group { display: flex; flex-direction: column; }
.control-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.control-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.control-value { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.4375rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
  outline: none;
  cursor: pointer;
}
.dark .slider { background: rgba(255,255,255,0.08); }

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--rose-500);
  border: 2.5px solid white;
  box-shadow: 0 2px 6px rgba(244,63,94,0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

.slider::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--rose-500);
  border: 2.5px solid white;
  box-shadow: 0 2px 6px rgba(244,63,94,0.4);
  cursor: pointer;
}

.slider-labels { display: flex; justify-content: space-between; margin-top: 0.375rem; font-size: 0.625rem; color: var(--gray-400); }

.controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.125rem;
  padding-top: 0.25rem;
}
@media (min-width: 640px) { .controls-grid { grid-template-columns: 1fr 1fr; } }

select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color var(--transition);
}
.dark select {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
select option {
  background: var(--bg-elevated);
  color: var(--text);
}
.dark select option {
  background: var(--gray-900);
  color: var(--text);
}
select:hover, select:focus { border-color: var(--rose-400); outline: none; }

.hidden { display: none !important; }

/* ===== FILE QUEUE (GLASSMORPHISM ROWS) ===== */
.queue-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.875rem; }
.btn-clear {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.btn-clear:hover { color: var(--rose-500); }

.file-list { display: flex; flex-direction: column; gap: 0.625rem; }

.file-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  animation: slideIn 0.35s var(--transition-spring);
  /* .glass handles the surface */
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}

.file-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  background: rgba(244,63,94,0.12);
  color: var(--rose-500);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.file-icon-image {
  background: rgba(59,130,246,0.12);
  color: #3b82f6;
}
.file-icon.status-done {
  background: rgba(16,185,129,0.15) !important;
  color: var(--emerald-500) !important;
}
.file-icon.status-error {
  background: rgba(239,68,68,0.15) !important;
  color: #ef4444 !important;
}

.file-icon svg {
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
}

.file-info { flex: 1; min-width: 0; }
.file-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}
.file-meta .size-saved { color: var(--emerald-500); font-weight: 600; }

.file-progress {
  margin-top: 0.5rem;
  height: 0.4375rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
  overflow: hidden;
}
.dark .file-progress { background: rgba(255,255,255,0.06); }
.file-progress-bar {
  height: 100%;
  background: var(--rose-500);
  width: 0%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.file-row.done .file-progress-bar { background: var(--emerald-500); }
.file-row.error .file-progress-bar { background: #ef4444; }

/* ===== FILE ROW ACTIONS ===== */
.file-actions { display: flex; gap: 0.375rem; flex-shrink: 0; align-items: center; }

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--emerald-500);
  color: white;
  font-weight: 700;
  font-size: 0.8125rem;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition-spring);
  cursor: pointer;
}
.btn-download:hover { background: var(--emerald-600); transform: translateY(-1px); }
.btn-download.downloaded { background: var(--gray-400); pointer-events: none; transform: none; }

.btn-preview {
  display: none;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--rose-500);
  color: white;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(244,63,94,0.35);
}
.btn-preview:not(.hidden) {
  display: flex;
}
.btn-preview:hover { 
  background: var(--rose-600); 
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244,63,94,0.45);
}
.btn-preview svg { flex-shrink: 0; }
.preview-label { display: none; }
@media (min-width: 480px) { .preview-label { display: inline; } }

.btn-icon {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.btn-icon:hover { background: rgba(0,0,0,0.05); color: var(--gray-700); }
.dark .btn-icon:hover { background: rgba(255,255,255,0.06); color: var(--gray-300); }
.btn-icon.btn-recompress:hover { color: var(--rose-500); }
.btn-icon.btn-remove:hover { color: #ef4444; }

/* ===== SMART SUGGESTION CHIP ===== */
.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.75rem;
  border-radius: 999px;
  color: var(--rose-600);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), color var(--transition);
  animation: chipIn 0.35s var(--transition-spring);
  margin-top: 0.5rem;
  white-space: nowrap;
  /* glass applied via class in HTML */
}
.dark .suggestion-chip { color: var(--rose-400); }
.suggestion-chip:hover {
  transform: scale(1.04);
  color: white;
  background: var(--rose-500) !important;
  box-shadow: 0 4px 16px rgba(244,63,94,0.45),
    inset 0 1px 0 rgba(255,255,255,0.3);
}
@keyframes chipIn {
  from { opacity: 0; transform: scale(0.75); }
  to   { opacity: 1; transform: scale(1); }
}

/* ===== ACTION BUTTONS ===== */
.actions-bar { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 640px) { .actions-bar { flex-direction: row; } }

.btn-primary {
  flex: 1;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--rose-500);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  transition: background var(--transition), transform var(--transition-spring), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(244,63,94,0.35);
}
.btn-primary:hover:not(:disabled) {
  background: var(--rose-600);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244,63,94,0.45);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled {
  background: var(--gray-200);
  color: var(--gray-400);
  box-shadow: none;
  cursor: not-allowed;
}
.dark .btn-primary:disabled { background: var(--gray-800); color: var(--gray-600); }

.btn-secondary {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform var(--transition), box-shadow var(--transition);
  /* .glass applied in HTML */
}
.btn-secondary:hover { transform: translateY(-1px); color: var(--rose-500); }

.btn-success {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--emerald-500);
  color: white;
  font-weight: 700;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(16,185,129,0.3);
}
.btn-success:hover:not(:disabled) { background: var(--emerald-600); transform: translateY(-2px); }
.btn-success:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-cancel {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: transform var(--transition), color var(--transition);
  /* .glass applied in HTML */
}
.btn-cancel:hover { color: #ef4444; transform: translateY(-1px); }

/* ===== SUMMARY CARD ===== */
.summary-card {
  margin-top: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-xl);
  /* .glass applied in HTML — override sheen tint to emerald */
}
.summary-card::before {
  background: radial-gradient(ellipse 110% 55% at 50% -10%,
    rgba(16,185,129,0.25) 0%, rgba(255,255,255,0) 65%) !important;
}

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.summary-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.summary-value { font-weight: 800; font-size: 1.125rem; margin-top: 0.25rem; letter-spacing: -0.02em; }
@media (min-width: 640px) { .summary-value { font-size: 1.375rem; } }
.summary-saved .summary-value { color: var(--emerald-500); }

/* ===== ERROR ===== */
.error-box {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  color: #b91c1c;
  font-size: 0.875rem;
  /* .glass applied in HTML — override sheen tint to red */
}
.error-box::before {
  background: radial-gradient(ellipse 110% 55% at 50% -10%,
    rgba(239,68,68,0.25) 0%, rgba(255,255,255,0) 65%) !important;
}
.dark .error-box { color: #fca5a5; }

/* ===== BEFORE/AFTER PREVIEW ===== */
.preview-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 1rem;
  align-items: center;
  justify-content: center;
}
.preview-modal.open { display: flex; }

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.preview-panel {
  position: relative;
  z-index: 1;
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  width: 100%;
  max-width: 44rem;
  max-height: 90dvh;
  overflow-y: auto;
  /* .glass applied in HTML — stronger blur for modal panels */
  backdrop-filter: blur(40px) saturate(220%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(220%) !important;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.preview-title { font-weight: 800; font-size: 1.125rem; letter-spacing: -0.02em; }
.preview-close {
  width: 2rem; height: 2rem;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.preview-close:hover { background: rgba(0,0,0,0.07); color: var(--text); }
.dark .preview-close:hover { background: rgba(255,255,255,0.07); }

/* Before/After slider */
.ba-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  user-select: none;
  touch-action: none;
  cursor: ew-resize;
  line-height: 0;
  background: #000;
}
.ba-after-img,
.ba-before-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60dvh;
  object-fit: contain;
}
.ba-before-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  clip-path: inset(0 50% 0 0);
}
.ba-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  background: white;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  cursor: ew-resize;
  transition: width 0.1s;
}
.ba-divider:hover { width: 4px; }
.ba-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: white;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
}

.ba-label-before,
.ba-label-after {
  position: absolute;
  top: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  pointer-events: none;
}
.ba-label-before { left: 0.75rem; }
.ba-label-after { right: 0.75rem; }

.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.03);
}
.dark .preview-stats { background: rgba(255,255,255,0.03); }

.preview-stat-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.preview-stat-value { font-weight: 700; font-size: 1.125rem; margin-top: 0.125rem; letter-spacing: -0.02em; }
.stat-saved { color: var(--emerald-500); }

/* ===== DRAG OVERLAY ===== */
.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(244,63,94,0.15);
  backdrop-filter: blur(6px) saturate(150%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drag-overlay-card {
  border-radius: var(--radius-2xl);
  border: 2px dashed rgba(244,63,94,0.5);
  padding: 3rem 4rem;
  text-align: center;
  /* .glass applied in HTML */
}
.drag-overlay-icon { width: 3rem; height: 3rem; color: var(--rose-400); margin: 0 auto 0.875rem; }
.drag-overlay-text { font-size: 1.125rem; font-weight: 700; color: var(--rose-500); }

/* ===== TOASTS ===== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(0.75rem) scale(0.95);
  transition: all 0.35s var(--transition-spring);
  white-space: nowrap;
  pointer-events: auto;
  /* Full glass for the default (dark) toast */
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow:
    0 8px 32px -4px rgba(0,0,0,0.35),
    inset 0 0 0 1px rgba(255,255,255,0.55),
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -1px 0 rgba(255,255,255,0.2);
  color: var(--text);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}
.toast::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--glass-sheen);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 1;
}
.toast > * { position: relative; z-index: 2; }
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.toast-success {
  background: linear-gradient(135deg, rgba(5,150,105,0.82), rgba(16,185,129,0.72));
  color: white;
  box-shadow: 0 8px 32px -4px rgba(16,185,129,0.5),
    inset 0 1px 0 rgba(255,255,255,0.4);
}
.toast.toast-error {
  background: linear-gradient(135deg, rgba(220,38,38,0.82), rgba(239,68,68,0.72));
  color: white;
  box-shadow: 0 8px 32px -4px rgba(239,68,68,0.5),
    inset 0 1px 0 rgba(255,255,255,0.4);
}
.toast.toast-info {
  background: linear-gradient(135deg, rgba(37,99,235,0.82), rgba(59,130,246,0.72));
  color: white;
  box-shadow: 0 8px 32px -4px rgba(59,130,246,0.5),
    inset 0 1px 0 rgba(255,255,255,0.4);
}

/* ===== FOOTER ===== */
footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--gray-400);
  padding-bottom: 1rem;
}
