/* Spark Stack Holo — design system
   Brand colors: frontend/brand-tokens.css (sync with Shopify Theme settings).
   Layout tokens + components below. */

@import url('brand-tokens.css');

:root {
  /* Map brand tokens to app aliases */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #101722;
  --text-secondary: #515a67;
  --hairline: rgba(0, 0, 0, 0.08);
  --accent: var(--holo-blue);
  --accent-hover: var(--holo-blue-hover);
  --accent-tint: var(--holo-blue-10);
  --accent-focus: var(--holo-blue-18);
  --green: #34c759;
  --red: #e30000;
  --track: #e3e3e8;
  --segment-track: rgba(120, 120, 128, 0.12);

  /* Shape */
  --radius-card: 18px;
  --radius-control: 12px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.09);
  --shadow-thumb: 0 1px 4px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.04);

  /* Motion */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur: 0.28s;

  /* Frosted toolbars */
  --frost: rgba(255, 255, 255, 0.72);
  --frost-blur: blur(20px) saturate(1.8);

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  --sidebar-w: 300px;

  /* Responsive */
  --bp-mobile: 900px;
  --mobile-viewer-min: 420px;
  --mobile-viewer-ideal: 58svh;
  --mobile-viewer-max: 650px;
  --tap-min: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.47;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection {
  background: var(--holo-blue-18);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

/* Type scale */
h1,
.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.section-label--sm {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.caption {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
}

/* Lucide icons */
svg.lucide,
.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------- shell */

.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.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;
}

/* Full-size transparent hit target — real user clicks open Finder reliably on Safari. */
.upload-file-hitbox {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  font-size: 0;
  color: transparent;
  cursor: pointer;
  border: 0;
  z-index: 2;
  /* Prevent native “No file chosen” chrome from painting through. */
  -webkit-appearance: none;
  appearance: none;
}

.upload-box.is-disabled .upload-file-hitbox,
.upload-file-hitbox:disabled {
  pointer-events: none;
  cursor: default;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  z-index: 30;
}

.sidebar-brand {
  padding: 14px 16px 10px;
  flex-shrink: 0;
}

html.is-embed .sidebar-brand,
body.is-embed .sidebar-brand {
  display: none;
}

html.is-embed .mobile-menu-btn,
body.is-embed .mobile-menu-btn {
  display: none !important;
}

/*
 * Shopify embed: never scroll inside the iframe — parent page scrolls (mobile + desktop).
 * See also the mobile-specific block at the end of this file.
 */
html.is-embed,
html.is-embed body,
html.is-embed.is-mobile-workflow,
html.is-embed.is-mobile-workflow body {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  overscroll-behavior: auto;
}

/* Edit Holo (mobile): fixed viewport configurator (parent locks scroll). */
@media (max-width: 900px) {
  html.is-embed.is-embed-editing,
  html.is-embed.is-embed-editing body,
  html.is-embed.is-embed-editing.is-mobile-workflow,
  html.is-embed.is-embed-editing.is-mobile-workflow body {
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  html.is-embed.is-embed-editing .app-shell {
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html.is-embed.is-embed-editing .sidebar,
  html.is-embed.is-embed-editing .sidebar-scroll,
  html.is-embed.is-embed-editing #design-flow.sidebar-scroll {
    overflow-x: clip !important;
    overflow-y: auto !important;
    max-height: 100% !important;
    -webkit-overflow-scrolling: touch;
  }

  html.is-embed.is-embed-editing .canvas-area {
    overflow: hidden !important;
  }
}

/* editing-flow wins over any leftover is-embed-editing viewport lock. */
html.is-embed.is-embed-editing.editing-flow,
html.is-embed.is-embed-editing.editing-flow body,
html.is-embed.is-embed-editing.editing-flow .app-shell,
html.is-embed.is-embed-editing.editing-flow .canvas-area {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

html.is-embed.is-embed-editing.editing-flow .sidebar,
html.is-embed.is-embed-editing.editing-flow .sidebar-scroll,
html.is-embed.is-embed-editing.editing-flow #design-flow.sidebar-scroll {
  overflow-x: clip !important;
  overflow-y: visible !important;
  max-height: none !important;
}

/*
 * Editing flow (Edit from 3D preview only — html.editing-flow).
 * Mirror commerce geometry: stable square preview + options column.
 * Do not apply these rules to express create or preview-commerce.
 */

/* Always unlock scroll/height while editing — do not trap content in 100dvh. */
html.is-embed.editing-flow,
html.is-embed.editing-flow body,
html.is-embed.editing-flow.is-mobile-workflow,
html.is-embed.editing-flow.is-mobile-workflow body,
html.editing-flow,
html.editing-flow body {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
}

html.is-embed.editing-flow .app-shell,
html.editing-flow .app-shell {
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}

html.is-embed.editing-flow .sidebar,
html.is-embed.editing-flow .sidebar-scroll,
html.is-embed.editing-flow #design-flow.sidebar-scroll,
html.editing-flow .sidebar,
html.editing-flow .sidebar-scroll,
html.editing-flow #design-flow.sidebar-scroll {
  overflow-x: clip !important;
  overflow-y: visible !important;
  max-height: none !important;
}

html.is-embed.editing-flow .canvas-area,
html.editing-flow .canvas-area {
  overflow: visible !important;
}

/* No price / ATC during pre-HOLO editing — saves space and avoids confusion. */
html.editing-flow .preview-tools,
html.editing-flow #commerce-panel,
html.editing-flow .commerce-panel,
html.editing-flow .commerce-reassure,
html.editing-flow .commerce-sticky-atc,
html.editing-flow .commerce-compare,
html.editing-flow .commerce-preview-badge,
html.editing-flow .commerce-original-overlay,
html.editing-flow #desktop-checkout,
html.editing-flow .desktop-checkout,
html.editing-flow #price-quote,
html.editing-flow #cart-btn,
html.editing-flow .mobile-3d-cart-bar,
html.editing-flow .mobile-3d-chrome,
html.editing-flow .scale-toggle,
html.editing-flow .view-toolbar,
html.editing-flow .mobile-sticky-btn[data-action="cart"],
html.wizard-manual:not(.preview-commerce) #desktop-checkout,
html.wizard-manual:not(.preview-commerce) .desktop-checkout,
html.wizard-manual:not(.preview-commerce) #price-quote,
html.wizard-manual:not(.preview-commerce) #cart-btn,
html.wizard-manual:not(.preview-commerce) .mobile-sticky-btn[data-action="cart"] {
  display: none !important;
}

html.editing-flow .product-viewer,
html.editing-flow .preview-commerce-layout,
html.editing-flow .preview-commerce-main,
html.editing-flow .product-stage-card {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 575px !important;
  margin: 0 auto !important;
  min-height: 0 !important;
  flex: 0 0 auto !important;
  height: auto !important;
}

html.editing-flow .product-stage,
html.editing-flow .product-stage:has(#canvas-crop:not(.hidden)),
html.editing-flow .product-stage:has(#canvas-free:not(.hidden)),
html.editing-flow .product-stage:has(#canvas-placeholder:not(.hidden)),
html.editing-flow .product-stage:has(#canvas-preview3d:not(.hidden)) {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  max-width: 575px !important;
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  background: #eef1f6;
}

html.editing-flow #canvas-crop:not(.hidden),
html.editing-flow #canvas-free:not(.hidden),
html.editing-flow #canvas-placeholder:not(.hidden),
html.editing-flow #canvas-preview3d:not(.hidden) {
  position: absolute !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
}

html.editing-flow #canvas-crop:not(.hidden) {
  padding: 12px !important;
  overflow: hidden !important;
}

/* Editing flow: frame the photo only — no inch rulers or dimension callouts. */
html.editing-flow #canvas-crop:not(.hidden) .crop-ruler,
html.editing-flow #canvas-crop:not(.hidden) .scale-aids,
html.editing-flow #canvas-crop:not(.hidden) .dim-callout,
html.editing-flow #canvas-crop:not(.hidden) .scale-quarter-wrap,
html.editing-flow #canvas-crop:not(.hidden) .scale-quarter-note,
html.editing-flow #canvas-crop:not(.hidden) .crop-frame-label {
  display: none !important;
  visibility: hidden !important;
}

/*
 * Admin edit page (/admin/edit/…) — the customer editing wizard with admin chrome.
 * The page also carries html.editing-flow, so the two-column shell (canvas left,
 * wizard right) and stage geometry above already apply. These rules only add the
 * admin-specific bits; nothing here can affect the customer configurator.
 */
html.admin-edit-mode .admin-edit-chrome {
  max-width: 1099px;
  margin: 0 auto;
  padding: 20px 24px 0;
  box-sizing: border-box;
}

/* .app-shell sets display:flex, which would otherwise beat the UA [hidden] rule. */
html.admin-edit-mode .app-shell[hidden] {
  display: none !important;
}

html.admin-edit-mode .sidebar {
  border-right: 0;
}

/* Admin has no mobile sticky bar — the wizard nav must stay usable at any width. */
html.admin-edit-mode .wizard-desktop-nav {
  display: flex;
}

html.admin-edit-mode .wizard-desktop-nav[hidden] {
  display: none !important;
}

/* Express-only affordances never apply to an existing paid configuration. */
html.admin-edit-mode .express-path,
html.admin-edit-mode .mobile-sticky-action,
html.admin-edit-mode .mobile-app-header,
html.admin-edit-mode .view-toolbar,
html.admin-edit-mode .mobile-3d-cart-bar,
html.admin-edit-mode .scale-toggle {
  display: none !important;
}

@media (max-width: 900px) {
  html.admin-edit-mode .admin-edit-chrome {
    padding: 16px 12px 0;
  }
}

@media (max-width: 900px) {
  html.editing-flow .app-shell {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 12px 12px 28px !important;
  }

  html.editing-flow .canvas-area {
    order: 1 !important;
    width: min(575px, 100%) !important;
    max-width: 575px !important;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html.editing-flow .sidebar {
    order: 2 !important;
    width: min(500px, 100%) !important;
    max-width: 500px !important;
    flex: 0 0 auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html.editing-flow .sidebar-scroll,
  html.editing-flow #design-flow.sidebar-scroll {
    overflow: visible !important;
    max-height: none !important;
  }

  /*
   * Editing-flow unlocks document scroll, so #mobile-sticky-action sits in-flow
   * (not a viewport dock). Drop the frosted white chrome or it reads as a
   * stray card around Back / Rebuild.
   */
  html.editing-flow .mobile-sticky-action {
    width: min(500px, 100%);
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
    box-shadow: none;
    padding: 8px 0 0;
  }

  html.editing-flow.has-mobile-sticky {
    padding-bottom: 0;
  }

  /* Sticky owns the Make/Rebuild CTA — hide the duplicate in-panel button. */
  html.editing-flow.has-mobile-sticky #step-generate.mobile-panel-active #generate-btn,
  html.editing-flow.has-mobile-sticky #step-generate.wizard-panel-active #generate-btn,
  html.editing-flow.has-mobile-sticky #step-generate.mobile-panel-active .btn-generate-holo,
  html.editing-flow.has-mobile-sticky #step-generate.wizard-panel-active .btn-generate-holo {
    display: none !important;
  }
}

/*
 * Safety net: immersive mobile 3D chrome must never crush editing-flow.
 * (applyMobileStage also refuses immersive while editing-flow is set.)
 */
html.editing-flow.mobile-preview-immersive .sidebar {
  display: flex !important;
}

html.editing-flow.mobile-preview-immersive .mobile-3d-chrome,
html.editing-flow.mobile-preview-immersive .mobile-preview-dock,
html.editing-flow.mobile-preview-immersive .mobile-3d-cart-bar {
  display: none !important;
}

html.editing-flow.mobile-preview-immersive .product-stage,
html.editing-flow.mobile-preview-immersive .product-stage:has(#canvas-preview3d:not(.hidden)) {
  width: 100% !important;
  max-width: 575px !important;
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
}

@media (min-width: 901px) {
  html.is-embed.editing-flow .app-shell,
  html.editing-flow .app-shell {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 24px !important;
    width: min(1099px, 100%) !important;
    max-width: 1099px !important;
    margin: 0 auto !important;
    padding: 28px 24px 40px !important;
    box-sizing: border-box !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Preview on the left — same role as commerce square. */
  html.editing-flow .canvas-area {
    order: 1 !important;
    flex: 0 1 575px !important;
    width: 575px !important;
    max-width: 575px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Edit controls on the right — same role as commerce cart panel. */
  html.editing-flow .sidebar {
    order: 2 !important;
    flex: 0 1 500px !important;
    width: 500px !important;
    max-width: 500px !important;
    min-width: 0 !important;
    min-height: 575px !important;
    height: auto !important;
    align-self: flex-start !important;
    box-sizing: border-box !important;
  }

  html.editing-flow .product-viewer,
  html.editing-flow .preview-commerce-layout,
  html.editing-flow .preview-commerce-main,
  html.editing-flow .product-stage-card,
  html.editing-flow .preview-commerce-stack {
    max-width: 575px !important;
    margin: 0 !important;
  }

  /*
   * Desktop manual wizard without editing-flow (pre-preview express edit).
   * Same two-column + square stage geometry — never a wide thin strip.
   */
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .app-shell,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .app-shell {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 24px !important;
    width: min(1099px, 100%) !important;
    max-width: 1099px !important;
    margin: 0 auto !important;
    padding: 28px 24px 40px !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .canvas-area,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .canvas-area {
    order: 1 !important;
    flex: 0 1 575px !important;
    width: 575px !important;
    max-width: 575px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .sidebar,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .sidebar {
    order: 2 !important;
    flex: 0 1 500px !important;
    width: 500px !important;
    max-width: 500px !important;
    min-width: 0 !important;
    min-height: 575px !important;
    height: auto !important;
    align-self: flex-start !important;
    box-sizing: border-box !important;
  }

  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-viewer,
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .preview-commerce-layout,
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .preview-commerce-main,
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .preview-commerce-stack,
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage-card,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-viewer,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .preview-commerce-layout,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .preview-commerce-main,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .preview-commerce-stack,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 575px !important;
    margin: 0 !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    height: auto !important;
  }

  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage,
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage:has(#canvas-crop:not(.hidden)),
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage:has(#canvas-free:not(.hidden)),
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage:has(#canvas-placeholder:not(.hidden)),
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage:has(#canvas-preview3d:not(.hidden)),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage,
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage:has(#canvas-crop:not(.hidden)),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage:has(#canvas-free:not(.hidden)),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage:has(#canvas-placeholder:not(.hidden)),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) .product-stage:has(#canvas-preview3d:not(.hidden)) {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 575px !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    background: #eef1f6;
  }

  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-crop:not(.hidden),
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-free:not(.hidden),
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-placeholder:not(.hidden),
  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-preview3d:not(.hidden),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-crop:not(.hidden),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-free:not(.hidden),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-placeholder:not(.hidden),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-preview3d:not(.hidden) {
    position: absolute !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
  }

  html.is-embed.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-crop:not(.hidden),
  html.is-embed-editing.wizard-manual:not(.preview-commerce):not(.express-creating):not(.editing-flow) #canvas-crop:not(.hidden) {
    padding: 16px !important;
    overflow: hidden !important;
  }
}

html.is-embed.has-mobile-sticky {
  padding-bottom: 0 !important;
}

html.is-embed .app-shell {
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}

html.is-embed .sidebar,
html.is-embed .sidebar-scroll,
html.is-embed #design-flow.sidebar-scroll,
html.is-embed .canvas-area {
  overflow: visible !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
  overscroll-behavior: auto;
  -webkit-overflow-scrolling: auto;
}

html.is-embed .sidebar-scroll,
html.is-embed #design-flow.sidebar-scroll {
  flex: 0 0 auto;
  min-height: 0;
}

html.is-embed.mobile-preview-immersive .canvas-area {
  overflow: hidden !important;
  flex: 0 0 auto !important;
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* While generating (before commerce layout): keep a real-sized stage so WebGL can fit. */
html.is-embed.mobile-preview-immersive:not(.preview-commerce) .product-viewer,
html.is-embed.mobile-preview-immersive:not(.preview-commerce) .product-stage-card,
html.is-embed.mobile-preview-immersive:not(.preview-commerce) .product-stage,
html.is-embed.mobile-preview-immersive:not(.preview-commerce) .product-stage:has(#canvas-preview3d:not(.hidden)) {
  flex: 0 0 auto !important;
  width: 100% !important;
  height: min(66dvh, 560px) !important;
  min-height: 360px !important;
  max-height: none !important;
}

/* Absolute inset:0 collapses to 0×0 when the iframe height is content-sized. */
html.is-embed.mobile-preview-immersive #canvas-preview3d:not(.hidden) {
  position: relative !important;
  inset: auto !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

html.is-embed.mobile-preview-immersive .viewer-shell,
html.is-embed.mobile-preview-immersive .viewer-viewport,
html.is-embed.mobile-preview-immersive #viewer3d,
html.is-embed.mobile-preview-immersive .viewer3d {
  position: relative !important;
  inset: auto !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

/* Commerce preview: centered two-column layout.
   Left = stable 1:1 viewer (~575×575). Right = cart panel (~500×575). */
html.preview-commerce .product-viewer {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 0 !important;
  flex: 0 0 auto !important;
  height: auto !important;
}

html.preview-commerce .preview-commerce-layout {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 24px !important;
  width: 100% !important;
  max-width: 1099px !important;
  margin: 0 auto !important;
  min-height: 0 !important;
  flex: 0 0 auto !important;
  height: auto !important;
}

html.preview-commerce .preview-commerce-main {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: min(575px, 100%) !important;
  max-width: 575px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  flex: 0 0 auto !important;
  height: auto !important;
}

html.preview-commerce .product-stage-card {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 575px !important;
  min-height: 0 !important;
  flex: 0 0 auto !important;
  height: auto !important;
  overflow: hidden !important;
}

/* OUTER viewer box is the source of truth — always a square. */
html.preview-commerce .product-stage,
html.preview-commerce .product-stage:has(#canvas-preview3d:not(.hidden)),
html.preview-commerce .product-stage:has(#canvas-crop:not(.hidden)),
html.preview-commerce .product-stage:has(#canvas-placeholder:not(.hidden)) {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  max-width: 575px !important;
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 0 0 auto !important;
  background: #eef1f6;
}

/* Fill the square from the DOM box — never invent sizes from the canvas/image. */
html.preview-commerce #canvas-preview3d:not(.hidden) {
  position: absolute !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  flex: none !important;
  display: flex !important;
  flex-direction: column !important;
}

html.preview-commerce .viewer-shell {
  position: absolute !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  flex: none !important;
  display: flex !important;
  flex-direction: column !important;
}

html.preview-commerce .viewer-viewport {
  position: relative !important;
  inset: auto !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
}

html.preview-commerce #viewer3d,
html.preview-commerce .viewer3d {
  position: absolute !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  flex: none !important;
}

html.preview-commerce .viewer3d canvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

html.preview-commerce .sidebar,
html.preview-commerce .mobile-app-header,
html.preview-commerce .mobile-workflow-chrome,
html.preview-commerce .mobile-sticky-action,
html.preview-commerce .desktop-checkout,
html.preview-commerce .flow-locked-banner,
html.preview-commerce .wizard-progress,
html.preview-commerce #mobile-preview-panel,
html.preview-commerce .mobile-3d-cart-bar,
html.preview-commerce .mobile-3d-chrome,
html.preview-commerce .scale-toggle,
html.preview-commerce .view-toolbar {
  display: none !important;
}

html.preview-commerce .commerce-sticky-atc:not(.is-visible),
html.preview-commerce .commerce-sticky-atc[hidden] {
  display: none !important;
}

html.preview-commerce .canvas-area {
  flex: 0 0 auto !important;
  width: 100% !important;
  max-width: none !important;
  padding: 24px 16px 32px !important;
  min-height: 0 !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}

html.preview-commerce #preview-tools,
html.preview-commerce #commerce-panel {
  display: flex;
}

html.preview-commerce #preview-tools {
  width: 100%;
  margin-top: 8px;
}

.preview-tools {
  display: none;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0 2px;
  touch-action: pan-y;
}

.preview-tools[hidden] {
  display: none !important;
}

.preview-tool {
  flex: 1 1 0;
  max-width: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 4px 4px 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

.preview-tool-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-1);
  color: var(--accent);
}

.preview-tool-icon svg {
  width: 18px;
  height: 18px;
}

.preview-tool--primary {
  flex: 1.45 1 0;
  max-width: 132px;
}

.preview-tool--primary .preview-tool-icon {
  width: 44px;
  height: 44px;
  border: 2px solid var(--accent);
  background: var(--holo-blue-10);
  box-shadow: var(--shadow-2);
}

.preview-tool--primary .preview-tool-icon svg {
  width: 22px;
  height: 22px;
}

.preview-tool--primary .preview-tool-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.preview-tool-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  line-height: 1.05;
}

.preview-tool[aria-pressed="true"] .preview-tool-icon,
.preview-tool.is-active .preview-tool-icon {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.commerce-panel {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 10px 0 0;
  padding: 16px 16px 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(16, 24, 40, 0.06);
  box-sizing: border-box;
  touch-action: pan-y;
}

.commerce-panel[hidden] {
  display: none !important;
}

/* Desktop split-view only — hidden when columns stack (≤900px). */
.commerce-panel-ready {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
}

.commerce-ready-title {
  margin: 0;
  font-size: clamp(1.625rem, 2.1vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text, #12141a);
}

.commerce-ready-sub {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-secondary, #5a6170);
}

.commerce-panel-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0 0 10px;
}

.commerce-product-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary, #5a6170);
  line-height: 1.3;
}

.commerce-product-price {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.05rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text, #12141a);
}

.commerce-product-price .price-sale {
  color: var(--text, #12141a);
}

.commerce-product-price .price-list {
  margin-left: 8px;
  font-size: 0.55em;
  font-weight: 500;
  color: var(--text-secondary, #5a6170);
  text-decoration: line-through;
  vertical-align: baseline;
}

.commerce-cart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-transform: none;
  box-shadow: 0 4px 14px rgba(var(--holo-blue-rgb, 48, 127, 226), 0.28);
}

.commerce-cart-btn__content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.commerce-cart-btn__prices {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.commerce-cart-btn__prices .price-sale {
  color: inherit;
  font-weight: 800;
}

.commerce-cart-btn__prices .price-list {
  order: -1;
  font-size: 0.82em;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: line-through;
}

.commerce-cart-btn .btn-label {
  flex: 0 1 auto;
  font-weight: 650;
}

.commerce-cart-btn .cart-count-badge {
  position: static;
  margin-left: 2px;
}

.commerce-cart-btn:disabled {
  box-shadow: none;
}

.commerce-cart-btn.is-busy .btn-label {
  opacity: 0.92;
}

.commerce-shipping {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0 4px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-secondary, #5a6170);
  text-align: center;
}

.commerce-shipping svg,
.commerce-shipping i {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--text-secondary, #5a6170);
  stroke-width: 1.75;
}

.commerce-bogo {
  position: relative;
  margin: 22px 0 0;
  padding: 0;
  border: 1px solid rgba(var(--holo-blue-rgb, 48, 127, 226), 0.14);
  border-radius: 16px;
  background: #fafbfd;
  overflow: hidden;
}

.commerce-bogo-badge {
  position: absolute;
  top: 0;
  left: 16px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 10px;
  border-radius: 0 0 8px 8px;
  background: #e8f56a;
  color: #1a1f14;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.commerce-bogo-body {
  padding: 28px 16px 16px;
}

.commerce-bogo-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.commerce-bogo-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text, #12141a);
}

.commerce-bogo-free-word {
  color: var(--accent, #307fe2);
  font-weight: 800;
}

.commerce-bogo-save {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #1b7f4e;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
}

.commerce-bogo-save[hidden] {
  display: none !important;
}

.commerce-bogo-sub {
  margin: 8px 0 0;
  text-align: left;
  font-size: 0.84rem;
  font-weight: 450;
  line-height: 1.45;
  color: var(--text-secondary, #5a6170);
}

.commerce-bogo-shipping {
  margin: 6px 0 0;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-secondary, #5a6170);
}

.commerce-bogo-shipping-note {
  font-weight: 500;
  color: #8a91a0;
}

.commerce-bogo-formula {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 14px;
}

.commerce-bogo-step {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
  color: var(--text-secondary, #5a6170);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}

.commerce-bogo-step--free {
  position: relative;
  border-color: rgba(var(--holo-blue-rgb, 48, 127, 226), 0.28);
  background: rgba(var(--holo-blue-rgb, 48, 127, 226), 0.1);
  color: var(--accent, #0b3a7a);
  font-weight: 750;
  box-shadow:
    0 4px 14px rgba(var(--holo-blue-rgb, 48, 127, 226), 0.14),
    inset 0 0 0 1px rgba(var(--holo-blue-rgb, 48, 127, 226), 0.06);
}

.commerce-bogo-step--free.holo-offer-preview-addon-v1-step--filled {
  justify-content: flex-end;
  gap: 2px;
  padding: 4px;
}

.commerce-bogo-step--free.holo-offer-preview-addon-v1-step--filled .commerce-bogo-step-free-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
}

.commerce-bogo-step--free.holo-offer-preview-addon-v1-step--claimed {
  border-color: rgba(27, 127, 78, 0.4);
  background: rgba(27, 127, 78, 0.1);
  box-shadow:
    0 4px 14px rgba(27, 127, 78, 0.14),
    inset 0 0 0 1px rgba(27, 127, 78, 0.08);
}

.commerce-bogo-step--free.holo-offer-preview-addon-v1-step--claimed .commerce-bogo-step-free-badge {
  background: #1b7f4e;
}

.commerce-bogo--claimed .commerce-bogo-save {
  background: #1b7f4e;
  color: #fff;
}

.commerce-bogo-step-free-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 16px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent, #307fe2);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
}

.commerce-bogo-step-label {
  display: block;
}

.commerce-bogo-op {
  flex: 0 0 auto;
  align-self: center;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text-secondary, #5a6170);
  line-height: 1;
}

.commerce-bogo-footer {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 12px;
  background: #e8f56a;
  color: #1a1f14;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
}

@media (max-width: 900px) {
  html.is-embed .app-shell {
    height: auto !important;
    max-height: none !important;
  }

  html.is-embed .sidebar {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible !important;
  }

  html.is-embed .canvas-area {
    flex: 0 0 auto;
    min-height: 0;
  }

  html.is-embed .mobile-sticky-action {
    position: relative;
    bottom: auto;
  }

  html.preview-commerce .product-stage,
  html.preview-commerce .product-stage:has(#canvas-preview3d:not(.hidden)),
  html.preview-commerce .product-stage:has(#canvas-crop:not(.hidden)),
  html.preview-commerce .product-stage:has(#canvas-placeholder:not(.hidden)) {
    width: min(575px, 100%) !important;
    max-width: 575px !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  html.preview-commerce .canvas-area {
    padding: 12px 14px 8px !important;
  }

  html.preview-commerce .preview-commerce-layout {
    gap: 4px !important;
  }

  html.preview-commerce .product-stage-card {
    border-radius: 14px;
    box-shadow: var(--shadow-1);
    width: min(575px, 100%) !important;
  }

  html.preview-commerce .commerce-panel {
    width: min(500px, 100%) !important;
    max-width: 500px !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    flex: 0 0 auto !important;
    padding: 12px 14px 14px;
  }

  html.preview-commerce .preview-tools {
    margin-top: 4px;
    margin-bottom: 0;
    padding: 0 2px;
  }

  /* Stacked layout: never show the desktop completion heading. */
  html.preview-commerce .commerce-panel-ready {
    display: none !important;
  }

  html.preview-commerce .preview-tool {
    padding-bottom: 0;
  }

  html.preview-commerce .commerce-panel-header {
    margin-bottom: 8px;
  }

  html.preview-commerce .commerce-cart-btn {
    min-height: 46px;
    padding: 9px 14px;
  }

  html.preview-commerce .commerce-bogo-step {
    padding: 6px 4px;
    font-size: 0.68rem;
  }

  html.preview-commerce .commerce-bogo-body {
    padding: 26px 14px 14px;
  }

  html.preview-commerce .commerce-bogo-headline {
    gap: 8px;
  }

  html.preview-commerce .commerce-bogo-title {
    font-size: 1rem;
  }

  html.preview-commerce .commerce-bogo-save {
    font-size: 0.68rem;
    min-height: 24px;
    padding: 3px 9px;
  }
}

@media (min-width: 901px) {
  html.is-embed .app-shell {
    align-items: flex-start;
  }

  html.is-embed .sidebar {
    height: auto;
    align-self: stretch;
  }

  html.is-embed .canvas-area {
    flex: 1 1 auto;
    min-height: min(70vh, 720px);
  }

  html.preview-commerce .app-shell {
    display: block !important;
    height: auto !important;
    max-height: none !important;
  }

  html.preview-commerce .preview-commerce-layout {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 24px !important;
    width: min(1099px, 100%) !important;
    max-width: 1099px !important;
    margin: 0 auto !important;
  }

  html.preview-commerce .preview-commerce-main {
    flex: 0 1 575px !important;
    width: 575px !important;
    max-width: 575px !important;
    min-width: 0 !important;
  }

  html.preview-commerce .product-stage-card,
  html.preview-commerce .product-stage,
  html.preview-commerce .product-stage:has(#canvas-preview3d:not(.hidden)),
  html.preview-commerce .product-stage:has(#canvas-crop:not(.hidden)),
  html.preview-commerce .product-stage:has(#canvas-placeholder:not(.hidden)) {
    width: 100% !important;
    max-width: 575px !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  html.is-embed.preview-commerce .canvas-area {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }

  html.preview-commerce .canvas-area {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 20px 20px 40px !important;
  }

  html.preview-commerce .product-viewer {
    flex: 0 0 auto !important;
    height: auto !important;
  }

  html.preview-commerce .preview-commerce-layout {
    align-items: flex-start !important;
  }

  html.preview-commerce .commerce-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 1 500px !important;
    width: 500px !important;
    max-width: 500px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 20px 20px 22px;
    position: relative !important;
    top: auto !important;
    transform: none !important;
    align-self: flex-start !important;
    box-sizing: border-box !important;
  }

  html.preview-commerce .commerce-panel-ready {
    display: flex;
  }

  html.preview-commerce .preview-tools {
    margin-top: 4px;
    margin-bottom: 0;
    padding: 0;
  }

  html.preview-commerce .commerce-cart-btn {
    min-height: 48px;
  }
}

.brand-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 8px;
  min-height: 0;
}

.sidebar-section {
  padding: 10px 14px;
  border-top: 1px solid var(--hairline);
}

.sidebar-section--primary {
  border-top: 0;
  padding-top: 6px;
}

.sidebar-section--tune {
  padding-top: 8px;
  padding-bottom: 8px;
}

/* --------------------------------------------------------------- design flow */

#design-flow {
  padding: 8px 12px 12px;
}

.flow-locked-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--holo-blue-10);
  box-shadow: inset 0 0 0 1px var(--holo-blue-18);
}

.flow-locked-banner.hidden {
  display: none;
}

.flow-locked-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.flow-locked-copy {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.edit-setup-btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 650;
  border: 2px solid var(--accent);
  background: var(--holo-blue-10);
  color: var(--accent);
  box-shadow: var(--shadow-1);
}

.flow-step {
  position: relative;
  margin: 0 0 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hairline);
  transition: opacity var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.flow-step.is-active {
  box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-1);
}

.flow-step.is-complete:not(.is-active):not(.is-locked) {
  box-shadow: 0 0 0 1px rgba(52, 199, 89, 0.35);
}

.flow-step.is-locked {
  opacity: 0.55;
}

.flow-step.is-locked .flow-step-body {
  pointer-events: none;
}

.flow-step.is-setup-locked {
  display: none;
}

.crop-locked-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--holo-blue-10);
  box-shadow: inset 0 0 0 1px var(--holo-blue-18);
}

.crop-locked-banner.hidden {
  display: none;
}

.crop-locked-banner p {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.flow-step-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.flow-step-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
}

.flow-step.is-complete .flow-step-num {
  background: #34c759;
}

.flow-step.is-locked:not(.is-complete) .flow-step-num {
  background: #c7c7cc;
}

.flow-step-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.step-title-mobile {
  display: none;
}

.optional-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--holo-blue-10);
  color: var(--holo-blue);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
}

.flow-step-sub {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.enhance-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.enhance-action-btn,
.enhance-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(var(--holo-blue-rgb), 0.24);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.enhance-action-btn:hover:not(:disabled),
.enhance-card:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 18px rgba(var(--holo-blue-rgb), 0.3);
}

.enhance-action-btn:active:not(:disabled),
.enhance-card:active:not(:disabled) {
  transform: scale(0.98);
}

.enhance-action-btn:disabled,
.enhance-card:disabled {
  border-color: rgba(0, 0, 0, 0.08);
  background: #e8e8ed;
  color: var(--text-secondary);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

.enhance-action-btn.is-busy,
.enhance-card.is-busy {
  cursor: wait;
  opacity: 0.92;
  pointer-events: none;
}

.enhance-action-btn.is-busy .bg-remove-icon,
.enhance-action-btn.is-preparing .bg-remove-icon {
  display: none;
}

.enhance-action-btn .bg-remove-spinner.hidden {
  display: none;
}

.enhance-action-btn.is-busy .bg-remove-spinner,
.enhance-action-btn.is-preparing .bg-remove-spinner {
  display: inline-block;
}

.enhance-action-btn.is-applied,
.enhance-card.is-applied {
  border-color: #248a3d;
  background: #34c759;
  box-shadow: 0 4px 14px rgba(52, 199, 89, 0.28);
}

.enhance-action-btn.is-applied:hover:not(:disabled),
.enhance-card.is-applied:hover:not(:disabled) {
  background: #2fb350;
  border-color: #248a3d;
}

.enhance-action-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.enhance-action-label .lucide,
.enhance-action-label svg {
  width: 18px;
  height: 18px;
  flex: none;
  stroke-width: 2;
}

.enhance-card-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: inherit;
}

.enhance-card-meta {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.86);
}

.enhance-action-btn:disabled .enhance-card-meta,
.enhance-card:disabled .enhance-card-meta {
  color: var(--text-secondary);
}

.bg-remove-cancel-btn {
  margin-top: 0.8rem;
  width: 100%;
}

.bg-remove-cancel-btn.hidden {
  display: none;
}

.bg-remove-advanced {
  margin-top: 12px;
  border: none;
  background: transparent;
}

/* Desktop: no disclosure chrome — paint tools stay inline when visible. */
.bg-remove-advanced > summary {
  display: none;
}

.bg-remove-advanced-body {
  display: block !important;
  padding: 0;
}

.bg-remove-advanced-hint {
  margin: 6px 0 0;
}

.bg-remove-sensitivity {
  margin-top: 14px;
}

.bg-remove-sensitivity.hidden {
  display: none !important;
}

.bg-remove-sensitivity-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.bg-remove-sensitivity-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.bg-remove-sensitivity-head output {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
}

.bg-remove-sensitivity-slider {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bg-remove-sensitivity-slider .row-progress {
  width: 12px;
  height: 12px;
  flex: none;
}

.bg-remove-sensitivity-slider input[type="range"] {
  width: 100%;
  min-width: 0;
  height: 28px;
}

.bg-remove-sensitivity-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  padding-left: 18px; /* align under track after progress dot */
}

.bg-remove-sensitivity-ends span {
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.bg-remove-sensitivity-ends span:last-child {
  text-align: right;
}

.bg-restore-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  min-height: 42px;
}

.bg-restore-btn.hidden {
  display: none !important;
}

.bg-mask-paint-tools {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.bg-mask-paint-tools.hidden {
  display: none !important;
}

.bg-mask-paint-title {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.bg-mask-paint-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bg-mask-paint-modes .align-tool-btn[aria-pressed="true"] {
  border-color: var(--accent, var(--holo-blue));
  background: color-mix(in srgb, var(--accent, var(--holo-blue)) 16%, var(--surface));
}

.bg-mask-brush-row {
  margin-top: 10px;
}

.bg-mask-paint-hint {
  margin: 8px 0 0;
}

.bg-mask-paint-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
  touch-action: none;
  cursor: none;
}

.bg-mask-paint-canvas.is-active {
  pointer-events: auto;
}

.bg-mask-brush-cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 7;
  box-sizing: border-box;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition: width 0.05s linear, height 0.05s linear, opacity 0.12s ease;
  will-change: transform, width, height;
}

.bg-mask-brush-cursor.is-visible {
  opacity: 1;
}

.bg-mask-brush-cursor.is-erase {
  background: rgba(255, 70, 70, 0.18);
  border-color: rgba(255, 220, 220, 0.95);
}

.bg-mask-brush-cursor.is-keep {
  background: rgba(70, 200, 120, 0.18);
  border-color: rgba(220, 255, 230, 0.95);
}

.crop-viewport.is-bg-painting {
  cursor: none;
}

.crop-viewport.is-bg-painting .crop-image {
  opacity: 0;
}

.flow-skip-btn {
  margin-top: 2px;
}

.size-grid.is-disabled,
.upload-box.is-disabled,
.size-list.is-disabled {
  pointer-events: none;
  opacity: 0.7;
}

.crop-viewport.is-locked {
  cursor: default !important;
}

#step-generate .btn-primary {
  margin-top: 4px;
}

#step-generate .gen-progress {
  margin-bottom: 10px;
}

#step-tune .fine-tuning {
  margin: 0;
  overflow: visible;
}

#step-tune .fine-tuning-body {
  display: grid;
  gap: 8px;
  overflow: visible;
}

