:root {
  --bg-deep: #0a2a26;
  --bg-mid: #12443c;
  --bg-soft: #f5f7f6;
  --surface: #ffffff;
  --ink: #14201e;
  --ink-muted: #5a6e69;
  --accent: #1a7a68;
  --accent-deep: #0e5a4c;
  --accent-soft: #e8f4f0;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --bubble-me: #1a7a68;
  --bubble-other: #ffffff;
  --shadow: 0 12px 40px rgba(10, 42, 38, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "ZCOOL XiaoWei", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --p1: #1a7a68; --p2: #2f6fed; --p3: #c45c26; --p4: #7a4dbf;
  --p5: #b42318; --p6: #0e7490; --p7: #a16207; --p8: #be185d;
  --p9: #365314; --p10: #1e3a5f; --p11: #9a3412; --p12: #4c1d95;
}

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

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-tap-highlight-color: transparent;
}

body { overscroll-behavior: none; }

#app {
  min-height: 100%;
  min-height: 100dvh;
  height: 100dvh;
  max-width: 920px;
  margin: 0 auto;
  position: relative;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  min-height: 0;
  height: 100%;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; }

#screen-chat {
  min-height: 0;
  position: relative;
  flex-direction: row;
}
.rooms-rail {
  width: 260px;
  flex-shrink: 0;
  background: #fafbfb;
  border-right: 1px solid rgba(20, 32, 30, 0.06);
  overflow: hidden;
  padding: 0.55rem 0.45rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rooms-rail[hidden],
#screen-chat.no-rooms-rail .rooms-rail {
  display: none !important;
}
.rooms-rail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-content: flex-start;
}
.rail-owner-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  margin: 0;
}
.rail-owner-actions[hidden] {
  display: none !important;
}
.rail-owner-actions .rail-create-btn {
  flex: none;
  width: 100%;
  min-width: 0;
  margin: 0;
}
.sidebar-rooms-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.rail-log-btn {
  appearance: none;
  border: 1px solid rgba(20, 32, 30, 0.08);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  padding: 0.28rem 0.45rem;
  margin-top: 0.25rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  box-sizing: border-box;
  min-height: 0;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.rail-log-btn:hover {
  background: #e8f6f1;
  border-color: rgba(26, 122, 104, 0.35);
  box-shadow: 0 2px 8px rgba(10, 42, 38, 0.08);
}
.rail-log-btn:active {
  background: #d8f0e8;
}
.rail-create-btn {
  appearance: none;
  border: 1.5px dashed rgba(26, 122, 104, 0.4);
  background: rgba(26, 122, 104, 0.06);
  color: var(--accent-deep);
  border-radius: 8px;
  padding: 0.38rem 0.5rem;
  margin: 0;
  width: 100%;
  font: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease,
    color 0.15s ease, transform 0.12s ease;
}
.rail-create-btn:hover {
  background: rgba(26, 122, 104, 0.14);
  border-color: rgba(26, 122, 104, 0.72);
  border-style: solid;
  color: #0f5c4e;
  box-shadow: 0 2px 8px rgba(26, 122, 104, 0.16);
}
.rail-create-btn:active {
  background: rgba(26, 122, 104, 0.2);
  transform: scale(0.98);
  box-shadow: none;
}
.rail-create-btn[hidden] {
  display: none !important;
}
.rail-log-btn[hidden] {
  display: none !important;
}
.rail-log-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-deep, #1a7a68);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  line-height: 1.2;
}
.rail-log-latest {
  font-size: 0.72rem;
  color: var(--ink-muted);
  line-height: 1.25;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-log-latest.is-reenter {
  color: #2f6fed;
  font-weight: 500;
}
.rail-log-latest.is-leave {
  color: #e03434;
  font-weight: 500;
}
.logs-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.logs-list li {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(20, 32, 30, 0.04);
  line-height: 1.45;
}
.logs-list .log-text {
  font-size: 0.88rem;
  color: var(--ink);
  word-break: break-word;
}
.logs-list li.is-reenter .log-text {
  color: #2f6fed;
  font-weight: 500;
}
.logs-list li.is-leave .log-text {
  color: #e03434;
  font-weight: 500;
}
.logs-list .log-time {
  margin-left: 0.4rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  white-space: nowrap;
}
.sidebar-rooms-list li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 58px;
  padding: 0.55rem 0.55rem;
  border-radius: 12px;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  background: #fff;
  border: 1.5px solid rgba(26, 122, 104, 0.14);
  box-shadow: 0 2px 8px rgba(10, 42, 38, 0.05);
}
.sidebar-rooms-list li:hover,
.sidebar-rooms-list li:active {
  background: #e8f6f1;
  border-color: rgba(26, 122, 104, 0.35);
}
.sidebar-rooms-list li.active {
  background: #d8f0e8;
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(26, 122, 104, 0.14);
}
.sidebar-rooms-list .rail-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.sidebar-rooms-list .rail-avatar {
  width: 2.4rem;
  height: 2.4rem;
  font-size: 0.95rem;
  border-radius: 50%;
}
.sidebar-rooms-list .rail-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #fa5151;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
  box-sizing: border-box;
  border: 2px solid #fff;
  z-index: 2;
}
.sidebar-rooms-list .rail-badge[hidden] {
  display: none !important;
}
.sidebar-rooms-list li.has-unread {
  border-color: #fa5151;
  background: #fff5f5;
  box-shadow: 0 0 0 1px rgba(250, 81, 81, 0.35), 0 4px 14px rgba(250, 81, 81, 0.22);
  animation: room-unread-pulse 1.1s ease-in-out infinite;
}
@keyframes room-unread-pulse {
  0%, 100% {
    background: #fff5f5;
    border-color: #fa5151;
    box-shadow: 0 0 0 1px rgba(250, 81, 81, 0.4), 0 4px 14px rgba(250, 81, 81, 0.25);
  }
  50% {
    background: #ffd6d6;
    border-color: #e03434;
    box-shadow: 0 0 0 3px rgba(250, 81, 81, 0.55), 0 6px 18px rgba(250, 81, 81, 0.4);
  }
}
.sidebar-rooms-list .rail-avatar-wrap[hidden] {
  display: none !important;
}
/* 无默认头像时仅保留未读角标占位 */
.sidebar-rooms-list .rail-avatar-wrap:has(.rail-avatar[hidden]):not([hidden]) {
  width: 1.1rem;
  height: 1.1rem;
  align-self: center;
}
.sidebar-rooms-list .rail-avatar[hidden] {
  display: none !important;
}
.sidebar-rooms-list .meta {
  flex: 1;
  min-width: 0;
}
.sidebar-rooms-list .name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-rooms-list .sub {
  margin-top: 0.12rem;
  font-size: 0.72rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-rooms-list .enter-tag {
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
}
.sidebar-rooms-list li.active .enter-tag {
  background: var(--accent-deep);
  color: #fff;
}
.chat-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.chat-header {
  flex-shrink: 0;
}

@media (max-width: 720px) {
  #app { max-width: 100%; }
  .rooms-rail { width: 210px; padding: 0.4rem 0.3rem; }
  .sidebar-rooms-list .name { font-size: 0.85rem; }
  .sidebar-rooms-list .sub { font-size: 0.68rem; }
}
@media (max-width: 560px) {
  .rooms-rail { width: 168px; }
  .sidebar-rooms-list li { padding: 0.45rem 0.4rem; gap: 0.45rem; min-height: 52px; }
  .sidebar-rooms-list .rail-avatar { width: 2.1rem; height: 2.1rem; }
  .sidebar-rooms-list .enter-tag { font-size: 0.7rem; }
}

/* Avatars */
.avatar, .avatar-lg, .avatar-xl, .avatar-sm {
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  font-weight: 600;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.avatar-sm { width: 1.85rem; height: 1.85rem; font-size: 0.72rem; }
.avatar { width: 2.1rem; height: 2.1rem; font-size: 0.85rem; }
.avatar-lg { width: 2.6rem; height: 2.6rem; font-size: 1rem; }
.avatar-xl { width: 3.4rem; height: 3.4rem; font-size: 1.2rem; }

.preset-1 { background: var(--p1); color: #fff; }
.preset-2 { background: var(--p2); color: #fff; }
.preset-3 { background: var(--p3); color: #fff; }
.preset-4 { background: var(--p4); color: #fff; }
.preset-5 { background: var(--p5); color: #fff; }
.preset-6 { background: var(--p6); color: #fff; }
.preset-7 { background: var(--p7); color: #fff; }
.preset-8 { background: var(--p8); color: #fff; }
.preset-9 { background: var(--p9); color: #fff; }
.preset-10 { background: var(--p10); color: #fff; }
.preset-11 { background: var(--p11); color: #fff; }
.preset-12 { background: var(--p12); color: #fff; }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.avatar-grid button {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  font-weight: 600;
  color: #fff;
}
.avatar-grid button.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
}

.profile-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 0.55rem;
}

/* Welcome */
.welcome-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 10% 0%, rgba(26, 122, 104, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 20%, rgba(200, 235, 226, 0.35), transparent 50%),
    linear-gradient(165deg, var(--bg-deep) 0%, var(--bg-mid) 48%, #1a4f47 100%);
  z-index: 0;
}
.welcome-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 38%;
  background: linear-gradient(to top, var(--surface) 50%, transparent);
}
.welcome-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem calc(2rem + var(--safe-bottom));
  gap: 0.75rem;
}
.brand {
  font-family: var(--font-display);
  font-size: 3.4rem;
  line-height: 1;
  color: #f2faf7;
  margin: 0 0 0.35rem;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 8px rgba(10, 42, 38, 0.35);
  animation: rise 0.7s ease both;
  max-width: 100%;
}
.brand.is-room-name {
  font-size: 2.35rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  word-break: break-word;
}
@media (max-width: 390px) {
  .welcome-inner {
    padding: 1.35rem 1.1rem calc(1.35rem + var(--safe-bottom));
    gap: 0.55rem;
  }
  .brand {
    font-size: 2.55rem;
  }
  .brand.is-room-name {
    font-size: 1.75rem;
  }
  .welcome-title {
    font-size: 1.35rem;
  }
  .welcome-invite-avatar {
    width: 4rem;
    height: 4rem;
    font-size: 1.45rem;
    margin-bottom: 0.55rem;
  }
}
.welcome-invite-avatar {
  width: 4.6rem;
  height: 4.6rem;
  font-size: 1.7rem;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 24px rgba(10, 42, 38, 0.28);
  margin: 0 auto 0.85rem;
  animation: rise 0.7s ease both;
}
.welcome-invite-avatar[hidden] {
  display: none !important;
}
.welcome-title.welcome-title-sm {
  font-size: 1.05rem;
  font-family: var(--font-body);
  font-weight: 500;
  opacity: 0.92;
}
.announce-panel .announce-text {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #f0f7f4;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 40vh;
  overflow-y: auto;
}
.announce-panel .btn-primary {
  width: 100%;
}
.welcome-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  color: #f2faf7;
  margin: 0;
  text-shadow: 0 1px 6px rgba(10, 42, 38, 0.35);
  animation: rise 0.7s 0.08s ease both;
  max-width: 100%;
}
.welcome-sub {
  color: rgba(242, 250, 247, 0.92);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 1.25rem;
  max-width: 22rem;
  text-shadow: 0 1px 4px rgba(10, 42, 38, 0.3);
  animation: rise 0.7s 0.14s ease both;
}
#form-login { animation: rise 0.7s 0.2s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.stack.compact { gap: 0.65rem; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field[hidden] { display: none !important; }
.field span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

/* 底部浅色区：表单放进白卡片，深色字保证可读 */
#screen-welcome #form-guest {
  background: #fff;
  border-radius: 16px;
  padding: 1.15rem 1.05rem 1.2rem;
  box-shadow: 0 10px 32px rgba(10, 42, 38, 0.18);
  animation: rise 0.7s 0.18s ease both;
  width: 100%;
  max-width: 22rem;
  text-align: left;
}
#screen-welcome .error-text,
#screen-welcome #login-error,
#screen-welcome .login-details {
  width: 100%;
  max-width: 22rem;
}
#screen-welcome #form-guest[hidden] {
  display: none !important;
}
/* 微信收藏缩略图：移出视口但仍加载，供抓取；不挡点击 */
.wx-share-thumb {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 300px;
  height: 300px;
  max-width: none;
  pointer-events: none;
  opacity: 1;
}
.header-room-avatar {
  overflow: hidden;
  padding: 0 !important;
}
.header-room-avatar .room-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
/* 扫码入口全屏遮罩：域名纠偏 / 自动进群前不露昵称页 */
.entry-splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: #ffffff;
  color: #1a2e2a;
  text-align: center;
  padding: 2rem;
}
.entry-splash[hidden] {
  display: none !important;
}
.entry-splash-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  color: #145c52;
}
.entry-splash-sub {
  margin: 0;
  font-size: 0.9rem;
  color: #5a6f6a;
  opacity: 1;
}
html.entry-gating {
  background: #fff;
}
html.entry-gating body {
  background: #fff;
}
html.entry-gating #app {
  visibility: hidden;
}
html.entry-gating #form-guest,
html.entry-gating #welcome-invite-avatar,
html.entry-gating #guest-room-hint,
html.entry-gating #login-details {
  display: none !important;
}
#screen-welcome #form-guest .field span {
  color: var(--ink);
  font-weight: 600;
}
#screen-welcome #form-guest .field input {
  background: #f0f3f2;
  border-color: rgba(20, 32, 30, 0.12);
}

