/* DearDrawn — 기획 10 "디자인 시스템 제안": 절제된 아이보리 · 딥 퍼플 · 중립색. 채도가 높은 색은 아이의 작품에 양보한다.
   태블릿 가로 먼저, 넉넉한 터치 영역(44px+), 분명한 글씨(Lexend — 읽기 쉬운 글꼴), 제목은 Fraunces. 크레용 장식 · 장난감 같은 단추는 쓰지 않는다. */
:root {
  --ivory: #faf6ee; --paper: #fffdf8; --card: #ffffff; --line: #e8e1d3; --line-2: #d9d0bf;
  --ink: #2a2140; --ink-2: #4a4060; --muted: #776f86; --purple: #4b2f7f; --purple-2: #6c4fb0; --purple-soft: #efe9f8;
  --danger: #b3261e; --ok: #2e7d4f;
  --c-plum: #8e5bb5; --c-coral: #e0765a; --c-teal: #2f9c8f; --c-gold: #d2a032; --c-sky: #4a8fd6; --c-leaf: #6a9c3a;
  --r: 18px; --r-sm: 12px; --shadow: 0 1px 2px rgba(42,33,64,.06), 0 6px 22px rgba(42,33,64,.07);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif; --serif: 'Fraunces', Georgia, serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--ivory); color: var(--ink); font: 400 17px/1.5 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font: 600 30px/1.18 var(--serif); letter-spacing: -.01em; }
h2 { font: 600 21px/1.25 var(--serif); }
p { margin: 0; }
.muted { color: var(--muted); } .tiny { font-size: 13px; line-height: 1.45; }
.lead { font-size: 18px; color: var(--ink-2); }
.app { min-height: 100dvh; padding-bottom: var(--safe-b); }

/* 로고 · 배지 */
.logo { font: 500 24px/1 var(--serif); letter-spacing: -.01em; color: var(--ink); }
.logo b { font-weight: 600; color: var(--purple); }
.logo.sm { font-size: 20px; } .logo.lg { font-size: 34px; }
.soft { display: inline-block; border: 1px solid var(--purple-2); color: var(--purple); background: transparent; border-radius: 999px; padding: 3px 10px; font: 600 11px/1.2 var(--font); letter-spacing: .12em; white-space: nowrap; }

