/* ==========================================================================
   zzchar · 设计系统
   ========================================================================== */

:root {
  /* App 全屏时由原生层注入真实状态栏/导航栏高度；浏览器里保持 0，仍然走 env() */
  --zz-safe-top: 0px;
  --zz-safe-bottom: 0px;
  --brand: #07c160;
  --brand-dark: #06a050;
  --brand-soft: #e7f8ee;
  --bg: #f2f3f5;
  --panel: #ffffff;
  --sidebar: #f7f7f8;
  --text: #18191c;
  --text-2: #5f6673;
  --text-3: #98a0ac;
  --border: #e6e8eb;
  --border-strong: #d8dce1;
  --bubble-self: #d6eaff;
  --bubble-self-text: #14344e;
  --bubble-other: #ffffff;
  --hover: #eceef0;
  --active: #e4e6e9;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warning: #f5a524;
  --warning-text: #9a6205;
  --warning-border: #f6e2bd;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, 0.18);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --sidebar-w: 328px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  /* 次级表面：输入框底色、标签、表头等 */
  --surface-2: #f4f5f6;
  --surface-3: #eef0f2;
  --table-head: #fafbfb;
  --row-hover: #fbfcfc;
  --highlight: #fff4e0;
  --nav-bg: #10151c;
  /* 吸顶栏/浮层的半透明底色，深色主题必须跟着换，否则会露出一条白 */
  --glass: rgba(255, 255, 255, 0.86);
  --glass-strong: rgba(255, 255, 255, 0.98);
  --glass-panel: color-mix(in srgb, var(--panel) 46%, transparent);
  --glass-panel-strong: color-mix(in srgb, var(--panel) 70%, transparent);
  --glass-border: color-mix(in srgb, var(--panel) 62%, var(--border));
  --workspace-bg:
    radial-gradient(ellipse 58% 52% at 8% 2%, rgba(116, 172, 224, 0.3), transparent 62%),
    radial-gradient(ellipse 46% 46% at 96% 8%, rgba(178, 212, 241, 0.52), transparent 64%),
    radial-gradient(ellipse 52% 48% at 58% 100%, rgba(112, 164, 211, 0.24), transparent 66%),
    linear-gradient(135deg, #dbeaf9 0%, #e4f0fb 46%, #d0e3f5 100%);
  color-scheme: light;
}

/* ==========================================================================
   深色主题
   两种生效方式：手动指定 data-theme="dark"，或跟随系统且未手动锁定为 light
   ========================================================================== */
[data-theme="dark"] {
  --brand: #07c160;
  --brand-dark: #0fa95c;
  --brand-soft: #123322;
  --bg: #0f1114;
  --panel: #171a1f;
  --sidebar: #13161a;
  --text: #e6e8eb;
  --text-2: #9aa3af;
  --text-3: #6b7480;
  --border: #252a31;
  --border-strong: #333a43;
  --bubble-self: #1f3d56;
  --bubble-self-text: #e6f2fc;
  --bubble-other: #1e2228;
  --hover: #1c2026;
  --active: #242932;
  --danger: #ff6b6f;
  --danger-soft: #3a1d1e;
  --warning: #f5b942;
  --warning-text: #f5c46b;
  --warning-border: #5a4620;
  --surface-2: #1b1f26;
  --surface-3: #222831;
  --table-head: #1b1f26;
  --row-hover: #1e232a;
  --highlight: #3a2f18;
  --nav-bg: #0b0d10;
  --glass: rgba(23, 26, 31, 0.86);
  --glass-strong: rgba(23, 26, 31, 0.98);
  --workspace-bg:
    radial-gradient(ellipse 60% 50% at 8% 2%, rgba(58, 132, 200, 0.16), transparent 62%),
    radial-gradient(ellipse 46% 46% at 96% 8%, rgba(72, 100, 130, 0.18), transparent 64%),
    radial-gradient(ellipse 50% 44% at 58% 100%, rgba(40, 96, 150, 0.13), transparent 66%),
    linear-gradient(135deg, #0c1117 0%, #101821 48%, #0b131b 100%);
  /* 让原生控件（下拉框、滚动条、日期选择器）也走深色 */
  color-scheme: dark;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.65);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #07c160;
    --brand-dark: #0fa95c;
    --brand-soft: #123322;
    --bg: #0f1114;
    --panel: #171a1f;
    --sidebar: #13161a;
    --text: #e6e8eb;
    --text-2: #9aa3af;
    --text-3: #6b7480;
    --border: #252a31;
    --border-strong: #333a43;
    --bubble-self: #1f3d56;
    --bubble-self-text: #e6f2fc;
    --bubble-other: #1e2228;
    --hover: #1c2026;
    --active: #242932;
    --danger: #ff6b6f;
    --danger-soft: #3a1d1e;
    --warning: #f5b942;
    --surface-2: #1b1f26;
    --surface-3: #222831;
    --table-head: #1b1f26;
    --row-hover: #1e232a;
    --highlight: #3a2f18;
    --nav-bg: #0b0d10;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.65);
    --glass: rgba(23, 26, 31, 0.86);
    --glass-strong: rgba(23, 26, 31, 0.98);
    --workspace-bg:
      radial-gradient(ellipse 60% 50% at 8% 2%, rgba(58, 132, 200, 0.16), transparent 62%),
      radial-gradient(ellipse 46% 46% at 96% 8%, rgba(72, 100, 130, 0.18), transparent 64%),
      radial-gradient(ellipse 50% 44% at 58% 100%, rgba(40, 96, 150, 0.13), transparent 66%),
      linear-gradient(135deg, #0c1117 0%, #101821 48%, #0b131b 100%);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}

svg {
  display: block;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.28);
  background-clip: padding-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.app-root {
  height: 100dvh;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

/* ============================ 基础组件 ============================ */

.avatar {
  --size: 42px;
  width: var(--size);
  height: var(--size);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: calc(var(--size) * 0.4);
  font-weight: 600;
  letter-spacing: 0.5px;
  flex: 0 0 auto;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.avatar.sm {
  --size: 32px;
  border-radius: 6px;
}
.avatar.lg {
  --size: 64px;
  border-radius: 14px;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* 群封面：群名文字，最多两行、每行最多 3 个字 */
.avatar.group-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: calc(var(--size) * 0.3);
  line-height: 1.08;
  letter-spacing: 0;
}
.avatar.group-cover span {
  display: block;
  white-space: nowrap;
}

.avatar-stack {
  display: flex;
}
.avatar-stack .avatar {
  margin-left: -10px;
  border: 2px solid var(--panel);
}
.avatar-stack .avatar:first-child {
  margin-left: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-2);
}
.btn:active {
  background: var(--surface-3);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.ghost:hover {
  background: var(--hover);
}
.btn.danger {
  color: var(--danger);
  border-color: var(--danger-soft);
  background: var(--panel);
}
.btn.danger:hover {
  background: var(--danger-soft);
}
.btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}
.btn.block {
  width: 100%;
}
.btn.icon {
  width: 38px;
  padding: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
  flex: 0 0 auto;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.icon-btn.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.icon-btn.danger {
  color: var(--danger);
}
.icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.input,
.textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
}
.input:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.14);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.badge.soft {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex: 0 0 auto;
  background: var(--surface-3);
  color: var(--text-2);
}
.chip.green {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.chip.amber {
  background: var(--highlight);
  color: var(--warning-text);
}
.chip.red {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-3);
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
}
.empty svg {
  opacity: 0.55;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ============================ 表单页 ============================ */

.auth {
  height: 100%;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #eef4fb;
  color-scheme: light;
  color: #18191c;
  --text: #18191c;
  --text-2: #5f6673;
  --text-3: #98a0ac;
  --border: #e6e8eb;
  --border-strong: #d8dce1;
  --panel: #ffffff;
  --surface-2: #f7f8f8;
  --hover: #eceef0;
  --active: #e4e6e9;
}
.auth::before,
.auth::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.auth::before {
  background-color: #eef4fb;
  /* 先铺 28px 模糊占位（几百字节，随 CSS 到达），真图 96KB WebP 到位后自动盖上 */
  background-image: url('/assets/login-desktop.webp?v=20261115-2110'), var(--login-desktop-lqip);
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.96;
  transition: opacity 0.7s ease;
}
.auth.auth-ready::before {
  opacity: 0.7;
}
.auth::after {
  background: linear-gradient(180deg, rgba(244, 249, 253, 0.04), rgba(244, 249, 253, 0.2));
}
.auth > * {
  position: relative;
  z-index: 1;
}

.auth-brand {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(4, 79, 43, 0.76) 0%, rgba(7, 164, 84, 0.48) 58%, rgba(67, 217, 138, 0.28) 100%);
  color: #fff;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.auth-brand::before {
  width: 520px;
  height: 520px;
  right: -180px;
  top: -160px;
}
.auth-brand::after {
  width: 360px;
  height: 360px;
  left: -140px;
  bottom: -120px;
  background: rgba(255, 255, 255, 0.08);
}
.auth-brand > * {
  position: relative;
  z-index: 1;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand-mark img {
  width: 46px;
  height: 46px;
  padding: 6px;
  object-fit: contain;
  background: #fff;
  border-radius: 13px;
  box-shadow: 0 6px 18px rgba(24, 62, 96, 0.2);
}
.auth-headline {
  font-size: 40px;
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 18px;
  letter-spacing: -0.5px;
}
.auth-sub {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.86);
  margin: 0;
  max-width: 420px;
}
.auth-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 36px;
}
.auth-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.94);
}
.auth-feature .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.auth-foot {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}
/* 手机/平板登录页：品牌收成顶部一颗玻璃胶囊，避免整块品牌区被隐藏后没有标识 */
.auth-mini-brand {
  display: none;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--panel) 54%, transparent);
  backdrop-filter: blur(10px);
  transition: background-color 0.55s ease;
}
.auth-brand {
  transition: opacity 0.55s ease 0.12s;
}
.auth-card {
  transition:
    opacity 0.7s ease,
    transform 0.85s cubic-bezier(0.18, 0.9, 0.28, 1.08),
    filter 0.65s ease;
}
.auth:not(.auth-ready) .auth-brand {
  opacity: 0;
}
.auth:not(.auth-ready) .auth-panel {
  background: transparent;
  backdrop-filter: none;
}
.auth:not(.auth-ready) .auth-card {
  opacity: 0;
  transform: translateY(56px) scale(0.955);
  filter: blur(12px);
  pointer-events: none;
}
@media (min-width: 721px) {
  .auth-panel {
    background: color-mix(in srgb, var(--panel) 28%, transparent);
    backdrop-filter: blur(3px);
  }
  .auth-card {
    padding: 30px 28px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.56);
    box-shadow:
      0 24px 72px rgba(29, 61, 39, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(24px) saturate(135%);
    -webkit-backdrop-filter: blur(24px) saturate(135%);
  }
}
@media (min-width: 901px) {
  .auth {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth::before,
  .auth.auth-ready::before {
    opacity: 1;
  }
  .auth::before {
    transform: scaleX(-1);
  }
  .auth::after {
    display: none;
  }
  .auth-brand {
    position: absolute;
    top: clamp(24px, 4vh, 44px);
    left: clamp(32px, 7vw, 120px);
    right: auto;
    bottom: auto;
    z-index: 3;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: auto;
    padding: 0;
    font-size: 20px;
    color: #fff;
    background: transparent;
    overflow: visible;
    pointer-events: none;
  }
  .auth-brand::before,
  .auth-brand::after,
  .auth-brand > div:not(.brand-mark),
  .auth-brand .auth-foot {
    display: none;
  }
  .brand-mark {
    gap: 10px;
    color: #14527c;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  }
  .brand-mark img {
    width: 46px;
    height: 46px;
    padding: 6px;
  }
  .auth-panel {
    justify-content: flex-end;
    padding: 44px clamp(32px, 7vw, 120px);
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .auth-card {
    max-width: 400px;
  }
}
.auth-card {
  width: 100%;
  max-width: 380px;
  overflow: hidden;
}
.auth-card-body {
  min-width: 0;
  transform-origin: 50% 100%;
}
.auth-card h1 {
  font-size: 26px;
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}
.auth-card .lead {
  color: var(--text-2);
  font-size: 14px;
  margin: 0 0 28px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  position: relative;
  overflow: hidden;
  background: rgba(45, 82, 56, 0.1);
  box-shadow: inset 0 1px 3px rgba(27, 62, 38, 0.1);
  border-radius: 9px;
  margin-bottom: 26px;
}
.auth-tabs-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  z-index: 0;
  width: calc((100% - 12px) / 2);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 10px rgba(26, 64, 38, 0.16), 0 1px 2px rgba(26, 64, 38, 0.1);
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.2, 0.85, 0.25, 1);
  will-change: transform;
}
.auth-tabs[data-mode="register"] .auth-tabs-indicator {
  transform: translateX(calc(100% + 4px));
}
.auth-tabs button {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  height: 34px;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.2s;
}
.auth-tabs button.active {
  background: transparent;
  color: var(--text);
  box-shadow: none;
}
.form-error {
  min-height: 0;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 6px;
  padding: 9px 12px;
  line-height: 1.5;
}
.form-error:empty {
  display: none;
}
.auth-hint {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.7;
}
.auth-trust-device {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}
.auth-trust-device input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}
.auth-trust-device span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.auth-trust-device strong { color: var(--text); font-size: 13px; }
.auth-trust-device small { color: var(--text-3); font-size: 11.5px; line-height: 1.45; }
.app-build { margin-top: 12px; color: var(--text-3); font-size: 10.5px; text-align: center; }
.device-list { display: flex; flex-direction: column; gap: 8px; }
.device-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.device-row-main { min-width: 0; flex: 1; }
.device-row-main strong { display: block; overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.device-row-main small { display: block; margin-top: 2px; color: var(--text-3); font-size: 11.5px; }

/* ============================ 主框架 ============================ */

/* 主页壁纸：桌面 / 手机 × 浅色 / 深色 四套。
   --wp-* 存图片地址，宽屏/高分屏只在下面的媒体查询里换一次变量，不用重复写主题规则；
   --wp-*-lqip 是 28px 宽的模糊缩略图（几百字节，随 CSS 一起到达，不发额外请求）：
   先用它铺底，真图加载完自动盖上去，慢网络下也不会先闪一块纯色再"啪"地跳出来。 */
:root {
  --wp-desktop: url('/assets/wallpaper-desktop-light.webp?v=20261115-2110');
  --wp-desktop-dark: url('/assets/wallpaper-desktop-dark.webp?v=20261115-2110');
  --wp-mobile: url('/assets/wallpaper-mobile-dark.webp?v=20261115-2110');
  --wp-light-lqip: url('data:image/webp;base64,UklGRtYAAABXRUJQVlA4IMoAAACQBgCdASocABUAPrlMnUqnJKKht/VYAOAXCWwAnTKEdOckv7Ae//dwHSmg0qR+145NeRiXPvKZQtkE3sAAAN08E217hjqukiRwoyAj0+0BZ0QeeGklL65FX4atcz/+LmbYIbmiacpI9JGUmMbekjGgMV6AmmDFCSFq7c+Cq4dQhXIprwqRR1HZ1G4dj7PAZQl4Ulm9sFaM7f+yS8D4+IibcHt1oNyY2kWfowHssI/QKcBLmb8FE8i4nsKX7rg1qbW+6ke2VuSKAAAA');
  --wp-dark-lqip: url('data:image/webp;base64,UklGRroAAABXRUJQVlA4IK4AAAAwBgCdASocABUAPrVCnUqnJyKht/qoAOAWiWwArC+wBgHmAfqr7/923exf5KoGpiwyfiaO2PRlGrwAAP71cpnWrampUYDgISSP1MZO8pzL4zvNnod29ELKftkX9IOx4m8Pc6oCDkOXRhGJOk4rtJ9vltxZqUDw5MQt0rvfqZgJ2RVTvEcjXvvhSnrgRHN692Dcw3pVm4Xm0VuUJQflFw2CeY/o+DMnUO0LYU/MAAA=');
  --wp-mobile-lqip: url('data:image/webp;base64,UklGRooAAABXRUJQVlA4IH4AAAAwBQCdASocAD4APrlMn0qnJCKiM/zIAOAXCWMAxnwt4bVBEx1c4+r6Rzl0ENaZ5FNqMAD+7R2FMRVvi7sRxk8Pg2SKcwAZnusTExj0uL8X/hGBYOtnzPxEPzGJMhEuFgCGXRBNxBrMa0GtJRvSnN1bh+UFwF8iQMTb3v+IAAA=');
  --login-desktop-lqip: url('data:image/webp;base64,UklGRoIAAABXRUJQVlA4IHYAAAAQBQCdASocABAAPsFOoEqnpCMhsAgA8BgJbACdMoKBn/gMIA/Un3/wHkfxZoJPTbdgAP7zae7ttNCMa7G0SVZ2L7Jgb/zqB8RybSKTLlgphRhbL+w8qErt8Cho/kS2c1vwlVqrN99H6LKOvUp8ZWs3UnxPz4AA');
  --login-mobile-lqip: url('data:image/webp;base64,UklGRnwAAABXRUJQVlA4IHAAAAAwBACdASocACUAPr1Mn0qnJCKhtVgIAOAXiUAZbQPKegQvBh2RTU10VUAA/u2v3+cO7PiKTizOPlv/onw9UB2wc3kXsWfhMcChnAn4LbnLE9d/siaMnbwJFMB87V7AipXZxVFHGF8ZvuWVK2zqgAAA');
}

/* 桌面暗色那张原图是 3840×2880，宽屏/高分屏换成 2560 的版本才真正看得清；
   1448 那张（日景）原图本身只有 1448 宽，HD 档就用原生尺寸。 */
@media (min-width: 1500px), (min-width: 721px) and (min-resolution: 1.5dppx) {
  :root {
    --wp-desktop: url('/assets/wallpaper-desktop-light-hd.webp?v=20261115-2110');
    --wp-desktop-dark: url('/assets/wallpaper-desktop-dark-hd.webp?v=20261115-2110');
  }
}

.shell {
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background-color: #dbeaf9;
  background-image: var(--wp-desktop), var(--wp-light-lqip);
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}
[data-theme="dark"] .shell {
  background-color: #0c1117;
  background-image: var(--wp-desktop-dark), var(--wp-dark-lqip);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shell {
    background-color: #0c1117;
    background-image: var(--wp-desktop-dark), var(--wp-dark-lqip);
  }
}
@media (max-width: 720px) {
  .shell {
    /* 手机端不分明暗，统一用这张「日照金山」：
       浅色模式的白玻璃面板压上去，比原来的亮色壁纸更容易看清字 */
    background-color: #0c1117;
    background-image: var(--wp-mobile), var(--wp-mobile-lqip);
  }
  [data-theme="dark"] .shell {
    background-color: #0c1117;
    background-image: var(--wp-mobile), var(--wp-mobile-lqip);
  }
}
@media (max-width: 720px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shell {
    background-image: var(--wp-mobile), var(--wp-mobile-lqip);
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: color-mix(in srgb, var(--panel) 34%, transparent);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(8px) saturate(125%);
  -webkit-backdrop-filter: blur(8px) saturate(125%);
}

.side-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
}
.side-me {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 9px;
  transition: background 0.15s;
  text-align: left;
}
.side-me:hover {
  background: var(--hover);
}

/* 侧栏右上角的品牌标识，替代原来的「+」按钮：Logo 的「Z」+ 右侧 zchar 组成 zzchar */
.side-brand-wrap {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: 0 0 auto;
  padding: 4px 13px 4px 11px;
  border-radius: 999px;
  background: var(--glass-panel-strong);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
  box-shadow: var(--shadow-sm);
  user-select: none;
}
.side-brand {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(16, 60, 110, 0.18));
  user-select: none;
  -webkit-user-drag: none;
}
.side-brand-name {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #1f6fe0;
  white-space: nowrap;
}
[data-theme="dark"] .side-brand-name {
  color: #6aa2ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .side-brand-name {
    color: #6aa2ff;
  }
}
.side-me-name {
  font-weight: 600;
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-me-sub {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  flex: 0 0 auto;
}
.status-dot.off {
  background: var(--text-3);
}

.side-search {
  padding: 4px 14px 10px;
  position: relative;
}
.side-search svg {
  position: absolute;
  left: 26px;
  /* 输入框高 34px、容器上内边距 4px，输入框垂直中心正好是 21px；
     用 -50% 真正居中，别再用 -40% 往下偏 */
  top: 21px;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.side-search input {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-panel);
  padding: 0 12px 0 34px;
  font-size: 13.5px;
  outline: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.side-search input:focus {
  background: var(--glass-panel-strong);
  border-color: color-mix(in srgb, var(--brand) 55%, var(--glass-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.side-actions {
  display: flex;
  gap: 8px;
  padding: 0 14px 10px;
}
.side-actions .btn {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  background: var(--glass-panel);
  border-color: var(--glass-border);
  backdrop-filter: blur(12px);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 8px 12px;
  min-height: 0;
  /* 列表每一行都是整宽的圆角卡片，滚动条一占位就会变成左 8 / 右 16，整列看起来往左歪
     （安卓上自定义滚动条会真的占 8px）。这里统一不显示滚动条，触摸和滚轮照样能滚。 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.conv-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ---------- 折叠栏：被收起来的会话 ---------- */

.conv-fold {
  padding: 2px 8px 6px;
}
.conv-fold-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 52%, transparent);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.conv-fold-bar:hover {
  background: var(--glass-panel);
  border-color: var(--brand);
}
.conv-fold-bar .cfb-ico {
  display: inline-flex;
  flex: 0 0 auto;
  transform: rotate(-90deg);
  transition: transform 0.2s ease;
}
.conv-fold-bar.open .cfb-ico {
  transform: rotate(0deg);
}
.conv-fold-bar .cfb-label {
  color: var(--text);
  font-weight: 600;
}
.conv-fold-bar .cfb-count {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.conv-fold-bar .cfb-unread {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.conv-fold-bar .cfb-hint {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 11.5px;
}
/* 折叠条中间靠右的灰色小字：固定的操作提示 */
.conv-fold-bar .cfb-preview {
  margin-left: auto;
  min-width: 0;
  max-width: 46%;
  overflow: hidden;
  color: var(--text-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.conv-fold-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 16px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

/* ---------- 会话行：左滑露出折叠按钮 ---------- */

.conv-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 11px;
  touch-action: pan-y;
  margin: 0 1px 3px;
}
.conv-wrap .conv {
  transform: translateX(0);
}
.conv-wrap.dragging .conv {
  transition: none;
}
.conv-act {
  position: absolute;
  top: 0;
  /* 收起时整块藏到右边外面，靠 .conv-wrap 的 overflow 裁掉，避免透在行底下 */
  right: -78px;
  bottom: 0;
  width: 78px;
  border: 0;
  border-radius: 0 11px 11px 0;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s ease;
}
.conv-wrap.dragging .conv-act {
  transition: none;
}
.conv-act.unfold {
  background: var(--surface-3);
  color: var(--text-2);
}
.conv.is-folded {
  background: color-mix(in srgb, var(--surface-3) 45%, transparent);
}

.conv {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s ease;
  position: relative;
  text-align: left;
  width: 100%;
  /* 壁纸再花也要保证名字/时间可读：整行垫一层圆角半透明底 */
  background: color-mix(in srgb, var(--panel) 68%, transparent);
  box-shadow: 0 1px 2px rgba(12, 24, 18, 0.05);
}
.conv:active { transform: scale(.992); }
.conv:hover {
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border-color: var(--glass-border);
}
.conv.active {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border-color: var(--glass-border);
  box-shadow: 0 8px 24px rgba(38, 74, 50, 0.09);
}
.conv-main {
  flex: 1;
  min-width: 0;
}
.conv-row1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.conv-name {
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.conv-time {
  font-size: 11.5px;
  color: var(--text-3);
  flex: 0 0 auto;
}
.conv-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}
.conv-preview {
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.conv-preview strong {
  color: var(--text-2);
  font-weight: 500;
}
.conv-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}
.pin-flag {
  font-size: 10px;
  color: var(--text-3);
}

/* ============================ 聊天区 ============================ */

.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: color-mix(in srgb, var(--panel) 8%, transparent);
  position: relative;
}

.chat-head {
  height: 58px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  background: var(--glass-panel);
  backdrop-filter: blur(10px) saturate(125%);
  -webkit-backdrop-filter: blur(10px) saturate(125%);
  border-bottom: 1px solid var(--glass-border);
  z-index: 5;
}
.chat-head-main {
  min-width: 0;
  flex: 1;
}
.chat-title {
  font-size: 15.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.back-btn {
  display: none;
}

.msg-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0 18px;
  min-height: 0;
  position: relative;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  /* 历史消息是手动补偿位置的，关掉浏览器自带的滚动锚定避免两套逻辑打架 */
  overflow-anchor: none;
}

.msg-loading {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 10px;
  min-height: 30px;
  flex: 0 0 auto;
}

.msg-list {
  padding: 0 22px;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-top: auto; /* 消息较少时贴着输入框排列，符合聊天软件直觉 */
}

.time-divider {
  text-align: center;
  margin: 14px 0 10px;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.2px;
}
.time-divider span {
  background: var(--glass-panel);
  border: 1px solid var(--glass-border);
  padding: 3px 9px;
  border-radius: 6px;
}

.sys-msg {
  text-align: center;
  margin: 8px 0;
  font-size: 12px;
  color: var(--text-3);
  padding: 0 40px;
  line-height: 1.6;
}
.sys-msg span {
  background: var(--glass-panel);
  border: 1px solid var(--glass-border);
  padding: 4px 10px;
  border-radius: 7px;
  display: inline-block;
}

.msg {
  display: flex;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  padding: 5px 0;
  align-items: flex-start;
  animation: msg-in 0.18s ease-out;
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.msg.self {
  flex-direction: row-reverse;
}
.msg-body {
  min-width: 0; /* 关键：允许 flex 子项收缩，否则 nowrap 的引用块会撑破气泡 */
  max-width: min(72%, 620px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg.self .msg-body {
  align-items: flex-end;
}
.msg-sender {
  font-size: 11.5px;
  color: var(--text-3);
  padding: 0 2px;
}
/* 桌面端聊天区是透明玻璃 + 壁纸，浅灰昵称在照片上几乎看不见：
   浅色主题用近黑字、暗色主题用纯白字，各加一层反向柔和描边，压在任何底色上都读得清。 */
@media (min-width: 721px) {
  .msg-sender {
    color: #111417;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(255, 255, 255, .9), 0 0 7px rgba(255, 255, 255, .6);
  }
  :root[data-theme="dark"] .msg-sender {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .8), 0 0 7px rgba(0, 0, 0, .6);
  }
}
@media (min-width: 721px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .msg-sender {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .8), 0 0 7px rgba(0, 0, 0, .6);
  }
}
.bubble {
  position: relative;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 9px 13px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bubble-other) 86%, transparent);
  font-size: 14.8px;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal; /* 内部空白折叠，避免模板缩进被渲染成空行 */
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.bubble-text {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.bubble-text a {
  word-break: break-all;
  overflow-wrap: anywhere;
}
.search-results-panel {
  position: absolute;
  z-index: 20;
  top: 62px;
  right: 18px;
  width: min(380px, calc(100% - 36px));
  max-height: 62%;
  overflow: auto;
  background: var(--glass-panel-strong);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  backdrop-filter: blur(18px) saturate(1.1);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.search-results-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
}
.search-results-head span { margin-left: auto; color: var(--text-3); font-size: 12px; }
.search-results-list { padding: 4px; }
.search-result {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 9px 8px;
  text-align: left;
  cursor: pointer;
}
.search-result:hover { background: var(--hover); }
.search-result span { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.search-result em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; font-size: 13px; }
.search-result time { color: var(--text-3); font-size: 11px; white-space: nowrap; }
.msg.self .bubble {
  background: color-mix(in srgb, var(--bubble-self) 88%, transparent);
  border-color: color-mix(in srgb, var(--bubble-self) 58%, transparent);
  color: var(--bubble-self-text);
}

/* 自己发的气泡：私聊、群聊统一用淡蓝色（原来是群聊绿、私聊蓝）。
   颜色已经在 :root / 深色变量里定义，这里不再需要按 .chat.direct 区分。 */
.bubble.revoked {
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 13px;
  font-style: normal;
  box-shadow: none;
}
.msg.self .bubble.revoked {
  background: var(--surface-3);
  color: var(--text-3);
}
.bubble.media {
  padding: 4px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* 图文同条：文字在上，图片在下，仍由同一个气泡框住 */
.bubble.media .bubble-text {
  padding: 6px 9px 2px;
}

/* 视频消息：默认只显示封面，点开后才加载完整视频 */
.bubble.media.video-bubble {
  padding: 4px;
}
.video-card {
  position: relative;
  display: block;
  max-width: min(360px, 62vw);
  border-radius: 10px;
  overflow: hidden;
  background: #0d1014;
  line-height: 0;
  text-align: left;
}
.video-card img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}
.video-placeholder {
  display: block;
  width: min(360px, 62vw);
  height: 190px;
  background: linear-gradient(135deg, #1b2430, #0d1014);
}
.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 18, 22, 0.62);
  color: #fff;
  font-size: 19px;
  line-height: 1;
  pointer-events: none;
}
.video-duration {
  position: absolute;
  right: 8px;
  bottom: 7px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(16, 18, 22, 0.66);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
}
.video-player {
  display: block;
  width: min(520px, 72vw);
  max-width: 100%;
  max-height: min(70vh, 520px);
  border-radius: 10px;
  background: #000;
}

/* 引用块：显示在气泡内，点击可定位原消息 */
.quote {
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  border-left: 2px solid rgba(0, 0, 0, 0.16);
  background: rgba(0, 0, 0, 0.045);
  border-radius: 4px;
  padding: 5px 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s;
}
.quote:hover {
  background: rgba(0, 0, 0, 0.08);
}
.msg.self .quote {
  border-left-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.055);
}
.quote-name {
  color: var(--text-2);
  font-weight: 600;
  margin-right: 6px;
}
.quote-text {
  color: var(--text-2);
}

.msg-highlight .bubble {
  animation: quote-flash 1.4s ease-out;
}
@keyframes quote-flash {
  0%,
  35% {
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.38);
  }
  100% {
    box-shadow: var(--shadow-sm);
  }
}
.bubble.media img {
  display: block;
  max-width: min(320px, 52vw);
  max-height: 320px;
  border-radius: 5px;
  object-fit: cover;
  cursor: zoom-in;
}
/* 表情包消息：气泡缩小一圈并去掉白底，贴近微信表情的观感 */
.msg .bubble.media.sticker-media {
  padding: 0;
  background: transparent;
  box-shadow: none;
}
.msg .bubble.media.sticker-media img {
  max-width: min(130px, 32vw);
  max-height: 130px;
  border-radius: 4px;
  object-fit: contain;
}
.file-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  min-width: 210px;
  max-width: 300px;
}
.file-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.file-meta {
  min-width: 0;
  flex: 1;
}
.file-name {
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.msg-time {
  font-size: 10.5px;
  color: var(--text-3);
  padding: 0 3px;
}

.msg-hover-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  align-self: center;
}
.msg:hover .msg-hover-actions {
  opacity: 1;
}
@media (hover: none) {
  /* 触摸设备不显示常驻操作按钮，改用长按菜单 */
  .msg-hover-actions {
    display: none;
  }
  /* 关闭整行消息的系统选词与长按菜单，避免与自定义长按菜单冲突；复制走菜单里的「复制文字」 */
  .msg,
  .msg * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  .msg img {
    -webkit-user-drag: none;
  }
}

.typing-hint {
  height: 20px;
  padding: 0 26px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.typing-dots {
  display: inline-flex;
  gap: 2px;
}
.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-3);
  animation: blink 1.2s infinite;
}
.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes blink {
  0%,
  60%,
  100% {
    opacity: 0.35;
  }
  30% {
    opacity: 1;
  }
}

/* 输入区 */
.composer {
  position: relative;
  flex: 0 0 auto;
  background: var(--glass-panel-strong);
  backdrop-filter: blur(10px) saturate(125%);
  -webkit-backdrop-filter: blur(10px) saturate(125%);
  border-top: 1px solid var(--glass-border);
  padding: 10px 18px calc(10px + max(env(safe-area-inset-bottom), var(--zz-safe-bottom, 0px)));
}

/* 待发送的引用提示条 */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border-left: 3px solid var(--brand);
  border-radius: 5px;
  font-size: 12.5px;
  animation: msg-in 0.15s ease-out;
}
.reply-bar-main {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-bar-name {
  color: var(--brand-dark);
  font-weight: 600;
  margin-right: 6px;
}
.reply-bar-text {
  color: var(--text-2);
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 6px;
}
.sticker-trigger {
  font-size: 22px;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
}
.sticker-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% - 2px);
  max-height: min(360px, 48dvh);
  overflow: auto;
  padding: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 14px 14px 8px 8px;
  box-shadow: var(--shadow-lg);
  animation: sticker-panel-in 0.16s ease-out;
  z-index: 12;
}
.sticker-panel-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text);
}
.sticker-panel-head span {
  font-size: 11px;
  color: var(--text-3);
}
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.sticker-tile,
.sticker-upload-tile {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
}
.sticker-image-btn,
.sticker-upload-tile {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.sticker-image-btn:hover,
.sticker-upload-tile:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  background: var(--brand-soft);
}
.sticker-image-btn:active,
.sticker-upload-tile:active { transform: scale(.96); }
.sticker-image-btn img { width: 100%; height: 100%; object-fit: contain; }
.sticker-upload-tile { color: var(--brand-dark); font-size: 26px; }
.sticker-upload-tile small { display: block; font-size: 11px; }
.sticker-remove-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(24, 25, 28, .72);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  z-index: 2;
}
.sticker-empty {
  grid-column: 1 / -1;
  padding: 22px 0;
  color: var(--text-3);
  text-align: center;
  font-size: 13px;
}
@keyframes sticker-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.composer-tools .spacer {
  flex: 1;
}
.composer-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