.field input,
.field textarea,
.composer input,
.sheet-panel input,
.sheet-panel textarea {
  width: 100%;
  border: 1.5px solid rgba(20, 32, 30, 0.14);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 1rem;
  background: #f3f5f4;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: inset 0 1px 2px rgba(20, 32, 30, 0.03);
}
.field input::placeholder,
.field textarea::placeholder,
.composer input::placeholder,
.sheet-panel input::placeholder,
.sheet-panel textarea::placeholder {
  color: #8a9a95;
  opacity: 1;
}
.sheet-panel textarea {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.45;
}
.field input:hover,
.field textarea:hover,
.sheet-panel input:hover,
.sheet-panel textarea:hover {
  border-color: rgba(26, 122, 104, 0.35);
  background: #f7f9f8;
}
.field input:focus,
.field textarea:focus,
.composer input:focus,
.sheet-panel input:focus,
.sheet-panel textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 122, 104, 0.16);
}

/* 大厅白卡片上的输入框：与卡片底色区分开 */
#screen-lobby .field input,
#screen-lobby .field textarea {
  background: #eef2f0;
  border-color: rgba(20, 32, 30, 0.16);
}
#screen-lobby .field input:focus,
#screen-lobby .field textarea:focus {
  background: #fff;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease,
    box-shadow 0.15s ease, color 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.btn-secondary { background: var(--accent-soft); color: var(--accent-deep); }
