/* =========================================================
   QChat · QQ 风格 AI 聊天
   ========================================================= */

:root {
  --brand: #0aa7ff;
  --brand-bright: #37c6ff;
  --brand-deep: #0077e6;
  --brand-soft: #e8f6ff;
  --rail: #151d2b;
  --rail-deep: #101724;
  --panel: #ffffff;
  --panel-soft: #f6f9fc;
  --canvas: #eef5fb;
  --line: #e8eef5;
  --line-strong: #dbe6f0;
  --text: #172232;
  --text-2: #4f6073;
  --muted: #8b9aad;
  --danger: #e6505b;
  --green: #22c55e;
  --bubble-in: #ffffff;
  --bubble-out-a: #1fb9ff;
  --bubble-out-b: #039bf5;
  --shadow-sm: 0 1px 2px rgba(20, 58, 92, 0.05), 0 4px 14px rgba(20, 58, 92, 0.04);
  --shadow-md: 0 10px 38px rgba(19, 57, 92, 0.1);
  --shadow-lg: 0 24px 80px rgba(15, 43, 70, 0.18);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --font: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button:disabled {
  cursor: not-allowed;
}

img {
  display: block;
  max-width: 100%;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

code,
pre {
  font-family: var(--mono);
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

:focus-visible {
  outline: 2px solid rgba(10, 167, 255, 0.55);
  outline-offset: 2px;
}

::selection {
  background: rgba(10, 167, 255, 0.2);
}

/* =========================================================
   启动 / 登录 / 注册
   ========================================================= */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  justify-content: center;
  color: #6f8598;
  background:
    radial-gradient(500px 340px at 50% 18%, rgba(55, 198, 255, 0.18), transparent 68%),
    #eef6fc;
}

.boot-screen img {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(0, 132, 220, 0.22), 0 0 0 7px rgba(255, 255, 255, 0.6);
  animation: floaty 4.5s ease-in-out infinite;
}

.boot-spinner {
  width: 19px;
  height: 19px;
  border: 2px solid rgba(10, 167, 255, 0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.boot-screen p {
  font-size: 11px;
  letter-spacing: 0.4px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--app-height, 100dvh);
  padding: 26px;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(680px 500px at 18% 12%, rgba(55, 198, 255, 0.34), transparent 65%),
    radial-gradient(620px 520px at 88% 88%, rgba(0, 119, 230, 0.2), transparent 68%),
    linear-gradient(145deg, #d9edfb 0%, #eef7fd 48%, #cfe6f7 100%);
}

.auth-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}

.auth-bg-orb-a {
  top: -150px;
  left: -120px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(55, 198, 255, 0.28), transparent 66%);
}

.auth-bg-orb-b {
  right: -160px;
  bottom: -190px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(0, 132, 230, 0.18), transparent 66%);
}

.auth-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 132, 180, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 132, 180, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.6), transparent 72%);
}

.auth-window {
  position: relative;
  z-index: 2;
  width: 410px;
  max-width: 100%;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(9, 48, 78, 0.24), 0 4px 14px rgba(9, 48, 78, 0.08);
  animation: dialogIn 0.24s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.auth-visual {
  position: relative;
  height: 206px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(420px 250px at 88% 6%, rgba(120, 230, 255, 0.42), transparent 64%),
    linear-gradient(135deg, #0a2f52 0%, #086899 46%, #0bb4f2 100%);
}

.auth-visual::before {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(130deg, rgba(0, 0, 0, 0.7), transparent 70%);
  pointer-events: none;
}

.auth-visual-brand {
  position: absolute;
  top: 17px;
  left: 19px;
  z-index: 2;
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-visual-brand img {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.auth-visual-brand span {
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.auth-visual-brand em {
  padding: 2px 5px;
  color: rgba(190, 240, 255, 0.8);
  font-size: 7px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 1.1px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 4px;
}

.auth-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-ring {
  position: absolute;
  top: 20px;
  right: -64px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(255, 255, 255, 0.035), 0 0 0 58px rgba(255, 255, 255, 0.02);
}

.auth-bubble {
  position: absolute;
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0, 35, 60, 0.18);
}

.auth-bubble::after {
  position: absolute;
  bottom: -4px;
  left: 17px;
  width: 9px;
  height: 9px;
  content: "";
  background: inherit;
  border-radius: 2px;
  transform: rotate(45deg);
}

.auth-bubble i {
  width: 5px;
  height: 5px;
  background: #0aa7ff;
  border-radius: 50%;
}

.auth-bubble-a {
  top: 78px;
  right: 27px;
  width: 86px;
  height: 43px;
}

.auth-bubble-b {
  top: 132px;
  right: 112px;
  width: 60px;
  height: 33px;
  background: rgba(255, 255, 255, 0.8);
}

.auth-bubble-b i {
  width: 4px;
  height: 4px;
  background: #4cb9e8;
}

.auth-spark {
  position: absolute;
  width: 5px;
  height: 5px;
  background: rgba(213, 247, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(156, 235, 255, 0.8);
}

.auth-spark-a {
  top: 52px;
  right: 158px;
}

.auth-spark-b {
  top: 118px;
  right: 38px;
  width: 3px;
  height: 3px;
}

.auth-spark-c {
  top: 63px;
  right: 66px;
  width: 3px;
  height: 3px;
}

.auth-visual-mark {
  position: absolute;
  right: 19px;
  bottom: -39px;
  color: rgba(255, 255, 255, 0.08);
  font-size: 120px;
  font-weight: 800;
  line-height: 1;
  user-select: none;
}

.auth-form-panel {
  position: relative;
  z-index: 2;
  padding: 0 28px 18px;
  margin-top: -30px;
  background: #fff;
  border-radius: 16px 16px 0 0;
}

.auth-avatar {
  display: grid;
  width: 58px;
  height: 58px;
  margin: -29px auto 7px;
  color: #fff;
  background: linear-gradient(145deg, #76ddff, #0aa7ff);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(10, 133, 199, 0.25);
  place-items: center;
}

.auth-avatar .icon {
  width: 25px;
  height: 25px;
  stroke-width: 1.7;
}

.auth-tabs {
  display: flex;
  gap: 11px;
  align-items: center;
  justify-content: center;
}

.auth-tabs button {
  position: relative;
  height: 34px;
  padding: 0 10px;
  color: #8b9bad;
  font-size: 12.5px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.auth-tabs button:hover:not(:disabled) {
  color: #4a6a82;
}

.auth-tabs button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.auth-tabs button.is-active {
  color: #0b83c4;
}

.auth-tabs button.is-active::after {
  position: absolute;
  bottom: 1px;
  left: 50%;
  width: 15px;
  height: 2px;
  content: "";
  background: var(--brand);
  border-radius: 2px;
  transform: translateX(-50%);
}

.auth-tab-sep {
  width: 1px;
  height: 11px;
  background: #e3ebf3;
}

.auth-subtitle {
  margin: 0 0 13px;
  color: #9aabb9;
  font-size: 9.5px;
  text-align: center;
}

.auth-form {
  display: block;
}

.auth-field {
  display: block;
  margin-bottom: 12px;
}

.auth-field > span {
  display: block;
  margin-bottom: 6px;
  color: #43596d;
  font-size: 10.5px;
  font-weight: 600;
}

.auth-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: #2e4256;
  font-size: 13px;
  background: #f7fafd;
  border: 1px solid #e2ebf3;
  border-radius: 9px;
  outline: 0;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input::placeholder {
  color: #b0bdc9;
}

.auth-field input:focus {
  background: #fff;
  border-color: rgba(10, 167, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 167, 255, 0.08);
}

.auth-secret {
  position: relative;
}

.auth-secret input {
  padding-right: 40px;
}

.auth-eye {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 30px;
  height: 30px;
  color: #91a4b6;
  border-radius: 7px;
  transform: translateY(-50%);
  place-items: center;
}

.auth-eye:hover {
  color: #1689c2;
  background: #eef8fe;
}

.auth-eye .icon {
  width: 16px;
  height: 16px;
}

.password-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: -4px 0 12px;
}

.password-rules span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 3px 7px;
  color: #9aaab9;
  font-size: 8.5px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 5px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.password-rules i {
  width: 5px;
  height: 5px;
  background: #cbd8e3;
  border-radius: 50%;
}

.password-rules span.ok {
  color: #1d9b6b;
  background: #f2fbf6;
  border-color: #d8f1e4;
}

.password-rules span.ok i {
  background: #22b573;
}

.auth-hint {
  margin: -4px 0 12px;
  color: #98a9b9;
  font-size: 9px;
  line-height: 1.55;
  text-align: center;
}

.auth-error {
  margin: 0 0 10px;
  padding: 8px 10px;
  color: #b1424b;
  font-size: 10px;
  line-height: 1.55;
  background: #fff5f6;
  border: 1px solid #fadce0;
  border-radius: 7px;
}

.auth-error.is-info {
  color: #3e7899;
  background: #f3faff;
  border-color: #d9edf9;
}

.auth-submit {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  margin-top: 3px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 650;
  background: linear-gradient(145deg, var(--brand-bright), var(--brand));
  border-radius: 9px;
  box-shadow: 0 8px 20px rgba(10, 167, 255, 0.24);
  transition: filter 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.auth-submit:hover:not(:disabled) {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-submit .icon {
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
}

.auth-switch {
  margin-top: 13px;
  color: #98a8b8;
  font-size: 10px;
  text-align: center;
}

.auth-switch button {
  padding: 0 2px;
  color: #1289c7;
  font-size: 10px;
  font-weight: 600;
}

.auth-switch button:hover {
  text-decoration: underline;
}

.auth-service {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 15px;
  padding-top: 13px;
  color: #94a5b5;
  font-size: 9px;
  border-top: 1px solid #edf3f8;
}

.service-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: #c5d2de;
  border-radius: 50%;
}

.auth-service.is-online .service-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.11);
}

.auth-service.is-offline .service-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(230, 80, 91, 0.1);
}

#authRetryBtn {
  margin-left: auto;
  color: #1289c7;
  font-size: 9px;
  font-weight: 600;
}

#authRetryBtn:hover {
  text-decoration: underline;
}

.auth-privacy {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 7px;
  color: #adbac6;
  font-size: 8.5px;
  text-align: center;
}

.auth-privacy .icon {
  width: 10px;
  height: 10px;
  stroke-width: 1.7;
}

/* =========================================================
   总体布局
   ========================================================= */

.app {
  display: flex;
  width: 100%;
  height: var(--app-height, 100dvh);
  overflow: hidden;
  background: var(--canvas);
}

/* =========================================================
   左侧导航栏
   ========================================================= */

.rail {
  position: relative;
  z-index: 20;
  display: flex;
  flex: 0 0 70px;
  flex-direction: column;
  align-items: center;
  width: 70px;
  padding: 16px 0 14px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.6);
  background:
    radial-gradient(120px 160px at 20% -10%, rgba(55, 198, 255, 0.24), transparent 70%),
    linear-gradient(180deg, var(--rail) 0%, var(--rail-deep) 100%);
}

.rail::after {
  position: absolute;
  right: 0;
  bottom: -70px;
  width: 150px;
  height: 150px;
  content: "";
  background: rgba(10, 167, 255, 0.08);
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.rail-brand {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 26px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  place-items: center;
}

.rail-brand img {
  width: 100%;
  height: 100%;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.rail-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: rgba(255, 255, 255, 0.58);
  border-radius: 14px;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.rail-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.rail-btn.is-active {
  color: #fff;
  background: linear-gradient(145deg, rgba(55, 198, 255, 0.34), rgba(10, 167, 255, 0.16));
  box-shadow: inset 0 0 0 1px rgba(117, 218, 255, 0.22), 0 8px 20px rgba(0, 126, 220, 0.22);
}

.rail-btn.is-active .icon {
  filter: drop-shadow(0 0 7px rgba(55, 198, 255, 0.45));
}

.rail-label {
  display: none;
  font-size: 10px;
  line-height: 1;
}

.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: auto;
}

.rail-avatar {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(140deg, #8b7cf6, #5a7cf5);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  place-items: center;
}

.rail-online {
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 10px;
  height: 10px;
  background: var(--green);
  border: 2px solid var(--rail);
  border-radius: 50%;
}

/* =========================================================
   会话列表
   ========================================================= */

.list-pane {
  position: relative;
  z-index: 10;
  display: flex;
  flex: 0 0 296px;
  flex-direction: column;
  width: 296px;
  min-width: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 18px 10px;
}

.list-title h2 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.list-title p {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
}

.tiny-spark {
  width: 5px;
  height: 5px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(10, 167, 255, 0.12);
}

.new-chat-btn {
  display: grid;
  width: 36px;
  height: 36px;
  margin-top: 2px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-bright), var(--brand));
  border-radius: 11px;
  box-shadow: 0 7px 16px rgba(10, 167, 255, 0.28);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  place-items: center;
}

.new-chat-btn:hover {
  box-shadow: 0 9px 22px rgba(10, 167, 255, 0.38);
  transform: translateY(-1px);
}

.new-chat-btn .icon {
  width: 19px;
  height: 19px;
  stroke-width: 2.2;
}

.search-box {
  display: flex;
  gap: 7px;
  align-items: center;
  height: 38px;
  margin: 6px 14px 11px;
  padding: 0 10px;
  color: var(--muted);
  background: #f2f6fa;
  border: 1px solid transparent;
  border-radius: 9px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-box:focus-within {
  background: #fff;
  border-color: rgba(10, 167, 255, 0.38);
  box-shadow: 0 0 0 3px rgba(10, 167, 255, 0.08);
}

.search-box .icon {
  width: 16px;
  height: 16px;
}

.search-box input {
  min-width: 0;
  flex: 1;
  padding: 0;
  font-size: 12.5px;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box input::-webkit-search-cancel-button {
  opacity: 0.45;
}

.search-kbd {
  padding: 2px 5px;
  color: #a5b2c1;
  font-family: var(--font);
  font-size: 9px;
  background: #fff;
  border: 1px solid #e5edf5;
  border-radius: 4px;
}

.list-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 19px 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.list-count {
  display: grid;
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  color: #8a9bad;
  font-size: 10px;
  background: #f2f6fa;
  border-radius: 9px;
  place-items: center;
}

.conv-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: #d9e3ed transparent;
}

.conv-scroll::-webkit-scrollbar,
.message-scroll::-webkit-scrollbar,
.dialog-body::-webkit-scrollbar,
pre::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.conv-scroll::-webkit-scrollbar-thumb,
.message-scroll::-webkit-scrollbar-thumb,
.dialog-body::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb {
  background: rgba(120, 143, 165, 0.28);
  border-radius: 6px;
}

.conv-scroll::-webkit-scrollbar-thumb:hover,
.message-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 143, 165, 0.45);
}

