/* ===== 念 · 全局样式 ===== */
:root {
  --theme: #c9a0dc;
  --theme-light: #e8d5f5;
  --theme-dark: #9b6db4;
  --home-nav-glass-alpha: 0.14;
  --home-nav-border-alpha: 0.22;
  --home-nav-blur: 18px;
  --home-nav-gap: 10px;
  --home-side-nav-gap: 5px;
  --home-nav-radius: 28px;
  --bg-primary: rgba(255,255,255,0.12);
  --bg-secondary: rgba(255,255,255,0.08);
  --bg-glass: rgba(255,255,255,0.18);
  --border: rgba(255,255,255,0.25);
  --text-primary: #2d1b3d;
  --text-secondary: #6b4d7f;
  --text-light: rgba(255,255,255,0.9);
  --shadow: 0 8px 32px rgba(148,92,184,0.2);
  --shadow-sm: 0 2px 12px rgba(148,92,184,0.12);
  --radius: 18px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  /* 角色气泡默认实色（与用户气泡同为不透明，不走半透明玻璃） */
  --bubble-ai-default-bg: #eceef2;

  --system-notify-bg: rgba(255, 255, 255, 0.96);
  --system-notify-text: #1a1224;
  --system-notify-border: rgba(0, 0, 0, 0.08);
  --system-notify-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);

  /* Gradient background */
  --bg-gradient: linear-gradient(135deg, #f5e6f8 0%, #e8d5f5 25%, #fef0f8 50%, #e5d9f2 75%, #f0e6fb 100%);
}

html[data-color-scheme="light"] {
  --bg-primary: rgba(255,255,255,0.72);
  --bg-secondary: rgba(255,255,255,0.55);
  --bg-glass: rgba(255,255,255,0.82);
  --border: rgba(0,0,0,0.08);
  --text-primary: #1a1224;
  --text-secondary: #5c4a6a;
  --shadow: 0 8px 32px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.06);
  --bubble-ai-default-bg: #eceef2;
  --system-notify-bg: rgba(255, 255, 255, 0.96);
  --system-notify-text: #1a1224;
  --system-notify-border: rgba(0, 0, 0, 0.08);
  --system-notify-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

html[data-color-scheme="dark"] {
  --bg-primary: rgba(255,255,255,0.1);
  --bg-secondary: rgba(255,255,255,0.06);
  --bg-glass: rgba(20,12,28,0.72);
  --border: rgba(255,255,255,0.14);
  --text-primary: #f3eaf8;
  --text-secondary: rgba(243,234,248,0.62);
  --shadow: 0 8px 32px rgba(0,0,0,0.35);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.25);
  --bubble-ai-default-bg: #2c2636;
  --system-notify-bg: rgba(30, 30, 36, 0.94);
  --system-notify-text: #f3eaf8;
  --system-notify-border: rgba(255, 255, 255, 0.12);
  --system-notify-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

#offline-banner {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10000;
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  background: rgba(30,20,40,0.92);
  color: #ffb4b4;
  backdrop-filter: blur(8px);
}
#offline-banner.is-visible { display: block; }

.bubble-wrap.msg-highlight {
  animation: msg-highlight-pulse 2.2s ease-out;
}

#messages-list.chat-select-mode {
  overflow-x: hidden;
}
#messages-list.chat-select-mode .bubble-wrap {
  cursor: pointer;
}
.bubble-wrap.is-selected {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--theme);
  border-radius: 14px;
  background: rgba(var(--theme-rgb, 160,100,200), 0.08);
}
.bubble-wrap.is-selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--theme);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}
.bubble-wrap.user.is-selected::after {
  left: 4px;
  right: auto;
}
.bubble-wrap.ai.is-selected::after {
  left: auto;
  right: 4px;
}
#messages-list.chat-select-mode .bubble-wrap.user {
  margin-right: 6px;
}
#messages-list.chat-select-mode .bubble-wrap.ai {
  margin-left: 6px;
}
@keyframes msg-highlight-pulse {
  0%, 100% { filter: none; }
  15%, 45% { filter: drop-shadow(0 0 8px var(--theme)); }
}

.cal-day--predicted {
  background: rgba(235,100,135,0.12);
  color: rgba(210,60,100,0.75);
  border: 1px dashed rgba(235,100,135,0.35);
}
.cal-legend {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-secondary);
  margin: 8px 0 12px;
}
.cal-legend-item { display: flex; align-items: center; gap: 4px; }
.cal-legend-dot {
  width: 10px; height: 10px; border-radius: 3px;
}

* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-weight: 300;
  color: var(--text-primary);
  background: #100818;
}

/* ===== 内页主题背景：铺满可视区域（含刘海），不用负偏移以免全屏时顶边空一条 ===== */
#theme-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  z-index: 1; pointer-events: none;
  opacity: 0; visibility: hidden;
}
#theme-bg.visible { opacity: 1; visibility: visible; }

/* ===== 主页桌面壁纸（固定层，不随 page display:none 卸载） ===== */
.home-desktop-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  /* 视频壁纸：仅用 opacity 藏，避免 visibility 挂起解码导致回主页卡顿 */
}
body.on-home .home-desktop-bg {
  opacity: 1;
  visibility: visible;
}
/* 图片壁纸离开主页：彻底脱离合成/动画，避免大图拖垮内页 */
body.home-bg-image:not(.on-home) .home-desktop-bg,
.home-desktop-bg.park-hard {
  opacity: 0 !important;
  visibility: hidden !important;
  content-visibility: hidden;
  pointer-events: none !important;
}
body.home-bg-image:not(.on-home) .home-desktop-bg .desktop-overlay,
body.home-bg-image:not(.on-home) .home-desktop-bg .water-droplet,
body.home-bg-image:not(.on-home) .home-desktop-bg .mist-wisp,
.home-desktop-bg.park-hard .desktop-overlay,
.home-desktop-bg.park-hard .water-droplet,
.home-desktop-bg.park-hard .mist-wisp {
  animation: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.home-desktop-bg canvas,
.home-desktop-bg video {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; pointer-events: none;
}
.home-desktop-bg img {
  position: absolute; top: 0; left: 0;
  object-fit: cover; pointer-events: none;
  max-width: none;
}
.home-desktop-bg canvas { z-index: 2; }
.home-desktop-bg video,
.home-desktop-bg img { z-index: 1; }
.home-desktop-bg video { opacity: 1; }
.home-desktop-bg img { opacity: 1; }

.desktop-overlay {
  position: absolute; inset: 0; z-index: 3;
  pointer-events: none; display: none;
}
/* 图片壁纸：用半透明罩代替 backdrop-filter，避免每帧对大图做模糊 */
.desktop-overlay.is-glass.is-lite {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: linear-gradient(
    145deg,
    rgba(255,255,255, calc(0.14 + (1 - var(--glass-clarity)) * 0.22)) 0%,
    rgba(255,255,255, calc(0.06 + (1 - var(--glass-clarity)) * 0.12)) 100%
  );
}
.desktop-overlay.is-frosted.is-lite {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(255,255,255, calc(0.18 + (1 - var(--frost-clarity)) * 0.28));
}
/* 内页主题若用大图：降低毛玻璃采样成本，避免点进功能也卡 */
body.theme-bg-image .topbar,
body.theme-bg-image .sheet-full-topbar,
body.theme-bg-image .bottom-nav,
body.theme-bg-image .side-nav {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.desktop-overlay.is-mist {
  display: block;
  --overlay-strength: 0.5;
  overflow: hidden;
  background: transparent;
  opacity: 1;
}
.desktop-overlay.is-mist::before {
  content: '';
  position: absolute;
  bottom: -18%;
  left: -25%;
  width: 150%;
  height: 62%;
  background:
    radial-gradient(ellipse 55% 70% at 30% 100%, rgba(255,255,255,calc(0.55 + var(--overlay-strength) * 0.35)), transparent 68%),
    radial-gradient(ellipse 45% 60% at 72% 100%, rgba(255,255,255,calc(0.45 + var(--overlay-strength) * 0.3)), transparent 65%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(245,250,255,calc(0.35 + var(--overlay-strength) * 0.25)), transparent 72%);
  filter: blur(calc(8px + (1 - var(--overlay-strength)) * 6px));
  animation: mist-rise-base 28s ease-in-out infinite;
}
.desktop-overlay.is-mist::after {
  content: '';
  position: absolute;
  bottom: -8%;
  left: -10%;
  width: 120%;
  height: 42%;
  background: radial-gradient(ellipse 80% 90% at 50% 100%, rgba(255,255,255,calc(0.25 + var(--overlay-strength) * 0.2)), transparent 70%);
  filter: blur(14px);
  animation: mist-rise-soft 34s ease-in-out infinite reverse;
}
.mist-wisp {
  position: absolute;
  bottom: -5%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,calc(0.5 + var(--overlay-strength) * 0.35)) 0%, rgba(255,255,255,0.08) 55%, transparent 72%);
  filter: blur(calc(6px + (1 - var(--overlay-strength)) * 8px));
  animation: mist-wisp-rise linear infinite;
  pointer-events: none;
}
.desktop-overlay.is-glass {
  display: block;
  --glass-clarity: 0.5;
  backdrop-filter: blur(calc((1 - var(--glass-clarity)) * 16px + 0.5px)) saturate(calc(1 + var(--glass-clarity) * 0.2));
  -webkit-backdrop-filter: blur(calc((1 - var(--glass-clarity)) * 16px + 0.5px)) saturate(calc(1 + var(--glass-clarity) * 0.2));
  background: linear-gradient(145deg, rgba(255,255,255,calc(0.06 + (1 - var(--glass-clarity)) * 0.14)) 0%, rgba(255,255,255,calc(0.02 + (1 - var(--glass-clarity)) * 0.06)) 40%, rgba(255,255,255,calc(0.04 + (1 - var(--glass-clarity)) * 0.1)) 100%);
  box-shadow: inset 0 0 80px rgba(255,255,255,calc(0.03 + (1 - var(--glass-clarity)) * 0.08));
}
.desktop-overlay.is-glass::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 35%;
  background: linear-gradient(rgba(255,255,255,calc(0.1 + var(--glass-clarity) * 0.15)), transparent);
}
.desktop-overlay.is-frosted {
  display: block;
  --frost-clarity: 0.5;
  backdrop-filter: blur(calc((1 - var(--frost-clarity)) * 28px + 2px)) saturate(1.08);
  -webkit-backdrop-filter: blur(calc((1 - var(--frost-clarity)) * 28px + 2px)) saturate(1.08);
  background: rgba(255,255,255,calc(0.1 + (1 - var(--frost-clarity)) * 0.32));
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  overflow: hidden;
}
.droplet-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
}
.water-droplet {
  position: absolute;
  border-radius: 50%;
  /* Two-layer gradient: bright specular highlight + blue-tinted water body */
  background:
    radial-gradient(circle at 33% 28%, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0) 26%),
    radial-gradient(circle at 50% 55%, rgba(210,232,255,0.62) 0%, rgba(185,218,255,0.32) 50%, rgba(160,205,255,0.06) 100%);
  box-shadow:
    inset 0 -2px 3px rgba(140,185,230,0.45),   /* bottom gravity shadow */
    0 1px 4px rgba(0,0,0,0.07),
    0 0 0 0.5px rgba(175,210,255,0.4);          /* subtle edge ring */
  filter: blur(0.06px);
  transform-origin: 50% 50%;
  animation: droplet-condense-slide var(--dur, 26s) ease-in infinite var(--delay, 0s);
}
@keyframes droplet-condense-slide {
  /* Phase 1: condense — grows from invisible dot */
  0%   { transform: scale(0.06) translateY(0);                              opacity: 0; }
  5%   { transform: scale(0.28) translateY(0);                              opacity: 0.4; }
  14%  { transform: scale(0.64) translateY(0);                              opacity: 0.78; }
  22%  { transform: scale(0.92) translateY(0);                              opacity: 0.9; }
  28%  { transform: scale(1)    translateY(0);                              opacity: 0.95; }
  /* Phase 2: hold — surface tension keeps it still */
  36%  { transform: scale(1.01) translateY(0);                              opacity: 0.94; }
  /* Phase 3: bottom starts to bulge under gravity */
  40%  { transform: scale(1)    scaleY(1.07) translateY(0);                 opacity: 0.93; }
  43%  { transform: scale(0.97) scaleY(1.16) translateY(2px);              opacity: 0.91; }
  /* Phase 4: releases and slides */
  47%  { transform: scale(0.95) scaleY(1.24) translateY(8px);              opacity: 0.9; }
  54%  { transform: scale(0.93) scaleY(1.32) translateY(26px); }
  64%  { transform: scale(0.91) scaleY(1.36) translateY(65px); }
  75%  { transform: scale(0.89) scaleY(1.3)  translateY(145px);            opacity: 0.82; }
  88%  { transform: scale(0.87) scaleY(1.2)  translateY(285px);            opacity: 0.62; }
  100% { transform: scale(0.85) scaleY(1.1)  translateY(calc(100vh + 110px)); opacity: 0; }
}

.gradient-presets {
  display: flex; flex-wrap: wrap; gap: 10px; width: 100%;
}
.gradient-preset {
  width: 52px; height: 52px; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; flex-shrink: 0;
  transition: transform 0.15s, border-color 0.15s;
  box-shadow: var(--shadow-sm);
}
.gradient-preset:hover { transform: scale(1.05); }
.gradient-preset.active { border-color: var(--theme); box-shadow: 0 0 0 2px var(--theme-light); }
.gradient-preset-label {
  font-size: 10px; color: var(--text-secondary); text-align: center;
  margin-top: 4px; line-height: 1.2;
}
@keyframes mist-rise-base {
  0% { transform: translateY(6%) scale(1); opacity: 0.75; }
  45% { transform: translateY(-8%) scale(1.04); opacity: 0.95; }
  100% { transform: translateY(-22%) scale(1.08); opacity: 0.55; }
}
@keyframes mist-rise-soft {
  0% { transform: translateY(4%) scale(1.02); opacity: 0.5; }
  50% { transform: translateY(-12%) scale(1.06); opacity: 0.85; }
  100% { transform: translateY(-28%) scale(1.1); opacity: 0.35; }
}
@keyframes mist-wisp-rise {
  0% { transform: translateY(0) scale(0.85); opacity: 0; }
  8% { opacity: calc(0.45 + var(--overlay-strength) * 0.4); }
  100% { transform: translateY(calc(-100vh - 120px)) scale(1.15); opacity: 0; }
}

/* ===== 媒体裁剪 ===== */
.media-crop-modal {
  width: calc(100% - 24px); max-width: 420px;
  background: var(--bg-glass); backdrop-filter: blur(24px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.media-crop-title { font-size: 16px; font-weight: 500; margin-bottom: 12px; text-align: center; }
.media-crop-stage {
  position: relative; width: 100%; aspect-ratio: 9/16; max-height: 58vh;
  background: #0a0610; border-radius: 12px; overflow: hidden;
}
.media-crop-inner {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.media-crop-inner img, .media-crop-inner video {
  max-width: 100%; max-height: 100%; display: block;
}
.media-crop-box {
  position: absolute; border: 2px solid rgba(255,255,255,0.95);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.55);
  cursor: move; touch-action: none; z-index: 2;
}
.crop-handle {
  position: absolute; width: 14px; height: 14px;
  background: white; border: 2px solid var(--theme-dark);
  border-radius: 50%; z-index: 3;
}
.crop-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.crop-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.crop-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.crop-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.media-crop-hint { font-size: 11px; color: var(--text-secondary); text-align: center; margin: 10px 0 4px; }
.media-crop-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }

/* ===== 页面容器 ===== */
html {
  height: 100%;
  height: -webkit-fill-available;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-gradient, #e8d5f5);
}

body {
  min-height: 100%;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  body {
    overscroll-behavior-y: none;
  }
}

/* 桌面快捷方式：顶栏按安全区正常留白（不再为「全屏藏状态栏」少留空隙） */
@media (display-mode: fullscreen), (display-mode: standalone) {
  .topbar,
  .sheet-full-topbar,
  .secret-topbar,
  .secret-sheet-topbar {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
  }
  .moments-topbar {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
  }
}

.page {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  height: 100dvh;
  display: none; flex-direction: column; z-index: 10;
  overflow: hidden;
  transition: top 0.12s ease-out, height 0.12s ease-out;
}
.page.active { display: flex; }

#chat-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 0;
  background: var(--bg-gradient);
}
/* 键盘打开时：背景用 JS 反向偏移钉整屏；内容叠在背景之上 */
#chat-page.keyboard-open #chat-bg {
  z-index: 0;
  pointer-events: none;
}
#chat-page.keyboard-open > *:not(#chat-bg) {
  position: relative;
  z-index: 1;
}
#chat-page.keyboard-open .topbar {
  z-index: 30;
}

/* ===== 玻璃卡片 ===== */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.glass-sm {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* ===== 顶部导航栏 ===== */
/* 全站顶栏一律不透明白底，不再用半透明玻璃透出主题图 */
.topbar {
  display: flex; align-items: center;
  padding: 12px 16px;
  /* 普通页关闭 overlay 后 safe-area 常为 0；叠层开启时再垫刘海 */
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 2px 8px rgba(0,0,0,0.04);
  z-index: 100; flex-shrink: 0;
  gap: 10px;
}
html[data-color-scheme="dark"] .topbar {
  background: #1e1824;
  border-bottom-color: rgba(255,255,255,0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* 顶栏返回 / 动作：全站只留图标，去掉方块底（保存键除外） */
.topbar-back {
  min-width: 40px; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; cursor: pointer;
  color: var(--text-primary);
  background: transparent;
  border: none;
  box-shadow: none;
  transition: color 0.15s, opacity 0.15s, transform 0.12s;
  font-family: 'Noto Serif SC', serif;
  font-size: 24px;
  font-weight: 700;
  padding: 0;
}
.topbar-back:hover { background: transparent; color: var(--theme-dark); box-shadow: none; transform: none; }
.topbar-back:active { transform: scale(0.92); background: transparent; box-shadow: none; }
/* 朋友圈封面上的返回：仍只留箭头，浅色半透明点按反馈 */
.moments-topbar-back:hover { background: rgba(255,255,255,0.16); }
.moments-topbar-back:active { background: rgba(255,255,255,0.28); }
/* 专用返回键：粗 SVG 箭头（总设置保存同笔触） */
.topbar-nav-back {
  font-size: 0 !important;
  line-height: 0;
}
.topbar-nav-back::before {
  content: '';
  display: block;
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18 9 12l6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18 9 12l6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.topbar-actions { display: flex; gap: 4px; align-items: center; }
.topbar-action {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; cursor: pointer;
  color: var(--text-primary);
  background: transparent;
  border: none;
  box-shadow: none;
  transition: color 0.15s, opacity 0.15s, transform 0.12s;
  padding: 0;
  font-size: 18px;
  font-weight: 600;
}
.topbar-action:hover { color: var(--theme-dark); background: transparent; border: none; box-shadow: none; transform: none; }
.topbar-action:active { transform: scale(0.92); background: transparent; box-shadow: none; }
.topbar-action svg { display: block; width: 20px; height: 20px; }

.topbar-save {
  min-width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; cursor: pointer;
  color: var(--theme-dark);
  background: var(--theme-light);
  border: 1.5px solid rgba(201,160,220,0.45);
  box-shadow: 0 2px 6px rgba(148,92,184,0.18), inset 0 1px 0 rgba(255,255,255,0.85);
  transition: all 0.18s;
  padding: 0 12px; flex-shrink: 0;
  font-size: 0;
  font-weight: 700;
}
.topbar-save:hover { background: var(--theme); color: #fff; border-color: var(--theme-dark); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(148,92,184,0.28); }
.topbar-save:active { transform: scale(0.9); box-shadow: inset 0 1px 4px rgba(0,0,0,0.12); transition: all 0.08s; }
.topbar-save:not(:has(svg))::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.topbar-save svg { display: block; }

.list-item-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--theme-light); color: var(--theme-dark);
  flex-shrink: 0;
}

.topbar-title {
  flex: 1;
  font-family: 'Noto Serif SC', serif;
  font-size: 17px; font-weight: 500;
  color: var(--text-primary);
}

/* ===== 秘密 / 随手记：顶栏跟全站一样用不透明白底 ===== */
.secret-topbar,
.secret-sheet-topbar {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid rgba(0,0,0,0.08) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 2px 8px rgba(0,0,0,0.04) !important;
  gap: 8px;
}
html[data-color-scheme="dark"] .secret-topbar,
html[data-color-scheme="dark"] .secret-sheet-topbar {
  background: #1e1824 !important;
  border-bottom: 1px solid rgba(255,255,255,0.1) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25) !important;
}
/* 隐藏按钮用 display:none，不占位，避免标题旁留空 */
.topbar-action-danger { color: #c9564f; }
html[data-color-scheme="dark"] .topbar-action-danger { color: #e5817a; }
.topbar-action-danger:hover { color: #a83e38; background: transparent; border: none; }

/* 秘密顶栏：返回/动作只留图标；保存键仍保留方块强调 */
.secret-topbar .topbar-back,
.secret-topbar .topbar-action,
.secret-sheet-topbar .topbar-back,
.secret-sheet-topbar .topbar-action {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  font-size: 18px;
  border-radius: 10px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text-primary);
  padding: 0;
  flex-shrink: 0;
}
.secret-topbar .topbar-save,
.secret-sheet-topbar .topbar-save {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  font-size: 18px;
  border-radius: 12px;
  background: var(--theme-light);
  border: 1.5px solid rgba(201,160,220,0.45);
  box-shadow: 0 2px 6px rgba(148,92,184,0.18), inset 0 1px 0 rgba(255,255,255,0.85);
  color: var(--theme-dark);
  padding: 0;
  flex-shrink: 0;
}
.secret-topbar .topbar-back:hover,
.secret-topbar .topbar-action:hover,
.secret-sheet-topbar .topbar-back:hover,
.secret-sheet-topbar .topbar-action:hover {
  background: transparent;
  border: none;
  color: var(--theme-dark);
}
.secret-topbar .topbar-save:hover,
.secret-sheet-topbar .topbar-save:hover {
  background: var(--theme);
  border-color: var(--theme-dark);
  color: #fff;
}
html[data-color-scheme="dark"] .secret-topbar .topbar-back,
html[data-color-scheme="dark"] .secret-topbar .topbar-action,
html[data-color-scheme="dark"] .secret-sheet-topbar .topbar-back,
html[data-color-scheme="dark"] .secret-sheet-topbar .topbar-action {
  background: transparent;
  border: none;
  box-shadow: none;
  color: rgba(255,255,255,0.88);
}
html[data-color-scheme="dark"] .secret-topbar .topbar-save,
html[data-color-scheme="dark"] .secret-sheet-topbar .topbar-save {
  background: rgba(201,160,220,0.22);
  border-color: rgba(201,160,220,0.4);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  color: #f0e6f8;
}
.secret-topbar .topbar-title,
.secret-sheet-topbar .sheet-full-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 0;
}
.secret-topbar .topbar-actions,
.secret-sheet-topbar .topbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

/* ===== 滚动区域 ===== */
.scroll-area {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.scroll-area::-webkit-scrollbar { width: 3px; }
.scroll-area::-webkit-scrollbar-thumb {
  background: var(--theme-light); border-radius: 2px;
}

/* 移动端式滚动：可滑但不显示滚动条 */
.scroll-area-native,
#contacts-page .scroll-area,
#settings-page .scroll-area {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scroll-area-native::-webkit-scrollbar,
#contacts-page .scroll-area::-webkit-scrollbar,
#settings-page .scroll-area::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 14px;
  font-size: 14px; font-weight: 400; cursor: pointer;
  border: 1px solid transparent; transition: all 0.22s; gap: 6px;
  font-family: 'Noto Serif SC', 'Noto Sans SC', serif;
  letter-spacing: 0.4px;
  position: relative; overflow: hidden;
}

.btn-primary {
  background: linear-gradient(145deg, var(--theme) 0%, var(--theme-dark) 100%);
  color: white;
  border-color: rgba(255,255,255,0.28);
  box-shadow: 0 4px 18px rgba(148,92,184,0.35), inset 0 1px 0 rgba(255,255,255,0.22);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(148,92,184,0.42); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
  color: var(--theme-dark);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-ghost:hover {
  background: linear-gradient(145deg, var(--theme-light), rgba(232,213,245,0.5));
  color: var(--theme-dark);
  border-color: rgba(201,160,220,0.45);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.25);
}

.btn-soft {
  background: rgba(255,255,255,0.12);
  color: var(--text-primary);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.btn-soft:hover { background: var(--theme-light); color: var(--theme-dark); transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(145deg, rgba(255,120,120,0.14), rgba(255,80,80,0.08));
  color: #c62828;
  border: 1px solid rgba(229,57,53,0.25);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.btn-danger:hover { background: rgba(229,57,53,0.12); transform: translateY(-1px); }

.btn-ghost:active, .btn-soft:active, .btn-danger:active {
  transform: translateY(0.5px) scale(0.97);
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.12);
  transition: all 0.08s;
}

.btn-sm { padding: 7px 16px; font-size: 13px; border-radius: 12px; }
.btn-icon { padding: 8px; border-radius: 12px; }

/* ===== 双方称呼（角色编辑） ===== */
.nn-block { margin-bottom: 4px; }
.nn-side-title {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  margin-bottom: 6px;
}
.nn-chip-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 28px; margin-bottom: 8px;
}
.nn-empty {
  font-size: 12px; color: var(--text-secondary); opacity: 0.75;
  padding: 4px 0;
}
.nn-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 8px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px; font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.nn-chip:hover { border-color: var(--theme); }
.nn-chip.is-primary {
  border-color: rgba(148, 92, 184, 0.45);
  background: rgba(148, 92, 184, 0.1);
}
.nn-chip em {
  font-style: normal; font-size: 10px;
  color: var(--theme); opacity: 0.9;
}
.nn-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 2px;
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 14px; line-height: 1;
}
.nn-chip-x:hover { color: #e53935; background: rgba(229, 57, 53, 0.1); }
.nn-add-row {
  display: flex; gap: 8px; align-items: center;
}
.nn-add-row .input { flex: 1; padding: 8px 12px; }
.nn-scan-section { margin-bottom: 12px; }
.nn-scan-label {
  font-size: 13px; font-weight: 500; margin-bottom: 6px;
}
.nn-scan-list { display: flex; flex-direction: column; gap: 4px; }
.nn-scan-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  cursor: pointer; font-size: 14px;
}
.nn-scan-item:hover { border-color: var(--theme); }

/* ===== 输入框 ===== */
.input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 14px; font-family: inherit; font-weight: 300;
  outline: none; transition: all 0.2s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.input:focus {
  border-color: var(--theme); background: var(--bg-glass);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04), 0 0 0 3px rgba(148,92,184,0.14);
}
.input::placeholder { color: var(--text-secondary); opacity: 0.6; }

textarea.input {
  resize: none; min-height: 80px; line-height: 1.6;
  scrollbar-width: none;   /* Firefox */
}
textarea.input::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* 点开放大编辑的文本框：readonly，靠右上角小图标提示可点开 */
textarea.input.ta-expandable {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23945cb8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M9 21H3v-6'/%3E%3Cpath d='M21 3l-7 7'/%3E%3Cpath d='M3 21l7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: top 10px right 10px;
}

.input-label {
  font-size: 12px; color: var(--text-secondary); margin-bottom: 6px;
  display: block;
}

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

/* ===== 开关 ===== */
.toggle {
  position: relative; width: 44px; height: 24px;
  display: inline-block; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(148,92,184,0.2);
  border-radius: 24px; transition: 0.3s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
.toggle-slider:before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: linear-gradient(160deg, #fff, #f0eaf5);
  border-radius: 50%;
  transition: 0.3s; box-shadow: 0 1px 4px rgba(0,0,0,0.25), 0 1px 1px rgba(255,255,255,0.5);
}
.toggle input:checked + .toggle-slider { background: linear-gradient(145deg, var(--theme), var(--theme-dark)); box-shadow: inset 0 1px 3px rgba(0,0,0,0.18); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }
.toggle-slider:active:before { width: 21px; }

/* ===== 列表项 ===== */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-primary); }
.list-item:active { background: var(--theme-light); }

