:root {
  --bg: #111729;
  --bg-deep: #0c1120;
  --panel: #1a2340;
  --border: #2a3960;
  --text: #eaedf6;
  --dim: #97a3c4;
  --dimmer: rgba(151, 163, 196, 0.55);
  --ember: #f0a45c;
  --ember-bright: #ffc084;
  --ember-bg: rgba(240, 164, 92, 0.08);
  --ember-line: rgba(240, 164, 92, 0.45);
  --danger: #e57364;
  --danger-bg: rgba(229, 115, 100, 0.12);
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* hidden 属性必须压过一切 display 规则，否则遮罩层会常显 */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

::selection { background: rgba(240, 164, 92, 0.35); }

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

button { font-family: inherit; }

/* ---------- 按钮 ---------- */

.btn-primary {
  background: var(--ember);
  color: #1d1305;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--ember-bright); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: #3d5183; }

.btn-small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

/* ---------- 表单 ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.field { display: block; margin-bottom: 16px; border: none; padding: 0; }
.field-label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.field-hint { opacity: 0.75; }

input, textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--dimmer); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(240, 164, 92, 0.15);
}

.form-error {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13.5px;
}

/* ---------- 大厅页 ---------- */

body.lobby { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar { padding: 22px clamp(20px, 5vw, 48px); }
.wordmark { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 24px; height: 24px; display: block; }
.ver { color: var(--dimmer); font-size: 11px; font-family: var(--font-mono); margin-left: 7px; }
.room-header .ver { margin-left: 10px; flex: none; }
.wordmark .latin {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 13px;
  color: var(--dim);
  margin-left: 7px;
  letter-spacing: 0.5px;
}

.landing {
  flex: 1;
  display: grid;
  grid-template-columns: 1.15fr 420px;
  gap: clamp(32px, 6vw, 72px);
  align-content: center;
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: 24px clamp(20px, 5vw, 48px) 40px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(46px, 7.5vw, 82px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.01em;
}
.hero-sub { color: var(--dim); max-width: 36em; margin: 20px 0 26px; font-size: 15.5px; }

.hero-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 11px; }
.hero-points li { color: var(--dim); font-size: 14px; padding-left: 17px; position: relative; }
.hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 1.5px;
  background: var(--ember);
}

.create-card { padding: 26px; }
.create-card h2 { margin: 0 0 18px; font-size: 17px; font-weight: 600; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented button {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--dim);
  font-size: 13px;
  padding: 8px 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] {
  color: var(--ember);
  border-color: var(--ember-line);
  background: var(--ember-bg);
}

.join-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 20px 28px;
  color: var(--dim);
  font-size: 14px;
}
.join-form { display: flex; gap: 8px; }
.join-form input {
  width: 140px;
  text-align: center;
  letter-spacing: 2px;
}

.site-footer {
  text-align: center;
  color: var(--dimmer);
  font-size: 12.5px;
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
}

/* 进入动画：仅大厅页一次 */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.lobby .hero { animation: rise 0.4s ease-out both; }
.lobby .create-card { animation: rise 0.4s ease-out 0.1s both; }
.lobby .join-row { animation: rise 0.4s ease-out 0.2s both; }

/* ---------- 加入房间页 ---------- */

.join-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.join-card {
  width: min(400px, 100%);
  padding: 28px;
  animation: rise 0.3s ease-out both;
}

/* 分享卡：大号房间码 + 复制按钮 + 社交分享 */
.share-card h1 { margin: 0 0 14px; font-size: 22px; text-align: center; }
.code-label {
  color: var(--dim);
  font-size: 13px;
  text-align: center;
  margin: 0 0 8px;
  letter-spacing: 2px;
}
.big-code {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 10px;
  text-indent: 10px; /* 抵消末字符间距，保持视觉居中 */
  color: var(--ember);
  text-align: center;
  background: var(--bg-deep);
  border: 1px solid var(--ember-line);
  border-radius: 14px;
  padding: 16px 0 16px 0;
  margin-bottom: 14px;
}
.share-btn-row { display: flex; gap: 10px; }
.share-btn-row .btn-ghost { flex: 1; }
.share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.share-row-label { color: var(--dimmer); font-size: 12.5px; }
.share-pill {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--dim);
  font-size: 12.5px;
  padding: 5px 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.share-pill:hover { color: var(--ember); border-color: var(--ember-line); }
.qr-box { text-align: center; }
.qr-box h3 { margin: 0 0 14px; font-size: 15px; }
.qr-holder { display: inline-block; background: #fff; border-radius: 10px; padding: 10px; min-width: 160px; min-height: 100px; display: flex; align-items: center; justify-content: center; color: #333; font-size: 13px; }
.qr-holder svg { display: block; }
.join-divider {
  height: 1px;
  background: var(--border);
  margin: 22px 0 20px;
}
.join-room-label { color: var(--dim); font-size: 13px; margin: 0 0 4px; }
.join-room-label .mono { color: var(--text); }
.join-card h1 { margin: 0 0 6px; font-size: 22px; }
.join-room-meta { color: var(--dim); font-size: 13.5px; margin: 0 0 20px; }

/* ---------- 聊天页 ---------- */

body.room { height: 100dvh; overflow: hidden; }
.chat-shell { height: 100%; display: flex; flex-direction: column; }

.room-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--dim);
  padding: 6px 10px 6px 6px;
  border-radius: 8px;
}
.back:hover { color: var(--text); }

