/* ============ 基础与主题 ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --bg: #060c16;
  --bg-2: #081320;
  --shell: #0a1320;
  --rail: #07101b;
  --panel: #0c1726;
  --panel-2: #101d2f;
  --panel-3: #16253a;
  --chat-bg: #0a1422;
  --line: rgba(151, 178, 214, 0.12);
  --line-strong: rgba(151, 178, 214, 0.22);
  --text: #e9f2ff;
  --muted: #8ba0bb;
  --faint: #61758f;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --accent-ink: #04211e;
  --danger: #fb7185;
  --bubble-in: #15243a;
  --bubble-in-text: #e9f2ff;
  --bubble-out: linear-gradient(135deg, #14766e, #1e9c8f);
  --bubble-out-text: #f2fffd;
  --input: rgba(5, 11, 20, 0.55);
  --hover: rgba(125, 211, 252, 0.06);
  --active: rgba(45, 212, 191, 0.11);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.22);
  --radius: 18px;
}

html[data-theme="light"] {
  --bg: #e8eff4;
  --bg-2: #dce8f1;
  --shell: #f7fbfd;
  --rail: #0d2b31;
  --panel: #f2f8fa;
  --panel-2: #ffffff;
  --panel-3: #e7f1f5;
  --chat-bg: #fbfdfe;
  --line: rgba(19, 48, 62, 0.1);
  --line-strong: rgba(19, 48, 62, 0.18);
  --text: #102a3a;
  --muted: #5c7385;
  --faint: #8297a6;
  --accent: #0f9f8f;
  --accent-2: #0284c7;
  --accent-ink: #ffffff;
  --danger: #e11d48;
  --bubble-in: #eaf2f6;
  --bubble-in-text: #102a3a;
  --bubble-out: linear-gradient(135deg, #0d8d80, #10a99a);
  --bubble-out-text: #ffffff;
  --input: #ffffff;
  --hover: rgba(2, 132, 199, 0.06);
  --active: rgba(15, 159, 143, 0.12);
  --shadow: 0 24px 70px rgba(31, 64, 83, 0.18);
  --shadow-soft: 0 10px 30px rgba(31, 64, 83, 0.1);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 600px at 15% -10%, rgba(45, 212, 191, 0.1), transparent 60%),
    radial-gradient(800px 600px at 100% 110%, rgba(56, 189, 248, 0.1), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(45, 212, 191, 0.28);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 160, 187, 0.24);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 160, 187, 0.4);
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

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

.avatar {
  --avatar-size: 46px;
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 32%;
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
  color: #fff;
  font-weight: 700;
  font-size: calc(var(--avatar-size) * 0.38);
  letter-spacing: 0.02em;
  background: linear-gradient(140deg, #1f8f86, #3b82f6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  user-select: none;
}

.avatar.small {
  --avatar-size: 30px;
}

.avatar.tiny {
  --avatar-size: 26px;
  font-size: 12px;
}

.avatar.large {
  --avatar-size: 54px;
}

.avatar .online-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #34d399;
  border: 2px solid var(--panel);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
}

.avatar.avatar-group {
  color: #eafffb;
}

.avatar .icon {
  width: 58%;
  height: 58%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  border-color: rgba(45, 212, 191, 0.5);
  background: var(--panel-3);
}

.btn:active {
  transform: translateY(1px);
}

.btn.danger {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
}

.btn.danger:hover {
  border-color: rgba(244, 63, 94, 0.6);
  background: rgba(244, 63, 94, 0.24);
}

html[data-theme="light"] .btn.danger {
  color: #be123c;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  border: 0;
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
  color: #04211e;
  box-shadow: 0 8px 24px rgba(45, 212, 191, 0.24);
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn.ghost:hover {
  color: var(--text);
  background: var(--hover);
}

.btn.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn.wide {
  width: 100%;
  min-height: 46px;
  font-size: 15px;
}

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

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.icon-btn.accent {
  background: var(--active);
  color: var(--accent);
}

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

.mobile-only {
  display: none !important;
}

/* ============ 登录 / 注册 ============ */
.auth {
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(400px, 0.88fr);
  overflow-y: auto;
}

.auth-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(36px, 6vw, 88px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(620px 420px at 18% 22%, rgba(45, 212, 191, 0.16), transparent 65%),
    radial-gradient(600px 500px at 82% 88%, rgba(56, 189, 248, 0.14), transparent 68%),
    linear-gradient(160deg, rgba(13, 32, 48, 0.9), rgba(6, 13, 24, 0.92));
}