.btn-secondary:hover:not(:disabled) {
  background: #cfe9e0;
  color: #0f5c4e;
  box-shadow: 0 2px 8px rgba(26, 122, 104, 0.14);
}
.btn-ghost { background: transparent; color: var(--ink-muted); width: 100%; }
.btn-ghost:hover:not(:disabled) {
  background: rgba(20, 32, 30, 0.06);
  color: var(--ink);
}
.btn-danger { background: var(--danger-soft); color: var(--danger); width: 100%; margin-bottom: 0.5rem; }
.btn-danger:hover:not(:disabled) {
  background: #f8d0cb;
  color: #b42318;
  box-shadow: 0 2px 8px rgba(180, 35, 24, 0.12);
}
.btn-send { background: var(--accent); color: #fff; padding-inline: 1.1rem; flex-shrink: 0; }
.btn-send:hover:not(:disabled) { background: var(--accent-deep); }
.file-btn { display: block; text-align: center; margin-bottom: 0.75rem; }

.error-text { color: #ffb4a8; font-size: 0.85rem; margin: 0.25rem 0 0; }
#screen-welcome .error-text,
#screen-welcome #login-error {
  color: #8b1a12;
  background: #fde8e6;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
}
#screen-welcome #login-error[hidden] {
  display: none !important;
}
#screen-welcome #form-login .btn-primary {
  width: 100%;
}
#screen-lobby .error-text, #screen-chat .error-text, .sheet .error-text { color: var(--danger); }
.status-line { margin: 0.75rem 0 0; font-size: 0.8rem; color: rgba(232, 245, 241, 0.55); }
.status-line.ok { color: #9ee0d0; }
.status-line[hidden] { display: none !important; }
.admin-link-wrap { margin: 0.5rem 0 0; }
.admin-link { color: rgba(232, 245, 241, 0.65); font-size: 0.82rem; }

.login-details {
  margin-top: 0.35rem;
  color: var(--ink);
  font-size: 0.88rem;
  background: #fff;
  border-radius: 16px;
  padding: 0.85rem 1rem 1rem;
  box-shadow: 0 8px 24px rgba(10, 42, 38, 0.14);
}
.login-details[hidden] { display: none !important; }
.login-details summary {
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-weight: 600;
}
.login-details summary::-webkit-details-marker { display: none; }
.guest-room-hint {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: #e8f2ef;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
}

/* Lobby */
.topbar {
  padding: 1.1rem 1.2rem 0.75rem;
  background: linear-gradient(180deg, #d5ebe4 0%, var(--surface) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.topbar-user { display: flex; align-items: center; gap: 0.55rem; min-width: 0; flex: 1; }
.topbar-actions { display: flex; gap: 0.4rem; flex-shrink: 0; align-items: center; }
.lobby-back-btn {
  appearance: none;
  border: none;
  margin: 0;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.45rem 1.05rem;
  line-height: 1.25;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(10, 42, 38, 0.14);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.lobby-back-btn:hover {
  background: var(--accent-deep);
  box-shadow: 0 3px 10px rgba(10, 42, 38, 0.2);
}
.lobby-back-btn:active {
  background: var(--accent-deep);
  transform: scale(0.97);
}
.topbar-avatar-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
  border-radius: 50%;
}
.topbar-avatar-btn:active {
  opacity: 0.88;
  transform: scale(0.96);
}
.topbar-avatar-btn .avatar-lg {
  width: 2.6rem;
  height: 2.6rem;
  font-size: 1.05rem;
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(10, 42, 38, 0.16);
}
.topbar-user-info {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0.15rem 0.2rem;
  margin: 0;
  min-width: 0;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  color: inherit;
  font: inherit;
}
.topbar-user-info:active {
  background: rgba(14, 61, 54, 0.06);
}
.brand-sm {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin: 0;
  color: var(--bg-deep);
  letter-spacing: 0.04em;
}
.topbar-sub { margin: 0.1rem 0 0; color: var(--ink-muted); font-size: 0.88rem; }
.sheet-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.35rem;
}
.sheet-title-row h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.sheet-back-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 1.05rem;
}
.profile-btn {
  appearance: none;
  border: 2px solid #fff;
  padding: 0;
  margin: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  box-shadow: 0 2px 10px rgba(10, 42, 38, 0.16);
  flex-shrink: 0;
}
.profile-btn:active {
  opacity: 0.88;
  transform: scale(0.96);
}
.profile-btn .avatar-sm {
  width: 100%;
  height: 100%;
  font-size: 0.95rem;
}
.lobby-body {
  flex: 1;
  padding: 0.5rem 1.1rem calc(1.5rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.lobby-panel {
  background: #fff;
  border-radius: 16px;
  padding: 1rem 1.05rem 1.1rem;
  border: 1px solid rgba(20, 32, 30, 0.06);
  box-shadow: 0 6px 20px rgba(10, 42, 38, 0.06);
}
.my-rooms-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.my-rooms-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  border-radius: 14px;
  background: #fff;
  border: 1.5px solid rgba(26, 122, 104, 0.16);
  box-shadow: 0 2px 10px rgba(10, 42, 38, 0.06);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.my-rooms-list li:active,
.my-rooms-list li:hover {
  background: #e8f6f1;
  border-color: rgba(26, 122, 104, 0.4);
  box-shadow: 0 4px 14px rgba(26, 122, 104, 0.12);
}
.my-rooms-list li.active {
  background: #d8f0e8;
  border-color: var(--accent);
}
.my-rooms-list li.is-empty {
  cursor: default;
  box-shadow: none;
  border-style: dashed;
  background: transparent;
  color: var(--ink-muted);
  justify-content: center;
}
.my-rooms-list li.is-empty:hover,
.my-rooms-list li.is-empty:active {
  background: transparent;
  border-color: rgba(26, 122, 104, 0.16);
  box-shadow: none;
}
.my-rooms-list .meta { flex: 1; min-width: 0; }
.my-rooms-list .name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.my-rooms-list .sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 0.1rem;
}
.my-rooms-list .enter-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
}
.my-rooms-list .enter-tag.is-unread {
  background: #fa5151;
  min-width: 1.35rem;
  padding: 0.22rem 0.45rem;
  text-align: center;
}
.my-rooms-list li.has-unread {
  border-color: #fa5151;
  background: #fff5f5;
  animation: room-unread-pulse 1.1s ease-in-out infinite;
}
.my-rooms-list li.active .enter-tag {
  background: var(--accent-deep);
}
#btn-rooms-create {
  width: 100%;
  margin: 0.15rem 0 0.35rem;
}
.lobby-panel h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0 0 0.25rem;
}
.hint { margin: 0 0 0.85rem; color: var(--ink-muted); font-size: 0.88rem; }
.hint.center { text-align: center; }
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink-muted);
  font-size: 0.8rem;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(20, 32, 30, 0.1);
}
.panel-disabled { opacity: 0.55; pointer-events: none; }

