/* =========================================================
   家 · 日记 —— 界面样式
   移动端优先，桌面端在上层做增强。
   ========================================================= */

:root {
  --bg: #faf6f0;
  --bg-deep: #f3eade;
  --card: #ffffff;
  --ink: #332c26;
  --ink-2: #6d6055;
  --ink-3: #9b8d80;
  --line: #ecdfd0;
  --line-soft: #f4ece2;
  --accent: #c1703f;
  --accent-deep: #a45a2c;
  --accent-soft: #f8e9db;
  --sage: #7f9470;
  --sage-soft: #eef3e8;
  --danger: #b4543f;
  --danger-soft: #fbeae6;

  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 26px;

  --shadow-sm: 0 1px 2px rgba(87, 63, 45, 0.06);
  --shadow: 0 10px 26px -14px rgba(87, 63, 45, 0.28);
  --shadow-lg: 0 22px 54px -24px rgba(87, 63, 45, 0.4);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

/* hidden 属性优先于各组件的 display，避免面板被意外撑开 */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(120% 80% at 100% 0%, #fdf3e8 0%, rgba(253, 243, 232, 0) 55%),
    radial-gradient(90% 60% at 0% 0%, #f7ede0 0%, rgba(247, 237, 224, 0) 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 16px; }
svg { display: block; }

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

/* --------------------------------------------------------- 布局 */

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(88px + var(--safe-b));
}

.page {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 4px 18px 0;
}

/* --------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-t);
  background: rgba(250, 246, 240, 0.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid rgba(236, 223, 208, 0.7);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #c87340, #a95c2d);
  color: #fff8f0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px -6px rgba(164, 90, 44, 0.9);
}

.brand-mark-lg { width: 46px; height: 46px; border-radius: 14px; font-size: 21px; }

.brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--ink);
}

.topnav {
  display: none;
  gap: 4px;
  margin-left: 18px;
}

.topnav a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-2);
  transition: background 0.2s, color 0.2s;
}

.topnav a:hover { background: #f4ebdf; color: var(--ink); }
.topnav a.is-active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 「写一篇」：只在没有底部导航的大屏出现 */
.write-btn {
  display: none;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff8f0;
  background: linear-gradient(150deg, #c9743f, #a95c2d);
  box-shadow: 0 8px 18px -12px rgba(164, 90, 44, 0.95);
  transition: filter 0.18s, transform 0.18s;
}

.write-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #efe4d6;
  color: #7a6450;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid #e4d5c2;
  transition: transform 0.2s;
}

.avatar:hover { transform: scale(1.06); }

/* --------------------------------------------------------- 底部导航 */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: rgba(253, 250, 245, 0.96);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid rgba(236, 223, 208, 0.9);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  min-height: 46px;
  border-radius: 14px;
  color: var(--ink-3);
  transition: color 0.18s, background 0.18s, transform 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.tab-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.tab-label { font-size: 11.5px; letter-spacing: 0.5px; }
.tab.is-active { color: var(--accent-deep); }
.tab.is-active .tab-icon { stroke-width: 1.9; }

.tab-add { justify-content: center; }

.fab {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #c9743f, #a95c2d);
  box-shadow: 0 10px 22px -10px rgba(164, 90, 44, 0.9);
  transition: transform 0.18s, box-shadow 0.18s;
}

.fab svg { width: 22px; height: 22px; fill: none; stroke: #fff7ef; stroke-width: 2; stroke-linecap: round; }

.tab-add:active .fab { transform: scale(0.94); }

/* --------------------------------------------------------- 通用组件 */

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(150deg, #c9743f, #a95c2d);
  color: #fff8f0;
  box-shadow: 0 8px 20px -12px rgba(164, 90, 44, 0.95);
}

.btn-primary:hover { filter: brightness(1.04); }

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
}

.btn-ghost:hover { background: #fdf7f0; color: var(--ink); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #f2d5cd; }
.btn-danger:hover { background: #f8ded6; }

.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.field-inline { flex: 1 1 auto; margin-bottom: 0; }

.field-label {
  font-size: 12.5px;
  letter-spacing: 1px;
  color: var(--ink-3);
  text-transform: none;
}

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fdfaf6;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  appearance: none;
  -webkit-appearance: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: #d9b393;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(193, 112, 63, 0.1);
}

.input-date { max-width: 170px; }

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 13.5px;
  transition: all 0.16s;
  -webkit-tap-highlight-color: transparent;
}

.chip:hover { border-color: #ddc4ac; }
.chip.is-active {
  background: var(--accent-soft);
  border-color: #e2bc9c;
  color: var(--accent-deep);
  font-weight: 600;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #f3eade;
}

.seg-item {
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  padding: 7px 15px;
  border-radius: 999px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.seg-item.is-active {
  background: #fff;
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(120, 90, 60, 0.12);
}

.seg-sm .seg-item { font-size: 12.5px; padding: 5px 11px; }

.section { margin-top: 30px; }

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

.section-title { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 0.5px; }

.link { font-size: 13px; color: var(--ink-3); transition: color 0.18s; }
.link:hover { color: var(--accent-deep); }

.page-title { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: 0.5px; }
.page-sub { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.6; }

.empty {
  padding: 42px 18px;
  text-align: center;
  color: var(--ink-3);
}

.empty-icon { font-size: 26px; margin: 0 0 8px; opacity: 0.7; }
.empty-text { margin: 0 0 14px; font-size: 14px; }

/* --------------------------------------------------------- 首页 */

.greet { padding: 18px 4px 4px; }

.greet-date { margin: 0 0 6px; font-size: 12.5px; letter-spacing: 1.5px; color: var(--ink-3); }

.greet-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.5px;
  line-height: 1.35;
}

.greet-sub { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }

.quick {
  margin-top: 18px;
  padding: 16px 18px 14px;
  background: linear-gradient(160deg, #fffdfa, #fdf3e8);
  border-color: #f0dfcd;
}

.quick-head { display: flex; justify-content: space-between; align-items: baseline; }

.quick-label { font-size: 12.5px; color: var(--ink-2); letter-spacing: 0.5px; }
.quick-hint { font-size: 11.5px; color: var(--ink-3); }

.quick-input {
  width: 100%;
  margin: 12px 0 0;
  padding: 4px 2px;
  border: none;
  background: transparent;
  resize: none;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  outline: none;
  min-height: 58px;
}

.quick-input::placeholder { color: #b8a696; }

.quick-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.stat-pill {
  padding: 14px 8px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line-soft);
  text-align: center;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.stat-pill:hover {
  transform: translateY(-2px);
  border-color: var(--line);
  box-shadow: 0 12px 24px -20px rgba(120, 84, 52, 0.95);
}

.stat-pill:active { transform: translateY(0); box-shadow: none; }

.stat-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stat-num { display: block; font-size: 19px; font-weight: 600; color: var(--accent-deep); letter-spacing: 0.5px; }
.stat-label { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }

.calendar-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(140deg, #fff, #f6f1e7);
  transition: transform 0.2s, box-shadow 0.2s;
}

.calendar-entry:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.calendar-entry-title { margin: 0; font-size: 15px; font-weight: 600; }
.calendar-entry-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.calendar-entry-arrow { color: var(--accent); font-size: 18px; }

/* --------------------------------------------------------- 日记卡片 */

.diary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
}

.diary-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 0.22s;
}

.diary-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.diary-card:active { transform: translateY(-1px) scale(0.995); }

.card-cover { aspect-ratio: 16 / 10; overflow: hidden; background: #f2e9de; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.diary-card:hover .card-cover img { transform: scale(1.03); }

/* 没有照片时，用邮戳样式的日期章撑起封面，卡片高度更整齐 */
.card-cover-empty {
  position: relative;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 100% at 50% 0%, #fdf6ec 0%, #f6e9d7 100%);
  border-bottom: 1px solid var(--line-soft);
}

.cover-stamp {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px dashed #dcc0a4;
  background: rgba(255, 252, 246, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transform: rotate(-6deg);
}

.cover-day {
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  color: #c08d66;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.cover-week {
  font-size: 9.5px;
  letter-spacing: 1.2px;
  color: #b79c84;
}

.cover-mood {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 14px;
  opacity: 0.85;
}

.card-body { padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }

.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.card-mood { font-size: 14px; }

.badge-share {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: #5d7350;
  font-size: 11px;
}

.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-3);
}

/* --------------------------------------------------------- 列表页 */

.list-head { padding: 16px 2px 0; }

.list-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 15px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.8;
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px 10px 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
}

.search-input:focus { border-color: #d9b393; box-shadow: 0 0 0 4px rgba(193, 112, 63, 0.1); }

.filters { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

.filter-toggle {
  margin-left: auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  height: 36px;
  padding: 0 15px;
  border-radius: 999px;
  font-size: 13px;
  transition: all 0.18s;
}

.filter-toggle.is-open { background: var(--accent-soft); border-color: #e2bc9c; color: var(--accent-deep); }

.filter-panel {
  margin-top: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideDown 0.24s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.date-range { display: flex; align-items: center; gap: 10px; }
.date-range-sep { font-size: 12px; color: var(--ink-3); }

.filter-actions { display: flex; justify-content: flex-end; }

.list-count { margin: 14px 2px 12px; font-size: 12.5px; color: var(--ink-3); }
.note-clear { margin-left: 6px; color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }

.load-more-wrap { display: flex; justify-content: center; padding: 26px 0 8px; }

/* --------------------------------------------------------- 日记详情 */

.detail { max-width: 720px; margin: 0 auto; padding-top: 14px; }

.detail-paper {
  margin-top: 6px;
  padding: 26px 22px 22px;
  border-radius: 22px;
  background: #fffdfa;
  box-shadow: 0 18px 40px -30px rgba(87, 63, 45, 0.5);
}

.detail-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.detail-actions { display: flex; gap: 8px; }

.detail-head { display: flex; flex-direction: column; gap: 10px; }

.detail-date {
  font-size: 12.5px;
  letter-spacing: 1.5px;
  color: var(--accent-deep);
}

.detail-title { margin: 0; font-size: 26px; font-weight: 600; line-height: 1.4; letter-spacing: 0.5px; }

.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }

.detail-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: #f6f0e7;
  color: #83705d;
}

.detail-content {
  margin: 20px 0 0;
  font-size: 16.5px;
  line-height: 1.95;
  color: #3d352d;
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: 0.2px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.gallery-item {
  overflow: hidden;
  border-radius: 14px;
  background: #f2e9de;
  aspect-ratio: 4 / 3;
  max-height: 460px;
  border: none;
  padding: 0;
}

.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.gallery-item:hover img { transform: scale(1.04); }

.detail-foot {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-3);
}

.skeleton-note { padding: 40px 0; text-align: center; color: var(--ink-3); font-size: 14px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(30, 24, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; object-fit: contain; }

.lightbox-close {
  position: absolute;
  top: calc(14px + var(--safe-t));
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --------------------------------------------------------- 日历 */

.cal { padding-top: 18px; }

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

.cal-nav { display: flex; gap: 8px; }

.cal-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1;
  transition: all 0.18s;
}

.cal-nav-btn:hover { background: var(--accent-soft); color: var(--accent-deep); border-color: #e2bc9c; }

.cal-card { padding: 14px 12px 12px; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-3);
  padding-bottom: 8px;
  letter-spacing: 1px;
}

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

.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  background: transparent;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-2);
  font-size: 14px;
  transition: background 0.18s, color 0.18s;
}

.cal-cell:hover { background: #faf3e9; }
.cal-cell.is-outside { opacity: 0.3; }
.cal-cell.is-today { color: var(--accent-deep); font-weight: 600; }
.cal-cell.is-today::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid #e3bd9d;
  border-radius: 10px;
  pointer-events: none;
}
.cal-cell.is-selected { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

.cal-cell .cal-dot.is-empty { background: transparent; }

.cal-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-3);
}

.cal-tools { display: flex; justify-content: center; padding: 14px 0 4px; }

.cal-day { margin-top: 12px; }
.cal-day .diary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.cal-day-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; color: var(--ink-2); }

/* --------------------------------------------------------- 编辑器 */

.editor-body { background: #faf6f0; }

.editor { max-width: 720px; margin: 0 auto; padding: 8px 18px calc(30px + var(--safe-b)); }

.editor-bar {
  position: sticky;
  top: calc(58px + var(--safe-t));
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  margin-bottom: 6px;
  background: linear-gradient(180deg, rgba(250, 246, 240, 0.97) 70%, rgba(250, 246, 240, 0));
}

.editor-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 15px;
}

.save-state {
  font-size: 12.5px;
  color: var(--ink-3);
  transition: color 0.2s;
}

.save-state.is-saving { color: var(--accent); }
.save-state.is-error { color: var(--danger); }
.save-state.is-saved { color: var(--sage); }

.editor-cover { padding: 18px; margin-bottom: 16px; }

.editor-cover-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.title-input {
  width: 100%;
  border: none;
  border-bottom: 1px dashed var(--line);
  background: transparent;
  padding: 6px 2px 10px;
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  letter-spacing: 0.5px;
}

.title-input::placeholder { color: #c1b1a2; font-weight: 400; }
.title-input:focus { border-color: #dcbb9c; }

.visibility-hint { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); }

.editor-block { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.editor-block-grow { gap: 0; }

.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block-hint { font-size: 11.5px; color: var(--ink-3); }

.content-input {
  width: 100%;
  min-height: 42vh;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.95;
  resize: none;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.content-input:focus { border-color: #e0c3a6; box-shadow: 0 0 0 4px rgba(193, 112, 63, 0.07); }
.content-input::placeholder { color: #b9a99a; }

.tag-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
}

.tag-box:focus-within { border-color: #d9b393; box-shadow: 0 0 0 4px rgba(193, 112, 63, 0.08); }

.tag-chip-list { display: contents; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12.5px;
}

.tag-chip button {
  border: none;
  background: transparent;
  color: #b98e6b;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}

.tag-input {
  flex: 1 1 120px;
  min-width: 120px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--ink);
  padding: 4px 2px;
}

.image-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.image-item, .upload-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: #f5ece1;
  padding: 0;
}

.image-item img { width: 100%; height: 100%; object-fit: cover; }

.image-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(40, 32, 26, 0.62);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.image-del:hover { background: rgba(40, 32, 26, 0.85); }

.upload-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px dashed #dcc6ae;
  background: #fffaf3;
  color: var(--ink-3);
  transition: all 0.18s;
}

.upload-tile:hover { background: #fff3e3; color: var(--accent-deep); border-color: #d8ab84; }
.upload-plus { font-size: 24px; line-height: 1; }
.upload-text { font-size: 11.5px; }

.editor-foot { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.editor-tip { margin: 0; text-align: center; font-size: 11.5px; color: var(--ink-3); }

.draft-banner {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(80px + var(--safe-b));
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  max-width: 640px;
  margin: 0 auto;
}

.draft-text { font-size: 13px; color: var(--ink-2); }
.draft-actions { display: flex; gap: 8px; }

/* --------------------------------------------------------- 我的 */

.me { padding-top: 18px; max-width: 720px; margin: 0 auto; }

.me-card { display: flex; align-items: center; gap: 16px; padding: 22px; }

.me-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #f1e3d1, #e6d3bd);
  color: #8a6c50;
  font-size: 22px;
  font-weight: 600;
}

.me-name { margin: 0; font-size: 20px; font-weight: 600; }
.me-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); }

.stat-row { margin-top: 16px; }

.menu { margin-top: 18px; overflow: hidden; }

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  font-size: 14.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: background 0.16s;
}

.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: #fdf7f0; }
.menu-arrow { color: var(--ink-3); font-size: 15px; }

.me-tip { margin-top: 18px; font-size: 12.5px; color: var(--ink-2); line-height: 1.8; }
.me-tip p { margin: 0; }
.me-logout { margin-top: 22px; }

/* --------------------------------------------------------- 后台 */

.admin { padding-top: 18px; }

.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.user-list { display: flex; flex-direction: column; gap: 12px; }

.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3e8da;
  color: #7f6549;
  font-size: 16px;
  font-weight: 600;
  flex: 0 0 auto;
}

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

.user-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-name { font-size: 15.5px; font-weight: 600; }

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #f5efe6;
  color: #857263;
}

