/* 回忆小站 —— 视觉层 */
:root {
  --bg: #faf7f3;
  --bg-deep: #f2ece4;
  --surface: #ffffff;
  --ink: #2e2a26;
  --ink-soft: #6d635b;
  --ink-faint: #9b9188;
  --line: #e7ddd1;
  --accent: #b86b55;
  --accent-deep: #98513c;
  --accent-soft: #f6e7e0;
  --shadow: 0 2px 4px rgba(90, 70, 55, 0.04), 0 8px 24px rgba(90, 70, 55, 0.06);
  --shadow-lg: 0 12px 48px rgba(70, 52, 40, 0.14);
  --radius: 16px;
  --radius-lg: 22px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "STSong", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

/* 始终为滚动条预留空间：弹窗锁滚动时滚动条消失，页面不会横向跳动 */
html {
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 8%, rgba(214, 168, 148, 0.16), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(190, 176, 150, 0.14), transparent 38%);
  z-index: 0;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; }

/* ---------------- 登录页 ---------------- */

.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px 34px 34px;
  text-align: center;
}

.login-mark {
  width: 46px;
  height: 46px;
  margin: 0 auto 20px;
  display: block;
}

.login-card h1 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  margin: 0 0 6px;
  letter-spacing: 0.02em;
}

.login-card .sub {
  margin: 0 0 28px;
  color: var(--ink-faint);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.field {
  text-align: left;
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}

.input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 11px;
  /* iOS 触摸目标建议不小于 44px 高 */
  padding: 11px 16px;
  min-height: 44px;
  font-size: 14px;
  color: var(--ink);
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn:hover { background: var(--bg-deep); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  /* 白字在 --accent(#b86b55) 上只有 3.98:1，达不到 WCAG AA 的 4.5:1。
     改用 --accent-deep(#98513c) = 5.87:1 */
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

.btn-primary:hover {
  background: #7f422f;
  border-color: #7f422f;
}

.btn-block {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  font-size: 15px;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover { background: var(--bg-deep); color: var(--ink); }

.btn-danger {
  color: #a3372c;
  border-color: #e4c6c1;
}

.btn-danger:hover { background: #fbeeec; }

.err {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
  color: #a3372c;
}

/* ---------------- 主界面 ---------------- */

.app {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px 120px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 16px;
  flex-wrap: wrap;
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  z-index: -1;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -22px;
  height: 22px;
  background: linear-gradient(to bottom, var(--bg), rgba(250, 247, 243, 0));
  pointer-events: none;
  z-index: -1;
}

/*
 * 宽屏时让顶栏背景延伸到整个视口宽度（.app 有 max-width，否则背景两侧会断）。
 * 窄屏上 .app 本来就是满宽，不需要延伸——而 -50vw 会在手机上向右溢出 181px，
 * 撑开文档宽度，导致移动浏览器把整页缩小。这是手机端"页面变小、右侧留白"的根因。
 */
@media (min-width: 961px) {
  .topbar::before,
  .topbar::after {
    left: -50vw;
    right: -50vw;
  }
}

.brand h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.02em;
}

.counter {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}

.counter strong {
  color: var(--accent);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search {
  width: 150px;
  padding: 8px 12px;
  /* iOS 触摸目标建议不小于 44px 高 */
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  transition: width 0.2s ease, border-color 0.16s ease;
}

.search:focus {
  width: 190px;
  border-color: var(--accent);
}

/* ---------------- 时间轴 ---------------- */

.year-block {
  margin-top: 34px;
}

/* 「再看看之前的 N 条」——时间轴分批渲染时用 */
.load-more {
  display: block;
  width: 100%;
  margin: 28px 0 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.load-more:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.year-label {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.16em;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.entry {
  position: relative;
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 18px;
  padding-bottom: 22px;
}

.entry::before {
  content: "";
  position: absolute;
  left: 86px;
  top: 26px;
  bottom: -6px;
  width: 1px;
  background: var(--line);
}

.entry:last-child::before { display: none; }

.entry-date {
  padding-top: 16px;
  text-align: right;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.entry-date .d {
  display: block;
  font-size: 19px;
  color: var(--ink-soft);
  font-family: var(--serif);
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.entry::after {
  content: "";
  position: absolute;
  left: 83px;
  top: 24px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--accent);
  z-index: 2;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: #ddcdbd;
}

.card-body { padding: 18px 20px; }

.card h2 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

.card .mood {
  display: inline-block;
  font-size: 11px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 2px 10px;
  margin-bottom: 8px;
  letter-spacing: 0.06em;
}

.card .text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.card-text-only .text {
  -webkit-line-clamp: 8;
}

.thumbs {
  display: grid;
  gap: 2px;
  background: var(--bg-deep);
}

.thumbs.n1 { grid-template-columns: 1fr; }
.thumbs.n2 { grid-template-columns: 1fr 1fr; }
.thumbs.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.thumbs.n4 { grid-template-columns: 1fr 1fr; }

.thumbs.n3 .thumb:first-child { grid-row: span 2; }

.thumb {
  position: relative;
  min-height: 120px;
  background: var(--bg-deep);
  overflow: hidden;
}

.thumbs.n1 .thumb { height: 360px; }
.thumbs.n2 .thumb { height: 190px; }
.thumbs.n3 .thumb { height: 108px; }
.thumbs.n3 .thumb:first-child { height: 218px; }
.thumbs.n4 .thumb { height: 132px; }

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb .more {
  position: absolute;
  inset: 0;
  background: rgba(40, 32, 26, 0.52);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-family: var(--serif);
  letter-spacing: 0.04em;
}

.thumb-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--ink-faint);
  font-size: 12px;
  background: repeating-linear-gradient(45deg, #f2ece4, #f2ece4 10px, #efe7dd 10px, #efe7dd 20px);
}

.thumb-ph svg { opacity: 0.55; }

/* 音频 / 视频没有封面，不该占满一整块大图位置 */
.thumbs .thumb.is-audio {
  height: 92px;
  min-height: 92px;
}

.thumbs .thumb.is-video {
  height: 170px;
  min-height: 170px;
}

.thumbs.n3 .thumb.is-audio,
.thumbs.n3 .thumb.is-video,
.thumbs.n4 .thumb.is-audio,
.thumbs.n4 .thumb.is-video {
  height: 92px;
  min-height: 92px;
  grid-row: auto;
}

/* ---------------- 空状态 ---------------- */

.empty {
  text-align: center;
  padding: 80px 20px 40px;
  color: var(--ink-faint);
}

.empty h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  color: var(--ink-soft);
  margin: 0 0 8px;
}

.empty p { margin: 0 0 20px; font-size: 14px; }

/* ---------------- 查看器 ---------------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  height: 100dvh;
  background: #1b1714;
  display: none;
  grid-template-rows: auto 1fr auto;
  color: #f5efe8;
}

.viewer.open { display: grid; }

.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 12px;
}

.viewer-date {
  font-family: var(--serif);
  font-size: 15px;
  color: #d8cec3;
  letter-spacing: 0.08em;
}

.viewer-actions { display: flex; gap: 6px; }

.viewer-actions .btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f0e9e1;
  font-size: 13px;
  padding: 7px 13px;
}

.viewer-actions .btn:hover { background: rgba(255, 255, 255, 0.16); }

.viewer-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  min-height: 0;
  position: relative;
}

.viewer-stage img,
.viewer-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.viewer-stage audio {
  width: min(560px, 100%);
  filter: invert(0.92) hue-rotate(180deg);
}

.viewer-stage .audio-card {
  text-align: center;
  display: grid;
  gap: 16px;
  padding: 28px 24px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  width: min(440px, 100%);
  max-width: 100%;
  box-sizing: border-box;
}

/* audio 控件默认就有 300px 宽，不压住会在手机上撑破容器 */
.viewer-stage .audio-card audio {
  width: 100%;
  min-width: 0;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  display: grid;
  place-items: center;
}

.viewer-nav:hover { background: rgba(255, 255, 255, 0.24); }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-nav[hidden] { display: none; }

.viewer-thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 0 12px;
  scrollbar-width: none;
}

.viewer-thumbs::-webkit-scrollbar { display: none; }
.viewer-thumbs[hidden] { display: none; }

.vt {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 7px;
  border: 1.5px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  opacity: 0.5;
  transition: opacity 0.16s ease, border-color 0.16s ease;
}

.vt img { width: 100%; height: 100%; object-fit: cover; display: block; }

.vt-ph { display: grid; place-items: center; }
.vt-ph svg { width: 18px; height: 18px; filter: brightness(1.7); }

.vt:hover { opacity: 0.82; }
.vt.on { opacity: 1; border-color: var(--accent); }

.viewer-bottom {
  max-height: 42vh;
  overflow: auto;
  padding: 18px 24px 26px;
  background: #1b1714;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.viewer-bottom h2 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  margin: 0 0 8px;
  color: #fbf6ef;
}

.viewer-bottom .vtext {
  margin: 0;
  font-size: 15px;
  line-height: 1.85;
  color: #ddd4ca;
  white-space: pre-wrap;
  max-width: 700px;
}

.viewer-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 0;
}

.viewer-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.viewer-dots span.on { background: #f0e4d6; }

/* ---------------- 弹窗 / 表单 ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(45, 36, 29, 0.42);
  display: none;
  padding: 24px;
  overflow: auto;
}

.modal.open { display: block; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 620px;
  margin: 40px auto;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 80px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.modal-head h2 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  margin: 0;
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 22px;
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

textarea.input {
  min-height: 150px;
  resize: vertical;
  line-height: 1.75;
}

.hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin: 6px 0 0;
  line-height: 1.6;
}

/* 上传区 */

.drop {
  border: 1.5px dashed var(--line);
  border-radius: 13px;
  padding: 22px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
  margin-bottom: 14px;
}

.drop:hover, .drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.upload-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.up-item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13px;
}

.up-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-deep);
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  font-size: 11px;
  overflow: hidden;
}

.up-thumb img { width: 100%; height: 100%; object-fit: cover; }

.up-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}

