/* ==========================================================================
   LocalPhotoTool — Design System
   https://localphototool.com
   Light + dark themes, mobile-first, zero external requests.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand */
  --brand-500: #4f46e5;
  --brand-600: #4338ca;
  --brand-400: #6366f1;
  --accent-500: #06b6d4;
  --accent-400: #22d3ee;
  --violet-500: #7c3aed;

  /* Semantic */
  --success-500: #10b981;
  --success-600: #059669;
  --warning-500: #f59e0b;
  --danger-500: #e11d48;
  --danger-600: #be123c;

  /* Surfaces */
  --bg: #ffffff;
  --bg-subtle: #f6f8fc;
  --bg-sunken: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --surface-hover: #f3f6fc;
  --border: #e3e8f0;
  --border-strong: #cfd7e6;

  /* Text */
  --text: #0c1222;
  --text-2: #3d4759;
  --text-muted: #667085;
  --text-faint: #98a2b3;
  --text-on-brand: #ffffff;

  /* Tints */
  --brand-tint: rgba(79, 70, 229, 0.08);
  --brand-tint-strong: rgba(79, 70, 229, 0.14);
  --accent-tint: rgba(6, 182, 212, 0.10);
  --success-tint: rgba(16, 185, 129, 0.12);
  --danger-tint: rgba(225, 29, 72, 0.10);

  /* Effects */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 6px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 18px 40px -12px rgba(16, 24, 40, 0.18), 0 8px 16px -8px rgba(16, 24, 40, 0.08);
  --shadow-brand: 0 10px 24px -8px rgba(79, 70, 229, 0.45);

  --grad-brand: linear-gradient(135deg, #4f46e5 0%, #7c3aed 52%, #06b6d4 100%);
  --grad-soft: linear-gradient(180deg, rgba(79, 70, 229, 0.07), rgba(6, 182, 212, 0.04));

  /* Geometry */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Type */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --header-h: 62px;
  --container: 1160px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #0a0d18;
  --bg-subtle: #0e121f;
  --bg-sunken: #060911;
  --surface: #121728;
  --surface-2: #171d31;
  --surface-hover: #1c2338;
  --border: #232b42;
  --border-strong: #333d59;

  --text: #eef1f9;
  --text-2: #c3cbdd;
  --text-muted: #939db5;
  --text-faint: #6b7590;

  --brand-500: #6366f1;
  --brand-600: #818cf8;
  --accent-500: #22d3ee;
  --success-500: #34d399;
  --success-600: #6ee7b7;
  --danger-500: #fb7185;

  --brand-tint: rgba(99, 102, 241, 0.14);
  --brand-tint-strong: rgba(99, 102, 241, 0.22);
  --accent-tint: rgba(34, 211, 238, 0.12);
  --success-tint: rgba(52, 211, 153, 0.14);
  --danger-tint: rgba(251, 113, 133, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 6px 18px -4px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.7);
  --shadow-brand: 0 10px 28px -10px rgba(99, 102, 241, 0.55);

  --grad-soft: linear-gradient(180deg, rgba(99, 102, 241, 0.10), rgba(34, 211, 238, 0.05));
  color-scheme: dark;
}

html { color-scheme: light; }

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0 0 0.6em;
  color: var(--text);
  font-weight: 730;
  letter-spacing: -0.021em;
  line-height: 1.16;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.35rem + 3.1vw, 3.35rem); letter-spacing: -0.032em; }
h2 { font-size: clamp(1.45rem, 1.1rem + 1.6vw, 2.1rem); }
h3 { font-size: clamp(1.08rem, 1rem + 0.4vw, 1.28rem); }
h4 { font-size: 1rem; }

p { margin: 0 0 1.1em; color: var(--text-2); }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

img, svg, video { max-width: 100%; height: auto; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 0.1em 0.4em;
}

::selection { background: var(--brand-tint-strong); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 4px;
}

.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;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--brand-500); color: #fff; padding: 10px 16px;
  border-radius: var(--r-sm); transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}
.container--narrow { max-width: 760px; }
.container--wide { max-width: 1340px; }

.section { padding: clamp(3rem, 6vw, 5.5rem) 0; }
.section--tight { padding: clamp(2rem, 4vw, 3rem) 0; }
.section--subtle { background: var(--bg-subtle); border-block: 1px solid var(--border); }

