.image-preview--mug {
  padding-top: 0.5rem;
  padding-bottom: 0.75rem;
}

.image-preview--mug .mug-stage {
  width: min(100%, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  z-index: 2;
}

.image-preview--mug .prev-wrap,
.image-preview--mug #noPreview {
  display: none;
}

.image-preview--mug.mug-flat-fallback .mug-stage {
  display: none;
}

.image-preview--mug.mug-flat-fallback .prev-wrap,
.image-preview--mug.mug-flat-fallback #noPreview {
  display: flex;
}

.mug-stage-canvas-wrap {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  background: transparent;
}

.mug-stage.is-updating .mug-stage-canvas-wrap {
  animation: mug-preview-build 2.6s ease-out forwards;
}

@keyframes mug-preview-build {
  0% {
    filter: drop-shadow(0 0 0 rgba(255, 162, 92, 0));
  }
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 162, 92, 0.38));
  }
}

.mug-stage.is-revealing .mug-stage-canvas-wrap {
  animation: mug-preview-reveal-glow 1.05s ease forwards;
}

@keyframes mug-preview-reveal-glow {
  0% {
    filter: drop-shadow(0 0 30px rgba(255, 162, 92, 0.95));
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(255, 162, 92, 0));
  }
}

.mug-stage-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  background: transparent;
}

.mug-zoom {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 3;
}

.mug-zoom-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-size: 1.35rem;
  line-height: 1;
}

.mug-zoom-btn:hover:not(:disabled) {
  background: #111;
  color: #fff;
}

.mug-zoom-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.mug-dash-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.mug-dash-toggle input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: #111;
}

.mug-stage-status {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
}

.mug-stage-status:empty {
  display: none;
}

.mug-stage-status.is-error {
  color: #9b2c2c;
}

.mug-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.mug-swatches {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  max-height: calc(100% - 1.5rem);
  margin: 0;
  padding: 0;
  overflow: auto;
}

.mug-swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.16rem 0.55rem 0.16rem 0.16rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 17, 17, 0.1);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 14px rgba(17, 17, 17, 0.08);
  color: #111;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.mug-swatch__dot {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  flex: 0 0 auto;
}

.mug-swatch.is-selected {
  border-color: #111;
  box-shadow:
    0 0 0 2px rgba(17, 17, 17, 0.14),
    0 6px 14px rgba(17, 17, 17, 0.1);
}

body:has(.image-preview--mug:not(.mug-flat-fallback)) .customise-field:has(#mugColourSelect) {
  display: none !important;
}

.mug-view-btn {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: #fff;
  padding: 0.35rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.mug-view-btn.is-selected {
  background: #111;
  color: #fff;
}

.mug-stage-note {
  max-width: 36rem;
  margin: 0.25rem auto 0;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  .mug-stage-canvas-wrap canvas {
    cursor: default;
  }
}
