/* 글꾸미 — 디자인 시스템 v2: 산리오풍 파스텔 × Y2K, '갖고 싶은 귀여움' + AA 가독성.
 * 원칙: 채움색(--brand)과 글자색(--pink-ink)을 분리해 파스텔을 유지하면서 대비를 양보하지 않는다.
 * 모션은 '확인'에만·짧게, prefers-reduced-motion이면 0(정보성 변화는 유지).
 */
:root {
  /* 배경 — 파스텔 멀티스톱 하늘 */
  --bg: #fff5fb;
  --bg-grad: radial-gradient(125% 85% at 50% -12%, #ffe1f1 0%, #fef0f9 38%, #f4f1ff 72%, #eef6ff 100%);
  /* 면 */
  --surface: #ffffff; --surface-2: #fdf4fb; --surface-3: #f6eef8;
  --surface-glass: rgba(255,255,255,.80);
  /* 잉크(텍스트) */
  --ink: #2a2030; --ink-2: #6b6177; --ink-3: #847b90;
  /* 라인 */
  --line: #f0e3ee; --line-2: #e6d4e6;
  /* 포인트 — 채움 전용(brand) */
  --brand: #ff5fa2; --brand-2: #8b7bff; --brand-3: #5ec8e0; --on-brand: #ffffff;
  /* 포인트 — 글자/아이콘 전용(흰 위 4.5:1↑) */
  --pink-ink: #d6286f; --violet-ink: #6a55e6; --mint-ink: #0f8aa6;
  /* 소프트 배경 칩 */
  --pink-soft: #ffe6f1; --violet-soft: #ece8ff; --mint-soft: #dff5fa;
  /* 상태 */
  --ok: #1f9d6b; --ok-soft: #d8f6ea;
  --warn: #c9711f; --warn-soft: #fdeede;
  --danger: #d6455a; --danger-soft: #fde3e6;
  /* 그라데이션 */
  --grad-brand: linear-gradient(135deg, #ff7eb6 0%, #b388ff 100%);
  --grad-brand-tri: linear-gradient(120deg, #ff8fc4 0%, #b39bff 55%, #7fd8ec 100%);
  --grad-soft: linear-gradient(135deg, var(--pink-soft), var(--violet-soft));
  /* 별칭(하위호환 — 혹시 빠뜨린 셀렉터 보호) */
  --accent: var(--brand); --accent-2: var(--brand-2); --accent-ink: var(--on-brand);
  --accent-soft: var(--pink-soft); --accent-soft-2: var(--violet-soft);
  /* 라운드 */
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px; --r-pill: 999px;
  /* 그림자 — 컬러드 2겹(스티커/젤리감) */
  --shadow-sm: 0 2px 8px rgba(214,40,111,.10);
  --shadow: 0 8px 22px -6px rgba(190,70,140,.22), 0 2px 6px rgba(190,70,140,.10);
  --shadow-pop: 0 14px 30px -8px rgba(255,95,162,.38), 0 3px 10px rgba(139,123,255,.20);
  --ring-hi: inset 0 1px 0 rgba(255,255,255,.7);
  /* 타입 스케일 */
  --t-caption: 11px; --t-small: 13px; --t-body: 14px; --t-input: 16px; --t-title: 18px; --t-display: 24px;
  --w-reg: 450; --w-med: 550; --w-bold: 700; --w-black: 820;
  --ls-tight: -.02em; --ls-snug: -.01em; --ls-wide: .02em; --lh-base: 1.55;
  --tab-h: 66px;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --fancy-fallback: 'Apple Color Emoji', 'Segoe UI Symbol', 'Noto Sans Symbols 2', sans-serif;
}
[data-theme="dark"] {
  --bg: #14101a;
  --bg-grad: radial-gradient(125% 85% at 50% -12%, #2c1d36 0%, #1a1422 42%, #131526 76%, #0e1322 100%);
  --surface: #1e1827; --surface-2: #261d31; --surface-3: #2d2339; --surface-glass: rgba(30,24,39,.72);
  --ink: #f5effb; --ink-2: #c2b6d0; --ink-3: #9b8fad;
  --line: #2f2640; --line-2: #3c3050;
  --brand: #ff86bd; --brand-2: #ad9fff; --brand-3: #79d6ef; --on-brand: #1a1020;
  --pink-ink: #ff9ec9; --violet-ink: #bcacff; --mint-ink: #84daf0;
  --pink-soft: #3a2333; --violet-soft: #2a2542; --mint-soft: #143540;
  --ok: #4fd6a0; --ok-soft: #16352a; --warn: #f0b366; --warn-soft: #3a2c18; --danger: #ff8a9c; --danger-soft: #3a1d22;
  --shadow-sm: 0 2px 10px rgba(0,0,0,.34);
  --shadow: 0 10px 26px -6px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.35);
  --shadow-pop: 0 16px 34px -8px rgba(255,134,189,.30), 0 3px 12px rgba(0,0,0,.5);
  --ring-hi: inset 0 1px 0 rgba(255,255,255,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--bg); background-image: var(--bg-grad);
  background-attachment: fixed; min-height: 100dvh; line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
::selection { background: var(--brand); color: var(--on-brand); }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-xs);
}

#shell { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* ── 헤더 ── */
#topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--surface-glass); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; font-size: 19px;
  background: var(--grad-brand-tri); color: #fff; box-shadow: var(--shadow-sm), var(--ring-hi);
  position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%);
  transform: translateX(-120%); animation: shine 5.5s ease-in-out infinite;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: var(--t-title); font-weight: var(--w-black); letter-spacing: var(--ls-tight); }