.mobile-tune-actions {
  display: none;
}

/* -------------------------------------------------------------- controls */

.control-block,
.control-row,
.toggle-row {
  display: block;
  margin-bottom: 8px;
}

.control-row,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.control-row.compact {
  margin: 8px 0 4px;
}

.zoom-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin: 8px 0 4px;
}

.zoom-row-main {
  margin: 0;
}

.zoom-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  align-self: flex-start;
  margin-left: 64px;
}

.adjust-subsection .zoom-actions {
  margin-left: 0;
}

.zoom-fill-btn,
.zoom-reset-btn {
  padding: 2px 0;
}

.flow-step.is-locked .zoom-fill-btn,
.flow-step.is-locked .zoom-reset-btn {
  pointer-events: none;
  opacity: 0.55;
}

.adjust-subsection {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
  box-shadow: inset 0 0 0 1px var(--hairline, rgba(0, 0, 0, 0.08));
}

.adjust-subsection:first-child {
  margin-top: 0;
}

.adjust-subsection .crop-photo-label {
  margin: 0 0 4px;
}

.adjust-subsection .crop-photo-help {
  margin: 0 0 10px;
}

.bg-remove-tip {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(var(--holo-blue-rgb), 0.08);
  box-shadow: inset 0 0 0 1px var(--holo-blue-18, rgba(0, 122, 255, 0.18));
  color: var(--text-secondary);
  line-height: 1.4;
}

