/* ════════════════════════════════════════════════════════════════
   Manifold · 对话与视觉创作 —— “暗室观象台”
   墨蓝深底 + 流形等高线 · 磷光青（对话）/ 琥珀（生图）/ 余像蓝（视频）
   ════════════════════════════════════════════════════════════════ */

:root {
  --ink-0: #080c0f;        /* 最深底 */
  --ink-1: #0c1116;        /* 页面底 */
  --ink-2: #11181e;        /* 面板 */
  --ink-3: #161f27;        /* 浮起面板 */
  --hairline: rgba(122, 168, 159, 0.14);
  --hairline-strong: rgba(122, 168, 159, 0.28);

  --text-0: #dde4e1;       /* 主文字 */
  --text-1: #9aa8a3;       /* 次级 */
  --text-2: #5f6f6a;       /* 弱化 */

  --phos: #2dd4bf;         /* 磷光青：对话模式 */
  --phos-dim: rgba(45, 212, 191, 0.55);
  --phos-faint: rgba(45, 212, 191, 0.10);

  --amber: #f0b25a;        /* 琥珀：生图模式 */
  --amber-dim: rgba(240, 178, 90, 0.55);
  --amber-faint: rgba(240, 178, 90, 0.10);

  --motion: #a9b7ff;       /* 余像蓝：视频与时间轨 */
  --motion-dim: rgba(169, 183, 255, 0.55);
  --motion-faint: rgba(169, 183, 255, 0.10);

  --danger: #e0685f;
  --clay: #d08a6a;         /* anthropic 平台标 */
  --azure: #7aa2f0;        /* gemini 平台标 */

  --font-display: Georgia, "Times New Roman", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Segoe UI", -apple-system, sans-serif;
  --font-mono: "Cascadia Code", Consolas, "JetBrains Mono", ui-monospace, monospace;

  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-0);
  background-color: var(--ink-1);
  /* 流形等高线：三圈嵌套椭圆环面投影，极低透明度铺底 */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='560' viewBox='0 0 560 560'%3E%3Cg fill='none' stroke='%232dd4bf' stroke-opacity='0.045'%3E%3Cellipse cx='280' cy='280' rx='250' ry='250'/%3E%3Cellipse cx='280' cy='280' rx='250' ry='160'/%3E%3Cellipse cx='280' cy='280' rx='250' ry='86'/%3E%3Cellipse cx='280' cy='280' rx='250' ry='30'/%3E%3Cellipse cx='280' cy='280' rx='160' ry='250' stroke-opacity='0.025'/%3E%3Cellipse cx='280' cy='280' rx='86' ry='250' stroke-opacity='0.025'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 560px 560px;
  background-position: center -120px;
  background-repeat: repeat;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-size: 0.88em; }

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

:where(button, a, input, textarea, select):focus-visible {
  outline: 2px solid var(--phos);
  outline-offset: 2px;
}
.mode-image :where(button, input, textarea, select):focus-visible { outline-color: var(--amber); }
.mode-video :where(button, input, textarea, select):focus-visible { outline-color: var(--motion); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(122, 168, 159, 0.18); border-radius: 5px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(122, 168, 159, 0.32); border: 3px solid transparent; background-clip: content-box; }

/* ─────────────── 按钮基元 ─────────────── */
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--text-0);
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s, box-shadow .18s;
}
.btn:hover { border-color: var(--phos-dim); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--phos-faint);
  border-color: var(--phos-dim);
  color: var(--phos);
  letter-spacing: .12em;
}
.btn-primary:hover { background: rgba(45, 212, 191, 0.18); box-shadow: 0 0 24px rgba(45, 212, 191, 0.12); }

.btn-ghost { border-color: transparent; color: var(--text-1); }
.btn-ghost:hover { color: var(--text-0); border-color: var(--hairline); }

.btn-block { display: block; width: 100%; }
.btn-small { font-size: 12.5px; padding: 5px 12px; }

.btn-icon {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-1);
  cursor: pointer;
  transition: color .18s, border-color .18s;
  flex: none;
}
.btn-icon:hover { color: var(--phos); border-color: var(--hairline); }

.inline-link {
  background: none; border: none; padding: 0;
  color: var(--amber); cursor: pointer;
  border-bottom: 1px dashed var(--amber-dim);
  font-size: inherit;
}
.inline-link:hover { color: #ffd28e; }

input, textarea, select {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-0);
  background: var(--ink-0);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 10px 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--phos-dim);
  box-shadow: 0 0 0 3px var(--phos-faint);
}

/* ════════════════ 登录视图 ════════════════ */
.view-login {
  position: fixed; inset: 0;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(45, 212, 191, 0.06), transparent 70%),
    var(--ink-0);
}
.login-stage { width: 100%; display: flex; justify-content: center; padding: 24px; }

