/* ─────────────────────────────────────────────────────────────
   BLINDSAVE Goalie Suit Customizer — Light premium theme
   ───────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'New Athletic M54';
  src: url('../fonts/NewAthleticM54.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

:root {
  /* surfaces */
  --bg: #FFFFFF;
  --surface: #FAFAFA;
  --surface-2: #F4F4F4;
  --surface-3: #EFEFEF;
  --border: #E8E8E8;
  --border-strong: #D6D6D6;

  /* text */
  --text: #0A0A0A;
  --text-2: #4A4A4A;
  --text-3: #8A8A8A;
  --text-muted: #B5B5B5;

  /* brand accent — BLINDSAVE pink (overridable when client confirms) */
  --accent: #E91E63;
  --accent-hover: #D81557;
  --accent-soft: rgba(233, 30, 99, 0.08);
  --accent-ring: rgba(233, 30, 99, 0.18);

  /* depth */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.02);
  --shadow-2: 0 2px 8px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-3: 0 4px 16px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);

  /* timing */
  --t-fast: 150ms;
  --t-base: 220ms;
  --t-slow: 360ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* type */
  --font-display: 'Bebas Neue', sans-serif;
  --font-sans: 'Figtree', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
button:disabled { cursor: not-allowed; opacity: 0.5; }

/* Visible focus ring on keyboard navigation. Browsers hide :focus-visible
   from mouse clicks automatically, so this only shows for Tab users.
   Uses the neutral text colour rather than the brand pink — pink is too
   close to the contrast-block warning red and would mislead the user. */
:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 4px;
}
.cz-row-swatch:focus-visible {
  outline-offset: 3px;
}
.cz-input:focus-visible,
.cz-color-input:focus-visible {
  outline: none;
}

/* Honour reduced-motion preference: keep transitions instantaneous and
   pause looping animations (loader pulse) for vestibular-sensitive users. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

input { font: inherit; color: inherit; }

img, svg { display: block; max-width: 100%; }

/* ── HEADER ──────────────────────────────────────────────────── */
.cz-header {
  flex-shrink: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
}

.cz-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cz-brand-mark {
  width: 24px;
  height: 24px;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.cz-brand-text {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 4px;
  color: var(--text);
}
.cz-brand-text em {
  font-style: normal;
  color: var(--text-3);
  margin-left: 6px;
}

.cz-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-2);
  text-transform: uppercase;
}
.cz-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #00B85C;
  box-shadow: 0 0 0 3px rgba(0, 184, 92, 0.15);
}

.cz-config-id {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
}

/* ── MAIN LAYOUT ─────────────────────────────────────────────── */
.cz-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 420px;
  min-height: 0;
}

/* ── PREVIEW PANEL ──────────────────────────────────────────── */
.cz-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    radial-gradient(ellipse 70% 50% at 50% 50%, var(--surface) 0%, var(--bg) 100%);
  padding: 24px 32px 28px;
  overflow: hidden;
}

.cz-variant-switch {
  position: relative;
  display: inline-flex;
  gap: 12px;
  z-index: 2;
}
.cz-variant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.cz-variant.active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text);
  box-shadow: var(--shadow-2);
}
.cz-variant:hover:not(.active) {
  color: var(--text-2);
  border-color: var(--border-strong);
}
.cz-variant-thumb {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
  transition: background var(--t-fast) var(--ease);
}
.cz-variant.active .cz-variant-thumb {
  background: var(--bg);
}
.cz-variant-thumb svg {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: geometricPrecision;
}



