:root {
  color-scheme: dark;
  --bg: #0b0910;
  --bg-soft: #12101a;
  --panel: #17141f;
  --panel-2: #1d1928;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f1eef8;
  --muted: #938da6;
  --muted-2: #6f6980;
  --accent: #ff6b8a;
  --accent-2: #b06bff;
  --accent-soft: rgba(255, 107, 138, 0.14);
  --ok: #5fe0a0;
  --warn: #ffc46b;
  --danger: #ff7b7b;
  --radius: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app {
  position: relative;
  width: 100%;
  max-width: 760px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(90% 40% at 50% -10%, rgba(176, 107, 255, 0.12), transparent 70%),
    radial-gradient(70% 30% at 100% 0%, rgba(255, 107, 138, 0.08), transparent 70%),
    var(--bg);
}

/* ---------- shared ---------- */
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted-2); display: inline-block; flex: 0 0 auto;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(95, 224, 160, 0.12); }
.dot.pending { background: var(--warn); animation: blink 1.2s infinite; }
.dot.bad { background: var(--danger); }
@keyframes blink { 50% { opacity: 0.35; } }

.text-btn {
  border: 0; background: none; color: var(--accent);
  font-size: 13px; padding: 4px; border-radius: 8px;
}
.text-btn.subtle { color: var(--muted-2); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid transparent; background: transparent;
  color: var(--text); font-size: 22px; line-height: 1;
  display: grid; place-items: center;
}
.icon-btn:active { background: var(--panel); }

/* ---------- connect ---------- */
.connect {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(32px + var(--safe-top)) 26px calc(26px + var(--safe-bottom));
  overflow-y: auto;
}
.connect-glow {
  position: absolute; inset: -20% -30% auto -30%; height: 70%;
  background: radial-gradient(50% 60% at 50% 40%, rgba(255, 107, 138, 0.16), rgba(176, 107, 255, 0.10) 45%, transparent 72%);
  pointer-events: none;
}
.brand { position: relative; text-align: center; margin-bottom: 34px; }
.orb {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 26px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2a2038, #17131f);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 18px 50px rgba(176, 107, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  color: #ffd7e0; font-size: 30px;
}
.orb.tiny { width: 30px; height: 30px; border-radius: 10px; margin: 0; font-size: 14px; box-shadow: none; }
.brand h1 { margin: 0; font-size: 32px; letter-spacing: 0.02em; font-weight: 700; }
.brand h1 em { font-style: normal; background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 8px 0 0; color: var(--muted); font-size: 14px; letter-spacing: 0.02em; }

