/* ==========================================================================
   心树日课 · 素雅禅意浅色风（宣纸质感、水墨青绿、清净柔和）
   针对 iPhone 12 Pro Max (428×926) 及安卓全屏 PWA 精细适配
   ========================================================================== */

:root {
  --bg-paper: #F6F3EC;
  --bg-card: #FCFBF8;
  --bg-subtle: #EEEAE0;
  --bg-hover: #E7E2D6;

  --ink-primary: #2B332F;
  --ink-secondary: #636F69;
  --ink-muted: #939E98;

  --jade-deep: #3B5B51;
  --jade-mid: #618575;
  --jade-soft: #96B3A5;
  --jade-pale: #E2ECE6;

  --cinnabar: #B85242;
  --cinnabar-soft: #F5E6E3;
  --gold: #C29D54;
  --gold-soft: #F6EFE0;

  --border-hairline: rgba(59, 91, 81, 0.11);
  --border-strong: rgba(59, 91, 81, 0.22);
  --shadow-soft: 0 4px 18px rgba(43, 51, 47, 0.045);
  --shadow-card: 0 2px 10px rgba(43, 51, 47, 0.035);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif CN", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 64px;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* 细腻宣纸肌理叠加 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.32;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(194, 157, 84, 0.08), transparent 44%),
    radial-gradient(circle at 86% 78%, rgba(59, 91, 81, 0.07), transparent 48%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

.hidden {
  display: none !important;
}

/* 桌面端居中如手机画幅，手机端 100% 全宽 */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 480px;
  height: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: transparent;
}

@media (min-width: 540px) {
  .app-shell {
    border-left: 1px solid var(--border-hairline);
    border-right: 1px solid var(--border-hairline);
    background: rgba(246, 243, 236, 0.72);
    box-shadow: 0 0 48px rgba(43, 51, 47, 0.06);
  }
}

/* 主视口 */
.main-viewport {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(14px + var(--safe-top)) 18px calc(var(--nav-height) + var(--safe-bottom) + 22px);
}

.view {
  display: none;
  animation: fadeInView 0.24s ease-out;
}

.view.active {
  display: block;
}

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

/* ==================== Toast 提示 ==================== */
.toast {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 50%;
  transform: translate(-50%, -18px);
  z-index: 900;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: rgba(43, 51, 47, 0.9);
  color: #FCFBF8;
  font-size: 13.5px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  box-shadow: 0 8px 24px rgba(43, 51, 47, 0.16);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==================== 标题与头部 ==================== */
.today-header,
.tree-header,
.simple-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.date-caption {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.serif-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-primary);
  line-height: 1.25;
}

.header-seal-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cinnabar-seal {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: 1.5px solid var(--cinnabar);
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
  transform: rotate(-4deg);
  box-shadow: 0 2px 6px rgba(184, 82, 66, 0.14);
}

.mini-tree-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  color: var(--jade-deep);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.mini-tree-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--jade-mid);
  box-shadow: 0 0 0 3px rgba(97, 133, 117, 0.18);
}

/* ==================== 备份温和提醒横幅 ==================== */
.backup-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--gold-soft);
  border: 1px solid rgba(194, 157, 84, 0.28);
}

.backup-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.backup-banner-text strong {
  font-size: 13px;
  color: var(--ink-primary);
}

.backup-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-soft-jade {
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--jade-deep);
  color: #FCFBF8;
  font-size: 12px;
  cursor: pointer;
}

.btn-icon-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 13px;
}

/* ==================== 今日总览卡片 ==================== */
.summary-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #FCFBF8 0%, #F4EFE4 100%);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-soft);
}

.summary-ring-wrap {
  position: relative;
  width: 82px;
  height: 82px;
  flex-shrink: 0;
}

.summary-ring {
  width: 82px;
  height: 82px;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--jade-pale);
  stroke-width: 6.5;
}

.ring-fill {
  fill: none;
  stroke: var(--jade-deep);
  stroke-width: 6.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.summary-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-num {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--jade-deep);
}

