/* 여우딩 — 공통 스타일 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@300;400;600&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

/* 여우딩 테마: 밝은 분홍. (변수 이름은 1단계 그대로 두고 값만 바꿈)
   --night  = 바탕색,  --gold = 강조색(분홍),  --ink = 글자색 */
:root {
  --night: #fff6f9;
  --night-2: #ffeaf1;
  --night-3: #ffd9e6;
  --ink: #4a2a3a;
  --ink-dim: #8a6478;
  --ink-faint: #b394a4;
  --gold: #e8578a;
  --gold-soft: rgba(232, 87, 138, .13);
  --rose: #d6336c;
  --sage: #4f9d86;
  --line: rgba(232, 87, 138, .16);
  --card: rgba(255, 255, 255, .72);
  --card-hover: rgba(255, 255, 255, .95);
  --radius: 18px;
  --serif: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  --sans: 'Noto Sans KR', 'Pretendard', system-ui, sans-serif;
  --shadow: 0 18px 50px rgba(232, 87, 138, .18);
  --on-accent: #fff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--night);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1200px 600px at 50% -10%, #ffd3e2 0%, transparent 60%),
    radial-gradient(800px 500px at 90% 100%, rgba(255, 200, 150, .35) 0%, transparent 60%),
    radial-gradient(600px 400px at 5% 60%, rgba(232, 87, 138, .10) 0%, transparent 60%),
    var(--night);
}
/* 흩날리는 꽃잎 빛 (예전 별빛 자리) */
.stars { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.stars i {
  position: absolute; width: 6px; height: 6px; border-radius: 50% 0 50% 0;
  background: #ff9cc0; opacity: .35;
  animation: twinkle var(--d, 4s) ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .15; transform: scale(.8) rotate(0deg); } to { opacity: .6; transform: scale(1.2) rotate(40deg); } }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }

.wrap { width: min(1080px, 100% - 40px); margin: 0 auto; }
.serif { font-family: var(--serif); }

/* 헤더 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(14px);
  background: rgba(255, 246, 249, .8);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 19px; letter-spacing: .02em; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe3ee, var(--gold) 55%, #b23a66);
  box-shadow: 0 0 24px rgba(232, 87, 138, .45);
}
.nav { display: flex; gap: 22px; font-size: 14px; color: var(--ink-dim); }
.nav a:hover { color: var(--ink); }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; transition: .2s; font-size: 14px; font-weight: 500;
}
.btn:hover { background: var(--card-hover); border-color: rgba(232, 87, 138, .4); }
.btn.primary { background: var(--gold); color: var(--on-accent); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 카드 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px;
}
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: 13px; }
.eyebrow { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.3; }
h1 { font-size: clamp(30px, 5vw, 48px); }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 19px; }
.section { padding: 56px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }

/* 폼 */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 14px; color: var(--ink-dim); }
.field .hint { font-size: 12px; color: var(--ink-faint); }
.field .cal { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-dim); margin-top: 2px; }
.field .cal input { accent-color: var(--gold); }
input[type=text], input[type=date], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .85); color: var(--ink);
  outline: none; transition: .2s;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea { resize: vertical; min-height: 110px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }

/* 아바타 */
.avatar {
  width: 148px; height: 148px; border-radius: 50%; overflow: hidden; flex: none;
  background: linear-gradient(145deg, #ffe1ec, #ffc3d8);
  border: 3px solid rgba(232, 87, 138, .55);
  box-shadow: 0 0 0 10px rgba(232, 87, 138, .08), var(--shadow);
  display: grid; place-items: center; font-family: var(--serif); font-size: 52px; color: var(--gold);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 72px; height: 72px; font-size: 26px; border-width: 2px; box-shadow: none; }

/* 추모 공간 목록 카드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.m-card { display: flex; gap: 18px; align-items: center; transition: .2s; }
.m-card:hover { background: var(--card-hover); transform: translateY(-2px); }
.m-card .name { font-family: var(--serif); font-size: 20px; }
.m-card .dates { font-size: 13px; color: var(--ink-dim); }
.m-card .epi { font-size: 13px; color: var(--ink-faint); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 추모 페이지 히어로 */
.hero { padding: 72px 0 40px; text-align: center; }
.hero .avatar { margin: 0 auto 26px; }
.hero .name { font-size: clamp(34px, 6vw, 56px); }
.hero .name small { font-size: .5em; color: var(--ink-dim); margin-right: 10px; vertical-align: middle; }
.hero .dates { color: var(--ink-dim); margin-top: 8px; letter-spacing: .05em; }
.hero .epitaph { font-family: var(--serif); font-size: 20px; color: var(--gold); margin-top: 22px; font-weight: 300; }
.hero .counter { display: inline-flex; gap: 28px; margin-top: 28px; padding: 14px 26px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; color: var(--ink-dim); }
.hero .counter b { color: var(--ink); font-weight: 500; }

/* 제단 */
.altar { position: relative; padding: 40px 24px 28px; text-align: center; overflow: hidden; }
.altar::after {
  content: ''; position: absolute; left: 10%; right: 10%; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .5;
}
.tributes { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.tribute {
  width: 150px; padding: 20px 14px 16px; border-radius: 20px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); transition: .2s; position: relative;
}
.tribute:hover { background: var(--card-hover); transform: translateY(-3px); }
.tribute:active { transform: scale(.97); }
.tribute .icon { font-size: 40px; line-height: 1; height: 48px; display: grid; place-items: center; }
.tribute .label { font-size: 14px; margin-top: 10px; }
.tribute .count { font-size: 12px; color: var(--ink-dim); }
.tribute.pop .icon { animation: pop .5s ease; }
@keyframes pop { 30% { transform: scale(1.35) rotate(-6deg); } 60% { transform: scale(.95); } }
/* 촛불 */
.flame {
  display: inline-block; width: 16px; height: 26px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff6d8 0%, #ffd27a 35%, #ff8a3d 75%, transparent 100%);
  box-shadow: 0 0 18px 6px rgba(255, 180, 80, .45);
  animation: flicker 1.6s ease-in-out infinite alternate; transform-origin: 50% 100%;
}
@keyframes flicker { 0% { transform: scaleY(1) rotate(-2deg); } 50% { transform: scaleY(1.08) rotate(2deg); } 100% { transform: scaleY(.95) rotate(-1deg); } }
.candle-body { display: block; width: 14px; height: 22px; margin: -2px auto 0; background: linear-gradient(#f4ecd8, #d9ccae); border-radius: 3px 3px 2px 2px; }
/* 날아가는 꽃잎 */
.petal {
  position: fixed; pointer-events: none; z-index: 50; font-size: 22px;
  animation: float 1.6s ease-out forwards;
}
@keyframes float { to { transform: translateY(-140px) translateX(var(--dx, 0)) rotate(var(--rot, 40deg)); opacity: 0; } }
/* 향 연기 */
.smoke { position: fixed; pointer-events: none; z-index: 50; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); filter: blur(3px); animation: rise 1.8s ease-out forwards; }
@keyframes rise { to { transform: translateY(-160px) translateX(var(--dx, 0)) scale(4); opacity: 0; } }

/* 탭 */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 40px 0 32px; overflow-x: auto; }
.tabs button {
  background: none; border: 0; padding: 12px 18px; cursor: pointer; color: var(--ink-dim);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 15px;
}
.tabs button.active { color: var(--ink); border-color: var(--gold); }
.panel { display: none; }
.panel.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* 약력 */
.bio-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
@media (max-width: 760px) { .bio-grid { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 13px; }
.quote { font-family: var(--serif); font-size: 18px; color: var(--ink); border-left: 2px solid var(--gold); padding-left: 16px; margin: 0; }

/* 타임라인 */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 26px; }
.tl-item::before {
  content: ''; position: absolute; left: -25px; top: 8px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft);
}
.tl-item .date { font-size: 12px; color: var(--gold); letter-spacing: .08em; }
.tl-item h3 { margin: 4px 0 6px; }
.tl-item p { margin: 0; color: var(--ink-dim); }
.tl-item img { margin-top: 12px; border-radius: 12px; max-height: 320px; object-fit: cover; }

