/* home 的样式：样稿方案 B「时间轴」（site-frontend D1）。左侧日期栏 + 竖线串起当天条目，
   条目无卡片底；正文宋体，界面文字系统无衬线；靛蓝强调色；跟随系统明暗。
   不加载任何网络字体或外站资源。可点击的控件不小于 44×44。 */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #ffffff;
  --raised: #ffffff;
  --fg: #22201d;
  --muted: #6f6a63;
  --line: #e6e2dc;
  --accent: #3d5a99;
  --accent-fg: #ffffff;
  --chip: #e9edf6;
  --danger: #b3261e;
  --scrim: rgba(18, 16, 14, 0.45);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  --heat-0: #edeae5;
  --heat-1: #c7d1ea;
  --heat-2: #93a6d6;
  --heat-3: #5f79b8;
  --heat-4: #3d5a99;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --gutter-l: max(16px, env(safe-area-inset-left));
  --gutter-r: max(16px, env(safe-area-inset-right));
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #121316;
    --raised: #1d1f24;
    --fg: #e9e7e3;
    --muted: #a19c95;
    --line: #2d2f35;
    --accent: #9db2ea;
    --accent-fg: #121316;
    --chip: #232a3d;
    --danger: #f2b8b5;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --heat-0: #24262c;
    --heat-1: #2f3a5c;
    --heat-2: #4a5e93;
    --heat-3: #7189c9;
    --heat-4: #9db2ea;
  }
}

* { box-sizing: border-box; }
html.locked { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.7 var(--sans);
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter-r) calc(140px + env(safe-area-inset-bottom)) var(--gutter-l);
}

/* ---- 顶栏 ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 10px; }
.topbar h1 { margin: 0; font: 600 28px/1.2 var(--serif); letter-spacing: 0.04em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); font-size: 15px; font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
a.btn { text-decoration: none; }
.btn:disabled { opacity: 0.5; }
.link { min-height: 44px; padding: 0 4px; color: var(--muted); }

/* ---- 时间轴：左侧日期栏 + 竖线 ---- */
.day { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 14px; }
.day-h {
  position: sticky; top: env(safe-area-inset-top); align-self: start;
  display: flex; flex-direction: column; padding-top: 14px; line-height: 1.3;
  font-size: 12px; color: var(--muted); background: var(--bg);
}
.d-num { font: 600 30px/1 var(--serif); color: var(--fg); font-variant-numeric: tabular-nums; }
.d-wk { margin-top: 4px; }
.d-rel { color: var(--accent); }
.day-items { display: flex; flex-direction: column; gap: 24px; min-width: 0; border-left: 1px solid var(--line); padding: 14px 0 26px 16px; }

