/* ============================================================
   QQ 风格聊天界面 — 浅色主题
   ============================================================ */

:root {
  --primary:    #12B7F5;
  --primary-dark: #0e9fd8;
  --primary-light: #e8f7fe;
  --bubble-me:  #95EC69;
  --bubble-them:#fff;
  --bg:         #F5F5F5;
  --bg-white:   #FFFFFF;
  --bg-sidebar: #E8E8E8;
  --bg-header:  #F5F5F5;
  --border:     #E0E0E0;
  --text:       #333333;
  --text-dim:   #999999;
  --text-light: #bbb;
  --text-white: #fff;
  --online:     #4CAF50;
  --danger:     #FA5151;
  --shadow:     rgba(0,0,0,.08);
  --radius:     8px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC",
          "Noto Sans CJK SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.hidden { display: none !important; }

/* ===================== 模式选择 ===================== */
.mode-selector {
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #12B7F5 0%, #0e9fd8 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.mode-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 420px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.mode-logo { font-size: 56px; margin-bottom: 16px; }
.mode-card h1 { color: var(--text); font-size: 26px; margin-bottom: 6px; font-weight: 700; }
.mode-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 32px; }
.mode-options { display: flex; flex-direction: column; gap: 12px; }
.mode-btn {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
  text-align: left;
  width: 100%;
}
.mode-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}
.mode-btn:active { transform: translateY(0); }
.mode-icon { font-size: 32px; flex-shrink: 0; }
.mode-title { color: var(--text); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.mode-desc { color: var(--text-dim); font-size: 13px; }
.mode-lan { border-color: rgba(76,175,80,.3); }
.mode-lan:hover { border-color: var(--online); background: #e8f5e9; }
.mode-cloud { border-color: rgba(18,183,245,.3); }
.mode-cloud:hover { border-color: var(--primary); }

/* ===================== 登录模态框 ===================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-logo { font-size: 48px; margin-bottom: 12px; }
.modal h2 { color: var(--text); font-size: 24px; margin-bottom: 6px; font-weight: 700; }
.modal-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }
.modal input {
  width: 100%; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 15px; margin-bottom: 20px; outline: none;
  transition: border .2s;
}
.modal input:focus { border-color: var(--primary); }
.color-picker { margin-bottom: 24px; text-align: left; }
.cp-label { display:block; font-size:12px; color:var(--text-dim); margin-bottom:8px; }
.cp-swatches { display:flex; flex-wrap:wrap; gap:8px; }
.cp-swatch {
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform .15s, border .15s;
}
.cp-swatch:hover { transform: scale(1.15); }
.cp-swatch.selected { border-color: var(--text); transform: scale(1.1); }
.btn-primary {
  width: 100%; padding: 12px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { background: #0b8cc0; }
.modal-hint { margin-top:16px; font-size:12px; color:var(--text-dim); line-height:1.5; }

/* ===================== 密码房模态框 ===================== */
.private-modal { width: 420px; text-align: left; padding: 32px 28px; }
.private-modal .modal-logo { font-size: 40px; margin-bottom: 12px; }
.private-modal h2 { text-align: center; }
.private-modal .modal-sub { text-align: center; margin-bottom: 20px; }
.private-tabs {
  display: flex; gap: 0; margin-bottom: 20px;
  background: var(--bg); border-radius: var(--radius); overflow: hidden;
}
.private-tab {
  flex: 1; padding: 10px;
  background: transparent; border: none;
  color: var(--text-dim); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.private-tab.active {
  background: var(--primary); color: #fff;
}
.private-tab:hover:not(.active) { background: rgba(0,0,0,.04); }
.private-panel { animation: fadeInUp .2s ease; }
.private-panel.hidden { display: none !important; }
.private-modal .form-label { margin-top: 12px; }
.private-modal .form-input { margin-bottom: 4px; }
.form-hint {
  font-size: 12px; color: var(--text-dim); margin-bottom: 16px;
}
.private-back {
  width: 100%; margin-top: 16px;
}
.mode-private { border-color: rgba(250,81,81,.3); }
.mode-private:hover { border-color: var(--danger); background: #ffebee; }

/* 频道列表中的密码房标识 */
.channel-item .ch-lock {
  font-size: 12px; margin-left: auto; opacity: .6;
}

/* ===================== 个人资料编辑模态框 ===================== */
.profile-modal { width: 400px; text-align: left; padding: 32px 28px; }
.profile-modal .modal-logo {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
  margin: 0 auto 16px;
}
.profile-modal h2 { text-align: center; }
.profile-modal .modal-sub { text-align: center; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-dim); margin-bottom: 8px; margin-top: 16px;
}
.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 15px; outline: none; transition: border .2s;
  font-family: var(--font);
}
.form-input:focus { border-color: var(--primary); }
.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.color-swatch {
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform .15s, border .15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); transform: scale(1.1); }
.modal-actions { display: flex; gap: 10px; margin-top: 24px; }
.btn-secondary {
  flex: 1; padding: 10px;
  background: #fff; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-secondary:hover { background: var(--bg); color: var(--text); }
.modal-actions .btn-primary { flex: 1; width: auto; }

/* ===================== 主布局 (QQ风格) ===================== */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}

/* ---- 侧边栏 (QQ联系人列表风格) ---- */
.sidebar {
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.sidebar-header {
  padding: 16px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
}
.ws-title { display:block; font-weight:700; color:var(--text); font-size:16px; }
.online-count { font-size:12px; color:var(--primary); }

.sidebar-section { padding: 8px 0; overflow-y:auto; flex:1; }
.sidebar-section:first-of-type { flex: 0 0 auto; max-height: 50%; }
.section-label {
  padding: 8px 16px 4px;
  font-size: 12px; font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .5px;
}

.channel-list, .member-list { list-style: none; }
.channel-item {
  padding: 10px 16px; cursor: pointer;
  color: var(--text); font-size: 14px;
  display: flex; align-items: center; gap: 10px;
  border-radius: 0;
  transition: background .15s;
}
.channel-item:hover { background: rgba(0,0,0,.05); }
.channel-item.active {
  background: var(--primary);
  color: #fff;
}
.channel-item.active .ch-icon { opacity: 1; }
.channel-item .ch-icon { opacity:.6; font-size: 16px; }
.channel-item.treehole .ch-icon { color: #FF9800; }
.channel-item.active.treehole .ch-icon { color: #fff; }

.member-item {
  padding: 6px 16px; display:flex; align-items:center; gap:8px;
  font-size: 13px; color: var(--text-dim);
}
.member-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--online); flex-shrink:0;
}
.member-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  font-size: 12px; font-weight:700; color:#fff; flex-shrink:0;
}
.member-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-white);
}
.me { display:flex; align-items:center; gap:10px; position: relative; }
.me-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; color:#fff; flex-shrink:0; font-size:16px;
}
.me-info { line-height:1.3; flex: 1; min-width: 0; }
.me-name { font-size:14px; font-weight:600; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.me-status { font-size:12px; color:var(--online); }
.me-edit-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); padding: 6px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.6; transition: opacity .15s, background .15s;
  flex-shrink: 0;
}
.me-edit-btn:hover { opacity: 1; background: rgba(0,0,0,.06); color: var(--text); }

