:root {
  --paper: #f4f6f8;
  --surface: #ffffff;
  --ink: #101318;
  --muted: #6c7480;
  --line: #e2e6eb;
  --line-strong: #ccd2da;
  --signal: #ee6255;
  --signal-dark: #d94f43;
  --link: #1768d3;
  --code: #202328;
  --code-ink: #f3f5f7;
  --control: #11151a;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 720px;
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) auto;
  background: var(--surface);
  border-inline: 1px solid var(--line);
}

.topbar {
  position: relative;
  z-index: 8;
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.model-picker {
  position: relative;
  min-width: 0;
  justify-self: center;
}

.brand {
  min-width: 0;
  max-width: min(280px, calc(100vw - 128px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 5px 2px 2px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.brand:hover,
.brand:focus-visible,
.brand[aria-expanded="true"] {
  background: #f2f4f6;
  outline: none;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  text-align: left;
}

.brand strong,
.brand-copy > span {
  margin: 0;
  overflow: hidden;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 18px;
  line-height: 1.05;
  font-weight: 720;
}

.brand-copy > span {
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  line-height: 1;
}

.model-picker-chevron {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 150ms ease;
}

.brand[aria-expanded="true"] .model-picker-chevron {
  transform: rotate(180deg);
}

/* 模型菜单保持在顶部工具栏内定位，最大高度避免越过输入区域。 */
.model-menu {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  width: min(340px, calc(100vw - 24px));
  max-height: min(360px, calc(100dvh - 130px));
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(18, 24, 31, 0.16);
  transform: translateX(-50%);
  scrollbar-width: thin;
}

.model-menu-item {
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.model-menu-item:hover,
.model-menu-item:focus-visible {
  background: #f2f4f6;
  outline: none;
}

.model-menu-item[aria-selected="true"] {
  box-shadow: inset 2px 0 0 var(--signal);
  background: #f7f8fa;
}

.model-menu-item > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.model-menu-item strong,
.model-menu-item small,
.model-menu-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-menu-item strong {
  font-size: 12px;
  font-weight: 680;
}

.model-menu-item small,
.model-menu-item em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.model-menu-item em {
  max-width: 150px;
  font-family: Consolas, "SFMono-Regular", monospace;
  text-align: right;
}

.model-orbit {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

.model-orbit::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1.5px solid var(--signal);
  border-radius: 50%;
}

.model-orbit span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
}

.app-shell.is-generating .model-orbit::before {
  border-top-color: transparent;
  animation: orbit 0.85s linear infinite;
}

@keyframes orbit {
  to { transform: rotate(360deg); }
}

.icon-button,
.send-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.icon-button svg,
.send-button svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button {
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  background: var(--paper);
  color: var(--ink);
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.35;
}

/* 登录状态确认前隐藏工作区，避免未登录内容短暂闪现。 */
.app-shell.is-auth-pending > .topbar,
.app-shell.is-auth-pending > .conversation,
.app-shell.is-auth-pending > .composer,
.app-shell.is-auth-pending > .auth-view {
  visibility: hidden;
}

/* 鉴权期间只显示品牌化加载环，避免已登录用户刷新时闪现登录表单。 */
.app-shell.is-auth-pending::after {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 80;
  width: 24px;
  height: 24px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--signal);
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
  animation: auth-pending-spin 700ms linear infinite;
}

@keyframes auth-pending-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 账号入口保持单任务结构，不使用嵌套卡片干扰移动端操作。 */
.auth-view {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: max(28px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  background: var(--surface);
}

.auth-panel {
  width: min(100%, 350px);
}

.auth-brand {
  margin-bottom: 28px;
}

.auth-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  box-shadow: inset 0 0 0 6px var(--surface), inset 0 0 0 7px var(--signal);
  font-size: 19px;
  font-weight: 760;
}

.auth-heading {
  margin-bottom: 24px;
}

.auth-heading h1,
.auth-heading p {
  margin: 0;
  letter-spacing: 0;
}

.auth-heading h1 {
  font-size: 25px;
  line-height: 1.25;
  font-weight: 740;
}

.auth-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-tabs {
  height: 38px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-bottom: 18px;
  padding: 3px;
  border-radius: 7px;
  background: #eceff3;
}

.auth-tab {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.auth-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 19, 24, 0.1);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #454c56;
  font-size: 12px;
  font-weight: 650;
}

.auth-form input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  background: #f8f9fa;
  color: var(--ink);
  font-size: 15px;
  font-weight: 450;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.auth-form input:focus {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(16, 19, 24, 0.07);
}

.auth-error {
  margin: -2px 0 0;
  color: #b83b33;
  font-size: 12px;
  line-height: 1.45;
}

.auth-submit {
  width: 100%;
  height: 44px;
  margin-top: 3px;
  border: 0;
  border-radius: 7px;
  background: var(--control);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 680;
  transition: background 150ms ease, transform 150ms ease;
}

.auth-submit:hover {
  background: #2b3138;
}

.auth-submit:active {
  transform: scale(0.985);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

/* 会话存档在移动端使用覆盖抽屉，避免永久压缩对话宽度。 */
.session-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  padding: 0;
  border: 0;
  background: rgba(16, 19, 24, 0.34);
  opacity: 0;
  cursor: default;
  transition: opacity 180ms ease;
}

.session-drawer {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 50;
  width: min(86%, 330px);
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  padding: max(18px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  box-shadow: 18px 0 42px rgba(16, 19, 24, 0.12);
  transform: translateX(-102%);
  transition: transform 210ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.app-shell.is-drawer-open .session-backdrop {
  opacity: 1;
}

.app-shell.is-drawer-open .session-drawer {
  transform: translateX(0);
}

.session-drawer-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 16px 6px;
}

.session-drawer-header h2,
.session-drawer-header p {
  margin: 0;
}

.session-drawer-header h2 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 720;
}

.session-drawer-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.drawer-icon-button,
.conversation-delete-button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.drawer-icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.drawer-icon-button:hover,
.conversation-delete-button:hover {
  background: #e9edf1;
  color: var(--ink);
}

.drawer-icon-button svg,
.drawer-new-button svg,
.conversation-delete-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-new-button {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.drawer-new-button:hover {
  border-color: #aeb5bf;
  background: #f5f7f9;
}

.drawer-new-button:disabled {
  cursor: default;
  opacity: 0.4;
}

.conversation-list {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.archive-empty {
  margin: 28px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.conversation-list-item {
  min-width: 0;
  height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  margin-bottom: 3px;
  border-radius: 7px;
}

.conversation-list-item:hover,
.conversation-list-item.is-active {
  background: #edf0f3;
}

.conversation-list-item.is-active {
  box-shadow: inset 2px 0 0 var(--ink);
}

.conversation-select-button {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 5px 0 11px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.conversation-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-time {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.conversation-delete-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  opacity: 0.45;
}

.conversation-delete-button svg {
  width: 15px;
  height: 15px;
}

.conversation-list-item:hover .conversation-delete-button,
.conversation-list-item.is-active .conversation-delete-button {
  opacity: 1;
}

.session-user {
  min-width: 0;
  height: 52px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 8px 5px 0;
  border-top: 1px solid var(--line);
}

/* 账户入口只展示最关键的余额信息，避免挤占会话列表。 */
.account-button {
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
}

.account-button strong {
  color: var(--signal-dark);
  font-size: 12px;
}

.admin-link,
.logout-button {
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}

.admin-link:hover {
  color: var(--ink);
}

.account-backdrop {
  position: absolute;
  inset: 0;
  z-index: 55;
  border: 0;
  background: rgba(16, 19, 24, 0.34);
}

.account-panel {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 60;
  width: min(92%, 390px);
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
  padding: max(18px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  border-left: 1px solid var(--line);
  background: #fbfcfd;
  box-shadow: -18px 0 42px rgba(16, 19, 24, 0.12);
  transform: translateX(102%);
  transition: transform 210ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.app-shell.is-account-open .account-panel {
  transform: translateX(0);
}

.account-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-panel-header h2,
.account-section h3 {
  margin: 0;
}

.account-panel-header h2 {
  font-size: 18px;
}

.account-balance {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}

.account-balance div {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 14px 4px;
}

.account-balance div + div {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.account-balance span,
.account-section h3 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.account-balance strong {
  overflow: hidden;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-section {
  min-width: 0;
}

/* 视频代理设置使用单行轨道开关，不额外占用账户面板纵向空间。 */
.account-proxy-setting {
  min-width: 0;
}

.account-proxy-toggle {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px;
  border: 0;
  border-block: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.account-proxy-toggle.is-locked {
  color: var(--muted);
}

.account-proxy-toggle:disabled {
  cursor: wait;
  opacity: 0.64;
}

.account-proxy-track {
  width: 34px;
  height: 18px;
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #c9cdd2;
  transition: background 150ms ease;
}

.account-proxy-track i {
  width: 14px;
  height: 14px;
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 19, 24, 0.2);
  transition: transform 150ms ease;
}

.account-proxy-toggle.is-on .account-proxy-track {
  background: var(--signal-dark);
}

.account-proxy-toggle.is-on .account-proxy-track i {
  transform: translateX(16px);
}

.account-recharge {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.account-recharge-button {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--control);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.account-recharge-button:hover:not(:disabled) {
  background: #262b33;
}

.account-recharge-button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.account-recharge-contact {
  max-height: min(42dvh, 330px);
  overflow-y: auto;
  border-block: 1px solid var(--line);
  scrollbar-width: thin;
}

.account-contact-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  min-height: 36px;
  padding: 0 3px;
}

.account-contact-row + .account-contact-row {
  border-top: 1px solid var(--line);
}

.account-contact-row span {
  color: var(--muted);
  font-size: 11px;
}

.account-contact-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 模型价格沿用联系方式的紧凑分隔行，不额外套用卡片。 */
.account-recharge-pricing {
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.account-recharge-pricing h3 {
  margin: 0 3px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.account-pricing-row {
  min-width: 0;
  display: grid;
  border-top: 1px solid var(--line);
}

.account-pricing-row.is-selected .account-pricing-head {
  box-shadow: inset 2px 0 0 var(--signal);
  background: #f7f8fa;
}

.account-pricing-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 3px 7px;
}

.account-pricing-head > strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-pricing-mode {
  flex: 0 0 auto;
  color: var(--signal-dark);
  font-size: 10px;
  font-weight: 650;
}

.account-pricing-values {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.account-pricing-value {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px 6px 9px;
}

.account-pricing-value + .account-pricing-value {
  border-left: 1px solid var(--line);
}

.account-pricing-value span,
.account-pricing-empty {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.account-pricing-value strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-pricing-value.is-current span {
  color: var(--signal-dark);
}

.account-pricing-value.is-current strong {
  color: var(--ink);
}

.account-ledger-section {
  min-height: 0;
  overflow: hidden;
}

.account-ledger {
  height: calc(100% - 24px);
  overflow-y: auto;
  margin-top: 8px;
  scrollbar-width: thin;
}

.account-ledger-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.account-ledger-item time {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--control);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.current-username {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  padding: 6px 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.logout-button:hover {
  color: #b83b33;
}

.app-notice {
  position: absolute;
  right: 14px;
  bottom: calc(76px + var(--safe-bottom));
  left: 14px;
  z-index: 70;
  width: fit-content;
  max-width: calc(100% - 28px);
  margin: 0 auto;
  padding: 9px 12px;
  border: 1px solid #30353c;
  border-radius: 6px;
  background: rgba(16, 19, 24, 0.94);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 28px rgba(16, 19, 24, 0.18);
}

.conversation {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  /* 历史消息插入顶部时由脚本精确补偿滚动位置，避免浏览器重复锚定。 */
  overflow-anchor: none;
  padding: 22px 18px 30px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.empty-state {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding-bottom: 10vh;
  text-align: center;
}

.empty-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  box-shadow: inset 0 0 0 8px var(--surface), inset 0 0 0 9px var(--signal);
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: 700;
}

.empty-state h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(21px, 6vw, 26px);
  line-height: 1.25;
  letter-spacing: 0;
}

.message {
  width: 100%;
  min-width: 0;
  margin: 0 0 30px;
}

.message:last-child {
  margin-bottom: 0;
}

.message-meta {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

/* 助手标识使用紧凑圆形字标，让身份层级独立于正文内容。 */
.message.assistant .message-meta::before {
  content: "G";
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--control);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
}

.message.user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message.user .message-content {
  width: fit-content;
  max-width: min(84%, 540px);
  padding: 11px 14px;
  border: 0;
  border-radius: 14px 14px 4px 14px;
  background: #f0f2f4;
}

.message.user .message-meta {
  margin-right: 2px;
}

.message-content {
  min-width: 0;
  width: 100%;
  font-size: 15px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.message-content > :first-child {
  margin-top: 0;
}

.message-content > :last-child {
  margin-bottom: 0;
}

.message-content p,
.message-content ul,
.message-content ol,
.message-content blockquote,
.message-content pre,
.message-content table,
.message-content figure,
.message-content details {
  margin: 0 0 14px;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
  margin: 24px 0 10px;
  line-height: 1.35;
  letter-spacing: 0;
}

.message-content h1 { font-size: 23px; }
.message-content h2 { font-size: 20px; }
.message-content h3 { font-size: 17px; }
.message-content h4 { font-size: 15px; }

.message-content ul,
.message-content ol {
  padding-left: 22px;
}

.message-content li + li {
  margin-top: 5px;
}

.message-content a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* X 搜索结果采用无卡片时间线结构，避免正文和媒体被切成多个框。 */
.search-results {
  display: grid;
  gap: 0;
  margin-top: 4px;
}

.search-result-card {
  min-width: 0;
  overflow: visible;
  padding: 18px 0;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.search-result-card:first-child {
  padding-top: 10px;
}

.search-result-card:last-child {
  padding-bottom: 4px;
  border-bottom: 0;
}

.search-result-author {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.search-author-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--control);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
}

.search-author-identity {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  overflow: hidden;
  line-height: 1.25;
}

.search-author-identity strong,
.search-author-identity span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-author-identity strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 720;
}

.search-author-identity span {
  color: var(--muted);
  font-size: 11.5px;
}

/* 帖子正文、附加信息和媒体统一与作者名左边界对齐。 */
.search-result-card > :not(.search-result-author) {
  width: calc(100% - 37px);
  margin-left: 37px;
}

.search-result-card > p,
.search-result-card > ul,
.search-result-card > ol,
.search-result-card > blockquote {
  margin-bottom: 10px;
}

.search-result-text {
  color: #252a31;
  font-size: 14.5px;
  line-height: 1.62;
  white-space: normal;
}

.search-media-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 11px;
  background: transparent;
}

.message-media-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 14px;
  background: transparent;
}

.search-media-grid .media-frame,
.message-media-grid .media-frame {
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
}

.search-media-grid:not(:has(.media-frame:only-child)) .media-frame:not(:has(video, audio)),
.message-media-grid:not(:has(.media-frame:only-child)) .media-frame:not(:has(video, audio)) {
  aspect-ratio: 1;
}

.search-media-grid .media-frame img,
.message-media-grid .media-frame img {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  background: transparent;
  transition: filter 160ms ease;
}

.search-media-grid .media-frame img:hover,
.message-media-grid .media-frame img:hover {
  filter: brightness(0.92);
}

/* 图片模型通常返回单张主图，单图完整展示；多图仍使用紧凑网格。 */
.message-media-grid:has(.media-frame:only-child) {
  grid-template-columns: minmax(0, min(100%, 460px));
}

.message-media-grid:has(.media-frame:only-child) .media-frame img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(58dvh, 560px);
  aspect-ratio: auto;
  object-fit: contain;
}

.search-media-grid .media-frame:has(.video-player),
.search-media-grid .media-frame:has(audio),
.message-media-grid .media-frame:has(.video-player),
.message-media-grid .media-frame:has(audio) {
  grid-column: 1 / -1;
}

.search-media-grid .media-frame figcaption,
.message-media-grid .media-frame figcaption {
  display: none;
}

.search-result-card > .metadata-details + .search-media-grid {
  margin-top: 12px;
}

.message-content blockquote {
  padding-left: 12px;
  border-left: 3px solid var(--signal);
  color: #4b5058;
}

.message-content code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eceef1;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.88em;
}

.message-content pre {
  max-width: 100%;
  overflow: auto;
  padding: 13px 14px;
  border-radius: 6px;
  background: var(--code);
  color: var(--code-ink);
  font-size: 12px;
  line-height: 1.55;
}

.message-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.message-content table {
  width: 100%;
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 13px;
}

.message-content th,
.message-content td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.media-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111316;
}

/* 远程图片加载期间显示轻量指示器，加载完成或失败后由脚本移除状态。 */
.media-frame.is-media-loading::after,
.media-preview-stage.is-media-loading::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  content: "";
  animation: media-loading-spin 700ms linear infinite;
  pointer-events: none;
}

.media-frame.is-media-loading img,
.media-preview-stage.is-media-loading img {
  opacity: 0.08;
}

.media-frame.is-media-loading::after {
  border-color: rgba(28, 32, 38, 0.24);
  border-top-color: #303640;
}

.media-fallback {
  min-height: 132px;
  display: none;
  place-items: center;
  padding: 24px;
  background: #f0f2f5;
  color: var(--muted) !important;
  font-size: 12px;
  text-align: center;
  text-decoration: none !important;
}

.media-frame.is-media-error img {
  display: none;
}

.media-frame.is-media-error .media-fallback {
  display: grid;
}

.media-frame img {
  display: block;
  width: 100%;
  max-height: min(62dvh, 620px);
  object-fit: contain;
}

.media-preview-trigger {
  cursor: zoom-in;
}

/* 全屏预览覆盖浏览器视口，媒体始终完整显示在安全区域内。 */
.media-preview {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(9, 11, 14, 0.96);
  color: #fff;
}

.media-preview-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: calc(56px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

.media-preview-stage img,
.media-preview-stage video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.media-preview-stage video {
  width: min(100%, 1280px);
}

.media-preview-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 1;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(17, 20, 24, 0.84);
  color: #fff;
  cursor: pointer;
}

.media-preview-close svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #17191d;
  color: #fff;
}

.video-player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-status {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  color: #d9dce1;
  font-size: 12px;
  pointer-events: none;
}

.video-status::before {
  width: 20px;
  height: 20px;
  margin-bottom: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  content: "";
  animation: media-loading-spin 700ms linear infinite;
}

.video-player.is-video-loading .video-status,
.video-player.is-video-error .video-status {
  display: grid;
}

.video-player.is-video-error .video-status::before {
  display: none;
}

@keyframes media-loading-spin {
  to { transform: rotate(360deg); }
}

.video-player.is-video-loading .video-play-overlay,
.video-player.is-video-error .video-play-overlay {
  display: none;
}

.video-player.is-video-loading .video-controls,
.video-player.is-video-error .video-controls {
  opacity: 0.45;
  pointer-events: none;
}

.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: rgba(21, 23, 26, 0.84);
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.video-play-overlay::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 52%;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid #fff;
  transform: translate(-50%, -50%);
}

.video-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-width: 0;
  height: 48px;
  display: grid;
  grid-template-columns: 30px minmax(72px, 1fr) auto 30px 30px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  background: rgba(17, 19, 22, 0.9);
}

.video-control-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 13px;
  line-height: 1;
}

.video-control-button:hover {
  color: #ff7a6d;
}

.video-progress {
  --progress: 0%;
  width: 100%;
  height: 20px;
  min-width: 0;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.video-progress::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--signal) var(--progress), #6d7178 var(--progress));
}

.video-progress::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  appearance: none;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--signal);
}

