/* 小恪的手机：纸感底 + 像素画放肆。所有数值照 DESIGN.md，颜色只用变量，禁止 hex。 */

@import url("/fonts/wenkai.css");

/* ---------- 1. 配色（DESIGN.md §1，Flexoki） ---------- */

:root {
  --paper: #fffcf0;
  --base-50: #f2f0e5;
  --base-100: #e6e4d9;
  --base-150: #dad8ce;
  --base-400: #9f9d96;
  --base-600: #6f6e69;
  --ink: #100f0f;
  --orange: #bc5215;
  --orange-2: #da702c;
  --orange-50: #ffe7ce;
  --blue: #205ea6;
  --blue-50: #e1eceb;
  --green: #66800b;
  --red: #af3029;
  --shadow: 0 8px 24px rgba(16, 15, 15, 0.08);
  color-scheme: light;
}
/* 跟随系统：没有显式 data-theme 时才生效 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #1c1b1a;
    --base-50: #282726;
    --base-100: #343331;
    --base-150: #403e3c;
    --base-400: #6f6e69;
    --base-600: #878580;
    --ink: #cecdc3;
    --orange: #da702c;
    --orange-2: #da702c;
    --orange-50: #3d2a1a;
    --blue: #4385be;
    --blue-50: #1f2d3a;
    --green: #879a39;
    --red: #d14d41;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
/* 固定选「夜」 */
:root[data-theme="dark"] {
  --paper: #1c1b1a;
  --base-50: #282726;
  --base-100: #343331;
  --base-150: #403e3c;
  --base-400: #6f6e69;
  --base-600: #878580;
  --ink: #cecdc3;
  --orange: #da702c;
  --orange-2: #da702c;
  --orange-50: #3d2a1a;
  --blue: #4385be;
  --blue-50: #1f2d3a;
  --green: #879a39;
  --red: #d14d41;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
/* 固定选「纸」：data-theme="light" 不加任何覆盖，直接落回 :root 的亮色默认值 */

/* ---------- 2. 字体 ---------- */

:root {
  --font-serif: "LXGW WenKai", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-sans: -apple-system, "PingFang SC", "Segoe UI", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- 5. 间距 / 6. 圆角 / 9. 动效 ---------- */

:root {
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  --ease-out: cubic-bezier(0, 0, 0.58, 1);
  --ease-in: cubic-bezier(0.42, 0, 1, 1);
  --dur-tap: 100ms;
  --dur-fade: 200ms;
  --dur-page: 260ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--base-50);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden; /* 页面本身永远不滚，壳比视口矮时整壳缩放，见 DESIGN.md §4 */
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}
button:disabled { cursor: default; opacity: 0.5; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}
/* 输入框聚焦不描边，只闪光标；Chrome 对文本框永远命中 :focus-visible，所以单独关掉（DESIGN.md §8 输入框） */
input, textarea {
  outline: none;
}

/* ---------- 4. 手机壳 ---------- */

#viewport {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--base-50);
}

.phone-shell {
  position: relative;
  width: 390px;
  height: 844px;
  border-radius: 54px;
  background: #1a1a1a;
  border: 2px solid #3a3a3a;
  padding: 10px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
  /* 视口比壳矮时整壳等比缩小，上下各留 20px；视口够高时 min(1, ...) 封顶在 1，不放大。
     DESIGN.md §4：视口高 < 884（844 + 40）时生效 */
  transform: scale(min(1, calc((100vh - 40px) / 844px)));
  transform-origin: center;
}

