.shape-layout {
  display: grid;
  grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1220px;
  margin: 0 auto;
  align-items: start;
}

.shape-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(160deg, rgba(216, 205, 249, 0.94), rgba(255, 253, 245, 0.9));
}

.hint {
  margin-bottom: 0;
  color: #405363;
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.55;
}

.shape-stage {
  padding: 16px;
  overflow: hidden;
  background: rgba(255, 253, 245, 0.78);
}

.puzzle-zone {
  position: relative;
  width: min(100%, 820px);
  height: 620px;
  margin: 0 auto;
  border-radius: 24px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.52)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(38, 50, 56, 0.05) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(38, 50, 56, 0.05) 31px 32px);
  touch-action: none;
}

.target-shape,
.shape-piece {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--w);
  height: var(--h);
  border-radius: 18px;
}

.target-shape {
  border: 4px dashed rgba(38, 50, 56, 0.24);
  background: rgba(255, 255, 255, 0.48);
}

.target-shape.triangle,
.target-shape.diamond,
.target-shape.star,
.target-shape.semicircle,
.target-shape.trapezoid {
  border: 0;
  background: rgba(38, 50, 56, 0.15);
}

.target-shape.triangle {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.shape-piece {
  z-index: 2;
  border: 4px solid rgba(255, 255, 255, 0.76);
  background: var(--piece-color);
  color: #263238;
  cursor: grab;
  font-size: 1.25rem;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(71, 85, 105, 0.16);
  user-select: none;
  touch-action: none;
}

.shape-piece.triangle {
  border: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.shape-piece.diamond,
.shape-piece.star,
.shape-piece.semicircle,
.shape-piece.trapezoid {
  border: 0;
}

.shape-piece.diamond,
.target-shape.diamond {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.shape-piece.star,
.target-shape.star {
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 56%, 80% 92%, 50% 70%, 20% 92%, 32% 56%, 2% 35%, 39% 35%);
}

.shape-piece.semicircle,
.target-shape.semicircle {
  border-radius: 999px 999px 0 0;
  clip-path: inset(0 0 0 0 round 999px 999px 0 0);
}

.shape-piece.trapezoid,
.target-shape.trapezoid {
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}

.shape-piece.circle,
.target-shape.circle,
.shape-piece.oval,
.target-shape.oval {
  border-radius: 999px;
}

.shape-piece.is-dragging {
  z-index: 5;
  cursor: grabbing;
  transform: scale(1.04);
}

.shape-piece.is-placed {
  cursor: default;
  box-shadow: 0 8px 18px rgba(71, 85, 105, 0.1);
}

@media (max-width: 820px) {
  .shape-layout {
    grid-template-columns: 1fr;
  }

  .puzzle-zone {
    height: 590px;
  }
}

@media (max-width: 520px) {
  .shape-stage {
    padding: 10px;
  }

  .puzzle-zone {
    height: 560px;
  }
}