.login-card {
  width: 400px; max-width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 44px 40px 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: card-in .6s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

.wordmark { text-align: center; margin-bottom: 36px; }
.wordmark-glyph, .brand-glyph, .empty-glyph {
  stroke: var(--phos);
  stroke-width: 1.4;
}
.wordmark-glyph { width: 52px; height: 52px; margin-bottom: 10px; filter: drop-shadow(0 0 12px rgba(45, 212, 191, .35)); }
.wordmark h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--text-0);
}
.wordmark-sub {
  margin-top: 6px;
  font-size: 12.5px;
  letter-spacing: .42em;
  text-indent: .42em; /* 抵消最后一个字的字距，保持视觉居中 */
  color: var(--text-2);
}

.login-step { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; letter-spacing: .18em; color: var(--text-2); }

.totp-hint { font-size: 13.5px; color: var(--text-1); margin-bottom: 4px; }

.login-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0 10px;
  color: var(--text-2); font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--hairline);
}

#keyonly-form { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }

.login-error {
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--danger);
  background: rgba(224, 104, 95, 0.08);
  border: 1px solid rgba(224, 104, 95, 0.25);
  border-radius: var(--radius);
  padding: 9px 13px;
  white-space: pre-wrap;
  word-break: break-all;
}

.login-upstream {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-2);
}

/* ════════════════ 主视图布局 ════════════════ */
.view-app {
  display: flex;
  height: 100vh;
  height: 100dvh;          /* 移动端随软键盘收缩，避免输入框被顶到键盘下方；旧浏览器回退 100vh */
  overflow: hidden;
}

/* 移动端专属元素：桌面一律隐藏，仅 ≤760px 媒体查询里启用 */
.hdr-menu, .hdr-newchat, .hdr-modelpill, .sidebar-scrim,
.model-sheet, .model-sheet-scrim, .me-key { display: none; }

/* ─────────────── 侧栏 ─────────────── */
.sidebar {
  width: 264px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--ink-0);
  border-right: 1px solid var(--hairline);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
}
.brand-glyph { width: 26px; height: 26px; }
.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: .06em;
}

.btn-newchat {
  margin: 0 16px 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border-color: var(--hairline-strong);
  color: var(--text-0);
  background: var(--ink-2);
}
.btn-newchat:hover { border-color: var(--phos-dim); color: var(--phos); }
.newchat-plus { color: var(--phos); font-size: 17px; line-height: 1; }

.conv-list { flex: 1; overflow-y: auto; padding: 2px 10px; }

