/* ============================================================
   计划与复盘 · Apple-style Design System
   ------------------------------------------------------------
   设计语言参考 apple.com / iOS 17:
   - 底色 #f5f5f7,白卡悬浮,20px 大圆角,发丝级描边
   - 磨砂玻璃全局导航 (backdrop-filter)
   - iOS 系统色 (Blue #0071e3 / Green / Orange / Red)
   - 980px 胶囊按钮 (Apple 经典 pill)
   - 大标题 Hero + Apple Intelligence 渐变标语
   - iOS 弹性缓动 cubic-bezier(0.32, 0.72, 0, 1)
   - 自动适配深色模式 (prefers-color-scheme)
   ============================================================ */

:root {
  color-scheme: light dark;

  /* 画布与表面 */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --fill: rgba(120, 120, 128, 0.08);

  /* 文字 */
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #aeaeb2;

  /* 发丝线 */
  --border: rgba(0, 0, 0, 0.08);
  --hairline: rgba(0, 0, 0, 0.06);

  /* iOS 系统色 */
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-press: #006edb;
  --green: #34c759;
  --green-text: #248a3d;
  --orange: #ff9500;
  --orange-text: #b25000;
  --red: #ff3b30;
  --red-press: #e0342b;
  --purple: #af52de;
  --purple-text: #8e5bc5;
  --yellow: #ffb302;

  /* 品牌主色 = iOS 蓝 */
  --primary: var(--blue);
  --primary-hover: var(--blue-hover);
  --danger: var(--red);
  --danger-hover: var(--red-press);

  /* 形状与阴影 */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-pill: 980px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  --shadow-lift: 0 8px 28px rgba(0, 0, 0, 0.09);
  --shadow-btn: 0 1px 3px rgba(0, 113, 227, 0.28);

  /* 排版:SF Pro / 苹方 是 Apple 品牌的正统选择 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial,
    sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", "JetBrains Mono", Menlo,
    Consolas, monospace;

  /* Apple Intelligence 渐变(仅用于标语点缀) */
  --ai-gradient: linear-gradient(96deg, #0a84ff 0%, #bf5af2 45%, #ff6482 100%);

  /* 缓动:iOS 弹性曲线 */
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- 深色模式:iOS 暗色画布 ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(120, 120, 128, 0.24);
    --text: #f5f5f7;
    --muted: #98989d;
    --muted-2: #636366;
    --border: rgba(255, 255, 255, 0.12);
    --hairline: rgba(255, 255, 255, 0.08);
    --blue: #0a84ff;
    --blue-hover: #2997ff;
    --blue-press: #0071e3;
    --green: #30d158;
    --green-text: #30d158;
    --orange: #ff9f0a;
    --orange-text: #ff9f0a;
    --red: #ff453a;
    --red-press: #ff6961;
    --purple: #bf5af2;
    --purple-text: #bf5af2;
    --yellow: #ffb340;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    --shadow-lift: 0 10px 32px rgba(0, 0, 0, 0.55);
    --shadow-btn: 0 1px 3px rgba(10, 132, 255, 0.35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

::selection { background: color-mix(in srgb, var(--blue) 22%, transparent); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   全局导航:磨砂玻璃(苹果官网式 52px 细腻导航)
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 52px;
  padding: 0 max(24px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--border);
}

.brand {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s ease;
}
.brand:hover { opacity: 0.7; }
.brand-sep { color: var(--muted-2); margin: 0 3px; font-weight: 400; }

.user-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   按钮:苹果 980px 胶囊体系
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s var(--ease-ios), box-shadow 0.2s var(--ease-ios),
    background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active { transform: scale(0.96); }

/* 蓝色主按钮(苹果官网 CTA) */
.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--blue-hover); box-shadow: 0 4px 16px color-mix(in srgb, var(--blue) 35%, transparent); }
.btn-primary:active { background: var(--blue-press); transform: scale(0.96); }

/* 幽灵按钮:浅灰填充( iOS 二级按钮) */
.btn-ghost {
  background: var(--fill);
  color: var(--text);
  border-color: transparent;
}
.btn-ghost:hover { background: color-mix(in srgb, var(--muted-2) 30%, transparent); }
.btn-ghost:active { background: color-mix(in srgb, var(--muted-2) 45%, transparent); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
}
.btn-danger:hover {
  background: color-mix(in srgb, var(--red) 8%, transparent);
  border-color: var(--red);
}
.btn-danger:active { background: color-mix(in srgb, var(--red) 16%, transparent); }

/* ---------- 顶部导航链接 ---------- */
.nav-link {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 6px 12px;
  font-weight: 500;
}
.nav-link:hover { color: var(--text); background: var(--fill); }
.nav-link.active { color: var(--blue); font-weight: 600; }

/* ---------- 顶栏备份状态点(每日自动备份) ---------- */
.backup-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-2);
  cursor: help;
  transition: background-color 0.3s ease;
}
.backup-dot-ok { background: var(--green); }
.backup-dot-warn { background: var(--orange); }
.backup-dot-err { background: var(--red); }
.backup-dot-busy {
  background: var(--blue);
  animation: backup-dot-pulse 1.2s ease-in-out infinite;
}
@keyframes backup-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue) 45%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--blue) 0%, transparent); }
}