.screen {
  position: relative;
  width: 370px;
  height: 824px;
  border-radius: 44px;
  background: var(--paper);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dynamic-island {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 37px;
  background: #1a1a1a;
  border-radius: var(--r-full);
  z-index: 20;
}

.status-bar {
  position: relative;
  flex: 0 0 54px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 24px 8px;
  z-index: 10;
  background: transparent;
  transition: background-color var(--dur-fade);
}
.status-time {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  transition: color var(--dur-fade);
}
.status-battery {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.battery-shell {
  position: relative;
  width: 22px;
  height: 11px;
  border: 1.3px solid var(--ink);
  border-radius: 3px;
  opacity: 0.9;
  transition: border-color var(--dur-fade);
}
.battery-shell::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 3px;
  width: 1.5px;
  height: 5px;
  background: var(--ink);
  border-radius: 0 1px 1px 0;
  transition: background-color var(--dur-fade);
}
.battery-fill {
  position: absolute;
  top: 1.3px;
  left: 1.3px;
  bottom: 1.3px;
  width: 70%;
  background: var(--ink);
  border-radius: 1.5px;
  transition: background-color var(--dur-fade);
}

/* 相册大图查看器打开时：状态栏跟着"全屏黑底"一起变，时间/电池换成固定的浅色（不是 --paper，
   暗色主题下 --paper 是深色，套在黑底上会看不见——跟查看器 caption 用字面 #fffcf0 是同一个道理） */
.screen.photo-viewing .status-bar { background: #000; }
.screen.photo-viewing .status-time { color: #fffcf0; }
.screen.photo-viewing .battery-shell { border-color: #fffcf0; }
.screen.photo-viewing .battery-shell::after { background: #fffcf0; }
.screen.photo-viewing .battery-fill { background: #fffcf0; }

.home-indicator {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  border-radius: var(--r-full);
  background: var(--ink);
  opacity: 0.3;
  z-index: 20;
}

/* 手机（< 480px）：不画壳，内容铺满视口，用真实安全区 */
@media (max-width: 479px) {
  #viewport { min-height: 100dvh; padding: 0; }
  .phone-shell {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
    padding: 0;
    box-shadow: none;
    transform: none; /* 真手机不用缩放壳那一套 */
  }
  body { overflow: visible; } /* 真手机让浏览器自己管理滚动/地址栏收起 */
  .screen {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .dynamic-island, .status-bar, .home-indicator { display: none; }
  #app-pages {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ---------- 8. 组件：页面容器 / 导航栏 ---------- */

#app-pages {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* 底部安全区以前直接 padding 在这里给 Home 条让位；工单 08 加了常驻 tab 栏之后，
     safe-area 挪进了 .tab-bar 自己的 padding-bottom 里（tab 栏本身占位，不需要这里重复留白） */
}

.page {
  position: relative; /* 相册大图查看器 .photo-viewer 用 position:absolute 铺满整页，要靠这个当基准 */
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden; /* 壳内绝不允许横向滚动，见 DESIGN.md §4 */
  scrollbar-width: none; /* Firefox */
}
.page::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.page[hidden] { display: none; }

.navbar {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  padding: 0 var(--s5);
  gap: var(--s3);
}
/* 同 .navbar-back / .settings-row：这里也是作者 display:flex 盖过 UA 默认 [hidden]{display:none}；
   相册大图查看器要把整条 navbar 藏起来自己画透明导航，之前这个 hidden 其实一直没生效，顺手一起修了
   （查看器是 position:absolute 铺满 .page，navbar 让不让位不影响它，可以放心用 display:none） */
.navbar[hidden] { display: none; }
.navbar-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--base-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--base-600);
  flex-shrink: 0;
  transition: transform var(--dur-tap) var(--ease-out);
}
/* .navbar-back 自己的 display:flex 是作者样式，会盖过浏览器默认的 [hidden]{display:none}（UA 样式优先级最低）；
   工单 08：相册变成 tab 根页后网格状态不需要返回箭头，用 visibility 占位不占布局重排，标题位置跟其它页一致 */
.navbar-back[hidden] { visibility: hidden; }
.navbar-back:active { transform: scale(0.97); }
.navbar-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 17px;
  color: var(--ink);
  opacity: 0;
  transition: opacity var(--dur-fade);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navbar-title.show { opacity: 1; }
.navbar-title[hidden] { display: block; } /* 用 opacity 控制显隐，hidden 属性只用来占位不挡交互 */

.navbar-action {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--base-600);
  transition: transform var(--dur-tap) var(--ease-out);
}
.navbar-action:active { transform: scale(0.97); }
.navbar-action svg { width: 22px; height: 22px; }
.navbar-action[hidden] { display: flex; visibility: hidden; } /* 占位保持居中，不参与布局塌陷 */

.navbar.scrolled { box-shadow: inset 0 -1px 0 var(--base-100); }

.large-title {
  flex-shrink: 0;
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1.2;
  padding: 4px var(--s5) var(--s3);
  margin: 0;
  transition: opacity var(--dur-fade);
}

.page-placeholder-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--base-600);
  font-size: 15px;
  font-family: var(--font-sans);
  padding: 0 var(--s5);
  text-align: center;
}

/* ---------- 主屏（工单 08 重做：日期电池 + 天气 + 壁纸区 + 健康条/心率线） ---------- */

.page-home {
  padding: var(--s4) var(--s5) var(--s3);
  gap: var(--s3);
  overflow: hidden; /* 主屏不滚动，DESIGN.md §8 */
}

.home-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.home-date-row {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--base-600);
  padding-top: 10px; /* 跟右边 44 触控的齿轮视觉对齐 */
}
.home-battery[hidden] { display: none; } /* 拿不到电池信息整段不显示，不留 "--" */
.home-gear {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--base-600);
  transition: transform var(--dur-tap) var(--ease-out);
}
.home-gear:active { transform: scale(0.94); }
.home-gear svg { width: 22px; height: 22px; }

