/* The interface's single stylesheet. Split from index.html for one reason only:
   a 1200-line file was the largest mental hurdle in the repository. Still no build
   step -- three static files instead of one, served as they are. */

  :root {
    --bg:        #1b252e;
    --bg-lift:   #232f3a;
    --panel:     #26333f;
    --panel-in:  #1f2a34;
    --line:      #37485a;
    --fg:        #f2f4f5;
    --muted:     #93a3b0;
    --pink:      #f07ea3;
    --pink-soft: #f7b3c8;
    --ok:        #8fd3b0;
    --warn:      #e0b356;
    --bad:       #e0644a;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  }
  * { box-sizing: border-box; }
  html { color-scheme: dark; scroll-behavior: smooth; }
  body {
    margin: 0; padding: 0 1.25rem 5rem; color: var(--fg);
    background: radial-gradient(120% 90% at 50% 0%, var(--bg-lift) 0%, var(--bg) 62%) fixed;
    min-height: 100vh;
    font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  main { max-width: 64rem; margin: 0 auto; }
  #mainContent { max-width: none; }
  .hidden, [hidden] { display: none !important; }
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .skip-link {
    position: fixed; z-index: 1000; top: .75rem; left: .75rem; padding: 12px 16px;
    color: var(--bg); background: var(--fg); border-radius: 7px; transform: translateY(-200%);
  }
  .skip-link:focus { transform: translateY(0); }
  :focus-visible { outline: 3px solid var(--pink-soft); outline-offset: 3px; }

  /* --- shared navigation and typography ----------------------------------------- */
  a { color: inherit; text-decoration: none; }
  h1, h2, p { overflow-wrap: anywhere; }
  .site-nav {
    max-width: 76rem; min-height: 4.5rem; margin: 0 auto; display: flex; align-items: center;
    gap: 1rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .86rem;
  }
  .site-nav > a { padding: 12px 4px; }
  .site-nav > a:hover { color: var(--fg); }
  .site-brand {
    margin-right: auto; color: var(--fg); font: 600 1rem/1 var(--mono);
    letter-spacing: .06em;
  }
  .mode-switch, .locale-switch, .nav-overflow {
    display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line);
    border-radius: 9px; background: var(--panel-in);
  }
  .mode-switch button, .locale-switch button, .nav-overflow button {
    min-width: 44px; min-height: 44px; padding: 8px 12px; border: 0; background: transparent;
    color: var(--muted);
  }
  .mode-switch button[aria-pressed="true"],
  .locale-switch button[aria-pressed="true"],
  .nav-overflow button[aria-pressed="true"] { color: var(--bg); background: var(--fg); }
  .eyebrow {
    margin: 0 0 12px; color: var(--pink-soft); font: 600 .72rem/1 var(--mono);
    letter-spacing: .15em; text-transform: uppercase;
  }

  /* --- adaptive hero ------------------------------------------------------------- */
  #siteHero {
    max-width: 76rem; margin: 0 auto; padding: clamp(4rem, 11vw, 8.5rem) 0 clamp(3rem, 8vw, 6rem);
    transition: padding .24s ease-out;
  }
  #siteHero h1 {
    max-width: 17ch; margin: 0; font: 600 clamp(2.7rem, 7vw, 6.2rem)/.98 var(--mono);
    letter-spacing: -.06em;
  }
  .hero-lead { max-width: 42rem; margin: 28px 0 0; color: var(--muted); font-size: 1.1rem; }
  .primary-action {
    display: inline-flex; align-items: center; min-height: 3rem; margin-top: 2rem;
    padding: 12px 20px; border: 1px solid var(--pink); border-radius: 9px;
    color: var(--bg); background: var(--pink-soft); font-weight: 650;
  }
  .primary-action:hover { background: var(--pink); }

  /* --- identity ------------------------------------------------------------------- */
  header { display: flex; align-items: center; gap: 1rem; margin-bottom: .2rem; }
  header img { flex: none; height: 76px; width: auto; image-rendering: pixelated; }
  h1 {
    font: 600 1.55rem/1 var(--mono); letter-spacing: .04em; margin: 0;
  }
  .tagline { color: var(--muted); margin: 0 0 2rem 0; font-size: .95rem; }
  .tagline a { color: var(--pink-soft); border-bottom: 1px solid transparent; }
  .tagline a:hover { border-bottom-color: var(--pink-soft); }

  /* --- Studio toolbar, session strip, canvas, inspector and output --------------- */
  #studio {
    max-width: 76rem; margin: 0 auto; padding: clamp(20px, 3vw, 40px);
    border: 1px solid var(--line); border-radius: 18px; background: rgba(31, 42, 52, .78);
    box-shadow: 0 1.8rem 4rem rgba(0, 0, 0, .18);
  }
  .studio-header {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
    margin: 0 0 20px;
  }
  .studio-header .eyebrow { margin: 0; }
  .studio-header h2 { margin: 0; font: 600 clamp(1.15rem, 2vw, 1.55rem)/1.2 var(--mono); }
  .session-strip:empty { display: none; }
  #workspace { min-width: 0; }

  /* --- drop zone ------------------------------------------------------------------ */
  #drop {
    position: relative; border-radius: 14px; padding: 3.25rem 1.5rem; text-align: center;
    cursor: pointer; background: var(--panel); border: 1px solid var(--line);
    transition: border-color .18s, background .18s, transform .18s;
  }
  #drop::before {
    content: ""; position: absolute; inset: 9px; border-radius: 8px; pointer-events: none;
    border: 2px dashed var(--line); transition: border-color .18s;
  }
  #drop:hover, #drop.over { background: #2b3844; }
  #drop:hover::before, #drop.over::before { border-color: var(--pink); }
  #drop.over { transform: scale(1.006); border-color: var(--pink); }
  #drop strong { font-size: 1.05rem; }
  #drop .hint { color: var(--muted); font-size: .87rem; margin: .45rem 0 0; }
  /* Once an image is loaded the invitation has done its job and should stop taking a third of
     the screen. It stays reachable, just out of the way. */
  #drop.compact { padding: .8rem 1.2rem; }
  #drop.compact strong { font-size: .92rem; font-weight: 500; }
  #drop.compact .hint, #drop.compact::before { display: none; }
  .linkish {
    border: none; background: none; color: var(--muted); text-decoration: underline;
    padding: .2rem .4rem; font-size: .85rem; cursor: pointer;
  }
  .linkish:hover { border: none; color: var(--pink-soft); }

  /* --- the wait ------------------------------------------------------------------- */
  /* A recovery legitimately takes seconds to a minute. Everything below the drop zone dims
     while one runs: the alternative -- last photograph's diagnostics standing crisp and
     confident next to a new photograph -- had someone reading numbers that belonged to a
     different image. */
  .busy #results { opacity: .35; pointer-events: none; }
  .busy.watching #results { opacity: 1; pointer-events: auto; }
  #results { transition: opacity .25s; }
  .progress {
    display: none; align-items: center; gap: 1rem; min-height: 5rem;
    margin-top: 1rem; padding: .8rem 1rem; overflow: hidden;
    background: var(--panel-in); border: 1px solid var(--line); border-radius: 12px;
    border-left: 3px solid var(--pink);
  }
  .progress:has(#status:not(:empty)) { display: flex; }
  .progress #status { flex: 1; min-width: 0; }
  .progress-mark {
    position: relative; display: none; flex: 0 0 3.5rem; width: 3.5rem; height: 3.5rem;
    overflow: hidden; border: 1px solid var(--line); border-radius: 7px;
    background-color: var(--bg-lift);
    background-image: radial-gradient(circle, rgba(240, 126, 163, .28) 1.2px, transparent 1.4px);
    background-size: 7px 7px;
  }
  .progress.working .progress-mark, .progress.complete .progress-mark { display: block; }
  .progress-finder {
    position: absolute; width: 13px; height: 13px; border: 2px solid var(--pink-soft);
    background: var(--bg-lift);
  }
  .progress-finder::after {
    content: ""; position: absolute; inset: 3px; background: var(--pink);
  }
  .progress-finder.top-left { top: 5px; left: 5px; }
  .progress-finder.top-right { top: 5px; right: 5px; }
  .progress-finder.bottom-left { bottom: 5px; left: 5px; }
  .progress-scan {
    position: absolute; z-index: 2; left: 4px; right: 4px; top: 5px; height: 2px;
    background: var(--ok); box-shadow: 0 0 8px rgba(143, 211, 176, .9);
    animation: progress-scan 1.35s ease-in-out infinite alternate;
  }
  @keyframes progress-scan { to { transform: translateY(42px); } }
  .progress.complete { border-left-color: var(--ok); }
  .progress.complete .progress-finder, .progress.complete .progress-scan { display: none; }
  .progress.complete .progress-mark::after {
    content: ""; position: absolute; left: 17px; top: 10px; width: 14px; height: 25px;
    border: solid var(--ok); border-width: 0 4px 4px 0; transform: rotate(45deg);
  }
  .quiet { color: var(--muted); }
  .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

  /* --- layout --------------------------------------------------------------------- */
  /* Panels size to their own content. Stretching the diagnostics to match the height of the
     photograph left a column of empty panel under seven lines of numbers. */
  .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-top: 1.4rem;
         align-items: start; }
  .panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 1.1rem;
  }
  .panel h2 {
    display: flex; align-items: center; gap: .5rem;
    font: 600 .72rem/1 var(--mono); text-transform: uppercase; letter-spacing: .12em;
    color: var(--muted); margin: 0 0 .9rem;
  }
  .panel h2::before {
    content: ""; width: 7px; height: 7px; background: var(--pink); flex: none;
  }
  canvas, .panel img {
    max-width: 100%; display: block; border-radius: 8px; background: var(--panel-in);
  }
  canvas { cursor: crosshair; }
  canvas.outline-editing {
    min-width: 44px; min-height: 44px; touch-action: none; cursor: crosshair;
  }
  canvas.outline-editing.outline-ready { cursor: grab; }
  canvas.outline-editing.outline-dragging { cursor: grabbing; }
  .photo-stage {
    position: relative; display: inline-block; max-width: 100%; overflow: hidden;
    vertical-align: top; border-radius: 8px;
  }
  .success-lock {
    position: absolute; inset: 0; overflow: hidden; opacity: 0; pointer-events: none;
    background: radial-gradient(circle at center, rgba(143, 211, 176, .08), transparent 56%);
  }
  .lock-corner {
    position: absolute; width: clamp(2.4rem, 22%, 5rem); height: clamp(2.4rem, 22%, 5rem);
    opacity: 0; filter: drop-shadow(0 0 5px rgba(143, 211, 176, .65));
  }
  .lock-corner.top-left { top: 8px; left: 8px; border-top: 3px solid var(--ok); border-left: 3px solid var(--ok); }
  .lock-corner.top-right { top: 8px; right: 8px; border-top: 3px solid var(--ok); border-right: 3px solid var(--ok); }
  .lock-corner.bottom-left { bottom: 8px; left: 8px; border-bottom: 3px solid var(--ok); border-left: 3px solid var(--ok); }
  .lock-corner.bottom-right { right: 8px; bottom: 8px; border-right: 3px solid var(--ok); border-bottom: 3px solid var(--ok); }
  .lock-sweep {
    position: absolute; z-index: 2; left: 8px; right: 8px; top: 0; height: 2px; opacity: 0;
    background: linear-gradient(90deg, transparent, var(--ok) 20% 80%, transparent);
    box-shadow: 0 0 10px rgba(143, 211, 176, .8);
  }
  .photo-stage.locked .success-lock { animation: success-lock 1.55s ease-out both; }
  .photo-stage.locked .lock-corner { animation: lock-corner-in .42s cubic-bezier(.2,.8,.2,1) .08s both; }
  .photo-stage.locked .lock-sweep { animation: lock-sweep .62s ease-out .18s both; }
  #results.success-reveal #verdict,
  #results.success-reveal #payload,
  #results.success-reveal #images,
  #results.success-reveal #exports { animation: result-reveal .42s cubic-bezier(.2,.8,.2,1) both; }
  #results.success-reveal #payload { animation-delay: .07s; }
  #results.success-reveal #images { animation-delay: .13s; }
  #results.success-reveal #exports { animation-delay: .19s; }
  @keyframes success-lock {
    0% { opacity: 0; }
    12%, 76% { opacity: 1; }
    100% { opacity: 0; }
  }
  @keyframes lock-corner-in {
    from { opacity: 0; transform: scale(1.22); }
    to { opacity: 1; transform: scale(1); }
  }
  @keyframes lock-sweep {
    0% { top: 0; opacity: 0; }
    18% { opacity: 1; }
    100% { top: calc(100% - 2px); opacity: 0; }
  }
  @keyframes result-reveal {
    from { opacity: .2; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
  }
  #images img { width: 100%; image-rendering: pixelated; }

  #thumbs { display: flex; gap: .55rem; flex-wrap: wrap; margin-bottom: .8rem; }
  .thumb { position: relative; }
  .thumb img { height: 54px; border-radius: 6px; display: block; }
  .thumb button {
    position: absolute; top: -8px; right: -8px; width: 44px; height: 44px; padding: 0;
    border-radius: 50%; font-size: .72rem; line-height: 1;
  }

  #cameraPanel { margin-top: 1rem; max-width: 34rem; margin-left: auto; margin-right: auto; }
  #cameraFeed { width: 100%; border-radius: 8px; background: #000; display: block; }

  #modeRow {
    display: flex; gap: 1.6rem; justify-content: center; flex-wrap: wrap;
    margin-top: .7rem; color: var(--muted); font-size: .87rem;
  }
  #modeRow label { display: inline-flex; gap: .45rem; align-items: center; cursor: pointer; }
  #modeRow input { accent-color: var(--pink); }
  #modeRow label:has(input:checked) { color: var(--fg); }

  #catalogPanel { margin-top: 1.4rem; }
  .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
           gap: .9rem; margin: .4rem 0 .9rem; }
  .card {
    background: var(--panel-in); border: 1px solid var(--line); border-radius: 10px;
    padding: .8rem; display: flex; flex-direction: column; gap: .6rem;
  }
  .card.miss { border-left: 3px solid var(--bad); }
  .card.dup  { opacity: .6; }
  .card img { width: 7.5rem; image-rendering: pixelated; border-radius: 6px; }
  .card input.title {
    font: inherit; padding: .5rem .6rem; border-radius: 7px; width: 100%;
    border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  }
  .card .snippet {
    font: 11px/1.5 var(--mono); color: var(--muted); word-break: break-all;
    max-height: 4.6em; overflow: hidden;
  }
  .card .state { font: 600 .68rem/1 var(--mono); letter-spacing: .1em;
                 text-transform: uppercase; }

  /* The live view during a recovery: the true intermediate states, not an animation. */
  #live .stage { font-size: .9rem; margin-bottom: .8rem; min-height: 1.3em; }
  #live .stage a {
    display: inline-flex; align-items: center; min-height: 44px;
    color: var(--pink-soft); border-bottom: 1px solid transparent;
  }
  #live .stage a:hover { border-bottom-color: var(--pink-soft); }
  .heatrow { display: flex; gap: .9rem; align-items: flex-start; margin-top: .9rem; }
  #heat { image-rendering: pixelated; border-radius: 6px; max-width: 11rem; }
  .racebar { display: inline-block; height: .55em; background: var(--line); border-radius: 3px;
             vertical-align: middle; margin-right: .5rem; }
  .racebar.best { background: var(--pink); }

  dl { display: grid; grid-template-columns: auto 1fr; gap: .42rem 1rem; margin: 0; }
  dt { color: var(--muted); }
  dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; }
  .ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

  /* One sentence of judgement above the numbers: the numbers stay the evidence, but not
     everyone who drops a photograph knows whether 6 of 841 uncertain cells is good news. */
  .verdict {
    border-radius: 8px; padding: .55rem .8rem; margin-bottom: .9rem; font-size: .9rem;
    background: var(--panel-in); border: 1px solid var(--line);
  }
  .verdict.ok   { border-left: 3px solid var(--ok); }
  .verdict.warn { border-left: 3px solid var(--warn); }
  .verdict.bad  { border-left: 3px solid var(--bad); }

  /* --- payload -------------------------------------------------------------------- */
  .payload {
    margin-top: 1.4rem; padding: 1.15rem 1.25rem; border-radius: 12px;
    background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--pink);
  }
  .payload.miss { border-left-color: var(--bad); }
  .payload .label { font: 600 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
  .payload code {
    display: block; margin-top: .7rem; padding: .7rem .85rem; border-radius: 8px;
    background: var(--panel-in); font: 14px/1.55 var(--mono); word-break: break-all;
    user-select: all;
  }
  .tips { margin: .7rem 0 0; padding-left: 1.15rem; color: var(--muted); font-size: .9rem; }
  .tips li { margin: .35rem 0; }
  .tips em { color: var(--pink-soft); font-style: normal; }

  /* --- controls ------------------------------------------------------------------- */
  .actions { display: flex; gap: .55rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
  button {
    min-width: 44px; min-height: 44px; font: 500 .88rem/1 inherit; padding: .55rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--line); background: var(--panel-in); color: var(--fg);
    cursor: pointer; transition: border-color .15s, color .15s;
  }
  button:hover { border-color: var(--pink); color: var(--pink-soft); }
  .download-control {
    display: inline-flex; align-items: center; justify-content: center; font: 500 .88rem/1 inherit;
    padding: .55rem 1rem; border: 1px solid var(--line); border-radius: 8px;
    background: var(--panel-in); color: var(--fg);
  }
  .download-control:hover { border-color: var(--pink); color: var(--pink-soft); }

  /* `.interactive-targets` names the shared hit-area contract for its automated audit. */
  .interactive-targets,
  .site-brand,
  .site-nav > a,
  summary,
  .manual-rail a,
  input[type="radio"],
  input[type="checkbox"],
  input[type="number"],
  input[type="text"],
  select,
  .text-link,
  .editorial-links a,
  footer a,
  .legal-page a,
  .manual-content a,
  #faq a,
  #faq-de a,
  .payload a[download] {
    min-width: 44px; min-height: 44px;
  }
  .site-brand,
  .site-nav > a,
  summary,
  .manual-rail a,
  .text-link,
  .editorial-links a,
  footer a,
  .legal-page a,
  .manual-content a,
  #faq a,
  #faq-de a,
  .payload a[download] {
    display: inline-flex; align-items: center;
  }
  .note { color: var(--muted); font-size: .85rem; margin-top: .65rem; min-height: 1.2em; }
  .note em { color: var(--pink-soft); font-style: normal; }

  details.panel { margin-top: 1.4rem; }
  summary { cursor: pointer; color: var(--muted); font: 600 .72rem/1 var(--mono);
            letter-spacing: .12em; text-transform: uppercase; }
  pre.grid {
    font: 10px/1 var(--mono); overflow-x: auto; margin: .9rem 0 0; letter-spacing: .55px;
    color: var(--muted);
  }
  label.size { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted);
               font-size: .87rem; }
  label.size select { font: inherit; padding: .45rem .5rem; border-radius: 7px;
                      border: 1px solid var(--line); background: var(--panel-in); color: var(--fg); }
  label.size input { width: 5rem; font: inherit; padding: .45rem .5rem; border-radius: 7px;
                     border: 1px solid var(--line); background: var(--panel-in);
                     color: var(--fg); font-variant-numeric: tabular-nums; }
  #splitRow { display: flex; gap: .5rem; align-items: flex-start; margin-top: .9rem;
              max-width: 46rem; }
  .knowledge { margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); }
  .payload-kind { color: var(--pink-soft); font: 600 .76rem/1.2 var(--mono);
                  letter-spacing: .08em; text-transform: uppercase; }
  .knowledge dl { margin-top: .6rem; font-size: .9rem; }
  .knowledge .note { margin-top: .3rem; }

