/* 흰 바탕, iOS 느낌 */
:root {
  --bg: #ffffff;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --text3: #8e8e93;
  --fill: #f5f5f7;
  --fill2: #ececf0;
  --line: #d2d2d7;
  --sep: rgba(60, 60, 67, .14);
  --a: #5b8def;
  --b: #ff6f91;
  --heart: #ff375f;
  --heart-soft: #fff0f3;
  --green: #34c759;
  --red: #ff3b30;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --safe-t: env(safe-area-inset-top);
  --safe-b: env(safe-area-inset-bottom);
  --fallback: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard Variable', system-ui, sans-serif;
  --font: 'Gowun Dodum', var(--fallback);
  color-scheme: light;
}
/* 글꼴 (설정에서 바꿈) */
html[data-font='myeongjo'] { --font: 'Nanum Myeongjo', var(--fallback); }
html[data-font='pretendard'] { --font: 'Pretendard Variable', Pretendard, var(--fallback); }
html { font-synthesis: none; }
body.font-swap #app { animation: fontSwap .5s var(--ease); }
@keyframes fontSwap { 0% { opacity: .2; filter: blur(2px); } 100% { opacity: 1; filter: none; } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
}
html.locked, html.locked body { overflow: hidden; }
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: default; }
img { -webkit-touch-callout: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.splash { min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--text2); }
.hide { display: none !important; }

/* 누르는 느낌 */
.icon-btn, .add-photo, .album-empty, .heart-btn, .who-card, .btn-primary, .btn-small, .pill, .cday, .memory, .dday-cta,
.text-btn, .back-btn, .vbtn, .row, .action, .hero-person, .nav-title {
  transition: transform .25s var(--ease), opacity .2s, background-color .2s, box-shadow .25s;
}
.icon-btn:active, .add-photo:active, .album-empty:active, .who-card:active, .btn-primary:active, .btn-small:active, .pill:active,
.cday:not(:disabled):active, .memory:active, .dday-cta:active, .text-btn:active, .back-btn:active, .vbtn:active,
.action:active, .hero-person[data-avatar]:active {
  transform: scale(.96);
  opacity: .8;
}
.icon-btn:disabled, .btn-small:disabled { opacity: .3; }