.badge-admin { background: var(--accent-soft); color: var(--accent-deep); }
.badge-off { background: var(--danger-soft); color: var(--danger); }

.user-sub { margin-top: 3px; font-size: 12px; color: var(--ink-3); }

.user-edit {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px;
}

.user-edit:hover { background: var(--accent-soft); color: var(--accent-deep); border-color: #e2bc9c; }

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

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-2);
  gap: 12px;
}

.info-row code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f6f0e7;
  padding: 4px 8px;
  border-radius: 8px;
  color: #7a6551;
}

.info-tip { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.7; }

/* 底部弹出面板 */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(45, 36, 28, 0.35);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.sheet-panel {
  pointer-events: auto;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 18px 20px calc(18px + var(--safe-b));
  animation: sheetUp 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  box-shadow: var(--shadow-lg);
}

@keyframes sheetUp { from { transform: translateY(18px); opacity: 0.4; } to { transform: none; opacity: 1; } }

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }

.sheet-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #f6f0e7;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1;
}

.sheet-body { display: flex; flex-direction: column; }

.sheet-foot { display: flex; gap: 10px; margin-top: 6px; }
.sheet-foot .btn { flex: 1; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

.switch-label { font-size: 14px; color: var(--ink); }
.switch-desc { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-3); }

.switch {
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #eee2d3;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(80, 60, 40, 0.25);
  transition: transform 0.2s;
}