/* Chat */
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.55rem;
  padding-left: 1.15rem;
  padding-top: max(0.55rem, env(safe-area-inset-top));
  background: rgba(247, 251, 249, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(20, 32, 30, 0.06);
  position: sticky;
  top: 0;
  z-index: 5;
}
.icon-btn {
  width: 2.3rem;
  height: 2.3rem;
  border: none;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 600;
}
.icon-btn[hidden] {
  display: none !important;
}
.icon-btn.ghost { background: rgba(20, 32, 30, 0.06); color: var(--ink-muted); }
.icon-btn.muted { opacity: 0.45; }
/* 所有人：返回位展示群头像（含默认字头像） */
.header-room-avatar {
  width: 2.3rem;
  height: 2.3rem;
  font-size: 0.95rem;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 1px 6px rgba(10, 42, 38, 0.16);
  pointer-events: none;
}
.header-room-avatar.is-action {
  pointer-events: auto;
  cursor: pointer;
}
.header-room-avatar.is-action:active {
  opacity: 0.85;
}
.header-room-avatar[hidden] {
  display: none !important;
}
.chat-back-btn {
  flex-shrink: 0;
  margin-right: 0.15rem;
}
.chat-header-main { min-width: 0; flex: 1; }
.chat-header-main h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#chat-room-name.is-action {
  cursor: pointer;
}
#chat-room-name.is-action:active {
  opacity: 0.85;
}
.group-avatar-btn {
  appearance: none;
  border: none;
  padding: 0;
  margin: 0 0.55rem 0 0.1rem;
  background: transparent;
  cursor: default;
  flex-shrink: 0;
  border-radius: 50%;
  line-height: 0;
  pointer-events: none;
}
.group-avatar-btn.is-action {
  cursor: pointer;
  pointer-events: auto;
}
.group-avatar-btn.is-action:active { opacity: 0.85; }
.group-avatar-btn[hidden] {
  display: none !important;
}
.group-avatar {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.05rem;
  border: 2px solid #fff;
  box-shadow: 0 1px 6px rgba(10, 42, 38, 0.16);
}

/* 群滚动字幕 */
.room-marquee {
  flex-shrink: 0;
  overflow: hidden;
  height: 2rem;
  line-height: 2rem;
  border-bottom: 1px solid rgba(20, 32, 30, 0.06);
}
.room-marquee.is-action {
  cursor: pointer;
}
.room-marquee.is-action:hover {
  filter: brightness(1.06);
}
.room-marquee.is-action:active {
  filter: brightness(0.96);
}
.room-marquee[hidden] {
  display: none !important;
}
.room-marquee-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  animation: marquee-scroll 18s linear infinite;
}
.room-marquee-text {
  display: inline-block;
  padding: 0 2.5rem;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.manage-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 0.35rem 0 0.55rem;
}
.manage-actions .btn {
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.5rem;
  font-size: 0.9rem;
  font-family: var(--font-body);
  font-weight: 600;
}
.manage-danger-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
}
.manage-danger-row .btn {
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.45rem;
  font-size: 0.88rem;
  font-family: var(--font-body);
  font-weight: 600;
}
.manage-danger-row #btn-all-mute.is-all-muted {
  background: #fff3cd;
  color: #8a6d00;
  border-color: transparent;
}
.manage-danger-row #btn-all-mute.is-all-muted:hover:not(:disabled) {
  background: #ffe8a3;
  color: #6b5400;
  box-shadow: 0 2px 8px rgba(138, 109, 0, 0.14);
}
.color-row {
  display: flex;
  gap: 0.75rem;
}
.color-field {
  flex: 1;
  min-width: 0;
}
.color-field input[type="color"] {
  width: 100%;
  height: 2.4rem;
  padding: 0.2rem;
  border: 1.5px solid rgba(20, 32, 30, 0.1);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
#form-marquee input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.speed-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}
#marquee-speed-label {
  font-style: normal;
  font-weight: 600;
  color: var(--accent-deep);
  margin-left: 0.35rem;
}
.chat-meta {
  margin: 0.12rem 0 0;
  font-size: 0.76rem;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}
.linkish {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.8rem;
  color: var(--accent);
  cursor: pointer;
}
.linkish::after {
  content: " ›";
  opacity: 0.7;
  font-weight: 600;
}
.linkish.code { font-weight: 600; letter-spacing: 0.08em; }
.linkish.code::after { content: none; }

.messages-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.messages-empty {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 1.5rem;
}
.messages-empty[hidden] {
  display: none !important;
}
.messages-empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink-muted);
  font-weight: 400;
}
.messages-empty-sub {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: rgba(20, 32, 30, 0.42);
}
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding: 0.85rem 0.9rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: #fafafa;
  -webkit-overflow-scrolling: touch;
}

.unread-fab {
  position: absolute;
  right: 28px;
  /* 完全在输入栏上方，避免被挡住 */
  bottom: calc(6rem + var(--safe-bottom, 0px));
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 18px rgba(10, 42, 38, 0.18);
  color: var(--accent-deep);
  font-size: 20px;
  cursor: pointer;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 0;
}
.unread-fab.is-show,
.unread-fab:not([hidden]) {
  display: grid !important;
}
.unread-fab[hidden] {
  display: none !important;
}
.unread-arrow {
  line-height: 1;
  font-weight: 700;
  transform: translateY(-1px);
}
.unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fa5151;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
  box-sizing: border-box;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
#screen-chat:has(.emoji-panel:not([hidden])) .unread-fab,
#screen-chat:has(.media-panel:not([hidden])) .unread-fab,
#screen-chat:has(.mention-panel:not([hidden])) .unread-fab {
  bottom: calc(13.8rem + var(--safe-bottom, 0px));
}