/* ===== 头像 ===== */
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  background: var(--theme-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--theme-dark);
  border: 2px solid rgba(255,255,255,0.5);
}

.avatar-lg { width: 64px; height: 64px; font-size: 26px; }
.avatar-sm { width: 32px; height: 32px; font-size: 14px; }

/* 聊天页头像：去掉边框/底色框，只显示头像图 */
#chat-page .avatar {
  border: none;
  box-shadow: none;
}
#chat-page img.avatar {
  background: transparent;
}

/* Status indicator */
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid white; position: absolute;
  bottom: 0; right: 0;
}
.status-online { background: #52c41a; }
.status-busy { background: #faad14; }
.status-offline { background: #d9d9d9; }

/* ===== 引用块 ===== */
.bubble-reply-block {
  display: flex; align-items: stretch; gap: 6px;
  margin-bottom: 4px; max-width: 100%;
  border-radius: 6px; overflow: hidden;
  /* 实一点，浅/深气泡里都能看清 */
  background: color-mix(in srgb, var(--text-primary, #222) 22%, #fff 55%);
  padding: 5px 8px;
}
.bubble-reply-block.user {
  background: color-mix(in srgb, #000 28%, #fff 48%);
}
.bubble-reply-block.ai {
  background: color-mix(in srgb, var(--text-primary, #222) 16%, #fff 62%);
}
html[data-color-scheme="dark"] .bubble-reply-block.ai {
  background: rgba(255, 255, 255, 0.28);
}
html[data-color-scheme="dark"] .bubble-reply-block.user {
  background: rgba(0, 0, 0, 0.48);
}
.bubble-reply-line {
  width: 3px; border-radius: 99px; flex-shrink: 0;
  background: var(--theme);
}
.bubble-reply-text {
  font-size: 12px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0; line-height: 1.4;
  opacity: 1;
}

/* ===== 气泡 ===== */
#messages-list {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.bubble-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  margin: 5px 12px;
  max-width: 100%;
  min-width: 0;
  position: relative;
}
.bubble-wrap.align-top { align-items: flex-start; }
.bubble-wrap.user { flex-direction: row-reverse; }
.bubble-wrap > div:last-child,
.bubble-wrap > .bubble-col {
  max-width: calc(100% - 52px);
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
}
.bubble-wrap.user > div:last-child,
.bubble-wrap.user > .bubble-col { align-items: flex-end; }
.bubble-wrap.user > .bubble-col {
  flex: 1 1 0;
  max-width: calc(100% - 52px);
}
.bubble-wrap.user .bubble-block {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.bubble-wrap.ai > div:last-child,
.bubble-wrap.ai > .bubble-col { align-items: flex-start; }
.bubble-col {
  width: auto;
  max-width: 100%;
  min-width: 0;
}

.bubble-user-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: auto;
  max-width: 100%;
  min-width: 0;
}
.bubble-user-content {
  width: auto;
  max-width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}
.bubble-wrap.user.align-top .bubble-user-row { align-items: flex-end; }

/* 气泡 + 外置时间戳 */
.bubble-block {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
  width: auto;
}
.bubble-block.user { flex-direction: row; }
.bubble-block.ai { flex-direction: row; }
.bubble-meta-foot.user { order: 0; }
.bubble-block.user .bubble-main { order: 1; }
.bubble-meta-foot.ai { order: 1; }
.bubble-block.ai .bubble-main { order: 0; }
.bubble-main {
  width: auto;
  max-width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}
.bubble-meta-foot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-bottom: 1px;
  line-height: 1;
  font-size: 10px;
}
.bubble-meta-foot.user { flex-direction: row; }
.bubble-meta-foot.ai { flex-direction: row; }
.bubble-stack {
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: 100%;
  min-width: 0;
}
.bubble-stack.user { align-items: flex-end; }
.bubble-stack.ai { align-items: flex-start; }
.bubble-meta-foot--inline {
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 2px;
  padding: 0 2px;
}
/* 气泡下：用户消息靠右、角色靠左（跟气泡同侧） */
.bubble-stack.user .bubble-meta-foot--inline {
  justify-content: flex-end;
  align-self: flex-end;
}
.bubble-stack.ai .bubble-meta-foot--inline {
  justify-content: flex-start;
  align-self: flex-start;
}

/* 气泡外时间戳（明暗交给内层 .bubble-time-text） */
.bubble-time-outside {
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
}

/* 已读/未读标志：与时间戳同字号、同行高，避免「已读」看起来比时间戳更高 */
.bubble-read-tag {
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  flex-shrink: 0;
  color: var(--read-tag-color, #000);
  display: inline-block;
  vertical-align: middle;
}
.bubble-read-tag.read {
  opacity: 0.85;
}
.bubble-read-tag.unread {
  opacity: 0.5;
}
.read-tag-white .bubble-read-tag {
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.35);
}
/* divider 模式专用：没有逐条时间戳可依附，已读/未读单独占一行 */
.bubble-read-tag-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 1px;
  padding-right: 2px;
}

/* 右下角：绝对定位贴右下，不用 float（短中文如「哎呀」会被 float 挤成竖排） */
.bubble:has(.bubble-time-corner),
.message-bubble:has(.bubble-time-corner) {
  position: relative;
  padding-bottom: 16px; /* 给时间戳留一行，避免压字 */
}
.bubble-time-corner {
  position: absolute;
  right: 8px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  float: none;
  font-size: 10px;
  line-height: 1;
  height: auto;
  margin: 0;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
.bubble-time-corner .bubble-read-tag,
.bubble-time-corner .bubble-time-text {
  font-size: 10px;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

/* 时间戳颜色直接复用已读未读戳同一套配色 */
.bubble-time-text {
  color: var(--read-tag-color, #000);
  font-size: 10px;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
  pointer-events: none;
}
.bubble-time-text.read { opacity: 0.85; }
.bubble-time-text.unread { opacity: 0.5; }
.read-tag-white .bubble-time-text {
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.35);
}

.bubble-main .voice-message { min-width: 0; max-width: 100%; overflow: visible; }

/* 气泡外时间戳：与气泡底、头像同一水平线；用户在左、角色在右 */

.bubble-media {
  max-width: min(220px, 55vw);
  max-height: min(390px, 62vh);
  width: auto;
  height: auto;
  border-radius: 12px;
  display: block;
  cursor: pointer;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.04);
}
.bubble-media[data-aspect="9:16"] {
  width: min(180px, 48vw);
  height: auto;
  max-height: min(390px, 62vh);
  aspect-ratio: 9 / 16;
  object-fit: contain;
}
.bubble-media[data-aspect="3:4"] {
  width: min(200px, 52vw);
  height: auto;
  max-height: min(320px, 55vh);
  aspect-ratio: 3 / 4;
  object-fit: contain;
}
.bubble-media[data-aspect="16:9"],
.bubble-media[data-aspect="4:3"] {
  width: min(240px, 62vw);
  height: auto;
  max-height: min(180px, 40vh);
  object-fit: contain;
}
.bubble-media[data-aspect="16:9"] { aspect-ratio: 16 / 9; }
.bubble-media[data-aspect="4:3"] { aspect-ratio: 4 / 3; }
.bubble-media[data-aspect="1:1"] {
  width: min(200px, 52vw);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}
.bubble-media.bubble-media-pending {
  width: min(200px, 55vw);
  max-height: none;
  background: rgba(128, 128, 128, 0.12);
  border: 1px solid var(--border);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.bubble-media.bubble-media-failed {
  width: min(200px, 55vw);
  max-height: none;
  background: rgba(180, 60, 60, 0.08);
  border: 1px dashed rgba(180, 60, 60, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
  padding: 12px;
  box-sizing: border-box;
  line-height: 1.45;
}
.bubble-media.bubble-media-failed small {
  opacity: 0.7;
  font-size: 11px;
}
.bubble-media-pending-dots {
  font-size: 22px;
  letter-spacing: 0.12em;
  opacity: 0.75;
  animation: bubble-pending-pulse 1.2s ease-in-out infinite;
}
@keyframes bubble-pending-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.95; }
}
.bubble-media.bubble-sticker {
  object-fit: contain;
  max-width: 100px;
  max-height: 100px;
}
.bubble-media.bubble-video-thumb {
  pointer-events: auto;
}
.chat-media-viewer { padding: 16px; }
.chat-media-viewer-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.chat-media-viewer-inner {
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.chat-media-viewer-inner img,
.chat-media-viewer-inner video {
  max-width: min(92vw, 720px);
  max-height: min(78vh, 900px);
  border-radius: 12px;
  object-fit: contain;
  background: #111;
}
.chat-media-reroll-btn {
  margin-top: 14px;
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.chat-media-reroll-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* 隐藏头像时气泡贴边，并扩展最大宽度 */
.bubble-wrap.no-avatar { gap: 0; }
.bubble-wrap.no-avatar.user { padding-right: 4px; }
.bubble-wrap.no-avatar.ai  { padding-left: 4px; }
/* 直接限制 bubble-col 宽度，避免 width:fit-content 与 max-width:88% 的循环引用导致换行异常 */
.bubble-wrap.no-avatar > div:last-child,
.bubble-wrap.no-avatar > .bubble-col { max-width: 88%; }

.bubble {
  max-width: 100%; width: auto;
  padding: 10px 14px;
  border-radius: 18px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.6; position: relative;
  box-shadow: var(--shadow-sm);
  font-size: var(--bubble-font-size, 15px);
  font-family: var(--bubble-font-family, 'Noto Sans SC', 'PingFang SC', sans-serif);
  box-sizing: border-box;
}
.bubble > .content {
  font-family: inherit;
}
#messages-area,
#cs-bubble-preview-stage,
#cs-custom-bubble-preview-stage {
  --bubble-font-size: 15px;
}
.bubble.ai {
  /* 默认实色中性底，与用户气泡同为不透明；半透明仅在选了透明/毛玻璃/磨砂时生效 */
  background: var(--bubble-ai-bg, var(--bubble-ai-default-bg));
  border: none;
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.bubble.user {
  background: linear-gradient(135deg, var(--theme), var(--theme-dark));
  color: white;
  border-bottom-right-radius: 4px;
}
/* 用户自定义气泡色：仅实色风格用纯色底；透明/毛玻璃/磨砂走下方 rgba 规则 */
#messages-area.user-bubble-custom:not(.bubble-style-transparent):not(.bubble-style-frosted):not(.bubble-style-matte) .bubble.user,
#cs-bubble-preview-stage.user-bubble-custom:not(.bubble-style-transparent):not(.bubble-style-frosted):not(.bubble-style-matte) .bubble.user,
#cs-custom-bubble-preview-stage.user-bubble-custom:not(.bubble-style-transparent):not(.bubble-style-frosted):not(.bubble-style-matte) .bubble.user {
  background: var(--user-bubble-bg);
}

/* 形状=自定义：默认底色/圆角套在所有气泡（含语音）；文字气泡另设 padding */
.bubble-shape-custom .bubble.user,
.bubble-shape-custom .bubble.ai {
  background: #e8e8ed;
  color: var(--text-primary);
  border: none;
  border-radius: 18px;
  box-shadow: none;
  overflow: visible;
}
.bubble-shape-custom .bubble.user {
  background: #c9a0dc;
  color: #fff;
}
.bubble-shape-custom .bubble:not(.voice-bubble) {
  padding: 10px 14px;
}
.bubble-shape-custom .bubble.voice-bubble {
  /* 与文字默认一致；自定义 CSS 可覆盖 */
  padding: 10px 14px;
}
.bubble-shape-custom .bubble > .content {
  display: block;
  /* 不强制清掉背景：很多自定义主题把底色画在 .content 上 */
  color: inherit;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  writing-mode: horizontal-tb;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 1.5em; /* 避免被挤成「一字一列」的竖排 */
  max-width: 100%;
}
/* 自定义主题若写了 display:flex 等，仍保证正文横向排 */
.bubble > .content {
  writing-mode: horizontal-tb;
}

.bubble.recalled {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  color: var(--text-secondary) !important;
  font-size: 13px;
}

/* ===== 气泡形状变体（差异拉开） ===== */

/* 软圆：四角同等大圆角，无尖角 */
.bubble-shape-soft .bubble,
.bubble-shape-telegram .bubble {
  border-radius: 24px !important;
}
.bubble-shape-soft .bubble-wrap.user .bubble,
.bubble-shape-soft .bubble-wrap.ai .bubble,
.bubble-shape-telegram .bubble-wrap.user .bubble,
.bubble-shape-telegram .bubble-wrap.ai .bubble {
  border-bottom-left-radius: 24px !important;
  border-bottom-right-radius: 24px !important;
}

/* 微信：小圆角 + 靠上 CSS 三角尾（标准 border 三角形） */
.bubble-shape-tail .bubble,
.bubble-shape-wechat .bubble {
  border-radius: 4px !important;
  position: relative;
  overflow: visible !important;
  box-shadow: none !important;
}
.bubble-shape-tail .bubble-wrap.user .bubble,
.bubble-shape-wechat .bubble-wrap.user .bubble {
  border-radius: 4px !important;
  border-bottom-right-radius: 4px !important;
  margin-right: 6px;
}
.bubble-shape-tail .bubble-wrap.ai .bubble,
.bubble-shape-wechat .bubble-wrap.ai .bubble {
  border-radius: 4px !important;
  border-bottom-left-radius: 4px !important;
  margin-left: 6px;
}
.bubble-shape-tail .bubble-wrap.user .bubble::before,
.bubble-shape-wechat .bubble-wrap.user .bubble::before {
  content: '';
  position: absolute;
  top: 13px;
  right: -6px;
  width: 0;
  height: 0;
  background: none !important;
  transform: none;
  border-style: solid;
  border-width: 5px 0 5px 6px;
  border-color: transparent transparent transparent var(--wechat-user-tail, var(--user-bubble-bg, var(--theme)));
  box-shadow: none;
  z-index: 0;
}
.bubble-shape-tail .bubble-wrap.ai .bubble::before,
.bubble-shape-wechat .bubble-wrap.ai .bubble::before {
  content: '';
  position: absolute;
  top: 13px;
  left: -6px;
  width: 0;
  height: 0;
  background: none !important;
  transform: none;
  border-style: solid;
  border-width: 5px 6px 5px 0;
  border-color: transparent var(--wechat-ai-tail, var(--bubble-ai-bg, var(--bubble-ai-default-bg))) transparent transparent;
  box-shadow: none;
  z-index: 0;
}
.bubble-shape-tail .bubble-wrap .bubble > *,
.bubble-shape-wechat .bubble-wrap .bubble > * {
  position: relative;
  z-index: 1;
}
.bubble-style-transparent.bubble-shape-tail .bubble-wrap.user .bubble::before,
.bubble-style-frosted.bubble-shape-tail .bubble-wrap.user .bubble::before,
.bubble-style-matte.bubble-shape-tail .bubble-wrap.user .bubble::before,
.bubble-style-transparent.bubble-shape-wechat .bubble-wrap.user .bubble::before,
.bubble-style-frosted.bubble-shape-wechat .bubble-wrap.user .bubble::before,
.bubble-style-matte.bubble-shape-wechat .bubble-wrap.user .bubble::before {
  background: none !important;
  border-left-color: rgba(var(--theme-rgb, 160,100,200), calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68)));
}
.bubble-style-transparent.bubble-shape-tail .bubble-wrap.ai .bubble::before,
.bubble-style-frosted.bubble-shape-tail .bubble-wrap.ai .bubble::before,
.bubble-style-matte.bubble-shape-tail .bubble-wrap.ai .bubble::before,
.bubble-style-transparent.bubble-shape-wechat .bubble-wrap.ai .bubble::before,
.bubble-style-frosted.bubble-shape-wechat .bubble-wrap.ai .bubble::before,
.bubble-style-matte.bubble-shape-wechat .bubble-wrap.ai .bubble::before {
  background: none !important;
  border-right-color: rgba(255,255,255, calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68) * 0.55));
}
html[data-color-scheme="dark"] .bubble-style-transparent.bubble-shape-tail .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-frosted.bubble-shape-tail .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-matte.bubble-shape-tail .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-transparent.bubble-shape-wechat .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-frosted.bubble-shape-wechat .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-matte.bubble-shape-wechat .bubble-wrap.ai .bubble::before {
  background: none !important;
  border-right-color: rgba(32,28,44, calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68)));
}
.bubble-shape-tail .bubble-wrap.user .bubble::after,
.bubble-shape-tail .bubble-wrap.ai .bubble::after,
.bubble-shape-wechat .bubble-wrap.user .bubble::after,
.bubble-shape-wechat .bubble-wrap.ai .bubble::after {
  display: none !important;
}

/* 下划线：无底色，仅底边 */
.bubble-shape-underline .bubble {
  border-radius: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  border-bottom: 1.5px solid var(--border) !important;
  box-shadow: none !important;
  padding: 6px 2px !important;
}
.bubble-shape-underline .bubble-wrap.user .bubble {
  border-bottom-color: var(--user-bubble-bg, var(--theme)) !important;
  color: var(--text-primary) !important;
}
.bubble-shape-underline .bubble-wrap.user .bubble::before,
.bubble-shape-underline .bubble-wrap.ai .bubble::before,
.bubble-shape-underline .bubble-wrap.user .bubble::after,
.bubble-shape-underline .bubble-wrap.ai .bubble::after {
  display: none !important;
}

/* Telegram/iMessage：大圆角矩形，贴近头像一侧的角收成小尖角，尖角处伸出一条细横向小尾巴
   （用户实测过的写法：top/bottom 透明打斜、贴近头像那一侧的边给实色、另一侧宽度 0 收尖）。 */
.bubble-shape-plane .bubble,
.bubble-shape-pill .bubble {
  border-radius: 18px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06) !important;
  position: relative;
  overflow: visible !important;
}
.bubble-shape-plane .bubble-wrap.user .bubble,
.bubble-shape-pill .bubble-wrap.user .bubble {
  border-bottom-right-radius: 4px !important;
}
.bubble-shape-plane .bubble-wrap.ai .bubble,
.bubble-shape-pill .bubble-wrap.ai .bubble {
  border-bottom-left-radius: 4px !important;
}
.bubble-shape-plane .bubble-wrap.user .bubble::before,
.bubble-shape-pill .bubble-wrap.user .bubble::before {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -6px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 6px 8px;
  border-color: transparent transparent transparent var(--user-bubble-bg, var(--theme-dark));
  box-shadow: none;
  z-index: 0;
}
.bubble-shape-plane .bubble-wrap.ai .bubble::before,
.bubble-shape-pill .bubble-wrap.ai .bubble::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: -6px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 8px 6px 0;
  border-color: transparent var(--bubble-ai-bg, var(--bubble-ai-default-bg)) transparent transparent;
  box-shadow: none;
  z-index: 0;
}
.bubble-style-transparent.bubble-shape-plane .bubble-wrap.user .bubble::before,
.bubble-style-frosted.bubble-shape-plane .bubble-wrap.user .bubble::before,
.bubble-style-matte.bubble-shape-plane .bubble-wrap.user .bubble::before,
.bubble-style-transparent.bubble-shape-pill .bubble-wrap.user .bubble::before,
.bubble-style-frosted.bubble-shape-pill .bubble-wrap.user .bubble::before,
.bubble-style-matte.bubble-shape-pill .bubble-wrap.user .bubble::before {
  border-color: transparent transparent transparent rgba(var(--theme-rgb, 160,100,200), calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68)));
}
.bubble-style-transparent.bubble-shape-plane .bubble-wrap.ai .bubble::before,
.bubble-style-frosted.bubble-shape-plane .bubble-wrap.ai .bubble::before,
.bubble-style-matte.bubble-shape-plane .bubble-wrap.ai .bubble::before,
.bubble-style-transparent.bubble-shape-pill .bubble-wrap.ai .bubble::before,
.bubble-style-frosted.bubble-shape-pill .bubble-wrap.ai .bubble::before,
.bubble-style-matte.bubble-shape-pill .bubble-wrap.ai .bubble::before {
  border-color: transparent rgba(255,255,255, calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68) * 0.55)) transparent transparent;
}
html[data-color-scheme="dark"] .bubble-style-transparent.bubble-shape-plane .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-frosted.bubble-shape-plane .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-matte.bubble-shape-plane .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-transparent.bubble-shape-pill .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-frosted.bubble-shape-pill .bubble-wrap.ai .bubble::before,
html[data-color-scheme="dark"] .bubble-style-matte.bubble-shape-pill .bubble-wrap.ai .bubble::before {
  border-color: transparent rgba(32,28,44, calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68))) transparent transparent;
}
.bubble-shape-plane .bubble-wrap.user .bubble::after,
.bubble-shape-plane .bubble-wrap.ai .bubble::after,
.bubble-shape-pill .bubble-wrap.user .bubble::after,
.bubble-shape-pill .bubble-wrap.ai .bubble::after {
  display: none !important;
}