/* --- state-driven companion ------------------------------------------------------ */
#companion {
  position: fixed; z-index: 40; top: 0; left: 0; width: 96px; min-height: 96px;
  pointer-events: none; will-change: transform;
}
#companionSprite {
  width: 96px; height: 96px; background: url("axolotl-companion.png") 0 0 / 600% 100% no-repeat;
  image-rendering: pixelated;
}
#companion[data-pose="walk"][data-motion="active"] #companionSprite {
  animation: companion-walk .56s steps(2, jump-none) infinite;
}
@keyframes companion-walk {
  from { background-position: 20% 0; }
  to { background-position: 40% 0; }
}
#companion[data-motion="still"] #companionSprite { animation: none; }
#companionBubble {
  position: absolute; left: 76px; top: 0; width: min(18rem, calc(100vw - 7rem));
  max-height: calc(100vh - 16px); overflow-y: auto;
  padding: 12px; pointer-events: none; border: 1px solid var(--pink);
  border-radius: 9px; color: var(--fg); background: var(--panel-in);
  font-size: .86rem; line-height: 1.45;
}
#companionBubble p { margin: 0 0 8px; }
#companionBubble > button { display: block; margin-left: auto; }
#companionBubble .companion-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#companionBubble a, #companionBubble button {
  min-height: 44px; padding: 10px 12px; pointer-events: auto; border: 1px solid var(--line);
  border-radius: 7px; color: var(--fg); background: var(--panel);
}
#companionBubble a { display: inline-flex; align-items: center; border-color: var(--pink); }

