/* IndoImage — design system per docs/product-pack/docs/design.md.
   Dark-first: a dark shell (header, home, footer, tool chrome) wraps a light utility
   canvas for the image. 8 px grid, 12 px control radius, 18-24 px panels.
   System sans stack with Inter first: the CSP forbids an off-site font, so nothing loads. */
/* ---------- theme tokens ----------
   Two complete sets on the SAME names, selected by html[data-theme]. /assets/theme.js writes that
   attribute before the first paint; a page with no attribute (or a browser that blocks the script)
   falls back to :root, which is the product-pack dark default. Every colour pair used by this file
   and by src/tools/_shared/kit.css is >= WCAG AA in BOTH themes - the measured ratios are in
   docs/design/theme/reports/s1.md. */
:root,
html[data-theme="dark"] {
  /* product pack tokens (docs/design.md section 4) */
  --bg: #07131f;
  --bg-elevated: #0b1b29;
  --surface: #102334;
  --surface-2: #162d40;
  --border: #294457;
  --text: #f7fbff;
  --text-muted: #a9bac8;
  --blue: #2f80ff;
  --cyan: #4dd7ff;
  --green: #45d483;
  --amber: #f1b957;
  --danger: #ff6d78;
  --white: #ffffff;
  --canvas: #eef4f8;
  /* a filled control needs 4.5:1 against white; #2f80ff is the accent, this is the fill */
  --blue-fill: #1c66d6;
  /* hover is one step DARKER than the fill, so white label text stays AA there too */
  --blue-fill-hover: #17539e;
  /* the accent where it carries TEXT on the page background (dark blue on dark is fine) */
  --blue-ink: var(--blue);
  /* translucent chrome and shadows are theme values, not literals inside the rules below */
  --top-bg: rgba(7, 19, 31, .92);
  --pop-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  --hero-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* The light theme comes out of the pack's --canvas #eef4f8 family: a near-white page with a cool
   tint, white surfaces, a light slate border, and the pack navy as ink. --blue stays the same
   interaction accent; the accent tokens that carry TEXT (_ink) and the state colours that carry
   text (cyan/green/amber/danger) are darkened so they keep AA on the light surfaces. */
html[data-theme="light"] {
  --bg: #f1f6fa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #e8f0f7;
  --border: #c7d5e1;
  --text: #07131f;
  --text-muted: #4a5f70;
  --blue: #2f80ff;
  --cyan: #0b6f88;
  --green: #0f7a44;
  --amber: #8a5a00;
  --danger: #b3261e;
  --white: #ffffff;
  --canvas: #eef4f8;
  --blue-fill: #1c66d6;
  --blue-fill-hover: #17539e;
  --blue-ink: #1c66d6;
  --top-bg: rgba(255, 255, 255, .9);
  --pop-shadow: 0 18px 40px rgba(7, 19, 31, .2);
  --hero-shadow: 0 18px 48px rgba(7, 19, 31, .16);
  color-scheme: light;
}

:root {
  /* aliases the workbench rules below read; var() is lazy, so they follow the theme above */
  --ink: var(--text);
  --muted: var(--text-muted);
  --line: var(--border);
  --card: var(--surface);
  --brand: var(--blue);
  --brand-soft: rgba(47, 128, 255, .14);
  --brand-ink: var(--white);
  --bad: var(--danger);
  --scrim: rgba(4, 12, 20, .8);
  --radius: 18px;
  --r-s: 12px;
  --tap: 44px;
  --fs-s: .8125rem;
  --fs-m: 1rem;
  --fs-l: 1.25rem;
  --t-fast: 160ms;
  --t-mid: 220ms;
  --ease: ease-out;
  font-family: Inter, "Inter var", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
a { color: var(--blue-ink); }
p { margin: 0 0 12px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.15; letter-spacing: -.02em; }

.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;
}
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.skip {
  position: absolute; left: 16px; top: -80px; z-index: 30; padding: 12px 16px;
  background: var(--surface); color: var(--text); border-radius: 0 0 12px 12px;
}
.skip:focus { top: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 1px solid transparent; border-radius: var(--r-s);
  background: var(--blue-fill); color: var(--white); font-weight: 700; font-size: var(--fs-m);
  text-decoration: none; transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--blue-fill-hover); transform: translateY(-1px); }
