/* ===== 기본 변수 (다크모드) ===== */
:root {
  --bg: #0f0f17;
  --bg-elev: #1a1a26;
  --bg-card: #20202e;
  --border: #2c2c3d;
  --text: #ececf1;
  --text-dim: #9a9aae;
  --muted: #6b6b80;
  --accent: #ff6b8a;
  --accent-2: #b76bff;
  --accent-soft: rgba(255, 107, 138, 0.15);
  --accent-gradient: linear-gradient(135deg, #ff6b8a, #b76bff);
  --danger: #ff5e5e;
  --success: #5eda9b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(72px + var(--safe-bottom));
}

h1, h2, h3 { margin: 0; font-weight: 700; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ===== 헤더 ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 18px 12px;
  background: rgba(15, 15, 23, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 8px; }
.app-header h1 { font-size: 18px; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* D-day chip */
.dday-chip {
  background: linear-gradient(135deg, rgba(255,107,138,0.25), rgba(183,107,255,0.25));
  border: 1px solid rgba(255,107,138,0.35);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  transition: transform .1s, background .15s;
  white-space: nowrap;
}
.dday-chip:active { transform: scale(0.95); }
.dday-chip #dday-chip-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 모달 닫기 X 버튼 */
.modal-close-x {
  position: absolute;
  top: 14px; right: 14px;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 18px;
  width: 32px; height: 32px;
  border-radius: 50%;
}
.modal-close-x:hover { background: var(--bg-card); color: var(--text); }
.modal-card { position: relative; }
.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent);
}
.icon-btn {
  background: transparent;
  color: var(--text);
  border: none;
  font-size: 20px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.icon-btn:hover, .icon-btn:active { background: var(--bg-elev); }
a.icon-btn { text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; display: block; }

/* ===== 메인 ===== */
main {
  flex: 1;
  padding: 18px 18px 28px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel { display: none; animation: fadeIn .25s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===== D-day 영역 ===== */
.dday-hero {
  margin: 8px 0 28px;
  padding: 32px 20px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255,107,138,0.18), rgba(183,107,255,0.18));
  border: 1px solid var(--border);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
}
.dday-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255,107,138,0.25), transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(183,107,255,0.25), transparent 50%);
  pointer-events: none;
}
.dday-label { margin: 0; color: var(--text-dim); font-size: 13px; letter-spacing: 1px; }
.dday-hero h2 {
  font-size: 48px;
  margin: 10px 0 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  letter-spacing: -1px;
}
.dday-sub { margin: 0; color: var(--text-dim); font-size: 13px; }

/* 섹션 헤더 */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 4px 12px;
}
.section-head h3 { font-size: 15px; color: var(--text-dim); font-weight: 600; }
.btn-add {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(255,107,138,0.3);
  width: 32px; height: 32px;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.btn-add:hover { background: rgba(255,107,138,0.25); }

/* 카드 리스트 */
.card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.card-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 600; margin: 0 0 2px; font-size: 15px; }
.card-sub { margin: 0; font-size: 12px; color: var(--text-dim); }
.card-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.card-delete {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 4px 6px;
  font-size: 16px;
}
.card-delete:hover { color: var(--danger); }

.card-item.clickable .card-main { cursor: pointer; }
.card-item.clickable:hover { border-color: rgba(255,107,138,0.4); }
.card-time {
  color: var(--accent);
  font-weight: 700;
  margin-right: 2px;
}
.muted-inline { color: var(--muted); font-size: 11px; margin-left: 4px; }

/* 위시리스트 */
.wish-item { gap: 10px; }
.wish-check {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.wish-item.done .wish-check {
  background: linear-gradient(135deg, var(--success), #6ed8ad);
  border-color: var(--success);
  color: #0f0f17;
}
.wish-item.done .card-title { text-decoration: line-through; color: var(--text-dim); }
.wish-priority {
  color: var(--accent);
  font-size: 12px;
  margin-right: 6px;
  letter-spacing: 0;
}
.wish-category-chip {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-2);
  background: rgba(183, 107, 255, 0.14);
  border: 1px solid rgba(183, 107, 255, 0.35);
  border-radius: 999px;
  vertical-align: middle;
}
.wish-place {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-dim);
  word-break: keep-all;
}
.wish-open-link {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 4px;
  transition: all .15s;
}
.wish-open-link:hover {
  background: rgba(255,107,138,0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* 위시 탭 — 카테고리 필터 칩 가로 스크롤 */
.wish-cat-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: -2px -4px 12px;
  padding: 6px 4px 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.wish-cat-strip::-webkit-scrollbar { display: none; }
.wish-cat-filter {
  flex-shrink: 0;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.wish-cat-filter:hover { color: var(--text); border-color: var(--text-dim); }
.wish-cat-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 위시 모달 — 카테고리 추천 칩 */
.wish-cat-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 12px;
}
.wish-cat-suggest-chip {
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s ease;
}
.wish-cat-suggest-chip:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.wish-cat-suggest-chip.active {
  background: rgba(183, 107, 255, 0.2);
  border-color: var(--accent-2);
  color: var(--accent-2);
}

/* 위시 모달 — 장소 미리보기 박스 */
.wish-place-preview {
  margin: 6px 0 12px;
  padding: 12px 14px;
  background: rgba(183, 107, 255, 0.08);
  border: 1px solid rgba(183, 107, 255, 0.25);
  border-radius: 12px;
}
.wish-place-preview.hidden { display: none; }
.wish-place-preview .wish-place-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.wish-place-preview .wish-place-addr {
  margin: 4px 0 0;
  font-size: 12px;
}
.wish-place-preview .wish-place-chip {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-2);
  background: rgba(183, 107, 255, 0.18);
  border-radius: 999px;
}

/* ====== 🎲 추억 한 장 (랜덤 회상 카드) ====== */
.throwback-wrap {
  margin: 0 0 14px;
}
.throwback-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(255,107,138,0.16), rgba(183,107,255,0.16));
  border: 1px solid rgba(255,107,138,0.3);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.throwback-btn:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(255,107,138,0.28), rgba(183,107,255,0.28));
  transform: translateY(-1px);
}
.throwback-btn:active { transform: translateY(0); }
.throwback-btn.throwback-empty { opacity: 0.6; }
.throwback-icon { font-size: 15px; }