/* 直角：硬边无圆角 */
.bubble-shape-sharp .bubble,
.bubble-shape-square .bubble {
  border-radius: 0 !important;
}
.bubble-shape-sharp .bubble-wrap.user .bubble::before,
.bubble-shape-sharp .bubble-wrap.ai .bubble::before,
.bubble-shape-sharp .bubble-wrap.user .bubble::after,
.bubble-shape-sharp .bubble-wrap.ai .bubble::after,
.bubble-shape-square .bubble-wrap.user .bubble::before,
.bubble-shape-square .bubble-wrap.ai .bubble::before,
.bubble-shape-square .bubble-wrap.user .bubble::after,
.bubble-shape-square .bubble-wrap.ai .bubble::after {
  display: none !important;
}

/* 斜切：右下/左下斜角裁切 */
.bubble-shape-slash .bubble {
  border-radius: 14px !important;
  position: relative;
}
.bubble-shape-slash .bubble-wrap.user .bubble {
  border-radius: 14px 14px 3px 14px !important;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}
.bubble-shape-slash .bubble-wrap.ai .bubble {
  border-radius: 14px 14px 14px 3px !important;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.bubble-shape-slash .bubble-wrap.user .bubble::before,
.bubble-shape-slash .bubble-wrap.ai .bubble::before,
.bubble-shape-slash .bubble-wrap.user .bubble::after,
.bubble-shape-slash .bubble-wrap.ai .bubble::after {
  display: none !important;
}

/* ===== 浏览效果预览盒 ===== */
.bubble-browse-preview {
  border-radius: 14px;
  overflow: visible;
  border: 1px solid var(--border);
  background:
    linear-gradient(160deg, rgba(255,255,255,0.08), transparent 40%),
    linear-gradient(135deg, #2a2438 0%, #1a1524 55%, #241c30 100%);
}
.bubble-browse-stage {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 132px;
  overflow: visible;
  border-radius: 14px;
}
.bubble-browse-stage .bubble-wrap {
  margin: 0;
  max-width: 100%;
}
.bubble-browse-stage .bubble {
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  max-width: 78%;
  box-shadow: none;
}
.bubble-browse-stage .bubble-wrap.user .bubble { max-width: 78%; }

/* ===== 用户气泡调色板 ===== */
.bubble-color-palette .color-preset.bubble-color-swatch.active {
  border-color: white;
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--theme-light, #e8d5f5);
}
.bubble-color-swatch.is-theme {
  position: relative;
}
.bubble-color-swatch.is-theme::after {
  content: '主题';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  pointer-events: none;
}

/* ===== 气泡风格覆盖（用户与角色共用透明度/实色强度） ===== */
/* transparent */
.bubble-style-transparent .bubble.user {
  background: rgba(var(--theme-rgb, 160,100,200), calc(var(--bubble-opacity, 0.45) * var(--bubble-solid-strength, 0.68)));
  backdrop-filter: none;
}
.bubble-style-transparent .bubble.ai {
  background: rgba(var(--char-rgb, 255,255,255), calc(var(--bubble-opacity, 0.45) * var(--bubble-solid-strength, 0.68) * 0.55));
  backdrop-filter: none;
  border-color: rgba(255,255,255,0.12);
}
html[data-color-scheme="dark"] .bubble-style-transparent .bubble.ai {
  background: rgba(var(--char-rgb, 32,28,44), calc(var(--bubble-opacity, 0.45) * var(--bubble-solid-strength, 0.68) * 0.9));
}

/* frosted - 毛玻璃（半透明实色模拟，避免 backdrop-filter 叠层闪烁） */
.bubble-style-frosted .bubble.user {
  background: rgba(var(--theme-rgb, 160,100,200), calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68) * 1.05));
  border: 1px solid rgba(255,255,255,0.25);
}
.bubble-style-frosted .bubble.ai {
  background: rgba(var(--char-rgb, 255,255,255), calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68) * 0.55));
  border-color: rgba(255,255,255,0.22);
}
html[data-color-scheme="dark"] .bubble-style-frosted .bubble.ai {
  background: rgba(var(--char-rgb, 32,28,44), calc(var(--bubble-opacity, 0.65) * var(--bubble-solid-strength, 0.68) * 1.05));
}

/* matte - 磨砂（更高不透明度，无 backdrop-filter） */
.bubble-style-matte .bubble.user {
  background: rgba(var(--theme-rgb, 160,100,200), calc(var(--bubble-opacity, 0.85) * var(--bubble-solid-strength, 0.68) * 1.05));
  border: 1px solid rgba(255,255,255,0.15);
}
.bubble-style-matte .bubble.ai {
  background: rgba(var(--char-rgb, 40,40,60), calc(var(--bubble-opacity, 0.85) * var(--bubble-solid-strength, 0.68) * 0.92));
  border-color: rgba(255,255,255,0.12);
}
html[data-color-scheme="dark"] .bubble-style-matte .bubble.ai {
  background: rgba(var(--char-rgb, 28,26,38), calc(var(--bubble-opacity, 0.85) * var(--bubble-solid-strength, 0.68) * 1.05));
}

/* ===== 顶栏打字动画 ===== */
#chat-char-status.typing::after {
  content: '';
  display: inline-block;
}
@keyframes typingDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}
#chat-char-status.typing {
  color: var(--theme) !important;
  font-style: italic;
}
#chat-char-status.typing .dot-anim {
  display: inline-block;
  animation: dotFlash 1.2s steps(1, end) infinite;
}
@keyframes dotFlash {
  0%,100% { opacity: 1; }
  33%      { opacity: 0.3; }
  66%      { opacity: 0.7; }
}

/* ===== 消息时间 / 系统提示 ===== */
.bubble-time {
  font-size: 11px; color: var(--text-secondary);
  text-align: center; margin: 7px 0;
  opacity: 0.7;
}
/* 微信式系统提示：撤回 / 拍一拍 / 拉黑等居中灰底条 */
.bubble-time.poke-hint,
.bubble-time.recall-hint,
.bubble-time.chat-sys-tip {
  display: table;
  margin-left: auto;
  margin-right: auto;
  max-width: min(88%, 320px);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.45;
  opacity: 1;
  color: rgba(0, 0, 0, 0.45);
  background: rgba(0, 0, 0, 0.10);
  word-break: break-word;
  white-space: normal;
}
html[data-color-scheme="dark"] .bubble-time.poke-hint,
html[data-color-scheme="dark"] .bubble-time.recall-hint,
html[data-color-scheme="dark"] .bubble-time.chat-sys-tip {
  color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.14);
}
.bubble-time.poke-hint {
  padding: 4px 12px;
}
/* 撤回提示：仿微信居中系统行，点文字本身查看原文 */
.bubble-time.recall-hint {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.bubble-time.recall-hint:hover,
.bubble-time.recall-hint:active {
  background: rgba(0, 0, 0, 0.16);
  text-decoration: none;
}
html[data-color-scheme="dark"] .bubble-time.recall-hint:hover,
html[data-color-scheme="dark"] .bubble-time.recall-hint:active {
  background: rgba(255, 255, 255, 0.20);
}

/* 游戏管家封存答案 */
.game-butler-sealed {
  text-align: center;
  margin: 8px 16px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(124, 92, 191, 0.45);
  background: rgba(124, 92, 191, 0.08);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.game-butler-sealed-icon {
  font-size: 14px;
  margin-right: 4px;
}
.game-butler-sealed-q {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 4px;
  filter: blur(4px);
  user-select: none;
}

/* 位置消息卡片 */
.location-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
  max-width: 240px;
  padding: 10px 14px !important;
}
.location-pin { font-size: 22px; line-height: 1; flex-shrink: 0; }
.location-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.location-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.location-tag {
  font-size: 11px;
  opacity: 0.65;
}
.bubble-wrap.user .location-body { align-items: flex-end; text-align: right; }
.bubble-wrap.ai .location-body { align-items: flex-start; text-align: left; }

.typing-indicator {
  display: flex; gap: 4px; padding: 12px 16px;
  align-items: center;
}
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--theme); animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* ===== 输入栏 / 作曲器 ===== */
.chat-input-area {
  padding: 10px 12px 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 -6px 24px rgba(26,18,36,0.04);
  flex-shrink: 0;
  transition: padding-bottom 0.12s ease-out;
}
/* 软键盘·聊天：顶栏/背景 JS fixed 钉住不动；仅输入栏抬起。其它页垫输入栏 */
#chat-page.keyboard-open #chat-bg {
  pointer-events: none;
}
#chat-page.keyboard-open #messages-area {
  flex: 1;
  min-height: 0;
  scroll-padding-bottom: 12px;
}
#chat-page.keyboard-open .chat-input-area {
  background: #ffffff;
  box-shadow: 0 -6px 24px rgba(26,18,36,0.08);
}
html[data-color-scheme="dark"] #chat-page.keyboard-open .chat-input-area {
  background: #1e1824;
}
.page.keyboard-open:not(#chat-page) .chat-input-area,
.page.keyboard-open [data-dream-input-bar],
#dream-page.keyboard-open #dream-input-bar {
  padding-bottom: calc(max(10px, env(safe-area-inset-bottom)) + var(--keyboard-offset, 0px));
  flex-shrink: 0;
}
.page.keyboard-open:not(#chat-page) #messages-area,
.page.keyboard-open:not(#chat-page) #dream-msgs,
.page.keyboard-open:not(#chat-page) #reader-chat-area {
  scroll-padding-bottom: 12px;
}
#call-screen.keyboard-open #call-bottom {
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + var(--keyboard-offset, 0px)) !important;
}
#call-screen.keyboard-open #call-chat-area {
  padding-bottom: calc(12px + var(--keyboard-offset, 0px));
}
html[data-color-scheme="dark"] .chat-input-area {
  background: #1e1824;
  border-top-color: rgba(255,255,255,0.08);
  box-shadow: 0 -8px 28px rgba(0,0,0,0.28);
}

