/* 여우딩 — 공통 스타일 (v2: 고급 분홍 테마) */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@200;300;400;600&family=Noto+Sans+KR:wght@300;400;500;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --night: #fff7fa;
  --night-2: #ffedf3;
  --night-3: #ffdce8;
  --ink: #3d2130;
  --ink-dim: #86607a;
  --ink-faint: #b89aab;
  --gold: #e24e85;
  --gold-2: #ff7fae;
  --gold-deep: #b8386a;
  --gold-soft: rgba(226, 78, 133, .12);
  --rose: #d6336c;
  --sage: #4f9d86;
  --line: rgba(226, 78, 133, .16);
  --line-strong: rgba(226, 78, 133, .32);
  --card: rgba(255, 255, 255, .66);
  --card-hover: rgba(255, 255, 255, .92);
  --radius: 22px;
  --serif: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  --sans: 'Noto Sans KR', 'Pretendard', system-ui, sans-serif;
  --latin: 'Cormorant Garamond', 'Noto Serif KR', serif;
  --shadow: 0 24px 60px -20px rgba(226, 78, 133, .28);
  --shadow-sm: 0 10px 30px -14px rgba(226, 78, 133, .25);
  --on-accent: #fff;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--night);
  line-height: 1.75;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--gold); color: #fff; }

/* 배경: 고정 그라데이션 + 떠다니는 빛 + 떨어지는 꽃잎 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(1200px 640px at 50% -12%, #ffd6e4 0%, transparent 62%),
    radial-gradient(900px 560px at 95% 100%, rgba(255, 206, 170, .35) 0%, transparent 60%),
    radial-gradient(700px 460px at 0% 65%, rgba(226, 78, 133, .10) 0%, transparent 60%),
    var(--night);
}
.glow { position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden; filter: blur(60px); opacity: .55; }
.glow b { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(255, 140, 185, .55), transparent 70%); animation: drift 22s ease-in-out infinite alternate; }
.glow b:nth-child(1) { width: 520px; height: 520px; left: -8%; top: 8%; }
.glow b:nth-child(2) { width: 420px; height: 420px; right: -6%; top: 28%; animation-duration: 28s; background: radial-gradient(circle, rgba(255, 190, 150, .5), transparent 70%); }
.glow b:nth-child(3) { width: 380px; height: 380px; left: 35%; bottom: -10%; animation-duration: 34s; }
@keyframes drift { to { transform: translate(60px, -50px) scale(1.12); } }
.petals { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.petals i {
  position: absolute; top: -4%; width: 12px; height: 12px;
  border-radius: 60% 0 60% 0; background: linear-gradient(135deg, #ffb6cf, #ff86b0);
  transform: scale(var(--s, 1));
  animation: fall var(--d, 20s) linear infinite;
}
@keyframes fall {
  0% { transform: translate3d(0, 0, 0) rotate(0) scale(var(--s, 1)); }
  100% { transform: translate3d(var(--x, 0), 108vh, 0) rotate(560deg) scale(var(--s, 1)); }
}
/* 예전 이름 호환 */
.stars { display: none; }

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); }

/* 진행 바 · 커서 */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 30; background: linear-gradient(90deg, var(--gold), var(--gold-2)); box-shadow: 0 0 12px rgba(226, 78, 133, .5); }
.cursor { position: fixed; left: 0; top: 0; z-index: 200; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 1.5px solid rgba(226, 78, 133, .55); pointer-events: none; opacity: 0; transition: width .25s, height .25s, margin .25s, opacity .3s, background .25s; mix-blend-mode: multiply; }
.cursor.on { opacity: 1; }
.cursor.hot { width: 54px; height: 54px; margin: -27px 0 0 -27px; background: rgba(226, 78, 133, .08); }

