/* app.css · consumes tokens only (no brand value here). Mobile-first; desktop from 1024.
   The stage's inner stack is the preview's lane (js/stage.js + manifest); this file only places it. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-body); font-size: var(--fs-base); line-height: var(--lh-base);
       color: var(--c-text); background: var(--c-surface); padding-top: var(--pbar-h);
       padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); }
img, svg { display: block; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; flex: none; }
.ico-lg { width: 28px; height: 28px; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-screen); }

/* focus: two-part ring on every interactive element */
:where(button, a, input, [tabindex]):focus { outline: none; }
:where(button, a, input, [tabindex]):focus-visible {
  box-shadow: 0 0 0 2px var(--focus-inner), 0 0 0 4px var(--focus-outer); border-radius: var(--r-btn); }

/* ---------- prototype bar (not product) ---------- */
.pbar { position: fixed; inset: 0 0 auto 0; z-index: 50; background: var(--c-ink); color: var(--c-white);
        font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: var(--fs-xs); }
.pbar-in { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; justify-content: center;
           min-height: 40px; padding: var(--sp-1) var(--sp-screen); }   /* fixed: --pbar-h is measured from this */
.pbar-group { display: flex; align-items: center; gap: 2px; }
.pbar-label { opacity: .7; margin-right: var(--sp-1); }
.pbar-btn { min-height: 32px; min-width: 44px; padding: 0 var(--sp-2); border: 1px solid transparent; border-radius: var(--r-pill);
            background: transparent; cursor: pointer; font-size: var(--fs-xs); }
.pbar-btn[aria-pressed="true"] { background: var(--c-white); color: var(--c-ink); }
.pbar-btn:focus-visible { box-shadow: 0 0 0 2px var(--c-ink), 0 0 0 4px var(--c-white); }
.pbar-note { margin: 0; padding: 2px var(--sp-2); border-radius: var(--r-pill); background: var(--c-ink-2); }

/* ---------- shop header ---------- */
.shop-top { border-bottom: 1px solid var(--c-line); background: var(--c-surface); }
.shop-top-in { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--topbar-h); }
.wordmark { display: inline-flex; align-items: center; min-height: var(--target); padding: 0 var(--sp-1); }
.logo { display: none; }
.logo svg { height: 22px; width: auto; }
.logo-orwo svg { height: 30px; }
:root[data-theme="core"] .logo-core, :root[data-theme="orwo"] .logo-orwo { display: block; }
.nav-back { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--target); min-width: var(--target);
            padding: 0 var(--sp-3) 0 var(--sp-1); border: 1px solid var(--c-line); border-radius: var(--r-pill);
            background: var(--c-surface); cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
/* stepper, as on MixPix: a circle per step with a sentence-case label. Upcoming = muted disc with its number;
   current = brand tint, brand edge, brand number; done = full brand fill with a white check (the kids-book treatment). */
