.design-preview-page {
  overflow: clip;
  background: var(--surface);
}

.design-preview-tool__heading {
  max-width: 1100px;
  margin: 0 0 34px;
}

.design-preview-tool__heading h1 {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(30px, 3.8vw, 48px);
  line-height: 1.2;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.design-preview-tool__heading > p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
}

.design-workspace {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(420px, 1.08fr);
  align-items: start;
  gap: 28px;
}

.design-editor,
.design-preview-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 18px 52px rgba(6, 42, 59, 0.08);
}

.design-editor {
  overflow: hidden;
}

.design-step {
  padding: 30px;
  scroll-margin-top: 104px;
}

.design-step + .design-step {
  border-top: 1px solid var(--line);
}

.design-step__heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 22px;
}

.design-step__heading > span {
  display: block;
  width: auto;
  height: auto;
  flex: 0 0 auto;
  padding-top: 3px;
  color: var(--aqua-700);
  background: transparent;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.design-step__heading h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 20px;
  line-height: 1.35;
}

.design-step__heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.design-preview-panel {
  position: sticky;
  top: 102px;
  padding: 30px;
}

.design-preview-panel__heading {
  margin-bottom: 18px;
}

.design-preview-page fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group {
  margin-top: 25px;
}

.field-group legend,
.field-label {
  display: block;
  margin: 0 0 10px;
  color: var(--navy-950);
  font-size: 15px;
  font-weight: 800;
}

.field-label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.bottle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.bottle-card,
.template-card,
.scene-card {
  color: var(--navy-950);
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.bottle-card {
  min-height: 134px;
  padding: 8px 7px 10px;
  border-radius: 12px;
  text-align: center;
}

.bottle-card__image {
  width: 100%;
  height: auto;
  max-width: 92px;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 0 auto 5px;
  object-fit: contain;
  border-radius: 8px;
  background: #f2f5f5;
}

.bottle-card strong,
.bottle-card small,
.template-card strong,
.template-card small,
.scene-card strong,
.scene-card small {
  display: block;
}

.bottle-card strong {
  font-size: 14px;
}

.bottle-card small,
.template-card small,
.scene-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.bottle-card:hover,
.template-card:hover,
.scene-card:hover {
  border-color: rgba(25, 164, 181, 0.62);
  transform: translateY(-1px);
}

.bottle-card.is-active,
.template-card.is-active,
.scene-card.is-active {
  border-color: var(--aqua-500);
  background: var(--aqua-50);
  box-shadow: 0 0 0 3px rgba(25, 164, 181, 0.11);
}

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

.template-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 84px;
  padding: 11px;
  border-radius: 13px;
  text-align: left;
}

.template-card strong {
  font-size: 14px;
}

.template-swatch {
  display: grid;
  width: 46px;
  height: 56px;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
}

.template-swatch i {
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 700;
}

.template-card .check {
  position: absolute;
  top: 7px;
  right: 7px;
  display: none;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--aqua-500);
  font-size: 10px;
  font-style: normal;
}

.template-card.is-active .check {
  display: grid;
}

.upload-box {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border: 1px dashed #aebfc8;
  border-radius: 13px;
  background: #f8fbfb;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.upload-box:hover,
.upload-box:focus-within {
  border-color: var(--aqua-500);
  background: var(--aqua-50);
}

.upload-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--aqua-600);
  border-radius: 11px;
  background: var(--aqua-100);
  font-size: 24px;
}

.upload-box > span:nth-child(2) {
  min-width: 0;
}

.upload-box strong,
.upload-box small {
  display: block;
}

.upload-box strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-box small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.remove-logo {
  min-height: 40px;
  margin-left: auto;
  padding: 0 12px;
  color: #a63131;
  border: 0;
  border-radius: 8px;
  background: #fbebeb;
  cursor: pointer;
}

.local-file-note {
  margin: 9px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.local-file-note strong {
  color: var(--navy-800);
}

.simple-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.simple-fields label {
  position: relative;
  display: block;
  margin: 0;
  color: var(--navy-950);
  font-size: 14px;
  font-weight: 800;
}

.simple-fields label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.simple-fields input {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  padding: 0 54px 0 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
}

.simple-fields input:focus {
  border-color: var(--aqua-500);
  box-shadow: 0 0 0 3px rgba(25, 164, 181, 0.12);
}

.simple-fields label > small {
  position: absolute;
  right: 12px;
  bottom: 14px;
  color: #82939d;
  font-size: 12px;
  font-weight: 400;
}

.field-help {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

.scene-card {
  position: relative;
  overflow: hidden;
  padding: 0 0 9px;
  border-radius: 13px;
  text-align: left;
}

.scene-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #e9eef0;
}

.scene-card > span {
  display: block;
  padding: 10px 11px 2px;
}

.scene-card strong {
  font-size: 14px;
}

.scene-card > i {
  position: absolute;
  top: 7px;
  right: 7px;
  display: none;
  width: 19px;
  height: 19px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--aqua-500);
  font-size: 10px;
  font-style: normal;
}

.scene-card.is-active > i {
  display: grid;
}

.selection-summary {
  display: block;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
}

.selection-summary strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-stage {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  border-radius: 18px;
  background: #e9eef0;
}

.preview-stage.is-scene {
  aspect-ratio: 1 / 1;
}

#previewCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  box-shadow: 0 12px 32px rgba(12, 39, 61, 0.14);
  cursor: zoom-in;
}

#previewCanvas:focus-visible {
  outline: 3px solid rgba(25, 164, 181, 0.9);
  outline-offset: -5px;
}

