/* ======================================
   全局设计规范
   ====================================== */
/* 
  背景层级：
  - 容器/卡片：rgba(255, 255, 255, 0.1) + backdrop-filter: blur(8px)
  - 弹窗：rgba(255, 255, 255, 0.3) + border: 1px solid rgba(255, 182, 193, 0.3)
  - 输入框：rgba(245, 240, 242, 0.45)
  - 日志条目：rgba(255, 255, 255, 0.25) + border: 1px solid rgba(255, 182, 193, 0.3)
  - 按钮默认：rgba(255, 255, 255, 0.1) + border: 1px solid rgba(255, 255, 255, 0.3)
  - 按钮激活/确认：rgba(255, 182, 193, 0.8)
  - 按钮取消：rgba(255, 255, 255, 0.2) + border: 1px solid rgba(255, 255, 255, 0.3)
*/

/* 基础重置（保留） */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

/* ======================================
   核心：高透毛玻璃 + 蜡笔涂鸦背景 最终版
====================================== */
:root {
  --app-width: min(100vw, calc(100dvh * 9 / 16));
  --app-padding-x: 4%;
  --ui-scale: 1;
  --habit-card-min: 70px;
  --week-name-col: 2.5fr;
  --app-safe-top: max(54px, calc(env(safe-area-inset-top, 0px) + 18px));
}

html {
  min-height: 100%;
  background-image: var(--custom-wallpaper, url("../images/erduo.jpg"));
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

html body {
  margin: 0 auto;
  padding: 0 var(--app-padding-x);
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", sans-serif;
  width: var(--app-width);
  height: 100dvh;
  overflow: hidden;
}

/* 1. 蜡笔涂鸦背景（替换成你的本地图路径） */
body {
  --app-chrome-height: calc(112px + var(--app-safe-top));
  --atm-text: rgba(25, 38, 31, 0.92);
  --atm-text-soft: rgba(48, 73, 58, 0.68);
  --atm-glass: rgba(255, 255, 255, 0.24);
  --atm-glass-strong: rgba(255, 255, 255, 0.46);
  --atm-card: rgba(255, 255, 255, 0.34);
  --atm-nav: rgba(255, 255, 255, 0.24);
  --atm-fog: rgba(255, 255, 255, 0.14);
  --atm-highlight: transparent;
  --atm-accent: hsl(142 72% 42%);
  --atm-blur: 0px;
  --atm-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  --atm-saturation: 0.94;
  --atm-dim: rgba(255, 255, 255, 0.08);
  background-image: none;
  background-repeat: repeat;
  background-attachment: scroll;
  background-position: center;
  background-size: cover;
  width: var(--app-width);
  height: 100dvh;
  margin: 0 auto;
  padding: var(--app-safe-top) var(--app-padding-x) 10px;
  color: var(--atm-text);
  min-height: 100vh;
  overflow: hidden;
  font-size: calc(12px * var(--ui-scale)); /* 全局基础字体统一 */
  isolation: isolate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  transform: translateZ(0);
  will-change: transform, opacity;
  backface-visibility: hidden;
}

body::before {
  background:
    linear-gradient(180deg, var(--atm-fog), transparent 42%, var(--atm-dim)),
    radial-gradient(circle at 18% 8%, rgba(255,255,255,0.22), transparent 34%),
    radial-gradient(circle at 88% 18%, var(--atm-highlight), transparent 38%);
  opacity: 0.56;
}

body::after {
  background-image:
    linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.08) 42%, transparent 68%),
    radial-gradient(circle at 50% 0%, rgba(255,255,255,0.12), transparent 46%);
  opacity: 0.26;
}

body > * {
  position: relative;
  z-index: 1;
}

body.has-custom-wallpaper {
  background-image: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}


/* 2. 通用毛玻璃样式（统一半透，和所有日志模块一致） */
body #todayDate, 
body .nav, 
body .nav-btn, 
body .stat-card,
body .habit-section, 
body .habit-card, 
body .config-box, 
body .diary-table, 
body .week-table, 
body .log-detail, 
body .today-note-area {
  backdrop-filter: blur(var(--atm-blur)) saturate(1.18);
  -webkit-backdrop-filter: blur(var(--atm-blur)) saturate(1.18); /* 兼容iOS/Safari */
  background: var(--atm-card); /* 自适应氛围玻璃 */
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px; /* 苹果大圆角 */
  box-shadow: -1px 1px 14px 0px rgba(0, 0, 0, 0.27);

}

/* ===== 配置框 ===== */
body .config-box {
  display: none;
  padding: 15px;
  margin: 20px;
  border: 2px solid #FFC107;
}
body .config-box h3 { 
  margin-bottom: 10px; 
  font-size: 14px; 
}
body .config-box p { 
  font-size: 12px; 
  margin-bottom: 8px; 
}
body .config-box input {
  width: 100%;
  padding: 8px;
  margin: 4px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
}
body .config-box button {
  width: 100%;
  padding: 10px;
  background: rgba(45, 106, 79, 0.8); /* 按钮半透 */
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 8px;
  font-size: 12px;
}

/* ===== 导航栏 + 顶部日期（字体统一） ===== */
body .nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: calc(8px * var(--ui-scale)) calc(8px * var(--ui-scale)) calc(6px * var(--ui-scale)); /* 调扁导航栏 */
  margin: calc(8px * var(--ui-scale));
  gap: calc(8px * var(--ui-scale));
  flex-wrap: nowrap;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), transparent 120%),
    var(--atm-nav);
  border-color: transparent;
  box-shadow: 0 14px 40px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.24);
  backdrop-filter: blur(var(--atm-blur)) saturate(1.28);
  -webkit-backdrop-filter: blur(var(--atm-blur)) saturate(1.28);
}

/* 日期显示（和健康生活字体统一） */
body #todayDate {
  font-size: calc(16px * var(--ui-scale)); /* 和分类标题一致 */
  font-weight: 600;
  color: var(--atm-text);
  padding: calc(3px * var(--ui-scale)) calc(10px * var(--ui-scale)); /* 调扁 */
  margin-bottom: 0;
  white-space: nowrap;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  text-shadow: 0 1px 18px rgba(255,255,255,0.24);
}

/* 按钮容器 ,调导航栏按钮*/
body .nav-btn-group {
  display: flex;
  gap: calc(6px * var(--ui-scale));
  flex: 1;
  justify-content: flex-end;
  width: 100%; /* 占满父容器宽度（导航栏） */
  justify-content: space-between; 
  padding: calc(8px * var(--ui-scale));
  border-radius: calc(24px * var(--ui-scale));
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16);
}
body .nav-btn {
    /* 核心：让每个按钮占相同宽度 */
  flex: 1; /* 均分按钮组的宽度 */
  min-width: calc(80px * var(--ui-scale)); /* 按钮最小宽度，避免太窄 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(7px * var(--ui-scale)) calc(8px * var(--ui-scale));
  gap: calc(3px * var(--ui-scale)); /* Emoji和文字间距 */
  /* 把Emoji和文字强制分行 */
  white-space: pre-line; 
  color: var(--atm-text-soft);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  border-radius: 20px;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
/*调按钮里的字*/
body .nav-btn.active {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0.08)),
    color-mix(in srgb, var(--atm-accent) 22%, transparent);
  color: var(--atm-text);
  border-color: rgba(255,255,255,0.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), 0 8px 22px rgba(0,0,0,0.12);
  transform: scale(0.98);
}
body .nav-btn:hover, 
body .nav-btn:active {
  opacity: 0.9;
  transform: scale(0.98);
}

body .page { 
  display: none; 
  opacity: 0;
  height: calc(100dvh - var(--app-chrome-height));
  min-height: 0;
  padding: calc(5px * var(--ui-scale)) calc(10px * var(--ui-scale)) calc(16px * var(--ui-scale)); 
  overflow-y: auto;
  overflow-x: visible;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.15s ease;
}
body .page.active { 
  display: block; 
  opacity: 1;
}

