/* ============================================================
   夏以昼 · 陪伴感聊天 PWA — 样式 v2
   设计语言：液态玻璃拟态 + 低饱和樱花粉紫渐变 + 大圆角 + 柔光阴影
   ============================================================ */

:root {
  /* 色彩 */
  --bg: #FDF7F3;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #FFFFFF;
  --accent: #E8918A;
  --accent-strong: #D97870;
  --accent-deep: #E28379;
  --accent-soft: #F9E6E1;
  --lavender: #C7B9D8;
  --ink: #4A403B;
  --ink-2: #8E837C;
  --ink-3: #C4BAB3;
  --green: #7BC89F;

  /* 阴影（暖桃色调） */
  --shadow-card: 0 18px 44px rgba(214, 150, 130, 0.20), 0 3px 12px rgba(122, 92, 80, 0.05);
  --shadow-float: 0 16px 36px rgba(216, 120, 112, 0.42);
  --shadow-glow: 0 10px 26px rgba(216, 120, 112, 0.36);

  /* 圆角 & 布局 */
  --radius: 26px;
  --col: min(430px, 100vw);
  --dock-h: 70px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #FDF3EC;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  overflow-x: hidden;
}

.app {
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

/* ============================================================
   登录页
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-screen[hidden] { display: none; }
.login-card {
  width: 100%; max-width: 320px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 34px 24px; border-radius: var(--radius);
}
.login-card .avatar { width: 72px; height: 72px; font-size: 30px; border-radius: 24px; }
.login-title { font-size: 20px; font-weight: 700; color: var(--ink); }
.login-sub { font-size: 13px; color: var(--ink-2); margin-top: -8px; }
.login-card input {
  width: 100%; padding: 13px 16px; border-radius: 14px;
  border: 1px solid rgba(74, 64, 59, 0.12);
  background: var(--surface-solid); color: var(--ink);
  font-size: 15px; text-align: center; outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-btn {
  width: 100%; padding: 13px; border-radius: 14px; border: none;
  background: linear-gradient(135deg, #EFA99F, #E8918A);
  color: #fff; font-size: 15px; font-weight: 650; cursor: pointer;
}
.login-btn:active { transform: scale(.97); }
.login-err { font-size: 12.5px; color: var(--accent-strong); min-height: 1em; }

/* 通用图标（线条 / 实心） */
.ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-fill { fill: currentColor; stroke: none; }

/* ============================================================
   页面切换
   ============================================================ */
.page { display: none; padding: 0 20px 150px; }
.page.active { display: block; animation: pageIn .35s ease both; }
@keyframes pageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   头像（可爱插画脸）
   ============================================================ */
.avatar {
  position: relative;
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #F5BDB2, #E8918A);
  box-shadow: 0 10px 24px rgba(216, 120, 112, 0.34), inset 0 -4px 10px rgba(255, 255, 255, 0.28);
  display: grid; place-items: center; flex-shrink: 0;
  color: #fff; font-weight: 600; font-size: 16px;
}
.avatar.me {
  background: linear-gradient(135deg, #C2BDD9, #A79FC9);
  box-shadow: 0 10px 24px rgba(160, 150, 200, 0.4), inset 0 -4px 10px rgba(255, 255, 255, 0.3);
}
.avatar.mini { width: 40px; height: 40px; font-size: 14px; }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

.avatar-wrap { position: relative; }
.online-dot {
  position: absolute; right: 0; bottom: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--green); border: 3px solid #FDF7F3;
  box-shadow: 0 3px 8px rgba(123, 200, 159, 0.55);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(123,200,159,.4); } 50% { box-shadow: 0 0 0 6px rgba(123,200,159,0); } }

/* ============================================================
   玻璃拟态通用
   ============================================================ */
.glass {
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-card);
}