/* 待发送图片：输入框上方的缩略图条，点「发送」才真正上传 */
.attach-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 4px 8px;
}
.attach-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 12px;
}
.attach-tip {
  margin-left: auto;
  color: var(--text-3);
  font-size: 11.5px;
}
.attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attach-item {
  position: relative;
  width: 72px;
  height: 72px;
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  background: var(--surface-2);
  overflow: hidden;
  flex: 0 0 auto;
}
.attach-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attach-rm {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(24, 25, 28, 0.72);
  color: #fff;
}
.attach-rm:hover {
  background: var(--danger);
}
/* 待发送视频：封面 + 播放角标 + 时长 */
.attach-item.is-video .attach-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(24, 25, 28, 0.6);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
}
.attach-item .attach-dur {
  position: absolute;
  right: 4px;
  bottom: 3px;
  padding: 1px 4px;
  border-radius: 6px;
  background: rgba(24, 25, 28, 0.62);
  color: #fff;
  font-size: 10px;
  line-height: 1.3;
  pointer-events: none;
}
.attach-video-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: #10151c;
  color: #fff;
  font-size: 12px;
}
.composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 132px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-panel);
  outline: none;
  resize: none;
  line-height: 1.5;
  font-size: 14.8px;
  transition: background 0.15s, border-color 0.15s;
}
.composer textarea:focus {
  background: var(--glass-panel-strong);
  border-color: color-mix(in srgb, var(--brand) 55%, var(--glass-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}
.send-btn {
  height: 40px;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
}
.send-btn:hover {
  background: var(--brand-dark);
}
.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.composer-hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 6px;
  display: flex;
  gap: 10px;
}
.kbd {
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  font-size: 10.5px;
  color: var(--text-2);
  background: var(--surface-2);
}

.offline-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--highlight);
  color: var(--warning-text);
  font-size: 12.5px;
  padding: 6px;
  border-bottom: 1px solid var(--warning-border);
}
.offline-message {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.offline-bar .btn {
  min-height: 28px;
}

/* 拖拽上传遮罩 */
.drop-mask {
  position: absolute;
  inset: 0;
  background: rgba(7, 193, 96, 0.08);
  border: 2px dashed var(--brand);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--brand-dark);
  z-index: 20;
  pointer-events: none;
  margin: 8px;
}