.throwback-card {
  margin-top: 10px;
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 8px 8px 12px;
  box-shadow: var(--shadow);
}
.throwback-card.hidden { display: none; }
.throwback-photo-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card);
}
#throwback-photo {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
  transition: transform .35s ease;
}
.throwback-photo-wrap:hover #throwback-photo { transform: scale(1.03); }
.throwback-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 24px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
}
.throwback-date {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.throwback-hint {
  font-size: 11px;
  opacity: 0.85;
  background: rgba(255,255,255,0.15);
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.throwback-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: 0;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.throwback-shuffle {
  display: block;
  margin: 10px auto 0;
  padding: 8px 18px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.throwback-shuffle:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.throwback-fade {
  animation: throwback-fade-in .35s ease;
}
@keyframes throwback-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-card select {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
}
.modal-card select:focus { outline: none; border-color: var(--accent); }

/* ===== 캘린더 ===== */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-header h3 { font-size: 17px; }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 0;
}
.cal-weekdays span:first-child { color: #ff8a8a; }
.cal-weekdays span:last-child { color: #8aaaff; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.cal-cell {
  min-height: 92px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 4px 5px 5px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: background .15s, border-color .15s;
}
.cal-cell.muted { color: var(--muted); background: transparent; cursor: default; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.selected { background: var(--accent-soft); border-color: var(--accent); }
.cal-cell.has-content { background: color-mix(in srgb, var(--bg-card), var(--accent) 5%); }
.cal-cell.sunday .cal-day { color: #ff8a8a; }
.cal-cell.saturday .cal-day { color: #8aaaff; }

.cal-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 2px;
}
.cal-day { font-size: 12px; font-weight: 600; }
.cal-badges {
  display: inline-flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 9px;
  line-height: 1;
}
.cal-badge {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--text-dim);
  background: rgba(0,0,0,0.05);
  white-space: nowrap;
}
.cal-badge-call  { background: rgba(60,120,220,0.14); color: #4a78c4; }
.cal-badge-photo { background: rgba(220,80,140,0.14); color: #c45a85; }
.cal-badge-memo  { background: rgba(110,180,90,0.14); color: #6aa05a; }

.cal-anni, .cal-evt, .cal-story {
  font-size: 10.5px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  padding: 1px 4px;
  border-radius: 4px;
}
.cal-anni { background: rgba(255,180,80,0.16); color: #c0792b; font-weight: 600; }
.cal-evt-confirmed { background: rgba(150,90,220,0.14); color: #7a4cc0; }
.cal-evt-draft { background: rgba(150,90,220,0.08); color: #9888a8; font-style: italic; }
.cal-evt-more { opacity: 0.6; font-size: 9px; }
.cal-story { color: var(--text-dim); font-style: italic; }

@media (max-width: 480px) {
  .cal-cell { min-height: 78px; padding: 3px 3px 4px; }
  .cal-day { font-size: 11px; }
  .cal-badge { padding: 1px 3px; font-size: 8.5px; }
  .cal-anni, .cal-evt, .cal-story { font-size: 9.5px; padding: 0 3px; }
}

/* ===== 빈 상태 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state .muted { font-size: 13px; }

/* ===== History 탭 (사진+일기 통합) ===== */
.head-actions { display: flex; gap: 8px; align-items: center; }
.btn-ghost-sm {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}
.btn-ghost-sm:hover { background: var(--border); }
.fav-filter-btn { min-width: 34px; padding: 6px 10px; font-size: 15px; line-height: 1; }
.fav-filter-btn.active {
  background: rgba(255, 107, 138, 0.16);
  border-color: var(--accent);
  color: var(--accent);
}

#history-list { display: flex; flex-direction: column; gap: 18px; }
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-date-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  row-gap: 4px;
}
.history-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}
.history-photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  position: relative;
}
.history-photo-cell {
  position: relative;
  aspect-ratio: 1 / 1;
}
.history-photos img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .12s, opacity .2s, filter .2s;
}
.history-photos img:active { transform: scale(0.96); }

/* 업로드 중인 사진 — 살짝 어둡게 + 회전 스피너 */
.history-photo-cell.is-pending img {
  opacity: 0.55;
  filter: saturate(0.6);
}
.history-photo-cell .photo-spinner {
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: photo-spin 0.8s linear infinite;
  pointer-events: none;
}
@keyframes photo-spin { to { transform: rotate(360deg); } }

/* 업로드 실패 — 빨간 ! 배지 + 흐릿 */
.history-photo-cell.is-failed img {
  opacity: 0.4;
  filter: grayscale(0.7);
}
.history-photo-cell .photo-failed-badge {
  position: absolute;
  right: 4px; top: 4px;
  width: 18px; height: 18px;
  background: #ff4d4f;
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.history-photo-more {
  position: absolute;
  right: 0; bottom: 0;
  width: calc(25% - 3px);
  aspect-ratio: 1 / 1;
  background: rgba(0,0,0,0.65);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 700;
  pointer-events: none;
}
.history-memory {
  cursor: pointer;
  padding: 10px 12px;
  background: var(--bg-elev);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  transition: background .15s;
}
.history-memory:hover { background: var(--border); }
.history-memory-title {
  font-weight: 700;
  margin: 0 0 4px;
  font-size: 15px;
}
.history-memory-content {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-write-btn {
  background: transparent;
  color: var(--accent);
  border: 1px dashed rgba(255,107,138,0.4);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.history-write-btn:hover { background: var(--accent-soft); }

/* 추억 모달 */
.memory-card { max-width: 480px; }

/* 분할 레이아웃: 일기(고정) / 사진(스크롤) — 일기는 위에 고정, 사진은 위아래로 스크롤 */
.modal-card.memory-card {
  display: flex; flex-direction: column;
  overflow: hidden;            /* 카드 자체는 스크롤 안 함 — 내부 pane들이 스크롤 */
  max-height: 90vh;
}
.memory-card > h3 { flex: 0 0 auto; }
.memory-body {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0; gap: 10px;
}
/* 단일 스크롤: 바깥 .memory-body 한 곳만 스크롤(일기 pane의 자체 38vh 스크롤 제거).
   → 중첩 스크롤이 없어서 긴 일기도 끝까지 내려가고, 편집 중 커서가 위로 튀지 않음. */
.memory-diary-pane {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.memory-photos-pane {
  flex: 0 0 auto; min-height: 0;
}
.memory-actions { flex: 0 0 auto; }

.memory-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 4px 0 14px;
}
.memory-photos img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}
.memory-diary { display: flex; flex-direction: column; }
/* 제목 + 기분 한 줄 (공간 절약) */
.memory-diary-row { display: flex; gap: 10px; align-items: flex-start; }
.memory-field-title { flex: 1 1 auto; min-width: 0; }
.memory-field-mood { flex: 0 0 auto; width: 120px; }
.memory-field-mood select { min-width: 0; }

/* memory 모달 — 읽기 모드 vs 수정 모드 */
.memory-edit-toggle {
  position: absolute;
  top: 14px; right: 54px;       /* 닫기 X 옆 */
  padding: 5px 12px;
  background: rgba(255, 107, 138, 0.15);
  color: var(--accent);
  border: 1px solid rgba(255, 107, 138, 0.35);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s ease;
  z-index: 2;
}
.memory-edit-toggle:hover {
  background: rgba(255, 107, 138, 0.25);
  border-color: var(--accent);
}
#memory-modal.is-editing .memory-edit-toggle {
  background: rgba(94, 218, 155, 0.12);
  color: var(--success);
  border-color: rgba(94, 218, 155, 0.35);
}

/* 읽기 모드: input/textarea/select를 평문처럼 보이게 */
#memory-modal:not(.is-editing) .memory-diary input,
#memory-modal:not(.is-editing) .memory-diary textarea,
#memory-modal:not(.is-editing) .memory-diary select {
  background: transparent !important;
  border: 0 !important;
  padding: 4px 0 !important;
  cursor: default !important;
  resize: none !important;
  pointer-events: none;
  color: var(--text);
  outline: none !important;
}
#memory-modal:not(.is-editing) .memory-diary textarea {
  min-height: auto;
  height: auto;
}
#memory-modal:not(.is-editing) .memory-diary .muted-inline,
#memory-modal:not(.is-editing) .memory-diary label > span {
  display: none;
}
#memory-modal:not(.is-editing) .memory-diary label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
}
#memory-modal:not(.is-editing) .memory-diary input::placeholder,
#memory-modal:not(.is-editing) .memory-diary textarea::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

/* 캘린더에서 memory 표시 (포인터 강조) */
.memory-event { border-left: 3px solid var(--accent); }

/* 장소 라벨 — 날짜 옆에 인라인으로 붙음 */
.history-places {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* 지도 탭 */
#map-canvas {
  width: 100%;
  height: calc(100vh - 290px);
  min-height: 380px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e7e6e2;
}
.leaflet-container { background: #e7e6e2 !important; font-family: inherit !important; }
.leaflet-popup-content-wrapper {
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 12px;
}
.leaflet-popup-tip { background: var(--bg-elev); }
.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
  border-radius: 12px !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: rgba(26, 26, 38, 0.92) !important;
  color: var(--text) !important;
  border-color: rgba(255,255,255,0.06) !important;
  backdrop-filter: blur(8px);
  width: 36px !important; height: 36px !important;
  line-height: 36px !important;
  font-size: 17px !important;
}
.leaflet-control-zoom a:hover { background: rgba(255,107,138,0.2) !important; color: var(--accent) !important; }
.leaflet-control-attribution { display: none !important; }

/* 지도 상단 요약 카드 */
.map-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255,107,138,0.08), rgba(183,107,255,0.08));
  border: 1px solid rgba(255,107,138,0.18);
  border-radius: var(--radius);
}
.map-summary-stats {
  display: flex;
  align-items: center;
  gap: 14px;
}
.map-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--text);
  font-size: 12px;
}
.map-stat b {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.map-stat-divider {
  width: 1px; height: 18px;
  background: var(--border);
}
.map-filter-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.map-filter-strip::-webkit-scrollbar { display: none; }
.map-filter {
  flex-shrink: 0;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.map-filter:hover { color: var(--text); border-color: var(--text-dim); }
.map-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 사진 마커 (조금 더 둥글고 부드러운 그림자) */
.photo-marker-wrap {
  background: transparent !important;
  border: 0 !important;
}
.photo-marker {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: visible;
  background: #fff;
  border: 2.5px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.photo-marker:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 22px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,107,138,0.4);
}
.photo-marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 11px;
}
.photo-marker::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid #fff;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}
.photo-marker.is-cluster img { filter: brightness(0.55); }
.photo-marker-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  border-radius: 11px;
}