/* 引用 / 游戏 / 话题上下文条 */
.chat-context-bar {
  align-items: center;
  gap: 8px;
  padding: 0 2px 8px;
}
.chat-context-card {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  border-left: 3px solid var(--theme);
  background: color-mix(in srgb, var(--bg-card, #fff) 78%, var(--theme) 22%);
}
html[data-color-scheme="dark"] .chat-context-card {
  background: color-mix(in srgb, #2a2a32 72%, var(--theme) 28%);
}
.chat-context-card--game {
  border-left-color: #7c5cbf;
  background: color-mix(in srgb, var(--bg-card, #fff) 78%, #7c5cbf 22%);
}
html[data-color-scheme="dark"] .chat-context-card--game {
  background: color-mix(in srgb, #2a2a32 72%, #7c5cbf 28%);
}
.chat-context-card--topic {
  border-left-color: #d48806;
  background: color-mix(in srgb, var(--bg-card, #fff) 78%, #faad14 22%);
}
html[data-color-scheme="dark"] .chat-context-card--topic {
  background: color-mix(in srgb, #2a2a32 72%, #faad14 28%);
}
.chat-context-card--theater {
  border-left-color: #c45c7a;
  background: color-mix(in srgb, var(--bg-card, #fff) 78%, #c45c7a 22%);
}
html[data-color-scheme="dark"] .chat-context-card--theater {
  background: color-mix(in srgb, #2a2a32 72%, #c45c7a 28%);
}
.chat-context-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--theme);
  margin-bottom: 2px;
  font-family: 'Noto Serif SC', serif;
}
.chat-context-card--game .chat-context-name { color: #7c5cbf; }
.chat-context-card--topic .chat-context-name { color: #d48806; }
.chat-context-card--theater .chat-context-name { color: #c45c7a; }
.chat-context-text {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-context-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-context-close:active { background: rgba(0,0,0,0.05); }
.chat-context-action {
  flex-shrink: 0;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
}

.chat-input-row,
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-composer-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 4px 4px 4px 14px;
  background: #f4f1f6;
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 22px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
html[data-color-scheme="dark"] .chat-composer-field {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
}
.chat-composer-field:focus-within {
  border-color: color-mix(in srgb, var(--theme) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme) 16%, transparent);
  background: #faf8fc;
}
html[data-color-scheme="dark"] .chat-composer-field:focus-within {
  background: rgba(255,255,255,0.08);
}

.chat-input {
  font-size: 16px; /* 防止 iOS 聚焦时自动缩放 */
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 300;
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  overflow-y: auto;
  scrollbar-width: none;
  transition: border-color 0.2s;
}
.chat-input::-webkit-scrollbar { display: none; }
.chat-input:focus { border-color: var(--theme); }
.chat-input::placeholder { color: var(--text-secondary); opacity: 0.7; }

/* 聊天页作曲器内：输入框融入胶囊底 */
.chat-composer-field .chat-input {
  padding: 8px 0;
  background: transparent;
  border: none;
  border-radius: 0;
}
.chat-composer-field .chat-input:focus { border-color: transparent; }

.chat-send-btn-wrap {
  position: relative;
  flex-shrink: 0;
}
#pending-ai-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  background: var(--theme);
  color: white;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.chat-send-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  background: linear-gradient(145deg, var(--theme), var(--theme-dark));
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--theme) 40%, transparent);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.chat-send-btn svg { display: block; }
.chat-send-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.chat-send-btn:active { transform: scale(0.94); }

.chat-plus-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  background: #f4f1f6;
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: transform 0.25s ease, background 0.2s, color 0.2s, border-color 0.2s;
}
html[data-color-scheme="dark"] .chat-plus-btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
  color: var(--text-primary);
}
.chat-plus-btn svg { display: block; transition: transform 0.25s ease; }
.chat-plus-btn:hover { background: color-mix(in srgb, var(--theme) 14%, #f4f1f6); color: var(--theme-dark); }
.chat-plus-btn.is-open {
  background: var(--theme);
  border-color: var(--theme-dark);
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--theme) 35%, transparent);
}
.chat-plus-btn.is-open svg { transform: rotate(45deg); }
.chat-plus-btn:active { transform: scale(0.94); }

.chat-voice-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  background: #f4f1f6;
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: transform 0.15s, background 0.2s, color 0.2s, border-color 0.2s;
}
html[data-color-scheme="dark"] .chat-voice-toggle {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
}
.chat-voice-toggle:hover {
  background: color-mix(in srgb, var(--theme) 14%, #f4f1f6);
  color: var(--theme-dark);
}
.chat-voice-toggle.is-voice {
  background: color-mix(in srgb, var(--theme) 18%, #f4f1f6);
  border-color: color-mix(in srgb, var(--theme) 40%, transparent);
  color: var(--theme-dark);
}
.chat-voice-toggle:active { transform: scale(0.94); }
.chat-voice-toggle svg { display: block; }

.chat-hold-talk {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 18px;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  text-align: center;
}
.chat-hold-talk:active,
.chat-hold-talk.is-recording {
  color: var(--theme-dark);
  font-weight: 600;
}
.chat-hold-talk.is-cancel {
  color: #c45c6a;
}
.chat-composer.is-voice-mode .chat-composer-field {
  align-items: center;
}
.chat-composer.is-voice-mode #chat-send-btn-wrap {
  display: none;
}
.chat-composer.is-voice-mode.has-pending-ai #chat-send-btn-wrap {
  display: flex;
}
.chat-voice-record-tip {
  position: fixed;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 120;
  min-width: 140px;
  padding: 18px 22px;
  border-radius: 16px;
  background: rgba(30, 24, 36, 0.92);
  color: #fff;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
}
.chat-voice-record-tip.is-cancel {
  background: rgba(160, 48, 64, 0.92);
}
.chat-voice-record-tip .chat-voice-record-sec {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* 表情包按钮 */
.chat-emoji-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  transition: color 0.15s, background 0.15s;
}
.chat-emoji-btn svg { display: block; }
.chat-emoji-btn:hover,
.chat-emoji-btn.active {
  color: var(--theme);
  background: color-mix(in srgb, var(--theme) 12%, transparent);
}

/* 表情包面板（聊天输入区下方展开，与 + 工具栏一致） */
.chat-emoji-panel {
  border-top: 1px solid rgba(0,0,0,0.05);
  margin-top: 10px;
  padding-top: 2px;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatPanelIn 0.22s ease;
}
html[data-color-scheme="dark"] .chat-emoji-panel {
  border-top-color: rgba(255,255,255,0.08);
}
.chat-emoji-panel .emoji-panel-grid {
  max-height: 200px;
}
.emoji-panel-tabs {
  display: flex; gap: 6px; padding: 10px 4px 8px;
  overflow-x: auto; flex-shrink: 0;
  scrollbar-width: none; border-bottom: 1px solid rgba(0,0,0,0.05);
}
html[data-color-scheme="dark"] .emoji-panel-tabs {
  border-bottom-color: rgba(255,255,255,0.08);
}
.emoji-panel-tabs::-webkit-scrollbar { display: none; }
.emoji-panel-tab {
  padding: 5px 14px; border-radius: 20px; font-size: 13px;
  white-space: nowrap; cursor: pointer; flex-shrink: 0;
  background: #f4f1f6; color: var(--text-secondary);
  transition: all 0.15s;
}
html[data-color-scheme="dark"] .emoji-panel-tab {
  background: rgba(255,255,255,0.06);
}
.emoji-panel-tab.active {
  background: var(--theme); color: white;
}
.emoji-panel-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 8px; padding: 10px 4px; overflow-y: auto; flex: 1;
}
.emoji-panel-loading,
.emoji-panel-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}
.emoji-panel-loading .loading-spinner {
  width: 24px;
  height: 24px;
}
.emoji-panel-item {
  width: 100%; aspect-ratio: 1; object-fit: contain;
  border-radius: 8px; cursor: pointer;
  transition: transform 0.1s; display: block;
}
.emoji-panel-item:hover { transform: scale(1.08); }

/* ===== 工具栏面板 ===== */
.chat-toolbar-panel {
  margin-top: 10px;
  padding-top: 2px;
  border-top: 1px solid rgba(0,0,0,0.05);
  animation: chatPanelIn 0.22s ease;
}
html[data-color-scheme="dark"] .chat-toolbar-panel {
  border-top-color: rgba(255,255,255,0.08);
}
@keyframes chatPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.toolbar-pages {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.toolbar-pages::-webkit-scrollbar { display: none; }
.toolbar-page {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.toolbar-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 2px 0 8px;
}
.toolbar-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0,0,0,0.16);
  transition: background 0.15s, transform 0.15s;
}
.toolbar-dots span.active {
  background: var(--theme, #c9a0dc);
  transform: scale(1.15);
}
html[data-color-scheme="dark"] .toolbar-dots span {
  background: rgba(255,255,255,0.22);
}
html[data-color-scheme="dark"] .toolbar-dots span.active {
  background: var(--theme, #c9a0dc);
}
.toolbar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 8px;
  padding: 12px 2px 6px;
  min-height: 148px;
}
.toolbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 6px 2px;
  border: none;
  background: transparent;
  border-radius: 14px;
  color: inherit;
  transition: transform 0.12s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.toolbar-item:active { transform: scale(0.96); }
.toolbar-icon {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a4a66;
  background: #f3eef7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  transition: transform 0.15s, box-shadow 0.15s;
}
html[data-color-scheme="dark"] .toolbar-icon {
  color: #e8dff2;
  background: rgba(255,255,255,0.07);
  box-shadow: none;
}
.toolbar-icon svg { display: block; }
.toolbar-icon--cam { background: #efe8f6; color: #7a5a96; }
.toolbar-icon--img { background: #e8f1f6; color: #4a7a96; }
.toolbar-icon--loc { background: #e9f5ee; color: #3d8a62; }
.toolbar-icon--game { background: #eee8f8; color: #6b4ea8; }
.toolbar-icon--reroll { background: #f6eee8; color: #a06a48; }
.toolbar-icon--topic { background: #f6f0e4; color: #9a7a32; }
.toolbar-icon--poke { background: #f6e8ef; color: #a05578; }
.toolbar-icon--mem { background: #e8eef8; color: #4a6aa0; }
.toolbar-icon--theater { background: #f6e6ec; color: #b04a6a; }
html[data-color-scheme="dark"] .toolbar-icon--cam,
html[data-color-scheme="dark"] .toolbar-icon--img,
html[data-color-scheme="dark"] .toolbar-icon--loc,
html[data-color-scheme="dark"] .toolbar-icon--game,
html[data-color-scheme="dark"] .toolbar-icon--reroll,
html[data-color-scheme="dark"] .toolbar-icon--topic,
html[data-color-scheme="dark"] .toolbar-icon--poke,
html[data-color-scheme="dark"] .toolbar-icon--mem,
html[data-color-scheme="dark"] .toolbar-icon--theater {
  background: rgba(255,255,255,0.07);
  color: #e8dff2;
}
.toolbar-item:active .toolbar-icon { transform: scale(0.94); }
.toolbar-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'Noto Serif SC', serif;
  letter-spacing: 0.2px;
}

/* ===== 主页 iOS 风格 ===== */
/* ===== 主页（壁纸沉浸；顶栏控件避开系统状态栏） ===== */
#home-page {
  background: transparent;
  position: relative;
  overflow: hidden;
}

/* 左上角时钟：为状态栏预留下沉，不再贴顶（全屏时代曾压到 10px） */
.home-clock-wrap {
  position: absolute;
  top: max(52px, calc(env(safe-area-inset-top, 0px) + 12px));
  left: 20px;
  z-index: 10;
  pointer-events: none;
}

.home-clock {
  font-size: 60px; font-weight: 100;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 2px 20px rgba(0,0,0,0.35), 0 0 40px rgba(148,92,184,0.4);
  font-family: 'Noto Serif SC', serif;
  letter-spacing: 2px; line-height: 1;
}

.home-date {
  font-size: 13px; color: rgba(255,255,255,0.6);
  margin-top: 6px; letter-spacing: 2px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* 右上角角色定位 */
.home-char-corner {
  position: absolute;
  top: max(52px, calc(env(safe-area-inset-top, 0px) + 12px));
  right: 14px;
  z-index: 10;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(0,0,0,0.28), rgba(0,0,0,0.18));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 8px 14px 8px 8px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  max-width: calc(100% - 160px);
}
.home-char-corner:active { background: rgba(0,0,0,0.38); transform: scale(0.98); }
.home-char-meta { min-width: 0; flex: 1; }
.home-char-meta #home-char-name {
  font-size: 13px; font-weight: 500;
  font-family: 'Noto Serif SC', serif;
  color: rgba(255,255,255,0.94);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.home-char-meta #home-char-status-text {
  font-size: 11px; color: rgba(255,255,255,0.58); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

/* 右侧侧边导航 */
.home-side-nav {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex; flex-direction: column; gap: var(--home-side-nav-gap);
}

.side-nav-btn {
  display: flex; flex-direction: column; align-items: center;
  padding: 9px 10px;
  background: rgba(255,255,255,var(--home-nav-glass-alpha));
  backdrop-filter: blur(var(--home-nav-blur, 18px));
  -webkit-backdrop-filter: blur(var(--home-nav-blur, 18px));
  border: 1px solid rgba(255,255,255,var(--home-nav-border-alpha));
  border-right: none;
  border-radius: var(--home-nav-radius) 0 0 var(--home-nav-radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.18s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.15s;
  min-width: 50px;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
}
.side-nav-btn:hover {
  background: rgba(255,255,255,calc(var(--home-nav-glass-alpha) + 0.06));
  transform: translateX(-3px) translateY(-2px);
  box-shadow: -3px 5px 16px rgba(0,0,0,0.18), inset 0 0 0 1px rgba(255,255,255,0.22);
}
.side-nav-btn:active {
  background: rgba(255,255,255,calc(var(--home-nav-glass-alpha) + 0.12));
  transform: translateX(-4px) scale(0.94);
  box-shadow: -4px 2px 16px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(255,255,255,0.35);
}

.side-nav-icon { font-size: 20px; line-height: 1; }
.side-nav-label {
  font-size: 10px;
  font-family: 'Noto Serif SC', serif;
  color: rgba(255,255,255,0.88);
  text-shadow: 0 1px 4px rgba(0,0,0,0.45);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* 底部主导航 */
.home-bottom-nav {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 0; right: 0;
  display: flex; justify-content: center;
  align-items: flex-end;
  gap: var(--home-nav-gap);
  padding: 0 12px;
  z-index: 10;
}

.bottom-nav-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}
.bottom-nav-btn:active { transform: scale(0.96); }

.bottom-nav-icon {
  width: 56px; height: 56px;
  border-radius: min(var(--home-nav-radius), 50%);
  background: rgba(255,255,255,var(--home-nav-glass-alpha));
  backdrop-filter: blur(var(--home-nav-blur, 18px));
  -webkit-backdrop-filter: blur(var(--home-nav-blur, 18px));
  border: 1.5px solid rgba(255,255,255,var(--home-nav-border-alpha));
  box-shadow: 0 4px 20px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 25px;
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.18s, background 0.18s, filter 0.18s, border-color 0.18s;
  position: relative; overflow: visible;
}

/* 通讯主按钮稍大，两侧稍小 */
.bottom-nav-btn--main .bottom-nav-icon {
  width: 64px; height: 64px; font-size: 29px;
}
.bottom-nav-btn--side .bottom-nav-icon {
  width: 48px; height: 48px; font-size: 22px;
}
.bottom-nav-btn--main .bottom-nav-label { font-size: 12px; }
.bottom-nav-btn--side .bottom-nav-label { font-size: 10px; }
.bottom-nav-icon::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 46%;
  background: linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0));
  border-radius: min(var(--home-nav-radius), 50%) min(var(--home-nav-radius), 50%) 0 0;
  pointer-events: none;
}
.bottom-nav-btn:hover .bottom-nav-icon {
  transform: translateY(-3px);
  box-shadow: 0 9px 24px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.3);
}
.bottom-nav-btn--main:hover .bottom-nav-icon { transform: translateY(-4px); }
.bottom-nav-btn:active .bottom-nav-icon {
  transform: scale(0.86);
  filter: brightness(1.12);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.35), 0 2px 12px rgba(0,0,0,0.22);
  background: rgba(255,255,255,calc(var(--home-nav-glass-alpha) + 0.1));
}
.bottom-nav-btn--main:active .bottom-nav-icon { transform: scale(0.9); }

.bottom-nav-label {
  font-size: 11px;
  font-family: 'Noto Serif SC', serif;
  color: rgba(255,255,255,0.88);
  text-shadow: 0 1px 5px rgba(0,0,0,0.5);
  letter-spacing: 0.3px;
  text-align: center;
}

.home-nav-badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  pointer-events: none;
  font-family: 'Noto Sans SC', sans-serif;
}

html.home-nav-transparent .bottom-nav-icon,
html.home-nav-transparent .side-nav-btn {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.home-nav-transparent .bottom-nav-icon::after {
  display: none !important;
}
html.home-nav-transparent .side-nav-btn:active,
html.home-nav-transparent .bottom-nav-btn:active .bottom-nav-icon {
  background: transparent !important;
  box-shadow: none !important;
  filter: none;
}
html.home-nav-transparent .bottom-nav-btn:active .bottom-nav-icon {
  transform: scale(0.86);
}

/* 品牌标识 */
.home-brand {
  position: absolute;
  bottom: max(calc(env(safe-area-inset-bottom) + 96px), 116px);
  left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  color: rgba(255,255,255,0.18);
  letter-spacing: 3px;
  z-index: 5;
  pointer-events: none;
}

/* ===== 弹出层 ===== */
.overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: rgba(0,0,0,0.4); z-index: 300;
  display: none; align-items: flex-end;
  backdrop-filter: blur(4px);
}
.overlay.active { display: flex; }
.overlay.center { align-items: center; justify-content: center; }

/* 全屏覆盖式面板 */
.overlay.fullscreen { align-items: stretch; background: none; backdrop-filter: none; }
.overlay.fullscreen .sheet-full {
  width: 100%; height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: #ffffff;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
html[data-color-scheme="dark"] .overlay.fullscreen .sheet-full {
  background: #1a1520;
}
.sheet-full-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 2px 8px rgba(0,0,0,0.04);
  flex-shrink: 0;
  gap: 8px;
}
html[data-color-scheme="dark"] .sheet-full-topbar {
  background: #1e1824;
  border-bottom-color: rgba(255,255,255,0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.sheet-full-topbar .topbar-back { font-size: 20px; color: var(--theme); cursor: pointer; }
.sheet-full-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px; font-weight: 500;
  flex: 1; min-width: 0;
  text-align: center;
}
.sheet-full-body { flex: 1; overflow-y: auto; padding: 0 16px 40px; background: #ffffff; }
html[data-color-scheme="dark"] .sheet-full-body { background: #1a1520; }

/* 设置页 / 通讯设置：白底 + 卡片分组（通讯设置同款） */
#settings-page,
#character-page,
#contacts-page,
#preset-page,
#manage-page,
#emoji-manager-page,
#beautify-page {
  background: #ffffff;
}
html[data-color-scheme="dark"] #settings-page,
html[data-color-scheme="dark"] #character-page,
html[data-color-scheme="dark"] #contacts-page,
html[data-color-scheme="dark"] #preset-page,
html[data-color-scheme="dark"] #manage-page,
html[data-color-scheme="dark"] #emoji-manager-page,
html[data-color-scheme="dark"] #beautify-page {
  background: #1a1520;
}
#settings-page .scroll-area,
#settings-page .settings-tab-bar {
  background: #ffffff;
}
html[data-color-scheme="dark"] #settings-page .scroll-area,
html[data-color-scheme="dark"] #settings-page .settings-tab-bar {
  background: #1a1520;
}

#chat-settings-overlay .sheet-full,
#secret-paper-settings-overlay .sheet-full,
#dream-settings-overlay {
  background: #ffffff !important;
}
html[data-color-scheme="dark"] #chat-settings-overlay .sheet-full,
html[data-color-scheme="dark"] #secret-paper-settings-overlay .sheet-full,
html[data-color-scheme="dark"] #dream-settings-overlay {
  background: #1a1520 !important;
}

/* 通讯设置卡片风：推广到所有设置面板的 form-group / settings-group */
#chat-settings-overlay .form-group,
#secret-paper-settings-overlay .form-group,
.settings-panel-cards .form-group {
  background: #f7f5f9;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  padding: 14px 14px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8);
  margin-bottom: 12px;
}
html[data-color-scheme="dark"] #chat-settings-overlay .form-group,
html[data-color-scheme="dark"] #secret-paper-settings-overlay .form-group,
html[data-color-scheme="dark"] .settings-panel-cards .form-group {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
#chat-settings-overlay .settings-section-title,
#secret-paper-settings-overlay .settings-section-title,
.settings-panel-cards .settings-section-title {
  padding-top: 18px;
  font-weight: 600;
}
#chat-settings-overlay .settings-section-title:first-child,
#secret-paper-settings-overlay .settings-section-title:first-child,
.settings-panel-cards .settings-section-title:first-child { padding-top: 12px; }

.settings-group {
  background: #f7f5f9;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  overflow: hidden;
  margin: 0 12px 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8);
}
html[data-color-scheme="dark"] .settings-group {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.settings-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  min-height: 50px;
}
html[data-color-scheme="dark"] .settings-row {
  border-bottom-color: rgba(255,255,255,0.08);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label {
  flex: 1; font-size: 14px; color: var(--text-primary);
}
.settings-row-sub {
  font-size: 12px; color: var(--text-secondary); margin-top: 2px;
}
.settings-row-value {
  font-size: 13px; color: var(--text-secondary);
}

.sheet {
  width: 100%; background: rgba(245,230,248,0.95);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  padding: 0 0 max(20px, env(safe-area-inset-bottom));
  max-height: 85vh; overflow-y: auto;
}

.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

.sheet-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px; font-weight: 500;
  color: var(--text-primary);
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.modal {
  width: calc(100% - 40px); max-width: 380px;
  background: rgba(245,230,248,0.96);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  overflow: hidden;
}

.modal-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px; padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.modal-body { padding: 16px 20px; }
.modal-footer {
  padding: 12px 20px;
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ===== 标签选择 ===== */
.tag-list {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tag {
  padding: 7px 14px; border-radius: 12px;
  font-size: 13px; cursor: pointer;
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  color: var(--text-secondary);
  border: 1px solid var(--border); transition: all 0.18s;
  font-family: 'Noto Serif SC', serif;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.tag:active { transform: scale(0.95); box-shadow: inset 0 1px 3px rgba(0,0,0,0.12); transition: all 0.08s; }
.tag.active {
  background: linear-gradient(145deg, var(--theme-light), rgba(232,213,245,0.6));
  color: var(--theme-dark);
  border-color: rgba(201,160,220,0.55);
  box-shadow: 0 2px 10px rgba(148,92,184,0.18), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ===== 后端连接提示 ===== */
.backend-health-banner {
  margin: 12px 12px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(229, 57, 53, 0.12);
  border: 1px solid rgba(229, 57, 53, 0.35);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}
.backend-health-banner strong {
  display: block;
  margin-bottom: 6px;
  color: #c62828;
}
.backend-health-banner p {
  margin: 0 0 6px;
}
.backend-health-banner code {
  font-size: 12px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}
.backend-health-origin {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== 站点访问锁 ===== */
.site-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 8, 24, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-lock-overlay.is-visible {
  display: flex;
}
.site-lock-card {
  width: min(100%, 340px);
  padding: 28px 22px 22px;
  border-radius: var(--radius-lg, 16px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 40px rgba(80, 40, 100, 0.25);
  text-align: center;
}
.site-lock-logo {
  font-family: 'Liu Jian Mao Cao', cursive;
  font-size: 56px;
  line-height: 1;
  color: var(--theme-dark, #945cb8);
  margin-bottom: 8px;
}
.site-lock-desc {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary, #666);
}
.site-lock-input {
  width: 100%;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.site-lock-error {
  margin: 0 0 10px;
  font-size: 12px;
  color: #c62828;
}
.site-lock-btn {
  width: 100%;
  margin-top: 4px;
}

/* ===== 段落设置 ===== */
.settings-section {
  margin-bottom: 24px;
}
.settings-section-title {
  font-size: 12px; color: var(--text-secondary);
  padding: 8px 16px; letter-spacing: 1px;
  text-transform: uppercase;
}

/* ===== 记忆卡片 ===== */
.memory-card {
  padding: 12px 14px; margin: 8px 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
}
.memory-category {
  font-size: 11px; color: var(--theme-dark);
  margin-bottom: 4px; font-weight: 500;
}
.memory-content { font-size: 14px; line-height: 1.5; }
.memory-date { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* ===== 日记卡片 ===== */
.diary-card {
  margin: 8px 12px; padding: 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer; transition: all 0.2s;
}
.diary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.diary-date { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.diary-title { font-family: 'Noto Serif SC', serif; font-size: 16px; margin-bottom: 6px; }
.diary-preview { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* ===== 朋友圈 微信封面风格 ===== */

/* 顶栏（悬浮在封面上；封面本身顶到屏幕最上沿） */
.moments-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center;
  padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px;
}
#moments-page {
  position: relative;
  overflow: hidden;
  background: #fff;
}

/* 封面区：高度含刘海/状态栏，视觉顶上去 */
.moments-cover-wrap {
  position: relative;
  width: 100%;
  height: calc(240px + env(safe-area-inset-top, 0px));
  flex-shrink: 0;
  margin-bottom: 0;
  z-index: 2;
}
.moments-cover-bg {
  position: relative;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--theme-dark), var(--theme));
  overflow: hidden;
}
.moments-cover-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.moments-cover-gradient {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.35));
  pointer-events: none;
}
/* 头像 + 名字：微信风格，头像半露出封面，名字紧挨头像左侧 */
.moments-cover-user {
  position: absolute; bottom: -28px; right: 16px; z-index: 2;
  display: flex; align-items: flex-start; flex-direction: row-reverse;
  gap: 10px;
}
.moments-cover-username {
  font-size: 17px; font-weight: 600;
  text-shadow: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 160px;
  margin-top: 10px;
}
.moments-cover-username.color-black { color: #1a1a1a; }
.moments-cover-username.color-white { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.45); }
.moments-cover-avatar {
  width: 68px; height: 68px; border-radius: 8px;
  border: none; flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.2); overflow: hidden;
  background: var(--theme-light);
}

/* 动态列表 — 白底紧贴封面下方；padding 给半露出的头像留位 */
#moments-page .moments-scroll-area {
  flex: 1; overflow-y: auto;
  padding-top: 36px;
  position: relative;
  z-index: 1;
}
.moments-wechat-feed {
  padding: 0;
  min-height: 100%;
}
#moments-page .empty-state .empty-text {
  color: #999;
}
.wechat-moment-post {
  display: flex; gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}
.wechat-moment-post.flash-interact {
  animation: momentFlash .6s ease;
}
@keyframes momentFlash {
  0%, 100% { background: #fff; }
  30% { background: rgba(180, 140, 255, 0.12); }
}
.wechat-moment-avatar-col { flex-shrink: 0; }
.wechat-moment-avatar {
  width: 44px; height: 44px; border-radius: 6px;
  object-fit: cover; display: block;
  background: var(--theme-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; color: var(--theme-dark);
}
img.wechat-moment-avatar { display: block; }
.wechat-moment-right { flex: 1; min-width: 0; }
.wechat-moment-name {
  font-size: 15px; font-weight: 600; color: var(--theme);
  margin-bottom: 4px; line-height: 1.3;
}
.wechat-moment-text {
  font-size: 15px; line-height: 1.65; margin-bottom: 10px;
  color: #1a1a1a; word-break: break-word;
}
.wechat-moment-meta-row {
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
}
.wechat-moment-time { font-size: 12px; color: #999; flex: 1; }
.wechat-moment-ops-wrap {
  position: relative; flex-shrink: 0;
}
.wechat-ops-dots {
  width: 32px; height: 22px; border-radius: 4px;
  background: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; letter-spacing: 1px; cursor: pointer;
  color: #666; user-select: none;
}
.wechat-ops-dots:active { background: #ebebeb; }
.wechat-ops-menu {
  display: none; position: absolute; right: 0; bottom: calc(100% + 6px);
  background: rgba(40,40,50,0.92); border-radius: 6px;
  overflow: hidden; white-space: nowrap; z-index: 20;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  animation: momentOpsPop .15s ease-out;
}
.wechat-ops-menu.open { display: flex; }
.wechat-ops-menu-item {
  padding: 8px 16px; font-size: 13px; color: #fff; cursor: pointer;
  border-right: 1px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; gap: 5px;
}
.wechat-ops-menu-item:last-child { border-right: none; }
.wechat-ops-menu-item:active { background: rgba(255,255,255,0.1); }
.wechat-ops-menu-item.liked { color: #e0245e; }
@keyframes momentOpsPop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.wechat-moment-location {
  font-size: 13px; color: var(--theme); margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
.wechat-moment-mention { color: var(--theme); font-weight: 500; }
/* 系统/回复类横幅（跟随浅色/深色模式，与聊天通知区分） */
.system-notify {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: max(12px, env(safe-area-inset-top));
  z-index: 10040; max-width: calc(100vw - 32px);
  background: var(--system-notify-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--system-notify-text);
  border: 1px solid var(--system-notify-border);
  padding: 10px 18px; border-radius: 10px;
  font-size: 14px; line-height: 1.45; text-align: center;
  box-shadow: var(--system-notify-shadow);
  animation: systemNotifyIn .25s ease-out;
  pointer-events: none;
}
@keyframes systemNotifyIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.moment-compose-extra {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px 10px; flex-wrap: wrap;
}
.moment-compose-tag {
  font-size: 13px; color: var(--theme); background: rgba(180,140,255,0.12);
  padding: 4px 10px; border-radius: 20px;
}
.moment-compose-tool {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
}
.moment-mention-sheet .mention-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.moment-mention-sheet .mention-item:active { background: rgba(255,255,255,0.06); }

/* 互动区（点赞+评论列表）微信风格 */
.wechat-moment-interact {
  margin-top: 8px; background: #f7f7f7;
  border-radius: 8px; padding: 8px 10px;
  font-size: 13px; line-height: 1.6;
}
.wechat-moment-likes {
  color: var(--theme); margin-bottom: 4px; word-break: break-word;
}
.wechat-comment-line { color: #1a1a1a; }
.wechat-comment-name { color: var(--theme); font-weight: 500; }
.wechat-comment-reply-tag { color: #999; font-weight: 400; margin: 0 2px; font-size: 12px; }
.wechat-comment-content { color: #1a1a1a; }
.wechat-comment-replyable { cursor: pointer; border-radius: 4px; margin: 0 -4px; padding: 0 4px; transition: background 0.15s; }
.wechat-comment-replyable:active { background: rgba(255,255,255,0.08); }
.wechat-moment-comment-input-row {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
}

/* 我 → 朋友圈封面预览 */
.me-moments-cover-preview {
  width: 100%; height: 100px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, var(--theme-dark), var(--theme));
  background-size: cover; background-position: center;
}

/* 旧X风格保留，防止其他地方引用报错 */
.moments-feed { padding: 0; }
.moment-post {
  display: flex; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.moment-post:hover { background: rgba(255,255,255,0.03); }
.moment-avatar-col { flex-shrink: 0; }
.moment-avatar-img {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; display: block;
}
.moment-avatar-placeholder {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--theme-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: var(--theme-dark);
}
.moment-body { flex: 1; min-width: 0; }
.moment-meta {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 4px; flex-wrap: wrap;
}
.moment-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.moment-time { font-size: 12px; color: var(--text-secondary); }
.moment-content { font-size: 15px; line-height: 1.65; margin-bottom: 10px; color: var(--text-primary); word-break: break-word; }
.moment-images {
  display: grid; gap: 3px; margin-bottom: 10px;
  border-radius: 12px; overflow: hidden;
}
.moment-images.cols-1 { grid-template-columns: 1fr; }
.moment-images.cols-2 { grid-template-columns: 1fr 1fr; }
.moment-images.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.moment-images.cols-4 { grid-template-columns: 1fr 1fr; }
.moment-img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  display: block; cursor: pointer; transition: opacity .2s;
}
.moment-img:hover { opacity: .88; }
.moment-actions {
  display: flex; align-items: center; gap: 0; margin-top: 8px;
}
.moment-action {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer; padding: 6px 14px 6px 0;
  transition: color .2s; user-select: none;
}
.moment-action svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.moment-action:hover { color: var(--theme); }
.moment-action.liked { color: #e0245e; }
.moment-action.liked svg { fill: #e0245e; stroke: #e0245e; }
.moment-ai-btn {
  margin-left: auto; font-size: 11px; color: var(--text-secondary);
  padding: 3px 8px; border: 1px solid var(--border);
  border-radius: 20px; cursor: pointer; transition: all .2s;
}
.moment-ai-btn:hover { color: var(--theme); border-color: var(--theme); }
/* 点赞头像列表 */
.moment-likers {
  display: flex; flex-wrap: wrap; gap: 3px;
  margin-top: 6px; align-items: center;
}
.moment-liker-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--bg-primary);
}
/* 内联评论 */
.moment-comments {
  margin-top: 10px; border-top: 1px solid var(--border);
  padding-top: 8px;
}
.moment-comment-item {
  display: flex; gap: 8px; padding: 6px 0;
}
.moment-comment-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.moment-comment-avatar-placeholder {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--theme-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}
.moment-comment-body { flex: 1; min-width: 0; }
.moment-comment-name { font-size: 12px; font-weight: 600; color: var(--theme-dark); }
.moment-comment-text { font-size: 13px; color: var(--text-primary); line-height: 1.5; margin-top: 1px; }
.moment-comment-time { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.moment-comment-input-row {
  display: flex; gap: 8px; align-items: center; margin-top: 8px;
}
/* 发推弹窗 */
.compose-overlay-inner {
  width: 100%; max-width: 480px;
}
.compose-avatar-row {
  display: flex; gap: 12px; padding: 16px;
}
.compose-textarea {
  flex: 1; background: none; border: none; outline: none;
  font-size: 18px; color: var(--text-primary); resize: none;
  min-height: 80px; font-family: inherit; line-height: 1.5;
}
.compose-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-top: 1px solid var(--border);
}
.compose-toolbar-icon {
  font-size: 20px; cursor: pointer; color: var(--theme);
  padding: 4px; border-radius: 50%; transition: background .2s;
}
.compose-toolbar-icon:hover { background: var(--bg-primary); }

/* ===== 语音条（用户 / 角色同一套：播放键 + 波形 + 时长） ===== */
.voice-message {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: visible;
}
.voice-bubble {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: nowrap;
  /* 与文字气泡一致：不写死宽高，随内容/自定义 CSS */
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  width: auto;
  max-width: 100%;
  min-width: 96px;
  box-sizing: border-box;
  writing-mode: horizontal-tb;
  position: relative;
}
/* 播放在外侧、时长在浪尾：用 order 固定，不被 row-reverse 打乱 */
.bubble-wrap.ai .voice-bubble { flex-direction: row; }
.bubble-wrap.user .voice-bubble { flex-direction: row; }
.bubble-wrap.ai .voice-bubble .voice-play-icon { order: 1; }
.bubble-wrap.ai .voice-bubble .voice-wave { order: 2; }
.bubble-wrap.ai .voice-bubble .voice-duration { order: 3; }
.bubble-wrap.user .voice-bubble .voice-play-icon { order: 3; }
.bubble-wrap.user .voice-bubble .voice-wave { order: 2; }
.bubble-wrap.user .voice-bubble .voice-duration { order: 1; }
.bubble-wrap.user .voice-wave { justify-content: flex-end; }
.bubble-wrap.ai .voice-wave { justify-content: flex-start; }
/* 自定义气泡：只锁横排，不锁宽高/内边距，大小跟文字气泡同一套自定义规则 */
#messages-area.bubble-shape-custom .bubble-wrap .bubble.voice-bubble,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap .bubble.voice-bubble,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap .bubble.voice-bubble,
#messages-area.bubble-shape-custom .voice-message .bubble.voice-bubble {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  white-space: nowrap !important;
  writing-mode: horizontal-tb !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}
#messages-area.bubble-shape-custom .bubble-wrap.ai .bubble.voice-bubble,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap.ai .bubble.voice-bubble,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap.ai .bubble.voice-bubble {
  flex-direction: row !important;
}
#messages-area.bubble-shape-custom .bubble-wrap.user .bubble.voice-bubble,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap.user .bubble.voice-bubble,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap.user .bubble.voice-bubble {
  flex-direction: row !important;
}
#messages-area.bubble-shape-custom .voice-bubble .voice-duration,
#messages-area.bubble-shape-custom .voice-bubble .voice-play-icon,
#cs-bubble-preview-stage.bubble-shape-custom .voice-bubble .voice-duration,
#cs-bubble-preview-stage.bubble-shape-custom .voice-bubble .voice-play-icon,
#cs-custom-bubble-preview-stage.bubble-shape-custom .voice-bubble .voice-duration,
#cs-custom-bubble-preview-stage.bubble-shape-custom .voice-bubble .voice-play-icon {
  flex-shrink: 0 !important;
  position: relative !important;
}
#messages-area.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-play-icon,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-play-icon,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-play-icon { order: 1 !important; }
#messages-area.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-wave,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-wave,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-wave { order: 2 !important; }
#messages-area.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-duration,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-duration,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap.ai .voice-bubble .voice-duration { order: 3 !important; }
#messages-area.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-duration,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-duration,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-duration { order: 1 !important; }
#messages-area.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-wave,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-wave,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-wave { order: 2 !important; }
#messages-area.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-play-icon,
#cs-bubble-preview-stage.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-play-icon,
#cs-custom-bubble-preview-stage.bubble-shape-custom .bubble-wrap.user .voice-bubble .voice-play-icon { order: 3 !important; }
#messages-area.bubble-shape-custom .voice-bubble .voice-wave,
#cs-bubble-preview-stage.bubble-shape-custom .voice-bubble .voice-wave,
#cs-custom-bubble-preview-stage.bubble-shape-custom .voice-bubble .voice-wave {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-wrap: nowrap !important;
  min-width: 40px !important;
  height: 20px !important;
  position: relative !important;
}
.voice-icon { font-size: 16px; color: var(--theme); flex-shrink: 0; }
.voice-wave {
  display: flex; gap: 2.5px; align-items: center; flex: 1;
  min-width: 40px; height: 20px;
  position: relative;
}
.voice-bar {
  width: 2.5px; flex-shrink: 0; background: currentColor;
  border-radius: 2px; opacity: 0.45;
  animation: wave-idle 2.2s infinite ease-in-out;
}
.bubble.ai .voice-bar { color: var(--theme); }
/* 跟气泡文字同色：深色气泡用白浪，浅色/白底气泡用深色浪，避免「空白条」 */
.bubble.user .voice-bar { color: currentColor; }
.voice-bubble.is-playing .voice-bar {
  animation: wave-play 0.9s infinite ease-in-out;
  opacity: 1;
}
@keyframes wave-idle {
  0%, 100% { transform: scaleY(0.55); }
  50% { transform: scaleY(1); }
}
@keyframes wave-play {
  0%, 100% { transform: scaleY(0.4); opacity: 0.65; }
  50% { transform: scaleY(1.25); opacity: 1; }
}
/* 时长贴在浪尾（紧挨波形末端），仍在气泡内 */
.voice-duration {
  display: inline-block !important;
  font-size: 12.5px !important;
  line-height: 1.2 !important;
  flex-shrink: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
  margin-inline: 2px;
  white-space: nowrap !important;
  writing-mode: horizontal-tb !important;
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
  color: currentColor !important;
}
.bubble.ai .voice-duration { color: var(--text-secondary) !important; }
.bubble.user .voice-duration { color: currentColor !important; opacity: 0.9 !important; }
.voice-play-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex !important; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(128,128,128,0.14);
  color: inherit;
  cursor: pointer;
  position: relative;
  z-index: 2;
  visibility: visible;
  opacity: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform .15s ease, background .15s ease;
}
.voice-play-icon:active { transform: scale(0.9); }
.bubble.ai .voice-play-icon { background: rgba(var(--theme-rgb, 160,100,200), 0.15); color: var(--theme); }
.bubble.user .voice-play-icon {
  /* 用 currentColor：白底深字 / 紫底白字都能看见，不再写死白色 */
  background: color-mix(in srgb, currentColor 18%, transparent) !important;
  color: currentColor !important;
}
/* 浅色用户气泡时仍保证播放键/时长可见 */
.bubble-style-transparent .bubble.user .voice-play-icon,
.bubble-style-frosted .bubble.user .voice-play-icon,
.bubble-style-matte .bubble.user .voice-play-icon {
  background: rgba(0,0,0,0.12) !important;
  color: var(--text-primary) !important;
}
.bubble-style-transparent .bubble.user .voice-duration,
.bubble-style-frosted .bubble.user .voice-duration,
.bubble-style-matte .bubble.user .voice-duration,
.bubble-style-transparent .bubble.user .voice-bar,
.bubble-style-frosted .bubble.user .voice-bar,
.bubble-style-matte .bubble.user .voice-bar {
  color: var(--text-primary) !important;
}
.voice-play-icon .icon-play {
  width: 0; height: 0;
  margin-left: 2px;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
}
.voice-play-icon .icon-pause {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 12px;
}
.voice-play-icon .icon-pause i {
  display: block;
  width: 3px;
  height: 12px;
  border-radius: 1.5px;
  background: currentColor;
}
.voice-bubble.is-playing .voice-play-icon { background: rgba(var(--theme-rgb, 160,100,200), 0.22); }
.bubble.user.voice-bubble.is-playing .voice-play-icon { background: rgba(255,255,255,0.32); }
.voice-bubble.is-playing .voice-play-icon .icon-play { display: none; }
.voice-bubble.is-playing .voice-play-icon .icon-pause { display: flex; }

/* 语音转文字：绝对定位在语音条下方，不顶起气泡 */
.voice-transcript-box {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  z-index: 2;
  display: none;
  max-width: 260px;
}
.voice-transcript-box.is-open { display: block; }
.bubble-wrap.user .voice-transcript-box {
  left: auto;
  right: 0;
}
.voice-transcript-inner {
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-card, #fff) 82%, var(--text-primary, #222) 10%);
  border: 1px solid color-mix(in srgb, var(--text-primary, #222) 14%, transparent);
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
html[data-color-scheme="dark"] .voice-transcript-inner {
  background: color-mix(in srgb, #2a2a32 88%, #fff 8%);
  border-color: rgba(255,255,255,0.16);
  box-shadow: 0 1px 4px rgba(0,0,0,0.28);
}
.bubble-wrap.user .voice-transcript-inner { text-align: right; }
.bubble-wrap.ai .voice-transcript-inner { text-align: left; }

/* ===== 通话界面 ===== */
.call-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 500; display: none; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding-top: max(52px, env(safe-area-inset-top));
  background: linear-gradient(180deg, #f4f5f7 0%, #e9ebef 48%, #e3e5ea 100%);
  color: #1f2329;
  transition: width 0.28s cubic-bezier(.2,.8,.2,1), height 0.28s cubic-bezier(.2,.8,.2,1),
    top 0.28s cubic-bezier(.2,.8,.2,1), left 0.28s cubic-bezier(.2,.8,.2,1),
    right 0.28s cubic-bezier(.2,.8,.2,1), bottom 0.28s cubic-bezier(.2,.8,.2,1),
    border-radius 0.28s ease, padding 0.28s ease, box-shadow 0.28s ease;
  overflow: hidden;
  box-sizing: border-box;
}
.call-screen.active { display: flex; }
.call-screen.is-dialing .call-minimize-btn { display: none; }
.call-minimize-btn {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 14px;
  z-index: 6;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.88);
  color: #3c4048;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  transition: background 0.15s, transform 0.15s;
}
.call-minimize-btn:active { transform: scale(0.94); background: #fff; }
.call-pip-hangup {
  display: none;
  position: absolute;
  top: -6px; right: -6px;
  z-index: 7;
  width: 22px; height: 22px; border-radius: 50%;
  border: none;
  background: #e05555;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.call-avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.call-avatar {
  width: 120px; height: 120px; border-radius: 50%;
  object-fit: cover; border: 3px solid rgba(255,255,255,0.95);
  box-shadow: 0 8px 28px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
  display: block;
  background: #d8dbe2;
}
.call-screen.is-speaking .call-avatar-wrap::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(70, 180, 120, 0.7);
  animation: call-speak-ring 1.2s ease-out infinite;
}
.call-dialing-view {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex: 1;
  min-height: 0;
  padding: 48px 24px max(40px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.call-screen.is-dialing #call-dialing-view { display: flex !important; }
.call-screen.is-dialing #call-active-view,
.call-screen.is-dialing #call-bottom,
.call-screen.is-dialing #call-ended-view {
  display: none !important;
}
.call-dialing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 36px;
}
.call-dialing-pulse {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 28px;
  height: 14px;
}
.call-dialing-pulse span {
  width: 8px; height: 8px; border-radius: 50%;
  background: #9aa0a8;
  animation: call-dial-dot 1.2s infinite ease-in-out;
}
.call-dialing-pulse span:nth-child(2) { animation-delay: 0.2s; }
.call-dialing-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes call-dial-dot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.1); }
}
@keyframes call-speak-ring {
  0% { transform: scale(0.92); opacity: 0.9; }
  100% { transform: scale(1.18); opacity: 0; }
}

/* 收起为侧边小窗 */
.call-screen.active.is-minimized {
  width: 86px;
  height: 112px;
  top: auto;
  bottom: max(110px, calc(env(safe-area-inset-bottom) + 96px));
  left: auto;
  right: 10px;
  padding: 10px 8px 8px;
  border-radius: 18px;
  justify-content: center;
  align-items: center;
  background: linear-gradient(160deg, #f7f8fa, #e8eaef);
  box-shadow: 0 10px 28px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  color: #1f2329;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}
.call-screen.is-minimized .call-minimize-btn,
.call-screen.is-minimized #call-bottom,
.call-screen.is-minimized #call-chat-area,
.call-screen.is-minimized #call-time-display,
.call-screen.is-minimized #call-name,
.call-screen.is-minimized #call-status,
.call-screen.is-minimized #call-waveform,
.call-screen.is-minimized #call-ended-view,
.call-screen.is-minimized #call-dialing-view {
  display: none !important;
}
.call-screen.is-minimized #call-active-view {
  display: flex !important;
  flex: none;
  width: 100%;
  height: 100%;
  justify-content: center;
  min-height: 0;
}
.call-screen.is-minimized .call-hero {
  padding: 0 !important;
  gap: 6px;
  width: 100%;
}
.call-screen.is-minimized .call-avatar-wrap {
  margin: 0;
}
.call-screen.is-minimized .call-avatar {
  width: 52px; height: 52px;
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.9);
}
.call-screen.is-minimized #call-timer {
  margin-top: 0;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: rgba(0,0,0,0.65);
}
.call-screen.is-minimized .call-pip-hangup {
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-screen.is-minimized.is-dragging {
  transition: none;
  opacity: 0.92;
}
.call-name { font-size: 24px; color: #1f2329; font-family: 'Noto Serif SC', serif; }
.call-status { font-size: 14px; color: rgba(0,0,0,0.45); margin-top: 8px; }
.call-waveform { display: flex; gap: 3px; align-items: center; margin: 24px 0; height: 40px; }
.call-wave-bar {
  width: 4px; background: rgba(80,90,110,0.45); border-radius: 2px;
  animation: call-wave 1s infinite ease-in-out;
}
.call-wave-bar:nth-child(1) { animation-delay: 0s; }
.call-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.call-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.call-wave-bar:nth-child(4) { animation-delay: 0.3s; }
.call-wave-bar:nth-child(5) { animation-delay: 0.4s; }
.call-wave-bar:nth-child(6) { animation-delay: 0.3s; }
.call-wave-bar:nth-child(7) { animation-delay: 0.2s; }
.call-wave-bar:nth-child(8) { animation-delay: 0.1s; }
@keyframes call-wave {
  0%, 100% { height: 6px; opacity: 0.4; }
  50% { height: 30px; opacity: 1; }
}
.call-hangup {
  width: 64px; height: 64px; background: #e05555;
  border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: white;
  box-shadow: 0 4px 20px rgba(224,85,85,0.4);
  transform: rotate(135deg);
  transition: all 0.2s;
}
.call-hangup:hover { transform: rotate(135deg) scale(1.05); }
.call-hangup-light {
  box-shadow: 0 6px 20px rgba(224,85,85,0.28);
}

/* 通话输入：文字 / 按住说话 */
.call-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.call-composer .call-input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.92);
  color: #1f2329;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 18px;
  padding: 10px 14px;
  resize: none;
  max-height: 88px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.call-composer .call-input::placeholder { color: rgba(0,0,0,0.35); }
.call-voice-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: 1px solid rgba(0,0,0,0.08);
  color: #3c4048; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
.call-voice-toggle:hover { background: #fff; }
.call-voice-toggle.is-voice { background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,0.06); }
.call-voice-toggle:active { transform: scale(0.94); }
.call-voice-toggle svg { display: block; }
.call-hold-talk {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 18px;
  background: rgba(255,255,255,0.92);
  color: rgba(0,0,0,0.72);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  transition: background 0.15s, color 0.15s;
}
.call-hold-talk:active,
.call-hold-talk.is-recording {
  background: #fff;
  color: #1f2329;
}
.call-hold-talk.is-cancel {
  background: rgba(224, 85, 85, 0.92);
  color: #fff;
  border-color: transparent;
}
.call-send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: #4a5568; border: none;
  color: white; font-size: 18px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.call-send-btn:active { transform: scale(0.94); }
.call-composer.is-voice-mode .call-send-btn { display: none; }

/* 通话计时器 */
.call-timer {
  font-size: 16px; font-weight: 300; color: rgba(0,0,0,0.55);
  letter-spacing: 2px; margin-top: 6px;
}

/* 通话顶部时间显示 */
.call-time-display {
  font-size: 28px; font-weight: 200; color: rgba(0,0,0,0.55);
  letter-spacing: 2px; margin-bottom: 8px;
}

/* 通话中重新生成按钮 */
.call-roll-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: 1px solid rgba(0,0,0,0.08);
  color: #3c4048; font-size: 20px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.2s;
}
.call-roll-btn:hover { background: #fff; transform: rotate(180deg); }

/* 聊天列表通话分割线 */
.call-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 16px 4px;
  font-size: 12px; color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
}
.call-divider::before, .call-divider::after {
  content: ''; flex: 1;
  height: 1px; background: rgba(255,255,255,0.15);
}
.call-divider-end { color: rgba(255,255,255,0.4); margin-bottom: 2px; }
.call-ended-hint {
  font-size: 12px; color: rgba(255,255,255,0.38);
  text-align: center; margin: 0 0 8px; padding: 0;
}

/* 通话屏实时文字区 */
.call-chat-area {
  flex: 1; min-height: 0;
  width: 100%; max-width: 440px;
  overflow-y: auto; padding: 5px 16px 3px;
  display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: none;
}
.call-chat-area::-webkit-scrollbar { display: none; }

.call-chat-msg {
  font-size: 14px; line-height: 1.6;
  max-width: 90%; word-break: break-word;
  padding: 8px 12px; border-radius: 14px;
  animation: fadeIn 0.2s ease;
}
.call-chat-user {
  align-self: flex-end;
  background: rgba(255,255,255,0.95);
  color: #1f2329;
  border: 1px solid rgba(0,0,0,0.06);
  border-bottom-right-radius: 4px;
}
.call-chat-assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.72);
  color: #2a2f38;
  border: 1px solid rgba(0,0,0,0.05);
  border-bottom-left-radius: 4px;
}
.call-chat-system {
  align-self: center;
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.45);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  max-width: 95%;
  text-align: center;
}

/* 骰子按钮 */
.chat-roll-btn {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 6px 4px;
  opacity: 0.7; transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.chat-roll-btn:hover { opacity: 1; transform: rotate(30deg); }

/* 首页心情徽章 */
.home-char-mood {
  font-size: 11px; color: rgba(255,255,255,0.75);
  margin-top: 2px;
  background: rgba(255,255,255,0.12);
  padding: 1px 7px; border-radius: 8px;
  display: inline-block;
}

/* ===== 角色列表 ===== */
.char-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; margin: 8px 12px;
  background: linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px; cursor: pointer;
  transition: all 0.2s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}
.char-card:hover { transform: translateY(-2px); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.2); }
.char-card .btn-ghost { font-size: 12px; padding: 6px 12px; }
.char-info { flex: 1; }
.char-name { font-size: 16px; font-weight: 500; }
.char-intro { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===== 梦境 ===== */
.dream-title {
  font-family: 'Noto Serif SC', serif !important;
  letter-spacing: 0.12em;
}
.dream-topbar {
  background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
  backdrop-filter: blur(16px);
}
.dream-portal {
  position: relative; min-height: 100%; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--theme) 10%, transparent), transparent 55%),
    #ffffff;
}
.dream-portal-bg { display: none; }
.dream-portal-stars { display: none; }
@keyframes dream-stars-twinkle {
  from { opacity: 0.55; } to { opacity: 1; }
}
.dream-portal-header {
  position: relative; z-index: 1; text-align: center; padding: 28px 20px 12px;
}
.dream-portal-title {
  font-family: 'Noto Serif SC', serif; font-size: 24px; font-weight: 500;
  color: var(--text-primary); letter-spacing: 0.35em;
}
.dream-portal-sub {
  font-size: 13px; color: var(--text-secondary); margin-top: 8px; letter-spacing: 0.06em;
}
.dream-char-grid {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 10px; padding: 8px 16px 28px;
}
.dream-char-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 16px; cursor: pointer;
  background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--border) 40%, transparent);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.dream-char-card:active { transform: scale(0.985); }
