/* ==========================================================================
   Image Tools Online — global stylesheet
   Follows the design system in /image_tools_design.md: one violet action on
   calm white, dark "night" bands to open and close a page, grouping by sunken
   surfaces instead of borders. Tokens first, then components.
   Fonts are served from /fonts (no third-party requests).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts (open licences; the licence texts are in /fonts)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 600 800; font-stretch: 100%; font-display: swap;
  src: url("/fonts/bricolage-grotesque-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 600 800; font-stretch: 100%; font-display: swap;
  src: url("/fonts/bricolage-grotesque-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/dm-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/dm-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/fonts/dm-mono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/fonts/dm-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/dm-sans-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/dm-sans-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Handwriting and signature faces, for the two tools that draw with them. A
   browser fetches a file only when a page sets text in that face, so these
   rules cost other pages nothing but their own few lines. Latin only, except
   Kalam, which also carries Devanagari for Hindi. Homemade Apple is under the
   Apache License 2.0; the rest are under the SIL Open Font License. */
@font-face {
  font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/caveat-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Kalam"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/kalam-400-devanagari.woff2") format("woff2");
  unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;
}
@font-face {
  font-family: "Kalam"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/kalam-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Patrick Hand"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/patrick-hand-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Indie Flower"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/indie-flower-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Shadows Into Light"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/shadows-into-light-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Homemade Apple"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/homemade-apple-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Dancing Script"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/dancing-script-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Great Vibes"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/great-vibes-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sacramento"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/sacramento-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Allura"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/allura-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */
:root {
  --surface: #ffffff; --surface-sunken: #f3f3f7; --surface-raised: #ffffff;
  --night: #0b0d24; --on-night: #ffffff; --on-night-muted: #b4b7d0;
  --ink: #0d1026; --ink-muted: #585c74; --line: #e3e4ec; --line-strong: #80849b;
  --violet: #7d2ae8; --violet-hover: #6a1fd0; --on-violet: #ffffff; --violet-soft: #f1e8fd; --violet-text: #6a1fd0; --focus: #7d2ae8;
  --blush: #fde8ee; --peach: #feeddc; --tile: #dfefef;
  --success: #0b7a55; --success-soft: #e3f5ed; --danger: #c2410c; --danger-soft: #fdece4; --warning: #9a5b00; --warning-soft: #fdf1dd;
  --checker-a: #ffffff; --checker-b: #e9e9f0;
  --shadow-card: 0 1px 2px rgba(13, 16, 38, .06), 0 1px 1px rgba(13, 16, 38, .04);
  --shadow-pop: 0 12px 32px rgba(13, 16, 38, .14), 0 2px 6px rgba(13, 16, 38, .08);
  --shadow-drop: 0 0 0 6px rgba(125, 42, 232, .16);

  --font-display: "Bricolage Grotesque", "DM Sans", system-ui, sans-serif;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --space-6: 32px; --space-7: 48px; --space-8: 64px; --space-9: 96px;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-xl: 24px; --radius-pill: 999px;

  --wrap: 1120px; --wrap-narrow: 760px; --header-h: 64px;
  color-scheme: light;

  /* Names from the previous stylesheet, still used by a few inline styles. */
  --bg: var(--surface); --surface-2: var(--surface-sunken); --surface-3: var(--surface-sunken);
  --text: var(--ink); --text-soft: var(--ink-muted); --text-muted: var(--ink-muted);
  --border: var(--line); --border-strong: var(--line-strong);
  --brand: var(--violet-text); --brand-soft: var(--violet-soft); --radius: var(--radius-lg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #0b0d24; --surface-sunken: #14173a; --surface-raised: #1a1d42; --night: #05061a;
    --ink: #f2f2f8; --ink-muted: #a8abc6; --line: #2a2e57; --line-strong: #6b7099;
    --violet: #a97cf8; --violet-hover: #bb96fa; --on-violet: #14092c; --violet-soft: #271a52; --violet-text: #c4a6fb; --focus: #a97cf8;
    --blush: #3a1f36; --peach: #3a2a1e; --tile: #15313b;
    --success: #4fd1a5; --success-soft: #0f3a2e; --danger: #ff8f66; --danger-soft: #3d1d12; --warning: #f5b454; --warning-soft: #33260f;
    --checker-a: #1a1d42; --checker-b: #24284e;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
    --shadow-drop: 0 0 0 6px rgba(169, 124, 248, .22);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: #0b0d24; --surface-sunken: #14173a; --surface-raised: #1a1d42; --night: #05061a;
  --ink: #f2f2f8; --ink-muted: #a8abc6; --line: #2a2e57; --line-strong: #6b7099;
  --violet: #a97cf8; --violet-hover: #bb96fa; --on-violet: #14092c; --violet-soft: #271a52; --violet-text: #c4a6fb; --focus: #a97cf8;
  --blush: #3a1f36; --peach: #3a2a1e; --tile: #15313b;
  --success: #4fd1a5; --success-soft: #0f3a2e; --danger: #ff8f66; --danger-soft: #3d1d12; --warning: #f5b454; --warning-soft: #33260f;
  --checker-a: #1a1d42; --checker-b: #24284e;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
  --shadow-drop: 0 0 0 6px rgba(169, 124, 248, .22);
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   3. Reset + base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }

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

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

body {
  font-family: var(--font-sans); font-size: 15px; line-height: 22px;
  color: var(--ink); background: var(--surface);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  min-height: 100vh; display: flex; flex-direction: column;
}

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

h1, h2, h3, h4 { color: var(--ink); text-wrap: balance; }
h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: 44px; line-height: 48px; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(26px, 1.4rem + 1.3vw, 36px); line-height: 1.15; }
h3 { font-size: 18px; line-height: 26px; font-weight: 600; }
h4 { font-size: 15px; line-height: 22px; font-weight: 600; }
p { color: var(--ink-muted); }

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

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

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

code, kbd, pre { font-family: var(--font-mono); font-size: .9em; }
code { background: var(--surface-sunken); padding: .1em .36em; border-radius: var(--radius-sm); color: var(--ink); }
pre { background: var(--surface-sunken); border-radius: var(--radius-md); padding: var(--space-4); overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }
::selection { background: var(--violet); color: var(--on-violet); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--space-6); }
.wrap-narrow { max-width: calc(var(--wrap-narrow) + 2 * var(--space-6)); }
@media (max-width: 640px) { .wrap { padding-inline: var(--space-4); } }

