/* 不醒酱工作台 — 玻璃拟态 × 淡海蓝设计系统
   配方：纯水色底 → 面板 backdrop-filter 雾化 → 细白高光描边 → 海蓝轻悬浮阴影 */
:root {
  --text: #1f3a52;
  --muted: #5f82a0;
  --line: rgba(255, 255, 255, 0.55);
  --hairline: rgba(44, 90, 130, 0.1);
  --glass-hi: linear-gradient(135deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.34));
  --glass-mid: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.24));
  --glass-deep: linear-gradient(135deg, rgba(224, 242, 254, 0.62), rgba(186, 224, 255, 0.38));
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 16px 44px rgba(52, 110, 165, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --accent: #4a90e2;
  --accent-2: #69b1ff;
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --ok: #0d9488;
  --bubble-user-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.5));
  --bubble-ai-bg: linear-gradient(135deg, rgba(224, 242, 254, 0.66), rgba(186, 224, 255, 0.42));
  --shadow-float: 0 24px 70px rgba(52, 110, 165, 0.2);
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6f1fa;
    --muted: #8fb0c8;
    --line: rgba(255, 255, 255, 0.12);
    --hairline: rgba(140, 190, 230, 0.1);
    --glass-hi: linear-gradient(135deg, rgba(24, 52, 74, 0.55), rgba(13, 34, 50, 0.42));
    --glass-mid: linear-gradient(135deg, rgba(20, 46, 66, 0.5), rgba(11, 28, 42, 0.36));
    --glass-deep: linear-gradient(135deg, rgba(30, 62, 86, 0.5), rgba(16, 40, 58, 0.38));
    --glass-border: rgba(140, 190, 230, 0.16);
    --glass-shadow: 0 16px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    --accent: #5c9fe8;
    --accent-2: #8cc4f4;
    --amber: #e8a33d;
    --amber-soft: rgba(232, 163, 61, 0.12);
    --danger: #f87171;
    --bubble-user-bg: linear-gradient(135deg, rgba(30, 58, 80, 0.5), rgba(16, 36, 52, 0.38));
    --bubble-ai-bg: linear-gradient(135deg, rgba(74, 144, 226, 0.24), rgba(46, 104, 160, 0.18));
    --shadow-float: 0 24px 70px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "SF Pro Text", "Segoe UI", system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  background: #86cecb; /* 水色 */
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  body { background: #0c2530; }
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12.5px; }
.micro {
  font-size: 11px;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 600;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120, 128, 160, 0.3); border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: rgba(120, 128, 160, 0.35) transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- 玻璃面板通用 ---------- */