.section-head { max-width: 720px; margin-bottom: clamp(1.75rem, 3.5vw, 3rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head p { font-size: 1.0625rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.75rem; font-weight: 680; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--brand-500);
  margin-bottom: 0.9rem;
}
.eyebrow::before {
  content: ""; width: 16px; height: 2px; border-radius: 2px;
  background: currentColor; opacity: 0.7;
}

.lead { font-size: clamp(1.02rem, 1rem + 0.35vw, 1.18rem); color: var(--text-2); }

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 80;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.nav {
  display: flex; align-items: center; gap: 8px;
  height: var(--header-h);
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 720; font-size: 1.02rem; letter-spacing: -0.02em;
  color: var(--text); margin-right: auto; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  box-shadow: var(--shadow-brand);
}
.brand__mark svg { width: 17px; height: 17px; }
.brand__dot { color: var(--text-faint); font-weight: 500; }

.nav__links { display: flex; align-items: center; gap: 2px; }
.nav__link {
  padding: 8px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 0.9125rem; font-weight: 560;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
  white-space: nowrap;
}
.nav__link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav__link[aria-current="page"] { color: var(--brand-500); background: var(--brand-tint); }

.nav__actions { display: flex; align-items: center; gap: 8px; margin-left: 8px; }

.icon-btn {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-2);
  cursor: pointer; transition: all 0.18s var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .i-moon { display: none; }
html[data-theme="dark"] .icon-btn .i-moon { display: block; }
html[data-theme="dark"] .icon-btn .i-sun { display: none; }

.nav__toggle { display: none; }

@media (max-width: 860px) {
  .nav__links {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 12px 20px 20px; margin: 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  }
  .nav__links.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__link { padding: 13px 14px; font-size: 1rem; }
  .nav__toggle { display: grid; }
  .nav__actions .btn { display: none; }
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.66rem 1.05rem;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 0.9125rem; font-weight: 620; letter-spacing: -0.005em;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform 0.16s var(--ease), box-shadow 0.2s var(--ease),
    background 0.18s var(--ease), border-color 0.18s var(--ease), opacity 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.5; pointer-events: none; cursor: not-allowed;
}
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--primary {
  background: var(--brand-500); color: var(--text-on-brand);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--brand-600); box-shadow: var(--shadow-md); }

.btn--grad {
  background: var(--grad-brand); background-size: 160% 160%;
  color: #fff; box-shadow: var(--shadow-brand);
}
.btn--grad:hover { background-position: 100% 0; transform: translateY(-1px); }

.btn--ghost {
  background: var(--surface); color: var(--text);
  border-color: var(--border); box-shadow: var(--shadow-xs);
}
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }

.btn--quiet { background: transparent; color: var(--text-2); }
.btn--quiet:hover { background: var(--surface-hover); color: var(--text); }

.btn--danger { background: transparent; color: var(--danger-500); border-color: transparent; }
.btn--danger:hover { background: var(--danger-tint); }

