/* 자동 DM 관리 화면. 색·간격은 여기 토큰에서만 정한다. */
:root {
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --surface-2: #F2F2EF;
  --surface-3: #E9E9E5;
  --ink: #18181B;
  --ink-2: #55555E;
  --ink-3: #8E8E98;
  --line: #E6E6E2;
  --line-strong: #D6D6D0;
  --accent: #F2B705;
  --accent-soft: #FFF5D1;
  --accent-ink: #4A3800;
  --on-accent: #1B1600;
  --primary: #18181B;
  --on-primary: #FFFFFF;
  --ok: #188A4A;
  --ok-soft: #E3F5EA;
  --danger: #D33A2C;
  --danger-soft: #FDECEA;
  --focus: #F2B705;
  --ig-blue: #0095F6;
  --bubble-me: linear-gradient(135deg, #7B4DFF, #3D7BFF);
  --phone-bg: #FFFFFF;
  --phone-ink: #111111;
  --phone-line: #EFEFEF;
  --phone-card: #EFEFEF;
  --shadow-1: 0 1px 2px rgba(24, 24, 27, .04), 0 1px 1px rgba(24, 24, 27, .03);
  --shadow-2: 0 8px 24px -8px rgba(24, 24, 27, .14), 0 2px 6px rgba(24, 24, 27, .05);
  --shadow-3: 0 24px 64px -16px rgba(24, 24, 27, .28), 0 4px 16px rgba(24, 24, 27, .08);
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0F11;
    --surface: #18181B;
    --surface-2: #202024;
    --surface-3: #2A2A2F;
    --ink: #F4F4F5;
    --ink-2: #B4B4BC;
    --ink-3: #7C7C86;
    --line: #26262B;
    --line-strong: #34343A;
    --accent-soft: #3A2E07;
    --accent-ink: #FFD95C;
    --primary: #F4F4F5;
    --on-primary: #18181B;
    --ok: #3DD68C;
    --ok-soft: #10301F;
    --danger: #FF6B5E;
    --danger-soft: #3A1714;
    --phone-bg: #000000;
    --phone-ink: #F5F5F5;
    --phone-line: #262626;
    --phone-card: #262626;
    --shadow-1: 0 1px 0 rgba(255, 255, 255, .03) inset;
    --shadow-2: 0 8px 24px -8px rgba(0, 0, 0, .6);
    --shadow-3: 0 24px 64px -16px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
img { display: block; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
  transition: transform .12s var(--ease), background .15s, border-color .15s, opacity .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 4px 14px -4px rgba(0,0,0,.35); }
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn.outline { background: var(--surface); border-color: var(--line-strong); }
.btn.outline:hover:not(:disabled) { border-color: var(--ink-3); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15.5px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; opacity: .7;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 스위치 ---------- */
.switch {
  --w: 46px; --h: 28px;
  position: relative; flex: none; width: var(--w); height: var(--h); border-radius: 999px;
  border: 0; padding: 0; background: var(--surface-3);
  transition: background .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: calc(var(--h) - 6px); height: calc(var(--h) - 6px); border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 1px 1px rgba(0,0,0,.08);
  transition: transform .28s var(--spring), width .15s var(--ease);
}
.switch:active::after { width: calc(var(--h) - 2px); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(calc(var(--w) - var(--h))); }
.switch[aria-checked="true"]:active::after { transform: translateX(calc(var(--w) - var(--h) - 4px)); }
.switch.sm { --w: 38px; --h: 23px; }
.switch:disabled { opacity: .5; }

/* ---------- 입력 ---------- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.label .count { font-weight: 500; color: var(--ink-3); font-size: 12.5px; transition: color .15s; }
.label .count.near { color: var(--accent-ink); }
.label .count.over { color: var(--danger); font-weight: 700; }
.input, .textarea {
  width: 100%; border-radius: var(--r-m); border: 1px solid var(--line-strong);
  background: var(--surface); padding: 11px 14px; font-size: 15.5px; line-height: 1.45;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); }
.textarea { resize: none; min-height: 76px; overflow: hidden; }
.invalid .input, .invalid .textarea, .invalid .chips { border-color: var(--danger); }
.invalid .input:focus, .invalid .textarea:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
.hint { font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.error { font-size: 13px; color: var(--danger); font-weight: 500; display: flex; gap: 5px; align-items: flex-start; animation: drop .2s var(--ease); }
@keyframes drop { from { opacity: 0; transform: translateY(-3px); } }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .trail { position: absolute; right: 6px; }

/* 키워드 칩 입력 */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 50px; padding: 8px; border-radius: var(--r-m);
  border: 1px solid var(--line-strong); background: var(--surface); cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.chips:hover { border-color: var(--ink-3); }
.chips:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); }
.chips input { flex: 1; min-width: 120px; border: 0; background: transparent; padding: 4px 6px; font-size: 15.5px; }
.chip {
  display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 4px 0 12px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 600; font-size: 14px; animation: pop .22s var(--spring);
}
.chip.static { padding: 0 10px; height: 26px; font-size: 12.5px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.chip.armed { background: var(--danger-soft); color: var(--danger); }
.chip.shake { animation: shake .35s var(--ease); }
.chip button { width: 24px; height: 24px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: inherit; opacity: .6; }
.chip button:hover { opacity: 1; background: rgba(0,0,0,.06); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* 시험 댓글 */
.tester { display: flex; gap: 8px; align-items: center; margin-top: 12px; padding: 6px 6px 6px 14px; border-radius: var(--r-m); background: var(--surface-2); }
.tester input { flex: 1; border: 0; background: transparent; padding: 6px 0; font-size: 14.5px; min-width: 0; }
.verdict { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 11px; border-radius: 999px; font-size: 13px; font-weight: 600; transition: background .2s, color .2s; }
.verdict.yes { background: var(--ok-soft); color: var(--ok); }
.verdict.no { background: var(--surface-3); color: var(--ink-3); }

/* 공개 답글 목록 */
.variants { display: grid; gap: 8px; }
.variant { display: flex; gap: 6px; align-items: flex-start; animation: drop .2s var(--ease); }
.variant .idx { flex: none; width: 24px; height: 46px; display: grid; place-items: center; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.variant .field { flex: 1; }
.variant .btn { margin-top: 3px; }
.add-row { justify-self: start; margin-left: 24px; }

/* 세그먼트 */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); gap: 2px; position: relative; }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; height: 34px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2); transition: color .2s; }
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg .thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-2); transition: left .28s var(--spring), width .28s var(--spring); }