/* The footer is a legal obligation before it is a design element, so it stays legible and
   stops there -- no columns, no repeated navigation, nothing competing with the work. */
footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line);
         display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline;
         font-size: .85rem; color: var(--muted); }
footer a { color: var(--muted); }
footer a:hover { color: var(--fg); }

/* The lead answers the search that brought somebody here; it earns slightly more presence
   than body text but must not shout past the drop zone, which is the actual next step. */
.lead { max-width: 44rem; margin: 0 0 1.1rem 0; font-size: 1.06rem; color: var(--fg); }

/* The questions people type, styled as quiet help rather than a landing-page section. Native
   <details> keeps the section script-free, which the CSP appreciates as much as we do. */
#faq, #faq-de { margin-top: 3rem; max-width: 46rem; }
#faq h2, #faq-de h2 { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
          color: var(--muted); }
#faq details, #faq-de details { border-bottom: 1px solid var(--line); }
#faq summary, #faq-de summary { padding: .7rem 0; cursor: pointer; color: var(--fg); font-weight: 600;
               list-style-position: outside; }
#faq summary:hover, #faq-de summary:hover { color: var(--pink-soft); }
#faq p, #faq-de p { margin: .2rem 0 .9rem 0; color: var(--muted); line-height: 1.55; }
#faq a, #faq-de a { color: var(--pink-soft); }

