/* 도장 만들기 */
.stp { overflow-x: clip; }
.stp [hidden] { display: none !important; }
.stp-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 18px; align-items: start; }
.stp-preview { position: sticky; top: 86px; display: grid; gap: 14px; }
.stp-stage { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--r-md); border: 1px solid var(--line); overflow: hidden; }
.stp-stage canvas { width: 100%; height: 100%; display: block; }
.stp-stage.bg-check { background: repeating-conic-gradient(#eef1f2 0% 25%, #ffffff 0% 50%) 50% / 22px 22px; }
.stp-stage.bg-paper { background: linear-gradient(transparent 31px, #e4e9ee 32px) 0 0 / 100% 32px, #fffdf8; }
.stp-stage.bg-dark { background: #1d2528; }
:root[data-theme="dark"] .stp-stage.bg-check { background: repeating-conic-gradient(#2a3437 0% 25%, #222b2e 0% 50%) 50% / 22px 22px; }
.stp-stage-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.stp-download { display: grid; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.stp-export { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 12px; }
.stp-select { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.stp-select select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-size: 16px; }
.stp-buttons { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.stp-buttons .btn { min-height: 50px; font-size: 16px; }

.stp-controls { display: grid; gap: 14px; }
.stp-controls .tool-panel { padding: clamp(16px, 2.6vw, 24px); }
.stp-name { font-size: 22px !important; font-weight: 800; letter-spacing: .02em; text-align: center; min-height: 56px !important; }
.stp-controls .field:last-child { margin-bottom: 0; }

.stp-shapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.stp-shape { position: relative; cursor: pointer; }
.stp-shape input { position: absolute; opacity: 0; pointer-events: none; }
.stp-shape-card { display: grid; justify-items: center; gap: 2px; padding: 10px 6px 10px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: center; transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.stp-shape-card canvas { width: 100%; max-width: 96px; aspect-ratio: 1; height: auto; }
.stp-shape-card b { font-size: 13.5px; letter-spacing: -.02em; line-height: 1.3; }
.stp-shape-card small { color: var(--subtle); font-size: 11.5px; line-height: 1.35; }
@media (hover: hover) { .stp-shape:hover .stp-shape-card { border-color: var(--line-strong); transform: translateY(-1px); } }
.stp-shape input:checked + .stp-shape-card { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.stp-shape input:focus-visible + .stp-shape-card { outline: 2px solid var(--primary); outline-offset: 2px; }

.stp-chips, .stp-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.stp-chip, .stp-color { position: relative; }
.stp-chip input, .stp-color > input, .stp-shape input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.stp-chip span { display: inline-flex; align-items: center; justify-content: center; min-width: 84px; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 16px; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.stp-chip input:checked + span { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); color: var(--link); }
.stp-color span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; background: var(--surface); }
.stp-color i { width: 28px; height: 28px; border-radius: 50%; }
.stp-color > input:checked + span { border-color: var(--text); }
.stp-color-custom span { overflow: hidden; background: conic-gradient(#e33, #fc3, #3c6, #39f, #93f, #e33); }
.stp-color-custom input[type=color] { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; opacity: .01; }
.stp-chip input:focus-visible + span, .stp-color > input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.stp-ranges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-top: 4px; }
.stp-range { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
.stp-range span { display: flex; justify-content: space-between; }
.stp-range output { color: var(--link); font-variant-numeric: tabular-nums; }
.stp-range input { width: 100%; accent-color: var(--primary); touch-action: pan-y; }
.stp-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.stp-warn { margin: 16px 2px 0; line-height: 1.7; }

@media (max-width: 900px) {
  .stp-layout { grid-template-columns: 1fr; }
  .stp-preview { position: static; }
  .stp-stage { max-width: 420px; width: 100%; margin: 0 auto; }
}
@media (max-width: 520px) {
  .stp-shapes { gap: 8px; }
  .stp-shape-card { padding: 8px 4px; }
  .stp-shape-card small { display: none; }
  .stp-ranges { grid-template-columns: 1fr; }
  .stp-buttons { grid-template-columns: 1fr; }
  .stp-stage-bar { justify-content: center; }
}
/* 휴대폰: 이름 입력 → 미리보기 → 나머지 설정 순서 */
@media (max-width: 900px) {
  .stp-controls { display: contents; }
  .stp-controls > :first-child { order: 1; }
  .stp-preview { order: 2; }
  .stp-controls > :nth-child(n+2) { order: 3; }
}