.stage-loading {
  position: absolute;
  z-index: 2;
  color: var(--muted);
  font-size: 14px;
}

.zoom-trigger {
  position: absolute;
  z-index: 4;
  top: 14px;
  right: 14px;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 999px;
  background: rgba(6, 31, 49, 0.8);
  box-shadow: 0 7px 22px rgba(3, 24, 38, 0.22);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.zoom-trigger:hover,
.zoom-trigger:focus-visible {
  background: rgba(6, 31, 49, 0.94);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.download-area {
  display: grid;
  gap: 14px;
  margin-top: 17px;
}

.download-area > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.download-area .button {
  width: 100%;
  min-height: 50px;
}

.download-area .button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.design-preview-contact {
  margin-top: 0;
}

.design-preview-toast {
  z-index: 1100;
}

.zoom-dialog {
  width: min(1180px, calc(100vw - 30px));
  height: min(900px, calc(100vh - 30px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  color: #fff;
  border: 0;
  border-radius: 22px;
  background: #071a28;
  box-shadow: 0 32px 110px rgba(0, 0, 0, 0.48);
}

.zoom-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.zoom-dialog::backdrop {
  background: rgba(2, 14, 23, 0.83);
  backdrop-filter: blur(9px);
}

.zoom-header {
  position: relative;
  display: flex;
  min-height: 80px;
  align-items: center;
  gap: 22px;
  padding: 13px 66px 13px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #0a2233;
}

.zoom-header .eyebrow {
  margin-bottom: 4px;
  color: #72d9cf;
  font-size: 9px;
}

.zoom-header h2 {
  margin: 0;
  color: #fff;
  font-size: 17px;
}

.zoom-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.zoom-toolbar button,
.zoom-toolbar span {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
}

.zoom-toolbar button {
  padding: 0 12px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.zoom-toolbar button:hover,
.zoom-toolbar button:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: 2px solid rgba(114, 217, 207, 0.8);
  outline-offset: 1px;
}

.zoom-toolbar button:disabled {
  opacity: 0.38;
  cursor: default;
}

.zoom-toolbar #zoomIn,
.zoom-toolbar #zoomOut {
  width: 42px;
  padding: 0;
  font-size: 20px;
}

.zoom-toolbar span {
  min-width: 58px;
  padding: 0 8px;
  color: #a9c5d4;
  background: rgba(0, 0, 0, 0.18);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
}

.zoom-close {
  position: absolute;
  z-index: 6;
  top: 18px;
  right: 16px;
  width: 44px;
  height: 44px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 25px;
  cursor: pointer;
}

.zoom-viewport {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: radial-gradient(circle at center, #193645 0, #071720 68%);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.zoom-viewport.is-dragging {
  cursor: grabbing;
}

#zoomCanvas {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  box-shadow: 0 18px 65px rgba(0, 0, 0, 0.34);
  transform-origin: center;
  will-change: transform;
}

.zoom-help {
  position: absolute;
  z-index: 4;
  bottom: 12px;
  left: 50%;
  margin: 0;
  padding: 7px 11px;
  color: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  font-size: 10px;
  pointer-events: none;
  transform: translateX(-50%);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .design-workspace {
    grid-template-columns: minmax(0, 0.94fr) minmax(390px, 1.06fr);
  }
}

@media (max-width: 960px) {
  .design-workspace {
    grid-template-columns: 1fr;
  }

  .design-preview-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .design-preview-tool__heading {
    margin-bottom: 24px;
  }

  .design-preview-tool__heading h1 {
    font-size: 30px;
  }

  .design-editor,
  .design-preview-panel {
    border-radius: 20px;
  }

  .design-step,
  .design-preview-panel {
    padding: 22px 18px;
  }

  .design-step__heading {
    margin-bottom: 18px;
  }

  .design-step__heading h2 {
    font-size: 17px;
  }

  .bottle-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }

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

  .bottle-card {
    min-height: 0;
    padding: 6px 4px 8px;
  }

  .bottle-card__image {
    max-width: none;
    margin-bottom: 3px;
  }

  .bottle-card strong {
    font-size: 12px;
    line-height: 1.35;
  }

  .bottle-card small {
    margin-top: 2px;
    font-size: 10px;
  }

  .scene-card span {
    padding: 8px 8px 1px;
  }

  .scene-card strong {
    font-size: 12px;
  }

  .scene-card small {
    font-size: 10px;
  }

  .upload-box {
    align-items: flex-start;
  }

  .remove-logo {
    min-height: 38px;
    padding: 0 9px;
  }

  .selection-summary strong {
    white-space: normal;
  }

  .zoom-trigger {
    top: 9px;
    right: 9px;
    min-height: 40px;
    padding: 0 11px;
    font-size: 11px;
  }

  .zoom-dialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .zoom-header {
    min-height: 124px;
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
    padding: 12px 54px 10px 14px;
  }

  .zoom-header h2 {
    font-size: 15px;
  }

  .zoom-toolbar {
    width: 100%;
    margin: 0;
    padding-bottom: 2px;
    gap: 5px;
    overflow-x: auto;
  }

  .zoom-toolbar button {
    min-height: 40px;
    flex: 0 0 auto;
    padding: 0 9px;
    font-size: 10px;
  }

  .zoom-toolbar #zoomIn,
  .zoom-toolbar #zoomOut {
    width: 40px;
  }

  .zoom-close {
    top: 10px;
    right: 9px;
    width: 40px;
    height: 40px;
  }

  .zoom-help {
    bottom: max(10px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (prefers-reduced-motion: reduce) {
  .design-preview-page *,
  .design-preview-page *::before,
  .design-preview-page *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
