/* PieBoard - 简洁清爽版 */
/* 设计:白底 + 单色强调 + 等宽数字 */
/* 移动端适配：排满整个屏幕，元素适当放大 */

:root {
  --bg: #F8F8FA;
  --card: #FFFFFF;
  --ink: #1A1A2E;
  --ink-2: #5A5A6E;
  --ink-3: #A8A8B8;
  --line: #ECECF0;
  --accent: #FF6B35;
  --accent-soft: #FFE9DD;
  --shadow: 0 2px 12px rgba(26, 26, 46, 0.06);
  --shadow-lg: 0 8px 28px rgba(26, 26, 46, 0.10);
  --radius: 12px;
  --radius-lg: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: -apple-system, "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum';
}

.phone-frame {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* 主页面控件需高于固定 AI 浮窗,避免滚动后无法点击 */
.phone-frame button,
.phone-frame input,
.phone-frame select {
  position: relative;
  z-index: 100;
}

/* 状态栏 */
.status-bar {
  height: 44px;
  background: var(--bg);
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top, 8px);
}

/* 周进度条:简洁 */
.week-bar {
  background: var(--card);
  margin: 12px 20px 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  flex-shrink: 0;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.week-bar:hover {
  box-shadow: var(--shadow);
}

.week-bar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.week-bar-label {
  font-size: 15px;
  color: var(--ink-2);
  font-weight: 500;
}

.week-bar-value {
  margin-left: auto;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 16px;
  color: var(--ink);
  font-weight: 600;
  font-feature-settings: 'tnum';
}

.week-bar-track {
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.week-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 日期切换器 */
.date-switcher {
  background: transparent;
  padding: 20px 24px 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.btn-icon {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  transition: all 0.15s;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.date-text {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.weekday-text {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 3px;
}

.btn-text {
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-2);
}

.btn-text:disabled {
  color: var(--ink-3);
  cursor: not-allowed;
}

/* 饼图区 - 响应式 */
.pie-section {
  background: var(--card);
  margin: 12px 20px;
  padding: 24px 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

#pie-canvas {
  display: block;
  cursor: pointer;
  width: 100%;
  max-width: 320px;
  height: auto;
  aspect-ratio: 1;
}

/* 图例 */
.legend {
  padding: 16px 24px 8px;
  display: flex;
  flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 100px;
  color: var(--ink-2);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-value {
  color: var(--ink-3);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  margin-left: 3px;
}

/* 录入表单 */
.entry-form {
  margin: 12px 20px;
  background: var(--card);
  padding: 14px;
  display: flex;
  gap: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.entry-form:focus-within {
  border-color: var(--accent);
}

.form-hint {
  padding: 0 24px 6px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
  flex-shrink: 0;
}

/* 精力值快捷选择条(滑块 + 动态标签) */
.energy-bar {
  margin: 0 20px 4px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.energy-bar-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.energy-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}
.energy-current {
  flex: 1;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}
.energy-current-text { color: inherit; }
.energy-current.empty .energy-current-text { color: var(--ink-3); font-weight: 500; }
.energy-current[data-tier="1"], .energy-current[data-tier="2"] { color: #5B7FA0; }
.energy-current[data-tier="4"], .energy-current[data-tier="5"] { color: #D08040; }
.energy-clear {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-3);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.energy-clear:hover { color: var(--accent); border-color: var(--accent); }
.energy-slider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  outline: none;
  /* 低-蓝 / 中-灰 / 高-橙 渐变 */
  background: linear-gradient(to right,
    #5B7FA0 0%,
    #8898AA 25%,
    #A8A8A8 50%,
    #C89878 75%,
    #D08040 100%);
  margin: 4px 0;
}
.energy-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.1s;
}
.energy-slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
.energy-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.energy-slider.disabled { opacity: 0.45; }

.select-category {
  flex: 2;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
}

.input-duration {
  flex: 2;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 16px;
  color: var(--ink);
}

.input-duration:focus {
  outline: none;
}

.btn-add {
  width: 44px;
  height: 40px;
  border: none;
  background: var(--accent);
  color: #FFF;
  border-radius: 8px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-add:active {
  transform: scale(0.92);
}

/* 条目列表 - 展开版 */
.entry-list {
  flex: 1;
  padding: 12px 20px;
  overflow-y: visible;
  background: transparent;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--card);
  border-radius: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 72px;
}

.entry-row:active {
  transform: scale(0.98);
  background: var(--bg);
}

.entry-emoji {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 8px;
}

.entry-cat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;  // 防止 flex 挤压
}

.entry-cat-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.entry-time {
  font-size: 11px;
  color: var(--ink-3);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.entry-duration {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-delete {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-delete:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* 底部按钮 */
.bottom-buttons {
  padding: 12px 20px;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.btn-secondary {
  flex: 1;
  height: 56px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  font-size: 16px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:active {
  background: var(--bg);
}

.btn-secondary:disabled {
  color: var(--ink-3);
  cursor: not-allowed;
}

.btn-sync-main {
  background: var(--accent);
  color: #FFF;
  border-color: var(--accent);
}

/* AI 总结按钮 */
.ai-bar {
  padding: 0 20px 12px;
  flex-shrink: 0;
}

.btn-ai {
  width: 100%;
  height: 56px;
  border: none;
  background: var(--ink);
  color: #FFF;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-ai:hover { opacity: 0.85; }
.btn-ai:disabled { background: var(--ink-3); cursor: not-allowed; }

/* 日记卡片 */
.diary-card {
  margin: 8px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  flex-shrink: 0;
}

.diary-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.diary-icon { font-size: 18px; }
.diary-title { font-size: 14px; font-weight: 600; color: var(--ink); flex: 1; }
.diary-status { font-size: 11px; color: var(--ink-3); margin-right: 8px; }
.diary-status.has-content { color: var(--accent); }

.diary-edit-btn {
  height: 28px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.diary-edit-btn:hover { background: var(--accent); color: #FFF; }
.diary-edit-btn:active { transform: scale(0.95); }

.diary-preview {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
  max-height: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
}

.diary-preview.empty { color: var(--ink-3); font-style: italic; }

/* 日记弹窗 */
.diary-modal-content { height: auto; max-height: 85vh; }

.diary-body { padding: 16px; }

.diary-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
  font-family: 'JetBrains Mono', monospace;
}

.diary-textarea {
  width: 100%;
  min-height: 280px;
  max-height: 50vh;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.7;
  font-family: inherit;
  color: var(--ink);
  resize: vertical;
  background: var(--bg);
}

.diary-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.diary-stats {
  text-align: right;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
}

.diary-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

.diary-actions button {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.diary-actions .btn-secondary {
  background: var(--bg);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

/* 桌面小组件 */
.widget-preview {
  margin: 8px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  flex-shrink: 0;
}

.widget-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.widget-header {
  display: none;
}

.widget-ring {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.widget-center {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.widget-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

.widget-unit {
  font-size: 9px;
  color: var(--ink-3);
  margin-top: 2px;
}

.widget-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.widget-top-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

.widget-top-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.widget-top-name {
  flex: 1;
}

.widget-top-val {
  color: var(--ink-3);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}

/* 调试栏 */
.debug-bar {
  background: var(--bg);
  padding: 6px 16px;
  display: flex;
  gap: 4px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.btn-debug {
  flex: 1;
  height: 28px;
  border: 1px dashed var(--ink-3);
  background: transparent;
  border-radius: 4px;
  font-size: 10px;
  color: var(--ink-2);
  cursor: pointer;
}

/* ===== 弹窗(统一) ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.btn-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 16px;
  color: var(--ink-2);
  cursor: pointer;
}

/* 周详情弹窗 */
.week-modal-content { padding-bottom: 12px; }

.week-summary {
  text-align: center;
  padding: 20px 16px;
  background: var(--bg);
  margin: 12px 16px;
  border-radius: var(--radius);
}

.week-summary-total {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

.week-summary-label {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 4px;
}

.week-summary-percent {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 6px;
}

.week-days {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.week-day-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 12px;
}

.week-day-row.today {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
}

.week-day-label {
  flex: 0 0 70px;
  color: var(--ink-2);
  font-weight: 500;
}

.week-day-row.today .week-day-label {
  color: var(--accent);
  font-weight: 600;
}

.week-day-track {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.week-day-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.week-day-value {
  flex: 0 0 50px;
  text-align: right;
  color: var(--ink-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.week-footer {
  padding: 8px 16px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
}

/* 同步弹窗 */
.sync-modal-content { padding-bottom: 12px; }

.sync-body { padding: 12px 16px; }

.sync-info { text-align: center; line-height: 1.6; }

.sync-tabs {
  display: flex;
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.sync-tab {
  flex: 1;
  height: 36px;
  border: none;
  background: var(--card);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  border-right: 1px solid var(--line);
}

.sync-tab:last-child { border-right: none; }

.sync-tab.active {
  background: var(--accent);
  color: #FFF;
  font-weight: 600;
}

.sync-tab-panel { display: none; padding: 8px 0; }
.sync-tab-panel.active { display: block; }

.qr-display {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  padding: 16px;
  background: #FFF;
  border-radius: 12px;
  border: 1px dashed var(--ink-3);
}

#my-qr-canvas {
  max-width: 100%;
  height: auto !important;
}

.sync-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  padding: 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  margin: 12px 0;
  word-break: break-all;
}

.btn-copy {
  width: 100%;
  height: 40px;
  border: none;
  background: var(--ink);
  color: #FFF;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-block { width: 100%; margin-top: 8px; }

.sync-code-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  margin: 12px 0;
}

.sync-divider {
  text-align: center;
  margin: 16px 0 8px;
  color: var(--ink-3);
  font-size: 11px;
  position: relative;
}

.sync-divider::before,
.sync-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--line);
}

.sync-divider::before { left: 0; }
.sync-divider::after { right: 0; }

/* 扫码弹窗 */
.scan-modal-content { height: auto; max-height: 85vh; }

.scan-body { padding: 16px 0; text-align: center; }

.scan-frame {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 1;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

#scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.scan-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 4px solid var(--accent);
}

.scan-corner.tl { top: 20%; left: 20%; border-right: none; border-bottom: none; border-top-left-radius: 8px; }
.scan-corner.tr { top: 20%; right: 20%; border-left: none; border-bottom: none; border-top-right-radius: 8px; }
.scan-corner.bl { bottom: 20%; left: 20%; border-right: none; border-top: none; border-bottom-left-radius: 8px; }
.scan-corner.br { bottom: 20%; right: 20%; border-left: none; border-top: none; border-bottom-right-radius: 8px; }

.scan-hint { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.scan-status { margin-top: 8px; font-size: 12px; color: var(--ink-2); min-height: 20px; }

/* 分享菜单 */
.share-modal-content { height: auto; max-height: 80vh; }
.share-menu-body { padding: 16px 16px 8px; }
.share-info { text-align: center; line-height: 1.6; }

#share-preview {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* 解析/AI 弹窗 */
.parse-modal-content { height: auto; padding-bottom: 16px; }
.parse-body { padding: 12px 16px; font-size: 14px; }
.parse-raw { background: var(--bg); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 12px; color: var(--ink-3); font-style: italic; }
.parse-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: var(--bg); border-radius: 6px; margin-bottom: 6px; }
.parse-label { color: var(--ink-3); font-size: 13px; }
.parse-value { color: var(--ink); font-weight: 600; font-size: 14px; }
.parse-cat-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* parse-modal 内的精力选择(滑块版) */
.parse-value-energy {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  max-width: 220px;
}
.energy-mini-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.energy-mini-header .energy-current { text-align: left; }
.energy-clear-mini {
  width: 22px;
  height: 22px;
  font-size: 14px;
}
.energy-slider-mini {
  margin: 0;
}
.parse-actions { display: flex; gap: 8px; padding: 0 16px 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.parse-actions button { flex: 1; height: 40px; border-radius: 8px; font-size: 13px; cursor: pointer; }

.parse-confirm, .btn-primary { background: var(--accent); color: #FFF; border: none; font-weight: 600; }
.parse-cancel, .btn-modal-secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }

/* AI 弹窗 */
.ai-modal-content { height: auto; max-height: 70vh; }
.ai-body { padding: 12px 16px; max-height: 50vh; overflow-y: auto; }
.ai-loading { text-align: center; padding: 30px 0; color: var(--ink-3); }
.ai-loading::after { content: '...'; animation: dots 1.5s infinite; }
@keyframes dots { 0%, 20% { content: '.'; } 40% { content: '..'; } 60%, 100% { content: '...'; } }

.ai-section { margin-bottom: 14px; }
.ai-section-title { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.ai-section-content { font-size: 13px; color: var(--ink); }
.ai-suggestion { background: var(--bg); padding: 10px 12px; margin-bottom: 6px; border-radius: 6px; font-size: 13px; color: var(--ink); border-left: 3px solid var(--accent); }

.ai-tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  margin-right: 4px;
  margin-bottom: 4px;
  font-weight: 500;
}

.ai-footer { border-top: 1px solid var(--line); padding: 10px 16px; display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }
.ai-model-badge { background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 100px; font-weight: 600; }

/* 分类管理弹窗 */
.category-list { padding: 8px 16px; max-height: 50vh; overflow-y: auto; }
.cat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.cat-color-dot { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; }
.cat-name-input {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  font-size: 14px;
  color: var(--ink);
}
.cat-name-input:focus { border-color: var(--line); background: var(--card); outline: none; }
.cat-name-input:disabled { color: var(--ink-2); }
.cat-color-options { display: flex; gap: 4px; }
.cat-color-option { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.cat-color-option.selected { border-color: var(--ink); }
.btn-cat-delete { width: 28px; height: 28px; border: none; background: var(--accent-soft); color: var(--accent); border-radius: 50%; font-size: 12px; cursor: pointer; }

.add-category-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  align-items: center;
}
.add-category-row input {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}
.color-picker { display: flex; gap: 4px; }
.color-picker-dot { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-picker-dot.selected { border-color: var(--ink); }

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #FFF;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 13px;
  z-index: 200;
  pointer-events: none;
  animation: fadeInOut 1.8s ease-in-out;
  box-shadow: var(--shadow-lg);
  max-width: 90%;
  text-align: center;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, 20px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* 本周条形图 */
.week-bars {
  margin: 8px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  flex-shrink: 0;
}

.week-bars-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.week-bars-icon { font-size: 16px; }
.week-bars-title { font-size: 13px; font-weight: 600; color: var(--ink); flex: 1; }
.week-bars-toggle {
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
}

#week-bars-canvas {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
}

.week-bars-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--ink-3);
  justify-content: center;
}

.week-bars-legend .legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* ==================== 热力图 ==================== */
:root {
  --hm-0: #ECECF0;
  --hm-1: rgba(255, 107, 53, 0.15);
  --hm-2: rgba(255, 107, 53, 0.35);
  --hm-3: rgba(255, 107, 53, 0.60);
  --hm-4: #FF6B35;
}

.heatmap-section {
  background: var(--card);
  margin: 12px 20px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.heatmap-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.heatmap-icon {
  font-size: 20px;
}

.heatmap-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.heatmap-grid-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.heatmap-grid {
  display: grid;
  gap: 4px;
  min-width: 100%;
}

/* 月份行 */
.heatmap-months {
  grid-column: 2 / -1;
  position: relative;
  height: 20px;
}

.heatmap-month-label {
  position: absolute;
  top: 0;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* 星期标签 */
.heatmap-weekday {
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
  padding-right: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
  min-width: 32px;
}

/* 色块 */
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  position: relative;
  min-height: 12px;
  min-width: 12px;
}

.heatmap-cell:hover {
  opacity: 0.8;
  transform: scale(1.2);
  z-index: 2;
}

.heatmap-cell[data-level="0"] { background: var(--hm-0); }
.heatmap-cell[data-level="1"] { background: var(--hm-1); }
.heatmap-cell[data-level="2"] { background: var(--hm-2); }
.heatmap-cell[data-level="3"] { background: var(--hm-3); }
.heatmap-cell[data-level="4"] { background: var(--hm-4); }

/* tooltip */
.heatmap-cell::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.heatmap-cell:hover::after {
  opacity: 1;
}

/* 图例 */
.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
}

.heatmap-legend-cell {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.heatmap-legend-label {
  margin: 0 4px;
}

/* 统计卡片 */
.heatmap-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.heatmap-stat {
  text-align: center;
}

.heatmap-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-feature-settings: 'tnum';
}

.heatmap-stat-label {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 3px;
}

/* 调试栏 */
.btn-debug {
  flex: 1;
  height: 28px;
  border: 1px dashed var(--ink-3);
  background: transparent;
  border-radius: 4px;
  font-size: 10px;
  color: var(--ink-2);
  cursor: pointer;
}

/* 热力图展开按钮 */
.heatmap-expand-btn {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--accent-soft);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.heatmap-expand-btn:hover {
  background: var(--accent);
  color: white;
  transform: scale(1.1);
}

.heatmap-expand-btn .expand-icon {
  font-size: 14px;
  line-height: 1;
}

/* 热力图全屏模式（覆盖整个手机屏幕，竖屏横屏都能用） */
.heatmap-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  z-index: 9999;
  display: none;
  flex-direction: column;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.heatmap-fullscreen.active {
  display: flex;
}

.heatmap-fullscreen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
  flex-shrink: 0;
}

.heatmap-fullscreen-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.heatmap-fullscreen-close {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--card);
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  color: var(--ink-2);
}

.heatmap-fullscreen-close:hover,
.heatmap-fullscreen-close:active {
  background: var(--accent);
  color: white;
  transform: scale(1.1);
}

.heatmap-fullscreen-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  min-height: 0;
}

.heatmap-fullscreen-grid-wrap {
  flex: 1;
  overflow: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.heatmap-fullscreen-grid {
  display: grid;
  gap: 6px;
  min-width: 100%;
  width: 100%;
}

/* 全屏模式下的单元格大小 */
.heatmap-fullscreen-grid .heatmap-cell {
  border-radius: 3px;
  min-height: 18px;
}

.heatmap-fullscreen-grid.vertical .heatmap-cell {
  min-height: 22px;
  min-width: 22px;
  max-width: 36px;
  max-height: 36px;
  width: 100%;
  aspect-ratio: 1;
}

.heatmap-fullscreen-grid.vertical {
  display: grid !important;
  grid-template-columns: 56px repeat(7, 1fr) !important;
  gap: 4px !important;
  width: 100% !important;
}

.heatmap-fullscreen-grid .heatmap-cell.is-today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.heatmap-fullscreen-grid .heatmap-row-label {
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  padding-right: 6px;
  font-weight: 600;
}

.heatmap-fullscreen-grid .heatmap-weekday-row {
  display: flex;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  height: 18px;
  align-items: center;
  gap: 4px;
  padding-left: 4px;
}

.heatmap-fullscreen-grid .heatmap-weekday-row span {
  flex: 1;
  text-align: center;
}

.heatmap-fullscreen-grid .heatmap-weekday {
  font-size: 11px;
  min-width: 20px;
  padding-right: 4px;
}

.heatmap-fullscreen-grid .heatmap-month-label {
  font-size: 11px;
}

/* 纵向布局（手机竖屏使用） */
.heatmap-fullscreen-grid.vertical {
  /* 在 JS 中会重新设置 grid-template-columns */
}

.heatmap-fullscreen-grid.vertical .heatmap-months {
  /* 月份标签放在左侧 */
  grid-column: auto;
  position: relative;
  height: auto;
  min-width: 36px;
}

.heatmap-fullscreen-grid.vertical .heatmap-month-label {
  position: relative;
  display: block;
  height: auto;
  font-size: 12px;
  text-align: center;
  padding: 6px 4px;
  background: var(--bg);
  border-radius: 4px;
  margin-bottom: 4px;
  left: auto !important;
}

.heatmap-fullscreen-grid.vertical .heatmap-weekday {
  min-width: 36px;
  padding-right: 8px;
  font-weight: 600;
}

.heatmap-fullscreen-grid.vertical .heatmap-cell {
  min-height: 24px;
}

.heatmap-fullscreen-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 12px;
}

.heatmap-fullscreen-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-3);
}

.heatmap-fullscreen-stats {
  display: flex;
  gap: 20px;
}

.heatmap-fullscreen-stats .heatmap-stat {
  text-align: center;
}

.heatmap-fullscreen-stats .heatmap-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.heatmap-fullscreen-stats .heatmap-stat-label {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-3);
  font-size: 14px;
}

/* ==================== 名人对照卡片 ==================== */
/* 主页面小入口卡 */
.cards-shortcut {
  background: linear-gradient(135deg, #fff8f0, #ffe9dd);
  margin: 12px 20px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--accent-soft);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.cards-shortcut:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-lg);
}

.cards-shortcut-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.cards-shortcut-icon {
  font-size: 20px;
}

.cards-shortcut-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.cards-shortcut-tier {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  background: var(--card);
  padding: 4px 12px;
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--accent-soft);
}

.cards-shortcut-preview {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}

/* 卡片 Modal */
.cards-modal-content {
  max-width: 100%;
  width: 100%;
  height: 95vh;
  max-height: 95vh;
  margin: auto;
  padding: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .cards-modal-content {
    width: 720px;
    height: auto;
    max-height: 85vh;
    border-radius: var(--radius-lg);
  }
}

.cards-modal-content .modal-header {
  flex-shrink: 0;
  margin: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.cards-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
  background: #f2efe8;
  background-image:
    linear-gradient(rgba(170,160,140,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(170,160,140,.12) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* 档位切换按钮 */
.cards-tier-switcher {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
}

.tier-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 100px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #5a5a6e;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tier-btn:active {
  transform: scale(0.96);
}

.tier-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tier-btn.match::after {
  content: '✨';
  margin-left: 4px;
  font-size: 11px;
}

/* 档位说明 */
.cards-summary {
  background: #fff;
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #5a5a6e;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.cards-summary strong {
  color: #1a1a2e;
  font-weight: 700;
}

.cards-summary .badge-match {
  display: inline-block;
  background: #FFE9DD;
  color: #FF6B35;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 700;
  margin-left: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

/* 卡片网格 */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 卡片本体 */
.cc-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  position: relative;
}

.cc-card.dashed {
  border: 2px dashed #d0c8d8;
  background: #faf8fc;
}

.cc-avatar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.cc-avatar-initials {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
}

.cc-avatar-info {
  flex: 1;
  min-width: 0;
}

.cc-avatar-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.cc-avatar-en {
  font-size: 11px;
  opacity: .75;
  color: #fff;
  margin-top: 2px;
}

.cc-avatar-badge {
  font-size: 24px;
  flex-shrink: 0;
}

.cc-body {
  padding: 16px 18px 0;
}

.cc-body h4 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cc-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cc-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid currentColor;
}

.cc-timeline {
  margin-bottom: 12px;
}

.cc-time-block {
  display: flex;
  align-items: stretch;
  margin-bottom: 2px;
  min-height: 28px;
  font-size: 13px;
}

.cc-time-bar {
  width: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  border-right: 2px solid currentColor;
}

.cc-time-content {
  flex: 1;
  padding-left: 10px;
  display: flex;
  align-items: center;
  color: #5a5a5a;
  line-height: 1.4;
}

.cc-quote {
  margin: 12px -18px 0;
  padding: 14px 18px;
  font-size: 12px;
  line-height: 1.7;
  font-style: italic;
  border-left: 4px solid currentColor;
}

.cc-quote-src {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 10px;
  opacity: .7;
}

.cc-foot {
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #6a6a6a;
  border-top: 1px dashed rgba(0,0,0,.06);
  margin-top: 14px;
}

.cc-ev {
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 10px;
}

.cc-ev-a { background: #e8f5e9; color: #2e7d32; }
.cc-ev-b { background: #fff3e0; color: #e65100; }
.cc-ev-c { background: #fce4ec; color: #c62828; }
.cc-ev-d { background: #f3e5f5; color: #7b1fa2; }

/* 各档位颜色 */
.tier-4 .cc-avatar { background: linear-gradient(135deg,#5b8c7e,#7fb09a); }
.tier-4 .cc-time-bar { color: #5b8c7e; border-color: #5b8c7e; }
.tier-4 h4 { color: #5b8c7e; }
.tier-4 .cc-quote { color: #5b8c7e; background: #f4f9f7; }
.tier-4 .cc-tag { color: #5b8c7e; }

.tier-6 .cc-avatar { background: linear-gradient(135deg,#b07a4a,#d4a574); }
.tier-6 .cc-time-bar { color: #b07a4a; border-color: #b07a4a; }
.tier-6 h4 { color: #b07a4a; }
.tier-6 .cc-quote { color: #b07a4a; background: #fdf7f2; }
.tier-6 .cc-tag { color: #b07a4a; }

.tier-8 .cc-avatar { background: linear-gradient(135deg,#3d5a80,#5e82a8); }
.tier-8 .cc-time-bar { color: #3d5a80; border-color: #3d5a80; }
.tier-8 h4 { color: #3d5a80; }
.tier-8 .cc-quote { color: #3d5a80; background: #f5f7fa; }
.tier-8 .cc-tag { color: #3d5a80; }

.tier-10 .cc-avatar { background: linear-gradient(135deg,#7a6b8a,#a08fb8); }
.tier-10 .cc-time-bar { color: #7a6b8a; border-color: #7a6b8a; }
.tier-10 h4 { color: #7a6b8a; }
.tier-10 .cc-quote { color: #7a6b8a; background: #f8f6fa; }
.tier-10 .cc-tag { color: #7a6b8a; }

.tier-12 .cc-avatar { background: linear-gradient(135deg,#8b3a3a,#b85c5c); }
.tier-12 .cc-time-bar { color: #8b3a3a; border-color: #8b3a3a; }
.tier-12 h4 { color: #8b3a3a; }
.tier-12 .cc-quote { color: #8b3a3a; background: #fdf5f5; }
.tier-12 .cc-tag { color: #8b3a3a; }

.tier-13 .cc-avatar { background: linear-gradient(135deg,#4a3a5a,#6a5a7a); }
.tier-13 .cc-time-bar { color: #4a3a5a; border-color: #4a3a5a; }
.tier-13 h4 { color: #4a3a5a; }
.tier-13 .cc-quote { color: #4a3a5a; background: #f7f5fa; }

/* ==================== API 设置弹窗 ==================== */
.api-settings-modal-content {
  max-width: 460px;
  width: 94vw;
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}

.api-settings-modal-content .modal-header {
  margin: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.api-settings-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 70vh;
  -webkit-overflow-scrolling: touch;
}

.api-settings-hint {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

/* 提供商卡片 */
.api-provider-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.api-provider-card:focus-within {
  border-color: var(--accent);
}

.api-provider-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg);
  cursor: pointer;
}

.api-provider-icon { font-size: 22px; }

.api-provider-info { flex: 1; min-width: 0; }

.api-provider-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.api-provider-desc {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.api-provider-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 6px;
}

.api-provider-badge { background: #d4edda; color: #155724; }

.api-badge-fallback { background: #fff3cd; color: #856404; }

/* 开关 */
.api-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.api-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.api-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: 0.2s;
}

.api-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.api-toggle input:checked + .api-toggle-slider {
  background: var(--accent);
}

.api-toggle input:checked + .api-toggle-slider::before {
  transform: translateX(20px);
}

/* 提供商内容 */
.api-provider-body {
  padding: 0 16px 14px;
}

.api-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin-top: 10px;
  margin-bottom: 4px;
}

.api-key-row {
  display: flex;
  gap: 6px;
}

.api-key-input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  font-family: 'JetBrains Mono', monospace;
}

.api-key-input:focus {
  outline: none;
  border-color: var(--accent);
}

.api-key-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.api-key-toggle:active {
  background: var(--accent-soft);
}

.api-model-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  font-family: 'JetBrains Mono', monospace;
}

.api-model-input:focus {
  outline: none;
  border-color: var(--accent);
}

.api-settings-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.api-test-result {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.api-test-result.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.api-test-result.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.api-test-result.loading {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}
.tier-13 .cc-tag { color: #4a3a5a; }

/* ==================== 晨间打卡 + 16h 清醒额度 ==================== */
.wakeup-card {
  margin: 12px 20px 0;
  background: linear-gradient(135deg, #FFEFD5 0%, #FFD8B1 100%);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid rgba(255, 107, 53, .15);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.wakeup-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(255, 200, 100, .35), transparent 70%);
  pointer-events: none;
}

/* 未打卡状态 */
.wakeup-greeting {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.wakeup-greeting-icon {
  font-size: 36px;
  line-height: 1;
}

.wakeup-greeting-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

.wakeup-greeting-sub {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
  margin-top: -4px;
}

.wakeup-checkin-btn {
  width: 100%;
  height: 50px;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s;
  box-shadow: 0 4px 12px rgba(255, 107, 53, .25);
}

.wakeup-checkin-btn:active {
  transform: scale(0.98);
}

/* 已打卡状态 */
.wakeup-tracker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.wakeup-tracker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wakeup-tracker-time {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.wakeup-tracker-icon {
  font-size: 24px;
}

.wakeup-tracker-info {
  display: flex;
  flex-direction: column;
}

.wakeup-tracker-info-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
}

.wakeup-tracker-info-time {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

.wakeup-tracker-remaining {
  text-align: right;
  display: flex;
  flex-direction: column;
}

.wakeup-tracker-remaining-val {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.wakeup-tracker-remaining-label {
  font-size: 11px;
  color: var(--ink-3);
}

.wakeup-progress-track {
  height: 8px;
  background: rgba(255, 255, 255, .6);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}

.wakeup-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #FF9F66);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.wakeup-tracker-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 2px;
}

.wakeup-tracker-edit {
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}

.wakeup-tracker-edit:hover {
  color: var(--accent);
}

.wakeup-sleep-hint {
  font-size: 13px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .55);
  padding: 6px 10px;
  border-radius: 8px;
  margin-top: -2px;
}

/* 打卡模态框 */
.wakeup-modal-content {
  max-width: 400px;
}

.wakeup-modal-content .modal-body {
  padding: 20px 24px;
}

.wakeup-time-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
}

.wakeup-time-input {
  width: 100px;
  height: 56px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 28px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
}

.wakeup-time-input:focus {
  outline: none;
  border-color: var(--accent);
}

.wakeup-time-colon {
  font-size: 32px;
  color: var(--ink-3);
  font-weight: 700;
}

.wakeup-modal-hint {
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.6;
}

.wakeup-quick-times {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.wakeup-quick-btn {
  padding: 6px 14px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 100px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}

.wakeup-quick-btn:active {
  background: var(--accent-soft);
  color: var(--accent);
}

.wakeup-sleep-preview {
  text-align: center;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--accent-soft);
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 2px;
}
  border-color: var(--accent-soft);
}

/* ==================== 茶配方库 ==================== */
/* 主页面快捷入口 */
.tea-shortcut {
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  margin: 12px 20px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(76, 175, 80, .15);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.tea-shortcut:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-lg);
}

.tea-shortcut-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.tea-shortcut-icon {
  font-size: 20px;
}

.tea-shortcut-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.tea-shortcut-status {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid rgba(76, 175, 80, .3);
  color: #2e7d32;
  font-family: 'JetBrains Mono', monospace;
}

.tea-shortcut-preview {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* 茶配方列表 Modal */
.tea-modal-content {
  width: 100%;
  max-width: 720px;
  height: 95vh;
  max-height: 95vh;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.tea-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
}

.tea-search-input {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  font-size: 14px;
  margin-bottom: 14px;
  background: var(--card);
}

.tea-search-input:focus {
  outline: none;
  border-color: #4CAF50;
}

.tea-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .tea-list { grid-template-columns: repeat(2, 1fr); }
}

.tea-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: default;
}

.tea-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.tea-card-emoji {
  font-size: 28px;
  flex-shrink: 0;
}

.tea-card-info { flex: 1; min-width: 0; }

.tea-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.tea-card-desc {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.tea-card-picked {
  font-size: 11px;
  color: #2e7d32;
  background: rgba(76, 175, 80, .15);
  padding: 3px 8px;
  border-radius: 100px;
  font-weight: 600;
  flex-shrink: 0;
}

.tea-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.tea-card-tag {
  font-size: 11px;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--ink-2);
}

.tea-card-price {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--ink-2);
}

.tea-card-actions {
  display: flex;
  gap: 8px;
}

.tea-card-detail-btn,
.tea-card-pick-btn {
  flex: 1;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}

.tea-card-pick-btn {
  background: #4CAF50;
  color: white;
  border-color: #4CAF50;
  font-weight: 600;
}

.tea-card-detail-btn:active { transform: scale(0.97); }
.tea-card-pick-btn:active { transform: scale(0.97); }

/* 茶详情 Modal */
.tea-detail-content {
  width: 100%;
  max-width: 640px;
  height: 95vh;
  max-height: 95vh;
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.tea-detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255,255,255,.85);
  z-index: 2;
}

.tea-detail-header {
  padding: 24px 20px;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.tea-detail-emoji {
  font-size: 48px;
  flex-shrink: 0;
}

.tea-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.tea-detail-body h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 18px 0 10px;
  padding-left: 8px;
  border-left: 3px solid var(--accent);
}

.tea-detail-body h3:first-child { margin-top: 0; }

.tea-detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink-2);
}

.tea-ingredients {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tea-ingredients li {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 6px;
}

.tea-ing-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
}

.tea-ing-amount {
  float: right;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

.tea-ing-note {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  clear: both;
}

.tea-method {
  background: var(--bg);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.7;
  border-left: 3px solid var(--accent);
}

.tea-benefits,
.tea-cautions {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tea-benefits li,
.tea-cautions li {
  padding: 6px 0 6px 22px;
  position: relative;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}

.tea-benefits li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #4CAF50;
  font-weight: 700;
}

.tea-cautions li::before {
  content: '⚠';
  position: absolute;
  left: 0;
  color: #FF6B35;
  font-weight: 700;
}

.tea-buy-block {
  background: #f0f9f4;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(76, 175, 80, .2);
}

.tea-buy-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tea-kw {
  background: var(--card);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: #2e7d32;
  font-weight: 500;
  border: 1px solid rgba(76, 175, 80, .25);
}

.tea-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.tea-detail-actions .btn-primary {
  flex: 2;
  font-weight: 600;
}

.tea-detail-actions .btn-secondary {
  flex: 1;
}

.tea-disclaimer {
  margin-top: 16px;
  padding: 10px 12px;
  background: #FFF3E0;
  border-radius: 8px;
  font-size: 12px;
  color: #B85C00;
  line-height: 1.6;
}

/* ==================== 每日饮食 ==================== */
/* 主页面快捷入口 */
.meals-shortcut {
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  margin: 12px 20px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 152, 0, .15);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.meals-shortcut:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-lg);
}

.meals-shortcut-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.meals-shortcut-icon { font-size: 20px; }
.meals-shortcut-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.meals-shortcut-cal {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid rgba(255, 152, 0, .3);
  color: #E65100;
}

.meals-shortcut-preview {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* 膳食详情 Modal */
.meals-modal-content {
  width: 100%;
  max-width: 600px;
  height: 95vh;
  max-height: 95vh;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.meals-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
}

.meals-summary {
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.meals-summary-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.meals-summary-info {
  flex: 1;
}

.meals-summary-cal {
  font-size: 20px;
  font-weight: 700;
  color: #E65100;
  font-family: 'JetBrains Mono', monospace;
}

.meals-summary-meta {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.meals-summary-hint {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 4px;
  line-height: 1.5;
}

.meal-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
}

/* 添加表单 */
.meal-add-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
}

.meal-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.meal-type-select,
.meal-time-input,
.meal-name-input,
.meal-cal-input,
.meal-note-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 14px;
  color: var(--ink);
}

.meal-type-select { flex: 1; }
.meal-time-input { width: 110px; }
.meal-name-input,
.meal-note-input { width: 100%; }
.meal-cal-input { width: 130px; }

.meal-type-select:focus,
.meal-time-input:focus,
.meal-name-input:focus,
.meal-cal-input:focus,
.meal-note-input:focus {
  outline: none;
  border-color: var(--accent);
}

.meal-add-btn {
  width: 100%;
  height: 42px;
  border: none;
  background: #FF9800;
  color: white;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: transform 0.1s;
}

.meal-add-btn:active { transform: scale(0.98); }

/* 已添加的餐列表 */
.meals-list { display: flex; flex-direction: column; gap: 10px; }

.meal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.meal-card-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.meal-card-info {
  flex: 1;
  min-width: 0;
}

.meal-card-meta {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.meal-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
}

.meal-card-cal {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.meal-card-note {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  font-style: italic;
}

.meal-card-del {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  color: var(--ink-3);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.meal-card-del:active { background: #FFEBEE; color: #C62828; }

/* 空状态 */
.meals-empty {
  text-align: center;
  padding: 20px;
  color: var(--ink-3);
  font-size: 14px;
}

/* ==================== 粑粑指数 (Bristol 分类) ==================== */
/* 主页面入口卡 */
.bowel-shortcut {
  background: linear-gradient(135deg, #F3E5F5, #E1BEE7);
  margin: 12px 20px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(156, 39, 176, .15);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.bowel-shortcut:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-lg);
}

.bowel-shortcut-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.bowel-shortcut-icon { font-size: 20px; }
.bowel-shortcut-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.bowel-shortcut-status {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid currentColor;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.bowel-shortcut-status.status-normal { color: #2e7d32; }
.bowel-shortcut-status.status-soft { color: #F57C00; }
.bowel-shortcut-status.status-hard { color: #C62828; }
.bowel-shortcut-status.status-water { color: #6A1B9A; }
.bowel-shortcut-status.status-none { color: var(--ink-3); }

.bowel-shortcut-preview {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* 粑粑详情 Modal */
.bowel-modal-content {
  width: 100%;
  max-width: 600px;
  height: 95vh;
  max-height: 95vh;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.bowel-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
}

.bowel-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 18px 0 10px;
}

.bowel-section-title:first-child { margin-top: 0; }

.bowel-info {
  background: #F8F6FA;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.bowel-info-hint {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
  margin: 0;
}

/* 快速记录网格 */
.bowel-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

@media (min-width: 480px) {
  .bowel-quick-grid { grid-template-columns: repeat(4, 1fr); }
}

.bowel-quick-btn {
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  background: var(--card);
  text-align: center;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bowel-quick-btn:active { transform: scale(0.96); }

.bowel-quick-btn.type-1-2 { background: #FFEBEE; border-color: #FFCDD2; }
.bowel-quick-btn.type-3-4 { background: #E8F5E9; border-color: #C8E6C9; }
.bowel-quick-btn.type-3-4.target { background: #C8E6C9; border-color: #4CAF50; }
.bowel-quick-btn.type-5-6 { background: #FFF8E1; border-color: #FFE082; }
.bowel-quick-btn.type-7 { background: #E3F2FD; border-color: #90CAF9; }

.bowel-q-icon { font-size: 28px; line-height: 1; }
.bowel-q-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.bowel-q-desc {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.3;
}

/* 今日汇总 */
.bowel-today-summary {
  background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.bowel-today-summary.warning { background: linear-gradient(135deg, #FFEBEE, #FFCDD2); }
.bowel-today-summary.soft { background: linear-gradient(135deg, #FFF8E1, #FFE082); }
.bowel-today-summary.water { background: linear-gradient(135deg, #E3F2FD, #90CAF9); }

.bowel-today-summary-icon { font-size: 32px; flex-shrink: 0; }
.bowel-today-summary-info { flex: 1; }
.bowel-today-summary-score {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.bowel-today-summary-hint {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* 今日列表 */
.bowel-today-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.bowel-entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.bowel-entry-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.bowel-entry-info { flex: 1; min-width: 0; }
.bowel-entry-type {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.bowel-entry-time {
  font-size: 11px;
  color: var(--ink-3);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.bowel-entry-del {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  color: var(--ink-3);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.bowel-empty {
  text-align: center;
  padding: 14px;
  color: var(--ink-3);
  font-size: 13px;
  background: var(--bg);
  border-radius: 10px;
}

/* 7 天统计 */
.bowel-week-stats {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.bowel-week-day {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
}

.bowel-week-day .day-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 4px;
}

.bowel-week-day .day-icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 2px;
}

.bowel-week-day .day-text {
  font-size: 10px;
  color: var(--ink-2);
  font-family: 'JetBrains Mono', monospace;
}

.bowel-week-day.is-today {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.bowel-week-summary {
  font-size: 13px;
  color: var(--ink-2);
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.bowel-week-summary strong { color: var(--ink); }

/* 免责声明 */
.bowel-disclaimer {
  margin-top: 16px;
  padding: 10px 12px;
  background: #FFF3E0;
  border-radius: 8px;
  font-size: 12px;
  color: #B85C00;
  line-height: 1.6;
}

/* 30 天日历 */
.bowel-calendar {
  display: grid;
  grid-template-columns: 50px repeat(6, 1fr);
  gap: 3px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.bowel-cal-day {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--ink-2);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.bowel-cal-day:active { transform: scale(0.92); }
.bowel-cal-day.none { background: transparent; border: 1px dashed var(--line); color: var(--ink-3); }

.bowel-cal-day.b1, .bowel-cal-day.b2 { background: #FFCDD2; color: #B71C1C; }
.bowel-cal-day.b3, .bowel-cal-day.b4 { background: #C8E6C9; color: #1B5E20; }
.bowel-cal-day.b5, .bowel-cal-day.b6 { background: #FFF9C4; color: #F57F17; }
.bowel-cal-day.b7 { background: #BBDEFB; color: #0D47A1; }

.bowel-cal-header {
  font-size: 9px;
  color: var(--ink-3);
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.bowel-cal-row-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  display: flex;
  align-items: center;
  padding-right: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.bowel-cal-legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  justify-content: center;
}

.bowel-cal-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--ink-3);
}

.bowel-cal-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* 连续性统计 */
.bowel-streak-stats {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bowel-streak-item {
  background: var(--bg);
  padding: 10px;
  border-radius: 8px;
  text-align: center;
}

.bowel-streak-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
}

.bowel-streak-value.good { color: #2E7D32; }
.bowel-streak-value.warn { color: #E65100; }
.bowel-streak-value.bad { color: #C62828; }

.bowel-streak-label {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}

/* ==================== 私人时光计时器 ==================== */
.private-shortcut {
  background: linear-gradient(135deg, #E8EAF6, #C5CAE9);
  margin: 12px 20px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(63, 81, 181, .15);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.private-shortcut:active { transform: scale(0.98); box-shadow: var(--shadow-lg); }

.private-shortcut.is-running {
  border-color: var(--accent);
  background: linear-gradient(135deg, #FFE9DD, #FFD8C2);
}

.private-shortcut-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.private-shortcut-icon { font-size: 20px; }

.private-shortcut-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.private-shortcut-time {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.private-shortcut.is-running .private-shortcut-time {
  color: var(--accent);
  background: white;
}

.private-shortcut-preview {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* 计时器 Modal */
.private-modal-content {
  width: 100%;
  max-width: 500px;
  height: 95vh;
  max-height: 95vh;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.private-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
}

.private-disclaimer {
  padding: 10px 12px;
  background: #E8EAF6;
  border-radius: 8px;
  font-size: 12px;
  color: #3F51B5;
  line-height: 1.6;
  margin-bottom: 14px;
}

.private-timer-display {
  text-align: center;
  padding: 28px 16px;
  background: linear-gradient(135deg, #fafafa, #f0f0f0);
  border-radius: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
}

.private-timer-display.is-running {
  background: linear-gradient(135deg, #FFE9DD, #FFD8C2);
  border-color: var(--accent);
  animation: gentle-pulse 2s ease-in-out infinite;
}

@keyframes gentle-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.private-timer-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 56px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -1px;
}

.private-timer-display.is-running .private-timer-time {
  color: var(--accent);
}

.private-timer-state {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 8px;
  font-weight: 500;
}

.private-timer-display.is-running .private-timer-state {
  color: var(--accent);
  font-weight: 600;
}

.private-goal-block {
  background: var(--card);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 12px;
}

.private-goal-block.good { border-color: #4CAF50; background: #E8F5E9; color: #2E7D32; }
.private-goal-block.warn { border-color: #FF9800; background: #FFF3E0; color: #E65100; }
.private-goal-block.over { border-color: #C62828; background: #FFEBEE; color: #C62828; }

.private-goal-progress {
  flex: 1;
  height: 8px;
  background: rgba(0,0,0,.06);
  border-radius: 4px;
  overflow: hidden;
}

.private-goal-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
  border-radius: 4px;
}

.private-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.private-btn {
  flex: 1;
  height: 56px;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.1s;
}

.private-btn:active { transform: scale(0.98); }

.private-btn-start {
  background: linear-gradient(135deg, var(--accent), #FF9F66);
  color: white;
  box-shadow: 0 4px 14px rgba(255, 107, 53, .3);
}

.private-btn-stop {
  background: linear-gradient(135deg, #C62828, #E53935);
  color: white;
  box-shadow: 0 4px 14px rgba(198, 40, 40, .3);
}

.private-btn-icon {
  font-size: 20px;
}

.private-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 18px 0 10px;
}

.private-section-title:first-child { margin-top: 0; }

/* 自律目标设置 */
.private-goal-setting {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
}

.private-goal-setting label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
  display: block;
}

.private-goal-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.private-goal-btn {
  padding: 6px 14px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}

.private-goal-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.private-goal-input {
  width: 70px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
}

.private-goal-unit {
  font-size: 12px;
  color: var(--ink-3);
}

.private-goal-hint {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-3);
}

/* 今日记录 */
.private-today-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.private-session {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.private-session-icon { font-size: 22px; flex-shrink: 0; }
.private-session-info { flex: 1; min-width: 0; }
.private-session-time {
  font-size: 13px;
  color: var(--ink-2);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.private-session-range {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

.private-session-del {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  color: var(--ink-3);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.private-empty {
  text-align: center;
  padding: 14px;
  color: var(--ink-3);
  font-size: 13px;
  background: var(--bg);
  border-radius: 10px;
}

/* 健康提醒 */
.private-tips {
  background: linear-gradient(135deg, #E0F7FA, #B2EBF2);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 18px;
}

.private-tips ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.private-tips li {
  font-size: 13px;
  color: var(--ink-2);
  padding: 6px 0;
  line-height: 1.6;
}

/* 7天统计 */
.private-week-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  color: var(--ink-2);
}

.private-week-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}

.private-week-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.private-week-day {
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 4px;
  text-align: center;
  font-size: 10px;
}

.private-week-day.is-today { background: var(--accent-soft); }
.private-week-day .day-name { color: var(--ink-3); font-weight: 600; margin-bottom: 4px; }
.private-week-day .day-min { color: var(--ink); font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 12px; }
.private-week-day.over-goal .day-min { color: #C62828; }
.private-week-day.under-goal .day-min { color: #2E7D32; }

/* ==================== 生命额度 ==================== */
/* 主页面入口卡 */
.life-budget-card {
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  margin: 12px 20px 0;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 152, 0, .2);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.life-budget-card:active { transform: scale(0.98); box-shadow: var(--shadow-lg); }

.life-budget-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.life-budget-icon { font-size: 20px; }
.life-budget-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.life-budget-day-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid var(--line);
  color: #E65100;
}

.life-budget-track {
  height: 8px;
  background: rgba(255, 255, 255, .5);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.life-budget-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFB300, #FF6B35);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.life-budget-preview {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* 生命额度 Modal */
.life-budget-modal-content {
  width: 100%;
  max-width: 500px;
  height: 95vh;
  max-height: 95vh;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.life-budget-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
}

.life-budget-hero {
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  padding: 20px;
  border-radius: 14px;
  text-align: center;
  margin-bottom: 16px;
}

.life-budget-hero-icon { font-size: 48px; margin-bottom: 8px; }
.life-budget-hero-title {
  font-size: 20px;
  font-weight: 700;
  color: #E65100;
  margin-bottom: 6px;
}
.life-budget-hero-sub {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

.lb-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 18px 0 10px;
}

.lb-section-title:first-of-type { margin-top: 0; }

/* 今日进度块 */
.lb-today-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.lb-today-bar {
  height: 12px;
  background: rgba(0,0,0,.06);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.lb-today-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFB300, #FF6B35);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.lb-today-fill.over { background: linear-gradient(90deg, #C62828, #E53935); }
.lb-today-fill.warn { background: linear-gradient(90deg, #FF9800, #F57C00); }

.lb-today-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.lb-today-hint {
  font-size: 12px;
  color: var(--ink-3);
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  line-height: 1.6;
}

/* 本周柱状图 */
.lb-week-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.lb-week-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.lb-week-day {
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 4px;
  text-align: center;
  font-size: 10px;
}

.lb-week-day.is-today { background: #FFE9DD; }
.lb-week-day .day-name { color: var(--ink-3); font-weight: 600; margin-bottom: 4px; font-size: 11px; }
.lb-week-day .day-hrs { color: var(--ink); font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 12px; }
.lb-week-day.over .day-hrs { color: #C62828; }
.lb-week-day.warn .day-hrs { color: #E65100; }
.lb-week-day.good .day-hrs { color: #2E7D32; }

.lb-week-summary {
  font-size: 12px;
  color: var(--ink-2);
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  line-height: 1.6;
}

.lb-week-summary strong { color: var(--ink); }

.lb-tips {
  background: linear-gradient(135deg, #FFF8E1, #FFECB3);
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.lb-tips ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.lb-tips li {
  font-size: 13px;
  color: var(--ink-2);
  padding: 6px 0;
  line-height: 1.6;
}

/* ==================== AI 助手 ==================== */
.ai-chat-bubble {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B35, #FF9F66);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 6px 20px rgba(255, 107, 53, .4);
  cursor: pointer;
  z-index: 90;
  transition: transform 0.2s;
}

.ai-chat-bubble:active { transform: scale(0.92); }
.ai-chat-bubble.hidden { display: none; }

.ai-chat-window {
  position: fixed;
  right: 18px;
  bottom: 84px;
  width: calc(100% - 36px);
  max-width: 380px;
  height: 70vh;
  max-height: 560px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
  display: none;
  flex-direction: column;
  z-index: 901;
  overflow: hidden;
}

.ai-chat-window.open { display: flex; }

.ai-chat-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, #FF6B35, #FF9F66);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

.ai-chat-close {
  background: rgba(255, 255, 255, .25);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  background: #FAFAFA;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ai-msg.user {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ai-msg.bot {
  background: white;
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.ai-msg.bot.loading {
  color: var(--ink-3);
  font-style: italic;
}

.ai-msg .ai-tag {
  font-size: 10px;
  opacity: 0.7;
  margin-right: 4px;
}

.ai-chat-quick {
  padding: 8px 12px;
  background: white;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

.ai-quick-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 100px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.ai-quick-btn:active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-soft);
}

.ai-chat-input-row {
  padding: 10px 12px;
  background: white;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.ai-chat-input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 14px;
  background: white;
  outline: none;
}

.ai-chat-input:focus { border-color: var(--accent); }

.ai-chat-send {
  width: 60px;
  height: 40px;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ai-chat-send:active { transform: scale(0.96); }

/* ==================== 数据安全 ==================== */
.backup-shortcut {
  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
  margin: 12px 20px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(33, 150, 243, .2);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.backup-shortcut:active { transform: scale(0.98); box-shadow: var(--shadow-lg); }

.backup-shortcut-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.backup-shortcut-icon { font-size: 20px; }
.backup-shortcut-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}
.backup-shortcut-status {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid currentColor;
  color: #1976D2;
}
.backup-shortcut-status.warn { color: #C62828; }
.backup-shortcut-status.ok { color: #2E7D32; }
.backup-shortcut-preview {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* 备份 Modal */
.backup-modal-content {
  width: 100%;
  max-width: 500px;
  height: 90vh;
  max-height: 700px;
  margin: auto;
  display: flex;
  flex-direction: column;
}
.backup-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px 24px;
  background: #FAFAFA;
}
.backup-hero {
  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
  padding: 18px;
  border-radius: 14px;
  text-align: center;
  margin-bottom: 16px;
}
.backup-hero-icon { font-size: 36px; margin-bottom: 6px; }
.backup-hero-title {
  font-size: 17px;
  font-weight: 700;
  color: #1565C0;
  margin-bottom: 4px;
}
.backup-hero-sub {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}

.bk-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 16px 0 10px;
}
.bk-section-title:first-of-type { margin-top: 0; }

.bk-cross-device-hint {
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  border: 1px solid #FFB74D;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #5D4037;
  line-height: 1.5;
}
.bk-cross-device-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.bk-cross-device-desc {
  margin-bottom: 10px;
}
.bk-cross-device-btn {
  width: 100%;
  padding: 9px 12px;
  background: #FF6F00;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.bk-cross-device-btn:hover {
  background: #E65100;
}

.bk-status-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.bk-stat-item {
  background: var(--bg);
  padding: 10px;
  border-radius: 8px;
  text-align: center;
}
.bk-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
}
.bk-stat-value.good { color: #2E7D32; }
.bk-stat-value.warn { color: #C62828; }
.bk-stat-label {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}

.bk-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 16px;
  max-height: 240px;
  overflow-y: auto;
}
.bk-list-item {
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.bk-list-item:last-child { border-bottom: none; }
.bk-list-time { flex: 1; color: var(--ink-2); }
.bk-list-size { color: var(--ink-3); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.bk-list-diff {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.bk-diff-add { background: #E8F5E9; color: #2E7D32; }
.bk-diff-del { background: #FFEBEE; color: #C62828; }
.bk-diff-same { background: #FFF3E0; color: #E65100; }
.bk-list-latest { color: var(--accent); font-size: 10px; margin-left: 4px; }
.bk-list-restore {
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.bk-list-restore:active { background: var(--accent-soft); }

.bk-empty {
  text-align: center;
  padding: 20px;
  color: var(--ink-3);
  font-size: 13px;
}

.bk-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.bk-btn {
  height: 44px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.bk-btn:active { transform: scale(0.97); }
.bk-btn-primary {
  background: linear-gradient(135deg, #FF6B35, #FF9F66);
  color: white;
  border-color: transparent;
}

.bk-disclaimer {
  padding: 10px 12px;
  background: #FFF3E0;
  border-radius: 8px;
  font-size: 12px;
  color: #B85C00;
  line-height: 1.6;
}

.bk-test-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.bk-test-desc {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.bk-test-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.bk-btn-link {
  text-decoration: none;
  text-align: center;
}

/* 2026-07-26 恢复码冗余: 同步码大字号 + 红色下载按钮 */
.backup-shortcut-sync {
  margin-top: 8px;
  font-size: 13px;
  color: #555;
}
.bk-userid {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 700;
  background: #f4f4f6;
  padding: 4px 8px;
  border-radius: 4px;
  color: #222;
  letter-spacing: 0.5px;
  user-select: all;
  -webkit-user-select: all;
  margin-left: 4px;
}
.backup-shortcut-actions {
  margin-top: 10px;
}
.bk-recovery-btn {
  background: #FF6B6B;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.bk-recovery-btn:hover {
  background: #ff5252;
}
.bk-recovery-btn:active {
  background: #e64545;
}

/* 2026-07-27 效率评估 */
.ai-bar {
  display: flex;
  gap: 8px;
}
.ai-bar .btn-ai { width: auto; flex: 1; }
.btn-efficiency {
  background: #6c5ce7 !important;
}
.btn-efficiency:hover { opacity: 0.85; }
.efficiency-modal-content {
  max-height: 80vh;
}
.efficiency-body {
  padding: 12px 16px 16px;
  max-height: 60vh;
  overflow-y: auto;
}
.efficiency-loading {
  text-align: center;
  padding: 32px 0;
  color: var(--ink-3);
}
.efficiency-loading::after {
  content: '...';
  animation: dots 1.5s infinite;
}
.eff-meta {
  margin-bottom: 10px;
  text-align: right;
}
.eff-source {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.eff-source.ai {
  background: #e8f5e9;
  color: #2e7d32;
}
.eff-source.local {
  background: #fff3e0;
  color: #ef6c00;
}
.eff-text {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  background: var(--bg-2, #fafafa);
  padding: 12px;
  border-radius: 8px;
  margin: 0;
}

/* 2026-07-28 entry actionTag chip */
.entry-action-chip {
  display: inline-block;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 2px;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-energy-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 2px;
  margin-right: 4px;
  font-weight: 600;
  background: var(--bg);
  color: var(--ink-2);
  font-family: 'JetBrains Mono', monospace;
}
/* 低精力冷色 / 高精力暖色 — 让眼睛秒扫 */
.entry-energy-chip[data-level="1"],
.entry-energy-chip[data-level="2"] {
  color: #5B7FA0;
}
.entry-energy-chip[data-level="4"],
.entry-energy-chip[data-level="5"] {
  color: #D08040;
}
.entry-energy-chip[data-level="3"] {
  color: var(--ink-2);
}
  white-space: nowrap;
}

/* 2026-07-29 一键从云端恢复按钮 */
.cloud-recover-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 8px 12px;
  background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
  border-radius: 12px;
  border: 1px solid rgba(25, 118, 210, 0.15);
}
.cloud-recover-btn {
  flex: 1;
  padding: 10px 14px;
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.cloud-recover-btn:hover { background: #1565c0; }
.cloud-recover-btn:active { background: #0d47a1; }
.cloud-recover-btn:disabled {
  background: #90a4ae;
  cursor: wait;
  opacity: 0.8;
}
.cloud-recover-status {
  font-size: 12px;
  color: #555;
  white-space: nowrap;
}

/* 2026-07-29 Obsidian Vault 自动备份 — 类似 cloud-recover-bar 但绿色 */
.vault-set-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 12px 8px;
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  border-radius: 12px;
  border: 1px solid rgba(46, 125, 50, 0.15);
}
.vault-set-btn {
  flex: 1;
  padding: 10px 14px;
  background: #2e7d32;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.vault-set-btn:hover { background: #1b5e20; }
.vault-set-btn:active { background: #0d3a13; }
.vault-set-btn:disabled {
  background: #90a4ae;
  cursor: wait;
  opacity: 0.8;
}
.vault-status {
  font-size: 12px;
  color: #2e7d32;
  white-space: nowrap;
  font-weight: 600;
}

/* 2026-07-29 首次访问引导迁移卡片 */
.first-visit-migrate {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.first-visit-migrate[hidden] { display: none; }
.migrate-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.migrate-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}
.migrate-desc {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 16px;
}
.migrate-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  box-sizing: border-box;
  margin-bottom: 12px;
}
.migrate-input:focus {
  outline: none;
  border-color: #1976d2;
}
.migrate-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.btn-migrate, .btn-migrate-skip {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-migrate {
  background: #1976d2;
  color: white;
}
.btn-migrate:hover { background: #1565c0; }
.btn-migrate-skip {
  background: #f5f5f5;
  color: #555;
}
.btn-migrate-skip:hover { background: #e0e0e0; }
.migrate-status {
  font-size: 12px;
  color: #666;
  text-align: center;
  min-height: 18px;
}
.migrate-status.success { color: #2e7d32; }
.migrate-status.error { color: #c62828; }