.up-size {
  font-size: 11px;
  color: var(--ink-faint);
}

.up-bar {
  height: 3px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 5px;
}

.up-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* 设置分区 */

.section-title {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.section-title:first-child { margin-top: 0; }

/* 提示条 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 20px);
  background: #2e2a26;
  color: #f7f2ea;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 90;
  max-width: 88vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 页脚 */

.foot {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  padding: 20px 20px 84px;
  letter-spacing: 0.06em;
}

/* ---------------- 顶部标签页 ---------------- */

.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-deep);
  padding: 3px;
  border-radius: 11px;
}

.tab {
  border: none;
  background: transparent;
  /* iOS 建议触摸目标不小于 44px。原来只有 30px 高，在手机上很难点准。 */
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  transition: background 0.16s ease, color 0.16s ease;
  white-space: nowrap;
  min-height: 44px;
}

.tab:hover { color: var(--ink); }

.tab.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(90, 70, 55, 0.08);
}

/* ---------------- 见面倒计时条 ---------------- */

.meetbar { margin: 6px 0 4px; }
.meetbar[hidden] { display: none; }

.meetbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 20px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.meet-side {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.meet-label {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

.meet-num {
  font-family: var(--serif);
  font-size: 27px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.meet-unit {
  font-size: 12px;
  color: var(--ink-soft);
}

.meet-clocks {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.clock-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.clock-city { font-size: 13px; color: var(--ink-soft); }
.clock-time {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.clock-who { font-size: 11px; color: var(--ink-faint); }

/* ---------------- 视图操作条 ---------------- */

.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 8px;
  flex-wrap: wrap;
}

.view-actions .search { flex: 1; min-width: 140px; }

.cap-intro {
  flex: 1;
  margin: 0;
  font-size: 13px;
  color: var(--ink-faint);
  line-height: 1.6;
  min-width: 200px;
}

/* ---------------- 卡片元信息 ---------------- */

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.card-meta .mood {
  margin-bottom: 0;
  background: transparent;
  padding: 0;
  color: var(--mood-color, var(--ink-faint));
  font-weight: 400;
}

.author {
  font-size: 11px;
  padding: 1px 9px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  background: var(--bg-deep);
  color: var(--ink-soft);
}

.author.a-a { background: #e7eef7; color: #2f5779; }
.author.a-b { background: #f7e6df; color: #9a5039; }

.reply-count {
  font-size: 11px;
  color: var(--ink-faint);
}

/* ---------------- 纸条 ---------------- */

.note-compose {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 20px 0 18px;
  box-shadow: var(--shadow);
}

.note-compose textarea {
  width: 100%;
  min-height: 84px;
  border: none;
  outline: none;
  resize: vertical;
  background: transparent;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
}

.note-compose textarea::placeholder { color: var(--ink-faint); }

.note-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.note-mood { flex: 1; max-width: 180px; padding: 8px 12px; font-size: 13px; }

.notes-list { display: grid; gap: 10px; }

/* 纸条按月分组
   纸条只增不减，一天一条的话一年三百多条。分成月之后好翻得多。 */
.note-month {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.note-month-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--ink);
}

.note-month-head:hover { background: var(--bg-deep); }

.note-month-label {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.note-month-count {
  font-size: 12px;
  color: var(--ink-faint);
  background: var(--bg-deep);
  border-radius: 999px;
  padding: 1px 8px;
}

.note-month-arrow {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--ink-faint);
  border-bottom: 1.5px solid var(--ink-faint);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  flex: none;
}

.note-month.collapsed .note-month-arrow {
  transform: rotate(45deg);
}

.note-month-body {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

.note-month.collapsed .note-month-body {
  display: none;
}

/* 分组里的纸条不再自带外框和阴影，边框交给月份块 */
.note-month .note-card {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.note-month .note-card.mine {
  background: transparent;
  border-color: var(--line);
}

.note-month .note-month-body > .note-card:first-child {
  border-top: 0;
}

.note-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 18px;
  box-shadow: var(--shadow);
}

.note-card.mine {
  background: var(--accent-soft);
  border-color: #ecd8cd;
}

.note-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.note-time { font-size: 11px; color: var(--ink-faint); }

.note-body {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  color: var(--ink);
}

.note-del {
  position: absolute;
  right: 12px;
  bottom: 10px;
  border: none;
  background: transparent;
  font-size: 11px;
  color: var(--ink-faint);
  padding: 2px 6px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.note-card:hover .note-del { opacity: 1; }
.note-del:hover { background: rgba(0, 0, 0, 0.05); color: #a3372c; }

/* ---------------- 时间胶囊 ---------------- */

.capsules-list { display: grid; gap: 12px; }

.cap-card {
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.cap-card.locked {
  border-style: dashed;
  background: #fdfaf6;
}

.cap-card.open {
  border-color: #cfe0d6;
  background: #fbfdfb;
}

.cap-seal {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
}

.cap-card.open .cap-seal { background: #eaf3ee; border-color: #cfe0d6; }

.cap-body { flex: 1; min-width: 0; position: relative; }

.cap-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }

.cap-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 6px;
}

.cap-when {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.cap-text {
  margin: 12px 0 0;
  font-size: 14.5px;
  line-height: 1.85;
  white-space: pre-wrap;
  color: var(--ink);
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.cap-toggle { margin-top: 12px; font-size: 13px; padding: 6px 14px; }

.cap-card.open .note-del { opacity: 0.6; }

/* ---------------- 留言 ---------------- */

.replies { display: grid; gap: 14px; margin: 20px 0 14px; max-width: 700px; }

.reply-item {
  border-left: 2px solid rgba(255, 255, 255, 0.14);
  padding-left: 13px;
}

.reply-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.viewer .author {
  background: rgba(255, 255, 255, 0.1);
  color: #ded5cb;
}

.reply-time { font-size: 11px; color: rgba(255, 255, 255, 0.4); }

.reply-del {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
  padding: 0 4px;
  border-radius: 4px;
}

.reply-del:hover { color: #e2a09a; background: rgba(255, 255, 255, 0.08); }

.reply-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: #d9d0c6;
  white-space: pre-wrap;
}

.reply-form {
  display: flex;
  gap: 8px;
  max-width: 700px;
  margin-bottom: 6px;
}

.reply-form .input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f2ebe3;
  padding: 9px 13px;
  font-size: 13.5px;
}

.reply-form .input::placeholder { color: rgba(255, 255, 255, 0.35); }
.reply-form .input:focus { border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.12); }

.reply-form .btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f0e9e1;
  font-size: 13px;
}

.reply-form .btn:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------------- 重逢面板 ---------------- */

.welcome {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(35, 28, 22, 0.66);
  backdrop-filter: blur(7px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.welcome[hidden] { display: none; }

.welcome-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px 32px 30px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.w-lead {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

.welcome-card h2 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 22px;
}

.w-stats {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.w-stats li {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 7px;
  font-size: 13.5px;
  color: var(--ink-soft);
  max-width: 190px;
  margin: 0 auto;
  width: 100%;
}

.w-stats strong {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 26px;
  text-align: right;
  flex: 0 0 auto;
}

.w-stats li span { flex: 1; text-align: left; }

/* ---------------- 补录旧回忆相关 ---------------- */

.quick-dates {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.quick-dates button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 12px;
  color: var(--ink-soft);
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.quick-dates button:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.date-hint {
  margin: -4px 0 14px;
  color: var(--accent-deep);
}

.date-hint[hidden] { display: none; }

.year-nav {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}

.year-nav::-webkit-scrollbar { display: none; }
.year-nav[hidden] { display: none; }

.year-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.year-chip:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.year-chip-count {
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--bg-deep);
  border-radius: 10px;
  padding: 0 6px;
  line-height: 1.6;
}

.year-chip:hover .year-chip-count {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.card.flash {
  animation: cardFlash 2s ease;
}

@keyframes cardFlash {
  0%, 100% { box-shadow: var(--shadow); border-color: var(--line); }
  15%, 60% { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-lg); border-color: var(--accent); }
}

/* ---------------- 黑胶播放器 ---------------- */

.vinyl-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0 18px;
  pointer-events: none;
}

.vinyl-player[hidden] { display: none; }

.vinyl-sheet {
  pointer-events: auto;
  max-width: 880px;
  margin: 0 auto;
  max-height: 0;
  overflow: hidden;
  background: #221c17;
  border-radius: 18px;
  transition: max-height 0.3s ease, margin-bottom 0.3s ease;
}

.vinyl-sheet.open {
  max-height: 330px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.vinyl-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 8px;
  font-size: 12px;
  color: rgba(245, 239, 232, 0.5);
  letter-spacing: 0.06em;
}

.vinyl-tabs { display: flex; gap: 4px; }

.vinyl-tab {
  border: none;
  background: transparent;
  color: rgba(245, 239, 232, 0.45);
  font-size: 12.5px;
  padding: 4px 11px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  transition: background 0.16s ease, color 0.16s ease;
}

.vinyl-tab:hover { color: rgba(245, 239, 232, 0.82); }

.vinyl-tab.on {
  background: rgba(255, 255, 255, 0.13);
  color: #f2ebe3;
}

.vinyl-head-actions { display: flex; align-items: center; gap: 2px; }

.vinyl-manage {
  border: none;
  background: transparent;
  color: rgba(245, 239, 232, 0.5);
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 6px;
}

.vinyl-manage:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.vinyl-manage.on { color: var(--accent); }

.vinyl-ops { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

.vinyl-op {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 239, 232, 0.7);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 12px;
  padding: 0;
  display: grid;
  place-items: center;
}

.vinyl-op:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); color: #fff; }
.vinyl-op:disabled { opacity: 0.22; cursor: not-allowed; }
.vinyl-op-del:hover:not(:disabled) { background: rgba(224, 120, 95, 0.25); color: #f0a08c; }

.vinyl-row.managing { cursor: default; }
.vinyl-row.managing:hover { background: transparent; }
.vinyl-row.managing.on:hover { background: rgba(255, 255, 255, 0.09); }
.vinyl-row.is-hidden { opacity: 0.4; }

.vinyl-empty {
  padding: 22px 22px 26px;
  font-size: 12.5px;
  color: rgba(245, 239, 232, 0.4);
  text-align: center;
  line-height: 1.8;
}

.vinyl-close {
  border: none;
  background: transparent;
  color: rgba(245, 239, 232, 0.5);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}

.vinyl-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.vinyl-list {
  max-height: 268px;
  overflow-y: auto;
  padding: 0 10px 12px;
}

.vinyl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
  color: rgba(245, 239, 232, 0.72);
  transition: background 0.15s ease, color 0.15s ease;
}

.vinyl-row:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.vinyl-row.on { background: rgba(255, 255, 255, 0.09); color: #fff; }

.vinyl-row-no {
  font-size: 11px;
  color: rgba(245, 239, 232, 0.32);
  font-variant-numeric: tabular-nums;
  flex: 0 0 18px;
}

.vinyl-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.vinyl-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}

.vinyl-row-date {
  font-size: 11px;
  color: rgba(245, 239, 232, 0.3);
  flex: 0 0 auto;
}

.vinyl-row-heart { color: #e0785f; font-size: 11px; flex: 0 0 auto; }

/* 播放中的三根律动条 */
.vinyl-bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  flex: 0 0 auto;
}

.vinyl-row.playing .vinyl-bars { display: flex; }

.vinyl-bars i {
  width: 2px;
  background: var(--accent);
  border-radius: 1px;
  animation: barBounce 0.9s ease-in-out infinite;
}

.vinyl-bars i:nth-child(1) { height: 6px; animation-delay: 0s; }
.vinyl-bars i:nth-child(2) { height: 11px; animation-delay: 0.18s; }
.vinyl-bars i:nth-child(3) { height: 8px; animation-delay: 0.36s; }

@keyframes barBounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* 播放条 */
.player-bar {
  pointer-events: auto;
  max-width: 880px;
  margin: 0 auto calc(16px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 10px;
  background: #221c17;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 40px;
  box-shadow: 0 10px 36px rgba(40, 28, 20, 0.3);
}

.pbtn {
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: rgba(245, 239, 232, 0.7);
  padding: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  transition: color 0.16s ease, background 0.16s ease;
}

.pbtn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.pbtn[hidden] { display: none; }

.pbtn-main {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  transition: background 0.2s ease;
}

.pbtn-main:hover { background: rgba(255, 255, 255, 0.24); }

/* 播放中：整个按钮变成主色，"正在播放"一眼可见 */
.pbtn-main.playing { background: var(--accent); }

.pbtn-mode {
  width: 30px;
  height: 30px;
  font-size: 15px;
  line-height: 1;
  color: rgba(245, 239, 232, 0.55);
}

.pbtn-mode.on { color: var(--accent); }

.vol-wrap { position: relative; display: flex; }

.vol-pop {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  background: #2b241e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 13px 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 6;
}

.vol-pop[hidden] { display: none; }

.vol-pop input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 104px;
  height: 3px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  outline: none;
  display: block;
}

.vol-pop input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.vol-pop input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.pbtn-like.on { color: #e0785f; }

/* 小唱片 */
.pbtn-vinyl {
  width: 42px;
  height: 42px;
  padding: 0;
  background: transparent;
}

.pbtn-vinyl:hover { background: transparent; }

.mini-disc {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #f7f2ea 0 6.5%, transparent 7%),
    radial-gradient(circle, #c0705c 0 32%, #8f4732 32% 34%, transparent 34%),
    repeating-radial-gradient(circle, #191919 0 1px, #2b2b2b 1px 2px, #1d1d1d 2px 3px);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.7), 0 1px 4px rgba(0, 0, 0, 0.45);
}

.mini-disc.spinning { animation: vinylSpin 5s linear infinite; }

@keyframes vinylSpin {
  to { transform: rotate(360deg); }
}

/* 中间信息区 */
.player-mid {
  flex: 1;
  min-width: 0;
  display: grid;
  /* minmax(0,1fr)：默认的 auto 轨道会被 nowrap 标题的 min-content 撑宽，
     一撑宽 text-overflow:ellipsis 就失效 —— 长歌名直接盖到时间/按钮上。 */
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}

.player-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.player-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 13px;
  color: #f2ebe3;
}

.player-title-track { display: block; }

.player-title-txt {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 长歌名滚动：两份文本首尾相接，位移正好「一份文本 + 一个空档」，
   回到起点时看不出接缝（末尾接上开头，读起来是连续的一遍）。 */
.player-title.is-marquee .player-title-track {
  display: inline-flex;
  width: max-content;
  gap: var(--marquee-gap, 48px);
  animation: title-marquee var(--marquee-dur, 12s) linear infinite;
  will-change: transform;
}

.player-title.is-marquee .player-title-txt {
  overflow: visible;
  text-overflow: clip;
}

/* 右缘淡出：滚进来的字不会在容器边缘被硬切一刀 */
.player-title.is-marquee {
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 14px), transparent 100%);
}

/* 悬停/聚焦时停住，方便看清 */
.player-title.is-marquee:hover .player-title-track,
.player-title.is-marquee:focus-within .player-title-track {
  animation-play-state: paused;
}

@keyframes title-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-50% - (var(--marquee-gap, 48px) / 2))); }
}

.player-time {
  font-size: 11px;
  color: rgba(245, 239, 232, 0.42);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.player-track {
  position: relative;
  height: 3px;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 3px;
  cursor: pointer;
}

.player-track::after {
  content: "";
  position: absolute;
  inset: -9px 0;
}

.player-track-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.12s linear;
}

/* ---------------- 卡片内音频小条 ---------------- */

.audio-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.audio-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 11px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.audio-pill:hover { border-color: var(--accent); color: var(--ink); }

.audio-pill.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.pill-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
}

.audio-pill.on .pill-icon { background: var(--accent-deep); }

.pill-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-heart { color: var(--accent); font-size: 11px; flex: 0 0 auto; }

/* ---------------- 卡片内评论区 ---------------- */

.cmt-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 11px;
  /* iOS 触摸目标建议不小于 44px。原来只有 19px 高、宽度也偏窄，在手机上很难点准。 */
  padding: 12px 8px;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
  border-radius: 8px;
  margin-left: auto;
  transition: color 0.16s ease, background 0.16s ease;
}

/* 这个按钮本身只有 38×19，低于 iOS 的 44pt 触摸下限。
   用 ::after 把命中区撑到 44×44，视觉尺寸和布局完全不变。
   祖先 .card 的 overflow:hidden 裁不到它：卡片正文有 18/20px 内边距，
   而 44px 命中区只向外溢出 3px（横向）和 12.5px（纵向），都在内边距里。 */
.cmt-btn {
  position: relative;
}

.cmt-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.cmt-btn:hover { color: var(--ink-soft); background: var(--bg-deep); }
.cmt-btn.has { color: var(--accent-deep); }

.card-comments {
  border-top: 1px solid var(--line);
  padding: 14px 20px 16px;
  background: #fdfbf8;
}

.cmt-list { display: grid; gap: 8px; margin-bottom: 10px; }

.cmt-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.65;
}

.cmt-who {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent-deep);
}

.cmt-who.a-b { color: #2f5779; }

.cmt-text {
  flex: 1;
  min-width: 0;
  color: var(--ink-soft);
  word-break: break-word;
}

.cmt-del {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1;
  padding: 0 3px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.cmt-row:hover .cmt-del { opacity: 1; }

.cmt-empty { font-size: 12.5px; color: var(--ink-faint); }

.cmt-form { display: flex; gap: 8px; }

.cmt-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px !important;
  font-size: 13px !important;
  border-radius: 10px;
}

.cmt-send { padding: 7px 14px; font-size: 13px; }

/* ---------------- 查看器切换动效 ---------------- */

.media-in { animation: mediaIn 0.34s ease; }

@keyframes mediaIn {
  from { opacity: 0; transform: scale(0.975); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------------- 时间 / 季节背景 ---------------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

/* 天空色调：半透明叠加，不改 body 主背景，避免文字对比度出问题 */
.sky-wash {
  position: absolute;
  inset: 0;
  transition: background 2.4s ease;
  background: linear-gradient(180deg, rgba(255, 238, 216, 0.5) 0%, rgba(255, 247, 238, 0.18) 44%, transparent 70%);
}

body[data-phase="dawn"] .sky-wash {
  background: linear-gradient(180deg, rgba(255, 210, 190, 0.6) 0%, rgba(255, 233, 221, 0.26) 40%, transparent 68%);
}

body[data-phase="day"] .sky-wash {
  background: linear-gradient(180deg, rgba(208, 228, 244, 0.44) 0%, rgba(250, 247, 243, 0.14) 46%, transparent 72%);
}

body[data-phase="dusk"] .sky-wash {
  background: linear-gradient(180deg, rgba(255, 198, 168, 0.64) 0%, rgba(253, 224, 210, 0.3) 38%, transparent 66%);
}

body[data-phase="night"] .sky-wash {
  background: linear-gradient(180deg, rgba(180, 198, 226, 0.58) 0%, rgba(219, 228, 242, 0.26) 44%, transparent 72%);
}

/* 太阳 / 月亮 */
.sky-orb {
  position: absolute;
  top: 18%;
  right: 8%;
  width: 74px;
  height: 74px;
  /* 位移本身要"慢慢沉"，比换色更慢一点才像落日而不是闪一下；3s 与页面其它 2–2.4s
     的换色节奏属于同一档，不会显得脱节 */
  transition: transform 3s ease, filter 3s ease;
}

.sky-orb .orb-glow {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 198, 132, 0.4) 0%, rgba(255, 198, 132, 0) 68%);
  transition: background 2s ease;
}

.sky-orb .orb-body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 36% 32%, #fff6de, #ffd08d 62%, #f5bb79);
  box-shadow: 0 0 24px rgba(255, 190, 120, 0.42);
  transition: background 2s ease, box-shadow 2s ease;
}

.sky-orb .orb-shade {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #dfe7f5;
  opacity: 0;
  transform: translateX(var(--moon-shift, 100%));
  transition: transform 2s ease, opacity 2s ease;
}

body[data-phase="night"] .orb-glow {
  background: radial-gradient(circle, rgba(224, 233, 248, 0.68) 0%, rgba(224, 233, 248, 0) 72%);
}

body[data-phase="night"] .orb-body {
  background:
    radial-gradient(circle at 62% 56%, rgba(198, 209, 228, 0.42) 0 9%, transparent 10%),
    radial-gradient(circle at 44% 70%, rgba(198, 209, 228, 0.34) 0 6%, transparent 7%),
    radial-gradient(circle at 56% 36%, rgba(198, 209, 228, 0.28) 0 5%, transparent 6%),
    radial-gradient(circle at 38% 34%, #ffffff, #eff3fb 66%, #dde5f3);
  box-shadow: 0 0 30px rgba(214, 226, 246, 0.75);
}

body[data-phase="night"] .orb-shade { opacity: 1; }

/* 球的高度与明暗：只换颜色看不出"太阳在落"，所以再给它一条高度曲线。
   位移用百分比——相对球自身 74px 计算，手机上球不缩水也不会跑到屏幕外，
   桌面同理，不用为断点单独写一套。
   放在 .sky-orb（外层容器）而不是 .orb-body：外层没有任何 animation，
   只用 transform，两层分开不会和 .orb-body 的 background 过渡、
   .orb-shade 的 translateX 月相位移互相踩到。
   filter 加在父级会连同 .orb-glow 的光晕一起压暗，比单独改渐变更像太阳沉下去。 */
body[data-phase="dawn"] .sky-orb {
  /* 刚离地平线，仍然偏低；比黄昏亮一档，饱和度略提表示晨光 */
  transform: translateY(10%);
  filter: brightness(1.02) saturate(1.06);
}

body[data-phase="day"] .sky-orb {
  /* 日上三竿，回到常规位置，不加任何滤镜 */
  transform: translateY(0);
  filter: none;
}

body[data-phase="dusk"] .sky-orb {
  /* 明显下移 18%（约 13px），压暗一点、饱和度提上去——夕阳是暖而浓的红黄色 */
  transform: translateY(18%);
  filter: brightness(0.92) saturate(1.18);
}

body[data-phase="night"] .sky-orb {
  /* 月亮，位置略高（约 7px），去饱和做清冷月色 */
  transform: translateY(-10%);
  filter: brightness(1.06) saturate(0.72);
}

/* 云 */
/* 云：用一个元素的多层 radial-gradient 画鼓包 + 一条平底。
   之前用伪元素做凸起，凸起与主体颜色叠加后重叠处变浓，平底被压没，
   看上去就剩两个孤立的圆。em 单位让大小不同的云自动等比缩放。 */
.sky-cloud {
  position: absolute;
  font-size: 11px;
  width: 10.5em;
  height: 3.6em;
  opacity: 0;
  transition: opacity 2.4s ease;
  background:
    radial-gradient(circle 1.75em at 22% 54%, rgba(255, 255, 255, 0.8) 97%, transparent 100%),
    radial-gradient(circle 1.4em at 43% 44%, rgba(255, 255, 255, 0.8) 97%, transparent 100%),
    radial-gradient(circle 1em at 61% 58%, rgba(255, 255, 255, 0.8) 97%, transparent 100%),
    radial-gradient(circle 1.2em at 79% 63%, rgba(255, 255, 255, 0.8) 97%, transparent 100%),
    linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)) 0 100% / 100% 50% no-repeat;
}