.home-weather {
  align-self: flex-start;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--base-600);
  padding: 2px 0;
}
.home-weather:active { opacity: 0.6; }

.home-wallpaper {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.home-wallpaper-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.home-wallpaper-overlay {
  position: absolute;
  inset: 0;
  /* 图片背景上盖一层纸色让字能读，DESIGN.md §8 主屏；用 color-mix 从变量派生，不写死 hex */
  background: color-mix(in srgb, var(--paper) 25%, transparent);
}
.rain-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.home-health {
  flex-shrink: 0;
  margin-bottom: 12px; /* 健康条压在 tab 栏上方 12px，DESIGN.md §8 */
}
.home-health-text {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--ink);
}
.heartbeat-canvas {
  width: 100%;
  height: 48px;
  display: block;
  margin-top: var(--s1);
}

/* ---------- 底部 tab 栏（DESIGN.md §8，所有页面都有） ---------- */

.tab-bar {
  position: relative;
  flex: 0 0 90px; /* 56 视觉高 + 34 下安全区 */
  padding-bottom: 34px;
  display: flex;
  align-items: stretch;
  z-index: 15;
}
/* 背景 + 缺口单独一层：mask 只裁这一层，不会连 Home 键一起挖掉（Home 键是 .tab-bar 的另一个子元素） */
.tab-bar-bg {
  position: absolute;
  inset: 0;
  z-index: -1; /* 绝对定位默认 z-index:auto 会盖在静态定位的 tab-item/tab-home 上面，得手动压到它们下面 */
  background: var(--paper);
  border-top: 1px solid var(--base-100);
  /* 中间挖一个跟 Home 键同心的半圆缺口：键中心在栏顶下 12px，半径比键大 2px 留一圈缝隙 */
  /* mask 里的 black 不是真的画黑色，是"完全不透明"的意思（跟 transparent 相对），不算组件写 hex */
  -webkit-mask-image: radial-gradient(circle 34px at 50% 12px, transparent 33px, black 35px);
  mask-image: radial-gradient(circle 34px at 50% 12px, transparent 33px, black 35px);
}
.screen.photo-viewing .tab-bar { display: none; } /* 大图查看器全屏黑底时不画 tab 栏，见工单 08 实施记录 */

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--base-400);
}
.tab-item.active { color: var(--orange); }
.tab-icon { width: 32px; height: 32px; display: block; }
.tab-icon svg { width: 100%; height: 100%; display: block; }
.tab-label {
  font-family: var(--font-sans);
  font-size: 11px;
}