/* ============================================================
   布局
   ============================================================ */
#app {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 28px 96px;
  min-height: calc(100vh - 52px);
}

.footer {
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  letter-spacing: 0.01em;
  padding: 28px 16px 44px;
  border-top: 0.5px solid var(--hairline);
}

.section-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============================================================
   日视图:白卡悬浮 + 玻璃头部
   ============================================================ */
.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}
.day-center { display: flex; align-items: center; gap: 10px; }
.day-label {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.day-today {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.day-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.day-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 0.5px solid var(--hairline);
}
.day-card-head .section-title { font-size: 17px; }
/* 心事日记书写界面:「心情日记/周记」顶部切换 + 周记可编辑标题 */
.diary-toggle { display: flex; gap: 8px; margin-bottom: 20px; }
.diary-toggle .btn { flex: 1; }
.weekly-title { margin: 14px 22px 0; width: calc(100% - 44px); }
.save-status { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.word-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; margin-right: 10px; }

/* 保存状态四态:未保存(琥珀) / 保存中(旋转) / 已保存(绿) / 失败重试(红,可点) */
.status-dirty { color: var(--orange-text); font-weight: 600; }
.status-dirty::before { content: "● "; font-size: 10px; vertical-align: 1px; }
.status-syncing { color: var(--muted); }
.status-syncing::before { content: "⟳"; display: inline-block; margin-right: 4px; animation: spin 1s linear infinite; }
.status-saved { color: var(--green-text); font-weight: 600; }
.status-retry {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--red);
}
.status-retry:hover { color: var(--red-press); text-decoration: underline; }
@keyframes spin { to { transform: rotate(360deg); } }
/* 图片上传进度(慢上传时实时显示百分比) */
.status-upload { color: var(--muted); font-variant-numeric: tabular-nums; }
.status-upload .upload-bar {
  display: inline-block;
  width: 64px;
  height: 5px;
  margin-left: 6px;
  border-radius: 3px;
  background: var(--border);
  vertical-align: 1px;
  overflow: hidden;
}
.status-upload .upload-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.15s linear;
}
.status-upload-fail { color: var(--red); font-weight: 600; }

/* ============================================================
   星级自评:App Store 评分质感
   ============================================================ */
.rating-block {
  padding: 18px 22px;
  border-top: 0.5px solid var(--hairline);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}
.rating-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 14px;
}
.rating-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.rating-label {
  width: 60px;
  color: var(--muted);
  font-size: 14px;
}
.stars { display: flex; gap: 6px; }
.star {
  color: var(--muted-2);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s var(--ease-spring);
  user-select: none;
}
.star:hover { transform: scale(1.18); }
.star.on { color: var(--yellow); text-shadow: 0 1px 2px color-mix(in srgb, var(--yellow) 40%, transparent); }
.rating-status { display: block; margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ---------- 板块操作区 ---------- */
.section-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px 14px;
  border-top: 0.5px solid var(--hairline);
}
.btn-sm { font-size: 13px; padding: 5px 14px; }

/* 屏幕使用时间 */
.screen-card .section-title { font-size: 17px; }
.screen-fields {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  flex-wrap: wrap;
}
.screen-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}
.screen-input {
  width: 110px;
  font: inherit;
  font-size: 15px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.screen-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--blue) 18%, transparent); }

/* 主页卡片内的屏幕使用时间 */
.home-screen {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

/* ============================================================
   输入:iOS 表单质感
   ============================================================ */
.title-input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.title-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--blue) 18%, transparent);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  border-bottom: 0.5px solid var(--hairline);
}
.toolbar button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s var(--ease-ios);
}
.toolbar button:hover { background: var(--fill); color: var(--text); }
.toolbar button:active { transform: scale(0.92); }

.md-input {
  display: block;
  width: 100%;
  border: none;
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.75;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 200px;
  outline: none;
}
.md-input::placeholder { color: var(--muted-2); }