.dream-char-card:hover {
  border-color: color-mix(in srgb, var(--theme) 35%, var(--border));
  box-shadow: 0 4px 18px color-mix(in srgb, var(--theme) 10%, transparent);
}
.dream-char-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 1.5px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.dream-char-avatar-ph {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--theme) 8%, #f3f4f6);
  font-size: 22px; border: 1.5px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.dream-char-info { flex: 1; min-width: 0; }
.dream-char-name { font-size: 16px; font-weight: 500; color: var(--text-primary); }
.dream-char-hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dream-char-enter {
  font-size: 11px; color: var(--theme); padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--theme) 22%, transparent);
  flex-shrink: 0; letter-spacing: 0.06em;
}
#dream-page { background: transparent; position: relative; }
#dream-page > .topbar { background: #ffffff; }
.dream-bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: #ffffff;
}
#dream-page > *:not(.dream-bg-layer) {
  z-index: 1;
}

.dream-archive-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
}
@media (min-width: 480px) {
  .dream-archive-bar {
    max-width: 480px; left: 50%; transform: translateX(-50%);
  }
}

/* 设定页 */
.dream-setup-sheet {
  position: fixed; inset: 0; z-index: 200;
  background: #ffffff;
  display: flex; flex-direction: column; overflow: hidden;
}
.dream-setup-banner {
  padding: 8px 16px;
  background: color-mix(in srgb, var(--theme) 7%, #f5f5f7);
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary); text-align: center;
}
.dream-setup-body {
  flex: 1; overflow-y: auto; padding: 8px 16px 24px;
}
.dream-setup-sec {
  padding: 14px 0 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.dream-setup-sec:last-child { border-bottom: none; }
.dream-setup-sec-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px; letter-spacing: 0.12em;
  margin-bottom: 8px; color: var(--text-primary);
}
.dream-setup-opt {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 11px; letter-spacing: 0;
  color: var(--text-secondary); font-weight: 400;
  margin-left: 6px;
}
.dream-setup-hint {
  font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 8px;
}
.dream-setup-toggle { padding: 4px 0 10px; gap: 12px; }
.dream-chip-row {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.dream-chip {
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px; font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.dream-chip.active {
  border-color: color-mix(in srgb, var(--theme) 55%, var(--border));
  color: var(--theme);
  background: color-mix(in srgb, var(--theme) 10%, transparent);
}
.dream-freedom-list {
  display: flex; flex-direction: column; gap: 8px;
}
.dream-freedom-card {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.dream-freedom-card.active {
  border-color: color-mix(in srgb, var(--theme) 50%, var(--border));
  background: color-mix(in srgb, var(--theme) 8%, transparent);
}
.dream-freedom-label { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.dream-freedom-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.45; }
.dream-setup-footer {
  flex-shrink: 0;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: blur(18px);
}
.dream-enter-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  background: var(--theme);
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.2em;
  font-family: inherit;
  cursor: pointer;
}
.dream-enter-btn:active { transform: scale(0.985); }

.dream-wake-link {
  border: none; background: transparent;
  color: var(--theme); font-size: 13px;
  padding: 4px 6px; cursor: pointer; font-family: inherit;
}

.dream-settings-tabs {
  display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.dream-settings-tab {
  flex: 1; text-align: center; padding: 10px;
  border: none; background: transparent;
  font-size: 14px; color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer; font-family: inherit;
}
.dream-settings-tab.active {
  color: var(--theme);
  border-bottom-color: var(--theme);
}

.dream-scene {
  position: relative; flex: 1; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
  background: #ffffff;
}
.dream-scene-bg {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
}
.dream-scene .scroll-area { flex: 1; min-height: 0; }

/* ===== 梦境散文叙事容器 ===== */
.dream-narrative {
  padding: 20px 20px 110px;
}
.dream-block {
  margin: 0 0 18px;
  animation: dreamFadeIn 0.45s ease-out;
}
.dream-block-user {
  opacity: 0.88;
}
.dream-line {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 15px;
  line-height: 2;
  color: var(--text-primary);
  text-indent: 2em;
  margin: 0 0 0.35em;
  word-break: break-word;
}
.dream-line-dialogue {
  text-indent: 0;
  padding-left: 2em;
  margin: 0.45em 0;
}
.dream-block-user .dream-line {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
}
.dream-line-gap { height: 0.55em; }
.dream-p-ai, .dream-p-user { /* 兼容旧类名 */
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 15px; line-height: 2; text-indent: 2em; margin: 0 0 20px;
}
.dream-p-typing {
  text-indent: 0 !important;
  color: var(--text-secondary) !important;
  letter-spacing: 5px;
  font-style: italic;
  opacity: 1;
}
.dream-p-typing .dream-line {
  text-indent: 0;
  letter-spacing: 5px;
  color: var(--text-secondary);
}
.dream-wake-divider {
  text-align: center;
  color: var(--text-secondary);
  opacity: 0.55;
  letter-spacing: 10px;
  font-size: 13px;
  margin: 24px 0 12px;
  font-family: 'Noto Serif SC', serif;
}
.dream-scene-card {
  text-align: center;
  margin: 4px 0 28px;
  padding: 20px 20px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  animation: dreamFadeIn 0.6s ease-out;
}
.dream-scene-era {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  letter-spacing: 0.35em;
  color: var(--text-primary);
  opacity: 0.75;
}
.dream-scene-roles {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 7px;
  letter-spacing: 0.08em;
  opacity: 0.7;
}
.dream-card {
  margin: 8px 12px; padding: 16px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius); cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}
.dream-date { font-size: 12px; color: var(--text-secondary); }
.dream-fragment { font-size: 12px; color: var(--text-secondary); }
.dream-preview { font-size: 14px; line-height: 1.6; color: var(--text-primary); }

/* 输入栏 / 选项 */
.dream-input-bar {
  flex-shrink: 0;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg-primary) 90%, transparent);
  backdrop-filter: blur(18px);
}
.dream-input-row {
  display: flex; align-items: flex-end; gap: 8px;
}
.dream-composer {
  flex: 1; min-height: 40px; max-height: 120px;
}
.dream-input-actions {
  display: flex; gap: 6px; flex-shrink: 0; padding-bottom: 2px;
}
.dream-act-btn {
  min-width: 36px; height: 36px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--bg-primary) 96%, transparent);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.dream-act-send {
  background: var(--theme);
  border-color: transparent;
  color: #fff;
}
.dream-act-continue {
  min-width: 48px;
  font-size: 13px;
  color: var(--theme);
  border-color: color-mix(in srgb, var(--theme) 35%, var(--border));
}
.dream-inline-continue {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  font-family: inherit;
}
.dream-inline-continue:hover {
  color: var(--theme);
  border-color: color-mix(in srgb, var(--theme) 40%, var(--border));
}
.dream-block-ai .dream-inline-continue { opacity: 0.55; }
.dream-block-ai:last-of-type .dream-inline-continue { opacity: 1; }
.dream-mode-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  opacity: 0.85;
}
.dream-choices {
  padding: 8px 12px 0;
  background: color-mix(in srgb, var(--bg-primary) 94%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.dream-choices-title {
  font-size: 12px; color: var(--text-secondary);
  letter-spacing: 0.08em; margin-bottom: 8px;
}
.dream-choices-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.dream-choice-btn {
  display: flex; align-items: flex-start; gap: 10px;
  text-align: left;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px; line-height: 1.5;
  color: var(--text-primary);
  cursor: pointer; font-family: inherit;
}
.dream-choice-btn:active {
  border-color: color-mix(in srgb, var(--theme) 45%, var(--border));
  background: color-mix(in srgb, var(--theme) 8%, transparent);
}
.dream-choice-idx {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--theme);
  background: color-mix(in srgb, var(--theme) 12%, transparent);
  margin-top: 1px;
}
.dream-choices-loading {
  font-size: 12px; color: var(--text-secondary); padding: 8px 0 12px;
}

.dream-edit-btn {
  position: absolute; top: 4px; right: -28px;
  width: 22px; height: 22px; border: none; border-radius: 6px;
  background: rgba(0,0,0,0.05); color: var(--text-secondary);
  font-size: 11px; cursor: pointer; opacity: 0.6;
}
.dream-edit-btn:hover { opacity: 1; background: rgba(0,0,0,0.08); }
.dream-bubble-wrap { position: relative; }
.dream-bubble-wrap > div:last-child { position: relative; }
.msg-fold-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 12px 16px; padding: 10px 16px; cursor: pointer;
  border-radius: 20px; font-size: 13px; color: var(--text-secondary);
  background: rgba(255,255,255,0.12); border: 1px solid var(--border);
  transition: background 0.15s;
}
.msg-fold-bar:hover { background: rgba(255,255,255,0.2); color: var(--theme-dark); }
.msg-fold-icon { font-size: 16px; letter-spacing: 2px; }

