/* =====================================================================
   WaSize – style.css
   Mobile first · fluid units · system fonts · no frameworks
   Sections: 1 Tokens · 2 Base · 3 Header · 4 Intro · 5 Tool · 6 Content
             7 Footer · 8 Dock & toasts · 9 Larger screens · 10 Preferences
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --pine: #087a5b;
  --pine-strong: #056046;
  --on-pine: #ffffff;
  --mint: #dff3ea;
  --mint-strong: #bfe6d5;
  --soft-ink: #04442f;

  --ink: #0e2420;
  --ink-2: #405650;
  --ink-3: #5a6f69;

  --paper: #f1f5f3;
  --surface: #ffffff;
  --surface-2: #f5f8f6;
  --line: #dbe5e0;
  --line-2: #c3d2cb;

  --stage: #1c2925;

  --note-bg: #fff4c9;
  --note-ink: #5b4200;
  --note-line: #efd77a;

  --danger-bg: #fdeceb;
  --danger-ink: #8a1c14;
  --danger-line: #f1b4af;

  --focus: #0b63ce;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 10px;

  --shadow: 0 1px 2px rgba(14, 36, 32, .06), 0 10px 28px -10px rgba(14, 36, 32, .16);

  --header-h: 56px;
  --gutter: clamp(12px, 3.4vw, 24px);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --pine: #3cd6a0;
    --pine-strong: #63e6b8;
    --on-pine: #04241a;
    --mint: #14382d;
    --mint-strong: #1e5240;
    --soft-ink: #9af0cd;

    --ink: #e8f2ee;
    --ink-2: #b7c8c1;
    --ink-3: #93a9a1;

    --paper: #0c1411;
    --surface: #141e1a;
    --surface-2: #19251f;
    --line: #26362f;
    --line-2: #374c43;

    --stage: #0f1815;

    --note-bg: #3a2f0a;
    --note-ink: #f5df9a;
    --note-line: #5c4a12;

    --danger-bg: #3a1714;
    --danger-ink: #ffb4ab;
    --danger-line: #6b2a25;

    --focus: #8ab4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -10px rgba(0, 0, 0, .6);
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;            /* safety net only; layout is built not to overflow */
}

[hidden] { display: none !important; }

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--pine); }
::selection { background: var(--mint-strong); }

.ico {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.container { width: min(100% - 2 * var(--gutter), 1240px); margin-inline: auto; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip {
  position: fixed; left: 12px; top: -80px; z-index: 100;
  padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--ink); color: var(--paper); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 10px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1.5px solid transparent; border-radius: var(--r-sm);
  font-weight: 700; font-size: 15px; line-height: 1.1; text-align: center; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--pine); color: var(--on-pine); }
.btn--primary:hover { background: var(--pine-strong); }
.btn--soft { background: var(--mint); color: var(--soft-ink); }
.btn--soft:hover { background: var(--mint-strong); }
.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn--lg { min-height: 50px; padding: 0 24px; font-size: 16px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .short { display: inline; }
.btn .long { display: none; }

.label { font-weight: 700; font-size: 14px; color: var(--ink-2); line-height: 1.3; }
.hint { font-size: 13px; line-height: 1.4; color: var(--ink-3); }

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--header-h); }

.brand {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -.01em; line-height: 1;
}
.brand__mark { width: 30px; height: 30px; flex: none; }

.menu-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 10px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface);
  font-weight: 600; font-size: 14px;
}
.menu-btn[aria-expanded="true"] { background: var(--mint); border-color: var(--pine); }

.nav {
  position: absolute; left: 0; right: 0; top: 100%;
  display: none;
  padding: 8px var(--gutter) 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: 0 16px 24px -16px rgba(14, 36, 32, .3);
}
.nav.is-open { display: block; }
.nav ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.nav a {
  display: flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: var(--r-sm); background: var(--surface-2);
  color: var(--ink); font-weight: 600; text-decoration: none;
}
.nav a:hover { background: var(--mint); }