/* ---------- 앱 틀 ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; height: 64px; padding: 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.top.scrolled { border-bottom-color: var(--line); }
.top .grow { flex: 1; min-width: 0; }
.top-in { width: 100%; max-width: 1088px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); flex: none; }
.brand .who { min-width: 0; line-height: 1.25; }
.brand .who b { display: block; font-size: 16px; }
.brand .who span { font-size: 12.5px; color: var(--ink-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-3); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 8px 16px 120px; }
.page-title { margin: 20px 0 4px; font-size: 26px; font-weight: 750; letter-spacing: -.025em; }
.page-sub { margin: 0 0 22px; color: var(--ink-2); }

/* ---------- 목록 ---------- */
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 22px; border-radius: var(--r-l); overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.totals > div { background: var(--surface); padding: 14px 16px; }
.totals dt { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.totals dd { margin: 2px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.totals dd small { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-left: 2px; }
@media (max-width: 560px) { .totals { grid-template-columns: repeat(2, 1fr); } }

.list { display: grid; gap: 10px; }
.card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px 14px 14px; border-radius: var(--r-l); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-1); cursor: pointer; text-align: left; width: 100%;
  transition: transform .18s var(--ease), box-shadow .18s, border-color .18s, opacity .2s;
  animation: rise .35s var(--ease) backwards;
}
.card:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); transform: translateY(-1px); }
.card:active { transform: scale(.995); }
.card .thumb { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--surface-2); transition: filter .25s; }
.card.off .thumb { filter: grayscale(1) opacity(.6); }
.card.off .title { color: var(--ink-2); }
.card .body { min-width: 0; display: grid; gap: 5px; }
.card .title { font-weight: 650; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .kw { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; }
.card .funnel { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.card .funnel b { color: var(--ink); font-weight: 650; }
.card .funnel .arrow { color: var(--ink-3); }
.card .funnel .rate { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 650; font-size: 12px; }
.card .side { display: grid; justify-items: end; gap: 6px; }
.card .state { font-size: 12px; font-weight: 600; color: var(--ink-3); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.tile-any { width: 64px; height: 64px; border-radius: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 10px; background: var(--accent-soft); }
.tile-any i { border-radius: 4px; background: var(--accent); opacity: .55; }
.tile-any i:nth-child(1) { opacity: .9; }
.card.off .tile-any { filter: grayscale(1) opacity(.6); }

.empty { text-align: center; padding: 48px 20px 56px; border-radius: 24px; background: var(--surface); border: 1px dashed var(--line-strong); }
.empty h2 { margin: 18px 0 6px; font-size: 20px; }
.empty p { margin: 0 auto 20px; color: var(--ink-2); max-width: 340px; }
.empty .art { margin: 0 auto; width: 220px; display: grid; gap: 8px; }
.empty .art .b { padding: 10px 14px; border-radius: 18px; font-size: 13.5px; text-align: left; max-width: 80%; animation: rise .5s var(--ease) backwards; }
.empty .art .b.them { background: var(--surface-2); }
.empty .art .b.us { background: var(--accent-soft); color: var(--accent-ink); justify-self: end; animation-delay: .25s; }
.empty .art .b.us2 { animation-delay: .5s; }

.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 300% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- 편집 ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }
.sections { display: grid; gap: 14px; min-width: 0; }
.name-input { width: 100%; border: 0; background: transparent; font-size: 24px; font-weight: 750; letter-spacing: -.025em; padding: 6px 0; margin: 10px 0 2px; border-radius: 8px; }
.name-input::placeholder { color: var(--ink-3); }
.name-row { display: flex; align-items: center; gap: 12px; }
.name-row .grow { flex: 1; min-width: 0; }
.onoff { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }

.section { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow-1); transition: border-color .2s, box-shadow .2s; scroll-margin-top: 84px; }
.section:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.section header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.section header .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: 1px; transition: background .2s, color .2s; }
.section.done header .n { background: var(--ok-soft); color: var(--ok); }
.section.bad header .n { background: var(--danger-soft); color: var(--danger); }
.section header h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.section header p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-3); }
.section header .grow { flex: 1; min-width: 0; }
.section.collapsed header { margin-bottom: 0; }