.mention {
  color: inherit;
  font-weight: inherit;
}
/* 被@的人：蓝字 + 同色外边框，框内无底色；其他人看到的 @ 用默认字色 */
.mention.mention-me {
  color: #2f6fed;
  font-weight: 600;
  background: transparent;
  border-radius: 4px;
  padding: 0.05rem 0.25rem;
  border: 1px solid #2f6fed;
}
.msg.me .mention.mention-me {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}
/* 自己气泡若被套上高亮，保持可读 */
.msg.me.mention-keep .msg-bubble:not(.media) {
  color: #1a2b28;
}
.msg.me.mention-keep .mention.mention-me {
  color: #2f6fed;
  background: transparent;
  border-color: #2f6fed;
}
.msg.mention-flash .msg-bubble:not(.media) {
  animation: mention-pulse 0.55s ease 3;
}
.msg.mention-keep .msg-bubble:not(.media) {
  background: #f5f8ff;
  border: 1px solid #2f6fed;
  box-shadow: none;
}
@keyframes mention-pulse {
  0%, 100% {
    background: #f5f8ff;
    border-color: #2f6fed;
    box-shadow: 0 0 0 1px rgba(47, 111, 237, 0.15);
  }
  50% {
    background: #eaf0ff;
    border-color: #2f6fed;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.22);
  }
}

.mention-panel {
  max-height: 180px;
  overflow-y: auto;
  background: #fff;
  border-top: 1px solid rgba(20, 32, 30, 0.08);
  flex-shrink: 0;
}
.mention-panel[hidden] { display: none !important; }
.mention-title {
  margin: 0;
  padding: 0.55rem 0.85rem 0.25rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.mention-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.35rem;
}
.mention-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 0.92rem;
}
.mention-list li:active,
.mention-list li:hover {
  background: rgba(26, 122, 104, 0.08);
}

.mention-toast {
  position: absolute;
  left: 50%;
  bottom: 5.2rem;
  transform: translateX(-50%);
  z-index: 60;
  background: #2f3437;
  color: #ffffff;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  border: none;
  cursor: pointer;
  pointer-events: auto;
}
.mention-toast:not([hidden]) {
  display: block;
}
.mention-toast[hidden] { display: none !important; }
#screen-chat:has(.emoji-panel:not([hidden])) .mention-toast,
#screen-chat:has(.media-panel:not([hidden])) .mention-toast,
#screen-chat:has(.mention-panel:not([hidden])) .mention-toast {
  bottom: 14.5rem;
}

