/* Compact design workspace, matched to the supplied desktop reference.
   Shared brand tokens and the Three.js controls remain in their existing files. */

body.customizer-wrapper {
  --workspace-cyan: #00b4d3;
  --workspace-blue: #009bd4;
  --workspace-border: #e2d9cd;
  --workspace-field: #faf9f7;
  background: #fff;
  min-height: 100vh;
  font-size: 12px;
}

.customizer-wrapper .blob { display: none; }

.customizer-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 28px;
  padding: 3px 10px;
  background: #fff;
  border-bottom: 1px solid #e8e8ec;
  flex: 0 0 auto;
}

.customizer-topbar h1 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.customizer-topbar > :last-child { justify-self: end; }

.customizer-topbar .logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-width: 0;
  text-decoration: none;
}

.customizer-topbar .logo img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.customizer-topbar .logo span {
  color: var(--ink);
  font: 700 11px var(--font-serif);
  white-space: nowrap;
}

.back-link {
  color: var(--workspace-blue);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.customizer-user {
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.customizer-guest-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.customizer-guest-notice {
  margin: 0;
  padding: 12px 18px;
  color: #61574d;
  font-size: 9px;
  line-height: 14px;
  flex: 0 0 auto;
}

.form-alert {
  margin: 8px 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  flex: 0 0 auto;
}

.form-alert-error {
  background: #fff3ef;
  border: 1px solid #efc8bc;
  color: #a8402a;
}

.customizer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 8px 4px 6px;
}

.preview-panel,
.workspace-panel {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--workspace-border);
  border-radius: 12px;
}

.preview-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 14px;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  flex: 0 0 auto;
}

.preview-header-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--workspace-border);
  border-radius: 6px;
  background: #fcfbf9;
  color: #4a3828;
  font-size: 11px;
  flex-shrink: 0;
}

.preview-header-meta { min-width: 0; }

.preview-header-meta h2 {
  margin: 0 0 1px;
  color: #2b221a;
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.preview-header-meta p {
  margin: 0;
  color: #8a7d70;
  font-size: 8px;
  line-height: 1.2;
}

.preview-3d-wrap {
  position: relative;
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #eee7de;
  border-radius: 10px;
  background: #fff;
  isolation: isolate;
}

.preview-3d-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.preview-3d-wrap canvas:active { cursor: grabbing; }

.preview-hint {
  margin: 6px 0 0;
  color: #8c8074;
  font-size: 9px;
  line-height: 1.4;
  text-align: center;
  flex: 0 0 auto;
}

.workspace-panel {
  min-height: 0;
  padding: 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: #cbbfaf transparent;
}

#designForm { min-width: 0; }

.workspace-panel::-webkit-scrollbar { width: 5px; }
.workspace-panel::-webkit-scrollbar-track { background: transparent; }
.workspace-panel::-webkit-scrollbar-thumb {
  background: #cbbfaf;
  border-radius: 8px;
}

.workspace-group { margin-bottom: 10px; }

.workspace-group > label {
  display: block;
  margin-bottom: 6px;
  color: #29231e;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.workspace-group input[type="text"],
.workspace-group select {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 5px 10px;
  border: 1px solid #dcd3c6;
  border-radius: 6px;
  background: var(--workspace-field);
  color: #393128;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.workspace-group input[type="text"]::placeholder {
  color: #8d857e;
  font-weight: 400;
}

.workspace-group input[type="text"]:focus,
.workspace-group select:focus {
  outline: none;
  border-color: var(--workspace-cyan);
  box-shadow: 0 0 0 3px rgb(0 180 211 / 12%);
  background: #fff;
}

.workspace-group input[type="file"] {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid #dcd3c6;
  border-radius: 6px;
  background: var(--workspace-field);
  color: #70665b;
  font: 10px var(--font-sans);
}

.workspace-group input[type="file"]::file-selector-button {
  margin-right: 6px;
  border: 1px solid #c8c0b5;
  border-radius: 3px;
  background: #fff;
  color: #4a4035;
  font: inherit;
  cursor: pointer;
}

.field-hint {
  margin-top: 5px;
  color: #8a7d70;
  font-size: 9px;
  line-height: 1.4;
}

.field-hint #selectedProductPrice {
  color: var(--workspace-blue);
  font-size: 10px;
  font-weight: 800;
}

.product-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.product-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 22px;
  padding: 4px 8px;
  border: 1px solid #ded6ca;
  border-radius: 999px;
  background: var(--workspace-field);
  color: #51463a;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.product-tab i { font-size: 9px; }

.product-tab:hover,
.artwork-card:hover {
  border-color: var(--workspace-cyan);
  background: #f1fbff;
}

.product-tab.active {
  border-color: var(--workspace-cyan);
  background: #e8f8fe;
  color: var(--workspace-blue);
  box-shadow: 0 2px 5px rgb(0 180 211 / 15%);
}

.color-swatches {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px;
}

.color-combo-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  margin-bottom: 5px;
}