.brand-text small { font-size: var(--t-caption); color: var(--ink-2); }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-pill);
  padding: 7px 12px; font-size: var(--t-small); font-weight: var(--w-bold); box-shadow: var(--shadow-sm);
  transition: transform .12s;
}
.icon-btn:active { transform: scale(.94); }

/* ── 본문 ── */
#view { flex: 1; padding: 16px 16px calc(var(--tab-h) + 24px); }
.view { animation: fade .24s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.lead { color: var(--ink-2); font-size: var(--t-body); margin-bottom: 12px; }
.sec-title { font-weight: var(--w-black); font-size: var(--t-body); margin: 18px 2px 8px; display: flex; align-items: baseline; gap: 8px; letter-spacing: var(--ls-snug); }
.sec-sub { font-weight: var(--w-med); font-size: var(--t-caption); color: var(--ink-3); }
.opt-title { font-weight: var(--w-bold); font-size: var(--t-small); color: var(--ink-2); margin: 6px 2px; }

/* 입력 */
.input {
  width: 100%; border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-md);
  padding: 13px 14px; font-size: var(--t-input); resize: vertical; box-shadow: var(--shadow-sm) inset; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
textarea.input { line-height: 1.5; min-height: 56px; }
.input.search { margin-bottom: 10px; }

/* 툴바/버튼 */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.tbtn {
  border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-pill);
  padding: 9px 14px; font-size: var(--t-small); font-weight: var(--w-bold); box-shadow: var(--shadow-sm), var(--ring-hi);
  transition: transform .12s cubic-bezier(.34,1.56,.64,1), box-shadow .12s, filter .12s;
}
.tbtn:active { transform: translateY(1px) scale(.96); box-shadow: var(--shadow-sm); }
.tbtn.primary { background: var(--grad-brand); color: var(--on-brand); border-color: transparent; box-shadow: var(--shadow-pop), inset 0 1px 0 rgba(255,255,255,.4); }
@media (hover:hover) { .tbtn.primary:hover { filter: saturate(1.08) brightness(1.03); } }

/* 칩(옵션/카테고리) */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin: 6px 0 4px; }
.chip-opt {
  border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-pill);
  padding: 7px 12px; font-size: var(--t-small); font-weight: var(--w-bold); color: var(--ink-2);
  transition: transform .12s, background .15s, color .15s, border-color .15s;
}
.chip-opt:active { transform: scale(.94); }
.chip-opt.on { background: var(--pink-soft); border-color: var(--brand); color: var(--pink-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.cat-row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.cat-row::-webkit-scrollbar { height: 0; }

/* 옵션/토글/슬라이더/셀렉트 */
.options { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow-sm), var(--ring-hi); margin: 10px 0; }
.opt { display: flex; align-items: center; gap: 10px; font-size: var(--t-small); font-weight: var(--w-bold); color: var(--ink-2); margin: 9px 0; }
.opt-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 9px 0; }
.opt-val { min-width: 30px; text-align: right; color: var(--pink-ink); font-variant-numeric: tabular-nums; }
.toggle { border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-pill); padding: 8px 13px; font-size: var(--t-small); font-weight: var(--w-bold); color: var(--ink-2); transition: transform .12s; }
.toggle:active { transform: scale(.95); }
.toggle.on { background: var(--grad-brand); border-color: transparent; color: var(--on-brand); }
.select { border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm); padding: 8px 10px; font-size: var(--t-small); font-weight: var(--w-med); flex: 1; }
.slider { flex: 1; accent-color: var(--brand); height: 26px; }
details.adv { margin-top: 4px; border-top: 1px dashed var(--line); padding-top: 4px; }
details.adv > summary { cursor: pointer; font-size: var(--t-small); font-weight: var(--w-bold); color: var(--ink-2); list-style: none; padding: 6px 0; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "⚙ "; }