.ring-sub {
  font-size: 10px;
  color: var(--ink-muted);
}

.summary-metrics {
  flex: 1;
  min-width: 0;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.metric-cell {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 11px;
  color: var(--ink-muted);
}

.metric-value {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.metric-value small {
  font-size: 11px;
  font-weight: 400;
  margin-left: 1px;
  color: var(--ink-secondary);
}

.zen-whisper {
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border-hairline);
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--ink-secondary);
  letter-spacing: 0.04em;
}

/* ==================== 区块与功课卡片 ==================== */
.section-block {
  margin-bottom: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink-primary);
  letter-spacing: 0.05em;
}

.text-action-btn {
  border: none;
  background: transparent;
  color: var(--jade-deep);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 6px;
  cursor: pointer;
}

.practice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.practice-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.practice-card.completed {
  border-color: rgba(59, 91, 81, 0.28);
  background: linear-gradient(135deg, #FCFBF8 0%, #F0F5F2 100%);
}

.practice-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.practice-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.practice-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.done-tag {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
  font-size: 10.5px;
  font-weight: 600;
}

.practice-sub {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 7px;
}

.mini-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-bar {
  flex: 1;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--jade-mid), var(--jade-deep));
  transition: width 0.35s ease;
}

.mini-bar-count {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.practice-action {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-go-count {
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(59, 91, 81, 0.25);
  background: var(--jade-pale);
  color: var(--jade-deep);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-go-count:active {
  transform: scale(0.95);
}

.btn-sutra-check {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-paper);
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sutra-check.checked {
  border-color: var(--jade-deep);
  background: var(--jade-deep);
  color: #FCFBF8;
}

.sutra-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stepper-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-paper);
  color: var(--jade-deep);
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stepper-btn.primary {
  background: var(--jade-deep);
  border-color: var(--jade-deep);
  color: #FCFBF8;
}

/* 随笔卡 */
.note-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
}

.zen-textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
}

.zen-textarea::placeholder {
  color: var(--ink-muted);
}

.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-hairline);
}

.muted-hint {
  font-size: 12px;
  color: var(--ink-muted);
}

.status-tag {
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
}

.status-tag.active {
  background: var(--jade-pale);
  color: var(--jade-deep);
}

/* ==================== TAB 2: 持咒计数器 ==================== */
.view-counter.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--nav-height) - var(--safe-top) - var(--safe-bottom) - 36px);
}