/* ── STAGE (large preview) ──────────────────────────────────── */
.cz-stage {
  flex: 1;
  width: 100%;
  position: relative;
  margin-top: 16px;
  margin-bottom: 16px;
  min-height: 0;
}
.cz-stage-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,0,0,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.cz-view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  pointer-events: none;
  /* Keep the 3D space alive across the cz-view scale transform —
     without this, the perspective on .cz-stage gets flattened by
     cz-view's 2D scale and rotateX/Y on .cz-tilt has no visual effect. */
  transform-style: preserve-3d;
}
.cz-view[data-active="true"] {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.cz-tilt {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Parallax tilt — JS writes inline `transform` on this wrapper when the
     cursor moves over the stage. Lives inside .cz-view so the tilt rotation
     never fights the existing scale/opacity transitions used for view +
     variant switching. */
  transition: transform 140ms var(--ease);
  transform-origin: center center;
  transform-style: preserve-3d;
}
.cz-view svg {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  /* No drop-shadow filter here — applying a per-pixel shadow to a 2000+
     path SVG (e.g. the auto-traced halftone logo on Design 02) creates a
     moiré/streaking artifact in WebKit & Chromium. Depth comes from the
     stage's radial gradient + thumbnail container shadow instead. */
}
.cz-stage { perspective: 1500px; }
@media (prefers-reduced-motion: reduce) {
  .cz-tilt { transform: none !important; }
}

.cz-view-label {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-3);
  text-transform: uppercase;
  background: var(--bg);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.cz-swipe-hint {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
/* On mobile the swipe hint sat at right-of-stage, where it overlapped
   the chest logo on portrait views. Tuck it just under the view-label
   pill (centered, below the bottom edge of the stage padding) so it
   never overlaps the suit. */
@media (max-width: 768px) {
  .cz-swipe-hint {
    opacity: 0.7;
    top: auto;
    right: auto;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 0);
    font-size: 8px;
    letter-spacing: 1.5px;
    padding: 0 4px;
  }
  .cz-view-label { bottom: 24px; }
}

/* ── STAGE LOADER + ERROR OVERLAY ───────────────────────────── */
.cz-stage-loader,
.cz-stage-error {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity var(--t-base) var(--ease);
}
.cz-stage-loader[hidden],
.cz-stage-error[hidden] { display: none; }

.cz-stage-loader {
  gap: 8px;
  flex-direction: row;
  flex-wrap: wrap;
  padding: 16px;
}
.cz-stage-loader .cz-loader-text {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-left: 4px;
}
.cz-loader-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: cz-pulse 1.2s ease-in-out infinite;
}
.cz-loader-dot:nth-child(2) { animation-delay: 0.15s; }
.cz-loader-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes cz-pulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

.cz-stage-error {
  flex-direction: column;
  gap: 12px;
  text-align: center;
  padding: 24px;
}
.cz-stage-error-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #DC2626;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cz-stage-error-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.cz-stage-error-text {
  font-size: 13px;
  color: var(--text-2);
  max-width: 320px;
}
.cz-stage-error-retry {
  margin-top: 4px;
  padding: 10px 22px;
  background: var(--text);
  color: var(--bg);
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.cz-stage-error-retry:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

/* ── TOAST ──────────────────────────────────────────────────── */
.cz-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 12px 20px;
  background: var(--text);
  color: var(--bg);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  max-width: calc(100vw - 32px);
  text-align: center;
  animation: cz-toast-in var(--t-base) var(--ease);
}
.cz-toast[hidden] { display: none; }
.cz-toast[data-type="error"] { background: #DC2626; }
.cz-toast[data-type="success"] { background: #00B85C; }
@keyframes cz-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 768px) {
  .cz-toast {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    font-size: 12px;
    padding: 10px 16px;
  }
}

/* ── THUMBNAILS ─────────────────────────────────────────────── */
.cz-thumbs {
  display: flex;
  gap: 10px;
  padding-top: 4px;
  flex-shrink: 0;
}
.cz-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  transition: all var(--t-fast) var(--ease);
}
.cz-thumb:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.cz-thumb.active {
  border-color: var(--text);
  box-shadow: var(--shadow-2);
}
.cz-thumb-frame {
  width: 60px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 6px;
  overflow: hidden;
}
.cz-thumb-frame svg {
  max-width: 88%;
  max-height: 88%;
}
.cz-thumb-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--text-3);
  text-transform: uppercase;
}

/* ── CONFIG PANEL ───────────────────────────────────────────── */
.cz-config {
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cz-config-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.cz-config-scroll::-webkit-scrollbar { width: 8px; }
.cz-config-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.cz-config-scroll::-webkit-scrollbar-track { background: transparent; }

/* ── CURATED PALETTES ───────────────────────────────────────── */
.cz-palettes-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.cz-palettes-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cz-palettes-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cz-palettes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.cz-palette {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.cz-palette:hover {
  border-color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.cz-palette.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cz-palette-dots {
  display: inline-flex;
  align-items: center;
  gap: -6px;
}
.cz-palette-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border-strong);
  margin-left: -6px;
}
.cz-palette-dot:first-child { margin-left: 0; }
.cz-palette-name {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-2);
}
.cz-palette.active .cz-palette-name { color: var(--text); }

@media (max-width: 480px) {
  .cz-palettes-header { margin-bottom: 8px; }
  .cz-palette { padding: 8px 4px; gap: 6px; }
  .cz-palette-dot { width: 14px; height: 14px; }
  .cz-palette-name { font-size: 9px; letter-spacing: 0.5px; }
}

