/* ==========================================================================
   Bunker 频道阅读器 · 设计系统
   --------------------------------------------------------------------------
   三档响应式: 桌面 ≥1280 三栏 / 平板 768-1279 单栏+抽屉 / 手机 <768 单栏+底栏
   零依赖，无构建步骤。
   ========================================================================== */

/* --- 设计令牌 --- */
:root {
  /* 背景层级 */
  --bg:            #0b0d10;
  --bg-elev:       #12151a;
  --bg-card:       #171b22;
  --bg-hover:      #1d222b;
  --bg-inset:      #0e1116;

  /* 描边 */
  --border:        #242a34;
  --border-soft:   #1b2028;
  --border-strong: #333c4a;

  /* 文字 */
  --text:          #e2e7ee;
  --text-mid:      #a8b2c1;
  --text-dim:      #78828f;
  --text-faint:    #525b68;

  /* 强调色: 掩体暖光 */
  --accent:        #d9a441;
  --accent-soft:   #3a2f18;
  --accent-text:   #f0c674;

  /* 功能色 */
  --link:          #6fb4dc;
  --link-hover:    #96cdec;
  --danger:        #d97070;
  --ok:            #6fbf8b;

  /* 尺寸 */
  --sidebar-w:     268px;
  --rail-w:        196px;
  --stream-max:    760px;
  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     16px;

  /* 排版 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
          "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.65);

  --ease: cubic-bezier(.32,.72,0,1);
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

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

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: #47515f; }

/* ==========================================================================
   应用骨架
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
  gap: 0;
  min-height: 100vh;
  max-width: 1560px;
  margin: 0 auto;
}

/* ==========================================================================
   左栏: 频道信息
   ========================================================================== */
.sidebar-left {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 16px 32px;
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.channel-card { display: flex; flex-direction: column; gap: 12px; }

.channel-avatar {
  width: 62px; height: 62px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  background: var(--bg-card);
}

.channel-title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.01em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.channel-title .verified {
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

.channel-handle {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
}

.channel-about {
  font-size: 13.5px;
  color: var(--text-mid);
  margin: 0;
}

.channel-stats {
  display: flex;
  gap: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.stat { display: flex; flex-direction: column; gap: 1px; }
.stat-num {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.stat-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }

/* --- 筛选 --- */
.filter-group { display: flex; flex-direction: column; gap: 3px; }

.filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 5px;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  width: 100%;
  font-size: 13.5px;
  color: var(--text-mid);
  transition: background .14s var(--ease), color .14s var(--ease);
}

.filter-btn:hover { background: var(--bg-hover); color: var(--text); }

.filter-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.filter-icon { width: 17px; text-align: center; flex-shrink: 0; opacity: .85; }
.filter-btn[aria-pressed="true"] .filter-icon { opacity: 1; }
.filter-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
}
.filter-btn[aria-pressed="true"] .filter-count { color: var(--accent); }

/* --- 左栏页脚 --- */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.7;
}
.sidebar-footer a { color: var(--text-dim); }
.sidebar-footer a:hover { color: var(--accent); }

/* ==========================================================================
   中栏: 消息流
   ========================================================================== */
.stream {
  min-width: 0;
  padding: 0 0 96px;
  display: flex;
  flex-direction: column;
}

.stream-inner {
  width: 100%;
  max-width: var(--stream-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* --- 顶部工具条 --- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  padding: 11px 20px;
}

.toolbar-inner {
  max-width: var(--stream-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
  font-size: 14px;
}

.search-input {
  width: 100%;
  padding: 8px 34px 8px 34px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}

.search-clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 2px 6px;
  color: var(--text-faint);
  font-size: 15px;
  border-radius: 4px;
  display: none;
}
.search-clear:hover { color: var(--text); background: var(--bg-hover); }
.search-wrap.has-value .search-clear { display: block; }

.result-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  padding: 0 2px;
}

.icon-btn {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1;
  color: var(--text-mid);
  transition: all .15s var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

/* 移动端抽屉开关，桌面隐藏 */
.only-mobile { display: none; }

/* --- 日期分隔 --- */
.date-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px 0 16px;
  scroll-margin-top: 72px;
}

.date-sep::before,
.date-sep::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

.date-sep-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  padding: 3px 11px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: 99px;
  letter-spacing: .02em;
}