/* 预览显示在输入框上方 */
.md-preview {
  padding: 14px 22px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  border-bottom: 0.5px solid var(--hairline);
  min-height: 60px;
  word-break: break-word;
  line-height: 1.55;
  font-size: 15px;
}

/* ---------- markdown preview ---------- */
.md-preview h1, .md-preview h2, .md-preview h3 {
  margin: 0.6em 0 0.25em;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 700;
}
.md-preview h1 { font-size: 1.5em; }
.md-preview h2 { font-size: 1.3em; }
.md-preview h3 { font-size: 1.1em; }
/* 段落间距用单边外边距,避免相邻段落 margin 折叠后过小,空行(双回车)在预览中不可见 */
.md-preview p { margin: 0 0 1em; }
.md-preview p:last-child { margin-bottom: 0; }
.md-preview ul, .md-preview ol { margin: 0.3em 0; padding-left: 1.6em; }
.md-preview li { margin: 0.1em 0; }
.md-preview code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--fill);
  padding: 2px 7px;
  border-radius: 6px;
}
.md-preview pre {
  background: #1d1d1f;
  color: #f5f5f7;
  padding: 18px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.9em 0;
  box-shadow: var(--shadow);
}
.md-preview pre code { background: transparent; color: inherit; padding: 0; font-size: 0.85em; }
.md-preview blockquote {
  margin: 0.9em 0;
  padding: 4px 16px;
  border-left: 3px solid var(--muted-2);
  color: var(--muted);
}
.md-preview a { color: var(--blue); text-decoration: underline; }
.md-preview img { max-width: 100%; border-radius: var(--radius-sm); }
.md-preview .md-figure { margin: 0 0 1em; }
.md-preview .md-figure figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; }
.md-preview hr { border: none; border-top: 0.5px solid var(--border); margin: 1.4em 0; }
.md-preview input[type="checkbox"] { margin-right: 6px; accent-color: var(--blue); }
.md-preview table { border-collapse: collapse; margin: 0.9em 0; }
.md-preview th, .md-preview td { border: 0.5px solid var(--border); padding: 6px 12px; }

/* ============================================================
   主页:apple.com Hero 式大标语
   ============================================================ */
.home-hero {
  text-align: center;
  padding: 56px 16px 40px;
}
.home-sub {
  margin: 0 0 28px;
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  background: var(--ai-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.btn-lg {
  font-size: 17px;
  font-weight: 500;
  padding: 13px 30px;
  max-width: 320px;
  margin: 0 auto;
  border-radius: var(--radius-pill);
}
/* 主页两个入口按钮:块级排列,窄屏(安卓)上不重叠 */
.home-hero .btn-lg {
  display: flex;
}
.home-hero .btn-lg + .btn-lg {
  margin-top: 12px;
}

.home-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin: 32px 0 14px;
  text-transform: uppercase;
}

.home-list { display: flex; flex-direction: column; gap: 12px; }
/* 「加载更早」按钮:与卡片列表保持同样的视觉节奏 */
.load-more { margin-top: 12px; margin-bottom: 8px; }
.home-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios),
    border-color 0.25s ease;
}
.home-card:hover {
  transform: translateY(-3px) scale(1.005);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--muted-2) 40%, transparent);
}
.home-card:active { transform: translateY(-1px) scale(0.995); }
.home-date {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  transition: color 0.18s ease;
}
.home-card:hover .home-date { color: var(--blue); }
.home-body { display: flex; flex-direction: column; gap: 6px; }
.home-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* iOS 式浅色染色胶囊标签 */
.tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 11%, transparent);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  margin-top: 1px;
}
.tag-review {
  color: var(--green-text);
  background: color-mix(in srgb, var(--green) 13%, transparent);
}
.tag-mood {
  color: var(--orange-text);
  background: color-mix(in srgb, var(--orange) 14%, transparent);
}
.tag-weekly {
  color: var(--purple-text);
  background: color-mix(in srgb, var(--purple) 14%, transparent);
}

/* ---------- 导入 Word 周记 ---------- */
.import-picker { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.import-item .import-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.import-name { font-weight: 600; font-size: 14px; word-break: break-all; }
.import-field { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.import-field input {
  flex: 1;
  font: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-width: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.import-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--blue) 18%, transparent); }
.import-meta { margin-top: 8px; font-size: 12px; color: var(--muted-2); }
.import-warn { color: var(--orange-text); }
.import-status-done { color: var(--green-text); }
.import-status-failed { color: var(--red); }
.import-status-importing { color: var(--blue); }