/* 스크롤 등장 */
.rv { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.rv.in { opacity: 1; transform: none; }
.rv.d1 { transition-delay: .1s; } .rv.d2 { transition-delay: .2s; } .rv.d3 { transition-delay: .3s; } .rv.d4 { transition-delay: .4s; }
.rv-title { clip-path: inset(0 0 100% 0); transform: translateY(20px); transition: clip-path 1s var(--ease), transform 1s var(--ease); }
.rv-title.in { clip-path: inset(-10% 0 -10% 0); transform: none; }
@keyframes up { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.up { animation: up .9s var(--ease) both; }
.up.d1 { animation-delay: .12s; } .up.d2 { animation-delay: .24s; } .up.d3 { animation-delay: .36s; } .up.d4 { animation-delay: .5s; }
.fx-ready .up { animation: none; opacity: 1; transform: none; }
.shine {
  background: linear-gradient(100deg, var(--gold-deep) 0%, var(--gold) 38%, #ffb8d1 50%, var(--gold) 62%, var(--gold-deep) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 4.5s linear 1.2s infinite;
}
@keyframes shine { 0% { background-position: 120% 0; } 100% { background-position: -130% 0; } }

/* 헤더 */
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px) saturate(1.3); background: rgba(255, 247, 250, .72); border-bottom: 1px solid transparent; transition: .35s; }
.topbar.scrolled { border-bottom-color: var(--line); box-shadow: 0 10px 30px -22px rgba(226, 78, 133, .4); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--serif); font-size: 20px; letter-spacing: .04em; font-weight: 300; }
.brand .mark { position: relative; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe3ee, var(--gold) 55%, var(--gold-deep)); box-shadow: 0 0 24px rgba(226, 78, 133, .45); }
.brand .mark::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid rgba(226, 78, 133, .35); animation: ring 3.2s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.nav { display: flex; gap: 24px; align-items: center; font-size: 14px; color: var(--ink-dim); }
.nav a { position: relative; padding: 4px 0; transition: color .25s; }
.nav a::after { content: ''; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--gold); transition: right .3s var(--ease); }
.nav a:hover { color: var(--ink); } .nav a:hover::after { right: 0; }

/* 버튼 */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .7); cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink);
  transition: transform .25s var(--ease), background .25s, border-color .25s, box-shadow .25s;
}
.btn:hover { background: #fff; border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn.primary { background: linear-gradient(135deg, var(--gold-2), var(--gold) 55%, var(--gold-deep)); color: var(--on-accent); border-color: transparent; font-weight: 600; box-shadow: 0 10px 26px -10px rgba(226, 78, 133, .7); }
.btn.primary::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent); transform: skewX(-20deg); transition: left .6s var(--ease); }
.btn.primary:hover::after { left: 120%; }
.btn.primary:hover { box-shadow: 0 16px 34px -12px rgba(226, 78, 133, .8); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.sm { padding: 8px 15px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* 카드 (유리 질감 + 빛 반사) */
.card {
  position: relative; background: var(--card); border: 1px solid rgba(255, 255, 255, .8); border-radius: var(--radius);
  padding: 26px; backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 20px 50px -34px rgba(226, 78, 133, .45);
  transition: transform .3s var(--ease), box-shadow .3s, background .3s;
}
.card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, rgba(255, 255, 255, .9), rgba(226, 78, 133, .18) 50%, rgba(255, 255, 255, .5)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.tilt { transform-style: preserve-3d; will-change: transform; }
.tilt::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .55), transparent 55%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.tilt:hover::after { opacity: 1; }
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-dim); font-size: 14px; }
.eyebrow { font-family: var(--latin); font-size: 15px; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); font-weight: 500; }
h1, h2, h3 { font-family: var(--serif); font-weight: 300; margin: 0; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: clamp(32px, 5.2vw, 52px); }
h2 { font-size: clamp(24px, 3.2vw, 32px); }
h3 { font-size: 19px; font-weight: 400; }
.section { padding: 64px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }

/* 폼 */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 13.5px; color: var(--ink-dim); letter-spacing: .02em; }
.field .hint { font-size: 13.5px; color: var(--ink-dim); }
.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=email], input[type=password], input[type=date], textarea, select {
  width: 100%; padding: 13px 15px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .8); color: var(--ink);
  outline: none; transition: .25s;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); background: #fff; }
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 {
  position: relative; width: 156px; height: 156px; border-radius: 50%; overflow: hidden; flex: none;
  background: linear-gradient(145deg, #ffe4ee, #ffc6da);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(226, 78, 133, .3), 0 0 0 12px rgba(226, 78, 133, .07), var(--shadow);
  display: grid; place-items: center; font-family: var(--serif); font-size: 54px; color: var(--gold); font-weight: 300;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 72px; height: 72px; font-size: 26px; border-width: 2px; box-shadow: 0 0 0 1px rgba(226, 78, 133, .25); }
.hero .avatar-wrap { position: relative; width: 176px; height: 176px; margin: 0 auto 28px; display: grid; place-items: center; }
.hero .avatar-wrap::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 60%, rgba(226, 78, 133, .6) 80%, transparent 100%); animation: spin 7s linear infinite; }
.hero .avatar-wrap::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--night); }
.hero .avatar-wrap .avatar { position: relative; z-index: 1; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 목록 카드 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.m-card { display: flex; gap: 18px; align-items: center; }
.m-card:hover { background: var(--card-hover); box-shadow: var(--shadow); }
.m-card .name { font-family: var(--serif); font-size: 21px; }
.m-card .dates { font-size: 13px; color: var(--ink-dim); font-family: var(--latin); letter-spacing: .04em; font-size: 15px; }
.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: 80px 0 44px; text-align: center; position: relative; }
.hero .name { font-size: clamp(36px, 6.4vw, 62px); font-weight: 200; letter-spacing: .02em; }
.hero .name small { font-size: .45em; color: var(--ink-faint); margin-right: 12px; vertical-align: middle; font-weight: 300; }
.hero .dates { color: var(--ink-dim); margin-top: 10px; letter-spacing: .08em; font-size: 15px; }
.hero .epitaph { font-family: var(--serif); font-size: clamp(18px, 2.4vw, 22px); color: var(--gold-deep); margin: 24px auto 0; font-weight: 300; max-width: 640px; line-height: 1.7; }
.hero .epitaph::before, .hero .epitaph::after { content: ''; display: block; width: 36px; height: 1px; margin: 14px auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.hero .counter { display: inline-flex; gap: 30px; margin-top: 22px; padding: 14px 30px; border-radius: 999px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow-sm); font-size: 13px; color: var(--ink-dim); backdrop-filter: blur(10px); }
.hero .counter b { color: var(--ink); font-weight: 500; font-family: var(--latin); font-size: 17px; }

/* 제단 */
.altar { position: relative; padding: 44px 24px 32px; 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: 14px; }
.tribute {
  width: 156px; padding: 22px 14px 18px; border-radius: 22px; cursor: pointer; position: relative; overflow: hidden;
  background: rgba(255, 255, 255, .65); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s, background .3s;
}
.tribute::before { content: ''; position: absolute; inset: 0; background: radial-gradient(120px circle at 50% 30%, rgba(255, 170, 200, .35), transparent 70%); opacity: 0; transition: opacity .3s; }
.tribute:hover { background: #fff; transform: translateY(-5px); box-shadow: var(--shadow); }
.tribute:hover::before { opacity: 1; }
.tribute:active { transform: scale(.97); }
.tribute .icon { position: relative; font-size: 40px; line-height: 1; height: 48px; display: grid; place-items: center; filter: drop-shadow(0 6px 10px rgba(226, 78, 133, .25)); }
.tribute .label { position: relative; font-size: 14px; margin-top: 10px; font-family: var(--serif); }
.tribute .count { position: relative; 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: inline-flex; gap: 4px; padding: 5px; margin: 44px 0 32px; border-radius: 999px; background: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow-sm); overflow-x: auto; max-width: 100%; }
.tabs button { background: none; border: 0; padding: 9px 18px; border-radius: 999px; cursor: pointer; color: var(--ink-dim); white-space: nowrap; font-size: 14.5px; transition: .3s var(--ease); }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: #fff; background: linear-gradient(135deg, var(--gold-2), var(--gold) 60%, var(--gold-deep)); box-shadow: 0 8px 18px -8px rgba(226, 78, 133, .8); }
.tabs button.active .ai-badge { background: rgba(255, 255, 255, .25); color: #fff; }
.panel { display: none; }
.panel.active { display: block; animation: fade .45s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } }

/* 약력 */
.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: 12px; }
.chip { padding: 6px 13px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-deep); font-size: 13px; border: 1px solid rgba(226, 78, 133, .15); transition: .25s; }
.chip:hover { background: var(--gold); color: #fff; }
.quote { font-family: var(--serif); font-size: 18px; color: var(--ink); border-left: 2px solid var(--gold); padding-left: 16px; margin: 0; font-weight: 300; }

/* 타임라인 */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--gold), rgba(226, 78, 133, .1)); }
.tl-item { position: relative; margin-bottom: 30px; }
.tl-item::before { content: ''; position: absolute; left: -27px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 5px var(--gold-soft), 0 0 14px rgba(226, 78, 133, .6); }
.tl-item .date { font-family: var(--latin); font-size: 15px; color: var(--gold); letter-spacing: .1em; }
.tl-item h3 { margin: 4px 0 6px; }
.tl-item p { margin: 0; color: var(--ink-dim); }
.tl-item img { margin-top: 12px; border-radius: 14px; max-height: 340px; object-fit: cover; box-shadow: var(--shadow-sm); }