/* --- 消息卡片 --- */
.msg {
  position: relative;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color .16s var(--ease), background .16s var(--ease);
  scroll-margin-top: 76px;
}

.msg:hover { border-color: var(--border); background: var(--bg-card); }

.msg[data-pinned]::before {
  content: "";
  position: absolute;
  left: -1px; top: 13px; bottom: 13px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* 被搜索命中的消息 */
.msg.is-match { border-color: var(--accent); background: var(--accent-soft); }
.msg mark {
  background: var(--accent);
  color: #1a1408;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 600;
}

/* 被筛选隐藏 */
.msg.is-hidden { display: none; }

.msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.msg-type {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text-dim);
  flex-shrink: 0;
}

.msg-type[data-kind="photo"]    { color: #7fc8a9; border-color: #23443a; }
.msg-type[data-kind="video"]    { color: #c99ae0; border-color: #3d2a48; }
.msg-type[data-kind="document"] { color: #8fb3e0; border-color: #26364d; }
.msg-type[data-kind="webpage"]  { color: #d9a441; border-color: #4a3a18; }
.msg-type[data-kind="audio"]    { color: #e0a08f; border-color: #4a2f28; }

.msg-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.msg-edited {
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
}

.msg-stats {
  margin-left: auto;
  display: flex;
  gap: 11px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.msg-link {
  position: absolute;
  top: 11px; right: 13px;
  font-size: 12px;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity .15s var(--ease);
  text-decoration: none;
}
.msg:hover .msg-link { opacity: 1; }
.msg-link:hover { color: var(--accent); text-decoration: none; }

/* 转发标记 */
.msg-fwd {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 7px;
  padding-left: 2px;
}
.msg-fwd .fw-icon { color: var(--text-faint); }

/* 回复标记 */
.msg-reply {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-inset);
  border-left: 2px solid var(--border-strong);
  padding: 4px 9px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 8px;
}
.msg-reply:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }

/* --- 正文 --- */
.msg-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--text);
}
.msg-text:empty { display: none; }
.msg-text + .msg-media { margin-top: 11px; }

/* 纯链接行稍微弱化 */
.msg-text a { overflow-wrap: anywhere; }

/* 代码块 */
.msg-text code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent-text);
}

/* ==========================================================================
   媒体
   ========================================================================== */
.msg-media { margin-top: 10px; }

/* --- 单图 --- */
.media-photo {
  display: block;
  /* 必须有确定宽度：<button> 默认收缩包裹，宽度为 0 时
     aspect-ratio 算出的高度也接近 0，图片加载后才会被撑开。 */
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  line-height: 0;
  transition: border-color .15s var(--ease);
}
.media-photo:hover { border-color: var(--border-strong); }

/* 容器由 aspect-ratio 定高，图片填满不裁剪 */
.media-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-inset);
}

/* --- 相册网格 ---
   渲染上限 4 格（更多用 +N 角标），故只处理 1–4。
   容器给定确定高度基准，行高不依赖图片内容 —— 否则懒加载图片解码后
   会把网格撑高，导致滚动位置与滚动条漂移。 */
.album {
  display: grid;
  gap: 2px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  /* 间隙用背景色填充会形成明显黑缝，交给子元素背景即可 */
  background: var(--bg-inset);
}

.album[data-count="1"] { grid-template-columns: 1fr; }
.album[data-count="2"] { grid-template-columns: 1fr 1fr; aspect-ratio: 16/5; }
.album[data-count="3"] {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 16/9;
}
.album[data-count="3"] .album-item:first-child { grid-row: span 2; }
.album[data-count="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 2/1;
}

.album-item {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--bg-inset);
  line-height: 0;
  border: none;
  padding: 0;
  cursor: zoom-in;
}

/* 多图：格子填满已定高的容器，图片裁剪显示 */
.album[data-count="2"] .album-item,
.album[data-count="3"] .album-item,
.album[data-count="4"] .album-item { height: 100%; }

.album[data-count="2"] .album-item img,
.album[data-count="3"] .album-item img,
.album[data-count="4"] .album-item img {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* 单图：容器带 aspect-ratio 定高，图片填满且不裁剪 */
.album[data-count="1"] .album-item img { width: 100%; height: 100%; }

.album-item img {
  transition: transform .35s var(--ease), opacity .2s var(--ease);
}
.album-item:hover img { transform: scale(1.045); }

/* 相册超过 4 张时，末尾显示 +N */
.album-more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,10,13,.72);
  color: #fff;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  backdrop-filter: blur(2px);
}

