/* 家庭 Claude：仿 claude.ai 的观感。颜色都走变量，深色模式跟随系统。 */
:root {
  --bg: #FAF9F5;
  --side: #F5F4EE;
  --surface: #FFFFFF;
  --hover: #EDEBE3;
  --active: #E6E3D8;
  --line: #E6E3D8;
  --line-strong: #D9D5C8;
  --ink: #1F1E1D;
  --ink-2: #3D3C38;
  --muted: #6B6963;
  --accent: #C96442;
  --accent-hover: #B4553A;
  --accent-ink: #FFFFFF;
  --accent-soft: #F5E6DF;
  --user-bubble: #F0EEE6;
  --code-bg: #F5F4EE;
  --code-head: #ECEAE2;
  --danger: #B3261E;
  --shadow: 0 4px 20px rgba(60, 50, 30, .07);
  --shadow-pop: 0 8px 30px rgba(40, 30, 20, .16);
  --scrim: rgba(20, 18, 15, .38);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  /* 拉丁字母走衬线，汉字回落到系统黑体：长文阅读不吃力，又有 Claude 的气质 */
  --reading: "Charter", "Iowan Old Style", Georgia, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", serif;
  --serif: "Iowan Old Style", Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  /* 代码高亮 */
  --hl-kw: #A0330F; --hl-str: #2F6F3E; --hl-num: #8A4B08; --hl-com: #8A877E; --hl-fn: #2B5797; --hl-type: #6F3FA0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #262624;
    --side: #1F1E1D;
    --surface: #30302E;
    --hover: #2F2F2C;
    --active: #3A3936;
    --line: #3A3936;
    --line-strong: #4A4945;
    --ink: #F0EEE6;
    --ink-2: #DCD9CF;
    --muted: #A8A59C;
    --accent: #D97757;
    --accent-hover: #E38A6C;
    --accent-ink: #FFFFFF;
    --accent-soft: #4A2F25;
    --user-bubble: #141413;
    --code-bg: #1C1C1A;
    --code-head: #2A2A28;
    --danger: #F2B8B5;
    --shadow: 0 4px 20px rgba(0, 0, 0, .28);
    --shadow-pop: 0 8px 30px rgba(0, 0, 0, .5);
    --scrim: rgba(0, 0, 0, .55);
    --hl-kw: #F0907A; --hl-str: #9CCB8B; --hl-num: #E5B567; --hl-com: #8D8A82; --hl-fn: #8FB4F0; --hl-type: #C9A2F0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.serif { font-family: var(--serif); font-weight: 400; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; flex: none; }
.err { color: var(--danger); font-size: 14px; min-height: 0; }
.err:empty { display: none; }

/* 按钮 */
.btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 9px 16px; font-size: 15px; min-height: 40px; }
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #3B0B08; } }
.btn-block { width: 100%; }
.icon-btn { width: 36px; height: 36px; border: none; background: transparent; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); padding: 0; cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.bordered { border: 1px solid var(--line-strong); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-spark { width: 44px; height: 44px; margin: 0 auto; color: var(--accent); }
.login-card h1 { margin: 0; font-size: 34px; }
.login-card .sub { margin: -6px 0 14px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 14px; color: var(--ink-2); }
.field input { padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-size: 16px; outline: none; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100dvh; overflow: hidden; }
aside { width: 288px; flex: 0 0 288px; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 10px 8px; gap: 2px; transition: margin-left .2s ease; }
.app.side-collapsed aside { margin-left: -288px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 10px 10px; }
.brand { font-size: 21px; }
.new-chat { display: flex; align-items: center; gap: 10px; border: none; background: transparent; padding: 9px 8px; border-radius: 10px; color: var(--accent); font-weight: 600; font-size: 15px; text-align: left; }
.new-chat:hover { background: var(--hover); }
.new-chat .plus { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }
.new-chat .plus svg { width: 15px; height: 15px; }
.conv-list { flex: 1; overflow-y: auto; margin: 6px -4px 0; padding: 0 4px; }
.conv-group { font-size: 12px; color: var(--muted); padding: 14px 10px 6px; }
.conv-item { position: relative; display: flex; align-items: center; border-radius: 8px; }
.conv-item a { flex: 1; min-width: 0; display: block; padding: 8px 10px; color: var(--ink); text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 8px; }
.conv-item:hover { background: var(--hover); }
.conv-item.active { background: var(--active); }
.conv-item .more { position: absolute; right: 4px; width: 28px; height: 28px; opacity: 0; background: inherit; }
.conv-item:hover .more, .conv-item.active .more, .conv-item .more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .conv-item .more { opacity: 1; } }
.conv-empty { color: var(--muted); font-size: 13px; padding: 16px 10px; }
.side-foot { border-top: 1px solid var(--line); padding-top: 8px; }
.me-btn { width: 100%; display: flex; align-items: center; gap: 10px; border: none; background: transparent; padding: 8px; border-radius: 10px; text-align: left; }
.me-btn:hover { background: var(--hover); }
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.me-text > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn .chev { width: 16px; height: 16px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink-2); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.top { height: 52px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px; }
.title-btn { display: inline-flex; align-items: center; gap: 4px; border: none; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 15px; max-width: min(520px, 60vw); min-height: 36px; }
.title-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-btn svg { width: 16px; height: 16px; color: var(--muted); }
.title-btn:hover { background: var(--hover); }
.badge { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.only-mobile, .only-collapsed, .only-narrow { display: none; }
.app.side-collapsed .only-collapsed { display: inline-flex; }
.banner { margin: 0 auto 8px; max-width: 720px; width: calc(100% - 32px); background: var(--accent-soft); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-size: 14px; text-align: center; }

.scroller { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.thread { max-width: 768px; margin: 0 auto; padding: 12px 20px 24px; display: flex; flex-direction: column; gap: 26px; }

/* ---------- 欢迎页 ---------- */
main.is-empty .scroller { display: flex; }
main.is-empty .thread { display: none; }
.welcome { margin: auto; width: 100%; max-width: 720px; padding: 24px 20px 8vh; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.greet { margin: 0; display: flex; align-items: center; gap: 14px; font-size: clamp(28px, 5vw, 40px); line-height: 1.2; text-align: center; }
.greet .spark { width: 1.0em; height: 1.0em; color: var(--accent); }
#welcomeSlot { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink-2); border-radius: 10px; padding: 8px 13px; font-size: 14px; min-height: 38px; }
.chip:hover { background: var(--hover); }
.chip svg { width: 16px; height: 16px; color: var(--muted); }
main.is-empty .dock .disclaimer { display: none; }

/* ---------- 消息 ---------- */
.msg { display: flex; flex-direction: column; min-width: 0; }
.msg.user { align-items: flex-end; }
.msg.user .bubble { background: var(--user-bubble); border-radius: 18px; padding: 10px 16px; max-width: 85%; font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .atts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 8px; max-width: 85%; }
.att-img { width: 120px; height: 120px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; background: var(--side); display: block; }
.att-file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 12px; max-width: 260px; color: var(--ink); text-decoration: none; }
.att-file .ic { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.att-file .meta { min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.att-file .meta b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-actions { display: flex; gap: 2px; margin-top: 6px; color: var(--muted); min-height: 32px; }
.msg-actions .icon-btn { width: 32px; height: 32px; }
.msg-actions .icon-btn svg { width: 17px; height: 17px; }
.msg.user .msg-actions { opacity: 0; transition: opacity .15s; }
.msg.user:hover .msg-actions, .msg.user:focus-within .msg-actions { opacity: 1; }
@media (hover: none) { .msg.user .msg-actions { opacity: 1; } }
.msg.assistant .msg-actions { opacity: 1; }
.msg.assistant.streaming .msg-actions { visibility: hidden; }
.status-note { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.status-note.bad { color: var(--danger); }

.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; min-height: 28px; }
.thinking .spark, .msg.streaming .tail-spark { width: 22px; height: 22px; color: var(--accent); animation: spin 2.6s linear infinite; }
.tail-spark { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .thinking .spark, .msg.streaming .tail-spark { animation: pulse 1.6s ease-in-out infinite; } @keyframes pulse { 50% { opacity: .35; } } }

/* Markdown 正文 */
.md { font-family: var(--reading); font-size: 16.5px; line-height: 1.75; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .9em; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--sans); font-weight: 650; line-height: 1.35; margin: 1.4em 0 .6em; }
.md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.08em; } .md h4 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .9em; padding-left: 1.6em; }
.md li { margin: .25em 0; }
.md li > p { margin: 0 0 .4em; }
.md strong { font-weight: 650; }
.md a { color: var(--accent); text-underline-offset: 2px; }
.md blockquote { margin: 0 0 .9em; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.md hr { border: none; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md :not(pre) > code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: .1em .35em; }
.md .table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--line); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 14.5px; line-height: 1.5; }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md th { background: var(--code-bg); font-weight: 600; }
.md tr:last-child td { border-bottom: none; }
.md img { max-width: 100%; }
.code-block { margin: 0 0 1em; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--code-bg); font-family: var(--sans); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px; background: var(--code-head); font-size: 12px; color: var(--muted); }
.code-head button { display: inline-flex; align-items: center; gap: 5px; border: none; background: transparent; color: var(--muted); font-size: 12px; padding: 5px 8px; border-radius: 6px; }
.code-head button:hover { background: var(--hover); color: var(--ink); }
.code-head button svg { width: 14px; height: 14px; }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; }
.code-block pre code { font-family: inherit; white-space: pre; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in, .hljs-meta .hljs-keyword { color: var(--hl-kw); }
.hljs-string, .hljs-attr, .hljs-symbol, .hljs-template-tag, .hljs-addition { color: var(--hl-str); }
.hljs-number, .hljs-variable, .hljs-template-variable { color: var(--hl-num); }
.hljs-comment, .hljs-quote, .hljs-deletion, .hljs-meta { color: var(--hl-com); font-style: italic; }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: var(--hl-fn); }
.hljs-type, .hljs-class .hljs-title, .hljs-tag, .hljs-name, .hljs-selector-class, .hljs-selector-id { color: var(--hl-type); }