/* ============================ 右侧信息面板 ============================ */

.panel {
  width: 340px;
  max-width: 88vw;
  background: var(--glass-panel-strong);
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-backdrop-filter: blur(12px) saturate(125%);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  z-index: 15;
  animation: slide-in 0.2s ease-out;
}

/* 打开信息面板时挤压聊天区，而不是遮住消息 */
.shell.panel-open {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
}
@keyframes slide-in {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.panel-head {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.panel-title {
  font-weight: 600;
  font-size: 14.5px;
  flex: 1;
}
.panel-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.panel-section {
  padding: 16px;
  min-width: 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.panel-section:last-child {
  border-bottom: none;
}
.panel-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.panel-hint {
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.55;
}
.panel-announcement-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
.member-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 4px;
  border-radius: 8px;
}
.member-row:hover {
  background: var(--hover);
}
.member-main {
  flex: 1;
  min-width: 0;
}
.member-name {
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 1px;
}
.member-ops {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}
.owner-tag {
  font-size: 10.5px;
  background: var(--highlight);
  color: var(--warning-text);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 500;
}
.admin-tag {
  font-size: 10.5px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 500;
}

/* 头像裁剪 */
.cropper {
  padding: 6px 0 2px;
}
.cropper-stage {
  margin: 0 auto;
  background: var(--nav-bg);
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.cropper-stage canvas {
  display: block;
  cursor: grab;
  touch-action: none;
}
.cropper-stage canvas.dragging {
  cursor: grabbing;
}
.cropper-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px auto 2px;
  max-width: 300px;
  color: var(--text-3);
}
.cropper-zoom input[type="range"] {
  flex: 1;
  accent-color: var(--brand);
  height: 4px;
}
.cropper-tip {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 10px;
}

/* 头像上传 */
.avatar-edit {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
}
.avatar-upload {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  border: 2px solid var(--panel);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.22);
  transition: background 0.15s;
}
.avatar-wrap:hover .avatar-upload {
  background: var(--brand-dark);
}

/* ============================ 弹窗 / 提示 ============================ */

.modal-host {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 40, 0.42);
  backdrop-filter: blur(2px);
  animation: fade 0.15s ease-out;
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal {
  width: 100%;
  max-width: min(460px, calc(100vw - 40px));
  max-height: 86vh;
  min-width: 0;
  background: var(--glass-panel-strong);
  backdrop-filter: blur(26px) saturate(125%);
  -webkit-backdrop-filter: blur(26px) saturate(125%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal.wide {
  max-width: min(720px, calc(100vw - 40px));
}
@keyframes pop {
  from {
    transform: scale(0.97) translateY(6px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.modal-head {
  padding: 18px 20px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.modal-head > div { min-width: 0; }
.modal-head h3,
.modal-head p {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.modal-head h3 {
  margin: 0;
  font-size: 16.5px;
  flex: 1;
  letter-spacing: -0.2px;
}
.modal-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}
.modal-body {
  padding: 6px 20px 4px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.modal-foot .btn.block {
  flex: 1;
}

.conversation-picker-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: min(56vh, 520px);
  overflow-y: auto;
  padding: 2px;
}
.conversation-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
}
.conversation-picker-row:hover,
.conversation-picker-row:focus-visible {
  border-color: var(--brand);
  background: var(--surface-2);
}
.conversation-picker-row .avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  font-size: 17px;
}
.conversation-picker-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.conversation-picker-main strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-picker-main small {
  color: var(--text-3);
  font-size: 12px;
}
.conversation-picker-arrow {
  color: var(--text-3);
  flex: 0 0 auto;
}

.picker-list {
  max-height: 320px;
  overflow-y: auto;
  margin: 4px -6px;
}
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.picker-item:hover {
  background: var(--hover);
}
.picker-item.selected {
  background: var(--brand-soft);
}
.picker-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: transparent;
}
.picker-item.selected .picker-check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.chosen-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 4px;
}
.chosen-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 3px 6px 3px 4px;
  font-size: 12.5px;
}
.chosen-chip button {
  color: var(--text-3);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(24, 25, 28, 0.92);
  color: #fff;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease-out;
  max-width: 86vw;
  text-align: center;
}
.toast.error {
  background: rgba(190, 40, 45, 0.95);
}
.toast.success {
  background: rgba(6, 140, 72, 0.95);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ctx-menu {
  position: fixed;
  z-index: 150;
  min-width: 150px;
  background: var(--panel);
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  animation: pop 0.12s ease-out;
}
.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
}
.ctx-menu button:hover {
  background: var(--hover);
}
.ctx-menu button.danger {
  color: var(--danger);
}

/* 图片查看器 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.88);
  display: grid;
  place-items: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* 成员卡片视图：仅移动端使用，避免表格在窄屏挤压内容 */
.users-card-view {
  display: none;
}
.user-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 13px;
  margin-bottom: 10px;
}
.uc-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.uc-main {
  flex: 1;
  min-width: 0;
}
.uc-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  flex-wrap: wrap;
}
.uc-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uc-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.uc-dim {
  font-size: 11.5px;
  color: var(--text-3);
}
.uc-ip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  text-align: left;
}
.uc-ip code {
  font-size: 11.5px;
  color: var(--text-2);
  letter-spacing: 0.2px;
}
.uc-ip span {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================ 管理后台 ============================ */

.admin {
  height: 100%;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  background: var(--bg);
}
.admin-nav {
  background: var(--nav-bg);
  color: #cdd5df;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  min-height: 0;
}
.admin-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}
.admin-logo span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.admin-logo img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}
.admin-nav-group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #5f6b7a;
  padding: 12px 10px 6px;
}
.admin-nav button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: #b7c1cd;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.admin-nav button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.admin-nav button.active {
  background: rgba(7, 193, 96, 0.16);
  color: #4ade80;
}
/* 问卷有新答卷时，左侧导航上的小红点（数字） */
.admin-nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px rgba(229, 72, 77, 0.25);
}
.admin-nav-badge[hidden] { display: none; }
/* 问卷列表里每行标题旁的未读数 */
.sv-unread {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  vertical-align: 1px;
  font-variant-numeric: tabular-nums;
}
.sv-unread[hidden] { display: none; }
.admin-nav-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* 抽屉相关元素在桌面端不显示
   注意：.admin-nav button 的优先级高于单一类选择器，这里必须带层级前缀才能压住它 */