/* --- editorial sections, method and legal pages ---------------------------------- */
.manual-page, .legal-shell { overflow-x: hidden; }
.manual-layout {
  max-width: 76rem; margin: 0 auto; display: grid; grid-template-columns: 13rem minmax(0, 46rem);
  gap: clamp(2rem, 6vw, 6rem); align-items: start; padding: clamp(3rem, 7vw, 6rem) 0;
}
.manual-rail {
  position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.manual-rail a { padding: 8px 0; color: var(--muted); font-size: .82rem; }
.manual-rail a:hover { color: var(--pink-soft); }
.manual-content { min-width: 0; }
.manual-intro { margin: 0 0 3rem; color: var(--muted); font-size: 1.05rem; }
.manual-content section { scroll-margin-top: 1rem; }
.manual-content h1, .manual-content h2 {
  margin: 0; font: 600 clamp(1.8rem, 4vw, 3rem)/1.05 var(--mono); letter-spacing: -.04em;
}
.manual-content h2 {
  margin-top: 4rem; padding-top: 1rem; border-top: 1px solid var(--line);
  font-size: clamp(1.4rem, 3vw, 2.15rem);
}
.manual-content h2 .num {
  display: block; margin-bottom: 12px; color: var(--pink); font: 600 .72rem/1 var(--mono);
  letter-spacing: .12em;
}
.manual-content h3 { margin: 2rem 0 .25rem; color: var(--pink-soft); font-size: 1rem; }
.manual-content p { margin: .75rem 0; }
.manual-content em { color: var(--pink-soft); font-style: normal; font-weight: 600; }
.manual-content code, .legal-page code {
  padding: .1em .35em; border-radius: 4px; background: var(--panel-in); font: .92em var(--mono);
}
.manual-content .formula {
  margin: 1.25rem 0; padding: 1rem 1.25rem; overflow-x: auto; border: 1px solid var(--line);
  border-left: 3px solid var(--pink); border-radius: 8px; background: var(--panel);
  font: 15px/1.9 var(--mono);
}
.manual-content .where {
  display: block; margin-top: .5rem; color: var(--muted); font: .85em/1.6 var(--mono);
}
.manual-content .aside {
  margin: 1.5rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--muted); font-size: .93rem;
}
.manual-content .aside b, .manual-content figcaption b { color: var(--fg); }
.manual-content figure {
  margin: 1.5rem 0; padding: 1rem 1rem .75rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel);
}
.manual-content .plot { max-width: 100%; overflow-x: auto; }
.manual-content figure img { display: block; width: 100%; min-width: 520px; height: auto; }
.manual-content figcaption {
  margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .87rem; line-height: 1.6;
}
.manual-content ul { padding-left: 1.25rem; }
.manual-content li { margin: .25rem 0; }
.manual-content table { width: 100%; margin: 1.25rem 0; border-collapse: collapse; font-size: .93rem; }
.manual-content th, .manual-content td {
  padding: .5rem 1rem .5rem 0; border-bottom: 1px solid var(--line); text-align: left;
}
.manual-content th { color: var(--muted); font-size: .85rem; font-weight: 500; }
.manual-content td { font-variant-numeric: tabular-nums; }
.manual-content td.num { font-family: var(--mono); }
.manual-footer { margin-top: 3rem; color: var(--muted); font-size: .9rem; }
.manual-footer a:hover, .legal-page a:hover { color: var(--pink-soft); }
.legal-page { max-width: 44rem; margin: 0 auto; padding: clamp(3rem, 7vw, 6rem) 0; }
.legal-page h1 { font: 600 clamp(1.8rem, 5vw, 2.8rem)/1.05 var(--mono); letter-spacing: -.04em; }
.legal-page h2 { margin-top: 2.5rem; }
.legal-page h3 { margin-top: 1.75rem; color: var(--pink-soft); }
.legal-page dt { margin-top: .75rem; font-weight: 600; }
.legal-page dd { margin: 0 0 0 1rem; }
.legal-page .plain, .legal-authority { color: var(--muted); font-size: .92em; }
.legal-authority { padding-left: 12px; border-left: 2px solid var(--pink); }
.legal-back { margin-top: 3rem; }
#methodSummary, #situations, #privacyOpenSource {
  max-width: 76rem; margin: clamp(4rem, 9vw, 7rem) auto 0;
}
#methodSummary h2, #situations > h2, #privacyOpenSource h2 {
  max-width: 24ch; margin: 0; font: 600 clamp(1.8rem, 4vw, 3.5rem)/1.05 var(--mono);
  letter-spacing: -.04em;
}
#methodSummary ol {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0;
  margin: 2rem 0 24px; list-style: none; counter-reset: method;
  border: 1px solid var(--line); background: var(--line);
}
#methodSummary li {
  min-height: 8rem; padding: 20px; background: var(--panel-in); counter-increment: method;
}
#methodSummary li::before {
  content: "0" counter(method); display: block; margin-bottom: 2rem; color: var(--pink-soft);
  font: 600 .72rem/1 var(--mono);
}
.text-link, .editorial-links a {
  color: var(--pink-soft); text-decoration: underline; text-underline-offset: .25em;
}
#situations #faq, #situations #faq-de { max-width: 52rem; margin-top: 2rem; }
#situations #faq h2, #situations #faq-de h2 { margin-top: 0; }
#privacyOpenSource {
  padding: clamp(1.5rem, 5vw, 3.5rem); border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel);
}
#privacyOpenSource p:not(.eyebrow) { max-width: 48rem; color: var(--muted); }
.editorial-links { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: 24px; }
footer { max-width: 76rem; margin-right: auto; margin-left: auto; }