.conv-item {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  height: 66px;
  margin-bottom: 2px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.conv-item:hover {
  background: #f5f9fd;
}

.conv-item.is-active {
  background: linear-gradient(100deg, #e8f6ff, #f3faff);
  border-color: #d9efff;
}

.conv-item.is-active::before {
  align-self: center;
  width: 3px;
  height: 24px;
  margin-left: -10px;
  margin-right: -1px;
  content: "";
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

.conv-item:active {
  transform: scale(0.995);
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  user-select: none;
  place-items: center;
}

.conv-avatar {
  width: 43px;
  height: 43px;
  font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 4px 10px rgba(24, 67, 105, 0.12);
}

.conv-avatar .icon {
  width: 20px;
  height: 20px;
}

.conv-body {
  flex: 1;
  min-width: 0;
}

.conv-top,
.conv-bottom {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.conv-title {
  overflow: hidden;
  color: #263446;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item.is-active .conv-title {
  color: #0875bd;
}

.conv-time {
  flex: 0 0 auto;
  color: #a4b1c0;
  font-size: 9.5px;
}

.conv-bottom {
  margin-top: 5px;
}

.conv-preview {
  overflow: hidden;
  color: #93a2b4;
  font-size: 11.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-typing {
  flex: 0 0 auto;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.list-empty {
  padding: 54px 20px;
  color: var(--muted);
  text-align: center;
}

.list-empty-orb {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: #a9c0d4;
  background: #f1f7fc;
  border-radius: 50%;
  place-items: center;
}

.list-empty p {
  color: #5e7184;
  font-size: 13px;
  font-weight: 600;
}

.list-empty span {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
}

.me-card {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
  align-items: center;
  height: 64px;
  padding: 9px 13px;
  border-top: 1px solid var(--line);
}

.avatar-me {
  width: 34px;
  height: 34px;
  font-size: 12px;
  background: linear-gradient(140deg, #8b7cf6, #5a7cf5);
  box-shadow: 0 4px 12px rgba(90, 124, 245, 0.25);
}

.me-info {
  min-width: 0;
  flex: 1;
}

.me-name {
  font-size: 12.5px;
  font-weight: 650;
}

.me-sub {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
  color: #9aa8b8;
  font-size: 9.5px;
}

.online-dot {
  width: 5px;
  height: 5px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.12);
}

.icon-btn {
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  color: #7c8da1;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
  place-items: center;
}

.icon-btn:hover {
  color: var(--brand-deep);
  background: #f0f7fd;
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

/* =========================================================
   聊天窗口
   ========================================================= */

.chat-pane {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--canvas);
}

.chat-head {
  position: relative;
  z-index: 8;
  display: flex;
  flex: 0 0 67px;
  gap: 12px;
  align-items: center;
  height: 67px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(226, 235, 244, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
}

.back-btn {
  display: none;
  width: 34px;
  height: 34px;
  margin-left: -6px;
}

.peer {
  display: flex;
  gap: 11px;
  align-items: center;
  min-width: 0;
}

.peer-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 41px;
  height: 41px;
  background: linear-gradient(145deg, #e9f9ff, #dff4ff);
  border: 1px solid #d9f0ff;
  border-radius: 13px;
  box-shadow: 0 5px 14px rgba(14, 118, 182, 0.12);
}

.peer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.peer-status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  background: var(--green);
  border: 2px solid #fff;
  border-radius: 50%;
}

.peer-status-dot.is-typing {
  background: var(--brand);
  animation: statusPulse 1.2s ease-in-out infinite;
}

.peer-meta {
  min-width: 0;
}

.peer-meta h1 {
  overflow: hidden;
  max-width: 340px;
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-sub {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
  margin-top: 3px;
  color: #91a0b2;
  font-size: 10.5px;
}

.peer-sub #peerStatusText {
  color: #5d7388;
}

.peer-sub.typing #peerStatusText {
  color: var(--brand-deep);
}

.peer-model {
  overflow: hidden;
  max-width: 190px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-sep {
  color: #c3ceda;
}

.chat-tools {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-left: auto;
}

.model-pill {
  display: flex;
  gap: 6px;
  align-items: center;
  max-width: 190px;
  height: 31px;
  padding: 0 10px;
  color: #5a7084;
  font-size: 10.5px;
  font-weight: 600;
  background: #f4f9fd;
  border: 1px solid #e7f0f8;
  border-radius: 8px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.model-pill:hover {
  color: var(--brand-deep);
  background: #fff;
  border-color: #cce9fb;
}

.model-pill .icon {
  width: 14px;
  height: 14px;
  color: var(--brand);
}

.model-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-tools .icon-btn:hover {
  background: #f2f8fd;
}

/* =========================================================
   消息区 / 欢迎页
   ========================================================= */

.message-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(900px 520px at 92% -12%, rgba(104, 203, 255, 0.18), transparent 64%),
    radial-gradient(720px 520px at -8% 112%, rgba(132, 214, 255, 0.17), transparent 60%),
    linear-gradient(180deg, #f2f8fd 0%, #edf4fa 100%);
  scrollbar-width: thin;
  scrollbar-color: #d5e1ec transparent;
  overscroll-behavior: contain;
}

.welcome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 38px 24px 30px;
  overflow: hidden;
}

.welcome-glow {
  position: absolute;
  top: 8%;
  left: 50%;
  width: 430px;
  height: 430px;
  background: radial-gradient(circle, rgba(55, 198, 255, 0.2), transparent 65%);
  border-radius: 50%;
  filter: blur(14px);
  transform: translateX(-50%);
  pointer-events: none;
}

.welcome-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 570px;
  text-align: center;
}

.welcome-logo {
  width: 82px;
  height: 82px;
  margin: 0 auto 17px;
  border-radius: 23px;
  box-shadow: 0 18px 42px rgba(0, 132, 220, 0.24), 0 0 0 7px rgba(255, 255, 255, 0.52);
  animation: floaty 5.5s ease-in-out infinite;
}

.welcome-eyebrow {
  color: #58a9d8;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2.4px;
}

.welcome h2 {
  margin-top: 9px;
  color: #182a3d;
  font-size: 27px;
  font-weight: 720;
  letter-spacing: -0.7px;
}

.welcome-wave {
  display: inline-block;
  margin-left: 5px;
  font-size: 24px;
  animation: wave 2.6s ease-in-out infinite;
  transform-origin: 70% 80%;
}

.welcome-sub {
  margin-top: 10px;
  color: #71869a;
  font-size: 13px;
  line-height: 1.8;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 25px;
  text-align: left;
}

.suggestion {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(214, 230, 243, 0.9);
  border-radius: 11px;
  box-shadow: 0 3px 12px rgba(28, 68, 103, 0.045);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  backdrop-filter: blur(8px);
}

.suggestion:hover {
  background: #fff;
  border-color: #bde6fb;
  box-shadow: 0 8px 22px rgba(28, 95, 140, 0.1);
  transform: translateY(-2px);
}

.suggestion-emoji {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  font-size: 16px;
  background: #f0f8fe;
  border-radius: 9px;
  place-items: center;
}

.suggestion strong {
  display: block;
  overflow: hidden;
  color: #33475b;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #98a8b8;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-actions {
  display: flex;
  gap: 13px;
  align-items: center;
  justify-content: center;
  margin-top: 21px;
}

.welcome-config {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  color: #4385ad;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(195, 224, 242, 0.9);
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.welcome-config:hover {
  background: #fff;
  border-color: #9bd6f5;
}

.welcome-config .icon {
  width: 13px;
  height: 13px;
}

.welcome-note {
  color: #9aacbc;
  font-size: 9.5px;
}

.message-list {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 8px 26px 12px;
}

.scroll-anchor {
  height: 1px;
}

.time-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 18px 0 12px;
  color: #9dafc0;
  font-size: 9.5px;
  letter-spacing: 0.2px;
}

.time-divider span {
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
  animation: msgIn 0.2s ease both;
}

.msg-out {
  flex-direction: row-reverse;
}

.msg-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 37px;
  height: 37px;
  margin-top: 1px;
  overflow: hidden;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(24, 67, 105, 0.12), 0 0 0 1px rgba(219, 232, 243, 0.8);
  place-items: center;
}

.msg-avatar img {
  width: 100%;
  height: 100%;
}

.msg-avatar-user {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(140deg, #8b7cf6, #5a7cf5);
}

.msg-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(72%, 700px);
  min-width: 0;
}

.msg-out .msg-main {
  align-items: flex-end;
}

.bubble {
  position: relative;
  min-width: 38px;
  padding: 9px 13px;
  color: #243649;
  font-size: 14px;
  line-height: 1.72;
  word-break: break-word;
  background: var(--bubble-in);
  border: 1px solid rgba(220, 232, 242, 0.9);
  border-radius: 4px 13px 13px 13px;
  box-shadow: 0 2px 9px rgba(29, 70, 105, 0.055);
}

.msg-out .bubble {
  color: #fff;
  background: linear-gradient(135deg, var(--bubble-out-a), var(--bubble-out-b));
  border-color: transparent;
  border-radius: 13px 4px 13px 13px;
  box-shadow: 0 5px 16px rgba(3, 155, 245, 0.2);
}

.msg-body {
  min-width: 0;
}

.msg-plain {
  white-space: pre-wrap;
}

.msg-actions {
  display: flex;
  gap: 1px;
  align-items: center;
  height: 22px;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.msg:hover .msg-actions,
.msg:focus-within .msg-actions {
  opacity: 1;
}

.msg-action {
  display: inline-grid;
  width: 24px;
  height: 22px;
  color: #8a9caf;
  border-radius: 5px;
  transition: color 0.15s ease, background 0.15s ease;
  place-items: center;
}

.msg-action:hover {
  color: var(--brand-deep);
  background: rgba(255, 255, 255, 0.85);
}

.msg-action .icon {
  width: 13px;
  height: 13px;
}

.msg-out .msg-action:hover {
  color: #0877b8;
}

.msg-note {
  margin-top: 5px;
  color: #93a5b7;
  font-size: 9.5px;
}

.msg-error {
  margin-top: 8px;
  padding: 9px 11px;
  color: #9f333c;
  font-size: 11.5px;
  line-height: 1.65;
  background: #fff5f5;
  border: 1px solid #ffdcdf;
  border-radius: 8px;
}

.msg-error strong {
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 11.5px;
  font-weight: 650;
}

.msg-error p {
  margin-top: 3px;
}

.msg-error .error-detail {
  display: block;
  max-height: 66px;
  margin-top: 4px;
  overflow: hidden;
  color: #b1757a;
  font-size: 10px;
  word-break: break-word;
}

.error-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.retry-btn {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  color: #b23c45;
  font-size: 10.5px;
  font-weight: 600;
  background: #fff;
  border: 1px solid #ffd5d9;
  border-radius: 5px;
}

.retry-btn:hover {
  background: #fff0f1;
}

.retry-btn .icon {
  width: 12px;
  height: 12px;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 20px;
  padding: 2px 1px;
}

.typing-dots i {
  display: block;
  width: 5px;
  height: 5px;
  background: #8fc7e8;
  border-radius: 50%;
  animation: typingBounce 1.25s ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.msg-out .typing-dots i {
  background: rgba(255, 255, 255, 0.8);
}

.stream-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -3px;
  background: var(--brand);
  border-radius: 2px;
  animation: blink 0.95s steps(2, start) infinite;
}

.msg-out .stream-caret {
  background: #fff;
}

/* =========================================================
   思考过程
   ========================================================= */

.thinking {
  margin-bottom: 9px;
  background: rgba(240, 249, 255, 0.82);
  border: 1px solid #dceffb;
  border-radius: 8px;
}

.thinking summary {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 9px;
  color: #5e93b3;
  font-size: 10.5px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.thinking summary::-webkit-details-marker {
  display: none;
}

.thinking summary .icon {
  width: 12px;
  height: 12px;
}

.thinking summary::after {
  margin-left: auto;
  content: "›";
  font-size: 14px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.thinking[open] summary::after {
  transform: rotate(90deg);
}

.thinking-body {
  max-height: 300px;
  padding: 0 10px 8px;
  overflow-y: auto;
  color: #6b879b;
  font-size: 11.5px;
  line-height: 1.7;
}

.thinking-body p {
  margin: 0 0 5px;
}

/* =========================================================
   Markdown
   ========================================================= */

.md {
  min-width: 0;
}

.md > :first-child {
  margin-top: 0;
}

.md > :last-child {
  margin-bottom: 0;
}

.md p {
  margin: 0 0 0.62em;
}

.md h1,
.md h2,
.md h3,
.md h4 {
  margin: 0.85em 0 0.42em;
  color: #1b2d40;
  font-weight: 700;
  line-height: 1.45;
}

.msg-out .md h1,
.msg-out .md h2,
.msg-out .md h3,
.msg-out .md h4 {
  color: #fff;
}

.md h1 {
  font-size: 1.35em;
}

.md h2 {
  font-size: 1.22em;
}

.md h3 {
  font-size: 1.1em;
}

.md h4 {
  font-size: 1em;
}

.md strong {
  font-weight: 700;
}

.md em {
  font-style: italic;
}

.md del {
  opacity: 0.7;
}

.md a {
  color: #067fc4;
  text-decoration: none;
  border-bottom: 1px solid rgba(6, 127, 196, 0.28);
}

.md a:hover {
  border-bottom-color: currentColor;
}

.msg-out .md a {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

.md code:not(pre code) {
  padding: 1px 5px;
  color: #0878ad;
  font-size: 0.86em;
  background: rgba(10, 167, 255, 0.09);
  border: 1px solid rgba(10, 167, 255, 0.08);
  border-radius: 4px;
}

.msg-out .md code:not(pre code) {
  color: #fff;
  background: rgba(255, 255, 255, 0.17);
  border-color: rgba(255, 255, 255, 0.1);
}

.md-list {
  margin: 0.42em 0 0.62em;
}

.md-li {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin: 2px 0;
  padding-left: calc(var(--depth, 0) * 15px);
}

.md-marker {
  flex: 0 0 auto;
  min-width: 1.1em;
  color: #74a9c9;
  font-variant-numeric: tabular-nums;
}

.msg-out .md-marker {
  color: rgba(255, 255, 255, 0.72);
}

.md-li-text {
  min-width: 0;
}

.md blockquote {
  margin: 0.55em 0;
  padding: 7px 11px;
  color: #5a7387;
  background: #f5fafe;
  border-left: 3px solid #a9dcf7;
  border-radius: 0 5px 5px 0;
}

.msg-out .md blockquote {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
  border-left-color: rgba(255, 255, 255, 0.55);
}

.md hr {
  height: 1px;
  margin: 0.9em 0;
  background: #e1ebf3;
  border: 0;
}

.msg-out .md hr {
  background: rgba(255, 255, 255, 0.25);
}

.code-block {
  margin: 0.7em 0;
  overflow: hidden;
  background: #101923;
  border: 1px solid rgba(16, 25, 35, 0.9);
  border-radius: 9px;
  box-shadow: 0 3px 12px rgba(8, 20, 32, 0.12);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 9px 0 12px;
  color: #7e94a8;
  font-family: var(--font);
  font-size: 9.5px;
  letter-spacing: 0.5px;
  background: #0c141d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.code-lang {
  text-transform: uppercase;
}

.code-copy {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 22px;
  padding: 0 6px;
  color: #8ba0b3;
  font-size: 9.5px;
  border-radius: 4px;
}

.code-copy:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.code-copy .icon {
  width: 11px;
  height: 11px;
}

.code-block pre {
  margin: 0;
  padding: 11px 13px;
  overflow-x: auto;
  color: #dbe9f5;
  font-size: 12px;
  line-height: 1.65;
  tab-size: 2;
}

.code-block code {
  white-space: pre;
}

.md-table-wrap {
  margin: 0.7em 0;
  overflow-x: auto;
  border: 1px solid #e0ebf4;
  border-radius: 7px;
}

.md table {
  width: 100%;
  font-size: 0.9em;
  border-collapse: collapse;
}

.md th,
.md td {
  padding: 6px 9px;
  text-align: left;
  border-right: 1px solid #e7f0f7;
  border-bottom: 1px solid #e7f0f7;
}

.md th {
  font-weight: 650;
  background: #f4f9fd;
}

.md tr:last-child td {
  border-bottom: 0;
}

.md th:last-child,
.md td:last-child {
  border-right: 0;
}

.msg-out .md-table-wrap {
  border-color: rgba(255, 255, 255, 0.2);
}

.msg-out .md th,
.msg-out .md td {
  border-color: rgba(255, 255, 255, 0.16);
}

.msg-out .md th {
  background: rgba(255, 255, 255, 0.12);
}

.md-empty {
  color: #99aaba;
}

/* =========================================================
   输入区
   ========================================================= */

.composer-wrap {
  position: relative;
  z-index: 7;
  flex: 0 0 auto;
  padding: 8px 26px 12px;
  background: linear-gradient(180deg, rgba(237, 244, 250, 0), #edf4fa 34%);
}

.composer {
  max-width: 1020px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #dce8f2;
  border-radius: 14px;
  box-shadow: 0 7px 26px rgba(23, 64, 99, 0.08), 0 1px 2px rgba(23, 64, 99, 0.04);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.composer:focus-within {
  border-color: rgba(10, 167, 255, 0.48);
  box-shadow: 0 8px 30px rgba(10, 144, 220, 0.11), 0 0 0 3px rgba(10, 167, 255, 0.065);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: 150px;
  padding: 12px 14px 2px;
  overflow-y: auto;
  color: #233447;
  font-size: 13.5px;
  line-height: 1.65;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
  scrollbar-width: thin;
}

.composer textarea::placeholder {
  color: #a2b1c0;
}

.composer-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 8px 9px;
}

.composer-left,
.composer-right {
  display: flex;
  gap: 2px;
  align-items: center;
  min-width: 0;
}

.composer-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.composer-btn .icon {
  width: 17px;
  height: 17px;
}

.composer-hint {
  margin-left: 4px;
  color: #a4b2c1;
  font-size: 9.5px;
  white-space: nowrap;
}

.char-count {
  padding-right: 5px;
  color: #a8b6c5;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
}

.send-btn {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  height: 33px;
  padding: 0 13px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  background: linear-gradient(145deg, var(--brand-bright), var(--brand));
  border-radius: 8px;
  box-shadow: 0 5px 13px rgba(10, 167, 255, 0.28);
  transition: filter 0.15s ease, transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.send-btn:hover:not(:disabled) {
  box-shadow: 0 7px 18px rgba(10, 167, 255, 0.36);
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.send-btn:active:not(:disabled) {
  transform: translateY(0);
}

.send-btn .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.send-btn:disabled {
  color: #aab8c6;
  background: #eef3f8;
  box-shadow: none;
}

.send-btn.is-stop {
  color: #d64b55;
  background: #fff1f2;
  border: 1px solid #ffd8dc;
  box-shadow: none;
}

.send-btn.is-stop:hover {
  background: #ffe8ea;
  box-shadow: none;
}

.send-btn.is-stop .icon {
  width: 13px;
  height: 13px;
}

.composer-note {
  margin: 6px auto 0;
  color: #9eafbf;
  font-size: 9px;
  text-align: center;
}

/* =========================================================
   表情面板
   ========================================================= */

.emoji-panel {
  position: fixed;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 326px;
  max-height: 330px;
  padding: 9px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5eef6;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  animation: popIn 0.14s ease both;
}

.emoji-grid,
.emoji-custom-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-custom-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1px 2px 4px;
  color: #6e8498;
  font-size: 10px;
  font-weight: 650;
}

.emoji-upload {
  padding: 3px 7px;
  color: #0a93dc;
  font-size: 9.5px;
  background: #f1fbff;
  border: 1px solid #d9f0fc;
  border-radius: 6px;
}

.emoji-upload:hover {
  background: #e5f7ff;
}

.emoji-custom-empty {
  padding: 4px 2px 7px;
  color: #9badbc;
  font-size: 9.5px;
}

.emoji-custom-wrap {
  position: relative;
  aspect-ratio: 1;
}

.emoji-custom-item {
  overflow: hidden;
}

.emoji-custom-item img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.emoji-delete {
  position: absolute;
  top: -2px;
  right: -2px;
  display: none;
  width: 15px;
  height: 15px;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  background: rgba(223, 75, 86, 0.9);
  border-radius: 50%;
  place-items: center;
}

.emoji-custom-wrap:hover .emoji-delete {
  display: grid;
}

.chat-emoji {
  display: inline-block;
  width: 28px;
  height: 28px;
  margin: 0 1px;
  object-fit: contain;
  vertical-align: middle;
}

.emoji-item {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  font-size: 19px;
  border-radius: 7px;
  place-items: center;
}

.emoji-item:hover {
  background: #f0f7fd;
}

/* =========================================================
   菜单 / 提示
   ========================================================= */

.menu {
  position: fixed;
  z-index: 90;
  min-width: 172px;
  padding: 5px;
  background: #fff;
  border: 1px solid #e6eef6;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  animation: popIn 0.13s ease both;
}

.menu button {
  display: flex;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 8px 9px;
  color: #415367;
  font-size: 12px;
  text-align: left;
  border-radius: 6px;
}

.menu button:hover {
  color: #1e3448;
  background: #f3f8fc;
}

.menu button.danger {
  color: #cf4c55;
}

.menu button.danger:hover {
  background: #fff3f4;
}

.menu button .icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.menu-sep {
  height: 1px;
  margin: 4px 5px;
  background: #eef3f8;
}

.toast {
  position: fixed;
  bottom: 27px;
  left: 50%;
  z-index: 120;
  max-width: min(86vw, 520px);
  padding: 9px 15px;
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  background: rgba(21, 34, 49, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(9, 21, 34, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(8px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: rgba(160, 42, 52, 0.94);
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  padding: 24px;
  color: #fff;
  font-size: 16px;
  text-align: center;
  background: #172232;
  place-items: center;
}

/* =========================================================
   弹窗
   ========================================================= */

dialog.dialog {
  width: calc(100% - 36px);
  max-width: 590px;
  max-height: calc(var(--app-height, 100dvh) - 40px);
  margin: auto;
  padding: 0;
  overflow: visible;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
}

dialog.dialog::backdrop {
  background: rgba(13, 26, 40, 0.44);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease both;
}

.dialog-card {
  display: flex;
  flex-direction: column;
  max-height: calc(var(--app-height, 100dvh) - 40px);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 17px;
  box-shadow: var(--shadow-lg);
  animation: dialogIn 0.2s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.dialog-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 21px 24px 17px;
  border-bottom: 1px solid #edf3f8;
}

.dialog-head h2 {
  color: #182b3e;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.dialog-head p {
  margin-top: 4px;
  color: #8c9cae;
  font-size: 11.5px;
}

.dialog-close {
  width: 30px;
  height: 30px;
  margin-top: -3px;
}

.dialog-body {
  flex: 1;
  min-height: 0;
  padding: 18px 24px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dialog-body.compact {
  padding: 18px 24px 21px;
}

.dialog-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 13px 24px;
  background: #fbfdff;
  border-top: 1px solid #edf3f8;
}

.foot-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 13px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn .icon {
  width: 14px;
  height: 14px;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--brand-bright), var(--brand));
  border-color: transparent;
  box-shadow: 0 5px 14px rgba(10, 167, 255, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 7px 19px rgba(10, 167, 255, 0.34);
  filter: brightness(1.02);
}

.btn-ghost {
  color: #6b7e91;
  background: #fff;
  border-color: #e3ecf4;
}

.btn-ghost:hover {
  color: #344a5e;
  background: #f5f9fc;
}

.btn-soft {
  flex: 0 0 auto;
  color: #1682c0;
  background: #eff9ff;
  border-color: #d5effd;
}

.btn-soft:hover {
  background: #e3f5ff;
  border-color: #b9e5fb;
}

.btn-soft:disabled {
  color: #9db2c3;
  background: #f4f8fb;
  border-color: #e7eef5;
}

.btn-danger {
  color: #fff;
  background: linear-gradient(145deg, #f16872, #df4b56);
  box-shadow: 0 5px 14px rgba(223, 75, 86, 0.2);
}

/* 账号 */

.account-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 11px;
  margin-bottom: 13px;
  background: linear-gradient(135deg, #f4fbff, #fbfdff);
  border: 1px solid #e1f0fa;
  border-radius: 11px;
}

.account-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 37px;
  height: 37px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(140deg, #8b7cf6, #5a7cf5);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(90, 124, 245, 0.22);
  place-items: center;
}

.account-info {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.account-info strong {
  overflow: hidden;
  color: #334b61;
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-uuid {
  color: #8297aa;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.4;
  word-break: break-all;
}

.account-logout {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 8px;
  color: #b05a61;
  font-size: 9.5px;
  border-color: #f1dadd;
}

.account-logout:hover {
  color: #b1424b;
  background: #fff4f5;
}

/* 连接方式 */

.transport-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  margin-bottom: 19px;
  background: #f6fbff;
  border: 1px solid #e2f1fb;
  border-radius: 10px;
}

.transport-icon {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  color: #4b9bc8;
  background: #e8f7ff;
  border-radius: 8px;
  place-items: center;
}

.transport-icon .icon {
  width: 16px;
  height: 16px;
}

.transport-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.transport-copy strong {
  color: #3d6079;
  font-size: 11.5px;
  font-weight: 650;
}

.transport-copy span {
  color: #8da3b5;
  font-size: 9.5px;
  line-height: 1.45;
}

.transport-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  color: #3f94c3;
  font-size: 9px;
  font-weight: 700;
  background: #e6f6ff;
  border-radius: 5px;
}

.transport-card.is-direct {
  background: #fffaf2;
  border-color: #f6e6cd;
}

.transport-card.is-direct .transport-icon {
  color: #c18a31;
  background: #fdf2df;
}

.transport-card.is-direct .transport-badge {
  color: #ad7b2e;
  background: #fcf1de;
}

.transport-card.is-direct .transport-copy strong {
  color: #826231;
}

/* 表单 */

.form-section + .form-section {
  padding-top: 19px;
  margin-top: 19px;
  border-top: 1px solid #edf3f8;
}

.form-section-title {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-bottom: 15px;
}

.form-section-title > span {
  display: grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--brand-deep);
  font-size: 8.5px;
  font-weight: 700;
  background: #ebf8ff;
  border-radius: 6px;
  place-items: center;
}

.form-section-title h3 {
  color: #2f4559;
  font-size: 12.5px;
  font-weight: 700;
}

.form-section-title p {
  margin-top: 2px;
  color: #99a8b7;
  font-size: 9.5px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: flex;
  gap: 5px;
  align-items: baseline;
  margin-bottom: 6px;
  color: #43596d;
  font-size: 11px;
  font-weight: 600;
}

.field-label em {
  color: #a3b1bf;
  font-size: 8.5px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.field-label b {
  margin-left: auto;
  color: var(--brand-deep);
  font-size: 11px;
  font-weight: 650;
}

.field input:not([type="range"]),
.field textarea,
.field select {
  width: 100%;
  padding: 0 11px;
  color: #2e4256;
  font-size: 12px;
  line-height: 1.6;
  background: #f8fbfd;
  border: 1px solid #e2ebf3;
  border-radius: 8px;
  outline: 0;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:not([type="range"]),
.field select {
  height: 37px;
}

.field select {
  cursor: pointer;
}

.field textarea {
  min-height: 82px;
  padding-top: 8px;
  padding-bottom: 8px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  background: #fff;
  border-color: rgba(10, 167, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 167, 255, 0.08);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #b0bdc9;
}

.field-hint {
  display: block;
  margin-top: 5px;
  color: #9aaab9;
  font-size: 9px;
  line-height: 1.55;
}

.field-hint code {
  padding: 0 2px;
  color: #7796ab;
  font-size: 8.5px;
  background: #f2f7fb;
  border-radius: 2px;
}

.secret-wrap {
  position: relative;
  display: block;
}

.secret-wrap input {
  padding-right: 38px !important;
}

.secret-toggle {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 30px;
  height: 30px;
}

.secret-toggle .icon {
  width: 16px;
  height: 16px;
}

.model-row {
  display: flex;
  gap: 7px;
  align-items: center;
}

.model-row input {
  min-width: 0;
  flex: 1;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.field input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--brand);
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.field input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #7cd8ff, #dcecf7);
  border-radius: 4px;
}

.field input[type="range"]::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  background: var(--brand);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(4, 120, 185, 0.35);
  -webkit-appearance: none;
  appearance: none;
}

.field input[type="range"]::-moz-range-track {
  height: 4px;
  background: #dcecf7;
  border-radius: 4px;
}

.field input[type="range"]::-moz-range-progress {
  height: 4px;
  background: #7cd8ff;
  border-radius: 4px;
}

.field input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--brand);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(4, 120, 185, 0.35);
}

.switch-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  background: #f8fbfd;
  border: 1px solid #e8f0f7;
  border-radius: 9px;
  cursor: pointer;
}

.switch-row strong {
  display: block;
  color: #41576b;
  font-size: 11px;
  font-weight: 650;
}

.switch-row small {
  display: block;
  margin-top: 3px;
  color: #97a8b8;
  font-size: 9px;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: #d8e3ed;
  border-radius: 11px;
  transition: background 0.18s ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  content: "";
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(22, 48, 70, 0.2);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--brand);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid rgba(10, 167, 255, 0.55);
  outline-offset: 2px;
}

.form-status {
  margin-top: 4px;
  padding: 8px 10px;
  color: #3e8c66;
  font-size: 10px;
  line-height: 1.55;
  background: #f1fbf6;
  border: 1px solid #d9f2e4;
  border-radius: 7px;
}

.form-status.is-error {
  color: #b14a52;
  background: #fff5f5;
  border-color: #f9dde0;
}

.form-status.is-loading {
  color: #5f8ca8;
  background: #f4faff;
  border-color: #e1f0fa;
}

/* 小弹窗 */

dialog.dialog.small-dialog {
  max-width: 430px;
}

.small-dialog .dialog-head {
  padding: 19px 21px 14px;
}

.small-dialog .dialog-body {
  padding: 16px 21px 19px;
}

.small-dialog .dialog-foot {
  padding: 12px 21px;
}

.dialog-message {
  color: #5c7186;
  font-size: 12px;
  line-height: 1.7;
}

.dialog-message strong {
  color: #334b61;
  font-weight: 650;
}

.created-body {
  padding-top: 21px;
  text-align: center;
}

.created-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 13px;
  color: #13a477;
  background: #eefbf5;
  border: 1px solid #d5f3e5;
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(19, 164, 119, 0.1);
  place-items: center;
}

.created-mark .icon {
  width: 26px;
  height: 26px;
  stroke-width: 2.4;
}

.created-copy {
  margin-bottom: 13px;
  color: #536b7f;
  font-size: 11.5px;
  line-height: 1.75;
  text-align: left;
}

.created-copy strong {
  color: #2e536c;
  font-weight: 650;
}

.uuid-box {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  margin-bottom: 10px;
  background: #f6fafd;
  border: 1px dashed #cfe4f4;
  border-radius: 9px;
}

.uuid-box code {
  flex: 1;
  min-width: 0;
  color: #0f73a8;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.55;
  text-align: left;
  word-break: break-all;
}

.uuid-box .btn {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 9px;
  font-size: 9.5px;
}

.uuid-note {
  color: #9aabba;
  font-size: 9px;
  line-height: 1.65;
  text-align: left;
}

/* =========================================================
   响应式：小桌面
   ========================================================= */

@media (max-width: 1120px) {
  .rail {
    flex-basis: 66px;
    width: 66px;
  }

  .list-pane {
    flex-basis: 272px;
    width: 272px;
  }

  .msg-main {
    max-width: 76%;
  }

  .composer-hint {
    display: none;
  }

  .peer-meta h1 {
    max-width: 250px;
  }
}

/* =========================================================
   响应式：手机 / 窄屏
   ========================================================= */

@media (max-width: 820px) {
  .app {
    display: block;
  }

  .rail {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    height: calc(58px + env(safe-area-inset-bottom));
    padding: 0 14px env(safe-area-inset-bottom);
    overflow: visible;
    color: #8a99aa;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #e7eef5;
    box-shadow: 0 -6px 24px rgba(25, 59, 90, 0.05);
    backdrop-filter: blur(16px);
  }

  .rail::after {
    display: none;
  }

  .rail-brand {
    display: none;
  }

  .rail-nav,
  .rail-bottom {
    display: contents;
  }

  .rail-avatar {
    display: none;
  }

  .rail-btn {
    gap: 2px;
    width: 64px;
    height: 50px;
    color: #8c9bab;
    border-radius: 10px;
  }

  .rail-btn:hover {
    color: var(--brand-deep);
    background: #f2f9fe;
  }

  .rail-btn.is-active {
    color: var(--brand);
    background: transparent;
    box-shadow: none;
  }

  .rail-btn.is-active::after {
    position: absolute;
    bottom: 3px;
    width: 15px;
    height: 3px;
    content: "";
    background: var(--brand);
    border-radius: 3px;
  }

  .rail-btn.is-active .icon {
    filter: none;
  }

  .rail-btn .icon {
    width: 21px;
    height: 21px;
  }

  .rail-label {
    display: block;
    font-size: 9px;
    font-weight: 550;
  }

  .list-pane {
    width: 100%;
    height: calc(var(--app-height, 100dvh) - 58px - env(safe-area-inset-bottom));
    border-right: 0;
  }

  .list-head {
    padding: calc(15px + env(safe-area-inset-top)) 17px 9px;
  }

  .list-title h2 {
    font-size: 22px;
  }

  .search-kbd {
    display: none;
  }

  .me-card {
    display: none;
  }

  .chat-pane {
    position: fixed;
    inset: 0;
    z-index: 50;
    width: 100%;
    height: var(--app-height, 100dvh);
    background: var(--canvas);
    transform: translateX(102%);
    transition: transform 0.24s cubic-bezier(0.22, 0.8, 0.3, 1);
    will-change: transform;
  }

  .app.chat-open .chat-pane {
    transform: translateX(0);
    box-shadow: -18px 0 50px rgba(17, 45, 70, 0.14);
  }

  .chat-head {
    flex-basis: calc(60px + env(safe-area-inset-top));
    gap: 7px;
    height: calc(60px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0;
  }

  .back-btn {
    display: inline-grid;
    width: 32px;
    height: 32px;
    margin-left: -2px;
    margin-right: -2px;
  }

  .peer {
    gap: 9px;
    min-width: 0;
  }

  .peer-avatar {
    width: 37px;
    height: 37px;
    border-radius: 11px;
  }

  .peer-avatar img {
    border-radius: 10px;
  }

  .peer-meta h1 {
    max-width: min(46vw, 210px);
    font-size: 14.5px;
  }

  .peer-sub {
    max-width: 52vw;
    margin-top: 2px;
    font-size: 9.5px;
  }

  .peer-model {
    max-width: 100px;
  }

  .model-pill,
  #clearChatBtn {
    display: none;
  }

  .chat-tools {
    gap: 0;
  }

  .chat-tools .icon-btn {
    width: 32px;
    height: 32px;
  }

  .message-scroll {
    background:
      radial-gradient(560px 360px at 100% -8%, rgba(104, 203, 255, 0.16), transparent 65%),
      linear-gradient(180deg, #f2f8fd 0%, #edf4fa 100%);
  }

  .welcome {
    align-items: flex-start;
    min-height: auto;
    padding: calc(26px + env(safe-area-inset-top)) 14px 24px;
  }

  .welcome-inner {
    max-width: 470px;
  }

  .welcome-logo {
    width: 68px;
    height: 68px;
    margin-bottom: 13px;
    border-radius: 19px;
    box-shadow: 0 14px 34px rgba(0, 132, 220, 0.22), 0 0 0 5px rgba(255, 255, 255, 0.5);
  }

  .welcome-eyebrow {
    font-size: 8.5px;
    letter-spacing: 2px;
  }

  .welcome h2 {
    margin-top: 8px;
    font-size: 22px;
  }

  .welcome-wave {
    font-size: 20px;
  }

  .welcome-sub {
    margin-top: 8px;
    font-size: 11.5px;
    line-height: 1.7;
  }

  .suggestions {
    gap: 7px;
    margin-top: 18px;
  }

  .suggestion {
    gap: 8px;
    padding: 9px;
  }

  .suggestion-emoji {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border-radius: 8px;
  }

  .suggestion strong {
    font-size: 11px;
  }

  .suggestion small {
    font-size: 9px;
  }

  .welcome-actions {
    flex-direction: column;
    gap: 7px;
    margin-top: 17px;
  }

  .welcome-note {
    font-size: 8.5px;
  }

  .message-list {
    padding: 5px 12px 10px;
  }

  .time-divider {
    margin: 15px 0 10px;
  }

  .msg {
    gap: 8px;
    margin-top: 7px;
  }

  .msg-avatar {
    width: 34px;
    height: 34px;
  }

  .msg-avatar-user {
    font-size: 11px;
  }

  .msg-main {
    max-width: 82%;
  }

  .bubble {
    padding: 9px 12px;
    font-size: 14.5px;
    line-height: 1.68;
  }

  .msg-actions {
    height: 24px;
    opacity: 0.55;
  }

  .msg-action {
    width: 27px;
    height: 24px;
  }

  .msg-action .icon {
    width: 14px;
    height: 14px;
  }

  .composer-wrap {
    padding: 6px 10px calc(7px + env(safe-area-inset-bottom));
    background: #edf4fa;
  }

  .composer {
    border-radius: 13px;
    box-shadow: 0 4px 18px rgba(23, 64, 99, 0.08);
  }

  .composer textarea {
    min-height: 43px;
    max-height: 116px;
    padding: 10px 12px 1px;
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
  }

  .composer-bar {
    padding: 1px 6px 6px 7px;
  }

  .composer-btn {
    width: 30px;
    height: 28px;
  }

  .composer-hint,
  .composer-note {
    display: none;
  }

  .send-btn {
    height: 32px;
    padding: 0 11px;
    font-size: 11px;
    border-radius: 8px;
  }

  .send-btn .icon {
    width: 14px;
    height: 14px;
  }

  .emoji-panel {
    left: 10px !important;
    width: calc(100vw - 20px) !important;
    grid-template-columns: repeat(8, 1fr);
  }

  .emoji-item {
    font-size: 20px;
  }

  .menu {
    min-width: 168px;
  }

  .toast {
    bottom: calc(72px + env(safe-area-inset-bottom));
    font-size: 11.5px;
  }

  body.chat-open .toast {
    bottom: calc(18px + env(safe-area-inset-bottom));
  }

  dialog.dialog {
    width: calc(100% - 20px);
    max-height: calc(var(--app-height, 100dvh) - 24px);
  }

  .dialog-card {
    max-height: calc(var(--app-height, 100dvh) - 24px);
    border-radius: 16px;
  }

  .dialog-head {
    padding: 17px 17px 14px;
  }

  .dialog-head h2 {
    font-size: 17px;
  }

  .dialog-head p {
    font-size: 10.5px;
  }

  .dialog-body {
    padding: 15px 17px 18px;
  }

  .dialog-body.compact {
    padding: 15px 17px 17px;
  }

  .dialog-foot {
    padding: 11px 17px calc(11px + env(safe-area-inset-bottom));
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .transport-copy span {
    font-size: 9px;
  }

  .transport-badge {
    font-size: 8.5px;
  }

  .btn {
    height: 35px;
    font-size: 11.5px;
  }

  .small-dialog {
    max-width: calc(100% - 20px);
  }
}

@media (max-width: 380px) {
  .auth-brand {
    min-height: 198px;
    padding-bottom: 42px;
  }

  .auth-brand-top {
    margin-bottom: 15px;
  }

  .auth-brand h1 {
    font-size: 21px;
  }

  .auth-lead {
    display: none;
  }

  .auth-card {
    padding: 19px 15px 16px;
  }

  .suggestions {
    grid-template-columns: 1fr;
  }

  .suggestion small {
    display: none;
  }

  .msg-main {
    max-width: 84%;
  }

  .send-btn span {
    display: none;
  }

  .send-btn {
    width: 34px;
    padding: 0;
  }

  .peer-meta h1 {
    max-width: 42vw;
  }

  .peer-model {
    display: none;
  }
}

/* =========================================================
   动效
   ========================================================= */

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes blink {
  0%,
  48% {
    opacity: 1;
  }
  49%,
  100% {
    opacity: 0;
  }
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes statusPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(10, 167, 255, 0.28);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(10, 167, 255, 0.08);
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes wave {
  0%,
  55%,
  100% {
    transform: rotate(0);
  }
  10% {
    transform: rotate(16deg);
  }
  20% {
    transform: rotate(-7deg);
  }
  30% {
    transform: rotate(12deg);
  }
  40% {
    transform: rotate(-4deg);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* =========================================================
   QQ 手机风格登录页（覆盖旧移动端规则）
   ========================================================= */

@media (max-width: 560px) {
  .auth-screen {
    display: block;
    padding: 0;
    background:
      radial-gradient(520px 420px at 84% 2%, rgba(90, 222, 255, 0.52), transparent 64%),
      radial-gradient(520px 500px at 4% 24%, rgba(0, 106, 205, 0.35), transparent 70%),
      linear-gradient(160deg, #082a4d 0%, #086b9f 45%, #12b5ee 100%);
    overflow-y: auto;
  }

  .auth-bg {
    display: block;
  }

  .auth-bg-grid {
    opacity: 0.55;
    mask-image: radial-gradient(circle at 50% 22%, rgba(0, 0, 0, 0.65), transparent 72%);
  }

  .auth-window {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    min-height: var(--app-height, 100dvh);
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-visual {
    flex: 0 0 232px;
    height: 232px;
    overflow: visible;
    background: transparent;
  }

  .auth-visual::before {
    display: none;
  }

  .auth-visual-brand {
    top: calc(36px + env(safe-area-inset-top));
    left: 50%;
    flex-direction: column;
    gap: 9px;
    text-align: center;
    transform: translateX(-50%);
  }

  .auth-visual-brand img {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(0, 20, 40, 0.26), 0 0 0 6px rgba(255, 255, 255, 0.08);
  }

  .auth-visual-brand span {
    font-size: 22px;
    letter-spacing: 0.2px;
  }

  .auth-visual-brand em {
    font-size: 7.5px;
    letter-spacing: 1.3px;
  }

  .auth-art {
    opacity: 0.6;
  }

  .auth-ring {
    top: -24px;
    right: -92px;
    width: 230px;
    height: 230px;
  }

  .auth-bubble-a {
    top: 76px;
    right: 20px;
    transform: scale(0.85);
    transform-origin: right top;
  }

  .auth-bubble-b {
    top: 142px;
    right: 88px;
    transform: scale(0.8);
    transform-origin: right top;
  }

  .auth-visual-mark {
    display: none;
  }

  .auth-form-panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    margin-top: -24px;
    padding: 0 22px calc(16px + env(safe-area-inset-bottom));
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -16px 44px rgba(0, 30, 55, 0.18);
  }

  .auth-avatar {
    width: 62px;
    height: 62px;
    margin: -31px auto 4px;
    border-width: 3px;
  }

  .auth-avatar .icon {
    width: 27px;
    height: 27px;
  }

  .auth-tabs {
    margin: 0;
  }

  .auth-tabs button {
    height: 38px;
    font-size: 13px;
  }

  .auth-subtitle {
    margin-bottom: 16px;
    font-size: 10px;
  }

  .auth-field {
    margin-bottom: 13px;
  }

  .auth-field > span {
    margin-bottom: 7px;
    font-size: 10.5px;
  }

  .auth-field input {
    height: 47px;
    padding: 0 13px;
    font-size: 16px;
    border-radius: 10px;
    -webkit-text-size-adjust: 100%;
  }

  .password-rules {
    gap: 6px;
    margin: -2px 0 13px;
  }

  .password-rules span {
    padding: 4px 8px;
    font-size: 9px;
  }

  .auth-hint {
    margin: -2px 0 13px;
    font-size: 9.5px;
  }

  .auth-error {
    padding: 9px 11px;
    font-size: 10.5px;
  }

  .auth-submit {
    height: 47px;
    margin-top: 5px;
    font-size: 13px;
    border-radius: 10px;
  }

  .auth-switch {
    margin-top: 15px;
    font-size: 10.5px;
  }

  .auth-switch button {
    font-size: 10.5px;
  }

  .auth-service {
    margin-top: auto;
    padding-top: 14px;
    font-size: 9.5px;
    border-top: 1px solid #edf3f8;
  }

  .auth-privacy {
    margin-top: 8px;
    font-size: 9px;
  }
}

@media (max-width: 380px) {
  .auth-visual {
    flex-basis: 204px;
    height: 204px;
  }

  .auth-visual-brand {
    top: calc(28px + env(safe-area-inset-top));
    gap: 7px;
  }

  .auth-visual-brand img {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }

  .auth-visual-brand span {
    font-size: 20px;
  }

  .auth-form-panel {
    margin-top: -20px;
    padding: 0 16px calc(14px + env(safe-area-inset-bottom));
    border-radius: 21px 21px 0 0;
  }

  .auth-avatar {
    width: 56px;
    height: 56px;
    margin-top: -28px;
  }

  .auth-tabs button {
    height: 36px;
    font-size: 12px;
  }

  .auth-field input {
    height: 45px;
  }

  .auth-submit {
    height: 45px;
  }
}

/* =========================================================
   好友与私聊
   ========================================================= */

.rail-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  background: #ff5b68;
  border: 2px solid var(--rail);
  border-radius: 9px;
  place-items: center;
}

.friend-request-entry {
  display: flex;
  gap: 10px;
  align-items: center;
  width: calc(100% - 2px);
  margin: 2px 1px 6px;
  padding: 9px 10px;
  color: inherit;
  text-align: left;
  background: linear-gradient(135deg, #f5fbff, #fbfdff);
  border: 1px solid #e2f1fb;
  border-radius: 11px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.friend-request-entry:hover {
  background: #f0f9ff;
  border-color: #c9e8fa;
}

.friend-request-icon {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  color: #fff;
  background: linear-gradient(145deg, #5ed0ff, #0aa7ff);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(10, 167, 255, 0.2);
  place-items: center;
}

.friend-request-icon .icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.friend-request-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  display: grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  color: #fff;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  background: #ff5b68;
  border: 2px solid #fff;
  border-radius: 9px;
  place-items: center;
}

.friend-request-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.friend-request-copy strong {
  color: #344b61;
  font-size: 12.5px;
  font-weight: 650;
}

.friend-request-copy small {
  overflow: hidden;
  color: #93a5b6;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-request-arrow {
  width: 15px;
  height: 15px;
  color: #b1c1cf;
}

.friend-avatar {
  overflow: hidden;
}

.friend-unread {
  display: grid;
  flex: 0 0 auto;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  background: #ff5b68;
  border-radius: 9px;
  place-items: center;
}

.friend-peer-avatar {
  display: grid;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.5);
  place-items: center;
}

.friend-meta-dot {
  width: 6px;
  height: 6px;
  background: #0aa7ff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(10, 167, 255, 0.11);
}

.friend-welcome {
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 38px 24px;
  text-align: center;
}

.friend-welcome-orb {
  display: grid;
  width: 66px;
  height: 66px;
  margin-bottom: 4px;
  color: #2fa6dd;
  background: linear-gradient(145deg, #eaf9ff, #d9f2ff);
  border: 1px solid #d7effc;
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(30, 140, 190, 0.1);
  place-items: center;
}

.friend-welcome-orb .icon {
  width: 29px;
  height: 29px;
  stroke-width: 1.6;
}

.friend-welcome h2 {
  color: #20364b;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.friend-welcome p {
  max-width: 300px;
  color: #8b9eaf;
  font-size: 11px;
  line-height: 1.7;
}

.friend-welcome .welcome-config {
  margin-top: 5px;
}

.friend-chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: 30px 20px;
}

.friend-chat-empty span {
  padding: 8px 13px;
  color: #8c9eaf;
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(221, 234, 244, 0.9);
  border-radius: 9px;
  backdrop-filter: blur(6px);
}

.my-uuid-box {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  margin-bottom: 8px;
  background: #f6fafd;
  border: 1px dashed #cfe4f4;
  border-radius: 9px;
}

.my-uuid-box > span {
  flex: 0 0 auto;
  color: #7890a4;
  font-size: 9.5px;
  font-weight: 600;
}

.my-uuid-box code {
  flex: 1;
  min-width: 0;
  color: #0f73a8;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  word-break: break-all;
}

.add-friend-tip {
  margin: 0 0 14px;
  color: #92a4b4;
  font-size: 9.5px;
  line-height: 1.65;
}

.requests-section-title {
  margin: 16px 0 7px;
  color: #52697d;
  font-size: 10.5px;
  font-weight: 650;
}

.requests-section-title:first-child {
  margin-top: 0;
}

.request-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.request-item {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px 9px;
  background: #f8fbfd;
  border: 1px solid #e9f1f7;
  border-radius: 9px;
}

.request-avatar {
  width: 35px;
  height: 35px;
  font-size: 12px;
}

.request-info {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.request-info strong {
  overflow: hidden;
  color: #3a5065;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-info small {
  color: #98a8b8;
  font-size: 8.5px;
}

.request-actions {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.request-btn {
  height: 26px;
  padding: 0 8px;
  color: #71879a;
  font-size: 9.5px;
  border: 1px solid #e1ebf3;
  border-radius: 6px;
  background: #fff;
}

.request-btn:hover {
  color: #3e5b71;
  background: #f4f9fd;
}

.request-btn.accept {
  color: #fff;
  background: linear-gradient(145deg, #37c6ff, #0aa7ff);
  border-color: transparent;
}

.request-btn.accept:hover {
  background: #0a9bf0;
}

.request-pending {
  flex: 0 0 auto;
  color: #9aabba;
  font-size: 8.5px;
}

.request-empty {
  margin: 3px 0 7px;
  color: #9dadbc;
  font-size: 9.5px;
}

@media (max-width: 820px) {
  .rail-badge {
    border-color: #fff;
  }

  .friend-request-entry {
    margin: 2px 6px 6px;
    width: calc(100% - 12px);
    padding: 8px;
  }

  .friend-request-icon {
    width: 41px;
    height: 41px;
  }

  .friend-welcome {
    padding: 30px 18px;
  }

  .friend-welcome h2 {
    font-size: 19px;
  }

  .friend-chat-empty {
    min-height: 120px;
  }

  .request-item {
    padding: 8px;
  }

  .request-btn {
    height: 28px;
    padding: 0 9px;
    font-size: 10px;
  }

  .request-pending {
    font-size: 9px;
  }
}

/* 自定义头像与账号 ID */
.account-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 37px;
  height: 37px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.account-avatar-wrap .account-avatar {
  width: 100%;
  height: 100%;
}

.account-avatar-edit {
  position: absolute;
  right: -3px;
  bottom: -2px;
  display: grid;
  width: 16px;
  height: 16px;
  color: #fff;
  background: linear-gradient(145deg, #37c6ff, #0aa7ff);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(10, 167, 255, 0.25);
  place-items: center;
}

.account-avatar-edit .icon {
  width: 8px;
  height: 8px;
  stroke-width: 2.2;
}

.avatar-reset {
  align-self: flex-start;
  padding: 0;
  margin-top: 1px;
  color: #8298aa;
  font-size: 8.5px;
  background: none;
  border: 0;
  cursor: pointer;
}

.avatar-reset:hover {
  color: #0aa7ff;
}

.has-custom-avatar {
  color: transparent !important;
}

.account-avatar,
.conv-avatar,
.request-avatar,
.friend-peer-avatar,
.msg-avatar {
  overflow: hidden;
}

.avatar img,
.friend-peer-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.msg-avatar img {
  object-fit: cover;
}

.rail-avatar.has-custom-avatar #railAvatarText {
  opacity: 0;
}

.account-avatar-wrap:disabled {
  cursor: wait;
  opacity: 0.7;
}

/* 好友栏仅用于选择聊天对象 */
.friends-intro-pane {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-width: 0;
  background: var(--canvas);
}

.friends-intro-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  max-width: 320px;
  padding: 30px;
  text-align: center;
}

.friends-intro-orb {
  display: grid;
  width: 68px;
  height: 68px;
  color: #2fa6dd;
  background: linear-gradient(145deg, #eaf9ff, #d9f2ff);
  border: 1px solid #d7effc;
  border-radius: 50%;
  place-items: center;
}

.friends-intro-orb .icon {
  width: 30px;
  height: 30px;
}

.friends-intro-card h2 {
  color: #20364b;
  font-size: 20px;
  font-weight: 700;
}

.friends-intro-card p {
  color: #8b9eaf;
  font-size: 11px;
  line-height: 1.7;
}

@media (max-width: 820px) {
  .friends-intro-pane {
    display: none !important;
  }
}

/* 撤回消息 */
.msg-recall {
  display: flex;
  justify-content: center;
  padding: 2px 0;
  margin: 2px 0;
}

.msg-recall span {
  padding: 3px 9px;
  color: #9aabba;
  font-size: 9.5px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 7px;
}

.recall-action {
  width: auto;
  padding: 0 4px;
  color: #8ca0b2;
  font-size: 9px;
  background: transparent;
}

.recall-action:hover {
  color: #0a93dc;
  background: #f2f9fe;
}

@media (max-width: 820px) {
  .emoji-delete {
    display: grid;
  }
}

.delete-action {
  width: auto;
  padding: 0 4px;
  color: #a08f98;
  font-size: 9px;
  background: transparent;
}

.delete-action:hover {
  color: #df4b56;
  background: #fff4f5;
}

/* =========================================================
   Mnemosyne 记忆星图
   ========================================================= */

.memory-pane {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #f2f8fc;
}

.memory-head {
  display: flex;
  flex: 0 0 auto;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  background: linear-gradient(135deg, #f9fdff, #f1f9ff);
  border-bottom: 1px solid #e1eef8;
}

.memory-kicker {
  color: #7d9bb2;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.memory-heading h1 {
  margin: 4px 0 2px;
  color: #1e364b;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.6px;
}

.memory-heading p {
  color: #869eaf;
  font-size: 10.5px;
}

.memory-head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.memory-live {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 5px 8px;
  color: #0a9f78;
  font-size: 9px;
  font-weight: 650;
  background: #edfdf8;
  border: 1px solid #d0f5e9;
  border-radius: 20px;
}

.memory-live i {
  width: 5px;
  height: 5px;
  background: #16c58b;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(22, 197, 139, 0.12);
  animation: memoryLive 2s ease-in-out infinite;
}

@keyframes memoryLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.78); }
}

.memory-scan-btn {
  height: 30px;
  padding: 0 11px;
  color: #0a83c6;
  font-size: 10px;
  background: #f3fbff;
  border-color: #d6effc;
}

.memory-body {
  display: flex;
  flex: 1;
  gap: 12px;
  min-height: 0;
  padding: 12px;
}

.memory-map-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #071523;
  border: 1px solid #17354d;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(12, 48, 72, 0.16);
}

.memory-stats-strip {
  display: flex;
  gap: 22px;
  padding: 10px 16px;
  color: #dff4ff;
  background: rgba(5, 24, 40, 0.72);
  border-bottom: 1px solid rgba(92, 180, 225, 0.12);
}

.memory-stats-strip > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.memory-stats-strip span {
  color: #e7f8ff;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
}

.memory-stats-strip small {
  color: #6d9db6;
  font-size: 8px;
  letter-spacing: 0.08em;
}

.memory-map {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 22%, rgba(45, 173, 235, 0.16), transparent 23%),
    radial-gradient(circle at 80% 74%, rgba(126, 94, 220, 0.13), transparent 26%),
    radial-gradient(circle at 56% 46%, rgba(44, 144, 196, 0.09), transparent 30%),
    linear-gradient(155deg, #06111f, #071a2d 48%, #061323);
}

.memory-map::before,
.memory-map::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    radial-gradient(circle at 12% 28%, rgba(255, 255, 255, 0.46) 0 1px, transparent 1.5px),
    radial-gradient(circle at 64% 18%, rgba(160, 225, 255, 0.42) 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 76%, rgba(255, 255, 255, 0.3) 0 1px, transparent 1.5px),
    radial-gradient(circle at 84% 62%, rgba(190, 230, 255, 0.34) 0 1px, transparent 1.5px),
    radial-gradient(circle at 46% 88%, rgba(255, 255, 255, 0.26) 0 1px, transparent 1.5px);
  background-size: 260px 210px, 310px 250px, 220px 280px, 360px 300px, 240px 190px;
  opacity: 0.7;
}

.memory-map::after {
  background-size: 180px 160px, 230px 210px, 290px 230px, 210px 260px, 330px 280px;
  opacity: 0.35;
  transform: rotate(12deg) scale(1.15);
}

#memoryGraph {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.memory-empty {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  width: min(330px, 80%);
  color: #d6effc;
  text-align: center;
  transform: translate(-50%, -50%);
}

.memory-empty-orb {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 2px;
  color: #7dd6ff;
  background: rgba(80, 188, 242, 0.09);
  border: 1px solid rgba(111, 204, 248, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 34px rgba(73, 184, 238, 0.2);
  place-items: center;
}

.memory-empty-orb .icon {
  width: 29px;
  height: 29px;
}

.memory-empty h3 {
  font-size: 15px;
  font-weight: 650;
}

.memory-empty p {
  color: #7ea8bd;
  font-size: 10px;
  line-height: 1.7;
}

.memory-tooltip {
  position: absolute;
  z-index: 8;
  max-width: 280px;
  padding: 9px 11px;
  pointer-events: none;
  background: rgba(4, 20, 33, 0.94);
  border: 1px solid rgba(99, 191, 237, 0.28);
  border-radius: 9px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  transform: translate(12px, -50%);
}

.memory-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: #e3f8ff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
}

.memory-tooltip small {
  color: #7fa8bf;
  font-size: 8.5px;
}

.memory-map-legend {
  position: absolute;
  z-index: 4;
  bottom: 10px;
  left: 50%;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 5px 10px;
  color: #82a9bc;
  font-size: 8px;
  white-space: nowrap;
  background: rgba(4, 20, 33, 0.62);
  border: 1px solid rgba(89, 169, 207, 0.14);
  border-radius: 12px;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.memory-map-legend span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.memory-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.memory-dot.identity { background: #6ee7ff; box-shadow: 0 0 7px #6ee7ff; }
.memory-dot.preference { background: #ffd166; box-shadow: 0 0 7px #ffd166; }
.memory-dot.plan { background: #a78bfa; box-shadow: 0 0 7px #a78bfa; }
.memory-dot.emotion { background: #ff8fab; box-shadow: 0 0 7px #ff8fab; }
.memory-dot.relationship { background: #7ef0c3; box-shadow: 0 0 7px #7ef0c3; }
.memory-dot.event { background: #9db4ff; box-shadow: 0 0 7px #9db4ff; }

.memory-side {
  display: flex;
  flex: 0 0 340px;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e4eef7;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(27, 76, 109, 0.06);
}

.memory-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
}

.memory-side-head h2 {
  color: #2f465a;
  font-size: 11.5px;
  font-weight: 650;
}

.memory-side-head span {
  display: grid;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  color: #7590a4;
  font-size: 9px;
  background: #f2f8fc;
  border-radius: 10px;
  place-items: center;
}

.memory-search {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0 12px 7px;
  padding: 0 9px;
  color: #a3b7c6;
  background: #f6fafd;
  border: 1px solid #e4eff7;
  border-radius: 8px;
}

.memory-search .icon {
  width: 14px;
  height: 14px;
}

.memory-search input {
  flex: 1;
  min-width: 0;
  height: 32px;
  color: #3b5368;
  font-size: 10px;
  background: transparent;
  border: 0;
  outline: 0;
}

.memory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 12px 8px;
}

.memory-filter {
  padding: 4px 7px;
  color: #7f96a8;
  font-size: 8.5px;
  background: #f7fbfd;
  border: 1px solid #e8f1f7;
  border-radius: 6px;
}

.memory-filter.is-active {
  color: #087dbd;
  background: #eaf8ff;
  border-color: #cdecfb;
}

.memory-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 9px 10px;
}

.memory-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  width: 100%;
  padding: 9px;
  margin-bottom: 5px;
  text-align: left;
  background: #fbfdff;
  border: 1px solid #edf3f8;
  border-radius: 9px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.memory-item:hover,
.memory-item.is-selected {
  background: #f4fbff;
  border-color: #d5edfb;
}

.memory-item-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
}

.memory-item-dot.identity { background: #35bde0; }
.memory-item-dot.preference { background: #e9b53c; }
.memory-item-dot.plan { background: #9075e8; }
.memory-item-dot.emotion { background: #ee7894; }
.memory-item-dot.relationship { background: #34c69d; }
.memory-item-dot.event { background: #7f98e8; }

.memory-item-main {
  min-width: 0;
  flex: 1;
}

.memory-item-content {
  overflow: hidden;
  color: #385166;
  font-size: 10px;
  line-height: 1.55;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.memory-item-meta {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-top: 4px;
  color: #9aacba;
  font-size: 8px;
}

.memory-item-meta .memory-type {
  color: #6c8ba0;
  font-weight: 600;
}

.memory-item.is-superseded {
  opacity: 0.55;
}

.memory-item.is-superseded .memory-item-content {
  text-decoration: line-through;
}

.memory-item-delete {
  flex: 0 0 auto;
  display: grid;
  width: 19px;
  height: 19px;
  color: #a2b3c0;
  background: transparent;
  border-radius: 5px;
  place-items: center;
}

.memory-item-delete .icon {
  width: 11px;
  height: 11px;
}

.memory-item-delete:hover {
  color: #df4b56;
  background: #fff1f2;
}

.memory-list-empty {
  padding: 26px 12px;
  color: #9cafbe;
  font-size: 9.5px;
  line-height: 1.7;
  text-align: center;
}

.memory-edge {
  stroke: rgba(118, 184, 220, 0.22);
  stroke-width: 1;
}

.memory-edge.is-strong {
  stroke: rgba(131, 211, 249, 0.4);
  stroke-width: 1.3;
}

.memory-edge.is-supersede {
  stroke: rgba(255, 160, 175, 0.42);
  stroke-dasharray: 4 4;
}

.memory-hub-ring {
  fill: rgba(9, 32, 50, 0.7);
  stroke: rgba(132, 208, 244, 0.25);
  stroke-width: 1;
}

.memory-hub-label {
  fill: #b7d9e9;
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}

.memory-node {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.memory-node:hover {
  filter: url(#memoryGlow);
}

.memory-node.is-superseded {
  opacity: 0.35;
}

.memory-node.is-new {
  animation: memoryNodeIn 0.65s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes memoryNodeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.memory-node-label {
  fill: rgba(219, 245, 255, 0.82);
  font-size: 7.2px;
  text-anchor: middle;
  pointer-events: none;
}

.memory-core-ring {
  fill: rgba(250, 207, 111, 0.09);
  stroke: rgba(250, 207, 111, 0.45);
  stroke-width: 1.2;
}

.memory-core-dot {
  fill: #f5d27b;
}

.memory-core-label {
  fill: #ffe7a7;
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

@media (max-width: 980px) {
  .memory-side {
    flex-basis: 300px;
  }
}

@media (max-width: 820px) {
  .memory-head {
    gap: 8px;
    padding: 12px 14px 9px;
  }

  .memory-heading h1 {
    font-size: 20px;
  }

  .memory-heading p {
    display: none;
  }

  .memory-kicker {
    font-size: 7px;
  }

  .memory-head-actions {
    gap: 4px;
  }

  .memory-scan-btn {
    padding: 0 8px;
    font-size: 9px;
  }

  .memory-live {
    display: none;
  }

  .memory-body {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }

  .memory-map-panel {
    flex: 0 0 48vh;
    min-height: 300px;
  }

  .memory-side {
    flex: 1;
    min-height: 220px;
    border-radius: 12px;
  }

  .memory-stats-strip {
    gap: 14px;
    padding: 8px 12px;
  }

  .memory-stats-strip span {
    font-size: 12px;
  }

  .memory-map-legend {
    display: none;
  }
}

@media (max-width: 820px) {
  .memory-pane {
    height: calc(var(--app-height, 100dvh) - 58px - env(safe-area-inset-bottom));
  }
}

/* =========================================================
   群聊
   ========================================================= */

.group-block {
  padding: 2px 1px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid #edf3f8;
}

.group-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 5px 5px;
  color: #8a9eaf;
  font-size: 9.5px;
  font-weight: 600;
}

.group-create-btn {
  display: grid;
  width: 20px;
  height: 20px;
  color: #0a9be0;
  background: #effaff;
  border-radius: 6px;
  place-items: center;
}

.group-create-btn .icon {
  width: 13px;
  height: 13px;
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.group-empty {
  padding: 5px 6px 7px;
  color: #a0b1bf;
  font-size: 9px;
}

.group-item {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 7px 8px;
  text-align: left;
  border-radius: 8px;
}

.group-item:hover {
  background: #f5fbff;
}

.group-item-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(145deg, #5dcfff, #168ad6);
  border-radius: 10px;
  place-items: center;
}

.group-item-main {
  min-width: 0;
  flex: 1;
}

.group-item-title {
  display: flex;
  gap: 5px;
  align-items: center;
  color: #3b5267;
  font-size: 10.5px;
  font-weight: 600;
}

.group-item-title .group-ai-mini {
  padding: 1px 4px;
  color: #0a94d9;
  font-size: 7px;
  background: #eaf9ff;
  border-radius: 4px;
}

.group-item-sub {
  overflow: hidden;
  margin-top: 2px;
  color: #9aacba;
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-peer-avatar {
  overflow: hidden;
  background: linear-gradient(145deg, #5dcfff, #168ad6) !important;
}

.group-ai-tag {
  padding: 1px 5px;
  color: #0a94d9;
  font-size: 8px;
  background: #eaf9ff;
  border-radius: 5px;
}

.group-mention-btn {
  width: 23px;
  color: #0a9be0;
  font-size: 13px;
  font-weight: 700;
}

.group-ai-typing {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 7px 13px;
  color: #7d96a9;
  font-size: 9px;
}

.group-ai-typing-avatar {
  display: block;
  width: 22px;
  height: 22px;
  overflow: hidden;
  border-radius: 50%;
}

.group-ai-typing-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-message-sender {
  margin-bottom: 3px;
  color: #8ba0b1;
  font-size: 8.5px;
}

.group-message-sender.is-ai {
  color: #0a94d9;
}

.group-dialog-body {
  max-height: min(65vh, 560px);
  overflow-y: auto;
}

.group-member-picker {
  display: flex;
  max-height: 200px;
  flex-direction: column;
  gap: 2px;
  padding: 5px;
  overflow-y: auto;
  background: #f7fbfd;
  border: 1px solid #e8f1f7;
  border-radius: 8px;
}

.group-member-option {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 5px 6px;
  color: #4c6377;
  font-size: 10px;
  border-radius: 6px;
}

.group-member-option:hover {
  background: #eef9ff;
}

.group-member-option input {
  accent-color: var(--brand);
}

.group-member-avatar {
  display: grid;
  width: 23px;
  height: 23px;
  overflow: hidden;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  background: linear-gradient(145deg, #5dcfff, #168ad6);
  border-radius: 50%;
  place-items: center;
}

.group-member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-ai-switch {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  cursor: pointer;
  background: #f5fbff;
  border: 1px solid #e2f2fb;
  border-radius: 9px;
}

.group-ai-switch input {
  accent-color: var(--brand);
}

.group-ai-switch span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.group-ai-switch strong {
  color: #365269;
  font-size: 10px;
  font-weight: 650;
}

.group-ai-switch small {
  color: #93a7b7;
  font-size: 8.5px;
}

@media (max-width: 820px) {
  .group-block {
    padding-bottom: 6px;
  }

  .group-item {
    padding: 7px 6px;
  }

  .group-dialog-body {
    max-height: 58vh;
  }
}

.group-ai-mini {
  display: inline-block;
  padding: 1px 4px;
  margin-left: 3px;
  color: #0a94d9;
  font-size: 7px;
  font-style: normal;
  font-weight: 600;
  background: #eaf9ff;
  border-radius: 4px;
  vertical-align: middle;
}

.group-ai-avatar {
  background: #e9f8ff;
}

.group-ai-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-conv-avatar {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.group-ai-tag {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 820px) {
  .group-ai-tag {
    max-width: 120px;
  }
}

/* 群成员选择框与普通字段解耦 */
.field .group-member-option input[type="checkbox"],
.group-member-option input[type="checkbox"] {
  flex: 0 0 15px;
  width: 15px;
  min-width: 15px;
  height: 15px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
  accent-color: var(--brand);
}

/* 好友列表在线状态 */
.friend-list-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 5px;
  vertical-align: 1px;
  border-radius: 50%;
}

.friend-list-dot.is-online {
  background: #18c58b;
  box-shadow: 0 0 0 2px rgba(24, 197, 139, 0.12);
}

.friend-list-dot.is-offline {
  background: #b9c7d3;
}

.friend-meta-dot.is-online {
  background: #18c58b;
  box-shadow: 0 0 0 3px rgba(24, 197, 139, 0.12);
}

.friend-meta-dot.is-offline {
  background: #b9c7d3;
  box-shadow: 0 0 0 3px rgba(185, 199, 211, 0.12);
}

/* 底部登录状态卡已移除，只保留左下角头像 */
.me-card {
  display: none !important;
}

/* =========================================================
   个人设置 / 个人动态
   ========================================================= */

.profile-link {
  align-self: flex-start;
  padding: 0;
  color: #0a9be0;
  font-size: 10px;
  background: transparent;
  border: 0;
}

.profile-link:hover {
  text-decoration: underline;
}

.profile-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 20px;
  box-shadow: none;
}

.profile-dialog::backdrop {
  background: rgba(7, 25, 42, 0.54);
  backdrop-filter: blur(4px);
}

.profile-card {
  display: flex;
  flex-direction: column;
  height: min(88vh, 820px);
  overflow: hidden;
  background: #f3f9fd;
  border-radius: 20px;
  box-shadow: 0 28px 80px rgba(7, 38, 62, 0.3);
}

.profile-cover {
  position: relative;
  flex: 0 0 122px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.42), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(120, 227, 255, 0.5), transparent 36%),
    linear-gradient(135deg, #159fe0, #4a77e8 58%, #8a6be8);
}

.profile-cover-glow {
  position: absolute;
  right: -30px;
  bottom: -90px;
  width: 250px;
  height: 250px;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  filter: blur(2px);
}

.profile-cover-label {
  position: absolute;
  bottom: 14px;
  left: 22px;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.profile-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.profile-scroll {
  flex: 1;
  min-height: 0;
  padding: 0 22px 24px;
  overflow-y: auto;
}

.profile-head {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-top: -36px;
  margin-bottom: 16px;
}

.profile-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 82px;
  height: 82px;
  overflow: hidden;
  color: #fff;
  font-size: 25px;
  font-weight: 750;
  background: linear-gradient(140deg, #8b7cf6, #5a7cf5);
  border: 4px solid #f3f9fd;
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(16, 60, 94, 0.2);
  place-items: center;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-copy {
  min-width: 0;
  flex: 1;
  padding-top: 34px;
}

.profile-copy h2 {
  color: #223a50;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.4px;
}

.profile-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 3px;
  color: #8ba0b1;
  font-size: 9px;
}

.profile-meta b {
  color: #7d94a6;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
}

.profile-online {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: #0b9d76;
}

.profile-online::before {
  width: 6px;
  height: 6px;
  content: "";
  background: #18c58b;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(24, 197, 139, 0.12);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.profile-actions .btn {
  height: 25px;
  padding: 0 8px;
  font-size: 8.5px;
  border-radius: 6px;
}

.moment-composer {
  padding: 12px;
  background: #fff;
  border: 1px solid #e3eef7;
  border-radius: 13px;
  box-shadow: 0 6px 20px rgba(31, 81, 116, 0.05);
}

.moment-composer-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
}

.moment-composer-head strong {
  color: #324b60;
  font-size: 11px;
  font-weight: 650;
}

.moment-composer-head span {
  color: #9cafbd;
  font-size: 8px;
}

.moment-composer textarea {
  display: block;
  width: 100%;
  min-height: 58px;
  max-height: 140px;
  padding: 8px 9px;
  color: #3b5267;
  font-size: 11px;
  line-height: 1.65;
  resize: vertical;
  background: #f8fbfd;
  border: 1px solid #e8f1f7;
  border-radius: 8px;
  outline: 0;
}

.moment-composer textarea:focus {
  background: #fff;
  border-color: #b9e6fa;
  box-shadow: 0 0 0 3px rgba(10, 167, 255, 0.07);
}

.moment-image-preview {
  position: relative;
  width: 112px;
  height: 112px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 9px;
}

.moment-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.moment-image-preview .icon-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 50%;
}

.moment-image-preview .icon {
  width: 11px;
  height: 11px;
}

.moment-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
}

.moment-composer-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  color: #a0b2c1;
  font-size: 8.5px;
}

.moment-composer-tools .icon-btn {
  color: #5f9fc7;
}

.moment-post-btn {
  height: 28px;
  padding: 0 15px;
  font-size: 9.5px;
}

.moment-feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 2px 8px;
}

.moment-feed-head h3 {
  color: #30485d;
  font-size: 12px;
  font-weight: 700;
}

.moment-feed-head span {
  display: block;
  margin-top: 2px;
  color: #9cafbd;
  font-size: 8px;
}

.moment-feed {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.moment-card {
  padding: 11px;
  background: #fff;
  border: 1px solid #e5eff7;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(24, 68, 100, 0.035);
}

.moment-card-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.moment-author-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  overflow: hidden;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(140deg, #8b7cf6, #5a7cf5);
  border-radius: 50%;
  place-items: center;
}

.moment-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.moment-author {
  min-width: 0;
  flex: 1;
}

.moment-author strong {
  display: flex;
  gap: 5px;
  align-items: center;
  color: #3b5368;
  font-size: 10.5px;
  font-weight: 650;
}

.moment-author small {
  display: block;
  margin-top: 2px;
  color: #9cafbd;
  font-size: 8px;
}

.moment-card-delete {
  color: #a8b7c3;
}

.moment-card-delete:hover {
  color: #dc4d58;
}

.moment-content {
  margin-top: 8px;
  color: #40576b;
  font-size: 11px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.moment-photo {
  display: block;
  width: min(100%, 420px);
  max-height: 320px;
  margin-top: 8px;
  object-fit: cover;
  border-radius: 8px;
}

.moment-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid #f0f5f9;
}

.moment-action {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: #8ca2b3;
  font-size: 8.5px;
  background: transparent;
  border: 0;
}

.moment-action .icon {
  width: 14px;
  height: 14px;
}

.moment-action:hover {
  color: #0a9be0;
}

.moment-action.is-liked {
  color: #ed6a7c;
}

.moment-action.is-liked .icon {
  fill: #ed6a7c;
}

.moment-likes {
  margin-top: 7px;
  padding: 5px 7px;
  color: #67839a;
  font-size: 8.5px;
  line-height: 1.6;
  background: #f7fbfd;
  border-radius: 6px;
}

.moment-likes .icon {
  width: 11px;
  height: 11px;
  margin-right: 3px;
  color: #ed6a7c;
  fill: #ed6a7c;
  vertical-align: -1px;
}

.moment-comments {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 7px;
}

.moment-comment {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  color: #496176;
  font-size: 9px;
  line-height: 1.55;
}

.moment-comment strong {
  flex: 0 0 auto;
  color: #137fb8;
  font-weight: 600;
}

.moment-comment-body {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.moment-comment-delete {
  flex: 0 0 auto;
  color: #b2c0ca;
  font-size: 8px;
  background: transparent;
  border: 0;
}

.moment-comment-delete:hover {
  color: #dc4d58;
}

.moment-comment-form {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

.moment-comment-form input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  color: #3f576b;
  font-size: 9.5px;
  background: #f7fbfd;
  border: 1px solid #e6f0f7;
  border-radius: 6px;
  outline: 0;
}

.moment-comment-form input:focus {
  background: #fff;
  border-color: #b9e6fa;
}

.moment-comment-form button {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 9px;
  color: #0a8acb;
  font-size: 9px;
  background: #eefaff;
  border: 1px solid #d8f1fd;
  border-radius: 6px;
}

.moment-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 36px 20px;
  color: #9bafbe;
  text-align: center;
}

.moment-empty-orb {
  display: grid;
  width: 50px;
  height: 50px;
  margin-bottom: 3px;
  color: #72c9f4;
  background: #eefaff;
  border-radius: 50%;
  place-items: center;
}

.moment-empty-orb .icon {
  width: 24px;
  height: 24px;
}

.moment-empty h3 {
  color: #6b879b;
  font-size: 12px;
  font-weight: 600;
}

.moment-empty p {
  font-size: 9px;
}

@media (max-width: 820px) {
  .profile-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .profile-card {
    height: 100dvh;
    border-radius: 0;
  }

  .profile-cover {
    flex-basis: 112px;
  }

  .profile-scroll {
    padding: 0 14px calc(20px + env(safe-area-inset-bottom));
  }

  .profile-head {
    gap: 11px;
    margin-top: -32px;
  }

  .profile-avatar {
    width: 70px;
    height: 70px;
    font-size: 21px;
  }

  .profile-copy {
    padding-top: 31px;
  }

  .profile-copy h2 {
    font-size: 18px;
  }

  .profile-actions .btn {
    height: 24px;
  }

  .moment-photo {
    width: 100%;
    max-height: 260px;
  }
}

/* 修正 dialog.dialog 的 590px 上限 */
dialog.profile-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
  max-height: calc(var(--app-height, 100dvh) - 32px);
}

.friend-presence-label {
  margin-left: 4px;
  font-size: 7.5px;
  font-style: normal;
  font-weight: 500;
}

.friend-presence-label.is-online {
  color: #0aa87b;
}

.friend-presence-label.is-offline {
  color: #a6b7c4;
}

@media (max-width: 820px) {
  dialog.profile-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
}

.group-ai-switch input[type="checkbox"] {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--brand);
}

@media (max-width: 380px) {
  .rail-btn {
    width: 56px;
  }

  .rail-label {
    font-size: 8.5px;
  }
}

@media (max-width: 340px) {
  .rail-btn {
    width: 52px;
  }

  .rail-label {
    font-size: 8px;
  }
}

/* =========================================================
   动态 / 设置独立页面
   ========================================================= */

.profile-pane,
.settings-pane {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 80px;
  z-index: 20;
  overflow-y: auto;
  background: #eef7fc;
}

.profile-page,
.settings-page {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 18px;
}

.profile-page .profile-card {
  width: min(780px, 100%);
  height: 100%;
  max-height: calc(var(--app-height, 100dvh) - 36px);
  border-radius: 16px;
}

.settings-page .settings-page-card {
  width: min(820px, 100%);
  height: 100%;
  max-height: calc(var(--app-height, 100dvh) - 36px);
  border-radius: 16px;
}

.settings-page-card .dialog-body {
  overflow-y: auto;
}

@media (max-width: 1120px) {
  .profile-pane,
  .settings-pane {
    left: 66px;
  }
}

@media (max-width: 820px) {
  .profile-pane,
  .settings-pane {
    bottom: calc(58px + env(safe-area-inset-bottom));
    left: 0;
    z-index: 40;
  }

  .profile-page,
  .settings-page {
    padding: 0;
  }

  .profile-page .profile-card,
  .settings-page .settings-page-card {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: 0;
  }
}

.managed-ai-note {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 10px 11px;
  margin-top: 10px;
  background: #eefaff;
  border: 1px solid #d9f1fd;
  border-radius: 9px;
}

.managed-ai-icon {
  display: grid;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  color: #0a91cf;
  background: #dff5ff;
  border-radius: 8px;
  place-items: center;
}

.managed-ai-icon .icon {
  width: 16px;
  height: 16px;
}

.managed-ai-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.managed-ai-copy strong {
  color: #27627f;
  font-size: 9.5px;
  font-weight: 650;
}

.managed-ai-copy span {
  color: #7e9caf;
  font-size: 8.5px;
}

.composer-attachment {
  position: relative;
  display: inline-flex;
  width: 72px;
  height: 72px;
  margin: 8px 12px 0;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(20, 60, 90, 0.08);
}

.composer-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-attachment .icon-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 19px;
  height: 19px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
}

.composer-attachment .icon {
  width: 10px;
  height: 10px;
}

.msg-image {
  display: block;
  width: min(100%, 280px);
  max-height: 300px;
  margin-bottom: 6px;
  object-fit: cover;
  border-radius: 8px;
}

.msg-image:only-child {
  margin-bottom: 0;
}

@media (max-width: 820px) {
  .composer-attachment {
    width: 62px;
    height: 62px;
    margin: 7px 10px 0;
  }

  .msg-image {
    max-width: 220px;
    max-height: 250px;
  }
}

.auth-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: -2px 0 10px;
}

.auth-rules span {
  padding: 3px 7px;
  color: #a1b2c0;
  font-size: 9px;
  background: #f2f7fb;
  border: 1px solid #e4eef5;
  border-radius: 20px;
}

.auth-rules span.ok {
  color: #168d72;
  background: #eafaf4;
  border-color: #c7efdf;
}