.admin-nav .admin-nav-close,
.admin-menu-btn,
.admin-nav-mask {
  display: none;
}
/* 「更多操作」在桌面端也要能点：限制/解除限制放在这个菜单里 */
.ops-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  padding: 0;
  flex: 0 0 auto;
  color: var(--text-2);
}
.ops-trigger:hover {
  color: var(--text);
  background: var(--hover);
}
.admin-menu-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex: 0 0 auto;
}
.admin-menu-btn:hover {
  background: var(--bg);
}

.admin-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-head {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.admin-head h2 {
  font-size: 16px;
  margin: 0;
  flex: 1;
}
.admin-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 40px;
  min-height: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-label {
  font-size: 12.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 8px;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.stat-foot {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 {
  font-size: 14px;
  margin: 0;
  flex: 1;
}
.card-body {
  padding: 14px 16px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  /* 窄屏时给底部留出滚动条空间，避免遮挡最后一行 */
  padding-bottom: 2px;
}
table.data {
  /* 按内容撑开，窄屏下横向滚动而不是把列压成竖排 */
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-weight: 500;
  color: var(--text-3);
  font-size: 11.5px;
  padding: 9px 12px;
  background: var(--table-head);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:last-child td {
  border-bottom: none;
}
table.data tr:hover td {
  background: var(--row-hover);
}
.cell-user {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 140px;
}
.cell-main {
  font-weight: 500;
  white-space: nowrap;
}
.cell-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 1px;
}
.cell-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
}
/* 操作列：始终贴右，横向滚动时也不会被推出视野 */
table.data th.col-ops,
table.data td.col-ops {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 1%;
  white-space: nowrap;
  padding-right: 14px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 12px -10px rgba(0, 0, 0, 0.3);
}
table.data th.col-ops {
  background: var(--table-head);
}
table.data tr:hover td.col-ops {
  background: var(--row-hover);
}
/* 只放图标的方形小按钮 */
.btn.icon-only {
  width: 30px;
  padding: 0;
  justify-content: center;
}

/* ---------- 管理后台玻璃皮肤（覆盖上面的基础样式） ---------- */
.admin {
  background: var(--workspace-bg);
  background-attachment: fixed;
  color: var(--text);
  /* 后台按钮/选中态改用与浅蓝背景、蓝色 Logo 一致的品牌蓝，绿色留给聊天页 */
  --brand: #2f7cf6;
  --brand-dark: #2166d6;
  --brand-soft: #e8f1ff;
}
[data-theme="dark"] .admin {
  --brand: #4c8dff;
  --brand-dark: #6aa2ff;
  --brand-soft: #17263d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .admin {
    --brand: #4c8dff;
    --brand-dark: #6aa2ff;
    --brand-soft: #17263d;
  }
}
.admin .admin-nav {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  backdrop-filter: blur(18px) saturate(1.1);
  border-right: 1px solid var(--glass-border);
  color: var(--text-2);
}
.admin .admin-logo {
  color: var(--text);
}
.admin .admin-logo img {
  filter: drop-shadow(0 6px 14px rgba(16, 60, 110, 0.16));
}
.admin .admin-nav-group {
  color: var(--text-3);
}
.admin .admin-nav button {
  border-radius: 10px;
  color: var(--text-2);
}
.admin .admin-nav button:hover {
  background: var(--hover);
  color: var(--text);
}
.admin .admin-nav button.active {
  background: var(--brand-soft);
  color: color-mix(in srgb, var(--brand) 72%, var(--text));
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand);
}
.admin .admin-nav-foot {
  border-top-color: var(--glass-border);
}
.admin .admin-head {
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  backdrop-filter: blur(18px) saturate(1.1);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px -26px rgba(16, 60, 110, 0.45);
}
.admin .admin-menu-btn:hover {
  background: var(--hover);
}
.admin .admin-body {
  padding-top: 20px;
}
.admin .stat-card {
  background: var(--glass-panel-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 17px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.admin .stat-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 32%, var(--glass-border));
  box-shadow: var(--shadow-md);
}
.admin .stat-label svg {
  color: var(--brand);
}
.admin .stat-value {
  color: var(--text);
}
.admin .card {
  background: var(--glass-panel-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.admin .card-head {
  border-bottom: 1px solid var(--glass-border);
}
.admin .card-head h3 {
  font-size: 14.5px;
}
.admin .card-body {
  padding: 16px 18px;
}
.admin table.data th {
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  color: var(--text-2);
  font-weight: 600;
}
.admin table.data td {
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.admin table.data tr:hover td {
  background: color-mix(in srgb, var(--brand) 7%, transparent);
}
.admin table.data th.col-ops,
.admin table.data td.col-ops {
  background: var(--panel);
  border-left: 1px solid var(--glass-border);
}
.admin table.data th.col-ops {
  background: var(--table-head);
}
.admin table.data tr:hover td.col-ops {
  background: color-mix(in srgb, var(--panel) 90%, var(--brand) 10%);
}
/* 撤回消息标签：内容照常显示，只在旁边追加这句 */
.revoked-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11px;
  color: var(--danger);
  background: var(--danger-soft);
  white-space: nowrap;
  vertical-align: 1px;
}
/* 消息审计表格：正文照旧两行裁切，撤回标签放在裁切外面，长文本也不会把它挤没 */
.admin .msg-audit.has-revoked {
  display: flex;
  align-items: flex-start;
  overflow: visible;
}
.admin .msg-audit.has-revoked .audit-cell-body {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-width: 0;
}
.admin .msg-audit.has-revoked .revoked-tag {
  flex: 0 0 auto;
  margin-top: 1px;
}

/* ---------------- 问卷 ---------------- */
.sv-field { margin-bottom: 14px; }
.sv-field:last-child { margin-bottom: 0; }
.sv-field > label { display: block; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.sv-field .input { width: 100%; }

.sv-q {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--surface-2);
}
.sv-q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sv-q-no { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.sv-q-type { width: auto !important; height: 28px; padding: 0 8px; font-size: 12.5px; }
.sv-req { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-3); }
.sv-q-title { width: 100%; }
.sv-options { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.sv-opt { display: flex; align-items: center; gap: 8px; }
.sv-opt-mark { width: 16px; text-align: center; color: var(--text-3); font-size: 12px; }
.sv-opt .input { flex: 1; height: 32px; }

.sv-user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.sv-user { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.sv-user em { font-style: normal; color: var(--text-3); font-size: 11.5px; }

/* 统计条形图 */
.sv-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 2fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.sv-bar-label { font-size: 13px; word-break: break-word; }
.sv-bar-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.sv-bar-fill { height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s ease; }
.sv-bar-num { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 侧栏「待填问卷」提示条 */
.survey-banner {
  margin: 0 12px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.survey-banner:hover { filter: brightness(.98); }
.survey-banner .sb-count {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--brand);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.survey-banner .sb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 答题弹窗 */
.sv-answer-q { margin-bottom: 20px; }
.sv-answer-q:last-child { margin-bottom: 4px; }
.sv-answer-title { font-size: 14px; font-weight: 500; margin-bottom: 10px; line-height: 1.5; }
.sv-answer-title .sv-need { color: var(--danger); margin-left: 4px; font-weight: 400; font-size: 12px; }
.sv-answer-opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 7px;
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1.5;
}
.sv-answer-opt:hover { border-color: var(--border-strong); }
.sv-answer-opt.checked { border-color: var(--brand); background: var(--brand-soft); }
.sv-answer-opt input { margin-top: 3px; accent-color: var(--brand); }

/* 题目图片（编辑器 / 答题弹窗 / 统计页通用） */
.sv-q-image-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.sv-q-image {
  max-width: 320px;
  max-height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
  object-fit: contain;
  background: var(--surface-2);
}
.sv-answer-text,
.sv-answer-q .sv-answer-text {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 9px 11px;
}
.sv-text-answers { display: flex; flex-direction: column; gap: 7px; }
.sv-text-answer {
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

/* 聊天流里的问卷/投票卡片 */
.card-msg {
  width: min(320px, 76vw);
  padding: 12px 14px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 99px;
  padding: 2px 9px;
  width: fit-content;
}
.card-title { font-size: 14.5px; font-weight: 600; line-height: 1.5; word-break: break-word; }
.card-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.6; word-break: break-word; }
.card-meta { font-size: 11.5px; color: var(--text-3); }
.survey-card .btn { align-self: flex-start; }

.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-opt {
  position: relative;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 8px 11px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color .12s;
}
.poll-opt:hover:not(:disabled) { border-color: var(--brand); }
.poll-opt.chosen { border-color: var(--brand); }
.poll-opt:disabled { cursor: default; opacity: .85; }
.poll-bar {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.poll-bar > span {
  display: block;
  height: 100%;
  background: var(--brand-soft);
  opacity: .55;
}
.poll-opt-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.poll-opt-text { flex: 1; min-width: 0; font-size: 13px; line-height: 1.5; word-break: break-word; }
.poll-opt-num { font-size: 11px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.poll-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.poll-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.poll-foot > .card-meta { flex: 1 1 110px; }


/* 数字列：右对齐 + 等宽数字，纵向才能对齐 */
table.data th.num,
table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 中等宽度屏幕（1024~1200）：表格收紧，避免出现横向滚动条 */
@media (max-width: 1200px) {
  table.data {
    font-size: 12.5px;
  }
  table.data th,
  table.data td {
    padding: 9px 9px;
  }
  .cell-actions {
    gap: 4px;
  }
  .cell-actions .btn.sm {
    padding: 0 8px;
  }
}
/* 再窄一点就藏掉「最后在线」列：这列信息量最低，藏掉能省出一条操作列的空间 */
@media (max-width: 1080px) {
  .users-table-view table.data th:nth-child(7),
  .users-table-view table.data td:nth-child(7) {
    display: none;
  }
}
.msg-audit {
  max-width: 460px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 操作日志的详情列：单行省略，完整内容看 title */
.log-detail {
  max-width: 420px;
  font-size: 12.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.admin-toolbar .input {
  height: 36px;
  width: auto;
  min-width: 200px;
  flex: 0 1 280px;
}
.admin-toolbar select.input {
  min-width: 130px;
  flex: 0 0 auto;
}
.admin-toolbar .sort-direction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.pager {
  display: flex;
  justify-content: center;
  padding: 14px;
}

/* 审计对话视图 */
.audit-chat {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 210px);
  min-height: 320px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
}
.audit-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}
.audit-msg {
  display: flex;
  gap: 9px;
  margin-bottom: 12px;
}
.audit-msg .msg-meta {
  font-size: 11.5px;
  color: var(--text-3);
  margin-bottom: 3px;
}
.audit-msg .bubble {
  box-shadow: none;
  background: var(--panel);
}

/* 后台消息里的图片缩略图 */
.audit-thumb {
  display: inline-block;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.audit-thumb:hover {
  border-color: var(--accent);
}
.audit-thumb img {
  display: block;
  max-width: min(260px, 46vw);
  max-height: 260px;
  width: auto;
  height: auto;
}
.audit-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 12.5px;
  word-break: break-all;
}
.audit-file:hover {
  text-decoration: underline;
}
/* 表格里的“最新消息 / 消息审计”只给一个小缩略图 */
.msg-audit .audit-thumb img {
  max-width: 52px;
  max-height: 52px;
  object-fit: cover;
  border-radius: 6px;
}
.msg-audit .audit-file {
  font-size: 12px;
}

/* 后台设置项：单选列表（图片压缩档位等） */
.opt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.opt-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}
.opt-item:hover {
  border-color: var(--border-strong);
}
.opt-item.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.opt-item input {
  margin-top: 2px;
  accent-color: var(--brand);
}
.opt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.opt-text strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.opt-text em {
  font-style: normal;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}
.opt-meta {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 附件文件已从磁盘上消失时的兜底提示（历史遗留裂图） */
.media-broken {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  height: 64px;
  padding: 0 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  color: var(--text-3);
  font-size: 12px;
  background: var(--surface-2);
}

/* ============================ 响应式 ============================ */

@media (max-width: 900px) {
  :root {
    --sidebar-w: 280px;
  }
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    display: none;
  }
  .auth > .auth-mini-brand {
    position: absolute;
    top: max(16px, max(env(safe-area-inset-top), var(--zz-safe-top, 0px)));
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    margin: 0 auto;
    padding: 6px 15px 6px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 28px rgba(31, 70, 41, 0.14);
    backdrop-filter: blur(14px) saturate(130%);
    -webkit-backdrop-filter: blur(14px) saturate(130%);
    color: #14527c;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.6px;
    pointer-events: none;
    transition: opacity 0.55s ease 0.12s;
  }
  .auth > .auth-mini-brand img {
    width: 26px;
    height: 26px;
    object-fit: contain;
  }
  .auth:not(.auth-ready) > .auth-mini-brand {
    opacity: 0;
  }
  .auth-panel {
    padding: 32px 24px;
  }
}

@media (max-width: 720px) {
  .auth {
    background: #b7d3e9;
  }
  .auth::before {
    background-image: url('/assets/login-mobile.webp?v=20261115-2110'), var(--login-mobile-lqip);
    background-position: center center;
    background-size: cover;
    opacity: 0.96;
  }
  .auth.auth-ready::before {
    opacity: 0.78;
  }
  .auth::after {
    background: linear-gradient(180deg, rgba(250, 253, 255, 0.02) 0%, rgba(250, 253, 255, 0.08) 42%, rgba(150, 190, 222, 0.18) 100%);
  }
  .auth-panel {
    align-items: flex-end;
    justify-content: center;
    padding: 18px 18px max(18px, max(env(safe-area-inset-bottom), var(--zz-safe-bottom, 0px)));
    background: transparent;
    backdrop-filter: none;
  }
  .auth-card {
    max-width: 380px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.56);
    box-shadow:
      0 22px 64px rgba(31, 70, 41, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
  }
  .auth-card h1 { font-size: 24px; }
  .auth-card .lead { margin-bottom: 18px; }
  .auth-form { gap: 12px; }
  .auth-tabs { margin-bottom: 18px; }
  .auth-trust-device { padding: 8px 10px; }
  .shell {
    grid-template-columns: minmax(0, 1fr);
    position: relative;
  }
  .chat {
    background: color-mix(in srgb, var(--panel) 84%, transparent);
    backdrop-filter: blur(12px) saturate(125%);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
  }
  .shell.panel-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .panel {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: none;
    border-left: none;
    z-index: 45;
  }
  .sidebar {
    border-right: none;
  }
  .chat {
    position: absolute;
    inset: 0;
    z-index: 30;
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
    visibility: hidden;
  }
  .chat-head {
    height: 56px;
    padding: 0 10px;
    padding-top: max(env(safe-area-inset-top), var(--zz-safe-top, 0px));
    height: calc(56px + max(env(safe-area-inset-top), var(--zz-safe-top, 0px)));
  }
  .chat-head-actions { gap: 0; }
  .chat-head-actions .icon-btn { width: 38px; height: 38px; }
  .sidebar { padding-top: max(env(safe-area-inset-top), var(--zz-safe-top, 0px)); }
  body.mobile-chat-open .chat {
    transform: none;
    visibility: visible;
  }
  body.mobile-chat-open .sidebar {
    transform: translateX(-18%);
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .back-btn {
    display: grid;
  }
  .msg-list {
    padding: 0 12px;
  }
  .msg-body {
    max-width: min(82%, 420px);
  }
  .composer {
    padding: 7px 10px calc(8px + max(env(safe-area-inset-bottom), var(--zz-safe-bottom, 0px)));
    background: var(--glass);
    backdrop-filter: blur(10px);
  }
  .composer-tools { gap: 1px; }
  .composer-tools .icon-btn { width: 38px; height: 38px; }
  .composer-input { gap: 7px; }
  .composer textarea { min-height: 40px; max-height: 112px; font-size: 16px; }
  .send-btn { min-width: 54px; height: 40px; }
  .composer-hint {
    display: none;
  }
  .panel {
    width: 100%;
    max-width: none;
    border-left: none;
  }
  .sticker-panel {
    left: 6px;
    right: 6px;
    max-height: 52dvh;
    padding: 10px;
  }
  .sticker-grid { grid-template-columns: repeat(5, minmax(52px, 1fr)); gap: 7px; }
  .admin {
    grid-template-columns: 1fr;
  }

  /* 移动端导航改为左侧抽屉，避免 9 个菜单挤成一排看不全 */
  .admin-menu-btn {
    display: inline-flex;
  }
  .admin-nav {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 250px;
    max-width: 82vw;
    z-index: 70;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    padding: calc(14px + max(env(safe-area-inset-top), var(--zz-safe-top, 0px))) 12px calc(14px + max(env(safe-area-inset-bottom), var(--zz-safe-bottom, 0px)));
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.28);
  }
  .admin-nav.open {
    transform: translateX(0);
  }
  .admin-logo {
    display: flex;
    padding: 4px 6px 16px;
  }
  .admin-logo img {
    width: 26px;
    height: 26px;
  }
  .admin-logo span {
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .admin-nav .admin-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    margin-left: auto;
    border-radius: 7px;
    color: #9aa6b4;
  }
  .admin-nav .admin-nav-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }
  .admin-nav-group {
    display: block;
    padding: 10px 10px 4px;
  }
  .admin-nav button {
    width: 100%;
    white-space: nowrap;
    padding: 10px 10px;
    font-size: 14px;
  }
  .admin-nav-foot {
    margin: 12px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 0 0;
  }
  .admin-nav-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .admin-nav-mask.open {
    opacity: 1;
    pointer-events: auto;
  }
  body.admin-nav-open {
    overflow: hidden;
  }

  /* 抽屉也沿用玻璃皮肤，别退回原来的纯黑侧栏 */
  .admin .admin-nav {
    box-shadow: 24px 0 60px -30px rgba(16, 40, 70, 0.45);
  }
  .admin .admin-nav .admin-nav-close {
    color: var(--text-3);
  }
  .admin .admin-nav .admin-nav-close:hover {
    background: var(--hover);
    color: var(--text);
  }
  .admin .admin-nav-foot {
    border-top-color: var(--glass-border);
  }
  .admin .admin-nav-mask {
    background: rgba(20, 40, 70, 0.32);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }

  .admin-head {
    height: 54px;
    padding: 0 10px 0 8px;
    gap: 8px;
  }
  .admin-head h2 {
    font-size: 15px;
  }
  .admin-head .btn span {
    display: none;
  }
  .admin-body {
    padding: 14px 10px calc(28px + max(env(safe-area-inset-bottom), var(--zz-safe-bottom, 0px)));
  }

  /* 表格在窄屏保持可读，横向滚动查看其余列 */
  .table-wrap {
    border-radius: 10px;
  }
  table.data {
    font-size: 12.5px;
  }
  table.data th,
  table.data td {
    padding: 9px 10px;
    /* 窄屏强制不换行，靠横向滚动查看，避免列被压成一个字 */
    white-space: nowrap;
  }
  table.data td.wrap {
    white-space: normal;
    min-width: 180px;
    max-width: 260px;
  }
  /* 操作列固定在右侧，横向滑动时按钮始终可见 */
  table.data th.col-ops,
  table.data td.col-ops {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--panel);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 12px -10px rgba(0, 0, 0, 0.3);
  }
  table.data th.col-ops {
    background: var(--table-head);
  }
  table.data tr:hover td.col-ops {
    background: var(--row-hover);
  }
  /* 卡片里的「更多」按钮 */
  .user-card .ops-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    padding: 0;
  }

  /* 表格视图在移动端让位给卡片视图 */
  .users-table-view {
    display: none;
  }
  .users-card-view {
    display: block;
  }
  /* 让横向滚动条可见，提示还有内容 */
  .table-wrap::-webkit-scrollbar {
    height: 5px;
  }
  .table-wrap::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 3px;
  }
  .table-wrap::-webkit-scrollbar-track {
    background: transparent;
  }

  .audit-chat {
    height: calc(100dvh - 300px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 720px) {
  .toast-host {
    bottom: auto;
    top: 44%;
  }
  /* 后台统计卡：固定两列，奇数张时最后一张占满整行，避免孤零零吊在一侧 */
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .stat-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .stat-card {
    padding: 13px 14px;
  }
  .stat-value {
    font-size: 21px;
    letter-spacing: -0.5px;
    margin-top: 6px;
    word-break: break-all;
  }
  .stat-label,
  .stat-foot {
    font-size: 11.5px;
  }
}

@media (max-width: 360px) {
  .side-actions .btn span {
    display: none;
  }
}

/* 外观切换（个人设置内） */
.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.theme-row-label {
  font-size: 13px;
  color: var(--text-2);
}
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-2);
}
.seg button {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  background: transparent;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.seg button.on {
  background: var(--panel);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* ntfy 手机推送引导 */
.ntfy-intro {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
}
.ntfy-steps {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-2);
}
.ntfy-steps b {
  color: var(--text);
  font-weight: 600;
}
.ntfy-topic {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  letter-spacing: 0.3px;
  color: var(--text);
  word-break: break-all;
  text-align: center;
  user-select: all;
}
.ntfy-note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-3);
}

/* 全站公告 */
.announce-modal {
  max-width: min(440px, calc(100vw - 40px));
}
.announce-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}
.announce-body {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  max-height: 52vh;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.announce-foot {
  display: flex;
  gap: 10px;
}
.announce-foot .btn {
  flex: 1;
}
/* 弹窗打开时浏览器会把焦点放到第一个按钮上，默认描边太重 */
.modal:focus {
  outline: none;
}
.modal .btn:focus-visible,
.modal .icon-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 50%, transparent);
  outline-offset: 2px;
}

