/* DearMore editor — Operate surface.
   Same ivory/rosewood world as the invitation and the landing; here the brand lives in
   details (the logo, the serif in a few headings, the seal) and the controls stay familiar. */
:root {
  --bg: #FBF7F3;
  --surface: #FFFFFF;
  --surface-2: #F6EFE8;
  --surface-3: #EFE6DD;
  --ink: #3D3330;
  --ink-2: #6E615B;
  --ink-3: #7F716A;
  --ink-4: #B9ADA6;
  --line: #EADFD6;
  --line-strong: #DCCFC4;
  --accent: #8B5A5A;
  --accent-hover: #7A4C4C;
  --accent-ink: #FFFFFF;
  --accent-soft: #F3E6E3;
  --danger: #B4473D;
  --ok: #567352;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(61, 51, 48, .04), 0 6px 20px rgba(61, 51, 48, .05);
  --shadow-lift: 0 2px 4px rgba(43, 36, 34, .08), 0 18px 40px rgba(43, 36, 34, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --topbar-h: 60px;
  --tabs-h: 0px;
  --nav-h: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--accent-soft); color: var(--ink); }
input, textarea { caret-color: var(--accent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }
.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 14px; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { border-color: var(--ink-4); background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn-block { width: 100%; margin-top: 8px; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); padding: 0;
  background: var(--surface); color: var(--ink-2);
  cursor: pointer; display: inline-grid; place-items: center; flex: none;
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn svg, .modal-x svg, .thumb-remove svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* ---------- brand ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo-mark { width: 30px; height: 23px; flex: none; color: var(--ink); overflow: visible; }
.logo-mark .seal, .done-mark .seal { fill: var(--accent); transform-origin: 17px 17px; transition: transform .35s cubic-bezier(.16, 1, .3, 1); }
.logo:hover .logo-mark .seal { transform: scale(1.15); }
.logo-word { font-family: 'Cormorant Garamond', serif; font-size: 23px; font-weight: 500; letter-spacing: -.005em; line-height: 1; }
.logo-word em { font-style: italic; color: var(--accent); margin-right: .04em; }
.brand .logo-mark { width: 26px; height: 20px; }
.brand .logo-word { font-size: 21px; }
.start-logo { margin-bottom: 28px; gap: 11px; }
.start-logo .logo-mark { width: 38px; height: 29px; }
.start-logo .logo-word { font-size: 30px; }

/* ---------- start screen ---------- */
.start { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 72px 16px 48px; }
.start-inner { width: 100%; max-width: 420px; text-align: center; }
.start h1 { font-family: 'Nanum Myeongjo', serif; font-size: 28px; line-height: 1.45; letter-spacing: -.01em; margin: 0 0 14px; font-weight: 700; text-wrap: balance; }
.start-lead { color: var(--ink-2); margin: 0 0 32px; }
#create-btn { min-width: 220px; }
.my-list { margin-top: 56px; text-align: left; }
.my-list h2 { font-size: 13px; color: var(--ink-2); font-weight: 600; margin: 0 0 10px; padding: 0 4px; }
.my-list ul { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.my-list li + li { border-top: 1px solid var(--line); }
.my-list a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 56px; padding: 12px 18px; color: inherit; text-decoration: none; font-weight: 600;
  transition: background-color .15s;
}
.my-list a:hover { background: var(--surface-2); }
.my-list small { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.start-account { position: absolute; top: 12px; right: 16px; }

/* ---------- editor layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); padding: 0 20px;
  display: flex; align-items: center; gap: 14px;
  background: rgba(251, 247, 243, .9); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); margin-right: auto; white-space: nowrap; }
.save-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; transition: background-color .2s; }
.save-state:empty::before { display: none; }
.save-state.is-pending::before { background: var(--ink-4); }
.save-state.is-error { color: var(--danger); }
.save-state.is-error::before { background: var(--danger); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-account { display: flex; align-items: center; gap: 8px; }

.panes { display: grid; grid-template-columns: minmax(0, 580px) minmax(0, 1fr); gap: 40px; max-width: 1200px; margin: 0 auto; padding: 0 20px 96px; }
.form-pane { display: grid; gap: 16px; align-content: start; min-width: 0; }
.preview-pane { position: sticky; top: calc(var(--topbar-h) + 24px); height: calc(100vh - var(--topbar-h) - 48px); margin-top: 24px; display: grid; place-items: start center; }
.phone {
  position: relative; width: 390px; max-width: 100%; height: min(820px, 100%);
  border-radius: 40px; overflow: hidden; background: #FBF7F3;
  box-shadow: 0 0 0 9px #2B2422, 0 0 0 10px #4A3F3C, 0 30px 60px -10px rgba(43, 36, 34, .35);
}
.phone iframe { width: 100%; height: 100%; border: 0; display: block; background: #FBF7F3; }
.preview-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; background: #FBF7F3; }

.preview-pane { grid-template-rows: auto 1fr; gap: 14px; }
.preview-bar { width: 390px; max-width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }
.mobile-tabs { display: none; }

/* ---------- section nav ---------- */
.section-nav {
  position: sticky; top: calc(var(--topbar-h) + var(--tabs-h)); z-index: 20;
  display: flex; gap: 4px; margin: 0 -20px 4px; padding: 10px 20px;
  background: linear-gradient(var(--bg) 78%, rgba(251, 247, 243, 0));
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  display: inline-flex; align-items: center; gap: 5px; flex: none; scroll-snap-align: center;
  height: 32px; padding: 0 12px; border-radius: 999px;
  color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.section-nav a:hover { background: var(--surface-3); color: var(--ink); }
.section-nav a.is-active { background: var(--ink); color: #fff; }
.nav-check { display: none; width: 14px; height: 14px; fill: none; stroke: var(--ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-left: -2px; }
.section-nav a.is-done .nav-check { display: block; }
.section-nav a.is-active .nav-check { stroke: #CFE0CB; }
.card { scroll-margin-top: calc(var(--topbar-h) + var(--tabs-h) + var(--nav-h) + 8px); }

/* ---------- cards & fields ---------- */
.card { margin: 0; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.card legend { float: left; width: 100%; padding: 0; margin: 0 0 18px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.card legend + * { clear: both; }
.card .card-desc { margin: -12px 0 18px; font-size: 13px; color: var(--ink-3); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.col { display: grid; gap: 12px; align-content: start; min-width: 0; }
.col-title { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; font-family: 'Nanum Myeongjo', serif; font-size: 15px; color: var(--accent); font-weight: 700; }
.col-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.col .field { margin-bottom: 0; }
.field > span, .field > label, .field-head > label:first-child { font-size: 13px; color: var(--ink-2); font-weight: 600; }
em { color: var(--accent); font-style: normal; }
input, select, textarea {
  width: 100%; min-width: 0; min-height: 44px; padding: 10px 13px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #FFFDFB;
  font: inherit; font-size: 15px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-4); }
textarea { resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px #FBEDEA; }
input[type="date"], input[type="time"] { font-variant-numeric: tabular-nums; }
.hint { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-3); }
.hint-warn { color: var(--accent); font-weight: 600; }

/* ---------- parents: 고인 (quiet, lives in the label row) ---------- */
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
.quiet-check {
  position: relative; display: inline-flex; align-items: center; gap: 5px;
  padding: 12px 6px; margin: -12px -6px;
  font-size: 12px; color: var(--ink-3); cursor: pointer; user-select: none;
  transition: color .15s;
}
.quiet-check:hover { color: var(--ink-2); }
.quiet-check input {
  appearance: none; -webkit-appearance: none; width: 14px; height: 14px; min-height: 0; padding: 0; margin: 0;
  border: 1.2px solid var(--ink-4); border-radius: 4px; background: #fff center / 10px no-repeat;
  box-shadow: none !important; cursor: pointer;
}
.quiet-check input:checked {
  border-color: var(--ink-2); background-color: var(--ink-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3.5 8.4 2.9 2.8 6.1-6.4' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.quiet-check:has(input:checked) { color: var(--ink-2); }
.quiet-check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.deceased-option { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.deceased-option > span { color: var(--ink-2); font-weight: 600; margin-right: auto; }
.seg { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; transition: border-color .15s, background-color .15s, color .15s; }
.seg svg { width: 15px; height: 15px; }
.seg:hover span { border-color: var(--ink-4); }
.seg input:checked + span { border-color: var(--ink-2); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--ink-2); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- photos ---------- */
.photo-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 16px; margin-bottom: 24px; }
.photo-slot { display: grid; gap: 7px; align-content: start; }
.photo-slot small { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.slot-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.slot-box {
  position: relative; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden; cursor: pointer;
  border: 1.5px dashed var(--line-strong); background: var(--surface-2) center / cover no-repeat;
  display: grid; place-items: center; color: var(--ink-3); font-size: 13px;
  transition: border-color .15s, background-color .15s;
}
.slot-box:hover { border-color: var(--ink-4); background-color: var(--surface-3); }
.slot-box.has-image { border: 0; }
.slot-empty { display: grid; gap: 6px; justify-items: center; }
.slot-empty svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.slot-box .slot-remove { position: absolute; top: 8px; right: 8px; border: 0; background: rgba(255, 255, 255, .92); }
.slot-change {
  position: absolute; left: 8px; bottom: 8px; padding: 4px 10px; border-radius: 999px;
  background: rgba(43, 36, 34, .62); color: #fff; font-size: 12px; font-weight: 600;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s var(--ease);
}
.slot-box:hover .slot-change, .slot-box:focus-visible .slot-change { opacity: 1; transform: none; }
.slot-box.is-busy::after, .thumb.is-busy::after {
  content: '올리는 중…'; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(251, 247, 243, .82); color: var(--ink-2); font-size: 12px;
}

/* ---------- gallery (drag to reorder) ---------- */
.gallery-editor { margin: 0 -10px -10px; padding: 10px; border-radius: 14px; transition: background-color .15s, box-shadow .15s; }
.gallery-editor.is-dropping { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.gallery-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.count { font-weight: 400; color: var(--ink-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.gallery-tip { font-size: 12px; color: var(--ink-3); }
.gallery-thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumb-img { position: absolute; inset: 0; background: var(--surface-2) center / cover no-repeat; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--surface-2);
  cursor: grab; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .26s var(--ease), opacity .15s, box-shadow .15s;
}
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumb.is-busy { cursor: default; }
.thumb.is-pressing { transform: scale(.95); }
.thumb.is-placeholder { opacity: .28; box-shadow: inset 0 0 0 2px var(--accent); }
.thumb .thumb-index {
  position: absolute; left: 6px; top: 6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: rgba(43, 36, 34, .6); color: #fff; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  display: grid; place-items: center; pointer-events: none;
}
.thumb-remove {
  position: absolute; top: 0; right: 0; width: 36px; height: 36px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; cursor: pointer; color: var(--ink);
}
.thumb-remove::before { content: ''; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 3px rgba(43, 36, 34, .2); transition: background-color .15s; }
.thumb-remove svg { position: relative; width: 12px; height: 12px; margin: -6px -6px 0 0; stroke-width: 2; }
.thumb-remove:hover::before { background: #fff; }
.thumb-ghost {
  position: fixed; left: 0; top: 0; z-index: 100; margin: 0; pointer-events: none;
  box-shadow: var(--shadow-lift); cursor: grabbing; transition: none;
}
.thumb-ghost .thumb-index { background: var(--accent); }
.is-sorting, .is-sorting * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.thumb-add-wrap { aspect-ratio: 1; }
.thumb-add {
  width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 4px;
  border: 1.5px dashed var(--line-strong); border-radius: 10px; background: transparent;
  color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: border-color .15s, background-color .15s, color .15s;
}
.thumb-add svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.thumb-add:hover { border-color: var(--ink-4); background: var(--surface-2); color: var(--ink); }
.gallery-thumbs.is-empty { grid-template-columns: 1fr; }
.gallery-thumbs.is-empty .thumb-add-wrap { aspect-ratio: auto; }
.gallery-thumbs.is-empty .thumb-add { min-height: 112px; grid-auto-flow: column; gap: 8px; font-size: 14px; }

/* ---------- greeting ---------- */
.greeting-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.greeting-count { margin-left: auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
textarea.is-swapped { animation: swap-in .32s var(--ease); }
@keyframes swap-in { from { opacity: .25; transform: translateY(3px); } }

/* ---------- accounts ---------- */
#accounts-empty { margin: 0 0 14px; }
.accounts:empty { display: none; }
.accounts { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.account-row { display: grid; grid-template-columns: 96px 1fr 1fr; gap: 6px; padding: 12px; padding-right: 52px; position: relative; border-radius: 12px; background: var(--surface-2); }
.account-row [data-k="number"] { grid-column: 2 / span 2; font-variant-numeric: tabular-nums; }
.account-row [data-k="bank"] { grid-column: 1; }
.account-row input, .account-row select { background: #fff; }
.account-row .icon-btn { position: absolute; right: 10px; top: 18px; z-index: 1; }

/* ---------- switches ---------- */
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 8px 12px 8px 14px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: border-color .15s, background-color .15s;
}
.toggle:hover { border-color: var(--line-strong); background: #FFFDFB; }
.toggle span { order: -1; }
.toggle input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 38px; height: 22px; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--line-strong) radial-gradient(circle at center, #fff 8px, transparent 8.6px) 0 50% / 22px 22px no-repeat;
  box-shadow: none !important;
  transition: background-color .2s var(--ease), background-position .2s var(--ease);
}
.toggle input:checked { background-color: var(--accent); background-position: 16px 50%; }
.toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- responses ---------- */
.responses-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.responses-tabs button { border: 1px solid var(--line-strong); background: transparent; border-radius: 999px; min-height: 34px; padding: 0 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.responses-tabs button:hover { background: var(--surface-2); }
.responses-tabs button.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.rsvp-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rsvp-summary span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.responses { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 420px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.responses li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.responses .r-main { flex: 1; min-width: 0; }
.responses .r-meta { font-size: 12px; color: var(--ink-3); }
.responses .r-msg { margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.responses .empty { background: none; color: var(--ink-3); justify-content: center; }

.edit-link-card { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--radius); background: var(--accent-soft); }
.edit-link-card strong { font-size: 14px; }
.edit-link-card p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.edit-link-card .btn { flex: none; }
.edit-link-card .btn-ghost { background: var(--surface); }
.edit-link-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* ---------- modal ---------- */
.modal { border: 0; padding: 0; border-radius: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(43, 36, 34, .3); color: var(--ink); background: var(--surface); }
.modal::backdrop { background: rgba(43, 36, 34, .45); }
.modal[open] { animation: modal-in .26s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-body { padding: 30px 24px 24px; }
.modal h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.01em; }
.modal-lead { margin: 0 0 18px; color: var(--ink-2); }
.slug-field { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #FFFDFB; overflow: hidden; }
.slug-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.slug-prefix { padding-left: 13px; color: var(--ink-3); font-size: 13px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
.slug-field input { border: 0; box-shadow: none !important; padding-left: 2px; background: transparent; }
.slug-msg { min-height: 20px; margin: 6px 2px 0; font-size: 12.5px; color: var(--ink-3); }
.slug-msg.is-ok { color: var(--ok); }
.slug-msg.is-bad { color: var(--danger); }
.problems { margin: 8px 0 0; padding: 12px 14px; border-radius: 10px; background: #FBEDEA; color: var(--danger); font-size: 13px; }
.problems p { margin: 0 0 4px; font-weight: 600; }
.problems ul { margin: 0; padding-left: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.done-mark { display: block; width: 52px; height: 40px; margin: 4px auto 14px; color: var(--ink); overflow: visible; }
.modal[open] .done-mark .seal { animation: seal-in .6s .1s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes seal-in { from { transform: scale(.2); opacity: 0; } }
#publish-step-done .modal-lead { text-align: center; font-weight: 600; color: var(--ink); }
.url-box { padding: 14px; border-radius: 12px; background: var(--surface-2); text-align: center; word-break: break-all; }
.url-box a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }
#publish-step-done .modal-actions { justify-content: center; }
#publish-step-done .hint { text-align: center; }
.login-body { position: relative; text-align: center; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; background: none; color: var(--ink-3); cursor: pointer; border-radius: 50%; display: grid; place-items: center; }
.modal-x:hover { background: var(--surface-2); color: var(--ink); }
.social-login { display: grid; gap: 8px; justify-items: center; margin: 8px 0; }
.social-btn {
  position: relative; width: 300px; max-width: 100%; height: 44px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.social-btn svg { position: absolute; left: 18px; width: 20px; height: 20px; fill: currentColor; }
.social-btn:hover { filter: brightness(.96); }
.social-btn:active { transform: scale(.98); }
.social-btn:disabled { opacity: .6; cursor: default; }
/* Brand colors follow the providers' login button guidelines. */
.social-kakao { background: #FEE500; color: rgba(0, 0, 0, .85); }
.social-naver { background: #03C75A; color: #fff; }
.social-naver svg { width: 15px; height: 15px; left: 21px; }
.google-login { display: flex; justify-content: center; min-height: 44px; }
.dev-login { display: grid; gap: 8px; margin-top: 8px; text-align: left; }
.dev-badge { margin: 0; font-size: 11.5px; color: #7A5F17; background: #FBF3DC; padding: 6px 10px; border-radius: 8px; }
.login-error { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }
.account-email { font-size: 12px; color: var(--ink-2); text-decoration: none; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 120; padding: 11px 18px; border-radius: 999px; background: rgba(43, 36, 34, .94); color: #fff; font-size: 14px; max-width: calc(100vw - 32px); text-align: center; box-shadow: 0 8px 24px rgba(43, 36, 34, .25); animation: toast-in .24s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- tablet & phone ---------- */
@media (max-width: 900px) {
  :root { --tabs-h: 48px; }
  .panes { grid-template-columns: 1fr; gap: 0; padding: 0 16px 80px; }
  .section-nav { margin: 0 -16px 4px; padding: 8px 16px; }
  .mobile-tabs {
    display: flex; position: sticky; top: var(--topbar-h); z-index: 25; height: var(--tabs-h);
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .mobile-tabs button { flex: 1; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink-3); box-shadow: inset 0 -2px 0 transparent; cursor: pointer; transition: color .15s, box-shadow .15s; }
  .mobile-tabs button.is-active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
  .editor[data-pane="form"] .preview-pane { display: none; }
  .editor[data-pane="preview"] .form-pane { display: none; }
  .preview-pane { position: static; height: calc(100vh - var(--topbar-h) - var(--tabs-h)); height: calc(100dvh - var(--topbar-h) - var(--tabs-h)); padding: 0; margin: 0 -16px -80px; }
  .phone { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
  .preview-pane { gap: 0; }
  .preview-bar { width: 100%; padding: 6px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
  .topbar { padding: 0 16px; }
  .save-state { font-size: 11.5px; }
  #view-link { display: none; }
  .account-email { display: none; }
}
@media (max-width: 520px) {
  .card { padding: 20px 16px; }
  .pair { gap: 16px; }
  .photo-slots { grid-template-columns: 1fr 1fr; gap: 12px; }
  .toggles { grid-template-columns: 1fr; }
  .account-row { grid-template-columns: 1fr 1fr; }
  .account-row [data-k="side"] { grid-column: 1; }
  .account-row [data-k="label"] { grid-column: 2; }
  .account-row [data-k="bank"] { grid-column: 1; }
  .account-row [data-k="number"] { grid-column: 1 / span 2; }
  .deceased-option > span { flex-basis: 100%; }
}
@media (max-width: 380px) {
  .pair { grid-template-columns: 1fr; }
}

/* ---------- touch ----------
   iOS Safari zooms into any focused field under 16px, so touch gets 16px fields.
   Every tap target is a real 44px box (no ::after hit areas: Chrome ignores those for hit-testing). */
@media (pointer: coarse), (max-width: 900px) {
  input, select, textarea { font-size: 16px; min-height: 46px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 44px; padding: 0 14px; }
  .icon-btn { width: 44px; height: 44px; }
  .account-row { padding-right: 58px; }
  .account-row .icon-btn { right: 8px; top: 12px; }
  .quiet-check { padding: 13px 8px; margin: -13px -8px; font-size: 13px; }
  .quiet-check input { width: 16px; height: 16px; }
  .seg span { min-height: 44px; }
  .section-nav a { height: 44px; padding: 0 14px; }
  :root { --nav-h: 60px; }
  .thumb-remove { width: 44px; height: 44px; }
  .thumb-remove::before { top: 7px; right: 7px; width: 26px; height: 26px; }
  .gallery-thumbs { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .slot-change { opacity: 1; transform: none; }
  .modal-x { width: 44px; height: 44px; top: 6px; right: 6px; }
  .logo { padding: 12px 0; }
  .responses-tabs button { min-height: 44px; }
  .thumb { cursor: default; }
}
@media (max-width: 480px) {
  .save-state .ss-extra { display: none; }
  .topbar { gap: 8px; }
  .brand .logo-word { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