/* ===================== 聊天主区 (QQ风格) ===================== */
.chat-main {
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-white);
  flex-shrink: 0;
}
.ch-left { display:flex; align-items:center; gap:8px; }
.ch-hash { color: var(--text-dim); font-size: 18px; font-weight: 300; }
.ch-name { color: var(--text); font-weight: 700; font-size: 16px; }
.ch-desc { color: var(--text-dim); font-size: 13px; margin-left: 12px;
           border-left: 1px solid var(--border); padding-left: 12px; }
.ch-right { display:flex; align-items:center; gap:16px; }
.ch-members { font-size:13px; color:var(--text-dim); }

/* ---- 消息列表 (QQ气泡风格) ---- */
.messages {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  scroll-behavior: smooth;
  background: var(--bg);
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: #ccc; border-radius:3px; }
.messages::-webkit-scrollbar-track { background: transparent; }

.msg-group {
  display: flex; gap: 10px;
  margin-bottom: 16px;
  transition: background .12s;
  position: relative;
}
.msg-group:hover { background: rgba(0,0,0,.02); border-radius: 8px; }
.msg-group.me { flex-direction: row-reverse; }
.msg-group.same-author { margin-bottom: 4px; }

.msg-avatar {
  width: 40px; height: 40px; border-radius: 6px;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; color:#fff; flex-shrink:0; font-size:16px;
  border-radius: 6px;
}
.msg-group.same-author .msg-avatar { visibility: hidden; }

.msg-body { flex:1; min-width:0; max-width: 70%; }
.msg-group.me .msg-body { display: flex; flex-direction: column; align-items: flex-end; }

.msg-meta { display:flex; align-items:baseline; gap:8px; margin-bottom:4px; }
.msg-group.me .msg-meta { flex-direction: row-reverse; }
.msg-author { font-weight:600; color:var(--text); font-size:13px; }
.msg-author.anon { color: #FF9800; font-style: italic; }
.msg-time { font-size:11px; color:var(--text-light); }

/* QQ风格消息气泡 */
.msg-content {
  color: var(--text); font-size: 15px; line-height: 1.5;
  word-wrap: break-word; white-space: pre-wrap;
  padding: 10px 14px;
  border-radius: 6px;
  position: relative;
  display: inline-block;
  background: var(--bubble-them);
  box-shadow: 0 1px 2px var(--shadow);
}
/* 气泡三角箭头 */
.msg-content::before {
  content: '';
  position: absolute;
  top: 12px;
  left: -6px;
  width: 0; height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--bubble-them);
}
.msg-group.me .msg-content {
  background: var(--bubble-me);
  color: #000;
}
.msg-group.me .msg-content::before {
  left: auto;
  right: -6px;
  border-right: none;
  border-left: 6px solid var(--bubble-me);
}

.msg-content .mention { color: var(--primary); background: var(--primary-light); padding:0 2px; border-radius:2px; }

.msg-reactions { margin-top:6px; display:flex; flex-wrap:wrap; gap:4px; }
.msg-group.me .msg-reactions { justify-content: flex-end; }
.reaction-chip {
  display:inline-flex; align-items:center; gap:4px;
  padding: 2px 8px; border-radius: 12px;
  background: #fff; border: 1px solid var(--border);
  font-size: 12px; cursor:pointer;
  transition: background .15s, border .15s;
  box-shadow: 0 1px 2px var(--shadow);
}
.reaction-chip:hover { background: var(--primary-light); }
.reaction-chip.mine { background: var(--primary-light); border-color: var(--primary); }
.reaction-chip .rc-emoji { font-size:14px; }
.reaction-chip .rc-count { color:var(--text-dim); font-weight:600; }
.reaction-chip.mine .rc-count { color: var(--primary); }

.msg-actions {
  position: absolute; right: -40px; top: 0;
  display:none; gap:2px;
  background: #fff; border:1px solid var(--border);
  border-radius: var(--radius); padding: 2px;
  box-shadow: 0 2px 8px var(--shadow);
  z-index: 5;
}
.msg-group.me .msg-actions { right: auto; left: -40px; }
.msg-group:hover .msg-actions { display:flex; }
.msg-action-btn {
  background:none; border:none; cursor:pointer;
  padding:4px 6px; border-radius:4px; font-size:16px;
  color: var(--text-dim);
}
.msg-action-btn:hover { background: rgba(0,0,0,.06); color:var(--text); }

/* 系统消息 */
.msg-system {
  text-align:center; padding: 8px 20px;
  color: var(--text-dim); font-size: 13px;
}
.msg-system span {
  background: rgba(0,0,0,.04);
  padding: 4px 12px; border-radius: 12px;
}

/* ---- 打字指示器 ---- */
.typing-indicator {
  min-height: 24px; padding: 0 20px;
  font-size: 13px; color: var(--text-dim);
  flex-shrink: 0;
}

/* ---- 输入框 (QQ风格) ---- */
.composer {
  padding: 0 20px 16px;
  flex-shrink: 0;
  background: var(--bg);
}
.composer-inner {
  display: flex; align-items: flex-end; gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 1px 3px var(--shadow);
}
.composer-inner:focus-within { border-color: var(--primary); }
.emoji-btn {
  background:none; border:none; cursor:pointer;
  font-size: 22px; padding: 4px; opacity:.7;
  transition: opacity .15s;
}
.emoji-btn:hover { opacity:1; }
.message-input {
  flex:1; background:none; border:none; color:var(--text);
  font-size:15px; font-family:var(--font);
  resize:none; outline:none; max-height:120px;
  line-height:1.4;
}
.message-input::placeholder { color: var(--text-light); }
.send-btn {
  background: var(--primary); border:none; border-radius:6px;
  width: 36px; height: 36px; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  color:#fff; transition: background .2s;
}
.send-btn:hover { background: var(--primary-dark); }
.send-btn:disabled { opacity:.4; cursor:not-allowed; }
.composer-hint { font-size:12px; color:var(--text-dim); margin-top:6px; padding-left:4px; }

/* ===================== 表情面板 ===================== */
.emoji-panel {
  position: fixed; bottom: 70px; left: 60px;
  background: #fff; border:1px solid var(--border);
  border-radius: 8px; padding: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 100;
  width: 320px;
}
.ep-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  max-height: 200px; overflow-y:auto;
}
.ep-grid::-webkit-scrollbar { width:6px; }
.ep-grid::-webkit-scrollbar-thumb { background:#ddd; border-radius:3px; }
.ep-item {
  font-size: 22px; cursor:pointer; padding:4px;
  border-radius:4px; text-align:center;
  transition: background .12s;
}
.ep-item:hover { background: rgba(0,0,0,.06); }

/* ===================== 反应选择器 ===================== */
.reaction-picker {
  position: fixed; z-index: 100;
  background: #fff; border:1px solid var(--border);
  border-radius:8px; padding:8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.rp-grid { display:flex; gap:4px; }
.rp-item {
  font-size: 22px; cursor:pointer; padding:4px 6px;
  border-radius:4px; transition: background .12s;
}
.rp-item:hover { background: rgba(0,0,0,.06); }

/* ===================== 移动端 ===================== */
.mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 22px; padding: 4px 8px;
  align-items: center; justify-content: center;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
}
.sidebar-overlay.show { display: block; }

/* ===================== 响应式 ===================== */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  /* 侧边栏改为抽屉式 */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }

  .chat-main { width: 100%; }

  .chat-header { padding: 10px 12px; }
  .mobile-menu-btn { display: flex; }
  .ch-left { gap: 4px; }
  .ch-desc { display: none; }
  .ch-name { font-size: 15px; }

  .msg-group { padding: 4px 12px; margin-bottom: 12px; }
  .msg-system { padding: 8px 12px; }
  .msg-body { max-width: 80%; }

  .composer { padding: 0 10px 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .composer-inner { padding: 6px 8px; }
  .message-input { font-size: 16px; }
  .send-btn { width: 38px; height: 38px; flex-shrink: 0; }
  .emoji-btn { font-size: 20px; padding: 6px; }

  .emoji-panel {
    bottom: 60px; left: 10px; right: 10px;
    width: auto;
  }
  .ep-grid { grid-template-columns: repeat(6, 1fr); }

  .msg-actions { display: flex; position: static; box-shadow: none; background: none; border: none; padding: 0; margin-top: 4px; }
  .msg-group.me .msg-actions { left: auto; }
  .msg-action-btn { padding: 6px 8px; font-size: 18px; }

  .channel-item { padding: 10px 16px; min-height: 44px; }
  .member-item { padding: 6px 16px; min-height: 36px; }

  .typing-indicator { padding: 0 12px; min-height: 20px; font-size: 12px; }

  .modal { width: 92%; padding: 28px 20px; }
  .modal-logo { font-size: 40px; }
  .modal h2 { font-size: 20px; }
}