.combo-title,
.color-group-label {
  color: #54483b;
  font-size: 10px;
  font-weight: 700;
}

.combo-subtitle {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #8a7d70;
  font-size: 9px;
}

.color-combo-grid,
.color-swatch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.color-combo-grid { margin-bottom: 6px; }
.color-group-label { margin: 3px 0 6px; }
.color-swatch-row { margin-bottom: 2px; }

.color-swatch,
.color-swatch-split {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #d0c8bb;
  cursor: pointer;
  flex-shrink: 0;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.color-swatch-split { width: 26px; height: 26px; }
.color-swatch:hover,
.color-swatch-split:hover { transform: scale(1.08); }
.color-swatch.selected,
.color-swatch-split.selected {
  box-shadow: 0 0 0 2px var(--workspace-cyan), 0 2px 5px rgb(0 180 211 / 16%);
}

.artwork-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  max-height: 132px;
  margin-top: 4px;
  padding-right: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbbfaf transparent;
}

.artwork-grid::-webkit-scrollbar { width: 4px; }
.artwork-grid::-webkit-scrollbar-track { background: transparent; }
.artwork-grid::-webkit-scrollbar-thumb { background: #cbbfaf; border-radius: 4px; }

.artwork-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 26px;
  padding: 5px 10px;
  border: 1px solid #ded6ca;
  border-radius: 6px;
  background: var(--workspace-field);
  text-align: left;
  font-family: var(--font-sans);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.artwork-card i {
  width: 14px;
  color: #5d5041;
  font-size: 12px;
  text-align: center;
  flex-shrink: 0;
}

.artwork-card span {
  min-width: 0;
  overflow: hidden;
  color: #44382d;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artwork-card.active {
  border-color: var(--workspace-cyan);
  background: #e7f8fe;
}

.artwork-card.active i,
.artwork-card.active span { color: var(--workspace-blue); }

.workspace-group-dual {
  display: flex;
  align-items: start;
  gap: 8px;
  margin-bottom: 10px;
}

.workspace-group-dual > .workspace-group { margin-bottom: 0; }
.workspace-primary-field { flex: 1; min-width: 0; }
.workspace-year-field { width: 82px; flex-shrink: 0; }
.workspace-scale-field { width: 94px; flex-shrink: 0; }

.workspace-scale-value {
  color: var(--workspace-blue);
  font-size: 9px;
  font-weight: 700;
}

.workspace-group input[type="range"],
.decal-popover input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 10px 0;
  accent-color: var(--workspace-cyan);
  cursor: pointer;
}

.workspace-scale-field input[type="range"] {
  display: block;
  height: 26px;
  margin: 0;
}

.submit-design-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  margin-top: 10px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--workspace-cyan);
  box-shadow: 0 3px 9px rgb(0 180 211 / 25%);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.submit-design-btn:hover {
  background: #009fbe;
  box-shadow: 0 4px 12px rgb(0 180 211 / 30%);
}

/* Floating tools stay inside the preview and clear of the product. */
.decal-toolbar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 3px;
  width: max-content;
  max-width: calc(100% - 16px);
  padding: 4px 6px;
  transform: translateX(-50%);
  border: 1px solid #dce2eb;
  border-radius: 999px;
  background: rgb(255 255 255 / 95%);
  box-shadow: 0 4px 18px rgb(15 23 42 / 10%);
  backdrop-filter: blur(12px);
}

.decal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 22px;
  padding: 4px 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #536078;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
}

