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

:root {
  --bg: #FBF4EA;
  --card: #FFFDF9;
  --text: #5A4636;
  --text2: #A08A76;
  --accent: #E58F7E;
  --accent-deep: #D97A66;
  --accent-soft: #F9E3D8;
  --line: #F0E3D3;
  --danger: #C96B5B;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* 背景装饰 */
.bg-deco { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.bg-deco i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .4; }
.bg-deco i:first-child { width: 300px; height: 300px; background: #F8D6C3; top: -90px; right: -70px; }
.bg-deco i:last-child { width: 260px; height: 260px; background: #F4E3C2; bottom: -70px; left: -80px; }

.app { max-width: 480px; margin: 0 auto; padding: 22px 16px calc(150px + env(safe-area-inset-bottom)); }

/* 页面切换 */
.page { display: none; animation: fadeIn .25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 头部 */
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.site-name { font-family: "STKaiti", "KaiTi", "楷体", "STSong", serif; font-size: 27px; font-weight: 700; letter-spacing: 2px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text2); cursor: pointer; transition: all .2s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn:active { transform: scale(.94); }

/* 卡片 */
.card {
  background: var(--card); border-radius: 22px; padding: 22px 20px;
  box-shadow: 0 8px 28px rgba(178, 128, 88, .10);
  margin-bottom: 16px;
}

/* 首页英雄卡 */
.hero { text-align: center; }
.hero-names { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 16px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
  box-shadow: 0 4px 12px rgba(178, 128, 88, .18);
}
.avatar-a { background: linear-gradient(135deg, #F2B8A3, #E58F7E); }
.avatar-b { background: linear-gradient(135deg, #A9CDBD, #7FB5A3); }
.heart { animation: beat 1.8s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 10% { transform: scale(1.18); } 20% { transform: scale(1); } }

.hero-label { color: var(--text2); font-size: 14px; margin-bottom: 6px; }
.big-days {
  font-size: 64px; font-weight: 800; color: var(--accent);
  line-height: 1.15; font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 1px;
}
.hero-sub { color: var(--text2); font-size: 13px; margin-top: 4px; }
.btn-soft {
  margin-top: 14px; padding: 10px 22px; border-radius: 999px;
  border: 1.5px solid var(--accent); background: transparent;
  color: var(--accent-deep); font-size: 14px; cursor: pointer; transition: all .2s;
}
.btn-soft:hover { background: var(--accent-soft); }
.btn-soft:active { transform: scale(.96); }

/* 倒计时卡 */
.card-title { font-size: 13px; color: var(--text2); font-weight: 700; letter-spacing: 3px; margin-bottom: 12px; text-align: center; }
.count-label { font-size: 17px; font-weight: 700; text-align: center; }
.big-count {
  text-align: center; font-size: 40px; font-weight: 800; color: var(--accent);
  font-family: Georgia, serif; margin: 6px 0 2px;
}
.big-count.today { animation: glow 2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
.count-date { text-align: center; color: var(--text2); font-size: 13px; }
.muted { color: var(--text2); font-size: 14px; text-align: center; line-height: 1.8; }

/* 时间轴 */
.section-title { font-size: 17px; font-weight: 700; margin: 22px 6px 14px; letter-spacing: 1px; }
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(180deg, var(--accent-soft), #F0E3D3); border-radius: 2px;
}
.year-pill {
  display: inline-block; background: #F6E7CF; color: #B07F3C;
  font-size: 12px; font-weight: 700; padding: 3px 14px; border-radius: 999px;
  margin: 4px 0 12px -24px;
}
.ev-item { position: relative; margin-bottom: 14px; }
.ev-item::before {
  content: ""; position: absolute; left: -23px; top: 20px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--dot, var(--accent));
  border: 2.5px solid var(--card);
  box-shadow: 0 0 0 2.5px var(--dot, var(--accent));
}
.ev-card {
  background: var(--card); border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(178, 128, 88, .08);
}
.ev-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ev-date { font-size: 15px; font-weight: 700; }
.today-chip { background: #F6E7CF; color: #B07F3C; font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.tag-chip { font-size: 11px; padding: 2px 10px; border-radius: 999px; color: #fff; margin-left: auto; font-weight: 700; }
.ev-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.ev-content { font-size: 14px; color: var(--text2); white-space: pre-wrap; line-height: 1.7; }
.ev-actions { margin-top: 10px; display: flex; justify-content: flex-end; gap: 4px; }
.ev-btn {
  border: none; background: transparent; color: var(--text2);
  font-size: 12px; padding: 5px 10px; border-radius: 8px; cursor: pointer; transition: all .2s;
}
.ev-btn:hover { background: #F6EEE3; color: var(--text); }
.ev-btn.danger { color: var(--danger); }
.ev-btn.confirm { background: var(--danger); color: #fff; }
.ev-btn.confirm:hover { background: #B95A4B; }

/* 空状态 */
.empty { text-align: center; color: var(--text2); padding: 36px 0 10px; font-size: 14px; line-height: 2; }
.empty svg { opacity: .5; margin-bottom: 8px; }

/* 悬浮添加按钮 */
.fab {
  position: fixed; right: max(18px, calc(50vw - 224px)); bottom: calc(88px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, #F2B8A3, var(--accent));
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(229, 143, 126, .4);
  transition: transform .2s;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(.92); }

/* 弹窗 */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(90, 70, 54, .38); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 480px;
  background: var(--card);
  border-radius: 26px 26px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
  transform: translateY(24px); transition: transform .25s;
}
.overlay.show .sheet { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sheet-head h2 { font-size: 19px; font-weight: 700; letter-spacing: 1px; }

/* 表单 */
label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 14px; font-weight: 600; }
label > input, label > textarea {
  display: block; width: 100%; margin-top: 6px;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 13px; font-size: 15px; font-family: inherit;
  background: #FFFDF9; color: var(--text);
}
label > input:focus, label > textarea:focus { outline: none; border-color: var(--accent); }
label > textarea { resize: none; line-height: 1.7; }
input[type="date"] { color-scheme: light; }
.row2 { display: flex; gap: 10px; }
.row2 label { flex: 1; }

.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag-option {
  padding: 7px 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: transparent;
  color: var(--text2); font-size: 13px; cursor: pointer; transition: all .2s;
}
.tag-option.selected { background: var(--tag); border-color: var(--tag); color: #fff; font-weight: 700; }

.btn-primary {
  width: 100%; padding: 13px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, #F2B8A3, var(--accent));
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 2px;
  cursor: pointer; margin-top: 4px; transition: filter .2s;
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-primary:active { transform: scale(.98); }

/* 数据操作 */
.data-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-ghost {
  flex: 1; padding: 11px; border-radius: 14px;
  border: 1.5px solid var(--line); background: transparent;
  color: var(--text2); font-size: 14px; cursor: pointer; transition: all .2s;
}
.btn-ghost:hover { color: var(--accent-deep); border-color: var(--accent); }
.hint { font-size: 12px; color: var(--text2); text-align: center; margin-top: 14px; line-height: 1.8; }

/* 板块宫格（独立板块卡片） */
.mod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mod-card-tile {
  background: var(--card); border-radius: 20px; padding: 20px 14px 16px;
  text-align: center; cursor: pointer;
  box-shadow: 0 6px 18px rgba(178, 128, 88, .10);
  transition: transform .15s;
}
.mod-card-tile:active { transform: scale(.95); }
.mod-tile-icon {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px; color: #fff;
  box-shadow: 0 4px 12px rgba(178, 128, 88, .18);
}
.mod-tile-name { font-size: 15px; font-weight: 700; }
.mod-tile-type { font-size: 11px; color: var(--text2); margin-top: 3px; }
.mod-tile-preview { font-size: 12px; color: #C0A98F; margin-top: 8px; line-height: 1.6; }

.mod-tile-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 20px 14px 16px; border-radius: 20px;
  border: 2px dashed #E5D3BD; background: transparent;
  color: var(--text2); font-size: 13px; cursor: pointer; transition: all .2s;
  margin-top: 12px;
}
.mod-tile-add:hover { border-color: var(--accent); color: var(--accent-deep); background: #FFF9F2; }
.mod-tile-add:active { transform: scale(.98); }

/* 模块详情页 */
.mp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.mp-head-title { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: 1px; min-width: 0; }
.mp-head-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 4px 12px rgba(178, 128, 88, .18);
}
.mp-del { display: block; margin: 26px auto 0; border: none; background: transparent; color: #C0A98F; font-size: 13px; cursor: pointer; padding: 8px 16px; border-radius: 8px; }
.mp-del:hover { color: var(--danger); }
.mp-del.confirm { background: var(--danger); color: #fff; }

/* 相册 */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #F3E9DC; }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo-del {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: rgba(60, 40, 25, .55); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  padding: 0;
}
.photo-del.confirm { background: var(--danger); font-size: 10px; width: auto; padding: 0 8px; }
.photo-upload-tile {
  aspect-ratio: 1; border-radius: 14px;
  border: 2px dashed #E5D3BD; background: transparent;
  color: var(--text2); font-size: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.photo-upload-tile:hover { border-color: var(--accent); color: var(--accent-deep); }
.mp-hint { color: var(--text2); font-size: 14px; text-align: center; line-height: 1.8; padding: 24px 0; }

/* 计数器 */
.counter-box { text-align: center; padding: 36px 0 30px; }
.counter-label { color: var(--text2); font-size: 14px; margin-bottom: 8px; }
.counter-num {
  font-size: 76px; font-weight: 800; font-family: Georgia, serif;
  line-height: 1.1; margin-bottom: 20px;
}
.counter-btns { display: flex; gap: 16px; justify-content: center; }
.counter-btn {
  width: 58px; height: 58px; border-radius: 50%; border: none;
  font-size: 26px; font-weight: 700; color: #fff; cursor: pointer;
  box-shadow: 0 6px 16px rgba(178, 128, 88, .25);
  transition: transform .15s;
}
.counter-btn:active { transform: scale(.9); }

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(42, 30, 20, .93);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.lightbox.show { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 100%; max-height: 78vh; border-radius: 12px; }
.lb-cap { color: #EAD9C6; font-size: 14px; margin-top: 14px; }
.lb-close { margin-top: 14px; border: 1.5px solid rgba(255,255,255,.4); background: transparent; color: #EAD9C6; font-size: 13px; padding: 8px 26px; border-radius: 999px; cursor: pointer; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(92%, 440px);
  background: var(--card); border-radius: 999px;
  display: flex; padding: 6px;
  box-shadow: 0 8px 24px rgba(178, 128, 88, .18);
}
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: none; background: transparent; padding: 10px;
  border-radius: 999px; color: var(--text2); font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.tab.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 700; }

.mod-card {
  background: var(--card); border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(178, 128, 88, .08); margin-bottom: 14px;
}
.mod-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mod-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.mod-title { font-size: 15px; font-weight: 700; }
.mod-count { font-size: 11px; color: var(--text2); }
.mod-head .ev-btn:first-of-type { margin-left: auto; }

.mod-items { margin-bottom: 8px; }
.mod-item { display: flex; align-items: center; gap: 10px; padding: 7px 2px; }
.mod-check {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--c, var(--accent)); background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer; transition: all .15s; padding: 0;
}
.mod-item.done .mod-check { background: var(--c, var(--accent)); }
.mod-item-text { flex: 1; font-size: 14px; word-break: break-all; }
.mod-item.done .mod-item-text { color: var(--text2); text-decoration: line-through; }
.mod-item-del {
  border: none; background: none; color: #CBB9A6;
  padding: 4px; cursor: pointer; opacity: .55; transition: opacity .15s;
  display: inline-flex;
}
.mod-item-del:hover { opacity: 1; }
.mod-hint { color: #CBB9A6; font-size: 13px; padding: 4px 2px; }

.mod-add { display: flex; gap: 8px; }
.mod-add-input {
  flex: 1; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 9px 12px; font-size: 14px; background: #FFFDF9;
  color: var(--text); font-family: inherit; min-width: 0;
}
.mod-add-input:focus { outline: none; border-color: var(--accent); }
.mod-add-btn {
  width: 40px; border: none; border-radius: 12px; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}

.mod-note {
  width: 100%; border: none; background: transparent; resize: none;
  font-size: 14px; color: var(--text); line-height: 1.7; font-family: inherit;
  min-height: 60px; outline: none; display: block;
}
.mod-note::placeholder { color: #CBB9A6; }

/* 板块编辑弹窗 */
.type-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.type-option {
  padding: 12px 8px 10px; border-radius: 14px; text-align: center;
  border: 1.5px solid var(--line); background: transparent; cursor: pointer;
  font-size: 13px; color: var(--text2); transition: all .2s; font-weight: 600;
}
.type-option svg { display: block; margin: 0 auto 5px; }
.type-option small { display: block; font-size: 11px; font-weight: 400; margin-top: 2px; opacity: .8; }
.type-option.selected { border-color: var(--accent); color: var(--accent-deep); background: #FFF9F2; }
.type-option.selected svg { color: var(--accent); }

.color-picker { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.color-swatch {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  transition: transform .15s; padding: 0;
}
.color-swatch.selected { box-shadow: 0 0 0 2.5px var(--card), 0 0 0 5px var(--c); transform: scale(1.05); }
.empty-sm { padding: 18px 0 4px; }

/* 登录 */
.login-sub { color: var(--text2); font-size: 14px; text-align: center; margin: -8px 0 16px; }
.login-err { color: var(--danger); font-size: 13px; margin: -6px 0 12px; min-height: 18px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 99;
  transform: translateX(-50%) translateY(16px);
  background: rgba(90, 70, 54, .92); color: #fff;
  font-size: 14px; padding: 10px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: all .25s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