.conv-item {
  display: flex; align-items: center;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  color: var(--text-1);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.conv-item:hover { background: rgba(122, 168, 159, 0.06); color: var(--text-0); }
.conv-item.active {
  background: var(--phos-faint);
  border-left-color: var(--phos);
  color: var(--text-0);
}
.conv-item-title {
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-item-del {
  flex: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 15px; line-height: 1;
  padding: 2px 4px; border-radius: 4px;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.conv-item:hover .conv-item-del { opacity: 1; }
.conv-item-del:hover { color: var(--danger); }

.sidebar-footer {
  border-top: 1px solid var(--hairline);
  padding: 14px 20px 16px;
}
.me-line { display: flex; align-items: center; gap: 8px; }
.me-dot {
  flex: none;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--phos);
  box-shadow: 0 0 8px var(--phos-dim);
}
.me-label {
  flex: 1; min-width: 0;
  font-size: 12.5px; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-logout { flex: none; }

/* ─────────────── 主区 ─────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-header {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(12, 17, 22, 0.7);
  backdrop-filter: blur(8px);
}
.header-title {
  font-family: var(--font-display);
  font-size: 16.5px;
  letter-spacing: .03em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.header-controls { display: flex; align-items: center; gap: 12px; flex: none; }

.model-pick { display: flex; align-items: center; gap: 8px; }
.model-pick-label { font-size: 12px; letter-spacing: .15em; color: var(--text-2); }
.model-pick select {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 10px;
  max-width: 280px;
}

.key-chip {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--ink-2);
  color: var(--text-1);
  cursor: pointer;
  max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color .18s, color .18s;
}
.key-chip:hover { border-color: var(--phos-dim); color: var(--phos); }
.key-chip.unset { border-color: rgba(224, 104, 95, .4); color: var(--danger); }

/* ─────────────── 消息区 ─────────────── */
.messages-scroll { flex: 1; overflow-y: auto; }
.messages {
  max-width: 780px;
  margin: 0 auto;
  padding: 36px 24px 24px;
}

.empty-state {
  text-align: center;
  padding-top: 12vh;
  animation: card-in .7s .1s cubic-bezier(.2,.9,.3,1) both;
}
.empty-glyph { width: 64px; height: 64px; opacity: .5; margin-bottom: 18px; }
.empty-title {
  font-family: var(--font-display);
  font-size: 21px;
  margin-bottom: 10px;
}
.empty-hint { font-size: 13.5px; color: var(--text-1); max-width: 420px; margin: 0 auto; }

.msg { margin-bottom: 28px; animation: msg-in .3s ease both; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* 用户消息：右侧墨片（列向堆叠，让时间小字落在气泡下方并右对齐） */
.msg-user { display: flex; flex-direction: column; align-items: flex-end; }
.msg-user .msg-body {
  max-width: 82%;
  background: var(--ink-3);
  border: 1px solid var(--hairline);
  border-radius: 14px 14px 4px 14px;
  padding: 12px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 助手消息：通栏 + 角色标记 */
.msg-assistant .msg-role {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.msg-role-glyph {
  color: var(--phos);
  font-size: 13px;
  text-shadow: 0 0 10px var(--phos-dim);
}
.msg-assistant.is-image .msg-role-glyph { color: var(--amber); text-shadow: 0 0 10px var(--amber-dim); }
.msg-assistant.is-video .msg-role-glyph { color: var(--motion); text-shadow: 0 0 10px var(--motion-dim); }
.msg-role-name {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  color: var(--text-2);
}
.msg-assistant .msg-body {
  border-left: 2px solid var(--phos-faint);
  padding-left: 16px;
  word-break: break-word;
}
.msg-assistant.is-image .msg-body { border-left-color: var(--amber-faint); }
.msg-assistant.is-video .msg-body { border-left-color: var(--motion-faint); }

/* 一行小字：发送时间 / 回复完成时间（绝对日期） */
.msg-time {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--text-2);
  opacity: .7;
  margin-top: 6px;
}
.msg-assistant .msg-time { padding-left: 16px; }   /* 与正文左缩进对齐 */

/* 流式光标 */
.stream-caret {
  display: inline-block;
  width: 8px; height: 16px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--phos);
  animation: caret-blink 1s steps(2) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

/* 消息中的图片 */
.msg-images { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-top: 10px; }
.msg-img-wrap { display: inline-grid; flex: 0 0 auto; max-width: 100%; }
.msg-images img {
  grid-area: 1 / 1;
  max-width: 320px; max-height: 320px;
  min-height: 120px;                 /* 占位高度：加载前撑开，让屏外图真正不可见 → loading=lazy 生效 */
  background: var(--hairline);        /* 加载中的骨架底色 */
  border-radius: 10px;
  border: 1px solid var(--hairline);
  display: block;
  cursor: zoom-in;
}
.msg-user .msg-images img { max-width: 180px; max-height: 180px; }
.img-download {
  grid-area: 1 / 1;
  justify-self: end;
  align-self: end;
  margin: 0 8px 8px 0;
  z-index: 1;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(8, 12, 15, 0.78);
  border: 1px solid var(--hairline-strong);
  color: var(--text-0);
  cursor: pointer;
  text-decoration: none;
  opacity: 0;
  transition: opacity .15s;
}
.msg-img-wrap:hover .img-download { opacity: 1; }

/* 生图等待环 */
.gen-pending { display: flex; align-items: center; gap: 14px; padding: 6px 0; }
.gen-rings { width: 44px; height: 44px; position: relative; flex: none; }
.gen-rings span {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.4px solid var(--amber-dim);
  animation: ring-pulse 2.2s ease-out infinite;
}
.gen-rings span:nth-child(2) { animation-delay: .55s; }
.gen-rings span:nth-child(3) { animation-delay: 1.1s; }
@keyframes ring-pulse {
  from { transform: scale(.25); opacity: .9; }
  to   { transform: scale(1); opacity: 0; }
}
.gen-pending-text { font-size: 13.5px; color: var(--text-1); }
.gen-pending-timer { font-family: var(--font-mono); color: var(--amber); }

/* 视频任务：一条时间码轨道贯穿等待态，成片保持原生控件与移动端 playsinline。 */
.video-pending {
  width: min(100%, 620px);
  padding: 16px 16px 14px;
  border: 1px solid rgba(169, 183, 255, .2);
  border-radius: 12px;
  background: rgba(169, 183, 255, .035);
  overflow: hidden;
}
.video-time-rail { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; height: 18px; align-items: start; border-top: 1px solid var(--motion-dim); }
.video-time-rail span { width: 1px; height: 8px; background: var(--motion-dim); position: relative; }
.video-time-rail span:last-child { justify-self: end; }
.video-pending-copy { display: flex; align-items: center; gap: 9px; margin-top: 8px; color: var(--text-1); font-size: 13.5px; }
.video-live-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--motion); box-shadow: 0 0 12px var(--motion-dim); animation: video-live 1.8s ease-in-out infinite; }
@keyframes video-live { 50% { opacity: .35; transform: scale(.72); } }
.msg-video-wrap { width: min(100%, 680px); margin: 2px 0 0; }
.msg-video-wrap video { display: block; width: 100%; max-height: min(62vh, 680px); background: #020304; border: 1px solid rgba(169, 183, 255, .25); border-radius: 12px; }
.msg-video-wrap figcaption { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 8px; }
.video-spec { color: var(--text-2); }
.video-download { display: inline-flex; align-items: center; min-height: 36px; color: var(--motion); font-size: 12px; text-decoration: none; border-bottom: 1px dashed var(--motion-dim); white-space: nowrap; }
.video-download:hover { color: var(--text-0); }

/* 流式生图的半成品预览：逐步成形 */
.gen-partial {
  display: block;
  margin-top: 12px;
  max-width: 320px; max-height: 320px;
  border-radius: 10px;
  border: 1px solid var(--amber-dim);
  opacity: .88;
  animation: partial-in .4s ease;
}
@keyframes partial-in {
  from { opacity: 0; filter: blur(6px); }
  to   { opacity: .88; filter: none; }
}

/* 错误气泡 */
.msg-error .msg-body {
  border-left: 2px solid rgba(224, 104, 95, .5);
  padding-left: 16px;
  color: var(--danger);
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* markdown 内容 */
.md p { margin-bottom: 10px; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 18px 0 10px;
  line-height: 1.4;
}
.md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; } .md h4 { font-size: 15px; }
.md ul, .md ol { padding-left: 24px; margin-bottom: 10px; }
.md li { margin-bottom: 4px; }
.md a { color: var(--phos); text-decoration: none; border-bottom: 1px dashed var(--phos-dim); }
.md blockquote {
  border-left: 2px solid var(--hairline-strong);
  padding-left: 14px;
  color: var(--text-1);
  margin: 10px 0;
}
.md code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--ink-0);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 1.5px 6px;
}
.md pre {
  background: var(--ink-0);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 12px 0;
}
.md pre code { background: none; border: none; padding: 0; font-size: 13px; line-height: 1.6; }
.md table { border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.md th, .md td { border: 1px solid var(--hairline-strong); padding: 6px 12px; }
.md th { background: var(--ink-2); font-weight: 600; }
.md img { max-width: 100%; border-radius: 10px; border: 1px solid var(--hairline); }
.md hr { border: none; border-top: 1px solid var(--hairline); margin: 16px 0; }

/* ─────────────── 输入区 ─────────────── */
.composer-zone {
  flex: none;
  padding: 10px 24px 22px;
  background: linear-gradient(transparent, var(--ink-1) 36%);
}
.composer {
  max-width: 780px;
  margin: 0 auto;
  background: var(--ink-2);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  padding: 10px 12px 8px;
  transition: border-color .3s, box-shadow .3s;
}
.composer:focus-within {
  border-color: var(--phos-dim);
  box-shadow: 0 0 0 3px var(--phos-faint), 0 12px 40px rgba(0, 0, 0, .35);
}

/* 生图模式：整个输入区域转为琥珀 */
.composer.mode-image { border-color: var(--amber-dim); }
.composer.mode-image:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-faint), 0 12px 40px rgba(0, 0, 0, .35);
}
.composer.mode-image .btn-send {
  background: var(--amber-faint);
  border-color: var(--amber-dim);
  color: var(--amber);
}
.composer.mode-image .btn-send:hover { background: rgba(240, 178, 90, 0.2); }

/* 视频模式：不重画产品，只把输入框变成一段可读的时间轨。 */
.composer.mode-video { border-color: var(--motion-dim); }
.composer.mode-video:focus-within {
  border-color: var(--motion);
  box-shadow: 0 0 0 3px var(--motion-faint), 0 12px 40px rgba(0, 0, 0, .35);
}
.composer.mode-video .btn-send { background: var(--motion-faint); border-color: var(--motion-dim); color: var(--motion); }
.composer.mode-video .btn-send:hover { background: rgba(169, 183, 255, .18); }

.composer-row { display: flex; align-items: flex-end; gap: 8px; }

#input-box {
  flex: 1;
  min-width: 0;
  resize: none;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 8px 6px;
  max-height: 220px;
  line-height: 1.6;
}
#input-box:focus { box-shadow: none; }