.switch.is-on { background: var(--accent); border-color: var(--accent-deep); }
.switch.is-on::after { transform: translateX(20px); }

/* --------------------------------------------------------- 登录 */

.login-body {
  background-image:
    radial-gradient(90% 60% at 50% 0%, #f7e6d3 0%, rgba(247, 230, 211, 0) 60%),
    radial-gradient(70% 50% at 100% 100%, #eef0e4 0%, rgba(238, 240, 228, 0) 60%);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(32px + var(--safe-t)) 20px calc(32px + var(--safe-b));
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 253, 250, 0.94);
  border: 1px solid rgba(236, 223, 208, 0.9);
  border-radius: var(--radius-lg);
  padding: 30px 24px 24px;
  box-shadow: var(--shadow-lg);
}

.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand-text { font-size: 13px; letter-spacing: 3px; color: var(--ink-3); }

.login-title { margin: 0 0 6px; font-size: 24px; font-weight: 600; letter-spacing: 0.5px; }
.login-sub { margin: 0 0 24px; font-size: 13px; color: var(--ink-3); }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-hint { margin: 18px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.7; }

.login-foot {
  margin: 22px 0 0;
  font-size: 12px;
  color: #a89786;
  letter-spacing: 1px;
}

/* --------------------------------------------------------- 错误页 */

.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 40px 20px;
}

