:root {
  --bg: #ffffff; --side: #f0f4f9; --panel: #ffffff; --input: #f0f4f9; --hover: #e4e9f1; --active: #d3e3fd;
  --text: #1f1f1f; --soft: #3c4043; --muted: #6b7079; --border: #e1e5eb; --user: #e9eef6;
  --accent: #3f6cf0; --accent-soft: #d3e3fd; --danger: #c5362c;
  --code-bg: rgba(31, 35, 40, 0.06); --code-text: #24292f; --code-block-bg: #f6f8fa; --table-head: #f3f5f8;
  --tk-kw: #cf222e; --tk-str: #0a3069; --tk-com: #6e7781; --tk-num: #0550ae; --tk-fn: #8250df; --tk-type: #953800; --tk-attr: #116329;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131314; --side: #1e1f20; --panel: #1e1f20; --input: #1e1f20; --hover: #2a2b2d; --active: #1f3760;
    --text: #e3e3e3; --soft: #d0d2d6; --muted: #9aa0a6; --border: #333538; --user: #2a2b2e;
    --accent: #8ab4f8; --accent-soft: #1f3760; --danger: #f28b82;
    --code-bg: rgba(255, 255, 255, 0.08); --code-text: #e6e5e0; --code-block-bg: #1b1c1d; --table-head: #242527;
    --tk-kw: #ff7b72; --tk-str: #a5d6ff; --tk-com: #8b949e; --tk-num: #79c0ff; --tk-fn: #d2a8ff; --tk-type: #ffa657; --tk-attr: #7ee787;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15.5px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.spacer { flex: 1; }

.app { display: flex; height: 100dvh; }

/* ---------- 侧边栏 ---------- */
.side { width: 280px; flex: none; background: var(--side); display: flex; flex-direction: column; padding: 12px 12px 14px; gap: 6px; transition: width .2s ease; overflow: hidden; }
.side-top { display: flex; align-items: center; height: 40px; }
.icon-btn { width: 40px; height: 40px; border: none; background: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--soft); }
.icon-btn:hover { background: var(--hover); }
.new-chat { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 14px; margin: 10px 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text); white-space: nowrap; font-size: 14.5px; font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); transition: background .15s, border-color .15s, box-shadow .15s; }
.new-chat svg { width: 18px; height: 18px; padding: 3px; box-sizing: content-box; border-radius: 8px; color: #fff; background: linear-gradient(135deg, #4a7dff, #8b6cff); stroke-width: 2.4; }
.new-chat:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 2px 10px rgba(63, 108, 240, .12); }
.side-label { font-size: 13px; font-weight: 600; color: var(--soft); padding: 4px 12px; white-space: nowrap; }
.conv-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.conv { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 6px 0 14px; border-radius: 999px; font-size: 14px; color: var(--soft); cursor: pointer; }
.conv span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv:hover { background: var(--hover); }
.conv.on { background: var(--active); color: var(--text); font-weight: 500; }
.conv .del { border: none; background: none; width: 26px; height: 26px; border-radius: 50%; color: var(--muted); font-size: 17px; line-height: 1; opacity: 0; }
.conv:hover .del { opacity: 1; }
.conv .del:hover { background: var(--bg); color: var(--danger); }
.conv-empty { color: var(--muted); font-size: 13px; padding: 8px 14px; }
.side-bottom { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid var(--border); }
.side-link { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 999px; color: var(--soft); font-size: 14px; white-space: nowrap; }
.side-link:hover { background: var(--hover); }
.side-link svg { width: 19px; height: 19px; }
#planLink svg { color: #e2a400; }