.tab-home {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  margin-top: -20px; /* 凸出 tab 栏上沿 20px */
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--base-100);
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
}
.tab-home.online {
  border-color: var(--green);
  animation: home-breathe 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .tab-home.online { animation: none; }
}
@keyframes home-breathe {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 22%, transparent); }
}
.tab-home-face { width: 32px; height: 32px; display: block; }
.tab-home-face svg { width: 100%; height: 100%; display: block; }

/* ---------- 头像（DESIGN.md §8）：朋友圈、消息列表的头像用，主屏小组件删掉了但这几档还在用 ---------- */

.avatar {
  position: relative;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--base-100);
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar svg { display: block; }
.avatar-40 { width: 40px; height: 40px; }
.avatar-40 svg { width: 30px; height: 30px; }
.avatar-32 { width: 32px; height: 32px; }
.avatar-32 svg { width: 24px; height: 24px; }

/* ---------- apps 抽屉：4 列图标网格（复用主屏原来的 App 图标格子样式） ---------- */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s4) var(--s2);
  padding: 0 var(--s5);
}
.app-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  width: 60px;
}
.app-icon {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: var(--base-50);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-tap) var(--ease-out);
}
.app-icon svg { width: 48px; height: 48px; display: block; }
.app-icon-btn:active .app-icon { transform: scale(0.94); }
.app-icon-label {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--base-600);
}
.app-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--orange);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-badge[hidden] { display: none; }

/* ---------- App 切换：主屏 <-> App，scale + opacity ---------- */

#app-pages { view-transition-name: app-pages; }
::view-transition-old(app-pages), ::view-transition-new(app-pages) {
  animation-duration: var(--dur-page);
  animation-timing-function: var(--ease-out);
}
@keyframes page-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes page-out { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.92); } }
.vt-enter-app::view-transition-new(app-pages) { animation-name: page-in; }
.vt-enter-app::view-transition-old(app-pages) { animation: none; }
.vt-enter-home::view-transition-old(app-pages) { animation-name: page-out; }
.vt-enter-home::view-transition-new(app-pages) { animation: none; }

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

/* ---------- 设置页 ---------- */

.settings-group {
  flex-shrink: 0; /* .page 是 flex column + overflow-y:auto，没这行的话内容一多就会被 flex 算法压扁，
                      压扁的部分正好被 overflow:hidden 切掉（工单 08 加了两个组之后才暴露，见实施记录） */
  margin: 0 var(--s5) var(--s6);
  background: var(--base-50);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.settings-row {
  width: 100%; /* <button> 默认走表单控件的内在尺寸算法，不会像 <div> 一样自动撑满父容器宽度，得手动补上 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: var(--s3) var(--s4);
  font-family: var(--font-sans);
  font-size: 15px;
  text-align: left;
}
.settings-row + .settings-row { border-top: 1px solid var(--base-100); }
/* 同 .navbar-back：.settings-row 自己的 display:flex 会盖过 UA 默认的 [hidden]{display:none}，
   删除图片按钮平时要真的不占位（不是只隐身），补一条抢回来 */
.settings-row[hidden] { display: none; }
.settings-row-check {
  color: var(--orange);
  font-size: 15px;
}
.settings-row-value {
  color: var(--base-400);
  font-size: 13px;
  font-family: var(--font-sans);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.settings-row-danger { color: var(--red); }
.settings-group-title {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--base-600);
  margin: 0 var(--s5) var(--s2);
}

/* ---------- 头像三个上传位（工单 13：群聊） ---------- */

.settings-avatar-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 44px;
  padding: var(--s3) var(--s4);
}
.settings-avatar-row + .settings-avatar-row { border-top: 1px solid var(--base-100); }
.settings-avatar-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--base-100);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.settings-avatar-label { flex: 1; font-family: var(--font-sans); font-size: 15px; }
.settings-avatar-upload-btn {
  color: var(--orange);
  font-family: var(--font-sans);
  font-size: 14px;
  height: 36px;
  padding: 0 var(--s3);
}

/* ---------- Toast ---------- */