/* ---- 条目 ---- */
.entry { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.entry::before {
  content: ""; position: absolute; left: -22px; top: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.e-meta { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 13px; color: var(--muted); }
.e-meta time { font-variant-numeric: tabular-nums; }
.more { margin-left: auto; margin-right: -12px; width: 44px; height: 44px; border-radius: 10px; color: var(--muted); font-size: 18px; letter-spacing: 1px; }
.badge { font-size: 12px; line-height: 1.6; padding: 0 8px; border-radius: 999px; background: var(--chip); color: var(--accent); white-space: nowrap; }
.badge.private { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.e-body { margin: 0; font: 18px/1.8 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.e-kind { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; color: var(--accent); }
.e-title { margin: 0; font: 600 20px/1.4 var(--serif); text-wrap: balance; }
.e-excerpt {
  margin: 0; color: var(--muted); font: 15px/1.7 var(--serif);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.read { align-self: flex-start; min-height: 44px; color: var(--accent); font-size: 15px; }

/* 照片网格（D5）：1 张按原比例，2、4 张两列，其余三列 */
.grid { display: grid; gap: 4px; grid-template-columns: repeat(3, 1fr); }
.grid.g1 { grid-template-columns: 1fr; }
.grid.g2 { grid-template-columns: 1fr 1fr; }
.ph { position: relative; display: block; overflow: hidden; aspect-ratio: 1; border-radius: 2px; background: var(--line); min-height: 44px; }
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.grid.g1 .ph { aspect-ratio: var(--ar); }
.grid.g1.tall .ph { width: 70%; }
.plus { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 22px; font-weight: 600; }

.empty, .end { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 0; }
.more-sentinel { height: 1px; }

/* ---- 「···」菜单 ---- */
.menu {
  position: absolute; right: -6px; top: 40px; z-index: 5; min-width: 200px; padding: 6px;
  display: flex; flex-direction: column;
  background: var(--raised); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.menu button { min-height: 44px; padding: 0 12px; border-radius: 8px; text-align: left; font-size: 15px; }
.menu button:hover { background: var(--chip); }
.menu .danger { color: var(--danger); }
.menu .note { margin: 0; padding: 6px 12px 8px; font-size: 13px; color: var(--muted); }
.menu .confirm { display: flex; gap: 6px; }
.menu .confirm button { flex: 1; text-align: center; border: 1px solid var(--line); }
.menu .confirm .danger { background: var(--danger); border-color: var(--danger); color: var(--bg); }

/* ---- 右下角「+」与底部导航 ---- */
.fab {
  position: fixed; z-index: 6;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); font-size: 30px; line-height: 1; box-shadow: var(--shadow);
}
@media (min-width: 760px) { .fab { right: calc(50% - 320px - 72px); } }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center; gap: 8px;
  padding: 6px var(--gutter-r) calc(6px + env(safe-area-inset-bottom)) var(--gutter-l);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
}
.tabs a {
  display: grid; place-items: center; min-width: 88px; min-height: 44px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 15px;
}
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; background: var(--chip); }

/* ---- 底部动作面板（新建） ---- */
.scrim { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.asheet {
  width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 10px;
  padding: 18px var(--gutter-r) calc(18px + env(safe-area-inset-bottom)) var(--gutter-l);
  background: var(--raised); border-radius: 18px 18px 0 0;
}
.big { min-height: 60px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; text-align: left; }
.big b { display: block; }
.big span { font-size: 13px; color: var(--muted); }

/* ---- 全屏编辑页 ---- */
.sheet {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-bar {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter-r) 8px var(--gutter-l);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.sheet-bar h2 { margin: 0; font-size: 16px; text-align: center; }
.sheet-bar > :first-child { justify-self: start; }
.sheet-bar > :last-child { justify-self: end; }
.sheet-body { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding: 16px var(--gutter-r) 48px var(--gutter-l); }
.sheet textarea {
  width: 100%; min-height: 8em; border: 0; resize: vertical; background: transparent; color: var(--fg);
  font: 18px/1.8 var(--serif); padding: 0;
}
.sheet textarea:focus-visible { outline: none; }
.cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cell {
  position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--line);
  /* 平时允许从照片上开始滑动页面；长按进入拖动后由 composer.mjs 拦住 touchmove（D20）。 */
  touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  transition: transform 0.12s, box-shadow 0.12s;
}
.cell img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.cell.lifted { transform: scale(1.08); box-shadow: var(--shadow); z-index: 3; }
.cell .idx { position: absolute; left: 6px; bottom: 4px; color: #fff; font-size: 12px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.cell .x {
  position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: grid; place-items: center;
  color: #fff; font-size: 16px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.cell .state {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 6px; text-align: center;
  background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 12px; line-height: 1.4;
}
.cell.failed .state { background: rgba(140, 20, 20, 0.75); }
.add {
  aspect-ratio: 1; display: grid; place-items: center; border: 1.5px dashed var(--line); border-radius: 8px;
  color: var(--muted); font-size: 13px; text-align: center; cursor: pointer;
}
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.c-status { margin: 0; min-height: 1.6em; font-size: 14px; color: var(--danger); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(140px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px);
  padding: 10px 18px; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 14px; box-shadow: var(--shadow);
}
.cards { display: flex; flex-direction: column; gap: 12px; }
.cards:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- 文章编辑、预览、阅读与发布清单（article-authoring） ---- */
.sheet input[type="text"] {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg);
  font: 600 22px/1.5 var(--serif); padding: 0 0 8px;
}
.sheet input[type="text"]:focus-visible { outline: none; border-bottom-color: var(--accent); }
.sheet textarea.md { min-height: 50vh; font: 15px/1.7 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.tabs-inline { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs-inline button { min-height: 44px; padding: 0 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-inline button[aria-selected="true"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.prose { font: 18px/1.8 var(--serif); max-width: 36em; }
.prose h1 { font-size: 26px; line-height: 1.35; margin: 4px 0 12px; text-wrap: balance; }
.prose h2 { font-size: 20px; margin: 1.6em 0 0.4em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose figure { margin: 1.4em 0; }
.prose img { max-width: 100%; height: auto; display: block; border-radius: 2px; }
.prose figcaption { font: 13px/1.5 var(--sans); color: var(--muted); text-align: center; margin-top: 6px; }
.pickgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; max-height: 50vh; overflow-y: auto; }
.pickgrid button { aspect-ratio: 1; overflow: hidden; border-radius: 4px; min-height: 44px; }
.pickgrid img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pickgrid .hint, .pickgrid .c-status { grid-column: 1 / -1; }
.pub-list { margin: 0; padding: 0 0 0 1.2em; max-height: 40vh; overflow-y: auto; font-size: 15px; }
.pub-list li { padding: 4px 0; }
.pub-list em { margin-left: 8px; font-style: normal; font-size: 12px; color: var(--accent); }
.pub-list .retract em, .pub-list .deleted em { color: var(--danger); }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--accent-fg); color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums;
}

/* ---- 回忆卡片（home-recall） ---- */
.cards { margin-bottom: 8px; }
.card { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); color: inherit; text-decoration: none; }
.card-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; color: var(--accent); }
.card-title { display: block; margin-top: 2px; font: 600 18px/1.5 var(--serif); }
.card-row { display: flex; align-items: center; justify-content: space-between; }
.card .link { color: var(--accent); font-size: 14px; }
.recall-group { padding-top: 10px; }
.recall-group + .recall-group { border-top: 1px solid var(--line); margin-top: 10px; }
.rg-head { display: flex; gap: 10px; align-items: baseline; min-height: 32px; color: inherit; text-decoration: none; }
.ago { font: 600 16px/1.4 var(--serif); }
.rg-date { font-size: 13px; color: var(--muted); }
.rg-text { margin: 2px 0 8px; font: 16px/1.7 var(--serif); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rg-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }

/* ---- 往事页与热力图（D17：格子是密集概览，不受 44 像素限制） ---- */
.back { display: inline-flex; align-items: center; margin-left: -4px; font-size: 14px; text-decoration: none; }
.heatmap-wrap { margin: 8px 0 20px; }
.hm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hm-head h2 { margin: 0; font: 600 18px/1.4 var(--serif); }
.hm-years { display: flex; gap: 4px; flex-wrap: wrap; }
.hm-years a { display: grid; place-items: center; min-height: 44px; min-width: 56px; padding: 0 8px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; font-variant-numeric: tabular-nums; }
.hm-years a[aria-current="true"] { background: var(--chip); color: var(--accent); font-weight: 600; }
.heatmap { overflow-x: auto; padding: 8px 0; scrollbar-width: thin; }
.hm-grid { display: grid; grid-template-rows: repeat(7, 14px); grid-auto-flow: column; grid-auto-columns: 14px; gap: 3px; width: max-content; }
.hm-cell, .lg { display: block; width: 14px; height: 14px; border-radius: 3px; background: var(--heat-0); }
.hm-pad { display: block; }
.l1 { background: var(--heat-1); }
.l2 { background: var(--heat-2); }
.l3 { background: var(--heat-3); }
.l4 { background: var(--heat-4); }
.hm-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.archive-year { margin-bottom: 18px; }
.ay-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.ay-head h2 { margin: 0; font: 600 22px/1.4 var(--serif); font-variant-numeric: tabular-nums; }
.months { list-style: none; margin: 0; padding: 0; }
.months a { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 0 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; font: 17px/1.4 var(--serif); }
.months .n { font: 14px var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- 年度回顾 ---- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 20px; }
.stats > div { padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.stat { display: block; font: 600 30px/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.stat-l { font-size: 13px; color: var(--muted); }
.month-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 20px; }
.month-photo { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--line); color: #fff; text-decoration: none; }
.month-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.month-photo span { position: absolute; left: 6px; bottom: 4px; font-size: 12px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.month-photo.empty { background: transparent; border: 1px dashed var(--line); }
.month-photo.empty span { color: var(--muted); text-shadow: none; }
.bookend { margin-bottom: 16px; }
.bookend h2 { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); }
.bookend a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.bk-date { display: block; font-size: 13px; color: var(--muted); }
.bk-text { font: 16px/1.7 var(--serif); }

/* tools-platform A：日常摘要优先，下面延续时间轴和回忆。 */
body:has(#home) { --bg: #faf9f6; --surface: #fffefb; --raised: #fffefb; }
#home { max-width: 1040px; }
#home > .topbar { flex-wrap: wrap; }
#home > .topbar > div:first-child { flex: 1 1 180px; min-width: 0; }
.home-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.home-actions .btn { padding: 0 14px; font-size: 13px; white-space: nowrap; }
.daily-intro { margin: 18px 0 24px; }
.daily-kicker { color: var(--muted); font-size: 12px; letter-spacing: .08em; margin: 0 0 10px; }
.daily-intro h2 { font: 600 29px/1.5 var(--serif); margin: 0 0 6px; }
.daily-intro > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.daily-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.anniversary-empty { padding: 28px; border-radius: 18px; background: #f4ead5; color: #83652c; display: flex; flex-direction: column; justify-content: center; }
.anniversary-empty .daily-kicker { color: inherit; }
.anniversary-empty h2 { margin: 0 0 10px; font: 600 25px/1.5 var(--serif); }
.anniversary-empty > p:last-child { margin: 0; font-size: 13px; opacity: .8; }
.shopping-widget { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; min-width: 0; }
.shopping-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shopping-head h2 { margin: 0; font: 600 20px/1.5 var(--serif); }
.shopping-head > span { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.shopping-head b { font-weight: 400; }
.shopping-list { list-style: none; padding: 0; margin: 12px 0; }
.shopping-item { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); min-height: 48px; }
.shopping-item:last-child { border-bottom: 0; }
.shopping-toggle { width: 44px; min-height: 44px; flex-shrink: 0; display: grid; place-items: center; }
.shopping-tick { border: 1px solid var(--muted); border-radius: 6px; width: 19px; height: 19px; display: grid; place-items: center; font-size: 12px; line-height: 1; }
.is-done .shopping-tick { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.shopping-text { font-size: 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.is-done .shopping-text { text-decoration: line-through; color: var(--muted); }
.shopping-form { display: flex; gap: 8px; margin-top: 14px; }
.shopping-form input { min-width: 0; width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg); background: transparent; font: inherit; font-size: 14px; }
.shopping-form .btn { flex-shrink: 0; padding: 0 14px; font-size: 13px; }
.shopping-empty { color: var(--muted); font-size: 13px; margin: 16px 0; }
.shopping-status { margin: 6px 0 0; color: var(--muted); font-size: 12px; min-height: 0; overflow-wrap: anywhere; }
.shopping-status:empty { display: none; }
.shopping-all, .shopping-reload { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-size: 13px; text-decoration: none; }
.shopping-completed { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 10px; }
.shopping-completed summary { min-height: 44px; cursor: pointer; padding-top: 8px; color: var(--muted); font-size: 14px; }
.home-bottom { margin-top: 32px; }
.home-records { min-width: 0; }
.home-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.home-section-head h2 { margin: 0; font: 600 22px/1.5 var(--serif); }
.home-section-head a { min-height: 44px; display: inline-flex; align-items: center; font-size: 12px; color: var(--muted); text-decoration: none; }
.home-bottom .cards:empty { display: none; }
@media (min-width: 800px) {
  .home-bottom.has-memories { display: grid; grid-template-columns: 1.6fr 1fr; gap: 30px; }
  .home-bottom:not(.has-memories) .home-records { max-width: 720px; margin: auto; }
  .home-bottom .cards { padding-top: 8px; align-self: start; }
}
@media (max-width: 650px) {
  .daily-grid { grid-template-columns: 1fr; gap: 14px; }
  .daily-intro h2 { font-size: 25px; }
  .anniversary-empty { padding: 22px; min-height: 150px; }
  .shopping-widget { padding: 20px; }
  .home-bottom .cards { margin-top: 28px; }
  .home-actions .btn { padding: 0 12px; }
}
@media (prefers-color-scheme: dark) {
  body:has(#home) { --bg: #121316; --surface: #1b1e24; --raised: #1d1f24; }
  .anniversary-empty { background: #342e24; color: #dcc798; }
}

/* 每年期待的小日子：纯本地工具，与既有购物共用轻量布局。 */
.anniversary-upcoming { list-style: none; padding: 0; margin: 0; }
.anniversary-upcoming li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; }
.anniversary-upcoming li + li { border-top: 1px solid #bfa87855; }
.anniversary-upcoming li > div { min-width: 0; }
.anniversary-upcoming h2 { font-size: 21px; overflow-wrap: anywhere; margin: 0 0 4px; }
.anniversary-upcoming p { margin: 0; font-size: 12px; opacity: .85; }
.anniversary-upcoming strong { font: 600 16px/1.5 var(--serif); flex-shrink: 0; }
.anniversary-manage { color: inherit; display: inline-flex; align-items: center; min-height: 44px; margin-top: 10px; font-size: 13px; text-decoration: none; }
.tools-stack { display: grid; gap: 22px; }
.anniversary-manager { background: var(--raised); border: 1px solid var(--line); border-radius: 18px; padding: 22px; scroll-margin-top: 20px; }
.anniversary-list { list-style: none; margin: 16px 0; padding: 0; }
.anniversary-item { display: flex; gap: 10px; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 14px 0; }
.anniversary-item > div:first-child { min-width: 0; }
.anniversary-item h3 { font: 600 18px/1.5 var(--serif); margin: 0; overflow-wrap: anywhere; }
.anniversary-item p { font-size: 12px; color: var(--muted); margin: 4px 0; }
.anniversary-item strong { font-size: 13px; font-weight: 500; color: var(--accent); }
.anniversary-item.is-archived h3 { color: var(--muted); }
.anniversary-item-actions { display: flex; align-items: center; flex-shrink: 0; gap: 4px; }
.anniversary-item-actions button { min-width: 44px; min-height: 44px; font-size: 13px; color: var(--accent); }
.anniversary-form { border-top: 1px solid var(--line); padding-top: 18px; }
.anniversary-form h3 { font-size: 16px; margin: 0 0 12px; }
.anniversary-form label { display: block; font-size: 13px; color: var(--muted); }
.anniversary-form input:not([type=checkbox]), .anniversary-form select { display: block; width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 9px; padding: 0 10px; margin-top: 4px; font: 16px var(--sans); }
.anniversary-fields { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 10px; margin: 12px 0; }
.anniversary-fields.anniversary-fields-mode { grid-template-columns: 1fr 1fr; margin-top: 0; }
.anniversary-preview { margin: 6px 0; min-height: 1.5em; font-size: 14px; color: var(--accent); overflow-wrap: anywhere; }
.anniversary-form .anniversary-leap { display: flex; align-items: center; min-height: 44px; gap: 8px; }
.anniversary-leap input { width: 20px; height: 20px; accent-color: var(--accent); }
.anniversary-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.anniversary-actions .btn { font-size: 13px; }
.anniversary-rules { margin-top: 18px; font-size: 12px; color: var(--muted); }
.anniversary-rules summary { min-height: 44px; display: list-item; padding-top: 10px; cursor: pointer; }
@media(max-width:650px) {
 .anniversary-manager { padding: 20px; }
 .anniversary-item-actions { flex-direction: column; gap: 0; }
 .anniversary-upcoming li { gap: 8px; }
}

/* ---- 公网入口的登录页（open-public-access） ---- */
main.login { max-width: 420px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.login-form label { display: block; font-size: 13px; color: var(--muted); }
.login-form input { display: block; width: 100%; min-height: 44px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 9px; padding: 0 12px; margin-top: 4px; font: 16px var(--sans); }
.login-form .btn { min-height: 44px; }
.login-message { color: var(--danger); margin: 0; }
.login-probing { color: var(--muted); }
.login-home a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.icp { text-align: center; padding: 32px 16px calc(24px + env(safe-area-inset-bottom)); font: 13px/1.5 var(--sans); }
.icp a { color: var(--muted); text-decoration: none; }

/* ---- 账号页与「我的账号」 ---- */
.account-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.account-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.account-item h3 { margin: 0; font-size: 17px; }
.account-item p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.account-item.is-disabled h3 { color: var(--muted); }
.account-actions { display: flex; gap: 6px; }
.account-actions button { min-height: 44px; padding: 0 12px; color: var(--accent); }
.account-reset { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.account-reset input, .account-form input { min-height: 44px; flex: 1 1 200px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 9px; padding: 0 12px; font: 16px var(--sans); }
.account-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.account-form label { display: block; font-size: 13px; color: var(--muted); }
.account-form input { display: block; width: 100%; margin-top: 4px; }
.account-form .btn, .account-reset .btn { min-height: 44px; }
.account-status { min-height: 1.5em; }
.topbar > .btn { white-space: nowrap; flex-shrink: 0; }
.account-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 24px; }
.account-links a { min-height: 44px; display: inline-flex; align-items: center; color: var(--accent); }