/* ── SAVED DESIGNS GALLERY ──────────────────────────────────── */
.cz-gallery-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.cz-gallery-section .cz-section-title {
  margin-bottom: 8px;
}

.cz-gallery {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cz-gallery-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
}
.cz-gallery-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color var(--t-fast) var(--ease);
}
.cz-gallery-slot:hover { border-color: var(--border-strong); }
.cz-gallery-dots {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.cz-gallery-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border-strong);
  margin-left: -5px;
}
.cz-gallery-dot:first-child { margin-left: 0; }
.cz-gallery-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cz-gallery-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cz-gallery-date {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-3);
}
.cz-gallery-load {
  padding: 5px 12px;
  border-radius: 7px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-2);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.cz-gallery-load:hover {
  background: var(--text);
  color: var(--bg);
}
.cz-gallery-delete {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cz-gallery-delete:hover { background: #DC2626; color: var(--bg); }

/* ── RESTORE BANNER ─────────────────────────────────────────── */
.cz-restore {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-2);
  transition: opacity var(--t-base) var(--ease);
}
.cz-restore[hidden] { display: none; }
.cz-restore.is-fading { opacity: 0; }
.cz-restore-icon {
  font-size: 14px;
  line-height: 1;
  color: #00B85C;
  flex-shrink: 0;
}
.cz-restore-text {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.cz-restore-reset {
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-2);
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.cz-restore-reset:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.cz-restore-dismiss {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.cz-restore-dismiss:hover {
  background: var(--text);
  color: var(--bg);
}

.cz-section { margin-bottom: 18px; }
.cz-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── ROW (color zone) ───────────────────────────────────────── */
.cz-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.cz-row[hidden] { display: none; }
[data-view-only][hidden] { display: none; }

/* Contrast validation states on color rows */
.cz-row.cz-row-warn {
  border-color: #F59E0B;
  background: rgba(245, 158, 11, 0.04);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}
.cz-row.cz-row-block {
  border-color: #DC2626;
  background: rgba(220, 38, 38, 0.04);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.cz-row:hover { border-color: var(--border-strong); }
.cz-row:focus-within {
  /* Neutral dark border — the accent pink reads too close to the
     block-warning red, which made customers think the field was
     erroring out. Block / warn states still use distinct red / amber. */
  border-color: var(--text);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.cz-row-swatch {
  width: 24px; height: 24px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.cz-row-trigger { cursor: pointer; transition: transform var(--t-fast) var(--ease); }
.cz-row-trigger:hover { transform: scale(1.06); }

.cz-row-label {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}

.cz-row-hash {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.cz-color-input {
  width: 70px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text);
  text-align: left;
  padding: 4px 6px;
  border: 1px solid transparent;
  background: var(--surface-2);
  border-radius: 6px;
  text-transform: uppercase;
}
.cz-color-input:focus {
  outline: none;
  border-color: var(--text);
  background: var(--bg);
}

/* ── UPLOAD ─────────────────────────────────────────────────── */
.cz-upload { margin-bottom: 12px; }
.cz-upload-zone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1.5px dashed var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.cz-upload-zone:hover,
.cz-upload-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cz-upload-zone.is-dragging .cz-upload-icon { color: var(--accent); }
.cz-upload-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 16px;
  font-weight: 300;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cz-upload-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.cz-upload-text {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}
.cz-upload-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-3);
}

/* Preview shares the upload zone's footprint exactly — only one is
   visible at a time, so the "slot" looks unchanged whether empty or
   filled. Same padding, dashed border, gap. */
.cz-upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1.5px dashed var(--border-strong);
  border-radius: 10px;
}
.cz-upload-preview[hidden] { display: none; }
.cz-upload-preview img {
  width: 28px; height: 28px;
  object-fit: contain;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.cz-upload-name {
  flex: 1;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.cz-upload-remove {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.cz-upload-remove:hover { background: var(--text); color: var(--bg); }

/* ── FIELD (name / number) ──────────────────────────────────── */
.cz-field { margin-bottom: 8px; }
.cz-field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.cz-field-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.cz-field-row .cz-input { flex: 1; }
.cz-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: 2px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.cz-input::placeholder { color: var(--text-muted); letter-spacing: 2px; }
.cz-input:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

/* Inline color picker beside name/number input */
.cz-row-inline {
  margin-bottom: 0;
  padding: 6px 10px;
  gap: 8px;
  flex-shrink: 0;
}
.cz-row-inline .cz-row-swatch {
  width: 22px; height: 22px;
}
.cz-row-inline .cz-color-input {
  width: 60px;
}
/* Side-by-side fields with their own labels (e.g. Number + per-side color) */
.cz-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
  align-items: start;
}
.cz-field-grid .cz-field { margin-bottom: 0; }
.cz-field-grid .cz-row-inline {
  height: 38px;
  width: 100%;
}
.cz-field-grid .cz-row-inline .cz-color-input {
  flex: 1;
  width: auto;
  min-width: 0;
}

/* ── SEGMENTED CONTROL (name position toggle) ───────────────── */
.cz-segmented {
  display: inline-flex;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.cz-segmented-option {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.cz-segmented-option:hover { color: var(--text); }
.cz-segmented-option.active {
  background: var(--text);
  color: var(--bg);
}

/* ── FOOTER (price + CTA) ───────────────────────────────────── */
.cz-config-footer {
  flex-shrink: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Price + Add-to-cart share one row — Total label/value stacked on the
   left, the primary CTA fills the rest. Cuts a whole row off the
   footer height. */
.cz-footer-checkout {
  display: flex;
  align-items: stretch;
  gap: 12px;
}
.cz-footer-checkout .cz-price {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  flex-shrink: 0;
}
.cz-footer-checkout .cz-cta {
  flex: 1;
  height: auto;
  min-height: 48px;
}

/* Contrast warning panel */
.cz-warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.cz-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.cz-warning:hover { transform: translateY(-1px); filter: brightness(0.97); }
.cz-warning-warn {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400E;
}
.cz-warning-block {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #991B1B;
}
.cz-warning-icon {
  font-size: 14px;
  line-height: 1.2;
  flex-shrink: 0;
}
.cz-warning-body { flex: 1; min-width: 0; }
.cz-warning-title {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}
.cz-warning-text {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.85;
}

.cz-cta.is-blocked {
  background: var(--text-muted);
  cursor: not-allowed;
}
.cz-cta.is-blocked:hover {
  background: var(--text-muted);
  transform: none;
}

/* Footer secondary actions row — Save + Share live here so the price/CTA
   block keeps every commit-worthy control in one cluster. */
.cz-footer-secondary-actions {
  display: flex;
  gap: 8px;
}
.cz-cta-tertiary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  transition: color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.cz-cta-tertiary:hover {
  color: var(--text);
  border-color: var(--text);
  background: var(--surface);
}

/* Secondary CTA — sits above the primary "Add to cart" button */
.cz-cta-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.8px;
  transition: color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.cz-cta-secondary:hover {
  color: var(--text);
  border-color: var(--text);
  transform: translateY(-1px);
}
.cz-cta-secondary:active { transform: translateY(0); }

/* ── FULL-SUIT MODAL ──────────────────────────────────────── */
.cz-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: cz-modal-fade var(--t-base) var(--ease);
}
.cz-modal[hidden] { display: none; }
@keyframes cz-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.cz-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}
.cz-modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1080px;
  max-height: 100%;
  background: var(--bg);
  border-radius: 18px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: cz-modal-rise var(--t-base) var(--ease);
}
@keyframes cz-modal-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cz-modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.cz-modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 3px;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--text);
}
.cz-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.cz-modal-close:hover {
  background: var(--text);
  color: var(--bg);
}
.cz-modal-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  padding: 20px;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}
.cz-modal-cell {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-height: 280px;
}
.cz-modal-frame {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.cz-modal-frame svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
.cz-modal-label {
  text-align: center;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-3);
}

@media (max-width: 768px) {
  .cz-modal { padding: 12px; }
  .cz-modal-content { border-radius: 14px; }
  .cz-modal-header { padding: 14px 18px; }
  .cz-modal-title { font-size: 16px; letter-spacing: 2px; }
  .cz-modal-grid { padding: 12px; gap: 8px; }
  .cz-modal-cell { padding: 10px; min-height: 200px; }
}

@media (max-width: 520px) {
  .cz-modal-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, 1fr);
  }
  .cz-modal { padding: 0; }
  .cz-modal-content {
    border-radius: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
  }
}
.cz-price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.cz-price-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-3);
  text-transform: uppercase;
}
.cz-price-value {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 1.5px;
  color: var(--text);
  line-height: 1;
}