.stepper { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 0 auto; padding: 0; list-style: none; }
.step { display: flex; align-items: center; gap: var(--sp-2); color: var(--c-text-muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.step + .step::before { content: ""; width: 24px; height: 1px; background: var(--c-line); }            /* the line between steps */
.step-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
            background: var(--c-surface-muted); color: var(--c-text-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.step-num > * { grid-area: 1 / 1; }
.step-done { display: none; width: 16px; height: 16px; }
.step[aria-current="step"] { color: var(--c-text); font-weight: var(--fw-semibold); }
.step[aria-current="step"] .step-num { background: var(--selected-bg); border-color: var(--c-brand-600); color: var(--selected-text); }
.step.is-done { color: var(--c-text); }
.step.is-done .step-num { background: var(--seg-on-bg); border-color: var(--seg-on-bg); color: var(--seg-on-text); }
.step.is-done .step-n { display: none; }
.step.is-done .step-done { display: block; }

/* ---------- type ---------- */
.eyebrow { margin: 0 0 var(--sp-1); color: var(--c-brand-text); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
           letter-spacing: var(--tracking-label); text-transform: uppercase; }
.title { margin: 0 0 var(--sp-4); font-size: var(--fs-2xl); line-height: var(--lh-tight); font-weight: var(--fw-bold); }
.intro { margin: 0 0 var(--sp-5); color: var(--c-text-2); }
.sec-title { margin: 0 0 var(--sp-3); font-size: var(--fs-md); line-height: var(--lh-snug); font-weight: var(--fw-semibold); }
.helper { margin: var(--sp-2) 0 0; min-height: calc(var(--fs-sm) * var(--lh-caption) * 2); color: var(--c-text-muted);
          font-size: var(--fs-sm); line-height: var(--lh-caption); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--target);
       min-width: 88px; padding: 0 var(--sp-5); border-radius: var(--r-btn); border: 1.5px solid transparent;
       font-size: var(--fs-btn); font-weight: var(--fw-semibold); text-decoration: none; cursor: pointer;
       text-transform: var(--btn-case); letter-spacing: var(--btn-track);
       transition: background var(--dur-fast) var(--ease), transform var(--dur-instant) var(--ease); }
.btn:active { transform: scale(var(--press-scale)); }
.btn-primary { background: var(--action-primary-bg); color: var(--action-primary-text); }
.btn-primary:hover { background: var(--action-primary-bg-hover); }
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { background: var(--c-disabled); color: var(--c-text-2); cursor: not-allowed; }
.btn-secondary { background: var(--action-secondary-bg); color: var(--action-secondary-text); border-color: var(--action-secondary-line); }
.btn-block { width: 100%; }
.link { min-height: var(--target); padding: 0 var(--sp-2); border: 0; background: none; color: var(--c-brand-text);
        font-weight: var(--fw-semibold); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- step 1 layout ----------
   One grid, five parts. Below 1024 the two wrappers are display:contents and the parts are placed by area
   (head · preview · photo · filling · back) so the action sits right under the globe. From 1024 the wrappers
   become the two columns. */
.view { padding: var(--sp-5) 0 var(--sp-7); }
.design { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr);
          grid-template-areas: "head" "preview" "filling" "photo"; }   /* phones: the filling is a first-screen choice; the photo section appears with the tray */
.design-head { grid-area: head; }
.design-preview { grid-area: preview; display: grid; justify-items: center; gap: var(--sp-3); }
.design-photo { grid-area: photo; }
.design-filling { grid-area: filling; }
.design-head .title { margin-bottom: 0; }

/* stage: the product, with the two things that act on the whole globe overlaid on it */
.stage-wrap { position: relative; width: min(58vw, 280px); }
.sg-stage { position: relative; width: 100%; outline: none; touch-action: pan-y; }
.sg-stage.has-photo { cursor: grab; touch-action: none; }      /* a photo in the globe: drag pans, pinch zooms */
.sg-stage.has-photo.is-dragging { cursor: grabbing; }
.stage-hint { position: absolute; left: 50%; top: 62%; transform: translate(-50%, 0); display: inline-flex; align-items: center; gap: var(--sp-2);
              max-width: 92%; margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-pill);
              background: var(--c-ink); color: var(--c-white); box-shadow: var(--shadow-md); pointer-events: none;
              font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: var(--lh-snug); text-align: left;
              opacity: 0; transition: opacity var(--dur-base) var(--ease); }
.stage-hint.is-on { opacity: .92; }
.stage-hint-text { display: grid; gap: 1px; white-space: nowrap; }
.stage-hint .ico { color: var(--c-white); }
.sg-stage:focus-visible { box-shadow: 0 0 0 2px var(--focus-inner), 0 0 0 4px var(--focus-outer); border-radius: var(--r-xl); }
.stage-chip { position: absolute; top: 2%; left: 0; padding: 2px var(--sp-3); border-radius: var(--r-pill);   /* stage corner, never over the subject */
              background: var(--c-surface); color: var(--c-text-2); box-shadow: var(--shadow-sm);
              font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-label); text-transform: uppercase;
              pointer-events: none; }
.stage-side { left: auto; right: 0; }                 /* the side on view, opposite the "Beispiel" corner */
.stage-empty { position: absolute; left: 22%; right: 22%; top: 32%; display: grid; justify-items: center; gap: var(--sp-2);
               min-height: var(--target); padding: var(--sp-3); border: 1.5px dashed var(--c-brand-500); border-radius: var(--r-lg);
               background: var(--c-surface); color: var(--c-brand-text); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
               cursor: pointer; text-align: center; }