.decal-btn i { font-size: 9px; }
.decal-btn:hover { background: #f1f5f9; color: #0f172a; }
.decal-btn.active { background: #e7f8fe; color: #008caf; }

.decal-popover {
  position: absolute;
  bottom: 56px;
  left: 50%;
  z-index: 25;
  width: 260px;
  max-width: calc(100% - 24px);
  padding: 12px 14px;
  transform: translateX(-50%);
  border: 1px solid #dce2eb;
  border-radius: 12px;
  background: rgb(255 255 255 / 98%);
  box-shadow: 0 10px 32px rgb(15 23 42 / 14%);
}

.decal-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
}

.decal-popover-close {
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.popover-row { margin-bottom: 8px; }
.popover-row:last-child { margin-bottom: 0; }
.popover-row label {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  color: #475569;
  font-size: 10px;
  font-weight: 600;
}

.slider-badge {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eff8fc;
  color: #0284c7;
  font-size: 9px;
  font-weight: 700;
}

.decal-step-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #334155;
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.product-tab:focus-visible,
.artwork-card:focus-visible,
.color-swatch:focus-visible,
.color-swatch-split:focus-visible,
.decal-btn:focus-visible,
.decal-step-btn:focus-visible,
.decal-popover-close:focus-visible,
.submit-design-btn:focus-visible,
.workspace-group input[type="file"]:focus-visible {
  outline: 2px solid var(--workspace-blue);
  outline-offset: 3px;
}

/* Flex distributes the remaining height after the actual header/notices,
   including errors and wrapped text, instead of guessing a header offset. */
@media (min-width: 1024px) {
  body.customizer-wrapper:not(.customizer-thumbnail-mode) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .customizer-layout {
    flex: 1 1 0;
    overflow: hidden;
  }

  .preview-panel,
  .workspace-panel { height: 100%; }

  .workspace-panel { overflow-y: auto; }
}

@media (max-width: 1023px) {
  .customizer-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 10px;
  }

  .preview-3d-wrap {
    flex: none;
    height: clamp(320px, 60vw, 560px);
  }

  .workspace-panel { padding: 18px; }
  .workspace-group > label { font-size: 12px; }
  .product-tab { min-height: 34px; font-size: 11px; }
  .artwork-grid { max-height: 190px; }
  .artwork-card { min-height: 38px; }
  .artwork-card span { font-size: 10px; }
  .workspace-group input[type="text"],
  .workspace-group select { height: 38px; font-size: 12px; }
  .workspace-group input[type="file"] { min-height: 38px; font-size: 11px; }
  .workspace-scale-field input[type="range"] { height: 38px; }
  .submit-design-btn { min-height: 42px; font-size: 12px; }
  .color-swatch { width: 28px; height: 28px; }
  .decal-btn { min-height: 30px; font-size: 10px; }
}

@media (max-width: 600px) {
  .customizer-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 8px 12px;
  }

  .customizer-topbar h1 {
    grid-row: 2;
    grid-column: 1 / -1;
    font-size: 13px;
  }

  .customizer-topbar > :last-child { grid-column: 2; grid-row: 1; }
  .customizer-guest-links { gap: 10px; }
  .customizer-guest-notice { padding: 10px 12px; font-size: 11px; line-height: 1.6; }
  .preview-panel { padding: 12px; }
  .preview-header-meta h2 { font-size: 12px; }
  .preview-header-meta p { font-size: 10px; }
  .workspace-panel { padding: 16px 12px; }
  .workspace-group { margin-bottom: 16px; }
  .workspace-group-dual { margin-bottom: 16px; }
  .workspace-year-field { width: 84px; }
  .workspace-scale-field { width: 94px; }
  .field-hint { font-size: 10px; }
  .color-swatches { padding: 4px; }
}

@media (max-width: 380px) {
  .artwork-grid { grid-template-columns: minmax(0, 1fr); }
  .customizer-guest-links { gap: 7px; }
  .back-link { font-size: 9px; }
  .workspace-scale-field { width: 82px; }
}

@media (prefers-reduced-motion: reduce) {
  .customizer-wrapper *,
  .customizer-wrapper *::before,
  .customizer-wrapper *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Pen-set controls are only shown for this product. */
.pen-set-controls[hidden], .pen-set-controls [hidden] { display: none !important; }
.pen-set-targets { display: flex; gap: .6rem; }
.pen-set-targets button, .pen-set-open {
  border: 1px solid #d7c8b8; border-radius: 10px; background: #fffdf9;
  color: #563c2b; padding: .65rem .9rem; font: inherit; cursor: pointer;
}
.pen-set-targets button { flex: 1; }
.pen-set-targets button[aria-pressed="true"] { background: #63432e; color: white; border-color: #63432e; }
.pen-set-controls button:focus-visible { outline: 2px solid #a16d41; outline-offset: 3px; }
.pen-set-open { font-size: .85rem; }