.error-code { margin: 0; font-size: 46px; font-weight: 600; color: #ddc7ae; letter-spacing: 2px; }
.error-msg { margin: 0 0 10px; font-size: 15px; color: var(--ink-2); }
.error-actions { display: flex; gap: 10px; }

/* --------------------------------------------------------- 提示条 */

.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(96px + var(--safe-b));
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 20px;
}

.toast {
  max-width: 90vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(48, 39, 31, 0.92);
  color: #fff8f0;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toastIn 0.24s ease;
}

.toast.is-error { background: rgba(140, 60, 43, 0.94); }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------- 响应式 */

@media (min-width: 640px) {
  .page { padding: 8px 24px 0; }
  .diary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .greet { padding-top: 26px; }
  .stat-row { max-width: 520px; }
  .login-card { padding: 36px 32px 28px; }
}

@media (min-width: 880px) {
  :root { --safe-t: 0px; --safe-b: 0px; }

  .detail-paper { padding: 38px 40px 34px; }

  .topnav { display: flex; }
  .write-btn { display: inline-flex; }
  .tabbar { display: none; }
  .app-shell { padding-bottom: 44px; }
  .toast-wrap { bottom: 28px; }
  .draft-banner { bottom: 24px; }

  .page { padding: 0 32px; }
  .diary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .greet { padding-top: 34px; }
  .greet-title { font-size: 30px; }
  .quick { padding: 20px 24px 16px; }

  .editor-bar { top: 0; }
  .editor-body .topbar { position: static; }
  .editor { padding-bottom: 40px; }

  .cal-card { padding: 20px; }
  .cal-grid { gap: 6px; }
  .cal-cell { font-size: 15.5px; }
  .cal { max-width: 640px; margin: 0 auto; }
  .admin { max-width: 780px; margin: 0 auto; }

  .sheet { align-items: center; }
  .sheet-panel { border-radius: 24px; max-height: 86vh; padding-bottom: 22px; animation: sheetPop 0.24s cubic-bezier(0.2, 0.8, 0.3, 1); }

  @keyframes sheetPop { from { transform: scale(0.97); opacity: 0.6; } to { transform: none; opacity: 1; } }
}