.crop-photo-row {
  margin: 10px 0 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
  box-shadow: inset 0 0 0 1px var(--hairline, rgba(0, 0, 0, 0.08));
}

.adjust-subsection.crop-photo-row {
  margin: 12px 0;
  padding: 12px 14px;
}

.align-tools-section .align-tools {
  margin: 0;
}

.align-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 4px;
}

.crop-photo-label {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.color-adjust-row .control-row span:first-child {
  min-width: 84px;
}

.color-adjust-row output {
  flex: 0 0 auto;
  min-width: 44px;
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #666);
}

.color-adjust-row .link-btn {
  margin-top: 4px;
}

/* Color step: admin Create HOLO (?admin_order=1) + /admin/edit only — never customer editing-flow. */
html:not(.admin-order-mode):not(.admin-edit-mode) #step-color.admin-only-color-step {
  display: none !important;
}

.crop-photo-help {
  margin: 0 0 8px;
}

.crop-photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.crop-viewport.is-cropping {
  cursor: default;
}

.crop-trim-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.crop-trim-layer.hidden {
  display: none;
}

.crop-trim-rect {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  cursor: move;
  pointer-events: auto;
  touch-action: none;
}

.crop-trim-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 2px;
  background: var(--accent, var(--holo-blue));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.crop-trim-handle--nw { left: 0; top: 0; cursor: nwse-resize; }
.crop-trim-handle--n { left: 50%; top: 0; cursor: ns-resize; }
.crop-trim-handle--ne { left: 100%; top: 0; cursor: nesw-resize; }
.crop-trim-handle--e { left: 100%; top: 50%; cursor: ew-resize; }
.crop-trim-handle--se { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-trim-handle--s { left: 50%; top: 100%; cursor: ns-resize; }
.crop-trim-handle--sw { left: 0; top: 100%; cursor: nesw-resize; }
.crop-trim-handle--w { left: 0; top: 50%; cursor: ew-resize; }

.align-tools.is-disabled {
  pointer-events: none;
  opacity: 0.55;
}

.rotate-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 0;
}

.adjust-bg-section {
  margin: 12px 0 4px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}

.adjust-subsection.adjust-bg-section {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-top: 0;
}

.adjust-bg-section .crop-photo-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adjust-bg-section .enhance-grid {
  margin-top: 8px;
}

.adjust-bg-section.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.rotate-tools-label {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

.rotate-tools #rotate-frame-btn {
  grid-column: 1 / -1;
}

.rotate-tools .align-tool-btn.is-active {
  border-color: rgba(0, 0, 0, 0.28);
  background: #f0f0f2;
}

.align-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.align-tool-btn:hover {
  background: #f5f5f7;
  border-color: rgba(0, 0, 0, 0.18);
}

.align-tool-btn:active {
  background: #ececf0;
}

.align-tool-btn .lucide,
.align-tool-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke-width: 1.75;
  color: var(--text-secondary);
}

.align-tool-btn span {
  min-width: 0;
  line-height: 1.2;
}

.flow-step.is-locked .align-tool-btn {
  pointer-events: none;
  opacity: 0.55;
}

.flow-step.is-locked .rotate-tools .align-tool-btn {
  pointer-events: none;
  opacity: 0.55;
}

.control-row span:first-child,
.toggle-row span:first-child {
  flex: 0 0 auto;
  min-width: 64px;
  font-size: 13px;
}

.control-title {
  display: block;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.control-grid {
  display: grid;
  gap: 8px;
}

output {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 0;
  text-align: right;
  white-space: nowrap;
}

/* Compact slider rows: Label [──●──] 0.20" · 5.1mm ↺ */
.slider-row {
  display: grid;
  grid-template-columns: 76px minmax(72px, 1fr) auto;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 8px;
  min-height: 32px;
}

.slider-row:has(> .icon-btn) {
  grid-template-columns: 76px minmax(72px, 1fr) auto 28px;
}

.slider-row-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
}

.slider-row input[type="range"] {
  grid-column: 2;
  width: 100%;
  min-width: 0;
  height: 28px;
}

.slider-row output {
  font-size: 11px;
  min-width: 4.5rem;
  justify-self: end;
}

.slider-row .row-progress {
  width: 12px;
  height: 12px;
  flex: none;
}

.slider-row > .icon-btn {
  grid-column: 4;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--accent);
  background: var(--accent-tint);
}

.icon-btn .lucide,
.icon-btn svg {
  width: 14px;
  height: 14px;
}

.info-chip-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.info-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
  color: var(--text);
}

.info-chip-label {
  color: var(--text-secondary);
  font-size: 11px;
}

.info-chip strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Selects — clean white menus with hairline borders */
.select-input,
select {
  width: 100%;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.select-input:hover,
select:hover {
  border-color: rgba(0, 0, 0, 0.16);
}

/* Text inputs */
input[type="text"],
input[type="email"],
input[type="number"],
textarea {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  padding: 10px 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--holo-blue-18);
}

/* Sliders — clear track + blue fill so thumbs don't look like broken toggles */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 80px;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  --fill: 50%;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--fill),
    #d2d2d7 var(--fill),
    #d2d2d7 100%
  );
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-thumb);
  transition: transform var(--dur) var(--ease);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.08);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #d2d2d7;
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-thumb);
}

/* Switches — iOS toggle */
input[type="checkbox"].switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 36px;
  height: 22px;
  flex-shrink: 0;
  margin: 0;
  border-radius: var(--radius-pill);
  background: #e9e9eb;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

input[type="checkbox"].switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  transition: transform var(--dur) var(--ease);
}

input[type="checkbox"].switch:checked {
  background: var(--green);
}

input[type="checkbox"].switch:checked::after {
  transform: translateX(14px);
}

.pixel-fix-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pixel-fix-row .pixel-fix-toggle {
  flex: 1 1 auto;
  min-width: 140px;
  margin: 0;
}

.pixel-fix-min-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  flex: 0 0 auto;
}

.pixel-fix-min-field input[type="number"] {
  width: 4.5rem;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--hairline-strong, rgba(0, 0, 0, 0.12));
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.pixel-fix-min-unit {
  white-space: nowrap;
}

input[type="checkbox"]:not(.switch) {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* Segmented controls — iOS style with clear selected chip */
.segmented {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--segment-track);
}

.seg-thumb {
  display: none;
}

.seg-btn {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  border: 0;
  padding: 7px 12px;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.seg-btn:active {
  transform: scale(0.97);
}

.seg-btn.selected {
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

.segmented.mini .seg-btn {
  padding: 6px 10px;
  font-size: 12px;
}

/* ------------------------------------------------------------ disclosure */

.disclosure {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: none;
}

.disclosure summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  list-style: none;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}

.disclosure summary::-webkit-details-marker {
  display: none;
}

.disclosure-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.disclosure-detail {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disclosure-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  transition: transform var(--dur) var(--ease);
}

.disclosure[open] > summary .disclosure-chevron {
  transform: rotate(90deg);
}

.disclosure-body {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--hairline);
  animation: disclosure-in var(--dur) var(--ease);
}

@keyframes disclosure-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fine-tuning {
  margin: 8px 0 4px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--bg);
  /* details can clip descendants in some browsers when overflow is hidden */
  overflow: visible;
}

.fine-tuning summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.fine-tuning-note {
  font-weight: 400;
  color: var(--text-secondary);
}

.fine-tuning summary::-webkit-details-marker {
  display: none;
}

.fine-tuning summary .disclosure-chevron {
  margin-left: auto;
}

.fine-tuning[open] > summary .disclosure-chevron {
  transform: rotate(90deg);
}

.fine-tuning-body {
  padding: 2px 10px 12px;
  /* Opacity-only open animation — transform on the body clips wrapped chips
     when an ancestor (sidebar-scroll) uses overflow-x: hidden. */
  animation: fine-tuning-in var(--dur) var(--ease);
  overflow: visible;
  max-width: 100%;
  box-sizing: border-box;
}

@keyframes fine-tuning-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fine-tuning-body .control-block {
  min-width: 0;
  max-width: 100%;
  margin-bottom: 0;
  overflow: visible;
}

.prelayer-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline, rgba(0, 0, 0, 0.1));
}

.prelayer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 8px;
}

.prelayer-slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
  box-shadow: inset 0 0 0 1px var(--hairline, rgba(0, 0, 0, 0.08));
}

.prelayer-slot.is-filled {
  box-shadow: inset 0 0 0 1px rgba(30, 120, 80, 0.35);
}

.prelayer-slot-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--text);
}

.prelayer-slot-meta {
  font-size: 11px;
  color: var(--text-muted, #666);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prelayer-slot-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 6px;
  background:
    linear-gradient(45deg, #ddd 25%, transparent 25%),
    linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%),
    linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-color: #f4f4f4;
}

.prelayer-slot-thumb:not([src]),
.prelayer-slot-thumb[src=""] {
  display: none;
}

.prelayer-slot input[type="file"] {
  font-size: 11px;
  max-width: 100%;
}

.prelayer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.prelayer-status {
  margin: 6px 0 0;
}

.fine-tuning-body .segmented {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

/* Quantization: prefer full labels. Sidebar (~300px) → 1 col; wider → 2. */
.fine-tuning-body .segmented:not(.mini),
.fine-tuning-body #quant-segments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
  gap: 6px;
  padding: 4px;
  align-items: stretch;
}

.fine-tuning-body .segmented:not(.mini) .seg-btn,
.fine-tuning-body #quant-segments .seg-btn {
  flex: none;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 40px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
  text-align: center;
  box-sizing: border-box;
}

.fine-tuning-body .segmented.mini {
  display: flex;
  flex-wrap: wrap;
}

.fine-tuning-body .segmented.mini .seg-btn {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  font-size: 12px;
  padding: 6px 8px;
}

.fine-tuning-body .select-input,
.fine-tuning-body select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.fine-tuning-body .control-title {
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.fine-tuning-body .caption {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  margin-top: 6px;
}

/* Slider rows: keep value readable without clipping the inches/mm readout */
.fine-tuning-body .slider-row {
  grid-template-columns: minmax(0, 68px) minmax(48px, 1fr) minmax(0, 5.75rem);
  column-gap: 6px;
  max-width: 100%;
}

.fine-tuning-body .slider-row:has(> .icon-btn) {
  grid-template-columns: minmax(0, 68px) minmax(48px, 1fr) minmax(0, 5.75rem) 28px;
}

.fine-tuning-body .slider-row output {
  white-space: normal;
  line-height: 1.2;
  text-align: right;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.fine-tuning-body .pixel-fix-row {
  gap: 8px;
  max-width: 100%;
}

.fine-tuning-body .pixel-fix-toggle {
  min-width: 0;
  flex: 1 1 8rem;
}

.fine-tuning-body .pixel-fix-min-field {
  flex: 0 1 auto;
  min-width: 0;
}

/* Inline row progress (underlap live recompute) */
.row-progress {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  min-width: 0;
  border: 2px solid var(--track);
  border-top-color: var(--accent);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.row-progress.active {
  opacity: 1;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.reset-btn {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  border-radius: 8px;
  transition: opacity var(--dur) var(--ease);
}

.reset-btn:hover {
  opacity: 0.75;
}

/* ---------------------------------------------------------------- upload */

.upload-box {
  position: relative;
  display: block;
  border: 1.5px dashed rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  background: var(--bg);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.upload-box.compact {
  padding: 8px 10px;
}

.upload-box:hover,
.upload-box:focus-visible {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.upload-placeholder {
  text-align: left;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-box.compact .upload-placeholder {
  text-align: left;
}

.upload-placeholder p {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.upload-placeholder .caption {
  margin-top: 1px;
  color: var(--text-secondary);
}

.upload-icon {
  display: inline-flex;
  color: var(--accent);
}

.upload-icon .lucide {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
}

.upload-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.upload-preview img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow-1);
}

.upload-meta {
  position: relative;
  z-index: 3;
}

#replace-image-btn {
  position: relative;
  z-index: 3;
}

.upload-meta p {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 500;
  word-break: break-all;
}

.upload-replace-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.upload-replace-btn__icon {
  display: inline-flex;
  color: inherit;
}

.upload-replace-btn__icon .lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* Editing flow: make replace photo impossible to miss on step 1. */
html.editing-flow .upload-preview {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

html.editing-flow .upload-preview img {
  width: 56px;
  height: 56px;
  align-self: flex-start;
}

html.editing-flow .upload-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

html.editing-flow .upload-replace-btn,
html.editing-flow #replace-image-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
  padding: 12px 16px;
  border: 1.5px solid rgba(var(--holo-blue-rgb), 0.32);
  border-radius: 12px;
  background: rgba(var(--holo-blue-rgb), 0.07);
  color: var(--accent);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-1);
}

html.editing-flow .upload-replace-btn:hover,
html.editing-flow #replace-image-btn:hover {
  opacity: 1;
  background: rgba(var(--holo-blue-rgb), 0.11);
}

html.editing-flow .upload-replace-btn:disabled,
html.editing-flow #replace-image-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ------------------------------------------------------------- size list */

.size-list,
.size-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.size-list-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hairline);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.size-list-item:hover {
  box-shadow: var(--shadow-1), 0 0 0 1px var(--hairline);
}

.size-list-item.selected {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.size-list-item.selected::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--accent);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.size-list-shape {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 1px;
}

.size-shape-icon {
  display: block;
  border: 1.5px solid var(--text-secondary);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 2px;
}

.size-shape-icon--rectangle,
.size-shape-icon--rect {
  width: 22px;
  height: 13px;
}

.size-shape-icon--square {
  width: 16px;
  height: 16px;
}

.size-list-item.selected .size-shape-icon {
  border-color: var(--accent);
  background: rgba(var(--holo-blue-rgb), 0.12);
}

.size-list-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-right: 18px;
}

.size-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.size-name {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.size-dimensions {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--text);
}

.size-price {
  margin: 0;
  flex: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  white-space: nowrap;
}

.size-blurb {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-secondary);
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-sale {
  font-weight: 700;
  color: var(--text, #12141a);
}

.price-list {
  text-decoration: line-through;
  opacity: 0.72;
  margin-right: 4px;
  margin-left: 0;
  font-weight: 500;
  color: var(--text-secondary, #5a6170);
}

.size-auto-hint {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
}

.info-value .price-list {
  font-size: 13px;
  margin-left: 6px;
}

/* ---------------------------------------------------------------- buttons */

.btn-primary,
.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  margin-bottom: 8px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease),
    opacity var(--dur) var(--ease), border-color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-1);
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(0, 0, 0, 0.16);
}

.btn-secondary.small,
.btn-primary.small {
  width: auto;
  min-height: 36px;
  padding: 0 16px;
  margin: 0;
  font-size: 13px;
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  transition: opacity var(--dur) var(--ease);
}

.link-btn:hover {
  opacity: 0.75;
}

/* --------------------------------------------------------------- histogram */

.histogram-wrap {
  margin-bottom: 12px;
}

#histogram-canvas {
  width: 100%;
  height: 64px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  cursor: crosshair;
}

/* ---------------------------------------------------------------- checkout (desktop, below Fine Tuning) */

.desktop-checkout {
  flex-shrink: 0;
  margin: 4px 14px 16px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.price-quote {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #111;
  color: #fff;
}

.price-quote-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.price-quote-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.price-quote-amount {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.price-quote-detail {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.84);
}

.price-quote-layers {
  display: inline-block;
  margin-top: 2px;
}

.price-quote-detail.is-layer-price-bump .price-quote-layers,
#mobile-config-price.is-layer-price-bump,
#mobile-config-summary.is-layer-price-bump {
  animation: layer-price-bump 1.4s ease;
}

@keyframes layer-price-bump {
  0% {
    transform: scale(1);
  }
  20% {
    transform: scale(1.06);
    color: var(--accent);
  }
  100% {
    transform: scale(1);
  }
}

.desktop-checkout .btn-secondary,
.desktop-checkout .cart-cta {
  width: 100%;
  margin-bottom: 0;
}