.fab { position: absolute; right: 0; bottom: 6%; display: inline-flex; align-items: center; gap: var(--sp-1);
       min-height: var(--target); padding: 0 var(--sp-3) 0 var(--sp-2); border: 1px solid var(--c-line); border-radius: var(--r-pill);
       background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-md); cursor: pointer;
       font-size: var(--fs-sm); font-weight: var(--fw-semibold);
       transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.fab .ico { color: var(--c-brand-text); }
.fab:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.fab:active { transform: scale(var(--press-scale)); }
/* small globes (phones, 720–768 px tall laptops): the pill is the icon alone, so it covers a corner, not the filling */
.stage-wrap { container-type: inline-size; }
@container (max-width: 239px) { .stage-side { top: auto; bottom: 6%; left: 0; right: auto; } }
@container (max-width: 299px) {
  .fab { width: var(--target); padding: 0; justify-content: center; }
  .fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* the rail under the stage: side · zoom · reset, one quiet row */
.stage-rail { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-2); width: 100%;
              min-height: var(--target); }
.side-control { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: var(--r-pill); background: var(--c-surface);
                box-shadow: var(--shadow-md); }
.seg { min-width: 96px; min-height: var(--target); padding: 0 var(--sp-4); border: 2px solid transparent; border-radius: var(--r-pill);
       background: transparent; color: var(--c-text); font-weight: var(--fw-semibold); font-size: var(--fs-base); cursor: pointer; }
.seg[aria-checked="true"] { background: var(--selected-bg); border-color: var(--c-brand-600); color: var(--selected-text); }   /* edge ≥ 3:1 on the tint; the state also sits in the bold brand text */
.zoom { display: inline-flex; align-items: center; min-height: var(--target); padding: 0 var(--sp-1); border-radius: var(--r-pill);
        background: var(--c-surface-muted); }
.zoom-btn { display: grid; place-items: center; width: var(--target); height: var(--target); border: 0; border-radius: 50%;
            background: transparent; color: var(--c-text-2); cursor: pointer; }
.zoom-btn:hover { background: var(--c-surface); }
.zoom-range { display: flex; align-items: center; }
.zoom input { width: 96px; height: var(--target); margin: 0; accent-color: var(--c-brand-500); }
.tool { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--target); padding: 0 var(--sp-3);
        border: 0; border-radius: var(--r-pill); background: transparent; color: var(--c-text-2); cursor: pointer;
        font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.tool:hover { background: var(--c-surface-muted); }
.tool-icon { width: var(--target); padding: 0; justify-content: center; }

/* status: one line, under the thing it talks about */
.status { display: flex; align-items: flex-start; justify-content: center; gap: var(--sp-2); width: 100%; margin: 0;
          min-height: var(--target); color: var(--c-text-2); text-align: center; }
.status .ico { margin-top: 2px; color: var(--c-info-icon); }
.status[data-kind="ok"] { color: var(--c-success); } .status[data-kind="ok"] .ico { color: var(--c-success); }
.status[data-kind="warn"] { color: var(--c-warning); } .status[data-kind="warn"] .ico { color: var(--c-warning-icon); }
.status[data-kind="error"] { color: var(--c-danger); } .status[data-kind="error"] .ico { color: var(--c-danger-line); }
.stage-caption { display: none; }                   /* retired: the side control names the side, the status line does the talking (kept for the aria copy) */

/* filling: the material itself, as swatches, not icons */
.filling-heading { margin: 0 0 var(--sp-2); text-align: center; color: var(--c-text-muted); font-size: var(--fs-sm); }
.swatches { display: flex; justify-content: center; gap: var(--sp-3); }
.swatch { display: grid; justify-items: center; gap: var(--sp-1); min-width: 84px; padding: var(--sp-1) var(--sp-2) var(--sp-2);
          border: 0; border-radius: var(--r-lg); background: transparent; cursor: pointer; }