/* ---------- 화면 전환 ---------- */
.enter-fade { animation: fadeIn .45s var(--ease); }
.enter-push { animation: pushIn .5s var(--ease); }
.enter-pop { animation: popIn .5s var(--ease); }
.leave-fade { animation: fadeOut .25s ease forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; transform: scale(.98); } }
@keyframes pushIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes popIn { from { opacity: .3; transform: translateX(-30px); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* ---------- 상단 바 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(54px + var(--safe-t));
  padding: var(--safe-t) 8px 0 16px;
  display: flex; align-items: center;
  transition: background-color .3s, box-shadow .3s;
}
.navbar.scrolled, .navbar.solid {
  background: rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 var(--sep);
}
.navbar.solid { padding-left: 6px; }
.nav-title {
  position: absolute; left: 50%; bottom: 15px; transform: translate(-50%, 6px);
  font-size: 17px; font-weight: 600; opacity: 0; pointer-events: none; white-space: nowrap;
  transition: opacity .25s, transform .35s var(--ease);
}
.nav-title.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.nav-actions { margin-left: auto; display: flex; gap: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn svg { width: 25px; height: 25px; stroke-width: 1.6; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 20px; height: 20px; stroke-width: 2; }
.back-btn { display: flex; align-items: center; height: 44px; padding-right: 8px; font-size: 17px; }
.back-btn svg { width: 26px; height: 26px; stroke-width: 2; margin-right: -2px; }

/* 둘의 프로필 + 함께한 날 */
.couple { display: flex; align-items: center; min-width: 0; }
.couple .av + .av { margin-left: -9px; }
.couple-days { margin-left: 9px; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; transition: opacity .25s; }
.navbar.scrolled .couple-days { opacity: 0; }

/* ---------- 프로필 사진 (없으면 이름 첫 글자) ---------- */
.av {
  width: 22px; height: 22px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center; overflow: hidden;
  font-family: var(--fallback); font-size: 11px; font-weight: 700; color: #fff; line-height: 1; letter-spacing: 0;
  background: var(--fill2);
}
.av-a { background: var(--a); }
.av-b { background: var(--b); }
.av.sm { width: 30px; height: 30px; font-size: 13px; box-shadow: 0 0 0 2px #fff; }
.av.lg { width: 56px; height: 56px; font-size: 22px; }
.av.xl { width: 76px; height: 76px; font-size: 28px; box-shadow: 0 0 0 3px #fff; }

/* ---------- 당겨서 새로고침 ---------- */
.ptr {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 8px); z-index: 19;
  margin-left: -16px; width: 32px; height: 32px; display: grid; place-items: center;
  opacity: 0; transition: transform .4s var(--ease), opacity .3s;
  pointer-events: none;
}
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.4px solid var(--fill2); border-top-color: var(--text);
}
.ptr.busy .spinner, .sentinel .spinner, .spinner.center { animation: spin .8s linear infinite; }
.spinner.center { margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.sentinel { padding: 24px 20px calc(var(--safe-b) + 90px); display: grid; place-items: center; }
.feed-end { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--text3); }
.feed-end svg { width: 14px; height: 14px; fill: var(--heart); stroke: none; }

/* ---------- 위쪽: 다가오는 기념일, 배너, 1년 전 오늘 ---------- */
.top { padding-top: 2px; }
.ddays { display: flex; gap: 8px; overflow-x: auto; padding: 2px 20px 6px; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 0 20px; }
.ddays::-webkit-scrollbar { display: none; }
.dday {
  flex: none; display: flex; align-items: center; gap: 10px; scroll-snap-align: start;
  padding: 10px 14px 10px 12px; background: var(--fill); border-radius: 18px;
  animation: rise .6s var(--ease) both;
}
.dday:nth-child(2) { animation-delay: 60ms; }
.dday:nth-child(3) { animation-delay: 120ms; }
.dday:nth-child(4) { animation-delay: 180ms; }
.dday-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #fff; }
.dday-icon svg { width: 20px; height: 20px; stroke-width: 1.7; display: block; }
.dday-icon.cake { color: #f08a3c; }
.dday-icon.hearts { color: var(--heart); }
.dday-icon.rings { color: #b8913a; }
.dday.today .dday-icon { background: #fff; box-shadow: 0 0 0 2px var(--heart-soft); }
.dday-text { display: flex; flex-direction: column; line-height: 1.3; }
.dday-text b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.dday-text small { font-size: 12px; color: var(--text3); white-space: nowrap; }
.dday-num { font-size: 17px; font-weight: 700; margin-left: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dday.soon .dday-num { color: var(--b); }
.dday.today { background: var(--heart-soft); }
.dday.today .dday-num { color: var(--heart); }
.dday-cta {
  display: flex; align-items: center; gap: 10px; text-align: left;
  margin: 2px 20px 6px; width: calc(100% - 40px); padding: 13px 14px;
  background: var(--fill); border-radius: 18px; font-size: 14px; color: var(--text2); line-height: 1.4;
}
.dday-cta span:not(.dday-cta-icon) { flex: 1; }
.dday-cta-icon { width: 32px; height: 32px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; color: var(--heart); }
.dday-cta-icon svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.dday-cta > svg { width: 16px; height: 16px; color: var(--text3); }

.banner {
  margin: 8px 20px 4px; padding: 14px; border-radius: 20px; background: var(--fill);
  display: flex; align-items: center; gap: 12px; overflow: hidden;
  animation: rise .6s var(--ease) both;
  transition: height .35s var(--ease), opacity .25s, margin .35s var(--ease), padding .35s var(--ease);
}
.banner.collapse { height: 0 !important; opacity: 0; margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
.banner-icon { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.banner-icon svg { width: 20px; height: 20px; }
.banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.banner-text b { font-size: 15px; font-weight: 600; }
.banner-text span { font-size: 13px; color: var(--text2); line-height: 1.4; }
.banner-x { width: 28px; height: 28px; display: grid; place-items: center; color: var(--text3); flex: none; }
.banner-x svg { width: 16px; height: 16px; }
.btn-small { background: var(--text); color: #fff; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; flex: none; white-space: nowrap; }
.pill { font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--fill); margin-right: 4px; }

.memory {
  display: flex; align-items: center; gap: 12px; text-align: left;
  margin: 8px 20px 4px; padding: 10px 12px 10px 10px; width: calc(100% - 40px);
  background: var(--fill); border-radius: 20px;
}
.memory.rise { animation: rise .6s var(--ease) both; }
.memory img, .memory-ph { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex: none; }
.memory-ph { display: grid; place-items: center; background: #fff; color: var(--heart); }
.memory-ph svg { fill: currentColor; stroke: none; }
.memory-text { flex: 1; min-width: 0; }
.memory-text small { display: block; font-size: 12px; font-weight: 700; color: var(--b); }
.memory-text p { margin: 1px 0 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.memory-chev { color: var(--text3); }
.memory-chev svg { width: 18px; height: 18px; }

/* ---------- 하루 기록 ---------- */
.entry { padding: 20px 20px 26px; position: relative; }
.entry + .entry::before {
  content: ''; position: absolute; top: 0; left: 20px; right: 20px; height: .5px; background: var(--sep);
}
.entry.rise { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
.entry.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { background: var(--fill); } 100% { background: transparent; } }

.entry-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; min-height: 36px; }
.entry-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.entry-head h2 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.03em; }
.entry-sub { font-size: 14px; color: var(--text3); font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; color: var(--b); align-self: center; }
.tag svg { width: 15px; height: 15px; stroke-width: 1.8; display: block; }
.add-photo { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; flex: none; color: var(--text); }
.add-photo svg { width: 19px; height: 19px; stroke-width: 1.7; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.a { background: var(--a); }
.dot.b { background: var(--b); }

/* 공용 앨범 (첫 사진 비율에 맞춰 4:5 ~ 4:3) */
.album { position: relative; aspect-ratio: 4 / 5; border-radius: 20px; overflow: hidden; background: var(--fill); transform: translateZ(0); }
.album-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.album-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; position: relative; overflow: hidden; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transform: scale(1.03); transition: opacity .6s var(--ease), transform .8s var(--ease); }
.slide img.in { opacity: 1; transform: none; }
.slide.uploading::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .3); }
.ring { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; transform: rotate(-90deg); z-index: 1; }
.ring circle { fill: none; stroke: #fff; stroke-width: 3; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .2s; }
.album-dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.album-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .5); box-shadow: 0 0 2px rgba(0, 0, 0, .15); transition: background .2s, transform .3s var(--spring); }
.album-dots i.on { background: #fff; transform: scale(1.15); }
.album-empty {
  width: 100%; aspect-ratio: 5 / 3; border-radius: 20px; border: 1.5px dashed var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.album-empty small { font-size: 13px; font-weight: 400; color: var(--text3); }
.album-empty-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--text); color: #fff; display: grid; place-items: center; margin-bottom: 6px; transition: transform .4s var(--spring); }
.album-empty:active .album-empty-icon { transform: scale(.9); }
.album-empty-icon svg { width: 22px; height: 22px; }

/* 캡션: 프로필 + 이름 + 한 줄 */
.captions { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.cap {
  display: grid; grid-template-columns: var(--namew, 80px) 1fr 30px; align-items: start; column-gap: 8px;
  margin: 0 -10px; padding: 7px 10px; border-radius: 12px;
  transition: background-color .25s;
}
.cap.mine { cursor: text; }
.cap.mine:active, .cap.editing { background: var(--fill); }
.cap-name { display: flex; align-items: center; gap: 7px; min-width: 0; height: 24px; }
.cap-who { font-size: 14px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap-text { margin: 0; font-size: 16px; line-height: 24px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; min-width: 0; }
.cap-text.placeholder, .cap-text.waiting { color: var(--text3); }
.cap-pending { display: inline-block; margin-left: 6px; font-size: 12px; color: var(--text3); vertical-align: 1px; }
.cap-pending::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #ff9f0a; margin-right: 4px; vertical-align: 1px; }
.cap-input {
  width: 100%; display: block; border: 0; outline: none; resize: none; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; line-height: 24px; padding: 0; margin: 0; overflow: hidden;
}
.cap-input::placeholder { color: var(--text3); }
.cap-liked { display: none; justify-self: center; color: var(--heart); padding-top: 3px; }
.cap-liked.on { display: block; animation: pop .5s var(--spring); }
.cap-liked svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.heart-btn { width: 30px; height: 24px; display: grid; place-items: center; color: var(--text3); }
.heart-btn svg { width: 20px; height: 20px; transition: fill .2s, color .2s; }
.heart-btn.on { color: var(--heart); }
.heart-btn.on svg { fill: currentColor; }
.heart-btn.pop svg { animation: pop .5s var(--spring); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

.first-hint { text-align: center; color: var(--text3); padding: 12px 20px 0; }
.first-hint svg { width: 34px; height: 34px; stroke-width: 1.4; }
.first-hint p { margin: 8px 0 0; font-size: 16px; color: var(--text2); font-weight: 600; }
.first-hint span { font-size: 14px; color: var(--text3); font-weight: 400; }

/* 처음 불러오는 동안 */
.skel-entry { padding: 22px 20px 26px; }
.skel { border-radius: 12px; background: linear-gradient(90deg, var(--fill) 30%, #ebebef 50%, var(--fill) 70%); background-size: 300% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skel-h { width: 46%; height: 30px; margin-bottom: 16px; }
.skel-album { aspect-ratio: 4 / 5; border-radius: 20px; }
.skel-line { height: 18px; margin-top: 16px; width: 82%; }
.skel-line.short { width: 56%; margin-top: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- 토스트 (위에서 내려오는 알약) ---------- */
#toast {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 10px); z-index: 100;
  transform: translate(-50%, -140%) scale(.9); opacity: 0;
  background: var(--text); color: #fff; border-radius: 999px;
  padding: 11px 20px; font-size: 14px; font-weight: 600; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  transition: transform .5s var(--spring), opacity .3s;
  pointer-events: none;
}
#toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }

/* ---------- 시트 ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .32); opacity: 0; transition: opacity .45s var(--ease); }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.closing .sheet-backdrop { opacity: 0; transition-duration: .3s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: var(--kb, 0px);
  max-width: 560px; margin: 0 auto;
  max-height: calc(100dvh - var(--kb, 0px) - var(--safe-t) - 20px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 24px 24px 0 0;
  padding-bottom: var(--safe-b);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .12);
  transform: translateY(105%);
  transition: transform .55s var(--ease);
  will-change: transform;
}
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-wrap.closing .sheet { transform: translateY(105%); transition-duration: .38s; }
.grabber-zone { padding: 8px 0 2px; flex: none; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 4px 18px 10px; flex: none; }
.sheet-head h3 { margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; }
.text-btn { justify-self: end; font-size: 17px; padding: 6px 2px; }
.text-btn.left { justify-self: start; }
.text-btn.strong { font-weight: 700; }
.text-btn:disabled { opacity: .4; }
.sheet-body { overflow-y: auto; padding: 0 20px 24px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-empty { text-align: center; color: var(--text3); padding: 40px 20px; margin: 0; }

/* 하루 시트 */
.day-nav { display: flex; align-items: center; gap: 2px; }
.sheet.day { min-height: min(62dvh, 560px); }
.sheet.day .sheet-body { padding: 0 0 20px; }
.sheet.day .entry { padding-top: 6px; }
.sheet.day .entry-head h2, .sheet.day .entry-sub { display: none; }
.sheet.day .entry-head { min-height: 0; margin-bottom: 10px; }
.day-body.in-right { animation: inRight .4s var(--ease); }
.day-body.in-left { animation: inLeft .4s var(--ease); }

/* 고르기 시트 (사진 바꾸기/지우기) */
.sheet.action-sheet { background: #f2f2f7; }
.actions { display: flex; flex-direction: column; gap: 8px; padding: 4px 16px 16px; }
.action { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; border-radius: 14px; background: #fff; font-size: 17px; }
.action svg { width: 20px; height: 20px; }
.action.danger { color: var(--red); }
.action.cancel { font-weight: 700; margin-top: 4px; }

/* 프로필 사진 자르기 */
.crop-body { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 6px; }
.crop-stage { position: relative; width: 260px; height: 260px; overflow: hidden; border-radius: 26px; background: #111; touch-action: none; cursor: grab; flex: none; }
.crop-stage img { position: absolute; left: 0; top: 0; max-width: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.crop-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 200px rgba(0, 0, 0, .45); pointer-events: none; outline: 2px solid rgba(255, 255, 255, .85); outline-offset: -2px; }
.crop-zoom { width: 240px; accent-color: var(--text); }
.crop-hint { font-size: 13px; color: var(--text3); margin: 0; text-align: center; }

/* 설정 */
.sheet.settings-sheet { background: #f2f2f7; }
.settings { padding: 0 16px 24px; }
.hero { display: flex; justify-content: center; align-items: flex-start; gap: 18px; padding: 6px 0 4px; }
.hero-person { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 104px; }
.hero-photo { position: relative; display: block; }
.hero-cam { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px #f2f2f7; }
.hero-cam svg { width: 15px; height: 15px; stroke-width: 2; }
.hero-name { font-size: 16px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 24px; color: var(--heart); }
.hero-mid svg { width: 22px; height: 22px; fill: currentColor; stroke: none; animation: beat 2.4s ease-in-out infinite; }
.hero-mid small { font-size: 12px; color: var(--text2); white-space: nowrap; }
@keyframes beat { 0%, 60%, 100% { transform: scale(1); } 10% { transform: scale(1.18); } 20% { transform: scale(.96); } 30% { transform: scale(1.1); } }
.group-label { font-size: 13px; color: var(--text2); padding: 20px 16px 6px; }
.group { background: #fff; border-radius: 14px; overflow: hidden; }
.group.logout { margin-top: 28px; }
.row {
  position: relative; width: 100%; min-height: 50px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 16px; text-align: left; background: #fff;
}
.row > span:first-child { flex: none; }
.row + .row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.row:not(label):active { background: var(--fill2); }
.row:disabled { opacity: .4; }
.row-main { display: flex; align-items: center; gap: 10px; }
.row-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--text); color: #fff; display: grid; place-items: center; }
.row-icon svg { width: 17px; height: 17px; }
.row-chev { color: var(--text3); display: flex; }
.row-chev svg { width: 17px; height: 17px; }
.row.danger { color: var(--red); justify-content: center; }
.row.danger.confirm { font-weight: 700; }
.row input[type='text'] {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; text-align: right;
  font: inherit; font-size: 16px; color: var(--text2); padding: 12px 0;
}
.row input[type='text']:focus { color: var(--text); }
.row input[type='date'] {
  -webkit-appearance: none; appearance: none; border: 0; outline: none;
  background: var(--fill); color: var(--text); border-radius: 8px;
  font: inherit; font-size: 16px; padding: 6px 10px; min-width: 132px; min-height: 34px; text-align: right;
}
.font-row .font-name { font-size: 17px; }
.font-row .font-desc { font-size: 13px; color: var(--text3); margin-left: 8px; font-family: var(--fallback); }
.font-row .check { color: var(--text); opacity: 0; transform: scale(.5); transition: opacity .2s, transform .35s var(--spring); }
.font-row.on .check { opacity: 1; transform: none; }
.font-row .check svg { width: 20px; height: 20px; stroke-width: 2.4; }
.group-foot { font-size: 13px; color: var(--text2); margin: 0; padding: 7px 16px 0; line-height: 1.45; }
.group-foot.center { text-align: center; padding-top: 12px; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 51px; height: 31px; border-radius: 31px; background: #e9e9eb; position: relative; cursor: pointer;
  transition: background-color .3s;
}
.switch::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .06);
  transition: transform .35s var(--spring);
}
.switch:checked { background: var(--green); }
.switch:checked::before { transform: translateX(20px); }
.switch:disabled { opacity: .4; }

/* 백업 */
.backup-intro { font-size: 14px; color: var(--text2); margin: 2px 4px 14px; line-height: 1.6; }
.backup-intro b { color: var(--text); }
.b-row { min-height: 64px; }
.b-info { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.b-info b { font-size: 16px; font-weight: 600; }
.b-info small { font-size: 13px; color: var(--text3); }
.b-row.sub { padding-left: 32px; }
.b-row.sub::before { left: 32px; }
.b-row.ready .btn-small { background: var(--green); }
.b-bar { position: absolute; left: 16px; right: 16px; bottom: 7px; height: 3px; border-radius: 2px; background: var(--fill2); overflow: hidden; opacity: 0; transition: opacity .3s; }
.b-row.busy .b-bar { opacity: 1; }
.b-bar i { display: block; height: 100%; width: 0; background: var(--text); border-radius: 2px; transition: width .25s; }
.b-row .btn-small { min-width: 84px; font-variant-numeric: tabular-nums; }
.b-empty { text-align: center; color: var(--text3); padding: 28px 16px; margin: 0; font-size: 15px; }

/* ---------- 사진 크게 보기 ---------- */
.viewer { position: fixed; inset: 0; z-index: 60; }
.viewer-bg { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity .4s var(--ease); }
.viewer.open .viewer-bg { opacity: 1; }
.viewer.closing .viewer-bg { opacity: 0; transition-duration: .35s; }
.viewer-track { position: absolute; inset: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; touch-action: pan-x; overscroll-behavior: contain; }
.viewer-track.zoomed { overflow: hidden; touch-action: none; }
.viewer-track::-webkit-scrollbar { display: none; }
.vslide { flex: 0 0 100%; height: 100%; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; scroll-snap-stop: always; overflow: hidden; }
.vslide img { max-width: 100%; max-height: 100%; display: block; -webkit-touch-callout: default; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; transition: transform .45s var(--ease), opacity .3s; will-change: transform; }
.viewer.closing .vslide img { transition-duration: .38s; }
.viewer-top {
  position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-t) + 8px) 14px 8px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; color: #fff;
  background: linear-gradient(rgba(0, 0, 0, .35), transparent);
  opacity: 0; transition: opacity .3s .1s;
}
.viewer.open .viewer-top { opacity: 1; }
.viewer.closing .viewer-top { opacity: 0; transition-delay: 0s; }
.vmeta { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.vmeta b { font-size: 15px; font-weight: 600; }
.vcount { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
.vactions { justify-self: end; display: flex; gap: 8px; }
.vbtn { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .16); display: grid; place-items: center; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.vbtn svg { width: 18px; height: 18px; stroke-width: 2.2; }
.vdel { width: auto; min-width: 38px; padding: 0 10px; border-radius: 19px; gap: 4px; display: flex; align-items: center; justify-content: center; transition: background-color .2s, padding .3s var(--ease), opacity .2s; }
.vdel span { display: none; font-size: 14px; font-weight: 700; }
.vdel.confirm { background: var(--red); padding: 0 14px; }
.vdel.confirm span { display: inline; }
.vdel.hide { display: none; }

/* ---------- 로그인 ---------- */
.login-view { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--safe-t) + 20px) 28px calc(var(--safe-b) + 40px); }
.login-top { text-align: center; }
.mark { width: 64px; height: 44px; margin: 0 auto 18px; position: relative; }
.mark i { position: absolute; top: 0; width: 44px; height: 44px; border-radius: 50%; mix-blend-mode: multiply; animation: markIn .9s var(--spring) both; }
.mark .a { left: 0; background: var(--a); }
.mark .b { right: 0; background: var(--b); animation-delay: .08s; }
@keyframes markIn { from { transform: scale(.3); opacity: 0; } }
.login-top h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -0.035em; }
.login-top p { margin: 6px 0 0; color: var(--text2); font-size: 15px; }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 36px; }
.who-card { background: var(--fill); border-radius: 22px; padding: 22px 12px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.who-pick.picked .who-card:not(.on) { opacity: .45; }
.who-card.on { background: #fff; box-shadow: 0 0 0 2px var(--text), 0 10px 30px rgba(0, 0, 0, .08); }
.who-name { font-size: 16px; font-weight: 600; }
.pass-form {
  display: grid; gap: 10px; margin-top: 18px;
  max-height: 0; opacity: 0; transform: translateY(12px); overflow: hidden;
  transition: max-height .55s var(--ease), opacity .4s, transform .55s var(--ease);
}
.pass-form.show { max-height: 200px; opacity: 1; transform: none; }
.pass-form input {
  height: 54px; border-radius: 16px; border: 0; outline: none; background: var(--fill); color: var(--text);
  font: inherit; font-size: 17px; text-align: center; padding: 0 18px;
  transition: box-shadow .2s;
}
.pass-form input:focus { box-shadow: 0 0 0 2px var(--text) inset; }
.btn-primary { height: 54px; border-radius: 16px; background: var(--text); color: #fff; font-size: 17px; font-weight: 600; }
.btn-primary.loading { opacity: .5; pointer-events: none; }
.shake { animation: shake .45s var(--ease); }
@keyframes shake { 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(3px); } }

/* ---------- 달력 ---------- */
.cal-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 10px 10px 14px 20px; }
.cal-head h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; }
.cal-head h1 span { font-size: 22px; font-weight: 600; color: var(--text3); margin-left: 4px; letter-spacing: -0.02em; }
.cal-arrows { display: flex; align-items: center; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 14px 6px; }
.weekdays span { text-align: center; font-size: 12px; font-weight: 600; color: var(--text3); }
.weekdays span:first-child { color: var(--b); }
.cal-grid-wrap { padding: 0 14px; overflow: hidden; touch-action: pan-y; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid.in-right { animation: inRight .45s var(--ease); }
.cal-grid.in-left { animation: inLeft .45s var(--ease); }
@keyframes inRight { from { opacity: 0; transform: translateX(28px); } }
@keyframes inLeft { from { opacity: 0; transform: translateX(-28px); } }
.cday {
  position: relative; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; padding-top: 5px;
  font-size: 15px; font-weight: 500;
}
.cday img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s var(--ease); }
.cday img.in { opacity: 1; }
.cday.has::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, .32), transparent 50%); }
.cday .n { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; line-height: 1; }
.cday.has .n { color: #fff; font-weight: 600; }
.cday.note { background: var(--fill); }
.cday.today .n { background: var(--text); color: #fff; font-weight: 700; }
.cday.has.today .n { background: #fff; color: var(--text); }
.cday.future { color: #c7c7cc; }
.cdots { position: absolute; bottom: 6px; left: 0; right: 0; z-index: 1; display: flex; justify-content: center; gap: 3px; }
.cdots .dot { width: 6px; height: 6px; }
.cday.has .cdots .dot { box-shadow: 0 0 0 1.5px #fff; }
.legend { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: var(--text2); margin: 16px 0 6px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 20px calc(var(--safe-b) + 40px); }
.stat { background: var(--fill); border-radius: 18px; padding: 16px 12px 14px; }
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* 다른 날 기록하기 */
.pick-body { display: flex; flex-direction: column; gap: 14px; padding-bottom: 28px; }
.pick-hint { margin: 0; font-size: 14px; color: var(--text2); }
.pick-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick-quick .pill { margin: 0; padding: 12px 6px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 15px; }
.pick-quick .pill small { font-size: 12px; font-weight: 400; color: var(--text3); }
.pick-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--fill); border-radius: 16px; padding: 8px 8px 8px 16px; font-size: 16px; }
.pick-field input { -webkit-appearance: none; appearance: none; border: 0; outline: none; background: #fff; color: var(--text); border-radius: 10px; font: inherit; font-size: 16px; padding: 8px 12px; min-height: 40px; min-width: 150px; text-align: right; }

/* ---------- 댓글 · 답글 ---------- */
.cmts { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sep); }
.cmts-list:empty { display: none; }
.cmts-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
.cmt { display: flex; gap: 9px; align-items: flex-start; animation: cmtIn .4s var(--ease) both; border-radius: 12px; transition: background-color .25s; }
.cmt.reply { margin-left: 31px; }
.cmt.pending { opacity: .55; }
.cmt.target { background: var(--fill); box-shadow: 0 0 0 6px var(--fill); }
.cmt .av { margin-top: 1px; }
.cmt-main { min-width: 0; flex: 1; }
.cmt-text { margin: 0; font-size: 15px; line-height: 22px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.cmt-text b { font-weight: 700; margin-right: 6px; }
.cmt-meta { display: flex; align-items: center; gap: 12px; margin-top: 2px; font-size: 12.5px; color: var(--text3); }
.cmt-meta button { font-size: 12.5px; color: var(--text2); font-weight: 600; padding: 2px 0; transition: color .2s; }
.cmt-meta .cmt-del.confirm { color: var(--red); }
.cmt-more { font-size: 14px; color: var(--text3); padding: 0; text-align: left; align-self: flex-start; }
@keyframes cmtIn { from { opacity: 0; transform: translateY(6px); } }

.cmt-open {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 20px;
  background: var(--fill); color: var(--text3); font-size: 15px; text-align: left; transition: background-color .2s, transform .2s var(--ease);
}
.cmt-open:active { background: var(--fill2); transform: scale(.985); }
.cmt-ctx { display: none; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text2); padding: 0 4px 6px 4px; }
.cmt-ctx.show { display: flex; animation: cmtIn .3s var(--ease) both; }
.cmt-ctx button { font-size: 13px; color: var(--text3); font-weight: 600; }
.cmt-form { display: flex; align-items: flex-end; gap: 9px; padding: 6px 6px 6px 12px; border-radius: 20px; background: var(--fill); animation: cmtIn .3s var(--ease) both; }
.cmt-form .av { margin-bottom: 7px; }
.cmt-input {
  flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; line-height: 22px; padding: 6px 0; margin: 0; max-height: 140px;
}
.cmt-input::placeholder { color: var(--text3); }
.cmt-send {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--text); color: #fff; transition: opacity .2s, transform .25s var(--spring);
}
.cmt-send svg { width: 17px; height: 17px; stroke-width: 2.4; }
.cmt-send:disabled { opacity: .18; }
.cmt-send:not(:disabled):active { transform: scale(.88); }

/* 사진 크게 보기: 아래쪽 바꾸기 · 내리기 */
.viewer-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(var(--safe-b) + 18px);
  display: flex; justify-content: center; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .35));
  opacity: 0; transition: opacity .3s .1s; pointer-events: none;
}
.viewer.open .viewer-bottom { opacity: 1; }
.viewer.closing .viewer-bottom { opacity: 0; transition-delay: 0s; }
.vown { display: flex; gap: 10px; pointer-events: auto; }
.vown.hide { display: none; }
.vby { margin: 0; font-size: 13px; opacity: .8; }
.vby:empty { display: none; }
.vpill {
  height: 40px; padding: 0 16px; border-radius: 20px; display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .18); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; transition: background-color .2s, transform .2s var(--ease);
}
.vpill svg { width: 17px; height: 17px; stroke-width: 2.2; }
.vpill:active { transform: scale(.95); }
.vpill.vdel { width: auto; min-width: 0; }
.vpill.vdel span { display: inline; font-size: 14px; }
.vpill.vdel.confirm { background: var(--red); padding: 0 16px; }