/* ---------- 输入区 ---------- */
.dock { flex: none; padding: 0 16px calc(10px + env(safe-area-inset-bottom)); }
#composerSlot { max-width: 768px; margin: 0 auto; }
.composer { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); padding: 12px 12px 10px 14px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--muted)); box-shadow: 0 6px 24px rgba(60, 50, 30, .1); }
.composer textarea { border: none; outline: none; background: transparent; resize: none; font-size: 16px; line-height: 1.55; min-height: 26px; max-height: 40vh; padding: 2px 2px; overflow-y: auto; }
.composer textarea::placeholder { color: var(--muted); }
main.is-empty .composer textarea { min-height: 52px; }
.composer-bar { display: flex; align-items: center; gap: 8px; }
.model-btn { display: inline-flex; align-items: center; gap: 3px; border: none; background: transparent; color: var(--muted); font-size: 13px; padding: 6px 8px; border-radius: 8px; min-height: 36px; }
.model-btn:hover { background: var(--hover); color: var(--ink); }
.model-btn svg { width: 14px; height: 14px; }
.menu .mi.model { align-items: flex-start; }
.menu .mi.model .mt { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu .mi.model .mt small { color: var(--muted); font-size: 12px; }
.menu .mi.model .tick { width: 17px; height: 17px; color: var(--accent); visibility: hidden; margin-top: 1px; }
.menu .mi.model.on .tick { visibility: visible; }
.activity { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.activity:empty { display: none; }
.send-btn { width: 36px; height: 36px; border: none; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { opacity: .4; cursor: default; }
.send-btn.stop { background: var(--ink); color: var(--bg); }
.send-btn svg { width: 19px; height: 19px; }
.disclaimer { max-width: 768px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--muted); }

.attach-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-list:empty { display: none; }
.pend { position: relative; width: 84px; height: 84px; border-radius: 12px; border: 1px solid var(--line); background: var(--side); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.pend img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pend.file { width: 168px; padding: 10px; justify-content: space-between; }
.pend.file b { font-size: 13px; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.pend.file .ext { align-self: flex-start; font-size: 11px; font-weight: 600; text-transform: uppercase; border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; color: var(--muted); background: var(--surface); }
.pend .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(20, 20, 19, .72); color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; z-index: 2; }
.pend .rm svg { width: 12px; height: 12px; }
.pend .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); transition: width .2s; z-index: 1; }
.pend.uploading::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 45%, transparent); }
.pend.failed { border-color: var(--danger); }

