/* ============================================================
   流光小筑 · 网页版  —— 浅色毛玻璃设计系统（通透优先）
   设计 token 取自 glass-personal-space 技能，默认浅绿+浅蓝。
   ============================================================ */

:root {
  --glass-alpha: 0.5;
  --glass-rgb: 255, 255, 255;
  --glass-bg: rgba(var(--glass-rgb), var(--glass-alpha));
  --glass-bg-soft: rgba(var(--glass-rgb), calc(var(--glass-alpha) + 0.05));
  --glass-border: rgba(var(--glass-rgb), calc(var(--glass-alpha) + 0.15));
  --glass-stroke: rgba(var(--glass-rgb), calc(var(--glass-alpha) + 0.12));

  --text-l: 0%;
  --text-strong: color-mix(in srgb, #000000, white var(--text-l));
  --text: color-mix(in srgb, #0D0F12, white var(--text-l));
  --text-muted: color-mix(in srgb, #565C68, white var(--text-l));

  --accent: #7B8CFF;
  --accent2: #FF9AA8;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-deep: color-mix(in srgb, var(--accent) 70%, #1a2030);

  --bg-grad: linear-gradient(135deg, #E3F7ED 0%, #E8F7FF 50%, #EAFBF0 100%);
  --blob-pink: rgba(200, 245, 225, 0.70);
  --blob-blue: rgba(200, 235, 255, 0.72);
  --blob-green: rgba(178, 243, 208, 0.72);
  --blob-peach: rgba(222, 245, 210, 0.62);

  --radius-card: 24px;
  --radius-panel: 24px;
  --blur: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .10), inset 0 1px 2px rgba(255, 255, 255, .25);
  --veil-alpha: 0.42;
  --veil-rgb: 255, 255, 255;

  --sidebar-w: 248px;
  --bottom-h: 68px;
  --maxw: 1180px;
}

/* 深色模式：表面/蒙罩/背景由 applyPrefs 按 dark 注入暗色变量；此处只覆盖文字与强调色，
   使浅色文字基色 + textL 滑块在暗底仍生效（textL 此时向黑掺浅，调深文字）。 */
body.dark {
  --text-strong: color-mix(in srgb, #F2F5FA, black var(--text-l));
  --text: color-mix(in srgb, #D7DCE6, black var(--text-l));
  --text-muted: color-mix(in srgb, #929BAC, black var(--text-l));
  --accent-soft: color-mix(in srgb, var(--accent) 24%, transparent);
  --accent-deep: color-mix(in srgb, var(--accent) 55%, #FFFFFF);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 1px 2px rgba(255, 255, 255, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scrollbar-gutter: stable; }  /* 预留滚动条空间，切视图高度变化时视口宽度不再跳变，避免背景光斑被缩放 */
body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Inter, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh; min-height: 100dvh;
  transition: background .5s ease, color .3s ease;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(var(--glass-rgb), .35); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--glass-rgb), .55); }

/* —— 背景光斑 / 壁纸 / 蒙罩 —— */
.bg-layer { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: -2; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .9; }
.blob.b1 { width: 46vw; height: 46vw; left: -8vw; top: -10vw; background: var(--blob-pink); }
.blob.b2 { width: 40vw; height: 40vw; right: -6vw; top: 8vh; background: var(--blob-blue); }
.blob.b3 { width: 38vw; height: 38vw; left: 18vw; bottom: -14vw; background: var(--blob-green); }
.blob.b4 { width: 30vw; height: 30vw; right: 12vw; bottom: -8vw; background: var(--blob-peach); }
.bg-photo { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: -2; background-size: cover; background-position: center; }
.bg-veil { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: -1; background: rgba(var(--veil-rgb), var(--veil-alpha)); }
body:not(.bg-image) .bg-veil { display: none; }
body.bg-image .bg-layer { display: none; }

/* ============================================================
   玻璃配方
   ============================================================ */
.glass {
  border-radius: var(--radius-card);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.panel { border-radius: var(--radius-panel); padding: 22px; }
.card { border-radius: var(--radius-card); padding: 20px; display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(0, 0, 0, .14), inset 0 1px 2px rgba(255, 255, 255, .3); }

/* 首页 Hero：个性化问候（玻璃系统招牌元素） */
.hero { margin-bottom: 22px; }
.hero-greet { font-size: 30px; font-weight: 900; color: var(--text-strong); letter-spacing: .5px; text-shadow: 0 1px 10px rgba(var(--veil-rgb), .35); }
.hero-wave { font-size: 28px; display: inline-block; }
.hero-sub { color: var(--text); margin-top: 4px; font-size: 14px; font-weight: 500; text-shadow: 0 1px 1px rgba(var(--veil-rgb), .9), 0 1px 8px rgba(var(--veil-rgb), .5); }
.hero-chips { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-size: 17px; font-weight: 800; color: var(--text-strong); letter-spacing: .3px; }
.card-ico { font-size: 20px; }

/* ============================================================
   布局：侧栏（PC） + 主区 + 底栏（手机）
   ============================================================ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none;
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
  padding: 22px 16px; display: flex; flex-direction: column; gap: 8px;
  border-right: 1px solid var(--glass-stroke);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 16px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  font-size: 22px; background: var(--accent-soft); border: 1px solid var(--glass-border);
}
.brand-name { font-weight: 900; font-size: 18px; color: var(--text-strong); }
.brand-sub { font-size: 12px; color: var(--text-muted); }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px;
  cursor: pointer; color: var(--text); font-weight: 600; font-size: 15px;
  border: 1px solid transparent; transition: background .18s, color .18s;
}
.nav-item:hover { background: var(--glass-bg-soft); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--glass-border); }
.nav-item .ni-ico { font-size: 19px; width: 24px; text-align: center; }
.nav-spacer { flex: 1; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px;
  cursor: pointer; border: 1px solid var(--glass-stroke); background: var(--glass-bg-soft);
}
.user-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.user-meta { overflow: hidden; }
.user-name { font-weight: 700; font-size: 14px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub { font-size: 11px; color: var(--text-muted); }

.main { flex: 1; min-width: 0; padding: 26px 30px 40px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 900; color: var(--text-strong); margin: 0; letter-spacing: .5px; }
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke); font-size: 13px; font-weight: 600;
}
.view { display: none; animation: fade .25s ease; overflow-x: clip; overflow-clip-margin: 12px; max-width: 100%; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom-h);
  z-index: 30; padding: 6px 8px; justify-content: space-around; align-items: center;
  border-top: 1px solid var(--glass-stroke); overflow-x: auto;
}
.nav-item.bottom { flex-direction: column; gap: 2px; padding: 4px 8px; font-size: 11px; border-radius: 12px; }
.nav-item.bottom .ni-ico { font-size: 20px; }

/* ============================================================
   网格 / 列表 / 标签等通用原语
   ============================================================ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 8px;
  border-bottom: 1px solid var(--glass-stroke); border-radius: 10px;
  transition: background .18s ease, padding .18s ease;
}
.list-row:last-child { border-bottom: none; }
.dyn-newest {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding-left: 11px;
}
.dyn-newest .list-title { color: var(--accent-deep); }
.dyn-newest:hover { padding-left: 11px; }
.list-row:hover { background: rgba(var(--glass-rgb), calc(var(--glass-alpha) + 0.06)); padding-left: 14px; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; color: var(--text); word-break: break-word; }
.list-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.list-tail { color: var(--text-muted); font-size: 13px; flex: none; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.fchip {
  padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke); color: var(--text);
  transition: all .16s ease;
}
.fchip:hover { background: rgba(var(--glass-rgb), calc(var(--glass-alpha) + 0.08)); }
.fchip.active { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tag.green { background: color-mix(in srgb, #3FCBA0 18%, transparent); color: #1f9c78; }
.tag.amber { background: color-mix(in srgb, #FF9A5A 18%, transparent); color: #c96a2e; }
.tag.coral { background: color-mix(in srgb, #FF8FB1 18%, transparent); color: #c95a7e; }
.tag.blue  { background: var(--accent-soft); color: var(--accent-deep); }

.empty-hint { color: var(--text-muted); text-align: center; padding: 32px 12px; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-hint::before { content: "🌱"; font-size: 30px; line-height: 1; opacity: .5; }
@media (prefers-reduced-motion: no-preference) {
  .empty-hint::before { animation: empty-float 3s ease-in-out infinite; }
}
@keyframes empty-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.section-title { font-size: 18px; font-weight: 800; color: var(--text-strong); }

/* 习惯页 Tab（打卡 / 回顾） */
.habit-tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 20px 0 4px; border-radius: 14px;
  background: rgba(var(--glass-rgb), calc(var(--glass-alpha) * 0.5)); border: 1px solid var(--glass-border); backdrop-filter: blur(var(--blur)); }
.habit-tab { padding: 7px 18px; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--text-muted); transition: all .16s ease; }
.habit-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 4px 12px var(--accent-soft); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; cursor: pointer;
  border: 1px solid var(--glass-stroke); background: var(--glass-bg-soft); color: var(--text);
  transition: all .16s ease;
}
.btn:hover { background: rgba(var(--glass-rgb), calc(var(--glass-alpha) + 0.08)); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: #e3556b; border-color: color-mix(in srgb, #e3556b 40%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, #e3556b 12%, transparent); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.add-btn {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  font-size: 20px; font-weight: 700; cursor: pointer; background: var(--accent-soft); color: var(--accent-deep);
  border: 1px solid var(--glass-border);
}
.add-btn:hover { background: var(--accent); color: #fff; }

/* 输入 */
.input, .textarea, .select {
  width: 100%; padding: 11px 14px; border-radius: 12px; font-size: 14px;
  border: 1px solid var(--glass-stroke); background: var(--glass-bg-soft); color: var(--text);
  outline: none; transition: border .16s, box-shadow .16s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

/* ============================================================
   首页卡片
   ============================================================ */
.home-grid { position: relative; }
.home-card { position: relative; margin: 0; }
.home-card.dragging { opacity: .5; }
.home-card.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.home-card.drop-after { box-shadow: 0 3px 0 var(--accent); }
.grip { cursor: grab; color: var(--text-muted); font-size: 16px; padding: 2px 6px; }
.grip:active { cursor: grabbing; }
.bar { height: 8px; border-radius: 999px; background: rgba(var(--glass-rgb), .25); overflow: hidden; }
.bar > view, .bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s ease; }
.mood-card { text-align: center; padding: 14px 0 4px; cursor: pointer; }
.mood-emoji { font-size: 46px; }
.mood-text { margin-top: 6px; color: var(--text); font-weight: 600; }
.mood-edit-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.todo-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--glass-stroke); }
.todo-row:last-child { border-bottom: none; }
.todo-check {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--accent); flex: none;
  display: grid; place-items: center; color: #fff; font-size: 13px; cursor: pointer; transition: all .15s;
}
.todo-check.done { background: var(--accent); }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.todo-dot.high { background: #e3556b; } .todo-dot.medium { background: #FF9A5A; } .todo-dot.low { background: #3FCBA0; }
.todo-row.overdue .list-title { color: #e3556b; }
.add-row { margin-top: 12px; text-align: center; color: var(--accent-deep); font-weight: 600; cursor: pointer; font-size: 14px; }

/* ============================================================
   日程 / 日历
   ============================================================ */
.schedule-wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-title { font-weight: 800; font-size: 17px; color: var(--text-strong); flex: 1; }
.cal-nav, .cal-today {
  padding: 6px 12px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke);
}
.cal-nav:hover, .cal-today:hover { background: var(--accent-soft); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1 / 1; border-radius: 12px; position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; padding: 2px;
  cursor: pointer; font-size: 14px; font-weight: 600; border: 1px solid transparent; color: var(--text);
}
.cal-d { line-height: 1; }
.cal-cell.head { cursor: default; color: var(--text-muted); font-size: 12px; font-weight: 700; aspect-ratio: auto; padding: 4px 0; }
.cal-cell.empty { cursor: default; }
.cal-cell:not(.head):not(.empty):hover { background: var(--glass-bg-soft); }
.cal-cell.today { color: var(--accent-deep); font-weight: 800; }
.cal-cell.sel { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; }
.cal-cell.has::after {
  content: ""; position: absolute; bottom: 7px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6;
}
.cal-cell.sel.has::after { background: #fff; }
.sel-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 6px; flex-wrap: wrap; }
.sel-date { font-weight: 800; color: var(--text-strong); }
.sel-tools { display: flex; gap: 8px; }
.sch-scope { padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 13px;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke); }
.sch-scope.on { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
.sch-review { padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: var(--accent-deep); }

/* 回顾 */
.rev-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.rev-tab { flex: 1; text-align: center; padding: 9px; border-radius: 12px; cursor: pointer; font-weight: 700;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke); }
.rev-tab.on { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
.rev-scopes { display: flex; gap: 8px; margin-bottom: 16px; }
.rev-scope { flex: 1; text-align: center; padding: 9px; border-radius: 12px; cursor: pointer; font-weight: 700;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke); }
.rev-scope.on { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
.rev-range { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.rev-rate { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.rev-rate-bar { flex: 1; height: 12px; border-radius: 999px; background: rgba(var(--glass-rgb), .25); overflow: hidden; }
.rev-rate-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.rev-rate-num { font-weight: 800; color: var(--text-strong); }
.rev-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rev-cell { text-align: center; padding: 12px 6px; border-radius: 14px; background: var(--glass-bg-soft); }
.rev-num { font-size: 22px; font-weight: 900; color: var(--text-strong); }
.rev-num.done { color: #3FCBA0; } .rev-num.over { color: #e3556b; }
.rev-lab { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.rev-tip { margin-top: 14px; font-size: 13px; color: var(--text-muted); text-align: center; line-height: 1.6; }

/* ============================================================
   收藏 / 笔记 / 习惯
   ============================================================ */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile {
  position: relative; aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 12px;
  border: 1px solid var(--glass-stroke); color: #fff;
}
.tile .tile-type { position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,.35); padding: 2px 8px; border-radius: 999px; }
.tile .tile-label { font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.5); word-break: break-word; }
.notes { columns: 3 200px; column-gap: 14px; }
.note { break-inside: avoid; margin-bottom: 14px; padding: 14px 16px; border-radius: var(--radius-card);
  background: var(--glass-bg); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border); cursor: pointer; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.note:hover { border-color: var(--accent); }
.habit-card { padding: 18px; border-radius: var(--radius-card); margin-bottom: 14px; }
.habit-head { display: flex; align-items: center; gap: 12px; }
.habit-icon { font-size: 26px; }
.habit-name { font-weight: 800; color: var(--text-strong); flex: 1; }
.habit-streak { font-size: 13px; color: var(--text-muted); font-weight: 700; }
.habit-week { display: flex; gap: 8px; margin-top: 14px; }
.habit-day { flex: 1; text-align: center; }
.habit-dot { height: 30px; border-radius: 9px; background: rgba(var(--glass-rgb), .25); border: 1px solid var(--glass-stroke); }
.habit-dot.checked { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.habit-dot.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.habit-day-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.habit-day-label.now { color: var(--accent-deep); font-weight: 800; }
.habit-checkin { margin-top: 14px; text-align: center; padding: 10px; border-radius: 12px; font-weight: 800; cursor: pointer;
  background: var(--accent-soft); color: var(--accent-deep); border: 1px solid var(--glass-border); }
.habit-checkin.done { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; }
/* 周视图：圆点可点（未来日期除外） */
.habit-day { cursor: pointer; }
.habit-day.future { cursor: default; opacity: .4; }
.habit-day:not(.future):hover .habit-dot { outline: 2px solid var(--accent); outline-offset: 1px; }
/* 补卡（视觉区分：虚线描边），仍是 truthy，统计不区分 */
.habit-dot.mk { background: var(--accent-soft); border: 2px dashed var(--accent); }
/* 顶部右侧操作区：视图切换 + 月份导航 + 添加 */
.sh-right { display: flex; align-items: center; gap: 8px; }
/* 居中的玻璃导航条（周/月视图共用）—— 收敛圆角与阴影，贴近卡片观感 */
.m-nav { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 2px; padding: 3px 6px;
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 14px;
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: 0 1px 8px rgba(0,0,0,.05), inset 0 1px 0 rgba(var(--glass-rgb), .3); }
.m-nav button { width: 30px; height: 30px; border: none; border-radius: 9px; background: transparent;
  color: var(--text); font-weight: 800; font-size: 16px; line-height: 1; cursor: pointer;
  transition: background .15s ease, transform .12s ease, color .15s ease; }
.m-nav button:hover { background: var(--accent-soft); color: var(--accent-deep); }
.m-nav button:active { transform: scale(.92); }
.m-nav .m-cap { font-size: 13px; font-weight: 700; color: var(--text-muted); min-width: 64px; text-align: center; letter-spacing: .5px; }
.m-nav button.disabled { opacity: .28; pointer-events: none; }
/* 周/月视图导航条：撑满卡片宽度，与下方卡片左右对齐（‹ 贴左、› 贴右、标题居中） */
.w-nav { display: block; margin: 4px 0 10px; }
/* 打卡 + 补卡 并排，补卡刻意弱化 */
.habit-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.habit-actions .habit-checkin { flex: 1; margin-top: 0; }
.habit-makeup { flex: none; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--glass-border);
  background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s; }
.habit-makeup:hover { background: var(--glass-bg-soft); color: var(--accent-deep); }
/* 月视图网格 */
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.mcell { aspect-ratio: .84; display: flex; align-items: center; justify-content: center; border-radius: 7px; font-size: 11px;
  background: rgba(var(--glass-rgb), .2); border: 1px solid var(--glass-stroke); color: var(--text-muted); }
.mcell.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; }
.mcell.mk { background: var(--accent-soft); color: var(--accent-deep); border: 2px dashed var(--accent); }
.mcell.future { opacity: .4; }
.mcell.blank { background: transparent; border-color: transparent; }
.mcell:not(.future):not(.blank) { cursor: pointer; }
.mcell:not(.future):not(.blank):hover { outline: 2px solid var(--accent); outline-offset: 1px; }
/* 月视图星期表头：列数与 .mgrid 完全一致（手机 7 列 / 桌面 14 列），故列起点对齐 */
.mhead { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 4px; }
.mhead .mh { text-align: center; font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: .5px; }
/* 手机端仅显示首周 7 个标签，第 8 个起（第二周）隐藏 */
.mhead .mh:nth-child(n+8) { display: none; }
/* 电脑网页版：月视图每行显示 14 天（两周年一行），网格更矮更紧凑；手机端维持 7 天/行 */
@media (min-width: 901px) {
  .mgrid { grid-template-columns: repeat(14, 1fr); gap: 4px; }
  .mhead { grid-template-columns: repeat(14, 1fr); }
  .mhead .mh:nth-child(n+8) { display: block; }
}

/* 日记 */
.diary-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.diary-card { padding: 18px; border-radius: var(--radius-card); cursor: pointer; }
.diary-top { display: flex; align-items: center; justify-content: space-between; }
.diary-date { font-weight: 800; color: var(--text-strong); }
.diary-top-right { display: flex; gap: 8px; font-size: 15px; }
.diary-title { font-weight: 800; font-size: 16px; margin-top: 8px; color: var(--text-strong); }
.diary-text { margin-top: 8px; color: var(--text); line-height: 1.7; max-height: 5.1em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.diary-text.locked { color: var(--text-muted); font-style: italic; }
.diary-foot { margin-top: 10px; font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; }
.diary-locked-badge { display: inline-block; font-size: 11px; background: var(--accent-soft); color: var(--accent-deep);
  padding: 1px 8px; border-radius: 999px; margin-left: 6px; }

/* ============================================================
   设置
   ============================================================ */
.set-panel { padding: 8px 22px; }
.set-section { padding: 18px 0; border-bottom: 1px solid var(--glass-stroke); }
.set-section:last-child { border-bottom: none; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.set-label { font-weight: 700; color: var(--text-strong); margin-bottom: 10px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch.active { border-color: var(--text-strong); box-shadow: 0 0 0 2px var(--glass-bg); }
.slider-row { margin: 14px 0; }
.slider-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.seg { display: inline-flex; background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: none; background: transparent; padding: 7px 16px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--text); }
.seg button.active { background: var(--accent); color: #fff; }
.toggle { width: 50px; height: 28px; border-radius: 999px; background: rgba(var(--glass-rgb), .3); position: relative; cursor: pointer; transition: background .2s; border: 1px solid var(--glass-stroke); }
.toggle.on { background: var(--accent); }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle.on::after { left: 26px; }

/* ============================================================
   弹窗 / Toast / 登录
   ============================================================ */
.modal-mask { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; z-index: 350; background: rgba(20, 26, 36, .38); backdrop-filter: blur(4px);
  display: flex; flex-direction: column; padding: 20px; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain; overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* 手机端软键盘：键盘位置完全交给浏览器处理——
   index.html 的 viewport 加了 interactive-widget=resizes-content，支持该标准的浏览器会在
   键盘弹出时缩小布局视口，本弹窗(height:100dvh)自动落到键盘上方；旧版覆盖式浏览器则靠
   ui.js 在键盘开/关时把焦点框 scrollIntoView。弹窗盒子本身【不随聚焦位移】，避免点击错位。
   桌面端保持居中、移动端可整卡滚动，通用且稳定。 */
.modal-card { width: min(520px, 100%); margin: auto; max-height: none; overflow: visible;
  border-radius: var(--radius-card); padding: 24px; }
.modal-title { font-size: 19px; font-weight: 900; color: var(--text-strong); margin-bottom: 16px; }
/* 全局搜索：弹窗背后内容稍隐去（比默认遮罩更暗更糊） */
.modal-mask.search-mask { background: rgba(20, 26, 36, .55); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.topbar-search { flex: none; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--glass-border);
  background: var(--glass-bg-soft); color: var(--text-strong); font-size: 20px; cursor: pointer; touch-action: manipulation; transition: background .18s ease, transform .18s ease; }
.topbar-search:active { background: var(--accent-soft); transform: translateY(1px); }
@media (hover: hover) {
  .topbar-search:hover { background: var(--accent-soft); transform: translateY(-1px); }
}
.search-box { margin-bottom: 8px; }
.search-input { width: 100%; font-size: 15px; }
.search-result { max-height: 56vh; overflow-y: auto; margin-top: 6px; padding-right: 2px; }
.search-group { margin-bottom: 14px; }
.search-group-head { font-size: 12px; font-weight: 800; color: var(--text-muted); margin: 8px 4px 4px; letter-spacing: .5px; }
.search-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; transition: background .15s ease; }
.search-row:hover { background: var(--accent-soft); }
.search-ico { font-size: 18px; flex: none; }
.search-info { min-width: 0; }
.search-title { font-weight: 600; color: var(--text); word-break: break-word; }
.search-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.search-empty { color: var(--text-muted); text-align: center; padding: 28px 12px; font-size: 14px; }
.search-result mark { background: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--accent-deep); border-radius: 4px; padding: 0 2px; font-weight: 700; }
.modal-field { margin-bottom: 12px; }
.modal-label { font-size: 13px; font-weight: 700; color: var(--text-strong); margin: 12px 0 6px; }
.modal-picker { padding: 11px 14px; border-radius: 12px; background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke); cursor: pointer; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.mbtn { padding: 10px 18px; border-radius: 12px; font-weight: 700; cursor: pointer; border: 1px solid var(--glass-stroke); background: var(--glass-bg-soft); }
.mbtn.save { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; }
.mbtn.save:hover { filter: brightness(1.05); }
.mbtn.cancel { color: var(--text-muted); }
.mbtn.del { color: #e3556b; border-color: color-mix(in srgb, #e3556b 40%, transparent); }
.mbtn.disabled { opacity: .6; pointer-events: none; }

/* —— 从收藏选择背景：缩略图网格 —— */
.fav-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 4px; }
.fav-pick { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; cursor: pointer; border: 2px solid transparent;
  background-size: cover; background-position: center; transition: border-color .15s ease, transform .12s ease; overflow: hidden; }
.fav-pick:hover { border-color: var(--accent); transform: translateY(-2px); }
.fav-pick-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { width: 100%; text-align: center; padding: 12px; font-size: 15px; font-weight: 800; }
.priority-row, .icon-row, .mood-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pchip, .ichip, .mood-chip { padding: 8px 14px; border-radius: 11px; cursor: pointer; font-weight: 700; font-size: 13px;
  background: var(--glass-bg-soft); border: 1px solid var(--glass-stroke); }
.pchip.active, .ichip.active, .mood-chip.active { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
.modal-icons { display: flex; gap: 8px; flex-wrap: wrap; }
.fav-img-btn { padding: 11px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-deep);
  font-weight: 700; cursor: pointer; text-align: center; border: 1px solid var(--glass-border); }
.fav-img-preview { width: 100%; height: 160px; object-fit: cover; border-radius: 14px; margin-top: 10px; }
.set-hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-top: 8px; }

.toast-wrap { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { padding: 11px 20px; border-radius: 14px; font-weight: 700; font-size: 14px; color: #fff;
  background: rgba(30, 36, 48, .92); box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toastIn .25s ease; }
.toast.ok { background: linear-gradient(135deg, #3FCBA0, #2bb38a); }
.toast.err { background: linear-gradient(135deg, #e3556b, #c63f56); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* 登录 / 注册 遮罩 */
.auth-mask { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px;
  background: var(--bg-grad); background-attachment: fixed; }
.auth-card { width: min(420px, 100%); border-radius: var(--radius-card); padding: 34px 30px; text-align: center; }
.auth-logo { width: 64px; height: 64px; border-radius: var(--radius-card); margin: 0 auto 14px; display: grid; place-items: center;
  font-size: 32px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.auth-title { font-size: 24px; font-weight: 900; color: var(--text-strong); }
.auth-sub { color: var(--text-muted); margin: 6px 0 22px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted);
  user-select: none; cursor: pointer; margin: -2px 0; }
.auth-remember input { width: 16px; height: 16px; accent-color: var(--accent-deep); cursor: pointer; }
.auth-error { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 12px; font-size: 13px; font-weight: 700;
  color: #c63f56; background: color-mix(in srgb, #e3556b 14%, transparent); border: 1px solid color-mix(in srgb, #e3556b 32%, transparent);
  animation: toastIn .2s ease; }
.auth-error[hidden] { display: none; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.auth-switch a { color: var(--accent-deep); cursor: pointer; font-weight: 700; }

.boot-loading { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; background: var(--bg-grad); }
.boot-spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(var(--glass-rgb), .3); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.boot-loading-text { margin-top: 14px; color: var(--text-muted); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1100px) {
  .schedule-wrap { grid-template-columns: 1fr; }
  .notes { columns: 2 200px; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  /* 移动端输入框字号 ≥16px：否则 iOS Safari 聚焦时会强制放大整页，看着像"点不动/写不进" */
  .input, .textarea, .select { font-size: 16px; }
  .main { padding: 18px 16px calc(var(--bottom-h) + 24px); }
  .notes { columns: 1; }
  .rev-grid { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 22px; }
  .topbar { margin-bottom: 16px; }
}

/* 打卡回顾日历 */
.cal-wrap { padding: 18px; }
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cal-title { font-size: 19px; font-weight: 800; color: var(--text-strong); flex: 1; }
.cal-nav, .cal-today { border: 1px solid var(--glass-border); background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 10px; cursor: pointer; font-weight: 800; font-family: inherit; }
.cal-nav { width: 36px; height: 36px; font-size: 18px; line-height: 1; }
.cal-today { padding: 0 14px; height: 36px; font-size: 13px; }
.cal-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cal-chip { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--glass-border); color: var(--text-muted); background: transparent; user-select: none; }
.cal-chip.active { color: #fff; background: var(--chip, var(--accent)); border-color: transparent; }
.cal-weekrow, .cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-weekrow { margin-bottom: 8px; }
.cal-wd { text-align: center; font-size: 12px; color: var(--text-muted); font-weight: 700; }
.cal-grid { display: flex; flex-direction: column; gap: 8px; }
.cal-cell { min-height: 64px; border-radius: 14px; padding: 8px; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,.30); cursor: pointer; transition: transform .12s, box-shadow .12s; }
.cal-cell:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.10); }
.cal-cell.empty { background: transparent; border: none; cursor: default; box-shadow: none; }
.cal-cell.empty:hover { transform: none; box-shadow: none; }
.cal-cell.today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(123,140,255,.25); }
.cal-num { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.cal-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; }
body.dark .cal-cell { background: rgba(255,255,255,.06); }

/* 当日详情 */
.cal-detail { display: flex; flex-direction: column; gap: 16px; }
.cal-group { background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; }
body.dark .cal-group { background: rgba(255,255,255,.06); }
.cal-group-head { font-size: 14px; font-weight: 800; margin-bottom: 8px; }
.cal-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; color: var(--text); }
.cal-item.dim { opacity: .45; }
.cal-empty { font-size: 13px; color: var(--text-muted); }

/* 日历移动端适配（放在基础样式之后以覆盖） */
@media (max-width: 900px) {
  .cal-wrap { padding: 12px; }
  .cal-head { gap: 8px; }
  .cal-title { font-size: 16px; }
  .cal-nav, .cal-today { padding: 5px 10px; font-size: 13px; }
  .cal-nav { width: 34px; height: 34px; font-size: 16px; }
  .cal-today { height: 34px; padding: 0 12px; font-size: 13px; }
  .cal-chips { gap: 6px; margin-bottom: 10px; }
  .cal-chip { padding: 5px 10px; font-size: 12px; }
  .cal-weekrow, .cal-row { gap: 4px; }
  .cal-grid { gap: 4px; }
  .cal-wd { font-size: 11px; }
  .cal-cell { min-height: 52px; padding: 5px; border-radius: 10px; }
  .cal-num { font-size: 12px; }
  .cal-dots { gap: 3px; margin-top: 4px; }
  .cal-dot { width: 6px; height: 6px; }
  /* 日程视图日历（.cal 体系）同步收缩，避免手机端溢出/挤压 */
  .cal { gap: 3px; }
  .cal-cell { aspect-ratio: auto; }
  #calPanel, .cal-wrap, .cal, .cal-grid, .cal-row, .cal-weekrow { min-width: 0; max-width: 100%; }
}
@media (max-width: 400px) {
  .cal-wrap { padding: 10px; }
  .cal-weekrow, .cal-row { gap: 3px; }
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 46px; padding: 4px; border-radius: 9px; }
  .cal-num { font-size: 11px; }
  .cal-dot { width: 5px; height: 5px; }
}