/* 生图参数：独立成行，置于输入框上方（桌面 + 移动端一致，彻底避免遮挡输入框）*/
.imagegen-controls {
  display: flex;
  gap: 8px;
  padding: 2px 4px 8px;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--amber-dim);
}
.imagegen-controls select {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 8px;
  border-color: var(--amber-dim);
  color: var(--amber);
  background: var(--ink-0);
}

.videogen-controls {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(169, 183, 255, .28);
}
.videogen-controls::after {
  content: '';
  position: absolute; left: 4px; right: 4px; bottom: -1px; height: 6px;
  background: repeating-linear-gradient(90deg, var(--motion-dim) 0 1px, transparent 1px 38px);
  opacity: .55; pointer-events: none;
}
.videogen-controls select {
  position: relative;
  font-family: var(--font-mono); font-size: 12.5px;
  padding: 7px 9px; color: var(--motion);
  border-color: rgba(169, 183, 255, .34); background: var(--ink-0);
}
.video-rail-mark { color: var(--motion-dim); letter-spacing: .04em; flex: none; }
.video-rail-note { margin-left: auto; color: var(--text-2); font-size: 11.5px; white-space: nowrap; }

.btn-send {
  flex: none;
  white-space: nowrap;
  background: var(--phos-faint);
  border: 1px solid var(--phos-dim);
  color: var(--phos);
  font-size: 14px;
  letter-spacing: .1em;
  padding: 9px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .18s, box-shadow .18s, border-color .3s, color .3s;
}
.btn-send:hover { background: rgba(45, 212, 191, 0.18); }
.btn-send.stop {
  background: rgba(224, 104, 95, 0.1);
  border-color: rgba(224, 104, 95, 0.5);
  color: var(--danger);
}