/* 未读分隔条 */
.unread-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 16px 6px;
  color: var(--brand-dark);
  font-size: 11.5px;
}
.unread-divider::before,
.unread-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--brand-soft);
}
.unread-divider span {
  padding: 3px 10px;
  border-radius: 10px;
  background: var(--brand-soft);
  white-space: nowrap;
}

/* 语音消息 */
.bubble.voice {
  padding: 0;
  background: transparent;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
/* 气泡与「转文字」按钮：按钮脱离文档流，浮在气泡外侧，不占气泡空间 */
.voice-row {
  position: relative;
  display: flex;
  align-items: center;
}
/* 自己发的消息气泡靠右，按钮浮到左侧 */
.msg.self .bubble.voice {
  align-items: flex-end;
}
.voice-asr {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: calc(100% + 12px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.1);
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}
/* 自己发的：按钮浮到气泡左边 */
.msg.self .voice-asr {
  left: auto;
  right: calc(100% + 12px);
}
.voice-asr:hover {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: transparent;
  transform: translateY(-50%) scale(1.08);
}
.voice-asr:disabled {
  opacity: 0.6;
  cursor: default;
}
.voice-asr.loading {
  animation: asrPulse 1s ease-in-out infinite;
}
@keyframes asrPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.3; }
}
.voice-text {
  max-width: 250px;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--surface-2);
  word-break: break-word;
}
.voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--bubble-other);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background 0.15s;
}
.msg.self .voice-btn {
  background: var(--bubble-self);
  border-color: transparent;
  color: var(--bubble-self-text);
}
.voice-btn .voice-icon {
  display: inline-flex;
  opacity: 0.85;
}
.voice-btn .voice-dur {
  font-size: 12.5px;
  color: inherit;
  opacity: 0.75;
  margin-left: auto;
}
.voice-btn.playing .voice-icon {
  animation: voicePulse 0.9s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { opacity: 0.45; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* 录音状态条 */
.recording-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}
.recording-bar .spacer {
  flex: 1;
}
.recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: recBlink 1s ease-in-out infinite;
  flex: 0 0 auto;
}
.recording-hint {
  color: var(--text-3);
  font-size: 12px;
}
@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
#btn-voice.recording {
  color: var(--danger);
  background: var(--danger-soft);
}