.desktop-checkout .cart-cta {
  min-height: 48px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 18px rgba(var(--holo-blue-rgb), 0.28);
}

.desktop-checkout .cart-cta:disabled {
  box-shadow: none;
}

.sticky-generate {
  display: none;
  width: 100%;
  min-height: 48px;
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.sticky-generate.is-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.desktop-checkout .cart-cta:not(:disabled):hover {
  box-shadow: 0 8px 22px rgba(var(--holo-blue-rgb), 0.34);
}

.layer-choice-heading {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.layer-choice-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.layer-choice-grid.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.layer-choice-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 12px 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease),
    box-shadow 0.15s var(--ease), opacity 0.15s var(--ease);
}

.layer-choice-card.is-recommended {
  padding-top: 10px;
}

.layer-choice-recommend {
  display: inline-flex;
  align-items: center;
  margin: 0 0 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
}

.layer-choice-card.selected .layer-choice-recommend {
  background: var(--accent);
}

.layer-choice-card:hover:not(:disabled):not(.is-preparing) {
  border-color: rgba(0, 0, 0, 0.22);
  background: #fafafa;
}

.layer-choice-card.selected {
  border-color: var(--accent);
  background: rgba(var(--holo-blue-rgb), 0.06);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.layer-choice-card.is-preparing,
.layer-choice-card:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  background: #f3f3f5;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

.layer-choice-card.is-preparing:hover,
.layer-choice-card:disabled:hover {
  background: #f3f3f5;
  border-color: rgba(0, 0, 0, 0.08);
}

.layer-choice-card.is-ready:not(.selected) {
  border-color: rgba(52, 199, 89, 0.45);
}

.layer-choice-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.layer-choice-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.layer-choice-badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.layer-choice-card.selected .layer-choice-badge {
  color: var(--accent);
}

.layer-choice-blurb {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.layer-choice-card-status {
  margin: 8px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.layer-choice-card-status.is-preparing {
  color: var(--accent);
}

.layer-choice-card-status.is-ready {
  color: var(--green);
}

.layer-choice-card-status.is-error {
  color: var(--red);
}

.layer-choice-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(var(--holo-blue-rgb), 0.22);
  border-top-color: var(--accent);
  animation: holo-loader-spin 0.75s linear infinite;
  flex: none;
}

.layer-choice-card.is-switching {
  outline: 2px solid color-mix(in srgb, var(--accent, var(--holo-blue)) 55%, transparent);
  outline-offset: 2px;
}

.layer-choice-card.is-switching .layer-choice-title::after {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-left: 0.4rem;
  vertical-align: -0.05rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.viewer-shell.is-layer-switching .viewer-viewport {
  position: relative;
}

.viewer-shell.is-layer-switching .viewer-viewport::after {
  content: "";
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

@media (prefers-reduced-motion: reduce) {
  .layer-choice-card.is-switching .layer-choice-title::after,
  .viewer-shell.is-layer-switching .viewer-viewport::after {
    animation: none;
    opacity: 0.55;
  }
}

.layer-choice-status {
  margin: 8px 0 0;
  min-height: 1.2em;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.35;
}

.layer-choice-status.is-preparing {
  color: var(--accent);
}

.layer-choice-status.is-ready {
  color: var(--green);
}

.layer-choice-status.is-error {
  color: var(--red);
}

.info-item-price .info-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.step-hint {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.generate-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 6px;
  font-variant-numeric: tabular-nums;
}

.generate-error {
  margin: 0 0 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(227, 0, 0, 0.08);
  color: var(--red);
  font-size: 12px;
  line-height: 1.35;
}

.gen-progress {
  margin: 0 0 10px;
  padding: 10px 10px 8px;
  border-radius: 10px;
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px var(--holo-blue-18);
}

.gen-progress[hidden] {
  display: none !important;
}

.gen-progress-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.gen-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--holo-blue) 0%, var(--holo-blue-light) 55%, var(--holo-blue) 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 0 1px var(--holo-blue-25);
  transition: width 0.25s var(--ease);
  animation: progress-sheen 1.4s linear infinite;
}

.gen-progress.indeterminate .gen-progress-fill {
  width: 40% !important;
  animation: progress-slide 1.1s var(--ease) infinite, progress-sheen 1.4s linear infinite;
}

.gen-progress-stage {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.gen-progress-pct {
  margin: 2px 0 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--accent);
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.btn-primary.is-busy {
  pointer-events: none;
}

/* ------------------------------------------------------------ canvas area */

.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  position: relative;
  /* Slight left bias, still room to breathe on both sides */
  padding: 12px 20px 14px 12px;
  overflow: hidden;
}

/* Tabs — iOS segmented style (shared with admin) */
.canvas-tabs {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 2px;
  margin: 0 0 8px;
  align-self: flex-start;
  border-radius: 10px;
  background: var(--segment-track);
  flex-shrink: 0;
}

.tab {
  position: relative;
  z-index: 1;
  padding: 7px 16px;
  border: 0;
  background: none;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.tab:active {
  transform: scale(0.97);
}

.tab.active {
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

/* Stage */
.product-viewer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  flex: 1;
  min-height: 0;
}

.product-viewer.hidden {
  display: none;
}

.preview-commerce-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.preview-commerce-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

/* ---------------------------------------------------------------- HOLO loader (banner above preview) */

.holo-loader {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  display: none;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
}

.holo-loader.is-visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.holo-loader[hidden] {
  display: none !important;
}

.holo-loader.is-visible[hidden] {
  display: block !important;
}

.holo-loader-panel {
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-1), 0 0 0 0.5px var(--hairline);
  text-align: left;
}

.holo-loader-busy {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.holo-loader-anim {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 148px;
  margin: 0 0 4px;
  pointer-events: none;
}

.holo-loader-anim-host {
  display: block;
  width: min(168px, 46vw);
  height: min(168px, 46vw);
  max-width: 100%;
  line-height: 0;
}

.holo-loader-anim-host svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.holo-loader--anim-fallback .holo-loader-anim {
  min-height: 48px;
}

.holo-loader--anim-fallback .holo-loader-anim-host {
  display: none;
}

/* Confetti burst anchored to Make my HOLO / sticky generate */
.holo-btn-confetti {
  position: fixed;
  z-index: 10001;
  pointer-events: none;
  overflow: visible;
  line-height: 0;
}

.holo-btn-confetti-host {
  width: 100%;
  height: 100%;
}

.holo-btn-confetti-host svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.holo-loader-busy-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.holo-loader-stop {
  flex: none;
  align-self: center;
  margin: 8px 0 0;
  min-width: 4.5rem;
}

.holo-loader-stop.is-stopping {
  opacity: 0.72;
  pointer-events: none;
}

.holo-loader-spinner {
  flex: none;
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 50%;
  border: 2.5px solid var(--holo-blue-18);
  border-top-color: var(--accent);
  animation: holo-loader-spin 0.85s linear infinite;
}

.holo-loader-spinner[hidden] {
  display: none !important;
}

.holo-loader-copy {
  min-width: 0;
  flex: 1;
}

.holo-loader-heading {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.25;
}

.holo-loader-eta {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  color: var(--text-secondary, rgba(0, 0, 0, 0.55));
}

.holo-loader-message {
  margin: 2px 0 0;
  min-height: 2.7em;
  max-width: none;
  display: block;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.35;
  color: var(--accent);
  transition: opacity 0.18s var(--ease);
}

.holo-loader-message.is-fading {
  opacity: 0;
}

.holo-loader-stage {
  margin: 8px 0 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.holo-loader-progress {
  position: relative;
  margin: 0;
  width: 100%;
  max-width: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(var(--holo-blue-rgb), 0.12);
  overflow: hidden;
}

.holo-loader-progress-bar {
  height: 100%;
  width: 32%;
  border-radius: inherit;
  background: var(--accent);
}

.holo-loader-progress.is-indeterminate .holo-loader-progress-bar {
  animation: holo-loader-indeterminate 1.25s var(--ease) infinite;
}

.holo-loader-progress.is-determinate .holo-loader-progress-bar {
  width: var(--holo-loader-progress, 0%);
  transition: width 0.25s var(--ease);
  animation: none;
}

.holo-loader-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.holo-loader-error[hidden],
.holo-loader-busy[hidden] {
  display: none !important;
}

.holo-loader-error .holo-loader-heading {
  flex: 1 1 100%;
}

.holo-loader-error-text {
  margin: 0;
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.holo-loader-error .btn-primary {
  flex: none;
  min-width: 0;
}

@keyframes holo-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes holo-loader-indeterminate {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(320%);
  }
}

.holo-loader--reduced-motion .holo-loader-anim-host {
  display: none;
}

.holo-loader--reduced-motion .holo-loader-spinner {
  animation: none;
  border-color: var(--accent);
  border-top-color: var(--accent);
  opacity: 0.85;
}

.holo-loader--reduced-motion .holo-loader-anim {
  min-height: 48px;
}

.holo-loader--reduced-motion .holo-loader-progress-bar,
.holo-loader--reduced-motion .holo-loader-progress.is-indeterminate .holo-loader-progress-bar {
  animation: none;
  width: 55%;
  transform: none;
}

.holo-loader--reduced-motion .holo-loader-message {
  transition: none;
}

@media (max-width: 640px) {
  .holo-loader {
    margin-bottom: 8px;
  }

  .holo-loader-panel {
    padding: 11px 12px;
  }

  .holo-loader-heading {
    font-size: 14px;
  }

  .holo-loader-message {
    font-size: 12px;
  }
}

.product-stage-card {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
}

.product-stage {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  flex: 1;
  min-height: 280px;
  max-height: none;
  padding: 0;
  background: var(--surface);
  overflow: hidden;
}

/* Progress bar at the top of the stage while generating */
.stage-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  z-index: 20;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.08);
  transition: opacity var(--dur) var(--ease);
}

.stage-progress.active {
  opacity: 1;
}

.stage-progress-bar {
  width: 40%;
  height: 100%;
  border-radius: 0;
  background: linear-gradient(90deg, var(--holo-blue) 0%, var(--holo-blue-light) 50%, var(--holo-blue) 100%);
  background-size: 200% 100%;
  animation: progress-slide 1.1s var(--ease) infinite, progress-sheen 1.4s linear infinite;
  box-shadow: 0 0 12px rgba(var(--holo-blue-rgb), 0.55);
}

.stage-progress.determinate .stage-progress-bar {
  animation: progress-sheen 1.4s linear infinite;
  width: var(--progress, 0%);
  transition: width 0.25s var(--ease);
}

@keyframes progress-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(350%);
  }
}

@keyframes progress-sheen {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.product-stage.generating::after {
  content: "";
  position: absolute;
  inset: 0;
  /* Keep interaction blocked lightly — avoid washing out the crop/preview. */
  background: rgba(12, 14, 18, 0.08);
  pointer-events: auto;
  z-index: 5;
}

body.config-locked .flow-step-body button:not(#stop-generating-btn),
body.config-locked .flow-step-body input,
body.config-locked .flow-step-body select,
body.config-locked .flow-step-body textarea,
body.config-locked #file-input,
body.config-locked #dropzone,
body.config-locked .product-chip,
body.config-locked .layer-choice-btn,
body.config-locked .align-tool-btn,
body.config-locked .zoom-fill-btn,
body.config-locked .zoom-reset-btn,
body.config-locked #cart-btn,
body.config-locked .mobile-workflow-tab,
body.config-locked #bg-remove-btn,
body.config-locked #undo-bg-remove-btn,
body.config-locked #bg-remove-sensitivity,
body.config-locked #bg-remove-sensitivity-reset,
body.config-locked #bg-remove-advanced,
body.config-locked #bg-mask-paint-tools,
body.config-locked #bg-paint-keep-btn,
body.config-locked #bg-paint-erase-btn,
body.config-locked #bg-paint-undo-btn,
body.config-locked #bg-paint-done-btn,
body.config-locked #bg-paint-brush-size {
  pointer-events: none !important;
  opacity: 0.55;
}

body.config-locked #stop-generating-btn {
  pointer-events: auto !important;
  opacity: 1 !important;
  display: inline-flex;
}

body.config-locked #generate-btn {
  display: none;
}

#stop-generating-btn {
  margin-top: 0.6rem;
  width: 100%;
}

#stop-generating-btn.is-stopping {
  opacity: 0.75;
}

@keyframes shimmer {
  from {
    background-position: 130% 0;
  }
  to {
    background-position: -90% 0;
  }
}

.stage-panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#canvas-crop {
  align-items: center;
  justify-content: center;
  padding: 20px 28px 56px;
  box-sizing: border-box;
  overflow: visible;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.9) 0%, rgba(232, 232, 237, 0.96) 72%),
    repeating-conic-gradient(#ececf0 0% 25%, #e4e4ea 0% 50%) 0 0 / 20px 20px;
}

.stage-panel.hidden {
  display: none;
}

/* Pre-layered upload: live composite of the 8 layers inside the panel frame. */
#canvas-prelayer {
  padding: 20px 28px 40px;
  box-sizing: border-box;
}

.prelayer-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.prelayer-stage-frame {
  position: relative;
  flex-shrink: 0;
  border-radius: 4px;
  box-shadow:
    0 0 0 3px #1d1d1f,
    0 0 0 6px rgba(255, 255, 255, 0.95),
    0 18px 40px rgba(0, 0, 0, 0.22);
  background:
    linear-gradient(45deg, #ececf0 25%, transparent 25%),
    linear-gradient(-45deg, #ececf0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececf0 75%),
    linear-gradient(-45deg, transparent 75%, #ececf0 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  background-color: #fafafc;
}

.prelayer-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.prelayer-stage-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--text-secondary);
  max-width: 280px;
  padding: 24px;
}

#canvas-placeholder {
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

#canvas-placeholder:hover .stage-upload-btn {
  filter: brightness(1.05);
}

.placeholder-icon {
  display: block;
  color: #d2d2d7;
}

.placeholder-icon .lucide {
  width: 44px;
  height: 44px;
  stroke-width: 1.2;
}

.placeholder-inner p {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.stage-upload-btn {
  margin-top: 4px;
  min-width: 160px;
  width: auto;
  box-sizing: border-box;
}

.crop-stage-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Crop board: rulers are outside the transformed image viewport */
@property --crop-frame-w {
  syntax: "<length>";
  inherits: false;
  initial-value: 200px;
}

@property --crop-frame-h {
  syntax: "<length>";
  inherits: false;
  initial-value: 200px;
}

.crop-board {
  /* Label gutter fits multi-digit values (e.g. 10, 12.5); tick track is separate. */
  --ruler-label-gutter: 32px;
  --ruler-tick-track: 18px;
  --ruler-size: calc(var(--ruler-label-gutter) + var(--ruler-tick-track));
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--ruler-size) var(--crop-frame-w, auto);
  grid-template-rows: var(--ruler-size) var(--crop-frame-h, auto);
  align-items: start;
  justify-items: start;
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  min-height: calc(var(--ruler-size) + var(--crop-frame-h, 0px));
  margin: 0;
  transform: none;
}

.crop-board.is-resizing {
  transition: --crop-frame-w 0.3s var(--ease), --crop-frame-h 0.3s var(--ease);
}

.crop-ruler {
  position: relative;
  box-sizing: border-box;
  background: #f3f3f5;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  overflow: visible;
  pointer-events: none;
  user-select: none;
  z-index: 6;
  transform: none;
  flex: 0 0 auto;
}

.crop-ruler--corner {
  grid-column: 1;
  grid-row: 1;
  width: var(--ruler-size);
  min-width: var(--ruler-size);
  height: var(--ruler-size);
  min-height: var(--ruler-size);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  border-radius: 4px 0 0 0;
  z-index: 7;
  overflow: hidden;
  background: #f3f3f5;
}