.to-bottom { position: absolute; left: 50%; transform: translateX(-50%); bottom: 150px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; z-index: 3; }
.to-bottom svg { width: 18px; height: 18px; }

.drop-zone { position: absolute; inset: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); display: flex; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.drop-zone > div { border: 2px dashed var(--accent); border-radius: 20px; padding: 40px 56px; }
.drop-zone svg { width: 40px; height: 40px; color: var(--accent); }
.drop-zone p { margin: 8px 0 0; }

/* ---------- 菜单 / 对话框 / 提示 ---------- */
.menu { position: fixed; z-index: 50; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; }
.menu .mi { width: 100%; display: flex; align-items: center; gap: 10px; border: none; background: transparent; padding: 9px 10px; border-radius: 8px; font-size: 14px; text-align: left; }
.menu .mi:hover, .menu .mi:focus-visible { background: var(--hover); outline: none; }
.menu .mi svg { width: 17px; height: 17px; color: var(--muted); }
.menu .mi.danger { color: var(--danger); }
.menu .mi.danger svg { color: var(--danger); }
.menu .mhead { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; color: var(--muted); }
.menu .mhead b { display: block; color: var(--ink); font-size: 14px; font-weight: 600; }

.dlg { border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(92vw, 460px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.dlg.wide { width: min(94vw, 680px); }
.dlg::backdrop, .lightbox::backdrop { background: var(--scrim); }
.dlg h3 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.dlg p { margin: 0 0 12px; color: var(--ink-2); line-height: 1.6; }
.dlg .field { margin-bottom: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg .err { margin-top: 4px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.stats-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats th, .stats td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.stats th { color: var(--muted); font-weight: 500; font-size: 13px; }
.stats tr:last-child td { border-bottom: none; }
.dlg h4 { margin: 18px 0 8px; font-size: 14px; }
.ev { font-size: 13px; color: var(--muted); padding: 3px 0; }

.lightbox { border: none; padding: 0; background: transparent; max-width: 96vw; max-height: 92vh; overflow: visible; }
.lightbox img { display: block; max-width: 96vw; max-height: 92vh; border-radius: 10px; }
.lb-close { position: absolute; top: -44px; right: 0; color: #fff; background: rgba(0, 0, 0, .4); border-radius: 50%; }
.lb-close:hover { background: rgba(0, 0, 0, .6); color: #fff; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px); text-align: center; }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 30; }

/* ---------- 窄屏 ---------- */
@media (max-width: 860px) {
  aside { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(86vw, 320px); flex-basis: auto; transform: translateX(-100%); transition: transform .22s ease; margin-left: 0 !important; box-shadow: var(--shadow-pop); padding-top: calc(10px + env(safe-area-inset-top)); }
  aside.open { transform: none; }
  #collapseBtn { display: none; }
  .only-mobile, .only-narrow { display: inline-flex; }
  .app.side-collapsed .only-collapsed { display: none; }
  .top { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .top .grow { display: none; }
  .title-btn { margin: 0 auto; max-width: calc(100vw - 120px); }
  .only-narrow { margin-left: auto; }
  .title-btn:not(.hidden) ~ .only-narrow { margin-left: 0; }
  .thread { padding: 8px 16px 20px; gap: 22px; }
  .md { font-size: 16px; }
  .msg.user .bubble, .msg .atts { max-width: 90%; }
  .dock { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .disclaimer { display: none; }
  .welcome { padding-bottom: 4vh; }
  .att-img { width: 104px; height: 104px; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