/* ---------- 4. Intro ---------- */
.intro { padding: 12px 0 10px; }
.intro__inner { display: grid; gap: 8px; }
.intro h1 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; line-height: 1.1;
  font-size: clamp(26px, 7vw, 38px);
}
.intro__sub { color: var(--ink-2); font-size: clamp(14.5px, 3.7vw, 16.5px); line-height: 1.45; max-width: 62ch; }
.content-meta { margin-top: 7px; color: var(--ink-3); font-size: 13px; line-height: 1.45; }
.content-meta a { color: var(--pine); font-weight: 700; text-underline-offset: 3px; }
.badges { display: flex; flex-wrap: wrap; gap: 0 14px; margin-top: 2px; }
.badges li { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 13px; font-weight: 700; line-height: 1.7; }
.badges .ico { width: 14px; height: 14px; stroke-width: 3.2; color: var(--pine); }

/* ---------- 5. The tool ---------- */
.tool-section { padding: 2px 0 22px; }

.takeaways { padding: 0 0 clamp(20px, 4vw, 34px); }
.takeaways__box {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--mint); color: var(--soft-ink);
}
.takeaways h2 { font-family: var(--font-display); font-size: clamp(18px, 4vw, 22px); line-height: 1.25; }
.takeaways ul { display: grid; gap: 7px; margin-top: 10px; }
.takeaways li { position: relative; padding-left: 20px; line-height: 1.5; }
.takeaways li::before { content: "✓"; position: absolute; left: 0; color: var(--pine); font-weight: 900; }

.tool {
  display: grid; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
}

.tool.is-drag { border-color: var(--pine); box-shadow: 0 0 0 3px var(--mint-strong), var(--shadow); }

/* Inline notices */
.notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 12px;
  border: 1px solid var(--danger-line); border-radius: var(--r-md);
  background: var(--danger-bg); color: var(--danger-ink);
}
.notice[data-kind="warn"], .notice--warn { border-color: var(--note-line); background: var(--note-bg); color: var(--note-ink); }
.notice[data-kind="info"] { border-color: var(--line-2); background: var(--surface-2); color: var(--ink); }
.notice__ico { margin-top: 2px; }
.notice__text { flex: 1; font-size: 14px; line-height: 1.4; font-weight: 600; }
.notice__close {
  display: grid; place-items: center; width: 32px; height: 32px; margin: -4px -2px -4px 0; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: inherit;
}
.notice__close:hover { background: rgba(0, 0, 0, .08); }

/* Upload zone */
.upload {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 12px;
  min-height: 152px; padding: 14px;
  border: 2px dashed var(--line-2); border-radius: 14px; background: var(--surface-2);
  transition: border-color .15s, background-color .15s;
}
.upload.is-drag { border-color: var(--pine); background: var(--mint); }
.upload__icon {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 12px; background: var(--mint); color: var(--pine);
}
.upload__icon .ico { width: 24px; height: 24px; }
.upload__title { font-weight: 800; font-size: 17px; line-height: 1.25; }
.upload__sub { font-size: 14px; color: var(--ink-3); }
.upload__btn { grid-column: 1 / -1; width: 100%; }
.upload__meta {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px 12px; font-size: 13px; color: var(--ink-3);
}

.privacy-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px;
  border-radius: 99px; background: var(--mint); color: var(--soft-ink);
  font-size: 12.5px; font-weight: 700; line-height: 1.5;
}
.privacy-pill .ico { width: 14px; height: 14px; }