/* 主页卡片内的星级(玩好 / 学好) */
.home-rating { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.rating-mini { display: inline-flex; align-items: center; gap: 2px; }
.rate-label { margin-right: 2px; }
.starmini { font-size: 15px; line-height: 1; color: var(--muted-2); }
.starmini.on { color: var(--yellow); }
.tag-text {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.empty.muted { padding: 40px 16px; font-size: 14px; color: var(--muted); text-align: center; }

/* ============================================================
   登录:居中白卡
   ============================================================ */
.login-box {
  max-width: 400px;
  margin: 12vh auto 0;
  padding: 40px 32px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 24px;
  text-align: center;
  box-shadow: var(--shadow-lift);
}
.login-title { margin: 0 0 8px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.login-sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form .title-input { margin-bottom: 0; font-weight: 500; }
.btn-block { width: 100%; }
.login-error {
  margin-top: 14px;
  color: var(--red);
  font-size: 14px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 720px) {
  .topbar { padding: 10px 14px; gap: 10px; height: auto; flex-wrap: wrap; }
  .brand { font-size: 16px; }
  #app { padding: 24px 16px 72px; }
  .home-hero { padding: 36px 8px 28px; }
  .day-nav { flex-wrap: wrap; }
  .day-card { border-radius: 16px; }
}

/* ============================================================
   动画体系:入场 / 微交互 / 降级
   ============================================================ */

/* ---------- 关键帧 ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes softPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ---------- 主页入场:iOS 弹性曲线错落浮现 ---------- */
.home-hero {
  animation: fadeUp 0.65s var(--ease-ios) backwards;
}
.home-heading {
  animation: fadeIn 0.45s ease 0.15s backwards;
}
.home-card {
  animation: fadeUp 0.55s var(--ease-ios) backwards;
}
.home-card:nth-child(1) { animation-delay: 0.06s; }
.home-card:nth-child(2) { animation-delay: 0.12s; }
.home-card:nth-child(3) { animation-delay: 0.18s; }
.home-card:nth-child(4) { animation-delay: 0.24s; }
.home-card:nth-child(5) { animation-delay: 0.3s; }
.home-card:nth-child(n+6) { animation-delay: 0.36s; }

/* ---------- 日视图入场 ---------- */
.day-nav { animation: fadeIn 0.35s ease backwards; }
.day-card {
  animation: fadeUp 0.55s var(--ease-ios) backwards;
}
.day-card:nth-child(2) { animation-delay: 0.07s; }  /* day-nav 是第1个 */
.day-card:nth-child(3) { animation-delay: 0.14s; }
.day-card:nth-child(4) { animation-delay: 0.21s; }
.day-card:nth-child(5) { animation-delay: 0.28s; }

/* ---------- 登录框 ---------- */
.login-box {
  animation: fadeUp 0.6s var(--ease-ios) backwards;
}

/* ---------- 设置面板(顶栏 ⚙ 入口) ---------- */
.settings-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.settings-mask[hidden] { display: none; }
.settings-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  animation: fadeUp 0.35s var(--ease-ios) backwards;
}
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 10px;
}
.settings-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.settings-close {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--fill);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.settings-close:hover { background: color-mix(in srgb, var(--muted-2) 30%, transparent); color: var(--text); }
.settings-body { padding: 6px 10px 14px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 12px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
}
.settings-row:hover { background: var(--fill); }
.settings-row + .settings-row { margin-top: 2px; }
.settings-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-row-title { font-size: 15px; font-weight: 500; }
.settings-row-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.settings-status {
  min-height: 22px;
  padding: 0 22px 16px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- 主页 CTA:入场后轻微呼吸引导 ---------- */
.btn-lg { animation: softPulse 2.8s ease-in-out 1.4s infinite; }

/* ---------- 星级微交互 ---------- */
.star { transition: color 0.15s ease, transform 0.15s var(--ease-spring); }
.star.on { animation: popIn 0.32s var(--ease-spring) backwards; }
.stars:hover .star:not(:hover):not(.on) { color: color-mix(in srgb, var(--muted-2) 60%, var(--muted)); }
.stars:hover .star:not(.on) { cursor: pointer; }

/* ---------- 保存状态与图片淡入 ---------- */
.save-status { animation: fadeIn 0.3s ease backwards; }
.md-preview img { animation: fadeIn 0.4s ease backwards; }

/* ---------- 顶部栏进场 ---------- */
.topbar { animation: fadeIn 0.45s ease backwards; }

/* ---------- 滚动条:细腻灰(iOS WebKit) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted-2) 55%, transparent);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 减少动态(系统偏好) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 开屏(#splash)样式内联于 index.html,保证命中旧缓存 style.css 时仍正确显示 */