.crop-ruler--top {
  grid-column: 2;
  grid-row: 1;
  height: var(--ruler-size);
  min-height: var(--ruler-size);
  border-radius: 0 4px 0 0;
  background: linear-gradient(#f3f3f5, #e9e9ed);
  overflow: hidden;
}

.crop-ruler--left {
  grid-column: 1;
  grid-row: 2;
  width: var(--ruler-size);
  min-width: var(--ruler-size);
  max-width: var(--ruler-size);
  flex: 0 0 var(--ruler-size);
  border-radius: 0 0 0 4px;
  background: linear-gradient(90deg, #f3f3f5, #e9e9ed);
  overflow: visible;
}

.crop-ruler-tick {
  position: absolute;
  background: #6e6e73;
  z-index: 1;
  pointer-events: none;
}

.crop-ruler--top .crop-ruler-tick {
  bottom: 0;
  top: auto;
  width: 1px;
  transform: translateX(-0.5px);
}

.crop-ruler--top .crop-ruler-tick.is-minor {
  height: 7px;
}

.crop-ruler--top .crop-ruler-tick.is-half {
  height: 12px;
}

.crop-ruler--top .crop-ruler-tick.is-major {
  height: 16px;
  background: #1d1d1f;
}

.crop-ruler--left .crop-ruler-tick {
  right: 0;
  left: auto;
  height: 1px;
  transform: translateY(-0.5px);
}

.crop-ruler--left .crop-ruler-tick.is-minor {
  width: 7px;
}

.crop-ruler--left .crop-ruler-tick.is-half {
  width: 12px;
}

.crop-ruler--left .crop-ruler-tick.is-major {
  width: 16px;
  background: #1d1d1f;
}

.crop-ruler-label {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-stretch: normal;
  letter-spacing: 0;
  color: #1d1d1f;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  /* Never inherit zoom/scale from the image layer */
  transform: none;
}

.crop-ruler--top .crop-ruler-label {
  top: 6px;
  bottom: auto;
  transform: translateX(-50%);
}

.crop-ruler--left .crop-ruler-label {
  left: 2px;
  right: calc(var(--ruler-tick-track) + 3px);
  width: auto;
  max-width: calc(var(--ruler-label-gutter) - 4px);
  text-align: right;
  transform: translateY(-50%);
}

.product-mockup {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  overflow: visible;
  border-radius: 4px;
  box-shadow:
    0 0 0 3px #1d1d1f,
    0 0 0 6px rgba(255, 255, 255, 0.95),
    0 18px 40px rgba(0, 0, 0, 0.22);
  background:
    linear-gradient(45deg, #ececf0 25%, transparent 25%),
    linear-gradient(-45deg, #ececf0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececf0 75%),
    linear-gradient(-45deg, transparent 75%, #ececf0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f5f5f7;
  transform: none;
}

.product-mockup.is-resizing {
  transition: width 0.3s var(--ease), height 0.3s var(--ease);
}

.crop-frame-label {
  position: absolute;
  top: auto;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: #1d1d1f;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}

.crop-frame-label.is-scale-hidden {
  opacity: 0;
  visibility: hidden;
}

/* ---------------------------------------------------------------- scale aids */

.scale-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px 4px 8px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--frost);
  backdrop-filter: var(--frost-blur);
  -webkit-backdrop-filter: var(--frost-blur);
  box-shadow: var(--shadow-1), 0 0 0 0.5px var(--hairline);
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.scale-toggle .lucide,
.scale-toggle svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.75;
}

.scale-toggle[aria-pressed="true"] {
  color: var(--text);
}

.scale-toggle:hover {
  color: var(--text);
}

.scale-aids {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease);
}

.scale-aids.is-visible {
  opacity: 1;
  visibility: visible;
}

.scale-aids--3d {
  inset: 0;
  z-index: 4;
}

.scale-aids--3d .dim-callout {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  height: auto;
  min-height: 0;
  width: auto;
  overflow: visible;
}

.scale-aids--3d .dim-callout-line {
  flex: 0 0 auto;
  height: 1px;
  min-height: 1px;
  min-width: 0;
  background: rgba(0, 0, 0, 0.34);
}

.scale-aids--3d .dim-callout-cap {
  width: 1px;
  height: 8px;
}

.dim-callout {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.dim-callout--width {
  height: 0;
  flex-direction: row;
}

.dim-callout--height {
  width: 0;
  flex-direction: column;
}

.dim-callout-line {
  flex: 1 1 auto;
  background: rgba(0, 0, 0, 0.28);
  min-width: 8px;
  min-height: 8px;
}

.dim-callout--width .dim-callout-line {
  height: 1px;
  width: auto;
}

.dim-callout--height .dim-callout-line {
  width: 1px;
  height: auto;
}

.dim-callout-cap {
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.34);
}

.dim-callout--width .dim-callout-cap {
  width: 1px;
  height: 8px;
}

.dim-callout--height .dim-callout-cap {
  width: 8px;
  height: 1px;
}

.dim-callout-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.2;
  box-shadow: 0 0 0 1px var(--hairline);
  white-space: nowrap;
}

.dim-callout--height .dim-callout-label {
  transform: translate(-50%, -50%);
}

.scale-quarter-wrap {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  user-select: none;
}

.scale-quarter {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  background: transparent;
}

.scale-quarter-note {
  max-width: 5.5rem;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(255, 255, 255, 0.7);
}

.scale-quarter-note--3d {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, 0);
  pointer-events: none;
}

.product-stage:has(#canvas-placeholder:not(.hidden)) .scale-toggle,
.product-stage:has(#canvas-layers:not(.hidden)) .scale-toggle,
.product-stage:has(#canvas-depth:not(.hidden)) .scale-toggle,
.product-stage:has(#canvas-compare:not(.hidden)) .scale-toggle {
  display: none;
}

.crop-frame-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid var(--holo-blue);
  pointer-events: none;
  z-index: 3;
}

.crop-frame-corner--tl {
  top: -3px;
  left: 0;
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: 4px;
}

.crop-frame-corner--tr {
  top: -3px;
  right: -3px;
  border-left: 0;
  border-bottom: 0;
  border-top-right-radius: 4px;
}

.crop-frame-corner--bl {
  bottom: -3px;
  left: 0;
  border-right: 0;
  border-top: 0;
  border-bottom-left-radius: 4px;
}

.crop-frame-corner--br {
  bottom: -3px;
  right: -3px;
  border-left: 0;
  border-top: 0;
  border-bottom-right-radius: 4px;
}

.product-mockup .crop-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background: transparent;
  border-radius: 2px;
}

.product-mockup .crop-viewport:active {
  cursor: grabbing;
}

.crop-viewport {
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  min-width: 120px;
  min-height: 80px;
}

.crop-viewport:active {
  cursor: grabbing;
}

.crop-image {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  user-select: none;
  pointer-events: none;
}

.crop-error {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.92);
  pointer-events: none;
}

/* ------------------------------------------------------------- info strip (removed from storefront) */

.product-info-bar {
  display: none;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 12px;
}

.info-item + .info-item {
  border-left: 1px solid var(--hairline);
}

.info-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.info-value {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* --------------------------------------------------------------- 3D viewer */

#canvas-preview3d {
  position: absolute;
  inset: 0;
  padding: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#canvas-preview3d .viewer-shell {
  position: relative;
  inset: auto;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.viewer-viewport {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  touch-action: none;
}

.viewer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 200ms ease;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer-shell.viewer-fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 1000;
  border-radius: 0;
  min-height: 100dvh;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--surface);
}

html.viewer-fs-open,
html.viewer-fs-open body {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.viewer3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  margin: 0;
  z-index: 1;
}

.viewer3d canvas {
  display: block;
  position: relative;
  z-index: 1;
  width: 100% !important;
  height: 100% !important;
  margin: 0;
  padding: 0;
  touch-action: none;
}

/* Desktop: frosted floating toolbar over the bottom edge of the viewport */
.view-toolbar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--frost);
  backdrop-filter: var(--frost-blur);
  -webkit-backdrop-filter: var(--frost-blur);
  box-shadow: var(--shadow-2), 0 0 0 0.5px var(--hairline);
  max-width: min(100% - 24px, 560px);
}

/* Customer preview: drag the HOLO — no button chrome. Admin export row stays. */
.view-toolbar-row--main {
  display: none !important;
}

.view-toolbar:not(:has(.view-toolbar-row--admin:not([hidden]))) {
  display: none !important;
}

body.is-admin .view-toolbar:has(.view-toolbar-row--admin:not([hidden])) {
  display: flex !important;
}

/* One-shot drag hint over the 3D stage */
.mobile-drag-hint {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: absolute;
  left: 50%;
  bottom: 20px;
  z-index: 18;
  pointer-events: none;
  margin: 0;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(20, 20, 24, 0.82);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.mobile-drag-hint.is-visible {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mobile-drag-hint.is-instant,
.mobile-drag-hint.is-instant.is-visible {
  transition: none;
}

html.preview-commerce .mobile-drag-hint:not([hidden]),
html.mobile-preview-immersive .mobile-drag-hint:not([hidden]) {
  display: flex;
}

html.preview-commerce .mobile-drag-hint {
  bottom: 16px;
  z-index: 20;
}

.mobile-drag-hint.is-leaving {
  display: flex;
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
}

.mobile-drag-hint[hidden] {
  display: none !important;
}

.mobile-drag-hint__title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
}

.mobile-drag-hint__sub {
  display: none;
}

.view-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
}

.view-toolbar-row--admin {
  display: none;
  gap: 6px;
  padding: 4px 6px 2px;
  border-top: 1px solid var(--hairline);
}

body.is-admin .view-toolbar-row--admin:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.studio-mp4-zoom {
  display: none;
}