.btn--lg { padding: 0.85rem 1.5rem; font-size: 1rem; border-radius: var(--r-md); }
.btn--sm { padding: 0.42rem 0.7rem; font-size: 0.8125rem; border-radius: var(--r-xs); }
.btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   6. Badges / chips / pills
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--r-full);
  font-size: 0.78rem; font-weight: 600;
  background: var(--bg-sunken); color: var(--text-2);
  border: 1px solid var(--border);
}
.badge svg { width: 13px; height: 13px; }
.badge--success { background: var(--success-tint); color: var(--success-600); border-color: transparent; }
.badge--brand { background: var(--brand-tint); color: var(--brand-500); border-color: transparent; }
.badge--accent { background: var(--accent-tint); color: var(--accent-500); border-color: transparent; }
.badge--warning { background: rgba(245, 158, 11, 0.13); color: #b45309; border-color: transparent; }
html[data-theme="dark"] .badge--warning { color: #fbbf24; }

.trust-row {
  display: flex; flex-wrap: wrap; gap: 8px 10px;
  margin: 0; padding: 0; list-style: none;
}

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.825rem; font-weight: 560; color: var(--text-2);
}
.chip--soon { opacity: 0.62; }
.chip--soon::after {
  content: "soon"; font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero { position: relative; padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3rem); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -30% -10% auto -10%; height: 620px;
  background: radial-gradient(46% 58% at 22% 42%, rgba(79, 70, 229, 0.16), transparent 68%),
    radial-gradient(40% 52% at 78% 30%, rgba(6, 182, 212, 0.14), transparent 70%);
  pointer-events: none; z-index: -1;
}
html[data-theme="dark"] .hero::before {
  background: radial-gradient(46% 58% at 22% 42%, rgba(99, 102, 241, 0.22), transparent 68%),
    radial-gradient(40% 52% at 78% 30%, rgba(34, 211, 238, 0.14), transparent 70%);
}
.hero--center { text-align: center; }
.hero--center .hero__lead { margin-inline: auto; }
.hero__lead { max-width: 640px; font-size: clamp(1.03rem, 1rem + 0.4vw, 1.2rem); color: var(--text-2); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.75rem; }
.hero--center .hero__cta { justify-content: center; }
.hero__bullets {
  display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center;
  margin: 1.5rem 0 0; padding: 0; list-style: none;
  font-size: 0.8875rem; color: var(--text-muted);
}
.hero__bullets li { display: inline-flex; align-items: center; gap: 7px; }
.hero__bullets svg { width: 15px; height: 15px; color: var(--success-500); flex: none; }

.hero--compact { padding: clamp(2rem, 4vw, 3.25rem) 0 0; }
.hero--compact h1 { font-size: clamp(1.75rem, 1.3rem + 2.1vw, 2.60rem); }

/* --------------------------------------------------------------------------
   8. Cards & grids
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: clamp(1.15rem, 2.4vw, 1.6rem);
  box-shadow: var(--shadow-sm);
}

.grid { display: grid; gap: clamp(14px, 2vw, 22px); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); }

.feature { position: relative; }
.feature__icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 0.9rem;
  background: var(--brand-tint); color: var(--brand-500);
}
.feature__icon svg { width: 20px; height: 20px; }
.feature h3 { margin-bottom: 0.4rem; }
.feature p { font-size: 0.925rem; margin: 0; color: var(--text-muted); }

.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.stat-strip__item { background: var(--surface); padding: 1.15rem 1.35rem; }
.stat-strip__num {
  font-size: clamp(1.35rem, 1.2rem + 0.9vw, 1.75rem); font-weight: 750;
  letter-spacing: -0.03em; color: var(--text); line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-strip__label { font-size: 0.8125rem; color: var(--text-muted); margin-top: 3px; }

/* --------------------------------------------------------------------------
   9. Tool shell
   -------------------------------------------------------------------------- */
.tool { padding-bottom: 2rem; }

.dropzone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  background-image: var(--grad-soft);
  padding: clamp(1.9rem, 5vw, 3.4rem) 1.4rem;
  text-align: center;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease),
    transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.dropzone:hover { border-color: var(--brand-400); box-shadow: var(--shadow-md); }
.dropzone.is-dragover {
  border-color: var(--brand-500);
  background-color: var(--brand-tint);
  box-shadow: 0 0 0 5px var(--brand-tint), var(--shadow-lg);
  transform: scale(1.004);
}
.dropzone.is-busy { pointer-events: none; opacity: 0.85; }

.dropzone__icon {
  width: 62px; height: 62px; margin: 0 auto 1.1rem;
  border-radius: 18px; display: grid; place-items: center;
  background: var(--grad-brand); color: #fff;
  box-shadow: var(--shadow-brand);
}
.dropzone__icon svg { width: 28px; height: 28px; }
.dropzone h2, .dropzone h3 { margin-bottom: 0.4rem; }
.dropzone__hint { color: var(--text-muted); font-size: 0.9125rem; margin-bottom: 1.35rem; }
.dropzone__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.dropzone__formats {
  margin: 1.15rem 0 0; font-size: 0.78rem; color: var(--text-faint);
  letter-spacing: 0.01em;
}
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* Settings panel ---------------------------------------------------------- */
.settings {
  margin-top: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.settings__head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.settings__title { font-size: 0.875rem; font-weight: 660; margin: 0; letter-spacing: -0.01em; }
.settings__head .badge { margin-left: auto; }
.settings__body { padding: 16px; display: grid; gap: 18px; }

.field { display: grid; gap: 8px; min-width: 0; }
.field__label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8125rem; font-weight: 620; color: var(--text-2);
}
.field__label .hint { font-weight: 500; color: var(--text-faint); font-size: 0.7625rem; }
.field__row { display: flex; align-items: center; gap: 12px; }
.field__value {
  font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 600;
  color: var(--brand-500); min-width: 3.4em; text-align: right;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: inline-flex; padding: 3px; gap: 3px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--r-sm); width: 100%;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  flex: 1 1 0; text-align: center; padding: 8px 10px;
  font-size: 0.8375rem; font-weight: 600; color: var(--text-muted);
  border-radius: var(--r-xs); cursor: pointer; user-select: none;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  white-space: nowrap;
}
.segmented label:hover { color: var(--text); }
.segmented input:checked + label {
  background: var(--surface); color: var(--brand-500);
  box-shadow: var(--shadow-xs);
}
.segmented input:focus-visible + label { outline: 2px solid var(--brand-500); outline-offset: 1px; }