.btn.secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.sub { background: var(--surface); border-color: var(--border); color: var(--text); min-height: var(--tap); font-size: var(--fs-s); }

/* ---------- shared header ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  max-width: 1440px; margin: 0 auto; padding: 10px clamp(16px, 3vw, 32px);
  background: var(--top-bg); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; margin-right: auto;
  color: var(--text); font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; text-decoration: none;
}
.brand-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--cyan)); color: var(--white); font-size: 1.1rem;
}
.navlinks { display: flex; gap: 2px; }
.navlinks a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px;
  border-radius: var(--r-s); color: var(--text); font-size: var(--fs-s); font-weight: 600; text-decoration: none;
}
.navlinks a:hover { background: var(--surface); }
.nav-cta { min-height: var(--tap); padding: 0 16px; font-size: var(--fs-s); }
/* OPEN-0466: the one theme control. A 44 px target carrying an aria-hidden sun/moon pair and an
   sr-only label; CSS swaps BOTH with the theme, so the control is already correct at first paint -
   theme.js only keeps aria-pressed (true while light is active) in sync. */
.themebtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: var(--tap); min-height: var(--tap); padding: 0 10px; flex: none;
  border: 1px solid var(--border); border-radius: var(--r-s);
  background: var(--surface); color: var(--text); font-size: var(--fs-s); font-weight: 600;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.themebtn:hover { border-color: var(--blue); background: var(--surface-2); }
.themebtn .ic { display: block; flex: none; }
.themebtn .ic-moon, .themebtn .lab-dark { display: none; }
html[data-theme="light"] .themebtn .ic-sun,
html[data-theme="light"] .themebtn .lab-light { display: none; }
html[data-theme="light"] .themebtn .ic-moon { display: block; }
html[data-theme="light"] .themebtn .lab-dark { display: inline; }
/* T2: the phone header menu. A native <details>/<summary> - keyboard operable for free - hidden on
   wide screens, where the inline navlinks already carry the same five links. */
.navmenu { display: none; }
.btn[disabled], button.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary[disabled]:hover, button.btn:disabled:hover { background: var(--surface); transform: none; }

/* ---------- layout ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 32px) 48px; }
.wrap:has(.workbench) { max-width: 1440px; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.02fr .98fr; gap: 48px; align-items: center; padding: 48px 0 32px; }
.eyebrow {
  margin: 0 0 12px; font-size: 12px; letter-spacing: .28em; text-transform: uppercase;
  font-weight: 700; color: var(--cyan);
}
.hero h1 { font-size: clamp(40px, 5.6vw, 72px); margin: 0 0 16px; }
.lead { font-size: 1.125rem; color: var(--text-muted); max-width: 62ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 0; }
.promise { margin: 18px 0 0; font-size: var(--fs-s); font-weight: 600; color: var(--text); }
.trust-row {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 24px 0 0; padding: 0;
  color: var(--text-muted); font-size: var(--fs-s);
}
.trust-row li { display: flex; align-items: center; gap: 8px; }
.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(69, 212, 131, .16); }
.hero-card {
  border: 1px solid var(--border); border-radius: 24px; padding: 12px; background: var(--bg-elevated);
  box-shadow: var(--hero-shadow);
}
/* the hero is a dark UI screenshot: in the light theme its frame is what makes it read as a
   framed image rather than a hole in the page, so the hairline follows the theme border. */
.hero-card img { display: block; width: 100%; height: auto; border-radius: 16px; box-shadow: 0 0 0 1px var(--border); }

