/* =====================================================
   习惯打卡 - 全局样式
   说明：颜色/圆角等统一走 CSS 变量；主题通过 data-theme 切换
   ===================================================== */

/* ---------- 极简（默认） ---------- */
:root {
  --bg: #f5f5f7;
  --page-grad: linear-gradient(180deg, #f7f7f8 0%, #f1f1f3 100%);
  --surface: #ffffff;
  --surface-2: #fafafb;
  --ink: #1a1a1c;
  --ink-2: #6e6e73;
  --ink-3: #a1a1a6;
  --line: #e8e8eb;
  --line-strong: #d8d8dd;
  --accent: #a67c52;
  --accent-strong: #8a6542;
  --accent-soft: rgba(166, 124, 82, .12);
  --accent-faint: rgba(166, 124, 82, .08);
  --on-accent: #ffffff;
  --btn-add: #1c1c1e;
  --btn-add-hover: #000000;
  --on-btn-add: #ffffff;
  --hover-bg: #efeff2;
  --row-done: #f4f4f5;
  --track-bg: #ececef;
  --fill-grad: linear-gradient(90deg, #bd9a6b 0%, #a67c52 100%);
  --card-grad: linear-gradient(180deg, #ffffff 0%, #fdfdfe 100%);
  --mask: rgba(20, 20, 24, .48);
  --danger: #c94f4f;
  --check-shadow: 0 3px 10px rgba(166, 124, 82, .32);
  --shadow-sm: 0 1px 2px rgba(16, 16, 20, .05), 0 10px 28px rgba(16, 16, 20, .05);
  --shadow-md: 0 2px 6px rgba(16, 16, 20, .06), 0 18px 44px rgba(16, 16, 20, .14);
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

/* ---------- 粉色 ---------- */
html[data-theme="cute"] {
  --bg: #fdf6f3;
  --page-grad: linear-gradient(180deg, #fdf8f6 0%, #fbeef0 100%);
  --surface: #ffffff;
  --surface-2: #fff6f4;
  --ink: #4a3538;
  --ink-2: #9a7f84;
  --ink-3: #c4aeb2;
  --line: #f6e2df;
  --line-strong: #eccfc9;
  --accent: #e88795;
  --accent-strong: #d96f80;
  --accent-soft: rgba(232, 135, 149, .14);
  --accent-faint: rgba(232, 135, 149, .09);
  --on-accent: #3f2930;
  --btn-add: #e88795;
  --btn-add-hover: #d96f80;
  --on-btn-add: #ffffff;
  --hover-bg: #fdeeec;
  --row-done: #fdeeec;
  --track-bg: #f6e2df;
  --fill-grad: linear-gradient(90deg, #f2a6b1 0%, #e88795 100%);
  --card-grad: linear-gradient(180deg, #ffffff 0%, #fffbfa 100%);
  --mask: rgba(122, 74, 82, .42);
  --danger: #dd5f74;
  --check-shadow: 0 3px 10px rgba(232, 135, 149, .35);
  --shadow-sm: 0 1px 2px rgba(214, 122, 136, .08), 0 10px 26px rgba(214, 122, 136, .10);
  --shadow-md: 0 2px 6px rgba(214, 122, 136, .10), 0 18px 44px rgba(214, 122, 136, .16);
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
}

/* 粉色：底色极淡圆点纹理（唯一装饰） */
html[data-theme="cute"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(232, 135, 149, .10) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
}

/* ---------- 暗黑 / 护眼 ---------- */
html[data-theme="dark"] {
  --bg: #17171a;
  --page-grad: linear-gradient(180deg, #19191c 0%, #141417 100%);
  --surface: #202024;
  --surface-2: #26262b;
  --ink: #ececee;
  --ink-2: #9c9ca4;
  --ink-3: #6d6d74;
  --line: #2d2d32;
  --line-strong: #3b3b42;
  --accent: #c9a26b;
  --accent-strong: #d8b78a;
  --accent-soft: rgba(201, 162, 107, .16);
  --accent-faint: rgba(201, 162, 107, .10);
  --on-accent: #17171a;
  --btn-add: #ececee;
  --btn-add-hover: #ffffff;
  --on-btn-add: #17171a;
  --hover-bg: #28282d;
  --row-done: #1d1d21;
  --track-bg: #2c2c31;
  --fill-grad: linear-gradient(90deg, #d9b88a 0%, #c9a26b 100%);
  --card-grad: linear-gradient(180deg, #232327 0%, #202024 100%);
  --mask: rgba(0, 0, 0, .62);
  --danger: #f28482;
  --check-shadow: 0 3px 10px rgba(201, 162, 107, .30);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 10px 40px rgba(0, 0, 0, .5);
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 9px;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--page-grad);
  color: var(--ink);
  padding: 30px 16px 64px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container { max-width: 720px; margin: 0 auto; }

[hidden] { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.brand { font-size: 24px; font-weight: 800; letter-spacing: .02em; }

.top-actions { position: relative; }
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.theme-btn:hover { border-color: var(--accent); color: var(--ink); }
.theme-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--line);
}
.theme-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 30;
}
.theme-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.theme-menu button:hover { background: var(--hover-bg); color: var(--ink); }
.theme-menu button.on { color: var(--ink); font-weight: 600; }
.opt-dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-minimal { background: #a67c52; }
.dot-cute { background: #e88795; }
.dot-dark { background: #c9a26b; }

/* ---------- 主导航 ---------- */
.main-nav {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 20px;
}
.nav-item {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { color: var(--ink); }
.nav-item.active { background: var(--btn-add); color: var(--on-btn-add); }

.view[hidden] { display: none; }

/* ---------- 卡片与通用标题 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-title {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
  letter-spacing: .08em;
  padding: 20px 24px 12px;
}
.eyebrow {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: .08em;
}

/* 今日标记（签名元素） */
.day-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.day-chip.big { font-size: 15px; padding: 9px 18px; }

/* ---------- 今日进度 ---------- */
.progress-card { padding: 22px 24px 24px; background: var(--card-grad); }
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.progress-num { text-align: right; }
.progress-label {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: .1em;
  margin-bottom: 3px;
}
.progress-text {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.progress-track { height: 6px; background: var(--track-bg); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--fill-grad);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 习惯列表 ---------- */
.habit-list { list-style: none; padding: 4px 0; }
.habit-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 24px;
  transition: background .25s ease;
}
.habit-item + .habit-item { border-top: 1px solid var(--line); }
.habit-item:hover { background: var(--surface-2); }
.habit-item.done { background: var(--row-done); }

.habit-main { flex: 1; min-width: 0; }
.habit-name {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .25s ease;
}
.habit-item.done .habit-name {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}
.habit-stats { font-size: 12px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.habit-item.done .habit-stats { opacity: .75; }

/* 打勾按钮 */
.check-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  color: transparent;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.check-btn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-faint); }
.check-btn:active { transform: scale(.9); }
.habit-item.done .check-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--check-shadow);
}
.check-btn.small { width: 24px; height: 24px; font-size: 13px; }
.check-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* 行内图标按钮 */
.habit-actions { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink-3);
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--hover-bg); color: var(--ink-2); }

.rename-input {
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  padding: 5px 9px;
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-faint);
}

/* ---------- 添加习惯 ---------- */
.add-form {
  display: flex;
  gap: 10px;
  padding: 15px 24px 20px;
  border-top: 1px solid var(--line);
}
.add-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-2);
  outline: none;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.add-form input::placeholder { color: var(--ink-3); }
.add-form input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-faint);
}
.btn-add {
  background: var(--btn-add);
  color: var(--on-btn-add);
  border: none;
  padding: 0 22px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s ease, transform .1s ease;
}
.btn-add:hover { background: var(--btn-add-hover); }
.btn-add:active { transform: scale(.98); }

.empty-tip { text-align: center; color: var(--ink-3); padding: 30px 20px 14px; font-size: 14px; }

/* ---------- 日历 ---------- */
.calendar-card { padding-bottom: 18px; }
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 0;
}
.cal-header .card-title { padding: 0; }
.cal-nav {
  border: 1px solid transparent;
  background: none;
  font-size: 20px;
  color: var(--ink-2);
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  cursor: pointer;
  line-height: 1;
  transition: background .15s ease, color .15s ease;
}
.cal-nav:hover { background: var(--hover-bg); color: var(--ink); }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 12px 20px 6px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: .06em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 4px 20px 12px;
}
.cal-day {
  aspect-ratio: 1 / 1;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease, background .15s ease;
}
.cal-day:hover:not(.blank):not(.future) { border-color: var(--accent); }
.cal-day.blank { cursor: default; background: transparent; }
.cal-day.future { color: var(--ink-3); cursor: default; background: transparent; opacity: .55; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-num { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-frac {
  font-size: 10px;
  color: var(--accent-strong);
  margin-top: 1px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: var(--mask);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: modal-in .22s cubic-bezier(.22, .61, .36, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15px; font-weight: 700; }
.modal-close {
  border: none;
  background: none;
  font-size: 24px;
  color: var(--ink-3);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  border-radius: 6px;
}
.modal-close:hover { color: var(--ink); }
.modal-list { list-style: none; padding: 6px 0; max-height: 60vh; overflow-y: auto; }
.modal-item { display: flex; align-items: center; gap: 14px; padding: 13px 22px; }
.modal-item .habit-name { flex: 1; font-size: 15px; }
.modal-item.done .habit-name {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--line-strong);
}

/* ================= 笔记页 ================= */

/* 分区页签 */
.notes-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}
.notes-tab {
  border: none;
  background: none;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.notes-tab:hover { color: var(--ink); }
.notes-tab.active { background: var(--accent); color: var(--on-accent); }

/* 全部笔记：双栏 */
.notes-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 440px;
}
.note-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.note-side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.btn-new {
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease;
}
.btn-new:hover { background: var(--accent-strong); }
.note-list { list-style: none; padding: 8px; overflow-y: auto; max-height: 520px; }
.note-list-item {
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  margin-bottom: 2px;
}
.note-list-item:hover { background: var(--hover-bg); }
.note-list-item.active { background: var(--accent-soft); }
.note-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-list-item .note-item-title.empty { color: var(--ink-3); font-weight: 500; }
.note-item-meta { font-size: 11px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.note-list-empty { color: var(--ink-3); text-align: center; padding: 24px 12px; font-size: 13px; }

.note-main { display: flex; flex-direction: column; min-width: 0; }
.note-empty-hint {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  text-align: center;
  padding: 40px;
  font-size: 14px;
}

/* 编辑器 */
.note-editor { display: flex; flex-direction: column; height: 100%; padding: 18px 22px 20px; }
.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
}
.editor-title {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  font-family: inherit;
  padding: 2px 0;
}
.editor-title::placeholder { color: var(--ink-3); }
/* 阅读模式：标题像普通标题，正文不可编辑 */
.editor-title.viewing {
  font-size: 20px;
  font-weight: 700;
  cursor: default;
}
.rich-body.viewing {
  cursor: default;
  user-select: text;
}
.editor-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.editor-status { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.text-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
.text-btn:hover { background: var(--hover-bg); color: var(--ink); }
.text-btn.danger { color: var(--danger); }
.text-btn.danger:hover { background: rgba(201, 79, 79, .10); }

/* 富文本工具栏 */
.toolbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.tool-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: none;
  background: none;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tool-btn:hover { background: var(--hover-bg); color: var(--ink); }

/* 正文编辑区 */
.rich-body {
  flex: 1;
  min-height: 240px;
  padding: 12px 2px 8px;
  outline: none;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  overflow-y: auto;
  max-height: 60vh;
}
.rich-body:empty::before { content: attr(data-placeholder); color: var(--ink-3); pointer-events: none; }
.rich-body h2 { font-size: 20px; margin: 18px 0 8px; line-height: 1.4; }
.rich-body h3 { font-size: 17px; margin: 14px 0 6px; line-height: 1.4; }
.rich-body p { margin: 0 0 10px; }
.rich-body ul, .rich-body ol { margin: 0 0 10px; padding-left: 24px; }
.rich-body li { margin-bottom: 3px; }
.rich-body hr { border: none; border-top: 1px solid var(--line-strong); margin: 14px 0; }
.rich-body a { color: var(--accent-strong); }
/* 正文里的图片：自适应宽度、独立成块，避免撑破编辑框 */
.rich-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px auto;
  border-radius: 8px;
}

/* 日记 */
.diary-pane { }
.diary-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}
.day-nav {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.day-nav:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--surface-2); }
.diary-today-row {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  min-height: 24px;
}
.diary-card { padding: 0; }
.diary-body { min-height: 300px; }

