/* ==========================================================================
   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
   -------------------------------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  /* Nothing may pan sideways on a phone. `clip` (not `hidden`) keeps sticky
     positioning intact; the extra `hidden` rule is the fallback for older
     Safari, which does not support clip and would otherwise pan sideways. */
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
@supports (overflow: clip) {
  html { overflow-x: clip; }
}

*, *::before, *::after { box-sizing: border-box; }

/* Every layout box stays inside the viewport column. */
.table-scroll, .result-list, .dropzone { max-width: 100%; }

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;
}
@supports (overflow: clip) { body { overflow-x: clip; } }

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;
  /* a 64-character digest used to push the whole page sideways on a phone;
     the token only breaks when it genuinely does not fit */
  overflow-wrap: anywhere;
}

::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); }

/* v71 — All tools is a <details>, so the list opens with no JavaScript at all
   and its links stay in the DOM for crawlers. The panel is absolutely placed so
   opening it never reflows the header row. */
.nav__tools { position: relative; }
.nav__tools > summary {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 0.9125rem; font-weight: 560;
  cursor: pointer; list-style: none; white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.nav__tools > summary::-webkit-details-marker { display: none; }
.nav__tools > summary:hover { background: var(--surface-hover); color: var(--text); }
.nav__tools > summary:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.nav__tools[open] > summary { background: var(--surface-hover); color: var(--text); }
.nav__tools__caret {
  width: 11px; height: 11px; flex: none; color: var(--text-faint);
  transition: transform 0.18s var(--ease);
}
.nav__tools[open] > summary .nav__tools__caret { transform: rotate(180deg); }
.nav__tools__panel {
  position: absolute; top: calc(100% + 9px); left: 6px; z-index: 5;
  min-width: 300px; max-width: min(520px, calc(100vw - 40px));
  list-style: none; margin: 0; padding: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  max-height: min(60vh, 460px); overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 4px;
}
.nav__tools__panel a {
  display: block; padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 0.85rem; color: var(--text-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.nav__tools__panel a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }

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

/* Install entry: an icon on phones, icon + label once there is room. */
.nav__install {
  width: auto; padding: 0 12px; gap: 7px;
  font-size: 0.85rem; font-weight: 600; color: var(--text-2);
}
.nav__install svg { width: 15px; height: 15px; }
.nav__install:hover { color: var(--text); }
/* The header is a single non-wrapping flex row and the page clips horizontal
   overflow, so a nav that does not fit is not scrollable — it is simply cut off,
   and the last entries become unreachable. The inline nav therefore has to be
   measured, not guessed. Every page now carries a seventh entry ("No upload",
   added with /compress-without-uploading/), so the widest row is the homepage
   at 1081px (brand 188 + links 650 + actions 219 + padding 40) and the tool
   pages sit at 1001px. 1140 is the smallest round number that clears the
   widest of them with headroom for one more entry; below it the hamburger
   takes over.
   When you add or rename a nav entry: run _dev/measure-nav.cjs for the new
   numbers, adjust this value, then run _dev/audit-nav.cjs to confirm. */
@media (max-width: 1140px) {
  .nav__install { width: 36px; padding: 0; }
  .nav__install-text { display: none; }
}

/* Panels that hold plain content need their own padding. */
.modal__panel > .save-guide { padding: 16px; }

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

/* Same breakpoint as the install-button rule above, and for the same reason:
   see the measurement note there before changing either number. */
@media (max-width: 1140px) {
  .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; }
  /* v71 — in the hamburger the same list is laid out in the flow rather than as
     a floating panel, comes first (on a phone it is the only shortcut out of the
     page you are standing on) and scrolls with the menu instead of the page. */
  .nav__links { max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
  .nav__tools { order: -1; }
  .nav__tools > summary { padding: 13px 12px; font-size: 1rem; }
  .nav__tools__panel {
    position: static; top: auto; left: auto; max-height: none; overflow: visible;
    box-shadow: none; background: transparent; border: 0; padding: 2px 0 8px 14px;
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   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); }

/* Pinned tools strip — the shortcut row at the top of the toolkit section on
   the homepage. Everything here is a plain link, so it works with JS off; the
   "your tools" half is filled in by site.js from localStorage only. */
.pinned {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1rem 1.15rem 1.15rem;
  box-shadow: var(--shadow-sm); margin-bottom: clamp(1.05rem, 2vw, 1.6rem);
}
.pinned__head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px;
  margin-bottom: 0.85rem;
}
.pinned__title { font-size: 0.94rem; font-weight: 680; letter-spacing: -0.01em; }
.pinned__hint { font-size: 0.7725rem; color: var(--text-faint); }
.pinned__clear {
  margin-left: auto; background: none; border: 0; padding: 4px 0;
  font: inherit; font-size: 0.78rem; font-weight: 560; color: var(--text-muted);
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--border-strong); cursor: pointer;
}
.pinned__clear:hover { color: var(--text); text-decoration-color: currentColor; }
.pinned__list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pinned__mine { margin-top: 0.95rem; padding-top: 0.95rem; border-top: 1px dashed var(--border); }
/* v69 — grouped tool index */
.cat + .cat { margin-top: 2.5rem; }
.cat__name {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 0.85rem;
}