.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: 8px; top: -60px; z-index: 200; background: var(--violet); color: var(--on-violet); padding: 10px 16px; border-radius: var(--radius-md); font-weight: 600; transition: top .15s; }
.skip-link:focus { top: 8px; }

main { flex: 1 0 auto; }
section { scroll-margin-top: calc(var(--header-h) + 12px); }

.icon { flex: none; display: block; }
.figure { font-family: var(--font-mono); font-size: 13px; line-height: 18px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.figure b { color: var(--ink); font-weight: 500; }
.checker, .preview-stage, .oi-stage, .crop-stage, .cmp {
  background-color: var(--checker-a);
  background-image: linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%), linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--night); color: var(--on-night); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.header-inner { display: flex; align-items: center; gap: var(--space-5); min-height: var(--header-h); }
.logo { display: flex; align-items: center; gap: var(--space-2); flex: none; font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; letter-spacing: -.02em; color: var(--on-night); }
.logo:hover { text-decoration: none; }
.logo i { display: block; width: 22px; height: 22px; border-radius: var(--radius-sm); background: var(--violet); position: relative; overflow: hidden; }
.logo i::after { content: ""; position: absolute; inset: 0 0 0 50%; opacity: .9; background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%), linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%); background-size: 11px 11px; background-position: 0 0, 5.5px 5.5px; }
.logo-text { white-space: nowrap; }

.nav-toggle, .theme-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--radius-md); background: transparent; color: var(--on-night); }
.nav-toggle:hover, .theme-toggle:hover { background: rgba(255, 255, 255, .08); }
.nav-toggle { margin-left: auto; }
.nav-toggle .icon-close, .nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
}

.site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--night); border-bottom: 1px solid rgba(255, 255, 255, .08); padding: var(--space-3) var(--space-4) var(--space-4); max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.site-nav a { display: block; padding: 10px var(--space-3); border-radius: var(--radius-md); color: var(--on-night-muted); font-size: 14px; line-height: 20px; font-weight: 500; }
.site-nav a:hover { color: var(--on-night); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--on-night); background: rgba(255, 255, 255, .08); }
.nav-actions { display: flex; gap: var(--space-2); align-items: center; margin-top: var(--space-3); }

@media (min-width: 940px) {
  .nav-toggle { display: none; }
  /* flex, not block: as a block container the list and .nav-actions would stack. */
  .site-nav { display: flex; align-items: center; gap: var(--space-3); position: static; background: none; border: 0; padding: 0; margin-left: auto; overflow: visible; max-height: none; }
  .site-nav ul { flex-direction: row; align-items: center; gap: 2px; flex-wrap: nowrap; }
  .site-nav a { padding: var(--space-2) var(--space-3); white-space: nowrap; }
  .nav-actions { margin-top: 0; }
}
@media (min-width: 940px) and (max-width: 1080px) { .site-nav a { padding: var(--space-2); font-size: 13px; } }

/* Breadcrumb: the first line of the night band that opens every page. */
.breadcrumb { background: var(--night); padding: var(--space-4) 0 0; font-size: 13px; line-height: 18px; }
.breadcrumb ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.breadcrumb li { display: flex; align-items: center; gap: 6px; color: var(--on-night-muted); }
.breadcrumb li + li::before { content: "\203A"; color: var(--on-night-muted); opacity: .7; }
.breadcrumb a { color: var(--on-night-muted); }
.breadcrumb a:hover { color: var(--on-night); }
.breadcrumb [aria-current] { color: var(--on-night); font-weight: 500; }

/* --------------------------------------------------------------------------
   5. Buttons, badges, notes
   -------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-4); font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; text-align: center; border: 1px solid transparent; border-radius: var(--radius-md); background: var(--surface-sunken); color: var(--ink); cursor: pointer; transition: background-color .15s, border-color .15s; }
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-lg { height: 48px; padding: 0 var(--space-5); font-size: 15px; }
.btn-sm { height: 32px; padding: 0 var(--space-3); font-size: 13px; }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: var(--violet); color: var(--on-violet); }
.btn-primary:hover:not(:disabled) { background: var(--violet-hover); }
.btn-outline, .btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover:not(:disabled), .btn-secondary:hover:not(:disabled) { background: var(--surface-sunken); }
.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunken); color: var(--ink); }
.btn-inverse { background: var(--on-night); color: #0b0d24; }
.btn-inverse:hover { background: #e9e9f0; }

.badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; background: var(--surface-sunken); color: var(--ink-muted); }
.badge-brand, .badge-violet { background: var(--violet-soft); color: var(--violet-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-night { background: rgba(255, 255, 255, .1); color: var(--on-night); }

.note { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: 14px; line-height: 20px; background: var(--surface-sunken); color: var(--ink-muted); }
.note > .icon { margin-top: 2px; }
.note strong { color: var(--ink); }
.note a { text-decoration: underline; text-underline-offset: 3px; }
.note-privacy { background: var(--success-soft); color: var(--success); font-weight: 500; }
.note-warn { background: var(--warning-soft); color: var(--ink); }
.note-warn strong { color: var(--warning); }
.note-info { background: var(--violet-soft); color: var(--ink); }

/* --------------------------------------------------------------------------
   6. Form controls
   -------------------------------------------------------------------------- */
label { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink); }

input[type="text"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; height: 40px; padding: 0 var(--space-3); font-size: 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2380849b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 36px;
}
textarea { height: auto; min-height: 120px; padding: var(--space-3); resize: vertical; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type="color"] { width: 48px; height: 40px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; }
input[type="number"] { -moz-appearance: textfield; font-family: var(--font-mono); font-size: 13px; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: var(--radius-pill); background: linear-gradient(to right, var(--violet) var(--range-fill, 80%), var(--surface-sunken) var(--range-fill, 80%)); box-shadow: inset 0 0 0 1px var(--line-strong); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--line-strong); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: var(--radius-pill); background: var(--violet); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: var(--radius-pill); background: var(--surface-raised); border: 3px solid var(--violet); box-shadow: var(--shadow-card); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: var(--radius-pill); background: var(--surface-raised); border: 3px solid var(--violet); }
input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }

.switch { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 40px; height: 24px; margin-top: 1px; border-radius: var(--radius-pill); background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--line-strong); position: relative; transition: background-color .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-raised); box-shadow: 0 0 0 1px var(--line-strong); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--violet); box-shadow: none; }
.switch input:checked + .switch-track::after { transform: translateX(16px); box-shadow: none; background: var(--on-violet); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-label { font-size: 14px; line-height: 20px; font-weight: 600; }
.switch-hint { font-size: 13px; line-height: 18px; color: var(--ink-muted); font-weight: 400; }

.check { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid transparent; border-radius: var(--radius-md); background: var(--surface-sunken); cursor: pointer; font-size: 13px; line-height: 18px; font-weight: 500; }
.check:hover { border-color: var(--line-strong); }
.check input { margin: 1px 0 0; width: 16px; height: 16px; accent-color: var(--violet); flex: none; }
.check:has(input:checked) { background: var(--violet-soft); border-color: var(--violet); }
.check span small { display: block; color: var(--ink-muted); font-weight: 400; font-size: 12px; }

.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--surface-sunken); border-radius: var(--radius-md); max-width: 100%; }
.seg button { height: 30px; padding: 0 var(--space-3); border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface-raised); color: var(--violet-text); box-shadow: var(--shadow-card); }

.presets { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.preset { height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; }
.preset[aria-pressed="true"] { background: var(--violet-soft); border-color: var(--violet); color: var(--violet-text); }
.preset:disabled { opacity: .45; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   7. Search
   -------------------------------------------------------------------------- */
.search { position: relative; width: 100%; }
.search-input-wrap { position: relative; display: flex; align-items: center; }
.search-input-wrap > .icon { position: absolute; left: 14px; color: var(--ink-muted); pointer-events: none; }
.search input[type="search"] { height: 48px; padding: 0 44px 0 42px; font-size: 15px; }
.search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear { position: absolute; right: 8px; width: 32px; height: 32px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); display: none; place-items: center; }
.search-clear:hover { background: var(--surface-sunken); color: var(--ink); }
.search.has-value .search-clear { display: inline-grid; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + var(--space-2)); z-index: 60; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); max-height: 340px; overflow-y: auto; padding: var(--space-2); display: none; text-align: left; }
.search-results.open { display: block; }
.search-results a { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); color: var(--ink); }
.search-results a:hover, .search-results a.active { background: var(--surface-sunken); text-decoration: none; }
.search-results a.active { background: var(--violet-soft); }
.search-results .r-ico { color: var(--ink-muted); flex: none; }
.search-results .r-name { display: block; font-size: 14px; line-height: 20px; font-weight: 600; }
.search-results .r-desc { display: block; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.search-empty { padding: var(--space-4); text-align: center; color: var(--ink-muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   8. Hero (the night band that opens a page)
   -------------------------------------------------------------------------- */
.hero { background: var(--night); color: var(--on-night); padding-block: var(--space-7) var(--space-8); }
.breadcrumb + main > .hero { padding-top: var(--space-5); }
.hero h1 { color: var(--on-night); max-width: 20ch; }
.hero h1 em { font-style: normal; color: var(--violet); }
.hero .badge { margin-bottom: var(--space-4); }
.hero-sub, .hero .lead { margin-top: var(--space-4); font-size: 17px; line-height: 26px; color: var(--on-night-muted); max-width: 52ch; }
.hero-meta { margin-top: var(--space-4); font-size: 13px; line-height: 18px; color: var(--on-night-muted); display: flex; flex-wrap: wrap; gap: 6px var(--space-3); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--space-7); align-items: center; }
.hero-grid.is-single { grid-template-columns: minmax(0, 1fr); }
.page-home .hero h1 { font-size: 64px; line-height: 68px; }
.page-tool .hero h1 { font-size: clamp(36px, 1.6rem + 2.2vw, 52px); line-height: 1.08; }
.hero-plain { padding-block: var(--space-6) var(--space-7); }
.hero-plain h1 { max-width: 26ch; }
@media (max-width: 900px) {
  .hero { padding-block: var(--space-6) var(--space-7); }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .page-home .hero h1 { font-size: 44px; line-height: 48px; }
}
@media (max-width: 480px) { h1, .page-home .hero h1 { font-size: 36px; line-height: 40px; } }

.trust { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: var(--space-5) 0 0; padding: 0; list-style: none; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-muted); }
.trust li { display: inline-flex; align-items: center; gap: var(--space-2); }
.trust .icon { color: var(--ink); }
.hero .trust { color: var(--on-night-muted); }
.hero .trust .icon { color: var(--on-night); }

/* The white card on the right of a hero: the dropzone, or the home search. */
.hero-card { background: var(--surface); color: var(--ink); border-radius: var(--radius-xl); padding: var(--space-5); display: grid; gap: var(--space-4); }
.hero-card h2 { font-family: var(--font-sans); font-size: 18px; line-height: 26px; font-weight: 600; letter-spacing: 0; }

/* --------------------------------------------------------------------------
   9. Dropzone
   -------------------------------------------------------------------------- */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-2); min-height: 280px; padding: var(--space-6); border: 2px dashed var(--line-strong); border-radius: var(--radius-xl); background: var(--surface); color: var(--ink); cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.dropzone:hover { border-color: var(--violet); }
.dropzone.dragover { border-color: var(--violet); border-style: solid; background: var(--violet-soft); box-shadow: var(--shadow-drop); }
.dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dz-ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: var(--radius-lg); background: var(--violet-soft); color: var(--violet-text); margin-bottom: var(--space-2); }
.dropzone.dragover .dz-ico { background: var(--violet); color: var(--on-violet); }
.dz-title { font-size: 18px; line-height: 26px; font-weight: 600; color: var(--ink); }
.dropzone p { color: var(--ink-muted); }
.dz-btn { margin-top: var(--space-3); pointer-events: none; }
.dz-formats { font-size: 13px; line-height: 18px; margin-top: var(--space-2); }
@media (max-width: 640px) { .dropzone { min-height: 220px; padding: var(--space-5) var(--space-4); } }

/* --------------------------------------------------------------------------
   10. Sections, tiles, steps, cards
   -------------------------------------------------------------------------- */
.section { padding-top: var(--space-8); }
.page-home .section { padding-top: var(--space-9); }
.section-head { margin-bottom: var(--space-6); }
.section-head p, .section-lead { margin-top: var(--space-2); color: var(--ink-muted); font-size: 17px; line-height: 26px; max-width: 60ch; }
.page-home .section-head h2 { font-size: 44px; line-height: 50px; }
@media (max-width: 640px) {
  .section, .page-home .section { padding-top: var(--space-7); }
  .page-home .section-head h2 { font-size: 32px; line-height: 38px; }
  .section-head { margin-bottom: var(--space-5); }
}