.toast {
  position: absolute; /* 相对 .screen，不是 fixed 相对整个浏览器窗口——桌面上壳是居中的一小块 */
  left: 50%;
  top: calc(54px + var(--s3));
  transform: translateX(-50%);
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: var(--s2) var(--s4);
  border-radius: var(--r-full);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fade);
}
.toast.show { opacity: 1; }

/* ---------- 按钮（登录页、设置页会用到） ---------- */

.btn-primary {
  background: var(--orange);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  height: 44px;
  border-radius: var(--r-full);
  padding: 0 var(--s5);
  transition: transform var(--dur-tap) var(--ease-out);
}
.btn-primary:active { transform: scale(0.97); }

.btn-text {
  color: var(--orange);
  font-family: var(--font-sans);
  font-size: 15px;
  height: 44px;
  padding: 0 var(--s2);
}
.btn-text:active { opacity: 0.6; }

/* ---------- 动态（朋友圈） ---------- */

.feed-list { padding-bottom: var(--s4); }

.moment {
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--base-100);
}
.moment:last-child { border-bottom: none; }
.moment.highlight { animation: highlight-fade 600ms ease-out; }
@keyframes highlight-fade {
  from { background-color: var(--orange-50); }
  to { background-color: transparent; }
}

.moment-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
}
.moment-main { min-width: 0; flex: 1; }
.moment-name {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.4;
}
.moment-name.author-ai { color: var(--orange); }
.moment-name.author-user { color: var(--blue); }

.moment-body {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 2px;
}
.moment-body.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.moment-expand {
  display: flex; /* 触控区 44 高，但文字贴着正文顶部，视觉上不留大缝 */
  align-items: flex-start;
  width: 100%;
  color: var(--orange);
  font-family: var(--font-sans);
  font-size: 15px; /* callout */
  min-height: 44px;
  margin-top: 2px;
  padding: 0;
  text-align: left;
}
.moment-expand[hidden] { display: none; } /* display:flex 会盖掉 UA 的 [hidden]，要手动补回去 */

.moment-photos {
  margin-top: var(--s3);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.moment-photos.single { display: block; }
.moment-photos.single .moment-photo {
  width: 240px;
  max-height: 320px;
  overflow: hidden;
  border-radius: var(--r-sm);
}
.moment-photos.single .moment-photo img { width: 100%; height: auto; display: block; }
/* 3 列等分跟着内容列宽走，不定死 96px——定死会在窄内容列里溢出（DESIGN.md §8 动态） */
.moment-photos.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.moment-photos.grid .moment-photo { width: 100%; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; }
.moment-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.moment-meta {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s2);
}
.moment-time {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--base-400);
  flex: 1;
}
.moment-more {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--base-600);
  border-radius: 50%;
  transition: background-color var(--dur-tap);
}
.moment-more:active { background: var(--base-50); }
.moment-more svg { width: 18px; height: 18px; }

.moment-quick-actions {
  display: flex;
  gap: var(--s4);
  margin-top: var(--s2);
}
.moment-quick-actions[hidden] { display: none; }
.moment-quick-actions button {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--base-600);
  display: flex;
  align-items: center;
  gap: 4px;
}
.moment-quick-actions button.liked { color: var(--orange); }
.moment-quick-actions svg { width: 15px; height: 15px; }

.moment-interact {
  margin-top: var(--s2);
  background: var(--base-50);
  border-radius: var(--r-md);
  padding: var(--s2) var(--s3);
}
.moment-likes {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
}
.moment-likes svg { width: 14px; height: 14px; color: var(--orange); flex-shrink: 0; }
.moment-likes .like-name { font-family: var(--font-serif); }
.moment-likes .like-name.author-ai { color: var(--orange); }
.moment-likes .like-name.author-user { color: var(--blue); }
.moment-divider { height: 1px; background: var(--base-100); margin: var(--s2) 0; }
.moment-comment {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  padding: 3px 0;
}
.moment-comment .c-name { color: var(--ink); }
.moment-comment .c-name.author-ai { color: var(--orange); }
.moment-comment .c-name.author-user { color: var(--blue); }
.moment-comment .c-reply-to { color: var(--base-600); }