html[data-theme="light"] .auth-hero {
  background:
    radial-gradient(620px 420px at 18% 22%, rgba(15, 159, 143, 0.18), transparent 65%),
    radial-gradient(600px 500px at 82% 88%, rgba(2, 132, 199, 0.13), transparent 68%),
    linear-gradient(160deg, #eef9f8, #e5f0f7);
}

.bubbles span {
  position: absolute;
  display: block;
  border-radius: 50%;
  border: 1px solid rgba(94, 234, 212, 0.22);
  background: radial-gradient(circle at 32% 28%, rgba(94, 234, 212, 0.18), rgba(56, 189, 248, 0.02));
  animation: float 14s ease-in-out infinite;
  pointer-events: none;
}

.bubbles span:nth-child(1) { width: 160px; height: 160px; left: 6%; top: 14%; animation-delay: -2s; }
.bubbles span:nth-child(2) { width: 70px; height: 70px; left: 76%; top: 12%; animation-delay: -6s; }
.bubbles span:nth-child(3) { width: 28px; height: 28px; left: 66%; top: 38%; animation-delay: -9s; }
.bubbles span:nth-child(4) { width: 210px; height: 210px; right: -60px; bottom: 6%; animation-delay: -4s; }
.bubbles span:nth-child(5) { width: 44px; height: 44px; left: 14%; bottom: 18%; animation-delay: -11s; }
.bubbles span:nth-child(6) { width: 18px; height: 18px; left: 40%; top: 10%; animation-delay: -7s; }

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(6px, -18px, 0); }
}

.brand-lockup {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(38px, 7vh, 76px);
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #052520;
  background: linear-gradient(135deg, #5eead4, #38bdf8);
  box-shadow: 0 12px 30px rgba(45, 212, 191, 0.25);
}

.brand-badge .icon {
  width: 32px;
  height: 32px;
  stroke-width: 2.2;
}

.brand-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand-en {
  font-size: 10px;
  letter-spacing: 0.42em;
  color: var(--muted);
  margin-top: 2px;
}

.hero-title {
  position: relative;
  margin: 0;
  font-size: clamp(2.6rem, 4.6vw, 4.4rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.hero-title em {
  font-style: normal;
  background: linear-gradient(120deg, #5eead4, #38bdf8 65%, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  position: relative;
  max-width: 30em;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
}

.hero-chips {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 34px;
}

.hero-chips span {
  font-size: 12px;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(125, 211, 252, 0.04);
}

.hero-note {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: clamp(36px, 8vh, 80px);
  font-size: 12px;
  color: var(--faint);
}

.hero-note strong {
  color: var(--muted);
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.14);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.3); }
  70% { box-shadow: 0 0 0 8px rgba(45, 212, 191, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); }
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: linear-gradient(180deg, rgba(10, 19, 32, 0.5), rgba(6, 12, 22, 0.7));
}

html[data-theme="light"] .auth-panel {
  background: linear-gradient(180deg, rgba(247, 251, 253, 0.8), rgba(232, 239, 244, 0.9));
}

.auth-card {
  width: min(400px, 100%);
  padding: 30px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 13px;
  background: var(--input);
  margin-bottom: 26px;
}

.auth-tab {
  border: 0;
  border-radius: 9px;
  padding: 10px 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease;
}

.auth-tab.active {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
}

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

.field span {
  display: block;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input::placeholder,
.sidebar-search input::placeholder,
.friend-search input::placeholder,
.composer textarea::placeholder {
  color: var(--faint);
}

.field input:focus {
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.form-error {
  min-height: 18px;
  margin: 2px 0 12px;
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

/* ============ 三栏主界面 ============ */
.main {
  height: 100dvh;
  display: grid;
  grid-template-columns: 218px 336px minmax(0, 1fr);
  background: var(--shell);
  overflow: hidden;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 14px 18px;
  background:
    radial-gradient(300px 260px at 0% 0%, rgba(45, 212, 191, 0.09), transparent 70%),
    var(--rail);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.rail-brand {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #052520;
  background: linear-gradient(135deg, #5eead4, #38bdf8);
  box-shadow: 0 8px 24px rgba(45, 212, 191, 0.22);
  margin: 2px 0 6px 4px;
}

.rail-brand .icon {
  width: 26px;
  height: 26px;
}

.rail-me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.rail-me-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-me-text strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-me-text span {
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.rail-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease;
}

.rail-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.rail-btn.active {
  background: var(--active);
  color: var(--accent);
  border-color: rgba(45, 212, 191, 0.16);
}

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

.rail-badge {
  position: absolute;
  top: 8px;
  left: 28px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--rail);
}

.rail-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.rail-bottom .rail-btn {
  width: 40px;
  min-height: 40px;
  padding: 0;
  justify-content: center;
}

.theme-icon-light {
  display: none;
}

html[data-theme="light"] .theme-icon-dark {
  display: none;
}

html[data-theme="light"] .theme-icon-light {
  display: block;
}

/* 浅色主题下 rail 仍是深色，文字变量必须局部覆盖 */
html[data-theme="light"] .rail {
  --text: #e9f2ff;
  --muted: #9fb3c8;
  --faint: #7f95ab;
  --line: rgba(151, 178, 214, 0.16);
  --line-strong: rgba(151, 178, 214, 0.28);
  --hover: rgba(255, 255, 255, 0.06);
  --active: rgba(45, 212, 191, 0.16);
}

.conn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-left: auto;
  margin-right: 6px;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
  transition: background 0.2s ease;
}

.conn-dot.online {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.14);
}

.conn-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.15);
}

/* ============ 会话列表 ============ */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px 16px 14px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.sidebar-head h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.01em;
}