.swatch-dot { width: 56px; height: 56px; border: 1px solid var(--c-line); border-radius: 50%;
              background: var(--c-line) center / cover no-repeat;
              transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.swatch:hover .swatch-dot { transform: scale(1.05); }
.swatch[aria-pressed="true"] .swatch-dot { box-shadow: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--seg-on-bg); }   /* ≥ 3:1 (1.4.11); brand-500 was 2.56 / 2.65 */
.swatch-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-text-2); }
.swatch[aria-pressed="true"] .swatch-label { color: var(--selected-text); font-weight: var(--fw-semibold); }
.swatch-delta { font-size: var(--fs-xs); color: var(--c-text-muted); }

/* panel: the photo, the back switch */
.panel-sec { padding-top: var(--sp-5); border-top: 1px solid var(--c-line); }
.dropzone { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-7) var(--sp-4); border: 2px dashed var(--c-brand-500);
            border-radius: var(--r-lg); background: var(--selected-bg); color: var(--c-text); text-align: center; cursor: pointer;
            transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.dropzone:hover, .dropzone.is-over { background: var(--c-brand-100); border-color: var(--c-brand-600); }
.drop-ico { width: 24px; height: 24px; color: var(--c-brand-text); }
.drop-title { margin: 0; font-size: var(--fs-md); }
.drop-title strong { color: var(--c-brand-text); font-weight: var(--fw-bold); }
.drop-rule { color: var(--c-text); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }   /* the count is the choice: say it where the photos go in */
.drop-or { color: var(--c-text); }
.drop-meta { margin: 0; color: var(--c-text-muted); font-size: var(--fs-sm); }
.dropzone .drop-meta { color: var(--c-text-2); }        /* on the tint: text-muted is 4.38 (rest) / 3.8 (hover); text-2 is ≥ 5.98 */
.file { position: absolute; width: 1px; height: 1px; opacity: 0; }
/* Before upload, the desktop input draws its keyboard focus on the visible dropzone. */
.design-photo:has(#file:focus-visible) .dropzone {
  box-shadow: 0 0 0 2px var(--focus-inner), 0 0 0 4px var(--focus-outer); }
/* On smaller screens the empty-state globe and sticky upload button open the same input. */
.tray { margin-top: var(--sp-4); }
.tray-title { margin: 0 0 var(--sp-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.tray-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2); }
.tray-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.tray-item { position: relative; width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: var(--r-md);
             overflow: hidden; background: var(--c-surface-muted); cursor: pointer; }
.tray-item img { width: 100%; height: 100%; object-fit: cover; }
.tray-item[aria-current="true"] { border-color: var(--selected-line); }
span.tray-item { cursor: default; }                  /* one photo: nothing to switch to */
.tray-cell { display: grid; justify-items: center; }
.tray-remove { min-height: var(--target); padding: 0 var(--sp-1); font-size: var(--fs-sm); font-weight: var(--fw-medium); }   /* removing one of two puts the other on both sides; undo in the status line */
.tray-add { display: grid; place-items: center; width: 64px; height: 64px; border: 1.5px dashed var(--c-line); border-radius: var(--r-md);
            color: var(--c-brand-text); background: var(--c-surface); cursor: pointer; }
.tray-add:hover { border-color: var(--c-brand-500); background: var(--selected-bg); }
.tray-hint { margin: var(--sp-2) 0 0; color: var(--c-text-muted); font-size: var(--fs-sm); }

/* ---------- bottom bar ---------- */
.bbar { position: fixed; inset: auto 0 0 0; z-index: 40; background: var(--c-surface); box-shadow: var(--shadow-bar);
        padding-bottom: env(safe-area-inset-bottom); }