.video-progress::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: #6d7178;
}

.video-progress::-moz-range-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--signal);
}

.video-progress::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--signal);
}

.video-time {
  color: #d9dce1;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.media-frame audio {
  display: block;
  width: calc(100% - 20px);
  margin: 10px;
}

.media-frame figcaption {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.media-frame figcaption a {
  flex: 0 0 auto;
}

.reasoning {
  padding: 0 0 0 12px;
  border-left: 2px solid var(--line);
  color: #555a62;
  font-size: 13px;
}

/* 搜索过程与思考过程共用紧凑折叠入口，正文出现后减少辅助信息占用。 */
.search-progress-details {
  margin-bottom: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.search-progress-details > summary {
  width: max-content;
  max-width: 100%;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}

.search-progress-details > summary::-webkit-details-marker { display: none; }

.search-progress-details > summary::before {
  display: inline-block;
  margin-right: 6px;
  content: '›';
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.search-progress-details[open] > summary::before { transform: rotate(90deg); }

/* 联网搜索进度使用无卡片时间线，展示可公开的拆解、查询与核对节点。 */
.web-search-progress {
  display: flex;
  min-height: 28px;
  margin-top: 8px;
  align-items: center;
  gap: 8px;
  color: #59616b;
  font-size: 12px;
  font-weight: 600;
}

.web-search-progress.has-timeline {
  display: grid;
  gap: 0;
  padding-left: 1px;
}

.web-search-progress-item {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 0 0 10px 22px;
  grid-template-columns: minmax(0, 1fr);
}

.web-search-progress-item:not(:last-child)::before {
  position: absolute;
  top: 13px;
  bottom: -1px;
  left: 5px;
  width: 1px;
  background: #d7dbe0;
  content: '';
}

.web-search-progress-item:last-child { padding-bottom: 0; }

.web-search-progress-marker {
  position: absolute;
  top: 5px;
  left: 1px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #7a828c;
  box-shadow: 0 0 0 1px #aeb4bc;
}

.web-search-progress-item.is-active .web-search-progress-marker {
  background: #236b52;
  box-shadow: 0 0 0 1px #43856d;
  animation: web-search-pulse 1.15s ease-in-out infinite;
}

.web-search-progress-content {
  display: grid;
  min-width: 0;
  gap: 2px;
  line-height: 1.45;
}

.web-search-progress-content strong {
  color: #3e454d;
  font-size: 12px;
  font-weight: 650;
}

.web-search-progress-content span {
  overflow-wrap: anywhere;
  color: #747b84;
  font-size: 11px;
  font-weight: 400;
}

.web-search-progress-indicator {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 1.5px solid #cfd4da;
  border-top-color: #59616b;
  border-radius: 50%;
  animation: web-search-rotate 720ms linear infinite;
}

@keyframes web-search-rotate {
  to { transform: rotate(360deg); }
}

@keyframes web-search-pulse {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .web-search-progress-indicator,
  .web-search-progress-item.is-active .web-search-progress-marker { animation: none; }
}

.reasoning summary,
.tool-details > summary,
.source-details > summary,
.metadata-details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.tool-details,
.source-details,
.metadata-details {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8fa;
}

.metadata-details {
  margin-top: 10px;
}

.metadata-details[open],
.tool-details[open],
.source-details[open] {
  background: #f3f4f6;
}

.metadata-list {
  margin: 10px 0 0 !important;
  padding-left: 20px !important;
  color: #535860;
  font-size: 12px;
}

.metadata-body {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  margin-top: 9px;
}

.metadata-body > * {
  margin: 0 !important;
}

.metadata-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.metadata-links a {
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: #414852;
  font-size: 11px;
  line-height: 1.2;
  text-decoration: none;
}

.metadata-details > summary,
.tool-details > summary,
.source-details > summary {
  min-height: 20px;
  display: flex;
  align-items: center;
  list-style: none;
}

.metadata-details > summary::-webkit-details-marker,
.tool-details > summary::-webkit-details-marker,
.source-details > summary::-webkit-details-marker {
  display: none;
}

.metadata-details > summary::before,
.tool-details > summary::before,
.source-details > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  margin-right: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}

.metadata-details[open] > summary::before,
.tool-details[open] > summary::before,
.source-details[open] > summary::before {
  transform: rotate(45deg) translate(-1px, -1px);
}

.search-result-card > .metadata-details {
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 37px;
  border-color: transparent;
  background: #f5f7f9;
}

.metadata-details > div {
  margin-top: 10px;
  color: #535860;
  font-size: 12px;
}

.tool-list {
  margin-top: 9px;
  border-top: 1px solid var(--line);
}

.tool-item {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.tool-item:last-child {
  border-bottom: 0;
}

.tool-item summary {
  color: #4f555e;
  cursor: pointer;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
}

.tool-item pre {
  margin: 8px 0 0;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 10px;
}

.source-list a {
  max-width: 100%;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.2;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-citation {
  color: #245b86;
  font-size: .85em;
  font-weight: 650;
  text-decoration: none;
}

.source-citation:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 工具和参考来源属于低频辅助信息，关闭时仅呈现为并排的小按钮。 */
.message-content > .tool-group,
.message-content > .source-details {
  width: auto;
  max-width: 100%;
  display: inline-block;
  margin: 18px 6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  vertical-align: top;
}

.message-content > .tool-group > summary,
.message-content > .source-details > summary {
  width: fit-content;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #dfe3e8;
  border-radius: 6px;
  background: #f7f8f9;
  color: #68717d;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.message-content > .tool-group > summary:hover,
.message-content > .source-details > summary:hover {
  border-color: #cbd1d8;
  background: #f1f3f5;
  color: #313740;
}

.message-content > .tool-group > summary::before,
.message-content > .source-details > summary::before {
  width: 5px;
  height: 5px;
  flex-basis: 5px;
  margin-right: 7px;
}

/* 展开后恢复完整行宽，详细参数和来源不会挤在狭窄按钮下方。 */
.message-content > .tool-group[open],
.message-content > .source-details[open] {
  width: 100%;
  display: block;
  margin-right: 0;
  background: transparent;
}

.message-content > .tool-group[open] > summary,
.message-content > .source-details[open] > summary {
  border-color: #cbd1d8;
  background: #f1f3f5;
  color: #313740;
}

.message-content > .tool-group .tool-list,
.message-content > .source-details .source-list {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #e4e7eb;
  border-radius: 6px;
  background: #fafbfc;
}

.message-content > .source-details .source-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.message-content > .source-details .source-list a {
  width: 100%;
  white-space: normal;
}

.message-content > .tool-group .tool-list {
  border-top: 1px solid #e4e7eb;
}

/* 搜索帖子结束后留出呼吸空间，避免辅助按钮贴住媒体区域。 */
.message-content > .search-results + .tool-group,
.message-content > .search-results + .source-details {
  margin-top: 22px;
}

@media (max-width: 390px) {
  .video-controls {
    grid-template-columns: 28px minmax(52px, 1fr) auto 28px 28px;
    gap: 4px;
    padding-inline: 7px;
  }

  .video-time {
    font-size: 9px;
  }
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal);
  animation: pulse 1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.error-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--signal);
  background: #fff1ef;
  color: #7e2c25;
}

.retry-button {
  flex: 0 0 auto;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: #7e2c25;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}

.retry-button:hover {
  color: var(--signal-dark);
}

.composer {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.input-wrap {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f7f8fa;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

/* 待发送图片固定为单行缩略图，数量较多时仅附件带内部滚动。 */
.attachment-strip {
  min-width: 0;
  height: 64px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 7px 8px 5px;
  scrollbar-width: thin;
}

.attachment-item {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.attachment-item img {
  width: 100%;
  height: 100%;
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  object-fit: cover;
}

.attachment-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid #f7f8fa;
  border-radius: 50%;
  background: var(--control);
  color: #fff;
  cursor: pointer;
}

.attachment-remove svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.composer-input-row {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.image-upload-button,
.web-search-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}

.image-upload-button:hover,
.web-search-button:hover {
  background: #eceff2;
  color: var(--ink);
}

.image-upload-button:disabled,
.web-search-button:disabled {
  cursor: default;
  opacity: 0.38;
}

.image-upload-button svg,
.web-search-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.web-search-button.is-active {
  background: var(--control);
  color: #fff;
}

.input-wrap:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(21, 23, 26, 0.08);
}

#messageInput {
  min-width: 0;
  flex: 1;
  width: 100%;
  max-height: 132px;
  min-height: 44px;
  resize: none;
  overflow-y: auto;
  padding: 11px 12px 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 22px;
}

#messageInput::placeholder {
  color: #92979f;
}

.send-button {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  position: relative;
  overflow: hidden;
  padding: 0;
  background: var(--control);
  color: #fff;
  transition: background 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.send-button:hover {
  background: #2b3138;
}

.send-button:active {
  transform: scale(0.94);
}

.send-button:disabled {
  cursor: default;
  opacity: 0.38;
}

.send-button.is-stop {
  background: #e95146;
}

.send-button.is-stop:hover {
  background: #d8453b;
}

.send-button-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 140ms ease, transform 180ms ease;
}

.send-button-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.2;
}

.send-button-icon--stop {
  opacity: 0;
  transform: scale(0.72);
}

.send-button-icon--stop svg {
  fill: currentColor;
  stroke: none;
}

.send-button.is-stop .send-button-icon--send {
  opacity: 0;
  transform: translateY(-4px) scale(0.72);
}

.send-button.is-stop .send-button-icon--stop {
  opacity: 1;
  transform: scale(1);
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

@media (max-width: 719px) {
  .search-media-grid,
  .message-media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell {
    border-inline: 0;
  }
}

@media (max-width: 420px) {
  .conversation {
    padding-inline: 12px;
  }

  .search-result-card {
    padding-block: 16px;
  }

  .search-author-identity {
    display: grid;
    gap: 1px;
  }
}

@media (min-width: 720px) {
  body {
    background: #eceef1;
  }

  .app-shell {
    box-shadow: 0 0 35px rgba(21, 23, 26, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