/* 弹窗内的用户选择搜索框 */.picker-search {
  position: relative;
  padding: 0 0 10px;
}
.picker-search svg {
  position: absolute;
  left: 12px;
  top: 9px;
  color: var(--text-3);
  pointer-events: none;
}
.picker-search input {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  padding: 0 12px 0 34px;
  font-size: 13.5px;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}
.picker-search input:focus {
  background: var(--panel);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

/* 成员选择：分组标题与全选 */
.picker-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  font-size: 11.5px;
  color: var(--text-3);
}
.picker-all button {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 500;
}

/* 同频独立游戏页 */
.sync-game-page { min-height: 100%; background: var(--bg); }
.sync-game-root { min-height: 100dvh; padding: max(14px, max(env(safe-area-inset-top), var(--zz-safe-top, 0px))) 18px max(22px, max(env(safe-area-inset-bottom), var(--zz-safe-bottom, 0px))); }
.sync-shell { width: min(100%, 760px); min-height: calc(100dvh - 36px); margin: 0 auto; display: flex; flex-direction: column; }
.sync-header { display: flex; align-items: center; gap: 9px; min-height: 44px; color: var(--text-2); font-size: 13px; }
.sync-brand { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 700; font-size: 14px; }
.sync-brand img { width: 24px; height: 24px; border-radius: 6px; object-fit: contain; flex: 0 0 auto; }
.sync-header-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.sync-header-back { margin-left: auto; color: var(--text-2); font-size: 12.5px; }
.sync-header-back:hover { color: var(--brand-dark); }
.sync-players-rail {
  width: min(100%, 590px);
  margin: 4px auto 0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.sync-rail-player { min-width: 0; display: flex; align-items: center; gap: 7px; }
.sync-rail-player .avatar { --size: 34px; border-radius: 9px; }
.sync-rail-name { max-width: 112px; overflow: hidden; color: var(--text); font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sync-rail-player.is-me .sync-rail-name { color: var(--brand-dark); }
.sync-rail-vs { color: var(--text-3); font-size: 10px; font-weight: 700; letter-spacing: .5px; }
.sync-rail-empty { width: 34px; height: 34px; display: grid; place-items: center; border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--text-3); font-size: 15px; }
.sync-room-head,
.sync-game-top,
.sync-result-head { padding: clamp(22px, 5vw, 48px) 8px 18px; text-align: center; }
.sync-hero-icon {
  width: 76px;
  height: 76px;
  display: block;
  margin: 0 auto 12px;
  border-radius: 19px;
  box-shadow: 0 8px 22px rgba(214, 143, 24, .28);
}
.sync-eyebrow { color: var(--brand-dark); font-size: 12px; font-weight: 650; }
.sync-room-head h1,
.sync-game-top h1,
.sync-result-head h1,
.sync-invite-card h1,
.sync-notice h1 { margin: 9px 0 8px; color: var(--text); font-size: 30px; line-height: 1.25; font-weight: 700; }
.sync-room-head p,
.sync-game-top p,
.sync-result-head p,
.sync-invite-card p,
.sync-notice p { max-width: 520px; margin: 0 auto; color: var(--text-2); font-size: 13.5px; line-height: 1.7; }
.sync-lobby,
.sync-input-panel,
.sync-guess-panel,
.sync-invite-card,
.sync-notice { width: 100%; max-width: 590px; margin: 0 auto; padding: clamp(18px, 4vw, 30px); border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow-sm); }
.sync-lobby-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); color: var(--text-3); font-size: 12px; }
.sync-countdown b { color: var(--warning-text); font-variant-numeric: tabular-nums; font-size: 14px; }
.sync-countdown.expired b { color: var(--danger); }
.sync-player-grid { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); align-items: center; gap: 8px; padding: 24px 0 18px; }
.sync-player-slot { min-width: 0; min-height: 156px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); text-align: center; }
button.sync-player-slot { cursor: pointer; }
button.sync-empty-slot:hover,
button.sync-empty-slot:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.sync-player-avatar { display: flex; align-items: center; justify-content: center; background: none; }
.sync-player-avatar .avatar { box-shadow: 0 5px 14px rgba(32, 49, 42, 0.12); }
.sync-player-slot.is-me .sync-player-avatar .avatar { outline: 2px solid var(--brand); outline-offset: 2px; }
.sync-empty-slot .sync-plus { width: 42px; height: 42px; display: grid; place-items: center; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--brand-dark); }
.sync-player-slot strong { max-width: 100%; overflow: hidden; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.sync-player-slot small { color: var(--text-3); font-size: 11.5px; }
.sync-player-divider { text-align: center; color: var(--text-3); font-size: 14px; font-weight: 650; }
.sync-waiting-note { display: flex; justify-content: center; align-items: center; gap: 7px; color: var(--text-2); font-size: 12px; }
.sync-waiting-note i { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.sync-previous { width: fit-content; max-width: 100%; margin: 18px auto 0; padding: 9px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); font-size: 12px; }
.sync-previous > span:first-child { color: var(--text-3); }
.sync-previous strong { max-width: 130px; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.sync-prev-mark { color: var(--danger); font-size: 19px; font-weight: 700; }
.sync-prev-mark.matched { color: var(--brand-dark); }
.sync-word-form { display: flex; flex-direction: column; gap: 10px; }
.sync-word-form label,
.sync-guest-label { color: var(--text-2); font-size: 12.5px; }
.sync-word-input { height: 54px; padding: 0 15px; font-size: 19px; text-align: center; }
.sync-word-meta { display: flex; justify-content: space-between; color: var(--text-3); font-size: 11.5px; }
.sync-word-form .btn { min-height: 42px; margin-top: 4px; }
.sync-round-meta { margin-top: 20px; padding-top: 13px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 11.5px; text-align: center; }
.sync-submitted { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.sync-check-ring { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); }
.sync-submitted strong { margin-top: 12px; color: var(--text); font-size: 15px; }
.sync-submitted p { margin: 5px 0 0; color: var(--text-3); font-size: 12.5px; line-height: 1.6; }
.sync-word-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sync-word-side { min-width: 0; min-height: 122px; padding: 16px 12px; display: flex; flex-direction: column; justify-content: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); text-align: center; }
.sync-word-side span { color: var(--text-3); font-size: 12px; }
.sync-word-side strong { overflow-wrap: anywhere; color: var(--text); font-size: 20px; }
.sync-guess-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.sync-choice { min-height: 70px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 13.5px; font-weight: 600; }
.sync-choice.same { border-color: #b9e5ce; color: var(--brand-dark); }
.sync-choice.different { border-color: #f0c7c7; color: #b6434a; }
.sync-choice:hover { background: var(--surface-2); }
.sync-result-head { padding-bottom: 22px; }
.sync-result-symbol { width: 58px; height: 58px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); font-size: 34px; font-weight: 700; }
.sync-result-list { display: flex; flex-direction: column; gap: 10px; }
.sync-result-round { position: relative; min-height: 150px; padding: 12px 16px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.sync-result-round-title { color: var(--text-3); font-size: 11.5px; }
.sync-result-player { min-width: 0; min-height: 45px; display: flex; align-items: center; gap: 10px; }
.sync-result-player.left { margin-top: 3px; }
.sync-result-player.right { margin-top: 15px; }
.sync-result-player span { width: min(32%, 150px); overflow: hidden; color: var(--text-3); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.sync-result-player strong { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-size: 15px; }
.sync-result-mark { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; display: grid; place-items: center; transform: translate(-50%, -15%); border: 1px solid var(--border); border-radius: 50%; background: var(--panel); font-size: 17px; font-weight: 700; }
.sync-result-mark.matched { border-color: #b9e5ce; color: var(--brand-dark); }
.sync-result-mark.missed { border-color: #f0c7c7; color: #b6434a; }
.sync-result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; padding: 18px 0 8px; }
.sync-result-actions .btn { min-height: 38px; }
.sync-invite-card { max-width: 470px; margin-top: clamp(26px, 8vh, 75px); text-align: center; }
.sync-invite-orbit { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.sync-invite-orbit span { width: 46px; height: 46px; display: grid; place-items: center; border: 3px solid var(--panel); border-radius: 12px; background: var(--brand); color: #fff; font-size: 21px; font-weight: 700; }
.sync-invite-orbit span + span { margin-left: -7px; background: #f0a454; }
.sync-invite-card .sync-eyebrow { margin-bottom: 4px; }
.sync-invite-player { margin: 18px 0 12px; color: var(--brand-dark); font-size: 13px; font-weight: 600; }
.sync-invite-card .sync-guest-label { display: block; margin: 20px 0 7px; text-align: left; }
.sync-invite-card .btn { min-height: 44px; margin-top: 16px; }
.sync-signin-link { display: inline-block; margin-top: 15px; color: var(--text-3); font-size: 11.5px; }
.sync-signin-link:hover { color: var(--brand-dark); }
.sync-notice { max-width: 480px; margin-top: clamp(30px, 12vh, 100px); text-align: center; }
.sync-notice .sync-mark { color: var(--brand-dark); }
.sync-notice .btn { margin-top: 18px; }
.sync-share-modal { max-width: 430px; }
.sync-share-options { display: flex; flex-direction: column; gap: 7px; padding-bottom: 14px; }
.sync-share-option { min-height: 62px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--brand-dark); text-align: left; }
.sync-share-option:hover { background: var(--surface-2); border-color: var(--border-strong); }
.sync-share-option > span { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.sync-share-option strong { color: var(--text); font-size: 13px; }
.sync-share-option small { color: var(--text-3); font-size: 11.5px; }
.sync-footer { margin-top: auto; padding: 26px 0 8px; color: var(--text-3); font-size: 11px; text-align: center; }

/* 同频计时、历史词阵与动效 */
.sync-timer-row {
  margin: 10px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.sync-timer-row b { color: var(--text); font-size: 13px; }
.sync-timer-row.danger { border-color: #f0c7c7; background: rgba(240, 199, 199, 0.22); color: #b6434a; }
.sync-timer-row.danger b { color: #b6434a; }

.sync-history { margin-top: 16px; padding: 0; border: 0; background: transparent; }
.sync-history.compact { max-height: none; overflow: visible; }
.sync-history-title { margin-bottom: 8px; color: var(--text-3); font-size: 11.5px; text-align: center; }
.sync-history-head, .sync-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.sync-history-head { padding: 0 2px 7px; color: var(--text-3); font-size: 11.5px; }
.sync-history-head span:nth-child(2) { text-align: center; }
.sync-history-head span:last-child { text-align: right; }
.sync-history-list { display: flex; flex-direction: column; gap: 5px; }
.sync-history-row {
  min-height: 38px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  animation: sync-row-in .28s ease both;
  animation-delay: calc(var(--row-index, 0) * 35ms);
}
.sync-history-word {
  min-width: 0;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 5px 9px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: center;
}
.sync-history-word.left { background: #efe9ff; color: #5b3e8e; }
.sync-history-word.right { background: #e4f8ef; color: #176c4b; }
.sync-history-mark {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border: 0;
  background: transparent;
  font-size: 22px;
  font-weight: 500;
  animation: sync-mark-in .24s ease both;
}
.sync-history-mark.matched { color: #1a9b63; }
.sync-history-mark.missed { color: #9ca3af; }
.sync-review-panel {
  width: 100%;
  max-width: 590px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 30px);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  text-align: center;
  animation: sync-panel-in .28s ease both;
}
.sync-review-panel h1 { margin: 9px 0 8px; color: var(--text); font-size: 26px; line-height: 1.25; }
.sync-review-panel p { margin: 0 auto 14px; max-width: 480px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.sync-review-panel .btn { min-height: 40px; }
.sync-word-pair.reveal { animation: sync-panel-in .3s ease both; }
.sync-word-pair.reveal .sync-word-side { animation: sync-word-in .32s ease both; }
.sync-word-pair.reveal .sync-word-side.right { animation-delay: .08s; }
.sync-empty-result { padding: 20px 12px; color: var(--text-3); font-size: 12.5px; text-align: center; }

@keyframes sync-panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sync-row-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sync-word-in {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes sync-mark-in {
  0% { opacity: 0; transform: scale(.55); }
  65% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

/* 聊天流里的同频邀请卡片 */
.sync-game-card { text-decoration: none; }
.sync-game-card-hero {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sync-game-card-copy { min-width: 0; flex: 1; }
.sync-game-card-copy .card-desc { margin-top: 3px; }
.sync-game-card-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  margin-top: 2px;
  padding: 8px 10px;
  border: 1px solid #b9e5ce;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.sync-game-card-link:hover { background: rgba(7, 193, 96, .18); }
.sync-game-card-mark { flex: none; display: block; }
.sync-game-card-mark img {
  width: 56px;
  height: 56px;
  display: block;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(214, 143, 24, .28);
}

@media (max-width: 560px) {
  .sync-game-root { padding-left: 12px; padding-right: 12px; }
  .sync-shell { min-height: calc(100dvh - 36px); }
  .sync-room-head, .sync-game-top, .sync-result-head { padding-top: 28px; }
  .sync-room-head h1, .sync-game-top h1, .sync-result-head h1, .sync-invite-card h1, .sync-notice h1 { font-size: 25px; }
  .sync-lobby, .sync-input-panel, .sync-guess-panel, .sync-invite-card, .sync-notice { padding: 18px 15px; }
  .sync-player-grid { grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr); gap: 5px; padding: 17px 0 15px; }
  .sync-player-slot { min-height: 140px; padding: 12px 5px; }
  .sync-player-slot strong { font-size: 12.5px; }
  .sync-word-pair { gap: 8px; }
  .sync-word-side { min-height: 108px; padding: 13px 8px; }
  .sync-word-side strong { font-size: 18px; }
  .sync-guess-actions { gap: 7px; }
  .sync-choice { min-height: 64px; flex-direction: column; gap: 4px; font-size: 12px; }
  .sync-result-round { padding-left: 12px; padding-right: 12px; }
  .sync-result-player span { width: 28%; font-size: 10.5px; }
  .sync-result-player strong { font-size: 14px; }
  .sync-timer-row { gap: 4px; padding: 4px 8px; font-size: 11.5px; }
  .sync-timer-row b { font-size: 12.5px; }
  .sync-players-rail { width: 100%; gap: 7px; padding: 7px 9px; }
  .sync-rail-player { gap: 5px; }
  .sync-rail-player .avatar { --size: 30px; border-radius: 8px; }
  .sync-rail-name { max-width: 82px; font-size: 11.5px; }
  .sync-history { margin-top: 12px; padding: 9px; }
  .sync-history.compact { max-height: none; }
  .sync-history-head, .sync-history-row { grid-template-columns: minmax(0, 1fr) 25px minmax(0, 1fr); gap: 4px; }
  .sync-history-row { min-height: 44px; padding: 3px; gap: 3px; }
  .sync-history-word { min-height: 38px; padding: 5px 6px; font-size: 14px; }
  .sync-history-mark { width: 23px; height: 23px; font-size: 14px; }
  .sync-review-panel h1 { font-size: 22px; }
}

/* 小游戏入口：十款游戏 + 同频，3 列九宫格。图标 58px 在上、名字在下，
   手机（≤420px 模态）也保持三列，只是把图标和字号收小一档。 */
.minigame-menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.minigame-tile {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  min-height: 96px;
  padding: 12px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.minigame-tile:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 10px 22px rgba(16, 24, 40, .1); }
.minigame-tile:active { transform: translateY(0) scale(.98); }
.minigame-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.minigame-tile-icon { display: grid; place-items: center; width: 58px; height: 58px; }
.minigame-tile-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.minigame-tile-name { max-width: 100%; overflow: hidden; font-size: 12.5px; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.minigame-tile-sync { border-style: dashed; border-color: var(--border-strong); background: var(--surface-2); }
.minigame-tile-sync:hover { border-color: var(--brand); background: var(--surface); }
.minigame-tile-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .02em;
}
@media (max-width: 420px) {
  .minigame-menu-grid { gap: 8px; }
  .minigame-tile { min-height: 84px; padding: 10px 4px 8px; border-radius: 14px; gap: 4px; }
  .minigame-tile-icon { width: 46px; height: 46px; }
  .minigame-tile-name { font-size: 11.5px; }
  .minigame-tile-badge { top: 5px; right: 5px; padding: 0 4px; font-size: 8.5px; }
}

/* ---------------- 考试 ---------------- */
/* 考试相关的强调色统一用蓝色，和全站绿色品牌区分开；选项卡片选中必须是蓝色。 */
:root {
  --exam-blue: #2f6bff;
  --exam-blue-dark: #1d54e0;
  --exam-soft: #eef4ff;
  --exam-line: #b9cdfb;
}
[data-theme="dark"] {
  --exam-blue: #5b8cff;
  --exam-blue-dark: #7aa2ff;
  --exam-soft: #16233f;
  --exam-line: #33518f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --exam-blue: #5b8cff;
    --exam-blue-dark: #7aa2ff;
    --exam-soft: #16233f;
    --exam-line: #33518f;
  }
}

/* 侧栏「待参加考试」提示条 */
.exam-banner {
  margin: 0 12px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--exam-soft);
  border: 1px solid var(--exam-line);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.exam-banner:hover { filter: brightness(.98); }
.exam-banner .eb-count {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--exam-blue);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.exam-banner .eb-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.exam-banner .eb-text b {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exam-banner .eb-text em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-3);
}
.exam-banner .eb-go {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--exam-blue-dark);
  font-weight: 600;
}

/* 聊天流里的考试卡片 */
.exam-card { border-left: 3px solid var(--exam-blue); }
.exam-card .card-tag { color: var(--exam-blue-dark); background: var(--exam-soft); }
.exam-card .exam-card-btn {
  align-self: flex-start;
  text-decoration: none;
  background: var(--exam-blue);
  border-color: var(--exam-blue);
}
.exam-card .exam-card-btn:hover { background: var(--exam-blue-dark); border-color: var(--exam-blue-dark); }

/* 管理端出题编辑器 */
.ex-q {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface-2);
}
.ex-q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ex-q-no { font-size: 12.5px; font-weight: 600; color: var(--exam-blue-dark); }
.ex-q-type { width: auto !important; height: 28px; padding: 0 8px; font-size: 12.5px; }
.ex-q-score { width: 64px !important; height: 28px !important; padding: 0 8px; font-size: 12.5px; }
.ex-score-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); }
.ex-q-title { width: 100%; }
.ex-opt-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.ex-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  transition: border-color .12s, background .12s;
}
.ex-opt.is-correct { border-color: var(--exam-line); background: var(--exam-soft); }
.ex-opt .input { flex: 1; height: 32px; }
.ex-correct {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.ex-correct input { accent-color: var(--exam-blue); cursor: pointer; }
.ex-opt.is-correct .ex-correct { color: var(--exam-blue-dark); font-weight: 600; }
.ex-opt-mark { width: 16px; text-align: center; color: var(--text-3); font-size: 12px; }

/* 管理端统计 */
.ex-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ex-summary .item {
  min-width: 108px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.ex-summary .item b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.ex-summary .item span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-3); }
.ex-bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.4fr) 2fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.ex-bar-label { font-size: 13px; word-break: break-word; }
.ex-bar-label em { font-style: normal; color: var(--exam-blue-dark); font-size: 11px; margin-left: 4px; }
.ex-bar-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.ex-bar-fill { height: 100%; background: var(--exam-blue); border-radius: 99px; transition: width .3s ease; }
.ex-bar-fill.wrong { background: var(--border-strong); }
.ex-bar-num { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex-pass { color: #12a150; font-weight: 600; }
.ex-fail { color: var(--danger); font-weight: 600; }

/* 考试分数排行榜名次徽标 */
.ex-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ex-rank-1 { background: #fff1c9; color: #8a5a00; box-shadow: inset 0 0 0 1px #f0d28a; }
.ex-rank-2 { background: #f1f3f6; color: #4b5563; box-shadow: inset 0 0 0 1px #d7dce3; }
.ex-rank-3 { background: #fbe9dd; color: #8a4b22; box-shadow: inset 0 0 0 1px #ecc7ae; }
[data-theme="dark"] .ex-rank-1 { background: #3a2f14; color: #f5cf6b; box-shadow: inset 0 0 0 1px #6b5620; }
[data-theme="dark"] .ex-rank-2 { background: #2a3038; color: #c6ced9; box-shadow: inset 0 0 0 1px #444d59; }
[data-theme="dark"] .ex-rank-3 { background: #35251b; color: #e0aa86; box-shadow: inset 0 0 0 1px #6b4530; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ex-rank-1 { background: #3a2f14; color: #f5cf6b; box-shadow: inset 0 0 0 1px #6b5620; }
  :root:not([data-theme="light"]) .ex-rank-2 { background: #2a3038; color: #c6ced9; box-shadow: inset 0 0 0 1px #444d59; }
  :root:not([data-theme="light"]) .ex-rank-3 { background: #35251b; color: #e0aa86; box-shadow: inset 0 0 0 1px #6b4530; }
}
