/* ==========================================
   终极防御：强行禁止浏览器的自动字体放大
   ========================================== */
html, body {
  -webkit-text-size-adjust: 100% !important;
  -moz-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  max-height: 100000px; /* 关键 hack：破解部分安卓浏览器的文字重排算法 */
}

* {
  -webkit-text-size-adjust: none !important;
  text-size-adjust: none !important;
}

:root {
  --font-size-sm: 24px;
  --font-size-base: 28px;
  --font-size-lg: 32px;
  --font-size-xl: 40px;
  --font-size-2xl: 48px;
  --line-height: 1.8;
  
  /* 🌟 全新温暖色调设计变量 */
  --color-bg: #f9f6f0;        /* 暖米色主背景 */
  --color-surface: #ffffff;   /* 纯白卡片背景 */
  --color-text: #3e3832;      /* 深暖褐主文字 */
  --color-text-light: #8b8276;/* 灰褐辅助文字 */
  
  --color-primary: #d84315;   /* 品牌主色：暖赤陶红/橘 */
  --color-primary-light: #fbe9e7; /* 浅橘色背景（用于高亮） */
  
  --color-success: #2e7d32;   /* 保留：完成绿 */
  --color-danger: #c62828;    /* 保留：删除红 */
  --color-border: #e6dfd3;    /* 浅暖咖边框 */
  --color-shadow: rgba(62, 56, 50, 0.06); /* 温暖轻柔的阴影 */
  
  --radius: 12px;
  --ui-sp-sm: 12px;
  --ui-sp-md: 16px;
  --ui-sp-lg: 24px;
  --ui-btn-h: 52px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--font-size-base) !important; 
  line-height: var(--line-height);
  letter-spacing: 0.02em;
  color: var(--color-text);
  background: var(--color-bg);
  padding-bottom: 80px; 
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--ui-sp-md) 12px 40px; 
}

/* ==========================================
   卡片、区块统一阴影与圆角
   ========================================== */
.form-card, .settings-section, .list-section, .today-reminder-item, .journal-card, .yiji-compact {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px var(--color-shadow);
  padding: var(--ui-sp-md);
  margin-bottom: var(--ui-sp-md);
}

/* ==========================================
   底部极简文字导航
   ========================================== */
.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  display: flex !important;
  background: var(--color-surface) !important;
  border-top: 1px solid var(--color-border) !important;
  box-shadow: 0 -2px 10px var(--color-shadow);
  z-index: 9999 !important; 
  padding: 0 !important;
  margin: 0 !important;
  height: var(--ui-btn-h, 50px) !important; 
}

.bottom-nav a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg, 24px);
  color: var(--color-text-light);
  text-decoration: none;
  white-space: nowrap;
  padding: 0 !important;
}

.bottom-nav a.active {
  color: var(--color-primary);
  font-weight: bold;
  background: var(--color-primary-light);
}

/* ==========================================
   核心间距与按钮缩放（挂载变量）
   ========================================== */
.save-btn, .action-btn, .journal-btn, .chip, .meta-btn, .settings-action-btn, .picker-btn, .today-reminder-done {
  min-height: var(--ui-btn-h);
  padding: var(--ui-sp-sm) var(--ui-sp-md);
}

/* 输入框基础样式（暖化） */
.form-textarea, .form-date, .form-time, .form-number, .note-modal-input {
  padding: var(--ui-sp-sm) var(--ui-sp-md);
  font-size: var(--font-size-base);
  background: #fdfcfb;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 8px;
}
.form-textarea:focus, .form-date:focus, .form-time:focus, .form-number:focus, .note-modal-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
}

/* ==========================================
   首页日期区
   ========================================== */
.today-header {
  text-align: center;
  margin-bottom: var(--ui-sp-lg);
}

.today-year-month {
  font-size: 32px;
  color: var(--color-text-light);
  font-weight: 500;
  margin-bottom: 8px;
}

.today-day {
  font-size: 120px;
  font-weight: bold;
  color: var(--color-primary);
  line-height: 1;
  margin: 8px 0 12px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* 星期状态行容器（改成行内弹性盒，便于加背景） */
.weekday-status-row {
  display: inline-flex; 
  align-items: center;
  justify-content: center;
  gap: 12px; /* 稍微缩小一点间距，让胶囊更紧凑 */
  margin-top: 4px;
  padding: 4px 20px; /* 上下留白小，左右留白大，形成药丸状 */
  border-radius: 40px; /* 胶囊圆角 */
  transition: background-color 0.3s ease;
}

/* 休息日（周末或法定节假日）的专属样式 */
.weekday-status-row.is-rest-day {
  background-color: #e8f5e9; /* 与月历页一致的淡绿色 */
}

/* 休息日时，文字也变成深绿色，提高对比度 */
.weekday-status-row.is-rest-day .today-weekday {
  color: #2e7d32; 
}

.today-weekday {
  font-size: 32px;
  color: var(--color-text);
  font-weight: 500;
}

/* 状态圆点基础样式 */
.status-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  opacity: 0; /* 默认隐藏，但保留占位空间 */
  visibility: hidden;
  transition: opacity 0.3s;
}

