/* ============================================================
   WorkBuddy 镜像 —— 组件样式
   基础设计系统来自门户的 style.css（同目录，直接复用）：
   主题变量、背景、卡片、按钮都在那边。这里只写镜像自己的东西。
   ============================================================ */

body {
  padding-bottom: calc(66px + env(safe-area-inset-bottom));
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg-tint, #0d1017) 62%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-in {
  max-width: 940px;
  margin: 0 auto;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
}

.topbar .brand {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0;
}

.topbar .sub {
  font-size: 12.5px;
  color: var(--ink-mute);
}

.topbar .spacer { flex: 1; }

.topbar .act {
  font-size: 13px;
  color: var(--ink-mute);
  padding: 5px 9px;
  border-radius: 9px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.topbar .act:hover {
  background: rgba(255, 255, 255, .1);
  color: var(--ink);
}

/* 顶栏上的主题按钮缩一号 */
/* 子页面覆写 header 时不一定带 .spacer，按钮会紧跟标题；
   margin-left:auto 保证无论哪种 header，主题按钮都稳定贴右 */
.topbar .iconbtn { width: 34px; height: 34px; border-radius: 10px; margin-left: auto; }
.topbar .iconbtn svg { width: 16px; height: 16px; }
/* 返回门户：贴最左，不能吃到主题按钮那条 margin-left:auto */
.topbar .iconbtn.back { margin-left: 0; margin-right: -2px; }

/* ---------- 主区 ---------- */

.main {
  position: relative;   /* bg 是 fixed 层，不定位的内容会被它盖住 */
  z-index: 1;
  max-width: 940px;
  margin: 0 auto;
  padding: 14px 14px 20px;
}

/* ---------- 列表卡片 ---------- */

.card {
  /* 门户的 .card 是给登录卡片用的：限宽 400 且靠左偏移。
     镜像的列表要占满，这里必须整条覆盖 width / margin。 */
  width: auto;
  margin: 0 0 10px;
  background: rgba(18, 19, 26, .66);
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  padding: 14px;
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset,
              0 12px 30px -18px rgba(0, 0, 0, .7);
  animation: none;
}

.row { display: flex; gap: 12px; align-items: center; }
.row-top {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}
.grow { flex: 1; min-width: 0; }

.title {
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.4;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta {
  color: var(--ink-mute);
  font-size: 12.5px;
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.meta .dot::before { content: "·"; margin: 0 2px; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sun) 20%, transparent);
  color: var(--sun);
  font-weight: 550;
  white-space: nowrap;
}
.badge.gray { background: rgba(255, 255, 255, .09); color: var(--ink-mute); }
.badge.warn { background: rgba(255, 140, 90, .18); color: #ffb08a; }

.sess { padding: 13px 14px; display: flex; }
.sess .accentbar {
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--sun), var(--coral));
  align-self: stretch;
  flex: 0 0 3px;
  margin-right: 12px;
  opacity: .9;
}

.empty {
  text-align: center;
  color: var(--ink-mute);
  font-size: 13.5px;
  padding: 46px 20px;
}

.pager {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 16px 0;
}
.pager a, .pager span {
  padding: 9px 16px;
  border-radius: 11px;
  background: rgba(18, 19, 26, .78);
  border: 1px solid var(--line-soft);
  font-size: 13.5px;
  color: var(--ink-dim);
  text-decoration: none;
}

h2.sec {
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 18px 4px 9px;
}

/* ---------- 会话正文 ---------- */

/* 正文直接铺在亮背景上会看不清，统一装一块玻璃底板 */
/* 只看对话 / 展开过程 */
.view-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 10px;
  padding: 6px 10px;
  font-size: 11.5px;
  color: var(--ink-dim);
  /* 直接压在背景图上时灰字看不清，给整条一个玻璃底 */
  background: rgba(18, 19, 26, .58);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}
.view-switch .mini { flex: 0 0 auto; }