.pin-wrap {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: var(--r-full);
  background: var(--surface-2); max-width: 100%;
}
.pin-wrap:hover { border-color: var(--border-strong); background: var(--surface); }
.pin-wrap--mine { border-color: var(--brand-500); }
.pin__main {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; max-width: 100%;
  font-size: 0.8125rem; font-weight: 600; color: var(--text); text-decoration: none;
}
.pin__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin__icon { width: 15px; height: 15px; color: var(--brand-500); flex: none; }
.pin__x {
  width: 22px; height: 22px; flex: none; margin-right: 5px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-faint);
  display: grid; place-items: center; cursor: pointer;
}
.pin__x svg { width: 11px; height: 11px; }
.pin__x:hover { background: var(--border); color: var(--text); }
@media (max-width: 420px) { .pinned__clear { margin-left: 0; } }

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

/* Two related fields side by side on wide screens (e.g. rotate/flip + crop
   on the resize page); they stack on narrow viewports like any other field. */
.field-duo { display: grid; gap: 18px; min-width: 0; }
@media (min-width: 760px) {
  .field-duo { grid-template-columns: 1fr 1fr; }
  .field-duo > .field { margin: 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;
  /* Horizontally dragging a slider must never pan the page sideways. */
  touch-action: pan-y;
}
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; }

/* The finish-sound toggle: one bell, two faces. */
.chime-toggle .i-off { display: none; }
.chime-toggle[aria-pressed="false"] .i-on { display: none; }
.chime-toggle[aria-pressed="false"] .i-off { display: block; }
.chime-toggle[aria-pressed="false"] { color: var(--text-muted); }

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

/* v72d — the picture leads the row. A 60px crop hides the thing the tool just
   produced, and a picture that has to be opened in a dialog is one click the
   user has to think about, so the preview frame is the row itself and shows the
   whole picture. Only the cut produces a transparency, so the checkerboard
   stays with the background remover; everywhere else the frame is a plain
   sunken panel. */