@media (max-width: 380px) {
  .ch-members { display: none; }
  .msg-avatar { width: 32px; height: 32px; font-size: 13px; }
  .msg-content { font-size: 14px; }
}

@media (max-width: 768px) and (orientation: landscape) {
  .sidebar { width: 220px; }
  .composer { padding-bottom: 4px; }
}

/* ===================== 局域网聊天 (QQ风格) ===================== */
.lan-container {
  position: fixed; inset: 0;
  z-index: 100;
  background: var(--bg);
}
.lan-chat {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
}
.lan-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lan-title { display: flex; align-items: center; gap: 12px; }
.lan-icon-wrap {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); flex-shrink: 0;
}
.lan-name { font-size: 16px; font-weight: 700; color: var(--text); }
.lan-status { font-size: 12px; color: var(--online); margin-top: 2px; }
.lan-exit-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 20px; padding: 6px 10px;
  border-radius: 50%; transition: background .15s, color .15s;
}
.lan-exit-btn:hover { background: rgba(0,0,0,.06); color: var(--text); }

.lan-messages {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column;
}
.lan-messages::-webkit-scrollbar { width: 6px; }
.lan-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.lan-msg {
  display: flex; gap: 10px;
  margin-bottom: 16px;
  animation: fadeInUp .25s ease;
}
.lan-msg.me { flex-direction: row-reverse; }
.lan-msg-avatar {
  width: 40px; height: 40px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px;
  flex-shrink: 0;
}
.lan-msg-body { max-width: 70%; }
.lan-msg.me .lan-msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.lan-msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.lan-msg.me .lan-msg-meta { flex-direction: row-reverse; }
.lan-msg-name { font-weight: 600; color: var(--text); font-size: 13px; }
.lan-msg-time { font-size: 11px; color: var(--text-light); }
.lan-msg-content {
  padding: 10px 14px;
  border-radius: 6px;
  color: var(--text); font-size: 15px; line-height: 1.5;
  word-wrap: break-word; white-space: pre-wrap;
  display: inline-block;
  background: var(--bubble-them);
  box-shadow: 0 1px 2px var(--shadow);
  position: relative;
}
.lan-msg-content::before {
  content: '';
  position: absolute;
  top: 12px; left: -6px;
  width: 0; height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--bubble-them);
}
.lan-msg.me .lan-msg-content {
  background: var(--bubble-me);
  color: #000;
}
.lan-msg.me .lan-msg-content::before {
  left: auto; right: -6px;
  border-right: none;
  border-left: 6px solid var(--bubble-me);
}