/* 分类模块（健康生活/美容养护/心智成长）- 字体统一+调扁 */
body .habit-section {
  padding: calc(10px * var(--ui-scale)); /* 调扁模块 */
  margin-bottom: calc(10px * var(--ui-scale));
  border: none; /* 去掉原有彩色边框，统一毛玻璃 */
  position: relative;
  overflow: visible;
}
body .habit-section:has(.habit-card.active),
body .week-group:has(.week-col.active),
body .week-row:has(.week-col.active) {
  overflow: visible;
}
body .habit-section:has(.operation-bubble) {
  z-index: 20;
}
body .habit-grid,
body .week-group,
body .week-group-rows,
body .week-row {
  overflow: visible;
}
body .section-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: calc(8px * var(--ui-scale)); 
  position: relative;
}
/* 分类标题（和顶部日期/导航字体统一） */
body .section-title { 
  font-size: calc(13px * var(--ui-scale)); 
  font-weight: 600; 
  color: var(--atm-text); 
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale));
}
body .category-edit-btn {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #6B8A65;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}
body .category-edit-btn:hover {
  background: rgba(82, 183, 136, 0.18);
}
body .category-delete-btn {
  position: fixed;
  top: -9px;
  right: -9px;
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: #ff6b6b;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  line-height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
  z-index: 10;
}
body .category-delete-btn:hover {
  background: #ff5a5a;
}
body .add-category-row {
  width: 100%;
  min-height: 28px;
  margin: 6px 0 12px;
  border: 1px dashed rgba(107, 138, 101, 0.45);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #6B8A65;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
body .add-category-row:hover {
  background: rgba(82, 183, 136, 0.14);
}
body .wallpaper-row {
  width: 100%;
  min-height: 34px;
  margin: -4px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  background: var(--atm-glass);
  color: var(--atm-text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  backdrop-filter: blur(var(--atm-blur));
  -webkit-backdrop-filter: blur(var(--atm-blur));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  display: flex;
  padding: 0 12px;
  gap: 8px;
}
body .wallpaper-row:hover {
  background: var(--atm-glass-strong);
}
body .wallpaper-row span:first-child {
  flex: 1;
  text-align: center;
}
body .wallpaper-dice {
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 10px;
  transition: transform 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
}
body .wallpaper-dice:hover {
  transform: rotate(15deg) scale(1.15);
  background: rgba(255, 255, 255, 0.15);
}
body .atmosphere-row {
  margin-top: -8px;
}
body .section-progress { 
  font-size: calc(11px * var(--ui-scale)); 
  color: var(--atm-text-soft); 
  opacity: 0.8; 
}

/* 打卡网格 */
body .habit-grid { 
  display: grid; 
  grid-template-columns: repeat(4, minmax(0, 1fr)); /* iPhone 13/14 保持一行四个 */
  gap: calc(15px * var(--ui-scale)); 
}
/* 打卡卡片（调扁+图4同款毛玻璃） */
body .habit-card {
  padding: calc(6px * var(--ui-scale)) calc(4px * var(--ui-scale)); /* 大幅调扁 */
  border-radius: calc(18px * var(--ui-scale));
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.22);
  min-height: auto; /* 取消固定高度，更扁 */
}
body .habit-card:hover { 
  border-color: var(--atm-highlight); 
}
body .habit-card.completed {
  background: color-mix(in srgb, var(--atm-accent) 22%, var(--atm-card)); /* 自适应完成态 */
  border-color: var(--atm-highlight);
}
body .habit-card .mode-badge {
  position: fixed;
  top: 2px;
  right: 3px;
  font-size: calc(11px * var(--ui-scale));
  opacity: 0.75;
  line-height: 1;
}

/* 卡片内元素（字体统一调小） */
body .habit-icon { 
  font-size: calc(16px * var(--ui-scale)); 
  margin-bottom: calc(10px * var(--ui-scale)); 
}
body .habit-name { 
  font-size: calc(12px * var(--ui-scale)); 
  font-weight: 350; 
  color: var(--atm-text); 
  margin-bottom: calc(5px * var(--ui-scale)); 
  line-height: 1; 
}
body .habit-progress { 
  font-size: calc(9px * var(--ui-scale)); 
  color: var(--atm-text-soft); 
  opacity: 0.8; 
}

/* ===== Edit Mode: archive btn ===== */
.archive-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  z-index: 10;
  cursor: pointer;
  user-select: none;
  pointer-events: auto;
  border: none;
  border-radius: 50%;
  background: #ff6b6b;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
  padding: 0;
}
.archive-btn:hover {
  background: #ff5a5a;
}

.habit-card.delete-mode {
  animation: app-delete-wiggle 0.18s infinite alternate ease-in-out;
  transform-origin: 50% 55%;
}

.habit-card.delete-mode:nth-child(2n) {
  animation-direction: alternate-reverse;
}

@keyframes app-delete-wiggle {
  from {
    transform: rotate(-1.3deg) translateX(-0.5px);
  }
  to {
    transform: rotate(1.3deg) translateX(0.5px);
  }
}

.habit-card.deleting,
.habit-section.deleting {
  pointer-events: none;
  animation: app-delete-pop 0.18s ease-in forwards;
}

@keyframes app-delete-pop {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* 今日完成/本周完成率方块（调扁） */
body .stats { 
  display: flex; 
  gap: calc(8px * var(--ui-scale)); 
  margin-bottom: calc(12px * var(--ui-scale)); 
}
body .stat-card {
  padding: calc(8px * var(--ui-scale)) calc(6px * var(--ui-scale)); /* 大幅调扁 */
  flex: 1;
  text-align: center;
  min-height: calc(60px * var(--ui-scale)); /* 固定扁高 */
  display: flex;
  flex-direction: column;
  justify-content: center;
}
body .stat-value { 
  font-size: calc(18px * var(--ui-scale)); /* 调小数值 */
  font-weight: bold; 
  color: var(--atm-text); 
  margin-bottom: 2px; 
}
body .stat-label { 
  font-size: calc(11px * var(--ui-scale)); 
  color: var(--atm-text-soft); 
  opacity: 0.8; 
}

/* 同步状态 */
body .sync-status { 
  position: fixed; 
  top: 5px; 
  right: 5px; 
  padding: 5px 10px; 
  border-radius: 12px; 
  font-size: 11px; 
  z-index: 1000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
body .sync-status.online { 
  background: rgba(216, 243, 220, 0.8); 
  color: #2D6A4F; 
}
body .sync-status.offline { 
  background: rgba(255, 228, 230, 0.8); 
  color: #E76F51; 
}

/* 周视图（打卡框与周几列严格对齐） */
body .week-table { 
  margin-bottom: calc(12px * var(--ui-scale)); 
  overflow: visible; 
}

/* 表头 - 统一布局+样式，和行完全对齐 */
body .week-header { 
  display: grid; /* 强制生效grid布局 */
  grid-template-columns: var(--week-name-col) repeat(7, 1fr); /* 和周行列宽统一 */
  padding: calc(8px * var(--ui-scale)) calc(4px * var(--ui-scale)); /* 修正语法错误，配合顶格 */
  font-weight: 600; 
  font-size: 1px; /* 周几基础字体 */
  color: #4a5847; /* 统一表头文字色 */
}

/* 表头列容器 - 统一对齐，周几/日期分行 */
body .week-header-col { 
  text-align: center; /* 日期列居中，第一列单独左对齐 */
  font-size: calc(13px * var(--ui-scale)); 
  line-height: 1.5;
  color: #4a5847; 
  display: flex;
  flex-direction: column; /* 周几在上、日期在下分行 */
  justify-content: center;
  align-items: center;
  padding: calc(4px * var(--ui-scale)) calc(2px * var(--ui-scale)); /* 和行里的week-col padding匹配 */
}

/* 周几文字 - 统一样式 */
body .week-header-col .week-day-text { 
  font-size: calc(13px * var(--ui-scale)); /* 修正原1px的错误 */
  margin-bottom: calc(2px * var(--ui-scale)); /* 周几和日期间距 */
  font-weight: 500;
  color: #4a5847;
}

/* 日期文字 - 统一样式，稍浅区分层级（修复版） */
/* 精准匹配实际元素 .week-date-header，加!important确保生效 */
body .week-header-col span.week-date-header { 
  font-size: calc(10px * var(--ui-scale)) !important;
  color: #6B8A65 !important; 
  font-weight: 200 !important;
}

/* 表头第一列（习惯名称标题）- 左对齐+顶格 */
body .week-header-col:first-child { 
  text-align: left; 
  justify-content: center; /* 垂直居中 */
  align-items: flex-start; /* 水平左对齐 */
}

/* 周行 - 和表头完全对齐 */
body .week-row { 
  display: grid; 
  grid-template-columns: var(--week-name-col) repeat(7, 1fr); /* 和表头列宽完全一致 */
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  align-items: center;
  padding: calc(6px * var(--ui-scale)) calc(4px * var(--ui-scale)); /* 新增上下padding，和表头匹配 */
  padding-left: calc(4px * var(--ui-scale)); /* 行整体左移，配合顶格 */
}
body .week-row:last-child { 
  border-bottom: none; 
}
body .week-row:hover { 
  background: rgba(255, 255, 255, 0.15); 
}

/* 习惯名称列 - 顶格左对齐，和表头第一列匹配 */
body .week-col-name { 
  padding: calc(6px * var(--ui-scale)) 0 calc(6px * var(--ui-scale)) calc(10px * var(--ui-scale)); /* 和表头第一列padding-left:10px统一，顶格 */
  font-size: calc(13px * var(--ui-scale)); 
  font-weight: 500; 
  color: #4a5847; 
  line-height: 1.2; 
  text-align: left; 
  white-space: nowrap; 
  position: relative;
  cursor: pointer;
}
body .week-stat-field {
  display: inline-block;
  padding: calc(6px * var(--ui-scale)) calc(8px * var(--ui-scale)) calc(6px * var(--ui-scale)) 0;
  box-sizing: border-box;
}
/* 日历视图习惯名称右上角模式标注 */
body .week-mode-badge {
  position: absolute;
  top: -2px;
  right: 2px;
  font-size: calc(10px * var(--ui-scale));
  opacity: 0.75;
  line-height: 1;
}

/* 打卡框列 - 和表头日期列对齐 */
body .week-col { 
  padding: calc(4px * var(--ui-scale)) calc(2px * var(--ui-scale)); /* 和表头week-header-col padding匹配 */
  text-align: center; 
  min-height: calc(30px * var(--ui-scale)); 
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

body .week-col.disabled {
  opacity: 0.35;
  pointer-events: auto;
}

body .week-check-box {
  width: calc(22px * var(--ui-scale));
  height: calc(22px * var(--ui-scale));
  border: 1px solid rgba(255, 228, 230, 0.28);
  border-radius: calc(6px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.12);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(14px * var(--ui-scale));
  line-height: 1;
  box-sizing: border-box;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

body .week-col.done .week-check-box {
  background: rgba(82, 183, 136, 0.8);
  border-color: transparent;
}

body .week-check-box.flipping {
  animation: flip360 0.5s ease-in-out;
}

/* 打勾方框（适配周视图对齐） */
body .checkbox { 
  width: calc(24px * var(--ui-scale)); /* 调小打卡框 */
  height: calc(24px * var(--ui-scale)); 
  border: 2px solid rgba(221, 232, 214, 0.8); 
  border-radius: calc(6px * var(--ui-scale)); 
  cursor: pointer; 
  display: inline-block; 
  transition: all 0.1s ease; 
  margin: 0 auto;
  backdrop-filter: blur(4px);
}
body .checkbox:hover { 
  border-color: rgba(255, 255, 255, 0.55); 
  transform: scale(1.05); 
}
body .checkbox.checked { 
  background: rgba(82, 183, 136, 0.8); 
  border-color: rgba(255, 255, 255, 0.55); 
  position: relative; 
}
body .checkbox.checked::after { 
  content: '✓'; 
  color: white; 
  position: absolute; 
  top: 50%; 
  left: 50%; 
  transform: translate(-50%, -50%); 
  font-size: calc(14px * var(--ui-scale)); 
}
body .checkbox.flipping { 
  animation: flip360 0.5s ease-in-out; 
}

@keyframes flip360 {
  0% { transform: rotateY(0deg) scale(1); }
  25% { transform: rotateY(90deg) scale(1.2); }
  50% { transform: rotateY(180deg) scale(1.2); }
  75% { transform: rotateY(270deg) scale(1.1); }
  100% { transform: rotateY(360deg) scale(1); }
}

/* 周日历分组 */
body .week-group {
  margin-bottom: calc(4px * var(--ui-scale));
}
body .week-group-title {
  width: 100%;
  font-size: calc(12px * var(--ui-scale));
  font-weight: 600;
  color: #4a5847;
  padding: calc(7px * var(--ui-scale)) calc(10px * var(--ui-scale)) calc(5px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.12);
  border-radius: calc(8px * var(--ui-scale));
  margin: calc(2px * var(--ui-scale)) 0;
  user-select: none;
  text-align: left;
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale));
  font-family: inherit;
}
body .week-group-count {
  margin-left: auto;
  font-size: calc(10px * var(--ui-scale));
  color: #6B8A65;
  font-weight: 400;
}
body .week-group-arrow {
  width: calc(12px * var(--ui-scale));
  text-align: right;
}
body .week-group-toggle-hit {
  min-width: calc(44px * var(--ui-scale));
  min-height: calc(32px * var(--ui-scale));
  margin: calc(-7px * var(--ui-scale)) calc(-10px * var(--ui-scale)) calc(-5px * var(--ui-scale)) 0;
  padding: 0 calc(10px * var(--ui-scale));
  border: none;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  font-family: inherit;
}
body .week-group.collapsed .week-group-title {
  opacity: 0.6;
  margin-bottom: 0;
}
body .week-expand-btn {
  text-align: center;
  padding: calc(6px * var(--ui-scale));
  font-size: calc(11px * var(--ui-scale));
  color: #6B8A65;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border-radius: calc(8px * var(--ui-scale));
  margin-top: calc(2px * var(--ui-scale));
}
body .week-expand-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 周切换导航 */
body .week-nav { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  gap: calc(12px * var(--ui-scale)); 
  margin-bottom: calc(12px * var(--ui-scale)); 
}
body .week-nav button { 
  padding: calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale)); /* 调扁 */
  border: none; 
  background: rgba(45, 106, 79, 0.8); 
  color: white; 
  border-radius: calc(12px * var(--ui-scale)); 
  cursor: pointer; 
  font-size: calc(11px * var(--ui-scale));
  backdrop-filter: blur(4px);
}
body .week-nav button:hover { 
  background: rgba(82, 183, 136, 0.8); 
}
body .week-nav button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
body .week-nav span { 
  font-size: 12px; 
  font-weight: 600; 
  color: #3d6147; 
}

/* 今天日志输入框 */
body .today-note-area { 
  padding: 8px; /* 调扁 */
  border-radius: 20px; 
  font-size: 12px; /* 和分类标题一致 */
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(255, 248, 250, 0.2);
  border: 1px solid rgba(255, 228, 230, 0.5);
}
body .today-note-title { 
  font-size: 12px; 
  font-weight: 600; 
  color: #4a5847; 
  margin-bottom: 4px; 
}
body .today-note-input { 
  width: 100%; 
  padding: 6px; /* 调扁 */
  border: 1px solid rgba(255, 228, 230, 0.5); 
  border-radius: 12px; 
  font-size: 11px; 
  resize: vertical; 
  min-height: 40px; /* 调扁 */
  font-family: inherit; 
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #4a5847;
}
body .today-note-input:focus { 
  outline: none; 
  border-color: rgba(255, 182, 193, 0.8); 
}
body .today-note-btn { 
  padding: 4px 10px; /* 调扁 */
  background: rgba(255, 182, 193, 0.8); 
  color: white; 
  border: none; 
  border-radius: 12px; 
  cursor: pointer; 
  font-size: 11px;
  backdrop-filter: blur(4px);
}
body .today-note-btn:hover { 
  background: rgba(255, 156, 173, 0.8); 
}

/* 日记表格 + 所有日志（字体统一调小） */
body .diary-table { 
  overflow: hidden; 
}
body .diary-header { 
  display: grid; 
  grid-template-columns: 60px 1fr 2fr 50px; 
  padding: 10px; /* 调扁 */
  font-weight: 600; 
  gap: 6px; 
  font-size: 12px; /* 日志表头字体调小 */
  background: rgba(255, 240, 245, 0.2);
}
body .diary-row { 
  display: grid; 
  grid-template-columns: 60px 1fr 2fr 50px; 
  padding: 6px; /* 调扁 */
  border-bottom: 1px solid rgba(255, 228, 230, 0.2); 
  gap: 6px; 
  align-items: start; 
  font-size: 11px; /* 日志内容字体统一 */
}
body .diary-row:last-child { 
  border-bottom: none; 
}
body .diary-tag { 
  display: inline-block; 
  padding: 1px 4px; /* 调扁标签 */
  border-radius: 8px; 
  font-size: 11px; /* 标签字体调小 */
  margin: px;
  backdrop-filter: blur(4px);
    background: rgba(213, 245, 218, 0.655); 
  color: #566c62; 
}
body button.diary-tag {
  border: none;
  font-family: inherit;
  cursor: pointer;
}
body .stats-tag {
  background: rgba(82, 183, 136, 0.8);
  color: white;
}
body .stats-tag.active {
  background: rgba(82, 183, 136, 0.72);
  color: white;
}
body .multi-tag-summary {
  padding: 3px 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.24);
  color: #4a5847;
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
  font-weight: 500;
}
body .diary-tag.issue { 
  background: rgba(255, 228, 230, 0.8); 
  color: #E76F51; 
}
body .diary-tag.note { 
  background: rgba(255, 249, 196, 0); 
  color: #463e36; 
}
body .diary-tag.normal { 
  background: rgba(216, 243, 220, 0.8); 
  color: #2D6A4F; 
  font-size: 11px; /* 正常日志标签字体调小 */
}
body .diary-note { 
  font-size: 11px; /* 日志备注字体调小 */
  color: #6B8A65; 
  line-height: 1.4; 
  word-break: break-all; 
}
body .edit-note-btn { 
  padding: 2px 4px; /* 调扁按钮 */
  background: rgba(255, 182, 193, 0.8); 
  color: white; 
  border: none; 
  border-radius: 8px; 
  cursor: pointer; 
  font-size: 11px; /* 按钮字体调小 */
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
body .edit-note-btn:hover { 
  background: rgba(255, 156, 173, 0.8); 
}

/* 所有日志模块（图4样式，字体统一） */
body .log-detail { 
  padding: 8px 10px; /* 调扁 */
  border-radius: 20px; 
  margin-bottom: 8px;
  display: flex; 
  gap: 8px; 
  align-items: center;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 182, 193, 0.3);
}
body .log-detail-date { 
  font-weight: 600; 
  color: #3d6147; 
  min-width: 50px;
  font-size: 12px;
}