.sidebar-head p {
  margin: 5px 0 0;
  font-size: 11.5px;
  color: var(--faint);
}

.sidebar-head .icon-btn {
  margin-top: -4px;
}

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 18px 0 12px;
}

.sidebar-search .icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  outline: none;
  font-size: 13px;
}

.sidebar-search input:focus {
  border-color: rgba(45, 212, 191, 0.45);
}

.list-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-item:hover {
  background: var(--hover);
}

.chat-item.active {
  background: var(--active);
  border-color: rgba(45, 212, 191, 0.15);
}

.chat-item-body {
  min-width: 0;
}

.chat-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-item-name {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-time {
  flex: none;
  font-size: 10.5px;
  color: var(--faint);
}

.chat-item-preview {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-preview .draft {
  color: var(--accent);
}

.chat-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  min-width: 20px;
}

.unread-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
  color: #04211e;
  font-size: 10.5px;
  font-weight: 800;
}

.muted-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.empty.small {
  flex: 1;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--active);
  color: var(--accent);
}

.empty p {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.empty span {
  font-size: 11.5px;
  color: var(--faint);
}

/* ============ 联系人 ============ */
.friend-search {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.friend-search input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  outline: none;
  font-size: 13px;
}

.friend-search input:focus {
  border-color: rgba(45, 212, 191, 0.45);
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 11px;
}

.search-result:hover {
  background: var(--hover);
}

.search-result-name {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-name strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-name span {
  font-size: 11px;
  color: var(--faint);
}

.list-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--faint);
  text-transform: uppercase;
}

.list-label span {
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}

.friend-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 8px;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  transition: background 0.15s ease;
}

.friend-item:hover {
  background: var(--hover);
}

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

.friend-item-info strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-item-info span {
  font-size: 11px;
  color: var(--faint);
}

.friend-item-info span.online {
  color: var(--accent);
}

.friend-item .go {
  font-size: 11px;
  color: var(--faint);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.friend-item:hover .go {
  opacity: 1;
}

/* ============ 聊天区 ============ */
.chat {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(700px 380px at 78% -8%, rgba(56, 189, 248, 0.06), transparent 65%),
    var(--chat-bg);
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
}

.empty-orbit {
  position: relative;
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
}

.orbit-ring::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  border: 1px dashed var(--line);
}

.orbit-fish {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.orbit-fish .icon {
  width: 42px;
  height: 42px;
  stroke-width: 1.6;
}

.orbit-dot {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.6);
}

.orbit-dot.d1 { width: 7px; height: 7px; top: 12%; left: 16%; }
.orbit-dot.d2 { width: 5px; height: 5px; right: 9%; top: 48%; background: var(--accent-2); }
.orbit-dot.d3 { width: 9px; height: 9px; left: 30%; bottom: 8%; opacity: 0.55; }