.section { padding: 40px 0; }
.section h2 { font-size: clamp(26px, 3.2vw, 40px); }
.section-intro { color: var(--text-muted); font-size: 1.0625rem; max-width: 65ch; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card {
  display: block; padding: 22px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.card:hover { border-color: var(--blue); transform: translateY(-2px); }
.card h3 { margin: 14px 0 6px; font-size: 1.125rem; }
.card p { margin: 0; color: var(--text-muted); font-size: var(--fs-s); }
.card-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--brand-soft); color: var(--cyan); font-size: 1.25rem;
}
.panel { border: 1px solid var(--border); border-radius: 22px; background: var(--bg-elevated); padding: 24px; }
.panel h2 { font-size: 1.375rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 4px 12px;
  border-radius: 999px; font-size: var(--fs-s); font-weight: 700;
}
.badge.amber { background: rgba(241, 185, 87, .12); border: 1px solid rgba(241, 185, 87, .4); color: var(--amber); }
.notice {
  border-left: 3px solid var(--cyan); background: rgba(77, 215, 255, .08); border-radius: 0 12px 12px 0;
  padding: 12px 14px; color: var(--text); font-size: var(--fs-s); max-width: 65ch;
}

/* ---------- shared footer ---------- */
.foot {
  max-width: 1440px; margin: 40px auto 0; padding: 24px clamp(16px, 3vw, 32px) 40px;
  border-top: 1px solid var(--border); display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px;
  color: var(--text-muted); font-size: var(--fs-s);
}
.foot-brand { color: var(--text); font-weight: 700; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.foot a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--text-muted); text-decoration: none; }
.foot a:hover { color: var(--text); }
.footer-note { color: var(--text-muted); font-weight: 400; }
.footer-analytics { flex: 1 1 220px; min-width: 180px; }

/* ---------- tool page ---------- */
.page-intro { margin: 8px 0 24px; }
.page-intro h1 { font-size: clamp(28px, 4vw, 44px); }
.page-intro .lead:empty { display: none; }
.workbench { border: 1px solid var(--border); border-radius: 24px; background: var(--bg-elevated); overflow: clip; }
.bench { display: grid; grid-template-columns: 210px minmax(0, 1fr) 340px; align-items: stretch; }

/* left rail */
.rail { padding: 16px 12px; border-right: 1px solid var(--border); display: grid; gap: 8px; align-content: start; }
.ops { display: grid; gap: 6px; }
.op {
  min-height: var(--tap); display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--r-s); background: transparent;
  color: var(--text-muted); font-size: var(--fs-s); font-weight: 600; text-align: left;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.op .ic { width: 22px; height: 22px; display: inline-grid; place-items: center; font-size: 1rem; flex: none; }
.op:hover { background: var(--surface); color: var(--text); }
.op.on { background: var(--brand-soft); border-color: rgba(47, 128, 255, .45); color: var(--text); }
.op.ai { border-style: dashed; }
.op[disabled] { cursor: not-allowed; opacity: .7; }
.op .pill { margin-left: auto; padding: 2px 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: 11px; font-weight: 700; }
.ops .soon { display: none; }

/* centre canvas: the light utility surface */
.canvas {
  --ink: #0b1b29;
  --muted: #4a5f70;
  --line: #c8d6e0;
  --card: #ffffff;
  --surface-2: #e3ebf1;
  --brand: #1c66d6;
  --brand-soft: #dcebff;
  --brand-ink: #ffffff;
  --bad: #b3261e;
  --scrim: rgba(7, 19, 31, .82);
  color-scheme: light;
  display: flex; flex-direction: column; min-width: 0; background: var(--canvas); color: var(--ink);
}
.canvas-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--tap); padding: 8px 16px; border-bottom: 1px solid var(--line);
}
.stage { flex: 1; display: grid; align-content: center; gap: 12px; padding: 24px; min-width: 0; }
.stage[data-state="empty"] { min-height: 420px; }

/* ---------- file bar ---------- */
.file { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; font-size: var(--fs-s); color: var(--muted); }
.file b { color: var(--ink); }
.file-info { display: grid; gap: 2px; min-width: 0; }
.file-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-info > span { font-size: 11px; }
#file-dims:not(:empty)::after { content: ' · '; }
.swap { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--brand); font-weight: 600; text-decoration: none; white-space: nowrap; flex: none; }
.local-badge { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--muted); font-size: var(--fs-s); font-weight: 600; }
.local-badge .dot { background: var(--green); }