body[data-phase="dawn"] .sky-cloud,
body[data-phase="day"] .sky-cloud { opacity: 0.45; }
body[data-phase="dusk"] .sky-cloud { opacity: 0.5; }
/* 夜里不放云：浅色夜空里云会和月亮叠成两个圆，喧宾夺主 */
body[data-phase="night"] .sky-cloud { opacity: 0; }

.sky-cloud.c1 { top: 13%; width: 104px; animation: skyDrift 96s linear infinite; }
.sky-cloud.c2 { top: 24%; font-size: 8px; animation: skyDrift 132s linear infinite; animation-delay: -46s; }
.sky-cloud.c3 { top: 5%; font-size: 13px; animation: skyDrift 158s linear infinite; animation-delay: -92s; }

@keyframes skyDrift {
  from { transform: translateX(-200px); }
  to { transform: translateX(calc(100vw + 200px)); }
}

/* 四季植物剪影 */
.sky-plant {
  position: absolute;
  bottom: 0;
  opacity: 0;
  transition: opacity 2.6s ease;
}

.sky-plant svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* 春：不是一棵树，而是横铺在页脚的一片草地 */
.p-spring { left: 0; right: 0; width: auto; height: 122px; }
.p-summer { right: -18px; width: 216px; height: 168px; }
.p-autumn { right: -22px; width: 188px; height: 306px; }
.p-winter { left: -16px; width: 166px; height: 306px; }