@media (max-width: 359px) {
  .tab-label { display: none; }
  .greet-title { font-size: 23px; }
  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-pill { padding: 12px 4px 10px; }
}
/* --------------------------------------------------------- 评论（只支持文字） */

.comments {
  margin-top: 18px;
  padding: 20px 24px 18px;
}

.comments-head { display: flex; align-items: baseline; gap: 8px; }

.comments-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--ink-2);
}

.comments-count { font-size: 12.5px; color: var(--ink-3); }

.comment-empty { margin: 14px 0 2px; font-size: 13.5px; color: var(--ink-3); }

.comment-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comment-item { display: flex; gap: 10px; }

.comment-avatar {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #efe4d6;
  color: #7a6450;
  font-size: 13px;
  font-weight: 600;
}

.comment-main { flex: 1 1 auto; min-width: 0; }

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.comment-name { color: var(--ink-2); font-weight: 600; }

.comment-del {
  margin-left: auto;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.comment-del:hover { color: #a4472e; }

.comment-text {
  margin: 5px 0 0;
  font-size: 14.5px;
  line-height: 1.78;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-input {
  width: 100%;
  min-height: 66px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf9;
  font: inherit;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  resize: vertical;
}

.comment-input:focus { outline: none; border-color: #e2c6a6; background: #fff; }

.comment-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-limit { font-size: 12px; color: var(--ink-3); }

@media (max-width: 560px) {
  .comments { margin-top: 14px; padding: 18px 16px 16px; }
  .comment-form-foot .btn { flex: none; }
}
/* --------------------------------------------------------- 视图切换（卡片 / 列表） */

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.view-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.view-btn:hover { color: var(--ink-2); }
.view-btn.is-active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }

.diary-list {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.diary-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit;
  transition: background 0.18s;
}

.diary-row:last-child { border-bottom: 0; }
.diary-row:hover { background: #fffaf3; }
.diary-row:active { background: #fdf2e7; }

.row-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--ink-3);
}

.row-day { font-size: 19px; font-weight: 600; color: var(--accent-deep); line-height: 1.1; }
.row-week { font-size: 10.5px; letter-spacing: 0.3px; white-space: nowrap; }

.row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.row-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-arrow { color: var(--ink-3); font-size: 16px; text-align: right; }

@media (max-width: 480px) {
  .view-btn span { display: none; }
  .view-btn { padding: 6px 9px; }
  .diary-row { grid-template-columns: 44px minmax(0, 1fr) 12px; gap: 10px; padding: 12px 14px; }
  .row-day { font-size: 17px; }
  .row-week { font-size: 10px; }
}
/* 首页「最近的日记」标题行：视图切换 + 全部日记 */
.section-head { align-items: center; }

.section-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

@media (max-width: 480px) {
  .section-tools { gap: 10px; }
  .section-head { gap: 10px; }
}
/* --------------------------------------------------------- 相册（只含照片日记） */

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.album-card {
  display: block;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.album-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.album-card:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

.album-cover {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: #f3ebe1;
  overflow: hidden;
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.album-card:hover .album-cover img { transform: scale(1.03); }

.album-shade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64%;
  background: linear-gradient(to top, rgba(30, 19, 10, 0.82), rgba(30, 19, 10, 0));
  pointer-events: none;
}

.album-mood {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 6px rgba(38, 24, 14, 0.18);
  font-size: 13px;
  line-height: 1;
}

.album-badge {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(38, 24, 14, 0.62);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.3px;
}

.album-caption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #fff;
  pointer-events: none;
}

.album-date { font-size: 11px; opacity: 0.86; letter-spacing: 0.3px; }

.album-title {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

@media (max-width: 560px) {
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
  .album-title { font-size: 12.5px; }
  .album-caption { left: 9px; right: 9px; bottom: 8px; }
  .album-badge { right: 8px; top: 8px; padding: 2px 7px; }
  .album-mood { left: 8px; top: 8px; width: 22px; height: 22px; font-size: 11px; }
}
/* 小屏（出现底部导航时）不显示首页「随手一句」输入框 */
@media (max-width: 879px) {
  .quick { display: none; }
}
/* 小屏编辑器：收紧排版，把屏幕留给正文 */
@media (max-width: 640px) {
  .editor { padding: 4px 12px calc(20px + var(--safe-b)); }

  .editor-bar { padding: 6px 0 4px; margin-bottom: 2px; gap: 8px; }
  .editor-bar .btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
  .editor-back { width: 32px; height: 32px; font-size: 14px; }
  .save-state { font-size: 12px; }

  .editor-cover { padding: 12px 13px; margin-bottom: 10px; border-radius: 14px; }
  .editor-cover-row { gap: 8px; margin-bottom: 8px; align-items: flex-end; }
  .field-label { font-size: 11px; letter-spacing: 0.6px; }
  .input { min-height: 36px; padding: 5px 10px; font-size: 13px; }
  .input-date { max-width: none; width: 100%; }
  .seg-sm .seg-item { font-size: 11.5px; padding: 4px 9px; }
  .title-input { font-size: 16px; padding: 4px 2px 7px; }
  .visibility-hint { margin-top: 6px; font-size: 11px; }

  .editor-block { margin-bottom: 10px; gap: 6px; }
  .editor-block .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .editor-block .chips::-webkit-scrollbar { display: none; }
  .editor-block .chip {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
    gap: 4px;
  }

  .content-input { min-height: 46vh; padding: 12px 13px; font-size: 15px; line-height: 1.85; }

  .tag-box { min-height: 38px; }
  .block-hint { font-size: 11px; }
  .editor-foot { margin-top: 14px; gap: 8px; }
  .editor-tip { font-size: 11px; }
}
@media (max-width: 640px) {
  .editor-block .chips.is-scrollable {
    -webkit-mask-image: linear-gradient(to right, #000 86%, rgba(0, 0, 0, 0.2));
    mask-image: linear-gradient(to right, #000 86%, rgba(0, 0, 0, 0.2));
  }
}
/* 小屏筛选面板：收紧间距，心情一行滑动，别占掉半屏 */
@media (max-width: 640px) {
  .filters { margin-top: 10px; }

  .filter-toggle { height: 32px; padding: 0 13px; font-size: 12px; }

  .filter-panel { margin-top: 10px; padding: 11px 12px 9px; gap: 8px; }
  .filter-panel .field { gap: 5px; margin-bottom: 0; }

  .filter-panel .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filter-panel .chips::-webkit-scrollbar { display: none; }
  .filter-panel .chip {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
    gap: 4px;
  }

  .filter-panel .select { min-height: 34px; padding: 4px 10px; font-size: 13px; }
  .filter-panel .input { min-height: 34px; padding: 4px 8px; font-size: 12.5px; }
  .date-range { gap: 6px; }
  .date-range-sep { font-size: 11px; }
  .filter-actions .btn-sm { min-height: 30px; padding: 0 12px; font-size: 12.5px; }
}
/* 用过的标签：一行展示（横向滑动），可继续加载更多 */
.tag-suggest {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}

.tag-suggest-label {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.tag-suggest-row {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tag-suggest-row::-webkit-scrollbar { display: none; }

.tag-suggest-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px dashed #e4d2bd;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
  transition: all 0.16s;
  -webkit-tap-highlight-color: transparent;
}

.tag-suggest-chip:hover { border-color: #d9b393; color: var(--accent-deep); background: #fffaf3; }

.tag-suggest-chip.is-added {
  border-style: solid;
  border-color: #e2bc9c;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}

.tag-more {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-size: 12px;
  padding: 4px 2px;
  white-space: nowrap;
}

.tag-more:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .tag-suggest { gap: 6px; margin-top: 6px; }
  .tag-suggest-label { display: none; }
  .tag-suggest-chip { min-height: 24px; padding: 0 8px; font-size: 11.5px; }
  .tag-more { font-size: 11.5px; padding: 3px 0; }
}
/* 写日记 / 看日记：桌面端铺满到与顶栏导航同宽 */
.editor,
.detail {
  max-width: 1040px;
  margin: 0 auto;
}

@media (min-width: 880px) {
  .editor-body .page,
  .diary-view .page { padding: 0; }

  .editor { padding: 8px 18px 40px; }
}

@media (max-width: 640px) {
  .editor { padding: 4px 12px calc(20px + var(--safe-b)); }
}
/* 编辑器铺宽后，可见范围不要被拉成一整条 */
.editor-cover-row .seg { align-self: flex-start; }
