:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #4b5563;
  --line: #cfd8dc;
  --brand: #00a9a7;
  --brand-dark: #008b89;
  --brand-soft: #e7fbfa;
  --brand-wash: #f7fffe;
  --surface: #ffffff;
  --background: #ffffff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}

.builder {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 169, 167, 0.06);
  border-radius: 8px;
  padding: 24px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--brand);
}

h1 {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.intro,
.status {
  color: var(--muted);
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.form-section {
  display: grid;
  gap: 14px;
}

.ai-form-section {
  gap: 12px;
}

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

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

.outline-field,
.product-type-fieldset,
#custom-shape-field,
#custom-shape-note {
  grid-column: 1 / -1;
}

label,
legend {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.field-note {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.builder-mode-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.builder-mode-fieldset legend {
  width: 100%;
}

.mode-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  background: #fff;
}

.mode-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 2px rgba(0, 169, 167, 0.14);
}

.mode-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

textarea,
select,
input[type="text"],
input[type="range"] {
  width: 100%;
}

textarea,
select,
input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.native-font-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.font-picker {
  position: relative;
}

.font-picker-button {
  width: 100%;
  min-height: 44px;
  padding: 10px 38px 10px 12px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.font-picker-button::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
}

.font-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  max-height: 300px;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(17, 17, 17, 0.16);
}

.font-picker-option {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 19px;
  font-weight: inherit;
}

.font-picker-option:hover,
.font-picker-option.is-selected {
  color: var(--ink);
  background: var(--brand-soft);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.manual-canvas-area {
  margin-top: 18px;
}

.manual-toolbar,
.manual-selection-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.manual-selection-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-wash);
}

.manual-selection-panel.has-warning {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.manual-warning {
  margin: 10px 0 10px;
  padding: 12px 14px;
  color: #7f1d1d;
  background: #fef2f2;
  border: 1px solid #f87171;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.resize-control {
  display: grid;
  grid-template-columns: 36px minmax(120px, 1fr) 36px;
  gap: 8px;
  align-items: center;
}

.resize-step-button {
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 20px;
  line-height: 1;
}

.resize-step-button:hover,
.resize-step-button:focus {
  color: var(--ink);
  background: var(--brand-soft);
  border-color: var(--brand);
  outline: none;
}

.manual-selection-panel label {
  min-width: 150px;
  flex: 1 1 180px;
}

.manual-canvas-option {
  width: min(100%, 520px);
  max-width: 100%;
  margin-bottom: 14px;
  cursor: default;
}

.manual-canvas-option::before,
.design-option::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='110' viewBox='0 0 220 110'%3E%3Cg transform='translate(110 55) rotate(-24)'%3E%3Ctext x='0' y='0' text-anchor='middle' dominant-baseline='middle' fill='%2300a9a7' fill-opacity='0.14' font-family='Arial, sans-serif' font-size='15' font-weight='800' letter-spacing='2'%3ECOOKIE CUTTER%3C/text%3E%3Ctext x='0' y='20' text-anchor='middle' dominant-baseline='middle' fill='%2300a9a7' fill-opacity='0.14' font-family='Arial, sans-serif' font-size='15' font-weight='800' letter-spacing='2'%3ECENTRAL%3C/text%3E%3C/g%3E%3C/svg%3E");
  background-position: center;
  background-repeat: repeat;
  background-size: 220px 110px;
  user-select: none;
}