.lan-typing {
  min-height: 20px; padding: 0 20px;
  font-size: 12px; color: var(--text-dim);
  flex-shrink: 0;
}

.lan-composer {
  padding: 0 16px 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.lan-composer-inner {
  display: flex; align-items: flex-end; gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 1px 3px var(--shadow);
}
.lan-composer-inner:focus-within { border-color: var(--primary); }
.lan-emoji-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; padding: 4px; opacity: .7;
  transition: opacity .15s; flex-shrink: 0;
}
.lan-emoji-btn:hover { opacity: 1; }
.lan-input {
  flex: 1; background: none; border: none;
  color: var(--text); font-size: 15px;
  font-family: var(--font); resize: none;
  outline: none; max-height: 100px; line-height: 1.4;
}
.lan-input::placeholder { color: var(--text-light); }
.lan-send-btn {
  background: var(--primary); border: none; border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; transition: background .2s; flex-shrink: 0;
}
.lan-send-btn:hover { background: var(--primary-dark); }

/* 移动端局域网适配 */
@media (max-width: 768px) {
  .mode-card { width: 92%; padding: 32px 20px; }
  .mode-logo { font-size: 44px; }
  .mode-card h1 { font-size: 22px; }
  .mode-btn { padding: 14px 16px; }
  .mode-icon { font-size: 28px; }
  .lan-header { padding: 10px 14px; }
  .lan-messages { padding: 12px 14px; }
  .lan-msg-body { max-width: 80%; }
  .lan-composer { padding: 0 10px 8px; }
  .lan-input { font-size: 16px; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
