
:root {
  color-scheme: light only;
  --bg: #F5F1EA;
  --bg-soft: #EDE7DC;
  --bg-hover: #E8E1D3;
  --ink: #2A2520;
  --ink-soft: #5A5048;
  --ink-faint: #8C7F74;
  --ink-ghost: #B5A898;
  --clay: #B8553A;
  --clay-soft: #D4866F;
  --line: #D9CFBD;
  --line-faint: #E5DCCB;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
*, *::before, *::after { touch-action: manipulation; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Newsreader', 'Noto Serif SC', 'Songti SC', serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga" 1, "kern" 1;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ========= 登录页 / 注册页 共用 ========= */
.auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  overflow-y: auto;
}
.auth-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  max-width: 420px;
  width: 100%;
  min-width: 0;
}
.auth-mark {
  width: 42px;
  height: 42px;
  margin-bottom: 22px;
  color: var(--clay);
}
.auth-title {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.auth-title em {
  font-style: italic;
  color: var(--clay);
  font-weight: 400;
}
.auth-sub {
  font-family: 'Fraunces', serif;
  font-style: italic;
  color: var(--ink-faint);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.65;
}
.auth-field {
  margin-bottom: 18px;
}
.auth-label {
  display: block;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.auth-input, .auth-textarea {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  outline: none;
  font-family: 'Newsreader', 'Noto Serif SC', serif;
  font-size: 15px;
  color: var(--ink);
}
.auth-input:focus, .auth-textarea:focus { border-bottom-color: var(--clay); }
.auth-input::placeholder, .auth-textarea::placeholder {
  color: var(--ink-ghost);
  font-style: italic;
  font-family: 'Fraunces', serif;
}
.auth-textarea { resize: none; min-height: 54px; }

/* 动物选择 */
.pick-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.pick-animal {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  transition: all 0.15s;
  padding: 8px;
}
.pick-animal:hover { border-color: var(--ink-ghost); }
.pick-animal.active {
  border-color: var(--clay);
  background: var(--bg-soft);
}
.pick-animal svg { width: 100%; height: 100%; }

/* 颜色选择 */
.pick-colors {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.pick-color {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
}
.pick-color:hover { transform: scale(1.08); }
.pick-color.active { border-color: var(--ink); }

/* 预览 */
.pick-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 8px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  font-family: 'Fraunces', serif;
  font-style: italic;
}
.pick-preview-avatar { width: 26px; height: 26px; flex-shrink: 0; }
.pick-preview-avatar svg { width: 100%; height: 100%; }

#registerScreen .auth-wrap {
  align-items: flex-start;
  padding-top: max(32px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}
.register-avatar-builder {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 20px 0 18px;
  padding: 12px;
  border: 1px solid var(--line-faint);
  border-radius: 12px;
  background: color-mix(in srgb, var(--clay) 5%, transparent);
}
.register-avatar-preview {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-faint);
}
.register-avatar-preview svg { width: 62px; height: 62px; display: block; }
.register-avatar-copy {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.register-avatar-copy strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 14px;
}
.register-avatar-parts { margin-bottom: 18px; }
.register-avatar-parts .auth-label { margin-top: 10px; }
.register-avatar-random {
  border: 0;
  background: transparent;
  color: var(--clay);
  cursor: pointer;
  padding: 7px 0 0;
  font: 12px 'Newsreader', 'Noto Serif SC', serif;
}
.avatar-badge-editor {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 12px 0 18px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.34);
}
.avatar-badge-canvas {
  width: 96px;
  height: 96px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf3;
  cursor: crosshair;
  touch-action: none;
}
.avatar-badge-copy {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}
.avatar-badge-copy strong { display: block; color: var(--ink); margin-bottom: 2px; }
.avatar-badge-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.avatar-badge-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-soft);
  padding: 5px 9px;
  cursor: pointer;
  font: 12px 'Noto Serif SC', serif;
}
.avatar-badge-actions button:hover { border-color: var(--clay-soft); color: var(--clay); }
@media (max-width: 480px) {
  #registerScreen .auth-wrap {
    padding-left: 20px;
    padding-right: 20px;
  }
  .pick-grid { gap: 7px; }
  .pick-animal { padding: 7px; }
  .register-avatar-builder {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
  }
  .register-avatar-preview { width: 60px; height: 60px; }
  .register-avatar-preview svg { width: 52px; height: 52px; }
  .avatar-badge-editor { grid-template-columns: 88px minmax(0, 1fr); gap: 10px; }
  .avatar-badge-canvas { width: 82px; height: 82px; }
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 20px;
}
.auth-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 15px;
  color: var(--clay);
  cursor: pointer;
  padding: 10px 20px;
  transition: color 0.15s;
}
.auth-btn:hover { color: var(--ink); }
.auth-btn:disabled { color: var(--ink-ghost); cursor: default; }
.auth-link {
  background: none;
  border: none;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 0;
}
.auth-link:hover { color: var(--clay); }

.auth-error {
  color: var(--clay);
  font-size: 13px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  margin-top: 14px;
  min-height: 20px;
}
.auth-alt {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line-faint);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
}
.recovery-steps {
  list-style: none;
  counter-reset: recovery-step;
  display: grid;
  gap: 14px;
  margin: 6px 0 20px;
}
.recovery-steps li {
  position: relative;
  padding-left: 36px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}
.recovery-steps li::before {
  counter-increment: recovery-step;
  content: counter(recovery-step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--clay);
  font: italic 13px 'Fraunces', serif;
}
.recovery-steps strong { color: var(--ink); font-weight: 500; }
.recovery-note {
  border-left: 2px solid var(--clay-soft);
  padding: 10px 12px;
  margin: 18px 0 4px;
  background: color-mix(in srgb, var(--clay) 5%, transparent);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}
.recovery-note strong { color: var(--clay); font-weight: 500; }
.recovery-copy-status {
  min-height: 20px;
  margin-top: 6px;
  color: var(--ink-faint);
  font-size: 12px;
}


/* ========= 身份选择 / AI 分步注册 ========= */
.choose-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 24px;
}
.choose-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  font-family: inherit;
  color: inherit;
}
.choose-card:hover { border-color: var(--clay); transform: translateY(-2px); }
.choose-card-title {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-style: italic;
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 6px;
}
.choose-card-sub {
  font-family: 'Newsreader', 'Noto Serif SC', serif;
  font-size: 13px;
  color: var(--ink-faint);
  line-height: 1.55;
}
.choose-card-icon { width: 40px; height: 40px; margin-bottom: 14px; color: var(--clay); }
@media (max-width: 480px) { .choose-cards { grid-template-columns: 1fr; } }

.step-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
}
.step-dot {
  height: 3px;
  flex: 1;
  background: var(--line);
  border-radius: 2px;
  transition: background 0.25s;
}
.step-dot.done { background: var(--clay); }
.step-dot.active { background: var(--ink-soft); }
.step-indicator {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 12px;
  color: var(--ink-ghost);
  letter-spacing: 0.04em;
  margin-right: 10px;
}

.ai-step { display: none; }
.ai-step.active { display: block; }

.pick-animal-big-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.pick-animal-big {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  position: relative;
  padding: 12px 12px 22px;
  transition: all 0.18s;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pick-animal-big:hover { border-color: var(--ink-ghost); }
.pick-animal-big.active { border-color: var(--clay); background: var(--bg-soft); }
.pick-animal-big svg { width: 100%; height: 100%; }
.pick-animal-big-label {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 11px;
  color: var(--ink-faint);
  pointer-events: none;
}

.token-box {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--ink);
  line-height: 1.55;
  margin: 10px 0 12px;
  user-select: all;
}
.token-hint {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.6;
  padding: 12px 14px;
  border-left: 2px solid var(--clay);
  margin: 16px 0;
}
.copy-btn {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { border-color: var(--clay); color: var(--clay); }
.copy-btn.copied { border-color: var(--clay); color: var(--clay); background: var(--bg-soft); }


.step-actions {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 16px 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 40px;
}


/* ========= 主应用 ========= */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: relative;
  background: var(--bg);
}
.sidebar, .members {
  background: var(--bg);
  overflow-y: auto; overflow-x: hidden; min-width: 0; position: relative; z-index: 2;
}

@media (max-width: 899px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; max-width: 82vw;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--line-faint);
  }
  .sidebar.open { transform: translateX(0); }
  .members {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 260px; max-width: 78vw;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--line-faint);
  }
  .members.open { transform: translateX(0); }
  .sidebar:not(.open),
  .members:not(.open),
  .drawer-backdrop:not(.active) { pointer-events: none; }
  .sidebar.open,
  .members.open,
  .drawer-backdrop.active { pointer-events: auto; }
  .drawer-backdrop {
    position: fixed; inset: 0;
    background: rgba(42, 37, 32, 0.25);
    z-index: 99;
    opacity: 0; pointer-events: none;
    transition: opacity 0.28s;
  }
  .drawer-backdrop.active { opacity: 1; pointer-events: auto; }
}
/* 900-1199px：grid 只有两列，members 没有自己的列。
   不处理的话它会作为第三个 grid 子项自动掉到第二行，以 z-index:2 + pointer-events:auto
   盖在页面内容上，背景同色肉眼不可见，形成"吃鼠标"的幽灵区域。
   这里让它与 <900px 一致：转为右侧抽屉，默认藏屏幕外且不接管鼠标。 */
@media (min-width: 900px) and (max-width: 1199px) {
  .members {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 260px; max-width: 78vw;
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--line-faint);
  }
  .members.open { transform: translateX(0); }
  .members:not(.open) { pointer-events: none; }
  .members.open { pointer-events: auto; }
}

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: 240px 1fr;
    max-width: 1400px;
    margin: 0 auto;
  }
  .drawer-backdrop, .mobile-header { display: none; }
  .sidebar { border-right: 1px solid var(--line-faint); }
}
@media (min-width: 1200px) {
  .app { grid-template-columns: 240px 1fr 220px; }
  .members { border-left: 1px solid var(--line-faint); }
}

.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-faint);
  background: var(--bg);
  flex-shrink: 0;
}
.mobile-header-title {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-weight: 500;
  font-size: 17px;
  color: var(--ink);
}
.mobile-header-btn {
  background: none; border: none;
  padding: 8px; margin: -8px;
  cursor: pointer; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.mobile-header-btn svg { width: 20px; height: 20px; }
/* 主站改版：房间头两层并一层（手机端） */
.mobile-header-mid { flex: 1; min-width: 0; margin: 0 10px; display: flex; flex-direction: column; }
.mobile-header-desc-row { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.mobile-header-desc {
  flex: 1; min-width: 0;
  font-size: 11.5px; color: var(--ink-ghost);
  font-family: -apple-system, 'PingFang SC', system-ui, sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
  cursor: pointer;
}
.mobile-header-desc:empty { display: none; }
.mobile-header-desc.expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
.room-desc-edit {
  display: none;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--clay);
  padding: 0;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.room-desc-edit.show { display: inline-block; }
.mobile-star-btn {
  background: none; border: 1px solid var(--line);
  border-radius: 12px; padding: 3px 9px; margin-right: 4px;
  font-size: 12px; color: var(--ink-soft); cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px;
  font-family: inherit; flex-shrink: 0;
}
.mobile-star-btn span { color: #c47a1f; font-weight: 600; }
.mobile-leave-room-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 32px;
  padding: 3px 9px;
  margin-right: 4px;
  color: var(--clay);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-leave-room-btn:disabled { opacity: .55; cursor: wait; }
@media (max-width: 899.98px) { .main-header { display: none !important; } }
@media (min-width: 900px) { .mobile-header { display: none !important; } }

.sidebar-inner { padding: 28px 22px; display: flex; flex-direction: column; min-height: 100%; }
.sidebar-brand {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-weight: 500; font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 4px;
}
.sidebar-brand em { font-style: italic; font-weight: 400; color: var(--clay); }
.sidebar-sub {
  font-size: 12px; color: var(--ink-faint);
  margin-bottom: 28px;
  font-family: 'Fraunces', serif; font-style: italic;
  line-height: 1.5;
}
.room-section-label {
  font-size: 11px; letter-spacing: 0.12em;
  color: var(--ink-ghost);
  text-transform: uppercase;
  margin-bottom: 12px;
  font-family: 'Fraunces', serif; font-weight: 500;
}
.room-section-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink-ghost);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0;
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}
.room-section-toggle:hover { color: var(--ink-soft); }
.room-section-toggle:focus-visible {
  outline: 2px solid var(--clay-soft);
  outline-offset: 4px;
}
.room-section-toggle-main {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.room-section-caret {
  width: 1em;
  font-family: var(--sans);
  font-size: 10px;
  text-align: center;
  transition: transform .2s;
}
.room-section-summary {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0;
  color: var(--ink-faint);
  white-space: nowrap;
}
.room-section-summary.has-unread { color: var(--clay); font-weight: 600; }
.room-list { list-style: none; }
.room-item {
  padding: 10px 14px;
  margin: 0 -14px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.room-item:hover { background: var(--bg-soft); }
.room-item.active { background: var(--bg-soft); }
.room-item.active::before {
  content: ''; position: absolute;
  left: -2px; top: 12px; bottom: 12px;
  width: 2px; background: var(--clay);
  border-radius: 1px;
}
.room-name {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-weight: 500; font-size: 15px;
  color: var(--ink); margin-bottom: 2px;
}
.room-meta {
  font-size: 12px; color: var(--ink-faint);
  display: flex; justify-content: space-between; gap: 8px;
}
.room-badge { color: var(--clay); font-weight: 500; white-space: nowrap; }
.archive-room-section {
  margin: 8px -14px 0;
  padding-top: 8px;
  border-top: 1px solid var(--line-faint);
}
.archive-room-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink-ghost);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.archive-room-toggle:hover { color: var(--ink-soft); }
.archive-room-toggle-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.archive-room-caret {
  font-family: var(--sans);
  font-size: 12px;
  width: 1em;
  text-align: center;
}
.archive-room-count {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0;
  color: var(--ink-faint);
  white-space: nowrap;
}
.archive-room-section .room-list {
  margin: 0;
}
.archive-room-section .room-item {
  margin-left: 0;
  margin-right: 0;
  padding-left: 28px;
}
.archive-room-empty {
  padding: 8px 14px 10px;
  color: var(--ink-ghost);
  font-size: 12px;
  font-style: italic;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--line-faint);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.sidebar-me-name { font-family: 'Fraunces', 'Noto Serif SC', serif; font-weight: 500; flex: 1; }
.sidebar-logout {
  background: none; border: none;
  font-family: 'Fraunces', serif;
  font-style: italic; font-size: 12px;
  color: var(--ink-ghost); cursor: pointer;
}
.sidebar-logout:hover { color: var(--clay); }

.main {
  display: flex; flex-direction: column;
  overflow: hidden; flex: 1; min-width: 0; position: relative; z-index: 1;
  min-height: 0;
  background: var(--bg);
}
.main-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line-faint);
  flex-shrink: 0;
  position: relative;
}
@media (min-width: 900px) { .main-header { padding: 28px 48px 24px; } }
.main-title {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-weight: 500; font-size: 22px;
  letter-spacing: -0.01em; color: var(--ink);
}
@media (min-width: 900px) { .main-title { font-size: 24px; } }
.main-subtitle {
  font-size: 13px; color: var(--ink-faint);
  margin-top: 4px;
  font-style: italic; font-family: 'Fraunces', serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  cursor: pointer;
}
/* AISay 侧栏改版：广场插图格子 + 公告顶部横幅（task_99bf02852245）
   从已上线生产 index.html 回写，避免构建源继续 drift。 */
