/* DearWild — 크림색 바탕, 자연의 색, 절제된 아이콘 (PLANNING.txt 의 시안 설명) */
:root {
  --bg: #f4eee2;
  --card: #fffaf0;
  --ink: #26221b;
  --muted: #7a7264;
  --line: #e4dccb;
  --leaf: #2f5d46;
  --leaf-soft: #e3ecdf;
  --clay: #b8623c;
  --r: 18px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.shell { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.top h1 { font-size: 22px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .brand i { font-style: normal; color: var(--leaf); }
.top .back { width: 36px; height: 36px; margin-left: -8px; border-radius: 50%; display: grid; place-items: center; }
.top svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.800; stroke-linecap: round; stroke-linejoin: round; }
.main { flex: 1; padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; max-width: 112px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 7px; font-size: 11px; color: var(--muted); }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.700; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--leaf); font-weight: 600; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--leaf); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; color: var(--leaf); box-shadow: inset 0 0 0 1.500px var(--leaf); }
.btn.quiet { background: var(--leaf-soft); color: var(--leaf); }
.btn.sm { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--clay); box-shadow: inset 0 0 0 1.500px var(--clay); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.fab { position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 6; width: 56px; height: 56px; border-radius: 50%; background: var(--clay); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(80, 50, 20, .28); }
.fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.200; stroke-linecap: round; }