/* File bar */
.filebar {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 8px 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.filebar__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--mint); color: var(--pine); }
.filebar__name { font-weight: 700; font-size: 14.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filebar__meta { font-size: 13px; color: var(--ink-3); line-height: 1.3; }
.privacy-pill--bar { display: none; }

/* Presets */
.presets { display: grid; gap: 8px; min-height: 84px; }
.presets__row {
  position: relative; display: flex; gap: 8px; margin: 0 -1px; padding: 2px 1px 8px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  scrollbar-width: none; -ms-overflow-style: none;
}
.presets__row::-webkit-scrollbar { display: none; }
.presets__row--more { padding-top: 0; }

.chip { flex: 0 0 auto; display: block; scroll-snap-align: start; cursor: pointer; }
button.chip { padding: 0; border: 0; background: none; text-align: left; }
.chip__face {
  display: grid; align-content: center; gap: 2px; min-width: 96px; min-height: 54px; padding: 6px 12px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-md); background: var(--surface);
  transition: border-color .12s, background-color .12s;
}
.chip:hover .chip__face { border-color: var(--pine); }
.chip input:checked + .chip__face { border-color: var(--pine); background: var(--mint); box-shadow: inset 0 0 0 1px var(--pine); }
.chip input:focus-visible + .chip__face, button.chip:focus-visible .chip__face { outline: 3px solid var(--focus); outline-offset: 2px; }
.chip__name { font-weight: 800; font-size: 14px; line-height: 1.2; white-space: nowrap; }
.chip input:checked + .chip__face .chip__name { color: var(--soft-ink); }
.chip__sub { display: flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1.2; color: var(--ink-3); white-space: nowrap; }
.chip--more .chip__face { border-style: dashed; }
.chip--more .chip__name { color: var(--ink-2); }
.chip--more .ico { width: 14px; height: 14px; transition: transform .2s; }
.chip--more[aria-expanded="true"] .ico { transform: rotate(180deg); }

.glyph-box { display: grid; place-items: center; width: 14px; height: 14px; flex: none; }
.glyph { display: block; border: 1.5px solid currentColor; border-radius: 2px; opacity: .85; }
.glyph--circle { border-radius: 50%; }
.glyph--rounded { border-radius: 35%; }
.glyph--dash { border-style: dashed; }

/* Editor layout */
.tool__body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.stage-col { display: grid; gap: 10px; min-width: 0; align-content: start; }

/* The preview stage is the one bold, dark element of the page */
.stage {
  position: relative; height: clamp(300px, 50vh, 420px);
  border-radius: 14px; overflow: hidden; background-color: var(--stage); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 16px 16px;
}
.stage:focus-visible { outline-color: var(--focus); }
.stage__inner { position: absolute; top: 14px; right: 14px; bottom: 14px; left: 14px; display: grid; place-items: center; }

.frame {
  position: relative; flex: none; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .38), 0 14px 34px rgba(0, 0, 0, .5);
}
.frame canvas {
  display: block; width: 100%; height: 100%;
  touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.frame.is-dragging canvas { cursor: grabbing; }
.frame.is-static canvas { touch-action: auto; cursor: default; }
.frame.is-alpha canvas { background: conic-gradient(#c5cfcb 25%, #eef2f0 0 50%, #c5cfcb 0 75%, #eef2f0 0) 0 0 / 16px 16px; }

/* Preview-only overlays. They are DOM elements, so they can never end up in the exported file. */
.ov { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: none; pointer-events: none; }
.frame[data-overlay="circle"] .ov--shape, .frame[data-overlay="rounded"] .ov--shape { display: block; }
.frame[data-overlay="safe"] .ov--safe { display: block; }
.ov--shape::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  border: 2px dashed rgba(255, 255, 255, .92); border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(9, 18, 15, .58);
}
.frame[data-overlay="rounded"] .ov--shape::before { border-radius: 28%; }
.ov--safe::before {
  content: ""; position: absolute; left: 4%; right: 4%; top: 12%; bottom: 14%;
  border: 2px dashed rgba(255, 255, 255, .92); border-radius: 6px;
  box-shadow: 0 0 0 999px rgba(9, 18, 15, .5);
}

.stage__cap { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); line-height: 1.3; }
.stage__dims { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage__hint { margin-left: auto; text-align: right; }

/* Toolbar */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tools__zoom { flex: 1 1 232px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.tools__zoom input[type="range"] { flex: 1 1 auto; min-width: 60px; }
.tools__pct { min-width: 44px; text-align: right; font-size: 13px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tools__acts { display: flex; gap: 6px; flex: 0 0 auto; }

.ibtn {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 1.5px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  transition: background-color .12s, border-color .12s;
}
.ibtn:hover:not([disabled]) { background: var(--mint); border-color: var(--pine); }
.ibtn[aria-pressed="true"] { background: var(--mint); border-color: var(--pine); color: var(--soft-ink); }
.ibtn[disabled] { opacity: .4; cursor: default; }

/* Sliders */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; padding: 0;
  background: transparent; cursor: pointer; --p: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--pine) var(--p), var(--line-2) var(--p));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--pine); box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--pine); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--pine); box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
