/* ---------- 图片预览 ---------- */
#preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  /* dvh 兜底：万一键盘态残留把视口算矮了，浮层也要顶满整屏，不能露出底色 */
  height: 100vh;
  height: 100dvh;
  height: var(--vh100, 100dvh);
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 16, 0.92);
  opacity: 0;
  transition: opacity 0.22s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
#preview.show {
  display: flex;
  opacity: 1;
}
#preview img {
  max-width: 94vw;
  max-height: 88vh;
  border-radius: 8px;
  animation: zoomIn 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
}
#preview-close {
  position: absolute;
  top: calc(14px + var(--safe-t));
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
#preview-qr {
  position: absolute;
  left: 50%;
  bottom: calc(26px + var(--safe-b));
  transform: translateX(-50%);
  padding: 11px 22px;
  border: none;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  color: #1b2233;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
#preview-qr:active {
  transform: translateX(-50%) scale(0.97);
}
#preview-qr[hidden] {
  display: none;
}

/* ---------- 底部抽屉 ---------- */
#sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 88;
  background: rgba(10, 14, 22, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
#sheet-mask.show {
  opacity: 1;
  pointer-events: auto;
}
#sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  padding: 8px 12px calc(12px + var(--safe-b));
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.3, 0.85, 0.3, 1);
}
#sheet.show {
  transform: none;
}
#sheet-inner {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  max-width: 440px;
  margin: 0 auto;
  box-shadow: 0 -4px 30px rgba(16, 24, 40, 0.18);
}
.sheet-grab {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #e3e7ee;
  margin: 9px auto 4px;
}
.sheet-title {
  font-size: 13px;
  color: #98a1b0;
  text-align: center;
  padding: 8px 16px 10px;
}
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px 18px;
  border: none;
  background: #fff;
  text-align: left;
  font-size: 16px;
  color: var(--ink);
}
.sheet-item:active {
  background: #f4f5f8;
}
.sheet-item + .sheet-item {
  border-top: 1px solid var(--line);
}
.sheet-item.danger {
  color: #e5484d;
  justify-content: center;
}
.sheet-cancel {
  width: 100%;
  margin-top: 8px;
  padding: 15px;
  border: none;
  border-radius: 16px;
  background: #fff;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  box-shadow: 0 -2px 20px rgba(16, 24, 40, 0.1);
}

/* ---------- 修改头像昵称 ---------- */
#profile-mask {
  position: fixed;
  inset: 0;
  z-index: 92;
  background: rgba(10, 14, 22, 0.38);
}
#profile-sheet {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-b));
  z-index: 93;
  max-width: 440px;
  margin: 0 auto;
  padding: 16px 16px 14px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.18);
}
#profile-sheet[hidden],
#profile-mask[hidden] {
  display: none;
}
.profile-title {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}
.profile-avas {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}
.profile-avas button {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 16px;
  overflow: hidden;
  background: #eef2fb;
}
.profile-avas button.on {
  border-color: var(--blue);
}
.profile-avas img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-upload,
#profile-nick,
.profile-actions button {
  width: 100%;
  border-radius: 12px;
  font-size: 15px;
}
.profile-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin-bottom: 10px;
  background: #f4f7ff;
  color: var(--blue);
}
#profile-nick {
  height: 42px;
  border: 1px solid #e3e7ee;
  padding: 0 12px;
  margin-bottom: 12px;
}
.profile-actions {
  display: flex;
  gap: 8px;
}
.profile-actions button {
  height: 42px;
  border: 0;
}
#profile-cancel {
  background: #f3f5f8;
  color: #5c667a;
}
#profile-save {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}