.composer-hint {
  font-size: 11.5px;
  color: var(--text-2);
  padding: 6px 8px 2px;
  transition: color .3s;
}
.composer.mode-image .composer-hint { color: var(--amber-dim); }
.composer.mode-video .composer-hint { color: var(--motion-dim); }

/* 附件预览 */
.attach-previews {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 6px 6px 10px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 6px;
}
.attach-chip { position: relative; }
.attach-chip img {
  width: 62px; height: 62px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--hairline-strong);
  display: block;
}
.attach-chip button {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--ink-0);
  color: var(--text-1);
  font-size: 12px; line-height: 1;
  cursor: pointer;
}
.attach-chip button:hover { color: var(--danger); border-color: var(--danger); }

/* 文本文件附件 chip（输入区预览） */
.attach-chip.attach-file { min-width: 0; }
.attach-file-info {
  display: flex; align-items: center; gap: 8px;
  max-width: 220px; height: 62px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--hairline-strong);
  background: var(--ink-0);
}
.attach-file-icon { font-size: 20px; line-height: 1; flex: none; }
.attach-file-meta { display: flex; flex-direction: column; min-width: 0; }
.attach-file-name {
  font-size: 12.5px; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attach-file-size { font-size: 11px; color: var(--text-2); }

/* 消息气泡里的文件附件卡片 */
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.msg-file-chip {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 240px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--hairline-strong);
  background: var(--ink-0);
  color: var(--text-1);
  font-size: 12.5px; text-decoration: none;
}
a.msg-file-chip:hover { border-color: var(--phos-dim); color: var(--phos); }
.msg-file-icon { font-size: 16px; line-height: 1; flex: none; }
.msg-file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─────────────── 设置弹层 ─────────────── */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(5, 8, 10, 0.72);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
}
.modal {
  width: 480px; max-width: calc(100vw - 40px);
  max-height: 80vh; overflow-y: auto;
  background: var(--ink-2);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  padding: 28px 28px 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
  animation: card-in .35s cubic-bezier(.2,.9,.3,1) both;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 20px;
}
.modal-section { margin-bottom: 22px; }
.modal-section-title {
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--text-2);
  font-weight: 400;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.modal-text { font-size: 13.5px; color: var(--text-1); margin-bottom: 10px; }

.key-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.key-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.key-row:hover { border-color: var(--phos-dim); }
.key-row.selected { border-color: var(--phos); background: var(--phos-faint); }
.key-row-name {
  flex: 1; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.key-row-masked { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2); }
.key-row-platform {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  color: var(--text-1);
}
.key-row-platform.openai { border-color: var(--phos-dim); color: var(--phos); }