.bbar-in { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--bottombar-h); }
.bbar-product { display: grid; line-height: var(--lh-snug); min-width: 0; }
.bbar-name { color: var(--c-text-muted); font-size: var(--fs-sm); }
.bbar-price { font-size: var(--fs-2xl); font-weight: var(--fw-bold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.bbar .btn-primary { border-radius: var(--r-cta-bar); padding-right: var(--sp-4); }
.next-chev { width: 18px; height: 18px; margin-left: -2px; }
.bbar-reason { flex: 1; margin: 0; color: var(--c-text-muted); font-size: var(--fs-sm); text-align: right; line-height: var(--lh-caption); }
.bbar .btn { flex: none; }
.next-ico { display: none; }
#next.is-pick .next-ico { display: inline-block; }

/* ---------- step 2 ---------- */
.review { display: grid; gap: var(--sp-6); }
.edit-link { justify-self: start; padding: 0; }
.review-globes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.review-globe { margin: 0; display: grid; gap: var(--sp-2); justify-items: center; }
.review-globe figcaption { color: var(--c-text-muted); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.card { padding: var(--sp-5); border: 1px solid var(--c-line); border-radius: var(--r-xl); background: var(--c-surface); box-shadow: var(--shadow-xs); }
.sum { display: grid; gap: var(--sp-3); margin: 0 0 var(--sp-4); }
.sum > div { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.sum dt { color: var(--c-text-muted); font-size: var(--fs-sm); }
.sum dd { margin: 0; text-align: right; font-weight: var(--fw-medium); }
.sum-total { padding-top: var(--sp-3); border-top: 1px solid var(--c-line); }
.sum-total dd { font-size: var(--fs-lg); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--c-line); border-radius: var(--r-pill); }
.qty-btn { display: grid; place-items: center; width: var(--target); height: var(--target); border: 0; border-radius: 50%;
           background: transparent; cursor: pointer; }
.qty-btn:disabled { color: var(--c-disabled); cursor: not-allowed; }
.qty-val { min-width: 32px; text-align: center; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.trust { margin: 0 0 var(--sp-2); color: var(--c-text-2); font-size: var(--fs-sm); }
.face-note { margin: 0 0 var(--sp-4); color: var(--c-text-muted); font-size: var(--fs-xs); }
.added { display: grid; justify-items: center; gap: var(--sp-2); margin-top: var(--sp-6); text-align: center; }
.added p { margin: 0; color: var(--c-text-2); }
.ico-ok { color: var(--c-success); }
.added-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-3); }

/* ---------- phones: the header keeps one line (logo · back · current step) ---------- */
@media (max-width: 599px) {
  /* the fold: head · globe · rail · status · "choose photo" must all sit above the bar at 390 × 844 */
  .view { padding-top: var(--sp-3); }
  .design { gap: var(--sp-4); }
  .design-head .title { font-size: var(--fs-lg); }
  .pbar-label { display: none; }                    /* review bar on one row: the buttons say what they are */
  .design-photo .sec-title { font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
  .dropzone { padding: var(--sp-5) var(--sp-4); }
  .swatches { gap: var(--sp-2); }
  .swatch { min-width: 0; flex: 1 1 0; padding-bottom: var(--sp-1); }
  .swatch-dot { width: 44px; height: 44px; }
  .filling-heading { margin-bottom: var(--sp-1); }
  /* two rows, as on MixPix: logo (and Back) first, then the stepper with its labels on its own row */
  .shop-top-in { flex-wrap: wrap; row-gap: 0; padding-bottom: var(--sp-2); }
  .stepper { flex-basis: 100%; margin: 0; gap: var(--sp-2); }
  .step + .step::before { width: 16px; }
  .logo svg { height: 18px; }
  .logo-orwo svg { height: 26px; }
  .nav-back { padding: 0; justify-content: center; }
  .nav-back span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }   /* aria-label carries it */
  /* bottom bar: the reason gets its own line above price and button instead of a 4-line column */
  :root { --bottombar-h: 96px; }
  .bbar-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "reason reason" "product cta";
             column-gap: var(--sp-3); row-gap: var(--sp-1); min-height: 0; padding-block: var(--sp-2); }
  .bbar-reason { grid-area: reason; text-align: left; }
  .bbar-reason:empty { display: none; }
  .bbar-product { grid-area: product; }
  #bbar-name { display: none; }                                       /* phones: the price and "inkl. MwSt." only */
  .bbar-price { font-size: var(--fs-xl); }
  .bbar .btn { grid-area: cta; }
}
@media (max-width: 399px) { .pbar-note { display: none; } }
@media (max-width: 359px) { .pbar-group:last-of-type { display: none; } }   /* review bar stays one row on the smallest phones */
@media (max-width: 359px) {
  .stage-wrap { width: 48vw; }
  .bbar-price { font-size: var(--fs-lg); }
  #next.is-pick .next-ico { display: none; }                          /* the word and the chevron are enough at 320 */
  .bbar .btn { padding-left: var(--sp-3); padding-right: var(--sp-2); }
  .design-head .title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }   /* the globe is the title; the h1 stays for AT */
  .design-photo { padding-top: var(--sp-3); }
  .review-globes { grid-template-columns: 1fr; }
  .logo svg { height: 16px; }
}