/* --- phase and Easy/Pro visibility ----------------------------------------------- */
.studio-phase-welcome #siteHero {
  padding: clamp(4rem, 11vw, 8.5rem) 0 clamp(3rem, 8vw, 6rem);
}
#studioShell:not(.studio-phase-welcome) #siteHero { padding: 2.25rem 0 1.5rem; }
#studioShell:not(.studio-phase-welcome) #siteHero h1 {
  max-width: none; font-size: clamp(1.65rem, 4vw, 2.7rem); letter-spacing: -.04em;
}
#studioShell:not(.studio-phase-welcome) #siteHero .hero-lead,
#studioShell:not(.studio-phase-welcome) #siteHero .primary-action { display: none; }
.studio-mode-easy #results > .row:first-child { grid-template-columns: 1fr; }
.studio-mode-easy #diagnosticsPanel { grid-column: 1; }
.studio-mode-easy #diagnosticsDetails > summary,
.studio-mode-easy #advancedExport > summary { color: var(--muted); }
.studio-mode-pro #diagnosticsPanel { grid-column: auto; }
.studio-mode-pro #diagnosticsDetails > summary,
.studio-mode-pro #advancedExport > summary { color: var(--pink-soft); }
#diagnosticsDetails, #advancedExport { margin-top: 1rem; }