.key-paste-row { display: flex; gap: 8px; }
.key-paste-row input { flex: 1; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ════════════════ 设置弹层（重设计 · sx-*） ════════════════ */
.sx-modal {
  width: 480px; max-width: calc(100vw - 40px);
  max-height: 86vh; overflow: hidden auto;
  background: var(--ink-2);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
  animation: card-in .4s cubic-bezier(.2,.9,.3,1) both;
}
.sx-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 19px 22px 17px;
  border-bottom: 1px solid var(--hairline);
}
.sx-title { display: flex; align-items: center; gap: 11px; }
.sx-title-ic { width: 21px; height: 21px; color: var(--phos); flex: none; }
.sx-title h2 { font-family: var(--font-body); font-size: 18px; font-weight: 500; letter-spacing: .04em; color: var(--text-0); }
.sx-close {
  width: 32px; height: 32px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--text-2); cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.sx-close:hover { color: var(--text-0); border-color: var(--hairline); background: var(--ink-3); }
.sx-close svg { width: 17px; height: 17px; }

.sx-body { padding: 20px 22px 6px; }
.sx-section { margin-bottom: 24px; }
.sx-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.sx-sec-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-2); font-weight: 400;
}
.sx-sec-title svg { width: 14px; height: 14px; color: var(--text-1); }

.sx-refresh {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-size: 12px; color: var(--text-1);
  background: transparent; border: 1px solid var(--hairline);
  border-radius: 999px; padding: 4px 11px 4px 9px; cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.sx-refresh:hover { color: var(--phos); border-color: var(--phos-dim); background: var(--phos-faint); }
.sx-refresh svg { width: 13px; height: 13px; transition: transform .6s cubic-bezier(.3,.8,.3,1); }
.sx-refresh:hover svg { transform: rotate(-180deg); }

.sx-hint { font-size: 12.5px; color: var(--text-2); margin: -3px 0 13px; line-height: 1.65; }
.sx-hint code { font-family: var(--font-mono); font-size: .9em; color: var(--phos); background: var(--phos-faint); padding: 1px 6px; border-radius: 5px; }

.sx-keylist { display: flex; flex-direction: column; gap: 7px; }
.sx-empty { font-size: 12.5px; color: var(--text-2); padding: 4px 2px; line-height: 1.6; }
.sx-key {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 10px 13px;
  background: var(--ink-1);
  border: 1px solid var(--hairline);
  border-radius: 11px;
  cursor: pointer; font-family: inherit;
  transition: border-color .16s, background .16s;
}
.sx-key:hover { border-color: var(--phos-dim); background: var(--ink-3); }
.sx-key.selected { border-color: var(--phos); background: var(--phos-faint); }
.sx-key.is-manual { cursor: default; }

.sx-key-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-2); }
.sx-key.is-openai    .sx-key-dot { background: var(--phos); box-shadow: 0 0 8px var(--phos-dim); }
.sx-key.is-anthropic .sx-key-dot { background: var(--clay); box-shadow: 0 0 8px rgba(208,138,106,.55); }
.sx-key.is-gemini    .sx-key-dot { background: var(--azure); box-shadow: 0 0 8px rgba(122,162,240,.55); }
.sx-key.is-other     .sx-key-dot { background: var(--text-2); }
.sx-key.is-manual    .sx-key-dot { background: var(--text-1); }

.sx-key-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sx-key-name { font-size: 14px; color: var(--text-0); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-key-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); letter-spacing: .02em; }

.sx-plat {
  flex: none;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .03em;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--hairline-strong); color: var(--text-1);
}
.sx-plat.openai    { color: var(--phos); border-color: var(--phos-dim); background: var(--phos-faint); }
.sx-plat.anthropic { color: var(--clay); border-color: rgba(208,138,106,.42); background: rgba(208,138,106,.09); }
.sx-plat.gemini    { color: var(--azure); border-color: rgba(122,162,240,.42); background: rgba(122,162,240,.09); }
.sx-plat.manual { display: inline-flex; align-items: center; gap: 4px; color: var(--text-1); border-color: var(--hairline-strong); background: rgba(255,255,255,.025); }
.sx-plat.manual svg { width: 11px; height: 11px; }

.sx-key-check {
  flex: none; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--phos); opacity: 0; transform: scale(.5);
  transition: opacity .18s, transform .2s cubic-bezier(.2,1.4,.4,1);
}
.sx-key.selected .sx-key-check { opacity: 1; transform: scale(1); }
.sx-key-check svg { width: 17px; height: 17px; }

.sx-paste { display: flex; align-items: stretch; gap: 8px; margin-top: 13px; }
.sx-paste-field { position: relative; flex: 1; }
.sx-paste-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-2); pointer-events: none; }
.sx-paste-field input { width: 100%; padding-left: 37px; }
.sx-use { flex: none; padding: 0 20px; display: inline-flex; align-items: center; }

