/* ============================================================
   赛博上帝 / 忏悔楼 — 样式表
   配色: 米白 + 暖咖 + 烟粉
   字体: 衬线 (serif) 营造仪式感
   响应式: 移动优先, 不写死宽度
   ============================================================ */

:root {
  /* 主色 */
  --bg: #faf6f0;
  --bg-soft: #f3ece0;
  --bg-card: #ffffff;
  --line: #e8dcc8;
  --line-soft: #f0e4d0;

  /* 文字 */
  --text: #2e2620;
  --text-soft: #6b5e54;
  --text-muted: #a89a8d;
  --text-on-accent: #ffffff;

  /* 强调 */
  --accent: #c89a85;
  --accent-deep: #a87968;
  --accent-soft: #e8d3c8;

  /* 提醒 */
  --warn-bg: #f3e8e0;
  --warn-text: #8a4a3a;

  /* 阴影 */
  --shadow-sm: 0 1px 4px rgba(60, 40, 20, 0.05);
  --shadow: 0 4px 24px rgba(60, 40, 20, 0.08);
  --shadow-lg: 0 12px 40px rgba(60, 40, 20, 0.15);

  /* 圆角 */
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;

  /* 字体 */
  --font-serif: 'Songti SC', 'Source Han Serif SC', 'Noto Serif CJK SC', 'STSong', 'SimSun', 'Cambria', 'Georgia', serif;
  --font-sans:  'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', system-ui, sans-serif;

  /* 过渡 */
  --t-fast: 0.15s ease;
  --t:      0.25s ease;
}

