/* Claude 远程 —— 手机优先 */
:root {
  --bg: #f5f3ee;
  --bg-2: #efece5;
  --surface: #ffffff;
  --surface-2: #f8f6f1;
  --line: rgba(31, 30, 28, .09);
  --line-2: rgba(31, 30, 28, .16);
  --text: #1f1e1c;
  --text-2: #57534b;
  --muted: #8f8a80;
  --accent: #c96442;
  --accent-2: #d97757;
  --accent-soft: rgba(201, 100, 66, .1);
  --ok: #3f8f5b;
  --ok-soft: rgba(63, 143, 91, .12);
  --warn: #b7791f;
  --warn-soft: rgba(183, 121, 31, .12);
  --err: #c0392b;
  --err-soft: rgba(192, 57, 43, .1);
  --code-bg: #f1eee7;
  --user-bubble: #ebe7de;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px -8px rgba(40, 30, 20, .12);
  --shadow-lg: 0 24px 64px -16px rgba(30, 20, 10, .28);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1917; --bg-2: #201f1c; --surface: #262522; --surface-2: #2c2b27;
    --line: rgba(236, 232, 222, .08); --line-2: rgba(236, 232, 222, .15);
    --text: #ece8de; --text-2: #bdb7ab; --muted: #8a857a;
    --accent: #e0835f; --accent-2: #d97757; --accent-soft: rgba(224, 131, 95, .14);
    --ok: #6cc28a; --ok-soft: rgba(108, 194, 138, .13); --warn: #e3ad55; --warn-soft: rgba(227, 173, 85, .13);
    --err: #ef7d6d; --err-soft: rgba(239, 125, 109, .12);
    --code-bg: #1f1e1b; --user-bubble: #34322d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1917; --bg-2: #201f1c; --surface: #262522; --surface-2: #2c2b27;
  --line: rgba(236, 232, 222, .08); --line-2: rgba(236, 232, 222, .15);
  --text: #ece8de; --text-2: #bdb7ab; --muted: #8a857a;
  --accent: #e0835f; --accent-2: #d97757; --accent-soft: rgba(224, 131, 95, .14);
  --ok: #6cc28a; --ok-soft: rgba(108, 194, 138, .13); --warn: #e3ad55; --warn-soft: rgba(227, 173, 85, .13);
  --err: #ef7d6d; --err-soft: rgba(239, 125, 109, .12);
  --code-bg: #1f1e1b; --user-bubble: #34322d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overscroll-behavior: none; overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (hover: hover) { .hov:hover { background: var(--line); } }

#app { height: 100dvh; display: flex; }

/* ---------------------------------------------------------------- 登录 */
.login {
  flex: 1; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.login-card { width: min(380px, 100%); text-align: center; }
.login .logo { width: 64px; height: 64px; margin: 0 auto 20px; }
.login h1 { font: 500 30px/1.2 var(--serif); margin: 0 0 8px; letter-spacing: -.01em; }
.login p { color: var(--muted); margin: 0 0 28px; font-size: 14px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.field {
  width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface);
  padding: 0 16px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.btn-primary {
  height: 50px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 600; font-size: 16px;
  transition: transform .12s, filter .15s;
}
.btn-primary:active { transform: scale(.98); }
.login .hint { margin-top: 22px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.login .err { color: var(--err); font-size: 13px; min-height: 20px; }

/* ---------------------------------------------------------------- 布局 */
.shell { flex: 1; display: flex; min-width: 0; position: relative; }
.side {
  width: 340px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line);
  background: var(--bg-2); min-height: 0;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
@media (max-width: 899px) {
  .side { width: 100%; border: 0; background: var(--bg); position: absolute; inset: 0; z-index: 2;
    transition: transform .32s cubic-bezier(.32, .72, 0, 1); }
  .main { position: absolute; inset: 0; z-index: 3; background: var(--bg);
    transition: transform .32s cubic-bezier(.32, .72, 0, 1); }
  .shell[data-view="list"] .main { transform: translateX(100%); pointer-events: none; }
  .shell[data-view="chat"] .side { transform: translateX(-28%); }
  .shell[data-view="chat"] .side::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.18); }
  .only-desk { display: none !important; }
}
@media (min-width: 900px) { .only-mobile { display: none !important; } }

/* ---------------------------------------------------------------- 侧栏 / 会话列表 */
.side-head { padding: calc(14px + var(--safe-top)) 16px 10px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand .logo { width: 28px; height: 28px; }
.brand b { font: 500 21px/1 var(--serif); letter-spacing: -.01em; }
.brand .host { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.off { background: var(--err); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2);
  transition: background .15s, transform .12s; flex: none;
}
.icon-btn:active { transform: scale(.92); background: var(--line); }
.search {
  margin: 4px 16px 8px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted);
}
.search input { flex: 1; border: 0; outline: 0; background: none; font-size: 16px; min-width: 0; color: var(--text); }
.chips { display: flex; gap: 6px; padding: 2px 16px 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; color: var(--text-2);
  white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; flex: none; transition: all .15s;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { font-size: 11px; opacity: .6; }
.list { flex: 1; overflow-y: auto; padding: 0 8px calc(96px + var(--safe-bottom)); overscroll-behavior: contain; }
.group-h { font-size: 12px; color: var(--muted); padding: 14px 10px 6px; font-weight: 600; letter-spacing: .02em; display: flex; gap: 6px; align-items: center; }
.row {
  display: flex; gap: 12px; padding: 11px 10px; border-radius: 14px; align-items: flex-start; width: 100%; text-align: left;
  transition: background .15s; position: relative;
}
.row:active { background: var(--line); }
.row[aria-current="true"] { background: var(--surface); box-shadow: var(--shadow); }
.row .av {
  width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font: 600 14px/1 var(--font); color: #fff; letter-spacing: 0;
}
.row .body { flex: 1; min-width: 0; }
.row.sess { gap: 10px; padding: 12px 12px 12px 8px; }
.row.sess .ind { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 8px; background: transparent; }
.row.sess.st-busy .ind { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1.4s ease-in-out infinite; }
.row.sess.st-wait .ind { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.row.sess.st-ext .ind { background: var(--muted); }
.row .t { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 2px; min-width: 0; }
.row .s span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; flex: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.badge.busy { background: var(--accent-soft); color: var(--accent); }
.badge.wait { background: var(--warn-soft); color: var(--warn); }
.badge.ext { background: var(--line); color: var(--text-2); }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.empty { text-align: center; color: var(--muted); padding: 56px 24px; font-size: 14px; }
.fab {
  position: absolute; right: 18px; bottom: calc(22px + var(--safe-bottom)); height: 54px; padding: 0 22px 0 18px;
  border-radius: 18px; background: var(--accent); color: #fff; display: flex; align-items: center; gap: 8px;
  font-weight: 600; box-shadow: 0 10px 30px -6px rgba(201, 100, 66, .55); z-index: 5; transition: transform .15s;
}
.fab:active { transform: scale(.95); }
.fab svg.i { width: 20px; height: 20px; stroke-width: 2.2; }

/* ---------------------------------------------------------------- 聊天头部 */
.chat-head {
  padding: calc(8px + var(--safe-top)) 8px 8px; display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px);
  position: relative; z-index: 4;
}
.chat-head .ttl { flex: 1; min-width: 0; padding: 0 4px; }
.chat-head .ttl b { display: block; font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .ttl small { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.chat-head .ttl small span { overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- 时间线 */
.timeline { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: auto; min-height: 0; }
.tl-inner { max-width: 780px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 14px; }
.load-more { align-self: center; font-size: 13px; color: var(--muted); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); }
.u-msg { align-self: flex-end; max-width: 86%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.u-bubble {
  background: var(--user-bubble); padding: 10px 14px; border-radius: 20px 20px 6px 20px; white-space: pre-wrap;
  word-break: break-word; font-size: 15px;
}
.u-imgs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.u-imgs img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.slash { font-family: var(--mono); font-size: 13px; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 8px; }
.a-msg { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.md { word-break: break-word; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: .55em 0; }
.md h1, .md h2, .md h3, .md h4 { font-weight: 650; line-height: 1.35; margin: 1.1em 0 .45em; }
.md h1 { font-size: 1.3em; } .md h2 { font-size: 1.18em; } .md h3 { font-size: 1.06em; } .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.4em; margin: .5em 0; }
.md li { margin: .2em 0; }
.md li::marker { color: var(--muted); }
.md blockquote { margin: .6em 0; padding: .2em 0 .2em 12px; border-left: 3px solid var(--line-2); color: var(--text-2); }
.md code { font: .86em/1.5 var(--mono); background: var(--code-bg); padding: .12em .38em; border-radius: 6px; border: 1px solid var(--line); }
.md pre { margin: .7em 0; background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; position: relative; }
.md pre code { display: block; padding: 12px 14px; overflow-x: auto; border: 0; background: none; font-size: 12.5px; line-height: 1.6; }
.md pre .cp { position: absolute; top: 6px; right: 6px; font-size: 11.5px; padding: 3px 8px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); opacity: .9; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; margin: .7em 0; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--line-2); padding: 6px 10px; text-align: left; white-space: nowrap; }
.md th { background: var(--surface-2); font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.2em 0; }
.md a { word-break: break-all; }
.md img { max-width: 100%; border-radius: 10px; }

/* 思考块 */
.think { font-size: 13.5px; color: var(--muted); }
.think > summary { list-style: none; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; padding: 2px 0; user-select: none; }
.think > summary::-webkit-details-marker { display: none; }
.think > summary svg.i { width: 14px; height: 14px; transition: transform .2s; }
.think[open] > summary svg.chev { transform: rotate(90deg); }
.think .think-body { margin: 6px 0 2px 6px; padding-left: 12px; border-left: 2px solid var(--line-2); white-space: pre-wrap; line-height: 1.65; }

/* 工具活动组 */
.acts { display: flex; flex-direction: column; border-radius: 14px; }
.acts > .acts-sum {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); padding: 4px 0; text-align: left; width: 100%; min-width: 0;
}
.acts > .acts-sum span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.acts > .acts-sum .chev { width: 14px; height: 14px; transition: transform .2s; }
.acts[data-open="true"] > .acts-sum .chev { transform: rotate(90deg); }
.acts-list { display: none; flex-direction: column; gap: 6px; margin: 6px 0 0; }
.acts[data-open="true"] .acts-list { display: flex; }
.tool {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; overflow: hidden;
  font-size: 13.5px; transition: border-color .2s;
}
.tool-h { display: flex; align-items: center; gap: 9px; padding: 9px 12px; width: 100%; text-align: left; min-width: 0; }
.tool-h .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.tool-h .ic svg.i { width: 15px; height: 15px; }
.tool-h .nm { font-weight: 600; flex: none; }
.tool-h .ds { color: var(--text-2); font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tool-h .st { flex: none; display: grid; place-items: center; width: 18px; }
.tool-h .st .ok { color: var(--ok); } .tool-h .st .bad { color: var(--err); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tool-b { display: none; border-top: 1px solid var(--line); }
.tool[data-open="true"] .tool-b { display: block; }
.tool-b pre {
  margin: 0; padding: 10px 12px; font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all;
  max-height: 340px; overflow: auto; background: var(--code-bg); color: var(--text-2);
}
.tool-b .lbl { font-size: 11px; color: var(--muted); padding: 8px 12px 0; letter-spacing: .03em; font-weight: 600; background: var(--code-bg); }
.tool-b pre + .lbl { border-top: 1px solid var(--line); }
.diff { font: 12px/1.55 var(--mono); background: var(--code-bg); max-height: 380px; overflow: auto; padding: 6px 0; }
.diff div { padding: 0 12px; white-space: pre-wrap; word-break: break-all; }
.diff .del { background: var(--err-soft); color: var(--err); }
.diff .add { background: var(--ok-soft); color: var(--ok); }
.tool.err { border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.nested { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.nested div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }

/* 待办 */
.todos { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; }
.todo { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.todo .box { width: 16px; height: 16px; border-radius: 5px; border: 1.6px solid var(--line-2); flex: none; margin-top: 3px; display: grid; place-items: center; }
.todo.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.todo.done span { color: var(--muted); text-decoration: line-through; }
.todo.doing .box { border-color: var(--accent); }
.todo.doing .box::after { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.todo.doing span { font-weight: 600; }

/* 系统分隔 / 回合脚注 */
.sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.turn-foot { font-size: 11.5px; color: var(--muted); display: flex; gap: 10px; margin-top: -4px; }
.err-box { background: var(--err-soft); color: var(--err); padding: 10px 14px; border-radius: 12px; font-size: 13.5px; white-space: pre-wrap; }

/* 进行中 */
.working { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); padding: 2px 0; }
.working .shimmer {
  background: linear-gradient(90deg, var(--muted) 0%, var(--text) 45%, var(--muted) 90%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shim 2.2s linear infinite; font-weight: 500;
}
@keyframes shim { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.spark { width: 18px; height: 18px; color: var(--accent); animation: rot 2.6s cubic-bezier(.5, 0, .5, 1) infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.caret::after { content: ""; display: inline-block; width: 7px; height: 1.05em; vertical-align: -2px; margin-left: 2px; background: var(--accent); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------------------------------------------------------------- 待确认卡片 */
.dock { max-width: 780px; width: 100%; margin: 0 auto; padding: 0 12px; display: flex; flex-direction: column; gap: 10px; }
.dock:empty { display: none; }
.card {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 14px; animation: rise .32s cubic-bezier(.2, .9, .3, 1.1); max-height: 62dvh; overflow-y: auto;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.card-h { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.card-h .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); flex: none; }
.card-h.q .ic { background: var(--accent-soft); color: var(--accent); }
.card-h b { font-size: 15px; display: block; }
.card-h small { color: var(--muted); font-size: 12.5px; display: block; }
.card pre { margin: 0 0 12px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; }
.card .reason { font-size: 13px; color: var(--text-2); margin: -4px 0 10px; }
.card-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.b { height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 14.5px; flex: 1; min-width: 88px; transition: transform .12s, filter .15s; }
.b:active { transform: scale(.97); }
.b.pri { background: var(--accent); color: #fff; }
.b.sec { background: var(--surface-2); border: 1px solid var(--line-2); }
.b.ghost { color: var(--text-2); flex: 0 0 auto; }
.q-block + .q-block { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.q-head { font-size: 11.5px; color: var(--accent); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.q-text { font-size: 15px; font-weight: 600; margin: 2px 0 10px; }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt {
  text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2);
  display: flex; gap: 10px; align-items: flex-start; transition: border-color .15s, background .15s;
}
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt .mk { width: 18px; height: 18px; border-radius: 50%; border: 1.8px solid var(--line-2); flex: none; margin-top: 2px; display: grid; place-items: center; }
.opt.multi .mk { border-radius: 6px; }
.opt[aria-pressed="true"] .mk { border-color: var(--accent); background: var(--accent); }
.opt[aria-pressed="true"] .mk::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.opt b { font-size: 14.5px; font-weight: 600; display: block; }
.opt small { font-size: 12.5px; color: var(--muted); display: block; line-height: 1.5; }
.opt-other { margin-top: 6px; width: 100%; min-height: 42px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 10px 12px; font-size: 16px; outline: 0; resize: none; }
.opt-other:focus { border-color: var(--accent); }

/* ---------------------------------------------------------------- 输入区 */
.composer-wrap { padding: 8px 12px calc(10px + var(--safe-bottom)); position: relative; z-index: 4; display: flex; flex-direction: column; gap: 10px; }
.composer {
  max-width: 780px; width: 100%; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 22px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
.composer textarea {
  width: 100%; border: 0; outline: 0; background: none; resize: none; padding: 13px 16px 4px; font-size: 16px; line-height: 1.5;
  max-height: 40dvh; display: block;
}
.composer textarea::placeholder { color: var(--muted); }
.c-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; }
.c-bar .grow { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.c-bar .grow::-webkit-scrollbar { display: none; }
.pill {
  height: 32px; padding: 0 10px; border-radius: 10px; font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap; flex: none; transition: background .15s;
}
.pill:active { background: var(--line); }
.pill svg.i { width: 15px; height: 15px; }
.pill.warn { color: var(--warn); }
.pill.hot { color: var(--err); }
.send {
  width: 38px; height: 38px; border-radius: 13px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none;
  transition: transform .12s, background .2s, opacity .2s;
}
.send:active { transform: scale(.9); }
.send:disabled { background: var(--line-2); opacity: 1; color: var(--muted); }
.send.stop { background: var(--text); color: var(--bg); }
.send svg.i { width: 18px; height: 18px; stroke-width: 2.3; }
.atts { display: flex; gap: 8px; padding: 10px 12px 0; flex-wrap: wrap; }
.att { position: relative; width: 60px; height: 60px; }
.att img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.att button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; }
.att button svg.i { width: 12px; height: 12px; stroke-width: 2.6; }
.c-note { font-size: 12px; color: var(--muted); text-align: center; max-width: 780px; margin: 0 auto; width: 100%; }
.cwd-pick {
  max-width: 780px; margin: 0 auto; width: 100%; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2);
  padding: 0 4px;
}
.cwd-pick button { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); max-width: 100%; min-width: 0; }
.cwd-pick button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 新会话欢迎 */
.hello { margin: auto; text-align: center; padding: 40px 24px; max-width: 520px; }
.hello .logo { width: 52px; height: 52px; margin: 0 auto 18px; }
.hello h2 { font: 500 28px/1.25 var(--serif); margin: 0 0 8px; letter-spacing: -.01em; }
.hello p { color: var(--muted); margin: 0; font-size: 14px; }
.sugs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 26px; text-align: left; }
.sug { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.sug:active { background: var(--surface-2); }

/* ---------------------------------------------------------------- 底部弹层 */
.sheet-bg { position: fixed; inset: 0; background: rgba(10, 8, 5, .38); z-index: 50; animation: fade .2s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--surface); border-radius: 24px 24px 0 0;
  max-height: 88dvh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: up .34s cubic-bezier(.32, .72, 0, 1); padding-bottom: var(--safe-bottom);
}
@keyframes up { from { transform: translateY(100%); } }
@media (min-width: 900px) {
  .sheet { left: 50%; right: auto; bottom: 50%; width: 520px; border-radius: 22px; transform: translate(-50%, 50%); animation: pop .25s cubic-bezier(.2, .9, .3, 1.1); max-height: 80dvh; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, 52%) scale(.97); } }
}
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 2px; flex: none; }
.sheet-h { display: flex; align-items: center; padding: 8px 12px 8px 20px; gap: 8px; flex: none; }
.sheet-h b { flex: 1; font-size: 17px; font-weight: 650; }
.sheet-b { overflow-y: auto; padding: 0 12px 16px; overscroll-behavior: contain; }
.menu-i {
  display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 12px; width: 100%; text-align: left; font-size: 15px;
}
.menu-i:active { background: var(--line); }
.menu-i .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.menu-i .tx { flex: 1; min-width: 0; }
.menu-i small { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-i .ck { color: var(--accent); }
.menu-i.danger { color: var(--err); }
.sec-h { font-size: 12px; font-weight: 700; color: var(--muted); padding: 14px 10px 4px; letter-spacing: .03em; }

/* 文件浏览 */
.crumbs { display: flex; gap: 2px; align-items: center; font-size: 12.5px; color: var(--muted); padding: 0 8px 8px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.crumbs button { padding: 3px 6px; border-radius: 6px; }
.crumbs button:last-child { color: var(--text); font-weight: 600; }
.f-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; width: 100%; text-align: left; font-size: 14.5px; }
.f-row:active { background: var(--line); }
.f-row svg.i { color: var(--muted); }
.f-row.dir svg.i { color: var(--accent); }
.f-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-row small { color: var(--muted); font-size: 12px; flex: none; }
.preview pre { margin: 0; font: 12px/1.6 var(--mono); background: var(--code-bg); border-radius: 12px; padding: 12px; overflow: auto; white-space: pre; border: 1px solid var(--line); }
.preview img { max-width: 100%; border-radius: 12px; display: block; margin: 0 auto; }

/* ---------------------------------------------------------------- 提示 */
#toasts { position: fixed; top: calc(12px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 14px; box-shadow: var(--shadow-lg); animation: tin .3s cubic-bezier(.2, .9, .3, 1.2); pointer-events: auto; }
.toast.err { background: var(--err); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px) scale(.96); } }
.jump {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 100%; margin-bottom: 10px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--text-2);
}
.banner { background: var(--warn-soft); color: var(--warn); font-size: 13px; padding: 8px 14px; text-align: center; }
.offline { background: var(--err-soft); color: var(--err); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------- 首页：电脑卡 */
.list-sticky { position: sticky; top: 0; z-index: 3; background: var(--bg); padding-top: 6px; margin: 0 -8px; }
@media (min-width: 900px) { .list-sticky { background: var(--bg-2); } }
.pc {
  margin: 4px 8px 14px; padding: 18px 18px 14px; border-radius: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.pc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pc-greet { font: 500 26px/1.15 var(--serif); letter-spacing: -.01em; }
.pc-host { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.pc-shot {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  background: var(--text); color: var(--bg); flex: none; transition: transform .12s;
}
.pc-shot:active { transform: scale(.95); }
.pc-shot svg.i { width: 16px; height: 16px; }
.pc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 14px; }
.metric { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ring { position: relative; width: 42px; height: 42px; flex: none; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.ring .trk { stroke: var(--line-2); }
.ring .val { transition: stroke-dashoffset .8s cubic-bezier(.2, .8, .2, 1); }
.ring b { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring.plug { border-radius: 50%; border: 4px solid var(--line-2); color: var(--ok); }
.m-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.m-txt span { font-size: 13px; font-weight: 600; }
.m-txt small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-foot { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.pc-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 5px 10px; border-radius: 999px; background: var(--line); color: var(--text-2); flex: none; }
.pc-pill svg.i { width: 15px; height: 15px; }
.pc-pill.on { background: var(--ok-soft); color: var(--ok); }
.pc-stat { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: right; }

/* 常用指令 */
.snip-h { display: flex; justify-content: space-between; align-items: center; padding: 0 12px 8px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.snip-h button { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.snips { display: flex; gap: 8px; overflow-x: auto; padding: 0 8px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.snips::-webkit-scrollbar { display: none; }
.snip {
  flex: none; min-width: 112px; max-width: 168px; padding: 11px 13px; border-radius: 16px; text-align: left; background: var(--surface);
  border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; scroll-snap-align: start; transition: transform .12s;
}
.snip:active { transform: scale(.96); }
.snip b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snip span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snip.add { min-width: 76px; align-items: center; justify-content: center; color: var(--muted); border-style: dashed; background: none; }
.snip-edit { display: flex; align-items: center; }
.snip-edit .menu-i { flex: 1; min-width: 0; }
.form { display: flex; flex-direction: column; gap: 10px; padding: 0 8px 4px; }
.field.area { height: auto; min-height: 110px; padding: 12px 16px; resize: vertical; line-height: 1.55; }
.sug { display: flex; flex-direction: column; gap: 3px; }
.sug b { color: var(--text); font-size: 14px; font-weight: 600; }
.sug span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; color: var(--muted); }

/* 屏幕 */
.screen { border-radius: 14px; overflow: auto; background: #000; max-height: 66dvh; position: relative; min-height: 160px; }
.screen img { display: block; width: 100%; cursor: zoom-in; }
.screen.zoom img { width: 260%; max-width: none; cursor: zoom-out; }
.screen.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent); background-size: 200% 100%; animation: shim 1.2s linear infinite; }
.screen-bar { display: flex; align-items: center; gap: 10px; padding: 12px 2px 4px; }
.screen-t { flex: 1; color: var(--muted); font-size: 12.5px; }
.screen-bar .b { display: inline-flex; align-items: center; gap: 4px; }

/* 斜杠命令 */
.slash-pop {
  max-width: 780px; width: 100%; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; padding: 6px; animation: rise .2s ease-out;
}
.slash-i { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: left; font: 13.5px var(--mono); }
.slash-i:active, .slash-i:hover { background: var(--line); }
.slash-i svg.i { color: var(--accent); width: 15px; height: 15px; }

/* 改动 */
.chg + .chg { border-top: 1px solid var(--line); }
.chg .nm { display: flex; flex-direction: column; }
.chg-path { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.chg-b { padding: 0 6px 12px; display: flex; flex-direction: column; gap: 6px; }
.chg-b .diff { border-radius: 10px; border: 1px solid var(--line); }
.chg-tag { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.chg-pre { margin: 0; font: 12px/1.55 var(--mono); background: var(--code-bg); padding: 10px; border-radius: 10px; max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* 登录：扫码优先 */
.scan-tip { display: flex; gap: 14px; align-items: center; text-align: left; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 14px; }
.scan-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.scan-ic svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.scan-tip b { display: block; font-size: 15px; }
.scan-tip small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.login-alt { margin-top: 10px; font-size: 13px; color: var(--muted); padding: 8px 12px; border-radius: 10px; }
.login-alt:active { background: var(--line); }

/* iPhone 键盘：应用固定在可视区域里，输入框始终贴着键盘 */
#app { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); }
html.kb { --safe-bottom: 0px; }
html.kb .composer-wrap { padding-bottom: 8px; }