.pair-card {
  position: relative;
  background: linear-gradient(180deg, rgba(29, 25, 40, 0.9), rgba(21, 18, 30, 0.9));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 20px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.pair-card label { display: block; font-size: 12px; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 10px; }
.code-input {
  width: 100%; border: 1px solid var(--line); border-radius: 16px;
  background: rgba(0, 0, 0, 0.28); color: var(--text);
  font: 600 30px/1 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: 0.32em; text-align: center; padding: 16px 12px 16px 22px;
  outline: none;
}
.code-input::placeholder { color: #443f52; letter-spacing: 0.28em; }
.code-input:focus { border-color: rgba(255, 107, 138, 0.5); box-shadow: 0 0 0 4px rgba(255, 107, 138, 0.10); }
.primary {
  width: 100%; margin-top: 14px; border: 0; border-radius: 16px;
  padding: 15px; font-weight: 650; font-size: 16px; color: #fff;
  background: linear-gradient(100deg, #ff6b8a, #a15cff);
  box-shadow: 0 12px 30px rgba(255, 107, 138, 0.22);
}
.primary:disabled { opacity: 0.55; box-shadow: none; }
.primary:active:not(:disabled) { transform: translateY(1px); }
.error { margin: 10px 2px 0; color: var(--danger); font-size: 13px; }
.connect-foot { position: relative; margin-top: 22px; text-align: center; }
.status-line { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.hint { color: var(--muted-2); font-size: 12.5px; line-height: 1.7; margin: 0; }
.hint b { color: var(--muted); font-weight: 500; }

/* ---------- session list ---------- */
.view { height: 100%; }
#view-list { display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 18px 12px;
}
.topbar-brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: 0.02em; }
.topbar-right { display: flex; align-items: center; gap: 3px; }
.topbar-right .icon-btn { width: 34px; height: 34px; font-size: 18px; }
.conn-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 6px 11px; border-radius: 999px;
}
.list-scroll { flex: 1; overflow-y: auto; padding: 6px 18px calc(28px + var(--safe-bottom)); -webkit-overflow-scrolling: touch; }
.greet { margin: 18px 2px 24px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 13px; letter-spacing: 0.08em; }
.greet h2 { margin: 0; font-size: 28px; line-height: 1.35; font-weight: 700; letter-spacing: 0.01em; }
.new-chat {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(115deg, rgba(255, 107, 138, 0.16), rgba(176, 107, 255, 0.14));
  border: 1px solid rgba(255, 107, 138, 0.22);
  border-radius: 18px; padding: 16px 18px; color: var(--text);
  font-weight: 600; font-size: 15px;
}
.new-chat .plus { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; background: rgba(255, 255, 255, 0.10); font-size: 18px; }
.new-chat .arrow { margin-left: auto; color: var(--muted); }
.new-chat:active { transform: scale(0.99); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 2px 10px; color: var(--muted); font-size: 12.5px; letter-spacing: 0.08em; }
.session-list { display: flex; flex-direction: column; gap: 10px; }
.session-card {
  width: 100%; text-align: left; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(29, 25, 40, 0.65), rgba(20, 17, 28, 0.65));
  border-radius: 18px; padding: 15px 16px 13px;
  display: flex; flex-direction: column; gap: 6px;
}
.session-card:active { background: var(--panel); transform: scale(0.995); }
.sc-top { display: flex; align-items: baseline; gap: 12px; }
.sc-title { flex: 1; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-time { color: var(--muted-2); font-size: 11.5px; flex: 0 0 auto; }
.sc-snippet { color: var(--muted); font-size: 13px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; color: var(--muted-2); font-size: 11.5px; }
.sc-cwd { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-run { color: var(--ok); display: inline-flex; align-items: center; gap: 5px; }
.sc-run::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.skeleton-card { height: 96px; border-radius: 18px; background: linear-gradient(100deg, #15121d 20%, #1c1826 40%, #15121d 60%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13.5px; }
.list-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; color: var(--muted-2); font-size: 12px; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; }
.chat-top {
  display: flex; align-items: center; gap: 6px;
  padding: calc(10px + var(--safe-top)) 10px 10px;
  background: rgba(11, 9, 16, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 5;
}
.chat-title { flex: 1; min-width: 0; padding: 0 4px; }
.chat-title .name { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title .meta { color: var(--muted-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-banner { padding: 9px 16px; background: rgba(255, 196, 107, 0.09); color: var(--warn); font-size: 12.5px; border-bottom: 1px solid rgba(255, 196, 107, 0.14); }
.messages {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 18px 16px 26px;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}
.msg { display: flex; margin: 0 0 16px; min-width: 0; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.bubble-user {
  max-width: 84%;
  background: linear-gradient(135deg, rgba(255, 107, 138, 0.22), rgba(176, 107, 255, 0.18));
  border: 1px solid rgba(255, 107, 138, 0.20);
  padding: 11px 14px; border-radius: 18px 18px 6px 18px;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; font-size: 14.5px;
}
.bubble-user img { max-width: 100%; border-radius: 12px; margin-top: 6px; display: block; }
.assistant { width: 100%; min-width: 0; max-width: 100%; }
.assistant-card { display: flex; gap: 10px; width: 100%; min-width: 0; }
.avatar {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 11px;
  background: linear-gradient(145deg, #2a2038, #17131f);
  border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 13px; color: #ffd7e0;
  margin-top: 2px;
}
.assistant-body { flex: 1; min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 9px; }
.assistant-body > * { max-width: 100%; }
.assistant-body > .md { font-size: 14.5px; }

.md { word-break: break-word; overflow-wrap: anywhere; max-width: 100%; }
.md p { margin: 0 0 9px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 14px 0 8px; line-height: 1.35; }
.md h1 { font-size: 19px; } .md h2 { font-size: 17px; } .md h3, .md h4 { font-size: 15.5px; }
.md ul, .md ol { margin: 6px 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code { background: rgba(255, 255, 255, 0.08); border-radius: 6px; padding: 1.5px 5px; font: 0.9em ui-monospace, "SF Mono", Consolas, monospace; }
.md pre { background: #0a0810; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; overflow-x: auto; margin: 8px 0 10px; }
.md pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.6; }
.md blockquote { margin: 8px 0; padding: 2px 0 2px 12px; border-left: 3px solid rgba(176, 107, 255, 0.45); color: var(--muted); }
.md a { color: #9fc4ff; text-decoration: none; border-bottom: 1px solid rgba(159, 196, 255, 0.35); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.md th { background: rgba(255, 255, 255, 0.04); }

.think { border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, 0.025); overflow: hidden; }
.think summary { list-style: none; cursor: pointer; padding: 9px 12px; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.think summary::-webkit-details-marker { display: none; }
.think summary::before { content: "✧"; color: var(--accent-2); }
.think[open] summary { border-bottom: 1px solid var(--line); }
.think .md { padding: 10px 12px; color: var(--muted); font-size: 13px; }

.tool {
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, 0.028);
  overflow: hidden; min-width: 0; max-width: 100%;
}
.tool-head { display: flex; align-items: center; gap: 9px; padding: 10px 12px; min-width: 0; cursor: pointer; }
.tool-ico { width: 24px; height: 24px; border-radius: 8px; background: rgba(176, 107, 255, 0.14); color: #c9b6ff; display: grid; place-items: center; font-size: 12px; flex: 0 0 auto; }
.tool-name { font-size: 13px; font-weight: 600; flex: 0 0 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-arg { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
.tool-state { flex: 0 0 auto; font-size: 11px; color: var(--muted-2); }
.tool-state.done { color: var(--ok); }
.tool-state.error { color: var(--danger); }
.tool-state.running { color: var(--warn); animation: blink 1.2s infinite; }
.tool-peek { flex: 0 0 auto; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.tool-open .tool-peek { color: var(--accent-2); border-color: rgba(176, 107, 255, 0.3); }
.tool-out { margin: 0; border-top: 1px solid var(--line); padding: 10px 12px; font: 12px/1.55 ui-monospace, Consolas, monospace; color: #b9b3c8; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; }
.tool-out.error { color: #ffb2b2; }
.tool-more { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: none; color: var(--muted); font-size: 11.5px; padding: 7px; }
.turn-note { text-align: center; color: var(--muted-2); font-size: 11.5px; margin: 4px 0 18px; letter-spacing: 0.04em; }
.turn-note.error { color: var(--danger); }
.loading-line { display: flex; gap: 4px; padding: 8px 0; }
.loading-line i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.loading-line i:nth-child(2) { animation-delay: 0.15s; } .loading-line i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.jump {
  position: absolute; right: 18px; bottom: 152px;
  border: 1px solid var(--line); background: rgba(23, 20, 31, 0.92);
  color: var(--text); border-radius: 999px; padding: 8px 13px;
  font-size: 12px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

/* ---------- approval ---------- */
.approval {
  margin: 0 12px 8px;
  border: 1px solid rgba(255, 196, 107, 0.34);
  background: linear-gradient(180deg, rgba(60, 44, 24, 0.92), rgba(32, 26, 20, 0.95));
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.approval-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; font-weight: 600; color: #ffd79a; background: rgba(255, 196, 107, 0.08); }
.approval-ico { width: 18px; height: 18px; border-radius: 50%; background: rgba(255, 196, 107, 0.2); display: grid; place-items: center; font-size: 12px; }
.approval-body { padding: 10px 14px 4px; }
.approval-tool { font: 600 13px/1.5 ui-monospace, Consolas, monospace; color: #ffe3b8; }
.approval-reason { color: #c9b28f; font-size: 12.5px; line-height: 1.55; margin-top: 4px; word-break: break-word; }
.approval-actions { display: flex; gap: 8px; padding: 10px 14px 12px; }
.approval-actions button { flex: 1; border-radius: 11px; padding: 9px 10px; font-size: 13px; font-weight: 600; border: 1px solid transparent; }
.approval-actions .deny { background: rgba(255, 255, 255, 0.06); color: #ffb9b9; border-color: rgba(255, 122, 122, 0.25); }
.approval-actions .allow { background: linear-gradient(100deg, #ffb45c, #ff8a6b); color: #2a1a08; }
.approval-actions button:disabled { opacity: 0.5; }

/* ---------- user questions ---------- */
.question {
  margin: 0 12px 8px;
  border: 1px solid rgba(122, 160, 255, 0.32);
  background: linear-gradient(180deg, rgba(28, 36, 62, 0.96), rgba(20, 24, 40, 0.97));
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; max-height: 48vh;
}
.q-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; font-weight: 600; color: #cfe0ff; background: rgba(122, 160, 255, 0.09); flex: 0 0 auto; }
.q-ico { width: 18px; height: 18px; border-radius: 50%; background: rgba(122, 160, 255, 0.22); display: grid; place-items: center; font-size: 12px; }
.q-progress { margin-left: auto; color: #8ea7d8; font-size: 11.5px; font-weight: 400; }
.q-body { padding: 12px 14px 4px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.q-item { display: flex; flex-direction: column; gap: 4px; }
.q-label { font-size: 11px; letter-spacing: 0.08em; color: #7f93b8; }
.q-title { font-size: 14.5px; font-weight: 600; color: #eef2fb; line-height: 1.5; }
.q-detail { color: #9aa7bd; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; }
.q-options { display: flex; flex-direction: column; gap: 7px; margin-top: 7px; }
.q-option { text-align: left; border: 1px solid rgba(255, 255, 255, 0.09); background: rgba(255, 255, 255, 0.03); color: #e6ebf6; border-radius: 11px; padding: 9px 12px; font-size: 13.5px; line-height: 1.45; }
.q-option small { display: block; color: #8f9bb0; font-size: 11.5px; margin-top: 2px; }
.q-option.selected { border-color: rgba(122, 160, 255, 0.65); background: rgba(122, 160, 255, 0.16); color: #e7efff; }
.q-custom { width: 100%; margin-top: 8px; background: #0b0910; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 10px; padding: 9px 11px; color: var(--text); font-size: 13px; outline: none; }
.q-custom:focus { border-color: rgba(122, 160, 255, 0.5); }
.q-actions { display: flex; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid rgba(255, 255, 255, 0.06); flex: 0 0 auto; }
.q-actions button { border-radius: 11px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; border: 1px solid transparent; }
.q-later { flex: 0 0 auto; background: rgba(255, 255, 255, 0.06); color: #9aa7bd; border-color: rgba(255, 255, 255, 0.08); }
.q-submit { flex: 1; background: linear-gradient(100deg, #5b8cff, #9b6bff); color: #fff; }
.q-submit:disabled { opacity: 0.5; }

/* ---------- composer ---------- */
.composer {
  padding: 8px 12px calc(10px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, rgba(11, 9, 16, 0.92) 30%);
}
.working { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; padding: 2px 6px 7px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(255, 107, 138, 0.5); animation: pulse 1.5s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(255, 107, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 107, 138, 0); } }
.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; padding: 7px 7px 7px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.composer-box:focus-within { border-color: rgba(255, 107, 138, 0.35); }
.composer textarea {
  flex: 1; resize: none; border: 0; background: none; outline: none;
  padding: 8px 0; max-height: 132px; min-height: 24px;
  font-size: 16px; line-height: 1.45;
}
.composer textarea::placeholder { color: var(--muted-2); }
.send-btn {
  width: 40px; height: 40px; border: 0; border-radius: 15px;
  background: linear-gradient(140deg, #ff6b8a, #a15cff);
  color: #fff; font-size: 19px; font-weight: 700;
  display: grid; place-items: center; flex: 0 0 auto;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.send-btn:disabled { opacity: 0.35; }
.send-btn.steer { background: linear-gradient(140deg, #5b8cff, #9b6bff); }
.stop-btn {
  width: 40px; height: 40px; border: 0; border-radius: 15px;
  background: #2a2436; color: #ff9aa8; font-size: 13px;
  display: grid; place-items: center; flex: 0 0 auto;
}
.stop-btn:active { background: #3a3048; }
.attach-btn {
  width: 40px; height: 40px; border: 0; border-radius: 15px;
  background: rgba(255, 255, 255, 0.06); color: #c9c3d8;
  font-size: 21px; font-weight: 400; line-height: 1;
  display: grid; place-items: center; flex: 0 0 auto;
}
.attach-btn:active { background: rgba(255, 255, 255, 0.12); }
.attachments { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 8px; }
.attachment { position: relative; width: 62px; height: 62px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); flex: 0 0 auto; background: #0b0910; }
.attachment img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment .rm { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 12px; line-height: 1; display: grid; place-items: center; }
.attachment.file { width: 136px; height: 62px; display: flex; align-items: center; gap: 7px; padding: 8px 22px 8px 8px; }
.attachment.file .file-ico { width: 26px; height: 26px; border-radius: 8px; background: rgba(122, 160, 255, 0.16); display: grid; place-items: center; font-size: 13px; flex: 0 0 auto; }
.attachment.file .file-meta { min-width: 0; }
.attachment.file .file-name { font-size: 11px; color: #d6dcea; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.attachment.file .file-size { font-size: 9.5px; color: #7f8aa3; }
.bubble-file { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 11px; background: rgba(0, 0, 0, 0.16); }
.bubble-file .ico { width: 28px; height: 28px; border-radius: 8px; background: rgba(122, 160, 255, 0.18); display: grid; place-items: center; font-size: 13px; flex: 0 0 auto; }
.bubble-file .name { font-size: 12.5px; word-break: break-all; }
.bubble-file .size { color: var(--muted-2); font-size: 10.5px; }
.composer-hint { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 10.5px; padding: 7px 8px 0; }

/* ---------- 设置弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.62);
  display: flex; align-items: center; justify-content: center;
  padding: 22px; backdrop-filter: blur(4px);
}
.modal-card {
  width: 100%; max-width: 380px;
  background: #17141f; border: 1px solid var(--line);
  border-radius: 20px; padding: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.modal-card h3 { margin: 0 0 14px; font-size: 16px; }
.modal-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.modal-input {
  width: 100%; background: #0b0910; border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 12px; color: var(--text); font-size: 14px;
  outline: none;
}
.modal-input:focus { border-color: rgba(255, 107, 138, 0.45); }
.modal-hint { color: var(--muted-2); font-size: 11.5px; line-height: 1.65; margin: 9px 0 14px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-actions button { flex: 1 1 45%; border-radius: 11px; padding: 10px; font-size: 13px; font-weight: 600; border: 1px solid transparent; }
.modal-primary { background: linear-gradient(100deg, #ff6b8a, #a15cff); color: #fff; }
.modal-secondary { background: rgba(255, 255, 255, 0.06); color: var(--muted); border-color: var(--line); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(32, 27, 44, 0.96); border: 1px solid var(--line);
  color: var(--text); padding: 10px 16px; border-radius: 12px;
  font-size: 13px; max-width: 82vw; text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); z-index: 50;
}

@media (min-width: 761px) {
  body { background: #060509; }
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); box-shadow: 0 0 80px rgba(0, 0, 0, 0.6); }
  .connect { max-width: 420px; margin: 0 auto; }
}