/* 게시물 고르기 */
.picker-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { flex: 1; min-width: 180px; position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 36px; height: 40px; border-radius: 999px; font-size: 14.5px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 6px; } }
.media {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 0; padding: 0;
  background: var(--surface-2); transition: transform .18s var(--ease), box-shadow .18s;
  -webkit-tap-highlight-color: transparent;
}
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s var(--ease); }
@media (hover: hover) { .media:hover img { transform: scale(1.04); } }
.media:active { transform: scale(.97); }
.media::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); transition: box-shadow .2s var(--ease); pointer-events: none; }
.media[aria-pressed="true"]::after { box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px var(--surface); }
.media .cap { position: absolute; inset: auto 0 0 0; padding: 22px 8px 7px; font-size: 11.5px; line-height: 1.35; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,.66)); opacity: 0; transition: opacity .2s; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (hover: hover) { .media:hover .cap { opacity: 1; } .media:hover .used { opacity: 0; } }
.media:focus-visible .cap { opacity: 1; }
.media .kind { position: absolute; top: 7px; right: 7px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.media .check { position: absolute; top: 7px; left: 7px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; transform: scale(0); transition: transform .28s var(--spring); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.media[aria-pressed="true"] .check { transform: scale(1); }
.grid.invalid .media::after { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 55%, transparent); }
.media .used { position: absolute; left: 7px; bottom: 7px; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600; backdrop-filter: blur(6px); }
.more { display: flex; justify-content: center; margin-top: 12px; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; line-height: 1.5; margin-top: 12px; }
.callout svg { flex: none; margin-top: 2px; color: var(--ink-3); }
.callout.warn { background: var(--accent-soft); color: var(--accent-ink); }
.callout.warn svg { color: currentColor; }
.callout.bad { background: var(--danger-soft); color: var(--danger); }
.callout b { font-weight: 650; }

.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 16px; font-size: 12.5px; color: var(--ink-2); }
.flow span { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-weight: 600; }
.flow svg { color: var(--ink-3); }