.glass-panel {
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* ---------- 图标 ---------- */
.ic { width: 16px; height: 16px; display: block; flex-shrink: 0; }
.ic.sm { width: 14px; height: 14px; }
.ic.xs { width: 12px; height: 12px; }
.ic.lg { width: 42px; height: 42px; stroke-width: 1.2; }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 12px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s, border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  border: 1px solid var(--glass-border);
  background: var(--glass-mid);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(52, 110, 165, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
@media (prefers-color-scheme: dark) {
  .btn { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  box-shadow: 0 10px 26px rgba(74, 144, 226, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn.ghost:hover:not(:disabled) { background: var(--glass-hi); }
.btn.warn { color: var(--amber); }
.btn.warn:hover:not(:disabled) { border-color: var(--amber); }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--glass-mid); color: var(--text); }
.icon-btn.tiny { width: 22px; height: 22px; border-radius: 7px; }
.icon-btn.tiny .ic { width: 12px; height: 12px; }
.mini-badge {
  position: absolute;
  top: 1px;
  right: -1px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  background: var(--amber);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  padding: 0 3px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  border-radius: 26px;
  padding: 46px 40px 38px;
  width: 100%;
  max-width: 370px;
  text-align: center;
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  position: relative;
  overflow: hidden;
}
/* 玻璃表面斜向光斑 */
.login-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.16) 45%, transparent 58%);
}
.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(74, 144, 226, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.login-card h1 { margin: 20px 0 6px; font-size: 19px; font-weight: 700; letter-spacing: 0.01em; }
.login-sub { margin: 0 0 30px; color: var(--muted); font-size: 12.5px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid var(--glass-border);
  background: var(--glass-mid);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.login-card input:focus { border-color: rgba(74, 144, 226, 0.65); box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.14); }
.login-card input::placeholder { color: var(--muted); }
.login-err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin: 12px 0 0; }
.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- 布局 ---------- */
.app { display: flex; height: 100dvh; overflow: hidden; padding: 14px; gap: 14px; }
#sidePanel {
  width: 302px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(28px) saturate(175%);
  backdrop-filter: blur(28px) saturate(175%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
#roomPanel { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- 会话列表 ---------- */
.side-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 12px 16px;
  border-bottom: 1px solid var(--hairline);
}
.logo-mark.sm { width: 27px; height: 27px; border-radius: 9px; font-size: 13px; }
.brand { flex: 1; font-size: 13.5px; font-weight: 700; letter-spacing: 0.02em; }
.side-actions { display: flex; gap: 2px; }
.list-label { padding: 14px 18px 4px; }
.sessions-list { flex: 1; overflow-y: auto; padding: 4px 10px 14px; }
.empty-list { text-align: center; color: var(--muted); padding: 56px 24px; font-size: 12.5px; line-height: 2; }
.chat-card {
  display: flex;
  gap: 11px;
  padding: 10px;
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  align-items: center;
  border: 1px solid transparent;
}
.chat-card:hover { background: var(--glass-mid); }
.chat-card.active {
  background: var(--glass-hi);
  border-color: var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 18px rgba(52, 110, 165, 0.08);
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--glass-deep);
  color: var(--muted);
  font-weight: 650;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.avatar-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid rgba(255, 255, 255, 0.8);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.55; }
}
.card-main { flex: 1; min-width: 0; }
.card-top { display: flex; align-items: center; gap: 6px; }
.card-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-time { margin-left: auto; font-size: 11px; color: var(--muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.card-bottom { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.card-snippet {
  flex: 1;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.status .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.wait { color: var(--amber); font-weight: 600; }
.status.wait .dot { animation: pulse 1.6s ease-in-out infinite; }
.chip-mini {
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0 4px;
  line-height: 1.5;
  flex-shrink: 0;
  background: var(--glass-mid);
}

/* ---------- 聊天室 ---------- */
.room-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  gap: 6px;
}
.room-empty p { margin: 14px 0 0; font-size: 13.5px; color: var(--text); }
.room-empty .muted { font-size: 12px; }
.room-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(28px) saturate(175%);
  backdrop-filter: blur(28px) saturate(175%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.room-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--glass-mid);
}
.back-btn { display: none; }
.room-title-wrap { flex: 1; min-width: 0; }
.room-title { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 不醒酱的专属小表情 */
.room-title::after {
  content: "(˘ω˘)ᶻᶻ";
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 8px;
  letter-spacing: 0.02em;
}
.room-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; font-variant-numeric: tabular-nums; }

.prompt-box {
  margin: 14px 22px 0;
  border-radius: 14px;
  padding: 10px 13px;
  background: var(--glass-mid);
  border: 1px solid var(--hairline);
}
.prompt-label { margin-bottom: 5px; }
.prompt-content {
  font-size: 12.5px;
  color: var(--muted);
  max-height: 88px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.waiting-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 22px 0;
  padding: 8px 13px;
  border-radius: 12px;
  background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.4s ease-in-out infinite;
}
.countdown { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 500; }
.countdown.urgent { color: var(--danger); }

.messages { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.msg-row { display: flex; gap: 10px; max-width: 78%; }
.msg-row.user { align-self: flex-start; }
.msg-row.assistant { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.note { align-self: center; max-width: 90%; }
.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.msg-avatar.user { background: var(--glass-deep); color: var(--muted); }
.msg-avatar.ai {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.msg-body { min-width: 0; }
.msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.msg-row.assistant .msg-meta { text-align: right; }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 24px rgba(52, 110, 165, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}
@media (prefers-color-scheme: dark) {
  .msg-bubble { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
}
.msg-row.user .msg-bubble { background: var(--bubble-user-bg); border-top-left-radius: 5px; }
.msg-row.assistant .msg-bubble { background: var(--bubble-ai-bg); border-top-right-radius: 5px; }
.msg-row.note .msg-bubble {
  background: var(--glass-mid);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  border-radius: 10px;
  padding: 7px 14px;
  box-shadow: none;
}
.msg-row.is-pending .msg-bubble {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 40%, transparent);
}
.pending-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pending-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.pending-tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.4s ease-in-out infinite;
}
.pending-reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
  background: var(--glass-mid);
  color: var(--amber);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  padding: 3px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pending-reply-btn:hover, .pending-reply-btn.selected { background: var(--amber); color: #fff; border-color: var(--amber); }
.msg-images { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-images img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  cursor: zoom-in;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 14px rgba(52, 110, 165, 0.12);
}

.typing-hint { align-self: flex-end; font-size: 11.5px; color: var(--muted); padding-right: 6px; }

/* ---------- 快捷语 ---------- */
.quick-row {
  display: flex;
  gap: 7px;
  padding: 8px 22px 0;
  overflow-x: auto;
  flex-shrink: 0;
}
.quick-row:empty { display: none; }
.quick-chip {
  border: 1px solid var(--glass-border);
  background: var(--glass-mid);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.quick-chip:hover { color: var(--text); background: var(--glass-hi); }

/* ---------- 输入区 ---------- */
.composer { padding: 10px 22px calc(14px + env(safe-area-inset-bottom)); flex-shrink: 0; border-top: 2px dashed color-mix(in srgb, var(--accent) 30%, transparent); }
.reply-target-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent);
  border-radius: 9px;
  padding: 4px 6px 4px 10px;
  margin-bottom: 8px;
  max-width: 100%;
}
.reply-target-bar b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}
#replyInput {
  display: block;
  width: 100%;
  resize: none;
  border: 1px solid var(--glass-border);
  background: var(--glass-mid);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  outline: none;
  max-height: 140px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
#replyInput:focus { border-color: rgba(74, 144, 226, 0.6); box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.13); }
#replyInput::placeholder { color: var(--muted); }
.composer-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 9px; }

/* ---------- 快捷语编辑器 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 26, 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 45;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  z-index: 46;
  padding: 18px;
  animation: modalIn 0.16s ease;
}
@keyframes modalIn {
  from { transform: translate(-50%, -48%); opacity: 0.4; }
  to { transform: translate(-50%, -50%); opacity: 1; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head b { font-size: 14px; }
.modal-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.quick-edit-list { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.quick-edit-row { display: flex; gap: 6px; align-items: center; }
.quick-edit-row input {
  flex: 1;
  border: 1px solid var(--glass-border);
  background: var(--glass-mid);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.quick-edit-row input:focus { border-color: rgba(74, 144, 226, 0.6); box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.12); }

/* ---------- 预设朋友 ---------- */
.contact-form { display: flex; flex-direction: column; gap: 7px; margin: 10px 0 4px; }
.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--glass-border);
  background: var(--glass-mid);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: none;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: rgba(74, 144, 226, 0.6); box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.12); }