.room-title { min-width: 0; display: flex; flex-direction: column; }
.room-title h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.room-code { color: var(--dim); font-size: 12px; letter-spacing: 1px; }

.room-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--dim);
}
.online { white-space: nowrap; }

.sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.sound-toggle:hover { color: var(--ember); background: rgba(240, 164, 92, 0.1); }
.sound-toggle .ic-bell-off { display: none; }
.sound-toggle.muted { color: var(--dimmer); }
.sound-toggle.muted .ic-bell { display: none; }
.sound-toggle.muted .ic-bell-off { display: block; }
.online::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ember);
  margin-right: 6px;
  vertical-align: 1px;
}
.countdown { font-size: 14px; color: var(--text); white-space: nowrap; }
.countdown.urgent { color: var(--danger); }

.fuse {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.fuse-fill {
  height: 100%;
  background: var(--ember);
  box-shadow: 0 0 10px rgba(240, 164, 92, 0.6);
  transition: width 1s linear;
}
.fuse.urgent .fuse-fill {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(229, 115, 100, 0.55);
}

.banner {
  padding: 8px 18px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
}

.messages { flex: 1; overflow-y: auto; padding: 20px 18px 28px; }
.messages-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  animation: rise 0.25s ease-out both;
}

.messages::-webkit-scrollbar { width: 10px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--bg); }

.empty { margin: auto; color: var(--dim); font-size: 14px; text-align: center; }

.sysline {
  text-align: center;
  color: var(--dimmer);
  font-size: 12.5px;
  margin: 14px 0;
}

.msg { display: flex; flex-direction: column; margin: 10px 0; max-width: 82%; align-self: flex-start; }
.msg.own { align-self: flex-end; align-items: flex-end; }

@keyframes msg-in { from { opacity: 0; transform: translateY(4px); } }
.msg.fresh, .sysline.fresh { animation: msg-in 0.18s ease-out; }

.msg-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  color: var(--dimmer);
  margin: 0 4px 4px;
}
.msg-head .nick { font-weight: 600; font-size: 12.5px; }
.msg-head time { font-family: var(--font-mono); font-size: 11.5px; }

.msg-body { display: flex; align-items: flex-end; gap: 6px; }
.msg.own .msg-body { flex-direction: row-reverse; }

.bubble {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  padding: 8px 13px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg.own .bubble {
  background: var(--ember-bg);
  border-color: var(--ember-line);
  border-radius: 14px 4px 14px 14px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  font-size: 12px;
  flex: none;
}
.msg:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--text); }
.copy-btn .copy-done { display: none; }
.copy-btn.copied { opacity: 1; color: var(--ember); }
.copy-btn.copied .copy-done { display: inline; }
.copy-btn svg { flex: none; }

@media (hover: none) {
  .copy-btn { opacity: 0.85; }
}

.new-msg-pill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 96px;
  background: var(--panel);
  border: 1px solid var(--ember-line);
  color: var(--ember);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

/* ---------- 附件 ---------- */

.attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.attach-btn:hover { color: var(--ember); border-color: var(--ember-line); }

.emoji-panel {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 118px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  z-index: 30;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; }
.emoji-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
}
.emoji-cell:hover { background: rgba(255, 255, 255, 0.07); }
.emoji-cell img { width: 26px; height: 26px; display: block; }

.emoji { width: 20px; height: 20px; vertical-align: -3px; }

/* ---------- 验证码 ---------- */