/* ---------- empty state: drop + samples ---------- */
.drop {
  display: grid; justify-items: center; gap: 10px; text-align: center; cursor: pointer;
  padding: 28px 16px 20px; border: 1.5px dashed var(--line); border-radius: 16px; background: var(--card);
}
.drop.over, .drop:focus-within { border-color: var(--brand); }
.photo-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); }
.drop-title { font-size: 1.3125rem; font-weight: 600; margin: 0; }
.drop .pick {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: var(--r-s);
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: var(--fs-m);
}
.drop .sub { font-size: var(--fs-s); color: var(--muted); }
.drop .trust { font-size: var(--fs-s); color: var(--ink); }
.samples { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.samples p { margin: 0; font-size: var(--fs-s); color: var(--muted); }
.srow { display: flex; gap: 8px; }
.sample {
  width: 52px; height: 52px; min-width: var(--tap); min-height: var(--tap); padding: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; font-size: 0;
}
.sample img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--t-fast) var(--ease); }
.sample:hover img { transform: scale(1.08); }

/* ---------- before/after difference slider ---------- */
.cmpwrap { display: grid; gap: 10px; }
/* the stage is sized to the photo's aspect ratio so the tags and the handle sit ON the photo.
   --ar / --ar-num are set from the source dims via CSSOM; --stage-h is the height cap. */
.compare {
  position: relative; margin: 0 auto; width: 100%; --stage-h: min(62vh, 540px);
  aspect-ratio: var(--ar, 4 / 3); max-height: var(--stage-h);
  max-width: calc(var(--stage-h) * var(--ar-num, 0.75));
  border-radius: 12px; overflow: hidden; background: var(--surface-2);
  touch-action: none; user-select: none; cursor: ew-resize;
}
.layer { position: absolute; inset: 0; overflow: hidden; }
.layer.after { clip-path: inset(0 0 0 var(--pos, 50%)); }
.compare img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transform: translate(var(--pan-x, 0px), var(--pan-y, 0px)) scale(var(--zoom, 1));
  transform-origin: center center;
}
.compare[data-peek="1"] .layer.after { visibility: hidden; }
.compare.first-pass .after, .compare.first-pass .divider,
.compare.first-pass .handle, .compare.first-pass .tag.r { visibility: hidden; }
.divider {
  position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); pointer-events: none;
  transition: left var(--t-fast) var(--ease);
}
.compare[data-drag] .divider, .compare[data-drag] .handle { transition: none; }
.handle {
  position: absolute; top: 50%; left: var(--pos, 50%); width: var(--tap); height: var(--tap);
  margin: -22px 0 0 -22px; border-radius: 999px; background: #fff; border: 2px solid var(--brand);
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); color: var(--brand);
  font-weight: 800; cursor: ew-resize; touch-action: none; transition: transform var(--t-fast) var(--ease);
}
.handle.drag { transform: scale(1.12); }
.tag { position: absolute; top: 10px; background: var(--scrim); color: #fff; font-size: var(--fs-s); padding: 4px 8px; border-radius: 8px; font-weight: 600; }
.tag.l { left: 10px; }
.tag.r { right: 10px; }
.busybar { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(28, 102, 214, .2); overflow: hidden; }
.busybar i { position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: var(--brand); animation: busy 1.1s var(--ease) infinite; }
@keyframes busy { from { transform: translateX(-110%); } to { transform: translateX(320%); } }
.busychip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0;
  background: var(--scrim); color: #fff; font-size: var(--fs-s); padding: 6px 12px;
  border-radius: 999px; display: flex; gap: 8px; align-items: center;
}
.spin { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.hold { min-height: var(--tap); padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.zoom { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.zoom button { min-width: var(--tap); min-height: var(--tap); border: 0; background: var(--card); color: var(--ink); padding: 0 10px; font-weight: 600; font-size: var(--fs-s); }
.zoom button + button { border-left: 1px solid var(--line); }
.zoom button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-s); color: var(--muted); }
.meta b { color: var(--ink); }
.okline { color: var(--brand); font-weight: 700; }

/* ---------- crop frame ---------- */
/* 22 px of breathing room (>= half a 44 px handle) so all four corner handles sit inside. */
.cropwrap { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-2); padding: 22px; display: grid; }
.cropstage { position: relative; }
.cropwrap img.base { display: block; width: 100%; height: auto; }
.frame {
  position: absolute; left: var(--fx, 20%); top: var(--fy, 20%); width: var(--fw, 60%); height: var(--fh, 60%);
  border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(7, 19, 31, .62); cursor: move; touch-action: none;
}
.frame:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.thirds {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.333% - .5px), rgba(255,255,255,.55) calc(33.333% - .5px), rgba(255,255,255,.55) calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.55) calc(66.666% - .5px), rgba(255,255,255,.55) calc(66.666% + .5px), transparent calc(66.666% + .5px)),
    linear-gradient(to bottom, transparent calc(33.333% - .5px), rgba(255,255,255,.55) calc(33.333% - .5px), rgba(255,255,255,.55) calc(33.333% + .5px), transparent calc(33.333% + .5px), transparent calc(66.666% - .5px), rgba(255,255,255,.55) calc(66.666% - .5px), rgba(255,255,255,.55) calc(66.666% + .5px), transparent calc(66.666% + .5px));
}
.move { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--scrim); color: #fff; font-size: var(--fs-s); padding: 4px 10px; border-radius: 999px; pointer-events: none; }
.crop-h { position: absolute; width: var(--tap); height: var(--tap); touch-action: none; }
.crop-h::after { content: ""; position: absolute; inset: 11px; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.crop-h[data-corner="tl"] { left: -22px; top: -22px; cursor: nwse-resize; }
.crop-h[data-corner="tr"] { right: -22px; top: -22px; cursor: nesw-resize; }
.crop-h[data-corner="bl"] { left: -22px; bottom: -22px; cursor: nesw-resize; }
.crop-h[data-corner="br"] { right: -22px; bottom: -22px; cursor: nwse-resize; }
/* the live crop result stays outside the crop image so it never covers a corner handle */
.cres { position: relative; bottom: auto; right: auto; justify-self: end; margin-top: 24px; z-index: 1; background: var(--card); border-radius: 10px; padding: 5px 5px 3px; display: grid; gap: 2px; justify-items: center; font-size: var(--fs-s); font-weight: 600; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); pointer-events: none; }
.cres img { width: 48px; max-width: 100%; height: auto; aspect-ratio: 1; border-radius: 7px; display: block; object-fit: cover; }