body.is-admin .view-toolbar-row--admin:not([hidden]) .studio-mp4-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 100%;
  min-width: 0;
  padding: 2px 4px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.studio-mp4-zoom__label {
  flex: 0 0 auto;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.studio-mp4-zoom input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.studio-mp4-zoom output {
  flex: 0 0 3.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.view-toolbar-row--admin .view-tool-btn--admin {
  flex: 1 1 0;
  min-width: 7.5rem;
  max-width: none;
  height: 40px;
  justify-content: center;
  padding: 0 12px;
}

.view-toolbar-extra {
  display: flex;
  align-items: center;
  gap: 2px;
}

.view-tool-label {
  display: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.view-tool-btn--labeled {
  flex-direction: column;
  gap: 2px;
}

/* Mobile-only Scale / Zoom live in the docked toolbar — hidden on desktop */
.view-tool-btn--mobile-only {
  display: none;
}

.view-tool-btn[aria-pressed="true"] {
  background: var(--accent-tint);
  color: var(--accent);
}

.view-tool-btn--admin[hidden] {
  display: none !important;
}

.view-tool-btn--admin {
  width: auto;
  min-width: 44px;
  padding: 0 10px;
  flex-direction: row;
  gap: 6px;
  background: var(--accent-tint);
  color: var(--accent);
}

.view-tool-btn--admin .view-tool-label {
  display: inline !important;
  font-size: 11px;
  white-space: nowrap;
}

.view-tool-btn--admin.is-recording {
  background: var(--accent-tint);
  color: var(--accent);
}

.view-tool-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* Scene picker — frosted thumbnail bar floating at the top of the stage */
.scene-picker {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: var(--frost);
  backdrop-filter: var(--frost-blur);
  -webkit-backdrop-filter: var(--frost-blur);
  box-shadow: var(--shadow-2), 0 0 0 0.5px var(--hairline);
  max-width: calc(100% - 260px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.scene-picker::-webkit-scrollbar {
  display: none;
}

.scene-picker.hidden {
  display: none;
}

.scene-thumb-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  scroll-snap-align: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
    transform var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.scene-thumb-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.scene-thumb-btn:active {
  transform: scale(0.97);
}

.scene-thumb-btn.selected {
  border-color: var(--accent);
}

.scene-thumb-btn canvas,
.scene-thumb-btn img {
  display: block;
  width: 56px;
  height: 38px;
  border-radius: 8px;
  box-shadow: 0 0 0 0.5px var(--hairline);
}

.scene-thumb-btn img {
  object-fit: cover;
}

.scene-thumb-label {
  font-size: 10px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-thumb-btn.selected .scene-thumb-label {
  color: var(--accent);
}

.scene-picker-hint {
  padding: 0 8px;
  font-size: 10px;
  color: var(--text-secondary);
  max-width: 120px;
}

.view-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.view-tool-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.view-tool-btn:active {
  transform: scale(0.97);
}

.view-tool-btn--label {
  width: auto;
  min-width: 44px;
  padding: 0 16px;
}

.view-tool-btn .lucide {
  width: 18px;
  height: 18px;
}

/* Layers panel — frosted floating sheet over the stage */
.layers-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 78px;
  display: flex;
  flex-direction: column;
  width: 216px;
  border-radius: 16px;
  background: var(--frost);
  backdrop-filter: var(--frost-blur);
  -webkit-backdrop-filter: var(--frost-blur);
  box-shadow: var(--shadow-2), 0 0 0 0.5px var(--hairline);
  color: var(--text);
  z-index: 4;
  min-height: 0;
  overflow: hidden;
}

.layers-panel.hidden {
  display: none;
}

.layers-panel.collapsed {
  width: auto;
  bottom: auto;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  overflow: visible;
}

.layers-panel.collapsed .layers-panel-header,
.layers-panel.collapsed .layers-panel-list,
.layers-panel.collapsed .layers-panel-footer {
  display: none;
}

.layers-panel-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.layers-panel-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.layers-panel-collapse,
.layers-panel-toggle-all {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.layers-panel-collapse:hover,
.layers-panel-toggle-all:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.layers-panel-collapse .lucide,
.layers-panel-toggle-all .lucide {
  width: 16px;
  height: 16px;
}

.layers-panel-expand {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--frost);
  backdrop-filter: var(--frost-blur);
  -webkit-backdrop-filter: var(--frost-blur);
  box-shadow: var(--shadow-2), 0 0 0 0.5px var(--hairline);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.layers-panel.collapsed .layers-panel-expand {
  display: flex;
}

.layers-panel-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 6px;
  min-height: 0;
}

.layers-row {
  display: grid;
  grid-template-columns: 28px 40px 1fr;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 10px;
  cursor: default;
  transition: background var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.layers-row:hover,
.layers-row:focus-within {
  background: var(--accent-tint);
}

.layers-row.dimmed {
  opacity: 0.4;
}

.layers-eye {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.layers-eye.hidden-eye {
  color: var(--text-secondary);
}

.layers-eye:hover {
  background: rgba(0, 0, 0, 0.05);
}

.layers-thumb {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--hairline);
  background:
    linear-gradient(45deg, #ececf0 25%, transparent 25%),
    linear-gradient(-45deg, #ececf0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececf0 75%),
    linear-gradient(-45deg, transparent 75%, #ececf0 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  background-color: #f7f7f9;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}

.layers-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.layers-row-label {
  font-size: 12px;
  line-height: 1.3;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layers-panel-footer {
  flex-shrink: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hairline);
}

.layers-explode-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.layers-explode-row input[type="range"] {
  width: 100%;
}

.layers-explode-row output {
  font-size: 12px;
}

/* Lightbox */
.layer-lightbox {
  position: relative;
  border: 0;
  border-radius: var(--radius-card);
  padding: 0;
  max-width: min(92vw, 720px);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.layer-lightbox[open] {
  animation: sheet-in var(--dur) var(--ease);
}

.layer-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.layer-lightbox img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background:
    linear-gradient(45deg, #ececf0 25%, transparent 25%),
    linear-gradient(-45deg, #ececf0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececf0 75%),
    linear-gradient(-45deg, transparent 75%, #ececf0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f7f7f9;
}

.layer-lightbox-caption {
  margin: 0;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid var(--hairline);
}

.layer-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--frost);
  backdrop-filter: var(--frost-blur);
  -webkit-backdrop-filter: var(--frost-blur);
  box-shadow: var(--shadow-1);
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  z-index: 1;
}

/* ------------------------------------------------------------ layers grid */

#canvas-layers,
#canvas-depth,
#canvas-compare {
  width: 100%;
  height: 100%;
  max-height: calc(62vh - 64px);
  overflow: auto;
  padding: 12px;
  display: block;
}

.layers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.layer-tile {
  margin: 0;
  border-radius: var(--radius-control);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-1), 0 0 0 1px var(--hairline);
}

.layer-tile img {
  width: 100%;
  display: block;
  background: #e8e8ed;
}

.layer-tile figcaption {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.depth-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.depth-compare figure {
  margin: 0;
}

.depth-compare figcaption {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.depth-compare img {
  width: 100%;
  border-radius: var(--radius-control);
  box-shadow: 0 0 0 1px var(--hairline);
  background: #e8e8ed;
}

/* ---------------------------------------------------------------- compare */

.compare-toolbar {
  width: 100%;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.compare-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hairline);
  cursor: pointer;
  transition: box-shadow var(--dur) var(--ease);
}

.check-chip:hover {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.compare-grid-wrap {
  width: 100%;
  overflow: auto;
}

.compare-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.compare-grid th,
.compare-grid td {
  border-bottom: 1px solid var(--hairline);
  padding: 10px;
  vertical-align: top;
  text-align: left;
}

.compare-grid th {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.compare-poster-btn {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.compare-poster-btn img {
  width: 140px;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--hairline);
}

.compare-meta {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}

.compare-notes {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
}

.star-btn {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 15px;
  transition: color var(--dur) var(--ease);
}

.star-btn.starred {
  color: #f5a623;
}

/* ----------------------------------------------------------------- error */

.canvas-error {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  padding: 12px 16px;
  background: #fff2f2;
  box-shadow: 0 0 0 1px rgba(227, 0, 0, 0.2), var(--shadow-1);
  color: var(--red);
  border-radius: var(--radius-control);
  font-size: 13px;
  z-index: 50;
  pointer-events: none;
}

html.is-mobile-workflow.has-mobile-sticky .canvas-error {
  bottom: calc(12px + var(--mobile-sticky-h, 64px));
}

/* ---------------------------------------------------------------- dialogs */

.order-dialog {
  border: 0;
  border-radius: var(--radius-card);
  padding: 28px;
  max-width: 440px;
  width: calc(100% - 32px);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.order-dialog[open] {
  animation: sheet-in var(--dur) var(--ease);
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.order-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.order-dialog h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.order-summary {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.order-dialog .control-block > span {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.order-dialog input,
.order-dialog textarea {
  width: 100%;
}

.optional {
  color: var(--text-secondary);
}

.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.dialog-actions .btn-primary,
.dialog-actions .btn-secondary {
  flex: 1;
  margin: 0;
}

.order-confirmation {
  margin-top: 14px;
  font-size: 15px;
  color: var(--green);
}

/* ---------------------------------------------------------------- mobile */

.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--frost);
  backdrop-filter: var(--frost-blur);
  -webkit-backdrop-filter: var(--frost-blur);
  box-shadow: var(--shadow-1);
  font-size: 18px;
  cursor: pointer;
}

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 25;
}

.flow-step--retired {
  display: none !important;
}

.btn-generate-holo {
  min-height: 48px;
}

/* —— Express path: Upload → Make my HOLO (mobile-first) —— */
.express-path {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-top: 20px;
  width: 100%;
}

.express-path[hidden] {
  display: none !important;
}

.express-make-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 14px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.express-status {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 550;
  line-height: 1.4;
  color: var(--text-secondary, rgba(0, 0, 0, 0.6));
  text-align: center;
}

.express-make-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.express-make-btn.is-busy {
  pointer-events: none;
}

.express-make-label {
  display: block;
}

.express-make-sub {
  display: none;
}

.express-edit-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 8px 0 0;
  padding: 12px 16px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: var(--holo-blue-10);
  color: var(--accent);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-1);
}

.express-edit-link:hover {
  background: var(--holo-blue-18);
}

.edit-holo-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 15px;
  font-weight: 650;
  border: 2px solid var(--accent);
  background: var(--holo-blue-10);
  color: var(--accent);
  box-shadow: var(--shadow-1);
}

html.wizard-express #step-upload .flow-step-sub {
  max-width: 22rem;
}

/*
 * Empty express state on custom page: the stage placeholder is already the upload
 * CTA. Hide the duplicate sidebar "Upload image / Choose a photo" panel unless
 * express-path is showing (retry after a failed auto-make).
 */
html.wizard-express:not(.editing-flow):not(.preview-commerce)
  #step-upload:has(#express-path[hidden]) {
  display: none !important;
}

/* Express create: no ATC until a HOLO exists (preview-commerce). */
html.wizard-express:not(.preview-commerce):not(.editing-flow) #desktop-checkout,
html.wizard-express:not(.preview-commerce):not(.editing-flow) .desktop-checkout {
  display: none !important;
}

/*
 * Desktop Choose a photo (express, pre-HOLO): match commerce / editing-flow
 * two-column geometry so the stage is a proper square, not a thin wide strip.
 */
@media (min-width: 901px) {
  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .app-shell,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .app-shell {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 24px !important;
    width: min(1099px, 100%) !important;
    max-width: 1099px !important;
    margin: 0 auto !important;
    padding: 28px 24px 40px !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .sidebar,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .sidebar {
    flex: 0 1 500px !important;
    width: 500px !important;
    max-width: 500px !important;
    min-width: 0 !important;
    min-height: 575px !important;
    height: auto !important;
    align-self: flex-start !important;
    box-sizing: border-box !important;
  }

  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .sidebar-scroll,
  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) #design-flow.sidebar-scroll,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .sidebar-scroll,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) #design-flow.sidebar-scroll {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .canvas-area,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .canvas-area {
    flex: 0 1 575px !important;
    width: 575px !important;
    max-width: 575px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-viewer,
  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .preview-commerce-layout,
  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .preview-commerce-main,
  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-stage-card,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-viewer,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .preview-commerce-layout,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .preview-commerce-main,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-stage-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 575px !important;
    margin: 0 !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    height: auto !important;
  }

  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-stage,
  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-stage:has(#canvas-placeholder:not(.hidden)),
  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-stage:has(#canvas-free:not(.hidden)),
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-stage,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-stage:has(#canvas-placeholder:not(.hidden)),
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .product-stage:has(#canvas-free:not(.hidden)) {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 575px !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    background: #eef1f6;
  }

  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) #canvas-placeholder:not(.hidden),
  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) #canvas-free:not(.hidden),
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) #canvas-placeholder:not(.hidden),
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) #canvas-free:not(.hidden) {
    position: absolute !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  html.is-embed.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .wizard-desktop-nav,
  html.wizard-express:not(.preview-commerce):not(.editing-flow):not(.express-creating) .wizard-desktop-nav {
    display: none !important;
  }
}

@media (min-width: 901px) {
  .express-make-btn {
    min-height: 68px;
    font-size: 1.15rem;
  }

  .express-path {
    max-width: 28rem;
  }
}

/* Mobile workflow chrome — desktop: hidden */
.mobile-app-header,
.mobile-workflow-chrome,
.mobile-sticky-action,
.mobile-3d-chrome,
.mobile-preview-dock,
#mobile-preview-panel {
  display: none;
}

.crop-board.crop-board--scale-off {
  grid-template-columns: var(--crop-frame-w, auto);
  grid-template-rows: var(--crop-frame-h, auto);
  justify-content: center;
  align-content: center;
}

.crop-board.crop-board--scale-off .crop-ruler {
  display: none;
}

.crop-board.crop-board--scale-off .product-mockup {
  grid-column: 1;
  grid-row: 1;
}

/* ------------------------------------------------------------- admin page */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px calc(40px + env(safe-area-inset-bottom, 0px));
}

.header {
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--holo-blue-light));
  box-shadow: var(--shadow-1);
}

.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.admin-tabs {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--segment-track);
  margin-bottom: 24px;
}

.admin-tab {
  position: relative;
  z-index: 1;
  padding: 7px 18px;
  border: 0;
  background: none;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

.admin-tab.active {
  font-weight: 600;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.admin-panel.hidden {
  display: none;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  padding: 24px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}

.admin-table code {
  font-size: 12px;
  color: var(--text-secondary);
}

.table-muted {
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.settings-toolbar h2 {
  margin: 0;
  flex: 1;
}

.save-status {
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 1.2em;
}

.save-status.error {
  color: var(--red);
}

.save-status.ok {
  color: var(--green);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.settings-group {
  border-radius: var(--radius-control);
  padding: 16px;
  background: var(--bg);
}

.settings-group h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.field small {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
}

.field input,
.field select {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 10px;
}

.editable-table input[type="text"],
.editable-table input[type="number"] {
  width: 100%;
  min-width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}

.sheet-capacity-cell {
  max-width: 11.5rem;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: help;
}

.sheet-capacity-cell .sheet-capacity-label {
  display: inline-block;
  letter-spacing: 0.01em;
}

.sheet-capacity-cell.is-unconfigured {
  white-space: normal;
  color: var(--text-muted, var(--text-secondary));
  font-style: italic;
}

.preview-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-tint);
  font-size: 12px;
  color: var(--text-secondary);
}

.editable-table input.is-list-price {
  text-decoration: line-through;
  opacity: 0.72;
  color: var(--text-secondary, #666);
}

/* ---------------------------------------------------------- reduced motion */

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

/* --------------------------------------------------------------- responsive */

@media (max-width: 1100px) and (min-width: 901px) {
  :root {
    --sidebar-w: 280px;
  }

  .canvas-area {
    padding: 10px 12px 12px;
  }
}

@media (max-width: 900px) {
  :root {
    --mobile-preview-h: clamp(320px, 44svh, 500px);
    --mobile-header-h: 56px;
    --mobile-tabs-h: 52px;
    --mobile-sticky-h: 64px;
  }

  html.is-mobile-workflow,
  html.is-mobile-workflow body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100svh;
    max-height: 100dvh;
    max-height: 100svh;
    overflow: hidden;
    overflow-x: clip;
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
    padding-bottom: 0;
  }

  html.is-mobile-workflow.has-mobile-sticky .app-shell {
    padding-bottom: 0;
  }

  /* —— Compact top header —— */
  .mobile-app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    order: 0;
    flex: 0 0 auto;
    position: relative;
    z-index: 40;
    min-height: var(--mobile-header-h);
    padding: var(--safe-top) 14px 0;
    box-sizing: content-box;
    background: rgba(245, 245, 247, 0.96);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--hairline);
  }

  .mobile-app-header .mobile-app-brand,
  .mobile-app-header .mobile-app-header-actions {
    padding-bottom: 8px;
    padding-top: 8px;
  }

  html.is-embed .mobile-app-header,
  body.is-embed .mobile-app-header {
    display: none;
  }

  .mobile-app-brand {
    min-width: 0;
  }

  .mobile-brand-eyebrow {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.2;
  }

  .mobile-brand-title {
    margin: 0;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
  }

  .mobile-app-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mobile-app-header .mobile-menu-btn {
    display: none;
    position: static;
    flex-shrink: 0;
  }

  .mobile-menu-btn {
    display: none;
  }

  /* —— Persistent preview (does not scroll away) —— */
  .canvas-area {
    order: 1;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    padding: 12px 14px 8px;
    overflow: hidden;
    min-height: 0;
    position: relative;
    z-index: 32;
    background: var(--bg);
  }

  html.is-embed .canvas-area {
    top: 0;
  }

  .product-viewer {
    width: 100%;
    max-width: 100%;
  }

  .product-stage-card {
    flex: none;
    border-radius: 14px;
  }

  .product-stage {
    min-height: var(--mobile-preview-h);
    height: var(--mobile-preview-h);
    max-height: none;
    padding: 0;
  }

  /* Keep workspace height stable across placeholder / crop / 3D */
  .product-stage:has(#canvas-preview3d:not(.hidden)),
  .product-stage:has(#canvas-crop:not(.hidden)),
  .product-stage:has(#canvas-placeholder:not(.hidden)) {
    min-height: var(--mobile-preview-h);
    height: var(--mobile-preview-h);
  }

  #canvas-crop {
    padding: 8px 10px 10px;
  }

  .crop-board.crop-board--scale-off {
    min-height: 100%;
    width: 100%;
  }

  .crop-board.crop-board--scale-off .product-mockup {
    max-width: 100%;
    max-height: 100%;
  }

  .crop-board.crop-board--mobile-scale {
    --ruler-label-gutter: 22px;
    --ruler-tick-track: 12px;
  }

  .crop-board.crop-board--mobile-scale .crop-ruler-label {
    font-size: 9px;
  }

  .crop-board.crop-board--mobile-scale .crop-ruler--corner {
    font-size: 9px;
  }

  .scale-aids--mobile .dim-callout-label {
    font-size: 11px;
  }

  .scale-aids--mobile .scale-quarter-note {
    font-size: 9px;
  }

  .scale-aids--mobile .scale-quarter-wrap {
    transform: scale(0.92);
    transform-origin: top left;
  }

  /* —— Horizontal workflow tabs —— */
  .mobile-workflow-chrome {
    display: block;
    order: 2;
    flex: 0 0 auto;
    position: relative;
    z-index: 35;
    background: rgba(245, 245, 247, 0.98);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    border-bottom: 1px solid var(--hairline);
  }

  .mobile-workflow-tabs {
    position: relative;
  }

  .mobile-workflow-tabs::before,
  .mobile-workflow-tabs::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s var(--ease);
  }

  .mobile-workflow-tabs::before {
    left: 0;
    background: linear-gradient(90deg, rgba(245, 245, 247, 0.98), transparent);
  }

  .mobile-workflow-tabs::after {
    right: 0;
    background: linear-gradient(270deg, rgba(245, 245, 247, 0.98), transparent);
  }

  .mobile-workflow-tabs.has-fade-left::before,
  .mobile-workflow-tabs.has-fade-right::after {
    opacity: 1;
  }

  .mobile-workflow-tablist {
    display: flex;
    gap: 4px;
    padding: 6px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .mobile-workflow-tablist::-webkit-scrollbar {
    display: none;
  }

  .mobile-workflow-tab {
    flex: 0 0 auto;
    scroll-snap-align: center;
    min-height: 44px;
    min-width: 72px;
    padding: 8px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* Explicit L→R order: Shape → Adjust → Color → Build. */
  #mobile-tab-upload { order: 1; }
  #mobile-tab-size { order: 2; }
  #mobile-tab-adjust { order: 3; }
  #mobile-tab-color { order: 4; }
  #mobile-tab-build { order: 5; }
  #mobile-tab-tune { order: 6; }
  #mobile-tab-preview { order: 7; }

  html.is-mobile-workflow .crop-viewport.is-bg-painting,
  html.is-mobile-workflow .bg-mask-paint-canvas.is-active {
    touch-action: none;
  }

  html.is-mobile-workflow #step-align.mobile-panel-active .bg-mask-paint-tools {
    display: block;
  }

  html.is-mobile-workflow #step-align.mobile-panel-active .bg-remove-sensitivity {
    display: block;
  }

  /* Mobile: sensitivity stays visible; paint tools tuck under Advanced. */
  html.is-mobile-workflow .bg-remove-advanced {
    margin-top: 10px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 88%, var(--border));
    border: 1px solid var(--border);
  }

  html.is-mobile-workflow .bg-remove-advanced > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    list-style: none;
  }

  html.is-mobile-workflow .bg-remove-advanced summary::-webkit-details-marker {
    display: none;
  }

  html.is-mobile-workflow .bg-remove-advanced summary .disclosure-chevron {
    margin-left: auto;
    transition: transform var(--dur) var(--ease);
  }

  html.is-mobile-workflow .bg-remove-advanced[open] > summary .disclosure-chevron {
    transform: rotate(90deg);
  }

  html.is-mobile-workflow .bg-remove-advanced:not([open]) > .bg-remove-advanced-body {
    display: none !important;
  }

  html.is-mobile-workflow .bg-remove-advanced[open] > .bg-remove-advanced-body {
    display: block !important;
    padding: 2px 12px 12px;
    animation: disclosure-in var(--dur) var(--ease);
  }

  html.is-mobile-workflow .bg-remove-advanced .bg-mask-paint-tools {
    margin-top: 8px;
    padding-top: 0;
    border-top: 0;
  }

  /* Hide empty Advanced chrome until a cutout exists (paint tools appear). */
  html.is-mobile-workflow .bg-remove-advanced:not(:has(.bg-mask-paint-tools:not(.hidden))) {
    display: none;
  }

  .mobile-workflow-tab.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-1), 0 0 0 1px var(--hairline);
  }

  .mobile-workflow-tab.is-complete:not(.is-active) {
    color: var(--text);
  }

  .mobile-workflow-tab.is-complete:not(.is-active)::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--green);
    vertical-align: middle;
  }

  .mobile-workflow-tab.is-disabled,
  .mobile-workflow-tab:disabled {
    opacity: 0.38;
    cursor: not-allowed;
  }

  .mobile-workflow-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* —— Step panels (sidebar body) — only this region scrolls —— */
  .sidebar {
    position: relative;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    border-right: 0;
    border-top: 0;
    order: 3;
    padding-bottom: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .sidebar-brand {
    display: none;
  }

  .drawer-backdrop.visible {
    display: none;
  }

  .sidebar-scroll,
  #design-flow.sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    /* Keep last options above the sticky Continue / Make my HOLO bar */
    padding-bottom: calc(28px + var(--safe-bottom));
  }

  html.is-mobile-workflow.has-mobile-sticky .sidebar-scroll,
  html.is-mobile-workflow.has-mobile-sticky #design-flow.sidebar-scroll {
    padding-bottom: calc(28px + var(--safe-bottom));
  }

  #design-flow {
    padding: 8px 12px 0;
  }

  .flow-step--retired {
    display: none !important;
  }

  .flow-step.mobile-panel-hidden {
    display: none !important;
  }

  .flow-step.mobile-panel-active {
    display: block;
    margin: 0;
    padding: 0 0 8px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .flow-step.mobile-panel-active .flow-step-header {
    margin-bottom: 8px;
  }

  .flow-step.mobile-panel-active .flow-step-num {
    display: none;
  }

  .flow-step.mobile-panel-active .flow-step-title {
    font-size: 15px;
  }

  .step-title-desktop {
    display: none;
  }

  .step-title-mobile {
    display: inline;
  }

  .flow-step.mobile-panel-active .flow-step-sub {
    font-size: 12px;
  }

  /* Locked steps: still show body when the tab is active (tab gate handles access) */
  .flow-step.mobile-panel-active.is-locked .flow-step-body {
    opacity: 1;
    pointer-events: auto;
  }

  .flow-step.mobile-panel-active.is-setup-locked .flow-step-body {
    pointer-events: none;
    opacity: 0.55;
  }

  .flow-step.mobile-panel-active.is-setup-locked .crop-locked-banner {
    pointer-events: auto;
    opacity: 1;
  }

  .zoom-actions {
    margin-left: 0;
  }

  #mobile-preview-panel.mobile-panel-active {
    display: block !important;
  }

  .mobile-preview-tips {
    margin: 0 0 12px;
    padding-left: 1.1em;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
  }

  .mobile-preview-tips li + li {
    margin-top: 4px;
  }

  /* Compact size cards */
  .size-list-item {
    padding: 8px 10px;
    gap: 8px;
    min-height: 44px;
    align-items: flex-start;
  }

  .size-list-item.selected::after {
    top: 12px;
    transform: none;
    right: 10px;
  }

  .size-list-copy {
    gap: 1px;
    padding-right: 22px;
    min-width: 0;
  }

  .size-name {
    font-size: 13px;
  }

  .size-dimensions {
    font-size: 11px;
  }

  .size-price {
    font-size: 12px;
  }

  .size-blurb {
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    margin-top: 1px;
  }

  .size-list-shape {
    width: 24px;
    height: 24px;
    margin-top: 0;
  }

  .rotate-tools {
    margin-top: 8px;
  }

  .align-tools {
    margin-bottom: 8px;
  }

  #step-shape.mobile-panel-active .flow-step-body,
  #step-shape.wizard-panel-active .flow-step-body,
  #step-align.mobile-panel-active .flow-step-body,
  #step-align.wizard-panel-active .flow-step-body,
  #step-color.mobile-panel-active .flow-step-body,
  #step-color.wizard-panel-active .flow-step-body {
    padding-bottom: 12px;
  }

  #step-shape.wizard-panel-active .size-list,
  #step-shape.wizard-panel-active .size-grid,
  #step-shape.mobile-panel-active .size-list,
  #step-shape.mobile-panel-active .size-grid {
    padding-bottom: 8px;
  }

  #step-shape.wizard-panel-active .rotate-tools,
  #step-shape.mobile-panel-active .rotate-tools {
    margin-top: 10px;
    margin-bottom: 4px;
  }

  .layer-choice-card {
    padding: 10px;
  }

  .upload-box {
    min-height: 88px;
  }

  .desktop-checkout {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  /* —— Sticky primary action + compact config summary —— */
  .mobile-sticky-action {
    display: flex;
    flex-direction: column;
    gap: 8px;
    order: 4;
    flex: 0 0 auto;
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 45;
    padding: 10px 12px calc(10px + var(--safe-bottom));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--hairline);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06);
  }

  .mobile-sticky-action[hidden] {
    display: none !important;
  }

  .mobile-config-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    align-items: end;
    padding: 0 2px;
  }

  .mobile-config-summary[hidden] {
    display: none !important;
  }

  .mobile-config-summary__product {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .mobile-config-summary__product strong {
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
    line-height: 1.25;
  }

  .mobile-config-summary__product span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.3;
  }

  .mobile-config-summary__selection {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
    min-width: 0;
  }

  .mobile-config-summary__selection span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.3;
  }

  .mobile-config-summary__selection strong {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.1;
  }

  .mobile-sticky-btn {
    min-height: 48px;
    margin: 0;
    position: relative;
    z-index: 46;
    pointer-events: auto;
    touch-action: manipulation;
  }

  /* Keep Back + Continue on one row — never let either go full-bleed width. */
  .wizard-sticky-row .mobile-sticky-btn {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
  }

  .wizard-sticky-row .wizard-back-btn {
    width: auto;
    flex: 0 0 auto;
    max-width: 34%;
  }

  .mobile-sticky-eta {
    margin: 4px 0 0;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-secondary, rgba(0, 0, 0, 0.55));
  }

  .mobile-sticky-eta[hidden] {
    display: none !important;
  }

  .mobile-sticky-btn.is-soft-disabled,
  .mobile-sticky-btn[aria-disabled="true"]:not(:disabled) {
    opacity: 0.55;
  }

  .mobile-sticky-btn.is-cart-busy,
  .mobile-sticky-btn.is-busy {
    cursor: progress;
  }

  .mobile-sticky-action {
    pointer-events: auto;
  }

  @media (max-width: 360px) {
    .mobile-config-summary {
      grid-template-columns: 1fr;
      gap: 6px;
    }

    .mobile-config-summary__selection {
      flex-direction: row;
      align-items: baseline;
      justify-content: space-between;
      text-align: left;
    }

    .mobile-config-summary__selection strong {
      font-size: 18px;
    }
  }

  /* —— Immersive mobile 3D preview —— */
  .mobile-3d-chrome {
    display: none;
  }

  .mobile-preview-dock {
    display: none;
  }

  html.mobile-preview-immersive .mobile-app-header,
  html.mobile-preview-immersive .mobile-workflow-chrome,
  html.mobile-preview-immersive .sidebar {
    display: none !important;
  }

  html.mobile-preview-immersive .canvas-area {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  html.mobile-preview-immersive .product-viewer,
  html.mobile-preview-immersive .product-stage-card {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  /* ~30% shorter than full-bleed so page/dock can scroll while orbiting the HOLO. */
  html.mobile-preview-immersive .product-stage,
  html.mobile-preview-immersive .product-stage:has(#canvas-preview3d:not(.hidden)) {
    flex: 0 0 auto;
    width: 100%;
    height: 70svh;
    max-height: 70svh;
    min-height: min(260px, 70svh);
  }

  /* Commerce checkout: keep a stable square preview; ATC stacks below. */
  html.preview-commerce.mobile-preview-immersive .product-stage,
  html.preview-commerce.mobile-preview-immersive .product-stage:has(#canvas-preview3d:not(.hidden)) {
    width: min(575px, 100%) !important;
    max-width: 575px !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
  }

  html.preview-commerce.mobile-preview-immersive .preview-commerce-main,
  html.preview-commerce.mobile-preview-immersive .product-stage-card {
    width: min(575px, 100%) !important;
    max-width: 575px !important;
    margin-inline: auto !important;
  }

  html.preview-commerce.mobile-preview-immersive .mobile-sticky-action,
  html.preview-commerce.mobile-preview-immersive .mobile-3d-cart-bar,
  html.preview-commerce.mobile-preview-immersive .mobile-3d-chrome {
    display: none !important;
  }

  html.mobile-preview-immersive #canvas-preview3d:not(.hidden) {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  html.mobile-preview-immersive .viewer-shell {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  html.mobile-preview-immersive .viewer-viewport {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    /* Keep one-finger orbit on the canvas; scroll happens on the shorter page chrome. */
    touch-action: none;
  }

  html.mobile-preview-immersive .mobile-drag-hint:not([hidden]) {
    display: flex;
  }

  html.mobile-preview-immersive .mobile-drag-hint {
    bottom: 16px;
  }

  html.mobile-preview-immersive .mobile-drag-hint.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  html.mobile-preview-immersive .mobile-drag-hint.is-leaving {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }

  html.mobile-preview-immersive .mobile-drag-hint[hidden] {
    display: none !important;
  }

  .mobile-3d-cart-bar {
    display: none;
  }

  html.mobile-preview-immersive .mobile-3d-cart-bar:not([hidden]) {
    display: block;
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--safe-bottom, 0px));
    z-index: 22;
    pointer-events: none;
  }

  html.mobile-preview-immersive .mobile-3d-cart-btn {
    pointer-events: auto;
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    touch-action: manipulation;
  }

  html.mobile-preview-immersive .mobile-drag-hint {
    bottom: calc(76px + var(--safe-bottom, 0px));
  }

  .mobile-drag-hint__title {
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.2;
  }

  .mobile-drag-hint__sub {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.82;
    line-height: 1.2;
  }

  html.mobile-preview-immersive .layers-panel,
  html.mobile-preview-immersive .layers-panel-expand,
  html.mobile-preview-immersive .scale-toggle {
    display: none !important;
  }

  html.mobile-preview-immersive .view-toolbar {
    display: none !important;
  }

  html.mobile-preview-immersive body.is-admin .view-toolbar:has(.view-toolbar-row--admin:not([hidden])) {
    display: flex !important;
  }

  html.mobile-preview-immersive .mobile-3d-chrome {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    position: absolute;
    top: calc(10px + var(--safe-top));
    left: 10px;
    right: auto;
    z-index: 20;
    pointer-events: none;
    max-width: 140px;
  }

  html.mobile-preview-immersive .mobile-3d-chrome[hidden] {
    display: none !important;
  }

  html.mobile-preview-immersive .mobile-preview-dock:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    padding: 8px 12px 6px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--hairline);
    min-height: 0;
  }

  /* Compact cart chrome so the 3D stage keeps height */
  html.mobile-preview-immersive .mobile-config-summary {
    padding: 6px 12px 0;
    gap: 4px 10px;
  }

  html.mobile-preview-immersive .mobile-config-summary__product span {
    display: none;
  }

  html.mobile-preview-immersive .mobile-config-summary__selection {
    gap: 8px;
  }

  html.mobile-preview-immersive .mobile-sticky-action {
    order: 2;
    flex: 0 0 auto;
    z-index: 30;
    padding-bottom: max(8px, var(--safe-bottom));
  }

  .mobile-3d-edit {
    pointer-events: auto;
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    border: 2px solid var(--accent);
    border-radius: 999px;
    background: var(--holo-blue-10);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    box-shadow: var(--shadow-2), 0 0 0 1px var(--holo-blue-18);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .mobile-3d-layer-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 108px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: auto;
  }

  .mobile-3d-layer-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    width: 100%;
    min-height: 48px;
    min-width: 0;
    padding: 7px 9px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    box-shadow: var(--shadow-1), 0 0 0 1px var(--hairline);
    font: inherit;
    text-align: left;
    color: var(--text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }

  .mobile-3d-layer-btn__title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
  }

  .mobile-3d-layer-btn__price {
    font-size: 10px;
    font-weight: 650;
    line-height: 1.2;
    color: var(--text-secondary);
  }

  .mobile-3d-layer-btn__status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 650;
    color: var(--text-secondary);
    line-height: 1.2;
  }

  .mobile-3d-layer-btn.is-active {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-1), 0 0 0 1px rgba(0, 0, 0, 0.08);
  }

  .mobile-3d-layer-btn.is-active .mobile-3d-layer-btn__price,
  .mobile-3d-layer-btn.is-active .mobile-3d-layer-btn__status {
    color: rgba(255, 255, 255, 0.9);
  }

  .mobile-3d-layer-btn.is-preparing {
    opacity: 0.72;
  }

  .mobile-3d-layer-btn.is-preparing .mobile-3d-layer-btn__status {
    color: inherit;
  }

  .mobile-3d-layer-btn.is-ready:not(.is-active) {
    box-shadow: var(--shadow-1), 0 0 0 1.5px rgba(22, 101, 52, 0.35);
  }

  .mobile-3d-layer-btn.is-ready:not(.is-active) .mobile-3d-layer-btn__status {
    color: #166534;
  }

  .mobile-3d-layer-btn.is-error .mobile-3d-layer-btn__status {
    color: #b42318;
  }

  .mobile-3d-layer-btn.is-active.is-error .mobile-3d-layer-btn__status {
    color: #ffd7d3;
  }

  .mobile-3d-layer-btn:disabled,
  .mobile-3d-layer-btn.is-unavailable {
    cursor: not-allowed;
    opacity: 0.55;
  }

  .mobile-3d-layer-spinner {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    border-right-color: transparent;
    animation: mobile-preview-spin 0.7s linear infinite;
    flex-shrink: 0;
  }

  .mobile-3d-layer-btn.is-switching {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: 1px;
  }

  .mobile-3d-layer-btn.is-switching .mobile-3d-layer-btn__status::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 5px;
    vertical-align: -1px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    border-right-color: transparent;
    animation: mobile-preview-spin 0.7s linear infinite;
  }

  .mobile-preview-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 52px;
  }

  .mobile-preview-status[hidden] {
    display: none !important;
  }

  .mobile-preview-status__main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .mobile-preview-status__spinner {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    border-radius: 50%;
    border: 2px solid var(--holo-blue-25);
    border-top-color: var(--accent);
    animation: mobile-preview-spin 0.75s linear infinite;
    flex-shrink: 0;
  }

  .mobile-preview-status__spinner[hidden] {
    display: none !important;
  }

  .mobile-preview-status__copy {
    min-width: 0;
    flex: 1 1 auto;
  }

  .mobile-preview-status__title {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
    line-height: 1.3;
  }

  .mobile-preview-status__detail {
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.35;
  }

  .mobile-preview-status__detail[hidden] {
    display: none !important;
  }

  .mobile-preview-status__bar {
    height: 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  .mobile-preview-status__bar[hidden] {
    display: none !important;
  }

  .mobile-preview-status__bar-fill {
    width: 40%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    animation: mobile-preview-indeterminate 1.2s ease-in-out infinite;
  }

  .mobile-preview-status.is-error .mobile-preview-status__title {
    color: #b42318;
  }

  .mobile-preview-retry {
    align-self: flex-start;
    min-height: var(--tap-min);
    touch-action: manipulation;
  }

  .mobile-preview-retry[hidden] {
    display: none !important;
  }

  @keyframes mobile-preview-spin {
    to {
      transform: rotate(360deg);
    }
  }

  @keyframes mobile-preview-indeterminate {
    0% {
      transform: translateX(-120%);
    }
    100% {
      transform: translateX(320%);
    }
  }

  html.mobile-preview-immersive .mobile-sticky-action {
    order: 2;
  }

  html.viewer-fs-open .mobile-sticky-action,
  html.viewer-fs-open .mobile-workflow-chrome,
  html.viewer-fs-open .mobile-app-header {
    visibility: hidden;
  }

  .sticky-generate.is-visible {
    display: none;
  }

  .scale-toggle {
    top: 8px;
    right: 8px;
    min-height: var(--tap-min);
    min-width: var(--tap-min);
    padding: 10px 12px;
    font-size: 13px;
    touch-action: manipulation;
  }

  /* Controls live under the model — never over the artwork center */
  .view-toolbar {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
    gap: 0;
    padding: 0;
    border-radius: 0;
    border-top: 1px solid var(--hairline);
    box-shadow: none;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
  }

  .view-toolbar-row--main {
    justify-content: space-around;
    gap: 2px;
    padding: 8px 4px;
  }

  .view-toolbar-row--admin {
    padding: 8px 10px;
    gap: 8px;
    border-top: 1px solid var(--hairline);
    flex-wrap: wrap;
  }

  .view-toolbar-row--admin .view-tool-btn--admin {
    flex: 1 1 0;
    min-width: 0;
    height: auto;
    min-height: var(--tap-min);
  }

  .studio-mp4-zoom {
    display: none;
  }

  body.is-admin .view-toolbar-row--admin:not([hidden]) .studio-mp4-zoom {
    display: flex;
    flex: 1 1 100%;
    width: 100%;
  }

  .view-toolbar-extra {
    display: none;
  }

  .view-tool-btn--mobile-only {
    display: inline-flex;
  }

  .view-tool-btn {
    width: auto;
    min-width: var(--tap-min);
    height: auto;
    min-height: var(--tap-min);
    padding: 6px 6px;
    touch-action: manipulation;
  }

  .view-tool-btn--labeled {
    flex: 1 1 0;
    max-width: 72px;
  }

  .view-tool-label {
    display: block;
    font-size: 10px;
  }

  .view-tool-btn.is-on,
  .view-tool-btn[aria-pressed="true"] {
    background: var(--accent-tint);
    color: var(--accent);
  }

  .viewer-shell.viewer-fullscreen-fallback .view-toolbar {
    padding-bottom: calc(8px + var(--safe-bottom));
  }

  .slider-row {
    grid-template-columns: 64px minmax(64px, 1fr) auto;
  }

  .slider-row:has(> .icon-btn) {
    grid-template-columns: 64px minmax(64px, 1fr) auto 28px;
  }

  .slider-row output {
    min-width: 0;
  }

  .slider-row .icon-btn {
    grid-column: 4;
  }

  .btn-primary,
  .btn-secondary,
  .enhance-action-btn,
  .size-list-item,
  .layer-choice-card,
  .align-tool-btn {
    min-height: var(--tap-min);
  }

  input[type="range"] {
    height: var(--tap-min);
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -10.5px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  .canvas-tabs {
    margin-bottom: 8px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    flex-shrink: 0;
    padding: 7px 12px;
  }

  .scene-picker {
    top: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
  }

  .scene-thumb-btn canvas {
    width: 52px;
    height: 36px;
  }

  .product-info-bar {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 8px;
    margin-top: 8px;
    padding: 10px 0;
  }

  .info-item:nth-child(3) {
    border-left: 0;
  }

  .layers-panel {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    border-radius: 16px;
  }

  .layers-panel::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 5px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.18);
    z-index: 2;
  }

  .layers-panel:not(.mobile-expanded) {
    max-height: 76px;
    overflow: hidden;
  }

  .layers-panel:not(.mobile-expanded) .layers-panel-header,
  .layers-panel:not(.mobile-expanded) .layers-panel-footer {
    display: none;
  }

  .layers-panel:not(.mobile-expanded) .layers-panel-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 16px 10px 8px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .layers-panel:not(.mobile-expanded) .layers-row {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 50px;
    flex-shrink: 0;
    padding: 2px;
    gap: 2px;
  }

  .layers-panel:not(.mobile-expanded) .layers-row-label {
    display: none;
  }

  .layers-panel:not(.mobile-expanded) .layers-eye {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    background: var(--surface);
    box-shadow: var(--shadow-1), 0 0 0 0.5px var(--hairline);
    border-radius: 50%;
    z-index: 1;
  }

  .layers-panel:not(.mobile-expanded) .layers-eye .lucide,
  .layers-panel:not(.mobile-expanded) .layers-eye svg {
    width: 12px;
    height: 12px;
  }

  .layers-panel:not(.mobile-expanded) .layers-thumb {
    width: 44px;
    height: 44px;
  }

  .layers-panel.mobile-expanded {
    max-height: 46vh;
  }

  .layers-panel.mobile-expanded .layers-panel-header {
    display: flex;
    padding-top: 16px;
  }

  .layers-panel.mobile-expanded .layers-panel-footer {
    display: block;
  }

  .layers-panel.mobile-expanded .layers-panel-list {
    display: block;
    overflow-y: auto;
  }

  .layers-panel.mobile-expanded .layers-row {
    display: grid;
    grid-template-columns: 28px 40px 1fr;
    width: auto;
    padding: 5px 6px;
  }

  .layers-panel.mobile-expanded .layers-row-label {
    display: block;
  }

  .layers-panel.mobile-expanded .layers-eye {
    position: static;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
  }

  .layers-panel-expand {
    display: flex !important;
    position: absolute;
    right: 10px;
    top: -46px;
  }

  .layers-panel.collapsed .layers-panel-expand {
    display: none !important;
  }

  .viewer3d {
    min-height: 0;
  }

  .viewer-shell {
    height: 100%;
    min-height: 0;
  }

  .viewer-viewport {
    flex: 1 1 auto;
    min-height: 0;
  }

  .size-list,
  .size-grid {
    display: flex;
    flex-direction: column;
  }

  .layer-choice-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
  }

  .layer-choice-heading {
    font-size: 0.92rem;
    margin-bottom: 10px;
  }

  .mobile-layer-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin: 0 0 8px;
  }

  .mobile-layer-switch[hidden] {
    display: none !important;
  }

  .mobile-layer-switch__btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-layer-switch__btn.is-active {
    border-color: var(--accent, var(--holo-blue));
    box-shadow: 0 0 0 1px var(--accent, var(--holo-blue));
    background: rgba(var(--holo-blue-rgb), 0.06);
  }

  .mobile-layer-switch__title {
    font-size: 0.92rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.2;
  }

  .mobile-layer-switch__price {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
  }

  .mobile-layer-switch__btn.is-active .mobile-layer-switch__price {
    color: var(--accent, var(--holo-blue));
  }

  .layer-choice-card {
    min-height: 0;
    padding: 10px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .layer-choice-top {
    flex-wrap: wrap;
    gap: 4px 6px;
  }

  .layer-choice-title {
    font-size: 0.92rem;
  }

  .layer-choice-badge {
    font-size: 0.65rem;
  }

  .layer-choice-blurb {
    font-size: 0.72rem;
    line-height: 1.25;
    margin: 0;
  }

  .layer-choice-recommend {
    font-size: 0.62rem;
    padding: 2px 6px;
  }

  .layer-choice-card-status {
    font-size: 0.68rem;
    margin: 0;
    margin-top: auto;
  }

  .enhance-grid {
    grid-template-columns: 1fr;
  }

  .align-tools {
    flex-wrap: wrap;
  }

  .histogram-wrap {
    overflow-x: auto;
  }

  #histogram-canvas {
    min-width: 240px;
  }

  .holo-loader-message {
    min-height: 2.8em;
  }

  /* Build tab: big in-panel CTA (sticky also shows Make my HOLO) */
  #step-generate.mobile-panel-active .btn-primary#generate-btn,
  #step-generate.mobile-panel-active .btn-generate-holo {
    display: inline-flex;
    width: 100%;
    min-height: 54px;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 8px;
  }

  #step-generate.mobile-panel-active .flow-step-header {
    display: block;
  }

  #step-generate.mobile-panel-active {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  #step-tune.mobile-panel-active .mobile-tune-actions {
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
  }

  /* Advanced controls: keep quantization labels fully visible on phones */
  #step-tune .fine-tuning-body {
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 14px;
    overflow: visible;
  }

  #step-tune .fine-tuning-body #quant-segments,
  #step-tune .fine-tuning-body .segmented:not(.mini) {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #step-tune .fine-tuning-body #quant-segments .seg-btn,
  #step-tune .fine-tuning-body .segmented:not(.mini) .seg-btn {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
    overflow: visible;
  }

  #step-tune .fine-tuning-body .slider-row {
    grid-template-columns: minmax(0, 4.25rem) minmax(40px, 1fr) minmax(0, 6rem);
  }

  #step-tune .fine-tuning-body .slider-row:has(> .icon-btn) {
    grid-template-columns: minmax(0, 4.25rem) minmax(40px, 1fr) minmax(0, 6rem) 32px;
  }

  #step-tune .fine-tuning-body .slider-row output {
    font-size: 11px;
  }

  #step-tune .fine-tuning-body .caption {
    font-size: 12px;
  }

  .mobile-tune-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    border: 1.5px solid transparent;
    border-radius: 12px;
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s var(--ease), transform 0.12s var(--ease);
  }

  .mobile-tune-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  .mobile-tune-btn__label {
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.25;
  }

  .mobile-tune-btn__hint {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
  }

  .mobile-tune-btn--default {
    background: #e8f8ef;
    border-color: #1f9d55;
    color: #0f6b38;
  }

  .mobile-tune-btn--default .mobile-tune-btn__hint {
    color: #1f9d55;
  }

  .mobile-tune-btn--tuned {
    background: #fdecec;
    border-color: #d92d20;
    color: #912018;
  }

  .mobile-tune-btn--tuned .mobile-tune-btn__hint {
    color: #d92d20;
  }

  .mobile-tune-btn--default:not(:disabled):active,
  .mobile-tune-btn--tuned:not(:disabled):active {
    transform: scale(0.98);
  }

  #canvas-crop:not(.hidden),
  #canvas-placeholder:not(.hidden),
  #canvas-preview3d:not(.hidden) {
    height: 100%;
  }

  dialog.modal,
  #order-dialog {
    width: min(100vw - 16px, 520px);
    max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom));
    margin: auto;
    padding-bottom: calc(16px + var(--safe-bottom));
  }
}