.captcha-row { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.captcha-row img { border-radius: 8px; border: 1px solid var(--border); flex: none; }
.captcha-row input { width: 90px; text-align: center; letter-spacing: 3px; font-family: var(--font-mono); }

.captcha-box { width: min(340px, 92vw); padding: 24px; text-align: center; }
.captcha-box h3 { margin: 0 0 14px; font-size: 16px; }
.captcha-row-modal { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.captcha-row-modal img { border-radius: 8px; border: 1px solid var(--border); flex: none; }
.captcha-row-modal input { width: 100px; text-align: center; letter-spacing: 3px; font-family: var(--font-mono); }

/* ---------- 显示设置 ---------- */

:root { --chat-fs: 15px; --chat-font: inherit; }

.bubble, .msg-caption, #input { font-family: var(--chat-font); }
.bubble, .msg-caption { font-size: var(--chat-fs); }

.settings-box { text-align: left; }
.settings-box h3 { margin: 0 0 16px; text-align: center; }
.st-group { margin-bottom: 14px; }
.st-group > label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.st-options { display: flex; gap: 6px; flex-wrap: wrap; }
.st-options button {
  flex: 1;
  min-width: 56px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--dim);
  font-size: 13px;
  padding: 7px 4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.st-options button:hover { color: var(--text); }
.st-options button.active { color: var(--ember); border-color: var(--ember-line); background: var(--ember-bg); }
/* 引用 / 搜索 / 撤回 */
.quote-block {
  font-size: 12.5px;
  color: var(--dim);
  border-left: 3px solid var(--ember-line);
  padding: 4px 10px;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 6px 6px 0;
}
.quote-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 18px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.quote-preview {
  flex: 1;
  font-size: 12.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 3px solid var(--ember);
  padding-left: 10px;
}
.search-box { text-align: left; width: min(420px, 94vw); max-height: 80vh; display: flex; flex-direction: column; }
.search-box h3 { margin: 0 0 12px; text-align: center; }
.search-results { flex: 1; overflow-y: auto; max-height: 50vh; }
.search-hit {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 4px;
}
.search-hit:hover { background: rgba(255, 255, 255, 0.06); }
.search-hit-meta { font-size: 12px; color: var(--dim); margin-bottom: 3px; }
.search-hit-text { font-size: 13.5px; color: var(--text); }
.recall-btn:hover { color: var(--danger) !important; }
.msg-actions { display: flex; align-items: flex-end; gap: 2px; }
.msg.own .msg-actions { flex-direction: row-reverse; }

.st-version { text-align: center; color: var(--dimmer); font-size: 12px; margin: 14px 0 0; font-family: var(--font-mono); }

/* ---------- 房间抽屉 ---------- */

.rooms-toggle { vertical-align: middle; }

.rooms-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
  flex: none;
}
.rooms-list { flex: 1; overflow-y: auto; padding: 10px; }
.rooms-empty { color: var(--dim); text-align: center; padding: 50px 10px; font-size: 14px; }

.room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}
.room-item:hover { background: rgba(255, 255, 255, 0.06); }
.room-item.current { background: var(--ember-bg); }
.room-item-main { flex: 1; min-width: 0; }
.room-item-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.room-item-name > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-item-cur {
  font-size: 11px;
  font-weight: 500;
  color: var(--ember);
  border: 1px solid var(--ember-line);
  border-radius: 99px;
  padding: 0 8px;
  flex: none;
}
.room-item-meta { color: var(--dim); font-size: 12.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-item-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--dim);
  cursor: pointer;
}
.room-item-del:hover { color: var(--danger); background: rgba(229, 115, 100, 0.15); }

.room-item-meta2 { color: var(--ember); font-size: 12px; margin-top: 2px; white-space: nowrap; }
.rooms-actions { padding: 10px 12px 4px; flex: none; }
.rooms-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: transparent;
  border: 1px dashed var(--ember-line);
  border-radius: 10px;
  color: var(--ember);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 0;
  cursor: pointer;
}
.rooms-actions button:hover { background: var(--ember-bg); }

.join-mini { text-align: left; }
.join-mini h3 { margin: 0 0 16px; text-align: center; }
.rj-field { margin-bottom: 12px; }
.rj-field label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 5px; }
.rj-field input { width: 100%; }
.rj-field .mono { letter-spacing: 2px; }

/* 房间侧栏：全端常驻左栏（微信电脑版式），可收起 */
body.room { display: flex; }
#rooms-btn { position: relative; }
.btn-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg);
}
.room-unread {
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 700;
  flex: none;
  margin-right: 2px;
  font-family: var(--font-mono);
}
.rooms-drawer {
  order: -1;
  width: 240px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
}
body.rooms-collapsed .rooms-drawer { display: none; }
.chat-shell { flex: 1; min-width: 0; position: relative; }
.join-wrap { flex: 1; }
.rooms-toggle { vertical-align: middle; }