/* ---------- error + status ---------- */
.err { border: 1px solid #f2c9c6; background: #fdeceb; color: #4a1a17; border-radius: 12px; padding: 20px; display: grid; gap: 10px; }
.err .t { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; font-size: 1.0625rem; }
.err .bang { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--bad); color: #fff; display: grid; place-items: center; font-weight: 800; }
.err p { margin: 0 0 0 38px; font-size: 14px; }
.err .steps { font-size: var(--fs-s); color: #6b3a36; }
.err .again { margin-left: 38px; justify-self: start; min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1px solid var(--brand); color: var(--brand); background: var(--card); font-weight: 700; }
.status { margin: 0; font-size: var(--fs-s); color: var(--muted); }
.status.bad { color: var(--bad); }
.status.ok { color: var(--brand); }
.opening { min-height: 220px; display: grid; align-content: center; justify-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.opening .spin { width: 26px; height: 26px; border-color: rgba(7, 19, 31, .15); border-top-color: var(--brand); }
.opening p { margin: 0; }

/* ---------- right properties panel ---------- */
.props { padding: 20px; border-left: 1px solid var(--border); display: grid; gap: 16px; align-content: start; min-width: 0; }
.props .panel { display: grid; gap: 14px; border: 0; background: transparent; padding: 0; border-radius: 0; }
.props h2 { font-size: 1.125rem; margin: 0; }
.step-label { margin: 0; font-size: 10px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.ctl { display: grid; gap: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lbl { font-size: var(--fs-s); color: var(--text-muted); }
.val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-s); overflow: hidden; flex-wrap: wrap; }
.seg .chip { border: 0; border-radius: 0; }
.seg .chip + .chip { border-left: 1px solid var(--border); }
.seg .chip.on { background: var(--blue-fill); color: var(--white); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: var(--tap); min-width: var(--tap); padding: 0 12px; border: 1px solid var(--border);
  border-radius: var(--r-s); background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-s);
}
.chip.on { background: var(--blue-fill); border-color: var(--blue-fill); color: var(--white); }
.chip[data-preset] { font-size: 11px; text-align: left; }
input[type="range"] { width: 100%; height: var(--tap); min-height: var(--tap); margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--border); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--blue); border: 3px solid var(--bg-elevated); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--border); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border: 3px solid var(--bg-elevated); border-radius: 50%; background: var(--blue); }
.field { display: grid; gap: 4px; font-size: var(--fs-s); color: var(--text-muted); }
.field input { font: inherit; width: 100%; min-height: var(--tap); padding: 10px; border: 1px solid var(--border); border-radius: var(--r-s); background: var(--bg); color: var(--text); }
.check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: var(--fs-m); }
.hint { margin: 0; font-size: var(--fs-s); color: var(--text-muted); }
.rule { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); font-size: var(--fs-s); color: var(--text-muted); }
.rule p { margin: 0; }
.rule summary { display: flex; align-items: center; gap: 8px; min-height: var(--tap); color: var(--text); font-weight: 600; cursor: pointer; }
.rule summary::after { content: '+'; margin-left: auto; font-size: 1.125rem; }
.rule[open] summary::after { content: '\2212'; }
.rule blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0; background: var(--surface); color: var(--text); }
.rule a { color: var(--cyan); word-break: break-word; }