.counter-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.mantra-pill-scroll {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.mantra-pill-scroll::-webkit-scrollbar {
  display: none;
}

.mantra-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  color: var(--ink-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mantra-pill.active {
  background: var(--jade-deep);
  border-color: var(--jade-deep);
  color: #FCFBF8;
  box-shadow: 0 4px 12px rgba(59, 91, 81, 0.2);
}

.mantra-pill-prog {
  font-size: 11px;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}

.icon-pill-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  color: var(--jade-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.exit-zen-btn {
  position: fixed;
  top: calc(14px + var(--safe-top));
  right: 18px;
  z-index: 60;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: rgba(252, 251, 248, 0.92);
  color: var(--jade-deep);
  font-size: 12.5px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

/* 禅修沉浸模式 */
.app-shell.zen-fullscreen .bottom-nav,
.app-shell.zen-fullscreen .counter-topbar {
  display: none;
}

.app-shell.zen-fullscreen .main-viewport {
  padding-bottom: calc(18px + var(--safe-bottom));
}

.app-shell.zen-fullscreen .view-counter.active {
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 32px);
}

.counter-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.counter-meta-strip {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.counter-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.counter-status-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.tiny-badge {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* 108 珠环 */
.bead-ring-container {
  position: relative;
  width: 244px;
  height: 244px;
  margin: 4px auto 12px;
  flex-shrink: 0;
}

.bead-ring-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bead-center-display {
  position: absolute;
  inset: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.bead-mantra-name {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink-secondary);
  max-width: 156px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.bead-count-num {
  font-family: var(--font-serif);
  font-size: 56px;
  font-weight: 600;
  line-height: 1.08;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
  transition: transform 0.1s ease;
}

.bead-count-num.bump {
  transform: scale(1.07);
}

.bead-target-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.round-badge {
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
  font-size: 11px;
  font-weight: 600;
}

/* 工具条 */
.counter-toolbar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.tool-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  color: var(--jade-deep);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
}

.tool-chip:active {
  transform: scale(0.95);
  background: var(--bg-subtle);
}

.tool-chip.tool-chip-muted {
  color: var(--ink-secondary);
}

.tool-chip.off {
  color: var(--ink-muted);
}

.tool-icon {
  font-size: 13px;
  font-weight: 600;
}

.tool-label {
  font-size: 10.5px;
  color: var(--ink-muted);
}

/* 大面积盲按触控区（原生 label 直连 iOS switch + 防双击缩放 & 选中文字） */
.tap-pad-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 196px;
  display: flex;
}

.ios-native-haptic-switch {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 2px;
  margin: 0;
  opacity: 0.001;
  pointer-events: none;
}

.counter-tap-pad {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1;
  min-height: 196px;
  border-radius: 28px;
  border: 1.5px solid rgba(59, 91, 81, 0.18);
  background: radial-gradient(circle at 50% 35%, #FCFBF8 0%, #EFECE2 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.08s ease, border-color 0.18s ease;
}

.counter-tap-pad:active,
.counter-tap-pad.pressed {
  transform: scale(0.985);
  border-color: rgba(59, 91, 81, 0.42);
  background: radial-gradient(circle at 50% 35%, #F5F1E7 0%, #E7E2D4 100%);
}

.lotus-touch-glyph {
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.18s ease;
}

.counter-tap-pad.pressed .lotus-touch-glyph,
.lotus-touch-glyph.pulse {
  transform: scale(0.92);
  background: rgba(59, 91, 81, 0.15);
}

.tap-ripple-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.tap-ripple {
  position: absolute;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  border: 2px solid rgba(97, 133, 117, 0.42);
  background: rgba(194, 157, 84, 0.12);
  animation: inkRipple 0.72s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes inkRipple {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(11); opacity: 0; }
}

.floating-merit {
  position: absolute;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--jade-deep);
  pointer-events: none;
  animation: floatUpMerit 0.85s ease-out forwards;
}

@keyframes floatUpMerit {
  0% { transform: translate(-50%, 0) scale(0.9); opacity: 0.95; }
  100% { transform: translate(-50%, -62px) scale(1.1); opacity: 0; }
}

.tap-pad-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.lotus-touch-glyph {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(59, 91, 81, 0.07);
  color: var(--jade-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tap-pad-title {
  font-family: var(--font-serif);
  font-size: 17px;
  letter-spacing: 0.08em;
  color: var(--ink-primary);
}

.tap-pad-hint {
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* ==================== TAB 3: 水墨生命树 ==================== */
.btn-outline-zen {
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--jade-deep);
  font-size: 12.5px;
  cursor: pointer;
}

.tree-canvas-card {
  position: relative;
  padding: 16px 12px 14px;
  margin-bottom: 16px;
  border-radius: 24px;
  background: linear-gradient(180deg, #FCFBF8 0%, #F2EEE4 100%);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-soft);
  text-align: center;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
}

.tree-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: rgba(252, 251, 248, 0.88);
  border: 1px solid var(--border-hairline);
}

.stage-num-tag {
  font-size: 11px;
  color: var(--cinnabar);
  font-weight: 600;
}

.stage-name-text {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--jade-deep);
  letter-spacing: 0.08em;
}

.tree-svg-mount {
  width: 100%;
  max-width: 340px;
  margin: 4px auto 2px;
}

.tree-svg-mount svg {
  width: 100%;
  height: auto;
  display: block;
}

/* 生命树微风动画 */
.tree-canopy-sway {
  transform-origin: 180px 300px;
  animation: gentleTreeSway 6.5s ease-in-out infinite;
}

@keyframes gentleTreeSway {
  0%, 100% { transform: rotate(-0.6deg); }
  50% { transform: rotate(0.75deg); }
}

.cloud-drift-slow {
  animation: cloudDrift 18s ease-in-out infinite alternate;
}

@keyframes cloudDrift {
  from { transform: translateX(-8px); }
  to { transform: translateX(10px); }
}

.merit-mote {
  animation: moteFloat 5.2s ease-in-out infinite;
}

@keyframes moteFloat {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-10px); opacity: 0.92; }
}

.nourish-spark {
  animation: nourishRise 1.6s ease-out forwards;
}

@keyframes nourishRise {
  0% { transform: translateY(28px) scale(0.5); opacity: 0; }
  25% { opacity: 0.95; }
  100% { transform: translateY(-76px) scale(1.15); opacity: 0; }
}

.tree-poetic-caption {
  margin: 4px 0 4px;
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--ink-secondary);
  letter-spacing: 0.05em;
}

.tree-tap-tip {
  font-size: 11px;
  color: var(--ink-muted);
}

.merit-progress-card,
.info-scroll-card,
.panel-card {
  padding: 16px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-card);
}

.merit-progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.merit-label-strong {
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.merit-label-strong strong {
  color: var(--jade-deep);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.zen-progress-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  overflow: hidden;
  margin-bottom: 16px;
}

.zen-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--jade-soft), var(--jade-deep), var(--gold));
  transition: width 0.5s ease;
}