/* 模态框 */
body .modal { 
  display: none; 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  background: rgba(40, 30, 35, 0.75); 
  align-items: center; 
  justify-content: center; 
  z-index: 9999; 
  pointer-events: none;
}
body .modal.show { 
  display: flex; 
}

body #allLogsModal.show {
  pointer-events: auto;
}

body #editNoteModal.show {
  pointer-events: auto;
}

/* ===== 修复自定义设置弹窗显示问题 ===== */

/* 父遮罩层 */
#customSettingModal {
  display: none;               /* 默认隐藏 */
  pointer-events: none;        /* 默认遮罩不可点击 */
  align-items: center;
  justify-content: center;
  position: fixed;             /* 固定在屏幕 */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3); /* 半透明遮罩 */
  z-index: 1002;               /* 高于 bubble/统计弹窗 */
}

/* modal 内容 */
#customSettingModal .modal-content {
  position: relative;          /* 避免父元素 overflow/transform 裁剪 */
  z-index: 1003;               /* 高于遮罩 */
  pointer-events: auto;        /* 可交互 */
  width: 360px;
  max-width: 90vw;
  min-height: 200px;
  background-color: rgba(255, 246, 243, 0.95); /* 粉色半透 */
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* optional: 保持 confirm/cancel 按钮在底部 */
#customSettingModal .modal-buttons {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* optional: 避免弹窗被 transform 裁剪 */
body .modal {
  overflow: visible;
  transform: none;
}