/* ── 멋글씨 결과 카드 ── */
.fout-wrap .dim { opacity: .55; }
.fout-list { display: flex; flex-direction: column; gap: 8px; }
.fout {
  display: grid; grid-template-columns: 70px 1fr 28px 32px; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px;
  box-shadow: var(--shadow-sm), var(--ring-hi);
  transition: transform .14s cubic-bezier(.34,1.56,.64,1), box-shadow .14s, border-color .14s;
}
@media (hover:hover) { .fout:hover { border-color: var(--line-2); box-shadow: var(--shadow), var(--ring-hi); } }
.fout-name { font-size: var(--t-caption); font-weight: var(--w-bold); color: var(--ink-3); letter-spacing: var(--ls-wide); line-height: 1.2; }
.fout-val {
  font-family: var(--sans), var(--fancy-fallback); border: none; background: transparent; text-align: left;
  font-size: var(--t-input); padding: 11px 8px; min-height: 44px; display: flex; align-items: center;
  overflow-x: auto; white-space: nowrap; border-radius: 12px; transition: background .12s, transform .12s;
}
.fout-val:active { background: var(--pink-soft); transform: scale(.99); }
.fout-val::-webkit-scrollbar { height: 0; }
.fout-star { border: none; background: transparent; font-size: 18px; color: var(--pink-ink); width: 32px; min-height: 44px; transition: transform .2s cubic-bezier(.34,1.56,.64,1); }
.fout-pv { border: none; background: transparent; font-size: 15px; width: 28px; min-height: 44px; opacity: .55; }
.fout-pv:active { opacity: 1; transform: scale(.9); }

/* 맥락 추천 행(가로 스크롤) */
.rec-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.rec-row::-webkit-scrollbar { height: 0; }
.rec-chip { flex: 0 0 auto; max-width: 200px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 1.5px solid var(--line-2); background: var(--surface); border-radius: var(--r-md); padding: 8px 12px; box-shadow: var(--shadow-sm), var(--ring-hi); }
.rec-chip:active { transform: scale(.95); border-color: var(--brand); }
.rec-name { font-size: 10px; font-weight: 700; color: var(--pink-ink); }
.rec-val { font-size: 15px; max-width: 176px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 슬롯 카테고리 라벨 */
.slot-cat { flex: 0 0 auto; font-size: 10px; font-weight: 700; color: var(--violet-ink); background: var(--violet-soft); border-radius: var(--r-pill); padding: 4px 8px; align-self: center; }
.fout-star[aria-pressed="true"] { animation: starpop .34s cubic-bezier(.34,1.56,.64,1); }
.fout.risky .fout-name { color: var(--warn); }

/* ── 특수문자/이모티콘 그리드(스티커 타일) ── */
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin-top: 4px; }
.chip {
  position: relative; border: 1px solid var(--line); border-radius: var(--r-md);
  min-height: 52px; display: flex; align-items: center; justify-content: center; padding: 6px; font-size: 20px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.6), transparent 60%), var(--surface);
  box-shadow: var(--shadow-sm), var(--ring-hi);
  transition: transform .14s cubic-bezier(.34,1.56,.64,1), box-shadow .14s, border-color .14s;
}
.chip:active { transform: scale(.92) rotate(-1.5deg); border-color: var(--brand); box-shadow: var(--shadow-pop), var(--ring-hi); }
.chip .chip-text { line-height: 1.15; word-break: break-all; text-align: center; }
.chip .chip-star {
  position: absolute; top: -7px; right: -7px; width: 23px; height: 23px; border-radius: 50%;
  border: 1.5px solid var(--surface); background: var(--surface); color: var(--pink-ink);
  font-size: 12px; display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.chip .chip-star[aria-pressed="true"] { background: var(--grad-brand); color: var(--on-brand); border-color: transparent; }
.view-library .sym-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.view-library .sym-grid .chip { font-size: 15px; min-height: 56px; }
.view-library .sym-grid .chip .chip-text { white-space: pre; overflow-x: auto; }

/* 구분선 목록 */
.deco-list { display: flex; flex-direction: column; gap: 7px; }
.deco-list .chip { min-height: 46px; font-size: 15px; justify-content: space-between; padding: 8px 14px; }
.deco-list .chip .chip-star { position: static; box-shadow: none; border: none; }

/* ── 세그먼트 ── */
.segmented { display: flex; gap: 4px; background: var(--surface-3); border-radius: var(--r-pill); padding: 5px; margin-bottom: 12px; box-shadow: inset 0 1px 3px rgba(120,70,110,.08); }
.seg { flex: 1; border: none; background: transparent; border-radius: var(--r-pill); padding: 9px 6px; font-size: var(--t-small); font-weight: var(--w-bold); color: var(--ink-2); transition: color .15s; }
.seg.on { background: var(--surface); color: var(--pink-ink); box-shadow: var(--shadow-sm), var(--ring-hi); }

/* ── 혼합 미리보기 ── */
.mix-preview { margin: 12px 0; min-height: 72px; display: grid; place-items: center; padding: 18px; border-radius: var(--r-lg); background: var(--grad-soft); border: 1px solid var(--line); }
.mix-out { font-size: var(--t-display); font-weight: var(--w-med); text-align: center; word-break: break-word; }

/* 카오모지 메이커 */
.maker-stage { display: grid; place-items: center; padding: 22px 14px; border-radius: var(--r-lg); background: var(--grad-soft); border: 1px solid var(--line); margin: 8px 0; min-height: 78px; }
.maker-out { font-size: 28px; font-weight: 600; text-align: center; word-break: break-word; }
.maker-row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; margin-bottom: 2px; }
.maker-row::-webkit-scrollbar { height: 0; }
.maker-row .chip-opt { flex: 0 0 auto; min-width: 36px; }
/* 밈 결과(이모지 포함 인라인 텍스트) */
.meme-out { font-size: 15px; line-height: 1.5; word-break: break-word; margin: 2px 0; }