.cat-chips { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-2); margin-bottom: var(--space-4); scrollbar-width: thin; }
.cat-chips button { height: 32px; padding: 0 var(--space-3); white-space: nowrap; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; }
.cat-chips button[aria-pressed="true"] { background: var(--violet-soft); border-color: var(--violet); color: var(--violet-text); }

/* ToolTile: an icon and a tool name on a sunken tile. */
.tool-grid, .related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 900px) { .tool-grid, .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .tool-grid, .related-grid { grid-template-columns: minmax(0, 1fr); } }
.tool-card, .related-card { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; min-width: 0; padding: var(--space-3) var(--space-4); background: var(--tile); border: 1px solid transparent; border-radius: var(--radius-md); color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 600; }
.tool-card:hover, .related-card:hover { border-color: var(--line-strong); text-decoration: none; }
.tool-card > .icon, .related-card > .icon { color: var(--ink-muted); }
.tool-card { align-items: flex-start; }
.tool-card > .icon { margin-top: 1px; }
.tool-card h3 { font-size: 14px; line-height: 20px; font-weight: 600; }
.tool-card p { margin-top: 2px; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--ink-muted); }
.tool-card > div, .related-card > span { min-width: 0; }
.related-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .related-grid.cols-2 { grid-template-columns: minmax(0, 1fr); } }
.related-card > span { overflow: hidden; text-overflow: ellipsis; }

/* StepCard */
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); counter-reset: step; }
@media (max-width: 800px) { .steps { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); } }
.steps li { padding: var(--space-5); background: var(--surface-sunken); border-radius: var(--radius-lg); color: var(--ink-muted); }
.steps li::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-pill); background: var(--violet); color: var(--on-violet); font-size: 13px; font-weight: 700; }
.steps li strong { display: block; margin: var(--space-4) 0 var(--space-1); color: var(--ink); font-size: 18px; line-height: 26px; font-weight: 600; }

/* Plain cards on a sunken surface: use cases, benefits. */
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
.feature-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .feature-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .feature-grid, .feature-grid.cols-4 { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); } }
.feature { padding: var(--space-5); background: var(--surface-sunken); border-radius: var(--radius-lg); }
.feature .f-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--surface); color: var(--violet-text); margin-bottom: var(--space-4); }
.feature h3 { margin-bottom: var(--space-1); }
.feature p a { text-decoration: underline; text-underline-offset: 3px; }

/* Feature rows: a soft panel with a UI fragment beside a short explanation. */
.frow { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-7); align-items: center; }
.frow + .frow { margin-top: var(--space-8); }
.frow.flip .shot { order: 2; }
.frow h3 { margin-bottom: var(--space-3); font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -.01em; }
.frow p { font-size: 17px; line-height: 26px; max-width: 52ch; }
.shot { border-radius: var(--radius-xl); padding: var(--space-6); min-height: 280px; display: grid; place-items: center; }
.shot.blush { background: var(--blush); }
.shot.peach { background: var(--peach); }
.float { width: 100%; max-width: 320px; background: var(--surface-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: var(--space-4); display: grid; gap: var(--space-3); color: var(--ink); }
.float .badge { justify-self: start; }
.float .mini { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); font-size: 13px; font-weight: 600; }
.float .bar { height: 6px; border-radius: var(--radius-pill); background: linear-gradient(to right, var(--violet) 75%, var(--surface-sunken) 75%); }
@media (max-width: 800px) {
  .frow { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .frow.flip .shot { order: 0; }
  .frow + .frow { margin-top: var(--space-7); }
  .shot { min-height: 0; padding: var(--space-5); }
}

/* FormatChip */
.fmt-groups { display: grid; gap: var(--space-5); }
.fmt-groups h3 { margin-bottom: var(--space-3); font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink-muted); }
.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; list-style: none; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: var(--space-1); height: 32px; padding: 0 var(--space-3); font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.chip.out { background: var(--violet-soft); border-color: var(--violet); color: var(--violet-text); }

/* The night band that closes a page. */
.cta { background: var(--night); color: var(--on-night); border-radius: var(--radius-xl); padding: var(--space-8) var(--space-6); text-align: center; display: grid; justify-items: center; gap: var(--space-4); }
.cta h2 { color: var(--on-night); font-size: clamp(30px, 1.5rem + 2vw, 44px); line-height: 1.12; font-weight: 800; }
.cta p { color: var(--on-night-muted); font-size: 17px; line-height: 26px; max-width: 52ch; }
@media (max-width: 640px) { .cta { padding: var(--space-7) var(--space-4); } }

/* Guides */
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
@media (max-width: 700px) { .guide-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); } }
.guide-card { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; padding: var(--space-5); background: var(--surface-sunken); border: 1px solid transparent; border-radius: var(--radius-lg); color: var(--ink); }
.guide-card:hover { border-color: var(--line-strong); text-decoration: none; }
.guide-card h2, .guide-card h3 { font-family: var(--font-sans); font-size: 18px; line-height: 26px; font-weight: 600; letter-spacing: 0; }
.guide-card p { font-size: 15px; line-height: 22px; }
.t-cat { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-muted); }
.guide-more { margin-top: auto; padding-top: var(--space-2); display: inline-flex; align-items: center; gap: var(--space-1); font-size: 14px; font-weight: 600; color: var(--violet-text); }
.guide-meta { display: flex; flex-wrap: wrap; gap: 6px var(--space-3); align-items: center; }
.guide-body { max-width: 72ch; }
.guide-body h2 { margin-top: var(--space-7); }
.guide-body h2:first-child { margin-top: 0; }
.guide-body .quick-answer { font-size: 17px; }
.toc { background: var(--surface-sunken); border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-7); max-width: 72ch; }
.toc-head { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); margin-bottom: var(--space-3); }
.toc ol { margin: 0; padding-left: 20px; display: grid; gap: var(--space-2); }
.toc li { font-size: 15px; }
.toc li::marker { color: var(--ink-muted); font-family: var(--font-mono); font-size: 13px; }
.toc a { color: var(--ink); }
.toc a:hover { color: var(--violet-text); }

/* --------------------------------------------------------------------------
   11. Tool workspace
   -------------------------------------------------------------------------- */
.tool-head { padding-bottom: var(--space-5); }