body .modal-content { 
  position: relative;
  z-index: 10000;
  pointer-events: auto;
  padding: calc(20px * var(--ui-scale)); /* 调扁 */
  border-radius: calc(20px * var(--ui-scale)); 
  width: calc(350px * var(--ui-scale)); 
  max-width: 90vw;
  font-size: calc(12px * var(--ui-scale)); /* 模态框字体统一 */
  background: rgba(255, 255, 255, 0.57);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #4a5847;
}
body .modal-content h3.modal-title {
  font-size: calc(14px * var(--ui-scale));
  font-weight: bold;
  margin-bottom: calc(12px * var(--ui-scale));
  color: #4a5847;
}
body .modal-content h3.modal-title.pink { 
  color: #4a5847; 
}
body .modal-scroll-area { 
  max-height: 60vh; 
  overflow-y: auto; 
}

body #allLogsModal .modal-content.wide {
  width: min(calc(520px * var(--ui-scale)), calc(100vw - 28px));
  max-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
}
body .modal-subtitle {
  margin-bottom: calc(6px * var(--ui-scale));
  font-size: calc(10px * var(--ui-scale));
  color: #666;
}
body .modal-input { 
  width: 100%; 
  padding: calc(8px * var(--ui-scale)); /* 调扁 */
  border: 1px solid rgba(255, 255, 255, 0.3); 
  border-radius: calc(12px * var(--ui-scale)); 
  margin-bottom: calc(10px * var(--ui-scale)); 
  font-size: calc(12px * var(--ui-scale)); 
  box-sizing: border-box;
  background: rgba(245, 240, 242, 0.45);
  color: #4a5847;
}
body .modal-input:focus { 
  outline: none; 
  border-color: rgba(255, 255, 255, 0.6); 
}
body .icon-picker-field {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
body .icon-picker-field .modal-input {
  grid-column: 2;
  margin-bottom: 0;
}
body .icon-picker-toggle {
  grid-column: 1;
  grid-row: 1;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  color: #4a5847;
  cursor: pointer;
  font-size: 12px;
}
body .icon-picker-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 6px;
  max-height: 154px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
  -webkit-overflow-scrolling: touch;
}
body .icon-picker-panel[hidden] {
  display: none;
}
body .icon-picker-option {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.34);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}
body .icon-picker-option:active {
  transform: scale(0.94);
}
body .modal-select { 
  width: 100%; 
  padding: 8px; /* 调扁 */
  border: 1px solid rgba(255, 255, 255, 0.3); 
  border-radius: 12px; 
  margin-bottom: 10px; 
  font-size: 11px; 
  box-sizing: border-box; 
  background: rgba(245, 240, 242, 0.45);
  color: #4a5847;
}
body .modal-buttons { 
  display: flex; 
  gap: calc(8px * var(--ui-scale)); 
  margin-top: calc(12px * var(--ui-scale)); 
}
body .modal-btn { 
  flex: 1; 
  padding: calc(8px * var(--ui-scale)); /* 调扁 */
  border: none; 
  border-radius: calc(12px * var(--ui-scale)); 
  cursor: pointer; 
  font-size: calc(11px * var(--ui-scale));
  backdrop-filter: blur(4px);
}
body .modal-btn.cancel { 
  background: rgba(255, 255, 255, 0.2); 
  color: #4a5847; 
  border: 1px solid rgba(255, 255, 255, 0.3);
}
body .modal-btn.confirm { 
  background: rgba(255, 182, 193, 0.8); 
  color: white; 
}
body .modal-btn.confirm.danger {
  background: rgba(255, 107, 107, 0.72);
}
body .delete-confirm-message {
  color: #4a5847;
  font-size: calc(12px * var(--ui-scale));
  line-height: 1.6;
  padding: calc(8px * var(--ui-scale)) calc(2px * var(--ui-scale)) calc(2px * var(--ui-scale));
}