.msg {
  display: flex;
  gap: 0.4rem;
  max-width: 88%;
  animation: msg-in 0.25s ease both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.other { align-self: flex-start; }
.msg.system { align-self: center; max-width: 90%; }
.msg-body { display: flex; flex-direction: column; min-width: 0; }
.msg.me .msg-body { align-items: flex-end; }
.msg.other .msg-body { align-items: flex-start; }
.msg-nick {
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-bottom: 0.2rem;
  padding-inline: 0.25rem;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.28rem;
  max-width: 100%;
}
.msg-nick-name {
  font-size: inherit;
  line-height: 1.2;
}
.msg-nick-tag {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--accent-deep);
  opacity: 0.88;
  line-height: 1.2;
}
.msg.me .msg-nick-tag {
  color: var(--accent-deep);
}
.msg-nick.has-color {
  font-weight: 600;
}
.members-list .tag-role {
  color: var(--accent-deep);
  font-size: 0.68rem;
  opacity: 0.9;
}
.nick-color-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nick-color-row input[type="color"] {
  width: 2.6rem;
  height: 2rem;
  padding: 0;
  border: 1px solid rgba(20, 32, 30, 0.12);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.profile-colors-row {
  display: flex;
  align-items: flex-end;
  gap: 0.85rem;
  margin-bottom: 0.55rem;
}
.profile-colors-row[hidden] {
  display: none !important;
}
.profile-color-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.profile-color-item[hidden] {
  display: none !important;
}
.profile-color-item > span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}
.btn-mini {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  width: auto;
}
.hint.tight {
  margin-top: 0.25rem;
  margin-bottom: 0;
}
.msg .avatar-sm {
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}
.msg .avatar-sm.is-self:active,
.msg-nick.is-self:active {
  opacity: 0.75;
}
.msg-bubble {
  padding: 0.38rem 0.62rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.38;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-bubble.emoji-only {
  font-size: 1.55rem;
  line-height: 1.25;
  padding: 0.28rem 0.4rem;
  letter-spacing: 0.04em;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji",
    "EmojiOne Color", sans-serif;
}
.msg-bubble .inline-emoji {
  display: inline-block;
  font-size: 1.28em;
  line-height: 1.2;
  min-width: 1.15em;
  text-align: center;
  vertical-align: -0.12em;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji",
    "EmojiOne Color", sans-serif;
  font-variant-emoji: emoji;
  transform: translateZ(0);
}
.msg-bubble .inline-emoji-img {
  width: 1.45em;
  height: 1.45em;
  vertical-align: -0.28em;
  display: inline-block;
  object-fit: contain;
  margin: 0 0.04em;
}
.msg-bubble.emoji-only .inline-emoji {
  font-size: 1em;
  min-width: 1.05em;
  margin-inline: 0.04em;
  vertical-align: baseline;
}
.msg-bubble.emoji-only .inline-emoji-img {
  width: 1.85rem;
  height: 1.85rem;
  vertical-align: -0.15em;
}
.msg-bubble .msg-link {
  color: #2f6fed;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  word-break: break-all;
}
.msg.me .msg-bubble .msg-link {
  color: #d6ebff;
}
.msg.me.mention-keep .msg-bubble .msg-link {
  color: #2f6fed;
}
.msg-bubble .msg-link:active {
  opacity: 0.75;
}
.msg-bubble.media {
  padding: 0.35rem;
  background: transparent !important;
  box-shadow: none !important;
}
.msg-bubble.media-caption {
  margin-top: 0.35rem;
  padding: 0.45rem 0.65rem;
}
.msg-image {
  display: block;
  max-width: min(220px, 62vw);
  max-height: 280px;
  border-radius: 10px;
  object-fit: cover;
  cursor: zoom-in;
  background: rgba(20, 32, 30, 0.06);
}
.msg.me .msg-image { border-bottom-right-radius: 4px; }
.msg.other .msg-image { border-bottom-left-radius: 4px; }
.msg-video {
  display: block;
  max-width: min(240px, 68vw);
  max-height: 320px;
  border-radius: 10px;
  background: #000;
}
.msg-media-name {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 0.25rem;
  padding-inline: 0.25rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg.other .msg-bubble {
  background: var(--bubble-other);
  color: var(--ink);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(10, 42, 38, 0.06);
}
.msg.me .msg-bubble {
  background: var(--bubble-me);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.system .msg-bubble {
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  text-align: center;
}
.msg-time {
  font-size: 0.68rem;
  color: var(--ink-muted);
  margin-top: 0.2rem;
  padding-inline: 0.25rem;
}

.composer {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.48rem 0.55rem;
  background: var(--surface);
  border-top: 1px solid rgba(20, 32, 30, 0.06);
  flex-shrink: 0;
  position: relative;
  z-index: 70;
}
.composer input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.58rem 0.8rem;
  font-size: 0.95rem;
  border-radius: 11px;
  border: 1.5px solid rgba(20, 32, 30, 0.14);
  background: #f3f5f4;
  line-height: 1.3;
}
.composer input[type="text"]:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26, 122, 104, 0.16);
}
.composer .btn-send {
  padding: 0.58rem 0.85rem;
  font-size: 0.9rem;
  border-radius: 11px;
  line-height: 1.3;
  min-height: 0;
}
.composer-tool {
  width: 2.15rem;
  height: 2.15rem;
  border: none;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.composer-tool.active {
  background: var(--accent);
  color: #fff;
}
.chat-main > .composer {
  padding-bottom: calc(0.48rem + var(--safe-bottom));
}
.chat-main:has(.emoji-panel:not([hidden])) > .composer,
.chat-main:has(.media-panel:not([hidden])) > .composer {
  padding-bottom: 0.48rem;
}

.emoji-panel {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.2rem;
  padding: 0.45rem 0.55rem calc(0.45rem + var(--safe-bottom));
  height: 148px;
  max-height: 148px;
  overflow-y: auto;
  background: #eef6f3;
  border-top: 1px solid rgba(20, 32, 30, 0.06);
  box-sizing: border-box;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 360px) {
  .emoji-panel {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
.emoji-panel[hidden],
.media-panel[hidden] {
  display: none !important;
}
.emoji-panel button {
  appearance: none;
  border: none;
  background: transparent;
  aspect-ratio: 1;
  width: 100%;
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  padding: 0;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji",
    "EmojiOne Color", sans-serif;
  font-variant-emoji: emoji;
  /* 单元格变窄时也不要挤压 emoji 字形 */
  overflow: visible;
  flex-shrink: 0;
}
.emoji-panel button:active {
  background: rgba(26, 122, 104, 0.15);
}
.emoji-panel .emoji-panel-img {
  width: 1.7rem;
  height: 1.7rem;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.media-panel {
  display: flex;
  justify-content: flex-start;
  gap: 1.1rem;
  padding: 0.65rem 1rem calc(0.65rem + var(--safe-bottom));
  background: #eef6f3;
  border-top: 1px solid rgba(20, 32, 30, 0.06);
  box-sizing: border-box;
  flex-shrink: 0;
}
.media-action {
  appearance: none;
  border: none;
  background: transparent;
  border-radius: 12px;
  padding: 0;
  width: 4.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink-muted);
  cursor: pointer;
}
.media-action .media-ico {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(10, 42, 38, 0.08);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}
.lightbox[hidden] { display: none !important; }
.lightbox img {
  max-width: 96%;
  max-height: 90vh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.upload-mask {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(10, 42, 38, 0.45);
  display: grid;
  place-items: center;
  max-width: 480px;
  margin: 0 auto;
  color: #fff;
  font-size: 0.95rem;
}

/* Sheets */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  max-width: 480px;
  margin: 0 auto;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 42, 38, 0.45);
  animation: fade 0.2s ease;
}
.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 0.45rem 0.95rem calc(0.85rem + var(--safe-bottom));
  animation: sheet-up 0.28s ease;
  max-height: 82vh;
  overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
  width: 2.2rem;
  height: 3px;
  border-radius: 2px;
  background: rgba(20, 32, 30, 0.15);
  margin: 0 auto 0.55rem;
}
.sheet-panel h3 {
  margin: 0 0 0.45rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.05rem;
}
.qr-panel { text-align: center; }
/* 二维码用居中卡片，避免底部抽屉上方留出大片暗影 */
#qr-sheet .sheet-panel.qr-panel {
  left: 1.1rem;
  right: 1.1rem;
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 18px;
  max-height: min(88vh, 560px);
  padding: 1.1rem 1.25rem 1rem;
  animation: qr-pop 0.22s ease;
  box-shadow: 0 16px 48px rgba(10, 42, 38, 0.28);
}
#qr-sheet .sheet-handle {
  display: none;
}
@keyframes qr-pop {
  from { opacity: 0; transform: translateY(calc(-50% + 12px)) scale(0.97); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}
.qr-image {
  display: block;
  width: 220px;
  height: 220px;
  margin: 0.5rem auto 0.75rem;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-sizing: border-box;
  object-fit: contain;
}
.invite-code {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: 0 0 0.85rem;
}
.invite-code strong {
  color: var(--accent-deep);
  letter-spacing: 0.12em;
  margin-left: 0.25rem;
}

.members-list { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.members-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(20, 32, 30, 0.06);
  font-size: 0.88rem;
}
.members-list li.is-clickable {
  cursor: pointer;
  border-radius: 8px;
  margin: 0 -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  transition: background 0.15s ease;
}
.members-list li.is-clickable:hover {
  background: rgba(26, 122, 104, 0.08);
}
.members-list li.is-clickable:active {
  background: rgba(26, 122, 104, 0.14);
}
.members-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
}
.members-sheet-head h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.02rem;
  line-height: 1.35;
}
.all-mute-btn {
  margin: 0;
  flex-shrink: 0;
}
.all-mute-btn.is-all-muted,
.members-list .settings-btn.is-all-muted {
  background: #fff3cd;
  color: #8a6d00;
}
.members-list .meta { flex: 1; min-width: 0; }
.members-list .tag {
  font-size: 0.68rem;
  color: var(--accent);
  margin-left: 0.25rem;
}
.members-list .tag-online {
  color: #1a7a68;
  background: rgba(26, 122, 104, 0.12);
  border-radius: 999px;
  padding: 0.04rem 0.32rem;
  margin-left: 0.25rem;
  font-size: 0.64rem;
  font-weight: 600;
}
.members-list .tag-offline {
  color: #7a8480;
  background: rgba(20, 32, 30, 0.06);
  border-radius: 999px;
  padding: 0.04rem 0.32rem;
  margin-left: 0.25rem;
  font-size: 0.64rem;
  font-weight: 600;
}
.members-list .member-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.2rem;
  min-width: 0;
}
.members-list .member-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.members-list .member-net {
  margin-top: 0.12rem;
  font-size: 0.68rem;
  color: var(--ink-muted);
  line-height: 1.3;
  word-break: break-all;
}
.members-list .member-times {
  margin-top: 0.1rem;
  font-size: 0.66rem;
  color: var(--ink-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.members-list .member-remark {
  margin-top: 0.08rem;
  font-size: 0.66rem;
  color: #3a5a9a;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}
.members-list .settings-btn {
  appearance: none;
  border: none;
  background: #e8eefc;
  color: #3a5a9a;
  border-radius: 6px;
  padding: 0.22rem 0.45rem;
  font-size: 0.7rem;
  cursor: pointer;
  margin-right: 0.2rem;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease,
    transform 0.12s ease;
}
.members-list .settings-btn:hover {
  background: #d4dff8;
  color: #27457a;
  box-shadow: 0 1px 4px rgba(58, 90, 154, 0.18);
}
.members-list .settings-btn:active {
  transform: scale(0.97);
}
.members-list .settings-btn.has-status {
  background: #f0f4f3;
  color: var(--ink-muted);
}
.members-list .settings-btn.has-status:hover {
  background: #e2eae8;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(20, 32, 30, 0.1);
}
.members-list .settings-btn.is-banned-btn {
  background: #efe2e2;
  color: #a33;
}
.members-list .settings-btn.is-banned-btn:hover {
  background: #e5cbcb;
  color: #8a2222;
  box-shadow: 0 1px 4px rgba(170, 51, 51, 0.16);
}
.members-list .mute-btn {
  appearance: none;
  border: none;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 6px;
  padding: 0.22rem 0.45rem;
  font-size: 0.7rem;
  cursor: pointer;
  margin-right: 0.2rem;
}
.members-list .mute-btn.on {
  background: #fff3cd;
  color: #8a6d00;
}
.members-list .kick-btn {
  appearance: none;
  border: none;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 6px;
  padding: 0.22rem 0.45rem;
  font-size: 0.7rem;
  cursor: pointer;
}
.members-list .ban-btn {
  appearance: none;
  border: none;
  background: #f5ebe0;
  color: #8a4b12;
  border-radius: 6px;
  padding: 0.22rem 0.45rem;
  font-size: 0.7rem;
  cursor: pointer;
  flex-shrink: 0;
}
.members-list .admin-btn {
  appearance: none;
  border: none;
  background: #e8eefc;
  color: #3a5a9a;
  border-radius: 6px;
  padding: 0.22rem 0.45rem;
  font-size: 0.7rem;
  cursor: pointer;
  margin-right: 0.2rem;
}
.members-list .admin-btn.on {
  background: #ece8f5;
  color: #6a4a9a;
}
.members-list .ban-btn.on {
  background: #efe2e2;
  color: #a33;
}
.members-list li.is-banned {
  opacity: 0.92;
}
.members-list .transfer-btn {
  display: none;
}
.member-actions-panel h3 {
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
}
.member-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.member-actions-stack .member-action-item {
  width: 100%;
  margin: 0;
}
.member-actions-stack .member-action-item:hover:not(:disabled) {
  filter: brightness(0.96);
  box-shadow: 0 2px 8px rgba(20, 32, 30, 0.08);
}
.member-actions-stack .is-admin-on {
  background: #ece8f5;
  color: #6a4a9a;
  border-color: transparent;
}
.member-actions-stack .is-admin-on:hover:not(:disabled) {
  background: #e0d8f0;
  color: #553a80;
}
.member-actions-stack .is-mute-on {
  background: #fff3cd;
  color: #8a6d00;
  border-color: transparent;
}
.member-actions-stack .is-mute-on:hover:not(:disabled) {
  background: #ffe8a3;
  color: #6b5400;
}
.member-actions-stack .is-danger-action {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.member-actions-stack .is-danger-action:hover:not(:disabled) {
  background: #f8d0cb;
  color: #b42318;
}
.member-actions-stack .is-ban-action,
.member-actions-stack .is-ban-on {
  background: #f5ebe0;
  color: #8a4b12;
  border-color: transparent;
}
.member-actions-stack .is-ban-action:hover:not(:disabled),
.member-actions-stack .is-ban-on:hover:not(:disabled) {
  background: #eadccb;
  color: #6e3c0e;
}
.member-actions-stack .is-ban-on {
  background: #efe2e2;
  color: #a33;
}
.member-actions-stack .is-ban-on:hover:not(:disabled) {
  background: #e5cbcb;
  color: #8a2222;
}
.member-actions-stack .is-remark-action {
  background: #eef3f8;
  color: #3a5a9a;
  border-color: transparent;
}
.member-actions-stack .is-remark-action:hover:not(:disabled) {
  background: #dde7f2;
  color: #27457a;
}

/* 微信风格确认弹窗 */
.wx-confirm {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  box-sizing: border-box;
}
.wx-confirm[hidden] {
  display: none !important;
}
.wx-confirm-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.wx-confirm-card {
  position: relative;
  width: min(78vw, 300px);
  background: #ededed;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  animation: wx-confirm-in 0.18s ease-out;
}
.wx-confirm.has-input .wx-confirm-card {
  width: min(86vw, 340px);
}
@keyframes wx-confirm-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.wx-confirm-body {
  padding: 1.35rem 1.1rem 1.15rem;
  text-align: center;
}
.wx-confirm.has-input .wx-confirm-body {
  padding: 1.2rem 1.1rem 1rem;
}
.wx-confirm-title {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #191919;
  line-height: 1.35;
}
.wx-confirm-title[hidden] {
  display: none !important;
}
.wx-confirm-text {
  margin: 0;
  font-size: 0.95rem;
  color: #191919;
  line-height: 1.5;
  word-break: break-word;
}
.wx-confirm-text[hidden] {
  display: none !important;
}
.wx-confirm-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: #191919;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.4;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.wx-confirm-input:focus {
  box-shadow: inset 0 0 0 1.5px rgba(87, 107, 149, 0.55);
}
.wx-confirm-input[hidden] {
  display: none !important;
}
.wx-confirm-input::placeholder {
  color: #a8a8a8;
}
.wx-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.wx-confirm-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0.85rem 0.5rem;
  font-size: 1.02rem;
  font-weight: 500;
  color: #000;
  cursor: pointer;
  font-family: inherit;
}
.wx-confirm-btn + .wx-confirm-btn {
  border-left: 1px solid rgba(0, 0, 0, 0.1);
}
.wx-confirm-btn.primary {
  color: #576b95;
  font-weight: 600;
}
.wx-confirm-btn.danger {
  color: #fa5151;
  font-weight: 600;
}
.wx-confirm-btn:active {
  background: rgba(0, 0, 0, 0.06);
}

@media (min-width: 481px) {
  body {
    background:
      radial-gradient(ellipse at 20% 10%, rgba(26, 122, 104, 0.15), transparent 40%),
      linear-gradient(160deg, #c5ddd6, #e8f2ef 50%, #d0e4de);
  }
  #app {
    height: min(900px, 96dvh);
    min-height: min(900px, 96dvh);
    margin-top: 2vh;
    margin-bottom: 2vh;
    border-radius: 24px;
    overflow: hidden;
  }
}

/* 个人资料 / 成员列表：H5 紧凑布局 */
#profile-sheet .sheet-panel .field {
  gap: 0.22rem;
  margin-bottom: 0.5rem;
}
#profile-sheet .sheet-panel .field > span {
  font-size: 0.75rem;
}
#profile-sheet .sheet-panel input[type="text"] {
  padding: 0.48rem 0.7rem;
  font-size: 0.92rem;
  border-radius: 10px;
}
#profile-sheet .sheet-panel .hint,
#profile-sheet .sheet-panel .hint.tight {
  font-size: 0.72rem;
  margin: 0.08rem 0 0;
  line-height: 1.35;
}
#profile-sheet .sheet-panel .btn {
  margin-top: 0.2rem;
  padding: 0.52rem 0.85rem;
  font-size: 0.9rem;
}
#profile-sheet .nick-color-row input[type="color"] {
  width: 2.2rem;
  height: 1.7rem;
}
#members-sheet .members-list .avatar {
  width: 1.85rem;
  height: 1.85rem;
  font-size: 0.72rem;
}

