:root {
  --bg: #060a12;
  --panel: #101826;
  --panel-2: #162033;
  --panel-3: #1e2a41;
  --border: #23334d;
  --line: rgba(88, 166, 255, 0.18);
  --text: #e8f0fb;
  --muted: #91a2bd;
  --accent: #4aa8ff;
  --accent-2: #3ddc97;
  --accent-soft: rgba(74, 168, 255, 0.14);
  --danger: #ff7285;
  --warn: #ffbb63;
  --radius: 14px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  /* 消息区左右内边距：PC 与手机统一，保证左右气泡到边框距离一致 */
  --msg-pad-x: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 720px at 12% -12%, rgba(74, 168, 255, 0.13), transparent 62%),
    radial-gradient(880px 620px at 105% 115%, rgba(61, 220, 151, 0.09), transparent 60%),
    linear-gradient(rgba(88, 166, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, 0.035) 1px, transparent 1px);
  background-size: auto, auto, 46px 46px, 46px 46px;
  background-attachment: fixed;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: rgba(74, 168, 255, 0.35); }

/* ---------------- 登录页 ---------------- */
.auth-shell {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 18px;
}
.auth-card {
  position: relative;
  width: 100%; max-width: 430px;
  padding: 36px 34px 30px;
  background: linear-gradient(165deg, rgba(22, 33, 52, 0.95), rgba(10, 16, 26, 0.97));
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(74, 168, 255, 0.05), 0 0 60px rgba(74, 168, 255, 0.08);
}
.auth-card::before {
  content: ""; position: absolute; left: 34px; right: 34px; top: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  border-radius: 2px;
}
.brand { display: flex; align-items: center; gap: 13px; margin-bottom: 8px; }
.brand-mark {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #4aa8ff, #3ddc97);
  color: #06101c; font-size: 21px; font-weight: 800;
  box-shadow: 0 0 24px rgba(74, 168, 255, 0.35);
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 0.6px; }
.brand p { margin: 0; color: var(--muted); font-size: 12.5px; letter-spacing: 0.5px; }

