@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 400; font-display: swap;
  src: url('vendor/jbmono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 700; font-display: swap;
  src: url('vendor/jbmono-700.woff2') format('woff2');
}
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('vendor/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('vendor/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('vendor/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('vendor/inter-700.woff2') format('woff2'); }
@font-face { font-family: 'Newsreader'; font-weight: 500; font-display: swap; src: url('vendor/news-500.woff2') format('woff2'); }
@font-face { font-family: 'Newsreader'; font-weight: 600; font-display: swap; src: url('vendor/news-600.woff2') format('woff2'); }

:root {
  --bg: #FAF9F5;
  --surface: #FFFFFF;
  --surface-2: #F1EEE7;
  --bubble-user: #F1EEE7;
  --border: #e9e3d6;
  --text: #2b2820;
  --muted: #8c8475;
  --accent: #5d6b78;
  --accent-weak: color-mix(in srgb, var(--accent) 15%, var(--surface));
  --accent-press: #4a555f;
  --ok: #6f8f4e;
  --err: #c0503e;
  --shadow: 40,38,31;
  --track: #d8d0c0;
  --hair: #c9c2b3;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ui: 'Inter', "PingFang SC", "MiSans", "HarmonyOS Sans SC", "OPPO Sans", "vivo Sans", -apple-system, Roboto, "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --serif: 'Newsreader', "PingFang SC", "MiSans", "Songti SC", "Noto Serif CJK SC", serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

/* ---- 主题：覆盖 :root 颜色 token。无 data-theme = 暖调（默认）。 ---- */
:root[data-theme="gray"] {
  /* 纸白：冷中性纸面 + 墨色字，配小票质感（不偏黄） */
  --bg: #EEF0F2; --surface: #FBFBFC; --surface-2: #E4E6EA; --bubble-user: #E4E6EA;
  --border: #DCDFE3; --text: #21252B; --muted: #868C95;
  --track: #D5D8DD; --hair: #D5D8DD; --shadow: 34,40,48;
}
:root[data-theme="dark"] {
  --bg: #15171A; --surface: #1E2024; --surface-2: #26292E; --bubble-user: #26292E;
  --border: #31353B; --text: #E7E9EC; --muted: #9098A1;
  --track: #3A3F46; --hair: #3A3F46; --shadow: 0,0,0;
}
/* ---- 强调色预设：砖橙=默认(:root)，其余覆盖 --accent / --accent-press。
       --accent-weak 用 color-mix，会随主题底色 + 当前强调色自动重算。 ---- */
:root[data-accent="rose"]   { --accent: #c0506b; --accent-press: #a23f57; }
:root[data-accent="amber"]  { --accent: #b07636; --accent-press: #935f28; }
:root[data-accent="green"]  { --accent: #4a7c59; --accent-press: #3c6549; }
:root[data-accent="teal"]   { --accent: #2f7d8f; --accent-press: #266676; }
:root[data-accent="indigo"] { --accent: #3a6ea5; --accent-press: #2f5a86; }
:root[data-accent="violet"] { --accent: #7a5cc6; --accent-press: #6447ad; }
:root[data-accent="slate"]  { --accent: #5d6b78; --accent-press: #4a555f; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text); font-family: var(--ui);
  overscroll-behavior: none;
}
body { -webkit-user-select: none; user-select: none; }

/* 高度钉到「可见视口」(visualViewport)：键盘弹出时只压缩中间消息区，标题栏+输入框始终可见、不被整页顶走 */
.screen { position: fixed; left: 0; right: 0; top: var(--vvtop, 0px); height: var(--vvh, 100%); display: none; flex-direction: column; background: var(--bg); }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ---------- generic ---------- */
.btn { border: none; border-radius: 14px; padding: 15px; font-size: 16px; font-weight: 600; width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-press); }
.btn-ghost { background: transparent; color: var(--accent); font-weight: 600; border: none; }
.iconbtn {
  border: none; background: transparent; color: var(--text);
  width: 44px; height: 44px; border-radius: 12px; font-size: 24px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.iconbtn:active { background: var(--surface-2); }
.spacer { flex: 1; }
input, textarea {
  font-family: var(--ui); -webkit-user-select: text; user-select: text;
}

/* ---------- setup / settings ---------- */
.pad { padding: calc(var(--safe-top) + 28px) 22px 22px; overflow-y: auto; flex: 1; }
.h1 { font-family: var(--serif); font-size: 30px; font-weight: 700; letter-spacing: -.5px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; line-height: 1.6; }
.field { margin: 16px 0; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 7px; padding-left: 2px; }
.field input {
  width: 100%; border: 1px solid var(--border); background: var(--surface);
  border-radius: 13px; padding: 14px; font-size: 16px; color: var(--text);
}
.field input:focus { outline: none; border-color: var(--accent); }
.field .mono { font-family: var(--mono); font-size: 13px; }

/* ---------- session list ---------- */
.topbar { padding: calc(var(--safe-top) + 16px) 14px 6px; display: flex; align-items: center; }
.list-title { font-family: var(--serif); font-size: 32px; font-weight: 700; padding: 4px 20px 12px; letter-spacing: -.5px; display: flex; align-items: center; gap: 9px; }
/* 文件夹收起：标题旁的小三角（▾ 展开 / ▸ 收起），只有有文件夹时才显示 */
.foldcaret { border: none; background: transparent; color: var(--muted); font-size: 14px; line-height: 1; padding: 8px 6px; align-self: center; }
.foldcaret:active { color: var(--accent); }
.foldcaret .foldcur { font-family: 'Inter'; font-size: 13px; font-weight: 600; color: var(--accent); }
.tabs { display: flex; gap: 10px; padding: 0 20px 12px; }
.tab {
  border: none; background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 9px 18px; font-size: 15px; font-weight: 600;
}
.tab.on { background: var(--surface-2); color: var(--text); }
.tab .count { color: var(--muted); margin-left: 6px; font-weight: 600; }

.daygroup { color: var(--muted); font-size: 14px; padding: 8px 24px 4px; }
.sessions { flex: 1; overflow-y: auto; padding: 0 16px calc(var(--safe-bottom) + 120px); }
.scard {
  background: var(--surface); border-radius: 24px; padding: 17px 18px;
  margin: 12px 0; box-shadow: 0 1px 2px rgba(var(--shadow),.04);
}
.scard:active { transform: scale(.99); }
.scard-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  border: 1.5px dashed var(--hair); display: flex; align-items: center; justify-content: center;
}
.scard-meta { flex: 1; min-width: 0; }
.scard-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard-repo { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.scard-time { color: var(--muted); font-size: 13px; flex: none; }
.scard-preview {
  background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin-top: 12px;
  font-size: 15px; color: var(--text); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.empty { text-align: center; color: var(--muted); margin-top: 22vh; font-size: 15px; line-height: 1.8; padding: 0 50px; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--safe-bottom) + 22px);
  border: none; background: var(--accent); color: #fff;
  height: 58px; border-radius: 29px; padding: 0 22px 0 20px;
  font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 22px rgba(var(--shadow),.22);
}
.fab:active { background: var(--accent-press); }
.fab .plus { font-size: 22px; font-weight: 300; }

/* ---------- chat ---------- */
/* 悬浮方圆框顶栏：只包住按键+标题，消息从毛玻璃后滑过；模糊比输入框(20px)低、更清晰 */
.chatbar {
  position: absolute; top: var(--safe-top); left: 12px; right: 12px; z-index: 6; /* 紧贴安全线（离 safe-top 0px） */
  display: flex; align-items: center; gap: 2px; padding: 4px 6px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 20px;
  box-shadow: 0 6px 22px rgba(var(--shadow),.10), 0 2px 6px rgba(var(--shadow),.05);
}
.model {
  flex: 1; text-align: center; font-family: var(--serif); font-size: 19px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.model .chev { font-size: 13px; color: var(--muted); }

.thread { flex: 1; overflow-y: auto; padding: calc(var(--safe-top) + 60px) 16px 150px; } /* 顶栏悬浮后自己补 top（底部由 syncDockPad 动态管） */
.msg { margin: 10px 0; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  background: var(--bubble-user); border-radius: 16px 16px 4px 16px;
  padding: 12px 15px; max-width: 86%; font-size: 16px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; -webkit-user-select: text; user-select: text;
}
.msg.assistant .text {
  font-size: 16px; line-height: 1.62; white-space: pre-wrap; word-break: break-word;
  -webkit-user-select: text; user-select: text; color: var(--text);
}
.msg.assistant .text code, .msg.assistant .text .ic {
  font-family: var(--mono); font-size: .9em; background: var(--surface-2);
  padding: 1px 5px; border-radius: 5px;
}
.cursor::after { content: '▍'; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.thinking {
  font-size: 14px; color: var(--muted); font-style: italic; line-height: 1.5;
  border-left: 2px solid var(--border); padding: 2px 0 2px 12px; margin: 8px 0;
  white-space: pre-wrap; cursor: pointer;
}
/* 注入显示（透视/全显）：她气泡下的「注入」块、回复下的「剥掉的」行、整条隐藏的系统消息 */
.inj { font-size: 12.5px; color: var(--muted); line-height: 1.5; border-left: 2px solid var(--border); padding: 2px 0 2px 10px; margin: 4px 0 8px; white-space: pre-wrap; word-break: break-word; cursor: pointer; font-family: var(--mono); }
.inj-h { font-size: 11px; opacity: .7; margin-bottom: 2px; font-family: inherit; }
.inj.collapsed .inj-b { max-height: 3.2em; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 50%, transparent); mask-image: linear-gradient(180deg, #000 50%, transparent); }
.msg.user { flex-wrap: wrap; }   /* 注入块要换到气泡下一行，别和气泡挤同一行（0906 把她的话挤成竖条那个 bug） */
.msg.user .inj { flex: 0 0 100%; box-sizing: border-box; text-align: left; margin: 4px 0 8px; }
.inj-msg { margin: 8px 0; }
/* 消息模板页（整页）：模板当正文排，变量一行一个小标签，预览像对话 */
.tplpad { padding-top: 6px; }
.tpltext { width: 100%; border: none; background: none; outline: none; resize: none; overflow: hidden; padding: 6px 0 10px; font-family: inherit; font-size: 15.5px; line-height: 1.7; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.tplsec { font-size: 12px; color: var(--muted); margin: 18px 0 8px; letter-spacing: .02em; }
.tplvars { display: flex; flex-wrap: wrap; gap: 8px; }
.tplchip { border: none; background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 7px 12px; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; gap: 6px; }
.tplchip .tplchip-k { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.apimodels { margin-top: 10px; }
.apimodels .tplchip.on { background: var(--accent); color: #fff; }
.apimodels .sub { flex: 0 0 100%; }
.tplpreview { display: flex; flex-direction: column; gap: 10px; }
.tplp { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.tplp.msg { align-self: flex-end; max-width: 78%; background: var(--bubble-user, var(--surface-2)); color: var(--text); border-radius: 18px; padding: 9px 14px; }
.tplp-h { font-size: 11px; opacity: .65; margin-bottom: 3px; }
.tplp.msg .tplp-h { display: none; }
.thinking.collapsed { max-height: 4.4em; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent); mask-image: linear-gradient(180deg, #000 55%, transparent); }
.thinking .md { font-size: 14px; line-height: 1.5; }
.thinking .md > :first-child { margin-top: 0; }
.thinking .md > :last-child { margin-bottom: 0; }
/* ---- splash / launch screen ---- */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; transition: opacity .45s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
.splash-art { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.splash-mark { width: 150px; height: 150px; display: block; background: var(--text); -webkit-mask: url(telos-tau.png) center/contain no-repeat; mask: url(telos-tau.png) center/contain no-repeat; animation: slpulse 1.8s ease-in-out infinite; }
.splash-name { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: .2px; }
.splash-foot { position: absolute; bottom: 46px; font-size: 13px; color: var(--muted); }

.statusline {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  margin: 12px 2px 6px; animation: slfade .25s ease;
}
.statusline .sl-glyph { color: var(--accent); font-size: 15px; width: 1.1em; display: inline-block; text-align: center; }
.statusline .sl-word { color: var(--text); animation: slpulse 1.6s ease-in-out infinite; }
.statusline .sl-meta { color: var(--muted); opacity: .75; }
@keyframes slfade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slpulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

.tool {
  display: flex; align-items: center; gap: 10px; margin: 8px 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 13px;
}
.tool .tdot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.tool.run .tdot { background: var(--accent); animation: pulse 1.1s infinite; }
.tool.ok .tdot { background: var(--ok); }
.tool.err .tdot { background: var(--err); }
@keyframes pulse { 50% { opacity: .35; } }
.tool .tname { font-weight: 600; font-size: 15px; }
.tool .targ { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

.turninfo { text-align: left; color: var(--muted); font-size: 12px; margin: 10px 2px 6px; }

/* suggestions on empty chat */
.suggwrap { padding: 30px 18px; }
.sugg-label { color: var(--muted); font-size: 15px; margin: 0 4px 12px; }
.sugg {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px; margin: 10px 0; font-size: 16px; line-height: 1.4;
}
.sugg:active { background: var(--surface-2); }
.sugg .ic { font-family: var(--mono); font-size: .92em; }

/* input dock */
.dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 0 14px calc(var(--safe-bottom) + 16px);
  background: transparent; pointer-events: none;
}
.dock > * { pointer-events: auto; }
.repochip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px;
  font-size: 14px; color: var(--text); margin: 0 0 8px 4px; max-width: 90%;
}
.repochip svg { flex: none; }
/* 毛玻璃输入框：半透明 + 背景模糊，能看到底下虚化的对话，且不再像一块发黄的死白 */
.inputbox { background: color-mix(in srgb, var(--surface) 70%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); border: 1px solid color-mix(in srgb, var(--border) 55%, transparent); border-radius: 28px; padding: 10px 6px 8px 6px; box-shadow: 0 12px 36px rgba(var(--shadow),.16), 0 3px 10px rgba(var(--shadow),.07); }
.inputbox textarea {
  width: 100%; border: none; background: transparent; resize: none; outline: none;
  font-size: 16px; line-height: 1.4; padding: 12px 12px 6px; max-height: 140px; color: var(--text);
}
.inputrow { display: flex; align-items: center; padding: 2px 6px 4px; }
.codechip { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; color: var(--text); }
.codechip .ng { font-family: var(--mono); color: var(--accent); }
.sendbtn {
  width: 40px; height: 40px; border-radius: 20px; border: none; flex: none;
  background: var(--accent); color: #fff; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
}
.sendbtn:disabled { background: var(--track); }
.sendbtn:active:not(:disabled) { background: var(--accent-press); }

/* ---------- modal (permission) ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(var(--shadow),.42); z-index: 100;
  display: none; align-items: flex-end;
}
.scrim.show { display: flex; }
/* simple (content-height) sheet */
.sheet {
  background: var(--bg); width: 100%; border-radius: 30px 30px 0 0;
  max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: rise .24s cubic-bezier(.32,.72,0,1);
}
@keyframes rise { from { transform: translateY(100%); } }
.sheethdr { position: relative; padding: 22px 20px 10px; text-align: center; }
.sheethdr.nodrag { padding-top: 18px; }
.sheethdr .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--track); margin: 2px auto 14px; }
/* 编辑器弹层：保存按钮放进顶栏右侧，始终可点（不必把弹层拖到顶） */
.sheet-save { position: absolute; right: 14px; bottom: 10px; border: none; background: transparent; color: var(--accent); font-size: 15px; font-weight: 700; padding: 6px 4px; }
.sheet-save:active { opacity: .55; }
.sheet-tog { position: absolute; left: 14px; bottom: 10px; border: none; background: transparent; color: var(--muted); font-size: 15px; font-weight: 600; padding: 6px 4px; }
.sheet-tog:active { opacity: .55; }
.sheetx {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; font-size: 19px; color: var(--muted);
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.sheethdr .grip + .sheetx { top: auto; bottom: 8px; transform: none; }
.sheetx:active { background: var(--surface-2); }
.psub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.sheetbody { padding: 4px 20px calc(var(--safe-bottom) + 22px); }
/* draggable two-stage sheet */
.sheet.drag {
  height: 92vh; max-height: 92vh; overflow: hidden; animation: none;
  display: flex; flex-direction: column; transform: translateY(100%);
}
.sheet.drag .sheethdr { flex: none; touch-action: none; }
.sheet.drag .sheetbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet .ptitle { font-size: 18px; font-weight: 700; }
.sheet .pdesc { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.sheet .pdetail {
  background: #211f1b; color: #e6e1d6; font-family: var(--mono); font-size: 13px;
  border-radius: 12px; padding: 13px; max-height: 240px; overflow: auto; white-space: pre-wrap;
  word-break: break-word; -webkit-user-select: text; user-select: text; margin-bottom: 16px;
}
.sheet .prow { display: flex; gap: 12px; }
.sheet .prow .btn { flex: 1; }
.btn-deny { background: var(--surface); color: var(--err); border: 1px solid var(--border); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 90px); transform: translateX(-50%);
  background: rgba(var(--shadow),.94); color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 14px; max-width: 82%; text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 200;
}
.toast.show { opacity: 1; }

/* 选区高亮：用强调色的淡色调（随强调色+主题自动换、低饱和不刺眼），别用中性灰会显脏 */
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
::-moz-selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* 选词浮条：浮在选区上方的小横条，不变暗、无遮罩。照系统选词条——扁平、无边框、无分割线 */
.selbar {
  position: fixed; z-index: 180; display: none;
  background: var(--surface); border-radius: 16px;
  box-shadow: 0 4px 18px rgba(var(--shadow),.16), 0 1px 4px rgba(var(--shadow),.08);
  padding: 3px; -webkit-user-select: none; user-select: none;
}
.selbar.show { display: flex; }
.selbar button {
  border: none; background: transparent; color: var(--text);
  font-family: var(--ui); font-size: 15px; padding: 13px 20px; border-radius: 13px; white-space: nowrap;
}
.selbar button:active { background: var(--surface-2); }

/* connection banner */
.connbar {
  text-align: center; font-size: 13px; padding: 6px; color: #fff; background: var(--muted);
  display: none;
}
.connbar.show { display: block; }
.connbar.err { background: var(--err); }

/* ---------- model button (header) ---------- */
button.model { border: none; background: transparent; }
button.model:active { opacity: .6; }

/* ---------- option lists (model / effort) ---------- */
.optlist { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  border-radius: 13px; padding: 13px 15px; font-size: 16px; font-weight: 600;
}
.opt .osub { color: var(--muted); font-weight: 400; font-size: 13px; }
.opt.on { border-color: var(--accent); background: var(--accent-weak); }
.opt .check { margin-left: auto; color: var(--accent); font-weight: 700; opacity: 0; }
.opt.on .check { opacity: 1; }
.tag1m { display: inline-block; margin-left: 7px; padding: 1px 6px; border-radius: 6px; background: var(--accent-weak); color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .04em; vertical-align: middle; }
.opt .check.chev { opacity: 1; color: var(--muted); font-weight: 400; font-size: 20px; }
.opt-back { color: var(--muted); border-style: dashed; }
/* 思考度：带刻度点的滑块 */
.effslider { padding: 2px 2px 0; }
.eff-val { font-size: 14px; color: var(--text); font-weight: 600; margin-bottom: 12px; }
.effslider .slider { width: 100%; }
.eff-ticks { display: flex; justify-content: space-between; padding: 7px 9px 0; }
.eff-tick { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.eff-tick.on { background: var(--accent); }
.eff-ends { display: flex; justify-content: space-between; padding: 5px 2px 0; font-size: 11px; color: var(--muted); }
/* 时间线：事件(在线/离开) / 心情 */
.cl-row.cl-evt .cl-x { color: var(--muted); }
.cl-row.cl-mood .cl-x { color: var(--accent); font-style: italic; }

/* ---------- dir picker ---------- */
.dirlist { margin: 8px 0 14px; }
.diritem {
  display: flex; align-items: center; gap: 10px; padding: 13px 6px;
  border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 14px;
}
.diritem .ico { color: var(--muted); }
.diritem.up { color: var(--accent); font-weight: 600; }

/* ---------- action sheet ---------- */
.actitem {
  width: 100%; border: none; background: transparent; text-align: center;
  padding: 16px; font-size: 17px; color: var(--text); border-bottom: 1px solid var(--border);
}
.actitem:last-child { border-bottom: none; }
.actitem.danger { color: var(--err); }
.actitem:active { background: var(--surface-2); }

/* ---------- 居中弹窗（确认 / 长按动作菜单）：替换「输入删除确认」与底部抽屉 ---------- */
.scrim.center { align-items: center; justify-content: center; }
.cdlg {
  width: min(320px, calc(100vw - 56px)); background: var(--surface); border-radius: 22px;
  box-shadow: 0 18px 50px rgba(var(--shadow),.22); overflow: hidden;
  animation: cdpop .18s cubic-bezier(.32,.72,0,1);
}
@keyframes cdpop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.cd-head { padding: 20px 20px 0; text-align: center; }
.cd-title { font-size: 17px; font-weight: 700; word-break: break-all; }
.cd-sub { color: var(--muted); font-size: 13.5px; margin-top: 5px; line-height: 1.5; word-break: break-all; }
.cd-row { display: flex; border-top: 1px solid var(--border); margin-top: 18px; }
.cd-btn { flex: 1; border: none; background: transparent; padding: 14px; font-size: 16px; font-weight: 600; color: var(--text); }
.cd-btn + .cd-btn { border-left: 1px solid var(--border); }
.cd-btn.danger { color: var(--err); }
.cd-btn:active { background: var(--surface-2); }
/* 动作菜单：无分隔线、收紧行高；长菜单卡内滚动（露半行=还能往下划） */
.cd-list { padding: 6px 0 10px; max-height: 246px; overflow-y: auto; }
.cd-head + .cd-list { margin-top: 10px; }
.cdlg .actitem { border-bottom: none; padding: 13px 16px; }

/* ---------- 文件管理：多选 / 剪贴板 ---------- */
.diritem.sel { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.fmselbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 14px); z-index: 7;
  display: none; align-items: center;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent); border-radius: 18px;
  padding: 6px 8px; box-shadow: 0 10px 30px rgba(var(--shadow),.16);
}
.fmselbar.show { display: flex; }
.fmselbar .fsb-n { font-size: 14px; color: var(--muted); padding: 0 8px; }
.fmselbar button { border: none; background: transparent; font-size: 15px; font-weight: 600; color: var(--text); padding: 10px 10px; }
.fmselbar button.danger { color: var(--err); }
.fmselbar button:active { opacity: .55; }
.pastebtn { border: none; background: transparent; color: var(--accent); padding: 8px 12px; display: inline-flex; align-items: center; }
.pastebtn:active { opacity: .55; }
.fpick-ico.fpup { color: var(--muted); }

/* ---------- 输入框「编辑中」条（编辑重发） ---------- */
.editstrip {
  display: none; align-items: center; margin: 0 4px 8px; padding: 11px 15px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 16px; font-size: 15px; font-weight: 700;
}
.editstrip.show { display: flex; }
.editstrip button { margin-left: auto; border: none; background: transparent; color: var(--text); font-size: 17px; line-height: 1; padding: 0 2px; }
.editstrip button:active { opacity: .55; }

/* ---------- 设置 › API ---------- */
.apitest { font-size: 13px; color: var(--muted); padding: 10px 2px 0; line-height: 1.5; word-break: break-all; }
.apitest.ok { color: #4a8c66; }
.apitest.err { color: var(--err); }

/* 自己的气泡：长按走弹窗菜单，关掉原生选词（全文复制在菜单里） */
.msg.user .bubble { -webkit-user-select: none; user-select: none; }

/* ---------- markdown content ---------- */
.md { font-size: 16px; line-height: 1.62; -webkit-user-select: text; user-select: text; word-break: break-word; }
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { font-family: var(--serif); margin: 14px 0 8px; line-height: 1.3; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 17px; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code {
  font-family: var(--mono); font-size: .88em; background: var(--surface-2);
  padding: 1px 5px; border-radius: 5px;
}
.md pre {
  background: #211f1b; color: #e6e1d6; border-radius: 12px; padding: 13px;
  overflow-x: auto; margin: 10px 0; -webkit-overflow-scrolling: touch;
}
.md pre code { background: transparent; padding: 0; font-size: 13px; color: inherit; }
/* 代码块复制按钮：吊在 wrapper 上（不吊 pre——pre 横向滚动会把按钮一起滚走） */
.codewrap { position: relative; }
.codewrap .codecopy {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; padding: 0; font-size: 15px;
  background: rgba(255, 255, 255, .09); color: #b9b3a6;
  -webkit-user-select: none; user-select: none;
}
.codewrap .codecopy:active { background: rgba(255, 255, 255, .18); }
.codewrap .codecopy.did { color: #9ed6ab; }
.md blockquote { border-left: 3px solid var(--border); margin: 8px 0; padding: 2px 0 2px 12px; color: var(--muted); }
.md a { color: var(--accent); }
.md table { border-collapse: collapse; font-size: 14px; margin: 8px 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; }

/* ---------- expandable tool result ---------- */
.tool { flex-wrap: wrap; }
.tool .chev2 { color: var(--muted); font-size: 12px; margin-left: 4px; }
.toolout {
  flex-basis: 100%; margin-top: 10px; background: #211f1b; color: #d8d2c4;
  font-family: var(--mono); font-size: 12px; border-radius: 10px; padding: 11px;
  max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  -webkit-user-select: text; user-select: text; display: none;
}
.tool.open .toolout { display: block; }

/* ---------- send / stop button ---------- */
.sendbtn.stop { background: var(--text); }
.sendbtn.stop:active { background: #000; }

/* ===== chat header title ===== */
.chattitle { flex: 1; text-align: center; min-width: 0; }
.ctitle { font-family: var(--ui); font-size: 15.5px; font-weight: 400; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62%; margin: 0 auto; }
.csub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.csub.mood { cursor: pointer; }                                                                 /* 有心情：默认仍单行省略，点一下才展开 */
.csub.mood.expanded { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }   /* 展开后换行显全、不截断 */

/* ===== ⋮ dropdown menu ===== */
.menuback { position: fixed; inset: 0; z-index: 90; display: none; background: rgba(20,18,14,.10); opacity: 0; transition: opacity .2s ease; }
.menuback.show { display: block; }
.menuback.in { opacity: 1; }
.menupop {
  position: fixed; top: calc(var(--safe-top) + 61px); right: 10px; z-index: 91; /* 落在悬浮顶栏下沿之下 */
  background: color-mix(in srgb, var(--surface) 78%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent); border-radius: 18px;
  box-shadow: 0 10px 34px rgba(var(--shadow),.16);
  padding: 6px; min-width: 210px; display: none;
  transform-origin: top right; opacity: 0; transform: translateY(-6px);
  clip-path: inset(0 0 100% 0 round 18px);
  transition: clip-path .26s cubic-bezier(.32,.72,0,1), opacity .18s ease, transform .26s cubic-bezier(.32,.72,0,1);
}
.menupop.show { display: block; }
.menupop.in { opacity: 1; transform: translateY(0); clip-path: inset(0 0 0% 0 round 18px); }
.mitem {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; border: none; background: transparent; color: var(--text);
  padding: 13px 14px; font-size: 16px; border-radius: 10px; text-align: left;
}
.mitem svg { color: var(--muted); flex: none; }
.mitem:active { background: var(--surface-2); }
.mitem.danger { color: var(--err); }
.mitem.danger svg { color: var(--err); }
/* 情绪：菜单里的状态点（关=空心描边，开=实心着色），标题下的心情小点+标签 */
.mooddot { width: 11px; height: 11px; border-radius: 50%; flex: none; border: 1.5px solid var(--muted); background: transparent; }
.mooddot.on { border-color: transparent; }
/* ⋮ 菜单分区：菜单设置 / 对话设置 小标题 + 删除分隔 */
.menusec { font-size: 11.5px; letter-spacing: .06em; color: var(--muted); padding: 9px 14px 4px; font-weight: 600; }
.menusec:first-child { padding-top: 4px; }
.mitem.menusep { margin-top: 5px; border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent); border-radius: 0 0 10px 10px; }
/* 记忆面板：开关 + 恢复设置（统计并进 sheet 副标题） */
.memreco { margin-top: 14px; }
.memreco-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; font-size: 15px; }
.numin { width: 96px; font-size: 16px; font-family: var(--mono); color: var(--text); text-align: right;
  background: var(--surface-2); border: none; border-radius: 9px; padding: 9px 12px; }
.numin:focus { outline: 1.5px solid var(--accent); }
.memact { width: 100%; border: none; border-radius: 14px; padding: 13px; margin-top: 12px;
  font-size: 15px; font-weight: 600; background: var(--accent); color: #fff; }
.memact:active { background: var(--accent-press); }
.memact.ghost { background: var(--surface-2); color: var(--text); font-weight: 500; }
/* 记忆库页：正文为主的卡片（点卡进编辑页，归档/删除都在那边） */
.memmgr-filters { display: flex; gap: 8px; padding: 6px 16px 8px; overflow-x: auto; }
.memf { flex: none; border: none; background: var(--surface-2); color: var(--muted); border-radius: 16px; padding: 7px 15px; font-size: 13px; }
.memf.on { background: var(--accent); color: #fff; }
.memcard { background: var(--surface); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); border-radius: 14px; padding: 13px 14px 11px; margin: 0 14px 10px; }
.memcard-meta { font-size: 12px; color: var(--muted); margin-top: 7px; display: flex; align-items: center; gap: 5px; }
.mempin { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.memcard-text { font-size: 14.5px; color: var(--text); line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.memcard.tappable:active { background: var(--surface-2); }
/* 编辑记忆页（仿日记 .dwlist/.dwitem 风格）*/
#memEditList .dwitem + .dwitem { border-top: 1px solid var(--border); }
#memEditList .me-right { margin-left: auto; }
#memEditList .cin-numinp { border: none; background: transparent; color: var(--text); font: inherit; text-align: right; padding: 0 1px; outline: none; }
.dwitem.medel { color: #d0492f; }
.dwitem.medel .dwlbl { color: #d0492f; }
.dwitem.medel:active { background: var(--surface-2); }
.mepicker { position: fixed; left: 20px; bottom: calc(var(--safe-bottom) + 20px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 86vw; box-shadow: 0 8px 28px rgba(0,0,0,.18); z-index: 60; }
.mepicker button { font-size: 15px; padding: 9px 16px; border-radius: 10px; background: none; border: none; color: var(--text); }
.mepicker button:active { background: var(--surface-2); }
.mood-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.mood-lab { color: var(--muted); }
.mood-sep { margin: 0 5px; color: var(--border); }

/* ===== tool group row in thread ===== */
.toolrow {
  display: flex; align-items: center; gap: 8px; color: var(--muted);
  font-size: 15px; padding: 8px 2px; margin: 4px 0;
}
.toolrow .chev3 { font-size: 13px; }
.toolrow:active { opacity: .6; }
.sysrow { color: var(--muted); font-size: 15px; padding: 6px 2px; }

/* ===== tools sheet list (timeline) ===== */
.toollist { margin: 6px 0; }
.trow { position: relative; }
.trow:not(:last-child)::before { content: ''; position: absolute; left: 12px; top: 36px; bottom: 0; width: 1px; background: var(--border); }
.trhead { display: flex; align-items: center; gap: 12px; padding: 12px 2px; }
.trhead .ti { width: 24px; flex: none; text-align: center; color: var(--text); }
.trhead .tn { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; }
.trhead .chev3 { color: var(--muted); font-size: 14px; transition: transform .15s ease; }
.trow.open .trhead .chev3 { transform: rotate(90deg); }
.trow.err .trhead .tn { color: var(--err); }
.trdetail {
  display: none; margin: 0 0 12px 36px; background: #211f1b; color: #d8d2c4;
  font-family: var(--mono); font-size: 12px; border-radius: 12px; padding: 12px;
  white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto;
  -webkit-user-select: text; user-select: text;
}
.trow.open .trdetail { display: block; }

/* ===== select mode ===== */
.moderow { display: flex; align-items: center; gap: 14px; width: 100%; border: none; background: transparent; padding: 16px 4px; text-align: left; }
.moderow:active { opacity: .7; }
.micon { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 700; font-size: 17px; }
.micon.code { color: #7c5cff; }
.micon.plan { color: #2f9e8f; font-family: var(--ui); }
.mbody { flex: 1; display: flex; flex-direction: column; }
.mbody .mname { font-size: 18px; font-weight: 600; }
.mbody .mdesc { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.radio { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--hair); flex: none; }
.radio.on { border-color: var(--accent); background: radial-gradient(circle at center, var(--accent) 0 7px, transparent 8px); }

/* ===== attachment ===== */
.attachrow { display: flex; gap: 12px; margin: 8px 0 6px; }
.attachcard { flex: 1; border: none; background: transparent; font-size: 14px; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.attachcard:active { background: rgba(var(--shadow),.04); }
.attachcard .aci { font-size: 26px; }

/* ===== dock: dir chip + mode chip + round btn ===== */
.dirchip { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 13px; font-size: 14px; color: var(--text); margin: 0 0 8px 4px; max-width: 92%; }
.dirchip svg { color: var(--muted); flex: none; }
.dirchip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modechip { display: inline-flex; align-items: center; gap: 7px; border: none; background: transparent; font-weight: 700; font-size: 15px; color: var(--text); padding: 6px 8px; border-radius: 10px; }
.modechip:active { background: var(--surface-2); }
.modechip .ng { font-family: var(--mono); color: var(--text); }
.modechip.plan .ng { color: var(--text); }
.roundbtn { width: 40px; height: 40px; border-radius: 20px; border: none; background: transparent; color: var(--text); display: flex; align-items: center; justify-content: center; flex: none; }
.roundbtn:active { background: var(--surface-2); }

/* ===== session pin + preview ===== */
.scard.pinned { border: 1px solid var(--accent-weak); }
.scard-pin { flex: none; color: var(--accent); font-size: 14px; margin-left: 4px; }

/* inline svg alignment */
.daygroup svg, .scard-repo svg, .scard-pin svg, .diritem .ico svg { vertical-align: middle; }
.daygroup { display: flex; align-items: center; gap: 5px; }
.scard-repo svg { flex: none; }
.diritem .ico { display: inline-flex; vertical-align: middle; color: var(--muted); }
.micon.plan svg { display: block; }

/* tools level-1 arg + chevron */
.trhead .ta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.trhead .tn { flex: none; }
/* tools level-2 detail sections */
.tsection { margin: 4px 0 18px; }
.tslabel { font-weight: 700; font-size: 15px; color: var(--muted); margin: 0 0 8px 2px; }
.tsbox {
  background: var(--surface-2); border-radius: 14px; padding: 14px;
  font-family: var(--mono); font-size: 13px; line-height: 1.5; color: var(--text);
  white-space: pre-wrap; word-break: break-word; -webkit-user-select: text; user-select: text;
}

/* tabs horizontal scroll + folder icon */
.tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 5px; }
.tab svg { vertical-align: middle; }

/* editable user bubble hint */
.msg.user .bubble.editable { cursor: pointer; }
.msg.user .bubble.editable:active { background: var(--track); }

/* attachment thumbnails (pending strip + in-bubble) */
.attachstrip { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 6px 8px; }
.attachstrip:empty { display: none; }
.athumb { position: relative; width: 60px; height: 60px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.athumb img { width: 100%; height: 100%; object-fit: cover; }
.athumb-pct { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0; font-size: 11px; line-height: 1.2; text-align: center; color: #fff; background: rgba(0,0,0,.55); }
.athumb-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.bubimgs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.bubimgs img { max-width: 160px; max-height: 160px; border-radius: 12px; object-fit: cover; }

/* assistant-sent media (generated images / tts audio) */
.msg.assistant .chatmedia { max-width: 78%; max-height: 320px; border-radius: 16px; border: 1px solid var(--border); display: block; }
.msg.assistant audio { width: 78%; max-width: 320px; margin: 2px 0; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* CLAUDE.md editor */
.codearea {
  width: 100%; min-height: 46vh; border: 1px solid var(--border); background: var(--surface);
  border-radius: 14px; padding: 14px; font-family: var(--mono); font-size: 13px; line-height: 1.55;
  color: var(--text); resize: none; -webkit-user-select: text; user-select: text;
}
.codearea:focus { outline: none; border-color: var(--accent); }
/* 日记式无框编辑区（CLAUDE.md / 压缩提示词）：去掉框线和底色，正文直接落在纸面上、字号放大 */
.edita {
  width: 100%; border: none; background: none; outline: none; resize: none;
  padding: 8px 2px; font-family: inherit; font-size: 16.5px; line-height: 1.7;
  color: var(--text); -webkit-user-select: text; user-select: text;
}
.edita.md { padding-bottom: 24px; }
/* in the editor sheets, the area fills the sheet and scrolls internally
   (so swiping the text doesn't fight the sheet drag) */
#claudeScrim .sheetbody, #compactScrim .sheetbody, #mcpCfgScrim .sheetbody { display: flex; flex-direction: column; }
#claudeScrim .edita, #compactScrim .edita, #mcpCfgScrim .codearea { flex: 1; min-height: 0; overflow-y: auto; }

/* sticky sheet header (so ✕ / path stay visible while a non-drag sheet scrolls) */
.sheethdr { position: sticky; top: 0; background: var(--bg); z-index: 2; }
/* file-manager bits in dir browser */
.dirtool { display: flex; gap: 8px; padding: 4px 0 10px; }
.dirtool .btn { padding: 11px; font-size: 14px; }
.diritem { -webkit-user-select: none; user-select: none; }

/* input box: expand-to-fullscreen button */
.inputbox { position: relative; }
.expandbtn { position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; border: none; background: transparent; color: var(--muted); border-radius: 8px; display: flex; align-items: center; justify-content: center; z-index: 2; }
.expandbtn:active { background: var(--surface-2); }
#composer { padding-right: 40px; }

/* "+" panel: more list (browse / compact) */
.morelist { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 6px; }
.moreitem { display: flex; align-items: center; gap: 12px; width: 100%; border: none; background: transparent; color: var(--text); padding: 14px 6px; font-size: 16px; text-align: left; }
.moreitem svg { color: var(--muted); flex: none; }
.moreitem:active { background: var(--surface-2); border-radius: 12px; }

/* fullscreen compose editor */
.composeover { position: fixed; inset: 0; background: var(--bg); z-index: 250; display: none; flex-direction: column; }
.composeover.show { display: flex; }
.composehdr { display: flex; align-items: center; padding: calc(var(--safe-top) + 8px) 10px 8px; }
.composetext { flex: 1; border: none; background: transparent; outline: none; padding: 8px 20px calc(var(--safe-bottom) + 20px); font-size: 18px; line-height: 1.6; color: var(--text); resize: none; -webkit-user-select: text; user-select: text; }

/* + panel: tools sheet below the input. The whole dock rides up so the tools
   sit at the bottom (thumb reach) with the input above them, over a dim backdrop. */
.plusback { position: absolute; inset: 0; z-index: 5; background: rgba(20,18,14,.32); opacity: 0; display: none; transition: opacity .22s ease; }
.plusback.show { display: block; }
.plusback.in { opacity: 1; }
.pluspanel {
  display: none; margin-top: 8px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent); border-radius: 24px;
  box-shadow: 0 10px 32px rgba(var(--shadow),.16), 0 2px 6px rgba(var(--shadow),.06);
}
.plusinner { padding: 8px; }
.roundbtn svg { transition: transform .2s ease; }
.roundbtn.open svg { transform: rotate(45deg); }
.attachcard .aci { width: 100%; height: 60px; background: color-mix(in srgb, var(--bg) 45%, transparent); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--text); }
.attachcard:active .aci { background: var(--surface-2); }

/* MCP server list + toggle switch */
.mcprow { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.mcprow:last-of-type { border-bottom: none; }
.mcpmeta { flex: 1; min-width: 0; }
.mcpname { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcpstatus { font-size: 13px; margin-top: 2px; color: var(--muted); }
.mcpstatus.ok { color: var(--ok); }
.mcpstatus.auth { color: var(--accent); }
.mcpstatus.err { color: var(--err); }
.switch { width: 46px; height: 28px; border-radius: 14px; border: none; background: var(--track); position: relative; flex: none; transition: background .2s; }
.switch.on { background: var(--accent); }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch.on .knob { left: 21px; }

/* inline images inside markdown (assistant-generated) */
.md img { max-width: 100%; max-height: 360px; border-radius: 14px; display: block; margin: 8px 0; border: 1px solid var(--border); }

/* ============================================================
   motion & new components (drawer / search / swipe edge)
   ============================================================ */
:root { --red: #c4231d; --red-deep: #8c1410; --door-red: #ef4a3d; }

/* brand mark glyphs */
.splash-glyph .sg-tau, .drawer-brand .db-tau, .splash-name { font-family: var(--serif); }
.drawer-brand { font-family: var(--mono); }

/* ---- message entrance ---- */
@keyframes msgin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.msg { margin: 10px 0; animation: msgin .26s ease both; }

/* ---- chat screen slide-in (when a session opens) ---- */
@keyframes chatin { from { transform: translateX(22px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }
#chat.active { animation: chatin .28s cubic-bezier(.32,.72,0,1); }
#chat { will-change: transform; }

/* ---- left settings/app drawer ---- */
.drawer-back { position: fixed; inset: 0; z-index: 110; display: none; background: rgba(20,18,14,.30); opacity: 0; transition: opacity .26s ease; }
.drawer-back.show { display: block; }
.drawer-back.in { opacity: 1; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 111; width: 68%; max-width: 268px;
  background: var(--surface); box-shadow: none;
  transform: translateX(-100%); transition: transform .3s cubic-bezier(.32,.72,0,1), box-shadow .3s ease;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 30px) 0 calc(var(--safe-bottom) + 22px);
}
/* shadow only while open, else it bleeds onto the screen from off-canvas */
.drawer.show { box-shadow: 10px 0 50px rgba(var(--shadow),.24); }
.drawer.show { transform: translateX(0); }
.drawer-head { padding: 6px 24px 22px; border-bottom: 1px solid var(--border); }
.drawer-brand { font-size: 27px; font-weight: 700; color: var(--text); display: flex; align-items: baseline; }
.drawer-brand .db-tau { color: var(--accent); }
.drawer-sub { font-size: 13px; color: var(--muted); margin-top: 8px; }
/* in-app update card: darker shaded box than the (white) drawer, framed */
.drawerupd { margin: 14px 16px 4px; padding: 13px 15px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border); }
.du-top { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.du-badge { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #fff;
  background: var(--accent); border-radius: 6px; padding: 2px 7px; }
.du-ver { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text); }
/* notes scroll inside a capped box — a long changelog must not swallow the drawer
   (it pushed 日记/文件/用量/设置 below reach, user-reported) */
.du-notes { font-size: 12.5px; line-height: 1.7; color: var(--muted); white-space: pre-wrap;
  word-break: break-word; margin-bottom: 11px; max-height: 5.2em; overflow-y: auto; }
.du-dl { width: 100%; border: none; border-radius: 11px; padding: 11px; font-size: 14px; font-weight: 600;
  background: var(--accent); color: #fff; }
.du-dl:active { background: var(--accent-press); }

.drawer-items { flex: 1; padding: 14px 12px; overflow-y: auto; }
.draweritem { display: flex; align-items: center; gap: 14px; width: 100%; border: none; background: transparent; color: var(--text); padding: 14px 16px; font-size: 16px; border-radius: 12px; text-align: left; }
.draweritem svg { color: var(--muted); flex: none; }
.draweritem:active { background: var(--surface-2); }
/* 「我的状态」右侧的当前状态一瞥：单行截断，别把条目撑高 */
.dr-sub { margin-left: auto; max-width: 40%; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-foot { padding: 6px 24px 0; font-size: 11px; color: var(--muted); letter-spacing: .06em; opacity: .7; }

/* ---- in-conversation search: everything floats over the live conversation ----
   layers: conversation (bottom) < results (scroll) < search box (top). No backdrop. */
#searchOverlay { position: fixed; inset: 0; z-index: 130; display: none; opacity: 0; background: rgba(20,18,14,.34); }
#searchOverlay.show { display: block; }
/* results scroll the full height and pass beneath the floating search box */
.search-results {
  position: absolute; inset: 0; z-index: 1; overflow-y: auto;
  padding: calc(var(--safe-top) + 88px) 16px calc(var(--safe-bottom) + 30px);
}
/* the search box is its own floating box on top; the area around it clicks through */
.search-bar-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; padding: calc(var(--safe-top) + 14px) 16px 0; pointer-events: none; }
.search-box {
  width: 100%; border: none; background: var(--surface); color: var(--text);
  border-radius: 26px; padding: 16px 20px; font-size: 18px; outline: none; pointer-events: auto;
  font-family: var(--serif); letter-spacing: .01em;
  box-shadow: 0 10px 30px rgba(var(--shadow),.18), 0 2px 6px rgba(var(--shadow),.08);
}
.search-box::placeholder { color: var(--muted); font-size: 14px; letter-spacing: 0; }
.search-row { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.search-row .search-box { flex: 1; width: auto; }
/* 全文搜索结果：成对 U/A */
.dlgcard .dlg-turn { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.45; padding: 3px 0; color: var(--muted); }
.dlgcard .dlg-turn.hit { color: var(--text); }
.dlgcard .dlg-who { flex: none; color: var(--muted); font-size: 12px; min-width: 2.8em; }
.dlgcard .dlg-text { flex: 1; min-width: 0; word-break: break-word; }
/* 重命名/输入悬浮框：仿搜索框浮在顶部、无框线、点空白返回，只一个保存键 */
/* 重命名 / 确认删除：对齐对话输入框的方圆框；操作键在框下方、只有框里有字才出现 */
.prompt-float { position: absolute; top: calc(var(--safe-top) + 56px); left: 14px; right: 14px; z-index: 2;
  display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.prompt-float > * { pointer-events: auto; }
.prompt-inbox { display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border-radius: 24px; padding: 7px 7px 7px 18px;
  box-shadow: 0 12px 34px rgba(var(--shadow),.18), 0 2px 8px rgba(var(--shadow),.08); }
.prompt-inbox textarea { flex: 1; min-width: 0; border: none; background: transparent; color: var(--text);
  font-size: 17px; font-family: var(--ui); line-height: 1.4; outline: none; resize: none; max-height: 38vh; padding: 8px 0; }
.prompt-inbox textarea::placeholder { color: var(--muted); }
.prompt-go { flex: none; width: 40px; height: 40px; border: none; background: transparent; color: var(--accent);
  font-size: 25px; line-height: 1; display: none; align-items: center; justify-content: center; }
.prompt-go.show { display: flex; }                    /* 有字才出现 */
.prompt-go:active { opacity: .5; }
.prompt-go.danger { color: #d0492f; }                 /* 删除：仅红箭头、无底纹 */
/* 文件管理：复制当前路径 */
.dircopy { flex: none; border: none; background: transparent; color: var(--muted); padding: 8px 6px; }
.dircopy:active { color: var(--text); }
.search-empty { text-align: center; color: rgba(255,255,255,.85); margin-top: 12vh; font-size: 15px; line-height: 1.8; }
.searchcard { background: var(--surface); border-radius: 16px; padding: 15px 17px; margin: 10px 0; box-shadow: 0 6px 20px rgba(var(--shadow),.16); }
.searchcard:active { transform: scale(.995); }
.sc-snippet {
  font-size: 15px; line-height: 1.55; color: var(--text); white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.searchcard.expanded .sc-snippet { display: block; -webkit-line-clamp: unset; }
.searchcard mark { background: var(--accent-weak); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---- usage strip (top of the in-conversation search) ---- */
.usagestrip { pointer-events: auto; margin: 0 4px 10px; }
.us-line {
  display: flex; align-items: center; gap: 15px; cursor: pointer;
  background: rgba(255,255,255,.92); border-radius: 15px; padding: 9px 15px;
  font-family: var(--mono); font-size: 13px; color: var(--text);
  box-shadow: 0 6px 18px rgba(var(--shadow),.14);
}
.us-line b { color: var(--accent); font-weight: 700; }
.us-caret { margin-left: auto; color: var(--muted); font-size: 11px; transition: transform .2s; }
.usagestrip.open .us-caret { transform: rotate(180deg); }
.us-detail { display: none; margin: 8px 4px 0; padding: 11px 16px; border-radius: 13px;
  background: rgba(255,255,255,.88); font-family: var(--mono); font-size: 12.5px;
  color: var(--text); line-height: 1.85; box-shadow: 0 6px 18px rgba(var(--shadow),.12); }
.us-detail .lbl { color: var(--muted); }
.us-detail b { color: var(--accent); }
.usagestrip.open .us-detail { display: block; }

/* ---- usage full panel (terminal-style, read-only) ---- */
#usageFull { position: fixed; inset: 0; z-index: 260; display: none; flex-direction: column; background: var(--bg); }
#usageFull.show { display: flex; }
.uf-head { display: flex; align-items: center; gap: 6px; padding: calc(var(--safe-top) + 10px) 10px 8px; }
.uf-back, .uf-refresh { width: 42px; height: 42px; border: none; background: transparent; color: var(--muted);
  font-size: 22px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.uf-back:active, .uf-refresh:active { background: var(--surface-2); }
.uf-title { flex: 1; text-align: center; color: var(--text); font-family: var(--mono); font-size: 15px; letter-spacing: .1em; }
.uf-term { flex: 1; margin: 0; padding: 6px 18px calc(var(--safe-bottom) + 26px); overflow: auto;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: #b9e0a8;
  white-space: pre; -webkit-user-select: text; user-select: text; }

/* brief highlight when search jumps to a message */
@keyframes jumpflash { 0%, 100% { background: transparent; } 30% { background: var(--accent-weak); } }
.msg.jumpflash .bubble, .msg.jumpflash .text, .msg.jumpflash .md { animation: jumpflash 1.3s ease; border-radius: 12px; }

/* ---- settings menu (secondary) ---- */
.setmenu { margin-top: 10px; background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: 0 1px 2px rgba(var(--shadow),.04); }
.setrow { display: flex; align-items: center; gap: 14px; width: 100%; border: none; background: transparent; color: var(--text); padding: 13px 16px; text-align: left; }
.setrow + .setrow { border-top: 1px solid var(--border); }
.setrow:active { background: var(--surface-2); }
.sr-ic { color: var(--muted); flex: none; display: flex; }
.sr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sr-name { font-size: 16px; }
.sr-desc { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-chev { color: var(--muted); font-size: 20px; flex: none; }
.togglerow { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px; font-size: 16px; }

/* ---- font scale + family (preferences) ---- */
:root { --fs-scale: 1; }
.msg.user .bubble, .msg.assistant .text, .msg.assistant .md { font-size: calc(16px * var(--fs-scale)); }
body.sysfont {
  --ui: -apple-system, "PingFang SC", "MiSans", "HarmonyOS Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --serif: "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}

/* ---- settings tertiary controls ---- */
.setitem { padding: 14px 16px; }
.setitem + .setitem { border-top: 1px solid var(--border); }
.setitem.disabled { opacity: .42; pointer-events: none; }
.setitem.disabled .slider { pointer-events: none; }
.sliderrow .sl-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; margin-bottom: 10px; }
.sliderrow .sl-val { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.slider { width: 100%; accent-color: var(--accent); height: 26px; }
.segrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.segrow .seg-label { font-size: 16px; flex: none; }
.segment { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.segment .seg { border: none; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.segment .seg.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(var(--shadow),.12); }
.btnrow { padding: 8px 10px; }
.h2 { color: var(--text); }
/* 强调色 swatch 选择行 */
.swatchrow { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.swatchrow .seg-label { font-size: 16px; }
.swatchdots { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.swatchdot { width: 30px; height: 30px; border-radius: 50%; border: none; padding: 0; box-shadow: inset 0 0 0 1px rgba(var(--shadow),.18); }
.swatchdot.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.pickrow { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.pickrow .seg-label { font-size: 16px; }
.picklist { display: flex; flex-direction: column; margin-top: 10px; }
.pickopt { display: flex; align-items: center; justify-content: space-between; border: none; background: transparent; color: var(--text); font-size: 15px; padding: 12px 2px; text-align: left; }
.pickopt + .pickopt { border-top: 1px solid var(--hair); }
.pickopt:active { background: var(--surface-2); border-radius: 10px; }
.pickopt .pickck { color: var(--accent); opacity: 0; font-size: 15px; }
.pickopt.on .pickck { opacity: 1; }
.pickopt.on { color: var(--accent); }
/* 电影模式 */
.cinemabar { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 5px 0; font-size: 12.5px; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--border); }
.cinemabar .cb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: cbpulse 2.2s ease-in-out infinite; }
.cinemabar.typing { color: var(--accent); }
@keyframes cbpulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.cinhead { padding: 6px 4px 10px; }
.cinhead .cintitle { font-size: 15px; color: var(--muted); }
.cinnote { color: var(--muted); font-size: 13.5px; line-height: 1.6; padding: 12px 6px 16px; }
.cin-hint { color: var(--muted); font-size: 12px; }
/* 高级设置折叠头 */
.cin-advhead { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 16px; color: var(--text); }
.cin-advhead .cin-caret { color: var(--muted); transition: transform .2s ease; }
.cin-advhead.open .cin-caret { transform: rotate(90deg); }
/* 高级设置：分组卡片（节奏 / 用量与刹车 / 模型），不再一长条平铺 */
.cin-group { margin-top: 8px; }
.cin-grouphd { padding: 11px 16px 3px; font-size: 12px; color: var(--muted); letter-spacing: .5px; }
.cin-modelrow { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.cin-modelrow .seg-label { font-size: 16px; flex: 1; }
.cin-modelrow .cin-modelval { color: var(--muted); font-size: 14px; text-align: right; }
.cin-modelrow .cin-modelchev { color: var(--muted); font-size: 18px; flex: none; }
/* 披露式设置行：平时只一行（标签+当前值），点开才露滑块 */
.cin-setrow { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.cin-setrow .cin-setlab { font-size: 16px; flex: 1; }
.cin-setrow .cin-setval { color: var(--muted); font-size: 14px; text-align: right; min-width: 5.5em; font-variant-numeric: tabular-nums; }   /* 固定宽+等宽数字：多出 .5 一位也不挤动布局 */
.cin-setrow .cin-setchev { color: var(--muted); font-size: 18px; flex: none; transition: transform .2s ease; }
.cin-set.open .cin-setchev { transform: rotate(90deg); }
.cin-set.open .cin-setrow .cin-setval { color: var(--accent); }
/* 滑动条：只一条底纹填充进度（无轨道底纹、条上无数字）；数值显示在上面那行 */
.cin-slidewrap { position: relative; height: 40px; margin: 2px 2px 12px; border-radius: 11px; overflow: hidden; }
.cin-slidefill { position: absolute; left: 0; top: 0; bottom: 0; min-width: 6px; background: var(--surface-2); border-radius: 11px; }
.cin-slide { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; -webkit-appearance: none; appearance: none; cursor: ew-resize; }
/* 行内可编辑数值：点数字原地改，不冒输入框、保留单位、字体字号沿用原值样式 */
.cin-numrow { display: flex; align-items: center; gap: 10px; }
.cin-numrow .cin-setlab { font-size: 16px; flex: 1; }
.cin-numval { font-size: 14px; color: var(--muted); white-space: nowrap; }
.cin-numinp { border: none; background: transparent; color: var(--muted); font: inherit; text-align: right; padding: 0 1px; outline: none; }
.cin-numunit { color: var(--muted); }
/* 时间线页（中性、简洁） */
.cl-day { text-align: center; color: var(--muted); font-size: 12px; margin: 20px 0 8px; letter-spacing: .5px; }
.cl-row { display: flex; gap: 12px; padding: 5px 6px; font-size: 14px; line-height: 1.6; }
.cl-row .cl-t { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; flex: 0 0 auto; padding-top: 1px; }
.cl-row.cl-said .cl-x { color: var(--text); }
.cl-row.cl-dim .cl-x { color: var(--muted); }
.cl-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 56px 28px; line-height: 1.8; }
.cl-row .cl-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; align-self: center; }
.cl-row.cl-watch .cl-x { color: var(--muted); font-style: italic; }
.cl-row .cl-meta { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; margin-left: auto; align-self: center; opacity: .7; }
.rc-cap { text-align: center; font-size: 12px; color: var(--muted); letter-spacing: 1px; margin: 2px 0 10px; }
/* 标题旁「输入中」省略号动画（守夜唤醒正在打字时） */
.typing-dots { display: inline-flex; align-items: center; gap: 3px; margin-left: 7px; vertical-align: middle; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: tdot 1.3s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: .22s; }
.typing-dots i:nth-child(3) { animation-delay: .44s; }
@keyframes tdot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
/* 小票 receipt */
.receipt { font-family: var(--mono); background: var(--surface); color: var(--text); max-width: 340px; margin: 0 auto; padding: 16px 18px 12px; border-radius: 3px; box-shadow: 0 6px 24px rgba(var(--shadow), .14); }
.rc-mark { width: 34px; height: 34px; margin: 0 auto 6px; background: var(--text); -webkit-mask: url(telos-tau.png) center/contain no-repeat; mask: url(telos-tau.png) center/contain no-repeat; }
.rc-title { text-align: center; letter-spacing: 3px; font-size: 15px; font-weight: 700; }
.rc-sub { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 5px; line-height: 1.55; }
.rc-rule { border-top: 1px dashed var(--hair); margin: 9px 0; }
.rc-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 1.66; }
.rc-row .rc-l { color: var(--muted); white-space: nowrap; }
.rc-row .rc-r { text-align: right; font-variant-numeric: tabular-nums; }
.rc-row.rc-head .rc-l, .rc-row.rc-head .rc-r { color: var(--text); font-weight: 700; }
.rc-row.rc-total .rc-l, .rc-row.rc-total .rc-r { font-weight: 700; font-size: 14px; }
.rc-row.rc-dim { font-size: 12px; margin-top: -2px; }   /* 恢复时间：紧贴上一行额度、淡一档当子信息 */
.rc-row.rc-dim .rc-l, .rc-row.rc-dim .rc-r { color: var(--muted); }
.rc-row.us-arc { cursor: pointer; }
.rc-row.us-arc .rc-r { color: var(--accent); }
.rc-row.us-arc.on .rc-r { color: var(--muted); }
.rc-foot { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 10px; letter-spacing: .3px; }
/* 全量存档·压缩点分隔线（淡、居中「压缩」当地标） */
.hist-compact { display: flex; align-items: center; gap: 10px; margin: 16px 10px; color: var(--muted); font-size: 11.5px; opacity: .72; }
.hist-compact::before, .hist-compact::after { content: ''; flex: 1; height: 1px; background: var(--hair); }
.hist-compact span { letter-spacing: .12em; white-space: nowrap; }
.rc-barcode { height: 30px; width: 62%; max-width: 200px; margin: 10px auto 4px; background: var(--text);
  -webkit-mask: url(telos-barcode.png) center/contain no-repeat; mask: url(telos-barcode.png) center/contain no-repeat; }
.rc-code { text-align: center; color: var(--muted); font-size: 10.5px; letter-spacing: 1px; }
.rc-loading { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 0; letter-spacing: 3px; }
.uf-scroll { flex: 1; overflow-y: auto; padding: 14px 14px calc(var(--safe-bottom) + 22px); }
.receipt.mini { box-shadow: none; background: transparent; max-width: none; padding: 6px 2px 2px; border-radius: 0; }
.receipt.mini .rc-barcode { height: 28px; width: 72%; max-width: 240px; margin: 10px auto 2px; }

/* ============ disconnect screen (与世界断联) ============ */
@keyframes redflick {0%{opacity:1}3%{opacity:.06}6%{opacity:1}9%{opacity:.7}11%{opacity:1}34%{opacity:1}37%{opacity:.1}40%{opacity:1}61%{opacity:.85}63%{opacity:1}82%{opacity:.04}85%{opacity:1}93%{opacity:.6}95%{opacity:1}100%{opacity:1}}
@keyframes blackcut {0%,11%{opacity:0}12%{opacity:.94}14%{opacity:0}46%,47%{opacity:0}48%{opacity:.72}49.5%{opacity:0}73%{opacity:0}74%{opacity:.88}75.5%{opacity:0}100%{opacity:0}}
@keyframes scanfall {from{background-position-y:0}to{background-position-y:14px}}
@keyframes fallshake {0%,100%{transform:translate(0,0)}25%{transform:translate(.6px,1px)}50%{transform:translate(-.5px,-.5px)}75%{transform:translate(.4px,1.2px)}}
@keyframes glitchx {0%,100%{transform:translateX(0)}48%{transform:translateX(0)}50%{transform:translateX(-2px)}52%{transform:translateX(2px)}54%{transform:translateX(0)}}
@keyframes sigflick {0%,100%{opacity:1}45%{opacity:1}48%{opacity:.12}55%{opacity:1}78%{opacity:.2}82%{opacity:1}}
@keyframes discspin {to{transform:rotate(360deg)}}
@keyframes dotwave {0%,100%{opacity:.18;transform:translateY(0)}50%{opacity:1;transform:translateY(-2.5px)}}
@keyframes toastpulse {0%,100%{opacity:.5}50%{opacity:1}}

#discScreen {
  position: fixed; inset: 0; z-index: 240; display: none; overflow: hidden;
  background: #0a0605; transform-origin: top center;
  transition: transform .55s cubic-bezier(.5,0,.2,1), opacity .4s ease;
}
#discScreen.show { display: block; }
#discScreen.collapsed { transform: scaleY(.04); opacity: 0; pointer-events: none; }
.disc-red { position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, #ef4233 0%, #c4231d 42%, #5e0f0c 100%); animation: redflick 1.35s steps(16,end) infinite; }
.disc-black { position: absolute; inset: 0; background: #070403; animation: blackcut 1.9s steps(1,end) infinite; }
.disc-scan { position: absolute; inset: 0; opacity: .08; background-image: repeating-linear-gradient(to bottom, rgba(0,0,0,.4) 0 1px, transparent 1px 4px); animation: scanfall .5s linear infinite; }
.disc-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; animation: fallshake .7s ease-in-out infinite; padding: 0 24px; }
.disc-lbl { font-family: var(--mono); text-transform: uppercase; letter-spacing: .24em; font-size: 11px; color: rgba(255,215,208,.85); white-space: nowrap; animation: sigflick 1.3s steps(1) infinite; }
.disc-title { display: flex; align-items: center; animation: glitchx 2.4s steps(1) infinite; }
.disc-title span { font-weight: 300; font-size: 31px; letter-spacing: .12em; color: #ffd9d2; text-shadow: 0 0 26px rgba(0,0,0,.5); }
.disc-sub { font-size: 13.5px; letter-spacing: .06em; color: rgba(255,215,208,.62); }
.disc-tel { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: rgba(255,150,140,.85); }
.disc-dots { display: inline-flex; align-items: flex-end; gap: 3px; margin-left: 10px; }
.disc-dots i { width: 5px; height: 5px; border-radius: 50%; background: #ffd9d2; animation: dotwave 1.5s infinite ease-in-out; }
.disc-dots i:nth-child(2){animation-delay:.12s} .disc-dots i:nth-child(3){animation-delay:.24s} .disc-dots i:nth-child(4){animation-delay:.36s} .disc-dots i:nth-child(5){animation-delay:.48s} .disc-dots i:nth-child(6){animation-delay:.6s}
.disc-dots.sm i { width: 4px; height: 4px; background: #ffd7d0; }
.disc-bottom { position: absolute; bottom: calc(var(--safe-bottom) + 44px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.disc-recon { display: flex; align-items: center; gap: 9px; }
.disc-recon span:last-child { font-size: 12.5px; letter-spacing: .08em; color: rgba(255,215,208,.7); }
.disc-spin { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid rgba(255,215,208,.5); border-top-color: transparent; display: block; animation: discspin 1s linear infinite; }
.disc-dismiss { font-family: var(--mono); font-size: 12px; letter-spacing: .34em; text-transform: uppercase; border: none; background: transparent; padding: 9px 14px; color: rgba(255,215,208,.72); }
/* blink off: steady red field, no red/black strobe or label/title flicker (telemetry + falling stay) */
#discScreen.noblink .disc-red { animation: none; opacity: 1; }
#discScreen.noblink .disc-black { display: none; }
#discScreen.noblink .disc-lbl, #discScreen.noblink .disc-title { animation: none; }
#discPill {
  position: fixed; top: calc(var(--safe-top) + 12px); left: 14px; right: 14px; height: 46px; z-index: 241;
  display: none; align-items: center; gap: 11px; padding: 0 16px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(90deg, #c4231d 0%, #8c1410 100%);
  box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,120,110,.4);
  animation: redflick 1.6s ease-in-out infinite;
}
#discPill.show { display: flex; }
#discPill .dp-dot { width: 9px; height: 9px; border-radius: 50%; background: #ffd9d2; box-shadow: 0 0 8px #ef4233; animation: toastpulse 1s infinite; flex: none; }
#discPill > span:nth-child(2) { font-size: 13.5px; letter-spacing: .1em; color: #fff; font-weight: 500; }
#discPill .dp-tap { margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: .18em; color: rgba(255,255,255,.7); }

/* ---- file manager rows + transfer progress ---- */
.diritem.fileitem { display: flex; align-items: center; gap: 10px; }
.fmthumb { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; flex: none; background: var(--surface-2); }
.diritem .fm-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diritem .fm-sz { color: var(--muted); font-size: 12px; font-family: var(--mono); flex: none; }
.dirtool { display: flex; gap: 10px; padding: 2px 0 10px; }
.dirtool .btn { width: auto; flex: 1; padding: 10px; font-size: 14px; }
#fmProgress { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.fmprow { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.fmprow .fmp-n { flex: none; max-width: 36%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmprow .fmp-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.fmprow .fmp-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.fmprow .fmp-s { flex: none; color: var(--muted); font-family: var(--mono); font-size: 12px; min-width: 92px; text-align: right; }
/* uploading chip in the attach strip */
.atfile.up { position: relative; opacity: .9; }
.atfile-bar { position: absolute; left: 8px; right: 8px; bottom: 4px; height: 3px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.atfile-bar i { display: block; height: 100%; width: 0; background: var(--accent); }

.searchcard .sc-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; color: var(--text); }

/* ---- multi-select (session list batch delete) ---- */
.scard.selected { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-weak); }
.selectbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: none; gap: 10px; padding: 12px 16px calc(var(--safe-bottom) + 12px); background: var(--surface); box-shadow: 0 -6px 20px rgba(var(--shadow),.14); }
.selectbar.show { display: flex; }
.selbtn { flex: 1; border: none; border-radius: 13px; padding: 13px; font-size: 15px; font-weight: 600; background: var(--surface-2); color: var(--text); }
.selbtn.danger { background: var(--err); color: #fff; }
.selbtn:disabled { opacity: .45; }

/* ---- import: pick conversations ---- */
.improw { display: flex; align-items: center; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--border); }
.improw.dim { opacity: .4; }
.impbox { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; color: #fff; flex: none; font-size: 14px; font-weight: 700; }
.improw.on .impbox { background: var(--accent); border-color: var(--accent); }
.impmeta { flex: 1; min-width: 0; }
.impname { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.impsub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* extra modes: 接受编辑 / 全部允许 */
.micon.auto { color: var(--ok); }
.micon.bypass { color: var(--accent); }
.modechip.plan #modeLabel { color: #2f9e8f; }
.modechip.auto #modeLabel { color: var(--ok); }
.modechip.bypass #modeLabel { color: var(--accent); }

/* ============ 定时唤醒 / 小纸条 / 日记 ============ */
.wkrow { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px; font-size: 15px; }
.wkhint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 12px 2px 14px; }
.wklabel { font-size: 13px; color: var(--muted); margin: 16px 2px 8px; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; padding: 9px 0; border: none; background: none; border-radius: 9px; color: var(--muted); font-size: 14px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.wkgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.wktrow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.wktrl { width: 22px; flex: none; color: var(--muted); font-size: 13px; }
.wkscroll { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.wkscroll::-webkit-scrollbar { display: none; }
.wkt { flex: none; min-width: 44px; padding: 9px 12px; text-align: center; border-radius: 10px; background: var(--surface-2); color: var(--text); border: none; font-size: 14px; }
.wkt.on { background: var(--accent); color: #fff; font-weight: 600; }
/* 闹钟式竖向滚轮（时/分/日期/时区共用） */
.wkclock { display: flex; align-items: center; justify-content: center; gap: 3px; }
.wkclock-sep { font-size: 18px; color: var(--text); font-weight: 600; padding-bottom: 2px; }
.whl { position: relative; width: 100%; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, transparent, #000 26%, #000 74%, transparent); mask-image: linear-gradient(180deg, transparent, #000 26%, #000 74%, transparent); }
.wkclock .whl { width: auto; flex: 1; max-width: 84px; }
/* 紧凑单行滚轮（VIS=1）：只显当前值、无上下预览、无渐隐遮罩，做成可滚的小药丸 */
.whl-flat { -webkit-mask-image: none; mask-image: none; background: var(--surface-2); border-radius: 8px; }
.wkclock.compact { gap: 5px; }
.wkclock.compact .whl { min-width: 44px; max-width: 52px; }
.wkclock.compact .whl-item, .wkinline-c .whl-item { color: var(--text); font-size: 17px; }
.wkclock.compact .whl-item.on, .wkinline-c .whl-item.on { font-size: 17px; font-weight: 600; }
/* 标签 + 控件同一行 */
.wkinline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px; }
.wkinline-l { color: var(--muted); font-size: 15px; flex: none; }
.wkinline-c { flex: none; }
.wkinline-c.whl-flat { min-width: 92px; max-width: 132px; padding: 0 4px; }
.whl-scroll { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.whl-scroll::-webkit-scrollbar { display: none; }
/* 行高要和 wkWheel 里的 ITEM 一致（现 30）；band 的 top/height 由 JS 按 ITEM 行内设定 */
.whl-item { height: 30px; line-height: 30px; text-align: center; scroll-snap-align: center; font-variant-numeric: tabular-nums; font-size: 16px; color: var(--muted); transition: color .12s, font-size .12s; }
.whl-item.on { color: var(--text); font-weight: 600; font-size: 18px; }
.whl-band { position: absolute; left: 4px; right: 4px; top: 60px; height: 30px; pointer-events: none; border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent); opacity: .5; }
/* 多个唤醒时间：列表 + 添加 */
.wkitem { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; }
.wkitem .wki-main { flex: 1; min-width: 0; }
.wkitem .wki-when { font-size: 15px; }
.wkitem .wki-sub { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.wkitem .wki-cc { font-size: 11px; color: var(--accent); flex: none; }
.wkitem .wki-del { flex: none; width: 30px; height: 30px; border: none; background: none; color: var(--muted); font-size: 20px; line-height: 1; }
.wkempty { font-size: 13px; color: var(--muted); padding: 4px 2px 10px; }
.wkcc-clear { width: 100%; border: none; background: var(--surface-2); color: var(--accent); font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-top: 2px; }
.wkadd { width: 100%; padding: 12px; border: 1px dashed var(--border); background: none; border-radius: 12px; color: var(--accent); font-size: 14px; font-weight: 600; margin-top: 2px; }
.wkadd:active { background: var(--surface-2); }
#wkEditor { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-top: 10px; }
.wkquick { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; }
.wkchip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; }
.wkchip:active { background: var(--surface-2); }
.wkselect { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 15px; font-family: inherit; }
input[type=datetime-local] { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 15px; font-family: inherit; }
#wkNote { width: 100%; margin-top: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 15px; font-family: inherit; }
#wkNote::placeholder { color: var(--muted); }

/* wake indicator on a session card */
.scard-wake { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--accent); margin-top: 4px; font-family: var(--mono); }
/* 守夜中：时间流动指示（冷场久了转冷色） */
.scard-cinema { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--accent); margin-top: 4px; font-family: var(--mono); }
.scard-cinema .cb-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: cbpulse 2.2s ease-in-out infinite; }
.scard-cinema.cold { color: var(--muted); }
.scard-busy { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--accent); margin-top: 4px; font-family: var(--mono); }
.scard-busy .sb-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: cbpulse 1.2s ease-in-out infinite; }
.scard-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; margin-left: 6px; }

/* sticky popup */
.stknote { background: #fff7e8; border: 1px solid #ecdcb8; border-radius: 12px; padding: 16px; font-size: 15px; line-height: 1.6; color: #4a3f2a; white-space: pre-wrap; word-break: break-word; margin-bottom: 16px; box-shadow: 0 1px 0 #e7d6b0 inset; }

/* diary write images */
.dwimg { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: none; }
.dwimg img { width: 100%; height: 100%; object-fit: cover; }
.dwimg.loading::after { content: '…'; color: var(--muted); }
.dwimg .x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; line-height: 1; }
/* 写日记整页:无框、铺满,右上绿色保存,大号日期,＋方块+缩略图左排,下面无边框列表 */
#diaryWrite .topbar { border: none; }
.dwsave { background: var(--accent); border: none; color: #fff; font-size: 14px; font-weight: 600; padding: 7px 18px; border-radius: 999px; }
.dwhead { display: flex; align-items: flex-end; gap: 10px; padding: 2px 20px 4px; }
.dwday { font-size: 40px; font-weight: 800; line-height: .95; color: var(--text); }
.dwdmeta { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); padding-bottom: 5px; }
.dwfull { flex: 1; min-height: 0; border: none; background: none; outline: none; resize: none; width: 100%; padding: 8px 20px; font-size: 17px; line-height: 1.7; color: var(--text); font-family: inherit; }
.dwimgrow { display: flex; align-items: center; gap: 8px; padding: 4px 20px; overflow-x: auto; }
.dwadd { flex: none; width: 84px; height: 84px; border: none; border-radius: 16px; background: var(--surface-2); color: var(--accent); font-size: 34px; display: flex; align-items: center; justify-content: center; }
.dwimgs { display: flex; gap: 8px; }
.dwlist { padding: 6px 20px calc(var(--safe-bottom) + 14px); }
.dwitem { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 0; border: none; background: none; color: var(--text); font-size: 15px; text-align: left; }
.dwitem .dwlbl { color: var(--muted); }
.dwitem .dwval { margin-left: auto; color: var(--text); }
.dwpicker { position: fixed; left: 12px; bottom: calc(var(--safe-bottom) + 62px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px; display: flex; flex-wrap: wrap; gap: 2px; max-width: 86vw; box-shadow: 0 8px 28px rgba(0,0,0,.18); z-index: 60; }
.dwpicker button { font-size: 22px; width: 42px; height: 42px; border-radius: 10px; background: none; border: none; }
.dwpicker button:active { background: var(--surface-2); }

/* diary page */
.dsection { font-family: var(--serif); font-size: 18px; font-weight: 700; margin: 18px 2px 10px; color: var(--text); }
.dsection:first-child { margin-top: 4px; }
.cal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 8px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 8px; }
.cal-lbl { font-size: 15px; font-weight: 600; }
.cal-nav { width: 34px; height: 34px; border: none; background: none; color: var(--muted); font-size: 20px; padding: 0; }
.cal-nav:active { color: var(--accent); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-w { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-cell { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 14px; border-radius: 9px; color: var(--text); }
.cal-cell.other { visibility: hidden; }
.cal-cell.sel { background: var(--accent); color: #fff; font-weight: 700; }
.cal-dot { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-cell.sel .cal-dot { background: #fff; }

.dwritebtn { width: 100%; margin: 12px 0 8px; padding: 11px; border-radius: 12px; border: 1px dashed var(--border); background: transparent; color: var(--accent); font-size: 14px; }
/* 时间线:时间在左,条目卡片在右,无边框 */
.dentry { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-start; }
.dtime { flex: none; width: 38px; padding-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.dbody { flex: 1; min-width: 0; background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.dentry.cc .dbody { background: var(--surface-2); }
.dmeta { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.dentry.cc .dmeta { color: var(--accent); }
.dtext { font-size: 15px; line-height: 1.6; }
.dentimgs { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; margin-top: 8px; }
.dthumb { max-width: 100%; max-height: 200px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.dthumb.multi { width: 80px; height: 80px; }
.dempty { color: var(--muted); font-size: 14px; padding: 10px 2px; }

/* 便签夹 list */
.noteitem { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; background: var(--surface); }
.noteitem.unread { border-color: var(--accent); }
.note-top { display: flex; gap: 10px; align-items: flex-start; }
.note-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 3em; overflow: hidden; }
.noteitem.open .note-text { max-height: none; }
.note-time { font-size: 11px; color: var(--muted); font-family: var(--mono); flex: none; }
.note-acts { display: none; gap: 8px; margin-top: 10px; }
.noteitem.open .note-acts { display: flex; }
.note-act { padding: 7px 14px; border-radius: 9px; background: var(--surface-2); color: var(--text); font-size: 13px; }
.note-act.danger { color: var(--err); background: none; border: none; padding-left: 6px; padding-right: 6px; }

/* diary overview cards */
.dcard { border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; background: var(--surface); }
.dcard-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcard-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.fav-text { font-size: 15px; line-height: 1.55; color: var(--text); white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== 总日历 ===== */
.calseg { display: flex; gap: 6px; background: var(--surface-2); border-radius: 11px; padding: 3px; margin: 2px 2px 12px; }
.calseg-b { flex: 1; border: none; background: none; color: var(--muted); font-size: 14px; padding: 8px; border-radius: 9px; }
.calseg-b.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.calwrap { position: relative; }
.cal-cell.hasmood { color: var(--text); }
.cal-cell.sel.hasmood { color: var(--text); font-weight: 700; box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.today:not(.sel) { box-shadow: inset 0 0 0 1.5px var(--border); }
.cal-marks { position: absolute; bottom: 3px; left: 0; right: 0; display: flex; justify-content: center; gap: 2px; }
.cm { width: 4px; height: 4px; border-radius: 50%; }
.cm-d { background: var(--accent); } .cm-e { background: #3b82c4; } .cm-t { background: #6aa84f; }

/* 心情色块（写日记里选当天心情，#d1efe3→#feb2b2） */
.moodsw-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.moodsw { height: 40px; border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); border-radius: 10px; }
.moodsw.on { box-shadow: 0 0 0 2px var(--text); }
.moodsw-lb { font-size: 13px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.22); }
.mb-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; border: 1px solid var(--border); }
.mb-word { margin-left: 6px; color: var(--muted); font-size: 13px; }

/* 当天面板：日程/待办/日记 */
.daypanel { margin-top: 16px; }
.dp-head { display: flex; align-items: baseline; gap: 8px; margin: 4px 2px 6px; }
.dp-head b { font-size: 24px; font-family: var(--serif); }
.dp-head span { font-size: 13px; color: var(--muted); }
.dp-sec { display: flex; align-items: center; justify-content: space-between; margin: 16px 2px 6px; }
.dp-sec-t { font-family: var(--serif); font-size: 16px; font-weight: 700; }
.dp-add { border: none; background: none; color: var(--accent); font-size: 14px; padding: 4px 6px; }
.dp-empty { color: var(--muted); font-size: 13px; padding: 3px 2px 6px; }
.agrow { display: flex; gap: 11px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.agck { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.6px solid var(--border); background: none; color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.agck.on { background: var(--accent); border-color: var(--accent); }
.agmid { flex: 1; min-width: 0; }
.agtitle { font-size: 15px; line-height: 1.4; word-break: break-word; }
.agrow.done .agtitle { color: var(--muted); text-decoration: line-through; }
.agnote { font-size: 12px; color: var(--muted); margin-top: 2px; }
.agby { font-size: 10px; color: var(--accent); border: 1px solid var(--accent); border-radius: 5px; padding: 0 4px; margin-left: 6px; }
.agdate { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-left: 6px; }
.dprev { border-radius: 12px; padding: 11px 13px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--border); }
.dprev-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.dprev-row { display: flex; gap: 10px; align-items: flex-start; }
.dprev-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dprev-thumb { flex: none; width: 66px; height: 66px; object-fit: cover; border-radius: 8px; background: var(--surface-2); }

/* 日记详情（只读） */
.dvcard { border-radius: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--border); }
.dv-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.dv-text { font-size: 16px; line-height: 1.7; }
.dv-acts { display: flex; gap: 10px; margin-top: 18px; }
.dv-btn { flex: 1; padding: 11px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; color: var(--text); }
.dv-btn.danger { color: var(--err); border-color: transparent; background: none; }

/* 贴在日历上的便利贴 */
.pinlayer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.pinnote { position: absolute; pointer-events: auto; max-width: 44%; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; font-size: 11px; line-height: 1.35; box-shadow: 0 3px 8px rgba(0,0,0,.16); transform: translate(-50%,-50%) rotate(-2deg); }
.pinnote.drag { z-index: 9; transform: translate(-50%,-50%) scale(1.05); box-shadow: 0 8px 20px rgba(0,0,0,.28); }
.pinnote.open { z-index: 9; }
.pinnote-t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.pin-acts { display: none; gap: 6px; margin-top: 6px; }
.pinnote.open .pin-acts { display: flex; }
.pin-a { font-size: 10px; border: none; background: var(--surface-2); border-radius: 5px; padding: 3px 7px; color: var(--text); }

/* 便签栏（右侧滑出） */
.stickypanel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 111; width: 80%; max-width: 320px; background: var(--surface); transform: translateX(100%); transition: transform .3s cubic-bezier(.32,.72,0,1), box-shadow .3s ease; display: flex; flex-direction: column; padding: calc(var(--safe-top) + 24px) 0 calc(var(--safe-bottom) + 18px); }
.stickypanel.show { transform: translateX(0); box-shadow: -10px 0 50px rgba(var(--shadow),.24); }
.sp-head { padding: 6px 20px 14px; border-bottom: 1px solid var(--border); }
.sp-title { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.sp-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.sp-body { flex: 1; overflow-y: auto; padding: 14px; }
.panelnote { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; margin-bottom: 10px; box-shadow: 0 1px 5px rgba(0,0,0,.05); }
.panelnote.pinned { border-color: var(--accent); }
.panelnote.unread { box-shadow: 0 1px 5px rgba(0,0,0,.05), inset 3px 0 0 var(--accent); }
.pn-text { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.pn-acts { display: flex; gap: 8px; margin-top: 9px; }
.pn-act { font-size: 12px; border: none; background: var(--surface-2); border-radius: 7px; padding: 5px 10px; color: var(--text); }
.pn-act.danger { color: var(--err); background: none; }

/* 心情取色弹层（写日记里替代 emoji） */
.dwpicker.moodpick { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; width: 80vw; max-width: 320px; }
.dwpicker.moodpick .dwpick-clr { width: 100%; height: auto; font-size: 13px; color: var(--muted); background: none; }

/* 日记页「只读态」：不能加图/改元数据，textarea 只读 */
#diaryWrite.readonly .dwadd { display: none; }
#diaryWrite.readonly .dwimg .x { display: none; }
#diaryWrite.readonly .dwitem { pointer-events: none; opacity: .85; }
#diaryWrite.readonly #dwText { background: transparent; }

/* ============ 回忆录 · 电子书阅读器 ============ */
#bookPage { background: color-mix(in srgb, var(--bg) 88%, var(--surface-2) 12%); }
.bookbar { background: transparent; }
.booktitle { font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bookfind { display: none; align-items: center; gap: 6px; padding: 2px 12px 10px; }
.bookfind.show { display: flex; }
.bookfind input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 12px; font: inherit; font-size: 15px; color: var(--text); outline: none; }
.bf-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }
.bf-nav { background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  width: 34px; height: 34px; flex: none; color: var(--text); font-size: 14px; }
.bookscroll { position: relative; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.bookbody { max-width: 620px; margin: 0 auto; padding: 8px 26px calc(var(--safe-bottom) + 110px);
  font-family: var(--serif); font-size: 16.5px; line-height: 2.05; color: var(--text);
  overflow-wrap: break-word; }
.bookbody h1 { font-family: var(--serif); font-size: 27px; text-align: center; font-weight: 700;
  margin: 46px 0 10px; line-height: 1.5; }
.bookbody h2 { font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 54px 0 18px; line-height: 1.6; }
.bookbody h2::before { content: ''; display: block; width: 34px; height: 2px; margin: 0 0 14px;
  background: color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 2px; }
.bookbody h3 { font-family: var(--serif); font-size: 17px; font-weight: 700; margin: 30px 0 10px; }
.bookbody p { margin: 0 0 14px; }
.bookbody ul, .bookbody ol { padding-left: 22px; margin: 0 0 14px; }
.bookbody li { margin: 5px 0; }
.bookbody blockquote { border-left: 2px solid var(--hair); margin: 14px 0; padding: 2px 0 2px 14px; color: var(--muted); }
.bookbody hr { border: none; border-top: 1px solid var(--hair); margin: 34px 18%; }
.bookbody code { font-family: var(--mono); font-size: 13.5px; background: var(--surface-2); border-radius: 5px; padding: 1px 5px; }
.bookcut { display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 48px 0; color: var(--muted); font-size: 13px; letter-spacing: .35em; text-indent: .35em; }
.bookcut span { letter-spacing: 0; text-indent: 0; font-size: 12px; opacity: .65; }
.bookempty { text-align: center; color: var(--muted); padding: 32vh 20px 0; font-family: var(--serif);
  font-size: 16px; line-height: 2.3; }
.bookempty span { font-size: 13px; opacity: .85; }
mark.bkm { background: color-mix(in srgb, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
mark.bkm.cur { background: color-mix(in srgb, var(--accent) 52%, transparent); }
.bookfoot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px;
  padding: 20px 18px calc(var(--safe-bottom) + 10px); font-size: 12px; color: var(--muted);
  background: linear-gradient(to top, color-mix(in srgb, var(--bg) 88%, var(--surface-2) 12%) 45%, transparent);
  pointer-events: none; font-variant-numeric: tabular-nums; }
.bookfoot #bookFootCh { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 72%;
  font-family: var(--serif); }
.bookprog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.bookprog div { height: 100%; width: 0; background: color-mix(in srgb, var(--accent) 62%, transparent);
  border-radius: 0 2px 2px 0; transition: width .15s linear; }
/* 目录整页：像书的目录——纸色底、居中栏、纯衬线行（不是卡片列表），当前章淡高亮 */
#bookToc { background: color-mix(in srgb, var(--bg) 88%, var(--surface-2) 12%); }
#bookToc .topbar { background: transparent; }
.btoc-col { max-width: 620px; margin: 0 auto; padding: 2px 8px; }
.btoc-part { font-size: 12px; color: var(--muted); letter-spacing: .3em; text-indent: .1em; margin: 22px 10px 8px; }
.btoc-row { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text);
  font-family: var(--serif); font-size: 16px; line-height: 1.55; padding: 11px 12px; border-radius: 12px; }
.btoc-row:active { background: var(--surface-2); }

/* ---- 文件编辑扩展：整页编辑层 / 纯文本视图 / 文件选择行 ---- */
.bookbar .booktitle { margin-left: 8px; }
#bookPage.editing .bookscroll, #bookPage.editing .bookfoot, #bookPage.editing .bookprog, #bookPage.editing .bookfind { display: none; }
.bookedit { display: none; flex: 1; min-height: 0; }
.bookedit.show { display: flex; }
.bookedit textarea { flex: 1; width: 100%; border: none; outline: none; resize: none; background: transparent;
  padding: 8px 18px calc(var(--safe-bottom) + 24px); font-family: var(--mono); font-size: 13.5px;
  line-height: 1.85; color: var(--text); }
.bookplain { font-family: var(--mono); font-size: 13px; line-height: 1.8; white-space: pre-wrap;
  word-break: break-word; margin: 0; }
/* 文件编辑选择页：分组标签 + 卡片容器（细分隔线）+ 图标两行式（区分与列表感） */
.fpick-part { font-size: 12px; color: var(--muted); letter-spacing: .18em; margin: 18px 6px 8px; }
.fpick-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.fpick-row { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--text); font: inherit; padding: 12px 14px; text-align: left; }
.fpick-row:last-child { border-bottom: none; }
.fpick-row:active { background: var(--surface-2); }
.fpick-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center;
  justify-content: center; background: var(--surface-2); color: var(--muted); }
.fpick-ico.book { background: var(--accent-weak); color: var(--accent); }
.fpick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fpick-line1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fpick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15.5px; font-weight: 500; }
.fpick-tag { flex: none; font-size: 11px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 7px; padding: 1px 7px; }
.fpick-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