/* --- responsive breakpoints ------------------------------------------------------- */
@media (max-width: 48rem) {
  body { padding-right: 1rem; padding-left: 1rem; }
  .site-nav { padding: 12px 0; flex-wrap: wrap; gap: 8px 12px; }
  .site-brand { flex-basis: calc(100% - 8rem); }
  .site-nav > a:not(.site-brand) { order: 3; }
  .mode-switch, .locale-switch, .nav-overflow { order: 2; }
  #siteHero { padding-top: 4rem; }
  #studio { padding: 1rem; border-radius: 13px; }
  .studio-header { align-items: flex-start; flex-direction: column; }
  .row, .studio-mode-easy #results > .row:first-child { grid-template-columns: 1fr; }
  #methodSummary ol { grid-template-columns: 1fr; }
  #methodSummary li { min-height: 0; }
  #methodSummary li::before { margin-bottom: 12px; }
  .manual-layout { display: block; padding-top: 2rem; }
  .manual-rail {
    position: static; flex-direction: row; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 3rem;
  }
  .manual-rail a { padding: 8px 0; }
}

@media (max-width: 20rem) {
  body { padding-right: 12px; padding-left: 12px; }
  .site-nav, .actions, #modeRow, .editorial-links { align-items: stretch; }
  .site-nav > *, .actions > *, #modeRow label { max-width: 100%; }
  .mode-switch, .locale-switch, .nav-overflow { flex-wrap: wrap; }
  .panel, .payload, #drop { padding-right: 12px; padding-left: 12px; min-width: 0; }
  label.size { flex-wrap: wrap; }
  input, select, button { max-width: 100%; }
  pre.grid { max-width: 100%; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .manual-content figure { padding-right: 12px; padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #results, #siteHero { transition: none; }
  #drop, #drop::before, button { transition: none; }
  #drop.over { transform: none; }
  .progress-scan { animation: none; transform: translateY(21px); box-shadow: none; }
  .photo-stage.locked .success-lock { animation: none; opacity: 1; }
  .photo-stage.locked .lock-corner, .photo-stage.locked .lock-sweep,
  #results.success-reveal #verdict, #results.success-reveal #payload,
  #results.success-reveal #images, #results.success-reveal #exports { animation: none; }
  .photo-stage.locked .lock-corner { opacity: 1; }
  .photo-stage.locked .lock-sweep { opacity: 0; }
  #companion, #companionSprite { animation: none !important; transition: none; }
}
