

.wallbuilder {
  padding: clamp(48px, 7vw, 108px) 0;
  background: var(--paper-warm);
  position: relative;
  overflow: hidden;
}

.wallbuilder .wb-head__note {
  margin: -12px 0 clamp(20px, 2.6vw, 32px);
  font-family: var(--f-italic);
  font-style: italic;
  font-size: 17px;
  line-height: 1.35;
  color: var(--ink-mute);
}

.wb-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 50px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.wb-stage {
  position: relative;
  aspect-ratio: 16/10;
  background: #ffffff;
  border: 1px solid var(--line);
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.wb-bg {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.92;
}

.wb-slot {
  position: absolute;
  border: 2px dashed rgba(197,48,111,0.45);
  background: rgba(197,48,111,0.06);
  z-index: 2;
  transition: background .2s, border-color .2s, transform .25s;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--f-italic);
  font-style: italic;
  font-size: 13px;
  color: var(--pink);
  text-align: center;
  padding: 4px;
}
.wb-slot.empty:hover {
  background: rgba(197,48,111,0.14);
  transform: scale(1.02);
}
.wb-slot.over {
  background: rgba(197,48,111,0.25);
  border-color: var(--pink);
}
.wb-slot.filled {
  border: none;
  background: transparent;
  cursor: pointer;
}
.wb-slot.filled .placed {
  position: absolute;
  inset: 0;
  background: #f3eee2;
  padding: 8px;
  box-shadow: 0 8px 18px -8px rgba(0,0,0,0.35);
  animation: drop-in .45s cubic-bezier(.3,1.4,.4,1);
}
@keyframes drop-in {
  0% { transform: scale(0.5) rotate(-6deg); opacity: 0; }
  60% { transform: scale(1.05) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.wb-slot.filled .placed::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 8px solid;
  border-image: linear-gradient(135deg, #c89a4f, #6b441a) 1;
  z-index: 2;
  pointer-events: none;
}
.wb-slot.filled .placed img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.wb-slot.filled:hover .placed { transform: scale(1.04) rotate(-1.5deg); transition: transform .25s; }
.wb-slot .remove-x {
  position: absolute;
  top: -10px; right: -10px;
  width: 24px; height: 24px;
  background: var(--ink);
  color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  z-index: 4;
  opacity: 0;
  transition: opacity .25s, transform .25s;
}
.wb-slot.filled:hover .remove-x { opacity: 1; transform: scale(1.1); }

.wb-controls {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  max-width: 100%;
}
.wb-controls h3 {
  font-family: var(--f-head);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.wb-controls .hint {
  font-family: var(--f-italic);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-mute);
  line-height: 1.5;
  overflow-wrap: break-word;
}
.wb-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.wb-thumb {
  aspect-ratio: 3/4;
  background: #f3eee2;
  padding: 6px;
  position: relative;
  cursor: grab;
  transition: transform .2s;
  user-select: none;
}
.wb-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 6px solid;
  border-image: linear-gradient(135deg, #c89a4f, #6b441a) 1;
  z-index: 2;
  pointer-events: none;
}
.wb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wb-thumb:hover { transform: translateY(-3px) rotate(-1deg); }
.wb-thumb.is-picked {
  box-shadow: 0 0 0 3px var(--pink);
  transform: translateY(-2px);
}
.wb-thumb.dragging { opacity: 0.5; }
.wb-thumb.used { opacity: 0.3; cursor: default; }
.wb-thumb.used:hover { transform: none; }

.wb-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.wallbuilder .wb-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: var(--pink);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background .18s, color .18s, border-color .18s, transform .12s;
}
.wallbuilder .wb-btn:not(.wb-btn--ghost),
.wallbuilder .wb-btn:not(.wb-btn--ghost) span { color: #fff; }
.wallbuilder .wb-btn:hover { background: var(--pink-soft); }
.wallbuilder .wb-btn:active { transform: scale(.98); }
.wallbuilder .wb-btn .arr { font-size: 17px; line-height: 1; }
.wallbuilder .wb-btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.wallbuilder .wb-btn--ghost:hover { background: transparent; border-color: var(--ink); }

.wb-tip {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border-left: 4px solid var(--yellow);
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.wb-tip b { color: var(--ink); }

.wb-stage--photo {
  aspect-ratio: 1086 / 815;
  background: #f7f3ec;
}
.wb-bg--photo {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.wb-bg--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.wb-stage--photo .wb-slot {
  border: 2px dashed rgba(197,48,111,0.55);
  background: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 1px rgba(197,48,111,0.15);
  z-index: 2;
}
.wb-stage--photo .wb-slot.empty:hover {
  background: rgba(197,48,111,0.18);
}
.wb-stage--photo .wb-slot.filled {
  border: none;
  background: transparent;
  box-shadow: none;

  z-index: 0;
}
.wb-stage--photo .wb-slot.filled .placed {
  position: absolute;
  inset: 0;
  padding: 0;
  background: transparent;
  box-shadow: 0 4px 10px -4px rgba(0,0,0,0.25);
  overflow: hidden;
}
.wb-stage--photo .wb-slot.filled .placed::before { display: none; }
.wb-stage--photo .wb-slot.filled:hover .placed { transform: none; }
.wb-stage--photo .wb-slot.filled .placed img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.wb-stage--photo .wb-slot.empty {
  font-size: 0;
  color: transparent;
}
.wb-stage--photo .wb-slot.empty::after {
  content: "+";
  display: grid;
  place-items: center;
  width: clamp(28px, 5vw, 40px);
  height: clamp(28px, 5vw, 40px);
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font-family: var(--f-head);
  font-style: normal;
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(197, 48, 111, 0.35);
}
.wallbuilder .wb-head__note--mobile,
.wallbuilder .hint--mobile {
  display: none;
}

@media (max-width: 1100px) {
  .wb-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .wb-thumbs { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 1080px) {
  .wallbuilder {
    overflow-x: clip;
  }
}

@media (max-width: 760px) {
  .wallbuilder {
    padding-top: clamp(40px, 8vw, 56px);
    padding-bottom: clamp(40px, 8vw, 56px);
  }

  .wallbuilder .block-header.wb-head {
    gap: 10px;
    margin-bottom: 0;
  }

  .wallbuilder .wb-head__note {
    margin-top: 0;
    margin-bottom: 22px;
    font-size: 15px;
  }
  .wallbuilder .wb-head__note--desktop { display: none; }
  .wallbuilder .wb-head__note--mobile { display: block; }

  .wb-grid { gap: 24px; }

  .wb-stage {
    border-radius: 4px;
    touch-action: manipulation;
  }

  .wb-slot {
    font-size: 10px;
    line-height: 1.15;
    padding: 2px;
  }

  .wb-controls { gap: 18px; min-width: 0; }
  .wb-controls h3 { font-size: 19px; }
  .wb-controls .hint {
    font-size: 15px;
    max-width: 100%;
    overflow-wrap: break-word;
  }
  .wb-controls .hint--desktop { display: none; }
  .wb-controls .hint--mobile { display: block; }

  .wb-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0 8px;
    margin: 0;
  }
  .wb-thumbs::-webkit-scrollbar { height: 4px; }
  .wb-thumbs::-webkit-scrollbar-thumb {
    background: color-mix(in oklab, var(--ink) 18%, transparent);
    border-radius: 999px;
  }
  .wb-thumb {
    flex: 0 0 clamp(68px, 18vw, 84px);
    width: clamp(68px, 18vw, 84px);
    scroll-snap-align: start;
    touch-action: manipulation;
  }
  .wb-thumb:hover { transform: none; }

  .wb-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    max-width: 100%;
  }
  .wallbuilder .wb-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: center;
    padding: 14px 18px;
  }
}

@media (max-width: 420px) {
  .wallbuilder .wb-head h2 { font-size: 24px; }
  .wb-thumb {
    flex-basis: 64px;
    width: 64px;
  }
}

@media (hover: none) {
  .wb-slot.filled .remove-x {
    opacity: 1;
    transform: none;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    font-size: 13px;
  }
  .wb-slot.empty:hover,
  .wb-stage--photo .wb-slot.empty:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wb-slot, .wb-thumb, .wb-slot.filled .placed { transition: none; animation: none; }
}
