body.builder { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(380px, 560px) 1fr; }
.editor-col { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--paper); }
.editor { flex: 1; overflow-y: auto; padding: 20px clamp(14px, 3vw, 26px) 30px; display: flex; flex-direction: column; gap: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.card h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.card p { margin: -6px 0 0; font-size: 14px; }
.step { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font: 600 12px/24px var(--sans); text-align: center; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field-label { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.help { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.row { display: flex; gap: 12px; }
.editor input[type="text"], .editor input[type="number"], .editor textarea, .editor select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; transition: border-color .15s, background .15s;
}
.editor textarea { resize: vertical; line-height: 1.5; min-height: 110px; }
.editor input:focus, .editor textarea:focus, .editor select:focus { border-color: var(--brand); background: #fff; }

.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.toggle input:checked + .switch { background: var(--brand); }
.toggle input:checked + .switch::after { transform: translateX(16px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--brand); outline-offset: 2px; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 8px; }
.tpl { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 14px; border: 1px solid var(--line); background: #fff; text-align: left; font-size: 13.5px; }
.tpl-swatch { flex: none; width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--b) 50%, var(--a) 50%); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.tpl.is-on { border-color: var(--brand); background: var(--brand-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.chip.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: -6px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; background: conic-gradient(var(--a) 0 50%, var(--c) 0 75%, var(--b) 0); box-shadow: 0 0 0 1px var(--line); }
.swatch.is-on { box-shadow: 0 0 0 2px var(--ink); }

.blk-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--paper); transition: border-color .2s, box-shadow .2s; }
.blk-card.is-focus { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }
.blk-head { display: flex; align-items: center; justify-content: space-between; }
.blk-type { font-weight: 500; font-size: 14px; }
.blk-tools { display: flex; gap: 4px; }
.icon { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 15px; line-height: 1; color: var(--muted); }
.icon:disabled { opacity: .35; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; }
.add { padding: 8px 13px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); background: transparent; color: var(--brand); font-size: 13.5px; font-weight: 500; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.thumb { display: flex; flex-direction: column; gap: 6px; }
.thumb-img { position: relative; aspect-ratio: 1; border-radius: 10px; background: #eee center / cover; }
.thumb input[type="text"] { padding: 7px 9px !important; font-size: 13px !important; border-radius: 9px !important; }
.thumb .x { position: absolute; top: 4px; right: 4px; }
.x { width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 15px; line-height: 1; flex: none; }
.thumb-add { aspect-ratio: 1; border-radius: 10px; border: 1.5px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); align-items: center; justify-content: center; gap: 2px; color: var(--brand); cursor: pointer; }
.thumb-add span { font-size: 26px; line-height: 1; }
.thumb-add small { font-size: 11.5px; }
.upload { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); cursor: pointer; text-align: center; }
.upload span { color: var(--brand); font-weight: 500; }
.upload small { color: var(--muted); font-size: 12px; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.file-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; align-items: center; gap: 8px; }
.list-row .num { width: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.list-row .x { background: var(--line); color: var(--muted); }

.publish-bar { display: flex; align-items: center; gap: 12px; padding: 14px clamp(14px, 3vw, 26px); border-top: 1px solid var(--line); background: #fff; }
.meter-wrap { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 3px; transition: width .3s ease; }
.meter.is-full i { background: #b3261e; }
.meter-wrap small { color: var(--muted); font-size: 12px; }

.preview-col { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 18px; background: radial-gradient(circle at 50% 20%, #fff, #f3e9e5); }
.preview-head { width: min(390px, 100%); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.preview-head b { color: var(--ink); font-weight: 500; }
.phone { height: min(820px, calc(100dvh - 190px)); aspect-ratio: 9 / 19; max-width: 100%; padding: 10px; border-radius: 46px; background: #1d1719; box-shadow: 0 40px 70px -30px rgba(40, 10, 20, .55), inset 0 0 0 2px #3b3134; }
.phone-screen { width: 100%; height: 100%; border-radius: 37px; overflow: hidden; position: relative; }
#preview { width: 100%; height: 100%; }
.preview-note { margin: 0; max-width: 390px; text-align: center; font-size: 12px; color: var(--muted); }

.busy { position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(251, 246, 243, .8); backdrop-filter: blur(3px); font-size: 14px; }
.busy[hidden] { display: none; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Share + my gifts */
.share-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 12px; }
.share-icon svg, .note svg, .tag svg { width: 1em; height: 1em; }
.share-icon svg { width: 24px; height: 24px; }
.link-box { display: flex; gap: 8px; margin: 18px 0 12px; }
.link-box input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; background: #fff6e6; border: 1px solid #f3e0b8; padding: 11px 13px; border-radius: 12px; line-height: 1.45; }
.note svg { margin-top: 3px; flex: none; color: #a46a00; }
.share-actions { display: flex; gap: 10px; margin: 16px 0 6px; }
.share-actions .btn { flex: 1; }
.mine { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mine li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; }
.mine li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mine small { color: var(--muted); font-size: 12px; }
.mine-actions { display: flex; gap: 14px; flex: none; }
.tag { display: inline-flex; vertical-align: -2px; color: var(--muted); }

.mobile-only { display: none; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .editor-col { border-right: 0; }
  .mobile-only { display: inline-flex; }
  .preview-col { position: fixed; inset: 0; z-index: 60; display: none; padding: 14px 12px; }
  body.show-preview .preview-col { display: flex; }
  .phone { height: calc(100dvh - 120px); }
  .row { flex-direction: column; }
}
