/* 정담 디자인 시스템
   - 따뜻한 오프화이트 + 잉크 블랙 + 감빛(persimmon) 포인트
   - 큰 글씨·넓은 터치 영역을 기본으로 하되, '어르신용'처럼 보이지 않는 모던한 카드 레이아웃 */
:root {
  --fs: 1; /* 글자 크기 배율 (설정에서 변경) */
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --ink: #17171b;
  --ink-2: #3a3a42;
  --muted: #6e6c72;
  --line: #e4e0d7;
  --accent: #e8602c;
  --accent-soft: #ffe7dc;
  --sage: #2f6b5b;
  --sage-soft: #dcefe7;
  --danger: #c8322b;
  --danger-soft: #fde4e1;
  --radius: 28px;
  --radius-sm: 18px;
  --shadow: 0 1px 2px rgba(23, 23, 27, 0.04), 0 8px 24px rgba(23, 23, 27, 0.06);
  --nav-h: 84px;
  font-size: calc(19px * var(--fs));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 1.15em; height: 1.15em; flex: none; vertical-align: middle; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { padding: 20px 20px calc(var(--nav-h) + 28px); animation: fade 0.28s ease; }
.screen.no-nav { padding-bottom: 32px; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 타이포 */
.eyebrow { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
h1, .h1 { font-size: 1.75rem; line-height: 1.3; font-weight: 750; margin: 4px 0 0; letter-spacing: -0.03em; }
h2, .h2 { font-size: 1.25rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.lead { font-size: 1.05rem; color: var(--ink-2); margin: 8px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* 상단 바 */
.topbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 20px; }
.topbar .title { font-size: 1.15rem; font-weight: 700; flex: 1; }
.icon-btn {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); flex: none;
}
.icon-btn svg { width: 24px; height: 24px; }

/* 카드 */
.card { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 14px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 4px 12px; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; padding: 0 26px; border-radius: 999px; font-weight: 700; font-size: 1.05rem;
  background: var(--ink); color: #fff; transition: transform 0.12s ease, opacity 0.12s;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 24px; height: 24px; }
.btn.block { width: 100%; }
.btn.accent { background: var(--accent); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.line { background: transparent; box-shadow: inset 0 0 0 2px var(--line); color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn.sm { min-height: 46px; padding: 0 18px; font-size: 0.92rem; }
.btn[disabled] { opacity: 0.4; }

/* 아바타 */
.orb {
  --c1: #ff8a5b; --c2: #ffc46b;
  width: 64px; height: 64px; border-radius: 50%; flex: none; position: relative;
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.75), transparent 38%), linear-gradient(140deg, var(--c1), var(--c2));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.3rem;
  box-shadow: 0 10px 24px -10px var(--c1);
}
.orb.xl { width: 128px; height: 128px; font-size: 2.4rem; }
.orb.sm { width: 44px; height: 44px; font-size: 1rem; }
.orb.speaking::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid var(--c1); opacity: .5; animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse { from { transform: scale(.92); opacity: .6; } to { transform: scale(1.2); opacity: 0; } }

/* 홈 */
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 8px; }
.hero {
  margin-top: 22px; border-radius: 34px; padding: 26px; color: #fff; position: relative; overflow: hidden;
  background: var(--ink);
}
.hero::before {
  content: ""; position: absolute; width: 280px; height: 280px; right: -90px; top: -110px; border-radius: 50%;
  background: radial-gradient(circle, var(--hero-glow, #e8602c) 0%, transparent 70%); opacity: .55;
}
.hero .row { display: flex; align-items: center; gap: 16px; position: relative; }
.hero .who { font-size: 0.9rem; opacity: .7; }
.hero .name { font-size: 1.3rem; font-weight: 750; }
.hero .bubble {
  position: relative; margin: 20px 0 22px; padding: 16px 18px; border-radius: 22px 22px 22px 6px;
  background: rgba(255,255,255,.1); font-size: 1.08rem; line-height: 1.5;
}
.hero .btn { background: #fff; color: var(--ink); position: relative; }

.checkins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check {
  background: var(--surface); border-radius: var(--radius-sm); padding: 16px 10px 14px; text-align: center;
  box-shadow: var(--shadow); font-weight: 650; font-size: 0.95rem; display: grid; gap: 6px; justify-items: center;
}
.check .dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.check .dot svg { width: 22px; height: 22px; }
.check.done { background: var(--sage-soft); color: var(--sage); }
.check.done .dot { background: var(--sage); color: #fff; }

.bento { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: var(--surface); border-radius: var(--radius); padding: 20px; min-height: 150px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: space-between; text-align: left;
}
.tile .ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); }
.tile .ic svg { width: 26px; height: 26px; }
.tile b { font-size: 1.1rem; display: block; margin-top: 14px; }
.tile span { font-size: 0.85rem; color: var(--muted); }
.tile.wide { grid-column: span 2; min-height: 0; flex-direction: row; align-items: center; gap: 16px; justify-content: flex-start; }
.tile.wide b { margin-top: 0; }
.tile.memoir { background: linear-gradient(150deg, #ffe2d3, #fff3ea); }
.tile.memoir .ic { background: var(--accent); color: #fff; }
.tile.family .ic { background: var(--sage-soft); color: var(--sage); }
.tile.game .ic { background: #e6ebff; color: #3d55c9; }
.tile.notes .ic { background: #f6e8ff; color: #8a3fc2; }

.notice {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: #7a2c0c; font-size: 0.95rem;
}
.notice svg { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.notice.sage { background: var(--sage-soft); color: #1d4a3e; }
.notice.danger { background: var(--danger-soft); color: #7d1611; }
.notice b { display: block; font-size: 1rem; margin-bottom: 2px; }
.notice .btn { margin-top: 12px; }

/* 하단 내비 */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 8px 10px env(safe-area-inset-bottom);
  background: rgba(246, 244, 239, 0.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr);
}
.nav a { display: grid; justify-items: center; align-content: center; gap: 4px; font-size: 0.78rem; font-weight: 650; color: var(--muted); border-radius: 18px; }
.nav a svg { width: 28px; height: 28px; }
.nav a.on { color: var(--ink); }
.nav a.on .pill { background: var(--ink); color: #fff; }
.nav .pill { width: 56px; height: 34px; border-radius: 999px; display: grid; place-items: center; }

/* 대화 */
.chat { display: flex; flex-direction: column; height: 100dvh; }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: rgba(246,244,239,.9);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.chat-head .meta { flex: 1; min-width: 0; }
.chat-head .meta b { display: block; font-size: 1.08rem; line-height: 1.3; }
.chat-head .meta .badges { display: flex; gap: 6px; margin-top: 2px; }
.badge { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.chat-body { flex: 1; overflow-y: auto; padding: 20px 16px 8px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 86%; padding: 15px 18px; border-radius: 24px; font-size: 1.08rem; line-height: 1.55; white-space: pre-wrap; }
.msg.fresh { animation: fade .25s ease; }
.msg.ai { background: var(--surface); border-bottom-left-radius: 8px; box-shadow: var(--shadow); align-self: flex-start; }
.msg.user { background: var(--ink); color: #fff; border-bottom-right-radius: 8px; align-self: flex-end; }
.msg .replay { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 0.82rem; font-weight: 650; color: var(--muted); }
.msg .replay svg { width: 18px; height: 18px; }
.typing { display: inline-flex; gap: 6px; padding: 20px 22px; }
.typing i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.saved-chip { display: inline-flex; align-items: center; gap: 6px; align-self: center; font-size: 0.8rem; font-weight: 650; color: var(--sage); background: var(--sage-soft); padding: 6px 14px; border-radius: 999px; }
.chat-foot { padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.suggest { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.suggest button { flex: none; padding: 12px 18px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; font-size: 0.95rem; }
.composer { display: flex; align-items: center; gap: 10px; }
.mic {
  width: 84px; height: 84px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
  box-shadow: 0 14px 30px -12px var(--accent); flex: none; position: relative; transition: transform .15s;
}
.mic svg { width: 36px; height: 36px; }
.mic.listening { background: var(--danger); transform: scale(1.06); }
.mic.listening::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid var(--danger); opacity: .4; animation: pulse 1.2s infinite; }
.composer.voice { justify-content: center; position: relative; }
.composer.voice .side { position: absolute; right: 0; }
.composer .field { min-width: 0;
  flex: 1; min-height: 60px; border-radius: 30px; border: 0; background: var(--surface); padding: 0 22px;
  box-shadow: inset 0 0 0 1.5px var(--line); font-size: 1.05rem;
}
.composer .send { width: 60px; height: 60px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.composer .send svg { width: 26px; height: 26px; }
.hint { text-align: center; font-size: 0.85rem; color: var(--muted); margin-top: 8px; min-height: 1.3em; }

/* 목록 */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list .item { display: flex; align-items: center; gap: 14px; padding: 18px 20px; width: 100%; text-align: left; }
.list .item + .item { border-top: 1px solid var(--line); }
.list .item .grow { flex: 1; min-width: 0; }
.list .item .chev { color: var(--muted); width: 22px; height: 22px; flex: none; }
.tag { font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 16px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; font-size: 0.92rem; }
.chip.on { background: var(--ink); color: #fff; box-shadow: none; }

/* 회고록 */
.progress { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.book {
  background: #fffdf8; border-radius: 10px 28px 28px 10px; padding: 32px 26px; box-shadow: var(--shadow), inset 6px 0 0 #f0e6d6;
  font-family: "Pretendard Variable", serif;
}
.book h3 { font-size: 1.15rem; margin: 24px 0 8px; color: var(--accent); }
.book p { margin: 0 0 12px; line-height: 1.8; }

/* 폼 */
.field-label { display: block; font-weight: 700; margin: 22px 0 10px; }
.input {
  width: 100%; min-height: 62px; border-radius: var(--radius-sm); border: 0; background: var(--surface); padding: 0 20px;
  box-shadow: inset 0 0 0 1.5px var(--line); font-size: 1.1rem;
}
textarea.input { padding: 16px 20px; min-height: 120px; resize: vertical; }
.input:focus { outline: none; box-shadow: inset 0 0 0 2.5px var(--ink); }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius-sm); background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line); text-align: left; width: 100%;
}
.option.on { box-shadow: inset 0 0 0 3px var(--ink); }
.option .grow { flex: 1; }
.option b { display: block; font-size: 1.05rem; }
.option span { font-size: 0.88rem; color: var(--muted); }
.radio { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line); flex: none; }
.option.on .radio { box-shadow: inset 0 0 0 8px var(--ink); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); padding: 5px; border-radius: 999px; gap: 4px; }
.seg button { min-height: 50px; border-radius: 999px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.switch { width: 58px; height: 34px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.switch.on { background: var(--sage); }
.switch.on::after { transform: translateX(24px); }

/* 온보딩 */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; padding: 28px 22px 32px; }
.welcome .grow { flex: 1; }
.steps { display: flex; gap: 6px; margin-bottom: 28px; }
.steps i { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.steps i.on { background: var(--ink); }
.splash { display: grid; place-items: center; text-align: center; gap: 10px; padding-top: 12vh; }
.splash .logo { width: 96px; height: 96px; border-radius: 30px; }
.splash h1 { font-size: 2.2rem; }
.char-grid { display: grid; gap: 12px; }
.char {
  display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: var(--radius); background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line); text-align: left; width: 100%;
}
.char.on { box-shadow: inset 0 0 0 3px var(--ink); }
.char b { font-size: 1.1rem; } .char .role { font-size: 0.85rem; font-weight: 700; color: var(--accent); }
.char p { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }

/* 가족 요약 */
.summary-mood { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; padding: 8px 14px; border-radius: 999px; background: var(--sage-soft); color: var(--sage); }
.summary-mood.low { background: var(--accent-soft); color: var(--accent); }
.summary-mood.crisis { background: var(--danger-soft); color: var(--danger); }
.summary ul { margin: 8px 0 0; padding-left: 20px; } .summary li { margin: 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 14px 22px; border-radius: 999px; font-weight: 650; box-shadow: var(--shadow);
  animation: fade .2s ease;
}
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; opacity: .5; }

@media print {
  .nav, .topbar, .no-print { display: none !important; }
  body { background: #fff; } .book { box-shadow: none; }
}
.tile-ic { width: 44px; text-align: center; flex: none; }

/* 로그인·가입 */
.btn.kakao { background: #fee500; color: rgba(0, 0, 0, 0.85); }
.btn.kakao[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.divider { display: flex; align-items: center; gap: 12px; margin: 26px 0 6px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.check-box { width: 28px; height: 28px; border-radius: 9px; box-shadow: inset 0 0 0 2px var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.check-box svg { width: 18px; height: 18px; }
.check-box.on { background: var(--ink); color: #fff; box-shadow: none; }
.consent-row { display: flex; align-items: center; gap: 14px; flex: 1; text-align: left; font-size: 0.95rem; }
.consent .item { padding: 14px 18px; }

/* 말벗 만들기·둘러보기 */
.swatch { width: 44px; height: 44px; border-radius: 50%; box-shadow: inset 0 0 0 3px transparent; }
.swatch.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--ink); }
a.char { color: inherit; }
.char .badge { margin-top: 8px; }
.trait-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.trait-chips span { font-size: 0.82rem; font-weight: 650; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.gift-card { margin-top: 14px; border-radius: var(--radius); padding: 22px; background: linear-gradient(150deg, #fff3ea, #ffe2d3); box-shadow: var(--shadow); }
.gift-card .row { display: flex; gap: 14px; align-items: center; }

.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat-tiles div { background: var(--surface-2); border-radius: 14px; padding: 10px; text-align: center; }
.stat-tiles b { display: block; font-size: 1.15rem; }
.stat-tiles span { font-size: 0.78rem; color: var(--muted); }
.like-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 700; }
.like-btn.on { background: #ffe4e8; color: #d63a5a; box-shadow: none; }

/* 홈의 말벗 줄 */
.char-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.char-scroll::-webkit-scrollbar { display: none; }
.mini-char { flex: none; width: 132px; background: var(--surface); border-radius: var(--radius-sm); padding: 18px 12px 14px; box-shadow: var(--shadow); display: grid; justify-items: center; gap: 6px; text-align: center; }
.mini-char .orb { width: 58px; height: 58px; }
.mini-char .orb svg { width: 26px; height: 26px; }
.mini-char b { font-size: 1rem; }
.mini-char span { font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.mini-char.on { box-shadow: inset 0 0 0 2.5px var(--accent), var(--shadow); }
.mini-char.on span { color: var(--accent); font-weight: 700; }

/* 사업자 정보 (카카오 비즈 앱 심사: 서비스 화면에서 확인 가능해야 함) */
.biz-info { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; font-size: 0.8125rem; line-height: 1.7; color: var(--muted); word-break: keep-all; }
.biz-info p { margin: 0; }
.biz-info .biz-name { font-size: 0.9375rem; font-weight: 700; color: var(--ink-2, var(--muted)); margin-bottom: 4px; }
.biz-info .biz-item { display: inline-block; margin: 0 6px; }
.biz-info .biz-label { font-weight: 600; opacity: 0.75; }
.biz-info a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.biz-info .biz-links { margin-top: 10px; font-size: 0.875rem; display: flex; justify-content: center; gap: 16px; }