/* ============================================================
   重置 — 系统默认样式全覆盖
   ============================================================ */

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* 系统选择框 / scrollbar / input 默认全覆盖 */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:focus {
  outline: none;
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input, textarea {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  font-family: inherit;
}

/* 自定义滚动条 (覆盖系统) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

::selection {
  background: var(--accent-soft);
  color: var(--text);
}


/* ============================================================
   页面切换 — 多页应用 (SPA)
   ============================================================ */

.page {
  display: none;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}
.page-active {
  display: block;
}

.hidden { display: none !important; }


/* ============================================================
   身份页
   ============================================================ */

.identity-wrap {
  max-width: 28rem;
  margin: 0 auto;
  padding: calc(4rem + env(safe-area-inset-top, 0)) 1.5rem calc(3rem + env(safe-area-inset-bottom, 0));
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.brand-title {
  font-size: 2.5rem;
  font-weight: 400;
  letter-spacing: 0.4rem;
  color: var(--text);
}
.brand-divider {
  width: 3rem;
  height: 1px;
  background: var(--accent);
  margin: 0.25rem 0;
}
.brand-sub {
  font-size: 1rem;
  letter-spacing: 0.6rem;
  color: var(--text-soft);
  text-indent: 0.6rem;
}

.warn-box {
  background: var(--warn-bg);
  border-radius: var(--r);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.warn-title {
  font-size: 0.9rem;
  letter-spacing: 0.3rem;
  color: var(--warn-text);
  text-indent: 0.3rem;
  font-weight: 600;
}
.warn-line {
  font-size: 0.95rem;
  color: var(--warn-text);
  line-height: 1.7;
}

.identity-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.text-input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 1.05rem;
  letter-spacing: 0.05rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
  line-height: 1.6;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.form-msg {
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--warn-text);
  text-align: center;
  padding: 0 0.5rem;
}


/* ============================================================
   按钮
   ============================================================ */

.btn {
  flex: 1;
  min-height: 3rem;
  padding: 0 1.5rem;
  font-size: 1rem;
  letter-spacing: 0.3rem;
  text-indent: 0.3rem;
  border-radius: var(--r);
  font-family: var(--font-serif);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:active { background: var(--accent-deep); }

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--accent); color: var(--text); }
.btn-ghost:active { background: var(--bg-soft); }

.btn-large {
  min-height: 3.5rem;
  font-size: 1.1rem;
  width: 100%;
}


/* ============================================================
   主页 — 顶栏 + tab
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 246, 240, 0.92);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line-soft);
  padding: calc(0.75rem + env(safe-area-inset-top, 0)) 1.25rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar-name {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  overflow: hidden;
}
.topbar-label {
  font-size: 0.8rem;
  letter-spacing: 0.2rem;
  text-indent: 0.2rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.topbar-me {
  font-size: 1.05rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60vw;
}
.topbar-btn {
  font-size: 0.85rem;
  letter-spacing: 0.2rem;
  text-indent: 0.2rem;
  color: var(--text-soft);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.topbar-btn:active { background: var(--bg-soft); color: var(--text); }

.view-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.2rem;
  text-indent: 0.2rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--t-fast);
}
.tab::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform var(--t);
}
.tab-active { color: var(--text); }
.tab-active::after { transform: translateX(-50%) scaleX(1); }

.view {
  display: none;
  padding: 1.25rem 1rem calc(4rem + env(safe-area-inset-bottom, 0));
  max-width: 40rem;
  margin: 0 auto;
}
.view-active { display: block; }

/* 子 tab — 忏悔录里的 3 类 (pill 风格) */
.sub-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.3rem;
  background: var(--bg-soft);
  border-radius: 999px;
  margin-bottom: 1.5rem;
}
.sub-tab {
  flex: 1;
  padding: 0.6rem 0.5rem;
  font-size: 0.92rem;
  letter-spacing: 0.15rem;
  text-indent: 0.15rem;
  color: var(--text-muted);
  border-radius: 999px;
  font-family: var(--font-serif);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.sub-tab-active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.sub-tab:active { transform: scale(0.97); }

.sub-view { display: none; }
.sub-view-active { display: block; }


/* ============================================================
   忏悔输入区
   ============================================================ */

.confess-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-title {
  font-size: 1.15rem;
  letter-spacing: 0.4rem;
  text-indent: 0.4rem;
  color: var(--text);
  text-align: center;
  font-weight: 500;
}

.confess-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
  background: var(--bg-soft);
  border-radius: var(--r);
  border: 1px solid transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.confess-input-wrap:focus-within {
  border-color: var(--accent);
  background: var(--bg-card);
}
.prefix, .suffix {
  color: var(--text-soft);
  font-size: 1.05rem;
  flex-shrink: 0;
  user-select: none;
}
.confess-input {
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0.25rem;
  font-size: 1.05rem;
  color: var(--text);
}

.stats-area {
  position: relative;
  background: var(--bg-soft);
  border-radius: var(--r);
  padding: 1rem 2.5rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-left: 3px solid var(--accent);
}
.stats-area.hidden { display: none; }
.stats-close {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.stats-close:hover  { background: var(--bg-card); color: var(--text); }
.stats-close:active { background: var(--accent-soft); color: var(--text); }
.stat-line {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.8;
}
.stat-num {
  font-weight: 600;
  color: var(--accent-deep);
  margin: 0 0.15rem;
}
.stat-content {
  color: var(--text);
  font-weight: 500;
}


/* ============================================================
   历史快选
   ============================================================ */

.quick-pick {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.quick-pick-label {
  font-size: 0.85rem;
  letter-spacing: 0.25rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
}
.quick-pick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.quick-pick-empty {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.5rem;
}

.quick-pick-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
  max-width: 100%;
}
.quick-pick-item:hover { border-color: var(--accent); }
.quick-pick-item:active { transform: scale(0.96); background: var(--bg-soft); }

.quick-pick-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.quick-pick-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 12rem;
}
.quick-pick-count {
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}


/* ============================================================
   破戒卡片(在忏悔卡片下方)
   ============================================================ */

.break-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.break-empty {
  font-size: 0.92rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 0.5rem 0;
}

.break-pick-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.05rem;
}

.break-pick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.break-pick-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
  max-width: 100%;
  font-family: var(--font-serif);
}
.break-pick-item:hover  { border-color: var(--accent); }
.break-pick-item:active { transform: scale(0.96); background: var(--bg-soft); }
.break-pick-item-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 500;
}

.break-pick-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.break-pick-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 12rem;
}

.break-input-area {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
}

.break-sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.5rem 0.25rem 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-soft);
}
.break-content {
  color: var(--text);
  font-weight: 500;
}

.break-but {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-soft);
  border-radius: var(--r);
  border: 1px solid transparent;
  font-size: 1rem;
  font-family: var(--font-serif);
  color: var(--text);
  resize: vertical;
  min-height: 4rem;
  line-height: 1.6;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.break-but:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  outline: none;
}

/* 偷看一个理由 — 链接风格小按钮, 不显眼但可点 */
.break-peek-btn {
  align-self: flex-end;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border-radius: var(--r-sm);
  letter-spacing: 0.05rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--text-muted);
  transition: color var(--t-fast), background var(--t-fast);
}
.break-peek-btn:hover,
.break-peek-btn:active {
  color: var(--accent-deep);
  background: var(--bg-soft);
  text-decoration-color: var(--accent);
}
.break-peek-btn:disabled {
  opacity: 0.5;
  cursor: default;
}


/* ============================================================
   视图: 时间树
   ============================================================ */

.tree-list {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 1.5rem;
}
.tree-list::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 1px;
  background: var(--line);
}

