/* REWORK — 직접 구성 */
.builder { padding: 8px 0 80px; }
.builder-grid { display: grid; gap: 24px; }
@media (min-width: 960px) {
  .builder-grid { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 48px; align-items: start; }
  .viewer-wrap { position: sticky; top: calc(var(--header-h) + 16px); }
}

/* 3D 보기 */
.viewer { position: relative; aspect-ratio: 1 / 1; background: var(--surface); border-radius: var(--radius); overflow: hidden; touch-action: none; cursor: grab; }
.viewer:active { cursor: grabbing; }
@media (min-width: 960px) { .viewer { aspect-ratio: 4 / 3.4; } }
.viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.viewer-hint { position: absolute; left: 16px; top: 14px; font-size: 12px; color: var(--muted); pointer-events: none; transition: opacity .4s; }
.viewer-empty, .viewer-error { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); font-size: 14px; pointer-events: none; }
.viewer-tools { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tool-btn { height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); font-size: 13px; }
.tool-btn:hover { border-color: var(--ink); }
.tool-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* 조작 패널 */
.panel { display: grid; gap: 4px; }
.panel-block { padding: 20px 0; border-top: 1px solid var(--line); }
.panel-block:first-child { border-top: 0; padding-top: 0; }
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.panel-title-row { display: flex; justify-content: space-between; align-items: baseline; }

.preset-list { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-list button { height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); font-size: 14px; }
.preset-list button:hover { border-color: var(--ink); }
.preset-list button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* 칸 격자 */
.cell-grid, .cap-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 360px; }
.cell-grid { grid-template-rows: repeat(3, auto); }
.cell { aspect-ratio: 1 / 1; border-radius: 0; border: 1px dashed var(--line); background: transparent; font-size: 18px; color: var(--muted); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.cell.is-addable { border-color: #bdb2a3; }
.cell.is-addable::before { content: '+'; font-weight: 300; }
.cell.is-addable:hover { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.cell.is-filled { border: 0; background: var(--cube, var(--c-black)); box-shadow: inset 0 0 0 3px var(--edge); }
.cell.is-filled:hover { opacity: .8; }
.cell.is-filled::before { content: ''; }
.cell:disabled { opacity: .45; cursor: not-allowed; }
.cap-row { margin-top: 8px; }
.cap-btn { height: 30px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); font-size: 12px; color: var(--muted); }
.cap-btn[aria-pressed="true"] { background: var(--edge); border-color: #b9a27f; color: var(--ink); font-weight: 600; }
.cap-btn:disabled { visibility: hidden; }

/* 색 정하는 방식 */
.mode-toggle { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ink); margin-bottom: 14px; }
.mode-toggle button { height: 36px; padding: 0 16px; font-size: 13px; }
.mode-toggle button[aria-checked="true"] { background: var(--ink); color: #fff; }
.mix-hint { color: var(--ink-2); margin-top: 12px; background: #eef0ff; padding: 10px 12px; }
.mix-reset { margin-top: 8px; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.mix-reset:hover { color: var(--ink); }
.is-painting .viewer { cursor: crosshair; }
.is-painting .cell.is-filled { cursor: crosshair; }
.is-painting .cell.is-filled:hover { opacity: 1; box-shadow: inset 0 0 0 3px var(--edge), 0 0 0 2px var(--accent); }

/* 색상 */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); position: relative; }
.swatch-btn[aria-checked="true"]::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid var(--ink); }

/* 요약 */
.summary dl { display: grid; gap: 10px; margin-bottom: 10px; }
.summary dl div { display: flex; justify-content: space-between; gap: 16px; font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { font-weight: 600; text-align: right; }

.panel-actions { display: grid; gap: 10px; padding-top: 4px; }
.panel-actions .btn-primary { width: 100%; }
.panel-actions-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel-actions .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.copy-msg { min-height: 1.5em; color: var(--ink-2); }
