:root {
  --brand-1: #272edc;
  --brand-2: #2db4f9;
  --chat-width: 650px;
  --chat-height: 700px;
  --text: #1f2329;
  --sub: #8a919f;
  --line: #e6e8ee;
  --page: #eef1f6;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: #f3f6f8;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, textarea { font: inherit; }
button { cursor: pointer; }

.chat-container {
  width: 100%;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.banner {
  margin: auto;
  color: var(--sub);
  padding: 24px;
  text-align: center;
}

.chat-navbar {
  height: 3.5rem;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem;
  color: #fff;
  background: linear-gradient(to right, var(--brand-2), var(--brand-1));
}
.nav-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-nick { font-size: 16px; font-weight: 600; line-height: 1.2; }
.user-sign { font-size: 12px; opacity: 0.88; margin-top: 2px; }
.user-sign:empty { display: none; }

.chat-body {
  flex: 1;
  overflow: auto;
  padding: 8px 12px 4px;
  background: #f3f6f8;
}
.history-hint { text-align: center; padding: 16px 8px 4px; }
.history-hint button {
  border: 0;
  background: transparent;
  color: #98a2b3;
  font-size: 13px;
  padding: 4px 8px;
}
.message { margin: 8px 0; display: flex; }
.message-col { max-width: 100%; min-width: 0; }
.message-row { display: flex; align-items: center; gap: 6px; }
.message.right { justify-content: flex-end; }
.message.right .message-col { margin-left: auto; }
.message.system { justify-content: center; margin: 6px 0; }
.message-author { color: #b4bcc8; font-size: 12px; margin-bottom: 4px; }
.message.right .message-author { text-align: right; }
.bubble {
  max-width: min(78%, 420px);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.message.right .bubble { background: #e8f1ff; }
.message.system .bubble {
  background: transparent;
  box-shadow: none;
  color: #98a2b3;
  font-size: 12px;
  padding: 0;
}
.quote {
  border-left: 3px solid #91caff;
  padding: 2px 8px;
  margin-bottom: 6px;
  color: #667085;
  font-size: 12px;
}
.msg-tool {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #98a2b3;
  padding: 0;
  flex: none;
  display: grid;
  place-items: center;
}
.msg-tool svg { width: 16px; height: 16px; }
.media-frame { position: relative; display: inline-block; max-width: 240px; }
.msg-media { display: block; max-width: 240px; max-height: 180px; border-radius: 8px; cursor: zoom-in; }
.media-save {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #344054;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.media-save svg { width: 16px; height: 16px; }
video.msg-media { max-width: 280px; background: #111; cursor: default; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
}
.viewer[hidden] { display: none; }
.viewer-bar { display: flex; align-items: center; gap: 2px; padding: 10px 8px 6px 14px; }
.viewer-count { margin-right: auto; font-size: 14px; }
.viewer-bar button {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
}
.viewer-bar svg { width: 22px; height: 22px; }
.viewer-stage { flex: 1; display: grid; place-items: center; overflow: hidden; }
.viewer-stage img { max-width: 92vw; max-height: calc(100vh - 64px); object-fit: contain; transform-origin: center center; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  z-index: 40;
}

.chat-footer {
  position: relative;
  flex: none;
  border-top: 1px solid #eef0f3;
  background: #fff;
  padding: 8px 10px 8px;
}
.chat-input {
  width: 100%;
  min-height: 38px;
  max-height: 96px;
  resize: none;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
  font-size: 14px;
}
.chat-input:focus { border-color: var(--brand-1); }
.chat-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}
.tool {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #667085;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 0;
}
.tool:hover { background: #f2f4f7; color: var(--brand-1); }
.tool input { display: none; }
.tool svg { width: 22px; height: 22px; }
.send-msg-button {
  margin-left: auto;
  height: 30px;
  min-width: 64px;
  border: 0;
  border-radius: 6px;
  background: var(--brand-1);
  color: #fff;
  padding: 0 14px;
  font-size: 14px;
}
.send-msg-button:disabled { opacity: 0.45; cursor: default; }

.emoji-picker {
  position: absolute;
  left: 12px;
  bottom: 58px;
  width: min(340px, calc(100% - 24px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
  z-index: 2;
}
.emoji-tabs { display: flex; gap: 4px; padding: 8px 8px 0; }
.emoji-tabs button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 16px;
}
.emoji-tabs button.active { background: #eef2ff; }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
}
.emoji-grid button {
  border: 0;
  background: transparent;
  border-radius: 6px;
  height: 32px;
  font-size: 20px;
}
.emoji-grid button:hover { background: #f2f4f7; }