/* ── 아트 출력 ── */
.art-out {
  font-family: var(--mono); font-size: 9px; line-height: 1.0; white-space: pre; overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px; margin-top: 12px; max-height: 60vh; box-shadow: var(--shadow-sm); letter-spacing: 0; scroll-margin-top: 72px;
}
.art-out.emoji { font-size: 16px; line-height: 1.05; }
.art-out.empty { min-height: 60px; }
.art-out.empty::before { content: "변환 결과가 여기에 표시돼요"; color: var(--ink-3); font-family: var(--sans); font-size: var(--t-small); }

/* 드롭존 */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 26px 16px; background: var(--surface); font-size: var(--t-body); font-weight: var(--w-bold); color: var(--ink-2); transition: .15s; }
.dropzone.over { border-color: var(--brand); background: var(--pink-soft); }
.dz-emoji { font-size: 34px; }
.dz-sub { font-size: var(--t-caption); font-weight: var(--w-med); color: var(--ink-3); }

/* 그림판 */
.draw-stage { display: grid; place-items: center; margin: 8px 0 4px; }
.draw-canvas { width: 100%; max-width: 340px; aspect-ratio: 1/1; background: #fff; border: 1.5px solid var(--line-2); border-radius: var(--r-lg); touch-action: none; cursor: crosshair; box-shadow: var(--shadow-sm), var(--ring-hi); }

/* 텍대 블록 카드 */
.block-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; margin: 8px 0; box-shadow: var(--shadow-sm), var(--ring-hi); }
.block-name { font-size: var(--t-caption); font-weight: var(--w-bold); color: var(--ink-3); margin-bottom: 4px; }
.block-out { font-family: var(--mono); white-space: pre; overflow-x: auto; font-size: var(--t-small); line-height: 1.35; }

/* ── 보관함 ── */
.saved-body { display: flex; flex-direction: column; gap: 8px; }
.saved-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 8px 6px 12px; box-shadow: var(--shadow-sm), var(--ring-hi); }
.saved-val { flex: 1; border: none; background: transparent; text-align: left; font-size: var(--t-input); padding: 8px 0; overflow-x: auto; white-space: nowrap; }
.saved-val::-webkit-scrollbar { height: 0; }
.saved-acts { display: flex; gap: 2px; }
.saved-act { border: none; background: transparent; width: 36px; height: 44px; border-radius: 10px; font-size: 15px; color: var(--ink-2); transition: transform .12s; }
.saved-act:active { background: var(--surface-3); transform: scale(.9); }