.cta { display: grid; gap: 12px; align-content: start; }
.dock { display: grid; gap: 6px; }
.dock small { display: none; font-size: var(--fs-s); color: var(--text-muted); text-align: center; }
.dock .btn, .cta .btn { width: 100%; }
#download[aria-disabled="true"] { opacity: .6; cursor: progress; }
#after-size[data-busy="1"]::after { content: " \2192 \2026"; opacity: .7; }
.privacy-details { border-top: 1px solid var(--border); padding-top: 6px; }
.privacy-details summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--tap); font-size: var(--fs-s); color: var(--text-muted); cursor: pointer; }
.privacy-details summary::after { content: '+'; }
.privacy-details[open] summary::after { content: '\2212'; }
.privacy { margin: 0; padding: 0; font-size: var(--fs-s); line-height: 1.6; color: var(--text-muted); }
.privacy b { color: var(--text); }

/* ---------- rule block + cluster interlink (built by bin/build.py) ---------- */
.ruleblock { margin-top: 24px; display: grid; gap: 10px; padding: 22px 24px; border: 1px solid var(--border); border-radius: 18px; background: var(--bg-elevated); }
.ruleblock h2 { margin: 0; font-size: 1.25rem; }
.ruleblock p { margin: 0; max-width: 74ch; font-size: 14px; color: var(--text-muted); }
.ruleblock .rule-summary { color: var(--text); font-size: 15px; }
.ruleblock .forbids b { color: var(--text); }
.ruleblock .source a { color: var(--cyan); }
.use-cases { margin-top: 28px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 1.375rem; }
.section-heading > span { color: var(--text-muted); font-size: var(--fs-s); }
.cluster .cluster-links, .next { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; margin: 0; }
.cluster .cluster-links a, .next a {
  display: flex; align-items: center; min-height: var(--tap); padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--text); font-size: var(--fs-s); font-weight: 600; text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.cluster .cluster-links a:hover, .next a:hover { border-color: var(--blue); }