/* ---------- 轻提示 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translate(-50%, 12px);
  max-width: 82vw;
  padding: 10px 16px;
  background: rgba(24, 28, 36, 0.9);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.45;
  border-radius: 12px;
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  text-align: center;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 添加到主屏幕引导 ---------- */
#a2hs {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
}
#a2hs.show {
  display: block;
}
.a2hs-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.64);
  animation: fadeIn 0.2s ease;
}
.a2hs-card {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(var(--safe-b) + 22px);
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border-radius: 22px;
  padding: 18px 18px 12px;
  /* iOS 26 的步骤多一步，小屏（SE 667 高）也不能顶出屏幕 */
  max-height: calc(100dvh - 52px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 22px 54px rgba(6, 10, 22, 0.38);
  animation: a2hsUp 0.34s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.a2hs-welcome {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4f7ff;
}
.a2hs-welcome-who {
  font-size: 12px;
  font-weight: 600;
  color: #5b6b88;
  margin-bottom: 4px;
}
.a2hs-welcome-body {
  font-size: 14.5px;
  line-height: 1.55;
  color: #1b2b4b;
}
.a2hs-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 2px 2px;
}
.a2hs-top img {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: block;
  flex: none;
}
.a2hs-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.a2hs-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 3px;
  line-height: 1.5;
}
.a2hs-sub.red {
  color: #d92b1f;
  font-weight: 600;
}
.a2hs-steps {
  margin: 10px 0 2px;
}
.a2hs-shot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: #f2f2f7;
  border: 1px solid #e6e8ee;
}
.a2hs-cap {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.55;
  font-weight: 600;
  color: #2b3242;
}
.a2hs-step {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  font-size: 14px;
  color: #2b3242;
  line-height: 1.55;
}
.a2hs-num {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: #eaf0ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  font-style: normal;
  display: flex;
  align-items: center;
  justify-content: center;
}
.a2hs-ico {
  display: inline-flex;
  vertical-align: -3px;
  margin: 0 1px;
  color: var(--blue);
}
.a2hs-act {
  width: 100%;
  padding: 13px;
  margin-top: 8px;
  border: none;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.a2hs-act:active {
  transform: scale(0.985);
  background: var(--blue-d);
}
.a2hs-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
}
.a2hs-note svg {
  flex: none;
  color: var(--blue);
  animation: a2hsBob 1.5s ease-in-out infinite;
}
@keyframes a2hsUp {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes a2hsBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
}
/* ---- 分步引导：示意图 / 步骤大字 / 进度点 / 屏幕叠加箭头 ---- */
.a2hs-mockbox {
  background: #eef1f6;
  border-radius: 12px;
  padding: 6px;
  margin: 10px 0 8px;
  overflow: hidden;
}
.a2hs-mocksvg {
  display: block;
  width: 100%;
  height: auto;
}
.a2hs-mocksvg .mk-ripple {
  animation: mkRipple 1.5s ease-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.a2hs-mocksvg .mk-finger {
  animation: mkTap 1.5s ease-in-out infinite;
}
@keyframes mkRipple {
  0% {
    opacity: 0.8;
    transform: scale(0.4);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}
@keyframes mkTap {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
}
.a2hs-big {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.6;
  min-height: 46px;
}
.a2hs-big .a2hs-num {
  margin-top: 1px;
}
.a2hs-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 2px;
}
.a2hs-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #dbe0ea;
  transition: all 0.2s;
}
.a2hs-dots i.on {
  background: var(--blue);
  width: 18px;
  border-radius: 4px;
}
.a2hs-btns {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.a2hs-btn {
  flex: 1;
  border: none;
  cursor: pointer;
  border-radius: 22px;
  padding: 12px 0;
  font-size: 14.5px;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
}
.a2hs-btn:active {
  transform: scale(0.985);
}
.a2hs-btn.ghost {
  background: #eef1f6;
  color: var(--ink);
  font-weight: 500;
}
.a2hs-btn.warn {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
  font-weight: 500;
}
.a2hs-btn.sos {
  background: #fff6e8;
  color: #a05a00;
  border: 1.5px solid #f3c35b;
}
/* 屏幕叠加箭头：指向真实浏览器菜单位置 */
#gc-halo {
  position: fixed;
  z-index: 130;
  pointer-events: none;
  display: none;
}
#gc-halo.show {
  display: block;
}
.gc-halo-wrap {
  position: absolute;
  transform: translate(-50%, -50%);
}
.gc-halo-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #ff5a5f;
  transform: translate(-50%, -50%);
  animation: gcHalo 1.5s ease-out infinite;
}
.gc-halo-ring.d2 {
  animation-delay: 0.5s;
}
.gc-halo-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5a5f;
  transform: translate(-50%, -50%);
}
.gc-halo-label {
  position: absolute;
  left: 0;
  top: -52px;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(20, 26, 40, 0.92);
  color: #fff;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.gc-halo-label.corner {
  top: 34px;
  left: 0;
  transform: translateX(-100%);
  white-space: normal;
  width: 168px;
  line-height: 1.45;
  text-align: left;
}
.gc-halo-label svg {
  vertical-align: -4px;
  animation: gcBob2 1.2s ease-in-out infinite;
}
@keyframes gcHalo {
  0% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }
}
@keyframes gcBob2 {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(4px);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- 安卓安装横条 ---------- */
#install-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  z-index: 70;
  bottom: calc(var(--safe-b) + 78px);
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px 10px 12px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  box-shadow:
    0 10px 30px rgba(16, 24, 40, 0.18),
    0 0 0 1px rgba(16, 24, 40, 0.04);
  transform: translateY(150%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.34s cubic-bezier(0.2, 0.9, 0.3, 1),
    opacity 0.24s ease;
}
#install-bar.show {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}
#install-bar img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: none;
  display: block;
}
.ib-main {
  flex: 1;
  min-width: 0;
}
.ib-main b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.ib-main span {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
}
#ib-go {
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 14px;
  flex: none;
}
#ib-go:active {
  background: var(--blue-d);
}
#ib-close {
  border: none;
  background: transparent;
  color: #b6bdc9;
  font-size: 15px;
  padding: 6px 4px;
  flex: none;
  line-height: 1;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes blink {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 桌面浏览器打开时收成手机宽度 */
@media (min-width: 600px) {
  body {
    background: radial-gradient(circle at 50% 0%, #eef2f9, #d9e0ec);
  }
  #app {
    max-width: 460px;
    margin: 0 auto;
    top: calc(var(--app-top, 0px) + 20px);
    height: calc(var(--app-h, 100dvh) - 40px);
    border-radius: 22px;
    box-shadow:
      0 24px 60px rgba(16, 24, 40, 0.22),
      0 0 0 1px rgba(255, 255, 255, 0.6);
  }
  html.kb-open #app {
    height: calc(var(--app-h, 100dvh) - 40px);
  }
}