body[data-season="spring"] .p-spring { opacity: 0.22; }
body[data-season="summer"] .p-summer { opacity: 0.2; }
body[data-season="autumn"] .p-autumn { opacity: 0.22; }
body[data-season="winter"] .p-winter { opacity: 0.2; }

.sky-plant .trunk {
  fill: none;
  stroke: #8d7c66;
  stroke-width: 7;
  stroke-linecap: round;
}

/* 枫树：树干要粗，撑得住树冠 */
.p-autumn .trunk { stroke-width: 14; }
.p-autumn .trunk.limb { stroke-width: 7.5; }
.p-winter .trunk { stroke-width: 9; }

/* 春天：起伏的地面 + 小草 + 小花 */
.p-spring::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32px;
  background: #93b075;
  border-radius: 46% 38% 0 0 / 100% 76% 0 0;
}

.p-spring .grass,
.p-spring .flower {
  position: absolute;
  bottom: 7px;
  transform-origin: 50% 100%;
}

.p-spring .grass { width: 66px; height: 46px; }
.p-spring .flower { width: 32px; height: 52px; }

.p-spring .g1 { left: 3%; }
.p-spring .g2 { left: 20%; bottom: 2px; }
.p-spring .g3 { left: 37%; }
.p-spring .g4 { left: 61%; bottom: 3px; }
.p-spring .g5 { left: 83%; }
.p-spring .f1 { left: 11%; }
.p-spring .f2 { left: 46%; bottom: 2px; }
.p-spring .f3 { left: 73%; }

.p-spring .blade {
  fill: none;
  stroke: #7ba05c;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.p-spring .stem {
  fill: none;
  stroke: #8bab6b;
  stroke-width: 2;
  stroke-linecap: round;
}