.next a { position: relative; display: block; padding: 16px; background: transparent; }
.next a b { display: block; margin: 8px 0 3px; font-size: 13px; }
.next a > span { font-size: 11px; color: var(--text-muted); }
.next a .route-icon { color: var(--cyan); font-size: 22px; }
.next a .route-arrow { position: absolute; top: 16px; right: 14px; color: var(--text-muted); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 32px 0 24px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
  .bench { grid-template-columns: 170px minmax(0, 1fr) 300px; }
}
@media (max-width: 820px) {
  .navlinks { display: none; }
  .navmenu { display: block; position: relative; }
  .navmenu > summary {
    display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 12px;
    border: 1px solid var(--border); border-radius: var(--r-s); background: var(--surface);
    color: var(--text); font-size: var(--fs-s); font-weight: 600; cursor: pointer; list-style: none;
  }
  .navmenu > summary::-webkit-details-marker { display: none; }
  .navmenu[open] > summary { border-color: var(--blue); }
  .navmenu nav {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 190px;
    display: grid; padding: 8px; border: 1px solid var(--border); border-radius: 14px;
    background: var(--bg-elevated); box-shadow: var(--pop-shadow);
  }
  .navmenu nav a {
    display: flex; align-items: center; min-height: var(--tap); padding: 0 12px; border-radius: 10px;
    color: var(--text); font-size: var(--fs-s); font-weight: 600; text-decoration: none;
  }
  .navmenu nav a:hover { background: var(--surface); }
  .bench { grid-template-columns: minmax(0, 1fr); }
  .canvas { order: 1; }
  .rail { order: 2; border-right: 0; border-top: 1px solid var(--border); padding: 10px 12px; }
  .props { order: 3; border-left: 0; border-top: 1px solid var(--border); }
  .ops { display: flex; gap: 6px; overflow-x: auto; }
  .op { white-space: nowrap; flex: none; }
  .grid { grid-template-columns: 1fr; }
  .cluster .cluster-links, .next { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ruleblock { padding: 18px 16px; }
}
@media (max-width: 560px) {
  .top { padding: 8px 14px; }
  .brand { font-size: 1.0625rem; }
  .wrap { padding: 16px 14px 24px; }
  .hero h1 { font-size: 34px; }
  .section { padding: 32px 0; }
  .stage { padding: 14px; }
  .stage[data-state="empty"] { min-height: 0; }
  .drop { padding: 20px 12px 16px; }
  .drop .dropdesk { display: none; }
  .compare { --stage-h: 52vh; }
  .cluster .cluster-links, .next { grid-template-columns: 1fr; }
  .foot { font-size: 12px; }
  /* M9: `.section { padding: 32px 0 }` landed after `.panel { padding: 24px }` and stripped the
     inner padding off every element that is BOTH (the "Coming" cards on /share/, the Beacon
     section on the home page). Keep the panel's own inset at phone width. */
  .section.panel { padding: 22px 18px; }
  .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    background: var(--bg-elevated); border-top: 1px solid var(--border);
  }
  .dock small { display: block; }
  body:has(#dock:not([hidden])) { padding-bottom: 96px; }
}
@media (max-width: 430px) {
  /* OPEN-0466: at 320-430 px the header (brand + menu + 44 px theme toggle + Choose image) no
     longer fits on one line. Wrap the bar onto two rows instead of clipping it - the toggle has
     to stay reachable at every width (WCAG 1.4.10 reflow). */
  .top { flex-wrap: wrap; row-gap: 6px; }
  .nav-cta { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- P3: requirement checklist + metadata report ---------- */
/* Every line carries a tick or a cross AND its words, so nothing depends on colour alone. */
.checklist { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.check-h { margin: 0; font-size: var(--fs-s); font-weight: 700; color: var(--text); }
.cline { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; margin: 0; font-size: var(--fs-s); color: var(--text); }
.cline .tick { font-weight: 800; }
.cline.yes .tick { color: var(--green); }
.cline.no .tick { color: var(--amber); }
.check-self { margin: 4px 0 0; font-size: var(--fs-s); font-weight: 700; color: var(--text); }
.check-help { margin: 0; font-size: var(--fs-s); color: var(--text-muted); }
.metarep { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: var(--fs-s); color: var(--muted); }
.metarep p { margin: 0; }
.metarep .meta-h { font-weight: 700; color: var(--ink); }
.metarep .meta-removed { margin-top: 4px; font-weight: 700; color: var(--ink); }

/* ---------- OPEN-0453 s3.5: labelled checklist rows, human checks, phone verdict ---------- */
.cline .clabel { color: var(--text); }
.check-human { margin: 2px 0 0; padding-left: 20px; font-size: var(--fs-s); color: var(--text-muted); }
.check-human li { margin: 2px 0; }
.ops-lock { margin: 6px 0 0; font-size: var(--fs-s); color: var(--text-muted); }
.dock-verdict a { display: inline-flex; align-items: flex-start; gap: 8px; font-size: var(--fs-s); font-weight: 700; text-decoration: none; }
.dock-verdict a.yes { color: var(--green); }
.dock-verdict a.no { color: var(--amber); }
.cta .metarep { margin-top: 2px; }