.cz-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  background: var(--text);
  color: var(--bg);
  border-radius: 11px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 1px;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.cz-cta:hover {
  background: var(--accent);
  transform: translateY(-1px);
}
.cz-cta:active { transform: translateY(0); }

/* ── COLORIS PICKER OVERRIDES ───────────────────────────────── */
.clr-picker {
  border-radius: 12px !important;
  box-shadow: var(--shadow-3) !important;
  border: 1px solid var(--border) !important;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .cz-main { grid-template-columns: 1fr 360px; }
}

/* Mobile: stacked layout with body scroll + sticky CTA footer.
   Avoid the desktop "two scroll panes" pattern — on small screens
   it traps the customer in the config pane and hides the preview. */
@media (max-width: 768px) {
  html, body {
    height: auto;
    min-height: 100%;
  }
  body {
    overflow: auto;
    -webkit-text-size-adjust: 100%;
  }

  .cz-main {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-template-rows: none;
    min-height: 100vh;
  }

  /* Sticky preview pinned to the viewport top — keeps the suit
     visible while the customer scrolls colour rows below it, so
     they can see edits land in real time without losing the
     thumbnail. Uses a fixed (not min) height so the sticky offset
     stays predictable as content shifts. */
  .cz-preview {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px 6px;
    height: 56vh;
    min-height: 320px;
    max-height: 480px;
  }
  .cz-stage { flex: 1 1 auto; min-height: 0; margin: 8px 0; }

  /* Match the desktop thumbnail layout on mobile too — the customer
     wants to see both designs side-by-side as previews, not as
     compact pills. Slightly smaller thumb cap so the sticky preview
     can still fit the stage below. */
  .cz-variant-switch {
    width: 100%;
    max-width: 360px;
    gap: 10px;
  }
  .cz-variant {
    flex: 1;
    padding: 8px 8px 10px;
    min-width: 0;
  }
  .cz-variant-thumb {
    display: flex;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: 80px;
    margin: 0 auto;
  }
  .cz-variant-label { font-size: 10px; letter-spacing: 1px; }

  /* Thumbs: horizontal scroll + snap on mobile (avoid wrapping
     onto multiple rows which eats vertical space). */
  .cz-thumbs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 12px;
    margin: 0 -12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cz-thumbs::-webkit-scrollbar { display: none; }
  .cz-thumb {
    flex-shrink: 0;
    scroll-snap-align: center;
  }

  .cz-config {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: none;
  }
  .cz-config-scroll {
    overflow-y: visible;
    padding: 20px 18px 12px;
  }

  /* Sticky footer keeps price + CTA visible while scrolling colors. */
  .cz-config-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  }

  /* Touch-friendly sizing (≥44px tap targets, 16px inputs to
     prevent iOS auto-zoom on focus). */
  .cz-row {
    min-height: 48px;
    padding: 10px 14px;
  }
  .cz-row-swatch { width: 32px; height: 32px; }
  .cz-row-inline { padding: 6px 10px; }
  .cz-row-inline .cz-row-swatch { width: 26px; height: 26px; }

  .cz-input { font-size: 16px; padding: 14px; }
  .cz-color-input { font-size: 13px; }

  .cz-cta { height: 56px; font-size: 15px; }

  .cz-warnings { max-height: 120px; }

  .cz-config-id { display: none; }
}