.sx-conn {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  background: var(--ink-1);
  border: 1px solid var(--hairline);
  border-radius: 11px;
}
.sx-conn-status { width: 8px; height: 8px; border-radius: 50%; flex: none; position: relative; background: var(--phos); box-shadow: 0 0 8px var(--phos-dim); }
.sx-conn-status::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--phos-dim); opacity: 0; animation: sx-pulse 2.4s ease-out infinite; }
@keyframes sx-pulse { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.8); opacity: 0; } }
.sx-conn-label { font-size: 13px; color: var(--text-1); flex: none; }
.sx-conn-url {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-0);
  padding: 3px 11px; border-radius: 7px;
  background: var(--ink-3); border: 1px solid var(--hairline);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62%;
}

.sx-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--hairline);
}

/* 图片放大查看 */
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(5, 8, 10, 0.88);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 92vw; max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, .8);
}

/* ─────────────── 拖拽上传遮罩 ─────────────── */
.drop-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 12, 15, 0.74);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;            /* 不拦截 drop（让 window 监听接管），也避免遮罩自身触发 dragenter 抖动 */
  animation: drop-fade 120ms ease-out;
}
@keyframes drop-fade { from { opacity: 0; } to { opacity: 1; } }
.drop-overlay-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 60px;
  border: 2px dashed var(--phos-dim);
  border-radius: 18px;
  background: var(--phos-faint);
  color: var(--phos);
  text-align: center;
}
.drop-overlay-card svg { width: 40px; height: 40px; opacity: .9; }
.drop-overlay-card p { font-size: 17px; font-weight: 600; color: var(--text-0); }
.drop-overlay-card span { font-size: 13px; color: var(--text-1); }