.auth-tip {
  margin: 22px 0 24px; padding: 12px 14px;
  border: 1px solid rgba(74, 168, 255, 0.28);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  color: #c4d9f5; font-size: 12.5px; line-height: 1.7;
}
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; color: #c3d0e4; }
.field input {
  width: 100%; height: 46px; padding: 0 14px;
  background: #0b1220; border: 1px solid var(--border); border-radius: 10px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 168, 255, 0.16); }
.field input::placeholder { color: #5f6f88; }
.btn-primary {
  width: 100%; height: 46px; border: 0; border-radius: 10px;
  background: linear-gradient(120deg, #4aa8ff, #3d8bff);
  color: #fff; font-weight: 600; letter-spacing: 1.5px;
  box-shadow: 0 8px 24px rgba(74, 168, 255, 0.25);
  transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.form-error { min-height: 22px; margin: 12px 0 0; color: var(--danger); font-size: 13px; }
.auth-foot {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12px; line-height: 1.8;
}
.auth-foot b { color: #b9c9df; font-weight: 600; }
/* 登录入口右下角：普通/管理员登录模式切换 */
.auth-bottom {
  display: flex; justify-content: flex-end;
  margin-top: 14px;
}
.mode-toggle {
  border: 1px solid transparent; background: transparent;
  color: var(--accent); font-size: 12.5px; letter-spacing: .3px;
  padding: 6px 4px; border-radius: 6px;
  transition: color .15s, text-shadow .15s;
}
.mode-toggle:hover { color: #8fc9ff; text-shadow: 0 0 12px rgba(74, 168, 255, 0.55); }
.mode-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- 聊天页整体布局 ---------------- */
.app {
  width: 100%; max-width: 1000px;
  height: 100vh; height: 100dvh;
  margin: 0 auto; padding: 18px 22px;
  display: grid; grid-template-columns: 274px minmax(0, 1fr); gap: 16px;
}

/* 左侧信息栏 */
.sidebar {
  min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding-right: 4px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #253752; border-radius: 6px; }

.side-brand { display: flex; align-items: center; gap: 11px; padding: 2px 2px 0; }
.sidebar .brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; font-size: 18px; }
.side-title { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.side-sub { color: #6e849f; font-size: 9.5px; letter-spacing: 1.1px; white-space: nowrap; }

.secure-status {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: 9px;
  border: 1px solid rgba(61, 220, 151, 0.26);
  background: rgba(61, 220, 151, 0.07);
  color: #9de9c8; font-size: 11.5px; letter-spacing: .2px;
}
.pulse {
  position: relative; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2);
}
.pulse::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid var(--accent-2); animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring { 0% { transform: scale(.5); opacity: .85; } 100% { transform: scale(1.5); opacity: 0; } }

.side-card {
  position: relative; overflow: hidden;
  padding: 15px 14px 14px;
  border: 1px solid var(--border); border-radius: 13px;
  background: linear-gradient(160deg, rgba(20, 30, 47, 0.94), rgba(12, 19, 31, 0.96));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.side-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 75%);
}
.side-card.policy::before { background: linear-gradient(90deg, var(--danger), transparent 75%); }
.card-kicker { color: #6f8db2; font-size: 9.5px; letter-spacing: 1.3px; font-weight: 700; }
.side-card h2 { margin: 5px 0 10px; font-size: 14.5px; letter-spacing: .3px; }
.privacy h2 { color: #cfe4ff; }
.policy h2 { color: #ffc9c9; }

.feature-list, .ban-list { list-style: none; margin: 0; padding: 0; }
.feature-list li { display: flex; gap: 9px; margin-bottom: 12px; }
.feature-list li:last-child { margin-bottom: 0; }
.feature-list b { display: block; color: #dbe8f8; font-size: 12.5px; font-weight: 600; }
.feature-list p { margin: 3px 0 0; color: #8ca0bb; font-size: 11px; line-height: 1.65; }
.feature-icon {
  position: relative; flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px;
  border: 1px solid rgba(74, 168, 255, 0.45); border-radius: 6px;
  background: rgba(74, 168, 255, 0.10);
}
.feature-icon::after {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--accent); font-size: 11px; font-weight: 700;
}
.feature-icon.shield::after { content: "✓"; color: var(--accent-2); border-color: var(--accent-2); }
.feature-icon.bolt::after { content: "!"; color: var(--warn); }
.feature-icon.sync::after { content: "⟳"; }

.policy-lead { margin: 0 0 8px; color: #9fb0c8; font-size: 11px; line-height: 1.6; }
.ban-list li {
  position: relative; padding-left: 13px; margin-bottom: 6px;
  color: #d4bfc6; font-size: 11px; line-height: 1.6;
}
.ban-list li::before {
  content: ""; position: absolute; left: 2px; top: 8px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--danger);
}
.policy-note {
  margin: 10px 0 0; padding-top: 9px; border-top: 1px dashed rgba(255, 114, 133, 0.25);
  color: #ff9fac; font-size: 10.5px; line-height: 1.6;
}
.side-footer { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 4px; }
.chip {
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 20px;
  background: rgba(74, 168, 255, 0.06); color: #8fabc9; font-size: 10px; letter-spacing: .4px;
}

/* 管理员运行状态面板（左下角红框区） */
.admin-status { border-color: rgba(61, 220, 151, 0.28); }
.admin-status h2 { margin: 8px 0 7px; font-size: 12.5px; }
.admin-status .stat-h2 { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.admin-status .stat-grid {
  display: grid; grid-template-columns: 1fr; gap: 4px;
}
.admin-status .stat-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 4px 7px; border-radius: 6px;
  background: rgba(74, 168, 255, 0.045);
}
.admin-status .stat-item span {
  color: #7f96b3; font-size: 10.5px; white-space: nowrap;
}
.admin-status .stat-item b {
  color: #cfe0f5; font-size: 10.5px; font-weight: 600; text-align: right;
  word-break: break-all; line-height: 1.35;
}
.admin-status .stat-ok { color: var(--accent-2) !important; }
.admin-status .stat-bad { color: var(--danger) !important; }
.admin-status .stat-foot { margin-top: 9px; color: #647c99; font-size: 10px; text-align: right; }

/* 右侧聊天面板 */
.chat-panel {
  min-height: 0; display: flex; flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(88, 166, 255, 0.24); border-radius: 18px;
  background: linear-gradient(180deg, rgba(15, 23, 37, 0.92), rgba(9, 14, 23, 0.96));
  box-shadow: var(--shadow), 0 0 0 1px rgba(74, 168, 255, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 11px;
  min-height: 58px; padding: 9px 15px;
  background: rgba(14, 22, 36, 0.92);
  border-bottom: 1px solid var(--line);
}
.session-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.session-name { font-size: 14.5px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.session-sub { color: #7387a3; font-size: 10.5px; white-space: nowrap; }

.tag {
  padding: 2px 9px; border-radius: 20px; font-size: 10.5px;
  border: 1px solid rgba(61, 220, 151, 0.35);
  background: rgba(61, 220, 151, 0.10); color: var(--accent-2);
  white-space: nowrap;
}
.tag.admin { border-color: rgba(255, 187, 99, 0.35); background: rgba(255, 187, 99, 0.10); color: var(--warn); }
.topbar-spacer { flex: 1; min-width: 4px; }
.online-badge { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 9px var(--accent-2); }
.dot.off { background: var(--danger); box-shadow: 0 0 9px var(--danger); }
.topbar .sub { color: var(--muted); font-size: 11px; white-space: nowrap; }

.btn-ghost {
  height: 31px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel-2); color: #c9d6e9; font-size: 11.5px; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: var(--panel-3); border-color: #3a5578; }
.btn-ghost.danger { color: #ff9fac; border-color: rgba(255, 114, 133, 0.35); }

.messages {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 20px var(--msg-pad-x) 10px; scroll-behavior: smooth;
}
/* 左右气泡到聊天区边框的距离严格一致 */
.msg.theirs { margin-left: 0; }
.msg.mine { margin-right: 0; }
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: #263954; border-radius: 8px; }

.empty {
  max-width: 420px; margin: 10vh auto 0; padding: 26px 24px;
  text-align: center; color: var(--muted);
  border: 1px dashed #2a3d5c; border-radius: 14px;
  background: rgba(16, 24, 38, 0.55);
  font-size: 12.5px; line-height: 1.9;
}
.empty strong { display: block; margin-bottom: 6px; color: #d9e8fa; font-size: 14.5px; }

.msg { display: flex; flex-direction: column; margin-bottom: 17px; max-width: 76%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg-head { display: flex; gap: 9px; align-items: baseline; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.msg-head .who { color: #bdd0e8; font-weight: 600; }
.msg-head time { color: #657895; }

.bubble {
  padding: 10px 14px; border-radius: 13px;
  background: var(--panel-2); border: 1px solid var(--border);
  word-break: break-word; white-space: pre-wrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}
.msg.mine .bubble {
  background: linear-gradient(140deg, #3a86e8, #4aa8ff);
  border-color: #4aa8ff; color: #fff;
  box-shadow: 0 6px 22px rgba(74, 168, 255, 0.22);
}
.bubble.image { padding: 8px; background: var(--panel-2); border-color: var(--border); }
.chat-image {
  display: block; max-width: min(300px, 58vw); max-height: 280px;
  border-radius: 9px; cursor: zoom-in; object-fit: contain; background: #0b111c;
}
.chat-image.failed { width: 210px; height: 105px; object-fit: contain; cursor: default; }
figure { margin: 0; }
figcaption { margin-top: 6px; color: var(--muted); font-size: 10.5px; word-break: break-all; }

/* 非图片附件下载卡片 */
.bubble.file { padding: 8px; background: var(--panel-2); border-color: var(--border); }
.file-card {
  display: flex; align-items: center; gap: 10px;
  min-width: 180px; max-width: min(320px, 62vw);
  padding: 10px 12px; border-radius: 9px;
  background: linear-gradient(135deg, rgba(74,168,255,.10), rgba(61,139,255,.05));
  border: 1px solid var(--border); color: var(--text);
  text-decoration: none; transition: border-color .15s, background .15s;
}
.file-card:hover { border-color: var(--accent); background: rgba(74,168,255,.16); }
.file-icon {
  flex: 0 0 auto; width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px; background: rgba(74,168,255,.18);
  color: #8fc4ff; font-size: 20px; line-height: 1;
}
.file-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.file-name { font-size: 12.5px; color: var(--text); word-break: break-all; }
.file-meta { font-size: 10.5px; color: var(--muted); }

.notice-bar {
  flex: 0 0 auto; margin: 0 15px 8px; padding: 8px 12px;
  border-radius: 9px; font-size: 12px; line-height: 1.6;
  border: 1px solid rgba(74, 168, 255, 0.35);
  background: rgba(74, 168, 255, 0.12); color: #cfe0fa;
}
.notice-bar.error { border-color: rgba(255, 114, 133, 0.45); background: rgba(255, 114, 133, 0.12); color: #ffc5ce; }
.notice-bar.ok { border-color: rgba(61, 220, 151, 0.4); background: rgba(61, 220, 151, 0.10); color: #b9f2d8; }

.composer {
  flex: 0 0 auto; padding: 10px 15px 14px;
  border-top: 1px solid var(--line);
  background: rgba(13, 20, 33, 0.94);
}
.composer-hint { margin-bottom: 8px; color: #7185a1; font-size: 10.5px; }
.composer-row { display: flex; align-items: flex-end; gap: 9px; }
.icon-btn {
  flex: 0 0 auto; height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel-2); color: #c8d7ec; font-size: 12.5px;
}
.icon-btn:hover { background: var(--panel-3); border-color: #3a5578; }
#textInput {
  flex: 1 1 auto; min-height: 44px; max-height: 150px;
  /* 用 CSS 自动撑高，避免 JS 写内联样式，从而不需要 CSP 的 unsafe-inline */
  field-sizing: content; resize: vertical;
  padding: 11px 13px;
  background: #0a111e; border: 1px solid var(--border);
  border-radius: 10px; outline: none; line-height: 1.5;
}
#textInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 168, 255, 0.14); }
#textInput::placeholder { color: #5f6f88; }
.send-btn {
  flex: 0 0 auto; height: 44px; padding: 0 22px;
  border: 0; border-radius: 10px; font-weight: 600; letter-spacing: .5px;
  background: linear-gradient(120deg, #4aa8ff, #3d8bff); color: #fff;
  box-shadow: 0 6px 18px rgba(74, 168, 255, 0.22);
}
.send-btn:hover { filter: brightness(1.1); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; }

.app.dragging::after {
  content: "松开即可发送附件（单文件 ≤ 100MB，累计 ≤ 2GB）";
  position: fixed; inset: 12px; z-index: 50;
  display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: 16px;
  background: rgba(6, 10, 18, 0.9); color: #cfe0fa; font-size: 16px; pointer-events: none;
}
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(3, 6, 11, 0.94); cursor: zoom-out; padding: 28px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }

/* ---------------- 移动端安全说明：抽屉弹层（桌面端默认隐藏） ---------------- */
.info-btn { display: none; }
.info-close { display: none; }
.info-overlay { display: none; }

@media (max-width: 1080px) {
  .session-sub { display: none; }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr);
    gap: 0; padding: 10px;
  }

  /* 侧栏默认完全收起，不占用任何聊天区域 */
  .sidebar {
    position: fixed; z-index: 80;
    top: 0; right: 0; bottom: 0; width: min(360px, 88vw);
    height: 100dvh; max-height: none;
    margin: 0; padding: 16px 16px 24px;
    border-left: 1px solid var(--border); border-radius: 0;
    background: linear-gradient(165deg, rgba(18, 28, 45, 0.99), rgba(8, 13, 22, 0.99));
    box-shadow: -22px 0 60px rgba(0, 0, 0, 0.62);
    transform: translateX(105%);
    transition: transform .28s cubic-bezier(.22, .61, .36, 1);
    overflow-y: auto; overscroll-behavior: contain;
  }
  .app.info-open .sidebar { transform: translateX(0); }
  .sidebar { gap: 8px; -webkit-overflow-scrolling: touch; }
  .sidebar .side-brand, .sidebar .secure-status { margin-bottom: 8px; }
  .sidebar .side-card { margin-bottom: 8px; padding: 12px 12px 11px; }
  .sidebar .side-card h2 { margin: 4px 0 8px; font-size: 13.5px; }
  .sidebar .card-kicker { font-size: 9px; }
  .sidebar .side-sub { font-size: 9px; }
  .sidebar .secure-status { padding: 8px 10px; font-size: 11px; }
  .sidebar .feature-list li { margin-bottom: 8px; gap: 8px; }
  .sidebar .feature-list b { font-size: 12px; }
  .sidebar .feature-list p { margin-top: 2px; font-size: 10.5px; line-height: 1.5; }
  .sidebar .feature-icon { width: 18px; height: 18px; flex-basis: 18px; }
  .sidebar .policy-lead { font-size: 10.5px; margin-bottom: 7px; }
  .sidebar .ban-list li { margin-bottom: 4px; font-size: 10.5px; line-height: 1.5; }
  .sidebar .ban-list li::before { top: 7px; }
  .sidebar .policy-note { margin-top: 7px; padding-top: 7px; font-size: 10px; }
  .sidebar .side-footer { gap: 5px; }
  .sidebar .admin-status { padding: 12px 12px 11px; }
  .sidebar .admin-status .stat-item span, .sidebar .admin-status .stat-item b { font-size: 10px; }

  /* 关闭按钮固定在抽屉右上，不占据内容高度、不挤压正文 */
  .info-close {
    position: sticky; top: 0; align-self: flex-end;
    margin: -2px -2px -32px 0;
  }

  /* 遮罩层 */
  .info-overlay {
    display: block; position: fixed; inset: 0; z-index: 70;
    background: rgba(3, 6, 11, 0.66);
    opacity: 0; visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
  }
  .app.info-open .info-overlay { opacity: 1; visibility: visible; }

  /* 右上角触发按钮：触屏友好 40×40 */
  .info-btn {
    display: inline-grid; place-items: center;
    flex: 0 0 auto; width: 40px; height: 40px; margin-left: 2px;
    padding: 0; border: 1px solid rgba(74, 168, 255, 0.42); border-radius: 11px;
    background: var(--accent-soft); color: var(--accent);
  }
  .info-btn svg { width: 21px; height: 21px; fill: currentColor; }
  .info-btn:active { background: rgba(74, 168, 255, 0.28); }

  /* 抽屉内关闭按钮：触屏友好 */
  .info-close {
    display: grid; place-items: center;
    position: sticky; top: -16px; float: right; z-index: 2;
    width: 38px; height: 38px; margin: -4px -4px 2px 0;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel-2); color: #c9d6e9;
    font-size: 24px; line-height: 1;
  }
  .info-close:active { background: var(--panel-3); }
  .secure-status { clear: both; }
}

@media (max-width: 640px) {
  .topbar { gap: 6px; padding: 7px 9px; }
  .session-name { font-size: 13px; }
  .online-badge, .topbar .sub { font-size: 10px; }
  #meName { display: none; }
  .btn-ghost { height: 34px; padding: 0 9px; font-size: 11px; }
  .messages { padding: 14px var(--msg-pad-x) 8px; }
  .msg { max-width: 88%; }
  /* 安全图标与「退出登录」按钮等高（34px），触屏区域由内边距补足 */
  .info-btn { width: 34px; height: 34px; border-radius: 9px; }
  .info-btn svg { width: 18px; height: 18px; }
  .composer { padding: 8px 10px 11px; }
  .composer-hint { font-size: 10px; margin-bottom: 7px; }
  .composer-row { gap: 7px; align-items: stretch; }
  /* 图片、输入框、发送三者高度一致 */
  .icon-btn { height: 44px; min-height: 44px; max-height: 44px; padding: 0 10px; font-size: 11.5px; }
  #textInput { height: 44px; min-height: 44px; max-height: 44px; field-sizing: fixed; padding: 11px 12px; overflow-y: auto; }
  .send-btn { height: 44px; min-height: 44px; max-height: 44px; padding: 0 15px; }
  .auth-card { padding: 28px 22px 24px; }
}

/* ---------------- 提示语折叠（同一用户发满 3 条后隐藏） ---------------- */
.composer-hint.collapsed { display: none; }

/* ---------------- 消息气泡上的管理员禁言操作 ---------------- */
.msg-head .mute-action {
  margin-left: 6px; padding: 1px 7px;
  border: 1px solid rgba(255, 114, 133, 0.4); border-radius: 6px;
  background: rgba(255, 114, 133, 0.10); color: #ff9fac;
  font-size: 10px; line-height: 1.5; cursor: pointer;
}
.msg-head .mute-action:hover { background: rgba(255, 114, 133, 0.22); }
.msg-head .mute-action.unmute { border-color: rgba(61, 220, 151, 0.4); background: rgba(61, 220, 151, 0.10); color: var(--accent-2); }
.msg-head .mute-action.unmute:hover { background: rgba(61, 220, 151, 0.22); }
.msg-head .muted-flag { margin-left: 6px; color: var(--danger); font-size: 10px; }

/* ---------------- 管理员用户管理面板 ---------------- */
.modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 11, 0.72); }
.modal-card {
  position: relative; width: min(560px, 100%); max-height: 88dvh; overflow-y: auto;
  padding: 22px 24px 20px; border: 1px solid rgba(74, 168, 255, 0.32); border-radius: 16px;
  background: linear-gradient(160deg, rgba(20, 30, 47, 0.99), rgba(9, 14, 23, 0.99));
  box-shadow: var(--shadow), 0 0 0 1px rgba(74, 168, 255, 0.06);
}
.modal-card::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); border-radius: 2px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-kicker { color: #6f8db2; font-size: 9.5px; letter-spacing: 1.3px; font-weight: 700; }
.modal-head h2 { margin: 4px 0 0; font-size: 18px; letter-spacing: .5px; }
.modal-close {
  width: 34px; height: 34px; flex: 0 0 34px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel-2); color: #c9d6e9; font-size: 22px; line-height: 1;
}
.modal-close:hover { background: var(--panel-3); }
.modal-notice {
  margin: 14px 0 0; padding: 9px 12px; border-radius: 9px; font-size: 12px; line-height: 1.6;
  border: 1px solid rgba(74, 168, 255, 0.35); background: rgba(74, 168, 255, 0.12); color: #cfe0fa;
}
.modal-notice.error { border-color: rgba(255, 114, 133, 0.45); background: rgba(255, 114, 133, 0.12); color: #ffc5ce; }
.modal-notice.ok { border-color: rgba(61, 220, 151, 0.4); background: rgba(61, 220, 151, 0.10); color: #b9f2d8; }
.modal-section { margin-top: 20px; }
.modal-section-title { margin-bottom: 10px; color: #bcd0ea; font-size: 12.5px; font-weight: 600; letter-spacing: .3px; }
.muted { color: #7185a1; font-weight: 400; font-size: 11px; margin-left: 6px; }

.user-list { display: flex; flex-direction: column; gap: 7px; }
.user-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(13, 20, 33, 0.7);
}
.user-meta { flex: 1 1 130px; min-width: 0; }
.user-name { display: block; color: #e2ecf9; font-size: 13px; font-weight: 600; word-break: break-all; }
.user-display { color: #7f93ae; font-size: 10.5px; }
.user-badge { padding: 1px 7px; border-radius: 20px; font-size: 10px; white-space: nowrap; }
.user-badge.admin { border: 1px solid rgba(255, 187, 99, 0.35); background: rgba(255, 187, 99, 0.10); color: var(--warn); }
.user-badge.user { border: 1px solid var(--line); background: rgba(74, 168, 255, 0.06); color: #8fabc9; }
.user-badge.muted { border: 1px solid rgba(255, 114, 133, 0.4); background: rgba(255, 114, 133, 0.12); color: #ff9fac; }
.user-badge.online { border: 1px solid rgba(61, 220, 151, 0.35); background: rgba(61, 220, 151, 0.10); color: var(--accent-2); }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-btn {
  padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--panel-2); color: #c8d7ec; font-size: 11px; white-space: nowrap;
}
.mini-btn:hover { background: var(--panel-3); border-color: #3a5578; }
.mini-btn.danger { color: #ff9fac; border-color: rgba(255, 114, 133, 0.35); }
.mini-btn.warn { color: var(--warn); border-color: rgba(255, 187, 99, 0.35); }
.mini-btn.good { color: var(--accent-2); border-color: rgba(61, 220, 151, 0.35); }

.user-form { display: flex; flex-direction: column; gap: 11px; }
.form-row { display: flex; gap: 11px; flex-wrap: wrap; }
.form-row label { flex: 1 1 180px; display: flex; flex-direction: column; gap: 6px; color: #b3c4dc; font-size: 11.5px; }
.user-form input, .user-form select {
  width: 100%; height: 40px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px;
  background: #0b1220; outline: none;
}
.user-form input:focus, .user-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 168, 255, 0.14); }
.modal-primary {
  align-self: flex-start; height: 40px; padding: 0 20px; border: 0; border-radius: 9px;
  background: linear-gradient(120deg, #4aa8ff, #3d8bff); color: #fff; font-weight: 600; letter-spacing: .5px;
}
.modal-primary:disabled { opacity: .5; cursor: not-allowed; }
.modal-footnote { margin: 18px 0 0; color: #6e849f; font-size: 10.5px; line-height: 1.7; }

/* 聊天数据管理 */
.chat-admin-box {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: 11px;
  background: rgba(13, 20, 33, 0.7);
}
.chat-admin-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.chat-admin-form label {
  flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 5px;
  color: #a9bdd6; font-size: 11px;
}
.chat-admin-form input {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #0b1220; color: #dbe7f6; font-size: 12px; outline: none;
}
.chat-admin-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 168, 255, 0.14); }
.chat-admin-form .mini-btn { height: 36px; }
.chat-list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: #8fa6c2; font-size: 11px; margin-top: 2px;
}
.chat-manage-list {
  display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto;
  padding-right: 2px;
}
.chat-manage-empty { color: #6e849f; font-size: 11px; text-align: center; padding: 14px 0; }
.chat-manage-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; border: 1px solid var(--border); border-radius: 8px;
  background: rgba(9, 15, 26, 0.65);
}
.chat-manage-meta { flex: 1 1 auto; min-width: 0; }
.chat-manage-summary {
  color: #d3e1f2; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-manage-sub { color: #6f86a3; font-size: 10px; margin-top: 3px; word-break: break-all; }
.chat-clear-all { align-self: stretch; margin-top: 2px; }

@media (max-width: 640px) {
  .chat-admin-form label { flex-basis: 100%; }
  .chat-manage-list { max-height: 180px; }
}

@media (max-width: 640px) {
  .modal { padding: 10px; }
  .modal-card { padding: 18px 16px 16px; max-height: 92dvh; }
  .modal-card::before { left: 16px; right: 16px; }
  .user-row { gap: 8px; }
  .form-row label { flex-basis: 100%; }
}

/* ================================================================
   科技感增强层：呼吸灯 / 扫描线 / HUD 角标 / 状态脉冲 / 流光
   纯装饰，不影响任何功能与布局；遵守 prefers-reduced-motion
   ================================================================ */
.chat-panel, .auth-card { position: relative; }

.fx-decor { position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit; overflow: hidden; }

/* HUD 四角：细线描边 + 呼吸 */
.fx-corner {
  position: absolute; width: 16px; height: 16px;
  border-color: rgba(74, 168, 255, 0.55); border-style: solid; border-width: 0;
  filter: drop-shadow(0 0 4px rgba(74, 168, 255, 0.5));
  animation: hud-breathe 3.4s ease-in-out infinite;
}
.fx-corner.tl { top: 7px; left: 7px;  border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 5px; }
.fx-corner.tr { top: 7px; right: 7px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 5px; }
.fx-corner.bl { bottom: 7px; left: 7px;  border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 5px; }
.fx-corner.br { bottom: 7px; right: 7px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 5px; }
.fx-corner.tr, .fx-corner.bl { animation-delay: .5s; }
.fx-corner.br { animation-delay: 1s; }
@keyframes hud-breathe {
  0%, 100% { opacity: .28; border-color: rgba(74, 168, 255, 0.35); }
  50%      { opacity: .95; border-color: rgba(61, 220, 151, 0.85); }
}

/* 扫描线：自上而下缓慢掠过 */
.fx-scan {
  position: absolute; left: 0; right: 0; top: -18%; height: 16%;
  background: linear-gradient(180deg,
    rgba(74, 168, 255, 0) 0%,
    rgba(74, 168, 255, 0.07) 45%,
    rgba(61, 220, 151, 0.10) 55%,
    rgba(74, 168, 255, 0) 100%);
  border-bottom: 1px solid rgba(122, 205, 255, 0.18);
  animation: fx-scan-move 7s linear infinite;
}
@keyframes fx-scan-move {
  0%   { top: -18%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 102%; opacity: 0; }
}

/* 顶部会话标题呼吸光点 */
.session-title .session-name { position: relative; }
.secure-status { position: relative; overflow: hidden; }
.secure-status::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 12px rgba(61, 220, 151, 0.18);
  animation: status-glow 3s ease-in-out infinite; pointer-events: none;
}
@keyframes status-glow { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* 在线状态灯：双层呼吸光晕 */
.dot, .pulse { animation: dot-breathe 2.4s ease-in-out infinite; }
.dot::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  border: 1px solid var(--accent-2); box-shadow: 0 0 8px var(--accent-2);
  animation: pulse-ring 2.2s ease-out infinite; pointer-events: none;
}
.dot { position: relative; }
.dot.off, .dot.off::after { animation: none; }
.dot.off::after { display: none; }
@keyframes dot-breathe {
  0%, 100% { box-shadow: 0 0 6px var(--accent-2); }
  50%      { box-shadow: 0 0 14px 2px var(--accent-2); }
}

/* 品牌标志：呼吸发光 */
.brand-mark { animation: brand-breathe 3.6s ease-in-out infinite; }
@keyframes brand-breathe {
  0%, 100% { box-shadow: 0 0 18px rgba(74, 168, 255, 0.28), 0 0 6px rgba(61, 220, 151, 0.2); }
  50%      { box-shadow: 0 0 34px rgba(74, 168, 255, 0.55), 0 0 14px rgba(61, 220, 151, 0.4); }
}

/* 卡片顶部高光线：流光扫过 */
.side-card::after {
  content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(74, 168, 255, 0.9), rgba(61, 220, 151, 0.7), transparent);
  animation: card-sheen 5s ease-in-out infinite; pointer-events: none;
}
.side-card.policy::after {
  background: linear-gradient(90deg, transparent, rgba(255, 114, 133, 0.9), rgba(255, 187, 99, 0.6), transparent);
  animation-delay: 1.4s;
}
@keyframes card-sheen { 0% { left: -40%; } 60%, 100% { left: 110%; } }

/* 标签微光呼吸 */
.tag:not(.admin) { animation: tag-breathe 3s ease-in-out infinite; }
@keyframes tag-breathe {
  0%, 100% { box-shadow: 0 0 0 rgba(61, 220, 151, 0); }
  50%      { box-shadow: 0 0 10px rgba(61, 220, 151, 0.28); }
}

/* 输入框聚焦：呼吸边框 */
#textInput:focus { animation: input-focus-glow 2.2s ease-in-out infinite; }
@keyframes input-focus-glow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(74, 168, 255, 0.12); }
  50%      { box-shadow: 0 0 0 4px rgba(74, 168, 255, 0.24), 0 0 16px rgba(74, 168, 255, 0.18); }
}

/* 发送按钮：顶边流光 */
.send-btn { position: relative; overflow: hidden; }
.send-btn::before {
  content: ""; position: absolute; top: 0; left: -60%; width: 55%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-20deg); animation: btn-sheen 4.5s ease-in-out infinite; pointer-events: none;
}
@keyframes btn-sheen { 0% { left: -60%; } 55%, 100% { left: 130%; } }

/* 登录按钮：缓慢呼吸光 */
.btn-primary { animation: btn-breathe 3.8s ease-in-out infinite; }
@keyframes btn-breathe {
  0%, 100% { box-shadow: 0 8px 24px rgba(74, 168, 255, 0.22); }
  50%      { box-shadow: 0 8px 34px rgba(74, 168, 255, 0.45); }
}

/* 空状态：轻微浮动呼吸 */
.empty { animation: empty-float 5s ease-in-out infinite; }
@keyframes empty-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* 消息入场：淡入上浮，增强"实时到达"观感 */
.msg { animation: msg-in .34s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

/* 尊重系统「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  .fx-decor, .fx-scan { display: none; }
  .fx-corner, .dot, .pulse, .brand-mark, .secure-status::before,
  .side-card::after, .tag:not(.admin), .send-btn::before,
  .btn-primary, .empty, .msg, #textInput:focus { animation: none !important; }
}