/* ---------- 会话目录（右侧跳转栏） ----------
   一页 20 轮、近两万像素，光靠滚根本找不着。
   宽屏钉在右侧留白里；窄屏收成悬浮按钮 + 抽屉。
   选中哪一轮，就把它下面的 h2/h3 小节展开在该条目下方。 */

.toc-fab {
  position: fixed;
  right: 14px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 26;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(18, 19, 26, .84);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, .85);
  transition: background .16s var(--ease), transform .16s var(--ease);
}
.toc-fab:hover { background: rgba(30, 32, 44, .92); }
.toc-fab:active { transform: scale(.96); }
.toc-fab svg { width: 15px; height: 15px; opacity: .8; }

.toc-mask {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(6, 7, 11, .52);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease);
}
.toc-mask.on { opacity: 1; pointer-events: auto; }

.toc {
  position: fixed;
  z-index: 45;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(300px, 86vw);
  display: flex;
  flex-direction: column;
  padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
  background: rgba(15, 16, 23, .95);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-left: 1px solid var(--line-soft);
  transform: translateX(102%);
  transition: transform .24s var(--ease);
  box-shadow: -18px 0 40px -24px rgba(0, 0, 0, .9);
}
.toc.on { transform: none; }

.toc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 9px;
  border-bottom: 1px solid var(--line-soft);
}
.toc-head b { font-size: 13px; font-weight: 650; color: var(--ink); }
.toc-head span { font-size: 11.5px; color: var(--ink-mute); }
.toc-x {
  margin-left: auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  color: var(--ink-dim);
  cursor: pointer;
}
.toc-x svg { width: 13px; height: 13px; }

.toc-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 7px 0 2px;
}

.toc-i {
  display: flex;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-dim);
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.toc-i:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }
.toc-i.on {
  background: color-mix(in srgb, var(--sun) 17%, transparent);
  color: var(--ink);
}
.toc-n {
  flex: 0 0 auto;
  padding-top: 1px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-mute);
}
.toc-i.on .toc-n { color: var(--sun); }
.toc-t {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.toc-subs {
  margin: 1px 0 6px 24px;
  padding-left: 4px;
  border-left: 1px solid var(--line-soft);
}
.toc-s {
  display: block;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-mute);
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.toc-s:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }

/* 右侧留白够宽（1380 以上）时，抽屉变常驻栏，按钮和遮罩都收起来 */
@media (min-width: 1380px) {
  .toc {
    right: 18px;
    top: 74px;
    bottom: auto;
    width: 200px;
    max-height: calc(100vh - 152px);
    padding: 9px 7px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: rgba(15, 16, 23, .78);
    transform: none;
    box-shadow: 0 16px 34px -22px rgba(0, 0, 0, .85);
  }
  .toc-mask, .toc-fab, .toc-x { display: none; }
  .toc-i { font-size: 11.5px; }
}

.proc {
  margin: 10px 0 4px;
  border: 1px dashed var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, .03);
}
.proc > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-dim);
  list-style: none;
}
.proc > summary::-webkit-details-marker { display: none; }
.proc > summary::before { content: "\25B8"; font-size: 11px; color: var(--sun); }
.proc[open] > summary::before { content: "\25BE"; }
.proc[open] > summary { border-bottom: 1px dashed var(--line-soft); }
.proc-body { padding: 10px 12px 12px; }
.proc-body details.det:first-child { margin-top: 0; }

.transcript {
  background: rgba(18, 19, 26, .70);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 4px 16px 14px;
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset,
              0 14px 34px -20px rgba(0, 0, 0, .75);
}

.turn {
  border-top: 1px solid var(--line-soft);
  padding: 15px 0 6px;
}
.turn:first-of-type { border-top: none; }

.q {
  background: color-mix(in srgb, var(--sun) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--sun) 18%, transparent);
  border-radius: 13px;
  padding: 11px 13px;
  margin-bottom: 11px;
  font-weight: 550;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  color: var(--ink);
}
.q .num {
  display: inline-block;
  color: var(--ink-mute);
  font-size: 11.5px;
  font-weight: 600;
  margin-right: 6px;
}