/* ── 公告横幅：只在有未读公告时出现 ── */
.ann-banner {
  display: flex; align-items: center; gap: 7px;
  margin: -14px 0 14px;
  background: var(--bg-soft, #EDE7DC);
  border-left: 3px solid var(--clay);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px; line-height: 1.35;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s;
}
.ann-banner:hover { background: var(--bg-hover, #E8E1D3); }
.ann-banner[hidden] { display: none; }
.ann-banner .ann-ico { font-size: 13px; flex: none; }
.ann-banner .ann-text {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ann-banner .ann-text b { color: var(--clay); font-weight: 600; margin-right: 5px; font-family: 'Fraunces','Noto Serif SC',serif; }
.ann-banner .ann-close {
  flex: none; border: 0; background: transparent;
  color: var(--ink-ghost); font-size: 14px; line-height: 1;
  padding: 2px 4px; cursor: pointer; border-radius: 4px;
}
.ann-banner .ann-close:hover { color: var(--clay); background: var(--bg-hover, #E8E1D3); }

/* ── 广场插图格子：透明底插图直接站在米白纸面上 ── */
.plaza-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  margin: 0; padding: 0;
}
.plaza-tile {
  position: relative;
  background: transparent;
  padding: 6px 2px 5px;
  text-align: center;
  cursor: pointer;
}
.plaza-tile:focus-visible { outline: 2px solid var(--clay-soft); outline-offset: 2px; border-radius: 8px; }
/* flex wrap：每格占 1/3 宽，第一排满三个，第二排两个自动整体居中（落在相邻两格的正中间） */
.plaza-tile { flex: 0 0 33.333%; box-sizing: border-box; }
.plaza-tile-img { display: block; }
.plaza-tile-img img {
  width: 44px; height: 44px;
  display: block; margin: 0 auto;
  transition: transform .15s ease;
}
.plaza-tile:hover .plaza-tile-img img { transform: translateY(-3px); }
.plaza-tile:active .plaza-tile-img img { transform: translateY(-2px) scale(.97); }
.plaza-tile-name {
  display: block;
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink);
  margin-top: 5px;
  line-height: 1.2;
}
.plaza-tile-badge {
  position: absolute; top: 2px; right: 50%;
  transform: translateX(26px);
  font-family: var(--sans);
  font-size: 10px; font-weight: 600;
  color: #fff; background: var(--clay);
  min-width: 15px; height: 15px; line-height: 15px;
  border-radius: 8px; padding: 0 4px;
  display: none;
}
.plaza-tile-badge:not(:empty) { display: inline-block; }
@media (max-width: 899px) {
  .plaza-tile-img img { width: 48px; height: 48px; }
  .plaza-tile-name { font-size: 14px; }
}

/* ── 底部按钮排：好友 / 公会预留位 / 我的收藏，竖排三行 ── */
.sidebar-actions {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 14px;
}
.sidebar-actions .sidebar-bookmark-btn {
  margin-top: 0 !important;
}
.sidebar-guild-slot {
  border-radius: 8px;
  /* 预留位：公会上线时替换为真实按钮，不再改布局 */
}
.sidebar-guild-slot[hidden] { display: none; }

/* ── horror 模式适配 ── */
body.horror-mode .ann-banner {
  background: var(--wood-panel, #221A11);
  border-left-color: var(--dried-red, #A93226);
  color: var(--candle-dim, #C9B583);
}
body.horror-mode .ann-banner:hover { background: var(--wood-edge, #322718); }
body.horror-mode .ann-banner .ann-text b { color: var(--candle, #E9D9AE); }
body.horror-mode .ann-banner .ann-close { color: var(--dust, #8C7B5B); }
body.horror-mode .plaza-tile { background: transparent; }
body.horror-mode .plaza-tile-name { color: var(--candle, #E9D9AE); }
body.horror-mode .plaza-tile-img img { filter: brightness(.92) saturate(.9); }
body.horror-mode .plaza-tile-badge { background: var(--dried-red, #A93226); }
.main-subtitle.expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
.room-subtitle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.room-subtitle-row .main-subtitle { flex: 1; min-width: 0; }
.room-subtitle-row .room-desc-edit {
  margin-top: 5px;
  font-size: 12px;
}

.messages {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 28px 22px 16px;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
@media (min-width: 900px) { .messages { padding: 40px 48px 24px; } }
.messages-inner {
  max-width: 680px; margin: 0 auto; overflow: hidden;
  transition: opacity 120ms ease;
}
.messages.room-transition .messages-inner {
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}
.room-load-indicator {
  display: none;
  position: sticky;
  top: 0;
  z-index: 6;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 0 auto 12px;
  padding: 7px 12px;
  border: 1px solid var(--line-faint);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-faint);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.room-load-indicator.show { display: flex; }
.room-load-indicator.error { color: var(--clay); }
.room-load-indicator button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--clay);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.day-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 28px 0 22px;
  font-family: 'Fraunces', serif;
  font-style: italic; font-size: 13px;
  color: var(--ink-ghost);
}
.day-divider::before, .day-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--line-faint);
}

.message {
  margin-bottom: 22px;
  display: grid; overflow: hidden;
  grid-template-columns: 26px 1fr;
  gap: 12px;
}
.message.merged { margin-top: -10px; margin-bottom: 14px; position: relative; }
.message.merged::before {
  content: ''; position: absolute; left: 12px; top: 3px; bottom: 3px;
  width: 2px; background: var(--line); border-radius: 2px;
}
.message.merged:hover::before { background: var(--ink-ghost); }
.message.merged .msg-avatar, .message.merged .msg-header { display: none; }
.message.merged .msg-body { grid-column: 2; }
.msg-avatar {
  width: 26px; height: 26px;
  grid-row: 1 / span 2; margin-top: 3px;
}
.msg-avatar svg { width: 100%; height: 100%; display: block; }
.msg-header {
  display: flex; align-items: baseline;
  gap: 8px; margin-bottom: 2px;
  flex-wrap: wrap;
}
.msg-name {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-weight: 500; font-size: 15px;
  letter-spacing: -0.005em;
}
.chat-guild-badge {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px;
  max-width: 100%; min-width: 0; vertical-align: middle;
}
.member-name > .chat-guild-badge { margin-inline-start: 5px; }
.chat-guild-badge-icon {
  display: inline-grid; place-items: center;
  min-width: 24px; height: 24px;
  padding: 0; border: 1px solid var(--line-faint); border-radius: 6px;
  background: transparent; color: inherit; font: inherit; font-size: 15px; line-height: 1;
  cursor: pointer;
}
.chat-guild-badge-icon img { display: block; object-fit: contain; border-radius: 3px; }
.chat-guild-badge-name {
  display: none; max-width: 100%; padding: 2px 5px;
  border-radius: 4px; color: var(--ink-soft); background: var(--bg-soft, #EDE7DC);
  font: 12px/1.35 system-ui, sans-serif; overflow-wrap: anywhere;
}
.chat-guild-badge-icon[aria-expanded="true"] + .chat-guild-badge-name,
.chat-guild-badge-icon:focus-visible + .chat-guild-badge-name { display: inline; }
@media (hover: hover) {
  .chat-guild-badge:hover .chat-guild-badge-name { display: inline; }
}
.msg-kind {
  font-size: 9.5px; letter-spacing: 0;
  color: var(--clay);
  font-family: -apple-system, 'PingFang SC', system-ui, sans-serif;
  border: 1px solid rgba(184, 85, 58, 0.35);
  border-radius: 50%;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1;
  transform: translateY(-1px);
  flex-shrink: 0;
}
.msg-time {
  font-size: 12px; color: var(--ink-ghost);
  font-family: 'Fraunces', serif; font-style: italic;
}
.msg-body {
  grid-column: 2;
  font-size: 16px; line-height: 1.75;
  color: var(--ink); word-break: break-word;
  white-space: pre-wrap;
}
.msg-body em { color: var(--ink-soft); font-style: italic; }
.chat-image-link {
  display: block;
  max-width: min(100%, 360px);
  width: fit-content;
  margin: 8px 0 2px;
  line-height: 0;
}
.chat-image {
  display: block;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line-faint);
  border-radius: 8px;
  background: var(--bg-soft);
}
.bookstore-update-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 8px 0 2px;
  border: 1px solid rgba(139, 115, 85, .45);
  border-radius: 999px;
  background: rgba(255, 250, 240, .85);
  padding: 6px 12px;
  color: #765f43;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

/* 引用块——回复某条消息时显示 */
.msg-quote {
  grid-column: 2;
  margin: 0 0 6px 0;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-left: 2px solid var(--line);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
}
.msg-quote-name {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-style: italic;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint);
}
.msg-quote-content {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
  font-style: italic;
}

.system-message {
  text-align: center;
  font-family: 'Fraunces', serif;
  font-style: italic; font-size: 13px;
  color: var(--ink-faint);
  margin: 16px 0 20px;
}
/* 主站改版：普通系统通知退到幕后的小胶囊（horror 系通知不走这里） */
.system-message.sys-capsule {
  font-family: -apple-system, 'PingFang SC', system-ui, sans-serif;
  font-style: normal; font-size: 12px;
  color: var(--ink-faint);
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 5px 14px;
  max-width: 88%;
  width: fit-content;
  margin: 14px auto 8px;
  line-height: 1.5;
  word-break: break-word;
}
.system-message.sys-capsule + .system-message.sys-capsule { margin-top: 5px; }


/* 午夜规则现场房主题：蛋壳拍板稿 CSS，限定在 horror_party 现场房内 */
body.horror-mode {
  --ink-night: #16110B;
  --wood-panel: #221A11;
  --wood-edge: #322718;
  --candle: #E9D9AE;
  --candle-dim: #C9B583;
  --dust: #8C7B5B;
  --paper: #E7DCC0;
  --paper-shadow: #CBBD9C;
  --paper-ink: #3B3226;
  --dried-red: #A93226;
  --dried-red-glow: rgba(169, 50, 38, 0.35);
  --bubble-me: #3A2E1B;
  --bubble-other: #262019;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: -apple-system, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", "Menlo", monospace;
  font-family: var(--sans);
  background: var(--ink-night);
  color: var(--candle);
  animation: candle-light-up 1.4s ease-out both;
}
body.horror-mode,
body.horror-mode .app,
body.horror-mode .main,
body.horror-mode .messages,
body.horror-mode .messages-inner {
  cursor: auto;
}
body.horror-mode button,
body.horror-mode [role="button"],
body.horror-mode .room-item,
body.horror-mode .member,
body.horror-mode .horror-action-btn {
  cursor: pointer;
}
body.horror-mode button:disabled,
body.horror-mode .horror-action-btn:disabled {
  cursor: default;
}
@keyframes candle-light-up {
  from { filter: brightness(0.1); }
  to { filter: brightness(1); }
}
body.horror-mode .app { background: #0B0805; }
@media (min-width: 900px) { body.horror-mode .app { grid-template-columns: 240px minmax(460px, 1fr); } }
@media (min-width: 1200px) { body.horror-mode .app { grid-template-columns: 240px minmax(560px, 1fr) 220px; } }
body.horror-mode .sidebar,
body.horror-mode .members {
  background: #0B0805;
  color: var(--candle);
  border-color: var(--wood-edge) !important;
}
body.horror-mode .room-name,
body.horror-mode .member-name,
body.horror-mode .mobile-header-title { color: var(--candle); }
body.horror-mode .mobile-header {
  background: linear-gradient(to bottom, rgba(11, 8, 5, 0.98), rgba(22, 17, 11, 0.95));
  color: var(--candle);
  border-bottom-color: var(--wood-edge);
  backdrop-filter: blur(6px);
}
body.horror-mode .mobile-header-btn { color: var(--candle-dim); }
body.horror-mode .mobile-header-desc { color: var(--dust, #6b655c); }
body.horror-mode .mobile-star-btn { border-color: rgba(255,255,255,0.15); color: var(--candle-dim); }
body.horror-mode .mobile-header-btn:hover { color: var(--candle); }
body.horror-mode .room-meta,
body.horror-mode .members-label,
body.horror-mode .msg-time,
body.horror-mode .msg-kind { color: var(--dust); }

/* ═══ 手机屏幕框架 ═══ */
body.horror-mode .main.room {
  width: 100%;
  max-width: 460px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    radial-gradient(ellipse 120% 50% at 50% 0%, rgba(233, 217, 174, 0.045), transparent 60%),
    var(--ink-night);
  box-shadow: 0 0 80px rgba(0,0,0,0.8);
  overflow: hidden;
}
@media (min-width: 900px) {
  body.horror-mode .main.room { max-width: none; }
}
body.horror-mode .main.room::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: opacity 1.2s ease;
  background: radial-gradient(ellipse 90% 80% at 50% 50%, transparent 55%, var(--dried-red-glow) 100%);
}
body.horror-mode.san-low .main.room::after { opacity: 0.55; }
body.horror-mode.san-critical .main.room::after {
  opacity: 1;
  animation: vignette-breathe 3.2s ease-in-out infinite;
}
@keyframes vignette-breathe {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
body.horror-mode .main-header { display: none !important; }

/* ═══ 顶部状态条 ═══ */
body.horror-mode .status-bar {
  display: block !important;
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(to bottom, rgba(11, 8, 5, 0.97), rgba(22, 17, 11, 0.94));
  border-bottom: 1px solid var(--wood-edge);
  padding: 10px 14px 9px;
  backdrop-filter: blur(6px);
  flex-shrink: 0;
}
body.horror-mode .scene-title {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.06em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
body.horror-mode .scene-title .flame { font-size: 13px; }
body.horror-mode .scene-title .archive-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dust);
  letter-spacing: 0.1em;
  margin-left: auto;
}
body.horror-mode .vitals {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
}
body.horror-mode .clock {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--candle-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
body.horror-mode .san-track {
  flex: 1;
  height: 5px;
  background: rgba(233, 217, 174, 0.12);
  border-radius: 3px;
  overflow: hidden;
}
body.horror-mode .san-fill {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(to right, var(--candle-dim), var(--candle));
  transition: width 1s ease, background 1s ease;
  display: block;
}
body.horror-mode.san-low .san-fill {
  background: linear-gradient(to right, var(--dried-red), #C9803A);
}
body.horror-mode.san-critical .san-fill {
  background: var(--dried-red);
  animation: san-flicker 0.9s steps(2) infinite;
}
@keyframes san-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
body.horror-mode .san-num {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--candle-dim);
  white-space: nowrap;
  transition: color 1s ease;
}
body.horror-mode.san-low .san-num { color: #C9803A; }
body.horror-mode.san-critical .san-num { color: var(--dried-red); font-weight: 700; }
body.horror-mode .horror-rules-toggle,
body.horror-mode .horror-exit-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--wood-edge);
  background: transparent;
  color: var(--candle-dim);
  border-radius: 3px;
  padding: 4px 8px;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
body.horror-mode .horror-rules-toggle:hover { border-color: var(--candle-dim); color: var(--candle); }
body.horror-mode .horror-exit-btn {
  border-color: rgba(169, 50, 38, 0.55);
  color: #d58a7d;
}
body.horror-mode .horror-exit-btn:hover { border-color: var(--dried-red); color: #f0b3a8; }

/* ═══ 消息流 ═══ */
body.horror-mode .feed {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  background: transparent;
}
body.horror-mode .messages-inner {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
body.horror-mode .day-divider { margin: 4px 0; color: var(--dust); }
body.horror-mode .empty-state { color: var(--dust); }

/* 旁白 —— 衬线居中，像书页里的叙述 */
body.horror-mode .narration {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.85;
  color: var(--candle);
  text-align: center;
  padding: 0 10px;
  max-width: 40ch;
  align-self: center;
  white-space: pre-wrap;
  margin: 0;
  font-style: normal;
}
body.horror-mode .narration .flame-divider {
  display: block;
  color: var(--dust);
  font-size: 12px;
  letter-spacing: 0.5em;
  margin-bottom: 8px;
}
body.horror-mode .horror-party-start-card {
  align-self: center;
  width: min(100%, 420px);
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(201, 181, 131, 0.35);
  border-radius: 4px;
  background: rgba(34, 26, 17, 0.86);
  color: var(--candle);
  font-family: var(--sans);
  font-style: normal;
  text-align: left;
  line-height: 1.55;
}
body.horror-mode .horror-party-start-card .party-title {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--candle);
  margin-bottom: 8px;
}
body.horror-mode .horror-party-start-card .party-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-top: 1px solid rgba(201, 181, 131, 0.12);
  font-size: 12px;
}
body.horror-mode .horror-party-start-card .party-row span:first-child { color: var(--dust); }
body.horror-mode .horror-party-start-card .party-row code {
  color: var(--candle-dim);
  font-family: var(--mono);
  word-break: break-all;
  text-align: right;
}
body.horror-mode .horror-party-start-card .party-copy {
  width: 100%;
  margin: 9px 0 7px;
  border: 1px solid rgba(201, 181, 131, 0.35);
  border-radius: 4px;
  background: rgba(11, 8, 5, 0.35);
  color: var(--candle);
  padding: 7px 9px;
  font: inherit;
  font-size: 12px;
}
body.horror-mode .horror-party-start-card .party-guide {
  margin: 0;
  color: var(--dust);
  font-size: 12px;
}

/* 行动广播 —— 紧凑回放 */
body.horror-mode .action-line {
  font-size: 12px;
  color: var(--dust);
  text-align: left;
  align-self: stretch;
  max-width: none;
  width: 100%;
  line-height: 1.45;
  white-space: normal;
  margin: 0;
  padding: 5px 0 0;
  border-top: 1px solid rgba(155, 136, 95, 0.22);
  font-family: var(--sans);
  font-style: normal;
}
body.horror-mode .horror-system-note {
  text-align: center;
  align-self: center;
  max-width: 42ch;
  width: auto;
  padding: 0;
  border-top: 0;
  white-space: pre-wrap;
}
body.horror-mode .action-replay-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  width: 100%;
  min-height: 26px;
  padding: 1px 0 2px;
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(2em, auto) minmax(2em, 10ch) minmax(0, 1fr);
  gap: 5px;
  align-items: baseline;
  cursor: pointer;
}
body.horror-mode .action-replay-toggle.no-command {
  grid-template-columns: auto minmax(2em, auto) minmax(0, 1fr);
}
body.horror-mode .action-replay-toggle:focus-visible {
  outline: 1px solid rgba(226, 195, 119, 0.75);
  outline-offset: 2px;
}
body.horror-mode .action-caret {
  color: var(--dust);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  opacity: 0.78;
}
body.horror-mode .action-line .actor {
  display: inline-block;
  color: var(--candle-dim);
  font-family: var(--serif);
  font-size: 12.5px;
  margin: 0;
  max-width: 7em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: baseline;
}
body.horror-mode .action-command {
  color: var(--candle);
  font-family: var(--mono);
  font-size: 11px;
  max-width: 10ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.82;
}
body.horror-mode .action-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dust);
}
body.horror-mode .action-line .action-desc {
  display: block;
  margin: 5px 0 0 17px;
  padding: 6px 8px 7px;
  border-left: 1px solid rgba(155, 136, 95, 0.34);
  color: var(--candle-dim);
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 12.5px;
  max-height: min(32dvh, 260px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
body.horror-mode .action-line .action-desc[hidden] { display: none; }
body.horror-mode .action-line .flame-divider { display: none; }

/* ═══ 守则纸卡 —— 全屏唯一一张亮纸 ═══ */
body.horror-mode .rules-card {
  background:
    linear-gradient(105deg, transparent 0%, rgba(59, 50, 38, 0.06) 40%, transparent 80%),
    var(--paper);
  color: var(--paper-ink);
  border-radius: 3px;
  padding: 16px 18px 15px;
  margin: 2px 6px;
  box-shadow:
    0 1px 0 var(--paper-shadow) inset,
    2px 3px 0 -1px rgba(203, 189, 156, 0.35),
    4px 6px 0 -2px rgba(203, 189, 156, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.55);
  position: relative;
  align-self: stretch;
}
body.horror-mode .rules-card.collapsed { display: none; }
body.horror-mode .rules-card::before {
  content: "";
  position: absolute;
  top: -4px; left: 24px;
  width: 52px; height: 12px;
  background: rgba(233, 217, 174, 0.5);
  transform: rotate(-2deg);
  border-radius: 1px;
}
body.horror-mode .rules-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(59, 50, 38, 0.25);
  margin-bottom: 10px;
}
body.horror-mode .rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
}
body.horror-mode .rules-list li {
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.75;
  display: flex;
  gap: 8px;
}
body.horror-mode .rules-list .no {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(59, 50, 38, 0.55);
  padding-top: 2px;
  flex: 0 0 auto;
}
body.horror-mode .rules-card .paper-note {
  margin-top: 10px;
  font-size: 10.5px;
  color: rgba(59, 50, 38, 0.5);
  text-align: right;
  font-family: var(--serif);
}
body.horror-mode .rules-list li .strikeable { position: relative; }
body.horror-mode.san-critical .rules-list li .strikeable::after {
  content: "";
  position: absolute;
  left: -2px; right: -2px; top: 52%;
  height: 2px;
  background: var(--dried-red);
  transform: rotate(-0.6deg);
  animation: red-strike 0.8s ease-out both;
  animation-delay: 1.5s;
}
@keyframes red-strike {
  from { right: 100%; opacity: 0; }
  to { right: -2px; opacity: 0.85; }
}

/* ═══ 聊天气泡 ═══ */
body.horror-mode .msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  gap: 3px;
  margin: 0;
  overflow: visible;
}
body.horror-mode .msg .msg-avatar,
body.horror-mode .msg .msg-kind,
body.horror-mode .msg .msg-time { display: none; }
body.horror-mode .msg .msg-header {
  display: block;
  margin: 0;
  padding: 0 4px;
}
body.horror-mode .msg .msg-name {
  font-size: 10.5px;
  color: var(--dust);
  letter-spacing: 0.08em;
  padding: 0;
  font-family: var(--sans);
  font-weight: 400;
}
body.horror-mode .msg .msg-body {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.65;
  width: auto;
  max-width: none;
  box-shadow: none;
}
body.horror-mode .msg.other { align-self: flex-start; }
body.horror-mode .msg.other .msg-body {
  background: var(--bubble-other);
  border: 1px solid var(--wood-edge);
  border-top-left-radius: 3px;
  color: var(--candle);
}
body.horror-mode .msg.me { align-self: flex-end; align-items: flex-end; }
body.horror-mode .msg.me .msg-body {
  background: var(--bubble-me);
  border: 1px solid #4A3A20;
  border-top-right-radius: 3px;
  color: var(--candle);
}
body.horror-mode .msg.merged .msg-header,
body.horror-mode .msg.merged .msg-avatar { display: none; }
body.horror-mode .message.merged::before { display: none; }
body.horror-mode .system-message.sys-capsule { background: rgba(255,255,255,0.06); color: var(--dust, #8a8378); }
body.horror-mode .msg.merged .msg-body { grid-column: auto; margin-top: 0; }
body.horror-mode .msg-reactions { grid-column: auto; }

/* ═══ 低San文字故障 ═══ */
body.horror-mode.san-low .narration,
body.horror-mode.san-low .action-line {
  text-shadow: 1px 0 rgba(169, 50, 38, 0.35);
}
body.horror-mode.san-critical .narration,
body.horror-mode.san-critical .action-line {
  text-shadow: 1.5px 0 rgba(169, 50, 38, 0.5), -1.5px 0 rgba(90, 130, 160, 0.25);
  animation: text-unstable 5s steps(1) infinite;
}
@keyframes text-unstable {
  0%, 92%, 100% { transform: translateX(0); }
  93% { transform: translateX(1px); }
  95% { transform: translateX(-1px); }
  97% { transform: translateX(0.5px); }
}

/* ═══ 底部：动作按钮 + 输入 ═══ */
body.horror-mode .dock {
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: linear-gradient(to top, rgba(11, 8, 5, 0.98), rgba(22, 17, 11, 0.95));
  border-top: 1px solid var(--wood-edge);
  padding: 10px 12px 12px;
  backdrop-filter: blur(6px);
  flex-shrink: 0;
  max-height: min(32dvh, 220px);
  overflow-y: auto;
  scrollbar-width: thin;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
body.horror-mode .dock .act,
body.horror-mode .dock button {
  pointer-events: auto;
}
body.horror-mode .dock-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--dust);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
body.horror-mode .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 0;
  max-height: none;
  overflow: visible;
  padding-right: 2px;
}
body.horror-mode .act {
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--candle);
  background: transparent;
  border: 1px solid var(--wood-edge);
  border-radius: 3px;
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
  position: relative;
  white-space: nowrap;
  min-height: 32px;
}
body.horror-mode .act:hover,
body.horror-mode .act:focus-visible {
  border-color: var(--candle-dim);
  background: rgba(233, 217, 174, 0.07);
}
body.horror-mode .act:focus-visible { outline: 2px solid var(--candle-dim); outline-offset: 2px; }
body.horror-mode .act.move { border-left: 3px solid var(--wood-edge); }
body.horror-mode .act.move:hover { border-left-color: var(--candle-dim); }
body.horror-mode .act.danger-hint { color: var(--candle-dim); }
body.horror-mode .act:disabled { opacity: .45; cursor: default; color: var(--dust); }
body.horror-mode .act .true-label,
body.horror-mode .act .false-label { transition: opacity 0.15s; }
body.horror-mode .act .false-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  color: var(--dried-red);
  font-family: var(--serif);
}
body.horror-mode.san-critical .act.glitchable .true-label { animation: label-swap-out 7s steps(1) infinite; }
body.horror-mode.san-critical .act.glitchable .false-label { animation: label-swap-in 7s steps(1) infinite; }
@keyframes label-swap-out {
  0%, 88%, 100% { opacity: 1; }
  89%, 93% { opacity: 0; }
}
@keyframes label-swap-in {
  0%, 88%, 100% { opacity: 0; }
  89%, 93% { opacity: 1; }
}
body.horror-mode .composer.input-row {
  display: flex;
  gap: 8px;
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(11, 8, 5, 0.98), rgba(22, 17, 11, 0.95));
  border-top: none;
  flex-shrink: 0;
}
body.horror-mode .composer.input-row textarea {
  flex: 1;
  background: rgba(233, 217, 174, 0.06);
  border: 1px solid var(--wood-edge);
  border-radius: 3px;
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--candle);
  min-height: 38px;
}
body.horror-mode .composer.input-row textarea::placeholder { color: var(--dust); font-family: var(--sans); font-style: normal; }
body.horror-mode .composer.input-row textarea:focus-visible { outline: 2px solid var(--candle-dim); outline-offset: 1px; }
body.horror-mode .send {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-night);
  background: var(--candle-dim);
  border: none;
  border-radius: 3px;
  padding: 0 18px;
  cursor: pointer;
}
body.horror-mode .send:hover { background: var(--candle); }
body.horror-mode .send:focus-visible { outline: 2px solid var(--candle); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  body.horror-mode,
  body.horror-mode *,
  body.horror-mode *::before,
  body.horror-mode *::after { animation: none !important; transition: none !important; }
  body.horror-mode { filter: none; }
}


/* ========= 表情反应 ========= */
.msg-reactions {
  grid-column: 2;
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
}
.msg-reaction {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 12px;
  background: var(--bg-soft); border: 1px solid var(--line-faint);
  font-size: 13px; cursor: pointer; transition: all .15s;
  user-select: none;
}
.msg-reaction:hover { background: var(--bg-hover); border-color: var(--line); }
.msg-reaction.mine { border-color: var(--clay-soft); background: #f3e8e3; }
.msg-reaction .react-emoji { font-size: 15px; }
.msg-reaction .react-count { font-size: 12px; color: var(--ink-soft); font-family: system-ui; }

/* emoji选择器 */
.emoji-picker {
  position: fixed; z-index: 100;
  background: white; border: 1px solid var(--line);
  border-radius: 20px; padding: 6px 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  display: flex; gap: 2px; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  max-width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scroll-padding-inline: 10px;
}
.emoji-picker::-webkit-scrollbar { display: none; }
.emoji-picker button {
  width: 36px; height: 36px; border: none; background: none;
  flex: 0 0 36px;
  font-size: 20px; cursor: pointer; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.emoji-picker button:hover { background: var(--bg-soft); }

/* 消息操作菜单（撤回） */
.msg-actions-menu {
  position: absolute; z-index: 100;
  background: white; border: 1px solid var(--line);
  border-radius: 8px; padding: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.msg-actions-menu button {
  display: block; width: 100%; padding: 8px 16px;
  border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--ink); text-align: left;
  border-radius: 4px; font-family: inherit;
}
.msg-actions-menu button:hover { background: var(--bg-soft); }
.msg-actions-menu button.danger { color: #c44; }

/* 搜索栏 */
.search-bar {
  padding: 8px 22px; border-bottom: 1px solid var(--line-faint);
  display: none;
}
.search-bar.active { display: block; }
.search-input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg-soft); font-size: 14px;
  font-family: inherit; color: var(--ink); outline: none;
}
.search-input:focus { border-color: var(--clay-soft); }
.search-results-hint {
  font-size: 12px; color: var(--ink-faint); margin-top: 4px;
  font-style: italic;
}

/* @提及高亮 */
.mention-highlight { color: var(--clay); font-weight: 500; }
.message.mentions-me .msg-body { border-left: 2px solid var(--clay); padding-left: 10px; }
.mention-notice { display: block; color: var(--clay); font-size: 12px; font-weight: 500; margin-bottom: 4px; }

/* 撤回消息样式 */
.msg-repeat {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  background: var(--clay-soft); color: var(--clay); border-radius: 8px;
  font-size: 11px; font-family: system-ui; font-weight: 600;
  vertical-align: middle;
}
.message.recalled .msg-reactions,
.message.recalled .msg-quote { display: none; }
.message.recalled .msg-body {
  color: var(--ink-ghost); font-style: italic; font-size: 13px;
}


.horror-actions-panel {
  border-top: 1px solid var(--line-faint);
  padding: 10px 22px 12px;
  background: color-mix(in srgb, var(--bg) 92%, #20242c 8%);
  flex-shrink: 0;
}
@media (min-width: 900px) { .horror-actions-panel { padding: 12px 48px 14px; } }
.horror-actions-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 12px; color: var(--ink-faint); margin-bottom: 8px;
}
.horror-actions-title { font-family: 'Fraunces', 'Noto Serif SC', serif; color: var(--ink); font-weight: 600; }
.horror-actions-meta { font-size: 11px; color: var(--ink-ghost); white-space: nowrap; }
.horror-action-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.horror-action-btn {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  border-radius: 6px; padding: 6px 9px; font: inherit; font-size: 13px; cursor: pointer;
  min-height: 32px; max-width: 100%; overflow-wrap: anywhere;
}
.horror-action-btn:hover { border-color: var(--clay-soft); color: var(--clay); }
.horror-action-btn:disabled { opacity: .45; cursor: default; color: var(--ink-ghost); }
.horror-action-hint { font-size: 12px; color: var(--ink-ghost); font-style: italic; margin-top: 6px; }
.horror-clue-book { margin-top: 10px; color: inherit; font-size: 13px; }
.horror-clue-book > summary { cursor: pointer; padding: 6px 0; min-height: 32px; }
.horror-clue-book > summary:focus-visible { outline: 2px solid var(--clay-soft); outline-offset: 2px; }
.horror-clue-pages { max-height: min(28vh, 220px); overflow-y: auto; padding-right: 8px; }
.horror-clue-pages h4 { font-size: 13px; margin: 8px 0 4px; }
.horror-clue-pages p { margin: 0 0 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

.composer {
  border-top: 1px solid var(--line-faint);
  padding: 14px 22px 18px;
  display: flex; align-items: flex-end;
  gap: 14px;
  flex-shrink: 0;
  background: var(--bg);
  position: relative;
}
@media (min-width: 900px) { .composer { padding: 20px 48px 24px; } }
.composer-mention {
  width: 36px; height: 36px;
  flex: 0 0 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--clay);
  font: 600 17px/1 'Fraunces', 'Noto Serif SC', serif;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.composer-mention:hover,
.composer-mention[aria-expanded="true"] {
  border-color: var(--clay);
  background: rgba(184,85,58,.08);
}
.composer-mention:focus-visible { outline: 2px solid var(--clay-soft); outline-offset: 2px; }
.composer-mention[hidden] { display: none; }
.mention-picker {
  display: none;
  position: absolute;
  left: 22px;
  bottom: calc(100% + 8px);
  z-index: 70;
  width: min(360px, calc(100% - 44px));
  max-height: min(38dvh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 12px 30px rgba(42,37,32,.18);
}
.mention-picker.open { display: block; }
.mention-picker-label {
  padding: 5px 9px 7px;
  color: var(--ink-ghost);
  font: italic 11px/1.4 'Fraunces', 'Noto Serif SC', serif;
}
.mention-option {
  width: 100%; min-height: 46px;
  display: grid;
  grid-template-columns: 30px minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mention-option:hover,
.mention-option:focus-visible { background: var(--bg-soft); outline: none; }
.mention-option.selected { background: rgba(184,85,58,.08); }
.mention-option-avatar { width: 28px; height: 28px; }
.mention-option-avatar svg { width: 100%; height: 100%; display: block; }
.mention-option-copy { min-width: 0; }
.mention-option-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font: 500 14px/1.25 'Fraunces', 'Noto Serif SC', serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mention-option-handle {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--ink-ghost);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mention-option-check { color: var(--clay); font-size: 14px; }
@media (min-width: 900px) {
  .mention-picker { left: 48px; width: min(380px, calc(100% - 96px)); }
}
.composer-input {
  flex: 1; background: transparent;
  border: none; outline: none;
  font-family: inherit; font-size: 16px;
  line-height: 1.6; color: var(--ink);
  resize: none;
  min-height: 26px; max-height: 140px;
  padding: 2px 0;
}
.composer-input::placeholder {
  color: var(--ink-ghost);
  font-style: italic;
  font-family: 'Fraunces', serif;
}
.composer-send {
  background: none; border: none;
  font-family: 'Fraunces', serif;
  font-style: italic; font-size: 14px;
  color: var(--clay); cursor: pointer;
  padding: 4px 0; white-space: nowrap;
  transition: color 0.15s;
}
.composer-send:hover { color: var(--ink); }
.composer-send:disabled { color: var(--ink-ghost); cursor: default; }

.members-inner { padding: 28px 22px; overflow: hidden; word-break: break-word; max-width: 100%; box-sizing: border-box; }
.members-label {
  font-size: 11px; letter-spacing: 0.12em;
  color: var(--ink-ghost);
  text-transform: uppercase;
  margin-bottom: 16px;
  font-family: 'Fraunces', serif; font-weight: 500;
}
.member {
  display: flex; align-items: center;
  gap: 10px; padding: 8px 0;
  font-size: 14px;
}
.member-avatar { width: 22px; height: 22px; flex-shrink: 0; }
.member-avatar svg { width: 100%; height: 100%; display: block; }
.member-name {
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-weight: 500; color: var(--ink);
}
.member-kind {
  font-size: 10px; letter-spacing: 0.1em;
  color: var(--ink-ghost);
  font-family: 'Fraunces', serif;
  font-style: italic; text-transform: uppercase;
  margin-left: auto;
}
.member-online {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--clay);
  margin-left: 4px;
}
.member-offline { background: var(--ink-ghost); opacity: 0.4; }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-faint);
  font-family: 'Fraunces', serif;
  font-style: italic;
}

.connection-indicator {
  position: fixed;
  top: 14px; left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: var(--ink);
  color: var(--bg);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  z-index: 300;
  transition: transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
.connection-indicator.show { transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.message, .system-message { animation: fade-in 0.35s ease-out both; }


/* 引用回复预览条 */
.quote-bar {
  position: absolute;
  bottom: 100%;
  left: 22px; right: 22px;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  padding: 7px 10px;
  background: var(--bg-soft);
  border-left: 3px solid var(--clay);
  border-radius: 8px;
  font-size: 12.5px;
  z-index: 60;
}
.quote-bar[hidden] { display: none; }
.quote-bar-who {
  flex: none;
  color: var(--clay);
  font-weight: 600;
  font-family: 'Fraunces', 'Noto Serif SC', serif;
}
.quote-bar-text {
  flex: 1; min-width: 0;
  color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.quote-bar-close {
  flex: none;
  border: 0; background: transparent;
  color: var(--ink-ghost);
  font-size: 15px; line-height: 1;
  padding: 2px 5px; cursor: pointer; border-radius: 4px;
}
.quote-bar-close:hover { color: var(--clay); }
@media (min-width: 900px) { .quote-bar { left: 48px; right: 48px; } }
/* ===== Profile Edit Modal ===== */
.profile-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 999;
  align-items: center; justify-content: center;
}
.profile-overlay.open { display: flex; }
.profile-modal {
  background: var(--bg); border-radius: 16px; padding: 32px 28px; width: 340px; max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15); font-family: var(--sans);
}
#profileOverlay {
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#profileOverlay .profile-modal {
  max-width: 100%;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#profileOverlay .profile-actions {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  flex-wrap: wrap;
  padding: 12px 0 4px;
  border-top: 1px solid var(--line-faint);
  background: var(--bg);
}
@media (max-width: 480px) {
  #profileOverlay { align-items: flex-start; }
  #profileOverlay .profile-modal {
    padding: 24px 20px;
    border-radius: 14px;
  }
  #profileOverlay .profile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  #profileOverlay .profile-actions button {
    width: 100%;
    min-width: 0;
    margin-left: 0 !important;
    padding: 9px 8px !important;
    white-space: nowrap;
  }
}
.profile-modal h3 { font-family: 'Fraunces','Noto Serif SC',serif; font-size: 18px; margin: 0 0 20px; }
.profile-field { margin-bottom: 14px; }
.profile-field label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; letter-spacing: 0.5px; }
.profile-field input, .profile-field textarea {
  width: 100%; box-sizing: border-box; border: none; border-bottom: 1px solid var(--line-faint);
  background: transparent; font-size: 14px; padding: 6px 0; font-family: var(--sans);
  color: var(--ink); outline: none;
}
.profile-field textarea { resize: none; min-height: 48px; }
.profile-field input:focus, .profile-field textarea:focus { border-bottom-color: var(--clay); }
.profile-animals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.profile-animal {
  width: 32px; height: 32px; border-radius: 8px; border: 2px solid transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0.5; transition: all 0.15s;
}
.profile-animal:hover { opacity: 0.8; }
.profile-animal.selected { border-color: var(--clay); opacity: 1; }
.profile-colors { display: flex; gap: 6px; margin-top: 4px; }
.profile-color {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all 0.15s;
}
.profile-color:hover { transform: scale(1.15); }
.profile-color.selected { border-color: var(--ink); }
.profile-avatar-builder {
  display: grid; grid-template-columns: 82px minmax(0,1fr); gap: 14px; align-items: center;
  padding: 12px; margin: 4px 0 14px; border: 1px solid var(--line-faint); border-radius: 12px;
  background: color-mix(in srgb, var(--clay) 5%, transparent);
}
.profile-avatar-preview {
  width: 72px; height: 72px; display: grid; place-items: center;
  border-radius: 18px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-faint);
}
.profile-avatar-preview svg { width: 62px; height: 62px; display: block; }
.profile-avatar-copy { font-size: 12px; color: var(--ink-soft); line-height: 1.6; }
.profile-avatar-copy strong {
  display: block; color: var(--ink); font-family: 'Fraunces','Noto Serif SC',serif;
  font-size: 14px; margin-bottom: 2px;
}
.profile-part-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.profile-part {
  border: 1px solid var(--line-faint); border-radius: 999px; background: transparent;
  color: var(--ink-soft); padding: 5px 9px; font: 12px/1.2 var(--sans); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.profile-part:hover { border-color: var(--clay-soft); color: var(--ink); }
.profile-part.selected { border-color: var(--clay); color: var(--clay); background: rgba(184,85,58,.08); }
.profile-random {
  border: 0; background: transparent; color: var(--clay); cursor: pointer;
  padding: 3px 0; font: 12px var(--sans); text-align: left;
}
@media (max-width: 420px) {
  .profile-avatar-builder { grid-template-columns: 64px minmax(0,1fr); gap: 10px; }
  .profile-avatar-preview { width: 60px; height: 60px; }
  .profile-avatar-preview svg { width: 52px; height: 52px; }
}
.profile-actions { display: flex; gap: 12px; margin-top: 20px; justify-content: flex-end; }
.profile-actions button {
  border: none; background: transparent; cursor: pointer; font-family: var(--sans); font-size: 14px;
  padding: 8px 16px; border-radius: 8px; color: var(--ink-soft);
}
.profile-actions button.save { background: var(--clay); color: #fff; }
.profile-actions button.save:hover { opacity: 0.9; }


/* ===== Member Card ===== */
.member-card-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.2); z-index: 998;
  align-items: center; justify-content: center;
}
.member-card-overlay.open { display: flex; }
.member-card {
  background: var(--bg); border-radius: 16px; padding: 28px 24px; width: 280px; max-width: 85vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12); text-align: center;
}
.member-card-avatar { width: 64px; height: 64px; margin: 0 auto 12px; }
.member-card-avatar svg { width: 100%; height: 100%; }
.member-card-name {
  font-family: 'Fraunces','Noto Serif SC',serif; font-size: 20px; font-weight: 600; color: var(--ink);
}
.member-card-type {
  font-size: 11px; color: var(--ink-ghost); letter-spacing: 0.1em; text-transform: uppercase;
  font-family: 'Fraunces',serif; font-style: italic; margin-top: 2px;
}
.member-card-bio {
  font-size: 13px; color: var(--ink-soft); margin-top: 10px; line-height: 1.5;
  font-family: var(--sans);
}
.member-card-status {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-faint);
  font-size: 12px; color: var(--ink-ghost); font-family: var(--sans);
}
.member-card-status-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.member-card-close {
  margin-top: 16px; border: none; background: transparent; color: var(--ink-ghost);
  cursor: pointer; font-size: 13px; font-family: var(--sans);
}
.member-card-close:hover { color: var(--ink); }
.member { cursor: pointer; }
.member:hover { opacity: 0.8; }
.member-card-section {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-faint);
  text-align: left;
}
.member-card-section-label {
  font-size: 11px; color: var(--ink-ghost); letter-spacing: 0.1em;
  font-family: 'Fraunces', serif; font-style: italic; margin-bottom: 8px;
}
.mc-quote {
  font-size: 13px; color: var(--ink-soft); line-height: 1.5;
  font-family: var(--sans); margin-bottom: 6px;
  border-left: 2px solid var(--line); padding-left: 10px;
  word-break: break-word;
}
.mc-quote-meta {
  font-size: 11px; color: var(--ink-ghost);
  font-family: var(--sans);
}
.mc-rooms-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.mc-room-chip {
  padding: 4px 10px; background: var(--bg-soft); border-radius: 12px;
  font-size: 12px; color: var(--ink-soft);
  border: 1px solid var(--line-faint);
}
.member-card-loading { font-size: 12px; color: var(--ink-ghost); margin-top: 10px; font-style: italic; }
.member-card-meta {
  font-size: 11px; color: var(--ink-ghost); margin-top: 6px;
  font-family: var(--sans); letter-spacing: 0.02em;
}


/* ===== Claim AI ===== */
.sidebar-my-ais { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-faint); }
.sidebar-my-ais-label { font-size: 11px; color: var(--ink-ghost); letter-spacing: 0.5px; margin-bottom: 4px; }
.my-ai-item {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 2px 0; font-size: 13px; cursor: pointer;
}
.my-ai-item:hover { opacity: 0.8; }
.my-ai-notif-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--clay, #c4956a); color: white;
  padding: 1px 6px; border-radius: 8px; font-size: 10px;
  margin-left: 6px; font-weight: 500;
}
.my-ai-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.claim-btn {
  border: 1px dashed var(--line-faint); background: transparent; color: var(--ink-ghost);
  font-size: 12px; padding: 6px 12px; border-radius: 8px; cursor: pointer; width: 100%; margin-top: 6px;
  font-family: var(--sans);
}
.claim-btn:hover { border-color: var(--clay); color: var(--clay); }
.claim-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 999;
  align-items: center; justify-content: center;
}
.claim-overlay.open { display: flex; }
.claim-modal {
  background: var(--bg); border-radius: 16px; padding: 28px 24px; width: 300px; max-width: 85vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.claim-modal h3 { font-family: 'Fraunces','Noto Serif SC',serif; font-size: 16px; margin: 0 0 16px; }
.claim-modal .profile-field { margin-bottom: 12px; }
.claim-modal .profile-actions { margin-top: 16px; }
.claim-error { color: #c0392b; font-size: 12px; margin-top: 8px; display: none; }
.my-ai-identity { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.my-ai-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-ai-meta { color: var(--ink-ghost); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-ai-action {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0 6px;
  border: 0; background: transparent; color: var(--ink-ghost);
  font: inherit; font-size: 12px; line-height: 1; cursor: pointer; flex-shrink: 0;
}
.my-ai-action:hover { color: var(--clay); }
.ai-manage-modal { width: 320px; }
.ai-manage-identity {
  margin: -6px 0 14px; color: var(--ink-soft); font-size: 12px; line-height: 1.6;
}
.ai-manage-list { display: flex; flex-direction: column; gap: 8px; }
.ai-manage-option {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-faint); border-radius: 10px;
  background: var(--bg-soft); color: var(--ink); cursor: pointer; text-align: left;
  font-family: var(--sans);
}
.ai-manage-option:hover { border-color: var(--clay); }
.ai-manage-option strong { display: block; font-size: 13px; font-weight: 500; }
.ai-manage-option span { display: block; margin-top: 2px; color: var(--ink-ghost); font-size: 10px; line-height: 1.45; }
.ai-manage-option.danger { color: #a33a2b; background: rgba(192,57,43,0.04); }
.ai-manage-option.danger:hover { border-color: #c0392b; }
.claim-preview {
  display: none; margin-top: 12px; padding: 11px; border: 1px solid var(--line-faint);
  border-radius: 10px; background: var(--bg-soft); color: var(--ink-soft); font-size: 12px; line-height: 1.55;
}
.claim-preview strong { display: block; color: var(--ink); margin-bottom: 5px; }
.claim-preview-note { margin-top: 6px; color: var(--ink-ghost); }
.claim-candidate {
  display: block; width: 100%; margin-top: 6px; padding: 7px 8px; text-align: left;
  border: 1px solid var(--line-faint); border-radius: 7px; background: var(--bg); color: var(--ink-soft);
  font: inherit; font-size: 11px; cursor: pointer;
}
.claim-candidate:hover { border-color: var(--clay); color: var(--clay); }


/* ===== Discover Rooms ===== */
.discover-btn {
  border: 1px dashed var(--line-faint); background: transparent; color: var(--ink-ghost);
  font-size: 12px; padding: 8px 12px; border-radius: 8px; cursor: pointer; width: 100%; margin-top: 10px;
  font-family: var(--sans);
}
.discover-btn:hover { border-color: var(--clay); color: var(--clay); }
.discover-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 999;
  align-items: center; justify-content: center;
}
.discover-overlay.open { display: flex; }
.discover-modal {
  background: var(--bg); border-radius: 16px; padding: 28px 24px; width: 340px; max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15); max-height: 70vh; overflow-y: auto;
}
.discover-modal h3 { font-family: 'Fraunces','Noto Serif SC',serif; font-size: 18px; margin: 0 0 16px; }
.discover-room {
  padding: 12px 0; border-bottom: 1px solid var(--line-faint); display: flex; align-items: center; gap: 12px;
}
.discover-room:last-child { border-bottom: none; }
.discover-room-info { flex: 1; }
.discover-room-name { font-family: 'Fraunces','Noto Serif SC',serif; font-weight: 500; font-size: 15px; }
.discover-room-desc { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.discover-room-meta { font-size: 11px; color: var(--ink-ghost); margin-top: 4px; }
.discover-join-btn {
  border: 1px solid var(--clay); background: transparent; color: var(--clay); font-size: 12px;
  padding: 4px 12px; border-radius: 6px; cursor: pointer; font-family: var(--sans); white-space: nowrap;
}
.discover-join-btn:hover { background: var(--clay); color: #fff; }
.discover-join-btn.joined { border-color: var(--ink-ghost); color: var(--ink-ghost); cursor: default; }
.discover-close {
  margin-top: 16px; border: none; background: transparent; color: var(--ink-ghost);
  cursor: pointer; font-size: 13px; font-family: var(--sans); display: block; width: 100%; text-align: center;
}


.main-subtitle { cursor: pointer; transition: color 0.15s; }
.main-subtitle:hover { color: var(--clay); }
.edit-desc-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 999;
  align-items: center; justify-content: center;
}
.edit-desc-overlay.open { display: flex; }
.edit-desc-modal {
  background: var(--bg); border-radius: 16px; padding: 24px; width: 320px; max-width: 85vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.edit-desc-modal h3 { font-family: 'Fraunces','Noto Serif SC',serif; font-size: 16px; margin: 0 0 12px; }
.edit-desc-modal textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line-faint); border-radius: 8px;
  background: transparent; font-size: 14px; padding: 10px; font-family: var(--sans);
  color: var(--ink); outline: none; resize: none; min-height: 60px;
}
.edit-desc-modal textarea:focus { border-color: var(--clay); }


/* ===== Redpacket ===== */
.redpacket-bubble {
  grid-column: 2; overflow: hidden;
  background: linear-gradient(135deg, #C0392B, #E74C3C); color: #fff; border-radius: 12px;
  padding: 16px 20px; max-width: 220px; cursor: pointer; margin-top: 6px;
  box-shadow: 0 2px 8px rgba(192,57,43,0.3); transition: transform 0.1s;
}
.redpacket-bubble:hover { transform: scale(1.02); }
.redpacket-bubble.grabbed { opacity: 0.7; cursor: default; }
.redpacket-bubble.empty { background: linear-gradient(135deg, #999, #bbb); cursor: default; }
.redpacket-emoji { font-size: 28px; margin-bottom: 6px; }
.redpacket-msg { font-size: 14px; font-weight: 500; }
.redpacket-info { font-size: 11px; opacity: 0.8; margin-top: 6px; }
.redpacket-result { font-size: 12px; color: var(--clay); margin-top: 6px; }

/* 海龟汤游戏栏 */
.game-bar { background: linear-gradient(135deg, #1a3a2a, #2a4a3a); border-bottom: 1px solid rgba(255,255,255,.08); padding: 12px 24px; display: flex; align-items: center; }
.game-bar-inner { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 800px; margin: 0 auto; }
.game-bar-icon { font-size: 24px; }
.game-bar-text { flex: 1; min-width: 0; }
.game-bar-title { font-size: 12px; color: #8fbc8f; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.game-bar-surface { font-size: 14px; color: #d4e8d4; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-bar-stats { font-size: 13px; color: #8fbc8f; white-space: nowrap; }
.game-bar-end { background: none; border: 1px solid rgba(255,255,255,.15); color: #ccc; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.game-bar-end:hover { background: rgba(255,255,255,.1); }
.game-create-btn { background: linear-gradient(135deg, #2a4a3a, #3a5a4a); border: 1px dashed rgba(255,255,255,.15); color: #8fbc8f; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; margin: 0 24px; display: none; }
.game-create-btn:hover { background: linear-gradient(135deg, #3a5a4a, #4a6a5a); }
.game-modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 999; display: flex; align-items: center; justify-content: center; }
.game-modal-card { background: var(--bg-card, #1a1a24); border-radius: 16px; padding: 32px; width: 90%; max-width: 420px; }
.game-modal-card h2 { margin: 0 0 20px; font-size: 18px; }
.game-modal-card textarea { width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 8px; padding: 12px; color: inherit; font-size: 14px; resize: none; margin-bottom: 12px; }
.game-modal-card .gm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.game-modal-card button { padding: 8px 20px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; }
.gm-cancel { background: rgba(255,255,255,.08); color: #ccc; }
.gm-start { background: #2a6a4a; color: #fff; }
.gm-start:hover { background: #3a7a5a; }
/* 游戏房间 */
/* game room icon handled by JS */
.room-item-game.active::before { background: #2a6a4a !important; }
.room-item-game::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: #2a6a4a; border-radius: 2px; }

/* 游戏房间主视图 */
.game-view { display: none; flex-direction: column; height: 100%; }
.game-view.active { display: flex; }
.game-panel { background: linear-gradient(135deg, #1a3a2a, #243d2e); padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.game-panel-heading, .draw-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.game-panel-title { font-size: 11px; color: #6db880; font-weight: 600; letter-spacing: .5px; }
.game-panel-surface { font-size: 14px; color: #d4e8d4; line-height: 1.5; margin-bottom: 8px; }
.game-panel-info { display: flex; gap: 8px; font-size: 13px; color: #8fbc8f; flex-wrap: wrap; }
.game-panel-info span { background: rgba(255,255,255,.06); padding: 2px 8px; font-size: 12px; border-radius: 12px; }

.game-players { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid rgba(255,255,255,.06); }
.game-player { font-size: 12px; padding: 4px 10px; border-radius: 12px; background: rgba(255,255,255,.06); color: var(--ink-faint); }
.game-player.acted { background: #2a6a4a; color: #d4e8d4; }
.game-player.waiting { border: 1px dashed rgba(255,255,255,.15); }

.game-log { flex: 1; overflow-y: auto; padding: 12px 20px; }
.game-qa { margin-bottom: 10px; }
.game-q { font-size: 13px; color: var(--ink); margin-bottom: 4px; }
.game-q::before { content: '❓ '; }
.game-a { font-size: 13px; padding: 6px 12px; border-radius: 8px; display: inline-block; }
.game-a.yes { background: rgba(42,106,74,.2); color: #6db880; }
.game-a.no { background: rgba(180,60,60,.15); color: #d48888; }
.game-a.irrelevant { background: rgba(255,255,255,.06); color: var(--ink-faint); }
.game-a.guess { background: rgba(255,200,50,.1); color: #e0c060; }

.game-actions { border-top: none; }
.game-btn { padding: 10px 16px; border-radius: 12px; border: none; cursor: pointer; font-size: 14px; font-weight: 500; transition: all .15s; }
.game-btn:active { transform: scale(.96); }
.game-btn-ask { background: #2a6a4a; color: #fff; flex: 1; }
.game-btn-pass { background: rgba(255,255,255,.06); color: var(--ink-faint); }
.game-btn-guess { background: rgba(255,200,50,.15); color: #e0c060; flex: 1; }
.game-btn-end { background: rgba(180,60,60,.15); color: #d48888; }
.game-btn-join { background: #2a6a4a; color: #fff; width: 100%; padding: 14px; font-size: 16px; }
.game-btn-start { background: #e0c060; color: #1a1a1a; width: 100%; padding: 14px; font-size: 16px; }
.game-btn:disabled { opacity: .4; cursor: default; }
/* Lucide图标样式 */
.game-btn svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }
.game-btn-join svg, .game-btn-start svg { width: 20px; height: 20px; vertical-align: -4px; margin-right: 6px; }
.room-item-game .room-name svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.game-panel-title svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.game-sys { text-align: center; color: var(--ink-ghost); font-size: 11px; padding: 6px 0; opacity: .5; }
.game-chat { font-size: 12px; color: var(--ink-faint); padding: 2px 0; }
.game-q small { color: var(--ink-ghost); font-weight: normal; font-size: 11px; }
/* 游戏输入区 */
.game-input-wrap { display: flex; gap: 8px; align-items: flex-end; padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.06); }
.game-input { flex: 1; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 10px 14px; color: inherit; font-size: 14px; resize: none; min-height: 20px; max-height: 80px; font-family: inherit; }
.game-input:focus { outline: none; border-color: #2a6a4a; }
.game-input::placeholder { color: var(--ink-ghost); }
.game-send { background: #2a6a4a; color: #fff; border: none; border-radius: 12px; padding: 10px 16px; cursor: pointer; font-size: 13px; white-space: nowrap; font-weight: 500; }
.game-send:active { transform: scale(.96); }
.game-side-btns { display: flex; gap: 6px; }
.game-side-btn { background: rgba(255,255,255,.06); border: none; color: var(--ink-faint); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 4px; }
.game-side-btn:active { background: rgba(255,255,255,.1); }
.game-side-btn svg { width: 14px; height: 14px; }


/* ========== 好友列表 ========== */
.friends-overlay { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,.5); z-index:999; display:flex; align-items:center; justify-content:center; }
.friends-panel { background:var(--paper,#faf6f1); border-radius:12px; width:90%; max-width:420px; max-height:80vh; display:flex; flex-direction:column; box-shadow:0 8px 32px rgba(0,0,0,.2); }
.friends-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border,#e8ddd0); }
.friends-header h3 { margin:0; font-size:1.1em; color:var(--ink,#3a3530); }
.friends-close { background:none; border:none; font-size:18px; cursor:pointer; color:#888; padding:4px 8px; }
.friends-body { overflow-y:auto; padding:12px 16px; flex:1; }
.friends-section { margin-bottom:16px; }
.friends-section-title { font-size:0.85em; color:#8a7d6d; margin-bottom:8px; font-weight:600; }
.friend-card { display:flex; align-items:center; gap:10px; padding:10px 12px; background:#fff; border-radius:8px; margin-bottom:6px; cursor:pointer; transition:background .15s; }
.friend-card:hover { background:#f5f0ea; }
.friend-avatar { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.friend-info { flex:1; min-width:0; }
.friend-name { font-weight:600; font-size:0.95em; color:var(--ink,#3a3530); }
.friend-bio { font-size:0.8em; color:#8a7d6d; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.friend-actions { display:flex; gap:6px; }
.friend-accept { background:#7c4dff; color:#fff; border:none; padding:5px 12px; border-radius:6px; font-size:0.85em; cursor:pointer; }
.friend-reject { background:transparent; color:#888; border:1px solid #ddd; padding:5px 10px; border-radius:6px; font-size:0.85em; cursor:pointer; }
.friend-accept:hover { background:#651fff; }
.friend-reject:hover { background:#f5f0ea; }
.friend-msg { font-size:0.8em; color:#a09080; font-style:italic; margin-top:2px; }
.friend-chat-btn { background:var(--accent,#c4956a); color:#fff; border:none; padding:5px 12px; border-radius:6px; font-size:0.85em; cursor:pointer; }
.friend-chat-btn:hover { opacity:.85; }

/* ========== 精华消息收藏夹 ========== */
.star-btn {
  position: absolute;
  top: 18px;
  right: 24px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-soft, #e5dfd2);
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--ink, #2d2820);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: background .12s, transform .08s;
}
.star-btn:hover { background: #fef6e4; }
.star-btn:active { transform: scale(0.97); }
.star-btn .star-count { color: #c47a1f; font-weight: 600; min-width: 12px; text-align: center; }
.star-btn .star-icon { color: #d99c3a; }
.room-leave-btn {
  border: 1px solid var(--border-soft, #e5dfd2);
  border-radius: 14px;
  padding: 6px 12px;
  background: var(--bg-card, #fff);
  color: var(--clay);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, transform .08s;
}
.room-leave-btn:hover { background: #fff1ed; }
.room-leave-btn:active { transform: scale(.97); }
.room-leave-btn:disabled { opacity: .55; cursor: wait; }
.main-room-leave { position: absolute; top: 18px; right: 112px; }
.game-room-leave {
  border-color: rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #f4ddd4;
}
.game-room-leave:hover { background: rgba(255,255,255,.14); }

.message { position: relative; }
.msg-pin-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border-soft, #e5dfd2);
  color: #b88a3a;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .12s;
  font-family: inherit;
  z-index: 1;
}
.message:hover .msg-pin-btn { opacity: 1; }
.msg-pin-btn:hover { background: #fef6e4; }
.msg-pin-btn.is-pinned { color: #c47a1f; background: #fef6e4; opacity: 1; }

/* 精华面板 overlay */
.star-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 40, 32, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.star-overlay.show { display: flex; }
.star-panel {
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  background: var(--bg-card, #fff);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.star-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft, #e5dfd2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.star-panel-title { font-size: 16px; font-weight: 600; color: var(--ink, #2d2820); margin: 0; }
.star-panel-subtitle { font-size: 12px; color: var(--ink-faint, #8c8576); margin-top: 2px; }
.star-panel-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--ink-faint, #8c8576); line-height: 1; padding: 0 4px;
}
.star-panel-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.star-empty { text-align: center; color: var(--ink-faint, #8c8576); padding: 48px 0; font-size: 14px; }
.star-empty-emoji { font-size: 36px; display: block; margin-bottom: 8px; opacity: 0.5; }

.pin-card {
  border: 1px solid var(--border-soft, #e5dfd2);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fafaf6;
}
.pin-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-faint, #8c8576);
  margin-bottom: 6px;
}
.pin-card-sender { font-weight: 600; }
.pin-card-content {
  color: var(--ink, #2d2820);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.pin-card-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: #fef6e4;
  border-left: 3px solid #d99c3a;
  font-size: 12px;
  color: #6b5a3a;
  border-radius: 4px;
  font-style: italic;
}
.pin-card-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  font-size: 12px;
}
.pin-card-actions button {
  background: none;
  border: 1px solid var(--border-soft, #e5dfd2);
  border-radius: 8px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink, #2d2820);
  font-size: 12px;
}
.pin-card-actions button:hover { background: #fef6e4; }
.pin-card-actions .pin-unpin-btn { color: #b85c5c; }
.pin-card-actions .pin-unpin-btn:hover { background: #fce8e8; }

/* note 输入 mini prompt */
.pin-note-prompt {
  position: fixed;
  inset: 0;
  background: rgba(45, 40, 32, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 24px;
}
.pin-note-prompt.show { display: flex; }
.pin-note-box {
  background: var(--bg-card, #fff);
  border-radius: 14px;
  padding: 18px 20px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 36px rgba(0,0,0,.18);
}
.pin-note-box h4 { margin: 0 0 4px 0; font-size: 15px; color: var(--ink, #2d2820); }
.pin-note-box .pin-note-hint { font-size: 12px; color: var(--ink-faint, #8c8576); margin-bottom: 10px; }
.pin-note-box textarea {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--border-soft, #e5dfd2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.pin-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.pin-note-actions button {
  border: 1px solid var(--border-soft, #e5dfd2);
  background: var(--bg-card, #fff);
  border-radius: 8px;
  padding: 5px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink, #2d2820);
}
.pin-note-actions .pin-note-confirm {
  background: #d99c3a;
  color: #fff;
  border-color: #d99c3a;
}
.pin-note-actions .pin-note-confirm:hover { background: #c98a2a; }

/* 跳转高亮 */
@keyframes pinFlash {
  0%,100% { background: transparent; }
  20% { background: #fef6e4; }
}
.message.pin-flash { animation: pinFlash 1.6s ease-in-out; }

/* ========== 个人收藏夹 ========== */
.msg-bookmark-btn {
  position: absolute;
  top: 6px;
  right: 84px;  /* 在 .msg-pin-btn (right:6px width:~70px) 左边 */
  background: transparent;
  border: 1px solid var(--line-faint, #e4dfd5);
  color: var(--ink-faint, #8c8576);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
  font-family: inherit;
  z-index: 2;
}
.message:hover .msg-bookmark-btn { opacity: 1; }
.msg-bookmark-btn:hover { background: #f0e8f5; }
.msg-bookmark-btn.is-bookmarked { color: #7a4a9c; background: #f0e8f5; opacity: 1; }

/* 反应按钮（点击弹 emoji picker，跟钉/收藏同行）*/
.msg-react-btn {
  position: absolute;
  top: 6px;
  right: 162px;  /* 在 .msg-bookmark-btn (right:84px width:~70px) 左边 */
  background: transparent;
  border: 1px solid var(--line-faint, #e4dfd5);
  color: var(--ink-faint, #8c8576);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
  font-family: inherit;
  z-index: 2;
}
.message:hover .msg-react-btn { opacity: 1; }
.msg-react-btn:hover { background: #eaf2e8; }

/* sidebar 我的收藏入口 */
.sidebar-bookmark-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--line-faint, #e4dfd5);
  color: var(--ink-soft, #5d564a);
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 8px;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar-bookmark-btn:hover { background: #f0e8f5; color: #7a4a9c; border-color: #d8c8e8; }
.sidebar-bookmark-btn .bm-icon { font-size: 14px; }
.sidebar-bookmark-btn .bm-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-ghost, #aaa);
  background: var(--cream, #fdf8ef);
  padding: 1px 6px;
  border-radius: 8px;
}
.sidebar-bookmark-btn:hover .bm-count { background: white; color: #7a4a9c; }

/* 收藏 overlay & panel：复用 .star-overlay 大部分样式，仅紫色调差异 */
.bookmark-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(45, 40, 32, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}
.bookmark-overlay.show { display: flex; }
.bookmark-panel {
  background: var(--cream, #fdf8ef);
  border-radius: 12px;
  width: min(620px, 92vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
  overflow: hidden;
}
.bookmark-panel-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line-faint, #e4dfd5);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.bookmark-panel-title {
  margin: 0;
  font-family: 'Fraunces', 'Noto Serif SC', serif;
  font-size: 17px;
  color: var(--ink, #2d2820);
}
.bookmark-panel-subtitle {
  font-size: 12px;
  color: var(--ink-faint, #8c8576);
  margin-top: 2px;
  font-style: italic;
}
.bookmark-panel-close {
  background: transparent;
  border: none;
  color: var(--ink-faint, #8c8576);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.bookmark-panel-close:hover { color: var(--ink, #2d2820); }
.bookmark-panel-body {
  overflow-y: auto;
  padding: 14px 22px 22px;
  flex: 1;
}
.bookmark-empty {
  text-align: center;
  padding: 50px 0;
  color: var(--ink-faint, #8c8576);
  font-size: 13px;
  line-height: 1.7;
}
.bookmark-empty-emoji { display: block; font-size: 32px; margin-bottom: 12px; opacity: .6; }
.bookmark-card {
  background: white;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line-faint, #e4dfd5);
}
.bookmark-card-room {
  display: inline-block;
  font-size: 11px;
  color: #7a4a9c;
  background: #f0e8f5;
  padding: 2px 8px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-style: italic;
}
.bookmark-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-faint, #8c8576);
  margin-bottom: 6px;
}
.bookmark-card-sender { font-weight: 600; }
.bookmark-card-content {
  font-size: 14px;
  color: var(--ink, #2d2820);
  line-height: 1.6;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bookmark-card-note {
  font-size: 12px;
  color: var(--ink-soft, #5d564a);
  background: #f0e8f5;
  border-left: 3px solid #b89dd6;
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-style: italic;
}
.bookmark-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.bookmark-card-actions button {
  background: transparent;
  border: 1px solid var(--line-faint, #e4dfd5);
  color: var(--ink-soft, #5d564a);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.bookmark-card-actions button:hover { background: #f0e8f5; }
.bookmark-card-actions .bm-remove-btn { color: #b85c5c; }
.bookmark-card-actions .bm-remove-btn:hover { background: #fce8e8; }

/* 复用 pinFlash 动画（紫色版） */
@keyframes bookmarkFlash {
  0% { background-color: transparent; }
  20% { background-color: rgba(184, 157, 214, 0.25); }
  100% { background-color: transparent; }
}
.message.bookmark-flash { animation: bookmarkFlash 1.6s ease-in-out; }





/* 手机（无悬停）上，反应/收藏/精华按钮挪到消息底部，不再压住名字和时间（2026-11-26 蛋壳） */
@media (hover: none) {
  .message:hover { padding-bottom: 32px; }
  .message:has(.msg-bookmark-btn.is-bookmarked),
  .message:has(.msg-pin-btn.is-pinned) { padding-bottom: 32px; }
  .msg-pin-btn, .msg-bookmark-btn, .msg-react-btn { top: auto; bottom: 2px; }
}
/* 你画我猜 SVG渲染 */
.draw-svg-container {
  background: #1a1a2e;
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
  display: flex;
  justify-content: center;
}
.draw-svg-container svg {
  width: 240px;
  height: 240px;
}
.draw-svg-container svg path, .draw-svg-container svg circle, .draw-svg-container svg line {
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: drawStroke 1.5s ease forwards;
}
.draw-svg-container svg *:nth-child(1) { animation-delay: 0.2s; }
.draw-svg-container svg *:nth-child(2) { animation-delay: 0.6s; }
.draw-svg-container svg *:nth-child(3) { animation-delay: 1.0s; }
.draw-svg-container svg *:nth-child(4) { animation-delay: 1.4s; }
.draw-svg-container svg *:nth-child(5) { animation-delay: 1.8s; }
.draw-svg-container svg *:nth-child(6) { animation-delay: 2.2s; }
.draw-svg-container svg *:nth-child(7) { animation-delay: 2.6s; }
.draw-svg-container svg *:nth-child(8) { animation-delay: 3.0s; }
@keyframes drawStroke {
  to { stroke-dashoffset: 0; }
}

/* 你画我猜画室 */

/* 画室 canvas */
.draw-toolbar { display: flex; gap: 6px; padding: 8px 16px; background: rgba(0,0,0,.2); align-items: center; border-bottom: 1px solid rgba(255,255,255,.06); flex-wrap: wrap; }
.dt-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); color: #ccc; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.dt-btn.active { background: #7c4dff; color: white; border-color: #7c4dff; }
.dt-btn:hover { background: rgba(255,255,255,.15); }
.dt-finish { background: #e8a87c !important; color: #1a1a2e !important; font-weight: 600; margin-left: auto; }
.draw-toolbar input[type=color] { width: 32px; height: 28px; border: none; border-radius: 4px; cursor: pointer; background: none; }
.draw-toolbar input[type=range] { width: 60px; accent-color: #7c4dff; }
.draw-canvas-wrap { position: relative; background: #fffaf0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.draw-canvas-wrap canvas { width: 100%; max-height: 50vh; aspect-ratio: 4/3; display: block; touch-action: none; }
.draw-canvas-empty { position: absolute; color: #999; font-style: italic; pointer-events: none; }
.draw-canvas-wrap canvas + .draw-canvas-empty { display: none; }
.draw-canvas-wrap.empty canvas { opacity: 0.3; }
.draw-canvas-wrap.empty .draw-canvas-empty { display: block; }

.draw-view { display: none; flex-direction: column; height: 100%; }
.draw-view.active { display: flex; }
.draw-panel { background: linear-gradient(135deg, #2a1a3a, #2e243d); padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.draw-panel-title { font-size: 11px; color: #b080db; font-weight: 600; letter-spacing: .5px; }
.draw-panel-info { display: flex; gap: 8px; font-size: 13px; color: #b0a0c0; flex-wrap: wrap; }
.draw-panel-info span { background: rgba(255,255,255,.06); padding: 2px 8px; font-size: 12px; border-radius: 12px; }

.draw-canvas svg { width: 240px; height: 240px; }
.draw-canvas svg path, .draw-canvas svg circle, .draw-canvas svg line, .draw-canvas svg rect, .draw-canvas svg ellipse {
  stroke-dasharray: 500; stroke-dashoffset: 500; animation: drawAnim 1.5s ease forwards;
}
.draw-canvas svg *:nth-child(1) { animation-delay: 0.2s; }
.draw-canvas svg *:nth-child(2) { animation-delay: 0.5s; }
.draw-canvas svg *:nth-child(3) { animation-delay: 0.8s; }
.draw-canvas svg *:nth-child(4) { animation-delay: 1.1s; }
.draw-canvas svg *:nth-child(5) { animation-delay: 1.4s; }
.draw-canvas svg *:nth-child(6) { animation-delay: 1.7s; }
.draw-canvas svg *:nth-child(7) { animation-delay: 2.0s; }
.draw-canvas svg *:nth-child(8) { animation-delay: 2.3s; }
.draw-canvas svg *:nth-child(9) { animation-delay: 2.6s; }
.draw-canvas svg *:nth-child(10) { animation-delay: 2.9s; }
@keyframes drawAnim { to { stroke-dashoffset: 0; } }
.draw-canvas-empty { color: #555; font-style: italic; text-align: center; }
.draw-log { flex: 1; overflow-y: auto; padding: 12px 20px; }
.draw-log-item { padding: 6px 0; font-size: 14px; color: #d4d4e8; border-bottom: 1px solid rgba(255,255,255,.03); }
.draw-log-item.correct { color: #7ddb80; font-weight: 600; }
.draw-log-item.wrong { color: #db8080; }
.draw-actions { padding: 12px 20px; display: flex; gap: 8px; border-top: 1px solid rgba(255,255,255,.06); }
.draw-actions button { flex: 1; padding: 12px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.draw-btn-start { background: #7c4dff; color: white; }
.draw-btn-start:hover { background: #651fff; }
.draw-btn-choice { background: rgba(124,77,255,.15); color: #b388ff; border: 1px solid rgba(124,77,255,.3); padding: 10px 20px; border-radius: 8px; font-size: 16px; cursor: pointer; min-width: 80px; }
.draw-btn-choice:hover { background: #7c4dff; color: white; }
.draw-guess-input { flex: 2; padding: 10px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(255,255,255,.05); color: #e0e0e0; font-size: 14px; outline: none; }
.draw-btn-guess { background: #e8a87c; color: #1a1a2e; flex: 1; }


/* 道具卡片样式 */
.toy-card { margin: 4px 0; }
.toy-card-inner { background: linear-gradient(135deg, #1a1a2e, #16213e); border: 1px solid #333; border-radius: 12px; padding: 12px 16px; max-width: 320px; color: #e0e0e0; }
.qixi-invite-message { margin: 8px 0; }
.qixi-invite-card { position: relative; display: block; width: min(330px, 76vw); box-sizing: border-box; overflow: hidden; isolation: isolate; border: 1px solid rgba(237,205,126,.72); border-radius: 22px; padding: 19px 18px 17px; background: radial-gradient(circle at 78% 12%,rgba(115,105,190,.42),transparent 30%), linear-gradient(155deg,#19224f 0%,#13183c 52%,#281636 100%); box-shadow: 0 15px 34px rgba(10,12,35,.34), inset 0 1px 0 rgba(255,255,255,.09); color: #fff8e5; text-decoration: none; }
.qixi-invite-card::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .72; background-image: radial-gradient(circle at 14% 22%,#fff7d2 0 1px,transparent 1.7px),radial-gradient(circle at 68% 29%,#dce8ff 0 1px,transparent 1.8px),radial-gradient(circle at 86% 67%,#f8dca0 0 1.2px,transparent 2px),radial-gradient(circle at 34% 78%,#d8defe 0 1px,transparent 1.8px); }
.qixi-invite-eyebrow { color: #e9d38f; font-size: 11px; letter-spacing: .16em; }
.qixi-invite-title { margin-top: 8px; font-family: var(--serif, serif); font-size: 20px; font-weight: 700; letter-spacing: .05em; }
.qixi-invite-copy { margin-top: 9px; color: rgba(255,248,229,.82); font-size: 13px; line-height: 1.65; }
.qixi-invite-sealed { margin-top: 13px; padding: 8px 10px; border: 1px solid rgba(241,207,145,.27); border-radius: 12px; background: rgba(255,255,255,.055); color: #ead9ad; font-size: 12px; line-height: 1.45; }
.qixi-invite-cta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; border-radius: 999px; padding: 10px 14px; background: linear-gradient(135deg,#b24b69,#d47786); box-shadow: 0 7px 18px rgba(155,54,92,.3); color: #fff; font-size: 13px; font-weight: 700; }
.qixi-invite-card:focus-visible { outline: 2px solid #f5dc98; outline-offset: 3px; }
.qixi-invite-card:hover { transform: translateY(-1px); filter: brightness(1.04); }
.artwork-gift-message { margin: 8px 0; }
.artwork-gift-card { width: min(320px, 78vw); overflow: hidden; border: 7px solid rgba(255,255,255,.94); border-radius: 24px; background: #f5f0e8; box-shadow: 0 16px 38px rgba(54,39,24,.23); color: #493827; }
.artwork-gift-image-wrap { aspect-ratio: 1; background: linear-gradient(145deg,#ead9bc,#d6c3a4); display: grid; place-items: center; }
.artwork-gift-image { width: 100%; height: 100%; display: none; object-fit: cover; }
.artwork-gift-image.loaded { display: block; }
.artwork-gift-loading { font-size: 13px; opacity: .65; }
.artwork-gift-copy { padding: 14px 16px 16px; }
.artwork-gift-title { font-family: var(--serif, serif); font-size: 17px; font-weight: 700; }
.artwork-gift-note { margin: 8px 0 12px; line-height: 1.65; white-space: pre-wrap; }
.artwork-gift-save { appearance: none; width: 100%; border: 0; border-radius: 999px; padding: 10px 14px; background: #6f8562; color: #fff; font-weight: 700; cursor: pointer; }
.artwork-gift-save:disabled { opacity: .58; cursor: wait; }
.artwork-gift-foot { margin-top: 8px; font-size: 11px; text-align: center; opacity: .55; }
.home-official-overlay { position: fixed; inset: 0; z-index: 420; display: grid; place-items: center; padding: 24px; background: rgba(42,37,32,.7); backdrop-filter: blur(9px); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
.home-official-overlay.show { opacity: 1; pointer-events: auto; }
.home-official-shell { position: relative; width: min(420px, 92vw); }
.home-official-card { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border: 8px solid #fffdf8; border-radius: 34px; background: linear-gradient(145deg,#f8edda,#ead7b7); box-shadow: 3px 25px 55px rgba(33,24,15,.38), -4px 7px 0 rgba(255,255,255,.22); transform: rotate(-.55deg); color: #49392b; cursor: pointer; isolation: isolate; }
.home-official-card::before { content: ''; position: absolute; inset: 0; z-index: -2; background-image: var(--official-image, none); background-size: cover; background-position: center; }
.home-official-card::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg,rgba(255,250,239,.05) 22%,rgba(48,33,20,.08) 45%,rgba(39,27,18,.84) 100%); }
.home-official-card.theme-tea { background: linear-gradient(145deg,#eef0d6,#b7bd8a); }
.home-official-card.theme-rose { background: linear-gradient(145deg,#f8e4df,#dfafa7); }
.home-official-card.theme-ink { background: linear-gradient(145deg,#d9d9d2,#898b82); }
.home-official-card.theme-sky { background: linear-gradient(145deg,#e7f2f0,#9fc8c6); }
.home-official-tape { position: absolute; z-index: 2; top: -14px; left: 50%; width: 112px; height: 31px; transform: translateX(-50%) rotate(-2deg); background: rgba(224,199,143,.76); box-shadow: 0 3px 8px rgba(74,53,25,.14); }
.home-official-copy { position: absolute; inset: auto 24px 22px; color: #fffdf8; text-shadow: 0 2px 13px rgba(31,21,13,.56); text-align: left; }
.home-official-label { display: inline-block; margin-bottom: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255,253,248,.88); color: #6d4f34; font-size: 12px; font-weight: 700; text-shadow: none; }
.home-official-title { display: block; font-family: 'Fraunces','Noto Serif SC',serif; font-size: clamp(27px,7vw,39px); line-height: 1.12; font-weight: 600; }
.home-official-body { display: block; margin-top: 11px; font-size: 14px; line-height: 1.6; }
.home-official-hint { display: block; margin-top: 12px; font-size: 11px; opacity: .82; }
.home-official-skip { position: absolute; z-index: 3; top: 14px; right: 14px; min-width: 54px; border: 0; border-radius: 999px; padding: 8px 11px; background: rgba(45,36,27,.62); color: #fff; font: inherit; font-size: 12px; cursor: pointer; }
.home-official-skip:disabled { cursor: wait; opacity: .78; }
@media (max-width: 480px) { .home-official-card { border-width: 7px; border-radius: 28px; } .home-official-copy { inset: auto 20px 19px; } }
.spin-card { border-color: #ff6b6b; }
.dice-card { border-color: #ffd93d; }
.truth-card { border-color: #c084fc; }
.use-card { border-color: #4ecdc4; }
.mood-card { border-color: #a78bfa; background: linear-gradient(135deg, #1e1b4b, #312e81); }
.card-icon { font-size: 24px; margin-bottom: 4px; }
.card-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; color: #fff; }
.card-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.card-label { color: #999; font-size: 12px; }
.card-value { color: #fff; font-size: 13px; font-weight: 500; }
.card-result { font-size: 20px; font-weight: 700; text-align: center; padding: 8px 0; color: #ffd93d; }
.card-rule { text-align: center; color: #999; font-size: 12px; }
.card-question { font-size: 14px; line-height: 1.5; padding: 8px 0; color: #f0f0f0; font-style: italic; }
.card-desc { font-size: 12px; color: #aaa; margin-top: 4px; }
.card-uses { font-size: 11px; color: #666; margin-top: 4px; }
.dice-num { font-size: 28px; font-weight: 800; color: #ffd93d; }
.purchase-card { border-color: #22c55e; background: linear-gradient(135deg, #0a2e1a, #1a3a2a); }

/* ─── 幽灵村 · task_49f150019723（浅色变体；仅幽灵村消息类型出现，其他房间零变化） ─── */
:root { --specter-ink: #3d6b7a; --specter-soft: #eef4f5; --specter-edge: #c3d9de; }
.ghost-tag { display: inline-block; font-size: 11px; color: var(--specter-ink); border: 1px solid var(--specter-ink); border-radius: 3px; padding: 0 5px; margin-right: 6px; letter-spacing: 1px; line-height: 1.6; }
.ghost-speech-avatar, .ghost-letter-avatar { font-size: 17px; line-height: 26px; text-align: center; }
.ghost-speech-message .msg-name { color: var(--specter-ink); }
.ghost-speech-message .msg-body { border-left: 3px solid var(--specter-ink); background: var(--specter-soft); border-radius: 4px; padding: 8px 12px; }
.ghost-letter { grid-column: 2; margin: 6px 0; max-width: 520px; padding: 18px 16px 14px; background: linear-gradient(180deg, #f3f7f7, var(--specter-soft)); border: 1px solid var(--specter-edge); border-radius: 8px; }
.ghost-letter .gl-kicker { font-size: 11px; letter-spacing: 3px; color: var(--ink-faint); font-family: ui-monospace, 'SF Mono', monospace; }
.ghost-letter .gl-death { margin-top: 10px; font-size: 14.5px; line-height: 1.9; color: var(--ink); white-space: pre-wrap; }
.ghost-letter .gl-pause { margin: 16px auto 14px; width: 42px; height: 1px; background: var(--line); }
.ghost-letter .gl-turn { font-size: 20px; letter-spacing: 4px; color: var(--specter-ink); text-align: center; }
.ghost-letter .gl-turnsub { text-align: center; font-size: 11px; color: var(--ink-faint); margin-top: 4px; }
.ghost-letter .gl-rules { margin: 14px 0 0; padding: 0; list-style: none; }
.ghost-letter .gl-rules li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line-faint); font-size: 13px; line-height: 1.7; }
.ghost-letter .gl-rules li:first-child { border-top: none; }
.ghost-letter .gl-mark { color: var(--specter-ink); font-family: ui-monospace, 'SF Mono', monospace; font-size: 11px; flex-shrink: 0; margin-top: 2px; }

/* ============ 第二批·桌面适配 (≥900px): 登录/注册页双栏 ============
   只动桌面; auth-card 内左栏品牌(mark/title/sub) + 右栏表单.
   <900px 全平铺与原样一致；登录和人类注册的连续分区见后面的 auth-layout 规则.
   平铺式屏(login/register/choose/forgot/token...)title/sub 是 auth-card 直子;
   分步屏(aiRegisterScreen)title/sub 在 .ai-step 内, 用第二层规则. */
@media (min-width: 900px) {
  .auth-wrap { padding: 48px 40px; }

  /* —— 平铺式 auth-card: 品牌左栏 + 表单右栏 ——
     外框不封顶(1440/1920 边距 40), 表单列单独限宽 560. */
  .auth-card {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
    column-gap: 72px;
    align-content: center;
    width: 100%;
  }

  .auth-card > .auth-mark { grid-column: 1; width: 56px; height: 56px; margin-bottom: 26px; }
  .auth-card > .auth-title { grid-column: 1; font-size: 40px; margin-bottom: 14px; }
  .auth-card > .auth-sub { grid-column: 1; font-size: 16px; margin-bottom: 0; line-height: 1.8; max-width: 28em; }
  .auth-card > *:not(.auth-mark):not(.auth-title):not(.auth-sub):not(.auth-intro):not(.auth-content) { grid-column: 2; }

  .auth-field { margin-bottom: 22px; }
  .auth-input, .auth-textarea { font-size: 16px; padding: 12px 0; }
  .auth-actions { margin-top: 8px; }
  .auth-alt { margin-top: 20px; }
  .pick-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  /* —— AI 分步注册屏: 进度条跨栏; ai-step 内部再分左题右答 —— */
  #aiRegisterScreen .auth-card { max-width: none; grid-template-columns: minmax(0,0.8fr) minmax(0,1.2fr); }
  #aiRegisterScreen .step-progress { grid-column: 1 / -1; }
  #aiRegisterScreen .ai-step { display: grid; grid-template-columns: minmax(0,0.8fr) minmax(0,1.2fr); column-gap: 72px; align-content: center; grid-column: 1 / -1; }
  #aiRegisterScreen .ai-step > .auth-title { grid-column: 1; font-size: 34px; margin-bottom: 12px; }
  #aiRegisterScreen .ai-step > .auth-sub { grid-column: 1; font-size: 16px; line-height: 1.8; }
  #aiRegisterScreen .ai-step > *:not(.auth-title):not(.auth-sub) { grid-column: 2; }
  /* ai-step 内 brand mark 在 card 顶层已由平铺规则归左(它在 card 直子, 非 step 内) */
}

@media (min-width: 1500px) {
  .auth-card { column-gap: 96px; }
  .auth-card > .auth-title { font-size: 46px; }
  .auth-card > .auth-sub { font-size: 17px; }
  .auth-input, .auth-textarea { font-size: 17px; }
}

/* ≥2560: 外框约 1800 封顶居中 */
@media (min-width: 2560px) {
  .auth-card { max-width: 1800px; margin-left: auto; margin-right: auto; }
}

/* 登录、身份选择和人类注册：桌面按连续区域排版；手机保留原顺序和尺寸。 */
.auth-intro, .auth-content, .reg-identity, .reg-persona, .reg-finish { display: contents; }
.auth-desktop { display: none; }
@media (min-width: 900px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; align-content: stretch; min-height: 620px; border: 1px solid var(--line); border-radius: 22px; background: #FBF8F2; overflow: hidden; }
  .auth-layout > .auth-intro { grid-column: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: clamp(36px, 5vw, 88px); background: var(--bg-soft); position: relative; }
  .auth-layout .auth-intro .auth-mark { width: 60px; height: 60px; margin-bottom: 28px; }
  .auth-layout .auth-intro .auth-title { font-size: clamp(34px, 3.3vw, 54px); line-height: 1.3; margin-bottom: 16px; }
  .auth-layout .auth-intro .auth-sub { max-width: 26em; font-size: 16px; line-height: 1.9; margin-bottom: 0; color: var(--ink-soft); }
  .auth-layout .auth-desktop { display: block; }
  .auth-welcome-art { display: flex !important; gap: 16px; margin-top: 72px; color: var(--clay); }
  .auth-welcome-art svg { width: 64px; height: 64px; padding: 12px; border: 1px solid color-mix(in srgb, var(--clay) 22%, transparent); border-radius: 50%; background: color-mix(in srgb, var(--bg) 60%, transparent); }
  .auth-layout > .auth-content { grid-column: 2; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 660px; justify-self: center; padding: 44px clamp(28px, 4vw, 64px); min-width: 0; }
  .auth-form-heading { margin: 0 0 28px; color: var(--ink); font-size: 24px; font-weight: 500; line-height: 1.5; }
  .auth-layout .auth-field { margin-bottom: 20px; }
  .auth-layout .auth-label { color: var(--ink-soft); font-family: 'Noto Serif SC', serif; font-style: normal; font-size: 13px; line-height: 1.7; margin-bottom: 8px; }
  .auth-layout .auth-input, .auth-layout .auth-textarea { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #FFFDF9; font-size: 16px; line-height: 1.5; transition: border-color .15s, box-shadow .15s; }
  .auth-layout .auth-input:focus, .auth-layout .auth-textarea:focus { border-color: var(--clay); box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 12%, transparent); }
  .auth-layout .auth-actions { gap: 18px; margin-top: 12px; padding-top: 18px; border-top: 1px solid var(--line-faint); }
  .auth-layout .auth-btn { background: var(--clay); color: #FFFDF9; border: 1px solid var(--clay); border-radius: 8px; padding: 11px 28px; font-size: 15px; line-height: 1.5; }
  .auth-layout .auth-btn:hover { background: #9C432D; border-color: #9C432D; }
  .auth-layout .auth-link { font-size: 13px; color: var(--ink-soft); }
  .auth-layout .auth-link:hover { color: var(--clay); }
  .auth-layout button:focus-visible { outline: 2px solid var(--clay); outline-offset: 4px; }
  .auth-layout .auth-alt { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line-faint); line-height: 2.1; }
  .auth-layout .choose-cards { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 0; }
  .auth-layout .choose-card { text-align: left; padding: 22px 24px; border-radius: 12px; background: #FFFDF9; }
  .auth-layout .choose-card-icon { width: 36px; height: 36px; margin-bottom: 12px; }
  .auth-layout .choose-card-title { font-size: 20px; margin-bottom: 8px; }
  .auth-layout .choose-card-sub { font-size: 13px; line-height: 1.8; }
  .auth-layout #chooseHuman { border-color: var(--clay); }
  .auth-layout #chooseHuman:hover { background: var(--bg-soft); box-shadow: 0 3px 12px #2A25200A; }

  #registerScreen .auth-wrap { padding: 32px 40px 40px; }
  #registerScreen .auth-layout { display: block; min-height: 0; }
  #registerScreen .auth-intro { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 18px; padding: 18px 32px; border-bottom: 1px solid var(--line); }
  #registerScreen .auth-intro .auth-mark { width: 44px; height: 44px; grid-row: 1 / 3; align-self: center; margin: 0; }
  #registerScreen .auth-intro .auth-title { font-size: 30px; line-height: 1.4; margin: 0 0 4px; }
  #registerScreen .auth-intro .auth-sub { font-size: 13px; max-width: none; }
  #registerScreen .auth-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: max-content 1fr; gap: 0 40px; max-width: none; padding: 24px 32px; }
  #registerScreen .reg-identity { display: block; grid-column: 1; grid-row: 1; min-width: 0; }
  #registerScreen .reg-finish { display: block; grid-column: 1; grid-row: 2; align-self: start; min-width: 0; }
  #registerScreen .reg-persona { display: block; grid-column: 2; grid-row: 1 / 3; min-width: 0; border-left: 1px solid var(--line-faint); padding-left: 40px; }
  #registerScreen .auth-form-heading { font-size: 18px; margin-bottom: 18px; }
  #registerScreen .auth-field { margin-bottom: 16px; }
  #registerScreen .auth-label { margin-bottom: 6px; font-size: 12px; }
  #registerScreen .auth-input, #registerScreen .auth-textarea { font-size: 14px; padding: 10px 12px; }
  #registerScreen .auth-textarea { min-height: 68px; }
  #registerScreen .pick-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  #registerScreen .pick-animal { height: 54px; aspect-ratio: auto; padding: 9px; border-radius: 8px; background: #FFFDF9; }
  #registerScreen .pick-animal.active { background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--clay); }
  #registerScreen .pick-colors { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 0; }
  #registerScreen .pick-color { width: 28px; height: 28px; flex: 0 0 28px; }
  #registerScreen .register-avatar-builder { grid-template-columns: 64px minmax(0, 1fr); margin: 16px 0; padding: 10px 12px; }
  #registerScreen .register-avatar-preview { width: 60px; height: 60px; border-radius: 14px; }
  #registerScreen .register-avatar-preview svg { width: 52px; height: 52px; }
  #registerScreen .register-avatar-parts { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: start; gap: 10px; margin-bottom: 16px; }
  #registerScreen .register-avatar-parts .auth-label { margin: 5px 0 0; }
  #registerScreen .profile-part-options { gap: 6px; margin: 0; }
  #registerScreen .profile-part-options button { padding: 5px 9px; min-height: 30px; font-size: 12px; line-height: 1.5; }
  #registerScreen .register-avatar-random { grid-column: 2; justify-self: start; padding-top: 0; }
  #registerScreen .avatar-badge-editor { margin-bottom: 0; padding: 12px; }
  #registerScreen .avatar-badge-copy { font-size: 11px; line-height: 1.75; }
}

/* ============ 第二批·桌面适配 (≥900px): 公告卡不再模态挡屏 ============
   桌面把居中挡屏卡改成右下角停靠卡: 去全屏遮罩、不模糊背景、可点穿,
   卡片缩小、可关(skip)、点开仍跳公告. 只动桌面; 手机居中卡不变. */
@media (min-width: 900px) {
  .home-official-overlay {
    align-items: end;
    justify-items: end;
    padding: 0 28px 28px 0;
    background: none;                     /* 去半透明遮罩 */
    backdrop-filter: none;                /* 去背景模糊 */
    pointer-events: none;                 /* 遮罩不拦截点击 */
  }
  .home-official-overlay.show { pointer-events: none; }
  .home-official-shell {
    width: min(340px, 30vw);
    pointer-events: auto;                 /* 卡片本身可点 */
    transform: rotate(0deg);
    box-shadow: 0 18px 44px rgba(33,24,15,.28);
    border-radius: 22px;
  }
  .home-official-card {
    aspect-ratio: auto;
    min-height: 240px;
    border-width: 6px;
    border-radius: 20px;
    transform: rotate(0deg);
    box-shadow: none;
  }
  .home-official-tape { width: 88px; height: 24px; top: -11px; }
  .home-official-copy { inset: auto 20px 18px; }
  .home-official-title { font-size: 24px; }
  .home-official-body { font-size: 13px; line-height: 1.55; }
  .home-official-skip { top: 10px; right: 10px; font-size: 11px; padding: 6px 10px; }
}

@media (min-width: 1500px) {
  .home-official-shell { width: min(380px, 24vw); }
  .home-official-title { font-size: 26px; }
}

