/* =========================================================
   오세요 — 초대장 만들기 화면
   PC: 왼쪽 편집 + 오른쪽 휴대폰 미리보기 / 휴대폰: 편집 + '미리보기' 전체 화면
   ========================================================= */
body.ed { background: var(--surface-2); }
@media (prefers-color-scheme: dark) { body.ed { background: #000; } }

.ed-top { position: sticky; top: 0; z-index: 60; background: var(--nav-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.ed-top .in-top { display: flex; align-items: center; gap: 10px; max-width: 1180px; height: 56px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.ed-status { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 13px; }
.ed-status.warn { color: #c46a1d; }
.ed-actions { display: flex; gap: 8px; flex: none; }
.only-mobile { display: none !important; }

.ed-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 36px; max-width: 1180px; margin: 0 auto; padding: 24px 20px 96px; align-items: start; }
.ed-form { min-width: 0; }
.ed-wrap.solo { grid-template-columns: minmax(0, 1fr); max-width: 980px; }
.ed-head { margin: 4px 0 18px; }
.ed-head h1 { margin: 0; font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.03em; line-height: 1.2; }
.ed-head p { margin: 6px 0 0; color: var(--text-2); font-size: 15.5px; }
.ed-group-title { margin: 26px 4px 10px; font-size: 13px; font-weight: 700; color: var(--text-3); letter-spacing: .02em; }

/* ---------- 미리보기 (휴대폰) ---------- */
.ed-preview { position: sticky; top: 80px; height: calc(100vh - 104px); height: calc(100dvh - 104px); min-height: 560px; display: flex; flex-direction: column; align-items: center; }
.phone { position: relative; width: 390px; max-width: 100%; height: min(820px, 100%); padding: 11px; border-radius: 54px; background: #1d1d1f; box-shadow: 0 0 0 2px #3a3a3c inset, 0 30px 70px rgba(0, 0, 0, .25); }
.phone::before { content: ''; position: absolute; top: 22px; left: 50%; z-index: 5; width: 96px; height: 28px; margin-left: -48px; border-radius: 20px; background: #000; pointer-events: none; }
.phone-screen { position: relative; width: 100%; height: 100%; border-radius: 44px; overflow-y: auto; overflow-x: hidden; background: #fff; overscroll-behavior: contain; scrollbar-width: none; }
.phone-screen::-webkit-scrollbar { display: none; }
.phone-screen .inv { min-height: 100%; }
.pv-note { margin: 12px 0 0; font-size: 12.5px; color: var(--text-3); text-align: center; }
.pv-close { display: none; }

/* ---------- 카드 ---------- */
.ed-card, .sc { margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.ed-card { padding: 18px 18px 20px; }
.ed-card > h3 { margin: 0; font-size: 16px; letter-spacing: -0.02em; }
.ed-card > h3 + .help { margin-top: 4px; }
.sc { transition: box-shadow .2s; }
.sc.open { box-shadow: var(--shadow-sm); }
.sc-h { display: flex; align-items: center; gap: 4px; padding: 6px 12px 6px 6px; }
.sc-t { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 10px; border: 0; border-radius: 14px; background: transparent; text-align: left; cursor: pointer; }
.sc-t:hover { background: var(--surface-2); }
.sc-t .ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); font-size: 18px; }
.sc-t .nm { display: flex; flex-direction: column; min-width: 0; overflow: hidden; font-size: 16px; font-weight: 650; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.sc-t .nm small { overflow: hidden; color: var(--text-3); font-size: 13px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.sc-t .chev { flex: none; width: 18px; height: 18px; margin-left: auto; color: var(--text-3); transition: transform .2s; }
.sc.open .sc-t .chev { transform: rotate(180deg); }
.sc.off .sc-t .nm, .sc.off .sc-t .ic { opacity: .45; }
.sc-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-size: 15px; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .25; cursor: default; background: transparent; }
.icon-btn.del:hover { color: var(--danger); }
.sc-b { display: none; padding: 2px 18px 20px; border-top: 1px solid var(--line); }
.sc.open .sc-b { display: block; }

/* 스위치 */
.sw { position: relative; display: inline-block; flex: none; width: 46px; height: 28px; margin-left: 6px; }
.sw input { position: absolute; width: 0; height: 0; opacity: 0; }
.sw span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background-color .2s; }
.sw span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.sw input:checked + span { background: #34c759; }
.sw input:checked + span::after { transform: translateX(18px); }
.sw input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- 입력 ---------- */
.f { display: block; margin-top: 16px; }
.f-l { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.f-l .cnt { color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.in { width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); font-size: 16px; line-height: 1.4; outline: none; -webkit-appearance: none; appearance: none; transition: border-color .15s, box-shadow .15s; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.in::placeholder { color: var(--text-3); }
textarea.in { min-height: 96px; line-height: 1.65; resize: vertical; }
select.in { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
input[type="date"].in, input[type="time"].in, input[type="datetime-local"].in { min-width: 0; }
.f-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.help { margin: 8px 0 0; color: var(--text-3); font-size: 13px; line-height: 1.5; }
.help.warn { color: #c46a1d; }
.list-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.list-row .in { flex: 1; min-width: 0; }
.add-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; margin-top: 10px; padding: 0 14px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: transparent; color: var(--accent); font-size: 14.5px; font-weight: 600; cursor: pointer; }
.add-btn:hover { background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13.5px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg button { padding: 8px 16px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-size: 14.5px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line-2); border-radius: 50%; cursor: pointer; }
.swatch.on::after { content: ''; position: absolute; inset: -5px; border: 2px solid var(--accent); border-radius: 50%; }
.swatch.custom { overflow: hidden; background: conic-gradient(#ff5f6d, #ffc371, #47e891, #4f7cff, #b06bff, #ff5f6d); }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.bgs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.bg-sw { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: var(--text-2); font-size: 12px; cursor: pointer; }
.bg-sw i { display: block; width: 100%; aspect-ratio: 1.3; border: 1px solid var(--line-2); border-radius: 12px; }
.bg-sw.on i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.bg-sw.on { color: var(--text); font-weight: 600; }

/* ---------- 사진 ---------- */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 150px; margin-top: 14px; border: 1.5px dashed var(--line-2); border-radius: 16px; background: var(--surface-2); color: var(--text-2); font-size: 15px; font-weight: 600; cursor: pointer; }
.drop span { font-size: 30px; }
.drop small { color: var(--text-3); font-weight: 400; font-size: 13px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.cover-thumb { position: relative; margin-top: 14px; border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.cover-thumb img { width: 100%; max-height: 340px; object-fit: cover; }
.cover-thumb .tb { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.pill-btn { padding: 8px 14px; border: 0; border-radius: 999px; background: rgba(29, 29, 31, .72); color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ord { position: absolute; top: 6px; left: 6px; padding: 1px 7px; border-radius: 7px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11.5px; font-weight: 600; }
.thumb.top4 .ord { background: var(--accent); }
.thumb .tb { position: absolute; left: 4px; right: 4px; bottom: 4px; display: flex; justify-content: space-between; }
.thumb .tb button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .58); color: #fff; font-size: 13px; cursor: pointer; }
.thumb .tb button:disabled { opacity: .3; }
.thumb.add { display: grid; place-items: center; border: 1.5px dashed var(--line-2); background: transparent; color: var(--accent); font-size: 28px; cursor: pointer; }
.busy { position: relative; pointer-events: none; opacity: .6; }

/* ---------- 묶음 (교통 항목 · 계좌 그룹) ---------- */
.sub { margin-top: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.sub-h { display: flex; align-items: center; gap: 6px; }
.sub-h .in { flex: 1; min-width: 0; font-weight: 650; }
.sub .f { margin-top: 10px; }
.person-ed { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.person-ed .full { grid-column: 1 / -1; }
.person-ed .in { min-height: 42px; padding: 9px 12px; font-size: 16px; }
.person-ed .p-h { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 14.5px; color: var(--text-2); }

/* ---------- 지도 (만들기 화면) ---------- */
.addr-row { display: flex; gap: 8px; }
.addr-row .in { flex: 1; min-width: 0; }
.addr-row .btn { flex: none; min-height: 46px; border-radius: 12px; padding: 0 16px; font-size: 15px; }
.ed-map { position: relative; margin-top: 12px; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); isolation: isolate; }
.ed-map .canvas { position: absolute; inset: 0; }
.ed-map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ed-map .msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; color: var(--text-3); font-size: 14px; text-align: center; }
.geo-state { margin: 8px 0 0; font-size: 13px; color: var(--text-3); }
.geo-state.ok { color: #1f9d55; }
.geo-state.warn { color: #c46a1d; }
.addr-box { height: min(470px, 64vh); margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }

/* ---------- 종류 고르기 ---------- */
.types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.type-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 20px 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.type-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.type-btn .em { margin-bottom: 8px; font-size: 32px; line-height: 1; }
.type-btn b { font-size: 17px; letter-spacing: -0.02em; }
.type-btn small { color: var(--text-2); font-size: 13.5px; }

/* ---------- 완료 · 진행 ---------- */
.progress { height: 6px; margin-top: 18px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .3s; }
.result-link { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14.5px; }
.result-link code { flex: 1; min-width: 0; overflow: hidden; font-family: inherit; text-overflow: ellipsis; white-space: nowrap; }
.result-link .btn { flex: none; min-height: 34px; padding: 0 14px; font-size: 13.5px; }
.result-sub { margin: 18px 0 0; font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.result-actions .btn { padding: 0 10px; font-size: 15.5px; }
.danger-zone { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 26px; }

@media (max-width: 960px) {
  .ed-wrap { grid-template-columns: minmax(0, 1fr); max-width: 680px; padding-top: 18px; }
  .only-mobile:not([hidden]) { display: inline-flex !important; }
  .ed-preview { display: none; }
  .ed-preview.show { position: fixed; inset: 0; z-index: 900; display: block; height: auto; min-height: 0; background: #000; }
  .ed-preview.show .phone { width: 100%; height: 100%; padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .ed-preview.show .phone::before, .ed-preview.show .pv-note { display: none; }
  .ed-preview.show .phone-screen { border-radius: 0; }
  .ed-preview.show .pv-close { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 950; display: inline-flex; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
  .types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .ed-wrap { padding-left: 12px; padding-right: 12px; }
  .sc-b { padding-left: 14px; padding-right: 14px; }
  .sc-h { padding-right: 8px; }
  .sc-t { gap: 10px; padding: 8px 6px; }
  .sc-t .chev { display: none; }
  .sc-t .ic { width: 34px; height: 34px; font-size: 17px; }
  .sc-t .nm { font-size: 15.5px; }
  .icon-btn { width: 30px; }
  .ed-status { display: none; }
  .ed-actions .btn { padding: 0 12px; }
  .bgs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