/* ===== 加载动画 ===== */
.loading {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 20px; color: var(--text-secondary);
  font-size: 13px;
}
.loading-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--theme-light);
  border-top-color: var(--theme);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 长按菜单 ===== */
.context-menu {
  position: fixed; z-index: 400;
  background: rgba(245,230,248,0.97);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  min-width: 120px; max-width: min(220px, calc(100vw - 16px));
  max-height: min(320px, calc(100vh - 16px));
  overflow-y: auto;
  display: none;
}
.context-menu.active { display: block; }
.context-item {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; cursor: pointer; font-size: 14px;
  color: var(--text-primary); transition: background 0.15s;
}
.context-item:hover { background: var(--bg-primary); }
.context-item.danger { color: #e05555; }
.context-item + .context-item { border-top: 1px solid var(--border); }

/* ===== Toast：与朋友圈回复横幅同款，跟随浅/深色 ===== */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: max(12px, env(safe-area-inset-top));
  background: var(--system-notify-bg);
  color: var(--system-notify-text);
  border: 1px solid var(--system-notify-border);
  padding: 10px 18px; border-radius: 10px; font-size: 14px;
  line-height: 1.45; text-align: center;
  z-index: 10050; pointer-events: none; opacity: 0;
  transition: opacity 0.25s; white-space: normal;
  max-width: calc(100vw - 32px);
  box-shadow: var(--system-notify-shadow);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; }

/* ===== 拍一拍抖动 ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-1deg); }
  40% { transform: translateX(6px) rotate(1deg); }
  60% { transform: translateX(-4px) rotate(-0.5deg); }
  80% { transform: translateX(4px) rotate(0.5deg); }
}
.shaking { animation: shake 0.6s ease; }

/* ===== 粒子飘落 ===== */
@keyframes float-up {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-20px) rotate(360deg); opacity: 0; }
}

/* ===== 颜色选择器 ===== */
.color-presets {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.color-preset {
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: all 0.2s; box-shadow: var(--shadow-sm), inset 0 1px 1px rgba(255,255,255,0.35), inset 0 -1px 2px rgba(0,0,0,0.15);
}
.color-preset:hover { transform: translateY(-1px); }
.color-preset:active { transform: scale(0.9); }
.color-preset.active { border-color: white; transform: scale(1.1); box-shadow: 0 2px 8px rgba(0,0,0,0.25), inset 0 1px 1px rgba(255,255,255,0.35); }

/* ===== 滑块 ===== */
input[type="range"] {
  -webkit-appearance: none; width: 100%; height: 4px;
  background: var(--theme-light); border-radius: 2px; outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  background: linear-gradient(160deg, var(--theme), var(--theme-dark)); border-radius: 50%;
  box-shadow: 0 2px 8px rgba(148,92,184,0.3);
  cursor: pointer;
}

/* ===== 选择框 ===== */
select.input {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239b6db4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}

/* ===== 底部安全区 ===== */
.safe-bottom {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-secondary); text-align: center;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-text { font-size: 14px; line-height: 1.6; }

/* ===== Markdown ===== */
.md-content { line-height: 1.7; font-size: 14px; }
.md-content p { margin-bottom: 8px; }
.md-content strong { font-weight: 500; }
.md-content em { font-style: italic; color: var(--theme-dark); }
.md-content h1,.md-content h2,.md-content h3 {
  font-family: 'Noto Serif SC', serif; margin: 12px 0 6px;
}

/* ===== 响应式 ===== */
/* ===== 表情包管理 ===== */
.emoji-cat-block { margin-bottom: 4px; }

.emoji-cat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.emoji-cat-card:active { opacity: 0.85; }
.emoji-cat-card-main { flex: 1; min-width: 0; }
.emoji-cat-card-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.emoji-cat-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.emoji-cat-card-arrow {
  font-size: 22px;
  color: var(--text-secondary);
  line-height: 1;
  flex-shrink: 0;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}

.emoji-item {
  position: relative;
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.emoji-item-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}
.emoji-item-needs-desc {
  border-color: var(--theme);
  box-shadow: 0 0 0 1px rgba(148,92,184,0.25);
}
.emoji-desc-row {
  display: flex;
  gap: 4px;
  padding: 6px;
  align-items: center;
}
.emoji-desc-input {
  flex: 1;
  min-width: 0;
  font-size: 11px !important;
  padding: 5px 6px !important;
}
.emoji-desc-save {
  padding: 4px 8px !important;
  font-size: 11px !important;
  flex-shrink: 0;
}
.emoji-desc-hint {
  font-size: 10px;
  color: var(--theme);
  padding: 0 6px 6px;
  margin-top: -2px;
}
.emoji-item:hover .emoji-item-del { opacity: 1; }

.emoji-item-del {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px;
  background: rgba(224,85,85,0.85);
  color: white; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity 0.15s;
  z-index: 2;
}

/* ===== 通讯页 tabbar ===== */
.contacts-tabbar {
  display: flex;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.contacts-tabbar--line {
  box-shadow: 0 -1px 0 color-mix(in srgb, var(--border) 55%, transparent);
}

.contacts-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px 2px;
  cursor: pointer;
  gap: 2px;
  transition: color 0.2s;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
}

.contacts-tab.active {
  color: var(--theme);
}

.contacts-tab-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform 0.2s;
  position: relative;
}
.contacts-tab-icon svg {
  display: block;
}

.contacts-tab-badge {
  position: absolute;
  top: -4px; right: -8px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  font-family: 'Noto Sans SC', sans-serif;
}

.contacts-tab.active .contacts-tab-icon {
  transform: translateY(-1px);
}

.contacts-tab-label {
  font-size: 10px;
  letter-spacing: 0.2px;
  font-weight: 500;
}

.contacts-section-label {
  padding: 14px 16px 6px;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.contacts-new-friends {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 8px solid color-mix(in srgb, var(--border) 55%, transparent);
  cursor: pointer;
}
.contacts-new-friends-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--theme) 14%, transparent);
  color: var(--theme-dark, var(--theme));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--theme) 22%, transparent);
}
.contacts-new-friends-icon svg {
  display: block;
  stroke: currentColor;
}
.contacts-new-friends-main { flex: 1; min-width: 0; }
.contacts-new-friends-title { font-size: 16px; font-weight: 500; }
.contacts-new-friends-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.contacts-new-friends-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #e53935; color: #fff;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.contacts-row-chevron { color: var(--text-secondary); font-size: 20px; }

.ct-add-friend-menu {
  position: absolute; inset: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg-primary) 96%, transparent);
  backdrop-filter: blur(12px);
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
  box-sizing: border-box;
}
.ct-add-friend-title { font-size: 15px; font-weight: 600; padding: 4px 2px; }
.ct-add-friend-list {
  flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px;
}
.ct-add-friend-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: none; border-radius: 12px;
  background: color-mix(in srgb, var(--theme) 8%, var(--bg-primary));
  color: var(--text-primary); font-size: 15px; text-align: left; cursor: pointer;
}
.ct-add-friend-item img, .ct-add-friend-ph {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  background: var(--theme-light);
}
.ct-add-friend-cancel, .ct-add-friend-empty, .ct-add-friend-loading {
  text-align: center; padding: 12px; color: var(--text-secondary); font-size: 14px;
}

.friend-req-back {
  padding: 12px 16px; font-size: 15px; color: var(--theme); cursor: pointer;
}
.friend-req-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.friend-req-avatar {
  width: 48px; height: 48px; border-radius: 10px; overflow: hidden;
  background: var(--theme-light); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
}
.friend-req-avatar img { width: 100%; height: 100%; object-fit: cover; }
.friend-req-main { flex: 1; min-width: 0; }
.friend-req-name { font-size: 15px; font-weight: 500; }
.friend-req-msg { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.friend-req-actions { display: flex; flex-direction: column; gap: 6px; }

/* 角色名片 */
.profile-page-shell { display: flex; flex-direction: column; height: 100%; }
.profile-body { flex: 1; }
.profile-hero {
  display: flex; gap: 16px; align-items: center;
  padding: 24px 20px 20px;
}
.profile-avatar, .profile-avatar-ph {
  width: 72px; height: 72px; border-radius: 12px; object-fit: cover;
  background: var(--theme-light); display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.profile-nickname { font-size: 22px; font-weight: 600; letter-spacing: 0.02em; }
.profile-realname { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.profile-status-tag {
  display: inline-block; margin-top: 8px; font-size: 11px;
  padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, #c45c6a 16%, transparent); color: #c45c6a;
}
.profile-rows {
  margin: 8px 0 20px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.profile-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  width: 100%; background: none; border-left: none; border-right: none; border-top: none;
  color: inherit; font: inherit; text-align: left;
}
.profile-row:last-child { border-bottom: none; }
.profile-row-btn { cursor: pointer; }
.profile-row-label { font-size: 15px; }
.profile-row-value { font-size: 14px; color: var(--text-secondary); }
.profile-row-chevron { color: var(--text-secondary); font-size: 22px; }
.profile-actions { padding: 8px 18px 28px; display: flex; flex-direction: column; gap: 10px; }
.profile-action-btn {
  height: 46px; border: none; border-radius: 10px;
  background: var(--theme); color: #fff; font-size: 16px; font-weight: 500; cursor: pointer;
}
.profile-action-btn--ghost {
  background: color-mix(in srgb, var(--theme) 12%, var(--bg-primary));
  color: var(--theme-dark);
}
.profile-more-sheet { position: fixed; inset: 0; z-index: 80; }
.profile-more-mask { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.profile-more-panel {
  position: absolute; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
}
.profile-more-item {
  border: none; border-radius: 12px; padding: 15px;
  background: var(--bg-primary); font-size: 16px; cursor: pointer; color: var(--text-primary);
}
.profile-more-item--danger { color: #c45c6a; }

.bubble-row-with-status {
  display: flex; align-items: flex-end; gap: 6px;
}
.bubble-wrap.ai .bubble-row-with-status { flex-direction: row; }
.bubble-wrap.user .bubble-row-with-status { flex-direction: row-reverse; }
.bubble-undelivered {
  width: 18px; height: 18px; border-radius: 50%;
  background: #e53935; color: #fff;
  font-size: 12px; font-weight: 700; line-height: 18px;
  text-align: center; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(229,57,53,.35);
}

.contacts-char-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.contacts-char-row:active { background: var(--bg-primary); }
.contacts-char-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.contacts-char-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.contacts-char-main {
  flex: 1;
  min-width: 0;
}
.contacts-status-tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 400;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.4;
}
.contacts-status-tag.is-blocked {
  background: color-mix(in srgb, #c45c6a 14%, transparent);
  color: #c45c6a;
}
.contacts-status-tag.is-peer-blocked {
  background: color-mix(in srgb, #b8860b 14%, transparent);
  color: #a67c00;
}
.profile-peer-hint {
  margin: 0 16px 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  background: color-mix(in srgb, #b8860b 10%, transparent);
  border-radius: 10px;
}

/* ===== 通讯收件箱会话行 ===== */
.inbox-conv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px 13px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  position: relative;
}
.inbox-conv-row:active { background: var(--bg-primary); }
.inbox-conv-row.is-pinned {
  background: color-mix(in srgb, var(--theme) 7%, transparent);
}
.inbox-conv-row.is-pinned::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--theme);
  opacity: 0.85;
}
.inbox-conv-avatar {
  position: relative;
  flex-shrink: 0;
}
.inbox-conv-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inbox-conv-top,
.inbox-conv-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.inbox-conv-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.inbox-conv-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.inbox-conv-time {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1;
}
.inbox-pin-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0.45;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.inbox-pin-btn:hover,
.inbox-conv-row:hover .inbox-pin-btn {
  opacity: 0.85;
  background: color-mix(in srgb, var(--theme) 12%, transparent);
}
.inbox-pin-btn.is-on {
  opacity: 1;
  color: var(--theme);
  background: color-mix(in srgb, var(--theme) 14%, transparent);
}
.inbox-pin-btn:active { transform: scale(0.94); }
.inbox-conv-preview {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-conv-preview.has-unread {
  color: var(--text-primary);
  font-weight: 500;
}
.inbox-unread-badge {
  background: #e53935;
  color: white;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

/* ===== 梦境对话框风格变体 ===== */
/* 诗行风格 */
.dream-dialogue-line .bubble.ai,
.dream-dialogue-line .bubble.user {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid rgba(180,130,255,0.35) !important;
  border-radius: 0 !important;
  padding: 6px 2px !important;
  box-shadow: none !important;
  font-family: 'Noto Serif SC', serif;
  color: rgba(255,255,255,0.88) !important;
  letter-spacing: 0.5px;
  line-height: 1.9;
}

/* 渐隐风格 */
.dream-dialogue-fade .bubble.ai,
.dream-dialogue-fade .bubble.user {
  background: rgba(180,130,255,0.08) !important;
  border: 1px solid rgba(180,130,255,0.18) !important;
  border-radius: 14px !important;
  box-shadow: 0 2px 20px rgba(100,50,180,0.15) !important;
  animation: dreamFadeIn 0.6s ease-out;
}

@keyframes dreamFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dreamFog1 {
  0%   { transform: translate(-10%, 10%) scale(1);   opacity: 0.18; }
  50%  { transform: translate(8%, -6%) scale(1.15);  opacity: 0.28; }
  100% { transform: translate(-10%, 10%) scale(1);   opacity: 0.18; }
}
@keyframes dreamFog2 {
  0%   { transform: translate(12%, -8%) scale(1.1);  opacity: 0.14; }
  50%  { transform: translate(-8%, 10%) scale(0.95); opacity: 0.24; }
  100% { transform: translate(12%, -8%) scale(1.1);  opacity: 0.14; }
}
@keyframes dreamFog3 {
  0%   { transform: translate(0%, 0%) scale(1);      opacity: 0.10; }
  33%  { transform: translate(6%, 8%) scale(1.08);   opacity: 0.20; }
  66%  { transform: translate(-5%, -5%) scale(0.94); opacity: 0.12; }
  100% { transform: translate(0%, 0%) scale(1);      opacity: 0.10; }
}
.dream-fog-layer {
  position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(40px);
}

/* ===== 响应式 / 桌面自适应 ===== */
@media (min-width: 480px) {
  .page { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .wheel-btn { right: calc(50% - 240px + 20px); }
  .call-screen:not(.is-minimized) { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .call-screen.is-minimized { max-width: none; transform: none; }
  .toast { max-width: 460px; }

  /* 桌面端：主页壁纸已是 fixed 全屏 */
  .home-desktop-bg {
    position: fixed;
  }

  /* 桌面端：给居中的应用加上手机外框阴影 */
  .page:not(#home-page) {
    box-shadow: 0 0 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
  }
  #home-page {
    box-shadow: 0 0 60px rgba(0,0,0,0.45);
  }

  .call-ended-screen { max-width: 480px; left: 50%; transform: translateX(-50%); }
}

/* ===== 聊天快捷菜单 ===== */
.chat-menu-item {
  padding: 12px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
  color: var(--text-primary);
}
.chat-menu-item:hover { background: rgba(255,255,255,0.08); }

/* ===== 通讯页隐藏滚动条 ===== */
#ct-content::-webkit-scrollbar { width: 0 !important; height: 0 !important; background: transparent !important; }
#ct-content::-webkit-scrollbar-thumb { background: transparent !important; }
#ct-content { scrollbar-width: none !important; -ms-overflow-style: none !important; overflow-y: auto; }

/* ===== 经期日历 ===== */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-head {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0 6px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.cal-day:empty { cursor: default; pointer-events: none; }
.cal-day--period {
  background: rgba(235,100,135,0.18);
  color: rgba(215,70,110,0.95);
  font-weight: 500;
}
.cal-day--period-start {
  background: rgba(235,100,135,0.28);
}
.cal-day--today {
  box-shadow: inset 0 0 0 1.5px var(--theme);
  font-weight: 600;
}
.cal-day:not(:empty):not(.cal-day--period):hover {
  background: rgba(255,160,185,0.12);
}
.cal-day--period-end {
  background: rgba(235,100,135,0.22);
}
.period-popup-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-primary);
  transition: background 0.12s;
}
.period-popup-btn:hover {
  background: rgba(255,160,185,0.14);
}

/* ===== 角色印象备忘 ===== */
.impression-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--theme-light);
  color: var(--theme-dark);
  margin: 2px 2px 0 0;
}
.impression-category-喜好  { background: rgba(255,160,185,0.15); color: rgba(200,60,100,0.85); }
.impression-category-习惯  { background: rgba(160,200,255,0.15); color: rgba(60,100,200,0.85); }
.impression-category-weak  { background: rgba(180,160,220,0.18); color: rgba(100,70,160,0.9); }
.impression-category-trait { background: rgba(120,200,180,0.16); color: rgba(40,130,110,0.9); }
.impression-category-relation { background: rgba(255,180,140,0.18); color: rgba(180,90,40,0.9); }
.impression-category-looks { background: rgba(200,170,255,0.18); color: rgba(110,70,180,0.9); }
.impression-category-other { background: var(--theme-light); color: var(--theme-dark); }

/* ===== 移动端响应式补强 ===== */

/* 全局横向溢出防护 */
html, body { overflow-x: hidden; max-width: 100vw; }
img, video { max-width: 100%; height: auto; }

/* 全屏面板顶栏 — 补齐刘海/打孔屏安全区 */
.sheet-full-topbar {
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* iOS 输入框防自动缩放（< 16px 会触发） */
.chat-input, .input, .compose-textarea { font-size: 16px; }

/* 触控目标最小尺寸 44px */
.topbar-back, .topbar-action, .topbar-save,
.chat-send-btn, .chat-plus-btn, .call-roll-btn {
  min-width: 44px; min-height: 44px;
}
.chat-emoji-btn {
  min-width: 36px; min-height: 36px;
}

/* Toast 长文本防溢出 */
.toast {
  max-width: calc(100vw - 32px);
  white-space: normal;
  word-break: break-word;
  text-align: center;
}

/* 顶栏标题截断 */
.topbar-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 设置行 flex 折行防挤压 */
.settings-row { flex-wrap: wrap; }
.settings-row-label { min-width: 0; flex: 1 1 140px; }

/* 列表项长文案截断 */
.list-item > span:first-child {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}

/* 梦境编辑按钮防横溢 */
.dream-bubble-wrap { overflow: hidden; }
.dream-edit-btn { right: 0; }

/* ===== 320–390px 小屏专项 ===== */
@media (max-width: 390px) {
  .home-clock { font-size: 48px; letter-spacing: 1px; }

  .home-bottom-nav { gap: 6px; padding: 0 8px; }
  .bottom-nav-btn--side .bottom-nav-icon { width: 44px; height: 44px; font-size: 20px; }
  .bottom-nav-btn--main .bottom-nav-icon { width: 56px; height: 56px; font-size: 26px; }
  .side-nav-btn { min-width: 44px; padding: 8px; }

  .modal { width: calc(100% - 24px); }
}

/* ===== 设置页切页 ===== */
.settings-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  transition: color 0.15s, border-color 0.15s;
}
.settings-tab.active {
  border-bottom-color: var(--theme);
  color: var(--theme);
}

/* ===== 日程页 ===== */
#schedule-page {
  flex-direction: column;
  overflow: hidden;
}
.schedule-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.schedule-tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
}
.schedule-tab.active {
  border-bottom-color: var(--theme);
  color: var(--theme);
  font-weight: 500;
}
.schedule-date-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  flex-shrink: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.schedule-date-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.schedule-date-input {
  width: auto;
  padding: 4px 8px;
  font-size: 13px;
}
.schedule-weekday {
  font-size: 12px;
  color: var(--text-secondary);
}
.schedule-today-btn { flex-shrink: 0; }

/* 当天时间轴总结 */
.day-timeline {
  flex-shrink: 0;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--theme) 5%, var(--bg-glass));
  max-height: 42vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.day-timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.day-timeline-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: 'Noto Serif SC', serif;
}
.day-timeline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.day-timeline-body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-primary);
}
.day-timeline-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.day-timeline-hint--sub {
  margin-top: 4px;
  opacity: 0.8;
  font-size: 11px;
}
.day-timeline-summary {
  white-space: pre-wrap;
  word-break: break-word;
}
.day-timeline-beats {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.day-timeline-beat {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  position: relative;
  padding-left: 12px;
}
.day-timeline-beat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--theme);
  opacity: 0.55;
}
.day-timeline-beat-time {
  flex-shrink: 0;
  min-width: 2.8em;
  color: var(--theme);
  font-variant-numeric: tabular-nums;
}
.day-timeline-beat-text {
  flex: 1;
  min-width: 0;
}