/* 气泡类名用 .say，不要用 .msg。
   门户 style.css 里 .msg 是「登录页提示条」专用类（默认 opacity:0，
   靠 JS 加 .bad / .info 才显形）。镜像早期沿用 .msg 当消息气泡，
   结果所有正文整块隐形，只剩提问框和折叠条 —— 排查了很久。
   两个样式表同名类互相踩，改名字是唯一稳的解法。 */
.say { margin: 9px 0; }
.say.user { white-space: pre-wrap; color: var(--ink-dim); line-height: 1.62; }
.say.assistant { font-size: 15px; line-height: 1.72; }

.say.assistant p, .prose p { margin: .5em 0; }
.say.assistant a, .prose a { color: var(--sun); }

.say.assistant pre, .prose pre {
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 11px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 12.5px;
  line-height: 1.6;
  margin: .7em 0;
}
.say.assistant code {
  background: rgba(0, 0, 0, .3);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 13px;
}
.say.assistant pre code { background: none; padding: 0; }

.say.assistant table {
  border-collapse: collapse;
  font-size: 13px;
  display: block;
  overflow-x: auto;
}
.say.assistant th, .say.assistant td {
  border: 1px solid var(--line-soft);
  padding: 5px 8px;
}
.say.assistant ul, .say.assistant ol { padding-left: 1.3em; margin: .5em 0; }
.say.assistant img { max-width: 100%; border-radius: 10px; }
.say.assistant blockquote {
  margin: .6em 0;
  padding-left: 10px;
  border-left: 3px solid var(--line);
  color: var(--ink-mute);
}
.say.assistant h1, .say.assistant h2, .say.assistant h3 {
  font-size: 15.5px;
  margin: .9em 0 .4em;
}

/* 折叠块：思考过程 / 工具调用 */

details.det {
  margin: 8px 0;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, .04);
  overflow: hidden;
}
details.det > summary {
  cursor: pointer;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ink-mute);
  list-style: none;
  display: flex;
  gap: 7px;
  align-items: center;
}
details.det > summary::-webkit-details-marker { display: none; }
details.det > summary::after {
  content: "›";
  margin-left: auto;
  transform: rotate(90deg);
  transition: transform .15s;
  font-size: 16px;
  line-height: 1;
}
details.det[open] > summary::after { transform: rotate(-90deg); }
details.det > summary b {
  color: var(--ink-dim);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
details.det .body { padding: 0 12px 11px; }
details.det pre {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  max-height: 60vh;
  overflow: auto;
  color: var(--ink-dim);
}
details.reason { background: transparent; border-style: dashed; }
details.reason > summary b { color: var(--ink-mute); font-weight: 500; font-style: italic; }

.imgwrap { margin: 10px 0; }
.imgwrap img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  display: block;
}
.imgwrap .cap { font-size: 11.5px; color: var(--ink-mute); margin-top: 5px; }

.more {
  display: inline-block;
  font-size: 12.5px;
  margin-top: 6px;
  color: var(--sun);
  text-decoration: none;
}

/* ---------- 文件 ---------- */

.crumb {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 11px;
  word-break: break-all;
}
.crumb a { color: var(--ink-mute); text-decoration: none; }
.crumb a:hover { color: var(--sun); }

.fentry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14.5px;
  color: var(--ink-dim);
  text-decoration: none;
}
.fentry:last-child { border-bottom: none; }
.fentry:hover { color: var(--ink); }
.fentry .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fentry .sz { color: var(--ink-mute); font-size: 12px; }
.fentry .ic {
  width: 18px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
}

pre.file {
  background: rgba(0, 0, 0, .32);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 13px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
  color: var(--ink-dim);
}

/* ---------- 搜索 ---------- */