/* 위시 마커 (보라색 별, 갔다옴은 초록 ✓) */
.wish-marker-wrap {
  background: transparent !important;
  border: 0 !important;
}
.wish-marker {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b76bff, #8e3df5);
  border: 2.5px solid #fff;
  box-shadow: 0 4px 14px rgba(143, 51, 245, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.wish-marker:hover { transform: translateY(-2px) scale(1.08); }
.wish-marker.visited {
  background: linear-gradient(135deg, #5eda9b, #2eb87a);
  box-shadow: 0 4px 14px rgba(46, 184, 122, 0.5);
}
.wish-marker.is-cluster { width: 42px; height: 42px; }
.wish-marker-icon {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  z-index: 1;
}
.wish-marker::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #fff;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}
.wish-marker-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(183, 107, 255, 0.5);
  animation: wish-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
.wish-marker.visited .wish-marker-pulse { border-color: rgba(94, 218, 155, 0.5); }
@keyframes wish-pulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  100% { transform: scale(1.7); opacity: 0; }
}
.wish-marker-count {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: #fff;
  color: var(--accent-2);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--accent-2);
}

/* markercluster 기본 클래스가 같이 붙어도 우리 스타일 유지 */
.leaflet-marker-icon.photo-marker-wrap,
.leaflet-marker-icon.wish-marker-wrap { background: transparent !important; }
.marker-cluster, .marker-cluster div {
  background: transparent !important;
  box-shadow: none !important;
}
.marker-cluster span { display: none; }

/* 사진 위치 마커 (단일) + 클러스터 (여러 장) — 구글포토식 썸네일 핀 */
.map-photo-marker, .map-cluster { background: transparent !important; border: 0 !important; }
.map-photo-marker-inner {
  width: 44px; height: 44px; border-radius: 10px; overflow: hidden;
  border: 2px solid #fff; box-shadow: 0 2px 7px rgba(0,0,0,0.5); background: #1a1a26;
}
.map-photo-marker-inner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-cluster-inner {
  position: relative; width: 54px; height: 54px; border-radius: 13px; overflow: hidden;
  border: 2px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,0.55); background: #1a1a26;
}
.map-cluster-inner img { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(0.6); }
.map-cluster-count {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 17px; text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* 사진 마커 hover/long-tap tooltip — 날짜 빠른 확인 */
.leaflet-tooltip.photo-tooltip {
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}
.leaflet-tooltip.photo-tooltip::before {
  border-top-color: rgba(0,0,0,0.85);
}

/* 위시 마커 클릭 popup */
.leaflet-popup.wish-popup .leaflet-popup-content-wrapper {
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 14px;
  padding: 0;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.leaflet-popup.wish-popup .leaflet-popup-content {
  margin: 0;
  padding: 14px;
  font-size: inherit;
  line-height: 1.4;
}
.leaflet-popup.wish-popup .leaflet-popup-tip {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-top: 0;
  border-left: 0;
}
.wish-popup-card { display: flex; flex-direction: column; gap: 6px; }
.wish-popup-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.wish-popup-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.wish-popup-cat {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(183, 107, 255, 0.18);
  border: 1px solid rgba(183, 107, 255, 0.4);
  border-radius: 999px;
}
.wish-popup-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: -2px;
}
.wish-popup-addr {
  font-size: 12px;
  color: var(--text-dim);
  word-break: keep-all;
}
.wish-popup-memo {
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 8px;
  background: var(--bg-card);
  border-radius: 8px;
}
.wish-popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.wish-popup-actions button {
  flex: 1;
  min-width: 0;
  padding: 8px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s ease;
  white-space: nowrap;
}
.wish-popup-actions button:hover {
  background: rgba(255,107,138,0.1);
  border-color: var(--accent);
  color: var(--accent);
}
.wish-popup-check.is-done {
  background: rgba(94, 218, 155, 0.18);
  border-color: var(--success);
  color: var(--success);
}

/* 사진 뷰어 — 상단 메타 오버레이 (날짜/장소/카운터) */
.photo-meta {
  position: absolute;
  top: calc(20px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  color: #fff;
  z-index: 2;
  max-width: 80%;
  pointer-events: none;
  text-align: center;
}
#photo-meta-date { font-size: 13px; font-weight: 600; }
#photo-meta-place { font-size: 11px; opacity: 0.85; }
#photo-meta-counter { font-size: 10px; opacity: 0.65; letter-spacing: 0.8px; margin-top: 1px; }

/* 사진 뷰어 하단 바 — 4개 액션 버튼 가로 정렬 (모바일에서도 fit) */
.photo-viewer-bar {
  position: absolute;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  scrollbar-width: none;
}
.photo-viewer-bar::-webkit-scrollbar { display: none; }
.photo-viewer-bar .photo-action {
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 8px 12px;
  border-radius: 999px;
  width: auto;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all .12s ease;
}
.photo-viewer-bar .photo-action:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
}
.photo-viewer-bar .photo-action.btn-danger {
  background: rgba(255, 94, 94, 0.15);
  color: #ff8a8a;
  border-color: rgba(255, 94, 94, 0.4);
}
.photo-viewer-bar .photo-action.btn-danger:hover {
  background: rgba(255, 94, 94, 0.3);
  color: #fff;
}
.photo-mapview.hidden { display: none; }

/* ===== 교환일기 ===== */
.diary-compose {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.diary-compose textarea,
.diary-compose select {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  resize: vertical;
  width: 100%;
}
.diary-compose textarea:focus,
.diary-compose select:focus { outline: none; border-color: var(--accent); }

.diary-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.diary-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
}
.diary-item.me { border-left: 3px solid var(--accent); }
.diary-item.partner { border-left: 3px solid var(--accent-2); }
.diary-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.diary-author { font-weight: 700; color: var(--text); }
.diary-content { font-size: 14px; white-space: pre-wrap; word-break: break-word; }

/* ===== 하단 탭 (5탭 + 중앙 ＋ FAB) ===== */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  background: rgba(20, 20, 30, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(10px + var(--safe-bottom));
  z-index: 40;
}
.nav-btn {
  flex: 1;
  position: relative;
  background: transparent;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  transition: color .15s;
}
.nav-icon { display: flex; }
.nav-icon svg { width: 23px; height: 23px; display: block; }
.nav-label { font-size: 11px; letter-spacing: 0.3px; font-weight: 500; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active .nav-label { font-weight: 700; }
.nav-btn.active .nav-icon svg { stroke-width: 2.3; }

/* 중앙 ＋ FAB */
.nav-fab {
  width: 54px; height: 54px;
  margin: -24px 2px 0;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: transform .12s;
}
.nav-fab svg { width: 26px; height: 26px; }
.nav-fab:active { transform: scale(0.92); }

/* 대화 안 읽은 개수 배지 */
.nav-badge {
  position: absolute; top: 0; left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 4px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  text-align: center; box-shadow: 0 0 0 2px var(--bg-elev);
}
.nav-badge[hidden] { display: none; }
/* 추억 탭 안 읽은 점 (레거시 호환) */
.tab-dot {
  position: absolute; top: 4px; left: 50%; margin-left: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--bg-elev);
}
.tab-dot[hidden] { display: none; }

/* ===== 추억 탭 내부 타임라인/영상 토글 ===== */
.mem-toggle {
  display: flex;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 14px;
}
.mem-toggle-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 10px;
  transition: background .15s, color .15s;
}
.mem-toggle-btn svg { width: 16px; height: 16px; }
.mem-toggle-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ===== 통합 추가 시트 (＋ FAB) ===== */
.add-sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: flex-end;
  animation: addFade .18s ease;
}
.add-sheet-backdrop.hidden { display: none; }
@keyframes addFade { from { opacity: 0; } to { opacity: 1; } }
.add-sheet {
  width: 100%;
  background: var(--bg-elev);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  padding: 10px 18px calc(22px + var(--safe-bottom));
  animation: addUp .24s cubic-bezier(.2,.8,.3,1.05);
}
@keyframes addUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.add-sheet-handle { width: 42px; height: 4px; border-radius: 2px; background: var(--muted); opacity: .5; margin: 0 auto 14px; }
.add-sheet-title { font-size: 17px; font-weight: 700; margin: 0 2px 14px; }
.add-sheet-primary {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 14px; margin-bottom: 10px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  cursor: pointer;
}
.add-sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add-sheet-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  text-align: left; padding: 14px; border-radius: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
}
.add-sheet-opt b, .add-sheet-primary b { font-size: 15px; font-weight: 700; display: block; }
.add-sheet-opt small, .add-sheet-primary small { font-size: 12px; color: var(--text-dim); }
.add-opt-ic {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.add-opt-ic svg { width: 21px; height: 21px; }
.add-opt-ic-grad { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.add-opt-tx { flex: 1; }

/* ===== 카카오톡 캘린더 연동 배너 (플레이스홀더) ===== */
.kakao-k {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto;
  background: #FEE500; color: #3c1e1e; font-weight: 800; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.kakao-banner {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 12px; margin-bottom: 12px;
  background: rgba(254, 229, 0, 0.10);
  border: 1px solid rgba(254, 229, 0, 0.35);
  text-align: left;
}
.kakao-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kakao-text b { font-size: 13px; font-weight: 700; }
.kakao-text small { font-size: 11px; color: var(--text-dim); }
.kakao-cta { font-size: 12px; font-weight: 700; color: #3c1e1e; background: #FEE500; padding: 5px 12px; border-radius: 999px; }
.kakao-banner.connected .kakao-cta { background: var(--success); color: #0f0f17; }
/* 캘린더 카카오 일정 라벨 */
.cal-evt-kakao { background: rgba(254,229,0,0.14) !important; color: #ffd76b !important; }
.cal-k { display:inline-flex; align-items:center; justify-content:center; width:14px; height:14px; border-radius:3px; background:#FEE500; color:#3c1e1e; font-weight:800; font-size:9px; line-height:1; vertical-align:middle; flex:0 0 auto; }
.kakao-event .card-title { display:flex; align-items:center; gap:6px; }
.kakao-connect-btn { white-space: nowrap; }
.kakao-more { color: var(--accent); font-weight: 700; font-size: 12px; margin-left: 4px; }
.kakao-detail { margin-top: 8px; padding: 10px 12px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; color: var(--text); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.kakao-detail[hidden] { display: none; }
.set-kakao-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 12px 14px; background: #FEE500; border-radius: 12px; }
.set-kakao-label { font-size: 13px; font-weight: 700; color: #3c1e1e; display: inline-flex; align-items: center; gap: 8px; }

/* ===== 토스트 ===== */
.od-toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%) translateY(8px);
  z-index: 3000; max-width: 86%;
  background: rgba(20, 20, 30, 0.96);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: 999px;
  box-shadow: var(--shadow); text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.od-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 여행 (전체화면 섹션) ===== */
.travel-screen { position: fixed; inset: 0; z-index: 1500; background: var(--bg); display: flex; flex-direction: column; animation: travelIn .22s ease; }
.travel-screen.hidden { display: none; }
@keyframes travelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.travel-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: calc(12px + var(--safe-top)) 12px 12px; background: rgba(15,15,23,0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.travel-header h2 { font-size: 18px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.travel-header-actions { display: flex; align-items: center; gap: 6px; }
.travel-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 16px calc(24px + var(--safe-bottom)); }
.trip-dash-head { display: flex; align-items: center; margin: 0 2px 14px; }
.trip-dash-head h3 { font-size: 20px; font-weight: 800; }
.trip-new-btn { display: inline-flex; align-items: center; gap: 5px; background: var(--accent-gradient); color: #fff; border: none; border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; }
.trip-new-btn svg { width: 15px; height: 15px; }
.trip-cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
.trip-card { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-card); cursor: pointer; }
.trip-card-cover { height: 122px; position: relative; display: flex; align-items: flex-end; padding: 12px; background-size: cover; background-position: center; }
.trip-card-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.66), transparent 72%); }
.trip-card-cover > * { position: relative; z-index: 1; }
.trip-card-badge { position: absolute; top: 10px; left: 12px; z-index: 1; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.4); color: #fff; }
.trip-card-dday { position: absolute; top: 10px; right: 12px; z-index: 1; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--accent-gradient); color: #fff; }
.trip-card-title b { display: block; font-size: 18px; font-weight: 800; color: #fff; }
.trip-card-title span { font-size: 12px; color: rgba(255,255,255,.85); }
.trip-card-foot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 12px; color: var(--text-dim); }
.trip-card-foot .go { margin-left: auto; color: var(--accent); font-weight: 700; }
.trip-detail-hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 2px 12px; }
.trip-detail-hero .dday { font-size: 13px; font-weight: 800; color: var(--accent); }
.trip-seg { display: flex; gap: 6px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.trip-seg-btn { flex: 1; background: transparent; border: none; color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 0; border-radius: 9px; }
.trip-seg-btn.active { background: var(--accent-soft); color: var(--accent); }
#trip-map { width: 100%; height: 300px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #181822; }
.trip-photo-marker img { width: 40px; height: 40px; border-radius: 10px; border: 2px solid #fff; object-fit: cover; box-shadow: 0 2px 7px rgba(0,0,0,0.5); }
.trip-photos-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; }
.trip-photos-grid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; cursor: pointer; }
.trip-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0; line-height: 1.6; }
.trip-cat { margin-bottom: 16px; }
.trip-cat-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; }
.trip-cat-head h4 { font-size: 15px; font-weight: 700; }
.trip-cat-head .cnt { font-size: 12px; color: var(--muted); }
.trip-place { display: flex; gap: 10px; align-items: center; padding: 11px 13px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.trip-place-main { flex: 1; min-width: 0; }
.trip-place-main b { font-size: 14px; font-weight: 700; }
.trip-place-main p { font-size: 12px; color: var(--text-dim); margin-top: 2px; word-break: break-word; }
.trip-place-fav { background: transparent; border: none; color: var(--muted); font-size: 16px; flex: 0 0 auto; cursor: pointer; padding: 2px 4px; }
.trip-place-fav.on { color: #ffd166; }
.trip-place-link { color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; flex: 0 0 auto; }
.trip-add-row { display: flex; gap: 8px; margin-top: 6px; }
.trip-add-row input { flex: 1; min-width: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; color: var(--text); font-size: 13px; font-family: var(--font-sans, inherit); }
.trip-add-row button { background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 10px; padding: 0 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.trip-date-row { display: flex; gap: 10px; }
.trip-date-row label { flex: 1; }
/* 여행 코스 빌더 */
.trip-route-bar { display: flex; align-items: center; gap: 8px; margin: 8px 2px; flex-wrap: wrap; }
.trip-route-bar #trip-route-info { font-size: 12px; }
.trip-course-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.trip-course-panel[hidden] { display: none; }
.tcp-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tcp-head b { font-size: 14px; font-weight: 700; }
.tcp-head .muted { font-size: 11px; }
.tcp-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.tcp-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; color: var(--text); cursor: pointer; font-family: var(--font-sans, inherit); }
.tcp-item.on { border-color: var(--accent); background: var(--accent-soft); }
.tcp-num { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tcp-add { width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed var(--border); color: var(--muted); font-size: 14px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tcp-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; }
.tcp-actions { display: flex; gap: 8px; margin-top: 10px; }
.tcp-actions button { flex: 1; }
.tcp-actions .tcp-draw { background: var(--accent); color: #fff; border-color: transparent; font-weight: 700; }
.tcp-mode { display: flex; gap: 6px; margin-bottom: 10px; }
.tcp-mode-btn { flex: 1; background: var(--bg-elev); border: 1px solid var(--border); color: var(--muted); border-radius: 9px; padding: 8px 0; font-size: 13px; font-weight: 600; cursor: pointer; }
.tcp-mode-btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
/* 여행 지도 검색 */
.trip-search { display: flex; gap: 8px; margin-bottom: 8px; }
.trip-search input { flex: 1; min-width: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 14px; font-family: var(--font-sans, inherit); }
.trip-search button { flex: 0 0 auto; white-space: nowrap; }
.trip-search-results { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.trip-search-results[hidden] { display: none; }
.trip-search-results .tsr-msg { font-size: 12px; color: var(--muted); padding: 10px 12px; margin: 0; }
.tsr-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid var(--border); padding: 10px 12px; color: var(--text); cursor: pointer; font-family: var(--font-sans, inherit); }
.tsr-item:last-child { border-bottom: none; }
.tsr-item:hover, .tsr-item:active { background: var(--bg-elev); }
.tsr-item b { font-size: 13px; font-weight: 600; }
.tsr-item span { font-size: 12px; color: var(--text-dim); }
/* 구간별 소요시간 */
.trip-route-legs { display: flex; flex-direction: column; gap: 4px; margin: 4px 2px 8px; }
.trip-route-legs:empty { display: none; }
.trl-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; font-size: 12px; }
.trl-seg { flex: 0 0 auto; font-weight: 800; color: var(--accent); }
.trl-nm { flex: 1; min-width: 0; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trl-t { flex: 0 0 auto; font-weight: 700; color: var(--text); }

/* ===== 모달 ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;            /* Leaflet 컨트롤(z:1000) 보다 위 */
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card h2, .modal-card h3 { margin-bottom: 12px; }
.modal-card label {
  display: block;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}
.modal-card input,
.modal-card textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
}
.modal-card input:focus,
.modal-card textarea:focus { outline: none; border-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.modal-actions button { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }

/* 버튼 */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  width: 100%;
  transition: transform .1s, opacity .15s;
}
.btn-primary:active { transform: scale(0.98); opacity: 0.92; }
.btn-ghost {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
}
.btn-ghost:hover { background: var(--border); }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
}
.btn-danger:hover { background: rgba(255, 94, 94, 0.12); }

/* 사진 뷰어 */
#photo-viewer {
  background: rgba(0,0,0,0.95);
  padding: 0;
}
#photo-viewer img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  transform-origin: center center;
  transition: transform 0.22s ease;
  will-change: transform;
  touch-action: none;            /* 브라우저 기본 핀치 줌/스크롤 막기 */
  -webkit-user-drag: none;
  user-select: none;
  cursor: grab;
}
#photo-viewer img:active { cursor: grabbing; }
.photo-close {
  position: absolute;
  top: calc(20px + var(--safe-top));
  right: 20px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 18px;
}
.photo-delete {
  position: absolute;
  bottom: calc(30px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 140px;
}

/* 반응형: 데스크탑 */
@media (min-width: 768px) {
  body { font-size: 16px; }
  main { padding: 30px 30px 60px; }
  .dday-hero h2 { font-size: 64px; }
  .album-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ========== 월별 History 레이아웃 ========== */
.history-month-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 10px 2px 12px;
  margin: -4px -4px 4px;
  position: sticky;
  /* 헤더(56px + safe-top) 바로 아래에 붙어서 화면 가리지 않게 */
  top: calc(56px + var(--safe-top));
  background: var(--bg);
  z-index: 5;
  scroll-snap-type: x proximity;
  box-shadow: 0 4px 12px -8px rgba(0,0,0,0.6);
}
.history-month-strip::-webkit-scrollbar { display: none; }
.month-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
  scroll-snap-align: center;
  white-space: nowrap;
}
.month-chip .month-chip-count {
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.month-chip:active { transform: scale(0.96); }
.month-chip.active {
  background: linear-gradient(135deg, rgba(255,107,138,0.25), rgba(183,107,255,0.25));
  border-color: rgba(255,107,138,0.45);
  color: var(--text);
}
.month-chip.active .month-chip-count {
  background: var(--accent);
  color: #fff;
}

.history-month {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* 헤더(56) + strip(약 60) + 여백(8) = 124. 안전하게 130. */
  scroll-margin-top: calc(130px + var(--safe-top));
}
.history-month-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 4px 0;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}
.history-month:first-of-type .history-month-header {
  border-top: none;
  padding-top: 0;
}
.history-month-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.history-month-meta {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

/* 8번째 셀 위에 +N 엠보스 (사진은 그대로 보이고 그 위에 반투명 오버레이) */
.history-photo-cell.is-overflow .photo-more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border: none;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  border-radius: 8px;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
}
.history-photo-cell.is-overflow .photo-more-overlay:active {
  transform: scale(0.96);
  background: rgba(0,0,0,0.7);
}

/* 펼쳤을 때 접기 버튼 */
.history-collapse-btn {
  margin-left: auto;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.history-collapse-btn:hover { color: var(--text); border-color: var(--text-dim); }

/* ========== 통화 텍스트 (익시오 분석) ========== */
.call-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: all .15s ease;
}
.call-drop-zone:hover, .call-drop-zone.is-drag {
  border-color: var(--accent);
  background: rgba(255,107,138,0.08);
}
.call-drop-icon { font-size: 28px; }
.call-drop-text { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.call-drop-name { font-size: 12px; color: var(--accent); font-weight: 600; word-break: break-all; text-align: center; }
.call-meta-preview { color: var(--accent-2) !important; }

/* memory 모달 안 통화 섹션 */
.memory-calls { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.memory-calls:empty { display: none; }
.call-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.call-card.is-pending { border-style: dashed; opacity: 0.85; }
.call-card.is-failed { border-color: var(--danger); }
.call-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.call-card-icon { font-size: 14px; }
.call-card-status {
  font-size: 12px;
  color: var(--text-dim);
}
.call-card-summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 0;
}
.call-card-long {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}
.call-card-emotion {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 8px;
  background: rgba(183,107,255,0.08);
  border-radius: 6px;
  border-left: 2px solid var(--accent-2);
}
.call-card-promises {
  font-size: 12px;
}
.call-card-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.call-card-promises ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.55;
}
.call-card-details {
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 8px;
  background: var(--bg-elev);
  border-radius: 6px;
}
.call-card-kw {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.call-kw {
  padding: 2px 8px;
  font-size: 10px;
  background: rgba(255,107,138,0.12);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 600;
}
.call-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
}
.call-card-delete:hover { color: var(--danger); }

/* 캘린더 초안 일정 (통화에서 추출) */
.event-draft {
  border-style: dashed !important;
  border-color: var(--accent-2) !important;
  background: rgba(183,107,255,0.05) !important;
}
.event-source-tag {
  margin-left: 8px;
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(183,107,255,0.18);
  color: var(--accent-2);
  border-radius: 999px;
  font-weight: 700;
}
.event-confirm, .event-reject {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .12s ease;
  margin-left: 4px;
}
.event-confirm { color: var(--success); border-color: rgba(94,218,155,0.4); }
.event-confirm:hover { background: var(--success); color: #0f0f17; border-color: var(--success); }
.event-reject:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ========== 통합 검색 모달 ========== */
.search-card {
  max-width: 560px;
  width: 92%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
#search-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
}
#search-input:focus { outline: none; border-color: var(--accent); }
.search-results {
  flex: 1;
  overflow-y: auto;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.search-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.search-group-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 2px;
}
.search-hit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all .12s ease;
}
.search-hit:hover {
  border-color: var(--accent);
  background: rgba(255,107,138,0.05);
}
.search-hit-meta {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.search-hit-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.search-hit-sub {
  font-size: 12px;
  color: var(--text-dim);
  word-break: break-word;
}
.search-hit mark, .search-hit-title mark, .search-hit-sub mark {
  background: rgba(255,107,138,0.3);
  color: var(--text);
  padding: 0 2px;
  border-radius: 3px;
}
.search-photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 6px;
  scrollbar-width: none;
}
.search-photo-strip::-webkit-scrollbar { display: none; }
.search-photo {
  flex-shrink: 0;
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  padding: 0;
}
.search-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.search-photo-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 6px 4px;
  font-size: 10px;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  line-height: 1.2;
}

/* ===== 주간 관계 인사이트 ===== */
.insight-hint { margin: 0 0 12px; font-size: 12px; }
.insight-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }

.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.insight-card.is-highlight {
  border-color: color-mix(in srgb, var(--accent), transparent 50%);
  box-shadow: 0 4px 18px -10px color-mix(in srgb, var(--accent), transparent 30%);
}
.insight-card.flash { animation: insightFlash 1.2s ease; }
@keyframes insightFlash {
  0%   { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 60%); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.insight-card-head {
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: background .12s;
}
.insight-card-head:hover { background: color-mix(in srgb, var(--bg-card), var(--accent) 4%); }

.insight-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.insight-card-week  { font-weight: 600; font-size: 14px; color: var(--text); }
.insight-card-count { font-size: 11px; color: var(--text-dim); }
.insight-card-preview {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
  margin-top: 2px;
}
.insight-card-toggle {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%) rotate(0deg);
  transition: transform .2s;
  color: var(--text-dim);
  font-size: 14px;
  pointer-events: none;
}
.insight-card.expanded .insight-card-toggle { transform: translateY(-50%) rotate(180deg); }

.insight-card-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px dashed var(--border);
}
.insight-card.expanded .insight-card-body { display: block; }

.insight-section {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border-left: 3px solid transparent;
}
.insight-section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 6px;
}
.insight-section-icon { font-size: 14px; }
.insight-section-body { font-size: 13px; color: var(--text); line-height: 1.55; }
.insight-section-body p { margin: 4px 0; }
.insight-section-body ul { margin: 4px 0 4px 18px; padding: 0; }
.insight-section-body li { margin: 3px 0; }