/* 编辑备注模态框 */
body .edit-note-modal,
body .add-habit-modal {
  width: 350px;
}
body .today-note-input {
  background: rgba(245, 240, 242, 0.45);
}
body .edit-note-modal textarea {
  resize: vertical;
  min-height: 80px; /* 调扁 */
  background: rgba(245, 240, 242, 0.45);
}
body .edit-note-modal textarea:focus {
  outline: none;
  border-color: #52B788;
}

/* 微信气泡弹窗 */
.bubble-popup {
  display: none;
  position: fixed;
  z-index: 1000;
  opacity: 0;
  transform: scale(0.3) translateX(-30px);
  transform-origin: left center;
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  will-change: transform, opacity;
}
.bubble-popup.show {
  display: flex;
  align-items: flex-start;
  opacity: 1;
  transform: scale(1) translateX(0);
  pointer-events: auto;
}
.bubble-arrow {
  width: 0;
  height: 0;
  flex-shrink: 0;
  /* 默认朝左，JS 会覆盖 */
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 10px solid rgba(255, 255, 255, 0.32);
  margin-right: -1px;
  margin-top: 12px;
}
.bubble-content {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  width: 220px;
  max-width: 90vw;
  overflow: hidden;
  flex-shrink: 0;
}
#habitStatsModal .bubble-content {
  width: 238px;
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
}
.bubble-header {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  color: #4a5847;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
#habitStatsModal .bubble-header {
  padding: 9px 17px;
  font-size: 13px;
}
.bubble-body {
  padding: 10px;
  font-size: 12px;
  color: #4a5847;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#habitStatsModal .bubble-body {
  padding: 11px;
  font-size: 13px;
}

/* 统计弹窗内部模块 */
.stats-section { margin-bottom: 8px; }
.stats-section:last-child { margin-bottom: 0; }
.stats-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #6B8A65;
  margin-bottom: 6px;
}
.stats-log-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.stats-log-title .multi-tag-summary:empty {
  display: none;
}
.quantify-line-title {
  margin-top: 10px;
}
.stats-section-content {
  min-height: 60px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px;
}
.stats-empty {
  color: #6B8A65;
  font-size: 11px;
  text-align: center;
}
.stats-empty.padded {
  padding: 20px 0;
}
.stats-record-row {
  margin-bottom: 6px;
}
.stats-record-time {
  font-size: 10px;
  color: #3d6147;
  margin-bottom: 2px;
}
.stats-record-time + div .diary-tag.stats-tag {
  background: rgba(82, 183, 136, 0.8);
  color: white;
}
#lineChartContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 172px;
  padding: 18px 4px 10px;
}
.line-chart-wrapper {
  position: relative;
  width: 100%;
}
.line-chart-value-summary {
  position: absolute;
  top: -10px;
  right: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--atm-text);
  white-space: nowrap;
}
.line-chart-svg {
  display: block;
  max-width: 280px;
  margin: 0 auto;
  color: #6B8A65;
}
.line-chart-dot {
  cursor: pointer;
}
.line-chart-dot.active {
  filter: drop-shadow(0 0 4px rgba(82, 183, 136, 0.75));
}
.stats-mode-subdivide,
.stats-mode-quantify {
  display: none;
}
#logListContainer {
  max-height: min(48vh, 320px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 热力图容器：左侧月份 + 右侧格子 */
.heatmap-box {
  padding: 10px 16px 10px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
/* 左侧月份区域 */
.heatmap-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 64px;
}
.heatmap-month-label {
  font-size: 12px;
  font-weight: 500;
  color: #4a5847;
  text-align: center;
}
.stats-month-summary {
  color: #6B8A65;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  opacity: 0.72;
}
.heatmap-month-summary {
  max-width: none;
  white-space: nowrap;
}
/* 上下箭头 */
.heatmap-tri-up {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid rgba(107, 138, 101, 0.5);
  cursor: pointer;
  transition: transform 0.1s ease, border-bottom-color 0.15s ease;
}
.heatmap-tri-up:hover {
  border-bottom-color: rgba(107, 138, 101, 0.85);
}
.heatmap-tri-up:active {
  transform: scale(0.85);
}
.heatmap-tri-up.disabled {
  border-bottom-color: rgba(107, 138, 101, 0.12);
  cursor: not-allowed;
  pointer-events: none;
}
.heatmap-tri-down {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid rgba(107, 138, 101, 0.5);
  cursor: pointer;
  transition: transform 0.1s ease, border-top-color 0.15s ease;
}
.heatmap-tri-down:hover {
  border-top-color: rgba(107, 138, 101, 0.85);
}
.heatmap-tri-down:active {
  transform: scale(0.85);
}
.heatmap-tri-down.disabled {
  border-top-color: rgba(107, 138, 101, 0.12);
  cursor: not-allowed;
  pointer-events: none;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 6px;
  column-gap: 4px;
}
.heatmap-weekday {
  text-align: center;
  font-size: 8px;
  color: #6B8A65;
  line-height: 1;
}
.heatmap-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background 0.15s ease;
}
.heatmap-cell.empty {
  background: rgba(255, 255, 255, 0.08);
  opacity: 0.65;
}
.heatmap-cell.checked {
  background: rgba(82, 183, 136, 0.8);
}

/* ======================
   量化模式：日历数字热力图（气泡弹窗第二个图）
   ====================== */