.chat-empty h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.chat-empty p {
  max-width: 340px;
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.empty-actions {
  display: flex;
  gap: 10px;
}

.chat-active {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--chat-bg) 82%, transparent);
  backdrop-filter: blur(12px);
  z-index: 2;
}

.chat-title {
  min-width: 0;
  flex: 1;
}

.chat-title h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-title p {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-title p .online-text {
  color: var(--accent);
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.message-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px clamp(16px, 3.2vw, 46px) 10px;
}

.load-more-wrap {
  max-width: 980px;
  margin: 0 auto 8px;
  display: flex;
  justify-content: center;
}

.history-start {
  font-size: 11px;
  color: var(--faint);
  padding: 6px 0;
}

.messages {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 6px;
}

.day-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0 12px;
}

.day-sep span {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--faint);
  font-size: 10.5px;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
}

.msg-row.continued {
  margin-top: 3px;
}

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

.msg-row.continued .avatar {
  visibility: hidden;
}

.msg-row .avatar {
  --avatar-size: 36px;
  margin-top: 2px;
}

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

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

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 3px 5px;
  font-size: 11px;
  color: var(--faint);
}

.msg-author {
  color: var(--muted);
  font-weight: 600;
}

.msg-row.continued .msg-meta {
  display: none;
}

.msg-bubble {
  position: relative;
  padding: 10px 14px;
  border-radius: 4px 15px 15px 15px;
  background: var(--bubble-in);
  color: var(--bubble-in-text);
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.msg-row.own .msg-bubble {
  border-radius: 15px 4px 15px 15px;
  background: var(--bubble-out);
  color: var(--bubble-out-text);
}

.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-text a {
  color: #7dd3fc;
  text-underline-offset: 2px;
}

html[data-theme="light"] .msg-text a {
  color: #0369a1;
}

.msg-bubble.image-bubble {
  position: relative;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.image-save {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 1;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(5, 12, 16, 0.64);
  color: #e8fffb;
  opacity: 0.55;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.image-bubble:hover .image-save,
.image-save:focus-visible {
  opacity: 1;
}

.image-save:hover {
  background: rgba(13, 148, 136, 0.88);
}

.image-save .icon {
  width: 14px;
  height: 14px;
}

.msg-row.own .msg-bubble.image-bubble {
  background: var(--panel-2);
}

.msg-bubble.image-bubble img {
  display: block;
  max-width: min(320px, 52vw);
  max-height: 360px;
  border-radius: 11px;
  object-fit: cover;
  cursor: zoom-in;
  background: var(--panel-3);
}

.msg-bubble.image-bubble .image-fallback {
  padding: 18px 22px;
  color: var(--muted);
  font-size: 12px;
}

.file-bubble {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 210px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  text-decoration: none;
}

.msg-row:not(.own) .file-bubble {
  background: rgba(255, 255, 255, 0.04);
}

.file-bubble:hover {
  background: rgba(255, 255, 255, 0.1);
}

.file-icon {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(45, 212, 191, 0.14);
  color: var(--accent);
}

.file-icon .icon {
  width: 19px;
  height: 19px;
}

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

.file-info strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-info span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  opacity: 0.65;
}

.file-download {
  flex: none;
  opacity: 0.65;
}

.file-download .icon {
  width: 18px;
  height: 18px;
}

.audio-bubble audio {
  display: block;
  width: min(300px, 56vw);
  height: 38px;
}

.video-bubble video {
  display: block;
  max-width: min(340px, 56vw);
  max-height: 360px;
  border-radius: 11px;
}

.typing-line {
  max-width: 980px;
  margin: 6px auto 0;
  padding: 0 4px;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s infinite ease-in-out;
}

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

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

/* ============ 输入区 ============ */
.composer {
  position: relative;
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 12px clamp(16px, 3.2vw, 46px) 16px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--chat-bg) 88%, transparent);
  backdrop-filter: blur(12px);
}

.composer-tools {
  display: flex;
  gap: 2px;
  padding-bottom: 3px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.tool-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tool-btn .icon {
  width: 19px;
  height: 19px;
}

#composer-input {
  flex: 1;
  min-height: 44px;
  max-height: 150px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  outline: none;
  resize: none;
  line-height: 1.55;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#composer-input:focus {
  border-color: rgba(45, 212, 191, 0.5);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

#composer-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.composer-side {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 1px;
}