/* 有数据时显示，并开启呼吸灯 */
.status-dot.show {
  opacity: 1;
  visibility: visible;
  animation: breathe 2s infinite ease-in-out;
}

/* 预定红点 */
.dot-plan {
  background-color: #c62828;
  box-shadow: 0 0 8px rgba(198, 40, 40, 0.6);
}

/* 日志蓝点 */
.dot-log {
  background-color: #1976d2;
  box-shadow: 0 0 8px rgba(25, 118, 210, 0.6);
}

/* 呼吸灯动画 */
@keyframes breathe {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.today-lunar {
  font-size: 28px;
  color: var(--color-primary);
  margin-top: 8px;
}

.today-solar-term {
  font-size: clamp(18px, 5vw, 22px);
  color: var(--color-text-light);
  margin-top: 10px;
  white-space: nowrap;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.today-festival {
  font-size: clamp(20px, 5.5vw, 24px);
  color: var(--color-primary);
  font-weight: bold;
  margin-top: 6px;
  white-space: nowrap;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

/* ==========================================
   宜忌紧凑块
   ========================================== */
.yiji-compact {
  cursor: pointer;
  transition: background 0.2s;
  background: #fffdfa; /* 极浅的暖白 */
}
.yiji-compact:active {
  background: #f5eee6;
}

.yiji-row {
  display: flex;
  align-items: flex-start;
  font-size: 24px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.yiji-row:last-child {
  margin-bottom: 0;
}

.yiji-label {
  display: inline-block;
  min-width: 44px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  color: #fff;
  font-weight: bold;
  border-radius: 6px;
  margin-right: 12px;
  flex-shrink: 0;
  font-size: 22px;
}

.yiji-label-good { background: #2e7d32; }
.yiji-label-bad { background: #c62828; }

.yiji-content {
  flex: 1;
  min-width: 0;
  color: var(--color-text);
  padding-top: 3px;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yiji-compact.expanded .yiji-content {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* ==========================================
   当天预定 / 日记
   ========================================== */
.section-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--color-text);
  margin-bottom: var(--ui-sp-md);
}

.today-reminder-item {
  display: flex;
  flex-direction: column;
  gap: var(--ui-sp-sm);
  transition: opacity 0.3s;
}

.today-reminder-item.expired-item { 
  background: #fcfbfa; 
  opacity: 0.8;
}
.today-reminder-item.expired-item .today-reminder-title { 
  color: var(--color-text-light); 
  text-decoration: line-through;
}

.today-reminder-main { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.today-reminder-line1 { display: flex; align-items: center; gap: 10px; }
.today-reminder-title { font-size: 28px; font-weight: bold; color: var(--color-text); word-break: break-all; line-height: 1.4; }

.today-reminder-actions { display: flex; gap: 12px; width: 100%; margin-top: 4px; }

.action-btn {
  flex: 1;
  font-family: inherit;
  font-size: 22px;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.action-btn:active { opacity: 0.8; }
.action-complete { background: #2e7d32; color: #fff; }
.action-edit { background: #fff; color: #1976d2; border-color: #90caf9; }
.action-delete { background: #fff; color: #c62828; border-color: #ef9a9a; }

/* 标签色保留 */
.task-badge { border-radius: 6px; padding: 2px 10px; font-size: 20px; }
.today-badge { background: #e53935; color: #fff; }
.expired-badge { background: #bcaaa4; color: #fff; }
.upcoming-badge { background: #fff3e0; color: #e65100; border: 1px solid #ffb74d; }

/* 今日日志窗口 */
.today-journal { margin-top: 32px; margin-bottom: 24px; }
.journal-content { font-size: 24px; line-height: 1.6; color: var(--color-text); min-height: 80px; white-space: pre-wrap; word-break: break-all; }
.journal-empty { text-align: center; color: var(--color-text-light); font-size: 22px; padding: 20px 0; }
.journal-footer { font-size: 18px; color: var(--color-text-light); margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--color-border); text-align: right; }
.journal-actions { display: flex; gap: 12px; margin-top: 16px; }

.journal-btn {
  flex: 1; font-family: inherit; font-size: 22px; font-weight: bold;
  border-radius: 10px; cursor: pointer; border: 1px solid var(--color-border);
  background: #fdfcfb; color: var(--color-text);
}
.journal-btn:active:not(:disabled) { background: #f5eee6; }
.journal-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.journal-btn-add { color: #1976d2; border-color: #90caf9; background: #fff; }

.journal-line { margin-bottom: 8px; line-height: 1.5; color: var(--color-text); }
.journal-num { font-weight: bold; color: var(--color-primary); }
.journal-time { color: var(--color-text-light); font-size: 20px; margin-left: 4px; }

/* 列表内容折叠 */
.collapsible-content {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  position: relative;
}
.collapsible-content.is-expanded { display: block; -webkit-line-clamp: unset; overflow: visible; }

/* ==========================================
   弹窗与表单控件
   ========================================== */
.time-row { display: flex; align-items: center; flex-wrap: wrap; }
.check-label { display: inline-flex; align-items: center; cursor: pointer; }
.form-time:focus { border-color: #1976d2; }

/* 遮罩层变暖黑 */
.note-modal-overlay {
  position: fixed; inset: 0; background: rgba(40, 35, 30, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px;
}
.note-modal-overlay[hidden], .note-modal-overlay[style*="display: none"] { display: none !important; }

.note-modal { 
  background: var(--color-bg); 
  border-radius: 16px; 
  padding: 24px; 
  width: 100%; 
  max-width: 560px; 
  max-height: 90vh; 
  overflow-y: auto; 
  box-sizing: border-box; 
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.note-modal-title { font-size: 30px; font-weight: bold; color: var(--color-text); margin-bottom: 20px; text-align: center; line-height: 1.4; word-break: break-all; }
.note-modal-label { font-size: 24px; color: var(--color-text-light); margin-bottom: 12px; }
.note-modal-input { width: 100%; font-family: inherit; font-size: 26px; line-height: 1.5; box-sizing: border-box; resize: vertical; min-height: 100px; -webkit-appearance: none; }
.note-modal-actions { display: flex; gap: 12px; margin-top: 24px; }
.note-modal-btn { flex: 1; font-family: inherit; font-size: 28px; padding: 20px; border-radius: 12px; cursor: pointer; min-height: 60px; border: none; font-weight: bold;}
.note-modal-skip { background: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.note-modal-skip:active { background: #f5eee6; }
.note-modal-save { background: var(--color-primary); color: #fff; }
.note-modal-save:active { background: #bf360c; }

.site-footer { text-align: center; padding: var(--ui-sp-md); font-size: 14px; color: var(--color-text-light); line-height: 1.6; }
.site-footer a { color: var(--color-text-light); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.date-status-bar { text-align: center; margin-top: 10px; margin-bottom: 4px; min-height: 36px; }
.status-text { font-size: 24px; color: var(--color-text-light); font-weight: bold; }
.btn-back-today { font-size: 22px; color: var(--color-primary); background: none; border: none; padding: 4px 8px; margin-left: 8px; text-decoration: underline; cursor: pointer; }

.today-day-wrap { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 4px 0; }
.day-nav-btn { font-size: 32px; font-weight: bold; color: var(--color-text-light); background: #efeae1; border: none; border-radius: 50%; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.day-nav-btn:active { background: #e6dfd3; color: var(--color-primary); }
.today-day.not-today { color: var(--color-text-light); }

/* ==========================================
   全局顶部导航
   ========================================== */
.top-nav-bar {
  position: relative; 
  padding: 20px 16px 14px;
  background: transparent;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 新增：允许大字体下子元素自动折行 */
  flex-wrap: wrap; 
  gap: 8px;
  min-height: 60px; 
}

.brand-name {
  font-size: 34px;
  font-weight: bold;
  color: var(--color-primary, #d84315);
  letter-spacing: 2px;
  line-height: 1.2;
  white-space: nowrap; 
}

.help-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--color-text-light, #8b8276);
  text-decoration: none;
  border: 2px dashed var(--color-border, #e6dfd3);
  padding: 4px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.help-btn:active {
  background: var(--color-primary-light, #fbe9e7);
  color: var(--color-primary, #d84315);
  border-color: var(--color-primary, #d84315);
}

@media (max-width: 400px) {
  .top-nav-bar { padding: 16px 12px 10px; }
  .brand-name { font-size: 28px; }
  .help-btn { right: 12px; font-size: 15px; padding: 2px 8px; }
}

.top-nav-bar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: radial-gradient(ellipse at center, rgba(216, 67, 21, 0.4) 0%, rgba(216, 67, 21, 0) 70%);
}

@media (max-width: 400px) {
  .top-nav-bar::after {
    left: 5%;
    right: 5%;
    background: radial-gradient(ellipse at center, rgba(216, 67, 21, 0.3) 0%, rgba(216, 67, 21, 0) 80%);
  }
}