.quantify-calendar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.quantify-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.quantify-month-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.quantify-month-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.quantify-month-label {
  font-size: 12px;
  font-weight: 500;
  color: #4a5847;
  text-align: center;
  min-width: 56px;
}
.quantify-tri-left {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 7px solid rgba(107, 138, 101, 0.5);
  cursor: pointer;
  transition: transform 0.1s ease, border-right-color 0.15s ease;
}
.quantify-tri-left:hover {
  border-right-color: rgba(107, 138, 101, 0.85);
}
.quantify-tri-left:active {
  transform: scale(0.85);
}
.quantify-tri-left.disabled {
  border-right-color: rgba(107, 138, 101, 0.12);
  cursor: not-allowed;
  pointer-events: none;
}
.quantify-tri-right {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid rgba(107, 138, 101, 0.5);
  cursor: pointer;
  transition: transform 0.1s ease, border-left-color 0.15s ease;
}
.quantify-tri-right:hover {
  border-left-color: rgba(107, 138, 101, 0.85);
}
.quantify-tri-right:active {
  transform: scale(0.85);
}
.quantify-tri-right.disabled {
  border-left-color: rgba(107, 138, 101, 0.12);
  cursor: not-allowed;
  pointer-events: none;
}
.quantify-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 1px;
}
.quantify-heatmap-weekday {
  text-align: center;
  font-size: 8px;
  color: #6B8A65;
  padding: 1px 0;
}
.quantify-heatmap-cell {
  aspect-ratio: 1;
  min-height: 24px;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 500;
  color: #4a5847;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.15s ease;
  line-height: 1.1;
  padding: 1px 0;
}
.quantify-heatmap-cell.empty {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  opacity: 0.65;
}
.quantify-heatmap-cell.has-value {
  background: rgba(82, 183, 136, 0.8);
  border-color: rgba(255, 255, 255, 0.55);
  color: white;
  font-weight: 600;
}
/* 日期数字（上半） */
.quantify-heatmap-cell .qhm-day {
  font-size: 8px;
  opacity: 0.7;
}
/* 量化数值（下半） */
.quantify-heatmap-cell .qhm-value {
  font-size: 8px;
  font-weight: 600;
  min-height: 9px;
}

/* iPhone14适配 */
@media screen and (max-width: 390px) {
  body .modal-content { 
    width: 90vw; 
  }
  body .edit-note-modal { 
    width: 90vw; 
  }
  body .checkbox { 
    width: 22px; 
    height: 22px; 
  }
}

/* Pad：保留移动端习惯，稍微放宽容器和网格 */
@media screen and (min-width: 700px) {
  :root {
    --ui-scale: 1.18;
    --app-width: min(92vw, calc(100dvh * 9 / 16 * var(--ui-scale)));
    --app-padding-x: 24px;
    --habit-card-min: calc(70px * var(--ui-scale));
    --cat-card-min: calc(60px * var(--ui-scale));
    --week-name-col: 3fr;
  }

  body {
    --app-chrome-height: calc((112px * var(--ui-scale)) + var(--app-safe-top));
  }

  body .nav {
    margin: calc(8px * var(--ui-scale));
  }

  body .page {
    padding: calc(5px * var(--ui-scale)) calc(10px * var(--ui-scale)) calc(16px * var(--ui-scale));
  }

  body .habit-grid {
    grid-template-columns: repeat(auto-fill, minmax(var(--habit-card-min), 1fr));
  }

  body .habit-grid,
  .cat-grid {
    gap: calc(15px * var(--ui-scale));
  }

  body .stat-card {
    min-height: calc(60px * var(--ui-scale));
  }

  body .modal-content {
    width: min(calc(350px * var(--ui-scale)), 80vw);
  }

  body #allLogsModal .modal-content.wide {
    width: min(calc(520px * var(--ui-scale)), calc(100vw - 48px));
  }
}

/* PC网页端：居中加宽，不让内容铺得过散 */
@media screen and (min-width: 1024px) {
  :root {
    --ui-scale: 1.34;
    --app-width: min(86vw, calc(100dvh * 9 / 16 * var(--ui-scale)));
    --app-padding-x: 32px;
    --habit-card-min: calc(70px * var(--ui-scale));
    --cat-card-min: calc(60px * var(--ui-scale));
    --week-name-col: 3.6fr;
  }

  body {
    --app-chrome-height: calc((112px * var(--ui-scale)) + var(--app-safe-top));
  }

  body .nav {
    margin: calc(8px * var(--ui-scale));
  }

  body .page {
    padding: calc(5px * var(--ui-scale)) calc(10px * var(--ui-scale)) calc(16px * var(--ui-scale));
  }

  body .stats {
    gap: calc(8px * var(--ui-scale));
  }

  body .habit-grid {
    grid-template-columns: repeat(auto-fill, minmax(var(--habit-card-min), 1fr));
  }

  body .habit-grid,
  .cat-grid {
    gap: calc(15px * var(--ui-scale));
  }

  body .modal-content {
    width: min(calc(350px * var(--ui-scale)), 70vw);
  }

  body #allLogsModal .modal-content.wide {
    width: min(calc(520px * var(--ui-scale)), calc(100vw - 72px));
  }
}

/*添加的编辑按钮*/
/* 习惯编辑模式样式 - 加减按钮 */
.habit-edit-mode {
  position: relative;
  background: #fef2f2;
  border-radius: 4px;
  padding: 4px;
}

/* 加减按钮样式 - 防误触间距 */
.habit-count-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: #4a5847;
  color: white;
  font-size: 16px;
  cursor: pointer;
  margin: 0 6px; /* 关键：间距避免误触 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation; /* 移动端防误触 */
}

.habit-count-btn:hover {
  background: #3a4837;
}

/* 总次数输入框 */
.habit-total-input {
  width: 40px;
  height: 24px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 0 4px;
}

/* 编辑模式提示 */
.edit-mode-tip {
  font-size: 10px;
  color: #6B8A65;
  margin-top: 2px;
}

/* 自定义工具栏（habitCustom.js 用） */
.custom-toolbar { display: flex; gap: calc(8px * var(--ui-scale)); margin-top: calc(12px * var(--ui-scale)); flex-wrap: wrap; }
.custom-btn { flex: 1; padding: calc(10px * var(--ui-scale)) calc(8px * var(--ui-scale)); border: none; background: rgba(255, 255, 255, 0.1); color: #4a5847; border-radius: calc(20px * var(--ui-scale)); cursor: pointer; font-size: calc(12px * var(--ui-scale)); transition: all 0.2s; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.3); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03); }
.custom-btn:hover { background: rgba(255, 182, 193, 0.25); border-color: rgba(255, 182, 193, 0.4); }
.custom-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 删除模式 */
.shake { animation: shake 0.6s linear infinite; }
@keyframes shake {
  0% { transform: rotate(0deg) translateX(0); }
  12.5% { transform: rotate(-0.5deg) translateX(-0.5px); }
  25% { transform: rotate(0deg) translateX(0); }
  37.5% { transform: rotate(0.5deg) translateX(0.5px); }
  50% { transform: rotate(0deg) translateX(0); }
  62.5% { transform: rotate(-0.5deg) translateX(-0.5px); }
  75% { transform: rotate(0deg) translateX(0); }
  87.5% { transform: rotate(0.5deg) translateX(0.5px); }
  100% { transform: rotate(0deg) translateX(0); }
}
.delete-btn { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; background: #ff4444; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; z-index: 10; }

/* edit mode 视觉反馈 */
.habit-card.edit-mode,
.week-col.edit-mode,
.week-col-name.edit-mode {
  animation: editGlow 2s ease-in-out infinite;
  border-color: #ff8fb1;
}

#btnEditMode.active {
  background: #ff8fb1;
  color: white;
}

@keyframes editGlow {
  0% {
    box-shadow: 0 0 0 rgba(255,143,177,0);
  }

  50% {
    box-shadow: 0 0 12px rgba(255,143,177,0.45);
  }

  100% {
    box-shadow: 0 0 0 rgba(255,143,177,0);
  }
}

/* 次数调节控件 */
.count-controls { display: flex; align-items: center; justify-content: center; gap: calc(6px * var(--ui-scale)); margin-top: calc(4px * var(--ui-scale)); }
.count-btn { width: calc(22px * var(--ui-scale)); height: calc(22px * var(--ui-scale)); border: none; background: rgba(255, 255, 255, 0.15); color: #4a5847; border-radius: 50%; cursor: pointer; font-size: calc(12px * var(--ui-scale)); display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255, 255, 255, 0.3); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.count-display { font-size: calc(11px * var(--ui-scale)); font-weight: normal; color: #4a5847; min-width: calc(20px * var(--ui-scale)); text-align: center; }

/* 自定义弹窗 - 分区 */
.custom-section { margin: calc(6px * var(--ui-scale)) 0; padding: calc(6px * var(--ui-scale)) 0; border-bottom: 1px solid rgba(255, 255, 255, 0.15); }
.custom-section:last-of-type { border-bottom: none; }
.custom-section-label { font-size: calc(12px * var(--ui-scale)); font-weight: 600; color: #4a5847; margin-bottom: calc(5px * var(--ui-scale)); text-align: center; }
.custom-collapsible {
  display: block !important;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: max-height 0.22s ease, opacity 0.18s ease, transform 0.18s ease;
}
.custom-collapsible:not(.open) {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
}
.custom-collapsible.open {
  max-height: 520px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.custom-inline-toggle {
  display: block !important;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-3px);
  pointer-events: none;
  transition: max-height 0.18s ease, opacity 0.16s ease, transform 0.16s ease;
}
.custom-inline-toggle.open {
  max-height: 260px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#subdivideConfig .custom-toggle-group {
  margin-bottom: 2px !important;
  gap: 8px;
}
#subdivideConfig {
  padding-top: 4px;
  padding-bottom: 4px;
}
#subdivideItems {
  margin-top: 2px;
}
#addQuantifyLevel,
#addSubdivideItem {
  margin-top: 4px !important;
}