/* 窄屏紧凑侧栏（与聊天区并排共存） */
@media (max-width: 600px) {
  .rooms-drawer { width: 42vw; min-width: 136px; }
  .rooms-drawer-head { padding: 12px 12px 8px; font-size: 14px; }
  .rooms-actions { padding: 6px 8px 2px; }
  .rooms-actions button { font-size: 12.5px; padding: 7px 0; }
  .rooms-list { padding: 6px; }
  .room-item { padding: 8px 8px; border-radius: 10px; }
  .room-item-name { font-size: 13.5px; }
  .room-item-meta, .room-item-meta2 { font-size: 11px; }
  .room-item-del { width: 22px; height: 22px; }
  .msg { max-width: 96%; }
  .chat-media { max-width: 150px; }
}

.attach-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 18px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.attach-thumb {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--dim);
  font-size: 12px;
  background: var(--bg-deep);
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-info { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 13px; }
.attach-info #attach-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.attach-size { color: var(--dimmer); font-size: 12px; }
.attach-progress { color: var(--ember); font-size: 12px; font-family: var(--font-mono); }
.attach-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--dim);
  cursor: pointer;
}
.attach-remove:hover { color: var(--danger); background: rgba(229, 115, 100, 0.15); }

.chat-media {
  display: block;
  max-width: min(320px, 60vw);
  max-height: 260px;
  border-radius: 10px;
  cursor: pointer;
}
.msg-caption { margin-top: 6px; white-space: pre-wrap; word-break: break-word; }

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-deep);
  color: var(--text);
  min-width: 180px;
  max-width: 100%;
}
.file-card:hover { border-color: var(--ember-line); }
.file-card svg { color: var(--ember); flex: none; }
.file-card-info { display: flex; flex-direction: column; min-width: 0; }
.file-card-info > span:first-child {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.file-card-size { color: var(--dim); font-size: 12px; margin-top: 2px; }

.file-wrap { display: flex; align-items: stretch; gap: 6px; }
.file-wrap .file-card { cursor: pointer; font-family: inherit; text-align: left; }
.file-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--dim);
  background: var(--bg-deep);
}
.file-dl:hover { color: var(--ember); border-color: var(--ember-line); }

/* ---------- 文档预览 ---------- */

.doc-box {
  width: min(960px, 94vw);
  height: min(86vh, 900px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.doc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.doc-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 600;
}
.doc-actions { display: flex; gap: 8px; flex: none; }
.doc-body { flex: 1; overflow: auto; background: #0e1424; }
.doc-note {
  flex: none;
  padding: 12px 18px;
  color: var(--dim);
  font-size: 13.5px;
  border-top: 1px solid var(--border);
  background: rgba(240, 164, 92, 0.06);
}
.doc-frame { width: 100%; height: 100%; border: none; background: #fff; }
.doc-loading { padding: 40px; text-align: center; color: var(--dim); }

.doc-body .docx-container { background: #fff; padding: 24px; min-height: 100%; }
.doc-body .docx-wrapper { background: #fff; padding: 16px 0; }
.doc-body .docx-wrapper > section.docx { margin: 0 auto 24px; box-shadow: none; width: 100%; max-width: 800px; padding: 24px; }

.xlsx-wrap { background: #fff; min-height: 100%; }
.xlsx-tabs { display: flex; gap: 4px; padding: 10px 16px 0; background: #f2f3f7; border-bottom: 1px solid #e3e5ec; overflow-x: auto; }
.xlsx-tab {
  border: 1px solid #e3e5ec;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: #e9ebf2;
  color: #555c72;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.xlsx-tab.active { background: #fff; color: #1a2340; font-weight: 600; }
.xlsx-table { border-collapse: collapse; margin: 12px; background: #fff; }
.xlsx-table td, .xlsx-table th {
  border: 1px solid #d9dce6;
  padding: 5px 10px;
  font-size: 13px;
  color: #23283c;
  white-space: nowrap;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xlsx-table th { background: #eef0f6; font-weight: 600; }

.pptx-container { background: #fff; min-height: 100%; padding: 8px; }
.pptx-container .pptx-preview { overflow: auto; }
.doc-body .slide { margin: 0 auto 16px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18); }
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 38vh;
  overflow-y: auto;
  line-height: 1.5;
}
.composer .send { flex: none; }

/* ---------- 覆盖层 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 17, 32, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.overlay-card {
  width: min(360px, 100%);
  padding: 28px;
  text-align: center;
  animation: rise 0.3s ease-out both;
}
.overlay-card h2 { margin: 0 0 8px; font-size: 20px; }
.overlay-card p { color: var(--dim); font-size: 14px; margin: 0 0 20px; }

/* ---------- 响应式 ---------- */

@media (max-width: 880px) {
  .landing { grid-template-columns: 1fr; align-content: start; padding-top: 12px; }
  .hero h1 { font-size: clamp(42px, 11vw, 60px); }
  .room-title h1 { max-width: 56vw; }
  .room-meta { gap: 10px; }
  #copy-link { display: none; }
  .msg { max-width: 92%; }
}

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