.hit { padding: 13px 14px; display: block; text-decoration: none; color: inherit; }
.hit .snp {
  font-size: 13.5px;
  color: var(--ink-mute);
  margin-top: 6px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hit .snp b {
  color: var(--ink);
  background: color-mix(in srgb, var(--sun) 28%, transparent);
  font-weight: 600;
  border-radius: 3px;
  padding: 0 2px;
}

/* ---------- 底部标签栏 ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: color-mix(in srgb, #12141c 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line-soft);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 7px;
  color: var(--ink-mute);
  font-size: 10.5px;
  font-weight: 550;
  text-decoration: none;
}
.tab svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab.on { color: var(--sun); }
.tab.on svg { fill: color-mix(in srgb, var(--sun) 16%, transparent); }

/* ---------- 登录页（镜像自己的口令兜底） ---------- */

.login-wrap {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.login-card {
  width: min(380px, 100%);
  margin: 0;
  padding: 30px 26px 24px;
}

/* ---------- 手机 ---------- */

@media (max-width: 760px) {
  .main { padding: 12px 12px 18px; }
  .topbar-in { padding: 10px 14px; }
  .card { border-radius: 14px; padding: 13px; }
  .say.assistant { font-size: 14.5px; }
  /* 手机上这行说明会把按钮挤到下一行、撑成两层，直接收起 */
  .view-switch > span { display: none; }
}

/* ============================================================
   搜索页
   ============================================================ */

.sbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px 0 13px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(18, 19, 26, .72);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  transition: border-color .16s ease, background .16s ease;
}
.sbar:focus-within {
  border-color: color-mix(in srgb, var(--sun) 46%, transparent);
  background: rgba(18, 19, 26, .84);
}
.sbar-ico {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--ink-mute);
}
.sbar-ico svg { width: 17px; height: 17px; display: block; }

.sbar-in {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  -webkit-appearance: none;
  appearance: none;
}
.sbar-in::placeholder { color: var(--ink-mute); }
/* iOS 自带的圆角和清除按钮会破坏版式，统一用自己的 × */
.sbar-in::-webkit-search-cancel-button,
.sbar-in::-webkit-search-decoration { -webkit-appearance: none; display: none; }

.sbar-x {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
}
.sbar-x:active { background: rgba(255, 255, 255, .2); }

.sbar-stat {
  padding: 0 4px 10px;
  font-size: 12.5px;
  color: var(--ink-mute);
}
.sbar-stat b { color: var(--ink-dim); font-weight: 600; }
.sbar-stat .sep { margin: 0 5px; opacity: .6; }

/* ---------- 命中卡片 ---------- */

.card.hit {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 12px 14px 11px;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.card.hit:active {
  transform: scale(.996);
  background: rgba(24, 26, 34, .78);
}

.hit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.hit-src {
  font-size: 11.5px;
  color: var(--ink-mute);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hit-src b {
  color: color-mix(in srgb, var(--sun) 86%, white 14%);
  font-weight: 600;
}
.hit-time {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.hit-snp {
  font-size: 13.5px;
  line-height: 1.66;
  color: var(--ink-dim);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 命中词：抬亮 + 淡淡底色，扫读时一眼能定位 */
.hit-snp b {
  color: var(--ink);
  font-weight: 600;
  background: color-mix(in srgb, var(--sun) 28%, transparent);
  border-radius: 3px;
  padding: 0 2px;
}

.hit-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--ink-mute);
  min-width: 0;
}
.hit-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hit-turn { flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* ---------- 空态 ---------- */

.empty-ico {
  width: 30px; height: 30px;
  display: block;
  margin: 0 auto 14px;
  color: var(--ink-mute);
  opacity: .7;
}
.empty p { margin: 0 0 6px; }
.empty .hint {
  font-size: 12.5px;
  color: var(--ink-mute);
  opacity: .8;
}

/* 背景是插画，纯文字直接压在亮处会糊掉 —— 空态必须有自己的底板 */
.search-hint,
.empty.no-result {
  margin-top: 26px;
  padding: 34px 22px 30px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: rgba(18, 19, 26, .66);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  color: var(--ink-dim);
}
.empty.no-result { padding: 40px 22px; }
.search-hint { padding-top: 40px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .055);
  color: var(--ink-dim);
  font-size: 12.5px;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.chip:hover, .chip:active {
  background: rgba(255, 255, 255, .12);
  border-color: color-mix(in srgb, var(--sun) 34%, transparent);
  color: var(--ink);
}

/* ============================================================
   图片墙：先选项目，再展开该项目的图片
   ============================================================ */

.gal-lead {
  margin: 0 0 14px;
  padding: 0 4px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-mute);
}

.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 10px;
}

.proj-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(18, 19, 26, .66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .12s ease;
}
.proj-card:hover {
  border-color: color-mix(in srgb, var(--sun) 42%, transparent);
  background: rgba(22, 24, 33, .8);
}
.proj-card:active { transform: scale(.99); }

.proj-ico {
  flex: 0 0 38px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: var(--sun);
  background: color-mix(in srgb, var(--sun) 15%, transparent);
}
.proj-ico svg { width: 19px; height: 19px; }

.proj-txt { flex: 1; min-width: 0; }
.proj-txt b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-txt span {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-num {
  flex: 0 0 auto;
  min-width: 32px;
  padding: 4px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, .09);
}

/* ---------- 单项目视图 ---------- */

.viewer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 12px;
}
.viewer-back {
  flex: 0 0 auto;
  padding: 6px 10px 6px 8px;
  margin-left: -8px;
  border-radius: 9px;
  color: var(--ink-dim);
  font-size: 12.5px;
  text-decoration: none;
}
.viewer-back:hover { background: rgba(255, 255, 255, .08); color: var(--ink); }
.viewer-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-head .meta { margin: 0; flex: 0 0 auto; }