.tree-item {
  position: relative;
  padding: 0.85rem 0 0.85rem 0.75rem;
  border-bottom: 1px dashed var(--line-soft);
}
.tree-item:last-child { border-bottom: none; }
.tree-item::before {
  content: "";
  position: absolute;
  left: -1.07rem;
  top: 1.15rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--tree-color, var(--accent));
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}

/* 破戒条: 圆点换成 × 字符 — 与圆点同尺寸 / 视觉重量, 不加外圈 */
.tree-item-break::before {
  content: "×";
  width: 0.65rem;
  height: 0.65rem;
  left: -1.07rem;
  top: 1.05rem;
  background: transparent;
  color: var(--tree-color, var(--accent));
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  font-family: 'Helvetica', 'Arial', sans-serif;
  line-height: 1;
}

.tree-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.1rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tree-type-tag {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.1rem;
  color: var(--tree-color, var(--accent-deep));
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.tree-content {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.7;
}
.tree-content-fill {
  color: var(--tree-color, var(--accent-deep));
  font-weight: 500;
}
.tree-but {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.6;
  font-style: italic;
}

/* 时间线每条的删除按钮 — 始终可见但浅淡(移动端 tap 友好) */
.tree-item {
  padding-right: 3.5rem;   /* 给删除按钮留空间 */
}
.tree-del {
  position: absolute;
  right: 0;
  top: 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.05rem;
  color: var(--text-muted);
  padding: 0.4rem 0.65rem;
  border-radius: var(--r-sm);
  opacity: 0.45;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.tree-del:hover  { opacity: 1; background: var(--warn-bg); color: var(--warn-text); }
.tree-del:active { opacity: 1; background: var(--warn-bg); color: var(--warn-text); transform: scale(0.96); }

.empty-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 3rem 1rem;
}


/* ============================================================
   视图: 日历本
   ============================================================ */

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.cal-nav {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.4rem;
  color: var(--text-soft);
  transition: background var(--t-fast);
}
.cal-nav:active { background: var(--bg-soft); }
.cal-title {
  font-size: 1.1rem;
  letter-spacing: 0.3rem;
  text-indent: 0.3rem;
  color: var(--text);
  font-weight: 500;
  min-width: 8rem;
  text-align: center;
}

.cal-month-stats {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
  letter-spacing: 0.1rem;
  margin-bottom: 0.85rem;
  margin-top: -0.3rem;
}
.cal-month-stats .stat-mark {
  font-weight: 700;
  margin-right: 0.1rem;
}
.cal-month-stats .stat-num {
  color: var(--accent-deep);
  font-weight: 600;
  margin: 0 0.15rem;
}

.cal-filter {
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--text);
  flex-wrap: wrap;
}
.cal-filter-clear {
  font-size: 0.8rem;
  color: var(--accent-deep);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
}
.cal-filter-clear:active { background: var(--accent); color: var(--text-on-accent); }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  padding: 0.5rem 0;
}

.cal-cell {
  aspect-ratio: 1 / 1.1;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: inherit;
  text-align: left;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
  position: relative;
  overflow: hidden;
}
.cal-cell:active { transform: scale(0.95); }
.cal-cell:disabled,
.cal-cell-other {
  background: transparent;
  cursor: default;
  pointer-events: none;
}
.cal-cell:disabled:active { transform: none; }

.cal-cell-today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.cal-cell-other {
  opacity: 0.35;
}

.cal-day-num {
  font-size: 0.82rem;
  color: var(--text-soft);
  font-weight: 400;
}
.cal-cell-today .cal-day-num {
  color: var(--accent-deep);
  font-weight: 600;
}

.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-content: flex-start;
  flex: 1;
}
.cal-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
/* 破戒点用 × 标记代替圆点 — 跟圆点视觉重量对齐, 不加外圈 */
.cal-dot-break {
  width: 0.55rem;
  height: 0.55rem;
  background: transparent;
  color: var(--accent);
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  font-family: 'Helvetica', 'Arial', sans-serif;
  line-height: 1;
  flex-shrink: 0;
}
.cal-cell-dim .cal-dot,
.cal-cell-dim .cal-dot-break {
  opacity: 0.18;
}