/* 互斥选项 */
.custom-toggle-group { display: flex; gap: calc(12px * var(--ui-scale)); justify-content: center; }
.custom-toggle { display: flex; align-items: center; gap: calc(6px * var(--ui-scale)); padding: calc(8px * var(--ui-scale)) calc(16px * var(--ui-scale)); border-radius: calc(12px * var(--ui-scale)); background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.3); cursor: pointer; transition: all 0.2s; font-size: calc(12px * var(--ui-scale)); color: #4a5847; }
.custom-toggle:hover { background: rgba(255, 182, 193, 0.15); }
.custom-toggle.disabled { opacity: 0.35; pointer-events: none; }
.custom-toggle input[type="checkbox"] { display: none; }
.custom-toggle.active { background: rgba(82, 183, 136, 0.2); border-color: rgba(82, 183, 136, 0.5); }
.custom-toggle.plain input[type="checkbox"] { display: inline-block; width: 14px; height: 14px; margin-right: 4px; }
.custom-toggle.plain.active { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); }

.modal-input.field-error,
.modal-select.field-error {
  border-color: rgba(255, 77, 109, 0.75) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 77, 109, 0.5), 0 0 0 2px rgba(255, 77, 109, 0.12);
}

.field-error-message {
  color: #b4233c;
  font-size: 10px;
  line-height: 1.2;
  margin: 2px 0 0 2px;
}

.level-row .field-error-message {
  flex: 0 0 auto;
  min-width: 44px;
}
.level-row {
  margin-top: 4px !important;
  transition: opacity 0.16s ease, transform 0.16s ease, max-height 0.18s ease, margin-top 0.18s ease;
}
.level-row.row-entering {
  animation: customRowIn 0.18s ease both;
}
.level-row.row-removing {
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  max-height: 0;
  margin-top: 0 !important;
  overflow: hidden;
}
@keyframes customRowIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 自定义编辑模式 - 粉色闪烁边框（box-shadow 不改变卡片大小） */
@keyframes pinkPulse {
  0% { box-shadow: 0 0 0 2px rgba(255, 182, 193, 0.06), 0 0 10px 4px rgba(255, 182, 193, 0.02); }
  50% { box-shadow: 0 0 0 3px rgba(255, 182, 193, 0.7), 0 0 16px 8px rgba(255, 182, 193, 0.3); }
  100% { box-shadow: 0 0 0 2px rgba(255, 182, 193, 0.06), 0 0 10px 4px rgba(255, 182, 193, 0.02); }
}
.habit-card.custom-edit {
  animation: pinkPulse 1.5s ease-in-out infinite;
  cursor: pointer;
}
.habit-card.custom-edit:active {
  background: rgba(255, 182, 193, 0.3);
  transition: background 0.15s;
}

.habit-card.active {
  outline: 2px solid #52B788;
  background: rgba(82, 183, 136, 0.15);
}

.bubble {
  margin-top: 8px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
  display: flex;
  gap: 8px;
  justify-content: center;
}

.bubble-item {
  padding: 6px 10px;
  border-radius: 8px;
  background: white;
  font-size: 12px;
}

.bubble-item.selected {
  background: #52B788;
  color: white;
  transform: scale(1.1);
}

.habit-card.active {
  outline: none;
  background: rgba(255, 255, 255, 0.16);
  z-index: 20000;
}

.week-col.active {
  z-index: 20000;
}

.operation-bubble {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  display: block;
  transform: translate(-50%, -50%);
  z-index: 20001;
  overflow: visible;
}

.operation-bubble.bubble-portal {
  position: fixed;
  z-index: 30000;
}

.operation-bubble .bubble-item {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(52px * var(--ui-scale));
  height: calc(52px * var(--ui-scale));
  padding: 0 calc(5px * var(--ui-scale));
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgb(248, 232, 235);
  color: #4a5847;
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 22px rgba(118, 82, 92, 0.24), inset 0 1px 10px rgba(255, 255, 255, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(11.5px * var(--ui-scale));
  line-height: 1.1;
  text-align: center;
  word-break: break-word;
  cursor: pointer;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: operationBubbleItemIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) var(--bubble-delay, 0s) both;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.operation-bubble .bubble-item.selected {
  background: rgb(226, 240, 216);
  color: #3d6147;
  border-color: rgba(82, 183, 136, 0.5);
  box-shadow: 0 9px 20px rgba(94, 79, 100, 0.26), inset 0 1px 8px rgba(255, 255, 255, 0.48);
}

.operation-bubble.multi-bubble .bubble-item {
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.operation-bubble.multi-bubble .bubble-item.selected {
  box-shadow: 0 10px 22px rgba(118, 82, 92, 0.24), inset 0 1px 10px rgba(255, 255, 255, 0.72);
}

.operation-bubble .bubble-item:active {
  background: rgb(218, 234, 209);
}

body[data-atm-tone="dark"] .operation-bubble .bubble-item {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.18), rgba(255,255,255,0.055) 58%, rgba(255,255,255,0.035)),
    color-mix(in srgb, rgba(22, 28, 38, 0.62) 78%, var(--atm-card));
  color: rgba(255, 255, 255, 0.84);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 30px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.2), inset 0 -12px 26px rgba(255,255,255,0.035);
  backdrop-filter: blur(calc(var(--atm-blur) + 1px)) saturate(1.24);
  -webkit-backdrop-filter: blur(calc(var(--atm-blur) + 1px)) saturate(1.24);
}

body[data-atm-tone="dark"] .operation-bubble .bubble-item.selected {
  background:
    radial-gradient(circle at 34% 24%, color-mix(in srgb, var(--atm-accent) 24%, rgba(255,255,255,0.16)), transparent 52%),
    linear-gradient(145deg, rgba(255,255,255,0.24), rgba(255,255,255,0.075) 62%, rgba(255,255,255,0.04)),
    color-mix(in srgb, rgba(24, 28, 40, 0.64) 68%, var(--atm-accent));
  color: rgba(255, 255, 255, 0.96);
  border-color: color-mix(in srgb, var(--atm-highlight) 58%, rgba(255,255,255,0.26));
  box-shadow: 0 14px 34px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.28), 0 0 0 0.5px rgba(255,255,255,0.12), inset 0 0 18px color-mix(in srgb, var(--atm-accent) 14%, transparent);
}

body[data-atm-tone="dark"] .operation-bubble.multi-bubble .bubble-item.selected {
  box-shadow: 0 14px 34px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.28), 0 0 0 0.5px rgba(255,255,255,0.12), inset 0 0 18px color-mix(in srgb, var(--atm-accent) 14%, transparent);
}