/* ---------- desktop ---------- */
@media (min-width: 1024px) {
  .design { grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); grid-template-areas: "preview head" "preview filling" "preview photo"; grid-template-rows: min-content min-content 1fr; gap: var(--sp-5) var(--sp-8); align-items: start; }
  .design-preview { position: sticky; top: calc(var(--pbar-h) + var(--sp-4) + env(safe-area-inset-top)); }
  /* the globe scales to the viewport so rail, status and swatches always sit above the bottom bar
     (720 → 220 px, 768 → 258 px, 900 → 374 px, 1080 → 520 px); the floor is what a 720 px tall laptop can hold */
  .stage-wrap { width: clamp(220px, calc((100vh - 475px) * .88), 520px); }
  .dropzone { display: grid; }
  .dropzone { padding: var(--sp-7) var(--sp-4); }
  .status { justify-content: center; }
  .review { grid-template-columns: 1.6fr 1fr; align-items: start; }
  .review-globes { gap: var(--sp-5); }
  .title { font-size: var(--fs-3xl); line-height: 1.1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}

/* Codex mobile usability pass: the preview stays an editor, controls stay outside it. */
.preview-actions { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); flex-wrap: wrap; }
.preview-actions .fab { position: static; width: auto; padding: 0 var(--sp-3); box-shadow: none; transition: transform var(--dur-fast) var(--ease); }
.preview-actions .fab:focus-visible { box-shadow: 0 0 0 2px var(--focus-inner), 0 0 0 4px var(--focus-outer); }
.preview-actions .fab-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.motion-toggle { font-size: var(--fs-sm); }
.edit-help { margin: 0; color: var(--c-text-2); font-size: var(--fs-sm); text-align: center; }
.stage-rail { max-width: 520px; }
.swatches { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: var(--sp-2); width: 100%; max-width: 480px; margin-inline: auto; }
.swatch { position: relative; border: 2px solid var(--c-line); border-radius: var(--r-btn); padding: var(--sp-3) var(--sp-2); min-width: 0; background: var(--c-surface); }
.swatch[aria-pressed="true"] { border-color: var(--selected-line); background: var(--selected-bg); }
.swatch-check { display: none; position: absolute; right: var(--sp-1); top: var(--sp-1); width: var(--selection-check-size); height: var(--selection-check-size); color: var(--selected-text); }
.swatch[aria-pressed="true"] .swatch-check { display: block; }
.swatch[aria-pressed="true"] .swatch-dot { box-shadow: none; }
.swatch-dot { border-radius: var(--r-sm); }
.tray-title { display: none; }
.tray-item { display: block; width: var(--photo-thumb-size); height: var(--photo-thumb-size); }
.photo-side-label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); margin-top: var(--sp-1); }
.tray-add { width: var(--photo-add-size); min-height: var(--photo-thumb-size); height: auto; gap: var(--sp-1); padding: var(--sp-2); font-size: var(--fs-sm); }
.tray { margin-top: var(--sp-2); }
#replace-photo { padding-left: 0; }
@media (max-width: 1023px) {
  .design { gap: var(--sp-4); }
  .stage-wrap { width: min(76vw, 340px); }
  .design-preview { gap: var(--sp-2); }
  .stage-rail { gap: var(--sp-1); }
  .stage-rail .side-control { width: 100%; max-width: 280px; box-shadow: none; border: 1px solid var(--c-line); }
  .seg { min-width: 0; min-height: 40px; }
  .zoom { background: transparent; }
  .zoom input { width: 140px; }
  .status { min-height: 0; font-size: var(--fs-sm); }
  .design-photo { padding-top: var(--sp-3); }
  html[data-has-photo="false"] .design-photo { display: none; }
  .design-head .title { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: var(--fs-xl); }
  .swatch { padding: var(--sp-2); }
  .swatch-dot { width: 40px; height: 40px; }
}
@media (max-width: 599px) {
  .view { padding-top: var(--sp-3); }
  .design-head .eyebrow { display: none; }
  .shop-top-in { flex-wrap: nowrap; padding-bottom: 0; }
  .stepper { flex-basis: auto; margin-left: auto; }
  .step-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .stage-wrap { width: min(72vw, 280px); }
  .design { gap: var(--sp-3); }
  .filling-heading { color: var(--c-text-2); }
}
@media (min-width: 1024px) {
  .stage-wrap { width: clamp(220px, calc((100vh - 475px) * .88), 520px); }
}
/* Fit the three useful editing tools into two rows, with no controls over the photo. */
.preview-actions { flex-wrap: nowrap; width: 100%; }
.preview-actions .side-control { box-shadow: none; border: 1px solid var(--c-line); padding: var(--sp-1); }   /* v8: 4 px, so the chosen side doesn't hug the outline */
.preview-actions .seg { min-width: 76px; min-height: 44px; padding-inline: var(--sp-3); }
.design-filling { text-align: center; }
.design-filling .motion-toggle { font-weight: var(--fw-medium); }
@media (max-width: 599px) {
  .stage-wrap { width: min(70vw, 260px, max(218px, calc((100svh - 410px) * .7))); }
  .preview-actions { gap: var(--sp-2); }
  .preview-actions .seg { font-size: var(--fs-sm); min-width: 68px; padding-inline: var(--sp-2); }
  .bbar .btn { max-width: var(--bar-action-max); min-width: 0; font-size: var(--fs-base); }
  .bbar .btn span { white-space: normal; }
  .stage-rail { min-height: 44px; }
}
@media (min-width: 1024px) {
  .swatch { padding-block: var(--sp-2); }
  .swatch-dot { width: 40px; height: 40px; }
  .design-preview { gap: var(--sp-2); }
}
html[data-has-photo="false"] .stage-rail { display: none; }
@media (min-width: 1024px) {
  .status { min-height: 0; }
}
@media (max-width: 359px) {
  .shop-top-in:has(#nav-back:not([hidden])) { gap: var(--sp-2); }
  .shop-top-in:has(#nav-back:not([hidden])) .logo-core svg { height: 13px; }
}

/* v4: file-drop safety, explicit price breakdown and responsive price context. */
.sg-stage.is-over, .tray-add.is-over { outline: 2px dashed var(--c-brand-600); outline-offset: var(--sp-1); background-color: var(--selected-bg); }
.preview-actions { flex-wrap: wrap; }
.preview-actions .motion-toggle { flex-basis: 100%; }
.summary-vat { margin: 0 0 var(--sp-3); color: var(--c-text-2); font-size: var(--fs-sm); }
.sum dd { white-space: nowrap; }
#bbar-surcharge::after { content: " · "; }
.label-short { display: none; }
@media (max-width: 599px) {
  #bbar-surcharge { display: block; white-space: nowrap; }
  #bbar-surcharge::after { content: none; }
  .bbar-in { column-gap: var(--sp-2); }
}
@media (max-width: 599px) {
  #next:not(.is-pick) .label-long, #cart .label-long { display: none; }
  #next:not(.is-pick) .label-short, #cart .label-short { display: inline; }
  #cart .next-chev { display: none; }
  .bbar .btn { padding-inline: var(--sp-4) var(--sp-3); }   /* v8: was 8 px, too tight on the left; the chevron side keeps 12 px */
  #next.is-pick { max-width: none; }   /* v8: before the first photo the bar holds only the price, so the long label keeps one line */
}
@media (max-width: 599px) and (max-height: 700px) {
  .design-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .design { row-gap: var(--sp-2); }
}
@media (min-width: 1024px) {
  .design-filling { padding-top: var(--sp-4); border-top: 1px solid var(--c-line); }
  .design-filling .filling-heading { text-align: left; }
  .swatches { max-width: none; }
}

@media (max-width: 599px) and (max-height: 600px) {
  .stage-wrap { width: min(58vw, 218px); }
}
@media (max-width: 599px) {
  .bbar-in { padding-block: calc(var(--sp-2) - var(--sp-1) / 2); }
}