input[type="range"]:disabled { opacity: .4; cursor: default; }
input[type="range"]:focus-visible { outline-offset: -2px; border-radius: 8px; }

/* Toggles (Circle preview, Safe area, Full photo) */
.viewopts { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 10px;
  border: 1.5px solid var(--line-2); border-radius: 99px; background: var(--surface);
  font-weight: 700; font-size: 14px; transition: background-color .12s, border-color .12s;
}
.toggle__box {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line-2); color: transparent;
}
.toggle__box .ico { width: 12px; height: 12px; stroke-width: 3.5; }
.toggle[aria-pressed="true"] { background: var(--mint); border-color: var(--pine); color: var(--soft-ink); }
.toggle[aria-pressed="true"] .toggle__box { background: var(--pine); border-color: var(--pine); color: var(--on-pine); }

.tg-extra { display: none; }

.tip {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px;
  border: 1px solid var(--note-line); border-radius: var(--r-sm); background: var(--note-bg); color: var(--note-ink);
  font-size: 14px; line-height: 1.4;
}
.tip .ico { width: 18px; height: 18px; margin-top: 1px; }

/* Controls */
.controls { display: grid; gap: 14px; align-content: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); min-width: 0; }
.ctl { display: grid; gap: 7px; align-content: start; min-width: 0; }
.ctl--wide { grid-column: 1 / -1; }
.ctl__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 24px; }
.value { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.link {
  padding: 4px 0; border: 0; background: none; color: var(--pine);
  font-weight: 700; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px;
}

/* Segmented control */
.seg {
  display: flex; gap: 2px; padding: 2px; border: 1.5px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-2);
}
.seg__opt { position: relative; flex: 1 1 0; min-width: 0; cursor: pointer; }
.seg__opt span {
  display: grid; place-items: center; min-height: 42px; padding: 0 6px; border-radius: 9px;
  font-weight: 700; font-size: 14px; text-align: center; white-space: nowrap; color: var(--ink-2);
  transition: background-color .12s, color .12s;
}
.seg__opt:hover span { color: var(--ink); }
.seg__opt input:checked + span { background: var(--surface); color: var(--pine); box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 1px var(--line-2); }
.seg__opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg__opt.is-disabled { opacity: .45; cursor: not-allowed; }

/* Size fields */
.dims { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 8px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-3); line-height: 1.2; }
.field__box { position: relative; }
.field__box--narrow { max-width: 150px; }
.field__unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--ink-3); pointer-events: none; }
input[type="number"], input[type="text"], select {
  width: 100%; height: 44px; padding: 0 34px 0 12px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface);
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: none;
}
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"]:focus, input[type="text"]:focus, select:focus { border-color: var(--pine); }
input:read-only { color: var(--ink-3); }
.textbox { padding-right: 12px !important; font-weight: 500 !important; }
.lock { width: 44px; }
.lock__off { display: none; }
.lock[aria-pressed="false"] .lock__on { display: none; }
.lock[aria-pressed="false"] .lock__off { display: block; }
.lock[disabled] { opacity: .5; }