/* ─────────────── 窄屏 · 移动端（参考 GPT/Claude App）─────────────── */
@media (max-width: 760px) {
  /* 侧栏 → 抽屉：默认藏在屏幕左外，drawer-open 时滑入 */
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: min(86vw, 330px);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.3, .8, .3, 1);
    padding-top: env(safe-area-inset-top);
  }
  .view-app.drawer-open .sidebar {
    transform: none;
    box-shadow: 0 0 40px rgba(0, 0, 0, .5);
  }

  /* 抽屉背板：点击收起；低于设置弹层(z60)，高于正文 */
  .sidebar-scrim {
    display: block;
    position: fixed; inset: 0;
    z-index: 45;
    background: rgba(5, 8, 10, .6);
    opacity: 0; pointer-events: none;
    transition: opacity .26s;
  }
  .view-app.drawer-open .sidebar-scrim { opacity: 1; pointer-events: auto; }

  /* ── 顶栏：三区网格——菜单 / 模型药丸(居中) / 新建 ── */
  .main-header {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top));
  }
  .header-title { display: none; }          /* 标题让位给模型药丸；标题在抽屉会话列表里可见 */
  .header-controls { display: none; }        /* 桌面的 select + key-chip 收起 */
  .hdr-menu, .hdr-newchat { display: inline-flex; }
  .hdr-modelpill {
    display: inline-flex; align-items: center; gap: 6px;
    justify-self: center; max-width: 100%;
    padding: 7px 14px; border-radius: 999px;
    background: var(--ink-2); border: 1px solid var(--hairline-strong);
    color: var(--text-0); cursor: pointer;
    transition: border-color .15s;
  }
  .hdr-modelpill:active { border-color: var(--phos-dim); }
  .hdr-modelpill .mn {
    font-family: var(--font-mono); font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .hdr-modelpill svg { width: 15px; height: 15px; flex: none; color: var(--text-2); }
  .hdr-modelpill.is-image { border-color: var(--amber-dim); }
  .hdr-modelpill.is-image .mn { color: var(--amber); }
  .hdr-modelpill.is-video { border-color: var(--motion-dim); }
  .hdr-modelpill.is-video .mn { color: var(--motion); }

  /* 防 iOS 聚焦自动放大页面（输入控件字号须 ≥16px）*/
  #input-box, input, select, textarea { font-size: 16px; }

  /* 触摸目标放大；无 hover 环境下删除按钮常显 */
  .btn-icon { width: 44px; height: 44px; }
  .conv-item { padding: 12px 12px; }
  .conv-item-del { opacity: 1; }
  .img-download { opacity: 1; }
  .btn-send { padding: 11px 18px; }

  /* 正文与输入区：避让底部安全区 */
  .messages { padding: 20px 14px 12px; }
  .composer-zone { padding: 8px 12px calc(14px + env(safe-area-inset-bottom)); }
  .imagegen-controls,
  .videogen-controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
  }
  .imagegen-controls::-webkit-scrollbar,
  .videogen-controls::-webkit-scrollbar { display: none; }
  .imagegen-controls select,
  .videogen-controls select { flex: 0 0 auto; min-height: 44px; scroll-snap-align: start; }
  .video-rail-mark { min-width: 48px; }
  .video-rail-note { margin-left: 4px; padding-right: 10px; }
  .msg-video-wrap { width: 100%; }
  .msg-video-wrap video { max-height: 64dvh; border-radius: 10px; }
  .msg-video-wrap figcaption { align-items: flex-start; }
  .video-download { min-height: 44px; }
  .video-pending { width: 100%; padding: 14px 12px 12px; }

  /* 视觉微调：用户气泡更宽、空态上移 */
  .msg-user .msg-body { max-width: 88%; }
  .empty-state { padding-top: 8vh; }

  /* ── 抽屉底部：Key/设置入口（顶栏 key-chip 已收起）── */
  .me-key {
    display: flex; align-items: center; gap: 8px; width: 100%;
    margin-top: 8px; padding: 10px 11px;
    border-radius: 10px; background: var(--ink-2);
    border: 1px solid var(--hairline);
    color: var(--text-1); cursor: pointer; text-align: left;
  }
  .me-key:active { border-color: var(--phos-dim); }
  .me-key.unset { border-color: rgba(224, 104, 95, .4); color: var(--danger); }
  .me-key-dot { width: 7px; height: 7px; border-radius: 50%; flex: none;
    background: var(--phos); box-shadow: 0 0 8px var(--phos-dim); }
  .me-key.unset .me-key-dot { background: var(--danger); box-shadow: none; }
  .me-key-label { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .me-key-gear { width: 17px; height: 17px; flex: none; color: var(--text-2); }

  /* ── 底部模型选择弹层 + 背板 ── */
  .model-sheet-scrim {
    display: block; position: fixed; inset: 0; z-index: 60;
    background: rgba(5, 8, 10, .6);
    opacity: 0; pointer-events: none; transition: opacity .22s;
  }
  .model-sheet-scrim.open { opacity: 1; pointer-events: auto; }
  .model-sheet {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
    background: var(--ink-2); border-top: 1px solid var(--hairline-strong);
    border-radius: 20px 20px 0 0;
    padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
    max-height: 70vh; overflow-y: auto;
    transform: translateY(100%); transition: transform .28s cubic-bezier(.3, .85, .3, 1);
  }
  .model-sheet.open { transform: none; }
  .sheet-grip { width: 38px; height: 4px; border-radius: 2px;
    background: var(--hairline-strong); margin: 4px auto 12px; }
  .sheet-title { font-size: 12px; letter-spacing: .18em; color: var(--text-2); padding: 0 4px 8px; }
  .sheet-list { display: flex; flex-direction: column; gap: 2px; }
  .sheet-mdl {
    display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
    padding: 13px 12px; border-radius: 12px; border: 1px solid transparent;
    background: transparent; cursor: pointer; color: var(--text-0);
  }
  .sheet-mdl:active { background: var(--ink-3); }
  .sheet-mdl.sel { background: var(--phos-faint); border-color: var(--phos-dim); }
  .sheet-mdl.is-image.sel { background: var(--amber-faint); border-color: var(--amber-dim); }
  .sheet-mdl.is-video.sel { background: var(--motion-faint); border-color: var(--motion-dim); }
  .sheet-mdl-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--text-2); }
  .sheet-mdl.is-image .sheet-mdl-dot { background: var(--amber); box-shadow: 0 0 8px var(--amber-dim); }
  .sheet-mdl.is-video .sheet-mdl-dot { background: var(--motion); box-shadow: 0 0 8px var(--motion-dim); }
  .sheet-mdl.is-chat .sheet-mdl-dot { background: var(--phos); box-shadow: 0 0 8px var(--phos-dim); }
  .sheet-mdl-name { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sheet-mdl.sel .sheet-mdl-name { color: var(--phos); }
  .sheet-mdl.is-image.sel .sheet-mdl-name { color: var(--amber); }
  .sheet-mdl.is-video.sel .sheet-mdl-name { color: var(--motion); }
  .sheet-mdl-check { width: 18px; height: 18px; flex: none; color: var(--phos); opacity: 0; }
  .sheet-mdl.sel .sheet-mdl-check { opacity: 1; }
  .sheet-mdl.is-image.sel .sheet-mdl-check { color: var(--amber); }
  .sheet-mdl.is-video.sel .sheet-mdl-check { color: var(--motion); }
}

@media (max-width: 760px) and (max-height: 560px) and (orientation: landscape) {
  .main-header { padding-top: 5px; padding-bottom: 5px; }
  .messages { padding-top: 12px; }
  .composer-zone { padding-top: 5px; padding-bottom: calc(7px + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .msg-video-wrap video { max-height: 52dvh; }
}

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