.muted-count {
  font-size: 0.85em;
  font-weight: 500;
  color: var(--ink-muted);
}
.owner-manage-panel .hint.tight {
  margin: 0 0 0.55rem;
  font-size: 0.75rem;
}
.owner-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}
.owner-toolbar .btn {
  width: auto;
  margin: 0;
}
.owner-toolbar-refresh {
  margin-left: auto;
  font-size: 0.82rem;
  padding: 0.32rem 0.85rem;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.owner-page-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.owner-mgmt-tabs {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  padding: 0 0.1rem;
}
.owner-mgmt-tab {
  appearance: none;
  border: 1px solid rgba(20, 32, 30, 0.12);
  background: #fff;
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.owner-mgmt-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.owner-ban-hint {
  flex: 1;
  margin: 0;
  min-width: 0;
}
.owner-guests-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.owner-table-wrap {
  flex: 1;
  min-height: 12rem;
  overflow: auto;
  margin: 0 0 0.55rem;
  border: 1px solid rgba(20, 32, 30, 0.08);
  border-radius: 12px;
  background: #fff;
}
.owner-guest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 720px;
}
.owner-guest-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f1;
  color: var(--ink-muted);
  font-weight: 600;
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid rgba(20, 32, 30, 0.08);
  white-space: nowrap;
}
.owner-guest-table tbody td {
  padding: 0.5rem 0.45rem;
  border-bottom: 1px solid rgba(20, 32, 30, 0.06);
  vertical-align: middle;
  color: var(--ink);
}
.owner-guest-table tbody tr {
  transition: background 0.15s ease;
}
.owner-guest-table tbody tr:hover {
  background: rgba(26, 122, 104, 0.06);
}
.owner-guest-table .col-check {
  width: 2rem;
  text-align: center;
}
.owner-guest-table input[type="checkbox"] {
  width: auto !important;
  height: auto;
  margin: 0;
  accent-color: var(--accent);
  box-shadow: none;
  padding: 0;
  border: none;
  background: transparent;
}
.owner-guest-table .guest-name {
  font-weight: 600;
  max-width: 6.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.owner-guest-table .guest-sub {
  margin-top: 0.12rem;
  font-size: 0.68rem;
  color: var(--ink-muted);
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.owner-guest-table .col-ip {
  max-width: 9rem;
  word-break: break-all;
  font-size: 0.72rem;
  color: var(--ink-muted);
}
.owner-guest-table .col-time {
  white-space: nowrap;
  color: var(--ink-muted);
  font-size: 0.72rem;
}
.owner-guest-table .status {
  font-size: 0.72rem;
  color: var(--ink-muted);
  white-space: nowrap;
}
.owner-guest-table .status.on {
  color: #1a7a68;
  font-weight: 600;
}
.owner-guest-table .status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
}
.owner-guest-table .status.is-admin {
  color: #0b6e99;
  font-weight: 600;
}
.owner-guest-table .status.is-muted {
  color: #b45309;
  font-weight: 600;
}
.owner-guest-table .status.is-banned {
  color: #c0392b;
  font-weight: 600;
}
.owner-guest-table .status.is-action {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: currentColor;
  opacity: 0.92;
  transition: opacity 0.12s ease, filter 0.12s ease;
}
.owner-guest-table .status.is-action:hover {
  opacity: 1;
  filter: brightness(0.88);
}
.owner-guest-table .status.is-action:active {
  opacity: 0.75;
}
.owner-guest-table .remark-edit {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  max-width: 6rem;
  text-align: left;
  color: var(--ink);
  font-size: 0.75rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.owner-guest-table .remark-edit.empty {
  color: var(--ink-muted);
}
.owner-guest-table .col-ops .row-actions {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  margin: 0;
}
.owner-guest-table .row-actions .btn {
  width: auto;
  margin: 0;
  white-space: nowrap;
  padding: 0.22rem 0.45rem;
  font-size: 0.72rem;
}
.owner-guest-table .row-actions .btn-ban-ip {
  color: #e03434;
}
.owner-guest-table .row-actions .btn-banned {
  color: var(--ink-muted);
}
.owner-guests-list {
  list-style: none;
  margin: 0 0 0.55rem;
  padding: 0;
  flex: 1;
  min-height: 12rem;
  max-height: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.owner-guests-list li {
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(20, 32, 30, 0.04);
  border: 1px solid rgba(20, 32, 30, 0.06);
}
.owner-guests-list input[type="checkbox"] {
  width: auto !important;
  height: auto;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  box-shadow: none;
  padding: 0;
  border: none;
  background: transparent;
}
.owner-guests-list .row-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
}
.owner-guests-list .guest-nick {
  flex: 0 1 auto;
  max-width: 5.5rem;
  min-width: 0;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.owner-guests-list .meta-line {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.7rem;
  color: var(--ink-muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.owner-guests-list .status {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--ink-muted);
  white-space: nowrap;
}
.owner-guests-list .status.on {
  color: #1a7a68;
  font-weight: 600;
}
.owner-guests-list .row-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  flex-shrink: 0;
}
.owner-guests-list .row-actions .btn {
  width: auto;
  margin: 0;
  white-space: nowrap;
  padding: 0.22rem 0.45rem;
  font-size: 0.72rem;
}
.owner-guests-list .row-actions .btn-ban-ip {
  color: #e03434;
}
.owner-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.owner-pager .btn {
  width: auto;
  margin: 0;
}
.owner-pager .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.owner-ip-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}
.owner-ip-add input {
  flex: 1;
  min-width: 5.5rem;
  border: 1.5px solid rgba(20, 32, 30, 0.14);
  border-radius: 10px;
  padding: 0.42rem 0.55rem;
  font: inherit;
  font-size: 0.88rem;
  background: #f3f5f4;
}
.owner-ip-add .btn {
  width: auto;
  margin: 0;
}
.owner-ip-list {
  list-style: none;
  margin: 0 0 0.55rem;
  padding: 0;
  max-height: min(48vh, 380px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.owner-ip-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  background: rgba(20, 32, 30, 0.04);
}
.owner-ip-list .ip-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.owner-ip-list .ip {
  font-weight: 600;
  font-size: 0.88rem;
}
.owner-ip-list .reason {
  font-size: 0.72rem;
  color: var(--ink-muted);
}
.owner-ip-list .btn {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}
.owner-sec-sub {
  margin: 0.75rem 0 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
}
.owner-manage-panel .btn-danger.btn-mini {
  width: auto;
}
