  :root {
    /* Ground and accent sampled from award-winning developer/SaaS tools. */
    --paper:   #F7F7EE;
    --card:    #FFFFFF;
    --ink:     #0C0B11;
    --muted:   #6B6A63;
    --line:    #DCDBD0;
    --accent:  #0054FA;
    --accent-ink: #FFFFFF;
    --hot:     #FF5949;
    --good:    #4F7A3A;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
    --r: 12px;
    --sq: #E4E3D8;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --paper: #0C0B11; --card: #16151C; --ink: #F2F1EA; --muted: #9A988E;
      --line: #2B2933; --accent: #4C8BFF; --accent-ink: #06122E; --good: #9DC44D;
      --sq: #191822;
    }
  }

  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; }
  body {
    background: var(--paper); color: var(--ink);
    font: 16px/1.5 var(--sans);
    -webkit-text-size-adjust: 100%;
    display: flex; flex-direction: column;
  }
  button, input, select { font: inherit; color: inherit; }
  button { cursor: pointer; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* ---------------------------------------------------------- chrome */
  header {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 13px 20px; border-bottom: 1px solid var(--line);
  }
  .mark { font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
  .mark b { color: var(--accent); }
  .promise {
    font: 12px/1.4 var(--mono); color: var(--muted);
    display: flex; align-items: center; gap: 6px;
  }
  .promise svg { width: 13px; height: 13px; flex: none; }
  .tail { margin-left: auto; display: flex; align-items: center; gap: 14px; }
  #offline { font: 11px var(--mono); color: var(--good); display: none; align-items: center; gap: 5px; }
  #offline.on { display: flex; }
  #offline i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
  #modeToggle {
    background: none; border: 1px solid var(--line); border-radius: 999px;
    padding: 5px 13px; font-size: 13px; color: var(--muted);
  }
  #modeToggle:hover { border-color: var(--accent); color: var(--accent); }
  body.advanced #modeToggle { border-color: var(--accent); color: var(--accent); }

  main { flex: 1; display: flex; min-height: 0; }
  @media (max-width: 880px) { main { flex-direction: column; } }

  /* ------------------------------------------------------------ stage */
  #stage {
    flex: 1; min-width: 0; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; position: relative;
  }

  /* ------------------------------------------------------------- hero */
  /* The transparency checkerboard is the one image everybody already reads as
     "cut out" — it is what every editor shows you where a background used to
     be. So the landing sits on a very faint one, drifting slowly, masked away
     from the middle so it never competes with the words. Costs nothing: no
     file, no decode, no bytes. */
  #hero {
    position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  }
  #hero::before {
    content: ""; position: absolute; inset: -80px;
    background: repeating-conic-gradient(var(--sq) 0% 25%, transparent 0% 50%) 0 0 / 64px 64px;
    animation: drift 34s linear infinite;
    -webkit-mask-image: radial-gradient(112% 88% at 50% 46%, transparent 26%, #000 92%);
    mask-image: radial-gradient(112% 88% at 50% 46%, transparent 26%, #000 92%);
  }
  /* A single soft bloom of the accent behind the headline, so the page has a
     centre of gravity without an image in it. */
  #hero::after {
    content: ""; position: absolute; left: 50%; top: 42%;
    width: min(880px, 92vw); aspect-ratio: 1.6; transform: translate(-50%, -50%);
    background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent 72%);
    filter: blur(6px);
  }
  @keyframes drift { to { background-position: 64px 64px; } }
  @media (prefers-reduced-motion: reduce) { #hero::before { animation: none; } }

  #drop {
    width: 100%; max-width: 660px; padding: 8px 24px 40px; text-align: center;
    border-radius: 20px; transition: transform .18s ease;
  }
  #drop.over { transform: scale(1.01); }
  #drop h1 {
    font-size: clamp(30px, 5.4vw, 50px); line-height: 1.03;
    letter-spacing: -.035em; margin: 0 0 14px; font-weight: 700;
  }
  #drop h1 em { font-style: normal; color: var(--accent); }
  #drop .lede { color: var(--muted); margin: 0 0 28px; font-size: 17px; }
  .pick {
    background: var(--accent); color: var(--accent-ink); border: 0;
    border-radius: 12px; padding: 17px 34px; font-weight: 600; font-size: 17px;
    box-shadow: 0 6px 18px -8px var(--accent);
  }
  .pick:hover { filter: brightness(1.08); }
  #dropzone {
    margin-top: 18px; border: 2px dashed var(--line); border-radius: 16px;
    padding: 18px; color: var(--muted); font-size: 14px;
    transition: border-color .18s ease, background .18s ease;
  }
  #drop.over #dropzone { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
  #dropzone .kbd {
    font: 12px var(--mono); border: 1px solid var(--line);
    border-radius: 5px; padding: 1px 5px; background: var(--card);
  }
  #drop .samples { margin-top: 18px; font-size: 14px; color: var(--muted); }
  #drop .samples button {
    background: none; border: 0; color: var(--accent);
    text-decoration: underline; text-underline-offset: 3px; padding: 0 5px;
  }
  #drop .claims {
    margin: 30px auto 0; max-width: 520px; padding-top: 20px;
    border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px;
    font: 12px/1.5 var(--mono); color: var(--muted);
  }
  #drop .claims span::before { content: "✓ "; color: var(--good); }
  #drop .claims .lead { color: var(--ink); font-weight: 600; }
  #ready { margin-top: 14px; font: 11px var(--mono); color: var(--muted); min-height: 16px; }

  /* result canvas + before/after */
  #result { display: none; width: 100%; height: 100%; flex-direction: column; gap: 10px; min-height: 0; }
  #result.on { display: flex; }
  #viewport {
    flex: 1; min-height: 0; position: relative; overflow: hidden;
    border-radius: var(--r); border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    background: var(--card);
  }
  #frame { position: relative; line-height: 0; }
  #frame canvas, #frame img { display: block; }
  .checker {
    background-color: #fff;
    background-image:
      linear-gradient(45deg, #e2e2dc 25%, transparent 25%),
      linear-gradient(-45deg, #e2e2dc 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #e2e2dc 75%),
      linear-gradient(-45deg, transparent 75%, #e2e2dc 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  }
  @media (prefers-color-scheme: dark) {
    .checker { background-color: #232229;
      background-image:
        linear-gradient(45deg, #34333c 25%, transparent 25%),
        linear-gradient(-45deg, #34333c 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #34333c 75%),
        linear-gradient(-45deg, transparent 75%, #34333c 75%); }
  }

  #before { position: absolute; inset: 0; overflow: hidden; width: 12%; }
  #before img { position: absolute; top: 0; left: 0; width: auto; }
  #handle {
    position: absolute; top: 0; bottom: 0; left: 12%; width: 2px;
    background: var(--accent); transform: translateX(-1px);
    cursor: ew-resize; touch-action: none;
  }
  #handle::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.28);
  }
  #handle span {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: var(--accent-ink); font: 700 13px var(--sans); z-index: 1; pointer-events: none;
  }
  .brushing #before, .brushing #handle { display: none; }
  .brushing#viewport { cursor: none; touch-action: none; }
  .brushing #frame { cursor: none; touch-action: none; }
  #ring {
    position: absolute; z-index: 2;
    border: 1.5px solid var(--accent); border-radius: 50%;
    pointer-events: none; display: none; box-shadow: 0 0 0 1px rgba(255,255,255,.6) inset;
  }
  .brushing #ring { display: block; }

  /* ------------------------------------------------- the simple bar */
  #quickbar {
    flex: none; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r);
    background: var(--card);
  }
  body.advanced #quickbar { display: none; }
  #quickSwatches { display: flex; gap: 7px; align-items: center; }
  #quickSwatches button {
    width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); padding: 0;
  }
  #quickSwatches button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
  #quickSwatches .clear { background-size: 10px 10px; background-position: 0 0, 0 5px, 5px -5px, -5px 0; }
  #quickSwatches .more { position: relative; overflow: hidden;
    background: conic-gradient(#ff5949, #ecd06f, #7a8b69, #2779a7, #0054fa, #ff5949); }
  #quickSwatches .more input { position: absolute; inset: -8px; opacity: 0; cursor: pointer; }
  #quickbar .spacer { flex: 1 1 auto; }
  .ghostlink {
    background: none; border: 0; color: var(--muted); font-size: 14px;
    text-decoration: underline; text-underline-offset: 3px; padding: 4px 0;
  }
  .ghostlink:hover { color: var(--accent); }

  /* filmstrip for a batch */
  #strip { display: none; gap: 8px; overflow-x: auto; padding-bottom: 2px; flex: none; }
  #strip.on { display: flex; }
  #strip button {
    position: relative; flex: none; width: 62px; height: 62px; padding: 0;
    border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card);
  }
  #strip button[aria-current="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
  #strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
  #strip .tag {
    position: absolute; inset: auto 0 0 0; font: 9px/14px var(--mono);
    background: rgba(0,0,0,.62); color: #fff; text-align: center;
  }
  #strip .tag.fail { background: var(--hot); }

  /* ------------------------------------------------------------ panel */
  aside {
    width: 330px; flex: none; border-left: 1px solid var(--line);
    padding: 18px; overflow-y: auto; background: var(--card);
    flex-direction: column; gap: 20px; display: none;
  }
  body.advanced aside.on { display: flex; }
  @media (max-width: 880px) {
    aside { width: auto; border-left: 0; border-top: 1px solid var(--line); }
    #stage { padding: 12px; }
    #viewport { min-height: 42vh; }
  }
  /* Thumbs, not mouse pointers. */
  @media (max-width: 560px) {
    #quickbar { gap: 10px; padding: 12px; }
    #quickSwatches { flex: 1 1 100%; justify-content: space-between; }
    #quickSwatches button { width: 40px; height: 40px; }
    #quickbar .spacer { display: none; }
    #quickFix, #quickNew { flex: 1 1 0; text-align: center; }
    #quickbar .download { flex: 1 1 100%; order: 9; padding: 16px; }
    #drop { padding-top: 0; }
    #drop .claims { gap: 5px 14px; }
  }

  .group > h2, details.group > summary {
    font: 600 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: baseline;
  }
  .group > h2 em, details.group > summary em { font-style: normal; font-size: 10px; letter-spacing: 0; text-transform: none; }
  details.group > summary { cursor: pointer; list-style: none; padding: 4px 0; }
  details.group > summary::-webkit-details-marker { display: none; }
  details.group > summary::after { content: "+"; font-size: 14px; color: var(--muted); }
  details.group[open] > summary::after { content: "2"; }
  details.group[open] > summary { margin-bottom: 12px; }
  details.group + details.group { border-top: 1px solid var(--line); padding-top: 14px; }

  /* zoom, sitting on the canvas in both views */
  #zoomer {
    position: absolute; right: 10px; bottom: 10px; display: flex; z-index: 3;
    border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
    background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(4px);
  }
  #zoomer button {
    background: none; border: 0; border-right: 1px solid var(--line);
    padding: 6px 10px; font-size: 13px; color: var(--muted); min-width: 34px;
  }
  #zoomer button:last-child { border-right: 0; }
  #zoomer button:hover { color: var(--accent); }
  #zoomLabel { font: 11px var(--mono); }
  #viewport.zoomed:not(.brushing) { cursor: grab; }
  #viewport.zoomed:not(.brushing):active { cursor: grabbing; }
  .seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .seg button {
    flex: 1; background: none; border: 0; padding: 10px 6px; font-size: 14px;
    color: var(--muted); border-right: 1px solid var(--line);
  }
  .seg button:last-child { border-right: 0; }
  .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

  .swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 10px; }
  .swatches button { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); padding: 0; }
  .swatches button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
  .swatches .custom { position: relative; overflow: hidden;
    background: conic-gradient(#ff5949, #ecd06f, #7a8b69, #2779a7, #0054fa, #ff5949); }
  .swatches .custom input { position: absolute; inset: -8px; opacity: 0; cursor: pointer; }

  .subtle {
    background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
    padding: 11px; width: 100%; font-size: 14px;
  }
  .subtle:hover { border-color: var(--accent); }
  .subtle[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
  .row { display: flex; gap: 8px; }
  .check { display: flex; align-items: center; gap: 9px; font-size: 14px; padding: 5px 0; }
  .check input { width: 17px; height: 17px; accent-color: var(--accent); }
  select.subtle { appearance: auto; }

  input[type=range] { width: 100%; accent-color: var(--accent); }
  .rangeRow { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
  .rangeRow label { font: 11px var(--mono); color: var(--muted); flex: none; }

  .download {
    background: var(--accent); color: var(--accent-ink); border: 0;
    border-radius: 11px; padding: 14px 26px; font-weight: 700; font-size: 16px;
    box-shadow: 0 6px 18px -10px var(--accent); white-space: nowrap;
  }
  .download:hover { filter: brightness(1.08); }
  .meta { font: 11px/1.5 var(--mono); color: var(--muted); text-align: center; margin-top: 8px; }

  /* ------------------------------------------------------------ busy */
  #busy {
    position: absolute; inset: 0; display: none;
    align-items: center; justify-content: center; flex-direction: column; gap: 14px;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(3px); z-index: 5; padding: 24px; text-align: center;
  }
  #busy.on { display: flex; }
  #busy .what { font-size: 17px; font-weight: 600; }
  #busy .track { width: min(340px, 80vw); height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
  #busy .track i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
  #busy .track.indet i { width: 40%; animation: slide 1.1s ease-in-out infinite; }
  @keyframes slide { from { margin-left: -40%; } to { margin-left: 100%; } }
  #busy .detail { font: 12px var(--mono); color: var(--muted); max-width: 44ch; }

  #oops {
    margin: 0 0 4px; padding: 12px 14px; border-radius: 10px; font-size: 14px;
    background: color-mix(in srgb, var(--hot) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--hot) 45%, transparent);
    display: none; flex: none;
  }
  #oops.on { display: block; }
  #oops button {
    display: block; margin-top: 9px; background: var(--ink); color: var(--paper);
    border: 0; border-radius: 8px; padding: 9px 14px; font-size: 14px; font-weight: 600;
  }

  footer {
    padding: 12px 20px; border-top: 1px solid var(--line);
    font: 11px/1.6 var(--mono); color: var(--muted);
    display: flex; gap: 18px; flex-wrap: wrap;
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- prose */
/* The words under the tool on an intent page. Deliberately narrow: reading
   width is about 66 characters, and nothing here should compete with the
   picture above it. */
.prose {
  max-width: 62ch; margin: 0 auto; padding: 8px 24px 72px;
  font-size: 17px; line-height: 1.62;
}
.prose h2 {
  font-size: 22px; letter-spacing: -.02em; margin: 40px 0 12px; font-weight: 700;
}
.prose h2:first-child { margin-top: 8px; }
.prose h3 { font-size: 16px; margin: 26px 0 6px; font-weight: 650; }
.prose p { margin: 0 0 16px; color: var(--ink); }
.prose h3 + p { color: var(--muted); }
.prose em { font-style: normal; font-weight: 600; color: var(--accent); }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose .backlink {
  margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); font-weight: 600;
}
.prose .backlink a { text-decoration: none; }
.prose .backlink a:hover { text-decoration: underline; }
/* An intent page scrolls; the tool page does not. */
body:has(.prose) { height: auto; }
body:has(.prose) main { min-height: 78vh; }
body:has(.prose) #stage { min-height: 62vh; }