.tree-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tree-stat-box {
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  text-align: center;
}

.tree-stat-box strong {
  display: block;
  font-size: 16px;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
}

.tree-stat-box span {
  font-size: 10.5px;
  color: var(--ink-muted);
}

.subcard-title {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 14.5px;
  color: var(--ink-primary);
}

.zen-bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-secondary);
  font-size: 13px;
  line-height: 1.7;
}

/* ==================== TAB 4: 记录、日历、管理与备份 ==================== */
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-month-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 16.5px;
  color: var(--ink-primary);
}

.cal-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-hairline);
  background: var(--bg-paper);
  color: var(--jade-deep);
  font-size: 18px;
  cursor: pointer;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--bg-paper);
  color: var(--ink-secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cal-day.empty {
  background: transparent;
  cursor: default;
}

.cal-day.future {
  opacity: 0.36;
  cursor: default;
}

.cal-day.lv1 { background: #E7EFEA; color: var(--jade-deep); }
.cal-day.lv2 { background: #C2D9CC; color: var(--jade-deep); font-weight: 500; }
.cal-day.lv3 { background: var(--jade-deep); color: #FCFBF8; font-weight: 600; }

.cal-day.today {
  border-color: var(--cinnabar);
}

.cal-day .cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 2px;
}

.calendar-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-hairline);
}

.legend-hint {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.legend-swatches {
  display: flex;
  gap: 4px;
}

.swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.swatch.lv0 { background: var(--bg-paper); border: 1px solid var(--border-hairline); }
.swatch.lv1 { background: #E7EFEA; }
.swatch.lv2 { background: #C2D9CC; }
.swatch.lv3 { background: var(--jade-deep); }

/* 统计与分段控件 */
.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-desc {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.6;
}

.segment-control {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--bg-card);
  color: var(--jade-deep);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(43, 51, 47, 0.08);
}

.stats-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
}

.stat-row-left {
  display: flex;
  flex-direction: column;
}

.stat-row-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-primary);
}

.stat-row-sub {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.stat-row-val {
  font-size: 16px;
  font-weight: 600;
  color: var(--jade-deep);
  font-variant-numeric: tabular-nums;
}

/* 功课管理列表 */
.manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  border: 1px solid var(--border-hairline);
}

.manage-item.archived {
  opacity: 0.62;
}

.manage-info {
  flex: 1;
  min-width: 0;
}