.desk { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-5); align-items: start; margin-top: var(--space-7); }
.desk.is-stack { grid-template-columns: minmax(0, 1fr); }
.desk:has(> .desk-main > #result-panel.hidden):has(> #settings-panel.hidden) { margin-top: 0; }
.desk-main { display: grid; gap: var(--space-5); min-width: 0; }
.desk-main > section { display: grid; gap: var(--space-4); min-width: 0; }
/* The crop box already shows the original, so a crop tool keeps only the result card. */
.has-cropper .compare { grid-template-columns: minmax(0, 1fr); }
.has-cropper .compare .preview-card:first-child { display: none; }
/* A page that adds to the picture (text, a logo, a border) shows the result alone, and large. */
.is-solo .compare { grid-template-columns: minmax(0, 1fr); }
.is-solo .compare .preview-card:first-child { display: none; }
.is-solo .preview-stage img { max-height: 560px; }
/* On a narrow screen the settings move up to sit under the preview, ahead of
   the figures: the wrappers dissolve so their children can be ordered. */
@media (max-width: 900px) {
  .desk { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-4); margin-top: var(--space-6); }
  .desk-main, .desk-main > #result-panel:not(.hidden) { display: contents; }
  .desk .cropper-host { order: 1; }
  .desk #cmp { order: 2; }
  .desk #cmp-help { order: 3; }
  .desk #compare { order: 4; }
  .desk #settings-panel { order: 5; }
  .desk #outputs, .desk #meta-report, .desk #text-output { order: 6; }
  .desk #stats { order: 7; }
  .desk #result-note { order: 8; }
  /* A page that is a form to fill in (the EXIF editor) puts the form first. */
  .desk.is-form #settings-panel { order: 0; }
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-pad { padding: var(--space-5); }
.desk-side { display: grid; gap: var(--space-4); padding: var(--space-5); min-width: 0; }
.desk-side > h2 { font-family: var(--font-sans); font-size: 18px; line-height: 26px; font-weight: 600; letter-spacing: 0; }
@media (min-width: 901px) { .desk:not(.is-stack) > .desk-side { position: sticky; top: calc(var(--header-h) + var(--space-4)); max-height: calc(100vh - var(--header-h) - var(--space-6)); overflow-y: auto; } }

.controls { display: grid; gap: var(--space-4); }
.control-group { display: grid; gap: var(--space-2); min-width: 0; }
.control-group > .cg-label { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.cg-label .cg-value { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.cg-hint { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.cg-hint.warn { color: var(--warning); }
.cg-stack { display: grid; gap: var(--space-2); }
.control-row { display: grid; gap: var(--space-3); }
.control-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.control-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.control-grid { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.slider-scale { display: flex; justify-content: space-between; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.dim-lock { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; font-weight: 500; color: var(--ink-muted); cursor: pointer; }
.dim-lock input { width: 16px; height: 16px; accent-color: var(--violet); }
.field-suffix { position: relative; }
.field-suffix > span { position: absolute; right: var(--space-3); top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--ink-muted); pointer-events: none; }
.field-suffix input { padding-right: 40px; }

.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.actions .spacer { flex: 1; }
.desk-side .dl { display: grid; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.desk-side .dl:not(:has(> :not(.hidden))) { display: none; }
/* A long panel scrolls inside the window; the download stays in reach at its
   foot instead of scrolling out of sight with the controls. */
@media (min-width: 901px) {
  .desk:not(.is-stack) > .desk-side > .dl { position: sticky; bottom: calc(-1 * var(--space-5)); z-index: 1; margin-bottom: calc(-1 * var(--space-5)); padding-bottom: var(--space-5); background: var(--surface); }
}
.textout { display: grid; gap: var(--space-2); }
.busy { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 13px; color: var(--ink-muted); }

/* CompareSlider: the original on the left, the result on the right. */
.cmp { position: relative; overflow: hidden; border-radius: var(--radius-lg); user-select: none; touch-action: pan-y; cursor: ew-resize; width: 100%; max-height: 560px; aspect-ratio: 3 / 2; margin-inline: auto; }
.cmp-view { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.cmp img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; pointer-events: none; }
.ctag { position: absolute; top: var(--space-3); display: inline-flex; gap: var(--space-2); align-items: center; height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-sm); background: #0b0d24; color: #ffffff; font-size: 12px; font-weight: 600; pointer-events: none; max-width: 45%; white-space: nowrap; overflow: hidden; }
.ctag b { font-family: var(--font-mono); font-weight: 500; color: #b4b7d0; }
.ctag.l { left: var(--space-3); }
.ctag.r { right: var(--space-3); }
.ctag.is-new { animation: tag-new 1s ease-out; }
@keyframes tag-new { from { background: var(--violet); } }
/* One line at the foot of the frame: what is happening, or what was measured.
   It sits over the handle's line, and lets a drag pass through to it. */
.cnote { position: absolute; left: 50%; bottom: var(--space-3); transform: translateX(-50%); display: flex; align-items: center; gap: var(--space-2); width: max-content; max-width: calc(100% - 2 * var(--space-3)); padding: 6px var(--space-3); border-radius: var(--radius-sm); background: #0b0d24; color: #ffffff; font-size: 12px; line-height: 16px; font-weight: 600; text-align: center; pointer-events: none; }
.cnote .spinner { width: 12px; height: 12px; border-color: rgba(255, 255, 255, .3); border-top-color: #ffffff; }
.cline { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #ffffff; box-shadow: 0 0 0 1px #0b0d24; }
.cknob { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 40px; height: 40px; transform: translate(-50%, -50%); border-radius: var(--radius-pill); background: var(--violet); color: var(--on-violet); box-shadow: var(--shadow-pop); border: 2px solid #ffffff; cursor: ew-resize; }
/* Zoomed in, the picture is larger than its frame: a drag moves the picture,
   and only the handle (with a wider strip to catch it by) moves the split. */
.cmp.is-zoomed { cursor: grab; touch-action: none; }
.cmp.is-zoomed.is-panning { cursor: grabbing; }
.cmp.is-zoomed .cline { cursor: ew-resize; }
.cmp.is-zoomed .cline::before { content: ""; position: absolute; top: 0; bottom: 0; left: -14px; right: -14px; }
.cmp-bar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.cmp-help { flex: 1 1 280px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.cmp-zoom { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.cmp-zoom-label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }

/* Side-by-side preview cards: used when the two images differ in shape. */
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.compare.single { grid-template-columns: minmax(0, 1fr); }
/* With the slider above, the cards keep only their figures. */
.compare.is-slider .preview-stage { display: none; }
@media (max-width: 640px) { .compare, .compare.is-slider { grid-template-columns: minmax(0, 1fr); } }
.preview-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface-sunken); border-radius: var(--radius-lg); overflow: hidden; }
.preview-card > header { padding: var(--space-3) var(--space-4) 0; }
.preview-card > header h3 { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.preview-stage { position: relative; display: grid; place-items: center; min-height: 200px; margin: var(--space-3) var(--space-4) 0; padding: var(--space-3); border-radius: var(--radius-md); }
.preview-stage img, .preview-stage canvas { max-width: 100%; max-height: 360px; width: auto; height: auto; object-fit: contain; border-radius: var(--radius-sm); }
.preview-meta { list-style: none; margin: 0; padding: var(--space-3) var(--space-4) var(--space-4); display: grid; gap: var(--space-1); }
.preview-meta li { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 13px; line-height: 18px; }
.preview-meta .k { color: var(--ink-muted); }
.preview-meta .v { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; word-break: break-all; color: var(--ink); }
.preview-meta .v.good { color: var(--success); }
.preview-meta .v.bad { color: var(--danger); }
.placeholder-msg { color: var(--ink-muted); font-size: 14px; text-align: center; padding: var(--space-6) var(--space-3); }

.preview-stage.is-pickable, .preview-stage.is-pickable img { cursor: crosshair; }
.pick-hint { position: absolute; left: 50%; bottom: var(--space-2); transform: translateX(-50%); background: #0b0d24; color: #ffffff; font-size: 12px; font-weight: 600; white-space: nowrap; padding: 4px 10px; border-radius: var(--radius-sm); pointer-events: none; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 1040px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-sunken); min-width: 0; }
.stat .s-k { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.stat .s-v { margin-top: 2px; font-family: var(--font-mono); font-size: 15px; line-height: 22px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); word-break: break-word; }
.stat.is-good .s-v { color: var(--success); }
.stat.is-bad .s-v { color: var(--danger); }

.progress { height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--violet); transition: width .2s; }

.sticky-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); background: var(--surface-raised); border-top: 1px solid var(--line); box-shadow: var(--shadow-pop); transform: translateY(110%); transition: transform .2s ease; }
.sticky-bar.show { transform: translateY(0); }
.sticky-bar .btn { width: 100%; height: 48px; }
@media (min-width: 901px) { .sticky-bar { display: none; } }

.outputs { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.output-item { display: flex; flex-direction: column; gap: var(--space-2); align-items: center; text-align: center; min-width: 0; padding: var(--space-3); background: var(--surface-sunken); border-radius: var(--radius-md); }
.output-item .oi-stage { width: 100%; min-height: 84px; display: grid; place-items: center; border-radius: var(--radius-sm); padding: 6px; }
.output-item img { max-height: 84px; width: auto; }
.output-item .oi-name { font-size: 13px; line-height: 18px; font-weight: 600; word-break: break-all; }
.output-item .oi-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
/* The pieces of a split picture, laid out as they were cut and a little
   apart. Each one is a button that saves it. */
.outputs.is-mosaic { gap: 4px; width: 100%; margin-inline: auto; padding: var(--space-3); background: var(--surface-sunken); border-radius: var(--radius-lg); }
.mosaic-tile { position: relative; display: block; min-width: 0; padding: 0; border: 0; border-radius: 3px; background: none; line-height: 0; overflow: hidden; cursor: pointer; }
.mosaic-tile img { display: block; width: 100%; height: auto; }
.mosaic-tile:hover, .mosaic-tile:focus-visible { outline: 3px solid var(--violet); outline-offset: -3px; }
.outputs.is-dense .mosaic-n { display: none; }
/* The pages of a PDF, drawn as sheets of paper with each picture where it will sit. */
.outputs.is-sheets { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: var(--space-4); padding: var(--space-5) var(--space-4); background: var(--surface-sunken); border-radius: var(--radius-lg); }
.sheet { display: grid; justify-items: center; gap: var(--space-2); margin: 0; min-width: 0; }
.sheet canvas { display: block; max-width: 100%; height: auto !important; background: #ffffff; border-radius: 2px; box-shadow: 0 1px 2px rgba(11, 13, 36, .18), 0 6px 16px rgba(11, 13, 36, .12); }
.sheet figcaption { font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
/* The box a signature is drawn in. White in both themes: it is paper. */
.sign-pad { padding: var(--space-3); background: var(--surface-sunken); border-radius: var(--radius-lg); }
.sign-canvas { display: block; width: 100%; aspect-ratio: 5 / 2; background: #ffffff; border-radius: var(--radius-md); touch-action: none; cursor: crosshair; }
/* A finger needs more height than a mouse does. */
@media (max-width: 640px) { .sign-canvas { aspect-ratio: 3 / 2; } }
.sign-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.sign-acts .crop-readout { flex: 1 1 220px; margin: 0; text-align: left; font-family: var(--font-sans); }
/* The handwriting page's text box, in the wide column. 16px type: a phone zooms the page when a smaller field is tapped. */
.write-box { padding: var(--space-4); background: var(--surface-sunken); border-radius: var(--radius-lg); }
.write-box textarea { min-height: 170px; background: var(--surface); font-family: var(--font-sans); font-size: 16px; line-height: 24px; }
/* A written page is shown at the full width of the column, so that it can be read. */
.preview-stage.is-page { padding: var(--space-2); background: none; }
.preview-stage.is-page img { width: 100%; max-height: none; box-shadow: 0 1px 2px rgba(11, 13, 36, .18), 0 6px 16px rgba(11, 13, 36, .12); }

/* FileRow: the batch queue. */
.queue { display: grid; gap: var(--space-3); margin-top: var(--space-7); }
.queue + .desk { margin-top: var(--space-5); }
.queue-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-3); background: var(--surface-sunken); border: 2px solid transparent; border-radius: var(--radius-md); min-width: 0; cursor: pointer; }
.queue-item:hover { border-color: var(--line-strong); }
.queue-item.is-current { border-color: var(--violet); }
.queue-item .q-thumb { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-muted); font-family: var(--font-mono); font-size: 13px; }
.queue-item .q-name { font-size: 14px; line-height: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item .q-meta { font-family: var(--font-mono); font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.queue-item .q-status { font-size: 12px; font-weight: 600; color: var(--ink-muted); white-space: nowrap; }
.queue-item .q-status.ok { color: var(--success); }
.queue-item .q-status.err { color: var(--danger); }
/* Pictures waiting to be joined, in the order they will appear. Each has its
   own buttons to move it or take it out, and the last tile adds more. */
.queue.tray { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: stretch; }
.tray-item { display: grid; gap: var(--space-2); align-content: start; width: 132px; padding: var(--space-2); background: var(--surface-sunken); border-radius: var(--radius-md); }
.tray-pic { position: relative; display: grid; place-items: center; height: 88px; border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.tray-thumb { display: block; max-width: 100%; max-height: 88px; width: auto; height: auto; }
.tray-n, .mosaic-n { position: absolute; top: 5px; left: 5px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill); background: #0b0d24; color: #ffffff; font-family: var(--font-mono); font-size: 12px; line-height: 1; font-weight: 500; pointer-events: none; }
.tray-name { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.tray-btn { display: grid; place-items: center; height: 36px; border: 0; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.tray-btn:hover:not(:disabled) { background: var(--violet-soft); color: var(--violet-text); }
.tray-btn:disabled { opacity: .35; cursor: default; }
.tray-add { display: grid; place-items: center; align-content: center; gap: var(--space-2); width: 132px; min-height: 164px; border: 2px dashed var(--line-strong); border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); font-size: 13px; font-weight: 600; }
.tray-add:hover { border-color: var(--violet); color: var(--violet-text); }
@media (max-width: 640px) {
  .queue.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .tray-item, .tray-add { width: auto; }
}

/* Cropper */
.cropper-host:empty { display: none; }
.crop-stage { position: relative; overflow: hidden; touch-action: none; user-select: none; border-radius: var(--radius-lg); display: grid; place-items: center; padding: var(--space-3); }
.crop-holder { position: relative; line-height: 0; max-width: 100%; }
.crop-holder img, .crop-holder canvas { max-width: 100%; max-height: 460px; width: auto; border-radius: var(--radius-sm); }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(11, 13, 36, .55); cursor: move; }
.crop-box::before, .crop-box::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.crop-box::before { border-left: 1px solid rgba(255, 255, 255, .45); border-right: 1px solid rgba(255, 255, 255, .45); left: 33.33%; right: 33.33%; }
.crop-box::after { border-top: 1px solid rgba(255, 255, 255, .45); border-bottom: 1px solid rgba(255, 255, 255, .45); top: 33.33%; bottom: 33.33%; }
.crop-handle { position: absolute; width: 28px; height: 28px; background: transparent; touch-action: none; }
.crop-handle::after { content: ""; position: absolute; width: 14px; height: 14px; background: var(--violet); border: 2px solid #fff; border-radius: var(--radius-pill); top: 50%; left: 50%; transform: translate(-50%, -50%); }
.crop-handle[data-h="nw"] { top: -14px; left: -14px; cursor: nwse-resize; }
.crop-handle[data-h="ne"] { top: -14px; right: -14px; cursor: nesw-resize; }
.crop-handle[data-h="sw"] { bottom: -14px; left: -14px; cursor: nesw-resize; }
.crop-handle[data-h="se"] { bottom: -14px; right: -14px; cursor: nwse-resize; }
/* On the censor page the box marks what will be hidden, so the rest of the
   picture stays clear and the box itself is tinted. Areas set aside earlier
   are outlined under it. */
.crop-stage.is-mark .crop-box { box-shadow: 0 0 0 1px rgba(11, 13, 36, .6); background: rgba(125, 42, 232, .28); }
.crop-stage.is-mark .crop-box::before, .crop-stage.is-mark .crop-box::after { display: none; }
/* The circle page shows its crop box as the circle that will be cut. */
.crop-stage.is-round .crop-box { border-radius: 50%; }
.crop-stage.is-round .crop-box::before, .crop-stage.is-round .crop-box::after { display: none; }
/* Freehand crop and the colour picker draw over the picture itself. */
.stage-ink { position: absolute; left: 0; top: 0; width: 100% !important; height: 100% !important; max-height: none !important; pointer-events: none; }
.stage-lasso .crop-holder, .stage-pick .crop-holder { cursor: crosshair; }
/* On the profile grid page the box shows where it will be cut into tiles. */
.crop-stage.is-tiles .crop-box::before { left: 0; right: 0; border: 0; background: linear-gradient(to right, rgba(255, 255, 255, .8) 1px, transparent 1px) 0 0 / calc(100% / var(--tile-cols, 3)) 100%; }
.crop-stage.is-tiles .crop-box::after { top: 0; bottom: 0; border: 0; background: linear-gradient(to bottom, rgba(255, 255, 255, .8) 1px, transparent 1px) 0 0 / 100% calc(100% / var(--tile-rows, 3)); }
/* Nine positions, laid out the way they fall on the picture. */
.pos-grid { display: inline-grid; grid-template-columns: repeat(3, 44px); gap: 3px; padding: 3px; background: var(--surface-sunken); border-radius: var(--radius-md); }
.pos-grid button { height: 36px; border: 0; border-radius: 7px; background: transparent; position: relative; }
.pos-grid button::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 2px; background: var(--line-strong); }
.pos-grid button:hover::after { background: var(--ink-muted); }
.pos-grid button[aria-pressed="true"] { background: var(--surface-raised); box-shadow: var(--shadow-card); }
.pos-grid button[aria-pressed="true"]::after { background: var(--violet); }
/* Picked colours. */
.swatch-list { display: grid; gap: var(--space-2); }
.swatch-row { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; }
.swatch { flex: none; width: 28px; height: 28px; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line-strong); background-color: var(--checker-a); background-image: linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%), linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%); background-size: 10px 10px; background-position: 0 0, 5px 5px; }
.swatch-code { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crop-saved { position: absolute; border: 2px dashed #fff; background: rgba(11, 13, 36, .55); box-shadow: 0 0 0 1px rgba(11, 13, 36, .6); pointer-events: none; }
.crop-readout { margin-top: var(--space-2); font-family: var(--font-mono); font-size: 13px; line-height: 18px; color: var(--ink-muted); text-align: center; font-variant-numeric: tabular-nums; }

.code-out { width: 100%; min-height: 150px; max-height: 320px; overflow: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; word-break: break-all; white-space: pre-wrap; background: var(--surface-sunken); border-radius: var(--radius-md); padding: var(--space-3); color: var(--ink); }

.meta-report { display: grid; gap: var(--space-2); }
.meta-report h4 { margin-top: var(--space-4); font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.meta-report table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.meta-report th, .meta-report td { border-bottom: 1px solid var(--line); padding: var(--space-2) var(--space-3) var(--space-2) 0; text-align: left; vertical-align: top; }
.meta-report th { width: 42%; font-weight: 500; color: var(--ink-muted); }
.meta-report td { font-family: var(--font-mono); font-size: 13px; color: var(--ink); word-break: break-word; font-variant-numeric: tabular-nums; }
.meta-report .code-out { min-height: 0; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: var(--violet-text); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-host { position: fixed; left: 50%; bottom: var(--space-5); transform: translateX(-50%); z-index: 200; display: grid; gap: var(--space-2); width: calc(100% - 32px); max-width: 420px; pointer-events: none; }
.toast { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: 14px; line-height: 20px; font-weight: 500; background: #0b0d24; color: #ffffff; box-shadow: var(--shadow-pop); animation: toast-in .15s ease; }
.toast.err { background: #c2410c; }
.toast.ok { background: #0b7a55; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Analytics consent banner. Built by site.js, and only when analytics is
   configured. It floats over the page without blocking it. */
.consent { position: fixed; left: var(--space-3); right: var(--space-3); bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); z-index: 150; max-width: 760px; margin-inline: auto; display: grid; gap: var(--space-4); padding: var(--space-4) var(--space-5); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.consent-title { font-weight: 600; color: var(--ink); margin-bottom: var(--space-1); }
.consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
@media (min-width: 720px) {
  .consent { grid-template-columns: 1fr auto; align-items: center; gap: var(--space-5); }
  .consent-actions { min-width: 230px; }
}
/* On phones, sit above the download bar rather than covering it. */
@media (max-width: 900px) { body:has(.sticky-bar.show) .consent { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }

/* --------------------------------------------------------------------------
   12. Long-form content
   -------------------------------------------------------------------------- */
.prose { max-width: 72ch; font-size: 16px; line-height: 26px; }
.prose h2 { margin: var(--space-7) 0 var(--space-3); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: var(--space-5) 0 var(--space-2); }
.prose p, .prose ul, .prose ol { margin-bottom: var(--space-4); }
.prose ul, .prose ol { padding-left: 22px; color: var(--ink-muted); }
.prose li { margin-bottom: var(--space-2); }
.prose li::marker { color: var(--ink-muted); }
.prose strong { color: var(--ink); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose table, .table-scroll table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; margin-bottom: var(--space-4); }
.prose th, .prose td, .table-scroll th, .table-scroll td { border-bottom: 1px solid var(--line); padding: var(--space-3) var(--space-4) var(--space-3) 0; text-align: left; vertical-align: top; }
.prose thead th, .table-scroll thead th { font-size: 13px; font-weight: 600; color: var(--ink-muted); border-bottom-color: var(--line-strong); white-space: nowrap; }
.prose tbody th, .table-scroll tbody th { font-weight: 600; color: var(--ink); }
.prose td, .table-scroll td { color: var(--ink-muted); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wide-table { max-width: none; }

.quick-answer { max-width: 72ch; margin-bottom: var(--space-5); padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: var(--violet-soft); color: var(--ink); font-size: 17px; line-height: 26px; }

.trouble { display: grid; gap: var(--space-3); margin: 0; max-width: 80ch; }
.trouble > div { padding: var(--space-4) var(--space-5); background: var(--surface-sunken); border-radius: var(--radius-lg); }
.trouble dt { display: flex; gap: var(--space-2); align-items: flex-start; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); }
.trouble dt .icon { color: var(--warning); margin-top: 3px; }
.trouble dd { margin: var(--space-1) 0 0 26px; color: var(--ink-muted); }
.trouble dd a { text-decoration: underline; text-underline-offset: 3px; }

/* FAQItem */
.faq { max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) 0; font-size: 16px; line-height: 24px; font-weight: 600; cursor: pointer; list-style: none; color: var(--ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { color: var(--ink-muted); transition: transform .15s; }
.faq details[open] summary .icon { transform: rotate(45deg); }
.faq .faq-body { padding: 0 0 var(--space-4); color: var(--ink-muted); max-width: 64ch; }
.faq .faq-body p + p { margin-top: var(--space-3); }
.faq .faq-body a { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   13. Ads
   -------------------------------------------------------------------------- */
.ad-container { display: block; margin: var(--space-6) auto 0; text-align: center; min-height: 90px; overflow: hidden; clear: both; }
.ad-container::before { content: "Advertisement"; display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: var(--space-1); }
.ad-container.is-empty { border: 1px dashed var(--line); border-radius: var(--radius-lg); display: grid; place-items: center; padding: var(--space-4); }
.ad-container.is-empty::before { display: none; }
.ad-container.is-empty > .ad-slot-note { font-size: 12px; color: var(--ink-muted); }
.ad-container ins { display: block; }

/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */
.site-footer { margin-top: var(--space-9); padding-block: var(--space-7) var(--space-6); border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--space-5); }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } .site-footer { margin-top: var(--space-8); } }
.site-footer .logo { color: var(--ink); }
.footer-brand p { margin-top: var(--space-3); font-size: 13px; line-height: 18px; max-width: 36ch; }
.site-footer .f-head { margin-bottom: var(--space-3); font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.site-footer ul { list-style: none; padding: 0; display: grid; gap: var(--space-2); font-size: 14px; line-height: 20px; }
.site-footer li a { color: var(--ink); }
.site-footer li a:hover { color: var(--violet-text); text-decoration: none; }
.footer-bottom { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin-left: auto; }
.footer-bottom a, .footer-bottom button { color: var(--ink-muted); }
.footer-bottom button { padding: 0; border: 0; background: none; font-size: inherit; }
.footer-bottom a:hover, .footer-bottom button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   15. Error page
   -------------------------------------------------------------------------- */
.err-page { text-align: center; padding-block: var(--space-8) 0; display: grid; justify-items: center; gap: var(--space-4); }
.err-code { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--ink-muted); }
.err-page .lead { font-size: 17px; line-height: 26px; max-width: 52ch; }
.err-page .search { max-width: 520px; }
.err-page .btn-row { display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; }
.err-page .related-grid { width: 100%; text-align: left; }

/* --------------------------------------------------------------------------
   16. Utilities
   -------------------------------------------------------------------------- */
.hidden { display: none !important; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--space-2); } .mt-2 { margin-top: var(--space-4); } .mt-3 { margin-top: var(--space-5); }
.mb-1 { margin-bottom: var(--space-2); } .mb-2 { margin-bottom: var(--space-4); } .mb-3 { margin-bottom: var(--space-5); }
.text-muted { color: var(--ink-muted); }
.text-sm { font-size: 14px; line-height: 20px; }
.text-xs { font-size: 13px; line-height: 18px; }
.center { text-align: center; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-1 { gap: var(--space-2); } .gap-2 { gap: var(--space-4); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: var(--space-4) 0; }
.spacer { flex: 1; }