#composer-hint {
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
}

.send-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
  color: #04211e;
  box-shadow: 0 8px 22px rgba(45, 212, 191, 0.24);
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.send-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.send-btn .icon {
  width: 19px;
  height: 19px;
  margin-left: -1px;
}

.emoji-picker {
  position: absolute;
  left: clamp(16px, 3.2vw, 46px);
  bottom: 74px;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  border-radius: 15px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  z-index: 8;
}

.picker-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 8px 10px 6px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.picker-tab {
  border: 0;
  padding: 5px 11px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.picker-tab:hover {
  background: var(--hover);
  color: var(--text);
}

.picker-tab.active {
  background: var(--active);
  color: var(--accent);
}

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

.emoji-grid button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 5px 0;
  font-size: 20px;
  line-height: 1.2;
}

.emoji-grid button:hover {
  background: var(--hover);
}

.sticker-panel {
  padding: 0 10px 10px;
}

.sticker-block {
  margin-top: 6px;
}

.sticker-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 6px 2px;
  color: var(--muted);
  font-size: 11px;
}

.sticker-count {
  color: var(--faint);
  font-size: 10.5px;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.sticker-grid-recent {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.sticker-item {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
}

.sticker-use {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--input);
  display: block;
}

.sticker-use img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sticker-use:hover {
  border-color: rgba(45, 212, 191, 0.6);
}

.sticker-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-3);
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.sticker-item:hover .sticker-remove,
.sticker-remove:focus-visible {
  opacity: 1;
}

.sticker-remove:hover {
  color: #f87171;
}

.sticker-remove .icon {
  width: 10px;
  height: 10px;
}

.sticker-empty {
  padding: 18px 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

.sticker-empty span {
  color: var(--faint);
  font-size: 11px;
}

.sticker-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  padding-bottom: 3px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}

.sticker-status {
  color: var(--faint);
  font-size: 11px;
}

.upload-status {
  position: absolute;
  right: clamp(16px, 3.2vw, 46px);
  top: -34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11.5px;
  box-shadow: var(--shadow-soft);
}

.spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(45, 212, 191, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.drop-hint {
  position: absolute;
  inset: 78px 24px 86px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed rgba(45, 212, 191, 0.55);
  border-radius: 20px;
  background: rgba(6, 16, 28, 0.82);
  backdrop-filter: blur(4px);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

.drop-hint .icon {
  width: 30px;
  height: 30px;
}

/* ============ 弹窗 / 灯箱 / 提示 ============ */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 8, 15, 0.62);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(460px, 100%);
  max-height: min(86dvh, 680px);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: pop 0.17s ease-out;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 8px;
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
}

.modal-head p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.modal-body {
  padding: 12px 22px 4px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px 20px;
}

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

.modal-field span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.modal-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  outline: none;
  font-size: 14px;
}

.modal-field input:focus {
  border-color: rgba(45, 212, 191, 0.5);
}

.member-picker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 4px;
  padding-right: 2px;
}

.member-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.member-option:hover {
  background: var(--hover);
}

.member-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: none;
}

.member-option span {
  font-size: 13px;
}

.member-option .member-sub {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
}

.confirm-text {
  padding: 4px 0 10px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

.modal-empty {
  padding: 16px 4px;
  font-size: 12.5px;
  color: var(--faint);
  text-align: center;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 12, 0.92);
  backdrop-filter: blur(6px);
}

.lightbox img {
  max-width: 90vw;
  max-height: 84vh;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lightbox-caption {
  position: absolute;
  bottom: 26px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease-out;
  max-width: min(420px, 86vw);
  text-align: center;
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.4);
  color: #fecdd3;
}

.toast.success {
  border-color: rgba(45, 212, 191, 0.4);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ============ 响应式 ============ */
@media (max-width: 1240px) {
  .main {
    grid-template-columns: 86px 308px minmax(0, 1fr);
  }

  .rail {
    padding: 18px 10px 14px;
    align-items: center;
  }

  .rail-me {
    padding: 6px;
    border: 0;
    background: transparent;
  }

  .rail-me-text {
    display: none;
  }

  .rail-nav {
    width: 100%;
  }

  .rail-btn {
    flex-direction: column;
    gap: 3px;
    justify-content: center;
    padding: 7px 0;
    min-height: 54px;
    font-size: 10.5px;
  }

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

  .rail-badge {
    left: auto;
    right: 8px;
    top: 4px;
  }

  .rail-bottom {
    justify-content: center;
  }
}

@media (max-width: 980px) {
  .main {
    grid-template-columns: 80px 286px minmax(0, 1fr);
  }

  .sidebar {
    padding: 18px 12px 12px;
  }

  .chat-head {
    padding: 0 18px;
  }

  .message-scroll {
    padding-left: 18px;
    padding-right: 18px;
  }

  .composer {
    padding-left: 18px;
    padding-right: 18px;
  }

  #composer-hint {
    display: none;
  }
}