.manage-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.type-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--jade-pale);
  color: var(--jade-deep);
}

.type-badge.sutra {
  background: var(--gold-soft);
  color: #8C6A24;
}

.manage-meta {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.manage-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.small-icon-btn {
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-card);
  color: var(--ink-secondary);
  font-size: 12px;
  cursor: pointer;
}

/* 表单与按钮 */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px dashed var(--border-hairline);
}

.setting-row:first-of-type {
  border-top: none;
}

.setting-label {
  font-size: 14px;
  color: var(--ink-primary);
}

.zen-select,
.zen-input,
.zen-input-inline {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 8px 11px;
  outline: none;
}

.zen-input {
  width: 100%;
}

.zen-input-inline {
  width: 140px;
  text-align: right;
  padding: 6px 10px;
}

.zen-switch {
  width: 44px;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: #D5D0C5;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.zen-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FCFBF8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s ease;
}

.zen-switch:checked {
  background: var(--jade-deep);
}

.zen-switch:checked::after {
  transform: translateX(20px);
}

.backup-action-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 12px;
}

.btn-primary-zen,
.btn-secondary-zen,
.btn-ghost-zen,
.btn-danger-ghost {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-primary-zen {
  border: none;
  background: var(--jade-deep);
  color: #FCFBF8;
  box-shadow: 0 4px 14px rgba(59, 91, 81, 0.22);
}

.btn-secondary-zen {
  border: 1px solid var(--jade-deep);
  background: var(--jade-pale);
  color: var(--jade-deep);
}

.btn-ghost-zen {
  border: 1px solid var(--border-strong);
  background: var(--bg-paper);
  color: var(--ink-secondary);
}

.btn-danger-ghost {
  border: 1px solid rgba(184, 82, 66, 0.32);
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
}

.btn-primary-zen:active,
.btn-secondary-zen:active {
  transform: scale(0.985);
}

.app-footer {
  text-align: center;
  padding: 12px 0 6px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* ==================== 底部导航栏 ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(252, 251, 248, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-hairline);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 100;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.18s ease;
}

.nav-item.active {
  color: var(--jade-deep);
  font-weight: 600;
}

/* ==================== 底部抽屉弹层 ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(34, 42, 38, 0.38);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 86dvh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  background: var(--bg-card);
  padding: 10px 20px calc(22px + var(--safe-bottom));
  box-shadow: 0 -10px 36px rgba(43, 51, 47, 0.16);
  animation: sheetSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetSlideUp {
  from { transform: translateY(32px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: #D6D1C6;
  margin: 0 auto 12px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--ink-primary);
}

.sheet-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  cursor: pointer;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

.target-presets {
  display: flex;
  gap: 7px;
  margin-bottom: 8px;
}

.preset-chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-paper);
  color: var(--jade-deep);
  font-size: 12.5px;
  cursor: pointer;
}

.sheet-footer-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.quickadd-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.quickadd-btn {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-paper);
  color: var(--jade-deep);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.quickadd-btn.quickadd-featured {
  background: var(--jade-pale);
  border-color: var(--jade-deep);
  font-weight: 600;
}

.custom-add-row {
  display: flex;
  gap: 10px;
}

.custom-add-row .btn-primary-zen {
  width: 92px;
  flex-shrink: 0;
}

.day-detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.day-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-paper);
}

.day-detail-input {
  width: 88px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.dedication-box {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-paper);
  border: 1px solid var(--border-hairline);
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.8;
}

.import-summary-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--jade-pale);
  color: var(--jade-deep);
  font-size: 13.5px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.stages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-paper);
  cursor: pointer;
}

.stage-preview-row.current {
  border-color: var(--jade-deep);
  background: var(--jade-pale);
}

.stage-preview-left strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink-primary);
}

.stage-preview-left span {
  font-size: 12px;
  color: var(--ink-muted);
}

.stage-badge-state {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--ink-muted);
}

.stage-badge-state.reached {
  background: var(--jade-deep);
  color: #FCFBF8;
}