.moment-detail-body { padding: var(--s4) var(--s5) var(--s10); }
.moment-detail-comments { padding: 0 var(--s5) 160px; } /* 常驻评论条 + tab 栏都在底部悬浮，留够空间 */
.moment-detail-comments-title {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--base-600);
  margin: var(--s4) 0 var(--s3);
}
.moment-detail-comment-row {
  display: flex;
  gap: var(--s3);
  padding: var(--s2) 0;
  align-items: flex-start;
}
.moment-detail-comment-row .comment-text {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
}
.moment-detail-comment-row .c-name { color: var(--ink); }
.moment-detail-comment-row .c-name.author-ai { color: var(--orange); }
.moment-detail-comment-row .c-name.author-user { color: var(--blue); }
.moment-detail-comment-row .c-time { color: var(--base-400); font-size: 12px; font-family: var(--font-sans); margin-left: 6px; }

/* ---------- 空状态 / 骨架屏 ---------- */

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  padding: var(--s10) var(--s5);
  text-align: center;
}
.empty-state-title {
  font-family: var(--font-serif);
  font-size: 22px;
}
.empty-state svg, .empty-state .avatar { width: 64px; height: 64px; }

.skeleton-moment { padding: var(--s4) var(--s5); }
.skeleton-block { background: var(--base-150); border-radius: var(--r-sm); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-line { height: 14px; border-radius: var(--r-sm); margin-top: var(--s2); }

/* ---------- Sheet / 遮罩 / 动作单 ---------- */

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(16, 15, 15, 0.3);
  z-index: 40;
  opacity: 0;
  transition: opacity var(--dur-page) var(--ease-out);
}
.scrim.show { opacity: 1; }
.scrim[hidden] { display: block; visibility: hidden; opacity: 0; } /* 淡出时先摘 hidden 再等 transition，用 visibility 避免闪烁 */

.sheet, .action-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow);
  max-height: 90%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  transform: translateY(100%);
  transition: transform var(--dur-page) var(--ease-out);
}
.sheet.show, .action-sheet.show { transform: translateY(0); }
.sheet[hidden], .action-sheet[hidden] { display: block; visibility: hidden; transform: translateY(100%); }
.sheet::-webkit-scrollbar, .action-sheet::-webkit-scrollbar { display: none; }

.sheet-handle {
  width: 36px;
  height: 5px;
  border-radius: var(--r-full);
  background: var(--base-150);
  margin: var(--s2) auto 0;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s2) var(--s4) var(--s2) var(--s3);
}
.sheet-text-btn {
  color: var(--orange);
  font-family: var(--font-sans);
  font-size: 15px;
  height: 44px;
  padding: 0 var(--s2);
}
.sheet-primary-btn { height: 36px; font-size: 14px; padding: 0 var(--s4); }
.sheet-body { padding: 0 var(--s5) var(--s5); }

.compose-textarea {
  width: 100%;
  min-height: 88px;
  resize: none;
}
.compose-photo-grid {
  margin-top: var(--s3);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s2);
}
.compose-photo-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--base-50);
}
.compose-photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.compose-photo-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(16, 15, 15, 0.45);
  border: 1.5px solid var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
}
.compose-photo-cell.picked .compose-photo-check { background: var(--orange); border-color: var(--paper); }
.compose-photo-cell.picked .compose-photo-check::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 1.5px solid var(--paper);
  border-bottom: 1.5px solid var(--paper);
  transform: rotate(-45deg) translate(1px, -1px);
}
.compose-photo-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--base-600);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: var(--s4) 0;
}

.action-sheet-item {
  display: block;
  width: 100%;
  text-align: center;
  height: 52px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  border-top: 1px solid var(--base-100);
}
.action-sheet-item:first-of-type { border-top: none; margin-top: var(--s2); }
.action-sheet-danger { color: var(--red); }

/* ---------- 评论输入条 ---------- */