.schedule-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.schedule-char-picker {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
}
.schedule-char-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-secondary);
  transition: border-color 0.15s, background 0.15s;
}
.schedule-char-chip.active {
  border-color: var(--theme);
  background: color-mix(in srgb, var(--theme) 12%, transparent);
  color: var(--theme);
}
.schedule-char-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.schedule-char-av--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  font-size: 16px;
}
.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 8px;
  flex-shrink: 0;
}
.schedule-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.schedule-hint {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
}
.schedule-user-intro {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  background: color-mix(in srgb, var(--theme) 8%, transparent);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.schedule-scroll {
  flex: 1;
  padding: 12px 16px 28px;
}
.schedule-timeline {
  position: relative;
  padding-left: 4px;
}
.schedule-timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--theme), color-mix(in srgb, var(--theme) 20%, transparent));
  border-radius: 2px;
  opacity: 0.35;
}
.schedule-item {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  position: relative;
}
.schedule-item--now .schedule-card {
  border-color: var(--theme);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--theme) 25%, transparent),
    0 4px 16px color-mix(in srgb, var(--theme) 12%, transparent);
}
.schedule-item--pending .schedule-card {
  border-color: color-mix(in srgb, #e8a838 35%, var(--border));
}
.schedule-item--reviewed .schedule-card {
  opacity: 0.95;
}
.schedule-item--upcoming .schedule-card {
  opacity: 0.82;
}
.schedule-time-col {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
}
.schedule-time-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--theme);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme) 22%, transparent);
  z-index: 1;
}
.schedule-time-dot--user {
  background: #7eb8da;
  box-shadow: 0 0 0 3px color-mix(in srgb, #7eb8da 22%, transparent);
}
.schedule-item--now .schedule-time-dot {
  animation: schedule-pulse 2s ease infinite;
}
@keyframes schedule-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.schedule-time {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.schedule-card {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
}
.schedule-timeline--user::before {
  background: linear-gradient(to bottom, #7eb8da, color-mix(in srgb, #7eb8da 20%, transparent));
}
.schedule-item--user.schedule-item--now .schedule-card {
  border-color: #7eb8da;
  box-shadow: 0 0 0 1px color-mix(in srgb, #7eb8da 28%, transparent),
    0 4px 16px color-mix(in srgb, #7eb8da 14%, transparent);
}
.schedule-item--user.schedule-item--now .schedule-time-dot--user {
  animation: schedule-pulse 2s ease infinite;
}
.schedule-item--user.schedule-item--upcoming .schedule-card {
  opacity: 0.86;
}
.schedule-item--user.schedule-item--past .schedule-card {
  opacity: 0.9;
}
.schedule-card--user {
  background: color-mix(in srgb, #7eb8da 6%, var(--bg-glass));
  cursor: pointer;
}
.schedule-card--user .schedule-review-text {
  background: color-mix(in srgb, #7eb8da 10%, var(--bg-primary));
}
.schedule-card--user .schedule-review-edit:hover {
  color: #7eb8da;
}
.schedule-status-badge--past {
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--text-secondary) 12%, transparent);
}
.schedule-status-badge--user.schedule-status-badge--now {
  color: #5a8fb0;
  background: color-mix(in srgb, #7eb8da 18%, transparent);
}
.schedule-note-add {
  display: block;
  margin-top: 6px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
}
.schedule-note-add:hover { color: #7eb8da; }
.schedule-card-foot {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
}
.schedule-card-action {
  border: none;
  background: transparent;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
}
.schedule-card-action:hover { color: #7eb8da; }
.schedule-card-action--danger:hover { color: #d45c5c; }
.schedule-activity {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  flex: 1;
  min-width: 0;
}
.schedule-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.schedule-status-badge {
  flex-shrink: 0;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.schedule-status-badge--now {
  color: var(--theme);
  background: color-mix(in srgb, var(--theme) 14%, transparent);
}
.schedule-status-badge--upcoming {
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--text-secondary) 10%, transparent);
}
.schedule-status-badge--pending {
  color: #c9922a;
  background: color-mix(in srgb, #e8a838 16%, transparent);
}
.schedule-status-badge--reviewed {
  color: #5a9e6f;
  background: color-mix(in srgb, #5a9e6f 14%, transparent);
}
.schedule-review {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}
.schedule-review--done {
  position: relative;
}
.schedule-review-label {
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.schedule-review-text {
  font-size: 12px;
  line-height: 1.55;
  color: color-mix(in srgb, var(--text-primary) 88%, var(--text-secondary));
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--theme) 5%, var(--bg-primary));
}
.schedule-review-edit {
  position: absolute;
  top: 8px;
  right: 0;
  border: none;
  background: transparent;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 4px;
}
.schedule-review-edit:hover { color: var(--theme); }
.schedule-review-input {
  width: 100%;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  resize: vertical;
  box-sizing: border-box;
}
.schedule-review--pending {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.schedule-review-pending-icon {
  flex-shrink: 0;
  font-size: 13px;
}
.schedule-thought-wrap {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}
.schedule-field-wrap {
  margin-bottom: 8px;
}
.schedule-field-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.schedule-field-input {
  width: 100%;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--theme) 6%, var(--bg-primary));
  border-style: dashed;
  box-sizing: border-box;
}
.schedule-field-input--execution {
  background: color-mix(in srgb, #7eb8da 8%, var(--bg-primary));
}
.schedule-thought-label {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 6px;
}
.schedule-thought-input {
  flex: 1;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--theme) 6%, var(--bg-primary));
  border-style: dashed;
}
.schedule-item--past .schedule-card,
.schedule-item--reviewed .schedule-card {
  opacity: 0.92;
}
.schedule-user-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
}
.schedule-sticker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.schedule-sticker {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  opacity: 0.45;
  transition: opacity 0.12s, transform 0.12s, background 0.12s;
}
.schedule-sticker.on {
  opacity: 1;
  background: color-mix(in srgb, var(--theme) 14%, transparent);
  border-color: var(--theme);
  transform: scale(1.08);
}
.schedule-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.schedule-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  font-size: 14px;
}
.schedule-empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.schedule-empty-sub {
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.75;
}
.schedule-empty-hint {
  padding: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.schedule-edit-modal { max-width: 380px; }

/* ===== 秘密簿：新版笔记本卡片书架 + 内嵌纸页 ===== */
.secret-page-scroll {
  padding: 12px 14px 32px;
  background: #f3eee6;
}
#diary-page {
  background: #f3eee6;
  position: relative;
}
#diary-page #diary-view-overlay.secret-reader-docked {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  background: #d9cbb8;
  backdrop-filter: none;
  align-items: stretch;
}
#diary-page #diary-view-overlay.secret-reader-docked.active {
  display: flex;
}
#diary-page #diary-view-overlay.secret-reader-docked .sheet-full {
  height: 100%;
  max-height: 100%;
  background: transparent;
}
#diary-page #diary-view-overlay.secret-reader-docked .secret-sheet-topbar,
#diary-page #diary-view-overlay.secret-reader-docked #diary-view-topbar {
  display: none !important;
}
.diary-reading-extra {
  display: none;
  align-items: center;
  gap: 8px;
}
.secret-content-dimmed {
  visibility: hidden;
  pointer-events: none;
}
html[data-color-scheme="dark"] #diary-page,
html[data-color-scheme="dark"] .secret-page-scroll {
  background: #1a1520;
}

.secret-home-hero {
  margin: 4px 2px 18px;
  padding: 18px 16px 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, #fffdf8, #f3ebe0);
  border: 1px solid rgba(120,90,55,0.1);
  box-shadow: 0 4px 16px rgba(90,60,30,0.06);
}
.secret-home-kicker {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: #9a8874;
  margin-bottom: 4px;
}
.secret-home-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  color: #3a3228;
  font-weight: 500;
}
.secret-home-desc {
  margin-top: 6px;
  font-size: 12px;
  color: #7a6a58;
  line-height: 1.5;
}
.secret-section-label {
  font-size: 12px;
  color: #8a7866;
  letter-spacing: 0.12em;
  padding: 4px 4px 10px;
  font-weight: 500;
}
.secret-empty-hint {
  margin: 0 2px 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,252,245,0.8);
  border: 1px dashed rgba(120,90,55,0.18);
  font-size: 12.5px;
  color: #7a6a58;
  line-height: 1.6;
}

.secret-notebook-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.secret-notebook-card {
  position: relative;
  border-radius: 16px;
  background: #fffdf9;
  border: 1px solid rgba(120,90,55,0.12);
  box-shadow: 0 3px 12px rgba(90,60,30,0.07);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.secret-notebook-card:active {
  transform: translateY(1px);
  box-shadow: 0 1px 6px rgba(90,60,30,0.08);
}
.secret-notebook {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: inherit;
  display: block;
}
.secret-notebook-cover {
  position: relative;
  height: 110px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--book-color, #c9a6f5) 55%, #fff), color-mix(in srgb, var(--book-color, #c9a6f5) 28%, #f7f1ea));
  overflow: hidden;
}
.secret-notebook-cover .secret-book-cover-img,
.secret-notebook-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.secret-notebook-cover .secret-book-cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: transparent;
}
.secret-notebook-body {
  padding: 10px 12px 12px;
}
.secret-notebook-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  color: #3a3228;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.secret-notebook-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #9a8874;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.secret-notebook-del {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.92);
  color: #c9564f;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.secret-notebook-add {
  appearance: none;
  min-height: 168px;
  border-radius: 16px;
  border: 1.5px dashed rgba(120,90,55,0.28);
  background: rgba(255,252,245,0.55);
  color: #7a6a58;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 12px;
  transition: background .18s, border-color .18s, transform .18s;
}
.secret-notebook-add:hover {
  background: rgba(255,252,245,0.9);
  border-color: rgba(120,90,55,0.45);
}
.secret-notebook-add:active { transform: scale(0.98); }
.secret-notebook-add-plus {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0edf4;
  border: 1.5px solid rgba(0,0,0,0.1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  color: var(--text-primary);
}
.secret-notebook-add-plus svg { display: block; }
.secret-notebook-add-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* 打开的笔记本 — 阅读态铺满至底端约 2px */
.secret-open-desk {
  padding: 4px 2px 12px;
  min-height: calc(100% - 8px);
}
.secret-open-book {
  position: relative;
  display: flex;
  max-width: min(720px, calc(100% - 8px));
  width: 100%;
  margin: 0 auto;
  border-radius: 4px 16px 16px 4px;
  background:
    linear-gradient(90deg, #6b4e3a 0 12px, #8a6550 12px 16px, transparent 16px),
    #f7f1e6;
  box-shadow:
    0 16px 40px rgba(70,45,20,0.24),
    0 2px 0 rgba(255,255,255,0.35) inset,
    -2px 0 0 rgba(40,25,12,0.18);
  overflow: hidden;
  min-height: calc(100vh - 128px);
}
.secret-open-book.is-list { min-height: calc(100vh - 128px); }
.secret-open-book.secret-open-book-reader {
  max-width: none;
  width: calc(100% - 4px);
  height: calc(100% - 2px);
  min-height: 0;
  margin: 0 2px 0;
}
.secret-page-clip {
  position: relative;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}
.secret-page-inner {
  will-change: transform;
  position: relative;
  z-index: 1;
}
.secret-open-book-binding {
  width: 14px;
  flex-shrink: 0;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255,255,255,0.08) 0 2px,
      transparent 2px 8px
    ),
    linear-gradient(90deg, #5a3f2e, #8a6550 55%, #6b4e3a);
  box-shadow: 2px 0 8px rgba(40,25,12,0.25);
  position: relative;
}
.secret-open-book-binding::after {
  content: '';
  position: absolute;
  inset: 12% 4px auto;
  height: 76%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.18), transparent);
  pointer-events: none;
}
.secret-open-book-sheet {
  flex: 1;
  min-width: 0;
  padding: 14px 12px 18px;
  position: relative;
  overflow: hidden;
  background: #faf6ee;
}
.secret-open-book-sheet::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 18px;
  background: linear-gradient(90deg, rgba(70,45,20,0.12), transparent);
  pointer-events: none;
  z-index: 2;
}
.secret-open-book-sheet > .secret-paper-pattern {
  z-index: 0;
}
.secret-open-book-sheet > .secret-page-clip,
.secret-open-book-sheet > .secret-inset-paper,
.secret-open-book .secret-page-inner {
  position: relative;
  z-index: 1;
}
.secret-open-book .secret-inset-paper {
  margin: 4px 2px 8px;
  padding: 8px 6px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  min-height: 0;
}
.secret-open-book.is-list .secret-inset-paper {
  min-height: auto;
}
.secret-open-book-reader .secret-open-book-sheet {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 8px;
  /* 阅读态：背景完全交给纸张设置，不再叠默认横线 */
  background: #faf6ee;
}
.secret-open-book-reader .secret-inset-paper {
  margin: 0;
  padding: 4px 2px 8px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
}

.shared-memo-char-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.shared-memo-char-card {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  color: inherit;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.shared-memo-char-card:hover {
  background: #faf8fc;
  box-shadow: 0 4px 14px rgba(0,0,0,0.07);
}
.shared-memo-char-card:active { transform: scale(0.99); }
.shared-memo-char-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--theme-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.shared-memo-char-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shared-memo-char-fallback { font-size: 20px; }
.shared-memo-char-info { flex: 1; min-width: 0; }
.shared-memo-char-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.shared-memo-char-hint {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shared-memo-char-chevron {
  color: var(--text-secondary);
  font-size: 20px;
  flex-shrink: 0;
}

.secret-beautify-cover-row {
  display: flex;
  gap: 14px;
  align-items: center;
}
.secret-beautify-cover-preview {
  width: 84px;
  height: 112px;
  border-radius: 12px;
  overflow: hidden;
  background: #f0ebe3;
  border: 1px solid rgba(120,90,55,0.16);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(90,60,30,0.1);
}
.secret-beautify-cover-preview img,
.secret-beautify-cover-preview .secret-book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.secret-beautify-cover-preview .secret-book-cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.secret-beautify-cover-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.secret-inset-stage {
  max-width: 560px;
  margin: 0 auto;
}
.secret-inset-paper {
  margin: 12px 10px 24px;
  padding: 18px 16px 22px;
  border-radius: 16px;
  background: #faf6ee;
  border: 1px solid rgba(120,90,55,0.12);
  box-shadow: 0 8px 28px rgba(90,60,30,0.1), inset 0 1px 0 rgba(255,255,255,0.7);
  position: relative;
  overflow: hidden;
  min-height: 48vh;
}
.secret-inset-plain {
  white-space: pre-wrap;
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  line-height: 1.9;
  color: #3a3228;
}

/* 兼容旧书架类名（若别处仍引用） */
.secret-shelf-title {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 4px 14px;
  letter-spacing: 1px;
}
.secret-bookshelf {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 8px 0 28px;
}
.secret-book {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.secret-book-3d {
  position: relative;
  height: 168px;
  transform-style: preserve-3d;
  transition: transform .25s ease;
}
.secret-book:hover .secret-book-3d,
.secret-book:active .secret-book-3d {
  transform: translateY(-6px) rotateY(-8deg);
}
.secret-book-spine {
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 14px;
  border-radius: 3px 0 0 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--book-color) 70%, #222), var(--book-color));
  box-shadow: inset -2px 0 0 rgba(255,255,255,.15);
  transform: translateZ(1px);
}
.secret-book-cover {
  position: absolute;
  left: 10px; right: 6px; top: 0; bottom: 0;
  border-radius: 0 8px 8px 0;
  overflow: hidden;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--book-color) 45%, #1a1520), color-mix(in srgb, var(--book-color) 25%, #0d0a12));
  box-shadow:
    8px 12px 24px rgba(0,0,0,.35),
    inset 0 0 0 1px rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
}
.secret-book-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .88;
}
.secret-book-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  opacity: .85;
}
.secret-book-cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(0,0,0,.72) 100%);
}
.secret-book-cover-edit,
.secret-book-cover-reset {
  position: static;
  font-size: 13px;
  line-height: 1;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.95);
  color: #5a4634;
  cursor: pointer;
  opacity: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.secret-notebook-cover-tools {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 4;
  display: flex;
  gap: 6px;
}
.secret-book-cover-reset {
  color: #7a6a58;
}
.secret-shelf-hint {
  padding: 0 10px 10px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.secret-shelf-hint b {
  color: var(--text-primary);
  font-weight: 600;
}
.secret-book-title,
.secret-book-meta {
  position: relative;
  z-index: 1;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.secret-book-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.secret-book-meta {
  font-size: 11px;
  opacity: .85;
}
.secret-book-pages {
  position: absolute;
  right: 2px; top: 6px; bottom: 6px;
  width: 6px;
  background: repeating-linear-gradient(
    to bottom,
    #f7f2e8 0 2px,
    #e8dfd0 2px 3px
  );
  border-radius: 0 2px 2px 0;
  box-shadow: 2px 0 4px rgba(0,0,0,.2);
}

.secret-section-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 2px 8px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.secret-section-tab {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.secret-section-tab.active {
  color: var(--theme);
  border-color: var(--theme);
  background: color-mix(in srgb, var(--theme) 14%, transparent);
}
.secret-section-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 0 4px 10px;
}
.secret-accum-tip {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 4px 6px;
}
.secret-month-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 4px 6px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 1px;
}
.secret-month-chevron {
  display: inline-block;
  width: 14px;
  transition: transform .2s;
}
.secret-month-count {
  margin-left: auto;
  opacity: .8;
}

.secret-flip-stage {
  perspective: 1600px;
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.secret-flip-nav {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 10px;
  background: rgba(255,252,245,0.94);
  border: 1px solid rgba(120,90,60,0.14);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(70,45,20,0.12);
  flex-shrink: 0;
}
.secret-flip-nav[hidden] { display: none !important; }
.secret-flip-btn {
  width: 40px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(120,90,55,0.18);
  background: rgba(120,90,55,0.08);
  color: #5a4634;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(90,60,30,0.06), inset 0 1px 0 rgba(255,255,255,0.45);
  transition: transform .15s, background .15s;
}
.secret-flip-btn:hover { background: var(--theme-light); }
.secret-flip-btn:active { transform: scale(0.92); }
.secret-flip-indicator {
  min-width: 52px;
  text-align: center;
  font-size: 12px;
  color: #7a6a58;
  font-variant-numeric: tabular-nums;
}
.secret-flip-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  transform-style: preserve-3d;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.25), transparent 55%),
    linear-gradient(180deg, #cbb89a, #b9a486);
  padding: 2px 2px 2px;
  max-width: 100%;
}
.secret-flip-body {
  flex: 1;
  min-height: 0;
  overflow: hidden !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
  overscroll-behavior: none;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}
#diary-view-content {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  position: relative;
}
#diary-view-content .secret-open-book,
#diary-view-content .shared-memo-paper-sheet {
  flex: 1;
  min-height: 0;
}
#diary-peek-traces {
  max-width: 100%;
  box-sizing: border-box;
}
.secret-flip-stack {
  position: relative;
  height: 100%;
  min-height: 0;
  flex: 1;
  transform-style: preserve-3d;
  background: inherit;
  display: flex;
  flex-direction: column;
}
/* 下层内容默认完全隐藏，避免透过当前页看见昨天 */
.secret-flip-under {
  position: absolute;
  inset: 0;
  padding: 20px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  opacity: 0;
  visibility: hidden;
  white-space: pre-wrap;
  pointer-events: none;
  font-family: 'Noto Serif SC', serif;
  z-index: 0;
  overflow: hidden;
}
.secret-flip-under.is-peeking {
  opacity: 0.18;
  visibility: visible;
}
.secret-flip-page {
  position: relative;
  height: 100%;
  flex: 1;
  min-height: 0;
  z-index: 2;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.72s cubic-bezier(.22,.61,.36,1), box-shadow 0.72s ease, opacity 0.52s ease;
  backface-visibility: hidden;
  box-shadow: none;
  background-color: transparent;
  opacity: 1;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.secret-flip-curl {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 22%;
  pointer-events: none;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0,0,0,.03) 45%,
    rgba(255,255,255,.12) 72%,
    rgba(0,0,0,.1) 100%);
  opacity: .4;
  z-index: 3;
}
/* 仿真翻页（放慢） */
.secret-flip-page.flip-out {
  transform: rotateY(-108deg);
  box-shadow: -22px 12px 48px rgba(0,0,0,.38);
}
.secret-flip-page.flip-out-back {
  transform: rotateY(108deg);
  box-shadow: 22px 12px 48px rgba(0,0,0,.38);
}
.secret-flip-page.flip-in {
  animation: secretFlipIn 0.75s cubic-bezier(.22,.61,.36,1);
}
.secret-flip-page.flip-in-back {
  animation: secretFlipInBack 0.75s cubic-bezier(.22,.61,.36,1);
}
@keyframes secretFlipIn {
  from { transform: rotateY(98deg); box-shadow: 24px 10px 44px rgba(0,0,0,.32); }
  to { transform: rotateY(0); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
}
@keyframes secretFlipInBack {
  from { transform: rotateY(-98deg); box-shadow: -24px 10px 44px rgba(0,0,0,.32); }
  to { transform: rotateY(0); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
}
/* 覆盖翻页 */
.secret-flip-page.cover-out {
  transform: translateX(-18%) scale(0.96);
  opacity: 0;
}
.secret-flip-page.cover-out-back {
  transform: translateX(18%) scale(0.96);
  opacity: 0;
}
.secret-flip-page.cover-in {
  animation: secretCoverIn 0.52s cubic-bezier(.22,.61,.36,1);
}
.secret-flip-page.cover-in-back {
  animation: secretCoverInBack 0.52s cubic-bezier(.22,.61,.36,1);
}
@keyframes secretCoverIn {
  from { transform: translateX(40%) scale(1.02); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes secretCoverInBack {
  from { transform: translateX(-40%) scale(1.02); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
/* 滑动翻页 */
.secret-flip-page.slide-out {
  transform: translateX(-100%);
  opacity: 0.2;
}
.secret-flip-page.slide-out-back {
  transform: translateX(100%);
  opacity: 0.2;
}
.secret-flip-page.slide-in {
  animation: secretSlideIn 0.42s ease;
}
.secret-flip-page.slide-in-back {
  animation: secretSlideInBack 0.42s ease;
}
@keyframes secretSlideIn {
  from { transform: translateX(100%); opacity: 0.2; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes secretSlideInBack {
  from { transform: translateX(-100%); opacity: 0.2; }
  to { transform: translateX(0); opacity: 1; }
}

/* 纸张设置面板 — 全屏。这是个设置面板不是"纸张"本身，背景跟随 .sheet-full 的
   var(--bg-glass)，这样也能透出主题里设置的背景图，不再是写死的渐变盖住主题图。 */
.secret-paper-settings-sheet {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.secret-paper-settings-body {
  flex: 1;
  padding: 4px 16px 28px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.secret-paper-settings-body .input-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
/* 各个设置分组包一层卡片底，跟通讯设置一致的"有实感"质感，别再是漂浮在背景上的裸控件 */
.secret-paper-settings-body > .input-label {
  margin-top: 0;
}
/* 外层已是 .form-group 卡片，内层控件不再套第二层底 */
.secret-paper-swatch-row,
.secret-paper-color-tools,
#secret-paper-pattern-list,
#secret-paper-flip-list {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  box-sizing: border-box;
}
#secret-paper-pattern-list.tag-list,
#secret-paper-flip-list.tag-list { gap: 8px; }
/* 手机式备忘录列表 */
.phone-memo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.phone-memo-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  cursor: pointer;
  box-sizing: border-box;
}
.phone-memo-card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phone-memo-card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.phone-memo-card-time {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.75;
  margin-top: 8px;
}
.secret-paper-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.secret-paper-swatch {
  width: 52px;
  height: 64px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  overflow: hidden;
}
.secret-paper-swatch span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 10px;
  text-align: center;
  padding: 3px 0;
  background: rgba(255,255,255,.72);
  color: #3a3228;
}
.secret-paper-swatch.active {
  border-color: var(--theme);
  box-shadow: 0 0 0 2px var(--theme-light);
}
.secret-paper-color-tools {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.secret-paper-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}
.secret-paper-tool-btn input[type="color"] {
  width: 22px;
  height: 22px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
/* 字迹选项：预览字号受控，避免手写体撑破标签 */
.secret-paper-font-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.secret-paper-font-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  max-width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  color: var(--text-secondary);
  cursor: pointer;
  overflow: hidden;
  line-height: 1;
  font-size: 13px;
  box-sizing: border-box;
}
.secret-paper-font-tag.is-hand {
  font-size: 18px;
  padding: 0 14px;
}
.secret-paper-font-tag.active {
  background: linear-gradient(145deg, var(--theme-light), rgba(232,213,245,0.6));
  color: var(--theme-dark);
  border-color: rgba(201,160,220,0.55);
}
.secret-paper-ink-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.secret-paper-ink-row .secret-paper-tool-btn {
  width: 100%;
  justify-content: space-between;
  box-sizing: border-box;
}
.secret-sticker-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}
.secret-sticker-item {
  position: absolute;
  cursor: grab;
  user-select: none;
  z-index: 20;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

/* ===== 秘密簿：分区 TOC / 待办 / 愿望 / 心事纸片 ===== */
.secret-paper-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  z-index: 0;
}
.secret-toc-bookshelf {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 14px;
  padding: 8px 8px 28px;
  perspective: 900px;
}
.secret-toc-book .secret-book-3d {
  height: 132px;
}
.secret-toc-book .secret-book-title {
  font-size: 14px;
}
.secret-toc-book .secret-book-meta {
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.secret-toc-book .secret-book-cover-fallback {
  font-size: 32px;
}

.secret-todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 20px;
}
.secret-todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.45);
  border: 1px solid rgba(0,0,0,0.06);
}
.secret-todo-check {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  color: var(--theme);
  cursor: pointer;
  flex-shrink: 0;
}
.secret-todo-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
}
.secret-todo-done .secret-todo-text {
  text-decoration: line-through;
  color: var(--text-secondary);
  opacity: 0.75;
}
.secret-todo-del {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  opacity: 0.55;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.secret-todo-del:hover { opacity: 1; color: #e57373; }

.secret-wish-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 24px;
}
.secret-wish-card {
  position: relative;
  padding: 4px 8px 8px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,252,245,0.92), rgba(250,244,232,0.88));
  border: 1px solid rgba(90,70,40,0.08);
  box-shadow: 0 6px 18px rgba(60,40,20,0.06);
}
.secret-wish-del {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}
.secret-wish-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 12px 28px 10px 8px;
  cursor: pointer;
  text-align: left;
}
.secret-wish-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 17px;
  font-weight: 600;
  color: #3a3228;
  line-height: 1.45;
  flex: 1;
}
.secret-wish-chevron {
  display: inline-block;
  color: #8a7a6a;
  font-size: 18px;
  transition: transform .2s;
  flex-shrink: 0;
}
.secret-wish-detail {
  margin: 0 8px 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.75;
  color: #5a5046;
  white-space: pre-wrap;
  border-radius: 10px;
  background: rgba(255,255,255,0.45);
}
.secret-wish-card.is-open .secret-wish-detail {
  animation: secretWishIn .2s ease;
}
@keyframes secretWishIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.secret-shared-memo-wrap {
  position: relative;
  min-width: 0;
  width: 100%;
}
.secret-book-wrap {
  position: relative;
  min-width: 0;
  width: 100%;
}
.secret-book-wrap > .secret-book {
  position: relative;
  z-index: 1;
}
.secret-shared-memo-wrap > .secret-book,
.secret-book-wrap > .secret-book {
  display: block;
  width: 100%;
}
.secret-shared-memo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
}
.shared-memo-day-row {
  align-items: center;
  gap: 8px;
}
.shared-memo-day-row .secret-todo-del,
.shared-memo-day-del {
  position: static;
  flex-shrink: 0;
  font-size: 16px;
  opacity: 0.72;
}
.secret-shared-memo-del {
  font-size: 15px;
}