.contact-form-btns { display: flex; justify-content: flex-end; gap: 8px; }
.contacts-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 42vh; overflow-y: auto; }
.contact-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--glass-mid);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 10px 12px;
}
.contact-main { flex: 1; min-width: 0; }
.contact-name { font-weight: 650; font-size: 13.5px; }
.contact-persona {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.contact-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
  background: var(--glass-mid);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  padding: 2px 8px;
  cursor: pointer;
  transition: color 0.15s;
}
.contact-key:hover { color: var(--text); }
.contact-key code { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 11px; }
.contact-ops { display: flex; gap: 2px; }

/* ---------- 信箱抽屉 ---------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 26, 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  backdrop-filter: blur(32px) saturate(180%);
  border-left: 1px solid var(--glass-border);
  box-shadow: var(--shadow-float);
  z-index: 41;
  display: flex;
  flex-direction: column;
  padding: 18px;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0.4; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.drawer-head b { font-size: 14px; }
.drawer-tip { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 14px; }
.mailbox-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.mail-item {
  background: var(--glass-mid);
  border: 1px solid var(--hairline);
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.65;
}
.mail-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.mail-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mailbox-empty { text-align: center; color: var(--muted); padding: 36px 0; font-size: 12.5px; }
.mailbox-composer { padding-top: 14px; }
#mailboxInput {
  width: 100%;
  border: 1px solid var(--glass-border);
  background: var(--glass-mid);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  margin-bottom: 8px;
}
#mailboxInput:focus { border-color: rgba(74, 144, 226, 0.6); }

/* ---------- 图片预览 / Toast ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 24, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 24px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 14px; box-shadow: var(--shadow-float); }
.toast-wrap {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--glass-hi);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
  animation: toastIn 0.18s ease;
  max-width: 86vw;
}
@keyframes toastIn {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .app { padding: 0; gap: 0; }
  #sidePanel { width: 100%; border-radius: 0; border: none; }
  #roomPanel { display: none; }
  .app.show-room #sidePanel { display: none; }
  .app.show-room #roomPanel { display: flex; }
  .room-view { border-radius: 0; border: none; }
  .back-btn { display: inline-flex; }
  .msg-row { max-width: 88%; }
  .messages { padding: 18px 16px; }
  .prompt-box, .waiting-bar { margin-left: 16px; margin-right: 16px; }
  .composer { padding-left: 16px; padding-right: 16px; }
  .quick-row { padding-left: 16px; padding-right: 16px; }
}
