* {
  box-sizing: border-box;
}

:root,
:root[data-theme="light"] {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --inset: #f0f2f5;
  --border: #e4e7ec;
  --border-strong: #cdd3dc;
  --text: #101828;
  --text-dim: #475467;
  --text-faint: #98a2b3;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #e6f5f2;
  --accent-border: #b5e0d8;
  --on-accent: #ffffff;
  --good: #067647;
  --good-soft: #ecfdf3;
  --good-border: #a6f4c5;
  --bad: #b42318;
  --bad-soft: #fef3f2;
  --bad-border: #fecdca;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 12px 32px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0c0e12;
  --surface: #15181e;
  --inset: #1b1f27;
  --border: #262b33;
  --border-strong: #39404b;
  --text: #f2f4f8;
  --text-dim: #9aa4b2;
  --text-faint: #5f6b7a;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.1);
  --accent-border: rgba(45, 212, 191, 0.35);
  --on-accent: #06251f;
  --good: #3ddc97;
  --good-soft: rgba(61, 220, 151, 0.1);
  --good-border: rgba(61, 220, 151, 0.35);
  --bad: #ff7b6e;
  --bad-soft: rgba(255, 123, 110, 0.1);
  --bad-border: rgba(255, 123, 110, 0.35);
  --shadow: none;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 250ms ease, color 250ms ease;
}

/* ---------- Nav ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
}

.brand strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.privacy-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: var(--good-soft);
  border: 1px solid var(--good-border);
  color: var(--good);
  font-size: 12.5px;
  font-weight: 600;
}

.privacy-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 15px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: color 150ms ease, border-color 150ms ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* ---------- Intro ---------- */

.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

.intro {
  text-align: center;
  padding: 36px 0 28px;
}

.intro h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4.5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.intro p {
  margin: 0 auto;
  max-width: 520px;
  font-size: 15.5px;
  color: var(--text-dim);
}

.intro p strong {
  color: var(--text);
  font-weight: 600;
}

.steps {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 18px 0 0;
  padding: 0;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.steps li span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

/* ---------- Tool card ---------- */

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ---------- Dropzone ---------- */

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--inset);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.dropzone-icon {
  width: 34px;
  height: 34px;
  color: var(--accent);
  margin-bottom: 8px;
}

.dropzone-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
}

.browse-btn {
  display: inline-block;
  pointer-events: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 9px;
  color: var(--on-accent);
  background: var(--accent);
}

.dropzone-fine {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- Workbench ---------- */

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.file-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dim);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ghost-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border-strong);
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease;
}

.ghost-btn:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

/* ---------- Target picker ---------- */

.target-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.block-label {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.preset-groups {
  display: grid;
  gap: 12px;
}

.preset-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  width: 92px;
  flex-shrink: 0;
}

.preset-chip {
  font: inherit;
  text-align: left;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  transition: border-color 150ms ease, background 150ms ease;
}

.preset-chip strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}

.preset-chip small {
  font-size: 10.5px;
  color: var(--text-faint);
}

.preset-chip:hover {
  border-color: var(--accent);
}

.preset-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.preset-chip.is-active strong,
.preset-chip.is-active small {
  color: var(--accent);
}

.custom-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.custom-row label {
  display: grid;
  gap: 5px;
}

.custom-row label span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.custom-row input {
  font: inherit;
  font-size: 14px;
  width: 130px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}

.custom-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.apply-button {
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--on-accent);
  background: var(--accent);
  transition: background 150ms ease;
}

.apply-button:hover {
  background: var(--accent-strong);
}

.crop-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- Compare ---------- */

.compare {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 18px;
  align-items: start;
  padding-top: 16px;
}

.photo-card.result {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
}

.card-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
}

.card-label span {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.photo-frame {
  display: grid;
  place-items: center;
  min-height: 200px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: auto;
  padding: 10px;
}

.photo-frame img {
  max-width: 100%;
  max-height: 280px;
  display: block;
  border-radius: 4px;
}

.verdict-badge {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: 9999px;
}

.verdict-badge.pass {
  color: var(--good);
  background: var(--good-soft);
  border: 1px solid var(--good-border);
}

.verdict-badge.fail {
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid var(--bad-border);
}

.status-line {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
  min-height: 20px;
}

.status-line.warn {
  color: var(--bad);
}

.download-button {
  display: block;
  margin-top: 12px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  padding: 13px;
  border-radius: 10px;
  color: var(--on-accent);
  background: var(--accent);
  transition: background 150ms ease, opacity 150ms ease;
}

.download-button:hover {
  background: var(--accent-strong);
}

.download-button.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

/* ---------- FAQ ---------- */

.faq {
  margin: 44px auto 0;
  max-width: 720px;
}

.faq h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 16px;
  margin-bottom: 10px;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 13px 0;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::before {
  content: "+";
  display: inline-block;
  width: 18px;
  color: var(--accent);
  font-weight: 700;
}

.faq details[open] summary::before {
  content: "−";
}

.faq details p {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-dim);
}

/* ---------- Content pages (About, Privacy) ---------- */

.prose {
  max-width: 680px;
  padding-top: 28px;
  padding-bottom: 8px;
}

.prose h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.prose h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 28px 0 8px;
}

.prose p,
.prose li {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-dim);
}

.prose p {
  margin: 0 0 12px;
}

.prose ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

.prose strong {
  color: var(--text);
}

.prose a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.prose a:hover {
  text-decoration: underline;
}

.prose .muted {
  font-size: 13px;
  color: var(--text-faint);
}

.foot-links {
  margin-top: 6px !important;
}

.foot-links a {
  color: var(--text-dim);
  font-weight: 600;
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--text);
}

/* ---------- Footer ---------- */

.foot {
  max-width: 1000px;
  margin: 40px auto 0;
  padding: 16px 24px 32px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.foot p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .nav,
  .page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .intro {
    padding: 24px 0 20px;
  }

  .steps {
    gap: 14px;
  }

  .tool-card {
    padding: 14px;
  }

  .dropzone {
    padding: 40px 16px;
  }

  .compare {
    grid-template-columns: 1fr;
  }

  /* On phones, show the result first — that's what the user came for */
  .photo-card.result {
    order: -1;
  }

  .photo-frame {
    min-height: 160px;
  }

  .photo-frame img {
    max-height: 220px;
  }

  .group-label {
    width: 100%;
  }

  /* 16px inputs prevent iOS auto-zoom on focus */
  .custom-row input {
    width: 104px;
    font-size: 16px;
  }

  .privacy-chip {
    display: none;
  }
}