body.side-mini .side { width: 68px; }
body.side-mini .new-chat { width: 44px; padding: 0; justify-content: center; border-radius: 12px; }
body.side-mini .new-chat span, body.side-mini .side-label, body.side-mini .conv-list, body.side-mini .side-link span { display: none; }
body.side-mini .side-link { width: 44px; padding: 0; justify-content: center; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.top { display: flex; align-items: center; gap: 6px; height: 60px; padding: 0 16px 0 12px; flex: none; }
.brand a { display: inline-flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 600; color: var(--text); padding: 0 6px; letter-spacing: -.2px; }
.brand img { width: 24px; height: 24px; }
.model-wrap { position: relative; }
.model-btn { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; height: 36px; padding: 0 8px 0 10px; border-radius: 10px; color: var(--soft); font-size: 15px; max-width: 46vw; }
.model-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-btn svg { width: 16px; height: 16px; }
.model-btn:hover { background: var(--hover); }
.model-menu { position: absolute; top: 42px; left: 0; z-index: 30; width: 340px; max-height: min(78vh, 680px); overflow-y: auto; scrollbar-width: none; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 12px 36px rgba(0, 0, 0, .16); padding: 8px; }
.mm-group { font-size: 12px; color: var(--muted); padding: 10px 12px 4px; font-weight: 600; }
.mm-item { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; text-align: left; padding: 9px 12px; border-radius: 10px; font-size: 14px; }
.mm-item:hover { background: var(--hover); }
.mm-item.on { background: var(--accent-soft); }
.mm-item.locked { color: var(--muted); }
.mm-label { flex: 1; min-width: 0; }
.mm-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mm-check { width: 18px; height: 18px; color: var(--accent); }
.mm-foot { font-size: 12px; color: var(--muted); padding: 10px 12px 4px; border-top: 1px solid var(--border); margin-top: 6px; }
.quota { font-size: 13px; color: var(--muted); background: var(--side); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.login-btn { border: none; background: var(--accent); color: #fff; height: 38px; padding: 0 20px; border-radius: 999px; font-weight: 600; font-size: 14.5px; }
@media (prefers-color-scheme: dark) { .login-btn { color: #0b1a33; } }
.login-btn:hover { filter: brightness(1.06); }
.avatar-wrap { position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: none; background: linear-gradient(135deg, #4a7dff, #8b6cff); color: #fff; font-weight: 600; font-size: 15px; }
.user-menu { position: absolute; right: 0; top: 42px; z-index: 30; min-width: 220px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 12px 36px rgba(0, 0, 0, .16); padding: 8px; display: flex; flex-direction: column; }
.um-name { font-weight: 600; padding: 8px 12px 0; }
.um-plan { font-size: 12.5px; color: var(--muted); padding: 2px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-menu a, .user-menu button { border: none; background: none; text-align: left; padding: 9px 12px; border-radius: 10px; color: var(--text); font-size: 14px; }
.user-menu a:hover, .user-menu button:hover { background: var(--hover); }

/* ---------- 对话 ---------- */
.chat { flex: 1; overflow-y: auto; padding: 8px 20px 24px; scrollbar-width: thin; }
.log { max-width: 780px; margin: 0 auto; }
.hello { display: none; max-width: 780px; margin: 0 auto; }
body.empty .chat { display: flex; flex-direction: column; justify-content: flex-end; flex: 1 1 auto; padding-bottom: 26px; }
body.empty .hello { display: block; width: 100%; padding: 0 4px; }
body.empty .composer-wrap { flex: 1 1 auto; }
.hello h1 { margin: 0; font-size: clamp(30px, 4.2vw, 44px); font-weight: 500; letter-spacing: -.5px; line-height: 1.25; }
.hello p { margin: 6px 0 0; font-size: clamp(22px, 3vw, 32px); color: var(--muted); opacity: .75; font-weight: 400; }
.grad { background: linear-gradient(90deg, #4a7dff 0%, #8b6cff 45%, #d96570 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

.msg { margin: 0 0 26px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--user); padding: 11px 18px; border-radius: 22px 22px 6px 22px; max-width: 78%; white-space: pre-wrap; word-break: break-word; }
.msg.assistant { display: flex; gap: 16px; align-items: flex-start; }
.ai-ico { width: 30px; height: 30px; flex: none; margin-top: 1px; }
body.busy .msg.assistant:last-child .ai-ico { animation: ai-spin 2.4s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.msg.assistant .body { flex: 1; min-width: 0; padding-top: 2px; }
.md { color: var(--soft); line-height: 1.75; word-break: break-word; }
.md p { margin: 0 0 .75em; }
.md > :last-child { margin-bottom: 0; }
.md b, .md strong { color: var(--text); }
.md .h { color: var(--text); font-weight: 650; margin: 1em 0 .45em; }
.md .h1 { font-size: 1.3em; } .md .h2 { font-size: 1.18em; } .md .h3 { font-size: 1.06em; }
.md ul, .md ol { margin: .2em 0 .8em; padding-left: 1.5em; }
.md li { margin: .15em 0; }
.md code { background: var(--code-bg); color: var(--code-text); padding: .12em .38em; border-radius: 5px; font: .86em var(--mono); }
.md blockquote { margin: .5em 0; padding-left: 14px; border-left: 3px solid var(--border); color: var(--muted); }
.md a { color: var(--accent); cursor: pointer; }
.md a:hover { text-decoration: underline; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md .table-wrap { overflow-x: auto; margin: .6em 0 1em; border: 1px solid var(--border); border-radius: 12px; }
.md table { border-collapse: collapse; width: 100%; font-size: .92em; }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md tr:last-child td { border-bottom: none; }
.md th { background: var(--table-head); white-space: nowrap; }
.md .code { margin: .6em 0 1em; border-radius: 14px; overflow: hidden; background: var(--code-block-bg); border: 1px solid var(--border); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 0 14px; font-size: 12px; color: var(--muted); }
.code-copy { border: none; background: none; color: var(--muted); font-size: 12.5px; padding: 3px 8px; border-radius: 6px; }
.code-copy:hover { background: var(--hover); }
.md .code pre { margin: 0; padding: 8px 14px 14px; overflow-x: auto; font: 13px/1.6 var(--mono); color: var(--code-text); }
.md .code pre code { background: none; padding: 0; font: inherit; }
.tk-kw { color: var(--tk-kw); } .tk-str { color: var(--tk-str); } .tk-com { color: var(--tk-com); font-style: italic; } .tk-num { color: var(--tk-num); } .tk-fn { color: var(--tk-fn); } .tk-type { color: var(--tk-type); } .tk-attr { color: var(--tk-attr); }
.cursor { display: inline-block; width: 8px; height: 1.05em; vertical-align: -2px; margin-left: 2px; border-radius: 2px; background: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: flex; align-items: center; gap: 5px; height: 28px; color: var(--muted); font-size: 14px; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: linear-gradient(135deg, #4a7dff, #8b6cff); animation: dot 1.2s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
.thinking span { margin-left: 8px; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.msg-err { margin-top: 6px; color: var(--danger); font-size: 14px; }
.msg-err a { margin-left: 6px; font-weight: 600; }
.acts { display: flex; align-items: center; gap: 2px; margin-top: 8px; margin-left: -8px; opacity: 0; transition: opacity .15s; }
.msg.assistant:hover .acts, .msg.assistant:last-child .acts { opacity: 1; }
body.busy .msg.assistant:last-child .acts { opacity: 0; pointer-events: none; }
.acts button { border: none; background: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.acts button svg { width: 17px; height: 17px; }
.acts button:hover { background: var(--hover); color: var(--text); }
.billed { font-size: 12px; color: var(--muted); margin-left: 6px; }

/* ---------- 输入框 ---------- */
.composer-wrap { flex: none; padding: 0 20px 10px; }
.composer { max-width: 780px; margin: 0 auto; background: var(--input); border-radius: 28px; padding: 14px 12px 10px 22px; transition: box-shadow .2s, background .2s; }
.composer:focus-within { box-shadow: 0 2px 14px rgba(63, 108, 240, .12); }
@media (prefers-color-scheme: dark) { .composer:focus-within { box-shadow: 0 0 0 1px #3c4043; } }
.composer textarea { width: 100%; border: none; outline: none; resize: none; background: transparent; color: var(--text); font: 16px/1.55 var(--font); max-height: 220px; padding: 4px 0; }
.composer textarea::placeholder { color: var(--muted); }
.composer-row { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.composer-hint { font-size: 12.5px; color: var(--muted); }
.send { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; transition: opacity .15s, transform .15s; }
@media (prefers-color-scheme: dark) { .send { color: #0b1a33; } }
.send:disabled { opacity: .35; cursor: default; }
.send:not(:disabled):hover { transform: scale(1.05); }
.send .i-stop { display: none; }
body.busy .send .i-send { display: none; }
body.busy .send .i-stop { display: block; }
.send .i-stop { fill: currentColor; stroke: none; }
.chips { display: none; max-width: 780px; margin: 16px auto 0; gap: 10px; flex-wrap: wrap; justify-content: center; }
body.empty .chips { display: flex; }
.chips button { border: 1px solid var(--border); background: var(--bg); color: var(--soft); border-radius: 999px; padding: 9px 16px; font-size: 14px; }
.chips button:hover { background: var(--hover); }
.foot { max-width: 780px; margin: 10px auto 0; text-align: center; font-size: 12px; color: var(--muted); }
body.empty .foot { margin-top: 28px; }

/* ---------- 登录弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .4); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { background: var(--panel); border-radius: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); width: 100%; max-width: 400px; padding: 30px 28px 24px; position: relative; max-height: calc(100dvh - 32px); overflow-y: auto; }
.close { position: absolute; right: 14px; top: 12px; border: none; background: none; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; color: var(--muted); }
.close:hover { background: var(--hover); }
.auth { text-align: center; }
.auth-logo { width: 46px; height: 46px; }
.auth h2 { margin: 10px 0 2px; font-size: 22px; font-weight: 600; }
.auth .sub { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.tabs { display: flex; background: var(--side); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tabs button { flex: 1; border: none; background: none; height: 36px; border-radius: 999px; color: var(--muted); font-size: 14.5px; }
.tabs button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.auth form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.auth input:not([type="checkbox"]) { width: 100%; height: 46px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 12px; padding: 0 14px; font: 15px var(--font); outline: none; }
.auth input:focus { border-color: var(--accent); }
.captcha { display: flex; gap: 10px; }
.captcha input { flex: 1; }
.captcha img { height: 46px; width: 120px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; object-fit: cover; background: #fff; }
.agree { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.5; }
.agree input { margin-top: 3px; }
.err { color: var(--danger); font-size: 13px; min-height: 1px; }
.primary { height: 46px; border: none; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; margin-top: 4px; }
@media (prefers-color-scheme: dark) { .primary { color: #0b1a33; } }
.primary:disabled { opacity: .6; }

.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 60; background: #303134; color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); }

.scrim { display: none; }
.mobile-only { display: none; }

/* ---------- 手机 ---------- */
@media (max-width: 820px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 300px; max-width: 85vw; transform: translateX(-100%); transition: transform .22s ease; }
  body.side-open .side { box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .35); }
  body.side-mini .side { width: 300px; }
  body.side-mini .new-chat span, body.side-mini .side-label, body.side-mini .side-link span { display: inline; }
  body.side-mini .conv-list { display: block; }
  body.side-mini .new-chat, body.side-mini .side-link { width: auto; padding: 0 16px 0 12px; justify-content: flex-start; }
  .mobile-only { display: inline-flex; }
  .top { padding: 0 10px 0 6px; height: 56px; gap: 2px; }
  .brand { display: none; }
  .quota { display: none; }
  .model-menu { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; }
  .chat { padding: 4px 16px 16px; }
  .composer-wrap { padding: 0 12px calc(8px + env(safe-area-inset-bottom)); }
  .composer { padding: 10px 8px 6px 18px; border-radius: 26px; }
  .msg.assistant { gap: 10px; }
  .ai-ico { width: 26px; height: 26px; }
  .msg.user .bubble { max-width: 88%; }
  .chips { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .chips button { flex: none; }
  .foot { font-size: 11.5px; }
  body.empty .chat { justify-content: center; }
  body.empty .composer-wrap { flex: 0 0 auto; }
}
.um-toggle { display: flex; align-items: center; gap: 10px; }
.um-toggle span { flex: 1; display: flex; flex-direction: column; }
.um-toggle b { font-weight: 500; }
.um-toggle small { font-size: 12px; color: var(--muted); }
.switch { flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; }
.switch::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.um-toggle.on .switch { background: var(--accent); }
.um-toggle.on .switch::after { transform: translateX(14px); }
#clearAll { color: var(--danger); }
.user-menu { min-width: 270px; }
.loading-conv { padding: 40px 0; display: flex; justify-content: center; }

/* ---------- 会员与客服弹窗 ---------- */
button.quota { border: none; cursor: pointer; }
button.quota:hover { background: var(--hover); color: var(--text); }
.card.member { max-width: 720px; padding: 0; display: flex; flex-direction: column; max-height: min(88dvh, 820px); overflow: hidden; text-align: left; }
#memTabsView { padding: 24px 28px 0; flex: none; }
.mem-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding-right: 30px; }
.mem-head h2 { margin: 0; font-size: 21px; font-weight: 600; }
.mem-quota { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }
.mem-quota b { color: var(--text); font-weight: 600; }
.mem-tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--border); }
.mem-tabs button { border: none; background: none; padding: 10px 14px; font-size: 14.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.mem-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.badge { font-style: normal; background: var(--danger); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.mem-body { flex: 1; overflow-y: auto; padding: 18px 28px 24px; }
.muted { color: var(--muted); font-size: 13px; }
.muted.tiny { font-size: 12px; margin-top: 8px; }
.muted.empty { padding: 30px 0; text-align: center; }
.note { margin: 14px 0 0; line-height: 1.6; }
.seg { display: inline-flex; background: var(--side); border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.seg button { border: none; background: none; border-radius: 999px; padding: 6px 16px; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.seg small { color: #e06a2c; font-weight: 500; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.plan { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--panel); }
.plan.hot { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-top { display: flex; align-items: center; gap: 8px; }
.plan-top b { font-size: 16px; }
.plan .price { font-size: 26px; font-weight: 650; letter-spacing: -.5px; color: var(--text); margin: 2px 0; }
.plan .price small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.plan .price.pk { font-size: 20px; margin: 0; }
.plan-line { font-size: 13.5px; color: var(--soft); }
.plan-sub { font-size: 12.5px; color: var(--muted); }
.plan .hl-num { color: var(--accent); font-weight: 700; }
.plan .hl-model { color: var(--text); font-weight: 600; }
.plan .hl-deal { color: #d9480f; font-weight: 600; }
@media (prefers-color-scheme: dark) { .plan .hl-deal { color: #ff9b5e; } }
.plan-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.plan.pack { flex-direction: row; align-items: center; gap: 14px; margin-top: 12px; }
.plan.pack > div { flex: 1; }
.buy { border: none; background: var(--accent); color: #fff; border-radius: 999px; padding: 7px 18px; font-size: 14px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .buy { color: #0b1a33; } }
.buy.ghost { background: var(--accent-soft); color: var(--accent); }
.buy:disabled { opacity: .6; }
.tag { display: inline-flex; align-items: center; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--side); color: var(--muted); font-weight: 500; }
.tag.ok { background: rgba(23, 128, 61, .12); color: #17803d; }
.tag.hot { background: rgba(224, 106, 44, .13); color: #d0601f; }
.tag.bad { background: rgba(197, 54, 44, .12); color: var(--danger); }
@media (prefers-color-scheme: dark) { .tag.ok { color: #81c995; } .tag.hot { color: #f6a96b; } }
.order-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.or-main { flex: 1; min-width: 0; }
.or-main .muted { margin-top: 2px; word-break: break-all; }
.small { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 5px 14px; font-size: 13px; color: var(--text); white-space: nowrap; }
.small:hover { background: var(--hover); }
.mem-chat { height: min(46dvh, 380px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 10px; }
.bub { max-width: 82%; padding: 9px 14px; border-radius: 16px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.bub.a { background: var(--side); align-self: flex-start; border-bottom-left-radius: 4px; }
.bub.u { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
@media (prefers-color-scheme: dark) { .bub.u { color: #0b1a33; } }
.mem-ask { display: flex; gap: 8px; }
.mem-ask input { flex: 1; height: 42px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px; padding: 0 16px; font: 14.5px var(--font); outline: none; }
.mem-ask input:focus { border-color: var(--accent); }
.mem-ask .primary { margin: 0; height: 42px; padding: 0 20px; }
.back { border: none; background: none; color: var(--muted); display: inline-flex; align-items: center; gap: 2px; padding: 4px 8px 4px 0; font-size: 14px; }
.back svg { width: 18px; height: 18px; }
.back:hover { color: var(--text); }
.pay-title { margin: 6px 0 14px; font-size: 21px; font-weight: 600; }
.pay-card { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; background: var(--panel); }
.pay-card.order { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pay-card.order > div:first-child { flex: 1; min-width: 0; }
.pay-card.order .price { font-size: 26px; font-weight: 650; }
.order-no { font: 15px var(--mono); margin-top: 2px; word-break: break-all; }
.link { border: none; background: none; color: var(--accent); font-size: 13px; padding: 0 4px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; }
.step { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.step i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
@media (prefers-color-scheme: dark) { .step i { color: #0b1a33; } }
.qr { display: block; width: 100%; max-width: 220px; margin: 12px auto 8px; border-radius: 12px; background: #fff; cursor: zoom-in; border: 1px solid var(--border); }
.qr-acts { display: flex; justify-content: center; gap: 8px; }
.way { padding: 10px 0; }
.way + .way { border-top: 1px solid var(--border); }
.way .muted { margin: 4px 0 0; line-height: 1.55; }
.way .primary { width: 100%; margin-top: 10px; }
.result { font-size: 13px; margin-top: 8px; line-height: 1.55; }
.wx { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 14px; }
.sorry { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }
.qr-viewer { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
.qr-viewer img { max-width: min(86vw, 420px); max-height: 70dvh; border-radius: 14px; background: #fff; }
.qr-viewer-acts { display: flex; gap: 10px; }
.qr-viewer-acts .primary { margin: 0; padding: 0 22px; }
.ghost-btn { height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff; font-size: 15px; }
@media (max-width: 820px) {
  .modal:has(.member) { padding: 0; align-items: flex-end; }
  .card.member { max-width: none; border-radius: 22px 22px 0 0; max-height: 92dvh; }
  #memTabsView { padding: 20px 18px 0; }
  .mem-body { padding: 16px 18px calc(20px + env(safe-area-inset-bottom)); }
  .pay-grid { grid-template-columns: 1fr; }
}
.expire { font-size: 12.5px; color: #c76a16; margin-top: 3px; }
@media (prefers-color-scheme: dark) { .expire { color: #f6a96b; } }

.model-menu::-webkit-scrollbar { display: none; }
/* 宽屏：模型菜单分两列，不用上下滚 */
@media (min-width: 900px) {
  .model-menu { width: 640px; column-count: 2; column-gap: 8px; max-height: calc(100dvh - 80px); }
  .model-menu .mm-item { padding: 6px 10px; font-size: 13.5px; }
  .model-menu .mm-group { padding: 8px 10px 2px; }
  .mm-group { break-after: avoid; }
  .mm-item { break-inside: avoid; }
  .mm-foot { column-span: all; }
}
.mm-vis { font-size: 11px; opacity: .75; }
/* 「手机远程控制电脑」只在手机上显示（电脑上和桌面客户端重复） */
.mobile-only-link { display: none !important; }
@media (max-width: 820px) { .mobile-only-link { display: flex !important; } }

/* ---------- 附件 ---------- */
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.att { display: flex; align-items: center; gap: 8px; max-width: 260px; padding: 6px 8px 6px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); font-size: 13px; }
.att i { font-style: normal; font-size: 18px; }
.att img { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; }
.att-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.att-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.att.error { border-color: var(--danger); }
.att.error .att-meta { color: var(--danger); max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.att.reading .att-meta { animation: blink 1.2s infinite; }
.att-x { border: none; background: none; color: var(--muted); font-size: 16px; width: 22px; height: 22px; border-radius: 50%; line-height: 1; }
.att-x:hover { background: var(--hover); color: var(--text); }
.attach-btn { width: 36px; height: 36px; border: none; background: none; border-radius: 50%; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; margin-left: -8px; }
.attach-btn:hover { background: var(--hover); color: var(--text); }
.composer-hint.warn { color: var(--danger); }
body.dragging .composer { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
body.dragging .composer textarea::placeholder { color: var(--accent); }
.u-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 78%; }
.u-wrap .bubble { max-width: 100%; }
.u-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.u-file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); font-size: 13px; color: var(--soft); max-width: 260px; }
.u-file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-file i { font-style: normal; }
.dl-table { display: inline-flex; align-items: center; gap: 6px; margin: -6px 0 12px; border: 1px solid var(--border); background: var(--panel); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }
.dl-table svg { width: 15px; height: 15px; }
.dl-table:hover { background: var(--hover); }
@media (max-width: 820px) { .u-wrap { max-width: 88%; } }
.code-head .code-dl { margin-left: auto; }

/* ---------- 生成图片 ---------- */
.img-mode-btn { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px 0 9px; border: 1px solid var(--border); background: transparent; color: var(--soft); border-radius: 999px; font-size: 13px; }
.img-mode-btn svg { width: 16px; height: 16px; }
.img-mode-btn:hover { background: var(--hover); }
.img-mode-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
body.img-mode .composer { box-shadow: 0 0 0 1.5px var(--accent); }
.gen-images { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 4px; }
.gen-images figure { margin: 0; max-width: min(100%, 420px); }
.gen-images img { display: block; width: 100%; border-radius: 14px; cursor: zoom-in; border: 1px solid var(--border); }
.gen-acts { display: flex; gap: 8px; margin-top: 8px; }
.gen-acts button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 999px; padding: 5px 14px; font-size: 13px; }
.gen-acts button svg { width: 15px; height: 15px; }
.gen-acts button:hover { background: var(--hover); }
.gen-note, .gen-gone { width: 100%; font-size: 12.5px; color: var(--muted); }
@media (max-width: 820px) { .img-mode-btn span { display: none; } .img-mode-btn { padding: 0 8px; } }

/* 兑换码 */
.redeem { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 14px; font-size: 14px; }
.redeem input { flex: 1; min-width: 180px; height: 38px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px; padding: 0 14px; font: 14px var(--mono); letter-spacing: .5px; text-transform: uppercase; outline: none; }
.redeem input:focus { border-color: var(--accent); }
.redeem-msg { width: 100%; font-size: 13px; color: var(--muted); }
.redeem-msg:empty { display: none; }
.redeem-msg.ok { color: #17803d; }
.redeem-msg.bad { color: var(--danger); }
@media (prefers-color-scheme: dark) { .redeem-msg.ok { color: #81c995; } }