.p-spring .petals circle { fill: #e0a9b3; }
.p-spring .core { fill: #e6c469; }

.p-autumn .canopy { fill: #a96940; }
.p-winter .pine path { fill: #64806a; }

.p-summer .leaf { fill: #7d9a6f; }
.p-summer .stem { fill: none; stroke: #7d9a6f; stroke-width: 4; stroke-linecap: round; }
.p-summer .bloom path { fill: #c9828b; }

/* 摆动：慢一点，不然像在抽搐 */
.p-spring .grass { animation: swaySoft 6.5s ease-in-out infinite; }
.p-spring .flower { animation: swaySoft 8s ease-in-out infinite; }
.p-spring .g2, .p-spring .f2 { animation-delay: -2.6s; }
.p-spring .g3 { animation-delay: -4.1s; }
.p-spring .g4 { animation-delay: -1.3s; }
.p-spring .g5 { animation-delay: -3.4s; }
.p-spring .f1 { animation-delay: -5.2s; }
.p-spring .f3 { animation-delay: -2.1s; }

.p-summer svg {
  animation: floatSoft 8s ease-in-out infinite;
}

.p-autumn svg {
  transform-origin: 50% 100%;
  animation: swaySoft 15s ease-in-out infinite;
}

.p-winter svg {
  transform-origin: 50% 100%;
  animation: swaySoft 19s ease-in-out infinite;
}

@keyframes swaySoft {
  0%, 100% { transform: rotate(-1.1deg); }
  50% { transform: rotate(1.1deg); }
}

@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* 落叶与雪 */
.sky-fall {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.sky-fall span {
  position: absolute;
  top: -28px;
  animation-name: skyFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.sky-fall .leaflet {
  width: 13px;
  height: 11px;
  border-radius: 70% 12% 70% 12%;
  background: #c0724c;
}

.sky-fall .flake {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 7px rgba(255, 255, 255, 1), 0 0 14px rgba(226, 236, 250, 0.7);
}

@keyframes skyFall {
  0% { transform: translate3d(0, -30px, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translate3d(46px, 100vh, 0) rotate(300deg); opacity: 0; }
}

/* 跟随系统"减少动态效果" */
@media (prefers-reduced-motion: reduce) {
  .sky-cloud,
  .sky-plant svg,
  .sky-fall span {
    animation: none !important;
  }
  .sky-fall { display: none; }
  /* 太阳的"沉下去"是位移动效，减动效时整条曲线取消：
     球固定在上方常规位置，只靠 data-phase 的天空色调区分时段 */
  .sky-orb {
    transition: none !important;
    transform: none !important;
    filter: none !important;
  }
}

/* ---------------- 消息提醒 ---------------- */

.bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 50%;
  color: var(--ink-soft);
  margin-right: 4px;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.bell:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.bell.has-unread { color: var(--accent-deep); }

.bell-dot {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 9.5px;
  line-height: 15px;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 0 0 2px var(--bg);
}

.bell-dot[hidden] { display: none; }

.notice-panel {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 50;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: 420px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(60, 44, 32, 0.18);
  overflow: hidden;
  animation: noticeIn 0.2s ease;
}

.notice-panel[hidden] { display: none; }

@keyframes noticeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.notice-clear {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
}

.notice-clear:hover { color: var(--accent-deep); background: var(--accent-soft); }

.notice-list { overflow-y: auto; padding: 6px; }

.notice-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
  transition: background 0.15s ease;
}

.notice-row:hover { background: var(--bg); }
.notice-row.unread { background: rgba(192, 112, 92, 0.07); }
.notice-row.unread:hover { background: rgba(192, 112, 92, 0.12); }

.notice-who {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-deep);
  padding-top: 1px;
}

.notice-who.a-b { color: #2f5779; }

.notice-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.notice-title {
  font-size: 12.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-text {
  font-size: 12px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-time {
  flex: 0 0 auto;
  font-size: 10.5px;
  color: var(--ink-faint);
  padding-top: 2px;
}

.notice-empty {
  padding: 26px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ---------------- 移动端 ---------------- */

@media (max-width: 640px) {
  .app { padding: 0 14px 100px; }

  .topbar {
    align-items: center;
    padding: 16px 0 12px;
    gap: 10px;
  }

  .brand h1 { font-size: 21px; }
  .counter { font-size: 12px; }

  .toolbar {
    width: 100%;
    justify-content: space-between;
  }

  .search { flex: 1; width: auto; min-width: 0; }
  .search:focus { width: auto; }

  .entry {
    grid-template-columns: 1fr;
    gap: 0;
    padding-bottom: 18px;
  }

  .entry::before { display: none; }
  .entry::after { display: none; }

  .entry-date {
    text-align: left;
    padding: 0 0 7px 2px;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .entry-date .d { font-size: 15px; }

  .card::after { display: none; }
  .card-body { padding: 15px 17px; }
  .card h2 { font-size: 16.5px; }

  .thumbs.n1 .thumb { height: 240px; }
  .thumbs.n2 .thumb { height: 130px; }
  .thumbs.n4 .thumb { height: 108px; }

  .modal { padding: 0; }
  .modal-box {
    margin: 0;
    border-radius: 0;
    min-height: 100dvh;
    max-height: 100dvh;
  }
  .row { grid-template-columns: 1fr; }

  .viewer-actions .btn { padding: 6px 10px; font-size: 12px; }
  .viewer-bottom { padding: 14px 16px 20px; }
  .viewer-nav { display: none; }

  .tabs { flex: 1; order: 0; }
  .tab { flex: 1; padding: 7px 4px; font-size: 12.5px; text-align: center; }

  .meetbar-inner { padding: 11px 14px; gap: 10px; }
  .meet-num { font-size: 22px; }
  .meet-clocks { gap: 14px; }
  .clock-time { font-size: 14px; }
  .clock-city { font-size: 12px; }

  .view-actions { margin-top: 14px; }
  .view-actions .btn { padding: 8px 12px; font-size: 13px; }

  .note-compose { padding: 13px; margin-top: 14px; }
  .note-del { opacity: 0.65; }
  .note-card { padding: 13px 15px; }

  .cap-card { padding: 15px; gap: 12px; }
  .cap-seal { width: 38px; height: 38px; flex-basis: 38px; }
  .cap-title { font-size: 16px; }

  .reply-form .btn { padding: 8px 13px; }
  .welcome-card { padding: 30px 24px 26px; }

  .player-bar {
    margin: 0 10px calc(10px + env(safe-area-inset-bottom));
    padding: 5px 10px 5px 6px;
    gap: 2px;
    border-radius: 30px;
  }
  .pbtn { padding: 5px; }
  .pbtn-mode { width: 24px; height: 24px; font-size: 14px; }
  .vol-pop { bottom: 42px; padding: 11px 10px; }
  .vol-pop input[type="range"] { width: 88px; }
  .card-comments { padding: 12px 15px 14px; }
  .cmt-del { opacity: 0.55; }
  .notice-panel {
    top: 64px;
    right: 12px;
    width: calc(100vw - 24px);
    max-height: 60vh;
  }
  /* 铃铛保持 44px 触摸区域，视觉上靠内部图标保持小尺寸 */
  .bell { width: 44px; height: 44px; }
  .audio-pill { padding: 7px 10px; font-size: 12.5px; }
  .vt { width: 40px; height: 40px; }
  .viewer-thumbs { padding-bottom: 9px; }
  .vinyl-op { width: 26px; height: 26px; }
  .pbtn-vinyl { width: 36px; height: 36px; }
  .mini-disc { width: 32px; height: 32px; }
  .pbtn-main { width: 32px; height: 32px; }
  .player-time { display: none; }
  .vinyl-sheet { border-radius: 14px 14px 0 0; }
  .vinyl-sheet.open { max-height: 56vh; }
  .vinyl-list { max-height: calc(56vh - 46px); }
  .foot { padding-bottom: 78px; }
}

/* ============================================================
   心情日历 v3 —— 追加段。全部用 .cal- / .mood- 前缀隔离，
   不改动上面任何现有规则（设计规范 §10.1）。
   ============================================================ */

/* ---------- 四季主题变量（规范 §1.2） ---------- */
/* 挂在 .cal-box[data-season] 上，作用域限于日历弹窗内部。 */

.cal-box {
  /* 语义分层色：跨季恒定，不随季节变（规范 §1.2.1） */
  --cal-fest: #8a8078;
  --cal-fest-deep: #7f766d;
  --brand-keep: #98513c;
  /* 底与纹 */
  --cal-bg: #fdf6f2;
  --cal-line: #ecd2ce;
  --cal-fine: #f6e8e4;
  /* 文字 */
  --cal-ink: #3a322c;
  --cal-soft: #6b5c53;
  --cal-muted: #7c6f65;
  /* 强调 */
  --cal-accent: #b85f6e;
  --cal-accent-deep: #8f4450;
  --cal-accent-soft: #f7e9ec;
}

.cal-box[data-season="summer"] {
  --cal-bg: #f3f7f1;
  --cal-line: #d5e3d2;
  --cal-fine: #e8f0e6;
  --cal-ink: #33372f;
  --cal-soft: #5f6a58;
  --cal-muted: #6b7264;
  --cal-accent: #4e7a5c;
  --cal-accent-deep: #38604a;
  --cal-accent-soft: #e6efe6;
}

.cal-box[data-season="autumn"] {
  --cal-bg: #fbf4e9;
  --cal-line: #e7d3b6;
  --cal-fine: #f4e8d5;
  --cal-ink: #38302a;
  --cal-soft: #6e6053;
  --cal-muted: #7a6d5e;
  --cal-accent: #a5652f;
  --cal-accent-deep: #7d4a20;
  --cal-accent-soft: #f6ecdf;
}

.cal-box[data-season="winter"] {
  --cal-bg: #eff2f5;
  --cal-line: #d2dae4;
  --cal-fine: #e6ebf0;
  --cal-ink: #333840;
  --cal-soft: #5e6874;
  --cal-muted: #5f6a78;
  --cal-accent: #4a6784;
  --cal-accent-deep: #36506a;
  --cal-accent-soft: #e5ebf2;
}

/* ---------- 弹窗外壳（规范 §5.1） ---------- */

.cal-modal {
  z-index: 80;
}

.modal-box.cal-box {
  position: relative;
  background-color: var(--cal-bg);
  /* 方格纸：格线 22px，与日期列不对齐是有意的（规范 §4.4） */
  background-image:
    linear-gradient(to right, var(--cal-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--cal-line) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0 0;
  border-radius: 18px;
  max-width: 440px;
  width: 440px;
  max-height: min(88dvh, 760px);
  height: auto;
  margin: 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

/* ---------- 季节横幅（规范 §4.1） ---------- */

.cal-banner {
  position: relative;
  flex: 0 0 auto;
  height: 148px;
  overflow: hidden;
}

/* 两层绝对定位的 img 交叉淡入（规范 §5.1）。
   不用 background-image：那样没法做交叉淡入。 */
.cal-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cal-banner-img.on { opacity: 1; }

/* 横幅下缘融进纸面，避免硬边切割 */
.cal-banner-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  background: linear-gradient(to top, var(--cal-bg), transparent);
  pointer-events: none;
}

/* 月份纸签（规范 §4.2）
   left 用 56px 而不是规范写的 14px：翻月按钮是 34px 宽、贴在横幅左边缘
   （§4.3），纸签如果从 14px 开始就会和按钮叠在一起、把「10月」挡住。
   56px 正好让开按钮，和规范 §8.2 线框里纸签缩进的位置一致。 */
.cal-chip {
  position: absolute;
  left: 56px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  padding: 6px 14px 8px;
  background: rgba(250, 247, 243, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(70, 52, 40, 0.14);
  pointer-events: none;
}

@supports not ((backdrop-filter: blur(6px)) or (-webkit-backdrop-filter: blur(6px))) {
  .cal-chip { background: rgba(250, 247, 243, 0.94); }
}

.cal-chip-m {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1.15;
}

.cal-chip-y {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-top: 1px;
}

/* 翻页按钮：34px 视觉直径，::after 把命中区撑到 44px（规范 §4.3） */
.cal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  /* iOS 触摸目标建议不小于 44×44。视觉上还是小圆钮，但可点区域是 44px */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 8px rgba(70, 52, 40, 0.16);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

/* 命中区用 ::after 撑到 44×44（inset 会被 border-box 吃掉 2px，
   所以这里直接给死尺寸 + 居中位移，保证正好 44×44） */
.cal-nav::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.cal-nav.prev { left: 10px; }
.cal-nav.next { right: 10px; }

.cal-nav:hover { background: rgba(255, 255, 255, 0.98); box-shadow: 0 3px 12px rgba(70, 52, 40, 0.2); }
.cal-nav:active { background: rgba(240, 235, 229, 0.96); color: var(--ink-soft); transform: translateY(-50%) scale(0.94); }
.cal-nav:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: 2px; }

/* ---------- 表头条（规范 §5.2） ---------- */

.cal-bar {
  flex: 0 0 auto;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.cal-today {
  /* iOS 触摸目标建议不小于 44px 高。原来 30px，在手机上不好点。 */
  height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  background: var(--accent-soft);
  border: 1px solid #ecd8cd;
  color: var(--accent-deep);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.cal-today:hover { background: #f2ddd3; }
.cal-today:active { transform: scale(0.97); }
.cal-today:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }
.cal-today[hidden] { display: none; }

.cal-stat {
  font-size: 12px;
  color: var(--cal-muted);
  font-variant-numeric: tabular-nums;
}

.cal-stat.is-zero { color: var(--cal-soft); }

/* ---------- 星期行（规范 §5.3） ---------- */

.cal-week {
  flex: 0 0 auto;
  height: 32px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: center;
}

.cal-wd {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--cal-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cal-wd.is-weekend { color: #98513c; font-weight: 600; }

/* ---------- 节日条（规范 §5.3.1） ---------- */

/* 节日条（规范 §5.3.1）
   高度定 44px 而不是规范表格里的 28px：§6 的触摸目标硬下限是 44px，
   而 overflow-x:auto 会把 overflow-y 强制成 auto，::after 撑不高。
   条目文字仍是 11px，视觉上仍是一行细条。 */
.cal-fest-bar {
  flex: 0 0 auto;
  height: 44px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 8px;
  align-items: center;
  border-bottom: 1px solid var(--cal-line);
  scrollbar-width: none;
}

.cal-fest-bar::-webkit-scrollbar { display: none; }
.cal-fest-bar[hidden] { display: none; }

.cal-fest-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--cal-fest-deep);
  background: none;
  border: none;
  min-height: 44px;
  padding: 0 4px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 6px;
}

.cal-fest-item:hover { background: var(--cal-fine); }
.cal-fest-item:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: 1px; }

.cal-fest-sq {
  width: 8px;
  height: 8px;
  background: var(--cal-fest);
  border-radius: 2px;
  flex: 0 0 auto;
}

/* ---------- 格子区（规范 §5.4） ---------- */

.cal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 4px 16px 12px;
}

.cal-cell {
  position: relative;
  min-height: 56px;
  padding: 4px 4px 6px 7px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
}

.cal-cell:hover { background: rgba(184, 107, 85, 0.06); }
.cal-cell:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: -2px; border-radius: 8px; }

.cal-cell.is-empty { cursor: default; }
.cal-cell.is-empty:hover { background: none; }

/* 未来日期：不可点 */
.cal-cell.is-future {
  cursor: default;
  color: var(--cal-muted);
}

.cal-cell.is-future:hover { background: none; }
.cal-cell.is-future .cal-num { color: var(--cal-muted); }
.cal-cell.is-future .cal-mood { opacity: 0.45; }

/* 今天 */
.cal-cell.is-today { background: rgba(184, 107, 85, 0.08); }
.cal-cell.is-today.has-mood { background: rgba(184, 107, 85, 0.1); }

.cal-today-dot {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cal-accent-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* 选中 */
.cal-cell.is-selected { box-shadow: inset 0 0 0 1.5px var(--cal-accent-deep); border-radius: 8px; }

/* 日期数字：左对齐 + 等宽数字（规范 §5.4） */
.cal-num {
  font-size: 15px;
  font-weight: 500;
  color: var(--cal-ink);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.cal-cell.is-weekend .cal-num { color: #98513c; }

/* ---------- 纪念日文字标记（规范 §5.5 权重改版） ----------
   权重：第 x 年纪念日 = 生日 > 第几百天纪念日 > 节日。
   前两档是实色药丸（最醒目），第三档是浅底药丸，节日只留右上角灰方块。
   格子内宽在 375px 屏上只有 ~42px，所以这里只写 3–4 个字的缩写，
   完整说法在「本月纪念」条和当天视图里。
   紧跟在日期数字下面（不贴在格子底部，否则会看着像下一行的）。 */
.cal-badge {
  align-self: stretch;
  margin-top: 2px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  /* 跟着屏幕宽走：320px 屏 8px、375px 屏 9.4px、桌面封顶 10px。
     四个字的「博文生日」在最窄的格子也放得下。 */
  font-size: clamp(8px, 2.5vw, 10px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  flex: 0 0 auto;
}

/* 第一档：周年 / 生日（同权重，都用实色） */
.cal-badge.is-anniv { background: var(--brand-keep); color: #fff; }
.cal-badge.is-bday { background: var(--cal-accent-deep); color: #fff; }

/* 第三档：整百天 —— 浅底，比节日重、比前两档轻 */
.cal-badge.is-hundred {
  background: var(--cal-fine);
  color: var(--brand-keep);
  box-shadow: inset 0 0 0 1px rgba(152, 81, 60, 0.38);
}

/* ---------- 「本月纪念」条（格子放不下的完整说法） ---------- */

.cal-memo {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--cal-line);
  background: var(--cal-bg);
  max-height: 96px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.cal-memo[hidden] { display: none; }

.cal-memo-item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border: none;
  background: none;
  text-align: left;
  font-size: 12.5px;
  color: var(--cal-ink);
  cursor: pointer;
}

.cal-memo-item:hover { background: var(--cal-fine); }
.cal-memo-item:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: -2px; }

.cal-memo-date {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--cal-soft);
  font-variant-numeric: tabular-nums;
}

.cal-memo-ico {
  flex: 0 0 auto;
  width: 13px;
  text-align: center;
  line-height: 1;
  font-size: 10px;
}

.cal-memo-item.is-anniv .cal-memo-ico,
.cal-memo-item.is-hundred .cal-memo-ico { color: var(--brand-keep); }

.cal-memo-item.is-bday .cal-memo-ico { color: var(--cal-accent-deep); }

.cal-memo-txt {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-memo-item.is-anniv .cal-memo-txt,
.cal-memo-item.is-bday .cal-memo-txt { font-weight: 600; }

.cal-memo-item.is-hundred .cal-memo-txt { color: var(--cal-soft); }

/* 右上角节日角标：灰色小方块（规范 §5.6.3） */
.cal-fest {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--cal-fest);
}

/* 心情图标：竖排最多 2 个，她（圆）在上、我在下（方）。
   圆形 22px / 方形 19px —— 方形画布更大，按面积等重换算后小 2px（规范 §5.4）。 */
.cal-moods {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-top: 2px;
}

.cal-mood {
  display: block;
  flex: 0 0 auto;
  /* PNG 在圆角外是透明的，必须用 drop-shadow，不能用 box-shadow */
  filter: drop-shadow(0 1px 2px rgba(46, 42, 38, 0.18));
}

.cal-mood.is-round { width: 22px; height: 22px; }
.cal-mood.is-square { width: 19px; height: 19px; }

/* 今天的「＋」引导（规范 §5.4 可发现性第 2 条） */
.cal-plus {
  font-size: 12px;
  color: var(--cal-accent-deep);
  line-height: 1;
  margin-top: 1px;
  font-weight: 500;
}

/* 桌面端悬停时的「＋」 */
@media (hover: hover) and (pointer: fine) {
  .cal-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 16px;
    color: var(--cal-accent-deep);
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
  }
  .cal-cell.is-empty:hover::after { content: "＋"; opacity: 1; }
}

/* ---------- 底部图例（规范 §8.2） ---------- */

.cal-foot {
  flex: 0 0 auto;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-top: 1px solid var(--cal-line);
  background: var(--cal-bg);
  font-size: 11px;
  color: var(--cal-soft);
}

.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.cal-legend-round { width: 16px; height: 16px; }
.cal-legend-square { width: 14px; height: 14px; }

.cal-legend-sq {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cal-fest);
  display: inline-block;
}

.cal-legend-fest[hidden] { display: none; }

/* ---------- 当天视图（规范 §5.7 / §5.8） ---------- */

.cal-dayview {
  position: absolute;
  inset: 0;
  background: var(--cal-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 3;
}

.cal-dayview[hidden] { display: none; }

.cal-dayview-head {
  flex: 0 0 auto;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 0 4px;
  border-bottom: 1px solid var(--cal-line);
}

.cal-dayview-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--cal-ink);
  letter-spacing: 0.02em;
  text-align: center;
  flex: 1 1 auto;
  min-width: 0;
}

.cal-dv-btn {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  color: var(--cal-soft);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: 10px;
  padding: 0 8px;
}

.cal-dv-btn:hover { background: var(--cal-fine); color: var(--cal-ink); }
.cal-dv-btn:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: -2px; }

.cal-dv-close {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  color: var(--cal-soft);
  cursor: pointer;
  border-radius: 10px;
  padding: 0;
}

.cal-dv-close:hover { background: var(--cal-fine); color: var(--cal-ink); }
.cal-dv-close:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: -2px; }

/* 节日 / 纪念日一行文字 */
.cal-dayview-fest {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--cal-soft);
  line-height: 1.6;
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: baseline;
}

.cal-dv-sep { color: var(--cal-muted); }

.cal-dv-fest { color: var(--cal-fest-deep); }
.cal-dv-keep { color: var(--brand-keep); font-weight: 600; }

/* 当天视图里的标记图标（♥ / 🎂 / ● / ▪），和格子里的颜色呼应 */
.cal-dv-ico {
  display: inline-block;
  margin-right: 4px;
  font-size: 10px;
  vertical-align: 1px;
}

.cal-dayview-list {
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  padding: 0 16px 12px;
}

.cal-entry {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
}

.cal-entry-icon {
  width: 32px;
  height: 32px;
  display: block;
}

.cal-entry-icon.is-square { width: 29px; height: 29px; }

.cal-entry-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* 代记提示：by !== author 时出现（design-spec §5.8.1）。
   文案用真名，不用「你」—— 两端看到的一致。 */
.cal-entry-by {
  font-size: 11.5px;
  color: var(--cal-muted);
  margin-left: 6px;
  white-space: nowrap;
}

.cal-entry-mood {
  font-size: 13px;
  color: var(--cal-ink);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cal-entry-mood img { width: 18px; height: 18px; display: block; }

.cal-entry-note {
  font-size: 14px;
  line-height: 1.75;
  color: var(--cal-soft);
  margin: 4px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.cal-entry-time {
  font-size: 11px;
  color: var(--cal-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 5px;
  display: block;
}

/* 「XX帮你记的」——代记标记。
   用品牌红的浅底，和作者名区分开，但不要抢心情图标的位置。 */
.cal-entry-by {
  font-size: 11px;
  color: var(--cal-accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}

/* 「还没记」的空位提示 */
.cal-entry-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--cal-muted);
  background: transparent;
  box-shadow: none;
  grid-template-columns: 32px 1fr;
  display: grid;
  gap: 10px;
  align-items: center;
}

.cal-entry-empty-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px dashed var(--line);
}

/* 删除按钮：唯一允许小于 44px 的元素，靠二次确认兜底（规范 §6）
   规范要求「扩到 ≥ 44×28，并在行尾留 44 高的点击带」 */
.cal-entry-del {
  position: absolute;
  right: 8px;
  top: 8px;
  border: none;
  background: none;
  color: var(--ink-faint);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 8px;
  min-width: 44px;
  /* 规范原本允许 44×28（靠二次确认兜底），但这里给足 44×44 更保险，
     iOS 上不用瞄准。 */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  opacity: 0.65;
}

.cal-entry-del:hover { background: rgba(0, 0, 0, 0.05); color: #a3372c; }
.cal-entry-del:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: 1px; opacity: 1; }

/* ---------- 录入表单（规范 §5.9） ---------- */

.mood-form {
  flex: 0 0 auto;
  display: grid;
  gap: 12px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--cal-line);
  background: var(--cal-bg);
}

.mood-form-who {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--cal-soft);
}

/* 身份切换 chip：圆形=简博文 / 方形=刘宗熹
   触摸目标 ≥44px（规范 §6 硬下限） */
.mood-who {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 3px 14px 3px 10px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mood-who:hover { border-color: #d8c4b4; }
.mood-who:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: 1px; }

.mood-who.on {
  border-color: var(--cal-accent);
  background: var(--cal-accent-soft);
  color: var(--cal-ink);
  font-weight: 500;
}

.mood-who-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  background: var(--ink-faint);
}

.mood-who-dot.is-round { border-radius: 50%; }
.mood-who-dot.is-square { border-radius: 3px; }
.mood-who.on .mood-who-dot { background: var(--cal-accent-deep); }

.mood-form-label {
  font-size: 12px;
  color: var(--cal-muted);
  line-height: 1.4;
}

.mood-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 -4px;
}

.mood-opt {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.14s ease;
}

.mood-opt img {
  width: 32px;
  height: 32px;
  display: block;
  opacity: 0.78;
  transition: transform 0.14s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.14s ease;
}

.mood-opt:hover img { opacity: 1; }
.mood-opt:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: 1px; }

.mood-opt.on {
  background: var(--cal-accent-soft);
  border-radius: 10px;
}

.mood-opt.on img { transform: scale(1.12); opacity: 1; }

.mood-input-wrap { position: relative; }

textarea.input.mood-input {
  min-height: 64px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.7;
  width: 100%;
  padding-bottom: 22px;
}

.mood-count {
  position: absolute;
  right: 10px;
  bottom: 7px;
  font-size: 11px;
  color: var(--cal-muted);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.mood-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  /* 「保存」是主操作，不能被推到折叠线以下 —— 粘在表单底部 */
  position: sticky;
  bottom: 0;
  background: var(--cal-bg);
  padding-top: 4px;
}

.mood-actions .btn { min-height: 44px; }

/* 保存按钮：白字在 --accent-deep 上 5.87:1，在 --accent 上只有 3.98:1（规范 §1.3） */
.mood-save {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

.mood-save:hover { background: #7f422f; border-color: #7f422f; }
.mood-save:disabled { opacity: 0.6; cursor: not-allowed; }

.mood-add-btn {
  border: none;
  background: none;
  color: var(--cal-accent-deep);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mood-add-btn:hover { background: var(--cal-accent-soft); }
.mood-add-btn:focus-visible { outline: 2px solid var(--cal-accent-deep); outline-offset: 1px; }

/* ---------- 顶部提示条（规范 §5.9） ---------- */

.moodbar {
  margin: 8px 0 4px;
}

.moodbar[hidden] { display: none; }

.moodbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid #ecd8cd;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.moodbar-inner:hover { background: #f2ddd3; border-color: #e3c6b8; }
.moodbar-inner:active { transform: translateY(1px); }
.moodbar-inner:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

.moodbar-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
}

/* 两条都记了的时候，提示条里显示两个图标（她的圆在上、我的方在下）。
   容器从圆形改成竖排的胶囊，容纳 18px 的两个图标。
   规范 §5.9：形状 = 身份，提示条和日历格子保持一致。
   （用 .moodbar-icon-two 类，不用 :has() —— iOS Safari 15.4 以下不支持 :has） */
.moodbar-icon.moodbar-icon-two {
  width: 26px;
  height: 40px;
  border-radius: 13px;
  grid-template-rows: 1fr 1fr;
  place-items: center;
  padding: 2px 0;
  gap: 1px;
}

.moodbar-icon img {
  width: 26px;
  height: 26px;
  display: block;
}

/* 两个图标时各自缩小到 18px（规范定的手机端最佳尺寸） */
.moodbar-icon.moodbar-icon-two img {
  width: 18px;
  height: 18px;
}

.moodbar-icon .moodbar-empty {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px dashed var(--ink-faint);
}

.moodbar-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 6px;
}

.moodbar-main {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
}

.moodbar-sub {
  font-size: 12px;
  color: var(--accent-deep);
  line-height: 1.5;
}

.moodbar-cta {
  font-size: 12.5px;
  color: var(--accent-deep);
  white-space: nowrap;
  flex: 0 0 auto;
}

.moodbar-cta[hidden] { display: none; }

/* ---------- 时间轴时分（规范 §5.11） ---------- */

.entry-time {
  display: block;
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ---------- 节日开关（规范 §5.11.2） ---------- */

/* 生日选择：两个 select（月份 / 日期），直接产出 'MM-DD'，不做格式转换 */
.md-picker {
  display: flex;
  align-items: center;
  gap: 6px;
}

.md-picker .input {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 8px;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239b9188' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 24px;
}

.md-dash {
  color: var(--ink-faint);
  font-size: 13px;
  flex: 0 0 auto;
}

.fest-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 8px 0 4px;
}

.fest-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  min-height: 32px;
}

.fest-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-deep);
  cursor: pointer;
  margin: 0;
}

/* ============================================================
   响应式：平板 641–767px
   ============================================================ */

@media (min-width: 641px) and (max-width: 767px) {
  .modal-box.cal-box {
    max-width: min(520px, 92vw);
    width: min(520px, 92vw);
    max-height: min(86dvh, 720px);
    border-radius: 18px;
  }

  .cal-banner { height: 132px; }
  .cal-num { font-size: 14px; }
  .cal-cell { min-height: 50px; padding: 3px 3px 5px 5px; }
  .cal-mood.is-round { width: 21px; height: 21px; }
  .cal-mood.is-square { width: 19px; height: 19px; }
  .cal-grid { padding: 4px 14px 12px; }
  .cal-bar { padding: 0 14px; }
}

/* ============================================================
   响应式：手机 ≤640px（底部抽屉）
   ============================================================ */

@media (max-width: 640px) {
  /* 保留底部抽屉形态，覆盖现有的全屏规则 */
  .modal.cal-modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-box.cal-box {
    min-height: 92dvh !important;
    max-height: 92dvh !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 92dvh !important;
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    /* 底部安全区：iPhone 上别让最后一排贴到 Home 指示条 */
    padding-bottom: env(safe-area-inset-bottom);
  }

  .cal-banner { height: 104px; }
  .cal-chip { left: 62px; bottom: 10px; padding: 5px 11px 7px; }
  .cal-chip-m { font-size: 21px; }
  .cal-chip-y { font-size: 10px; }

  .cal-bar { height: 40px; padding: 0 8px; }
  /* iOS 触摸目标 ≥44px。这里不能压回 30px —— 上一条规则会被它覆盖掉。 */
  .cal-today { height: 44px; padding: 0 14px; font-size: 12px; }

  .cal-week { height: 30px; }

  /* 节日条保持 44px：条目是 44px 触摸目标，条太矮会把它压扁 */
  .cal-fest-bar { height: 44px; padding: 0 8px; }

  /* iPhone SE 375px：8px 内边距 + 2px 列间距 → 每列 49.6px，7 列放得下 */
  .cal-grid {
    gap: 2px;
    padding: 3px 8px 10px;
  }

  .cal-cell {
    min-height: 46px;
    padding: 3px 3px 5px 4px;
  }

  .cal-num { font-size: 13px; }
  .cal-today-dot { width: 22px; height: 22px; font-size: 12px; }

  .cal-mood.is-round { width: 20px; height: 20px; }
  .cal-mood.is-square { width: 18px; height: 18px; }

  .cal-badge { height: 13px; border-radius: 3px; letter-spacing: -0.3px; }
  .cal-memo { max-height: 78px; }
  .cal-memo-item { padding: 4px 12px; font-size: 12px; }

  .cal-foot { height: 30px; font-size: 10.5px; gap: 10px; }

  .cal-dayview-title { font-size: 17px; }
  .cal-dayview-list { padding: 0 12px 12px; }
  .cal-dayview-fest { padding: 8px 12px; }
  .mood-form { padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); }

  /* 手机端表情 4 列 × 2 行：8×44px 放不进 375px 屏 */
  .mood-picker { grid-template-columns: repeat(4, 1fr); gap: 6px; }

  .mood-actions { flex-direction: column-reverse; }
  .mood-actions .btn { width: 100%; justify-content: center; }
  .mood-actions .mood-add-row { display: flex; justify-content: center; }

  .moodbar-inner { padding: 9px 12px; gap: 8px; }
  .moodbar-icon { width: 28px; height: 28px; }
  .moodbar-icon img { width: 23px; height: 23px; }
  .moodbar-main { font-size: 13px; }
  .moodbar-cta { font-size: 12.5px; }

  /* 时间轴左列改成横排后，时分跟在日期后面 */
  .entry-time { margin-top: 0; }
}

@media (max-width: 430px) {
  .cal-chip { left: 60px; padding: 5px 11px 7px; }
  .cal-chip-m { font-size: 20px; }
  .moodbar-main { font-size: 12.5px; }
}

/* ============================================================
   横屏：左右分栏（iPhone 844×390 等）
   ============================================================
   手机横屏时 100dvh 很小（390px），7 列日历会被压扁。
   改成左日历 / 右当天视图两栏，横幅横跨顶部。
   断点用「高度矮 + 横屏」而不是宽度 —— 横屏时宽度反而变大了。 */

@media (orientation: landscape) and (max-height: 560px) {
  .modal.cal-modal {
    padding: 0;
    align-items: stretch;
  }

  .modal-box.cal-box {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding-bottom: env(safe-area-inset-bottom);

    /* 两栏：左 = 日历，右 = 当天视图
       每一行都要显式指定 grid-area，否则会多出隐式列 */
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "banner banner"
      "bar    bar"
      "week   week"
      "fest   fest"
      "grid   dayview"
      "foot   dayview";
  }

  .cal-banner {
    grid-area: banner;
    height: 76px;
  }

  .cal-banner-fade { height: 18px; }

  .cal-chip { left: 58px; bottom: 8px; padding: 4px 10px 6px; }
  .cal-chip-m { font-size: 18px; }
  .cal-chip-y { font-size: 10px; }

  .cal-nav { width: 30px; height: 30px; }
  .cal-nav.prev { left: 8px; }
  .cal-nav.next { right: 8px; }

  /* 表头 + 星期行 + 节日条 + 格子区 全在左栏 */
  .cal-bar {
    grid-area: bar;
    height: 38px;
    padding: 0 10px;
  }

  .cal-week {
    grid-area: week;
    height: 26px;
  }

  .cal-fest-bar {
    grid-area: fest;
    height: 30px;
  }

  .cal-fest-item { min-height: 30px; }

  .cal-scroll {
    grid-area: grid;
    overflow-y: auto;
  }

  .cal-grid {
    gap: 2px;
    padding: 2px 8px 8px;
  }

  .cal-cell {
    min-height: 40px;
    padding: 2px 3px 3px 4px;
  }

  .cal-num { font-size: 12px; }
  .cal-today-dot { width: 20px; height: 20px; font-size: 11px; }
  .cal-mood.is-round { width: 18px; height: 18px; }
  .cal-mood.is-square { width: 16px; height: 16px; }
  .cal-badge { height: 12px; letter-spacing: -0.4px; }
  .cal-memo { max-height: 72px; }

  .cal-foot {
    grid-area: foot;
    height: 28px;
    font-size: 10.5px;
  }

  /* 当天视图：变成右栏（不再覆盖整张纸），跨满右列所有行 */
  .cal-dayview {
    grid-area: dayview;
    grid-row: 1 / -1;
    grid-column: 2;
    position: static;
    inset: auto;
    border-left: 1px solid var(--cal-line);
    overflow-y: auto;
    z-index: auto;
  }

  .cal-dayview-head { height: 44px; }
  .cal-dayview-title { font-size: 16px; }
  .cal-dayview-list { padding: 0 12px 10px; }
  .cal-dayview-fest { padding: 6px 12px; }
  .mood-form { padding: 10px 12px 14px; }

  /* 横屏空间够，表情 8 个一行 */
  .mood-picker { grid-template-columns: repeat(8, 1fr); }
  .mood-opt { min-width: 0; }
  .mood-actions { flex-direction: row; justify-content: flex-end; }
  .mood-actions .btn { width: auto; }
}

/* 横屏但高度够（平板横屏等）不适用上面的两栏 */
@media (orientation: landscape) and (min-height: 561px) {
  .modal-box.cal-box {
    width: min(720px, 94vw) !important;
    max-width: min(720px, 94vw) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 92dvh !important;
    border-radius: 18px !important;
    margin: auto !important;
  }
}

/* ============================================================
   动效降级（规范 §6）
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  /* 所有会动的东西都停掉（规范 §6）：弹窗入场、横幅淡入、表情选中回弹、
     提示条、翻月按钮、节日条、删除按钮…… */
  .cal-box, .modal, .cal-cell, .mood-opt, .moodbar-inner, .cal-fest-item,
  .cal-banner-img, .mood-who, .cal-nav, .cal-today, .cal-dv-btn, .cal-dv-close,
  .cal-entry-del, .mood-add-btn, .mood-input, .fest-toggle, .cal-plus,
  .moodbar, .cal-dayview, .cal-grid, .cal-chip, .cal-dayview-fest, .cal-entry {
    animation: none !important;
    transition: none !important;
  }
  /* 横幅两层交叉淡入 → 减动效时只显示当前那张，另一张直接不渲染 */
  .cal-banner-img:not(.on) { display: none; }
  .cal-banner-img.on { opacity: 1; }
}