.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.gimg {
  margin: 0;
  min-width: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: rgba(18, 19, 26, .66);
  cursor: zoom-in;
  transition: border-color .16s ease, transform .12s ease;
}
.gimg:hover { border-color: color-mix(in srgb, var(--sun) 40%, transparent); }
.gimg:active { transform: scale(.99); }
.gimg:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }

.gimg-box {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, .045);
}
.gimg-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .22s var(--ease, ease);
}
.gimg:hover .gimg-box img { transform: scale(1.045); }

.gimg-badge {
  position: absolute;
  top: 6px; left: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--ink-dim);
  background: rgba(9, 11, 17, .74);
  backdrop-filter: blur(6px);
}
.gimg figcaption { padding: 7px 9px 9px; font-size: 11.5px; color: var(--ink-dim); }
.gimg figcaption b {
  display: block;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gimg figcaption span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--ink-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 灯箱 ---------- */

.lb {
  position: fixed;
  inset: 0;
  z-index: 100;               /* 高于 topbar(20) 和 tabbar(30) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 54px 58px 78px;
  background: rgba(6, 8, 13, .94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lb[hidden] { display: none; }
.lb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .75);
}

.lb-x, .lb-arrow {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}
.lb-x { top: 14px; right: 16px; width: 36px; height: 36px; font-size: 20px; line-height: 1; }
.lb-arrow {
  top: 50%;
  width: 40px; height: 40px;
  margin-top: -20px;
  font-size: 24px;
  line-height: 1;
  padding-bottom: 3px;
}
.lb-arrow.prev { left: 10px; }
.lb-arrow.next { right: 10px; }
.lb-x:active, .lb-arrow:active { background: rgba(255, 255, 255, .2); }

.lb-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(6, 8, 13, .92) 45%);
}
.lb-txt { flex: 1; min-width: 0; }
.lb-txt b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-txt span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-mute); }
.lb-bar a {
  flex: 0 0 auto;
  color: var(--sun);
  font-size: 12.5px;
  text-decoration: none;
}

@media (max-width: 760px) {
  .proj-grid { grid-template-columns: 1fr; gap: 8px; }
  .gal-grid { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 8px; }
  .gimg figcaption { padding: 6px 7px 8px; font-size: 11px; }
  .lb { padding: 50px 6px 76px; }
  .lb-arrow { width: 34px; height: 34px; font-size: 20px; }
  .lb-bar { gap: 10px; padding-left: 12px; padding-right: 12px; }
  .lb-bar a { font-size: 12px; }
}