.manual-canvas-option.is-empty::after {
  content: "Add text or icon";
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.manual-preview-shell {
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.manual-preview {
  width: 100%;
  height: 100%;
}

.manual-preview svg {
  display: block;
  width: 100%;
  height: 100%;
  padding: 4%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.manual-canvas-option > .manual-preview {
  transform: scale(var(--art-scale, 1));
  transform-origin: center;
}

.manual-draggable-layer {
  cursor: grab;
}

.manual-draggable-layer text,
.manual-draggable-layer path,
.manual-draggable-layer circle {
  pointer-events: visiblePainted;
}

.manual-draggable-layer.is-selected > .manual-selection-box {
  display: block;
}

.manual-selection-box {
  display: none;
  pointer-events: none;
  fill: none;
  stroke: var(--brand);
  stroke-width: 8;
  stroke-dasharray: 22 16;
}

.manual-draft-text {
  fill: var(--muted);
  stroke: none;
  opacity: 0.7;
}

.manual-preview.is-dragging .manual-draggable-layer {
  cursor: grabbing;
}

fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

fieldset label {
  grid-template-columns: auto 1fr;
  align-items: center;
  font-weight: 600;
}

.product-type-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.product-type-fieldset legend {
  width: 100%;
}

.product-type-fieldset .mode-card {
  min-height: 36px;
  padding: 7px 12px;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 800;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
}

button:hover {
  background: #000;
}

.font-picker-button:hover,
.font-picker-button:focus,
.font-picker-button[aria-expanded="true"] {
  color: var(--ink);
  background: #fff;
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.secondary-button {
  width: fit-content;
  padding: 9px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.secondary-button:hover {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

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

.design-option {
  position: relative;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 10px;
  aspect-ratio: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Keep tiles white — override the global button:hover { background:#000 }. */
.design-option:hover,
.design-option:focus,
.manual-canvas-option:hover,
.manual-canvas-option:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 169, 167, 0.16);
  outline: none;
}

.design-option[aria-pressed="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 169, 167, 0.22);
}

.design-option img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.design-option > img:not(.design-generated-outline) {
  transform: scale(var(--art-scale, 1));
  transform-origin: center;
}

.shape-outline {
  pointer-events: none;
  position: absolute;
  left: var(--outline-left, 9%);
  top: var(--outline-top, 9%);
  width: var(--outline-width, 82%);
  height: var(--outline-height, 82%);
  border: 4px solid rgba(0, 169, 167, 0.9);
  border-radius: 8px;
}

.design-option[data-shape="circle"] .shape-outline,
.design-option[data-shape="oval"] .shape-outline {
  border-radius: 999px;
}

.design-option[data-shape="square"] .shape-outline {
  border-radius: 8px;
}

.design-option[data-shape="rectangle"] .shape-outline,
.design-option[data-shape="wide-rectangle"] .shape-outline,
.design-option[data-shape="tall-rectangle"] .shape-outline {
  border-radius: 8px;
}

.design-option[data-shape="heart"] .shape-outline {
  border: 0;
  border-radius: 0;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 92'%3E%3Cpath d='M50 84 C18 57 7 42 7 25 C7 13 16 5 28 5 C38 5 45 11 50 19 C55 11 62 5 72 5 C84 5 93 13 93 25 C93 42 82 57 50 84 Z' fill='none' stroke='%2300a9a7' stroke-width='4' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.design-option[data-shape="other"] .shape-outline {
  display: none;
}

.design-option .design-generated-outline {
  pointer-events: none;
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4%;
}

.design-option[data-shape="shape-to-my-design"] .shape-outline {
  display: none;
}

.design-option[data-shape="shape-to-my-design"] .design-generated-outline {
  display: block;
}

@media (max-width: 760px) {
  h1 {
    font-size: 28px;
  }

  .mode-card {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* ============================================================
   Wizard layout — single centred column, CCC teal identity
   ============================================================ */

.builder {
  display: block;
  max-width: 940px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* Design Stamp editor: controls beside the canvas on desktop instead of stacked. */
@media (min-width: 721px) {
  .manual-canvas-area {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(0, 430px);
    grid-template-areas:
      "tools  canvas"
      "panel  canvas"
      "hint   canvas"
      "note   canvas";
    gap: 16px 22px;
    align-items: start;
  }
  .manual-canvas-area .manual-toolbar { grid-area: tools; margin: 0; }
  .manual-canvas-area #manual-selection-panel { grid-area: panel; }
  .manual-canvas-area .manual-hint { grid-area: hint; }
  .manual-canvas-area #manual-canvas-option { grid-area: canvas; margin: 0; align-self: start; }
  .manual-canvas-area #manual-canvas-note { grid-area: note; margin: 0; align-self: end; }
}

/* Empty-state guidance in the controls column. */
.manual-hint {
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--brand-wash);
  padding: 16px 18px;
}

.manual-hint-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.manual-hint-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 11px;
}

.manual-hint-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.manual-hint-steps li span {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Once the customer is actively editing an item, the how-to hint is redundant. */
#manual-selection-panel:not([hidden]) ~ .manual-hint {
  display: none;
}

/* Softer, larger-tiled watermark on the big stamp canvas. */
.manual-canvas-option::before {
  background-size: 300px 150px;
  opacity: 0.72;
}

.builder-head {
  text-align: center;
  margin-bottom: 24px;
}

.builder-head .intro {
  max-width: 460px;
  margin: 8px auto 0;
}

/* Legacy controls are driven programmatically by the wizard. */
#generate-button,
#add-to-cart-button {
  display: none !important;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
}

.stepper-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stepper-item::after {
  content: "";
  width: 26px;
  height: 2px;
  margin-left: 6px;
  background: var(--line);
  border-radius: 2px;
}

.stepper-item:last-child::after {
  display: none;
}

.stepper-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.stepper-item.is-current .stepper-dot {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.stepper-item.is-current {
  color: var(--brand-dark);
}

.stepper-item.is-done .stepper-dot {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.stepper-item.is-done .stepper-dot {
  font-size: 0;
}

.stepper-item.is-done .stepper-dot::before {
  content: "\2713";
  font-size: 14px;
}

.stepper-item.is-skipped {
  opacity: 0.4;
}

/* Step cards */
.wizard-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 169, 167, 0.07);
  padding: 26px;
  animation: stepIn 0.22s ease;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-heading {
  margin: 0 0 18px;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

/* Choose step */
.choose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.choose-layout .grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.choose-preview-label,
.choose-preview-frame {
  margin: 0;
}

.choose-preview-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.choose-preview-frame {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--brand-wash);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Brand-logo watermark, centred over the large preview and summary thumbnail. */
.choose-preview-frame,
.summary-thumb {
  position: relative;
}

.choose-preview-frame::after,
.summary-thumb::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  background-image: url("/logo.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 62%;
  opacity: 0.1;
}

.choose-preview-frame img,
.summary-thumb img {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.choose-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

.choose-preview-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 0 18px;
}

/* Configure step */
.configure-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.summary-card {
  background: var(--brand-wash);
  border: 1px solid var(--brand-soft);
  border-radius: 12px;
  padding: 18px;
}

.summary-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.summary-list {
  margin: 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(0, 139, 137, 0.18);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.summary-row dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.summary-thumb {
  margin-top: 14px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--brand-soft);
  transition: opacity 0.15s ease;
}

.summary-thumb.is-loading {
  opacity: 0.5;
}

.summary-thumb-label {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.summary-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 8px;
}

/* Done step */
.done-panel {
  text-align: center;
  padding: 16px 8px;
}

.done-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 28px;
  line-height: 56px;
}

/* Navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  margin-left: auto;
  border: none;
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.primary-button:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.status {
  text-align: center;
  margin: 14px 0 0;
  min-height: 18px;
  font-size: 13px;
}

/* Generating overlay — the AI halo */
.generating-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: rgba(247, 255, 254, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: overlayFade 0.25s ease;
}

@keyframes overlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.halo {
  position: relative;
  width: 132px;
  height: 132px;
  margin-bottom: 18px;
}

.halo-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(0, 169, 167, 0), var(--brand), rgba(0, 169, 167, 0));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  animation: haloSpin 1.5s linear infinite;
}

.halo-ring--2 {
  inset: 16px;
  opacity: 0.55;
  animation-direction: reverse;
  animation-duration: 2.4s;
}

.halo-core {
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #fff, var(--brand-soft));
  box-shadow: 0 0 22px rgba(0, 169, 167, 0.5);
  animation: haloPulse 1.4s ease-in-out infinite;
}

.halo-orbit {
  position: absolute;
  inset: 0;
  animation: haloSpin 3s linear infinite;
}

.halo-orbit span {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--brand);
}

.halo-orbit span:nth-child(2) {
  top: 50%;
  left: auto;
  right: -3px;
  margin-top: -4px;
  opacity: 0.7;
}

.halo-orbit span:nth-child(3) {
  top: auto;
  bottom: -3px;
  opacity: 0.45;
}

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

@keyframes haloPulse {
  0%, 100% { transform: scale(0.92); opacity: 0.85; }
  50% { transform: scale(1.05); opacity: 1; }
}

.generating-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-dark);
}

.generating-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.generating-tiles {
  display: grid;
  grid-template-columns: repeat(4, 46px);
  gap: 10px;
  margin-top: 22px;
}

.gen-tile {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  background: linear-gradient(100deg, var(--brand-soft) 30%, #fff 50%, var(--brand-soft) 70%);
  background-size: 220% 100%;
  animation: tileShimmer 1.2s ease-in-out infinite;
}

.gen-tile:nth-child(2) { animation-delay: 0.15s; }
.gen-tile:nth-child(3) { animation-delay: 0.3s; }
.gen-tile:nth-child(4) { animation-delay: 0.45s; }

@keyframes tileShimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .halo-ring,
  .halo-ring--2,
  .halo-core,
  .halo-orbit,
  .gen-tile {
    animation-duration: 0.001s;
    animation-iteration-count: 1;
  }
}

@media (max-width: 720px) {
  .choose-layout,
  .configure-layout {
    grid-template-columns: 1fr;
  }

  .stepper-label {
    display: none;
  }

  .builder {
    padding: 20px 12px 40px;
  }

  .wizard-step {
    padding: 18px 14px;
    border-radius: 12px;
  }

  /* Stack the design-method pills full width for easy tapping. */
  .builder-mode-fieldset .mode-card,
  .product-type-fieldset .mode-card {
    flex: 1 1 100%;
  }

  /* Keep the design grid two-up but comfortable. */
  .choose-layout .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Bigger tap targets and a thumb-friendly sticky-feeling nav. */
  .primary-button,
  .secondary-button {
    min-height: 48px;
  }
  .wizard-nav {
    gap: 10px;
  }

  /* Manual editor controls stack cleanly on small screens. */
  .manual-selection-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 24px;
  }
  .stepper {
    gap: 2px;
  }
  .stepper-item::after {
    width: 14px;
    margin-left: 3px;
  }
}