.segmented--wrap { flex-wrap: wrap; }

/* Segmented control built from buttons (view / zoom toggles) */
.segmented > .btn {
  flex: 1 1 auto; border: 0; box-shadow: none; border-radius: var(--r-xs);
  padding: 7px 11px; font-size: 0.8125rem; font-weight: 600;
}
.segmented > .btn--primary {
  background: var(--surface); color: var(--brand-500); box-shadow: var(--shadow-xs);
}
.segmented > .btn--ghost { background: transparent; color: var(--text-muted); }
.segmented > .btn--ghost:hover { background: transparent; color: var(--text); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; background: var(--bg-sunken);
  border: 1px solid var(--border);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: var(--brand-500); border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm); transition: transform 0.15s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.14); }
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 3px; background: var(--bg-sunken); border: 1px solid var(--border);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand-500); border: 2px solid var(--surface); box-shadow: var(--shadow-sm);
}

.input, .select {
  width: 100%; padding: 0.55rem 0.75rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 0.9rem; transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.input:focus, .select:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 2.1rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23888' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 15px;
}
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group__suffix {
  display: grid; place-items: center; padding: 0 0.7rem;
  background: var(--bg-sunken); border: 1px solid var(--border); border-left: 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 0.8125rem; color: var(--text-muted); font-weight: 600;
}

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 38px; height: 22px; flex: none; border-radius: 999px;
  background: var(--border-strong); position: relative;
  transition: background 0.2s var(--ease);
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-xs); transition: transform 0.2s var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand-500); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.switch__text { font-size: 0.875rem; font-weight: 560; color: var(--text-2); }
.switch--sm .switch__track { width: 32px; height: 18px; }
.switch--sm .switch__track::after { width: 12px; height: 12px; }
.switch--sm input:checked + .switch__track::after { transform: translateX(14px); }

.advanced {
  border-top: 1px solid var(--border); background: var(--surface-2);
}
.advanced > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; cursor: pointer; list-style: none;
  font-size: 0.8125rem; font-weight: 620; color: var(--text-2);
  transition: color 0.18s var(--ease);
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary:hover { color: var(--text); }
.advanced > summary svg { transition: transform 0.22s var(--ease); width: 15px; height: 15px; }
.advanced[open] > summary svg.i-chev { transform: rotate(180deg); }
.advanced__body { padding: 0 16px 18px; display: grid; gap: 16px; }