/* 接待页站内消息始终显示在安装引导上方。 */
html.mode-browser #msg-alert { z-index: 140; }

/* 浏览器接待顶部提醒：紧凑布局，保留消息可读性。 */
html.mode-browser #msg-alert {
  left: 10px; right: 10px; top: calc(var(--safe-t) + 8px);
  gap: 8px; padding: 9px 8px 9px 10px; border-radius: 14px;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
html.mode-browser #msg-alert .ma-ava { width: 32px; height: 32px; font-size: 14px; }
html.mode-browser #msg-alert .ma-main { gap: 2px; }
html.mode-browser #msg-alert .ma-name { font-size: 12px; line-height: 16px; }
html.mode-browser #msg-alert .ma-text { font-size: 13px; line-height: 18px; font-weight: 500; }
html.mode-browser #msg-alert .ma-go { padding: 7px 9px; font-size: 12px; line-height: 18px; border-radius: 9px; }
html.mode-browser #msg-alert .ma-x { width: 28px; height: 32px; font-size: 15px; }

/* 普通浏览器无需重复预留系统状态栏和旧键盘偏移。 */
html.mode-browser #app { top: 0 !important; height: 100vh; height: 100dvh; }
html.mode-browser .chat-hd { padding-top: 6px; padding-right: 64px; }
html.mode-browser #btn-chat-more { visibility: hidden; }
#browser-complaint { position: fixed; top: 14px; right: 12px; z-index: 80; border: 0; border-radius: 8px; background: #f3f5f9; color: #667085; padding: 7px 10px; font-size: 13px; }
#complaint-dialog { position: fixed; inset: 0; z-index: 160; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.4); padding: 20px; }
.complaint-card { width: 100%; max-width: 420px; padding: 22px; border-radius: 18px; background: white; }
.complaint-card p { font-size: 13px; color: #667085; margin: 12px 0; }
.complaint-card textarea { width: 100%; min-height: 120px; padding: 12px; border: 1px solid #d5dbe5; border-radius: 10px; font: inherit; resize: vertical; user-select: text; }
.complaint-actions { display: flex; gap: 12px; margin-top: 16px; }
.complaint-actions button { flex: 1; padding: 10px; border: 0; border-radius: 10px; }
.complaint-actions button[type="submit"] { color: white; background: #2b4acb; }
.complaint-status { font-size: 13px; margin-top: 8px; }

#browser-demo-overlay.reception-interactive { display:flex; flex-direction:column; }
.reception-heading { width:100%;display:flex;gap:10px;align-items:center;background:white;padding:12px 70px 12px 12px;flex-shrink:0; }
#browser-demo-overlay .reception-heading img { width:36px;height:36px;border-radius:10px; }
.reception-heading small { display:block;color:#7c8b9c;margin-top:3px;font-size:12px; }
.reception-messages { width:100%;flex:1;overflow-y:auto;padding:18px 12px 24px; }
.reception-row { display:flex;gap:9px;align-items:flex-start;margin-bottom:18px; }
#browser-demo-overlay .reception-row img { width:32px;height:32px;border-radius:9px;flex-shrink:0; }
.reception-bubble { max-width:calc(100% - 50px);padding:13px;border-radius:6px 16px 16px;background:white;font-size:15px;line-height:1.65;white-space:pre-line; }
.reception-row.mine { flex-direction:row-reverse; }
.reception-row.mine .reception-bubble { color:white;background:#365bd8; }
.reception-links { display:flex;flex-wrap:wrap;gap:4px 12px;margin:8px 0; }
.reception-links button { color:#087ac0;background:none;border:0;font-weight:600;font-size:15px; }
.reception-links button:disabled { opacity:.5; }
.reception-action { display:block;width:100%;margin-top:12px;padding:10px;border:0;border-radius:10px;background:#087ac0;color:white; }