/* Short landscape phones */
@media (max-width: 900px) and (orientation: landscape) {
  :root {
    --mobile-preview-h: clamp(200px, 46svh, 320px);
    --mobile-header-h: 44px;
  }

  .mobile-app-header {
    min-height: 44px;
  }

  .mobile-app-header .mobile-app-brand,
  .mobile-app-header .mobile-app-header-actions {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .mobile-brand-title {
    font-size: 14px;
  }

  html.mobile-preview-immersive .mobile-3d-chrome {
    top: calc(8px + var(--safe-top));
  }

  html.mobile-preview-immersive .product-stage,
  html.mobile-preview-immersive .product-stage:has(#canvas-preview3d:not(.hidden)) {
    height: 55svh;
    max-height: 55svh;
    min-height: min(180px, 55svh);
  }

  html.mobile-preview-immersive .mobile-preview-dock:not([hidden]) {
    min-height: 0;
    padding: 6px 10px 4px;
  }

  .view-tool-label {
    display: none;
  }
}

/* Very narrow phones */
@media (max-width: 360px) {
  .canvas-area {
    padding: 6px 8px 8px;
  }

  .mobile-workflow-tab {
    min-width: 64px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .view-tool-btn--labeled {
    padding: 6px 4px;
  }

  .view-tool-label {
    font-size: 9px;
  }

  .price-quote-amount {
    font-size: 24px;
  }
}

/* Internal test cart (MVP) */
.cart-cta {
  position: relative;
}

.cart-count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--forest);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  font-family: var(--font-mono);
}