/* Small phones (≤480px): tighten layout further. */
@media (max-width: 480px) {
  .cz-preview {
    padding: 8px 12px 4px;
    height: 52vh;
    min-height: 300px;
    max-height: 440px;
  }

  .cz-variant-switch { gap: 8px; max-width: 320px; }
  .cz-variant { padding: 6px 6px 8px; }
  .cz-variant-thumb { max-width: 64px; }
  .cz-variant-label { font-size: 9px; letter-spacing: 1px; }

  .cz-thumb-frame { width: 44px; height: 52px; }
  .cz-thumb-label { font-size: 7px; letter-spacing: 1px; }

  .cz-section { margin-bottom: 20px; }
  .cz-row-label { font-size: 12px; }
  .cz-color-input { width: 64px; }

  /* Stack name/number side-by-side fields on tiny screens
     so labels + color pickers stay readable. */
  .cz-field-grid { grid-template-columns: 1fr; gap: 10px; }
  .cz-field-grid .cz-row-inline { height: 44px; }

  .cz-config-scroll { padding: 16px 14px 8px; }
  .cz-config-footer { padding: 12px 14px calc(16px + env(safe-area-inset-bottom, 0px)); }

  .cz-price-value { font-size: 24px; }
  .cz-price-label { font-size: 9px; }

  .cz-upload-zone { padding: 18px 14px; }
}