.danger-zone { display: flex; justify-content: center; padding: 10px 0 0; }

/* 저장 줄 */
.savebar {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, calc(100% + 40px)); transition: transform .4s var(--spring);
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-3);
  width: min(560px, calc(100vw - 24px));
}
.savebar:not(.show) { visibility: hidden; transition: transform .3s var(--ease), visibility 0s .3s; }
.savebar.show { transform: translate(-50%, 0); }
.savebar .msg { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.savebar .msg button { border: 0; background: none; padding: 0; color: var(--danger); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.savebar .kbd { font-size: 11.5px; color: var(--on-primary); opacity: .55; font-weight: 600; margin-left: 2px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }

.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r-l); background: var(--accent-soft); color: var(--accent-ink); margin: 10px 0 4px; font-size: 14px; }
.banner .grow { flex: 1; min-width: 200px; }

/* ---------- 미리보기 ---------- */
.preview { position: sticky; top: 84px; display: grid; justify-items: center; gap: 14px; }
.preview .seg { justify-self: center; }
.phone {
  width: 340px; height: 640px; border-radius: 46px; padding: 10px; background: #111;
  box-shadow: var(--shadow-3), inset 0 0 0 2px #2b2b2b; position: relative;
}
.screen { width: 100%; height: 100%; border-radius: 37px; overflow: hidden; background: var(--phone-bg); color: var(--phone-ink); display: flex; flex-direction: column; font-size: 14px; position: relative; }
.island { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 92px; height: 26px; border-radius: 20px; background: #000; z-index: 3; }
.status { height: 50px; flex: none; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 28px 6px 34px; font-size: 14px; font-weight: 650; }
.status .icons { display: flex; gap: 5px; align-items: center; }
.ig-head { flex: none; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border-bottom: 1px solid var(--phone-line); }
.ig-head .who { flex: 1; min-width: 0; line-height: 1.2; }
.ig-head b { display: block; font-size: 14.5px; }
.ig-head span { font-size: 12px; opacity: .55; }
.ig-av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: linear-gradient(135deg, #F2B705, #F27405); flex: none; }
.ig-av.sm { width: 26px; height: 26px; }
.ig-av.guest { background: linear-gradient(135deg, #c9c9d0, #9d9da8); display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }
.scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.post-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: linear-gradient(135deg, #FFE48A, #F2B705); }
.post-img.ph { display: grid; place-items: center; color: rgba(0,0,0,.35); font-weight: 700; font-size: 13px; }
.ig-actions { display: flex; gap: 14px; padding: 10px 14px 4px; }
.comments { padding: 6px 14px 20px; display: grid; gap: 14px; }
.cmt { display: flex; gap: 10px; align-items: flex-start; animation: rise .3s var(--ease) backwards; }
.cmt.reply { margin-left: 36px; animation-delay: .12s; }
.cmt .t { font-size: 13.5px; line-height: 1.4; }
.cmt .t b { margin-right: 5px; }
.cmt .meta { font-size: 11.5px; opacity: .5; margin-top: 3px; font-weight: 600; }
.cmt.dim { opacity: .4; }
.cycle { display: flex; align-items: center; gap: 2px; margin: -6px 0 0 72px; font-size: 11.5px; color: var(--ink-3); }
.cycle button { width: 24px; height: 24px; border: 0; background: none; border-radius: 50%; color: inherit; display: grid; place-items: center; }
.cycle button:hover { background: var(--surface-2); }
.note-chip { justify-self: center; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--phone-card); opacity: .85; margin: 4px 0; }

.thread { padding: 14px 12px 24px; display: grid; gap: 6px; align-content: start; }
.msg-row { display: flex; gap: 8px; align-items: flex-end; animation: rise .3s var(--ease) backwards; }
.msg-row.me { justify-content: flex-end; }
.msg-row.focus .tcard { box-shadow: 0 0 0 2px var(--accent); }
.tcard { transition: box-shadow .2s; width: 220px; border-radius: 18px; background: var(--phone-card); overflow: hidden; }
.tcard .tt { padding: 11px 14px 10px; font-size: 14px; font-weight: 600; line-height: 1.35; white-space: pre-wrap; }
.tcard .tt.ph { opacity: .4; font-weight: 500; }
.tcard .tb { border-top: 1px solid color-mix(in srgb, var(--phone-ink) 10%, transparent); padding: 10px 14px; text-align: center; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 5px; }
.tcard .tb.link { color: var(--ig-blue); }
.tcard .cut { color: #ff5a4f; }
.bubble-me { max-width: 200px; padding: 9px 14px; border-radius: 20px; background: var(--bubble-me); color: #fff; font-size: 14px; }
.when { justify-self: center; font-size: 11.5px; opacity: .45; font-weight: 600; margin: 8px 0 4px; }
.branch { justify-self: center; display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 4px 10px; border-radius: 999px; margin: 12px 0 4px; }
.branch.no { background: color-mix(in srgb, #ff5a4f 14%, transparent); color: #e0483d; }
.branch.yes { background: color-mix(in srgb, #3DD68C 18%, transparent); color: #188A4A; }
@media (prefers-color-scheme: dark) { .branch.yes { color: #3DD68C; } .branch.no { color: #ff7a70; } }
.composer { flex: none; margin: 8px 12px 14px; height: 42px; border-radius: 999px; border: 1px solid var(--phone-line); display: flex; align-items: center; padding: 0 6px 0 16px; font-size: 13.5px; opacity: .6; }
.home-ind { flex: none; height: 5px; width: 120px; border-radius: 3px; background: currentColor; opacity: .25; margin: 0 auto 8px; }
.preview-cap { font-size: 12.5px; color: var(--ink-3); text-align: center; max-width: 320px; }

/* 모바일: 미리보기는 아래 시트 */
.fab { position: fixed; right: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px); z-index: 25; box-shadow: var(--shadow-3); transition: bottom .4s var(--spring); }
.fab.low { bottom: max(16px, env(safe-area-inset-bottom)); }
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 94vh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 10px 0 24px; animation: up .38s var(--spring); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet .preview { position: static; }
.sheet .phone { transform: scale(.92); transform-origin: top center; margin-bottom: -48px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

@media (min-width: 1000px) { .fab { display: none; } }
@media (max-width: 999px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor > .preview { display: none; }
}
@media (max-width: 560px) {
  .section { padding: 16px; border-radius: 18px; }
  .page-title { font-size: 23px; }
  .name-input { font-size: 21px; }
  .card { grid-template-columns: auto 1fr auto; padding: 12px; gap: 12px; }
  .card .thumb, .tile-any { width: 56px; height: 56px; }
}

/* 대화상자·알림 */
.dialog-back { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.42); display: grid; place-items: center; padding: 20px; animation: fade .18s; }
.dialog { width: min(400px, 100%); background: var(--surface); border-radius: 22px; padding: 22px; box-shadow: var(--shadow-3); animation: zoom .28s var(--spring); }
.dialog h3 { margin: 0 0 6px; font-size: 18px; }
.dialog p { margin: 0 0 20px; color: var(--ink-2); font-size: 14.5px; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes zoom { from { opacity: 0; transform: scale(.94); } }
.toast { position: fixed; left: 50%; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 76px); z-index: 60; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-3); animation: toast .35s var(--spring); white-space: nowrap; }
.toast.bad { background: var(--danger); color: #fff; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } }

/* 로그인 */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 14px; }
.login .mark { width: 52px; height: 52px; border-radius: 16px; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); margin-bottom: 6px; box-shadow: 0 10px 30px -10px var(--accent); }
.login h1 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.login p { margin: -6px 0 8px; color: var(--ink-2); }
.login .shake { animation: shake .4s var(--ease); }

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

/* 가입·로그인 */
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.link:hover { text-decoration-color: currentColor; }
.login .seg { margin: 2px 0 4px; }

/* 상단 계정 바꾸기 */
.brand-btn { display: flex; align-items: center; gap: 10px; min-width: 0; background: none; border: 0; padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: 14px; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .2s var(--ease); }
.brand-btn:hover { background: var(--surface-2); }
.brand-btn .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-btn .chev { color: var(--ink-3); display: grid; transform: rotate(90deg); flex: none; }

/* 계정 화면 */
.accounts { max-width: 640px; display: grid; gap: 14px; padding-top: 20px; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.03em; }
.page-head p { margin: 0; color: var(--ink-2); line-height: 1.55; }
.acct-list { display: grid; gap: 8px; }
.acct { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 6px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.acct.on { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); box-shadow: 0 0 0 3px var(--ok-soft); }
.acct-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; background: none; border-radius: var(--r-m); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.acct-pick:hover { background: var(--surface-2); }
.acct .avatar { width: 42px; height: 42px; }
.avatar.ph { display: grid; place-items: center; color: var(--ink-3); }
.acct .who { flex: 1; min-width: 0; line-height: 1.3; }
.acct .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct .who span { font-size: 12.5px; color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.connect { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-l); border: 1px dashed var(--line-strong); color: inherit; text-decoration: none; transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease); }
.connect:hover { background: var(--surface); border-color: var(--accent); }
.connect:active { transform: scale(.99); }
.connect .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.connect .t { display: grid; gap: 2px; min-width: 0; }
.connect .t span { font-size: 13px; color: var(--ink-2); }
.connect.big { border: 0; background: var(--primary); color: var(--on-primary); padding: 18px 18px; box-shadow: var(--shadow-2); }
.connect.big:hover { background: var(--primary); filter: brightness(1.08); }
.connect.big .ic { background: color-mix(in srgb, var(--on-primary) 16%, transparent); color: var(--on-primary); width: 44px; height: 44px; }
.connect.big .t span { color: color-mix(in srgb, var(--on-primary) 72%, transparent); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.bad { background: var(--danger-soft); color: var(--danger); }
.banner .sub { display: block; margin-top: 3px; font-size: 12.5px; opacity: .85; }
.claim-open { justify-self: start; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 2px; color: var(--ink-2); font: inherit; font-size: 13.5px; cursor: pointer; }
.claim-open:hover { color: var(--ink); }
.claim { display: grid; gap: 10px; padding: 16px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); animation: rise .3s var(--ease); }
.claim .actions { display: flex; justify-content: flex-end; gap: 8px; }
.help { color: var(--ink-2); font-size: 13.5px; }
.help summary { cursor: pointer; padding: 6px 2px; width: fit-content; }
.help ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.55; }