/* Background swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { position: relative; display: block; cursor: pointer; }
.sw__face {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 13px 0 8px;
  border: 1.5px solid var(--line-2); border-radius: 99px; background: var(--surface);
  font-size: 14px; font-weight: 700; line-height: 1; transition: border-color .12s, background-color .12s;
}
.sw:hover .sw__face { border-color: var(--pine); }
.sw input:checked + .sw__face { border-color: var(--pine); background: var(--mint); color: var(--soft-ink); box-shadow: inset 0 0 0 1px var(--pine); }
.sw input:focus-visible + .sw__face, .sw--custom:has(.sw__picker:focus-visible) .sw__face { outline: 3px solid var(--focus); outline-offset: 2px; }
.sw__dot { display: block; width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .22); flex: none; }
.sw__dot--blur { background: radial-gradient(circle at 32% 30%, #f6c9a3 0, #78b0a4 52%, #3f6f93 100%); filter: saturate(.9); }
.sw__dot--white { background: #fff; }
.sw__dot--black { background: #000; }
.sw__dot--clear { background: conic-gradient(#c5cfcb 25%, #f4f7f6 0 50%, #c5cfcb 0 75%, #f4f7f6 0) 0 0 / 10px 10px; }
.sw__dot--custom { background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #f43f5e); }
.sw__picker { position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }

/* Quality chips & target chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  min-height: 42px; padding: 0 15px; border: 1.5px solid var(--line-2); border-radius: 99px; background: var(--surface);
  font-weight: 700; font-size: 14px; transition: background-color .12s, border-color .12s;
}
.chip-btn:hover { border-color: var(--pine); }
.chip-btn[aria-pressed="true"] { background: var(--mint); border-color: var(--pine); color: var(--soft-ink); }

/* Advanced settings */
.adv { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.adv summary {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px;
  font-weight: 700; font-size: 14.5px; list-style: none; cursor: pointer; border-radius: var(--r-md);
}
.adv summary::-webkit-details-marker { display: none; }
.adv summary:focus-visible { outline-offset: -3px; }
.adv__chev { margin-left: auto; transition: transform .2s; color: var(--ink-3); }
.adv[open] .adv__chev { transform: rotate(180deg); }
.adv__body {
  display: grid; gap: 16px; padding: 4px 12px 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}
.adv__item { display: grid; gap: 7px; align-content: start; min-width: 0; }
.adv__item--wide { grid-column: 1 / -1; }
.target-custom { display: flex; gap: 8px; }
.target-custom input { flex: 1 1 auto; min-width: 0; padding-right: 12px; }
.target-custom select { flex: 0 0 92px; padding-right: 12px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 4px; font-size: 14px; line-height: 1.35; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--pine); }
.colorrow { display: flex; gap: 8px; align-items: center; }
.colorrow input[type="color"] {
  width: 44px; height: 44px; padding: 3px; flex: none; cursor: pointer;
  border: 1.5px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface);
}
.colorrow input[type="text"] { padding-right: 12px; text-transform: uppercase; }

