/* 恋爱记录小网站 —— 粉色浪漫风 */
:root {
  --primary: #f26d8d;
  --primary-deep: #e2557a;
  --primary-light: #ffd9e3;
  --bg: #fff6f8;
  --card: #ffffff;
  --text: #4a3b40;
  --muted: #a68d94;
  --line: #f6dfe5;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(242, 109, 141, .10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { overflow-y: scroll; scrollbar-gutter: stable; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
.boot { text-align: center; padding: 80px 0; color: var(--muted); }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(255, 246, 248, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; color: var(--primary-deep); }
.me { font-size: 14px; color: var(--muted); cursor: pointer; }

.container { max-width: 720px; margin: 0 auto; padding: 16px 14px 110px; }

/* 底部导航 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 56px; padding: 2px 8px; border: none; background: none;
  color: var(--muted); font-size: 11px; cursor: pointer; text-decoration: none;
}
.tab .ico { font-size: 20px; line-height: 1.2; }
.tab.on { color: var(--primary-deep); font-weight: 600; }

/* 悬浮发布按钮 */
.fab {
  position: fixed; right: 20px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 31;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #ff8fab, var(--primary));
  color: #fff; font-size: 30px; line-height: 1;
  box-shadow: 0 6px 20px rgba(242, 109, 141, .45);
}
.fab:active { transform: scale(.92); }

/* 首页 hero */
.hero {
  text-align: center; padding: 30px 16px 26px; margin-bottom: 14px;
  background: linear-gradient(135deg, #ffe3ec 0%, #fff3f0 100%);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.hero-sub { color: var(--muted); font-size: 14px; letter-spacing: 4px; }
.hero-days { margin: 6px 0 2px; }
.hero-days b {
  font-size: 56px; color: var(--primary-deep); line-height: 1.1;
  background: linear-gradient(135deg, #ff8fab, #e2557a);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-days span { font-size: 18px; color: var(--primary-deep); margin-left: 6px; }
.hero-since { color: var(--muted); font-size: 13px; }

.next-ann {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; padding: 14px 16px;
}
.next-ann .big { font-size: 28px; }
.next-ann .t { font-weight: 600; }
.next-ann .d { color: var(--muted); font-size: 13px; }
.next-ann.today { background: linear-gradient(135deg, #ffe9c9, #fff3e6); }

.stat-chips { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0 16px; }

/* 标题 */
.sec-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; margin: 18px 4px 10px;
}
.more { color: var(--primary); text-decoration: none; font-size: 13px; font-weight: normal; }

/* 头像（支持图片） */
.avatar { overflow: hidden; }
.avatar img, .cmt-avatar img {
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; display: block;
}
.avatar-lg { width: 64px; height: 64px; font-size: 30px; flex: none; }
.avatar-row { display: flex; align-items: center; gap: 16px; }
.me-img {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
  vertical-align: -6px; margin-right: 2px;
}

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}

/* 记录卡片 */
.rec-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--primary-light); display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.rec-meta { flex: 1; min-width: 0; }
.rec-author { font-weight: 600; font-size: 14px; }
.rec-date { color: var(--muted); font-size: 12px; }
.rec-ops { display: flex; gap: 4px; }
.icon-btn {
  border: none; background: none; cursor: pointer; font-size: 14px;
  color: var(--muted); padding: 4px 6px; border-radius: 8px;
}
.icon-btn:hover { background: #fdf1f4; }
.rec-mood { font-size: 22px; margin: 8px 0 0; }
.rec-text { margin-top: 8px; white-space: pre-wrap; word-break: break-word; }
.tag-row { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: #fdf0f3; color: var(--primary-deep); border-radius: 999px;
  padding: 2px 10px; font-size: 12px;
}

/* 照片网格 */
.pgrid { margin-top: 10px; display: grid; gap: 5px; }
.pgrid.g1 { grid-template-columns: 1fr; }
.pgrid.g1 img { max-height: 340px; width: auto; max-width: 100%; margin: 0 auto; }
.pgrid.g2 { grid-template-columns: 1fr 1fr; }
.pgrid.g3 { grid-template-columns: repeat(3, 1fr); }
.pgrid.g4 { grid-template-columns: repeat(2, 1fr); }
.pgrid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px;
  cursor: zoom-in; background: #fdeef2;
}
.pgrid.g2 img, .pgrid.g4 img { aspect-ratio: 1; }
.pgrid.g1 img { aspect-ratio: auto; }

.rec-foot { display: flex; gap: 8px; margin-top: 12px; }
.heart, .cmt-btn {
  border: none; cursor: pointer; border-radius: 999px; padding: 5px 14px;
  background: #fdf1f4; color: var(--text); font-size: 14px;
}
.heart.on { background: var(--primary-light); }

/* 评论 */
.comments { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.cmt { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start; }
.cmt-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.cmt-body { flex: 1; min-width: 0; font-size: 14px; }
.cmt-body b { font-size: 13px; }
.cmt-time { color: var(--muted); font-size: 11px; margin-left: 6px; }
.cmt-body > div:last-child { white-space: pre-wrap; word-break: break-word; }
.cmt-input { display: flex; gap: 8px; }
.cmt-input input {
  flex: 1; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; outline: none; font-size: 14px; background: #fffafb;
}
.cmt-input input:focus { border-color: var(--primary); }
.cmt-input button {
  border: none; border-radius: 999px; padding: 0 16px; cursor: pointer;
  background: linear-gradient(135deg, #ff8fab, var(--primary)); color: #fff;
}

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* 月份分隔 */
.month-h {
  color: var(--primary-deep); font-size: 14px; font-weight: 700;
  margin: 20px 4px 10px; display: flex; align-items: center; gap: 8px;
}
.month-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 筛选条 */
.filter-bar { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; outline: none; font-size: 14px; background: #fff;
}
.search-input:focus { border-color: var(--primary); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: none; background: #fff; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 4px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary-deep); font-weight: 600; }

/* 相册 */
.album-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.album-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px;
  cursor: zoom-in; background: #fdeef2; display: block;
}

/* 纪念日 */
.ann-card { display: flex; align-items: center; gap: 12px; }
.ann-card .emoji { font-size: 26px; }
.ann-card .body { flex: 1; min-width: 0; }
.ann-card .name { font-weight: 600; }
.ann-card .sub { color: var(--muted); font-size: 12px; }
.ann-days { text-align: right; }
.ann-days b { color: var(--primary-deep); font-size: 18px; }
.ann-days .lbl { color: var(--muted); font-size: 11px; display: block; }
.ann-days.today b { font-size: 15px; }

/* 动态日志 */
.log-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed #fdf0f4; }
.log-item:last-child { border-bottom: none; }
.log-line { font-size: 14px; line-height: 1.5; word-break: break-all; }
.log-detail { color: var(--primary-deep); }
.log-body { flex: 1; min-width: 0; }
.log-account { color: var(--muted); font-size: 12px; }
.logs-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 12px; }
#logs-status { min-height: 20px; overflow-wrap: anywhere; }
#logs-status.error { color: var(--primary-deep); }
#logs-refresh { flex-shrink: 0; }
.memory { background: linear-gradient(135deg, #f3e8ff, #ffeef2); }

/* 首页功能宫格（4列） */
.fn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.fn-item {
  position: relative; background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px 4px; text-align: center; text-decoration: none; color: var(--text); font-size: 13px;
}
.fn-item:active { transform: scale(.96); }
.fn-ico { display: block; font-size: 24px; margin-bottom: 3px; }
.fn-item .dot {
  position: absolute; top: 8px; right: 14px; width: 9px; height: 9px; border-radius: 50%;
  background: #ff3b5c; border: 2px solid #fff;
}

/* 悄悄话气泡 */
.whisper { display: flex; margin: 10px 0; }
.whisper.mine { justify-content: flex-end; }
.w-bubble {
  max-width: 78%; border-radius: 14px; padding: 9px 13px; background: #f7f2f4;
}
.whisper.mine .w-bubble { background: var(--primary-light); }
.w-text { word-break: break-word; white-space: pre-wrap; }
.w-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }

/* 愿望清单 */
.wish-progress { margin-bottom: 14px; }
.wish-progress .bar {
  height: 8px; border-radius: 999px; background: #fbe4ea; overflow: hidden; margin-bottom: 6px;
}
.wish-progress .bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #ff8fab, var(--primary));
  transition: width .4s ease;
}
.wish-pct { color: var(--muted); font-size: 12px; }
.wish { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-bottom: 1px dashed #fdf0f4; }
.wish:last-child { border-bottom: none; }
.wish-check { border: none; background: none; font-size: 20px; cursor: pointer; padding: 2px; flex: none; }
.wish-body { flex: 1; min-width: 0; }
.wish-title { font-weight: 600; }
.wish.done .wish-title { text-decoration: line-through; color: var(--muted); }
.wish-note { color: var(--muted); font-size: 13px; }
.wish-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.wish-link { color: var(--primary-deep); font-size: 12px; text-decoration: none; }
.wish-ops { display: flex; }
.rec-pick { max-height: 320px; overflow-y: auto; }
.rec-pick-item {
  display: block; width: 100%; text-align: left; margin-bottom: 8px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 9px 12px; font-size: 13px; cursor: pointer; color: var(--text);
}
.rec-pick-item b { color: var(--primary-deep); margin-right: 6px; }

/* 心情日签 */
.mood-head { display: flex; align-items: center; justify-content: space-between; }
.mood-head .icon-btn { font-size: 20px; }
.mood-stats { color: var(--muted); font-size: 13px; margin: 8px 0 12px; }
.mood-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mood-cal .dow { text-align: center; color: var(--muted); font-size: 11px; padding: 2px 0; }
.mood-day {
  aspect-ratio: 1; border-radius: 10px; background: #fdf6f8;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 2px; min-height: 40px;
}
.mood-day.blank { background: transparent; }
.mood-day.today { outline: 2px solid var(--primary); }
.md-num { font-size: 11px; color: var(--muted); }
.md-faces { display: flex; gap: 2px; font-size: 13px; }

/* 表单 */
.form-card h3 { margin: 0 0 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; outline: none; font-size: 15px; font-family: inherit;
  background: #fffafb; color: var(--text);
}
.field input:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; }
.form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mood-row { display: flex; flex-wrap: wrap; gap: 6px; }
.mood {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font-size: 20px; padding: 6px 9px; cursor: pointer;
}
.mood.on { border-color: var(--primary); background: var(--primary-light); }
.up-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.up-thumb { position: relative; aspect-ratio: 1; }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.up-thumb .rm {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff;
  cursor: pointer; font-size: 12px; line-height: 1;
}
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* 按钮 */
.btn {
  border: none; cursor: pointer; border-radius: 999px;
  padding: 10px 22px; font-size: 15px; color: #fff; font-family: inherit;
  background: linear-gradient(135deg, #ff8fab, var(--primary));
  box-shadow: 0 4px 14px rgba(242, 109, 141, .35);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost {
  background: #fff; color: var(--primary-deep);
  border: 1px solid var(--primary); box-shadow: none;
}
.btn.small { padding: 5px 14px; font-size: 13px; }
.btn.block { display: block; width: 100%; }

/* 登录 / 初始化 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; text-align: center; padding: 30px 24px; }
.auth-logo { font-size: 46px; }
.auth-card h2 { margin: 8px 0 2px; font-size: 20px; }
.auth-card .muted { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.auth-card .field { text-align: left; }
.setup-wrap { max-width: 480px; margin: 0 auto; padding: 20px 14px 60px; }
.setup-wrap h2 { text-align: center; }
.setup-user { border: 1px dashed var(--line); border-radius: 14px; padding: 12px; margin-bottom: 14px; }
.setup-user .who { font-size: 13px; color: var(--primary-deep); font-weight: 600; margin-bottom: 8px; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick button {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font-size: 20px; padding: 5px 8px; cursor: pointer;
}
.emoji-pick button.on { border-color: var(--primary); background: var(--primary-light); }

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(74, 59, 64, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { width: 100%; max-width: 420px; max-height: 85vh; overflow-y: auto; }
.modal h3 { margin: 0 0 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* 大图查看 */
.lb {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lb-img { max-width: 94vw; max-height: 80vh; object-fit: contain; border-radius: 6px; }
.lb-cap { color: #f3d7de; font-size: 13px; margin-top: 12px; text-align: center; padding: 0 20px; }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .15); color: #fff; font-size: 20px;
}
.lb-btn.prev { left: 10px; }
.lb-btn.next { right: 10px; }
.lb-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px;
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .15); color: #fff; font-size: 17px;
}
.lb-count { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 18px; color: #f3d7de; font-size: 13px; }

/* toast */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 70;
  background: rgba(74, 59, 64, .9); color: #fff; border-radius: 999px;
  padding: 9px 20px; font-size: 14px; max-width: 86vw; text-align: center;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 设置页 */
.settings-h4 { margin: 2px 0 10px; font-size: 15px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; }

/* 时间胶囊 */
.cap { display: flex; gap: 12px; align-items: flex-start; }
.cap-emoji { font-size: 26px; }
.cap-body { flex: 1; min-width: 0; }
.cap-title { font-weight: 600; }
.cap-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cap-count { color: var(--primary-deep); font-size: 12px; margin-top: 4px; }
.cap-text { margin-top: 8px; white-space: pre-wrap; word-break: break-word; background: #fdf6f8; border-radius: 10px; padding: 10px 12px; }
.cap-tag { background: var(--primary-light); color: var(--primary-deep); border-radius: 999px; font-size: 11px; padding: 1px 8px; font-weight: normal; }

/* 纪念日临近高亮 */
.next-ann.soon { background: linear-gradient(135deg, #fff3d6, #fff8ec); box-shadow: 0 4px 18px rgba(240, 180, 60, .18); }
.ann-card.ann-soon { outline: 2px solid #f5c26b; }

/* 相册选择模式 */
.album-grid img.sel { outline: 3px solid var(--primary); outline-offset: -3px; opacity: .85; }
.album-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 32;
  display: flex; gap: 10px; background: var(--card); border-radius: 999px;
  padding: 8px 12px; box-shadow: 0 6px 22px rgba(0,0,0,.18);
}
.lb-goto {
  margin-top: 10px; border: none; border-radius: 999px; cursor: pointer;
  background: rgba(255, 143, 171, .25); color: #ffd9e3; padding: 7px 18px; font-size: 13px;
}

/* ---------- 深色模式 ---------- */
body.dark {
  --primary: #ff7d9c; --primary-deep: #ff93ad; --primary-light: #4a2e36;
  --bg: #171314; --card: #241e20; --text: #f0e6e8; --muted: #a68d94;
  --line: #3a3134; --shadow: 0 4px 18px rgba(0, 0, 0, .35);
}
body.dark .topbar { background: rgba(23, 19, 20, .92); }
body.dark .tabs { background: rgba(36, 30, 32, .96); }
body.dark .hero { background: linear-gradient(135deg, #3a2430 0%, #2a2024 100%); }
body.dark .next-ann.today { background: linear-gradient(135deg, #40342a, #2e2721); }
body.dark .next-ann.soon { background: linear-gradient(135deg, #40352a, #2e2a21); }
body.dark .memory { background: linear-gradient(135deg, #332a3e, #2a2024); }
body.dark .tag { background: #3a2e33; }
body.dark .heart, body.dark .cmt-btn { background: #332b2e; }
body.dark .heart.on { background: var(--primary-light); }
body.dark .w-bubble { background: #302a2c; }
body.dark .whisper.mine .w-bubble { background: var(--primary-light); }
body.dark .field input, body.dark .field textarea, body.dark .field select { background: #1d181a; color: var(--text); }
body.dark .search-input { background: var(--card); color: var(--text); }
body.dark .chip { background: var(--card); }
body.dark .mood { background: var(--card); }
body.dark .mood-day { background: #1f1a1c; }
body.dark .pgrid img, body.dark .album-grid img { background: #2a2427; }
body.dark .cap-text { background: #1f1a1c; }
body.dark .up-grid .up-thumb img { background: #2a2427; }
body.dark .cmt-input input { background: #1d181a; color: var(--text); }
body.dark .btn.ghost { background: var(--card); }
body.dark .rec-pick-item { background: var(--card); color: var(--text); }
body.dark .wish-progress .bar { background: #3a3134; }
body.dark .log-item { border-bottom-color: #332c2f; }
body.dark .wish, body.dark .cmt .icon-btn:hover { border-bottom-color: #332c2f; }
body.dark .wish { border-bottom: 1px dashed #332c2f; }
body.dark .emoji-pick button { background: var(--card); }
body.dark .field input:focus, body.dark .field textarea:focus { border-color: var(--primary); }
body.dark .modal-overlay { background: rgba(0, 0, 0, .6); }
body.dark .auth-card .hint { color: var(--muted); }
body.dark .setup-user { border-color: #3a3134; }

/* 桌面端 */
@media (min-width: 760px) {
  .album-grid { grid-template-columns: repeat(5, 1fr); }
  .hero-days b { font-size: 68px; }
}