.insight-tone-topic    { border-left-color: #6aa0ff; }
.insight-tone-want     { border-left-color: #b870e0; }
.insight-tone-good     { border-left-color: #6cc59a; }
.insight-tone-friction { border-left-color: #d99270; }
.insight-tone-improve  { border-left-color: #d4b96a; }

/* ===== 추억 모달 — 본문 스크롤/동적 높이 (2026-05-18) ===== */
/* memory-card는 modal-card max-height:90vh를 유지하면서 본문 영역에서 스크롤이 일어나야 함.
   memory-body가 flex로 자라고 내부 textarea는 입력 양에 따라 자동 확장 (JS의 autoSizeMemoryTextarea와 협업). */
.memory-card {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.memory-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;        /* 스크롤바 폭 보정 */
  min-height: 0;             /* flex 자식이 부모 max-height를 따라 줄어들 수 있도록 */
}
.memory-actions {
  flex: 0 0 auto;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky;
  bottom: 0;
}
/* 일기 textarea — 내용 전체 높이로 펼침(내부 스크롤 없음).
   스크롤은 바깥 .memory-body가 담당 → 편집 중 커서가 위로 튀는 현상 방지. */
.memory-diary textarea {
  resize: none;
  min-height: 100px;
  line-height: 1.55;
  overflow-y: hidden;
}

/* ===== 변경 내역(활동 로그) ===== */
/* 헤더 아이콘 위 안읽음 점 */
.icon-btn { position: relative; }
.icon-dot {
  position: absolute; top: 5px; right: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-elev);
  pointer-events: none;
}
.icon-dot.hidden { display: none; }

.activity-card {
  max-width: 460px;
  display: flex; flex-direction: column;
  max-height: 82vh;
}
.activity-list {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  margin: 2px -4px 0;
}
.activity-day-head {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-elev);
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 10px 6px 5px;
}
.activity-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 6px; border-bottom: 1px solid var(--border);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.activity-item:active { background: rgba(255,255,255,0.05); }
.activity-ico {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; background: rgba(255,107,138,0.12);
}
.activity-item.is-new .activity-ico {
  background: rgba(255,107,138,0.22);
  box-shadow: 0 0 0 2px rgba(255,107,138,0.30);
}
.activity-main { flex: 1 1 auto; min-width: 0; }
.activity-title { font-size: 14px; font-weight: 600; color: var(--text); }
.activity-item.is-new .activity-title::after {
  content: "새"; margin-left: 6px;
  font-size: 10px; font-weight: 700; color: var(--accent);
  background: rgba(255,107,138,0.15); border-radius: 6px; padding: 1px 5px;
  vertical-align: middle;
}
.activity-body {
  font-size: 13px; color: var(--muted); margin-top: 2px;
  word-break: break-word; white-space: pre-wrap;
}
.activity-time {
  flex: 0 0 auto; font-size: 11px; color: var(--muted);
  white-space: nowrap; padding-top: 2px;
}
.activity-empty { text-align: center; color: var(--muted); padding: 34px 12px; font-size: 13px; }

/* ===== 음성 요약 토글 카드 (memory-modal 안, 일기 아래) ===== */
.memory-story {
  margin-top: 18px;
  padding: 0;
  background: rgba(255, 107, 138, 0.06);
  border: 1px solid color-mix(in srgb, var(--accent), transparent 70%);
  border-radius: 14px;
  overflow: hidden;
}
.memory-story:empty { display: none; }
.story-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.story-toggle:hover { background: rgba(255,255,255,0.03); }
.story-toggle-icon { font-size: 16px; }
.story-toggle-label { flex: 1; }
.story-toggle-caret {
  transition: transform .2s ease;
  color: var(--text-dim);
}
.memory-story.is-open .story-toggle-caret { transform: rotate(180deg); }
.story-headline {
  padding: 0 14px 12px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
}
.story-headline.muted { color: var(--muted); font-size: 12.5px; }
.story-body {
  display: none;
  padding: 4px 14px 14px;
  border-top: 1px dashed color-mix(in srgb, var(--accent), transparent 80%);
}
.memory-story.is-open .story-body { display: block; }
.story-long {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 8px;
}
.story-emotion, .story-highlights {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
}
.story-kw {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 8px;
}
.story-details { margin-top: 10px; }
.story-details > summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 4px 0;
  list-style: none;
}
.story-details > summary::-webkit-details-marker { display: none; }
.story-details > summary::before { content: '▸ '; color: var(--text-dim); }
.story-details[open] > summary::before { content: '▾ '; }
.story-calls { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* call-event — 캘린더 일정 리스트의 '통화/음성 요약' 카드 */
.call-event {
  border-left: 3px solid color-mix(in srgb, var(--accent), transparent 30%);
  background: rgba(255, 107, 138, 0.05);
}

/* ===== 영상 탭 ===== */
.video-status { font-size: 12.5px; margin: 6px 0; min-height: 16px; }
.video-list { display: flex; flex-direction: column; gap: 18px; padding-bottom: 24px; }
.video-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}
.video-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.video-day-date { font-weight: 600; font-size: 14px; }
.video-day-meta { font-size: 11.5px; color: var(--text-dim); }
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.video-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
}
.video-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
/* 포스터가 아직 없는 영상(ffmpeg 미설치 등) — 영상 파일을 받지 않는 어두운 플레이스홀더 */
.video-thumb-empty {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1c1c22, #33333d);
}
.video-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.video-dur, .video-size {
  position: absolute;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}
.video-dur { bottom: 6px; right: 6px; }
.video-size { top: 6px; left: 6px; opacity: 0.85; }

/* 영상 뷰어 — 사진 뷰어와 비슷한 풀스크린 */
#video-viewer {
  background: rgba(0,0,0,0.92);
  padding: 0;
  align-items: center;
}
.video-viewer-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
}
#video-full {
  width: 100%;
  max-height: calc(100vh - 100px);
  background: #000;
  border-radius: 8px;
}
.video-viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  color: #ddd;
}