/* Export bar */
.export { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.export__line { font-size: 15.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.export__line strong { color: var(--ink); font-weight: 800; }
.export__status { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13.5px; color: var(--ink-3); min-height: 20px; }
.export__status.is-ready { color: var(--pine); font-weight: 600; }
.export__status.is-ready .spinner { display: none; }
.export__note { margin-top: 4px; font-size: 13.5px; color: var(--note-ink); background: var(--note-bg); border: 1px solid var(--note-line); border-radius: 8px; padding: 6px 10px; line-height: 1.35; }
.export__btns { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--pine); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Ad placeholders (empty). Un-hide when ads are approved; the reserved height prevents layout shift. */
.ad-slot { display: block; width: min(100% - 2 * var(--gutter), 970px); min-height: 100px; margin: 16px auto; }

/* ---------- 6. Content sections ---------- */
.sec { padding: clamp(24px, 4.5vw, 44px) 0; }
.sec--band { background: var(--surface); border-block: 1px solid var(--line); }
.sec h2 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.015em; line-height: 1.2;
  font-size: clamp(21px, 5vw, 28px); margin-bottom: 8px;
}
.lead { font-size: clamp(15px, 3.7vw, 17px); line-height: 1.55; color: var(--ink-2); max-width: 66ch; }
.small { font-size: 14px; color: var(--ink-3); max-width: 66ch; margin-bottom: 14px; }
.prose { max-width: 760px; min-width: 0; }
.prose .lead { margin-bottom: 4px; }
.prose > p + p { margin-top: 10px; color: var(--ink-2); max-width: 66ch; }

.split { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.checks { display: grid; gap: 10px; margin: 14px 0 16px; }
.checks li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; color: var(--ink-2); line-height: 1.5; }
.checks li strong { color: var(--ink); }
.checks .ico { width: 18px; height: 18px; margin-top: 3px; color: var(--pine); stroke-width: 3; }

.facts {
  align-self: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
}
.sec--band .facts { background: var(--paper); }
.facts__title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 800; font-size: 15px; }
.facts dl { display: grid; grid-template-columns: auto 1fr; gap: 0; }
.facts dt, .facts dd { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.facts dt { padding-right: 16px; color: var(--ink-3); }
.facts dd { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.facts--flow ol { counter-reset: n; display: grid; gap: 8px; }
.facts--flow li { counter-increment: n; display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: 10px; font-size: 14.5px; }
.facts--flow li::before {
  content: counter(n); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--mint); color: var(--soft-ink); font-weight: 800; font-size: 13px;
}

.note {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 10px 12px; max-width: 880px;
  border: 1px solid var(--note-line); border-radius: var(--r-md); background: var(--note-bg); color: var(--note-ink);
  font-size: 14.5px; line-height: 1.45;
}
.note .ico { margin-top: 2px; }

/* Size tables: real tables on tablets and desktops, compact cards on phones */
.sizes-grid { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); }
.table-wrap { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.sizes { width: 100%; border-collapse: collapse; font-size: 15px; }
.sizes caption {
  padding: 10px 14px; text-align: left; font-weight: 800; font-size: 15px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.sizes thead th { padding: 8px 14px; text-align: left; font-size: 13px; font-weight: 700; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.sizes tbody th, .sizes tbody td { padding: 10px 14px; text-align: left; vertical-align: middle; border-top: 1px solid var(--line); }
.sizes tbody tr:first-child th, .sizes tbody tr:first-child td { border-top: 0; }
.sizes tbody th { font-weight: 700; }
.sizes .num { text-align: right !important; font-variant-numeric: tabular-nums; }
.sizes td.act { width: 1%; white-space: nowrap; text-align: right; }

@media (max-width: 599.98px) {
  .sizes, .sizes tbody, .sizes caption { display: block; }
  .sizes thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sizes tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "type type act" "size ratio act";
    gap: 2px 8px; align-items: center; padding: 9px 12px;
  }
  .sizes tbody tr + tr { border-top: 1px solid var(--line); }
  .sizes tbody th, .sizes tbody td { display: block; padding: 0; border: 0; }
  .sizes tbody th { grid-area: type; }
  .sizes tbody td:nth-of-type(1) { grid-area: size; font-weight: 700; color: var(--pine); text-align: left !important; }
  .sizes tbody td:nth-of-type(2) {
    grid-area: ratio; justify-self: start; padding: 0 9px; font-size: 12.5px; line-height: 1.6; color: var(--ink-3);
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px;
  }
  .sizes tbody td.act { grid-area: act; justify-self: end; width: auto; }
}

/* How it works */
.steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.steps li { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); }
.steps__n {
  display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 8px; border-radius: 50%;
  background: var(--pine); color: var(--on-pine); font-weight: 800; font-size: 14px;
}
.steps h3, .feats h3 { font-size: 16px; font-weight: 800; line-height: 1.25; }
.steps p, .feats p { font-size: 14px; line-height: 1.4; color: var(--ink-2); margin-top: 2px; }

/* Features */
.feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.feats li { display: grid; gap: 8px; align-content: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.feats__ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--mint); color: var(--pine); }