.comment-composer {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(90px + 12px); /* 贴着 tab 栏上方 12px，tab 栏 90 = 56 视觉高 + 34 下安全区 */
  z-index: 30;
  height: 44px;
  background: var(--base-50);
  border-radius: var(--r-full);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 4px 0 var(--s4);
  transform: translateY(120%);
  transition: transform var(--dur-page) var(--ease-out);
}
.comment-composer.show { transform: translateY(0); }
.comment-composer[hidden] { display: flex; visibility: hidden; transform: translateY(120%); }
.comment-composer-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
  color: var(--ink);
}
.comment-composer-input::placeholder { color: var(--base-400); }
.comment-composer-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--dur-tap) var(--ease-out);
}
.comment-composer-send:active { transform: scale(0.94); }
.comment-composer-send svg { width: 18px; height: 18px; }

/* ---------- 通用文字输入 sheet（改说明、移到相册） ---------- */

.sheet-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 相册 ---------- */

.album-chips {
  display: flex;
  gap: var(--s2);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 var(--s5) var(--s4);
}
.album-chips::-webkit-scrollbar { display: none; }
.album-chip {
  flex-shrink: 0;
  height: 32px;
  padding: 0 var(--s4);
  border-radius: var(--r-full);
  background: var(--base-50);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.album-chip.active { background: var(--ink); color: var(--paper); }

/* 贴边铺满，3 列正方形，2px 间距，无圆角 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.photo-cell {
  position: relative;
  aspect-ratio: 1;
  background: var(--base-50);
  overflow: hidden;
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell.highlight { animation: highlight-fade 600ms ease-out; }
.photo-cell-uploading {
  position: absolute;
  inset: 0;
  /* --paper 60%，用 color-mix 直接从变量派生，不用另外写一份 hex（跟主题走，不用分亮暗两条规则） */
  background: color-mix(in srgb, var(--paper) 60%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--base-100);
  border-top-color: var(--orange);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 大图查看器：全屏黑底，两个主题都黑 ---------- */

.photo-viewer {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: #000;
  display: flex;
  flex-direction: column;
}
.photo-viewer-top {
  position: relative;
  z-index: 2;
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s4);
}
.photo-viewer-top button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fffcf0;
  font-size: 20px;
}
.photo-viewer-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  user-select: none;
}
.photo-viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.photo-viewer-caption {
  flex: 0 0 auto;
  min-height: 20px;
  padding: var(--s3) var(--s5) var(--s5);
  color: #fffcf0;
  font-family: var(--font-sans);
  font-size: 13px;
  text-align: center;
}

/* ---------- 消息（信箱） ---------- */

.messages-list { padding-bottom: 160px; } /* 给底部悬浮输入条 + tab 栏让位，别挡住最后一条 */

.message-row {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) var(--s5);
  border-left: 3px solid transparent;
}
.message-row + .message-row { border-top: 1px solid var(--base-100); }
.message-row.unread { border-left-color: var(--orange); border-radius: 0; }
.message-row.highlight { animation: highlight-fade 600ms ease-out; }
.message-main { min-width: 0; flex: 1; }
.message-name {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.4;
}
.message-name.author-ai { color: var(--orange); }
.message-name.author-user { color: var(--blue); }
.message-body {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.message-detail-body {
  padding: var(--s4) var(--s5) 160px;
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.message-time {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--base-400);
  margin-top: 4px;
}

.message-composer {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(90px + 12px); /* 贴着 tab 栏上方 12px，同 .comment-composer */
  z-index: 30;
  height: 44px;
  background: var(--base-50);
  border-radius: var(--r-full);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 4px 0 var(--s4);
}
.message-composer-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
  color: var(--ink);
}
.message-composer-input::placeholder { color: var(--base-400); }
.message-composer-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--dur-tap) var(--ease-out);
}
.message-composer-send:active { transform: scale(0.94); }
.message-composer-send svg { width: 18px; height: 18px; }

/* ---------- 读书入口 ---------- */

.reading-card {
  margin: var(--s3) var(--s5) 0;
  background: var(--base-50);
  border-radius: var(--r-lg);
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s3);
}
.reading-card-text {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0;
}

/* ---------- 空状态按钮复用 empty-state，相册专属文案走 JS ---------- */