/* 当天详情弹层 — 中央居中, 简单可靠 */
.day-detail {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: dayDetailFadeIn 0.18s ease;
}
.day-detail.hidden { display: none; }
.day-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(46, 38, 32, 0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.day-detail-inner {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  max-width: 26rem;
  width: 100%;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-lg);
  z-index: 1;
  animation: dayDetailPopIn 0.22s cubic-bezier(0.18, 0.89, 0.32, 1.18);
}
@keyframes dayDetailFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dayDetailPopIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.day-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.day-detail-head h4 {
  font-size: 1.05rem;
  letter-spacing: 0.2rem;
  color: var(--text);
  font-weight: 500;
}
.day-detail-close {
  width: 2rem; height: 2rem;
  border-radius: 50%;
  font-size: 1.4rem;
  color: var(--text-muted);
  transition: background var(--t-fast);
}
.day-detail-close:active { background: var(--bg-soft); }

.day-detail-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.day-detail-item {
  padding: 0.65rem 0.85rem;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border-left: 3px solid var(--detail-color, var(--accent));
}
.day-detail-mark {
  flex-shrink: 0;
  padding-top: 0.15rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--detail-color, var(--accent));
  width: 1rem;
  text-align: center;
}
.day-detail-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.day-detail-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.day-detail-content {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
}
.day-detail-but {
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.6;
  font-style: italic;
  margin-top: 0.15rem;
}

/* 弹层标题区子标题(显示"忏悔 N / 破戒 N") */
.day-detail-sum {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.1rem;
  margin-top: -0.4rem;
}

/* 通用确认弹层 — 复用 day-detail 样式 + 小调整 */
.confirm-inner { max-width: 22rem; }
.confirm-text {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.7;
  padding: 0.25rem 0;
}
.confirm-btns {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}


/* ============================================================
   视图: 忏悔列表
   ============================================================ */

.list-items {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--item-color, var(--accent));
}
.list-item:active { transform: scale(0.98); background: var(--bg-soft); }

.list-item-content {
  flex: 1;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
  min-width: 0;
}
.list-item-counts {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-end;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.05rem;
}
.list-item-count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-soft);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.list-item-mark {
  font-weight: 700;
  color: var(--item-color, var(--accent));
  font-size: 0.8rem;
}


/* ============================================================
   Toast 轻提示
   ============================================================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 3rem;
  transform: translateX(-50%) translateY(2rem);
  background: rgba(46, 38, 32, 0.92);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  z-index: 200;
  max-width: calc(100vw - 2rem);
  text-align: center;
}
.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ============================================================
   响应式 — 极窄屏紧凑(避免 input 被前后缀挤没空间)
   ============================================================ */

@media (max-width: 380px) {
  html { font-size: 15px; }

  .view {
    padding: 0.85rem 0.7rem calc(4rem + env(safe-area-inset-bottom, 0));
  }
  .topbar {
    padding: calc(0.6rem + env(safe-area-inset-top, 0)) 0.85rem 0.6rem;
  }
  .view-tabs {
    padding: 0.4rem 0.7rem 0;
  }
  .tab { padding: 0.75rem 0.8rem; }

  .confess-card {
    padding: 1.25rem 1rem;
    border-radius: 18px;
  }
  .confess-input-wrap {
    padding: 0.7rem 0.75rem;
    gap: 0.25rem;
  }
  .prefix, .suffix { font-size: 1rem; }
  .confess-input    { font-size: 1rem; }

  .stats-area {
    padding: 0.85rem 2.3rem 0.85rem 1rem;
  }
  .stat-line { font-size: 0.88rem; }

  .quick-pick-text { max-width: 8rem; }

  .cal-grid { gap: 3px; }
  .cal-cell { padding: 0.2rem; }
  .cal-day-num { font-size: 0.75rem; }
  .cal-dot { width: 0.35rem; height: 0.35rem; }
  .calendar-header { gap: 0.5rem; }
  .cal-title { font-size: 1rem; letter-spacing: 0.2rem; }

  .day-detail { padding: 0.75rem; }
  .day-detail-inner { padding: 1.2rem; }

  .sub-tabs { padding: 0.25rem; }
  .sub-tab  { padding: 0.5rem 0.3rem; font-size: 0.85rem; letter-spacing: 0.08rem; }
}

/* ============================================================
   响应式 — 桌面增宽
   ============================================================ */

@media (min-width: 720px) {
  html { font-size: 17px; }

  .view {
    padding: 2rem 1.5rem 5rem;
  }

  .topbar {
    padding: 0.85rem 2rem;
  }

  .view-tabs {
    padding: 0.5rem 1.5rem 0;
  }

  .cal-cell {
    padding: 0.45rem;
  }
  .cal-day-num { font-size: 0.95rem; }

  .day-detail-inner { padding: 1.75rem; }
}

@media (min-width: 1024px) {
  .view { max-width: 44rem; }
}


/* ============================================================
   减少动画 (无障碍偏好)
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01s !important;
    animation-duration: 0.01s !important;
  }
}