.secret-heart-day {
  margin: 10px 2px 16px;
  border-radius: 14px;
  background: rgba(255,252,245,0.7);
  border: 1px solid rgba(0,0,0,0.05);
  overflow: hidden;
}
.secret-heart-day-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.secret-heart-day-body {
  position: relative;
  min-height: 88px;
  padding: 8px 14px 20px;
}
.secret-heart-scribble {
  position: relative;
  display: inline-block;
  max-width: 86%;
  margin: 6px 4px;
  padding: 10px 28px 10px 12px;
  border-radius: 4px 12px 10px 8px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(0,0,0,0.05);
  font-size: 13px;
  line-height: 1.55;
  color: #3a3228;
  font-family: 'Noto Serif SC', serif;
  box-shadow: 1px 2px 8px rgba(0,0,0,0.04);
}
.secret-heart-scribble .secret-todo-del {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 15px;
}

/* ===== 共享备忘录 ===== */
.secret-page-scroll {
  padding: 16px 12px 28px;
}
.secret-edit-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 24px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.secret-edit-field {
  background: rgba(255,255,255,0.42) !important;
  border-color: rgba(120,90,55,0.12) !important;
  font-family: 'Noto Serif SC', serif;
}
.secret-edit-textarea {
  flex: 1;
  min-height: 42vh;
  resize: none !important;
  font-size: 15px !important;
  line-height: 1.9 !important;
  font-family: 'Noto Serif SC', serif !important;
  background: rgba(255,255,255,0.28) !important;
  color: var(--diary-text-color, #3a3228) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
.secret-visible-wrap { margin-top: 6px; }
.secret-visible-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: .4px;
}
.secret-visible-chars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.secret-paper-scope-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(120,90,55,0.06);
  border: 1px dashed rgba(120,90,55,0.18);
  line-height: 1.5;
}
.secret-flip-content {
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
  font-family: 'Noto Serif SC', serif;
}
.secret-peek-traces { margin-top: 16px; padding-bottom: 8px; }
.secret-peek-heading {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.secret-peek-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
  overflow: hidden;
}
.secret-peek-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.secret-peek-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.secret-peek-avatar-fallback {
  background: var(--theme-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.secret-peek-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.secret-peek-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 6px;
}
.secret-peek-note {
  background: rgba(255,255,255,0.55);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
html[data-color-scheme="dark"] .secret-peek-note {
  background: rgba(255,255,255,0.08);
}
.secret-peek-note-label {
  font-size: 11px;
  color: var(--theme);
  margin-bottom: 4px;
}
.secret-peek-note-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.7;
  font-style: italic;
}
.secret-peek-save { font-size: 12px; }
.secret-flip-body {
  padding: 0 !important;
  position: relative;
  z-index: 1;
}

.shared-memo-paper-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  height: 100%;
  border-radius: 2px 10px 8px 2px;
  background: #f7f3ea;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.65) inset,
    0 10px 28px rgba(60,40,20,0.12),
    0 2px 6px rgba(60,40,20,0.06);
  overflow: hidden;
}
/* 随手记：与私密笔记相同，左右切片翻页 */
.shared-memo-paper-sheet .secret-page-clip {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.shared-memo-paper-sheet .secret-page-inner {
  will-change: transform;
  position: relative;
}
.shared-memo-paper-body {
  padding: 18px 18px 28px;
  display: block;
  overflow: visible;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.shared-memo-inline-composer {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(120,90,55,0.12);
  box-shadow: 0 4px 14px rgba(60,40,20,0.06);
}
.shared-memo-inline-input {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  line-height: 1.65;
  color: #3a3228;
  font-family: inherit;
}
.shared-memo-inline-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.shared-memo-inline-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.sm-mark-toolbar {
  position: absolute;
  z-index: 30;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(40,32,28,0.94);
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
  max-width: calc(100% - 16px);
}
.sm-mark-toolbar-hint {
  font-size: 11px;
  color: rgba(245,239,230,0.72);
  padding: 2px 6px 4px;
  line-height: 1.3;
}
.sm-mark-toolbar-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.sm-mark-toolbar button {
  border: none;
  background: transparent;
  color: #f5efe6;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.sm-mark-toolbar button:active {
  background: rgba(255,255,255,0.12);
}
.sm-mark-toolbar-btns button.active {
  background: color-mix(in srgb, var(--theme) 55%, transparent);
}
.sm-mark-confirm {
  margin-top: 2px;
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  background: var(--theme, #c9a0dc);
  color: #fff;
}
.sm-mark {
  position: relative;
  display: inline;
  --sm-mark-color: #c45c5c;
}
.sm-mark-circle {
  border: 1.5px solid var(--sm-mark-color);
  border-radius: 45% 55% 50% 50% / 55% 45% 55% 45%;
  padding: 0 0.12em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transform: rotate(-1.5deg);
}
.sm-mark-strike {
  text-decoration: line-through;
  text-decoration-color: var(--sm-mark-color);
  text-decoration-thickness: 2px;
}
.sm-mark-line {
  border-bottom: 2px solid var(--sm-mark-color);
  padding-bottom: 1px;
}
.sm-mark-note {
  border-bottom: 1.5px dashed var(--sm-mark-color);
}
.sm-mark.has-callout {
  display: inline-block;
  position: relative;
  padding-top: 0.15em;
  vertical-align: baseline;
}
/* 旁注：首行/末行或短文不画引线；多行中间才 has-leader 拉出去 */
.sm-mark-callout {
  position: absolute;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: min(11em, 46vw);
  pointer-events: none;
  font-family: inherit;
  gap: 1px;
}
.sm-mark-callout-above {
  bottom: calc(100% + 1px);
  transform: translateX(-50%);
}
.sm-mark-callout-below {
  top: calc(100% + 1px);
  transform: translateX(-50%);
}
.sm-mark-callout-side {
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  flex-direction: row;
  align-items: center;
  gap: 2px;
}
.sm-mark-callout.no-leader {
  gap: 0;
}
/* 直线引线（仅 has-leader） */
.sm-mark-callout-line {
  display: block;
  flex-shrink: 0;
  opacity: 0.8;
}
.sm-mark-line-straight {
  width: 1.5px;
  height: 0.72em;
  background: var(--sm-mark-color);
  border-radius: 1px;
}
.sm-mark-callout-side .sm-mark-line-straight {
  width: 0.65em;
  height: 1.5px;
}
.sm-mark-line-dots {
  width: 5px;
  height: 0.9em;
  background:
    radial-gradient(circle closest-side, var(--sm-mark-color) 55%, transparent 56%)
    50% 0 / 5px 5px repeat-y;
}
.sm-mark-callout-side .sm-mark-line-dots {
  width: 0.85em;
  height: 5px;
  background:
    radial-gradient(circle closest-side, var(--sm-mark-color) 55%, transparent 56%)
    0 50% / 5px 5px repeat-x;
}
.sm-mark-line-wavy {
  width: 7px;
  height: 0.95em;
  border-left: 1.6px dashed var(--sm-mark-color);
  border-radius: 60% 40%;
  transform: rotate(-12deg);
  box-sizing: border-box;
}
.sm-mark-callout-side .sm-mark-line-wavy {
  width: 0.9em;
  height: 7px;
  border-left: none;
  border-top: 1.6px dashed var(--sm-mark-color);
  transform: rotate(-6deg);
}
.sm-mark-note-text {
  display: block;
  font-size: 0.78em;
  font-family: inherit;
  color: var(--sm-mark-color);
  opacity: 0.92;
  line-height: 1.25;
  text-align: center;
  transform: rotate(var(--sm-tilt, -3deg));
  white-space: normal;
  word-break: break-word;
  padding: 0 1px;
}
.sm-mark-callout-side .sm-mark-note-text {
  text-align: left;
  max-width: 7.5em;
}
/* 有引线（中间行）多留一点空；无引线只略抬一点 */
.shared-memo-flow:has(.sm-mark-callout.has-leader.sm-mark-callout-above),
.shared-memo-flow:has(.sm-mark-callout.has-leader.sm-mark-callout-below) {
  line-height: 2.15;
}
.shared-memo-entry-block:has(.sm-mark-callout.has-leader.sm-mark-callout-above),
.shared-memo-entry-block:has(.sm-mark-callout.no-leader.sm-mark-callout-above) {
  margin-top: 0.7em;
}
.shared-memo-entry-block:has(.sm-mark-callout.has-leader.sm-mark-callout-below),
.shared-memo-entry-block:has(.sm-mark-callout.no-leader.sm-mark-callout-below) {
  margin-bottom: 0.7em;
}
.secret-paper-size-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.secret-paper-size-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.secret-paper-size-label input[type="range"] {
  flex: 1;
}
.secret-paper-mark-colors {
  flex-wrap: wrap;
}

.shared-memo-hero {
  margin: 0 0 18px;
  padding: 18px 16px 14px;
  position: relative;
  background:
    linear-gradient(135deg, rgba(255,252,245,0.95), rgba(248,240,228,0.88));
  border: none;
  border-radius: 2px 12px 4px 10px;
  box-shadow:
    1px 2px 0 rgba(90,60,30,0.06),
    0 8px 22px rgba(90,60,30,0.08);
  transform: rotate(-0.6deg);
}
.shared-memo-hero::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 18%;
  width: 64px;
  height: 18px;
  background: rgba(220, 190, 120, 0.45);
  transform: rotate(-4deg);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(90,60,30,0.12);
}
.shared-memo-hero-title {
  font-family: 'Noto Serif SC', 'PingFang SC', serif;
  font-size: 24px;
  line-height: 1.35;
  color: #3a3228;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.shared-memo-hero-desc {
  margin-top: 6px;
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-size: 13px;
  color: #8a7460;
  line-height: 1.45;
  opacity: 0.92;
}
.shared-memo-section .empty-state {
  padding: 28px 12px 40px;
}
.shared-memo-section .empty-text {
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: #6a5a48;
}
.shared-memo-section .empty-icon {
  font-size: 36px;
  opacity: 0.7;
  margin-bottom: 8px;
}

/* 列表：撕下来的便签条，不必对齐 */
.shared-memo-day-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0 0 14px;
  border-radius: 3px 10px 6px 8px;
  background: #fffaf1;
  border: 1px solid rgba(120,90,55,0.14);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.7) inset,
    2px 3px 10px rgba(90,60,30,0.08);
  overflow: visible;
  position: relative;
}
.shared-memo-day-card:nth-child(odd) { transform: rotate(-0.8deg); }
.shared-memo-day-card:nth-child(even) { transform: rotate(0.55deg); margin-left: 6px; margin-right: 2px; }
.shared-memo-day-card:nth-child(3n) { transform: rotate(0.35deg); margin-left: -2px; }
.shared-memo-day-card::after {
  content: '';
  position: absolute;
  top: -6px;
  right: 22%;
  width: 42px;
  height: 14px;
  background: rgba(180, 210, 200, 0.5);
  transform: rotate(3deg);
  border-radius: 1px;
  pointer-events: none;
}
.shared-memo-day-card:nth-child(even)::after {
  left: 16%;
  right: auto;
  background: rgba(230, 190, 170, 0.48);
  transform: rotate(-5deg);
}
.shared-memo-day-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 14px 12px 12px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 2px 10px;
  align-items: start;
}
.shared-memo-day-main:active { background: rgba(120,90,55,0.05); }
.shared-memo-day-date {
  font-family: 'Noto Serif SC', 'PingFang SC', serif;
  font-size: 22px;
  color: #3a3228;
  grid-column: 1;
  line-height: 1.1;
}
.shared-memo-day-meta {
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-size: 12px;
  color: #9a8874;
  grid-column: 1;
  margin-top: 0;
}
.shared-memo-day-preview {
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-size: 14px;
  color: #5a4a3a;
  margin-top: 4px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  grid-column: 1;
  opacity: 0.92;
}
.shared-memo-day-thumb {
  grid-column: 2;
  grid-row: 1 / span 3;
  width: 56px;
  height: 68px;
  object-fit: cover;
  border-radius: 2px;
  background: #efe6d8;
  box-shadow: 0 1px 3px rgba(90,60,30,0.18);
  transform: rotate(3deg);
  align-self: center;
}
.shared-memo-day-del {
  width: 40px;
  border: none;
  border-left: 1px dashed rgba(120,90,55,0.18);
  background: transparent;
  color: #c9564f;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.75;
}
.shared-memo-day-del:active { background: rgba(229,115,115,0.12); }

.shared-memo-edit-media {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 4px 12px 8px 6px;
  background: rgba(255,252,245,0.55);
  border: 1px dashed rgba(120,90,55,0.22);
}
.shared-memo-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.shared-memo-tool-btn {
  width: 40px;
  height: 36px;
  border-radius: 8px;
  border: 1px dashed rgba(120,90,55,0.28);
  background: rgba(120,90,55,0.06);
  cursor: pointer;
  font-size: 16px;
  box-shadow: none;
  transition: transform .15s, background .15s;
}
.shared-memo-tool-btn:hover { background: var(--theme-light); }
.shared-memo-tool-btn:active { transform: scale(0.92); }
.shared-memo-tool-hint {
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-size: 13px;
  color: #9a8874;
}

/* 同日一页：像一张纸上接着写 */
.shared-memo-day-page {
  display: flex;
  flex-direction: column;
  gap: 1.15em;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 4px 2px 16px;
}
.shared-memo-entry-block {
  font-size: inherit;
  line-height: 1.7;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 94%;
  box-sizing: border-box;
  position: relative;
  padding: 2px 2px 6px;
  transform: none;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}
.shared-memo-entry-block.is-marking {
  outline: 1.5px dashed color-mix(in srgb, var(--theme) 55%, transparent);
  outline-offset: 4px;
  border-radius: 6px;
}
.shared-memo-flow {
  display: inline;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}
.shared-memo-entry-block.is-user {
  align-self: flex-start;
  margin-left: 0;
  margin-right: 8%;
}
/* 主动随写：顶格写自己的一段，不后移 */
.shared-memo-entry-block.is-ai.is-ai-proactive {
  align-self: flex-start;
  margin-left: 0;
  margin-right: 6%;
  text-align: left;
  max-width: 96%;
}
/* 跟写：略缩进，和主动碎碎念区分开 */
.shared-memo-entry-block.is-ai.is-ai-react {
  align-self: flex-start;
  margin-left: 1.35em;
  margin-right: 4%;
  text-align: left;
  max-width: 90%;
}
.shared-memo-entry-block.is-ai {
  text-align: left;
}
.shared-memo-entry-who {
  display: block;
  font-family: inherit;
  font-size: 0.72em;
  opacity: 0.55;
  margin-bottom: 0.15em;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.shared-memo-inline-emoji {
  display: inline;
  height: 1.85em;
  width: auto;
  max-width: 2.6em;
  vertical-align: -0.4em;
  object-fit: contain;
  margin: 0 0.14em;
}
.shared-memo-tap-to-write {
  cursor: pointer;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}
.shared-memo-tap-hint {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 12px 8px 4px;
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-size: 13px;
  opacity: 0.45;
  border: none;
  border-top: 1px dashed currentColor;
  text-align: center;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.shared-memo-page-media-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 2px;
}
.shared-memo-polaroid {
  display: inline-block;
  padding: 8px 8px 22px;
  background: #fffef9;
  box-shadow:
    0 1px 2px rgba(90,60,30,0.12),
    0 6px 16px rgba(90,60,30,0.1);
  max-width: min(72vw, 240px);
  transform: rotate(-1.5deg);
}
.shared-memo-entry-block.is-ai .shared-memo-polaroid {
  transform: rotate(2deg);
}
.shared-memo-entry-block:nth-child(3n) .shared-memo-polaroid {
  transform: rotate(1.2deg);
}
.shared-memo-entry-block:nth-child(4n) .shared-memo-polaroid {
  transform: rotate(-2.4deg);
}
.shared-memo-page-media {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 240px);
  max-height: min(320px, 52vh);
  border-radius: 1px;
  object-fit: contain;
  cursor: pointer;
  background: #efe6d8;
}
.shared-memo-draft {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}
.shared-memo-chip {
  position: relative;
  display: inline-block;
}
.shared-memo-chip img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(90,60,30,0.15);
  transform: rotate(-2deg);
}
.shared-memo-chip button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.shared-memo-emoji-pick-btn {
  border: none;
  background: transparent;
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
}
.shared-memo-emoji-pick-btn img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
.shared-memo-emoji-pick-btn:hover {
  background: rgba(255,255,255,0.08);
}

/* ===== 共同清单（游戏大厅） ===== */
.shared-list-empty {
  text-align: center;
  padding: 52px 24px;
  color: var(--text-secondary);
}
.shared-list-empty-icon { font-size: 40px; margin-bottom: 12px; }
.shared-list-empty-title { font-size: 15px; color: var(--text-primary); margin-bottom: 8px; }
.shared-list-empty-hint { font-size: 12px; line-height: 1.65; }
.shared-list-stats {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px 4px 6px;
}
.shared-list-stats b { color: var(--theme); font-weight: 600; }
.shared-list-draw-banner {
  margin: 8px 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(201,160,220,0.22), rgba(116,185,255,0.12));
  border: 1px solid rgba(201,160,220,0.35);
  text-align: center;
}
.shared-list-draw-label { font-size: 12px; color: var(--theme); margin-bottom: 6px; }
.shared-list-draw-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Noto Serif SC', serif;
}
.shared-list-draw-meta { font-size: 11px; color: var(--text-secondary); margin: 6px 0 10px; }
.shared-list-section-label {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  padding: 8px 2px 6px;
}
.shared-list-section-done { margin-top: 8px; opacity: 0.85; }
.shared-list-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 10px 12px 12px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.42);
  border: 1px solid rgba(0,0,0,0.05);
  border-left: 4px solid var(--list-tint, var(--theme));
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
  position: relative;
}
.shared-list-card.is-drawn {
  box-shadow: 0 0 0 2px rgba(201,160,220,0.35);
}
.shared-list-card.is-done {
  opacity: 0.72;
  border-left-color: var(--border);
}
.shared-list-check {
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shared-list-card.is-done .shared-list-check {
  border-color: var(--theme);
  background: var(--theme);
}
.shared-list-card-main { flex: 1; min-width: 0; }
.shared-list-card-head.is-clickable { cursor: pointer; }
.shared-list-card-title {
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  font-family: 'Noto Serif SC', serif;
  word-break: break-word;
}
.shared-list-card.is-done .shared-list-card-title {
  text-decoration: line-through;
  color: var(--text-secondary);
}
.shared-list-card-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.shared-list-chevron {
  display: inline-block;
  transition: transform 0.2s;
  margin-left: auto;
}
.shared-list-chevron.open { transform: rotate(90deg); }
.shared-list-card-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.35);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
}
.shared-list-card-react {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--theme-dark, var(--theme));
  font-style: italic;
}
.shared-list-card .secret-todo-del {
  position: static;
  flex-shrink: 0;
}

/* ===== 自定义字体管理 ===== */
.custom-font-preview {
  padding: 16px 14px;
  min-height: 64px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 20px;
  line-height: 1.55;
  color: var(--text-primary);
  word-break: break-word;
}
.custom-font-browse {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.custom-font-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}
.custom-font-card.active {
  border-color: var(--theme);
  background: color-mix(in srgb, var(--theme) 18%, transparent);
}
.custom-font-card-name {
  font-size: 12px;
  opacity: 0.65;
  font-family: 'Noto Sans SC', sans-serif;
}
.custom-font-card-sample {
  font-size: 16px;
  line-height: 1.45;
}