/* ============================================================
   顶部栏（聊天页）
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  margin: 0 -20px;  /* 抵消 .page 的 20px 内边距，让背景贴满屏幕左右 */
  padding-top: calc(var(--safe-t) + 6px);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  background: rgba(253, 247, 243, 0.7);
}
.topbar-inner { display: flex; align-items: center; gap: 10px; padding: 8px 20px 10px; }
.topbar-meta { flex: 1; min-width: 0; }
.topbar-name { font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.topbar-status { font-size: 11px; color: var(--ink-2); display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.topbar-actions { display: flex; gap: 4px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 15px;
  border: none; background: transparent; color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}
.icon-btn:active { background: rgba(74, 64, 59, 0.06); transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; }
.topbar .icon-btn { width: 38px; height: 38px; }
.topbar .icon-btn svg { width: 20px; height: 20px; }

/* 右上角「更多」下拉菜单 */
.topbar-actions { position: relative; }
.more-menu {
  position: absolute; top: 48px; right: 0;
  min-width: 158px;
  background: var(--surface-solid);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 6px;
  z-index: 60;
  animation: pageIn .18s ease both;
}
.more-menu-item {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; cursor: pointer;
  padding: 12px 14px; font-size: 14.5px; font-weight: 500;
  color: var(--ink-2); font-family: inherit; border-radius: 11px;
}
.more-menu-item:active { background: var(--accent-soft); color: var(--ink); }
.more-menu-item.danger { color: var(--accent-strong); }

/* ============================================================
   消息列表
   ============================================================ */
.messages { padding: 8px 0 180px; display: flex; flex-direction: column; }
.day-divider { text-align: center; margin: 8px 0 16px; }
.day-divider span {
  font-size: 11px; color: var(--ink-3); letter-spacing: .5px;
  background: rgba(255,255,255,.6); padding: 4px 14px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.7);
}
.time-divider { text-align: center; font-size: 11px; color: var(--ink-3); margin: 16px 0 10px; letter-spacing: .5px; }
.msg { display: flex; gap: 9px; margin: 10px 0; animation: msgIn .35s ease both; }
.msg.me { justify-content: flex-end; }
.msg.them { align-items: flex-end; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bubble-col { max-width: 74%; display: flex; flex-direction: column; }
.msg.me .bubble-col { align-items: flex-end; }

.bubble {
  padding: 12px 16px; border-radius: 21px;
  font-size: 15.5px; line-height: 1.55; word-break: break-word;
}
.msg.them .bubble {
  background: rgba(255,255,255,.9); color: var(--ink);
  border: 1px solid rgba(255,255,255,.85);
  border-bottom-left-radius: 7px;
  box-shadow: 0 8px 22px rgba(122,92,80,.09);
}
.msg.me .bubble {
  background: linear-gradient(135deg, #EFA99F, #E8918A);
  color: #fff; border-bottom-right-radius: 7px;
  box-shadow: 0 8px 20px rgba(216, 120, 112, 0.26);
}
.time { font-size: 10.5px; color: var(--ink-3); margin: 5px 8px 0; }

.bubble.img { padding: 6px; background: rgba(255,255,255,.9); border-radius: 17px; }
.sticker {
  width: 146px; height: 146px; border-radius: 13px;
  background: linear-gradient(135deg, #FCE9E2, #F6DCD4);
  display: grid; place-items: center; font-size: 64px;
}

.typing-bubble { display: flex; gap: 5px; align-items: center; padding: 16px 18px; }
.typing-bubble span {
  width: 8px; height: 8px; border-radius: 50%;
  background: #CDB9B2; animation: blink 1.2s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: .18s; }
.typing-bubble span:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.typing { display: none; }
.typing.show { display: flex; }

/* ============================================================
   悬浮输入栏
   ============================================================ */
.chat-input {
  position: fixed; z-index: 25;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-b) + var(--dock-h) + 28px);
  width: min(430px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 28px; padding: 7px 7px 7px 12px;
  box-shadow: var(--shadow-card);
}
.chat-input input {
  flex: 1; min-width: 0; border: none; outline: none;
  background: transparent; font-size: 15px; color: var(--ink); font-family: inherit;
}
.chat-input input::placeholder { color: var(--ink-3); }
.chat-input .attach { flex-shrink: 0; }
.send-btn {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, #EFA99F, #E8918A);
  display: grid; place-items: center;
  box-shadow: var(--shadow-glow);
  transition: transform .15s ease;
}
.send-btn:active { transform: scale(.88); }
.send-btn svg { width: 20px; height: 20px; }

/* ============================================================
   页面标题
   ============================================================ */
.page-head {
  position: sticky; top: 0; z-index: 10;
  padding: calc(var(--safe-t) + 18px) 2px 16px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(253,247,243,.92), rgba(253,247,243,0));
}
.page-head h1 {
  font-size: 28px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(120deg, #E28379, #E8918A 55%, #C79BC8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-head p { font-size: 13px; color: var(--ink-2); margin-top: 5px; }

/* ============================================================
   碎碎念页
   ============================================================ */
.mood-card {
  position: relative; display: flex; align-items: center; gap: 14px;
  border-radius: var(--radius); padding: 18px; margin-top: 4px;
}
.mood-name { font-size: 15.5px; font-weight: 700; }
.mood-text { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.mood-text span { color: var(--accent-strong); font-weight: 600; }
.mood-spark { position: absolute; top: 14px; right: 16px; }

/* ============================================================
   天气板块（碎碎念页顶部固定卡片）
   ============================================================ */
.weather-card {
  position: relative;
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 4px;
  overflow: hidden;
}
.weather-main { display: flex; align-items: center; gap: 16px; }
.weather-icon {
  font-size: 42px; line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(216, 120, 112, 0.22));
}
.weather-temp-line { display: flex; align-items: baseline; gap: 2px; }
.weather-temp-num { font-size: 38px; font-weight: 800; letter-spacing: -1px; color: var(--ink); }
.weather-temp-unit { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.weather-desc { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.weather-extra { margin-left: auto; text-align: right; display: flex; flex-direction: column; gap: 3px; }
.weather-city { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.weather-range { font-size: 12px; color: var(--ink-3); }
.weather-comment {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed rgba(74, 64, 59, 0.14);
  font-size: 13.5px; line-height: 1.6; color: var(--ink-2);
}
.weather-comment::before { content: "夏以昼 · "; color: var(--accent-strong); font-weight: 600; }

.feed { margin-top: 16px; display: flex; flex-direction: column; gap: 15px; }
.feed-card { border-radius: var(--radius); padding: 17px; }
.feed-head { display: flex; align-items: center; gap: 11px; }
.feed-who { line-height: 1.3; }
.feed-name { font-size: 14.5px; font-weight: 700; }
.feed-time { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.feed-body { font-size: 15px; line-height: 1.68; margin: 13px 0 4px; }
.feed-photo {
  height: 154px; border-radius: 17px; margin-top: 13px;
  background: linear-gradient(135deg, #FBE3D4, #F0D6E6 65%, #DCE0F2);
  display: grid; place-items: center; font-size: 54px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
}
.feed-foot { display: flex; gap: 22px; margin-top: 11px; }
.feed-action {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-2); font-size: 13px; font-family: inherit;
  transition: color .2s ease;
}
.feed-action svg { width: 19px; height: 19px; }
.feed-action:active { color: var(--accent-strong); }

/* ============================================================
   装饰：小星星
   ============================================================ */
.spark { fill: currentColor; color: #EFB7AC; width: 18px; height: 18px; }
.spark.light { color: #fff; opacity: .9; }

/* ============================================================
   待办日程页
   ============================================================ */
.daily-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #F3BDB3, #E8918A);
  border-radius: var(--radius); padding: 20px; margin-top: 4px; color: #fff;
  box-shadow: 0 18px 44px rgba(216, 120, 112, 0.36);
  display: flex; flex-direction: column;
  margin-bottom: 16px;
}
.daily-body { position: relative; margin-top: 16px; }
.daily-label { font-size: 12.5px; opacity: .92; }
.daily-text { font-size: 20px; font-weight: 800; line-height: 1.45; margin-top: 6px; letter-spacing: .3px; }

.todo-progress {
  position: relative; display: flex; align-items: center; gap: 16px;
  border-radius: var(--radius); padding: 18px; margin-top: 4px;
}
.tp-ring { position: relative; width: 66px; height: 66px; flex-shrink: 0; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring-bg { stroke: rgba(74, 64, 59, 0.08); }
.ring-fill { stroke: var(--accent); stroke-linecap: round; }
.tp-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 800; color: var(--ink); }
.tp-num span { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.tp-meta { line-height: 1.5; }
.tp-title { font-size: 16px; font-weight: 700; }
.tp-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.tp-spark { position: absolute; top: 15px; right: 16px; }

.todo-list { border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.todo-item { display: flex; align-items: center; gap: 13px; padding: 15px 16px; cursor: pointer; }
.todo-item + .todo-item { border-top: 1px solid rgba(74, 64, 59, 0.06); }
.todo-check {
  width: 27px; height: 27px; border-radius: 50%;
  border: 2px solid var(--ink-3); flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
  transition: background .2s ease, border-color .2s ease;
}
.todo-check svg { width: 15px; height: 15px; opacity: 0; transition: opacity .2s ease; }
.todo-item.done .todo-check { background: linear-gradient(135deg, #EFA99F, #E8918A); border-color: transparent; }
.todo-item.done .todo-check svg { opacity: 1; }
.todo-meta { flex: 1; min-width: 0; }
.todo-title { font-size: 14.5px; font-weight: 600; transition: color .2s ease; }
.todo-time { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--ink-3); }
.todo-tag { font-size: 10.5px; padding: 4px 10px; border-radius: 20px; background: var(--tag, var(--accent-soft)); color: var(--ink-2); flex-shrink: 0; }
.todo-del { border: none; background: transparent; color: var(--ink-3); font-size: 18px; cursor: pointer; padding: 4px; line-height: 1; }

/* ============================================================
   记账页
   ============================================================ */
.overview {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #F3BDB3, #E8918A);
  border-radius: var(--radius); padding: 20px; margin-top: 4px; color: #fff;
  box-shadow: 0 18px 44px rgba(216, 120, 112, 0.36);
  display: flex; flex-direction: column;
  margin-bottom: 34px;
}
.ov-ring { position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,.22); pointer-events: none; }
.ov-ring.r1 { width: 180px; height: 180px; top: -70px; right: -40px; }
.ov-ring.r2 { width: 120px; height: 120px; top: -40px; right: -12px; }

.ov-month { position: relative; display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.ov-arrow {
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center;
  transition: background .15s ease, transform .15s ease;
}
.ov-arrow:active { transform: scale(.88); }
.ov-arrow:disabled { opacity: .35; cursor: default; }
.ov-arrow svg { width: 18px; height: 18px; }
.ov-month-mid { display: flex; align-items: center; gap: 9px; }
.ov-month-name { font-size: 18px; font-weight: 800; letter-spacing: .5px; }
.ov-month-badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: rgba(255,255,255,.22); color: #fff;
}
.ov-month-back {
  font-size: 12px; font-weight: 600; border: none; cursor: pointer; color: #fff;
  background: rgba(255,255,255,.2); padding: 4px 10px; border-radius: 999px;
}

.ov-items { position: relative; display: flex; align-items: center; }
.ov-item { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ov-label { font-size: 12.5px; opacity: .92; }
.ov-num { font-size: 19px; font-weight: 800; letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.ov-divider { width: 1px; height: 42px; background: rgba(255,255,255,.3); margin: 0 18px; }
.ov-balance {
  position: relative; margin-top: 18px; padding-top: 15px;
  border-top: 1px solid rgba(255,255,255,.28);
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  font-size: 14px; opacity: .96;
}
.ov-balance b { font-size: 26px; font-weight: 800; letter-spacing: .5px; font-variant-numeric: tabular-nums; }

.bill-list { border-radius: var(--radius); overflow: hidden; }
.bill-row { display: flex; align-items: center; gap: 13px; padding: 15px 16px; }
.bill-row + .bill-row { border-top: 1px solid rgba(74, 64, 59, 0.06); }
.bill-icon {
  width: 44px; height: 44px; border-radius: 15px;
  background: var(--tint, var(--surface-solid)); font-size: 0;
  display: grid; place-items: center; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
.bill-icon svg { width: 21px; height: 21px; color: var(--ink); }
.bill-meta { flex: 1; min-width: 0; }
.bill-name { font-size: 14.5px; font-weight: 650; }
.bill-note { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.bill-amount { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bill-amount.out { color: var(--ink); }
.bill-amount.in { color: #4FA878; }

/* 悬浮 “+” */
.fab {
  position: fixed; z-index: 22;
  right: calc(50% - var(--col)/2 + 22px);
  bottom: calc(var(--safe-b) + var(--dock-h) + 28px);
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  color: #fff; background: linear-gradient(135deg, #EFA99F, #E8918A);
  display: grid; place-items: center; box-shadow: var(--shadow-float);
  transition: transform .15s ease;
}
.fab:active { transform: scale(.9); }
.fab svg { width: 26px; height: 26px; }

/* ============================================================
   底部导航（悬浮玻璃胶囊）
   ============================================================ */
.dock {
  position: fixed; z-index: 30;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-b) + 14px);
  width: min(430px, calc(100vw - 26px));
  height: var(--dock-h);
  display: flex;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  box-shadow: 0 18px 44px rgba(122, 92, 80, 0.18);
  padding: 9px;
}
.dock-item {
  flex: 1; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-family: inherit;
  transition: color .25s ease;
}
.dock-icon {
  width: 44px; height: 30px; border-radius: 13px;
  display: grid; place-items: center;
  transition: background .25s ease, color .25s ease, box-shadow .25s ease;
}
.dock-icon svg { width: 23px; height: 23px; }
.dock-label { font-size: 10.5px; letter-spacing: .3px; }
.dock-item.active { color: var(--accent-strong); }
.dock-item.active .dock-icon {
  background: linear-gradient(135deg, #EFA99F, #E8918A);
  color: #fff; box-shadow: 0 6px 16px rgba(216, 120, 112, 0.4);
}

/* ============================================================
   全局背景：暖橙粉 · 梦幻星云（纯 CSS）
   ============================================================ */
.bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(120% 78% at 50% -10%, #FFFDFA 0%, #FDF3EB 40%, #FBECE1 72%, #F9E9DF 100%);
}

/* 顶部的暖阳光晕（视觉焦点附近，像阳光洒下来） */
.bg .glow {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%);
  width: 150%; height: 55%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 216, 188, 0.24), rgba(255, 216, 188, 0) 68%);
  filter: blur(16px);
}

/* 右下角一抹极淡珊瑚，增加层次 */
.bg .haze {
  position: absolute; right: -20%; bottom: -12%;
  width: 72%; height: 52%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 190, 165, 0.12), rgba(255, 190, 165, 0) 70%);
  filter: blur(20px);
}

/* 顶部柔光薄纱，制造朦胧质感 */
.bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(140% 100% at 50% 0%, rgba(255, 255, 255, 0.30) 0%, rgba(255, 255, 255, 0) 46%);
}

/* ============================================================
   记忆页
   ============================================================ */
.memory-add {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: 20px;
  padding: 6px 6px 6px 14px; margin-top: 4px;
  box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,.7);
}
.memory-add input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-size: 14px; color: var(--ink); font-family: inherit;
}
.memory-add input::placeholder { color: var(--ink-3); }
.add-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  border: none; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, #EFA99F, #E8918A);
  display: grid; place-items: center; box-shadow: var(--shadow-glow);
  transition: transform .15s ease;
}
.add-btn:active { transform: scale(.9); }
.add-btn svg { width: 20px; height: 20px; }

.memory-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.mem-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 16px; padding: 13px 14px;
  box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,.7);
}
.mem-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mem-text { font-size: 14.5px; line-height: 1.5; word-break: break-word; }
.mem-time { font-size: 11px; color: var(--ink-3); }
.mem-actions { display: flex; gap: 6px; flex-shrink: 0; }
.mem-btn {
  border: none; cursor: pointer; font-family: inherit; font-size: 12px;
  padding: 5px 10px; border-radius: 10px; color: var(--ink-2); background: var(--surface-2);
}
.mem-btn.del { color: var(--accent-strong); }

.empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 28px 12px; line-height: 1.6; }

/* ============================================================
   话题页
   ============================================================ */
.topics-list { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.topic-card { border-radius: 20px; padding: 15px 16px; cursor: pointer; }
.topic-top { display: flex; align-items: center; justify-content: space-between; }
.topic-cat {
  font-size: 11px; padding: 3px 9px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 600;
}
.topic-date { font-size: 11px; color: var(--ink-3); }
.topic-title { font-size: 16px; font-weight: 700; margin: 10px 0 5px; line-height: 1.4; }
.topic-summary { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }
.topic-detail {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink); line-height: 1.7;
}

/* ============================================================
   书架页
   ============================================================ */
.books-list { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.book-card { border-radius: 22px; padding: 16px; }
.book-cover {
  width: 46px; height: 62px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #F3BDB3, #E8918A);
  color: #fff; font-size: 20px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(216,120,112,.3);
  float: left; margin-right: 14px; margin-bottom: 8px;
}
.book-info { overflow: hidden; }
.book-title { font-size: 16px; font-weight: 700; }
.book-author { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.book-progress { height: 6px; border-radius: 6px; background: rgba(74,64,59,.08); margin-top: 10px; overflow: hidden; }
.bp-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #EFA99F, #E8918A); }
.book-pct { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.book-thoughts { clear: both; list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.book-thoughts li {
  font-size: 13px; line-height: 1.6; color: var(--ink-2);
  background: var(--surface-2); border-radius: 12px; padding: 9px 12px;
}

/* ============================================================
   更多页（菜单）
   ============================================================ */
.more-grid {
  margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.more-card {
  border-radius: 22px; padding: 22px 16px; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-family: inherit; color: var(--ink);
  transition: transform .15s ease;
}
.more-card:active { transform: scale(.96); }
.more-icon {
  width: 52px; height: 52px; border-radius: 18px;
  background: var(--accent-soft); color: var(--accent-strong);
  display: grid; place-items: center;
}
.more-icon.danger { background: #FBE4E0; color: #D97870; }
.more-icon svg { width: 26px; height: 26px; }
.more-name { font-size: 14px; font-weight: 650; }

/* ============================================================
   小游戏页
   ============================================================ */
.game-grid {
  margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.game-card {
  border-radius: 22px; padding: 22px 16px; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: inherit; color: var(--ink);
  transition: transform .15s ease;
}
.game-card:active { transform: scale(.96); }
.game-emoji { font-size: 30px; line-height: 1; }
.game-name { font-size: 14px; font-weight: 650; }
.game-result {
  margin-top: 14px; border-radius: 20px; padding: 20px 18px;
  min-height: 72px; display: flex; align-items: center;
  font-size: 15px; line-height: 1.7; color: var(--ink); white-space: pre-wrap;
}
.game-story { margin-top: 14px; border-radius: 22px; padding: 16px; }
.game-story-head { display: flex; align-items: center; gap: 12px; }
.game-story-meta { display: flex; flex-direction: column; gap: 3px; }
.game-story-title { font-size: 15px; font-weight: 700; }
.game-story-sub { font-size: 12px; color: var(--ink-2); }
.game-story-log {
  margin: 14px 0; display: flex; flex-direction: column; gap: 8px;
  max-height: 280px; overflow-y: auto;
}
.story-line { font-size: 13.5px; line-height: 1.6; padding: 9px 12px; border-radius: 12px; max-width: 86%; word-break: break-word; }
.story-line.me { background: var(--accent-soft); color: var(--ink); align-self: flex-end; }
.story-line.him { background: var(--surface-2); color: var(--ink); align-self: flex-start; }
.game-story-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border-radius: 20px; padding: 6px 6px 6px 14px;
}
.game-story-input input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-size: 14px; color: var(--ink); font-family: inherit;
}
.game-story-input input::placeholder { color: var(--ink-3); }
.game-soup { margin-top: 14px; border-radius: 22px; padding: 16px; }
.soup-surface {
  margin-top: 12px; padding: 14px; border-radius: 14px;
  background: var(--accent-soft); color: var(--ink);
  font-size: 14px; line-height: 1.7; white-space: pre-wrap;
}
.soup-log { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.soup-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.soup-btn {
  flex: 1; padding: 10px 0; border: none; border-radius: 14px; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 650;
  background: var(--surface-2); color: var(--ink-2);
}
.soup-btn.primary {
  background: linear-gradient(135deg, #EFA99F, #E8918A); color: #fff; box-shadow: var(--shadow-glow);
}
.soup-btn:active { transform: scale(.97); }

/* ============================================================
   话题详情弹窗（底部悬浮 + 背景模糊暗化）
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(40, 28, 24, 0.45);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  display: flex; align-items: flex-end;
  animation: fadeIn .25s ease;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: var(--col); margin: 0 auto;
  background: var(--surface-solid);
  border-radius: 28px 28px 0 0;
  padding: 26px 22px calc(var(--safe-b) + 22px);
  max-height: 72vh; overflow-y: auto;
  box-shadow: 0 -20px 60px rgba(0,0,0,.28);
  animation: slideUp .32s cubic-bezier(.22,.9,.36,1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-cat {
  display: inline-block; font-size: 12px; padding: 4px 11px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 600;
}
.modal-title { font-size: 20px; font-weight: 700; margin: 12px 0 8px; line-height: 1.4; }
.modal-summary { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.modal-detail {
  font-size: 14px; color: var(--ink); line-height: 1.75;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.modal-comment {
  margin-top: 12px; padding: 13px 14px; border-radius: 14px;
  background: var(--accent-soft);
}
.mc-label { display: block; font-size: 11px; color: var(--accent-strong); font-weight: 700; margin-bottom: 4px; }
.modal-comment p { font-size: 13.5px; line-height: 1.65; color: var(--ink); }
.modal-close {
  margin-top: 20px; width: 100%; padding: 14px; border: none; border-radius: 16px;
  background: linear-gradient(135deg, #EFA99F, #E8918A); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 650; cursor: pointer;
  box-shadow: var(--shadow-glow);
}
.modal-close:active { transform: scale(.98); }

/* ============================================================
   表情包
   ============================================================ */
.sticker-sheet {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(40, 28, 24, 0.45);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  display: flex; align-items: flex-end;
  animation: fadeIn .25s ease;
}
.sticker-sheet[hidden] { display: none; }
.sticker-sheet-card {
  width: 100%; max-width: var(--col); margin: 0 auto;
  background: var(--surface-solid); border-radius: 28px 28px 0 0;
  padding: 20px 18px calc(var(--safe-b) + 20px);
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 -20px 60px rgba(0,0,0,.28);
  animation: slideUp .32s cubic-bezier(.22,.9,.36,1);
}
.ss-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ss-title { font-size: 18px; font-weight: 700; }
.ss-close { border: none; background: var(--surface-2); color: var(--ink-2); width: 32px; height: 32px; border-radius: 50%; font-size: 20px; cursor: pointer; line-height: 1; }
.sticker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; overflow-y: auto; flex: 1; padding: 2px; }
.sticker-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.sticker-item img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px; background: var(--surface-2); }
.si-meaning { font-size: 11px; color: var(--ink-2); text-align: center; word-break: break-all; }
.si-del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: none; background: #FBE4E0; color: #D97870; font-size: 14px; cursor: pointer; line-height: 1; display: grid; place-items: center; }
.ss-upload { margin-top: 14px; }
.ss-add-btn { width: 100%; padding: 13px; border: 1.5px dashed var(--ink-3); border-radius: 16px; background: transparent; color: var(--ink-2); font-family: inherit; font-size: 14px; cursor: pointer; }
.ss-meaning { margin-top: 12px; }
.ss-meaning input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 14px; font-family: inherit; outline: none; background: var(--surface-2); }
.ss-meaning-btns { display: flex; gap: 8px; margin-top: 10px; }
.ss-meaning-btns button { flex: 1; padding: 10px; border: none; border-radius: 12px; font-family: inherit; font-size: 14px; cursor: pointer; }
#stickerMeaningCancel { background: var(--surface-2); color: var(--ink-2); }
#stickerMeaningOk { background: linear-gradient(135deg, #EFA99F, #E8918A); color: #fff; font-weight: 650; }
.sticker-img { max-width: 160px; max-height: 160px; border-radius: 12px; display: block; }

/* ============================================================
   记账
   ============================================================ */
.bill-sheet {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(40, 28, 24, 0.45);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  display: flex; align-items: flex-end;
  animation: fadeIn .25s ease;
}
.bill-sheet[hidden] { display: none; }
.bill-sheet-card {
  width: 100%; max-width: var(--col); margin: 0 auto;
  background: var(--surface-solid); border-radius: 28px 28px 0 0;
  padding: 20px 18px calc(var(--safe-b) + 20px);
  box-shadow: 0 -20px 60px rgba(0,0,0,.28);
  animation: slideUp .32s cubic-bezier(.22,.9,.36,1);
}
.bill-type-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.bt-btn { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-family: inherit; font-size: 14px; cursor: pointer; }
.bt-btn.active { background: linear-gradient(135deg, #EFA99F, #E8918A); color: #fff; font-weight: 650; border-color: transparent; }
#billAmount { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 18px; font-family: inherit; outline: none; background: var(--surface-2); margin-bottom: 12px; }
.bill-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cat-chip { padding: 7px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-2); color: var(--ink-2); font-family: inherit; font-size: 13px; cursor: pointer; }
.cat-chip.active { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-soft); font-weight: 600; }
#billNote { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 14px; font-family: inherit; outline: none; background: var(--surface-2); margin-bottom: 14px; }
.bill-save { width: 100%; padding: 14px; border: none; border-radius: 16px; background: linear-gradient(135deg, #EFA99F, #E8918A); color: #fff; font-family: inherit; font-size: 15px; font-weight: 650; cursor: pointer; box-shadow: var(--shadow-glow); }
.bill-del { border: none; background: transparent; color: var(--ink-3); font-size: 18px; cursor: pointer; padding: 4px; line-height: 1; }

/* 桌面预览时隐藏滚动条 */
::-webkit-scrollbar { width: 0; height: 0; }