/* 얼굴 */
.face { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; line-height: 1; background: var(--tone, #999); overflow: hidden; }
.face.lg { width: 84px; height: 84px; font-size: 44px; }
.face.sm { width: 34px; height: 34px; font-size: 18px; }
.face img { width: 100%; height: 100%; object-fit: cover; }
.face.animal { position: relative; }
.face.animal img { position: absolute; inset: 0; }
.face.xs { width: 22px; height: 22px; font-size: 12px; }
.face.human { background: #fff; box-shadow: inset 0 0 0 2.500px var(--ring, #bbb); padding: 3px; }
.face.human img { border-radius: 50%; }
.ai { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--leaf); background: var(--leaf-soft); border-radius: 5px; padding: 1px 5px; vertical-align: 1px; }

/* 글 */
.post { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 0 0 12px; }
.post .who { display: flex; gap: 10px; align-items: center; }
.post .who .names { flex: 1; min-width: 0; }
.post .who b { font-weight: 650; }
.post .who .sub { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post .text { margin: 10px 0 0; font-size: 17px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post.animal .text { font-family: var(--serif); font-size: 19px; line-height: 1.38; }
.post .photo { display: block; width: 100%; max-height: 520px; object-fit: cover; border-radius: 12px; margin-top: 10px; background: var(--line); }
.post .acts { display: flex; gap: 18px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 14px; }
.post .acts button, .post .acts span { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; }
.post .acts svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.800; stroke-linecap: round; stroke-linejoin: round; }
.post .acts .liked { color: var(--clay); }
.post .acts .liked svg { fill: currentColor; }
.post .acts .more { margin-left: auto; }

.cmt { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.cmt .body { flex: 1; min-width: 0; }
.cmt .body p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt.animal .body p { font-family: var(--serif); font-size: 17px; }
.cmt.wait .body p { color: var(--muted); font-style: italic; }
.composer { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); display: flex; gap: 8px; padding: 10px 0; background: var(--bg); }
.composer input { flex: 1; min-width: 0; height: 46px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); padding: 0 16px; font: inherit; color: inherit; }

/* 목록 */
.row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .names { flex: 1; min-width: 0; }
.row .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 12px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 14px; }
.chip.on { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.search { width: 100%; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font: inherit; color: inherit; margin-bottom: 10px; }
.empty { text-align: center; color: var(--muted); padding: 48px 12px; }
.empty .big { font-size: 40px; }
.note { font-size: 13px; color: var(--muted); background: var(--leaf-soft); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }

/* World */
.map { position: relative; width: 100%; aspect-ratio: 2 / 1; border-radius: var(--r); background: #dfe8e2; border: 1px solid var(--line); overflow: hidden; margin-bottom: 14px; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: var(--tone); border: 2.500px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.hab { display: block; border-radius: var(--r); padding: 16px; margin-bottom: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--tone) 26%, var(--card)), var(--card)); border: 1px solid var(--line); }
.hab h3 { font-size: 20px; }
.hab .faces { display: flex; margin-top: 10px; }
.hab .faces .face { margin-right: -8px; box-shadow: 0 0 0 2.500px var(--card); }

/* 동물 프로필 */
.hero { text-align: center; padding: 8px 0 16px; }
.hero .face { margin: 0 auto 10px; }
.hero h2 { font-size: 28px; }
.hero .stats { display: flex; justify-content: center; gap: 22px; margin: 12px 0; font-size: 14px; color: var(--muted); }
.hero .stats b { display: block; font-family: var(--serif); font-size: 20px; color: var(--ink); }
.facts { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; }
.facts h3 { font-size: 16px; margin-bottom: 6px; }
.facts ul { margin: 0; padding-left: 18px; }
.facts li { margin: 4px 0; font-size: 15px; }
.sect { font-family: var(--serif); font-size: 18px; margin: 18px 0 10px; }

/* 시트 · 전체 화면 */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(38, 34, 27, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); }
.sheet h2 { font-size: 24px; margin-bottom: 6px; }
.sheet p { margin: 0 0 14px; }
.sheet textarea { width: 100%; min-height: 120px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 12px 14px; font: inherit; color: inherit; resize: vertical; }
.sheet .bar { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.sheet .bar .sp { flex: 1; }
.sheet .preview { position: relative; margin-top: 10px; }
.sheet .preview img { width: 100%; max-height: 300px; object-fit: cover; border-radius: 12px; display: block; }
.sheet .preview button { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 18px; }
.err { color: var(--clay); font-size: 14px; margin: 10px 0 0; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 12px 0; }
.full { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; text-align: center; }
.full h1 { font-size: 40px; }
.full h1 i { font-style: normal; color: var(--leaf); }
.full .tag { font-family: var(--serif); font-size: 19px; margin: 6px 0 22px; }
.full input { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font: inherit; text-align: center; margin-bottom: 10px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 14px 0; }
.pick b { font-family: var(--serif); font-size: 22px; }
.gbtn { display: flex; justify-content: center; min-height: 44px; margin: 6px 0; }

.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); z-index: 30; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* 순위 · 팬클럽 · 서사 */
.seg { display: flex; background: var(--line); border-radius: 999px; padding: 3px; margin-bottom: 12px; }
.seg a { flex: 1; text-align: center; padding: 8px 0; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.rank { flex: none; width: 22px; text-align: center; font-family: var(--serif); font-size: 18px; color: var(--clay); }
.story p { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.5; }
.bio { margin: 0; display: grid; grid-template-columns: 92px 1fr; gap: 10px 12px; font-size: 15px; }
.bio dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.bio dd { margin: 0; min-width: 0; }
.bio dd a { color: var(--leaf); }
.bio .friends { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.bio .friends .chip { color: var(--ink); }
.hero .btn { margin: 0 3px; }
.cmt > button { align-self: flex-start; }

/* 동물 얼굴의 AI 딱지 */
.facewrap { position: relative; flex: none; display: inline-flex; }
.aib { position: absolute; right: -4px; bottom: -3px; font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: .03em; line-height: 1; color: #fff; background: var(--leaf); border: 2px solid var(--card); border-radius: 7px; padding: 2px 4px; }
.facewrap.lg .aib { right: 0; bottom: 2px; font-size: 13px; padding: 3px 7px; border-radius: 10px; border-width: 3px; }
.facewrap.sm .aib { font-size: 8px; padding: 1px 3px; right: -5px; bottom: -4px; }
.facewrap.xs .aib { font-size: 7px; padding: 1px 2px; right: -6px; bottom: -4px; border-width: 1.500px; }
.hero .facewrap { margin: 0 auto 10px; }
.hero .facewrap .face { margin: 0; }
.hab .faces .facewrap { margin-right: -4px; }
.hab .faces .facewrap .face { margin-right: 0; }
.hab .faces .aib { display: none; }