/* 빈 상태(마스코트 + 블롭) */
.empty-box { position: relative; text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty-box::before { content: ""; position: absolute; inset: 26px 30% auto; height: 96px; z-index: 0; background: var(--grad-soft); filter: blur(26px); opacity: .6; border-radius: var(--r-xl); }
.empty-box > * { position: relative; z-index: 1; }
.empty-emoji { font-size: 40px; margin-bottom: 8px; }
.empty-mascot { width: 92px; height: 92px; margin: 0 auto 10px; display: block; }
.empty-box strong { display: block; font-size: var(--t-input); margin-bottom: 4px; }
.empty-box p { font-size: var(--t-small); color: var(--ink-3); }
.empty-note { grid-column: 1 / -1; text-align: center; color: var(--ink-3); padding: 24px; font-size: var(--t-small); }
.counter { font-size: var(--t-small); font-weight: var(--w-bold); color: var(--ink-3); margin-left: auto; align-self: center; }
.counter.warn { color: var(--warn); }

/* 푸터 */
#appfoot { text-align: center; font-size: var(--t-caption); color: var(--ink-3); padding: 8px 16px calc(var(--tab-h) + 16px); display: flex; flex-direction: column; gap: 4px; }
#appfoot a { color: var(--pink-ink); font-weight: var(--w-bold); text-decoration: none; }

/* ── 하단 탭바 ── */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  background: var(--surface-glass); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tab { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: var(--r-md); color: var(--ink-3); font-size: var(--t-caption); font-weight: var(--w-bold); transition: color .18s; }
.tab-ico { font-size: 19px; opacity: .5; transition: transform .22s cubic-bezier(.34,1.56,.64,1), opacity .18s; }
.tab.on { color: var(--pink-ink); background: var(--pink-soft); }
.tab.on .tab-ico { opacity: 1; transform: translateY(-2px) scale(1.12); }
.tab:active .tab-ico { transform: scale(.85); }

/* ── 토스트(둥실 + 양옆 반짝) ── */
#toast-root { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 70px); bottom: auto; display: grid; place-items: center; z-index: 60; pointer-events: none; }
.toast {
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--surface);
  font-size: var(--t-body); font-weight: var(--w-bold); padding: 11px 18px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-pop); backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(-12px) scale(.92); transition: opacity .22s, transform .28s cubic-bezier(.34,1.56,.64,1);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.warn { background: var(--warn); color: #fff; }
.toast::before, .toast::after { content: "✦"; display: inline-block; color: var(--brand-3); margin: 0 3px; font-size: 12px; animation: sparkle .9s ease-in-out infinite; }
.toast::after { animation-delay: .3s; }

/* ── 키프레임 ── */
@keyframes starpop { 0% { transform: scale(1); } 45% { transform: scale(1.45) rotate(8deg); } 70% { transform: scale(.9); } 100% { transform: scale(1); } }
@keyframes sparkle { 0%,100% { opacity: .35; transform: scale(.8) rotate(0); } 50% { opacity: 1; transform: scale(1.25) rotate(20deg); } }
@keyframes shine { 0%,72% { transform: translateX(-120%); } 86%,100% { transform: translateX(120%); } }

/* ── 바텀시트 모달 ── */
.sheet-back { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; background: rgba(30,16,32,.45); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; }
.sheet-back.show { opacity: 1; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; background: var(--bg); background-image: var(--bg-grad); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; transform: translateY(16px); transition: transform .26s cubic-bezier(.34,1.56,.64,1); overflow: hidden; }
.sheet-back.show .sheet { transform: none; }
.sheet-hd { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.sheet-hd strong { font-size: var(--t-title); font-weight: var(--w-black); }
.sheet-x { border: 0; background: var(--surface-3); width: 32px; height: 32px; border-radius: 50%; font-size: 14px; color: var(--ink-2); }
.sheet-body { overflow: auto; padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); }

/* ── 플랫폼 미리보기 목업 ── */
.pv-lead { font-size: var(--t-small); color: var(--ink-2); margin-bottom: 8px; }
.pv-theme { display: inline-flex; gap: 4px; background: var(--surface-3); border-radius: var(--r-pill); padding: 4px; margin-bottom: 10px; }
.pv-tbtn { border: 0; background: transparent; border-radius: var(--r-pill); padding: 6px 12px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.pv-tbtn.on { background: var(--surface); color: var(--pink-ink); box-shadow: var(--shadow-sm); }
.pv-cards { display: flex; flex-direction: column; gap: 12px; }
.pv-card { border-radius: 16px; padding: 14px; box-shadow: var(--shadow-sm); font-family: -apple-system, system-ui, 'Apple SD Gothic Neo', 'Segoe UI', Roboto, sans-serif; }
.pv-ava { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #ffd1e8, #c9bfff); flex: 0 0 auto; }
/* 인스타 */
.pv-ig { background: #fff; color: #111; }
.pv-ig-top { display: flex; align-items: center; gap: 16px; }
.pv-ig-ava { width: 56px; height: 56px; }
.pv-ig-stats { display: flex; gap: 16px; }
.pv-ig-stats span { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: #555; }
.pv-ig-stats b { font-size: 15px; color: #111; }
.pv-ig-name { font-weight: 700; font-size: 14px; margin-top: 8px; }
.pv-ig-bio { font-size: 13px; white-space: pre-line; color: #222; margin-top: 2px; }
.pv-ig-btns { display: flex; gap: 6px; margin-top: 10px; }
.pv-ig-btn { flex: 1; text-align: center; background: #0095f6; color: #fff; font-size: 12px; font-weight: 700; padding: 6px; border-radius: 8px; }
.pv-ig-btn.ghost { background: #efefef; color: #111; }
/* 카카오톡 */
.pv-kakao { background: #b2c7d9; color: #222; }
.pv-kk-friend { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 8px 10px; }
.pv-kk-nick { font-weight: 700; font-size: 14px; }
.pv-kk-chat { margin-top: 10px; }
.pv-kk-line { display: flex; gap: 8px; align-items: flex-start; }
.pv-kk-ava, .pv-kk-ava2 { width: 36px; height: 36px; }
.pv-kk-name { font-size: 12px; color: #3a4a5a; margin-bottom: 3px; }
.pv-kk-bubble { display: inline-block; background: #fff; border-radius: 4px 14px 14px 14px; padding: 8px 11px; font-size: 14px; max-width: 220px; }
/* 디스코드 */
.pv-discord { background: #313338; color: #dbdee1; }
.pv-dc-row { display: flex; gap: 12px; }
.pv-dc-ava { background: linear-gradient(135deg,#5865f2,#9b84ec); }
.pv-dc-name { font-weight: 700; color: #f2c4e1; font-size: 14px; }
.pv-dc-time { font-size: 10px; color: #949ba4; margin-left: 6px; }
.pv-dc-msg { font-size: 14px; margin-top: 2px; }
/* X */
.pv-x { background: #fff; color: #0f1419; }
.pv-x-row { display: flex; gap: 10px; }
.pv-x-head .pv-x-name { font-weight: 700; font-size: 14px; }
.pv-x-handle { color: #536471; font-size: 13px; margin-left: 4px; }
.pv-x-msg { font-size: 14px; margin-top: 2px; }
/* 다크 변형 */
.pv-dark .pv-ig { background: #000; color: #fff; }
.pv-dark .pv-ig-stats span { color: #aaa; } .pv-dark .pv-ig-stats b { color: #fff; } .pv-dark .pv-ig-bio { color: #ddd; } .pv-dark .pv-ig-btn.ghost { background: #262626; color: #fff; }
.pv-dark .pv-kakao { background: #1b232b; color: #e6e6e6; } .pv-dark .pv-kk-friend { background: #2b3640; } .pv-dark .pv-kk-bubble { background: #2b3640; color: #fff; } .pv-dark .pv-kk-name { color: #9bb0c4; }
.pv-dark .pv-x { background: #15202b; color: #f7f9f9; } .pv-dark .pv-x-handle { color: #8b98a5; }
.pv-note { font-size: 12px; font-weight: 700; padding: 10px 12px; border-radius: 12px; margin-top: 12px; }
.pv-note.ok { background: var(--ok-soft); color: var(--ok); }
.pv-note.info { background: var(--mint-soft); color: var(--mint-ink); }
.pv-note.warn { background: var(--warn-soft); color: var(--warn); }

@media (min-width: 600px) { #view { padding-left: 20px; padding-right: 20px; } .sheet-back { align-items: center; } .sheet { border-radius: var(--r-xl); } }
@media (prefers-reduced-motion: reduce) {
  .view, .toast, .fout, .chip, .tbtn, .tab-ico, .brand-mark::after { animation: none !important; transition: none !important; }
  .toast::before, .toast::after, .fout-star[aria-pressed="true"] { animation: none !important; }
}