/* 사진 페이지네이션 — 미로드 달 placeholder */
.history-month-placeholder {
  padding: 14px 12px 18px;
  text-align: center;
}
.history-load-month {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.history-load-month:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.history-load-month:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ===== 설정 — 알림 섹션 ===== */
.set-notify-section {
  margin-top: 18px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.set-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 !important;
  cursor: pointer;
}
.set-toggle-row > span:first-child {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}
.set-toggle-row .muted-inline {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.set-toggle-row input[type="checkbox"] {
  width: 44px;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  transition: background .15s;
  cursor: pointer;
  flex-shrink: 0;
}
.set-toggle-row input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.set-toggle-row input[type="checkbox"]:checked {
  background: var(--accent);
}
.set-toggle-row input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}
.set-toggle-row input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.set-notify-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.set-notify-actions .btn-ghost {
  font-size: 12.5px;
  padding: 6px 12px;
}

/* ===== 추억 탭 서브뷰 (타임라인/캘린더/영상) ===== */
.subview { display: none; animation: fadeIn .2s ease; }
.subview.active { display: block; }

.subview-strip {
  display: flex;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.subview-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 10px;
  transition: background .15s, color .15s;
}
.subview-btn.active {
  background: rgba(255, 107, 138, 0.14);
  color: var(--accent);
}
/* 대화 버튼 안 읽은 개수 배지 */
.subview-badge {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 5px; margin-left: 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  vertical-align: middle; text-align: center;
}
.subview-badge[hidden] { display: none; }

/* ===== 위시 하단 시트 (지도 탭) ===== */
.wish-sheet-toggle {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(76px + var(--safe-bottom));
  z-index: 1100;
  background: rgba(26, 26, 38, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.wish-sheet-toggle.hidden { display: none; }

.wish-sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(56px + var(--safe-bottom));
  max-height: 62vh;
  overflow-y: auto;
  z-index: 1200;
  background: rgba(20, 20, 30, 0.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 4px 16px calc(16px + var(--safe-bottom));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  animation: sheetUp .22s ease;
}
.wish-sheet.hidden { display: none; }

@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.wish-sheet-handle {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 0 6px;
}
.wish-sheet-handle span {
  display: block;
  width: 42px;
  height: 4px;
  margin: 0 auto;
  border-radius: 2px;
  background: var(--muted);
  opacity: 0.5;
}

/* ============================================================
   구글포토식 그리드 / 즐겨찾기 / 멀티선택 / 지도 사진 시트
   ============================================================ */

/* ── 정사각 썸네일 그리드 ── */
.gp-day { margin-bottom: 18px; scroll-margin-top: 70px; }
.gp-day-head {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 2px 8px;
}
.gp-day-date { font-size: 14px; font-weight: 700; color: var(--text); }
.gp-day-place {
  font-size: 11px; color: var(--accent); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%;
}
.gp-day-spacer { flex: 1; }
.gp-day-diary-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; max-width: 50%; overflow: hidden; text-overflow: ellipsis;
}
.gp-day-diary-btn.has { color: var(--accent); border-color: rgba(255,107,138,0.4); }

/* 업로드 진행 토스트 */
.upload-status {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(56px + var(--safe-bottom) + 12px); z-index: 1400;
  background: rgba(20,20,30,0.96); color: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
.upload-status.hidden { display: none; }
.upload-status.is-failed { color: #ff9a9a; }
.upload-spin {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%; animation: od-spin .8s linear infinite;
}
@keyframes od-spin { to { transform: rotate(360deg); } }

/* 사진 이모지 리액션 */
.photo-reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.reaction-badge, .reaction-add {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px; padding: 4px 10px; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.reaction-badge:hover, .reaction-add:hover { background: rgba(255,255,255,0.2); }
.reaction-add { background: var(--accent-soft); color: var(--accent); border-color: rgba(255,255,255,0.12); }
.reaction-picker {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(150px + var(--safe-bottom)); z-index: 20;
  display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 320px;
  background: rgba(28,28,40,0.98); border: 1px solid var(--border);
  border-radius: 16px; padding: 10px 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.reaction-picker.hidden { display: none; }
.reaction-pick {
  background: transparent; border: 0; font-size: 26px; cursor: pointer;
  width: 44px; height: 44px; border-radius: 12px; line-height: 1;
}
.reaction-pick:hover { background: rgba(255,255,255,0.12); transform: scale(1.15); }

/* 사진 뷰어 댓글 (둘이 주고받기) — 사진 하단에 띄움 */
.photo-comments-wrap {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(76px + var(--safe-bottom)); z-index: 6;
  width: 100%; max-width: 640px; padding: 0 12px;
  display: flex; flex-direction: column;
}
.photo-comments-list {
  max-height: 22vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px;
}
.photo-comments-empty { color: rgba(255,255,255,0.45); font-size: 13px; text-align: center; padding: 6px 0; }
.photo-comment {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.07); border-radius: 12px; padding: 8px 10px;
}
.photo-comment-tag {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 2px 8px; border-radius: 999px;
}
.photo-comment-text { flex: 1 1 auto; color: #fff; font-size: 14px; word-break: break-word; }
.photo-comment-time { flex: 0 0 auto; font-size: 10px; color: rgba(255,255,255,0.45); white-space: nowrap; }
.photo-comment-del { flex: 0 0 auto; background: transparent; border: 0; color: rgba(255,255,255,0.4); font-size: 14px; cursor: pointer; }
.photo-comment-del:hover { color: #ff8aa0; }
.photo-comment-input-row { display: flex; align-items: center; gap: 8px; }
.photo-comment-author {
  flex: 0 0 auto; background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 999px;
  padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.photo-comment-input {
  flex: 1 1 auto; min-width: 0;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px; padding: 9px 14px; color: #fff; font-size: 14px;
}
.photo-comment-input::placeholder { color: rgba(255,255,255,0.4); }
.photo-comment-input:focus { outline: none; border-color: var(--accent); }
.photo-comment-send {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  border: 0; font-size: 18px; font-weight: 800; cursor: pointer;
}

/* 대화(채팅형) 화면 */
.chat-scroll {
  overflow-y: auto;
  height: calc(100vh - 252px);
  min-height: 240px;
  padding: 4px 2px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.chat-daysep { text-align: center; margin: 12px 0 8px; }
.chat-daysep span {
  font-size: 11px; color: var(--muted);
  background: var(--bg-card); padding: 3px 12px; border-radius: 999px;
}
.chat-photo { align-self: flex-start; max-width: 70%; margin-bottom: 2px; }
.chat-photo.selected .chat-photo-inner { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-photo-inner { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-card); cursor: pointer; }
.chat-photo-inner img { width: 100%; display: block; max-height: 240px; object-fit: cover; }
.chat-photo-day {
  position: absolute; right: 6px; top: 6px;
  background: rgba(0,0,0,0.5); border: 0; color: #fff; font-size: 13px;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
}
.chat-msg { display: flex; flex-direction: column; max-width: 78%; margin-bottom: 4px; }
.chat-msg.left { align-self: flex-start; align-items: flex-start; }
.chat-msg.right { align-self: flex-end; align-items: flex-end; }
.chat-author-tag { font-size: 11px; color: var(--text-dim); margin: 0 0 2px 6px; }
.chat-bubble {
  padding: 8px 13px; border-radius: 16px; font-size: 14px; line-height: 1.4; word-break: break-word;
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--border);
}
.chat-msg.right .chat-bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0;
}
.chat-rx-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chat-rx {
  font-size: 11px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 7px; cursor: pointer; color: var(--text);
}
/* 메시지 + 시간/읽음 메타 (말풍선 옆 아래쪽 정렬) */
.chat-row { display: flex; align-items: flex-end; gap: 5px; max-width: 100%; }
.chat-msg.right .chat-row { flex-direction: row-reverse; }
.chat-content { display: flex; flex-direction: column; min-width: 0; }
.chat-msg.right .chat-content { align-items: flex-end; }
.chat-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 1px; flex: 0 0 auto; padding-bottom: 2px;
  font-size: 10px; line-height: 1.25; color: var(--text-dim); white-space: nowrap;
}
.chat-msg.left .chat-meta { align-items: flex-start; }
.chat-time { color: var(--text-dim); }
.chat-read { font-weight: 700; color: var(--text-dim); }
.chat-read.read { color: var(--accent); }
.chat-inputbar {
  position: fixed; left: 0; right: 0; bottom: calc(56px + var(--safe-bottom));
  background: var(--bg-elev); border-top: 1px solid var(--border);
  padding: 8px 12px; z-index: 200;
}
.chat-target { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.chat-target.hidden { display: none; }
.chat-input-row { display: flex; align-items: center; gap: 8px; }
.chat-author {
  flex: 0 0 auto; background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 11px;
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.chat-react { flex: 0 0 auto; background: transparent; border: 0; font-size: 20px; cursor: pointer; }
.chat-input {
  flex: 1 1 auto; min-width: 0; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 14px; color: var(--text); font-size: 14px;
}
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-send {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 18px; font-weight: 800;
}
/* 메시지 안의 사진 */
.chat-msg-photo { border-radius: 14px; overflow: hidden; max-width: 220px; cursor: pointer; background: var(--bg-card); }
.chat-msg-photo img { width: 100%; display: block; max-height: 260px; object-fit: cover; }
.chat-msg.right .chat-msg-photo { margin-left: auto; }
.chat-msg .chat-bubble + .chat-rx-row, .chat-msg .chat-msg-photo + .chat-bubble { margin-top: 4px; }
/* 첨부 미리보기 칩 */
.chat-attach-thumb { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; vertical-align: -6px; margin-right: 4px; }
.chat-target span { display: inline-flex; align-items: center; }

/* 이 기기 사용자 선택 */
.owner-pick-overlay {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.owner-pick-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 20px;
  padding: 24px; width: 100%; max-width: 300px; text-align: center;
}
.owner-pick-q { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.owner-pick-btns { display: flex; gap: 10px; }
.owner-pick-btns button {
  flex: 1; padding: 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--accent-soft); color: var(--accent); font-size: 16px; font-weight: 700; cursor: pointer;
}
.owner-pick-hint { font-size: 12px; margin-top: 12px; }

/* 채팅 사진 선택 시트 */
.chat-picker-overlay {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-end; justify-content: center;
}
.chat-picker-card {
  background: var(--bg-elev); border-top-left-radius: 20px; border-top-right-radius: 20px;
  width: 100%; max-width: 600px; max-height: 70vh; display: flex; flex-direction: column;
  padding: 12px;
}
.chat-picker-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 700; }
.chat-picker-close { background: transparent; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.chat-picker-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.chat-picker-item { padding: 0; border: 0; background: var(--bg-card); border-radius: 8px; overflow: hidden; aspect-ratio: 1/1; cursor: pointer; }
.chat-picker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 길게누르기 시 브라우저 기본 메뉴(복사/선택/드래그/다운로드) 방지 → 우리 커스텀 메뉴만 뜨게.
   채팅·댓글·리액션·롱프레스 메뉴·이모지 피커 전체에 적용 (자식 요소 포함) */
.chat-scroll, .chat-scroll *,
.chat-msg-menu, .chat-msg-menu *,
.reaction-picker, .reaction-picker *,
.photo-comments-list, .photo-comments-list * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
/* 메시지/댓글 안의 이미지는 드래그·길게눌러 저장 차단 */
.chat-scroll img, .photo-comments-list img { -webkit-user-drag: none; user-drag: none; }
/* 말풍선은 세로 스크롤만 허용(가로 드래그로 선택/제스처 시작 방지) */
.chat-msg { touch-action: pan-y; }
/* 메시지 길게누르기 메뉴 (감정/답글/삭제) */
.chat-msg-menu {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(120px + var(--safe-bottom)); z-index: 2100;
  background: rgba(28,28,40,0.98); border: 1px solid var(--border);
  border-radius: 16px; padding: 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; gap: 6px; max-width: 340px;
}
.chat-menu-emojis { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.chat-menu-emoji { background: transparent; border: 0; font-size: 24px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.chat-menu-emoji:hover { background: rgba(255,255,255,0.12); }
.chat-menu-actions { display: flex; gap: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.chat-menu-act { flex: 1; background: rgba(255,255,255,0.08); border: 0; color: #fff; border-radius: 10px; padding: 9px; font-size: 14px; cursor: pointer; }
.chat-menu-act.danger { color: #ff9a9a; }
/* 답글 인용 */
.chat-reply-quote {
  font-size: 12px; color: var(--text-dim); border-left: 2px solid var(--accent);
  padding: 2px 8px; margin-bottom: 3px; opacity: 0.9;
  max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-msg.right .chat-reply-quote { border-left: 0; border-right: 2px solid var(--accent); }
/* 작성 맥락 칩 (답글/첨부) */
.compose-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 5px 10px; }
.compose-chip span { display: inline-flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-chip button { background: transparent; border: 0; color: var(--accent); font-size: 13px; cursor: pointer; flex: 0 0 auto; }

/* 채팅 사진 → 그날로 이동 시 카드 강조 + 모달 팝업 */
@keyframes dayFlash {
  0% { box-shadow: 0 0 0 0 rgba(255,107,138,0); }
  18% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 0 rgba(255,107,138,0); }
}
.gp-day.day-flash .gp-rowcard { animation: dayFlash 1.3s ease; }
@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-card.memory-card { animation: popIn 0.3s cubic-bezier(0.2, 0.8, 0.3, 1.15); }
/* 채팅에서 들어온 사진을 모달 안에서 강조 */
@keyframes photoFlash {
  0% { box-shadow: 0 0 0 0 rgba(255,107,138,0); transform: scale(1); }
  22% { box-shadow: 0 0 0 4px var(--accent); transform: scale(1.05); }
  100% { box-shadow: 0 0 0 0 rgba(255,107,138,0); transform: scale(1); }
}
.memory-photos img.photo-flash { animation: photoFlash 1.5s ease; position: relative; z-index: 1; }

/* 이맘때의 추억 배너 */
.onthisday { margin: 4px 0 14px; }
.onthisday-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px; border-radius: 14px; cursor: pointer;
  background: var(--accent-soft); border: 1px solid rgba(255,255,255,0.06);
}
.onthisday-card img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.onthisday-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.onthisday-title { font-size: 13px; font-weight: 700; color: var(--accent); }
.onthisday-sub { font-size: 12px; color: var(--text-dim); }
.onthisday-go { font-size: 20px; color: var(--accent); flex: 0 0 auto; }

/* 강조색 스와치 (설정) */
.accent-swatches { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.accent-swatch {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--sw1), var(--sw2));
  transition: transform .12s, border-color .12s;
}
.accent-swatch:hover { transform: scale(1.08); }
.accent-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--sw1); transform: scale(1.08); }

/* 우리의 기록 통계 (D-day 모달) */
.dday-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 16px 0 6px;
}
.dday-stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 4px; text-align: center;
}
.dday-stat b { display: block; font-size: 18px; font-weight: 800; color: var(--accent); line-height: 1.2; }
.dday-stat span { font-size: 11px; color: var(--muted); }

/* 로딩 스켈레톤 (초기 로딩 중 타임라인 자리표시) */
@keyframes od-shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
.gp-skel-row {
  height: 80px; border-radius: 12px; margin-bottom: 8px;
  background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-card) 38%, var(--bg-elev) 62%);
  background-size: 600px 100%;
  animation: od-shimmer 1.3s ease-in-out infinite;
}

/* 타임라인 하루 카드(접힘) — 작은 썸네일(좌) + 일기 미리보기(우). 누르면 상세(사진/일기 분할)로 열림 */
.gp-day.gp-row { margin-bottom: 8px; }
.gp-rowcard {
  display: flex; gap: 10px; width: 100%; align-items: stretch; text-align: left;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px; cursor: pointer; color: inherit;
}
.gp-rowcard:active { background: var(--bg-card); }
.gp-rowthumb {
  position: relative; flex: 0 0 auto;
  width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  background: var(--bg-card); display: block;
}
.gp-rowthumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.gp-rowthumb--empty { display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--muted); }
.gp-rowthumb-count {
  position: absolute; right: 3px; bottom: 3px;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
}
.gp-rowinfo { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.gp-rowtop { display: flex; align-items: center; gap: 6px; min-width: 0; }
.gp-rowdate { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.gp-rowdiary-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gp-rowdiary-text {
  font-size: 11px; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gp-rowdiary-empty { font-size: 12px; color: var(--muted); }

.gp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}
.gp-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-elev);
  cursor: pointer;
}
.gp-cell img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;   /* iOS: 롱프레스 이미지 저장/공유 메뉴 차단 */
  transition: transform .2s;
}
.gp-cell.is-selected img { transform: scale(0.86); }
.gp-cell.is-selected { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 별표 버튼 (셀 우상단) */
.gp-fav {
  position: absolute; top: 3px; right: 3px;
  width: 26px; height: 26px; border: none; border-radius: 50%;
  background: rgba(0,0,0,0.32); color: #fff; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, color .15s; cursor: pointer;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.gp-cell:hover .gp-fav { opacity: 1; }
.gp-fav.on { opacity: 1; color: #ffd166; }

/* 선택 체크 (좌상단, 선택 모드에서만) */
.gp-check {
  position: absolute; top: 5px; left: 5px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9); background: rgba(0,0,0,0.25);
  display: none; pointer-events: none;
}
body.select-mode .gp-check { display: block; }
body.select-mode .gp-fav { display: none; }
.gp-cell.is-selected .gp-check {
  background: var(--accent); border-color: var(--accent);
}
.gp-cell.is-selected .gp-check::after {
  content: '✓'; color: #fff; font-size: 13px; font-weight: 700;
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}

/* 펜딩/실패 오버레이 (기존 spinner 재사용) */
.gp-cell.is-pending img { opacity: 0.5; }
.gp-cell .photo-spinner { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.gp-cell .photo-failed-badge {
  position: absolute; top: 4px; left: 4px; background: #ff4d6d; color: #fff;
  width: 18px; height: 18px; border-radius: 50%; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── 멀티 선택 액션바 ── */
.select-bar {
  position: fixed; left: 0; right: 0;
  bottom: calc(56px + var(--safe-bottom));
  z-index: 1300;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(20,20,30,0.97);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.select-bar.hidden { display: none; }
.select-count { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.select-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.select-act {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  font-size: 12px; font-weight: 600; padding: 8px 12px; border-radius: 999px; cursor: pointer;
}
.select-act.danger { color: #ff6b8a; border-color: rgba(255,107,138,0.4); }
.select-act:disabled { opacity: 0.5; }

/* 라이트박스 별표 버튼 */
.photo-fav.on { color: #ffd166; }

/* ── 지도 탭: 풀 화면 지도 + 사진 시트 ── */
.tab-panel[data-tab="map"] { padding: 0 !important; position: relative; }
.tab-panel[data-tab="map"].active { display: block; }
#map-canvas {
  position: fixed;
  top: 56px; left: 0; right: 0;
  bottom: calc(56px + var(--safe-bottom));
  width: 100%; height: auto;
  min-height: 0; border: 0; border-radius: 0;
  z-index: 1;
}

/* 구글포토식 사진 시트 (드래그/스크롤) */
.map-photo-sheet {
  position: fixed; left: 0; right: 0;
  bottom: calc(56px + var(--safe-bottom));
  z-index: 1100;
  background: rgba(18,18,26,0.97);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  transition: height .28s cubic-bezier(.4,0,.2,1);
}
.map-photo-sheet[data-state="peek"] { height: 120px; }
.map-photo-sheet[data-state="half"] { height: 46vh; }
.map-photo-sheet[data-state="full"] { height: calc(100vh - 56px - 56px - var(--safe-bottom)); }
.map-sheet-handle {
  flex: 0 0 auto; background: transparent; border: none; padding: 9px 0 4px; cursor: pointer;
}
.map-sheet-handle span {
  display: block; width: 42px; height: 4px; margin: 0 auto;
  border-radius: 2px; background: var(--muted); opacity: 0.5;
}
.map-sheet-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 2px 14px 8px;
}
.map-sheet-title { font-size: 14px; font-weight: 700; color: var(--text); }
.map-sheet-chips { margin-left: auto; display: flex; gap: 6px; }
.map-sheet-chip {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--muted);
  font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 999px; cursor: pointer;
}
.map-sheet-chip.on { color: #ffd166; border-color: rgba(255,209,102,0.5); }
.map-sheet-grid {
  flex: 1 1 auto; overflow-y: auto; padding: 4px 14px 16px;
  -webkit-overflow-scrolling: touch;
}

/* 지도 위 활성 사진 버블 (원형 썸네일) */
.map-bubble-wrap { background: transparent; border: none; }
.map-bubble {
  width: 70px; height: 70px; border-radius: 50%;
  border: 3px solid #fff; overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  background: var(--bg-elev);
}
.map-bubble img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== Immich 모드: 업로드/삭제 숨김 (사진 관리는 Immich에서) ===== */
body.immich-mode label[for="album-input"],
body.immich-mode #photo-delete,
body.immich-mode #select-delete { display: none !important; }

/* ============================================================
   100일 (Love) — 100가지 이유 · 편지 · 받은 손편지
   ============================================================ */
.love-screen { position: fixed; inset: 0; z-index: 1500; background: var(--bg); display: flex; flex-direction: column; animation: travelIn .22s ease; }
.love-screen.hidden { display: none; }
.love-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 16px calc(28px + var(--safe-bottom)); }
.love-body .trip-seg { margin-bottom: 16px; }

/* 히어로 */
.love-hero { position: relative; border-radius: 18px; padding: 18px 18px 16px; margin-bottom: 14px; overflow: hidden;
  background: linear-gradient(135deg, rgba(255,107,138,0.22), rgba(183,107,255,0.20)); border: 1px solid rgba(255,107,138,0.28); }
.love-hero::after { content: '💌'; position: absolute; right: 12px; top: 10px; font-size: 44px; opacity: .18; }
.love-hero .lh-label { font-size: 12px; color: var(--text-dim); letter-spacing: .4px; }
.love-hero .lh-main { font-size: 26px; font-weight: 800; margin: 2px 0 4px; }
.love-hero .lh-sub { font-size: 12.5px; color: var(--text-dim); }
.love-hero .lh-chip { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 700; color: #fff;
  background: var(--accent-gradient, linear-gradient(135deg,var(--accent),var(--accent-2))); padding: 5px 12px; border-radius: 999px; }

/* 진행 바 */
.love-progress { height: 7px; border-radius: 999px; background: var(--bg-elev); overflow: hidden; margin: 2px 2px 8px; }
.love-progress i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s ease; }
.love-meta { display: flex; align-items: center; gap: 8px; margin: 0 2px 12px; font-size: 12.5px; color: var(--text-dim); }
.love-meta .grow { flex: 1; }
.love-linkbtn { background: transparent; border: none; color: var(--accent); font-size: 12.5px; font-weight: 700; padding: 2px 4px; }

/* 카드 */
.love-card-wrap { display: flex; align-items: stretch; gap: 8px; }
.love-nav { flex: 0 0 auto; width: 38px; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 12px; font-size: 22px; line-height: 1; }
.love-nav:disabled { opacity: .3; }
.love-card { flex: 1; min-width: 0; position: relative; border-radius: 18px; padding: 22px 18px 18px; min-height: 240px;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
  background: linear-gradient(160deg, #2a2036, #241d2e 60%, #2b1f2b); border: 1px solid rgba(255,107,138,0.22);
  box-shadow: 0 10px 30px rgba(0,0,0,.35); touch-action: pan-y; user-select: none; }
.love-card.is-empty { background: var(--bg-card); border-style: dashed; border-color: var(--border); }
.love-card-no { position: absolute; top: 12px; left: 16px; font-size: 13px; font-weight: 800; color: var(--accent); letter-spacing: .5px; }
.love-card-fav { position: absolute; top: 8px; right: 10px; background: transparent; border: none; font-size: 16px; color: var(--muted); }
.love-card-text { font-size: 19px; font-weight: 600; line-height: 1.65; word-break: keep-all; white-space: pre-wrap; margin: 6px 0 0; }
.love-card-empty { font-size: 14px; color: var(--muted); line-height: 1.7; }
.love-card-foot { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 10px; }
.love-card-foot button { background: transparent; border: none; color: var(--text-dim); font-size: 12.5px; font-weight: 700; padding: 4px 8px; border-radius: 8px; }
.love-card-foot button:active { background: var(--bg-elev); }
.love-card textarea { width: 100%; background: rgba(0,0,0,.22); border: 1px solid var(--border); border-radius: 12px; color: var(--text);
  font-size: 16px; line-height: 1.6; padding: 12px; resize: none; min-height: 120px; font-family: inherit; }
.love-edit-actions { display: flex; gap: 8px; margin-top: 10px; }
.love-edit-actions button { flex: 1; border-radius: 10px; padding: 9px 0; font-size: 13px; font-weight: 700; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); }
.love-edit-actions .save { background: var(--accent); border-color: transparent; color: #fff; }

/* 점프 바 */
.love-jump { display: flex; gap: 8px; align-items: center; margin: 12px 2px 0; }
.love-jump input { width: 74px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; color: var(--text); font-size: 13px; }
.love-jump button { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(255,107,138,.3); border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 700; }

/* 전체 목록 */
.love-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 7px; margin-top: 4px; }
.love-chip { aspect-ratio: 1/1; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card); color: var(--muted);
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.love-chip.filled { background: var(--accent-soft); border-color: rgba(255,107,138,.35); color: var(--accent); }
.love-listrows { display: flex; flex-direction: column; gap: 7px; }
.love-listrow { display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; color: var(--text); }
.love-listrow .no { flex: 0 0 auto; width: 28px; font-size: 12px; font-weight: 800; color: var(--accent); padding-top: 2px; }
.love-listrow .tx { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.55; word-break: keep-all; }
.love-listrow.empty .tx { color: var(--muted); }

/* 편지 */
.love-letter-card { border-radius: 16px; border: 1px solid var(--border); background: var(--bg-card); padding: 14px 16px; margin-bottom: 10px; text-align: left; width: 100%; color: var(--text); }
.love-letter-card b { display: block; font-size: 15px; font-weight: 700; }
.love-letter-card .dt { font-size: 12px; color: var(--muted); margin-top: 2px; }
.love-letter-card .pv { font-size: 13px; color: var(--text-dim); margin-top: 6px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.love-paper { border-radius: 18px; padding: 22px 20px 26px; background:
  repeating-linear-gradient(to bottom, transparent 0 33px, rgba(255,255,255,.05) 33px 34px), linear-gradient(160deg, #241f2e, #2a2131);
  border: 1px solid rgba(255,107,138,.2); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.love-paper h3 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.love-paper .dt { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.love-paper .bd { font-size: 15.5px; line-height: 34px; white-space: pre-wrap; word-break: keep-all; }
.love-paper input, .love-paper textarea { width: 100%; background: rgba(0,0,0,.22); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 15px; padding: 11px 12px; font-family: inherit; margin-bottom: 10px; }
.love-paper textarea { line-height: 1.8; resize: vertical; min-height: 260px; }
.love-cta { width: 100%; border: none; border-radius: 14px; padding: 14px 0; font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.love-ghost { width: 100%; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-dim); border-radius: 14px; padding: 12px 0; font-size: 13px; font-weight: 700; margin-top: 8px; }

/* 받은 손편지 */
.love-scan-group { margin-bottom: 20px; }
.love-scan-head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 9px; }
.love-scan-head b { font-size: 15.5px; font-weight: 700; }
.love-scan-head span { font-size: 12px; color: var(--muted); }
.love-scan-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.love-scan-strip img { width: 100%; aspect-ratio: 3/4; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); background: #f6f2ec; padding: 3px; }

/* 스캔 뷰어 */
.scan-viewer { position: fixed; inset: 0; z-index: 2000; background: #0b0b10; display: flex; flex-direction: column; }
.scan-viewer.hidden { display: none; }
.scan-top { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + var(--safe-top)) 12px 8px; }
.scan-counter { font-size: 13px; color: var(--text-dim); font-weight: 700; }
.scan-stage { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; touch-action: pinch-zoom pan-x pan-y; }
.scan-stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.scan-stage img.zoomed { max-width: none; max-height: none; width: 200%; }
.scan-bottom { display: flex; align-items: center; gap: 10px; padding: 8px 14px calc(14px + var(--safe-bottom)); }
.scan-caption { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.scan-nav { width: 46px; height: 40px; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); font-size: 22px; line-height: 1; }
.scan-nav:disabled { opacity: .3; }

/* 100가지 이유 — 목록형(여러 개 한눈에) */
.love-filter { display: flex; gap: 6px; margin: 0 2px 12px; }
.love-filter button { flex: 1; background: var(--bg-elev); border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; padding: 8px 0; font-size: 12.5px; font-weight: 700; }
.love-filter button.on { background: var(--accent-soft); color: var(--accent); border-color: rgba(255,107,138,.4); }
.love-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.love-tools .love-ghost { margin-top: 0; }
.love-group-head { display: flex; align-items: baseline; gap: 8px; margin: 16px 4px 7px; }
.love-group-head b { font-size: 13px; font-weight: 800; color: var(--text-dim); letter-spacing: .4px; }
.love-group-head span { font-size: 11.5px; color: var(--muted); }
.love-rows { display: flex; flex-direction: column; gap: 6px; }
.love-row { display: flex; gap: 10px; align-items: flex-start; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 12px; cursor: pointer; }
.love-row.is-empty { background: transparent; border-style: dashed; }
.love-row .lr-no { flex: 0 0 auto; width: 26px; font-size: 12px; font-weight: 800; color: var(--accent); padding-top: 2px; }
.love-row .lr-tx { flex: 1; min-width: 0; margin: 0; font-size: 14.5px; line-height: 1.6; word-break: keep-all; white-space: pre-wrap; }
.love-row.is-empty .lr-tx { color: var(--muted); font-size: 13.5px; }
.love-row .lr-pen { flex: 0 0 auto; color: var(--muted); font-size: 13px; padding-top: 3px; }
.love-row.editing { border-color: var(--accent); background: var(--bg-elev); cursor: default; }
.love-row .lr-box { flex: 1; min-width: 0; }
.love-row .lr-input { width: 100%; background: rgba(0,0,0,.24); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 15px; line-height: 1.6; padding: 10px; resize: vertical; min-height: 74px; font-family: inherit; }
.lr-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.lr-actions button { flex: 1; min-width: 62px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-dim);
  border-radius: 9px; padding: 8px 6px; font-size: 12.5px; font-weight: 700; }
.lr-actions button.primary { background: var(--accent); border-color: transparent; color: #fff; flex: 1.6; }
.love-bulk-start { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.love-bulk-start input { width: 90px; margin: 0; }
.lh-chip.mute { background: rgba(0,0,0,.35); border: 1px solid var(--border); color: var(--text-dim); margin-left: 6px; }

/* 접속 기록 */
.access-devices { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.access-devices:empty { display: none; }
.access-dev { display: flex; align-items: center; gap: 10px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 11px; padding: 9px 12px; }
.access-dev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.access-dev-main b { font-size: 13.5px; font-weight: 700; }
.access-dev-main span { font-size: 11.5px; color: var(--muted); }
.access-dev-ago { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--accent); }