/* 相册里的非图像项（txt/pdf/zip）*/
.album-file {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
}
.album-item:hover .album-file { color: var(--accent-text); }

/* 视频格子的播放角标 */
.album-item .video-badge {
  position: absolute;
  left: 6px; top: 6px;
  font-size: 11px;
  color: #fff;
  background: rgba(0,0,0,.66);
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1.5;
}

/* --- 视频 --- */
.media-video {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: #000;
  line-height: 0;
}

.media-video video {
  width: 100%;
  height: auto;
  background: #000;
}

.video-poster {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  background: #000;
  cursor: pointer;
  line-height: 0;
}
/* 容器由 aspect-ratio 定高，封面填满不裁剪 */
.video-poster img { width: 100%; height: 100%; object-fit: cover; }

.play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.28);
  transition: background .2s var(--ease);
}
.video-poster:hover .play-badge { background: rgba(0,0,0,.14); }

.play-badge span {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: rgba(255,255,255,.94);
  color: #14181d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  padding-left: 5px;
  box-shadow: var(--shadow-md);
  transition: transform .2s var(--ease);
}
.video-poster:hover .play-badge span { transform: scale(1.09); }

.video-meta {
  position: absolute;
  bottom: 9px; right: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #fff;
  background: rgba(0,0,0,.78);
  padding: 3px 7px;
  border-radius: 4px;
  line-height: 1.4;
}

/* --- 文件卡片 --- */
.file-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease), background .15s var(--ease);
  text-decoration: none;
}
.file-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  text-decoration: none;
}

.file-ext {
  width: 44px; height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-mid);
  text-transform: uppercase;
}
.file-ext[data-ext="pdf"]  { color: #e08a7a; border-color: #4d2b25; background: #221513; }
.file-ext[data-ext="zip"]  { color: #d9c07a; border-color: #4d4125; background: #221d13; }
.file-ext[data-ext="txt"]  { color: #8fb3e0; border-color: #26364d; background: #131a22; }
.file-ext[data-ext="png"],
.file-ext[data-ext="jpg"]  { color: #7fc8a9; border-color: #23443a; background: #13221c; }

.file-body { min-width: 0; flex: 1; }
.file-name {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.file-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* --- 音频 --- */
.media-audio { display: flex; flex-direction: column; gap: 9px; }
.media-audio audio { width: 100%; height: 40px; }

/* --- 链接预览 --- */
.link-card {
  display: block;
  padding: 12px 15px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background .15s var(--ease);
}
.link-card:hover { background: var(--bg-hover); text-decoration: none; }
.link-site {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}
.link-title { font-size: 13.5px; font-weight: 550; color: var(--text); line-height: 1.4; }
.link-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- 正文内链域徽标 --- */
.domain-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  color: var(--text-faint);
  margin-left: 4px;
  vertical-align: 1px;
  white-space: nowrap;
}

/* ==========================================================================
   右栏: 时间轴
   ========================================================================== */
.sidebar-right {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 14px 32px 10px;
  border-left: 1px solid var(--border-soft);
}

.rail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 11px;
  padding-left: 9px;
}

.rail-year { margin-bottom: 9px; }

.rail-year-head {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-mid);
  padding: 4px 9px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.rail-year-head .n { font-size: 10.5px; color: var(--text-faint); }

.rail-month {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all .14s var(--ease);
}
.rail-month:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}
.rail-month.is-active {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}
.rail-month .n {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
}
.rail-month.is-active .n { color: var(--accent); }

/* ==========================================================================
   灯箱
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6,8,10,.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  flex-direction: column;
}
.lightbox.is-open { display: flex; }

.lb-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.lb-counter {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mid);
}

.lb-cap {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-actions { display: flex; gap: 8px; flex-shrink: 0; }

.lb-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  transition: background .15s var(--ease);
}
.lb-btn:hover { background: rgba(255,255,255,.16); color: #fff; text-decoration: none; }

.lb-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.lb-content { max-width: 100%; max-height: 100%; display: flex; }
.lb-content img,
.lb-content video {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 72px;
  background: rgba(255,255,255,.06);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s var(--ease);
}
.lb-nav:hover { background: rgba(255,255,255,.16); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-nav[disabled] { opacity: .22; cursor: default; }
.lb-nav[disabled]:hover { background: rgba(255,255,255,.06); }

.lb-thumbs {
  flex-shrink: 0;
  display: flex;
  gap: 7px;
  padding: 11px 18px 15px;
  overflow-x: auto;
  border-top: 1px solid rgba(255,255,255,.07);
  justify-content: center;
}
.lb-thumb {
  width: 58px; height: 58px;
  flex-shrink: 0;
  border-radius: 5px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  background: #000;
  cursor: pointer;
  opacity: .5;
  transition: opacity .15s var(--ease), border-color .15s var(--ease);
  line-height: 0;
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-thumb:hover { opacity: .85; }
.lb-thumb.is-active { opacity: 1; border-color: var(--accent); }

/* ==========================================================================
   回到顶部 / 浮动操作
   ========================================================================== */
.to-top {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 60;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-mid);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease), background .15s var(--ease);
  transform: translateY(8px);
}
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { background: var(--bg-hover); color: var(--text); }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 72px 20px;
  color: var(--text-dim);
}
.empty-state .es-icon { font-size: 34px; margin-bottom: 12px; opacity: .5; }
.empty-state .es-title { font-size: 16px; color: var(--text-mid); margin-bottom: 5px; }
.empty-state .es-sub { font-size: 13px; color: var(--text-faint); }