@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    padding: 34px 26px 10px;
    border-right: 0;
    min-height: auto;
  }

  .brand-lockup {
    margin-bottom: 28px;
  }

  .hero-title {
    font-size: clamp(2rem, 9vw, 2.7rem);
  }

  .hero-sub {
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.75;
  }

  .hero-chips {
    margin-top: 18px;
  }

  .hero-note {
    margin-top: 18px;
  }

  .auth-panel {
    padding: 18px 20px 44px;
    align-items: flex-start;
  }

  .auth-card {
    padding: 22px;
  }

  .main {
    display: block;
  }

  .rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    height: 62px;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-right: 0;
    border-top: 1px solid var(--line);
    background: var(--rail);
  }

  .rail-brand,
  .rail-me {
    display: none;
  }

  .rail-bottom {
    display: flex;
    flex: none;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    gap: 0;
  }

  .rail-bottom .rail-btn {
    width: 40px;
    flex: 0 0 40px;
    min-height: 46px;
    padding: 0;
  }

  .rail-nav {
    flex: 1;
    flex-direction: row;
    width: auto;
    gap: 4px;
    margin: 0;
  }

  .rail-btn {
    flex: 1;
    flex-direction: row;
    min-height: 46px;
    gap: 7px;
    font-size: 12.5px;
    padding: 0 12px;
    justify-content: center;
  }

  .rail-badge {
    top: 4px;
    left: 50%;
    right: auto;
    transform: translateX(10px);
  }

  .sidebar {
    height: calc(100dvh - 62px);
    width: 100%;
    padding: 20px 16px 12px;
    border-right: 0;
  }

  .chat {
    position: fixed;
    inset: 0 0 62px;
    z-index: 30;
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.22, 0.7, 0.3, 1);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.3);
  }

  .main.chat-open .chat {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-grid !important;
  }

  .chat-head {
    min-height: 64px;
    gap: 9px;
    padding: 0 12px;
  }

  .chat-head .avatar {
    --avatar-size: 40px;
  }

  .chat-actions .btn {
    display: none;
  }

  #reload-btn {
    display: none;
  }

  .message-scroll {
    padding: 12px 12px 56px;
  }

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

  .msg-bubble {
    font-size: 14px;
  }

  .msg-bubble.image-bubble img {
    max-width: 62vw;
    max-height: 300px;
  }

  .composer {
    padding: 9px 12px calc(12px + env(safe-area-inset-bottom));
    gap: 6px;
  }

  .composer-tools {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 12px;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow-soft);
  }

  .composer-side {
    padding-bottom: 1px;
  }

  .send-btn {
    width: 42px;
    height: 42px;
  }

  #composer-input {
    font-size: 16px;
    min-height: 42px;
    padding: 10px 12px;
  }

  .emoji-picker {
    left: 12px;
    bottom: 116px;
    width: min(340px, calc(100vw - 24px));
    max-height: min(420px, 56vh);
  }

  .sticker-remove {
    opacity: 1;
  }

  .image-save {
    opacity: 0.9;
  }

  .upload-status {
    right: 12px;
  }

  .drop-hint {
    inset: 70px 12px 74px;
  }

  .toast-root {
    bottom: 82px;
    width: 100%;
    padding: 0 16px;
  }

  .lightbox img {
    max-width: 94vw;
  }
}

@media (max-width: 520px) {
  .hero-chips span:nth-child(4) {
    display: none;
  }

  .chat-item {
    grid-template-columns: 46px minmax(0, 1fr) auto;
  }

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

  .msg-row .avatar {
    --avatar-size: 32px;
  }

  .file-bubble {
    min-width: 0;
    width: 100%;
  }

  .modal-card {
    border-radius: 18px;
  }
}

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