/* 방명록 */
.gb-list { display: grid; gap: 14px; }
.gb-item { display: flex; gap: 14px; }
.gb-item .who { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; background: linear-gradient(145deg, #ffe4ee, #ffc6da); color: var(--gold-deep); 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: rgba(61, 33, 48, .92); color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .35s var(--ease); z-index: 100; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 푸터 */
footer { padding: 54px 0 64px; color: var(--ink-dim); font-size: 14px; margin-top: 70px; text-align: center; position: relative; }
footer::before { content: ''; position: absolute; left: 20%; right: 20%; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .5; }

/* 홈 히어로 */
.home-hero { padding: 110px 0 64px; text-align: center; position: relative; }
.home-hero h1 { font-size: clamp(36px, 6vw, 64px); font-weight: 200; line-height: 1.25; }
.home-hero p { max-width: 580px; margin: 22px auto 0; color: var(--ink-dim); font-size: 17px; }
.home-hero .actions { display: flex; gap: 12px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.features .card { padding: 26px 24px; }
.features .ico { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(145deg, #fff, var(--night-3)); box-shadow: var(--shadow-sm); font-size: 24px; margin-bottom: 16px; }
.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: 11px 15px; border-radius: 18px; line-height: 1.6; font-size: 15px; animation: fade .3s var(--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: linear-gradient(135deg, var(--gold-2), var(--gold) 60%, var(--gold-deep)); color: var(--on-accent); border-bottom-right-radius: 5px; box-shadow: 0 8px 18px -10px rgba(226, 78, 133, .7); }
.bubble.user .time { color: rgba(255, 255, 255, .75); }
.bubble.assistant { align-self: flex-start; background: rgba(255, 255, 255, .85); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.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: 14px; background: rgba(233, 163, 177, .14); border: 1px solid rgba(233, 163, 177, .4); font-size: 14px; line-height: 1.6; }
.rest { align-self: center; font-size: 13px; color: var(--sage); text-align: center; padding: 8px 14px; border: 1px dashed rgba(159, 196, 178, .5); 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; }
.ai-badge { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: rgba(79, 157, 134, .12); color: var(--sage); letter-spacing: .08em; margin-left: 8px; vertical-align: middle; font-family: var(--sans); }

@media (max-width: 640px) {
  .hero .counter { gap: 16px; padding: 12px 18px; flex-wrap: wrap; justify-content: center; }
  .tabs { display: flex; }
  .cursor { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rv, .rv-title, .up { opacity: 1; transform: none; clip-path: none; animation: none; transition: none; }
  .petals, .glow, .cursor, .brand .mark::after, .hero .avatar-wrap::before { animation: none; display: none; }
  .shine { animation: none; }
}

/* =========================================================
   v3: 공간 테마 (벚꽃·국화·밤하늘·바다) + 시간대 하늘 + 기일
   html[data-theme] 로 전환. --acc 는 강조색 RGB.
   ========================================================= */
:root { --acc: 226, 78, 133; --sky-a: transparent; --sky-b: transparent; --sun: transparent; }

/* 강조색을 쓰는 공통 요소 (벚꽃이면 원래와 같은 색) */
html[data-theme] .card { box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 20px 50px -34px rgba(var(--acc), .45); }
html[data-theme] .card::before { background: linear-gradient(140deg, rgba(255, 255, 255, .9), rgba(var(--acc), .18) 50%, rgba(255, 255, 255, .5)); }
html[data-theme] .btn.primary { box-shadow: 0 10px 26px -10px rgba(var(--acc), .7); }
html[data-theme] .tabs button.active { box-shadow: 0 8px 18px -8px rgba(var(--acc), .8); }
html[data-theme] .avatar { box-shadow: 0 0 0 1px rgba(var(--acc), .3), 0 0 0 12px rgba(var(--acc), .07), var(--shadow); }
html[data-theme] .hero .avatar-wrap::before { background: conic-gradient(from 0deg, transparent 0 60%, rgba(var(--acc), .6) 80%, transparent 100%); }
html[data-theme] .tl-item::before { box-shadow: 0 0 0 5px var(--gold-soft), 0 0 14px rgba(var(--acc), .6); }
html[data-theme] .progress { box-shadow: 0 0 12px rgba(var(--acc), .5); }
html[data-theme] .chip { border-color: rgba(var(--acc), .15); }
html[data-theme] .tribute .icon { filter: drop-shadow(0 6px 10px rgba(var(--acc), .25)); }
html[data-theme] .bubble.user { box-shadow: 0 8px 18px -10px rgba(var(--acc), .7); }
html[data-theme] .brand .mark { background: radial-gradient(circle at 35% 35%, #fff, var(--gold) 55%, var(--gold-deep)); box-shadow: 0 0 24px rgba(var(--acc), .45); }
html[data-theme] .brand .mark::after { border-color: rgba(var(--acc), .35); }
html[data-theme] ::selection { background: var(--gold); }

/* --- 국화: 아이보리 + 은은한 금빛, 길쭉한 흰 꽃잎 --- */
html[data-theme="chrysanthemum"] {
  --acc: 184, 145, 58;
  --night: #fbf8f1; --night-2: #f5efe2; --night-3: #ece2c9;
  --ink: #3a3226; --ink-dim: #7d705a; --ink-faint: #ad9f86;
  --gold: #b8913a; --gold-2: #d9b860; --gold-deep: #8c6a22; --gold-soft: rgba(184, 145, 58, .12);
  --rose: #b4553d; --line: rgba(184, 145, 58, .18); --line-strong: rgba(184, 145, 58, .34);
  --shadow: 0 24px 60px -20px rgba(140, 106, 34, .25); --shadow-sm: 0 10px 30px -14px rgba(140, 106, 34, .22);
}
html[data-theme="chrysanthemum"] body::before {
  background: radial-gradient(1200px 640px at 50% -12%, #f3e7c6 0%, transparent 62%), radial-gradient(900px 560px at 95% 100%, rgba(233, 211, 154, .35) 0%, transparent 60%), radial-gradient(700px 460px at 0% 65%, rgba(184, 145, 58, .08) 0%, transparent 60%), var(--night);
}
html[data-theme="chrysanthemum"] .glow b { background: radial-gradient(circle, rgba(240, 215, 150, .5), transparent 70%); }
html[data-theme="chrysanthemum"] .glow b:nth-child(2) { background: radial-gradient(circle, rgba(255, 255, 255, .8), transparent 70%); }
html[data-theme="chrysanthemum"] .petals i { width: 5px; height: 16px; border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%; background: linear-gradient(#fff, #fff 55%, #ecd59a); box-shadow: 0 0 6px rgba(184, 145, 58, .25); }
html[data-theme="chrysanthemum"] .topbar { background: rgba(251, 248, 241, .75); }
html[data-theme="chrysanthemum"] .avatar, html[data-theme="chrysanthemum"] .gb-item .who { background: linear-gradient(145deg, #fffaf0, #eedfb8); }

/* --- 바다: 맑은 하늘색 + 물방울 + 잔잔한 물결 --- */
html[data-theme="sea"] {
  --acc: 47, 134, 181;
  --night: #f3f9fc; --night-2: #e3f1f8; --night-3: #cfe6f2;
  --ink: #1f3444; --ink-dim: #5a7889; --ink-faint: #93abb8;
  --gold: #2f86b5; --gold-2: #6cc0e4; --gold-deep: #1d5f87; --gold-soft: rgba(47, 134, 181, .12);
  --rose: #c2456b; --line: rgba(47, 134, 181, .16); --line-strong: rgba(47, 134, 181, .32);
  --shadow: 0 24px 60px -20px rgba(29, 95, 135, .25); --shadow-sm: 0 10px 30px -14px rgba(29, 95, 135, .22);
}
html[data-theme="sea"] body::before {
  background: radial-gradient(1200px 640px at 50% -12%, #cfeaf7 0%, transparent 62%), radial-gradient(900px 560px at 95% 100%, rgba(150, 215, 225, .35) 0%, transparent 60%), radial-gradient(700px 460px at 0% 65%, rgba(47, 134, 181, .08) 0%, transparent 60%), var(--night);
}
html[data-theme="sea"] .glow b { background: radial-gradient(circle, rgba(120, 200, 235, .45), transparent 70%); }
html[data-theme="sea"] .glow b:nth-child(2) { background: radial-gradient(circle, rgba(170, 230, 220, .45), transparent 70%); }
html[data-theme="sea"] .petals i { top: auto; bottom: -4%; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .95), rgba(150, 210, 240, .35) 60%, rgba(47, 134, 181, .15)); border: 1px solid rgba(255, 255, 255, .7); animation-name: bubble; }
@keyframes bubble {
  0% { transform: translate3d(0, 0, 0) scale(var(--s, 1)); }
  50% { transform: translate3d(calc(var(--x, 0) * .5), -54vh, 0) scale(var(--s, 1)); }
  100% { transform: translate3d(var(--x, 0), -108vh, 0) scale(var(--s, 1)); }
}
html[data-theme="sea"] .topbar { background: rgba(243, 249, 252, .75); }
html[data-theme="sea"] .avatar, html[data-theme="sea"] .gb-item .who { background: linear-gradient(145deg, #eef8fd, #c4e3f3); }
.waves { position: fixed; left: 0; right: 0; bottom: 0; height: 130px; z-index: -1; pointer-events: none; overflow: hidden; }
.waves svg { position: absolute; bottom: 0; left: 0; width: 200%; height: 100%; animation: wave 26s linear infinite; }
.waves svg:nth-child(2) { height: 75%; opacity: .7; animation-duration: 18s; animation-direction: reverse; }
.waves path { fill: rgba(108, 192, 228, .16); }
.waves svg:nth-child(2) path { fill: rgba(47, 134, 181, .10); }
@keyframes wave { to { transform: translateX(-50%); } }

/* --- 밤하늘: 깊은 남색 + 반짝이는 별 + 달빛 금색 --- */
html[data-theme="night"] {
  --acc: 233, 199, 123;
  --night: #0f1630; --night-2: #18214a; --night-3: #24305f;
  --ink: #eef0fb; --ink-dim: #b6bddc; --ink-faint: #8189ad;
  --gold: #e9c77b; --gold-2: #ffe2a6; --gold-deep: #c99a45; --gold-soft: rgba(233, 199, 123, .14);
  --rose: #ff9db5; --sage: #8fd3bd; --line: rgba(233, 199, 123, .18); --line-strong: rgba(233, 199, 123, .34);
  --card: rgba(28, 37, 78, .58); --card-hover: rgba(38, 49, 98, .78);
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, .55); --shadow-sm: 0 10px 30px -14px rgba(0, 0, 0, .5);
  --on-accent: #1d1a2e;
  color-scheme: dark;
}
html[data-theme="night"] body::before {
  background: radial-gradient(1200px 700px at 50% -15%, #2a3a7a 0%, transparent 62%), radial-gradient(900px 560px at 95% 100%, rgba(90, 70, 150, .35) 0%, transparent 60%), radial-gradient(700px 460px at 0% 65%, rgba(40, 80, 160, .25) 0%, transparent 60%), linear-gradient(#0c1229, #141c3d);
}
html[data-theme="night"] .glow { opacity: .35; }
html[data-theme="night"] .glow b { background: radial-gradient(circle, rgba(110, 130, 230, .45), transparent 70%); }
html[data-theme="night"] .glow b:nth-child(2) { background: radial-gradient(circle, rgba(233, 199, 123, .25), transparent 70%); }
html[data-theme="night"] .petals i { width: 3px; height: 3px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px 1px rgba(255, 245, 220, .8); animation: twinkle var(--tw, 4s) ease-in-out infinite alternate; transform: scale(var(--s, 1)); }
html[data-theme="night"] .petals i:nth-child(5n) { width: 4px; height: 4px; background: #ffe9b8; }
@keyframes twinkle { from { opacity: .15; } to { opacity: 1; } }
html[data-theme="night"] .topbar { background: rgba(15, 22, 48, .72); }
html[data-theme="night"] .card { border-color: rgba(255, 255, 255, .08); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 20px 50px -30px rgba(0, 0, 0, .7); }
html[data-theme="night"] .card::before { background: linear-gradient(140deg, rgba(255, 255, 255, .18), rgba(233, 199, 123, .14) 50%, rgba(255, 255, 255, .05)); }
html[data-theme="night"] .tilt::after { background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .08), transparent 55%); }
html[data-theme="night"] .btn { background: rgba(255, 255, 255, .06); }
html[data-theme="night"] .btn:hover { background: rgba(255, 255, 255, .12); }
html[data-theme="night"] .btn.primary { background: linear-gradient(135deg, var(--gold-2), var(--gold) 55%, var(--gold-deep)); }
html[data-theme="night"] .tabs, html[data-theme="night"] .hero .counter, html[data-theme="night"] .tribute { background: rgba(28, 37, 78, .6); border-color: rgba(255, 255, 255, .1); }
html[data-theme="night"] .tribute:hover { background: rgba(40, 52, 104, .85); }
html[data-theme="night"] .tabs button.active { color: var(--on-accent); }
html[data-theme="night"] input[type=text], html[data-theme="night"] input[type=email], html[data-theme="night"] input[type=password], html[data-theme="night"] input[type=date], html[data-theme="night"] textarea, html[data-theme="night"] select { background: rgba(10, 15, 36, .55); }
html[data-theme="night"] input:focus, html[data-theme="night"] textarea:focus { background: rgba(10, 15, 36, .8); }
html[data-theme="night"] .bubble.assistant { background: rgba(36, 48, 95, .85); }
html[data-theme="night"] .avatar, html[data-theme="night"] .gb-item .who { background: linear-gradient(145deg, #2a3670, #1a2350); border-color: rgba(255, 255, 255, .6); }
html[data-theme="night"] .chip:hover { color: var(--on-accent); }
html[data-theme="night"] .toast { background: rgba(240, 236, 220, .95); color: #1d1a2e; }
html[data-theme="night"] .cursor { mix-blend-mode: normal; border-color: rgba(233, 199, 123, .6); }

/* --- 시간대 하늘 (방문자 현지 시각) --- */
.sky { position: fixed; inset: 0; z-index: -3; pointer-events: none; background: linear-gradient(180deg, var(--sky-a), var(--sky-b) 45%, transparent 75%); transition: background 2s; }
.sky::after { content: ''; position: absolute; width: 360px; height: 360px; right: 6%; top: -120px; border-radius: 50%; background: radial-gradient(circle, var(--sun), transparent 65%); }
html[data-time="dawn"]   { --sky-a: rgba(255, 196, 170, .38); --sky-b: rgba(210, 190, 235, .14); --sun: rgba(255, 220, 190, .55); }
html[data-time="day"]    { --sky-a: rgba(255, 255, 255, .22); --sky-b: transparent;               --sun: rgba(255, 252, 235, .55); }
html[data-time="sunset"] { --sky-a: rgba(255, 150, 110, .30); --sky-b: rgba(200, 110, 160, .12); --sun: rgba(255, 175, 120, .5); }
html[data-time="night"]  { --sky-a: rgba(45, 55, 120, .20);   --sky-b: rgba(45, 55, 120, .06);   --sun: rgba(235, 238, 255, .45); }
html[data-theme="night"][data-time="day"]    { --sky-a: rgba(120, 150, 230, .22); --sun: rgba(200, 215, 255, .25); }
html[data-theme="night"][data-time="night"]  { --sky-a: rgba(0, 0, 0, .18); --sun: rgba(255, 248, 225, .35); }

/* --- 기일 --- */
.anniv-banner { margin: 26px auto 0; max-width: 620px; padding: 18px 24px 16px; border-radius: 22px; background: linear-gradient(135deg, rgba(255, 236, 200, .55), rgba(var(--acc), .10)); border: 1px solid rgba(255, 200, 120, .45); box-shadow: 0 0 40px -10px rgba(255, 180, 80, .45); }
html[data-theme="night"] .anniv-banner { background: linear-gradient(135deg, rgba(255, 210, 140, .12), rgba(255, 255, 255, .04)); }
.anniv-banner .candles { display: flex; justify-content: center; gap: 22px; margin-bottom: 10px; }
.anniv-banner .candles > span { display: grid; justify-items: center; }
.anniv-banner .candles > span:nth-child(2) .flame { animation-delay: .5s; }
.anniv-banner .candles > span:nth-child(3) .flame { animation-delay: 1s; }
.anniv-banner h3 { font-size: 19px; }
.anniv-banner p { margin: 6px 0 0; font-size: 14px; color: var(--ink-dim); }
body.memorial-day .glow b:nth-child(2) { background: radial-gradient(circle, rgba(255, 190, 110, .55), transparent 70%); }
body.memorial-day .tribute[data-kind="candle"] { box-shadow: 0 0 0 1px rgba(255, 190, 110, .6), 0 0 34px -6px rgba(255, 180, 80, .6); }

/* --- 작별 인사 모드 --- */
.farewell-note { margin: 12px 0 0; padding: 14px 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(var(--acc), .08), rgba(255, 255, 255, .4)); border: 1px solid var(--line-strong); font-size: 14px; line-height: 1.65; }
html[data-theme="night"] .farewell-note { background: rgba(255, 255, 255, .05); }
.farewell-note b { font-family: var(--serif); font-weight: 400; font-size: 15.5px; color: var(--gold-deep); }
html[data-theme="night"] .farewell-note b { color: var(--gold-2); }
.farewell-note .starters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.farewell-note .starters button { cursor: pointer; }
.chat-box.farewell { box-shadow: 0 0 0 1px rgba(var(--acc), .35), 0 26px 60px -30px rgba(var(--acc), .6); }
.bubble.fw { border-color: rgba(var(--acc), .45); }
@media (max-width: 640px) {
  .chat-head { flex-wrap: wrap; }
  .chat-head > div:last-child { width: 100%; justify-content: flex-start !important; }
}
.btn.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-deep); }
html[data-theme="night"] .btn.on { color: var(--gold-2); }

/* --- 테마 고르기 (만들기 화면) --- */
.theme-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 640px) { .theme-pick { grid-template-columns: repeat(2, 1fr); } }
.theme-pick label { cursor: pointer; display: grid; gap: 6px; padding: 10px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, .55); transition: .25s; text-align: center; font-size: 14px; }
.theme-pick label:hover { border-color: var(--gold); }
.theme-pick input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pick .sw { height: 54px; border-radius: 11px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05); position: relative; overflow: hidden; }
.theme-pick .sw::after { content: attr(data-ico); position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; }
.theme-pick small { font-size: 11.5px; color: var(--ink-faint); line-height: 1.4; }
.theme-pick label:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); background: #fff; }
html[data-theme="night"] .theme-pick label { background: rgba(255, 255, 255, .05); }
html[data-theme="night"] .theme-pick label:has(input:checked) { background: rgba(255, 255, 255, .12); }
.theme-pick input:focus-visible + .sw { outline: 2px solid var(--gold); outline-offset: 2px; }

/* --- QR 추모 카드 --- */
.qr-card { margin-top: 24px; }
.qr-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .qr-layout { grid-template-columns: 1fr; } }
.qr-preview { background: repeating-linear-gradient(45deg, rgba(var(--acc), .04) 0 10px, transparent 10px 20px); border-radius: 16px; padding: 18px; display: grid; place-items: center; min-height: 220px; }
.qr-preview canvas { max-width: 100%; height: auto; max-height: 460px; border-radius: 4px; box-shadow: 0 14px 40px -18px rgba(0, 0, 0, .35); background: #fff; }
.qr-opts { display: grid; gap: 12px; font-size: 14px; }
.qr-opts .seg { display: flex; flex-direction: column; gap: 6px; }
.qr-opts .seg label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.qr-opts input[type=radio] { accent-color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  .waves svg, .sky { animation: none; transition: none; }
  html[data-theme="night"] .petals { display: block; }
  html[data-theme="night"] .petals i { animation: none; opacity: .55; }
  .anniv-banner .flame { animation: none; }
}

/* 휴대폰 상단 메뉴: 글자가 세로로 깨지지 않게 */
.brand { white-space: nowrap; flex: none; }
.nav a, .nav span { white-space: nowrap; }
@media (max-width: 640px) {
  .topbar .wrap { height: 58px; gap: 10px; }
  .brand { font-size: 18px; gap: 8px; }
  .brand .mark { width: 24px; height: 24px; }
  .nav { gap: 14px; font-size: 13.5px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav span.faint { display: none; }
}
/* 묶음 탭: 이야기 · 사진·영상 · 마음 남기기 · 대화 · 설정 */
.tabs.grouped button { display: inline-flex; align-items: center; gap: 6px; font-size: 15.5px; padding: 10px 18px; }
.tabs.grouped .tab-ic { font-size: 16px; }
.panel.active + .panel.active { margin-top: 44px; }
.panel-title { font-size: 22px; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
#bio .panel-title { display: none; }
.demo-bar { margin: 20px 0 0; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 15px; padding: 14px 18px; }
@media (max-width: 760px) {
  .tabs.grouped {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; border-radius: 0; max-width: none;
    display: flex; justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 250, 252, .96); backdrop-filter: blur(12px); border: 0; border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -18px rgba(120, 60, 80, .5); opacity: 1 !important; transform: none !important;
  }
  .tabs.grouped button { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 12.5px; border-radius: 12px; min-width: 0; }
  .tabs.grouped button span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabs.grouped .tab-ic { font-size: 20px; }
  .tabs.grouped button.active { background: var(--gold-soft); color: var(--gold-deep); box-shadow: none; }
  body.has-tabbar { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .panel.active:first-of-type { margin-top: 24px; }
}
@media (max-width: 760px) { body.has-tabbar .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); } }
