:root {
  --pink: #ff5b8a;
  --pink-soft: #ffe4ec;
  --purple: #8b5cf6;
  --bg: #fff7fa;
  --card: #ffffff;
  --text: #3d3040;
  --muted: #9b8a99;
  --border: #f3e0e8;
  --green: #3dd68c;
  --shadow: 0 4px 20px rgba(255, 91, 138, 0.08);
}

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

body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.hidden { display: none !important; }

/* 顶栏 */
#topbar {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, #ff5b8a, #ff8fb3);
  color: #fff;
}
.topbar-inner {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
}
#brand { font-weight: 700; font-size: 18px; flex: 1; }
.chip {
  background: rgba(255,255,255,.25); padding: 4px 10px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
}
.ghost-btn {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  padding: 6px 12px; border-radius: 16px; font-size: 13px; cursor: pointer;
}

main { max-width: 600px; margin: 0 auto; padding: 16px; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }

/* 卡片 */
.card {
  background: var(--card); border-radius: 18px; padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.card h2 { font-size: 18px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 12px; font-size: 15px; background: #fffdfe; color: var(--text);
}
.field textarea { resize: vertical; min-height: 100px; font-family: inherit; }
input:focus, textarea:focus { outline: none; border-color: var(--pink); }

.primary-btn {
  width: 100%; padding: 13px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, #ff5b8a, #ff8fb3); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 4px;
}
.secondary-btn {
  width: 100%; padding: 13px; border: 1.5px solid var(--pink); border-radius: 14px;
  background: #fff; color: var(--pink); font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 4px;
}

/* hero */
.hero { text-align: center; padding: 30px 0 20px; }
.hero-emoji { font-size: 60px; }
.hero h1 { font-size: 28px; margin: 8px 0 4px; color: var(--pink); }
.sub { color: var(--muted); font-size: 14px; }

/* tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 10px; border: 1.5px solid var(--border); background: #fff;
  border-radius: 12px; font-size: 15px; color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--pink-soft); border-color: var(--pink); color: var(--pink); font-weight: 700; }

.divider { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0; position: relative; }
.divider::before, .divider::after {
  content: ''; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--border);
}
.divider::before { left: 0; } .divider::after { right: 0; }

.auth-msg { color: var(--pink); font-size: 13px; text-align: center; margin-top: 10px; min-height: 18px; }

/* 邀请横幅 */
.banner {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: #fff;
  border-radius: 14px; padding: 12px 16px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px; font-size: 14px;
}
.banner strong { font-size: 20px; letter-spacing: 4px; }

/* 日记卡片 */
.diary-card { padding: 16px 18px; }
.date-sep {
  text-align: center; color: var(--muted); font-size: 12px;
  margin: 16px 0 10px; position: relative;
}
.date-sep::before, .date-sep::after {
  content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: var(--border);
}
.date-sep::before { left: 4%; } .date-sep::after { right: 4%; }

/* 卡片头部：统一高度与对齐（类型徽章/作者/日期一致） */
.diary-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  min-height: 24px;
}
.author-chip {
  display: inline-flex; align-items: center; height: 24px;
  background: var(--pink-soft); color: var(--pink); font-size: 12px; font-weight: 700;
  padding: 0 10px; border-radius: 12px; line-height: 1; white-space: nowrap;
}
.mood { font-size: 20px; line-height: 1; }
.diary-date { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; flex-shrink: 0; }
.diary-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.diary-content { font-size: 15px; line-height: 1.7; white-space: pre-wrap; }
.diary-loc { color: var(--muted); font-size: 12px; margin-top: 8px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  background: #f1ecff; color: var(--purple); font-size: 12px;
  padding: 3px 10px; border-radius: 20px;
}
.diary-actions { margin-top: 10px; text-align: right; }
.link-btn { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.link-btn.danger { color: #ff5b5b; }

/* 美食卡片 */
.food-card { padding: 16px 18px; }
.food-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.food-name { font-size: 16px; font-weight: 700; flex: 1; }
.stars { color: #ffb020; font-size: 15px; letter-spacing: 2px; }
.food-img { width: 100%; border-radius: 12px; margin-bottom: 10px; object-fit: cover; max-height: 300px; }
.food-note { font-size: 14px; line-height: 1.6; }
.food-meta { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.empty .e-emoji { font-size: 40px; display: block; margin-bottom: 10px; }

/* 我们视图 */
.profile-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.profile-row:last-child { border-bottom: none; }
.avatar-circle {
  width: 40px; height: 40px; border-radius: 50%; background: var(--pink-soft);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--pink);
}
.role-badge { font-size: 11px; padding: 2px 8px; border-radius: 12px; background: #f1ecff; color: var(--purple); }
.role-badge.owner { background: #fff1e0; color: #ff7a1a; }
.stat-grid { display: flex; gap: 10px; margin: 14px 0; }
.stat-box { flex: 1; background: var(--pink-soft); border-radius: 14px; padding: 16px; text-align: center; }
.stat-num { font-size: 26px; font-weight: 800; color: var(--pink); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 底部导航（统一高度 + safe-area 适配） */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; max-width: 600px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(255,91,138,.04);
}
.tab-item {
  flex: 1; height: 52px; background: none; border: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 12px; color: var(--muted); cursor: pointer;
  padding: 0;
}
.tab-item.active { color: var(--pink); font-weight: 700; }

/* FAB 写按钮 */
.fab {
  position: fixed; right: 20px; bottom: 90px; z-index: 30;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #ff5b8a, #ff8fb3); color: #fff;
  font-size: 26px; cursor: pointer; box-shadow: 0 6px 20px rgba(255,91,138,.4);
}
.fab.food { bottom: 150px; background: linear-gradient(135deg, #ff7a1a, #ffb020); box-shadow: 0 6px 20px rgba(255,122,26,.4); }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 600px; margin: 0 auto;
  background: #fff; border-radius: 20px 20px 0 0; padding: 20px;
  max-height: 85vh; overflow-y: auto; animation: slideup .3s ease;
}
@keyframes slideup { from { transform: translateY(100%);} to { transform: none;} }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head span { font-size: 18px; font-weight: 700; }
.modal-head .ghost-btn { background: var(--pink-soft); color: var(--pink); }

/* toast */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 20px; border-radius: 24px;
  font-size: 14px; z-index: 200; max-width: 80%; text-align: center;
}

/* 标签选择 */
.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.tag-option {
  padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--border);
  background: #fff; font-size: 13px; color: var(--muted); cursor: pointer;
}
.tag-option.active { background: #f1ecff; border-color: var(--purple); color: var(--purple); font-weight: 700; }
.new-tag-input { flex: 1; min-width: 100px; }

/* 心情选择 */
.mood-picker { display: flex; gap: 8px; margin-top: 6px; }
.mood-opt { font-size: 26px; cursor: pointer; opacity: .5; transition: .15s; }
.mood-opt.active { opacity: 1; transform: scale(1.2); }

/* 评分 */
.rating-picker { display: flex; gap: 6px; font-size: 30px; margin-top: 6px; }
.rating-picker span { cursor: pointer; color: #ddd; }
.rating-picker span.active { color: #ffb020; }

/* 图片预览 */
.img-preview { max-width: 100%; border-radius: 12px; margin-top: 8px; }

/* 日记图片 */
.diary-pics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.diary-pics .pic-item { position: relative; width: 100px; height: 100px; }
.diary-pics .pic-item img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 10px;
}
.pic-item .pic-del {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff;
  font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.diary-pics img { max-width: 100%; }

/* 倒计时 chip */
.countdown-chip {
  background: var(--pink-soft); color: var(--pink); font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.countdown-chip.today { background: #fff1e0; color: #ff7a1a; }

/* 确认框 */
.confirm-text { font-size: 15px; line-height: 1.6; color: var(--text); padding: 8px 0 16px; text-align: center; }
.confirm-actions { display: flex; gap: 12px; }
.confirm-actions .secondary-btn, .confirm-actions .primary-btn { flex: 1; }

/* 图片放大 lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox img { max-width: 95%; max-height: 90%; border-radius: 8px; }
.lightbox-close {
  position: absolute; top: 20px; right: 20px; width: 36px; height: 36px;
  border-radius: 50%; background: rgba(255,255,255,.2); color: #fff;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* 类型徽章（与 author-chip 同高度 24px，保证头部对齐） */
.type-badge {
  display: inline-flex; align-items: center; height: 24px;
  font-size: 11px; padding: 0 8px; border-radius: 12px; font-weight: 700;
  flex-shrink: 0; line-height: 1; white-space: nowrap;
}
.diary-badge { background: var(--pink-soft); color: var(--pink); }
.food-badge { background: #fff1e0; color: #ff7a1a; }
.place-badge { background: #e0f7ff; color: #00a8cc; }
.topic-badge { background: #f1ecff; color: var(--purple); }

/* 互动栏 */
.interact-bar { display: flex; gap: 16px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.interact-btn {
  background: none; border: none; font-size: 13px; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; gap: 4px;
}
.interact-btn:active { color: var(--pink); }

/* 评论 */
.comment-list { max-height: 40vh; overflow-y: auto; }
.comment-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.ci-author { font-size: 12px; color: var(--pink); font-weight: 700; }
.comment-content { font-size: 14px; color: var(--text); line-height: 1.5; }

/* 话题答案 */
.topic-answer-text { font-size: 14px; color: var(--text); margin-top: 6px; line-height: 1.6; }

/* AI 助手 */
.ai-card { background: linear-gradient(135deg, #f5f3ff, #ede9fe); }
.ai-msg-list { max-height: 45vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.ai-msg { display: flex; }
.ai-msg-user { justify-content: flex-end; }
.ai-msg-assistant { justify-content: flex-start; }
.ai-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 16px; font-size: 14px;
  line-height: 1.6; word-break: break-word;
}
.ai-msg-user .ai-bubble { background: linear-gradient(135deg, #ff5b8a, #ff8fb3); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg-assistant .ai-bubble { background: #fff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-typing { opacity: .6; }

/* 类型筛选 chip */
.type-filter {
  display: flex; gap: 8px; margin-bottom: 12px; padding: 2px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.type-chip {
  flex-shrink: 0; padding: 7px 14px; border-radius: 20px;
  border: 1.5px solid var(--border); background: #fff;
  font-size: 13px; color: var(--muted); cursor: pointer;
  white-space: nowrap;
}
.type-chip.active {
  background: linear-gradient(135deg, #ff5b8a, #ff8fb3);
  border-color: transparent; color: #fff; font-weight: 700;
}

/* 创建菜单 */
.create-menu { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.create-item {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  border: 1.5px solid var(--border); border-radius: 16px; background: #fff;
  cursor: pointer; text-align: left;
}
.create-item:active { border-color: var(--pink); }
.ci-icon { font-size: 28px; }
.ci-label { font-size: 16px; font-weight: 700; color: var(--text); }
.ci-desc { margin-left: auto; font-size: 12px; color: var(--muted); }

/* 按钮禁用态 */
.primary-btn:disabled { opacity: .6; cursor: not-allowed; }

/* 恋爱值卡片 */
.love-card { background: linear-gradient(135deg, #fff0f5, #ffe4ec); }
.love-head { display: flex; align-items: center; gap: 16px; }
.love-score-wrap { text-align: center; min-width: 80px; }
.love-score { font-size: 44px; font-weight: 800; color: var(--pink); line-height: 1; }
.love-level { font-size: 13px; color: var(--purple); font-weight: 700; margin-top: 4px; }
.love-title { font-size: 16px; font-weight: 700; color: var(--text); }
.love-details { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.love-chip { background: #fff; color: var(--pink); font-size: 12px; padding: 3px 10px; border-radius: 16px; }

/* 月度报告卡片 */
.report-card { background: linear-gradient(135deg, #f5f3ff, #ede9fe); }
.report-head { margin-bottom: 8px; }
.report-title { font-size: 15px; font-weight: 700; color: var(--purple); }
.report-summary { font-size: 13px; color: var(--text); line-height: 1.6; margin-bottom: 12px; }
.report-grid { display: flex; gap: 8px; }
.report-item { flex: 1; background: #fff; border-radius: 12px; padding: 10px; text-align: center; }
.ri-num { display: block; font-size: 22px; font-weight: 800; color: var(--purple); }
.ri-label { font-size: 11px; color: var(--muted); }

/* 愿望清单 */
.wish-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.wish-row:last-child { border-bottom: none; }
.wish-check { font-size: 18px; cursor: pointer; }
.wish-text { flex: 1; font-size: 14px; }
.wish-row.done .wish-text { text-decoration: line-through; color: var(--muted); }

/* 今日话题 */
.topic-card { background: linear-gradient(135deg, #fff7fa, #fff0f5); }
.topic-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.topic-label { font-size: 13px; font-weight: 700; color: var(--purple); }
.topic-question { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.5; }
.topic-answers { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.topic-answer { background: #fff; border-radius: 12px; padding: 10px 12px; }
.topic-answer.mine { background: var(--pink-soft); }
.ta-author { font-size: 12px; color: var(--pink); font-weight: 700; margin-bottom: 4px; }
.ta-text { font-size: 14px; color: var(--text); line-height: 1.5; }

/* 卡片头部行 */
.card-head-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.card-head-row h2 { margin-bottom: 0; }

/* 礼物 */
.gift-price { color: var(--pink); font-size: 12px; font-weight: 700; margin-left: 6px; }
.gift-link { margin-left: 6px; text-decoration: none; font-size: 13px; }

/* 更新提示浮层 */
.update-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.65);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
}
.update-icon { font-size: 48px; animation: miss-heartbeat 1s ease infinite; }
.update-text { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: 1px; }

/* 想你动画浮层 */
.miss-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(255, 91, 138, 0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: miss-fade-in .3s ease;
}
.miss-heart { font-size: 90px; animation: miss-heartbeat 1s ease infinite; }
.miss-text { font-size: 24px; font-weight: 800; color: #fff; margin-top: 12px; letter-spacing: 2px; }
.miss-from { font-size: 15px; color: rgba(255,255,255,.9); margin-top: 6px; }
@keyframes miss-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes miss-heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.25); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}