/* 방명록 */
.gb-list { display: grid; gap: 14px; }
.gb-item { display: flex; gap: 14px; }
.gb-item .who { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--night-3); color: var(--gold); font-family: var(--serif); }
.gb-item .meta { font-size: 12px; color: var(--ink-faint); }
.gb-item p { margin: 4px 0 0; white-space: pre-wrap; }
.gb-form { margin-bottom: 24px; }

/* 안내/빈 상태 */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-faint); }
.notice { font-size: 13px; color: var(--ink-dim); background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 16px; }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .3s; z-index: 100; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 푸터 */
footer { padding: 48px 0 60px; color: var(--ink-faint); font-size: 13px; border-top: 1px solid var(--line); margin-top: 60px; text-align: center; }

/* 홈 히어로 */
.home-hero { padding: 96px 0 56px; text-align: center; }
.home-hero p { max-width: 560px; margin: 18px auto 0; color: var(--ink-dim); font-size: 17px; }
.home-hero .actions { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.features .card { padding: 22px; }
.features .ico { font-size: 28px; margin-bottom: 10px; }
.features h3 { font-size: 17px; margin-bottom: 6px; }
.features p { margin: 0; font-size: 14px; color: var(--ink-dim); }

/* 소통(채팅) */
.talk-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .talk-grid { grid-template-columns: 1fr; } }
.chat-box { display: flex; flex-direction: column; min-height: 560px; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 4px; display: flex; flex-direction: column; gap: 12px; max-height: 520px; }
.chat-empty { margin: auto; text-align: center; color: var(--ink-dim); }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; line-height: 1.6; font-size: 15px; animation: fade .25s ease; }
.bubble .who { font-size: 12px; color: var(--gold); margin-bottom: 4px; }
.bubble .text { white-space: pre-wrap; }
.bubble .time { font-size: 11px; color: var(--ink-faint); margin-top: 4px; text-align: right; }
.bubble.user { align-self: flex-end; background: var(--gold); color: var(--on-accent); border-bottom-right-radius: 4px; }
.bubble.user .time { color: rgba(255, 255, 255, .7); }
.bubble.assistant { align-self: flex-start; background: var(--night-3); border-bottom-left-radius: 4px; }
.bubble.typing .text { display: flex; gap: 4px; padding: 6px 2px; }
.bubble.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-dim); animation: blink 1.2s infinite; }
.bubble.typing span:nth-child(2) { animation-delay: .2s; } .bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.chat-form { display: flex; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }
.crisis { margin: 10px 0; padding: 12px 16px; border-radius: 12px; background: rgba(233, 163, 177, .12); border: 1px solid rgba(233, 163, 177, .35); font-size: 14px; line-height: 1.6; }
.setup { margin: 14px 0 4px; padding: 16px 18px; border-radius: 14px; background: var(--gold-soft); border: 1px solid rgba(232, 87, 138, .35); font-size: 14px; line-height: 1.7; }
.setup ol { margin: 8px 0 12px; padding-left: 20px; }
.provider-pick { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0 4px; }
.provider-pick label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.provider-pick input { accent-color: var(--gold); }
.setup code { background: rgba(232, 87, 138, .15); padding: 1px 6px; border-radius: 4px; }
.setup input { flex: 1; }
.rest { align-self: center; font-size: 13px; color: var(--sage); text-align: center; padding: 8px 14px; border: 1px dashed rgba(159, 196, 178, .4); border-radius: 12px; max-width: 90%; }
.persona summary { cursor: pointer; list-style: none; }
.persona summary::-webkit-details-marker { display: none; }
.persona textarea { min-height: 80px; font-size: 14px; }

/* 2단계 예고(소통) */
.coming { text-align: center; padding: 40px 20px; }
.coming .ico { font-size: 44px; }
.coming h3 { margin: 12px 0 8px; }
.coming p { color: var(--ink-dim); max-width: 520px; margin: 0 auto; }
.ai-badge { display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 6px; background: rgba(159,196,178,.15); color: var(--sage); letter-spacing: .05em; margin-left: 8px; vertical-align: middle; }