/* 移动端抽屉遮罩 */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
  display: none;
}
.scrim.is-open { display: block; }

/* ==========================================================================
   响应式: 平板 768-1279 —— 收掉两侧栏，改为抽屉
   ========================================================================== */
@media (max-width: 1279px) {
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar-left {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    width: min(310px, 86vw);
    height: 100vh;
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform .26s var(--ease);
  }
  .sidebar-left.is-open { transform: none; }

  .sidebar-right {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    z-index: 100;
    width: min(260px, 78vw);
    height: 100vh;
    background: var(--bg-elev);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(102%);
    transition: transform .26s var(--ease);
  }
  .sidebar-right.is-open { transform: none; }

  .only-mobile { display: inline-flex; }
}

/* ==========================================================================
   响应式: 手机 <768
   ========================================================================== */
@media (max-width: 767px) {
  body { font-size: 14.5px; }

  .stream { padding-bottom: 88px; }
  .stream-inner { padding: 0 12px; }
  .toolbar { padding: 9px 12px; }

  .msg {
    padding: 12px 13px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
  }

  .msg-text { font-size: 14px; line-height: 1.64; }

  .date-sep { margin: 22px 0 12px; }
  .date-sep-text { font-size: 11.5px; padding: 2px 9px; }

  /* 窄屏相册：统一 4:3 左右的紧凑比例，避免竖屏下单个相册占满一屏 */
  .album[data-count="2"] { aspect-ratio: 8/5; }
  .album[data-count="3"] {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 5/4;
  }
  .album[data-count="3"] .album-item:first-child {
    grid-row: span 2;
    grid-column: span 1;
  }
  .album[data-count="4"] { aspect-ratio: 1; }

  .msg-stats { gap: 8px; font-size: 11px; }
  .msg-link { display: none; }

  .lb-bar { padding: 10px 12px; gap: 8px; }
  .lb-cap { font-size: 12px; }
  .lb-stage { padding: 10px; }
  .lb-nav { width: 40px; height: 60px; font-size: 20px; }
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
  .lb-thumbs { padding: 9px 12px 12px; gap: 5px; }
  .lb-thumb { width: 46px; height: 46px; }

  .to-top { right: 14px; bottom: 14px; width: 40px; height: 40px; }

  .file-card { padding: 11px 12px; gap: 10px; }
  .file-ext { width: 38px; height: 38px; font-size: 10px; }
}

/* ==========================================================================
   无障碍 / 动效偏好
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 打印 */
@media print {
  .sidebar-left, .sidebar-right, .toolbar, .to-top, .lightbox, .scrim { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .msg { break-inside: avoid; border-color: #ccc; background: #fff; color: #000; }
  body { background: #fff; color: #000; }
}