.result__thumb {
  grid-area: preview;
  display: grid; place-items: center; position: relative;
  padding: 10px; overflow: hidden; min-width: 0;
  background-color: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.result__thumb img {
  display: block; max-width: 100%; max-height: 320px;
  object-fit: contain; border-radius: 4px;
}
.result__thumb .ph { color: var(--text-faint); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; }
/* Nothing to show yet, because the row is still working: keep the frame the
   small square it always was instead of opening a hole in the row. */
.result__thumb:has(> .ph) { width: 54px; height: 54px; padding: 0; justify-self: start; }

/* v72b/v72d — the frame the background remover leads with is now the frame
   every tool leads with: the row, with the whole picture in view. `:has()` is
   what keeps the old 60px row layout for the few rows that carry no picture at
   all (an error line, a page-order list). The checkerboard only belongs to the
   cut — it is the only preview that can be a transparency. */
.result:has(> .result__thumb),
.result:has(> .result__preview) {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'preview preview' 'main actions';
  gap: 10px 12px; align-items: start;
}
.result__preview {
  grid-area: preview;
  display: grid; place-items: center;
  padding: 10px; overflow: hidden;
  background-color: transparent;
  background-image: repeating-conic-gradient(color-mix(in srgb, var(--text) 13%, transparent) 0% 25%, transparent 0% 50%);
  background-position: 0 0; background-size: 18px 18px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.result__preview img {
  display: block; max-width: 100%; max-height: 320px;
  object-fit: contain; border-radius: 4px;
}
.result:has(> .result__thumb) > .result__actions,
.result:has(> .result__preview) > .result__actions { margin-top: 0; }
#rbList .result__compare {
  justify-self: start; font-size: 0.78rem;
  padding: 0.34rem 0.6rem;
}

.result__main { min-width: 0; display: grid; gap: 5px; grid-area: main; }
.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; grid-area: actions; }
.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; }
  /* v72b/v72d: on a phone the whole picture still has to fit, so the preview
     gets a short frame and the actions drop under the name rather than beside
     it — whether the tool cut a background or compressed a photo. */
  .result:has(> .result__thumb),
  .result:has(> .result__preview) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'preview' 'main' 'actions';
  }
  .result__thumb, .result__preview { padding: 6px; }
  .result__thumb img, .result__preview img { max-height: 46vh; }
  #rbList .result__actions { grid-column: 1; margin-top: 4px; }
  .result:not(:has(> .result__thumb)):not(:has(> .result__preview)) .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; }
.save-hint {
  flex: 0 0 100%;
  margin: 0 0 2px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}
.save-hint[hidden] { display: none; }
.linkish {
  background: none; border: 0; padding: 0; margin-left: 6px;
  font: inherit; color: var(--brand-400);
  text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
.linkish:hover { color: var(--brand-500); }

/* Save coach shown before the phone share sheet */
.modal__panel--narrow { max-width: 440px; }
.save-guide { display: grid; gap: 14px; }
.save-guide__steps {
  margin: 0; padding-left: 0; list-style: none;
  display: grid; gap: 12px; counter-reset: step;
}
.save-guide__steps li {
  counter-increment: step;
  position: relative;
  padding-left: 40px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
}
.save-guide__steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -1px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-500); color: #fff;
  font-size: 0.8125rem; font-weight: 700;
}
.save-guide__steps strong { color: var(--brand-500); font-weight: 650; }
.save-guide__note {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-2);
}
#saveGuideGo[hidden] { display: none; }

.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;
  overscroll-behavior-x: contain;   /* swiping a table must not drag the page */
}
.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 h2 {
  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; }
/* The build stamp is written by _dev/stamp-build.py on every deploy. Tabular
   figures keep the date from jittering as the day number changes width. */
.build-stamp { font-variant-numeric: tabular-nums; }
.build-stamp code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em; color: var(--text-muted);
}

@media (max-width: 700px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 1.75rem; }
  .footer__about { grid-column: 1 / -1; }
  /* v70 — on a phone the tool list used to stack one link per row, which made
     the footer taller than the screen (1407px at 390px wide). Give it a
     full-width row and flow the links in two columns: every link stays in the
     DOM, in the same order, at half the height. */
  .footer__col--tools { grid-column: 1 / -1; }
  .footer__col--tools ul { display: block; column-count: 2; column-gap: 1.5rem; }
  .footer__col--tools li { break-inside: avoid; }
  .footer__bottom { margin-top: 1.75rem; padding-top: 1.1rem; gap: 8px; }
}

@media (min-width: 431px) and (max-width: 700px) {
  .footer__col--tools ul { column-count: 3; }
}

@media (max-width: 430px) {
  .site-footer { padding-bottom: 1.5rem; }
  .footer__bottom { font-size: 0.76rem; }
}

