/*
 * mobile.css —— 白板喊话 · 教师端 v2（聊天式 + 微信式语音输入）
 *
 * 布局：顶部身份栏 / 中间聊天滚动区 / 底部输入区（键盘或按住说话）。
 * 移动端优先：safe-area、100dvh、大触控区、无外部依赖。
 */

:root {
  --brand-1: #2f6bff;
  --brand-2: #7c5cff;
  --brand-soft: #eef2ff;

  --bg: #eef1f7;
  --chat-bg: #eef1f7;
  --card: #ffffff;
  --ink: #17203a;
  --ink-2: #3d4a66;
  --muted: #8a94a8;
  --line: #e3e8f2;
  --input-bg: #f3f5fa;

  --ok: #12a36b;
  --warn: #c07a00;
  --err: #d64545;

  --radius-lg: 18px;
  --radius-md: 14px;
  --shadow-card: 0 6px 18px rgba(23, 43, 77, 0.08);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--chat-bg);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button, input, textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.hidden { display: none !important; }

/* ============================================================
   整体布局
   ============================================================ */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  background: var(--chat-bg);
}

/* ============================================================
   顶部栏：身份 + 连接状态 + 更多
   ============================================================ */
.app-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) calc(14px + var(--safe-right)) 10px calc(14px + var(--safe-left));
  background: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 88%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(47, 107, 255, 0.18);
  z-index: 20;
}

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  padding: 4px 6px 4px 2px;
  border-radius: 12px;
  outline: none;
}

.identity:active { background: rgba(255, 255, 255, 0.12); }
.identity:focus-visible { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }

.avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.avatar-small {
  width: 34px;
  height: 34px;
  font-size: 15px;
  background: linear-gradient(135deg, #eef2ff, #e4e9ff);
  border: 0;
  color: var(--brand-1);
}

.identity-text { min-width: 0; }

.identity-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.identity-sub {
  margin-top: 1px;
  font-size: 11px;
  opacity: 0.82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  flex: 0 0 auto;
}

.dot.ok { background: #4ade80; box-shadow: 0 0 0 2.5px rgba(74, 222, 128, 0.25); }
.dot.wait { background: #fbbf24; animation: dotPulse 1.2s ease-in-out infinite; }
.dot.err { background: #f87171; }

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.28); }

/* ============================================================
   安全上下文横幅
   ============================================================ */
.secure-banner {
  flex: 0 0 auto;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 10px calc(12px + var(--safe-right)) 0 calc(12px + var(--safe-left));
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #fff6e5;
  border: 1px solid #ffdca8;
  color: #7a4a00;
  font-size: 12px;
  line-height: 1.55;
}

.secure-icon { font-size: 15px; line-height: 1.4; }
.secure-banner strong { display: block; margin-bottom: 2px; }

/* ============================================================
   聊天滚动区
   ============================================================ */
.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px calc(14px + var(--safe-right)) 12px calc(14px + var(--safe-left));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 未连接欢迎面板 */
.welcome {
  margin: 18px auto 24px;
  max-width: 340px;
  text-align: center;
  background: #ffffff;
  border-radius: 22px;
  padding: 26px 22px 22px;
  box-shadow: var(--shadow-card);
}

.welcome-logo {
  width: 70px;
  height: 70px;
  margin: 0 auto 10px;
  border-radius: 22px;
  background: linear-gradient(135deg, #eef2ff, #e8e2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.welcome-logo img { width: 72%; height: 72%; object-fit: contain; }

.welcome-logo-fallback {
  font-size: 30px;
  font-weight: 900;
  color: var(--brand-1);
}

.welcome h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.welcome-desc {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.welcome-desc b { color: var(--ink-2); }

.welcome-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 8px 20px rgba(47, 107, 255, 0.28);
}

.welcome-hint {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.chat-empty {
  padding: 36px 20px;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 系统消息 ---------- */
.sys-row {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}

.sys-text {
  max-width: 86%;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(23, 32, 58, 0.06);
  color: #7d879b;
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
  word-break: break-word;
}

/* ---------- 自己发出的消息（右对齐气泡） ---------- */
.msg-row {
  display: flex;
  justify-content: flex-end;
}

.bubble-wrap {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
}

.bubble {
  position: relative;
  padding: 10px 13px;
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(135deg, #f6f5ff 0%, #ece8ff 100%);
  border: 1px solid rgba(23, 43, 77, 0.055);
  box-shadow: 0 2px 8px rgba(23, 43, 77, 0.05);
  min-width: 0;
}

.bubble-text {
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
  white-space: pre-wrap;
}

/* 紧急消息：红色渐变气泡 + 小标签 */
.bubble.urgent {
  background: linear-gradient(135deg, #ff6b5e 0%, #e8462f 100%);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(232, 70, 47, 0.28);
}

.bubble.urgent .bubble-text { color: #ffffff; }

.urgent-tag {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* 气泡下方元信息：时间 + 状态 */
.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 5px;
  padding: 0 3px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.meta-status.ok { color: var(--ok); font-weight: 600; }
.meta-status.err { color: var(--err); font-weight: 600; }
.meta-status.pending { color: var(--warn); }

.retry-btn {
  border: 1px solid #f0caca;
  background: #fff4f4;
  color: var(--err);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 700;
}

.retry-btn:active { background: #ffe9e9; }

/* 语音消息气泡（发送中的语音用系统提示表达，这里保留样式备用） */
.bubble.voice .bubble-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
   底部输入区
   ============================================================ */
.composer {
  flex: 0 0 auto;
  background: #ffffff;
  border-top: 1px solid var(--line);
  padding: 8px calc(12px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(12px + var(--safe-left));
  box-shadow: 0 -4px 16px rgba(23, 43, 77, 0.05);
  z-index: 25;
}

/* 紧急开关行 */
.urgent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 1px 2px 7px;
  min-height: 18px;
}

.urgent-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #e6d3d3;
  background: #faf6f6;
  color: #9a6b6b;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.15s;
}

.urgent-chip .chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d9b9b9;
}

.urgent-chip.active {
  background: linear-gradient(135deg, #ff6b5e, #e8462f);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(232, 70, 47, 0.24);
}

.urgent-chip.active .chip-dot { background: #ffffff; }

.urgent-tip {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 输入行 */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.mode-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #f5f7fc;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.mode-btn:active { background: #e9edf7; }
.mode-btn.active { background: linear-gradient(135deg, #eef2ff, #e6e1ff); border-color: #d8d0ff; }

.keyboard-mode {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.msg-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--input-bg);
  border-radius: 20px;
  padding: 9px 13px;
  font-size: 16px; /* 16px 防止 iOS 聚焦自动放大 */
  line-height: 1.4;
  color: var(--ink);
  resize: none;
  outline: none;
  max-height: 110px;
  min-height: 40px;
  transition: border-color 0.15s, background 0.15s;
}

.msg-input:focus {
  border-color: #9db4ff;
  background: #ffffff;
}

.msg-input::placeholder { color: #a6b1c6; }

.send-btn {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 6px 14px rgba(47, 107, 255, 0.24);
  transition: opacity 0.15s, transform 0.08s;
}

.send-btn:active { transform: translateY(1px); }

.send-btn[disabled] {
  background: #dfe4ef;
  box-shadow: none;
  color: #ffffff;
  opacity: 0.85;
}

/* 语音模式 */
.voice-mode {
  flex: 1 1 auto;
  min-width: 0;
}

.hold-btn {
  width: 100%;
  height: 44px;
  border: 1.5px solid #cfd9ff;
  border-radius: 22px;
  background: linear-gradient(180deg, #f8faff, #eef2ff);
  color: var(--brand-1);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: background 0.12s, transform 0.08s;
}

.hold-btn:active,
.hold-btn.recording {
  background: linear-gradient(180deg, #e9eeff, #dde5ff);
  transform: scale(0.995);
}

.hold-btn.sending {
  border-color: #ffd0a8;
  background: linear-gradient(180deg, #fff8f0, #ffeede);
  color: #b06a00;
}

.hold-btn[disabled] {
  border-color: var(--line);
  background: #f2f4f9;
  color: #9aa4b5;
  cursor: not-allowed;
}

.hold-icon { font-size: 16px; }

.voice-hint {
  min-height: 14px;
  margin-top: 5px;
  font-size: 10.5px;
  line-height: 1.4;
  text-align: center;
  color: var(--muted);
}

.voice-hint.warn { color: #9c2020; }

/* ============================================================
   录音浮层
   ============================================================ */
.record-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(11, 18, 32, 0.42);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.record-card {
  width: 100%;
  max-width: 320px;
  padding: 26px 22px 22px;
  border-radius: 24px;
  background: rgba(20, 26, 44, 0.94);
  color: #ffffff;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transition: background 0.15s;
}

.record-card.cancel {
  background: rgba(150, 32, 32, 0.95);
}

.record-mic {
  font-size: 30px;
  line-height: 1;
}

.record-timer {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.record-bars {
  height: 40px;
  margin: 10px 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.record-bars .bar {
  width: 5px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.85);
  transition: height 0.08s linear;
}

.record-hint {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}

.record-card.cancel .record-hint {
  color: #ffdddd;
  font-weight: 700;
}

/* ============================================================
   配对中遮罩
   ============================================================ */
.pair-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(11, 18, 32, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.pair-card {
  width: 100%;
  max-width: 300px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(11, 18, 32, 0.3);
}

.spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid #dbe4ff;
  border-top-color: var(--brand-1);
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.pair-title {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 800;
}

.pair-text {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* ============================================================
   弹窗通用（身份设置）
   ============================================================ */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(11, 18, 32, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: #ffffff;
  border-radius: 22px;
  padding: 24px 22px 20px;
  box-shadow: 0 24px 60px rgba(11, 18, 32, 0.32);
  animation: popIn 0.18s ease-out;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-emoji { font-size: 30px; line-height: 1; }

.identity-modal h3 {
  margin: 8px 0 6px;
  font-size: 19px;
}

.modal-desc {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.modal-input {
  width: 100%;
  border: 1.5px solid #dbe1ee;
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 17px;
  color: var(--ink);
  outline: none;
  background: #fbfcff;
}

.modal-input:focus {
  border-color: var(--brand-1);
  background: #ffffff;
}

.identity-counter {
  margin-top: 6px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
}

.identity-counter.invalid { color: var(--err); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.modal-btn {
  flex: 1;
  border: 0;
  border-radius: 13px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
}

.modal-btn.ghost {
  background: #f2f4f9;
  color: var(--ink-2);
}

.modal-btn.primary {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 107, 255, 0.28);
}

/* ============================================================
   设置弹层（底部 sheet）
   ============================================================ */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(11, 18, 32, 0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.sheet {
  width: 100%;
  max-width: 620px;
  max-height: 88dvh;
  background: #ffffff;
  border-radius: 22px 22px 0 0;
  padding: 8px 0 calc(10px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.22s ease-out;
  box-shadow: 0 -12px 40px rgba(11, 18, 32, 0.2);
}

@keyframes sheetUp {
  from { transform: translateY(16%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #dbe1ee;
  margin: 4px auto 0;
  flex: 0 0 auto;
}

.sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 8px;
}

.sheet-title {
  font-size: 17px;
  font-weight: 800;
}

.sheet-close {
  width: 30px;
  height: 30px;
  border: 0;
  background: #f2f4f9;
  color: #6b7689;
  font-size: 14px;
}

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 18px 14px;
}

.sheet-section {
  padding: 12px 0 14px;
  border-bottom: 1px solid #f0f3f9;
}

.sheet-section-title {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.sheet-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sheet-identity-text {
  flex: 1;
  min-width: 0;
}

.sheet-identity-name {
  font-size: 15px;
  font-weight: 800;
}

.sheet-identity-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
}

.kv span { color: var(--muted); flex: 0 0 auto; }
.kv b {
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sheet-tip {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.scan-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.scan-emoji {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

/* 通用按钮 */
.btn {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 11px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.12s, transform 0.08s;
}

.btn:active { transform: translateY(1px); }
.btn.small { padding: 8px 12px; font-size: 12.5px; }
.btn.primary {
  border: 0;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 6px 14px rgba(47, 107, 255, 0.24);
}
.btn.ghost { background: #f4f6fb; }
.btn.danger { color: var(--err); border-color: #f3caca; background: #fff7f7; }

/* 手动配置 */
details.manual {
  padding: 12px 0 4px;
  border-bottom: 1px solid #f0f3f9;
}

details.manual > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

details.manual > summary::-webkit-details-marker { display: none; }

details.manual > summary .chevron {
  font-size: 12px;
  transition: transform 0.15s;
}

details.manual[open] > summary .chevron { transform: rotate(180deg); }

.field { margin-top: 10px; }

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8faff;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
}

.field input:focus { border-color: #9db4ff; background: #ffffff; }

.sheet-footer {
  padding: 14px 0 4px;
  text-align: center;
  font-size: 11px;
  color: #a6b0c2;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(112px + var(--safe-bottom));
  transform: translateX(-50%) translateY(8px);
  max-width: calc(100vw - 44px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(23, 32, 58, 0.94);
  color: #ffffff;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   小屏 / 桌面
   ============================================================ */
@media (max-width: 360px) {
  .identity-name { font-size: 15px; }
  .avatar { width: 36px; height: 36px; font-size: 15px; }
  .bubble-wrap { max-width: 86%; }
  .conn-pill { padding: 4px 8px; font-size: 10.5px; }
}

@media (min-width: 640px) {
  .app {
    box-shadow: 0 0 44px rgba(23, 43, 77, 0.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