.internal-cart-dialog {
  border: none;
  padding: 0;
  max-width: 420px;
  width: calc(100vw - 24px);
  border-radius: 10px;
  background: var(--cream, #f7f4ef);
  color: inherit;
}

.cart-added-dialog {
  border: none;
  padding: 0;
  max-width: 400px;
  width: calc(100vw - 28px);
  border-radius: 16px;
  background: var(--surface, #fff);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(20, 30, 24, 0.28);
}

/* WebGL canvas can paint over in-iframe dialogs — match holo-loader stacking. */
.cart-added-dialog[open] {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 10002;
  height: fit-content;
  max-height: min(92vh, 720px);
  overflow: hidden;
}

/* Mobile: pin to upper-middle of the visual viewport.
   Tall Shopify iframes make inset/margin auto sit too low on screen. */
@media (max-width: 900px) {
  .cart-added-dialog[open] {
    inset: auto;
    top: max(10dvh, calc(env(safe-area-inset-top, 0px) + 12px));
    left: 50%;
    right: auto;
    bottom: auto;
    margin: 0;
    transform: translateX(-50%);
    width: calc(100vw - 28px);
    max-width: 400px;
    max-height: min(78dvh, 640px);
  }
}

.cart-added-dialog::backdrop {
  background: rgba(20, 30, 24, 0.5);
}

html.cart-added-open .viewer3d,
html.cart-added-open .viewer-shell,
html.cart-added-open .product-viewer {
  z-index: 0 !important;
}

html.cart-added-open .viewer3d canvas {
  visibility: hidden;
  pointer-events: none;
}

.cart-added-panel {
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-added-panel h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 650;
}

.cart-added-copy {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-secondary, #5c635e);
}

.cart-added-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.cart-added-actions .btn-primary,
.cart-added-actions .btn-secondary {
  width: 100%;
  min-height: 48px;
  margin: 0;
  justify-content: center;
}

/* HOLO_CART_UPSELL_OFFER_V1 START */
.cart-added-dialog--upsell-v1 .cart-added-panel {
  gap: 10px;
  max-height: min(90vh, 680px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cart-added-upsell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-added-upsell-headline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cart-added-upsell-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.28;
  letter-spacing: -0.02em;
  font-weight: 750;
  color: var(--text, #12141a);
}

.cart-added-upsell-save {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.3;
  color: #1b7f4e;
  letter-spacing: -0.01em;
}

.cart-added-dialog--upsell-v1 .cart-added-upsell-save:not([hidden]) {
  font-size: 1.18rem;
}

.cart-added-upsell-sub {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text-secondary, #5a6170);
}

.commerce-bogo--cart-popup {
  margin: 0;
}

.commerce-bogo--cart-popup .commerce-bogo-body {
  padding: 24px 12px 12px;
}

.commerce-bogo--cart-popup .commerce-bogo-formula {
  margin-top: 0;
  gap: 4px;
}

.commerce-bogo--cart-popup .commerce-bogo-step {
  padding: 6px 4px;
  font-size: 0.64rem;
}

.commerce-bogo--cart-popup .holo-offer-preview-addon-v1-label {
  font-size: 0.56rem;
}

.commerce-bogo--cart-popup .holo-offer-preview-addon-v1-label--claimed {
  font-size: 0.58rem;
  font-weight: 800;
  color: #14653d;
}

.holo-offer-preview-addon-v1-step--complete {
  position: relative;
  border-color: rgba(27, 127, 78, 0.35);
  background: rgba(27, 127, 78, 0.06);
}

.holo-offer-preview-addon-v1-step--pending {
  border-style: dashed;
  border-color: rgba(var(--holo-blue-rgb, 48, 127, 226), 0.4);
  opacity: 0.92;
}

.holo-offer-preview-addon-v1-step--complete::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #1b7f4e;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.cart-added-dialog--upsell-v1 .cart-added-actions {
  margin-top: 4px;
  gap: 10px;
}

.cart-added-dialog--upsell-v1 .cart-added-another {
  min-height: 50px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.cart-added-checkout--text-link {
  min-height: auto !important;
  padding: 6px 8px 2px !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--accent, #307fe2) !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  text-decoration: none;
}

.cart-added-checkout--text-link:hover,
.cart-added-checkout--text-link:focus-visible {
  text-decoration: underline;
  background: transparent !important;
}

.cart-added-checkout--primary {
  min-height: 50px !important;
}

.cart-added-dialog--checkout-focus .cart-added-actions {
  display: flex;
  flex-direction: column;
}

.cart-added-dialog--checkout-focus .cart-added-checkout {
  order: 1;
}

.cart-added-dialog--checkout-focus .cart-added-another {
  order: 2;
  min-height: 50px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
}
/* HOLO_CART_UPSELL_OFFER_V1 END */

.internal-cart-dialog::backdrop {
  background: rgba(20, 30, 24, 0.45);
}

.internal-cart-panel {
  padding: 16px 18px 18px;
}

.internal-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.internal-cart-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.internal-cart-note {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.internal-cart-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(50vh, 360px);
  overflow: auto;
}

.internal-cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.internal-cart-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  background: #eee;
}

.internal-cart-item-meta {
  font-size: 0.8rem;
  line-height: 1.35;
}

.internal-cart-item-meta strong {
  display: block;
  margin-bottom: 2px;
}

.internal-cart-item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.internal-cart-item-actions input {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.internal-cart-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.internal-cart-status {
  min-height: 1.2em;
  margin: 10px 0;
  font-size: 0.82rem;
}

.internal-cart-status.ok {
  color: var(--forest);
}

.internal-cart-status.error {
  color: var(--error);
}

.internal-cart-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.internal-cart-completion {
  margin: 0 0 12px;
}

.internal-cart-complete-card {
  padding: 14px 16px;
  border-left: 3px solid var(--forest);
  background: rgba(31, 61, 45, 0.07);
  border-radius: 0 8px 8px 0;
}

.internal-cart-complete-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.internal-cart-complete-card p {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.internal-cart-order-number {
  color: var(--forest) !important;
  font-size: 0.95rem !important;
}

.internal-cart-qty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.internal-cart-qty-static {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}


/* ============================================================
   Wizard flow — mobile-first linear steps
   ============================================================ */

html.is-wizard-flow .flow-step.wizard-panel-hidden,
html.is-wizard-flow .flow-step.wizard-advanced-only {
  display: none !important;
}

html.is-wizard-flow .flow-step.wizard-panel-active {
  display: block !important;
}

html.is-wizard-flow .flow-step.is-locked .flow-step-body {
  pointer-events: auto;
  opacity: 1;
}

.wizard-progress {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 12px;
  margin: 0 0 8px;
  background: color-mix(in srgb, var(--bg, #f7f5f1) 92%, #fff);
  border-bottom: 1px solid var(--border, #e5e2dc);
  backdrop-filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.wizard-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.wizard-progress-current {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wizard-progress-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.wizard-progress-current strong {
  font-size: 1.05rem;
  line-height: 1.2;
}

.wizard-progress-track {
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: rgba(var(--holo-blue-rgb, 35, 136, 248), 0.14);
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  width: 20%;
  border-radius: inherit;
  background: var(--holo-blue, #2388f8);
  transition: width 0.35s ease;
}

.wizard-progress-steps,
.wizard-progress-dot {
  display: none !important;
}

.wizard-desktop-nav {
  display: none;
  gap: 10px;
  padding: 12px 0 4px;
  margin-top: 8px;
}

.wizard-desktop-nav[hidden] {
  display: none !important;
}

.wizard-desktop-nav .btn-primary[hidden],
.wizard-desktop-nav .btn-secondary[hidden] {
  display: none !important;
}

.wizard-desktop-nav .btn-primary,
.wizard-desktop-nav .btn-secondary {
  flex: 1;
  min-height: 48px;
}

.wizard-sticky-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}

.wizard-sticky-row .wizard-back-btn,
.wizard-sticky-row .mobile-sticky-btn {
  /* Global .btn-primary/.btn-secondary are width:100%; that breaks this row. */
  width: auto;
  margin-bottom: 0;
  min-width: 0;
}

.wizard-back-btn {
  flex: 0 0 auto;
  width: auto;
  max-width: 34%;
  min-width: 4.75rem;
  min-height: 52px;
  padding-inline: 14px;
  font-weight: 600;
}

.wizard-back-btn[hidden] {
  display: none !important;
}

.mobile-sticky-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 52px;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.hold-make-btn {
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hold-make-fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(var(--hold-make-progress, 0));
  background: color-mix(in srgb, #fff 28%, transparent);
  pointer-events: none;
  transition: none;
}

.hold-make-btn .btn-label,
.hold-make-btn .btn-spinner {
  position: relative;
  z-index: 1;
}

.hold-make-btn.is-holding {
  transform: scale(0.985);
}

.hold-make-btn.is-exploding {
  animation: hold-explode 0.42s ease-out forwards;
}

@keyframes hold-explode {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.18); filter: brightness(1.5); }
  100% { transform: scale(1.6); opacity: 0; filter: brightness(2); }
}

html.hold-make-flash::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: #0b3a7a;
  animation: hold-flash 0.42s ease-out forwards;
  pointer-events: none;
}

@keyframes hold-flash {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

.hold-make-hint {
  text-align: center;
  margin: 8px 0 0;
}

.free-preview-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
}

.free-preview-image {
  max-width: min(100%, 520px);
  max-height: min(70vh, 560px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #ececec 25%, transparent 25%),
    linear-gradient(-45deg, #ececec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececec 75%),
    linear-gradient(-45deg, transparent 75%, #ececec 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.free-preview-caption {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* Full-bleed light loader */
.holo-loader.holo-loader--light {
  background: #ffffff;
  color: var(--text, #111);
}

.holo-loader.holo-loader--light .holo-loader-panel {
  background: transparent;
  box-shadow: none;
  border: none;
  color: inherit;
  max-width: 28rem;
  text-align: center;
}

.holo-loader.holo-loader--light .holo-loader-busy {
  align-items: center;
  gap: 10px;
}

.holo-loader.holo-loader--light .holo-loader-copy {
  flex: none;
  width: 100%;
}

.holo-loader.holo-loader--light .holo-loader-heading,
.holo-loader.holo-loader--light .holo-loader-message,
.holo-loader.holo-loader--light .holo-loader-stage,
.holo-loader.holo-loader--light .holo-loader-error-text {
  color: inherit;
}

.holo-loader.holo-loader--light .holo-loader-message {
  margin: 0;
  color: var(--accent, #0b3a7a);
  font-size: clamp(1.15rem, 3.2vw, 1.45rem);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-align: center;
}

.holo-loader.holo-loader--light .holo-loader-eta {
  margin: -2px 0 0;
  max-width: 16rem;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.35;
  text-align: center;
  color: var(--text-secondary, rgba(0, 0, 0, 0.55));
}

.holo-loader.holo-loader--light .holo-loader-stage {
  color: var(--text-secondary, rgba(0, 0, 0, 0.55));
}

.holo-loader.holo-loader--light .holo-loader-spinner {
  border-color: rgba(var(--holo-blue-rgb, 11, 58, 122), 0.2);
  border-top-color: var(--accent, #0b3a7a);
}

.holo-loader.holo-loader--light .holo-loader-anim {
  min-height: 160px;
  margin: 0;
}

.holo-loader.holo-loader--light .holo-loader-stop {
  position: static;
  margin: 6px 0 0;
  background: #fff;
  border-color: rgba(0, 0, 0, 0.14);
  color: var(--text, #111);
}

.holo-loader.holo-loader--light [data-holo-loader-retry] {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.14);
  color: var(--text, #111);
}

.holo-loader.holo-loader--light .holo-loader-progress {
  background: rgba(var(--holo-blue-rgb, 11, 58, 122), 0.12);
  width: min(100%, 14rem);
  margin-inline: auto;
}

.holo-loader.holo-loader--light .holo-loader-progress-bar {
  background: var(--accent, #0b3a7a);
}

@media (max-width: 900px) {
  html.is-wizard-flow .mobile-workflow-chrome {
    display: none !important;
  }

  html.has-mobile-sticky {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-sticky-action {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  html.is-wizard-flow #design-flow {
    padding-bottom: 12px;
  }

  html.is-wizard-flow .flow-step-header {
    padding-top: 4px;
  }

  html.is-wizard-flow .enhance-action-btn,
  html.is-wizard-flow .align-tool-btn,
  html.is-wizard-flow .size-list button {
    min-height: 44px;
  }

  html.is-wizard-flow .btn-generate-holo {
    width: 100%;
    min-height: 56px;
    font-size: 1.05rem;
  }
}

@media (min-width: 901px) {
  .wizard-desktop-nav {
    display: flex;
  }

  html.is-wizard-flow .mobile-sticky-action {
    display: none !important;
  }

  html.is-wizard-flow.has-mobile-sticky {
    padding-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hold-make-btn.is-exploding,
  html.hold-make-flash::before {
    animation: none;
  }
}

.holo-loader.holo-loader--light.is-visible {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex !important;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.holo-loader.holo-loader--light.is-visible .holo-loader-panel {
  width: min(100%, 28rem);
}

/* ============================================================
   Shopify embed — single scroll owner on mobile
   Root cause fix: mobile standalone rules give .app-shell a 100svh
   overflow:hidden shell and .sidebar-scroll overflow-y:auto with
   overscroll-behavior:contain. In embed mode the iframe must expand
   to full content height so Shopify document/body owns vertical scroll.
   ============================================================ */

@media (max-width: 900px) {
  html.is-embed,
  html.is-embed body {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
  }

  html.is-embed .app-shell {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html.is-embed:not(.is-embed-editing):not(.editing-flow) .sidebar,
  html.is-embed:not(.is-embed-editing):not(.editing-flow) .sidebar-scroll,
  html.is-embed:not(.is-embed-editing):not(.editing-flow) #design-flow.sidebar-scroll,
  html.is-embed:not(.is-embed-editing):not(.editing-flow) .canvas-area {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
    -webkit-overflow-scrolling: auto !important;
  }
}

/* Express Create Yours: remove old upload/wizard surfaces from layout entirely.
   New-create never paints #step-upload or #canvas-placeholder — Edit restores them
   by clearing html.express-creating. */
html.express-creating,
html.express-creating body {
  background: #fff !important;
  overflow: hidden !important;
  height: 100% !important;
  min-height: 100% !important;
}

html.express-creating .app-shell {
  min-height: 100vh !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
  display: block !important;
}

html.express-creating .mobile-app-header,
html.express-creating .drawer-backdrop,
html.express-creating .sidebar,
html.express-creating .wizard-progress,
html.express-creating #step-upload,
html.express-creating #canvas-placeholder,
html.express-creating .canvas-tabs,
html.express-creating .canvas-area > :not(.product-viewer),
html.express-creating .product-viewer > :not(#holo-loader),
html.express-creating .preview-commerce-layout,
html.express-creating .mobile-sticky-action,
html.express-creating .mobile-workflow-chrome,
html.express-creating .wizard-desktop-nav {
  display: none !important;
}

html.express-creating .canvas-area,
html.express-creating .product-viewer {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

html.express-creating #holo-loader,
html.express-creating .holo-loader.holo-loader--light.is-visible {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  transition: none !important;
  background: #fff;
}

/* HOLO_OFFER_PREVIEW_ADDON_V1 START */
.holo-offer-preview-addon-v1-step--filled {
  justify-content: center;
  gap: 2px;
  padding: 4px;
  overflow: hidden;
}

.holo-offer-preview-addon-v1-img {
  display: block;
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
  user-select: none;
}

.holo-offer-preview-addon-v1-label {
  flex: 0 0 auto;
  font-size: 0.6rem;
  font-weight: 650;
  line-height: 1.05;
  color: var(--text-secondary, #5a6170);
  text-align: center;
}

.holo-offer-preview-addon-v1-label--claimed {
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: #14653d;
  text-transform: none;
  max-width: 100%;
  padding: 0 2px;
  word-break: break-word;
}

@media (max-width: 420px) {
  .commerce-bogo-formula {
    gap: 4px;
  }

  .commerce-bogo-step {
    padding: 6px 4px;
    font-size: 0.64rem;
  }

  .commerce-bogo-op {
    font-size: 0.9rem;
  }

  .holo-offer-preview-addon-v1-label {
    font-size: 0.56rem;
  }
}
/* HOLO_OFFER_PREVIEW_ADDON_V1 END */