/* --------------------------------------------------------------------------
   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; }
.toast.is-warn { background: var(--warning-500); color: var(--bg); }

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

/* --------------------------------------------------------------------------
   14. Live visitor stats
   -------------------------------------------------------------------------- */
[hidden] { display: none !important; }

.live-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--success-500);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  animation: livePulse 2.4s var(--ease) infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Footer social proof — deliberately quiet, and only revealed by JS once the
   visitor count clears its threshold (see data-stats-min). */
.footer__stats {
  margin: 1.6rem 0 0; font-size: 0.8rem; color: var(--text-faint);
}
.footer__stats b {
  color: var(--text-muted); font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.live-stats {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
  padding: clamp(1.1rem, 2.4vw, 1.5rem);
  display: grid; gap: clamp(1rem, 2vw, 1.35rem);
}
.live-stats__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.live-stats__title { font-size: 1.02rem; margin: 0; }
.live-stats__sub { font-size: 0.8125rem; color: var(--text-faint); }
.live-stats__grid {
  display: grid; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.live-stats__grid > div { background: var(--surface); padding: 0.95rem 1.1rem; }
.live-stats__num {
  font-size: clamp(1.5rem, 1.25rem + 1.1vw, 2rem); font-weight: 760;
  letter-spacing: -0.035em; line-height: 1.05; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.live-stats__label { font-size: 0.8125rem; color: var(--text-muted); margin-top: 4px; }
.live-stats__note { margin: 0; font-size: 0.8125rem; color: var(--text-faint); }

.live-stats__chart { display: grid; gap: 6px; }
.spark {
  display: flex; align-items: flex-end; gap: 4px; height: 54px;
  border-bottom: 1px solid var(--border);
}
.spark__col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.spark__bar {
  display: block; width: 100%; border-radius: 3px 3px 0 0;
  background: var(--brand-400); opacity: 0.85;
  transition: height 0.5s var(--ease), opacity 0.2s var(--ease), background-color 0.2s var(--ease);
}
.spark__bar.is-today { background: var(--grad-brand); opacity: 1; }
.spark__bar.is-empty { background: var(--border); opacity: 1; }
.spark__col:hover .spark__bar { opacity: 1; }
.spark__axis {
  display: flex; justify-content: space-between; min-height: 1em;
  font-size: 0.72rem; color: var(--text-faint);
}

@media (max-width: 560px) {
  .live-stats__grid { grid-template-columns: 1fr 1fr; }
  .live-stats__grid > div:last-child { grid-column: 1 / -1; }
  .spark { height: 44px; gap: 3px; }
}

/* ------------------------------------------------------------ share ---- */

.share-qr {
  display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr);
  gap: 34px; align-items: center;
}
.share-qr__panel {
  background: #fff; border-radius: 22px; padding: 20px;
  box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.share-qr__img { display: block; width: 100%; height: auto; }
.share-qr__title { margin: 0 0 8px; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.share-actions--tight { margin-top: 0; }
.share-note { margin-top: 12px; min-height: 1.3em; font-size: 0.875rem; color: var(--text-muted); }

.poster-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 26px; margin-top: 26px;
}
.poster { margin: 0; }
.poster img {
  display: block; width: 100%; height: auto;
  border-radius: 18px; box-shadow: var(--shadow-sm);
}
.poster figcaption {
  margin-top: 14px; display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap; justify-content: space-between;
}
.poster__tag {
  font-size: 0.8125rem; font-weight: 600; color: var(--text-muted);
}

.copy-list { display: grid; gap: 14px; margin-top: 24px; }
.copy-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 18px;
}
.copy-item p {
  margin: 0 0 12px; white-space: pre-wrap; line-height: 1.6;
  font-size: 0.9375rem;
}

@media (max-width: 760px) {
  .share-qr { grid-template-columns: 1fr; gap: 24px; }
  .share-qr__panel { max-width: 320px; }
}