body[data-atm-tone="dark"] .operation-bubble .bubble-item:active {
  background:
    radial-gradient(circle at 34% 24%, color-mix(in srgb, var(--atm-accent) 20%, rgba(255,255,255,0.12)), transparent 52%),
    color-mix(in srgb, rgba(24, 28, 40, 0.68) 72%, var(--atm-accent));
}

.operation-bubble.closing {
  pointer-events: none;
}

.operation-bubble:not(.text-bubble)::after {
  display: none;
}

.operation-bubble.closing .bubble-item {
  animation: operationBubbleItemOut 0.18s cubic-bezier(0.55, 0, 1, 1) forwards;
}

@keyframes operationBubbleItemIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
  }
  to {
    opacity: 1;
    transform: translate(calc(-50% + var(--bubble-x, 0px)), calc(-50% + var(--bubble-y, 0px))) scale(1);
  }
}

@keyframes operationBubbleItemOut {
  from {
    opacity: 1;
    transform: translate(calc(-50% + var(--bubble-x, 0px)), calc(-50% + var(--bubble-y, 0px))) scale(1.08);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
  }
}

.operation-bubble.text-bubble {
  --text-bubble-x: -50%;
  --text-bubble-y: calc(-100% - 20px);
  --text-bubble-y-start: calc(-100% - 4px);
  --text-bubble-tail-left: 50%;
  width: min(206px, calc(100vw - 44px));
  height: 112px;
  padding: 10px;
  border-radius: 20px;
  background: rgb(249, 235, 238);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: 0 14px 30px rgba(118, 82, 92, 0.18), inset 0 1px 10px rgba(255, 255, 255, 0.72);
  transform: translate(var(--text-bubble-x), var(--text-bubble-y));
  animation: textBubbleIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.operation-bubble.text-bubble.bubble-edge-left {
  left: 0;
  --text-bubble-x: -12px;
  --text-bubble-tail-left: 28px;
}

.operation-bubble.text-bubble.bubble-edge-right {
  left: 100%;
  --text-bubble-x: calc(-100% + 12px);
  --text-bubble-tail-left: calc(100% - 28px);
}

.operation-bubble.text-bubble::after {
  display: none;
}

.operation-bubble.text-bubble::before {
  content: '';
  position: absolute;
  left: var(--text-bubble-tail-left);
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.62);
  border-bottom: 1px solid rgba(255, 255, 255, 0.62);
  background: rgb(249, 235, 238);
  box-shadow: 6px 6px 14px rgba(118, 82, 92, 0.08);
  transform: translateX(-50%) rotate(45deg);
}

.operation-bubble.text-bubble.closing {
  animation: textBubbleOut 0.14s ease-in forwards;
}

.operation-bubble .multi-text-input {
  width: 100%;
  height: 100%;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.54);
  outline: none;
  border-radius: 15px;
  padding: 10px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.42);
  color: #4a5847;
  font-size: 12px;
  line-height: 1.45;
  font-family: inherit;
  box-shadow: inset 0 1px 8px rgba(255, 255, 255, 0.44);
  -webkit-overflow-scrolling: touch;
}

.operation-bubble .multi-text-input::placeholder {
  color: rgba(74, 88, 71, 0.46);
}

.operation-bubble .multi-text-input:focus {
  background: rgba(255, 255, 255, 0.54);
  border-color: rgba(255, 255, 255, 0.78);
}

@keyframes textBubbleIn {
  from {
    opacity: 0;
    transform: translate(var(--text-bubble-x), var(--text-bubble-y-start)) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(var(--text-bubble-x), var(--text-bubble-y)) scale(1);
  }
}

@keyframes textBubbleOut {
  from {
    opacity: 1;
    transform: translate(var(--text-bubble-x), var(--text-bubble-y)) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(var(--text-bubble-x), var(--text-bubble-y-start)) scale(0.94);
  }
}

.heatmap {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.heat-cell {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #eee;
}

.level-1 { background: #c7f9cc; }
.level-2 { background: #80ed99; }
.level-3 { background: #38a3a5; }

/* ======================================
   登录页面样式
   ====================================== */

.login-page {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url("../images/erduo.jpg") repeat fixed center;
  background-size: cover;
  padding: 20px;
}

.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.3), transparent 42%, rgba(255,255,255,0.1)),
    radial-gradient(circle at 18% 8%, rgba(255,255,255,0.3), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(150, 190, 170, 0.5), transparent 38%);
  opacity: 0.9;
  z-index: -1;
}

.login-container {
  width: 100%;
  max-width: 360px;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  padding: 40px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15);
  text-align: center;
  animation: loginSlideUp 0.6s ease-out;
}

@keyframes loginSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-logo {
  font-size: 56px;
  margin-bottom: 12px;
  animation: loginBounce 2s ease-in-out infinite;
}

@keyframes loginBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--atm-text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--atm-text-soft);
  margin-bottom: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-input-group {
  text-align: left;
}

.login-input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--atm-text);
  margin-bottom: 6px;
  padding-left: 4px;
}

.login-input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  color: var(--atm-text);
  outline: none;
  transition: all 0.3s ease;
}

.login-input-group input::placeholder {
  color: rgba(48, 73, 58, 0.4);
}

.login-input-group input:focus {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(82, 183, 136, 0.6);
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.15);
}

.login-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: rgba(82, 183, 136, 0.85);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 4px;
}

.login-btn:hover {
  background: rgba(82, 183, 136, 1);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(82, 183, 136, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn.register {
  display: none;
  background: rgba(255, 182, 193, 0.85);
}

.login-btn.register:hover {
  background: rgba(255, 182, 193, 1);
  box-shadow: 0 8px 24px rgba(255, 182, 193, 0.3);
}

.login-btn.google {
  background: rgba(255, 255, 255, 0.6);
  color: var(--atm-text);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 0;
}

.login-btn.google:hover {
  background: rgba(255, 255, 255, 0.8);
}

.login-icon {
  font-size: 16px;
}

.login-toggle {
  font-size: 12px;
  color: var(--atm-text-soft);
  margin-top: 4px;
}

.login-toggle a {
  color: rgba(82, 183, 136, 0.9);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}

.login-toggle a:hover {
  color: rgba(82, 183, 136, 1);
  text-decoration: underline;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--atm-text-soft);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
}

/* 登录状态隐藏 */
body.is-logged-in .login-page {
  display: none;
}

/* 用户信息栏已隐藏 */
.user-bar {
  display: none !important;
}

/* ======================================
   自定义弹窗（Toast）样式
   ====================================== */

.custom-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 36px;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 200px;
  max-width: 320px;
  text-align: center;
}

.custom-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.toast-icon {
  font-size: 40px;
  line-height: 1;
  animation: toastBounce 0.5s ease-out;
}

@keyframes toastBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.toast-message {
  font-size: 14px;
  font-weight: 600;
  color: var(--atm-text);
  line-height: 1.5;
}

/* 成功弹窗 */
.custom-toast.success {
  background: rgba(200, 240, 220, 0.6);
  border-color: rgba(82, 183, 136, 0.3);
}

.custom-toast.success .toast-icon {
  color: #52B788;
}

/* 错误弹窗 */
.custom-toast.error {
  background: rgba(255, 220, 220, 0.6);
  border-color: rgba(255, 107, 107, 0.3);
}

.custom-toast.error .toast-icon {
  color: #FF6B6B;
}

/* 警告弹窗 */
.custom-toast.warning {
  background: rgba(255, 240, 200, 0.6);
  border-color: rgba(255, 193, 7, 0.3);
}

.custom-toast.warning .toast-icon {
  color: #FFC107;
}

/* 弹窗遮罩层 */
.toast-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.toast-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