/* 단추 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent; font: 500 16px/1 var(--font); transition: transform .08s, background .15s; text-align: center; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-main { background: var(--purple); color: #fff; }
.btn-main:hover { background: #573893; }
.btn-ghost { background: var(--card); border-color: var(--line-2); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 17px; }
.btn.icon { padding: 0; width: 48px; }
.link { background: none; border: 0; padding: 0; color: var(--purple); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }
.ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); }
.ic:hover { background: rgba(42,33,64,.06); }
.ic.sm { width: 32px; height: 32px; } .ic.sm svg { width: 16px; height: 16px; }
.ic-sp { width: 44px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-size: 15px; }
.chip svg { width: 18px; height: 18px; }
.chip.on { background: var(--purple-soft); border-color: var(--purple-2); color: var(--purple); font-weight: 500; }
.chip.ghost { border-style: dashed; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(42,33,64,.06); gap: 2px; }
.seg > * { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; font-size: 15px; color: var(--ink-2); }
.seg > .on { background: var(--card); color: var(--purple); box-shadow: var(--shadow); font-weight: 500; }
.seg svg { width: 18px; height: 18px; }

/* 입력 */
.field { width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--card); font: 400 17px/1.4 var(--font); color: var(--ink); outline: none; }
.field:focus { border-color: var(--purple-2); box-shadow: 0 0 0 3px rgba(108,79,176,.15); }
textarea.field { resize: vertical; }
.field-l { display: grid; gap: 6px; font-weight: 500; margin: 16px 0 6px; font-size: 15px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; margin: 12px 0; text-align: left; }
.check input { width: 22px; height: 22px; accent-color: var(--purple); flex: none; margin-top: 1px; }
.check.big { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); }
.err { color: var(--danger); font-size: 14px; margin-top: 8px; }
.warn { color: #8a5a00; background: #fff4dc; padding: 10px 14px; border-radius: var(--r-sm); font-size: 15px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(108,79,176,.2); border-top-color: var(--purple-2); animation: spin .8s linear infinite; display: inline-block; }
.btn-main .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { min-height: 70dvh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }

/* 머리줄 */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 8px) 12px 8px; background: rgba(250,246,238,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar h1 { flex: 1; font: 600 19px/1.2 var(--serif); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.khead { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: calc(var(--safe-t) + 10px) 24px 10px; background: rgba(250,246,238,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.ktabs { display: flex; gap: 4px; margin: 0 auto; }
.ktabs a { padding: 10px 18px; border-radius: 999px; font-weight: 500; color: var(--ink-2); font-size: 16px; }
.ktabs a.on { background: var(--purple); color: #fff; }
.kidchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-weight: 500; font-size: 15px; }
.kdot { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font: 600 16px/1 var(--font); background: var(--c-plum); flex: none; border: 0; }
.kdot.xl { width: 104px; height: 104px; font-size: 44px; }
.c-plum { background: var(--c-plum); } .c-coral { background: var(--c-coral); } .c-teal { background: var(--c-teal); } .c-gold { background: var(--c-gold); } .c-sky { background: var(--c-sky); } .c-leaf { background: var(--c-leaf); }

/* 페이지 */
.kpage { max-width: 1180px; margin: 0 auto; padding: 28px 28px 60px; }
.kpage.center { text-align: center; display: grid; justify-items: center; gap: 14px; padding-top: 48px; }
.khi { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.khi h1 { font-size: 28px; }
.timepill { padding: 6px 14px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-size: 14px; font-weight: 500; }
.sec { margin: 34px 0 14px; }
.empty { text-align: center; padding: 56px 16px; display: grid; gap: 10px; justify-items: center; color: var(--ink-2); }
.empty h3 { font: 600 22px/1.2 var(--serif); color: var(--ink); }
.hint { color: var(--ink-2); font-size: 16px; text-align: center; margin: 4px auto 12px; max-width: 760px; }

/* 처음 */
.welcome { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 40px; max-width: 1180px; margin: 0 auto; padding: calc(var(--safe-t) + 32px) 40px 40px; }
.welcome-art { position: relative; aspect-ratio: 4 / 3.4; border-radius: 28px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; place-items: center; overflow: hidden; }
.welcome-art img { width: 70%; }
.welcome-art .bubble { position: absolute; top: 9%; right: 7%; max-width: 46%; background: var(--card); border: 1px solid var(--line); padding: 12px 16px; border-radius: 18px 18px 18px 4px; font-size: 16px; box-shadow: var(--shadow); }
.welcome-copy { display: grid; gap: 16px; justify-items: start; }
.welcome-copy h1 { font-size: 46px; }
.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; color: var(--ink-2); }
.ticks li { padding-left: 28px; position: relative; }
.ticks li::before { content: ''; position: absolute; left: 4px; top: 8px; width: 12px; height: 7px; border-left: 2px solid var(--purple-2); border-bottom: 2px solid var(--purple-2); transform: rotate(-45deg); }

/* 보호자 처음 설정 */
.setup { max-width: 860px; margin: 0 auto; padding: calc(var(--safe-t) + 28px) 28px 60px; display: grid; gap: 14px; }
.setup.narrow { max-width: 520px; }
.setup.center { text-align: center; justify-items: center; padding-top: 60px; }
.setup .seg { justify-self: start; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.steps b { font-weight: 500; font-size: 13px; padding: 5px 12px; border-radius: 999px; background: rgba(42,33,64,.06); color: var(--muted); }
.steps b.on { background: var(--purple); color: #fff; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0; }
.facts > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.facts h3 { font: 600 16px/1.3 var(--font); margin-bottom: 6px; color: var(--purple); }
.facts p { font-size: 15px; color: var(--ink-2); }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors .kdot { width: 44px; height: 44px; }
.colors .kdot.on { outline: 3px solid var(--ink); outline-offset: 3px; }
.seg#kAge > *, .seg#ekAge > * { min-height: 46px; padding: 0 24px; font-size: 16px; }
.done-art { display: flex; gap: 16px; margin-bottom: 8px; }

/* PIN */
.pin { display: grid; gap: 12px; justify-items: center; text-align: center; }
.pin > svg { width: 34px; height: 34px; color: var(--purple); }
.pin-dots { display: flex; gap: 12px; min-height: 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--purple-2); }
.pin-dots i.on { background: var(--purple-2); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 10px; }
.pin-pad button { height: 64px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font: 500 24px/1 var(--font); }
.pin-pad button:active { background: var(--purple-soft); }

/* Who's playing? */
.who { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 28px; padding: calc(var(--safe-t) + 24px) 24px 40px; position: relative; }
.who-top { display: grid; justify-items: center; gap: 8px; }
.who h1 { font-size: 40px; }
.who-grid { display: flex; gap: 28px; flex-wrap: wrap; justify-content: center; }
.who-card { display: grid; justify-items: center; gap: 12px; padding: 26px 30px; border-radius: 28px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); min-width: 200px; font-size: 22px; }
.who-card:hover { border-color: var(--purple-2); }
.grownups { position: absolute; right: 22px; bottom: calc(var(--safe-b) + 20px); display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--card); border-radius: 999px; padding: 10px 16px; font-size: 14px; color: var(--muted); }
.grownups svg { width: 18px; height: 18px; }

/* My Friends */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.fcard { background: var(--card); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; display: grid; box-shadow: var(--shadow); }
.fcard-art { position: relative; display: block; aspect-ratio: 5 / 4; background: var(--paper) linear-gradient(180deg, #fffdf8, #f5efe2); }
.fcard-art img { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); object-fit: contain; filter: drop-shadow(0 6px 10px rgba(42,33,64,.15)); }
.fcard-body { padding: 14px 16px 16px; display: grid; gap: 4px; }
.fcard-body h2 { font-size: 22px; }
.traits { color: var(--purple); font-size: 14px; font-weight: 500; }
.last { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard-go { display: flex; gap: 8px; margin-top: 8px; }
.fcard-go .btn-main { flex: 1; }
.fcard.new { place-content: center; justify-items: center; gap: 8px; text-align: center; border: 2px dashed var(--line-2); background: transparent; box-shadow: none; color: var(--purple); min-height: 300px; padding: 20px; }
.fcard.new svg { width: 40px; height: 40px; }
.fcard.new b { font: 600 20px/1.2 var(--serif); }
.fcard.new span { color: var(--muted); font-size: 14px; }
.first { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: 18px; justify-content: center; margin: 12px 0; }
.choice { display: grid; justify-items: center; gap: 8px; padding: 34px 20px; border-radius: 26px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: center; cursor: pointer; }
.choice:hover { border-color: var(--purple-2); }
.choice svg { width: 46px; height: 46px; color: var(--purple); stroke-width: 1.5; }
.choice b { font: 600 22px/1.2 var(--serif); }
.choice span { color: var(--muted); font-size: 15px; }
.choice.off { opacity: .55; cursor: default; }
.srow, .slist { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.scard { display: flex; gap: 14px; padding: 14px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); align-items: flex-start; }
.scard-f { width: 72px; height: 72px; object-fit: contain; flex: none; background: var(--paper); border-radius: 14px; padding: 6px; }
.scard b { display: block; font: 600 18px/1.25 var(--serif); }
.scard span { display: block; color: var(--muted); font-size: 13px; margin: 2px 0 4px; }
.scard p { font-size: 14px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 그리기 */
.drawpage { max-width: 1240px; margin: 0 auto; padding: 12px 18px 24px; }
.pad { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.pad-tools { display: grid; gap: 12px; align-content: start; }
.pad-group { display: grid; grid-template-columns: repeat(2, 46px); gap: 6px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.pad-colors { grid-template-columns: repeat(3, 34px); }
.tl, .sz { width: 46px; height: 46px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; }
.tl.on, .sz.on { background: var(--purple-soft); color: var(--purple); }
.sz i { display: block; border-radius: 50%; background: var(--ink); }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); background: var(--c); }
.sw.on { outline: 3px solid var(--purple); outline-offset: 2px; }
.pad-wrap { justify-self: center; width: min(100%, calc((100dvh - 200px) * 4 / 3)); background: #fff; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; line-height: 0; }
.pad-canvas { width: 100%; height: auto; aspect-ratio: 4 / 3; touch-action: none; display: block; cursor: crosshair; }

/* 사진 */
.photopage { max-width: 1100px; margin: 0 auto; padding: 14px 18px 24px; }
.photo { display: grid; gap: 12px; }
.photo-tools { display: flex; gap: 10px; justify-content: center; }
.photo-stage { position: relative; height: calc(100dvh - 230px); min-height: 300px; display: grid; place-items: center; }
.photo-stage canvas { border-radius: 8px; box-shadow: var(--shadow); }
.crop { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(42,33,64,.45); touch-action: none; cursor: move; }
.crop i { position: absolute; width: 30px; height: 30px; border: 4px solid #fff; }
.crop i[data-h=nw] { left: -6px; top: -6px; border-right: 0; border-bottom: 0; cursor: nwse-resize; }
.crop i[data-h=ne] { right: -6px; top: -6px; border-left: 0; border-bottom: 0; cursor: nesw-resize; }
.crop i[data-h=sw] { left: -6px; bottom: -6px; border-right: 0; border-top: 0; cursor: nesw-resize; }
.crop i[data-h=se] { right: -6px; bottom: -6px; border-left: 0; border-top: 0; cursor: nwse-resize; }

/* 친구 고르기 */
.pickpage { max-width: 1100px; margin: 0 auto; padding: 12px 18px 24px; display: grid; gap: 10px; justify-items: center; }
.cut { display: grid; gap: 12px; justify-items: center; width: 100%; }
.cut-stage { width: 100%; display: grid; place-items: center; background: repeating-conic-gradient(#f1ece2 0 25%, #fbf8f2 0 50%) 0 0 / 22px 22px; border-radius: 18px; border: 1px solid var(--line); padding: 10px; }
.cut-stage canvas { max-width: 100%; max-height: calc(100dvh - 260px); touch-action: none; display: block; cursor: crosshair; }
.cut-fix { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.cut-size { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.cut-size input { width: 140px; accent-color: var(--purple); }
.pick-actions { min-height: 40px; }

/* 친구 설정 */
.meet { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 1180px; margin: 0 auto; padding: 20px 28px 50px; align-items: start; }
.meet-art { position: sticky; top: 80px; aspect-ratio: 4 / 3; border-radius: 26px; overflow: hidden; display: grid; place-items: center; background: var(--paper) var(--bg) center / contain no-repeat; border: 1px solid var(--line); }
.meet-tint { position: absolute; inset: 0; background: rgba(250,246,238,.72); backdrop-filter: blur(3px); }
.meet-art .sprite { position: relative; max-width: 72%; max-height: 82%; }
.meet-form .btn-lg { width: 100%; margin-top: 22px; }
.meet-wait { display: grid; justify-items: center; gap: 14px; }
.meet-wait img { max-height: 46dvh; }
.chip.voice svg { width: 16px; height: 16px; }

/* 친구 그림 (전경) — 기획 04: 작은 등장/퇴장 효과만 */
.sprite { filter: drop-shadow(0 10px 18px rgba(42,33,64,.18)); transform-origin: 50% 90%; transition: transform .35s ease, opacity .35s; user-select: none; -webkit-user-drag: none; }
.sprite.pop { animation: pop .55s cubic-bezier(.3,1.5,.6,1); }
.sprite.born { animation: born .9s cubic-bezier(.3,1.4,.6,1); }
.sprite.talk { animation: bob 1.1s ease-in-out infinite; }
.sprite.small { transform: scale(.72); opacity: .8; }
.sprite.listen { transform: scale(.94); }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes born { 0% { transform: scale(.4) translateY(30px); opacity: 0; } 70% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-6px) rotate(-1.2deg); } 65% { transform: translateY(-2px) rotate(1deg); } }
@media (prefers-reduced-motion: reduce) { .sprite.pop, .sprite.born, .sprite.talk { animation: none; } }

/* 톤다운 배경 — 아이의 원본 그림. 빈 곳은 채우지 않고 아이보리로 (기획 04) */
.stage-bg { position: absolute; inset: 0; background: var(--ivory) var(--bg) center / contain no-repeat; filter: saturate(.6) contrast(.85) blur(1.5px); }
.stage-tint { position: absolute; inset: 0; background: rgba(250,246,238,var(--tone, .55)); }

/* 처음 만남 */
.hello { position: relative; min-height: 100dvh; display: grid; place-items: center; overflow: hidden; }
.hello-in { position: relative; display: grid; justify-items: center; gap: 12px; text-align: center; padding: 24px; }
.hello-in .sprite { max-height: 42dvh; max-width: 70vw; }
.hello-in h1 { font-size: 42px; }

/* Text Chat · Voice Chat */
.chat, .vchat { position: relative; height: 100dvh; display: grid; grid-template-columns: 1fr minmax(380px, 44%); grid-template-rows: auto 1fr; overflow: hidden; background: var(--ivory); }
.stage { position: relative; grid-row: 1 / 3; grid-column: 1 / 2; overflow: hidden; display: grid; place-items: center; }
.stage .sprite { position: relative; max-width: 78%; max-height: 72%; margin-top: 40px; }
.vchat .stage { grid-column: 1 / 3; }
.vchat .stage .sprite.big { max-height: 56%; margin-top: -10dvh; }
.chat-top { position: relative; z-index: 3; grid-column: 1 / 3; grid-row: 1; display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 10px) 14px 10px; }
.who-mini { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; background: rgba(255,255,255,.85); border-radius: 999px; border: 1px solid var(--line); font-size: 16px; margin-right: auto; }
.who-mini img { width: 34px; height: 34px; object-fit: contain; border-radius: 50%; background: var(--paper); }
.chat-top .seg { background: rgba(255,255,255,.75); }
.chat-top .ic { background: rgba(255,255,255,.85); border: 1px solid var(--line); }
.convo { position: relative; z-index: 2; grid-column: 2; grid-row: 2; display: grid; grid-template-rows: 1fr auto auto; min-height: 0; margin: 0 14px calc(var(--safe-b) + 14px) 0; background: rgba(255,253,248,.9); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.msgs { overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 12px 16px; border-radius: 20px; font-size: 18px; line-height: 1.45; position: relative; }
.msg.friend { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; padding-right: 46px; }
.msg.kid { align-self: flex-end; background: var(--purple); color: #fff; border-bottom-right-radius: 6px; }
.msg-img { display: block; max-height: 180px; border-radius: 12px; margin-bottom: 6px; background: #fff; }
.say-again { position: absolute; right: 6px; top: 6px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--purple-2); display: grid; place-items: center; }
.say-again svg { width: 18px; height: 18px; }
.drawask { margin-top: 10px; }
.msg.typing { display: inline-flex; gap: 5px; padding: 16px 18px; }
.msg.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--purple-2); opacity: .4; animation: dots 1.2s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .15s; } .msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: .9; transform: translateY(-3px); } }
.choices { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 8px; }
.choices:empty { display: none; }
.composer { display: flex; align-items: center; gap: 6px; padding: 10px; border-top: 1px solid var(--line); background: var(--card); }
.composer .field { min-height: 50px; border-radius: 999px; }
.composer .att { color: var(--purple); flex: none; cursor: pointer; }
.send { width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--purple); color: #fff; display: grid; place-items: center; flex: none; }

.vpanel { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 22px); transform: translateX(-50%); z-index: 3; width: min(720px, calc(100% - 32px)); display: grid; gap: 14px; justify-items: center; text-align: center; }
.caption { min-height: 28px; max-width: 640px; font: 500 22px/1.4 var(--font); color: var(--ink); background: rgba(255,253,248,.88); padding: 12px 20px; border-radius: 20px; border: 1px solid var(--line); }
.caption:empty { visibility: hidden; }
.vstate { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink-2); background: rgba(255,255,255,.8); padding: 8px 16px; border-radius: 999px; }
.vstate i { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.vstate.s-listening i { background: var(--danger); animation: pulse 1s infinite; }
.vstate.s-thinking i { background: var(--c-gold); animation: pulse 1s infinite; }
.vstate.s-talking i { background: var(--ok); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: .5; } }
.holdbtn { width: 168px; height: 168px; border-radius: 50%; border: 0; background: var(--purple); color: #fff; display: grid; place-content: center; justify-items: center; gap: 6px; font: 600 17px/1.2 var(--font); box-shadow: 0 10px 30px rgba(75,47,127,.35); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.holdbtn svg { width: 54px; height: 54px; }
.holdbtn.on { background: var(--danger); transform: scale(1.06); box-shadow: 0 0 0 14px rgba(179,38,30,.15), 0 10px 30px rgba(179,38,30,.35); }
.holdbtn[disabled] { opacity: .5; }
.holdbtn span { max-width: 130px; }
.live { min-height: 24px; color: var(--ink-2); font-size: 17px; }
.heard { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); width: 100%; }
.heard p { font: 500 22px/1.4 var(--font); }
.heard-go { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 26px; display: grid; gap: 14px; justify-items: center; box-shadow: var(--shadow); max-width: 560px; }

/* 친구 페이지 */
.fpage { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 1180px; margin: 0 auto; padding: 20px 28px 50px; align-items: start; }
.fpage-art { position: relative; aspect-ratio: 4 / 3; border-radius: 26px; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line); }
.fpage-art .sprite { position: relative; max-width: 72%; max-height: 82%; }
.fpage-info { display: grid; gap: 10px; }
.about { font-size: 18px; color: var(--ink-2); font-style: italic; }
.fpage-go, .fpage-more { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.mem { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mem li { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; font-size: 16px; }
.mem li span { flex: 1; }

/* 이야기책 */
.book { padding: 28px; display: grid; justify-items: center; }
.book-page { max-width: 760px; width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 34px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.book-f { width: 160px; height: 160px; object-fit: contain; }
.kicker { color: var(--purple); font-weight: 500; font-size: 14px; letter-spacing: .02em; }
.book-page h1 { font-size: 36px; }
.book-text { font: 400 21px/1.6 var(--serif); color: var(--ink-2); text-align: left; }
.props { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.props img { width: 130px; height: 100px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }

/* 그림 모음 */
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 18px; }
.gcard { border: 1px solid var(--line); background: var(--card); border-radius: 18px; padding: 8px; display: grid; gap: 6px; text-align: left; }
.gcard img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 12px; }
.gcard span { font-size: 14px; color: var(--ink-2); padding: 0 4px 2px; }
.orig { display: block; width: 100%; max-height: 70dvh; object-fit: contain; background: #fff; border-radius: 12px; border: 1px solid var(--line); margin-top: 8px; }

/* 보호자 */
.bar.grown h1 { text-align: left; padding-left: 4px; }
.parent { max-width: 1180px; margin: 0 auto; padding: 22px 28px 60px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.pcol { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.pcol h2 { font-size: 20px; margin-top: 8px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 12px; }
.pcard-h { display: flex; align-items: center; gap: 12px; }
.pcard-h > div { flex: 1; display: grid; }
.pcard-h b { font-size: 18px; }
.pcard-h .muted { font-size: 14px; }
.prow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.prow > span { display: grid; font-weight: 500; }
.prow small { font-weight: 400; color: var(--muted); font-size: 13px; }
.prow select { min-height: 42px; border-radius: 10px; border: 1px solid var(--line-2); padding: 0 10px; font: inherit; font-size: 15px; background: var(--paper); }
.toggle { appearance: none; width: 52px; height: 30px; border-radius: 999px; background: var(--line-2); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s; }
.toggle:checked { background: var(--purple-2); } .toggle:checked::after { left: 25px; }
.pmem summary { cursor: pointer; font-weight: 500; color: var(--purple); padding: 6px 0; }
.pmem-f { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; }
.pmem-f img { width: 32px; height: 32px; object-fit: contain; }
.pdel { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.danger { color: var(--danger) !important; }
.row-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 6px; border: 0; background: none; text-align: left; border-radius: 12px; }
.row-btn:hover { background: rgba(42,33,64,.04); }
.row-btn > span { display: grid; }
.row-btn b { font-weight: 500; }
.row-btn small { color: var(--muted); font-size: 13px; }
.row-btn svg { color: var(--purple-2); }
.soft-note { font-size: 13px; color: var(--muted); line-height: 1.5; }
.about { max-width: 820px; }
section.about { margin: 0 auto; padding: 28px 28px 60px; display: grid; gap: 12px; font-style: normal; font-size: 17px; color: var(--ink); }
section.about h2 { margin-top: 14px; font-size: 20px; }
section.about p { color: var(--ink-2); }

/* 시트 · 창 */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(42,33,64,.42); display: grid; place-items: center; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; background: var(--paper); border-radius: 26px; padding: 30px 26px 24px; display: grid; gap: 12px; box-shadow: 0 20px 60px rgba(42,33,64,.3); }
.overlay.wide .sheet { width: min(900px, 100%); }
.overlay.draw-ov .sheet { width: min(1000px, 100%); }
.draw-ov .pad-wrap { width: min(100%, calc((100dvh - 300px) * 4 / 3)); }
.sheet h2 { padding-right: 30px; }
.sheet .btn { width: 100%; }
.sheet-x { position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(42,33,64,.06); display: grid; place-items: center; }
.gbox { display: grid; gap: 8px; justify-items: center; min-height: 48px; }
.gbox .btn { width: 100%; }
.care { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 6px 4px; }
.care > svg { width: 40px; height: 40px; color: var(--purple-2); }
.care p { font-size: 18px; color: var(--ink-2); }
.storydone { display: grid; gap: 12px; justify-items: center; text-align: center; }
.storydone > svg { width: 40px; height: 40px; color: var(--purple-2); }
.storydone h2 { font-size: 28px; padding: 0; }
.storydone p { color: var(--ink-2); }
.fb-stars { display: flex; gap: 6px; }
.fb-stars button { border: 0; background: none; font-size: 30px; color: var(--line-2); padding: 0 2px; }
.fb-stars button.on { color: var(--c-gold); }

/* 입장 암호 · 18세 (시리즈 공통) */
.dw-gate { position: fixed; inset: 0; z-index: 80; background: var(--ivory); display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.gate-card { width: min(440px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: 28px; padding: 36px 28px; box-shadow: var(--shadow); }
.gate-card .logo { font-size: 32px; }
.gate-card .slogan { font: 500 italic 19px/1.3 var(--serif); color: var(--purple); }
.gate-card p { color: var(--ink-2); font-size: 16px; }
.gate-card .btn, .gate-card .field { width: 100%; }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 24px); transform: translate(-50%, 20px); max-width: min(480px, 92vw); padding: 14px 20px; border-radius: 16px; background: var(--ink); color: #fff; font-size: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: all .25s; z-index: 90; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 자매품 (보호자 화면에만 — 다른 서비스는 18세 이상) */
.sister { margin-top: 10px; }
.sister-title { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.sister-title small { font-size: 12px; }
.sister-home { text-decoration: underline; }
.sister-row { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.sister-row::-webkit-scrollbar { display: none; }
.sister-card { flex: none; width: 128px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.sister-icon { width: 40px; height: 40px; border-radius: 10px; margin-bottom: 8px; }
.sister-name { display: block; font-weight: 500; font-size: 14px; }
.sister-tag { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }

/* ── 세로 태블릿 · 휴대폰 ── */
@media (max-width: 900px) {
  .welcome { grid-template-columns: 1fr; padding: calc(var(--safe-t) + 20px) 20px 32px; gap: 24px; }
  .welcome-copy h1 { font-size: 36px; }
  .meet, .fpage, .parent { grid-template-columns: 1fr; padding: 16px 16px 40px; }
  .meet-art { position: relative; top: 0; }
  .chat { grid-template-columns: 1fr; grid-template-rows: auto 34dvh 1fr; }
  .chat .stage { grid-row: 1 / 3; grid-column: 1; }
  .chat .stage .sprite { max-height: 64%; margin-top: 56px; }
  .chat-top { grid-column: 1; }
  .convo { grid-column: 1; grid-row: 3; margin: 0 10px calc(var(--safe-b) + 10px); }
  .facts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 26px; }
  .khead { flex-wrap: wrap; gap: 8px; padding: calc(var(--safe-t) + 8px) 16px 8px; }
  .ktabs { order: 3; width: 100%; justify-content: space-between; margin: 0; }
  .ktabs a { padding: 8px 12px; font-size: 14px; }
  .kidchip { margin-left: auto; }
  .kpage { padding: 18px 16px 40px; }
  .khi h1 { font-size: 23px; }
  .first { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .fcard-body h2 { font-size: 18px; }
  .fcard-go { flex-wrap: wrap; }
  .srow, .slist { grid-template-columns: 1fr; }
  .who h1 { font-size: 32px; }
  .who-card { min-width: 140px; padding: 20px; }
  .kdot.xl { width: 80px; height: 80px; font-size: 34px; }
  .pad { grid-template-columns: 1fr; }
  .pad-tools { grid-auto-flow: column; overflow-x: auto; grid-template-columns: none; }
  .pad-group { grid-auto-flow: column; grid-template-columns: none; grid-template-rows: repeat(2, 40px); }
  .pad-colors { grid-template-rows: repeat(2, 30px); }
  .tl, .sz { width: 40px; height: 40px; } .sw { width: 30px; height: 30px; }
  .msg { font-size: 16px; }
  .chat-top .seg span { display: none; }
  .holdbtn { width: 140px; height: 140px; }
  .caption { font-size: 18px; }
  .book { padding: 16px; } .book-page { padding: 22px 18px; } .book-text { font-size: 18px; }
  .pin-pad { grid-template-columns: repeat(3, 68px); }
  .ggrid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) { .fgrid { grid-template-columns: 1fr; } }