/* FAQ */
.faq-wrap { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.faq-head .lead { margin-top: 2px; }
.faq { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; max-width: 860px; }
.faq__item + .faq__item { border-top: 1px solid var(--line); }
.faq__item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 14px;
  font-weight: 700; font-size: 15.5px; line-height: 1.35; list-style: none; cursor: pointer;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary:hover { background: var(--surface-2); }
.faq__item summary:focus-visible { outline-offset: -3px; }
.faq__chev { color: var(--ink-3); transition: transform .2s; }
.faq__item[open] .faq__chev { transform: rotate(180deg); }
.faq__item[open] summary { color: var(--soft-ink); }
.faq__a { padding: 0 14px 14px; color: var(--ink-2); max-width: 70ch; line-height: 1.55; }

.sources ul { display: grid; gap: 7px; margin: 14px 0; padding-left: 20px; list-style: disc; }
.sources a { color: var(--pine); font-weight: 700; text-underline-offset: 3px; }
.sources a:hover { text-decoration-thickness: 2px; }
.sources h3 { margin-top: 20px; font-family: var(--font-display); font-size: clamp(18px, 4vw, 22px); line-height: 1.3; }
.sources h3 + p { margin-top: 8px; color: var(--ink-2); line-height: 1.65; max-width: 78ch; }
.author-box { margin: 20px 0 14px; padding: 16px 18px; border: 1px solid var(--line); border-left: 4px solid var(--pine); border-radius: var(--r-md); background: var(--surface); }
.author-box__title { margin-bottom: 5px; color: var(--pine); font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.author-box p:last-child { color: var(--ink-2); line-height: 1.6; }

/* ---------- 7. Footer ---------- */
.site-footer { margin-top: 8px; padding: 22px 0 26px; background: var(--surface); border-top: 1px solid var(--line); }
.footer__top { display: grid; gap: 14px; }
.brand--sm { font-size: 17px; }
.brand--sm .brand__mark { width: 26px; height: 26px; }
.footer__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; }
.footer__links a { display: flex; align-items: center; min-height: 40px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none; }
.footer__links a:hover { color: var(--pine); text-decoration: underline; }
.footer__legal { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: var(--ink-3); max-width: 90ch; }
.footer__copy { margin-top: 8px; font-size: 13px; color: var(--ink-3); }

/* ---------- 8. Mobile download dock & toasts ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line-2); box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, .35);
  transform: translateY(110%); transition: transform .2s ease;
}
.dock.is-visible { transform: none; }
.dock__info { min-width: 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.3; font-variant-numeric: tabular-nums; }
.dock__info strong { color: var(--ink); }
.dock__label { color: var(--ink-3); }
.dock__size { display: block; font-size: 13px; color: var(--ink-3); }
.dock .btn { min-height: 48px; padding: 0 22px; flex: none; }
body.has-image { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

.toasts {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60;
  display: grid; gap: 8px; width: min(92vw, 420px); transform: translateX(-50%); pointer-events: none;
}
body.has-image .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-md);
  background: #12211d; color: #f2f8f5; border: 1px solid #2c3f38;
  font-size: 14.5px; font-weight: 600; line-height: 1.35;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35); pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast .ico { width: 18px; height: 18px; color: #63e6b8; }
.toast--error .ico { color: #ffb4ab; }
.toast .spinner { border-color: rgba(255, 255, 255, .25); border-top-color: #63e6b8; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 9. Larger screens ---------- */
@media (min-width: 420px) {
  .tg-extra { display: inline; }
}

@media (min-width: 480px) {
  .btn .short { display: none; }
  .btn .long { display: inline; }
}

@media (min-width: 600px) {
  .intro__sub { max-width: none; }
  .badges { gap: 6px; }
  .badges li { padding: 3px 10px 3px 7px; border-radius: 99px; background: var(--mint); color: var(--soft-ink); line-height: 1.5; }
  .tool { padding: 16px; gap: 14px; }
  .stage { height: clamp(420px, 55vh, 500px); }
  .presets__row {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px;
    margin: 0; padding: 0; overflow: visible;
  }
  .chip__face { min-width: 0; }
  .export { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .export__btns { grid-template-columns: auto auto; }
  .export__btns .btn { min-width: 150px; }
  .steps { gap: 12px; }
  .feats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .footer__links { grid-template-columns: repeat(4, auto); justify-content: start; gap: 0 22px; }
}

@media (min-width: 720px) {
  :root { --header-h: 60px; }

  .menu-btn { display: none; }
  .nav { position: static; display: block; padding: 0; background: none; border: 0; box-shadow: none; }
  .nav ul { display: flex; gap: 2px; }
  .nav a { min-height: 40px; padding: 0 12px; background: transparent; font-size: 14.5px; color: var(--ink-2); }
  .nav a:hover { background: var(--mint); color: var(--soft-ink); }

  .upload {
    grid-template-columns: 1fr; justify-items: center; text-align: center; align-content: center;
    min-height: 200px; padding: 18px; gap: 8px;
  }
  .upload__icon { width: 42px; height: 42px; }
  .upload__btn { width: auto; min-width: 210px; grid-column: auto; }
  .upload__meta { grid-column: auto; justify-content: center; gap: 6px 16px; }

  .filebar { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; padding: 8px 10px; }
  .privacy-pill--bar { display: inline-flex; }

  .sizes-grid { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .tool__body { grid-template-columns: minmax(0, 1.18fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
  .stage-col { position: sticky; top: calc(var(--header-h) + 12px); }
  .stage { height: clamp(420px, 58vh, 500px); }

  /* Download stays in reach while editing (phones use the bottom dock instead) */
  .export {
    position: sticky; bottom: 0; z-index: 5; margin: 0 -16px -16px; padding: 12px 16px;
    background: var(--surface); border-radius: 0 0 var(--r-lg) var(--r-lg);
  }

  .dock { display: none; }
  body.has-image { padding-bottom: 0; }
  body.has-image .toasts { bottom: calc(88px + env(safe-area-inset-bottom)); } /* clears the sticky export bar */
}

@media (min-width: 900px) {
  .intro { padding: 18px 0 14px; }
  .intro__inner { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 20px; }
  .badges { justify-content: flex-end; margin: 0 0 4px; }
  .badges li { font-size: 13px; padding: 4px 11px 4px 8px; }

  .split { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 36px; }
  .split .facts { position: sticky; top: calc(var(--header-h) + 20px); }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .faq-wrap { grid-template-columns: minmax(240px, 1fr) minmax(0, 2.3fr); gap: 40px; }
  .faq-head { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; }
  .footer__top { grid-template-columns: auto 1fr; align-items: center; gap: 28px; }
  .footer__links { grid-template-columns: repeat(7, auto); justify-content: end; gap: 0 4px; }
  .footer__links a { padding: 0 10px; }
}

@media (min-width: 960px) {
  .sizes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

@media (min-width: 1100px) {
  .tool { padding: 18px; }
  .tool__body { grid-template-columns: minmax(0, 1.7fr) minmax(360px, 1fr); gap: 20px; }
  .stage { height: clamp(420px, 62vh, 560px); }
  .export { margin: 0 -18px -18px; padding: 12px 18px; }
  .presets__row { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .chip__face { padding: 6px 8px; }
  .chip__sub { gap: 4px; }
  .chip__dims { overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- 10. Preferences ---------- */
@media (max-width: 359.98px) {
  .brand__name { font-size: 18px; }
  .menu-btn span { display: none; }
  .menu-btn { padding: 0 11px; }
  .tools__acts { gap: 4px; }
  .ibtn { width: 42px; }
  .lock { width: 40px; }
  .dock .btn { padding: 0 16px; }
}

@media (max-height: 520px) and (orientation: landscape) and (max-width: 767.98px) {
  .stage { height: clamp(220px, 70vh, 300px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spinner { animation: none; border-top-color: var(--line-2); border-right-color: var(--pine); }
}

@media (forced-colors: active) {
  .chip input:checked + .chip__face, .seg__opt input:checked + span, .sw input:checked + .sw__face { outline: 2px solid Highlight; }
}