/* ---------- 键盘焦点 ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, .rich-body:focus-visible { outline: none; }

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 620px) {
  body { padding: 22px 12px 48px; }
  .habit-item { padding: 14px 18px; }
  .add-form, .progress-card, .note-editor { padding-left: 18px; padding-right: 18px; }
  .cal-grid, .cal-weekdays, .card-title { padding-left: 18px; padding-right: 18px; }
  .notes-layout { grid-template-columns: 1fr; }
  .note-side { border-right: none; border-bottom: 1px solid var(--line); }
  .note-list { max-height: 180px; }
  .progress-text { font-size: 30px; }
}

/* 工具栏分隔线 */
.tool-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; align-self: center; flex-shrink: 0; }

/* ================= 粉色主题修饰 / 日记空状态 ================= */

/* 品牌：标志位与文字对齐 */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { display: none; color: var(--accent); flex-shrink: 0; }
/* 进度卡需要相对定位以容纳角标 */
.progress-card { position: relative; }

/* 日记：空状态卡片 */
.diary-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 52px 20px;
  text-align: center;
}
.diary-empty-icon { font-size: 30px; line-height: 1; color: var(--accent); }
.diary-empty-text { font-size: 16px; font-weight: 700; color: var(--ink); }
.diary-empty-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }

/* ============ 粉色主题专属修饰 ============ */
html[data-theme="cute"] .brand-mark { display: block; animation: cat-in .5s ease both; }
@keyframes cat-in { from { transform: scale(.6) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* 日期徽标前加一颗心 */
html[data-theme="cute"] .day-chip::before {
  content: "♥";
  margin-right: 6px;
  font-size: .85em;
}
/* 卡片小标题后加一颗空心爱心 */
html[data-theme="cute"] .card-title::after {
  content: " ♡";
  color: var(--accent);
  font-weight: 400;
  opacity: .75;
}
/* 空状态上方加爱心 */
html[data-theme="cute"] .empty-tip::before,
html[data-theme="cute"] .note-empty-hint p::before {
  content: "♡";
  display: block;
  font-size: 26px;
  color: var(--accent);
  opacity: .6;
  margin-bottom: 10px;
}
/* 进度卡右下角小爱心角标 */
html[data-theme="cute"] .progress-card::after {
  content: "♥";
  position: absolute;
  right: 18px;
  bottom: 14px;
  font-size: 14px;
  color: var(--accent);
  opacity: .45;
}
/* 日记空状态图标：粉色主题用爱心代替铅笔 */
html[data-theme="cute"] .diary-empty-icon {
  color: transparent;
}
html[data-theme="cute"] .diary-empty-icon::before {
  content: "♡";
  font-size: 34px;
  color: var(--accent);
}
/* 粉色主题：打勾后圆圈内保留 ✓，但完成行加一点腮红般的柔光 */
html[data-theme="cute"] .habit-item.done .check-btn {
  box-shadow: 0 3px 12px rgba(232, 135, 149, .45);
}

/* ================= 夜晚粉色主题 ================= */
html[data-theme="cute-dark"] {
  --bg: #22171a;
  --page-grad: linear-gradient(180deg, #261a1e 0%, #1e1417 100%);
  --surface: #2b1e22;
  --surface-2: #332428;
  --ink: #f3e9ea;
  --ink-2: #b79aa0;
  --ink-3: #7e5f66;
  --line: #3a292d;
  --line-strong: #4a3439;
  --accent: #e88795;
  --accent-strong: #f0a3ad;
  --accent-soft: rgba(232, 135, 149, .18);
  --accent-faint: rgba(232, 135, 149, .11);
  --on-accent: #2a1a1e;
  --btn-add: #e88795;
  --btn-add-hover: #f0a3ad;
  --on-btn-add: #2a1a1e;
  --hover-bg: #332428;
  --row-done: #24181b;
  --track-bg: #3a292d;
  --fill-grad: linear-gradient(90deg, #f0a3ad 0%, #e88795 100%);
  --card-grad: linear-gradient(180deg, #2f2125 0%, #2b1e22 100%);
  --mask: rgba(0, 0, 0, .62);
  --danger: #f2849a;
  --check-shadow: 0 3px 10px rgba(232, 135, 149, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 40px rgba(0, 0, 0, .55);
  --r-lg: 22px;
  --r-md: 15px;
  --r-sm: 11px;
}
html[data-theme="cute-dark"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(232, 135, 149, .08) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
}

/* ================= 粉色/夜晚粉色 通用修饰 ================= */
html[data-theme="cute-dark"] .brand-mark { display: block; }
html[data-theme="cute-dark"] .day-chip::before { content: "♥"; margin-right: 6px; font-size: .85em; }
html[data-theme="cute-dark"] .card-title::after { content: " ♡"; color: var(--accent); font-weight: 400; opacity: .75; }
html[data-theme="cute-dark"] .empty-tip::before,
html[data-theme="cute-dark"] .note-list-empty::before { content: "♡"; display: block; font-size: 26px; color: var(--accent); opacity: .6; margin-bottom: 10px; }
html[data-theme="cute-dark"] .progress-card::after { content: "♥"; position: absolute; right: 18px; bottom: 14px; font-size: 14px; color: var(--accent); opacity: .45; }
html[data-theme="cute-dark"] .diary-empty-icon { color: transparent; }
html[data-theme="cute-dark"] .diary-empty-icon::before { content: "♡"; font-size: 34px; color: var(--accent); }
html[data-theme="cute-dark"] .habit-item.done .check-btn { box-shadow: 0 3px 12px rgba(232, 135, 149, .45); }

/* 主题菜单稍宽以容纳更多选项 */
.theme-menu { min-width: 176px; }

/* 自动主题圆点：半色 */
.dot-auto { background: linear-gradient(90deg, #a67c52 0 50%, #c9a26b 50% 100%); }
.dot-auto-cute { background: linear-gradient(90deg, #e88795 0 50%, #b35a6c 50% 100%); }

/* ================= 全屏编辑弹窗（新建笔记 / 写日记） ================= */
.compose { display: flex; flex-direction: column; max-width: 620px; width: 100%; max-height: 82vh; }
.compose-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px 8px; border-bottom: 1px solid var(--line); }
.compose-title-area { flex: 1; min-width: 0; display: flex; align-items: center; }
.compose .editor-title { font-size: 20px; }
.compose .toolbar { border: none; border-bottom: 1px solid var(--line); padding: 8px 22px; }
.compose .rich-body { padding: 14px 22px; min-height: 240px; }
.compose-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px 16px;
  border-top: 1px solid var(--line);
}
.compose-foot .editor-status { margin-right: auto; }
.compose-foot .btn-add { border-radius: 999px; padding: 0 22px; height: 34px; }

/* ================= 全部笔记：仅列表卡片 ================= */
.notes-list-card { display: flex; flex-direction: column; }
.notes-list-card .note-list { max-height: 60vh; }

/* ================= 日记：空状态 / 已记录 ================= */
.diary-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 52px 20px; text-align: center; }
.diary-empty-icon { font-size: 30px; line-height: 1; color: var(--accent); }
.diary-empty-text { font-size: 16px; font-weight: 700; }
.diary-empty-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.diary-has {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 46px 20px;
  text-align: center;
}
.diary-has-icon { font-size: 30px; line-height: 1; color: var(--accent); }
.diary-has-text { font-size: 16px; font-weight: 700; }
.diary-has-meta { font-size: 13px; color: var(--ink-3); }
.diary-has-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
/* 日记阅读区：复用富文本样式，但去掉编辑器的尺寸限制 */
.diary-view.rich-body {
  flex: none;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding: 2px 0 0;
  text-align: left;
  overflow-wrap: anywhere;
}
.diary-view.rich-body img { margin-left: 0; margin-right: 0; }

/* 全部笔记：头部操作 + 按日期浏览 */
.note-side-actions { display: flex; align-items: center; gap: 8px; }
.notes-date-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.notes-date-bar .day-chip { padding: 6px 12px; font-size: 12px; cursor: default; }
.day-nav.sm { width: 28px; height: 28px; font-size: 15px; }
.text-btn.on { color: var(--accent-strong); background: var(--accent-soft); }
.note-list-empty { padding: 30px 12px; }


/* 夜晚粉色主题圆点颜色（与“自动·粉色”右半侧一致） */
.dot-cute-dark { background: #b35a6c; }


/* ================= 日期选择弹窗 ================= */
.picker { width: 100%; max-width: 330px; padding-bottom: 8px; }
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 4px;
}
.picker-head h3 { font-size: 15px; font-weight: 700; }
.picker .cal-weekdays { padding: 8px 16px 4px; }
.picker .cal-grid { padding: 2px 16px 8px; }
.picker .cal-day { font-size: 13px; }
.picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px 8px;
}

/* 可点击的日期徽标（笔记/日记） */
button.day-chip { cursor: pointer; transition: transform .1s ease, box-shadow .15s ease; }
button.day-chip:hover { box-shadow: 0 0 0 3px var(--accent-faint); }
button.day-chip:active { transform: scale(.96); }


/* 日期选择弹窗：当前选中日期 */
.cal-day.sel {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.cal-day.sel .cal-num { color: inherit; }


/* ================= 顶栏：日夜切换 + 菜单按钮 ================= */
.top-actions { display: flex; align-items: center; gap: 8px; }
.mode-btn, .menu-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.mode-btn:hover, .menu-btn:hover { border-color: var(--accent); color: var(--ink); background: var(--surface-2); }

/* ================= 设置侧边栏（左侧抽屉） ================= */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: var(--mask);
  z-index: 60;
}
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: min(300px, 85vw);
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  z-index: 61;
  display: flex;
  flex-direction: column;
  transform: translateX(-102%);
  transition: transform .26s cubic-bezier(.22, .61, .36, 1);
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 17px; font-weight: 700; }
.drawer-close {
  border: none;
  background: none;
  font-size: 24px;
  color: var(--ink-3);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  border-radius: 6px;
}
.drawer-close:hover { color: var(--ink); }
.drawer-body { padding: 6px 20px 24px; overflow-y: auto; }
.set-title {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: .1em;
  margin: 18px 0 6px;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.set-label { font-size: 14px; font-weight: 500; }
.set-hint { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin-top: 12px; }

/* 分段选择（日间/夜间主题） */
.seg {
  display: inline-flex;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.seg button {
  border: none;
  background: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--accent); color: var(--on-accent); }

/* 跟随系统开关 */
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border: none;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background .2s ease;
  flex-shrink: 0;
}
.switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: left .2s ease;
}
.switch.on { background: var(--accent); }
.switch.on .knob { left: 23px; }


/* ================= 顶栏：按钮靠左 + 可自定义标题 ================= */
.topbar { display: flex; align-items: center; gap: 8px; }
.top-actions { gap: 6px; }
.brand {
  margin-left: 4px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 名称输入框 */
.set-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-2);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.set-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-faint);
  background: var(--surface);
}


/* 按钮式日期徽标：去掉浏览器默认边框/外观，跟随主题更干净 */
button.day-chip {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  font-family: inherit;
}
button.day-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* 粉色主题：日记空状态爱心居中对齐（隐藏原铅笔字符占位） */
html[data-theme="cute"] .diary-empty-icon,
html[data-theme="cute-dark"] .diary-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0;
  line-height: 1;
}
html[data-theme="cute"] .diary-empty-icon::before,
html[data-theme="cute-dark"] .diary-empty-icon::before {
  content: "♡";
  display: inline-block;
  font-size: 34px;
  line-height: 1;
  color: var(--accent);
}


/* ================= 富文本工具栏：分组、按钮与下拉 ================= */
.tool-btn {
  min-width: 36px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
}
.tool-btn.tb-bold { font-weight: 800; }
.tool-btn.tb-italic { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.tool-btn.tb-underline { text-decoration: underline; text-underline-offset: 2px; }
.tool-select {
  height: 30px;
  min-width: 68px;
  max-width: 108px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.tool-select:hover { color: var(--ink); }
.tool-select:focus { border-color: var(--accent); }

/* “更多格式”菜单：低频格式收起来，工具栏更简洁 */
.tool-more { position: relative; display: inline-flex; }
.tool-btn.tb-more { font-size: 17px; font-weight: 700; padding-bottom: 6px; }
.tool-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 140px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tool-more-item {
  border: none;
  background: none;
  text-align: left;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.tool-more-item:hover { background: var(--hover-bg); }

/* execCommand fontSize 生成的 <font size> 大小映射 */
.rich-body font[size="1"] { font-size: 12px; }
.rich-body font[size="2"] { font-size: 14px; }
.rich-body font[size="3"] { font-size: 16px; }
.rich-body font[size="4"] { font-size: 18px; }
.rich-body font[size="5"] { font-size: 20px; }
.rich-body font[size="6"] { font-size: 24px; }
.rich-body font[size="7"] { font-size: 26px; }


/* ================= 移动端防聚焦放大 ================= */
/* iOS 在聚焦字号 <16px 的输入框/编辑区时会自动放大页面；
   把手机端的正文与输入字号提到 16px，即可避免（仍保留手动缩放） */
@media (max-width: 900px) {
  .rich-body { font-size: 16px; line-height: 1.8; }
  .add-form input { font-size: 16px; }
  .set-input { font-size: 16px; }
  .editor-title { font-size: 18px; }

  /* 编辑弹窗：手机端做成贴底小方框，给键盘留出空间 */
  #composeModal { align-items: flex-end; padding: 0; }
  #composeModal .compose {
    width: 100%;
    max-width: none;
    max-height: calc(100vh - var(--kb, 0px) - 8px);
    max-height: calc(100dvh - var(--kb, 0px) - 8px);
    margin-bottom: var(--kb, 0px);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  /* 工具栏移到正文下方：键盘弹出时正好贴在输入法上方 */
  #composeModal .compose .rich-body { order: 2; }
  #composeModal .compose .toolbar { order: 3; display: none; border-top: 1px solid var(--line); border-bottom: none; padding: 8px 12px; }
  #composeModal .compose .compose-foot { order: 4; }
  #composeModal.kb-open .compose .toolbar { display: flex; }
  /* 手机端“更多”菜单：贴着键盘上方的小浮层 */
  #composeModal .tool-more-menu {
    position: fixed;
    left: auto;
    right: 12px;
    width: 148px;
    top: auto;
    bottom: calc(var(--kb, 0px) + 8px);
    max-height: 40vh;
    overflow-y: auto;
    padding: 4px;
  }
}


/* ================= 深色模式手机白边修复 ================= */
/* 手机上下拉动时露出的最外层背景跟随主题，避免深色下露白边 */
html { background-color: var(--bg); }
body { background-color: var(--bg); }


/* ================= 主题切换边缘颜色修复 ================= */
/* 背景统一放到最外层 html（fixed），body 透出，避免上下露不同色 */
html {
  background-color: var(--bg);
  background-image: var(--page-grad);
  background-attachment: fixed;
}
body {
  background: none;
}
/* 刘海屏 / 底部手势条安全区 */
body {
  padding-top: calc(30px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 620px) {
  body {
    padding-top: calc(22px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  }
}


/* ================= 移动端缩放锁定 ================= */
/* 关闭双指缩放与双击缩放（iPhone 浏览器 / 添加到桌面后的独立窗口） */
html, body {
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 工具栏按钮：激活（当前文字处于该样式）高亮 */
.tool-btn.active {
  background: var(--accent);
  color: var(--on-accent);
}


/* 导航按钮（替代链接，避免外跳浏览器） */
button.nav-item { border: none; font-family: inherit; cursor: pointer; }


/* 删除确认小弹窗 */
.confirm-modal { max-width: 360px; padding: 24px 22px 18px; text-align: center; }
.confirm-text { font-size: 15px; line-height: 1.7; color: var(--ink); margin-bottom: 20px; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; }
.confirm-actions .text-btn { padding: 8px 18px; border-radius: 999px; font-size: 14px; }
.btn-danger {
  border: none;
  background: var(--danger);
  color: #fff;
  padding: 8px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: filter .15s ease;
}
.btn-danger:hover { filter: brightness(1.08); }


/* 删除确认框置顶：避免被编辑小方框等遮住 */
#confirmModal { z-index: 90; }


/* 设置：更新区样式 */
.set-value { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.set-row.column { flex-direction: column; align-items: flex-start; gap: 8px; }
.set-row.column .btn-new { align-self: flex-start; }
#updateStatus { word-break: break-word; }

/* =====================================================
   视觉升级：纸上刻度
   方向：安静的每日仪式。日期与数字用衬线，进度条做成刻度尺。
   仅调整外观，不改动结构与功能。
   ===================================================== */

/* ---------- 令牌精修：极简（默认） ---------- */
:root {
  --bg: #f4f4f6;
  --page-grad: radial-gradient(1100px 560px at 50% -12%, #fbfbfc 0%, #f4f4f6 58%, #efeff2 100%);
  --surface: #ffffff;
  --surface-2: #f8f8fa;
  --ink: #17171a;
  --ink-2: #5f5f68;
  --ink-3: #6f6f78;
  --line: #e6e6ea;
  --line-strong: #d4d4db;
  --accent: #a1733d;
  --accent-strong: #7d5628;
  --accent-soft: rgba(161, 115, 61, .12);
  --accent-faint: rgba(161, 115, 61, .07);
  --hover-bg: #f0f0f3;
  --row-done: #f5f5f6;
  --track-bg: #eaeaee;
  --fill-grad: linear-gradient(90deg, #bb8f5c 0%, #a1733d 100%);
  --card-grad: linear-gradient(180deg, #ffffff 0%, #fdfdfe 100%);
  --shadow-sm: 0 1px 2px rgba(18, 18, 22, .04), 0 8px 20px rgba(18, 18, 22, .045);
  --shadow-md: 0 2px 4px rgba(18, 18, 22, .05), 0 18px 40px rgba(18, 18, 22, .12);
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --focus-ring: 0 0 0 3px var(--accent-soft);
  --danger: #c04a4a;
}

/* ---------- 令牌精修：粉色 / 暗黑 / 夜晚粉色 ---------- */
html[data-theme="cute"] {
  --bg: #fbf3f4;
  --page-grad: radial-gradient(1000px 520px at 50% -10%, #fff9f9 0%, #fbf3f4 60%, #f8ecef 100%);
  --surface-2: #fff7f7;
  --ink: #43303a;
  --ink-2: #7f666f;
  --ink-3: #8f757e;
  --line: #f0dfe3;
  --line-strong: #e3cbd2;
  --accent: #dd7f92;
  --accent-strong: #b3566d;
  --accent-soft: rgba(221, 127, 146, .14);
  --accent-faint: rgba(221, 127, 146, .08);
  --btn-add: #b3566d;
  --btn-add-hover: #9d4a60;
  --danger: #c04a60;
  --fill-grad: linear-gradient(90deg, #eda3b1 0%, #dd7f92 100%);
  --shadow-sm: 0 1px 2px rgba(176, 92, 110, .06), 0 8px 20px rgba(176, 92, 110, .07);
  --shadow-md: 0 2px 4px rgba(176, 92, 110, .08), 0 18px 38px rgba(176, 92, 110, .13);
  --r-lg: 18px;
  --r-md: 13px;
  --r-sm: 9px;
}
html[data-theme="dark"] {
  --bg: #151518;
  --page-grad: radial-gradient(1000px 520px at 50% -10%, #1c1c21 0%, #161619 58%, #121215 100%);
  --surface: #1e1e22;
  --surface-2: #242429;
  --ink: #ececef;
  --ink-2: #a0a0a8;
  --ink-3: #74747c;
  --line: #2c2c33;
  --line-strong: #3a3a43;
  --accent: #c8a066;
  --accent-strong: #dcb684;
  --accent-soft: rgba(200, 160, 102, .16);
  --accent-faint: rgba(200, 160, 102, .09);
  --track-bg: #2a2a30;
  --row-done: #1b1b1f;
  --card-grad: linear-gradient(180deg, #222227 0%, #1e1e22 100%);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, .02), 0 10px 24px rgba(0, 0, 0, .3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .4), 0 22px 48px rgba(0, 0, 0, .5);
  --focus-ring: 0 0 0 3px rgba(200, 160, 102, .22);
}
html[data-theme="cute-dark"] {
  --bg: #1d1417;
  --page-grad: radial-gradient(900px 480px at 50% -10%, #292025 0%, #1e1518 58%, #191114 100%);
  --surface: #251b1f;
  --surface-2: #2d2126;
  --ink: #f2e8ea;
  --ink-2: #b2959d;
  --ink-3: #9a7b83;
  --line: #37262b;
  --line-strong: #49343a;
  --accent: #e392a3;
  --accent-strong: #f0aeb9;
  --accent-soft: rgba(227, 146, 163, .18);
  --accent-faint: rgba(227, 146, 163, .1);
  --track-bg: #38272c;
  --row-done: #201619;
  --card-grad: linear-gradient(180deg, #2a1f23 0%, #251b1f 100%);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, .02), 0 10px 24px rgba(0, 0, 0, .32);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .42), 0 22px 48px rgba(0, 0, 0, .52);
  --r-lg: 18px;
  --r-md: 13px;
  --r-sm: 9px;
  --focus-ring: 0 0 0 3px rgba(227, 146, 163, .24);
}

/* ---------- 排版：日期与数字有性格 ---------- */
.day-chip,
.progress-text,
.editor-title,
#calTitle {
  font-family: var(--font-display);
}
.progress-text { font-size: 36px; font-weight: 700; letter-spacing: .01em; }
.progress-label,
.set-title,
.eyebrow { letter-spacing: .14em; }
.day-chip {
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  letter-spacing: .02em;
}

/* ---------- 签名元素：进度刻度尺 ---------- */
.progress-track {
  height: 8px;
  background-color: var(--track-bg);
  background-image:
    linear-gradient(var(--line-strong), var(--line-strong)),
    linear-gradient(var(--line-strong), var(--line-strong)),
    linear-gradient(var(--line-strong), var(--line-strong));
  background-size: 1px 42%;
  background-position: 25% 50%, 50% 50%, 75% 50%;
  background-repeat: no-repeat;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .02);
}
.progress-fill { box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 34%, transparent); }

/* ---------- 容器与导航 ---------- */
.card {
  background: var(--card-grad);
  border-color: var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.main-nav {
  border-radius: 12px;
  padding: 3px;
  box-shadow: var(--shadow-sm);
}
.nav-item {
  border-radius: 9px;
  letter-spacing: .02em;
}
.nav-item.active { box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }

/* ---------- 习惯列表 ---------- */
.habit-item { gap: 14px; padding: 14px 22px; }
.habit-name { letter-spacing: .005em; }
.habit-stats { letter-spacing: .02em; }
.check-btn {
  width: 30px;
  height: 30px;
  transition: transform .16s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.check-btn:hover { transform: scale(1.05); }
.habit-item.done .habit-name { text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- 日历 ---------- */
.cal-day { border-radius: 9px; transition: background .16s ease; }
.cal-day:not(.blank):hover { background: var(--hover-bg); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ---------- 笔记与编辑器 ---------- */
.note-list-item { border-radius: 10px; padding: 11px 12px; }
.note-item-title { letter-spacing: .01em; }
.note-item-meta { letter-spacing: .03em; }
.editor-title { letter-spacing: .015em; }
.compose .rich-body { font-size: 15.5px; line-height: 1.85; }

/* ---------- 设置抽屉 ---------- */
.drawer { box-shadow: var(--shadow-md); }
.set-row { padding: 12px 0; }

/* ---------- 通用细节 ---------- */
.btn-add,
.btn-new,
.text-btn { letter-spacing: .02em; }
.btn-add,
.btn-new { transition: background .18s ease, transform .12s ease, box-shadow .18s ease; }
.btn-add:active,
.btn-new:active { transform: translateY(1px); }
.empty-tip,
.note-list-empty { letter-spacing: .02em; }
:where(button, input, select, [contenteditable="true"]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