.engine-status {
  display: grid; gap: 6px; font-size: 0.7625rem; color: var(--text-muted);
  font-family: var(--font-mono);
}
.engine-status div { display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.dot--on { background: var(--success-500); box-shadow: 0 0 0 3px var(--success-tint); }
.dot--off { background: var(--text-faint); }
.dot--loading { background: var(--warning-500); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Results ----------------------------------------------------------------- */
.results { margin-top: 22px; }
.results__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.results__title { font-size: 0.95rem; font-weight: 680; margin: 0; letter-spacing: -0.01em; }
.results__summary { font-size: 0.8125rem; color: var(--text-muted); margin: 0; }
.results__actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.result-list { display: grid; gap: 10px; }

.result {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 14px; align-items: center;
  padding: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  animation: rise 0.32s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.result.is-error { border-color: color-mix(in srgb, var(--danger-500) 45%, var(--border)); }

.result__thumb {
  width: 60px; height: 60px; border-radius: var(--r-sm);
  background-color: var(--bg-sunken); overflow: hidden; position: relative;
  display: grid; place-items: center; flex: none;
  border: 1px solid var(--border);
}
.result__thumb img { width: 100%; height: 100%; object-fit: cover; }
.result__thumb .ph { color: var(--text-faint); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; }

.result__main { min-width: 0; display: grid; gap: 5px; }
.result__name {
  font-size: 0.875rem; font-weight: 620; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin: 0; letter-spacing: -0.005em;
}
.result__meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.7625rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.result__meta .sep { color: var(--text-faint); opacity: 0.6; }
.result__meta strong { color: var(--text-2); font-weight: 620; }
.result__saved { color: var(--success-600); font-weight: 700; }
.result__grew { color: var(--warning-500); font-weight: 700; }

.result__bar {
  height: 5px; border-radius: 3px; background: var(--bg-sunken);
  overflow: hidden; position: relative;
}
.result__bar > span {
  display: block; height: 100%; border-radius: 3px;
  background: var(--grad-brand); background-size: 200% 100%;
  transition: width 0.35s var(--ease);
  animation: slide 1.6s linear infinite;
}
@keyframes slide { to { background-position: 200% 0; } }
.result__bar.is-done > span { animation: none; background: var(--success-500); }

.result__actions { display: flex; align-items: center; gap: 5px; }
.result__actions .btn { padding: 0.42rem 0.6rem; }

.result__note {
  font-size: 0.75rem; color: var(--danger-500);
  grid-column: 2 / -1;
}

@media (max-width: 620px) {
  .result { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
  .result__thumb { width: 52px; height: 52px; }
  .result__actions { grid-column: 2; margin-top: 2px; }
  .result__meta { font-size: 0.74rem; }
}

/* Sticky action bar -------------------------------------------------------- */
.action-bar {
  position: sticky; bottom: 0; z-index: 60;
  margin-top: 18px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  animation: rise 0.3s var(--ease) both;
}
.action-bar__info { display: grid; gap: 1px; margin-right: auto; }
.action-bar__big {
  font-size: 1.05rem; font-weight: 740; letter-spacing: -0.02em;
  color: var(--success-600); font-variant-numeric: tabular-nums;
}
.action-bar__sub { font-size: 0.7625rem; color: var(--text-muted); }
.action-bar__btns { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .action-bar { gap: 10px; }
  .action-bar__btns { width: 100%; }
  .action-bar__btns .btn { flex: 1 1 0; }
}

/* --------------------------------------------------------------------------
   10. Compare modal
   -------------------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: 16px;
  background: color-mix(in srgb, #05070f 72%, transparent);
  backdrop-filter: blur(4px);
  animation: fade 0.18s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } }
.modal[hidden] { display: none; }

.modal__panel {
  width: 100%; max-width: 1040px; max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.22s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: scale(0.975) translateY(8px); } }

.modal__head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.modal__title {
  font-size: 0.9125rem; font-weight: 660; margin: 0; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.modal__head .badge { flex: none; }
.modal__head .icon-btn { margin-left: auto; }

.compare {
  position: relative; flex: 1 1 auto; min-height: 220px;
  overflow: hidden; background: var(--bg-sunken);
  background-image: linear-gradient(45deg, rgba(128, 128, 128, 0.07) 25%, transparent 25%, transparent 75%, rgba(128, 128, 128, 0.07) 75%),
    linear-gradient(45deg, rgba(128, 128, 128, 0.07) 25%, transparent 25%, transparent 75%, rgba(128, 128, 128, 0.07) 75%);
  background-size: 22px 22px; background-position: 0 0, 11px 11px;
  touch-action: none; user-select: none;
}
.compare__layer {
  position: absolute; inset: 0; overflow: hidden;
}
.compare__layer img {
  width: 100%; height: 100%; object-fit: contain;
  transform: translate(var(--panx, 0px), var(--pany, 0px)) scale(var(--zoom, 1));
  transform-origin: center center;
  pointer-events: none;
  will-change: transform;
}
.compare__layer--over { clip-path: inset(0 0 0 var(--split, 50%)); }
.compare__layer--base { clip-path: none; }
.compare__label {
  position: absolute; top: 12px; z-index: 3;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  background: color-mix(in srgb, #05070f 66%, transparent); color: #fff;
  backdrop-filter: blur(6px); pointer-events: none;
}
.compare__label--l { left: 12px; }
.compare__label--r { right: 12px; }

.compare__handle {
  position: absolute; top: 0; bottom: 0; left: var(--split, 50%);
  width: 3px; margin-left: -1.5px; z-index: 4;
  background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28), 0 0 14px rgba(0, 0, 0, 0.35);
  cursor: ew-resize;
}
.compare__grip {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; color: #111;
  display: grid; place-items: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}
.compare__grip svg { width: 20px; height: 20px; }
.compare__handle:focus-visible { outline: none; }
.compare__handle:focus-visible .compare__grip { outline: 3px solid var(--brand-500); outline-offset: 2px; }

.modal__foot {
  border-top: 1px solid var(--border); background: var(--surface-2);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.compare-stats {
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.compare-stats b { color: var(--text); font-weight: 660; }
.modal__foot > .btn { margin-left: auto; }

.zoom-pan { cursor: zoom-in; }
.zoom-pan.is-zoomed { cursor: grab; }

/* --------------------------------------------------------------------------
   11. Content / prose
   -------------------------------------------------------------------------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 2.4rem; }
.prose h3 { margin-top: 1.8rem; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.3em; color: var(--text-2); }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--brand-500); }
.prose strong { color: var(--text); font-weight: 650; }
.prose table {
  width: 100%; border-collapse: collapse; margin: 1.4rem 0;
  font-size: 0.8875rem;
}
.prose th, .prose td {
  padding: 10px 12px; border: 1px solid var(--border); text-align: left;
}
.prose th { background: var(--surface-2); font-weight: 660; color: var(--text); }
.prose td { color: var(--text-2); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.4rem 0; }
.table-scroll table { margin: 0; min-width: 520px; }

.callout {
  display: flex; gap: 12px; padding: 15px 17px;
  border-radius: var(--r-md); background: var(--brand-tint);
  border: 1px solid color-mix(in srgb, var(--brand-500) 22%, transparent);
  font-size: 0.9125rem; color: var(--text-2); margin: 1.5rem 0;
}
.callout svg { width: 19px; height: 19px; color: var(--brand-500); flex: none; margin-top: 2px; }
.callout p { margin: 0; }

/* FAQ --------------------------------------------------------------------- */
.faq { display: grid; gap: 10px; }
.faq__item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.faq__item > summary {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 17px; cursor: pointer; list-style: none;
  font-size: 0.95rem; font-weight: 620; color: var(--text);
}
.faq__item > summary::-webkit-details-marker { display: none; }
.faq__item > summary::after {
  content: ""; margin-left: auto; flex: none;
  width: 9px; height: 9px; border-right: 2px solid var(--text-faint);
  border-bottom: 2px solid var(--text-faint); transform: rotate(45deg) translateY(-2px);
  transition: transform 0.22s var(--ease);
}
.faq__item[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq__item[open] > summary { color: var(--brand-500); }
.faq__body { padding: 0 17px 17px; }
.faq__body p { font-size: 0.9125rem; color: var(--text-muted); margin-bottom: 0.7em; }
.faq__body p:last-child { margin-bottom: 0; }

/* Steps ------------------------------------------------------------------- */
.steps { display: grid; gap: clamp(14px, 2vw, 20px); counter-reset: step; }
.step { position: relative; padding-left: 52px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--brand-500); font-weight: 720; font-size: 0.875rem;
  box-shadow: var(--shadow-xs);
}
.step h3 { margin-bottom: 0.32rem; font-size: 1.03rem; }
.step p { margin: 0; font-size: 0.9125rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   12. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: clamp(3rem, 6vw, 5rem);
  border-top: 1px solid var(--border); background: var(--bg-subtle);
  padding: clamp(2.25rem, 4vw, 3.25rem) 0 1.75rem;
  font-size: 0.875rem;
}
.footer__grid {
  display: grid; gap: 2rem;
  grid-template-columns: minmax(220px, 1.5fr) repeat(auto-fit, minmax(140px, 1fr));
}
.footer__about p { color: var(--text-muted); font-size: 0.85rem; max-width: 34ch; margin-top: 0.85rem; }
.footer__col h4 {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.085em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 0.85rem;
}
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.footer__col a { color: var(--text-muted); font-size: 0.85rem; }
.footer__col a:hover { color: var(--brand-500); }
.footer__bottom {
  margin-top: 2.25rem; padding-top: 1.35rem; border-top: 1px solid var(--border);
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  color: var(--text-faint); font-size: 0.8rem;
}
.footer__bottom .sep { margin-left: auto; }

@media (max-width: 700px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 1.75rem; }
  .footer__about { grid-column: 1 / -1; }
}

/* --------------------------------------------------------------------------
   13. Utilities & motion
   -------------------------------------------------------------------------- */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.85rem; }
.mt-4 { margin-top: 1.25rem; }
.mt-5 { margin-top: 2rem; }
.mb-4 { margin-bottom: 1.25rem; }
.text-center { text-align: center; }
.muted { color: var(--text-muted); }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 120%);
  z-index: 300; max-width: min(440px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg);
  font-size: 0.875rem; font-weight: 560;
  box-shadow: var(--shadow-lg);
  transition: transform 0.32s var(--ease), opacity 0.32s var(--ease);
  opacity: 0;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast svg { width: 17px; height: 17px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
