* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    "Microsoft YaHei",
    sans-serif;
  color: #20304c;
  background: #edf1f8;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  background: #285cd5;
  color: #fff;
  padding: 10px 15px;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
.app {
  height: 100dvh;
  max-width: 960px;
  margin: auto;
  background: #f8faff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 45px #243d6c12;
  padding-top: env(safe-area-inset-top);
}
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: #fff;
  border-bottom: 1px solid #e1e7f1;
}
h1 {
  font-size: 20px;
  margin: 0;
}
header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #60718c;
}
header button {
  margin-left: auto;
}
.brand {
  display: grid;
  place-items: center;
  background: #285cd5;
  color: white;
  width: 43px;
  height: 43px;
  border-radius: 14px;
  font-size: 21px;
}
.quiet {
  background: #eaf0fc;
  color: #315b9d;
  font-size: 13px;
}
.install-strip:not([hidden]) {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: #eef6f3;
  border-bottom: 1px solid #d3e5dd;
  font-size: 13px;
  line-height: 1.4;
}
.install-strip span { flex: 1; min-width: 0; }
.install-strip button { flex: none; padding: 6px 10px; border-radius: 6px; }
#install-dismiss { color: #20304c; background: transparent; font-size: 20px; line-height: 1; min-height: 32px; }
.panel {
  overflow: auto;
  padding: 20px;
  background: #fff;
  border-bottom: 1px solid #dae2f2;
}
.panel[hidden] {
  display: none;
}
.panel h2 {
  font-size: 18px;
  margin: 0 0 12px;
}
.panel label {
  display: block;
  font-size: 13px;
  margin: 10px 0;
}
.panel input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #ccd7e9;
  border-radius: 8px;
  margin-top: 5px;
}
.panel p {
  font-size: 12px;
  color: #66758e;
}
.panel .consent {
  display: flex;
  gap: 8px;
  align-items: center;
}
.panel button {
  margin: 6px 5px 0 0;
}
.actions {
  display: flex;
  gap: 8px;
  padding: 9px 16px;
  border-bottom: 1px solid #e7ecf4;
}
.notice {
  font-size: 13px;
  background: #fff3d9;
  padding: 10px 18px;
  color: #7d5819;
}
.notice[hidden] {
  display: none;
}
.messages {
  flex: 1;
  overflow: auto;
  min-height: 100px;
  padding: 20px;
  overscroll-behavior: contain;
}
.welcome {
  text-align: center;
  color: #8190a6;
  margin: 50px 0;
}
.welcome h2 {
  font-size: 19px;
  color: #536985;
}
.welcome p {
  font-size: 13px;
}
.message {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 9px;
  margin: 14px 0;
  max-width: 100%;
}
.message.mine {
  flex-direction: row-reverse;
}
/* 访客端手机对话框：客服消息左侧显示客服头像（2026-12-04 新增） */
.message .avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8eefb;
  border: 1px solid #e0e7f2;
}
.message .body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: calc(100% - 48px);
}
.message.mine .body {
  align-items: flex-end;
}
.message .body .bubble {
  max-width: 100%;
}
.bubble {
  padding: 11px 15px;
  border: 1px solid #e0e7f2;
  background: white;
  border-radius: 14px;
  max-width: 85%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.mine .bubble {
  background: #285cd5;
  color: #fff;
  border-color: #285cd5;
}
.bubble img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  cursor: zoom-in;
}
/* 客服发来的「专属入口」卡片（2026-12-05） */
.bubble .qr-card {
  appearance: none; border: 0; margin: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 210px; padding: 11px 18px; border-radius: 10px;
  background: #07c160; color: #fff; font-weight: 600; font-size: 14.5px;
  text-align: center; cursor: pointer;
}
.bubble .qr-card::after { content: "\203A"; font-size: 18px; line-height: 1; opacity: .9; }
.bubble .qr-card-title { font-weight: 600; font-size: 14px; }
.bubble .qr-card-desc { display: none; }
.bubble .qr-card-action { margin-top: 6px; font-size: 12.5px; color: #285cd5; }
.message.mine .bubble .qr-card-action { color: #fff; text-decoration: underline; }.image-wrap {
  display: inline-flex;
  max-width: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}
#image-preview {
  width: min(92vw, 960px);
  max-height: 92vh;
  max-height: 92dvh;
  padding: clamp(12px, 3vw, 24px);
  overflow: auto;
  border: 0;
  border-radius: 16px;
  color: #20304c;
  background: #fff;
}
#image-preview::backdrop {
  background: #101a2bcc;
}
#image-preview-content {
  display: block;
  width: 100%;
  max-height: 68vh;
  max-height: 68dvh;
  object-fit: contain;
}
.image-preview-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.image-preview-status:not(:empty) {
  display: block;
  margin-top: 8px;
  text-align: center;
  font-size: 13px;
}
.bubble a {
  color: inherit;
}
.meta {
  font-size: 11px;
  color: #71809a;
  margin: 5px 2px;
}
.retry {
  background: #fff0eb;
  color: #aa3b21;
  padding: 4px 9px;
  margin-left: 6px;
  font-size: 12px;
}
#composer {
  background: #fff;
  padding: 12px 18px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #dfe6f2;
}
.tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}
.attach {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #dbe5f5;
  background: #f2f6ff;
  color: #315b9d;
}
.attach:hover:not(:disabled) {
  background: #e7efff;
}
.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
textarea {
  flex: 1;
  min-width: 0;
  max-height: 140px;
  resize: vertical;
  border: 1px solid #d5dfed;
  border-radius: 10px;
  background: #f8faff;
  padding: 10px;
  font-size: 15px;
}
#hint {
  font-size: 11px;
  color: #77859b;
  margin: 7px 0 0;
}
#hint:empty { display: none; }
:focus-visible {
  outline: 3px solid #eba842;
  outline-offset: 2px;
}
@media (min-width: 700px) {
  .app {
    height: calc(100dvh - 48px);
    margin: 24px auto;
    border-radius: 18px;
    overflow: hidden;
  }
}
@media (max-width: 500px) {
  header {
    padding: 12px 15px;
  }
  .messages {
    padding: 12px;
  }
  .bubble {
    max-width: 92%;
  }
  #composer {
    padding-left: 12px;
    padding-right: 12px;
  }
  /* 确保底部政策链接不被 flex 挤压遮挡 */
  .site-footer { flex: none; }
}
.actions {
  flex-wrap: wrap;
}
.panel textarea {
  display: block;
  width: 100%;
  margin: 6px 0;
}
.panel details {
  border-bottom: 1px solid #e1e7f1;
  padding: 10px 0;
}
.panel summary {
  cursor: pointer;
  font-size: 14px;
}
.panel select {
  margin-left: 8px;
  padding: 8px;
  border: 1px solid #d5dfed;
  border-radius: 8px;
}

.bubble img[hidden],
.image-retry[hidden] {
  display: none;
}
.image-retry {
  background: #edf2ff;
  color: #315b9d;
  font-size: 13px;
}
/* 这里原来有一条 ≤500px 媒体查询，把 .image-wrap 宽度限在 320px，
   t11 起被文件末尾的 .image-wrap{width:100%} 同特异度后写覆盖，已成为死规则，
   按 t12 裁决删除，避免两套 width 并存造成误读。 */

.site-footer a { color: #285cd5; }
/* M1 常驻隐私政策入口 */
.site-footer { text-align: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: #f8faff; font-size: 12px; }
/* 商户自填 ICP 备案号；未填时由 hidden 属性隐藏，不与隐私政策入口挤在一行 */
.site-footer #icp-line { display: block; margin-top: 4px; color: #7b879c; }
.site-footer #icp-line[hidden] { display: none; }
/* 页脚操作：留手机号 / 清除本机身份（2026-12-04） */
.site-footer .footer-link { appearance: none; border: 0; background: transparent; color: #285cd5; font: inherit; padding: 0 6px; cursor: pointer; }
.site-footer .footer-link:hover { text-decoration: underline; }
.panel-note { font-size: 12px; color: #71809a; margin: 0 0 8px; line-height: 1.5; }

/* ===========================================================================
   访客端 H5（public/customer/）：修复“聊天对话框里的图片过小”
   ---------------------------------------------------------------------------
   现象（390×844 实测）：1200×1600 竖构图手机照片只渲染成 180×240，占屏宽 46%；
   9:16 竖拍图更小，只有 135×240。
   根因：原来 .bubble img 上有一条写死的 240px 高度上限。替换元素的 max-height 会
   反向决定它的固有宽度（240 × 3/4 = 180），而 .message 是 flex 容器、.bubble 是
   flex 子项（宽度 fit-content），又把这个 180 原样传给气泡，于是“图小 + 气泡也窄”；
   另外 @media(max-width:500px) 里还有一条 320px 宽度上限，
   在大屏手机上再叠一道 320px 上限。
   处置（t12 复核后）：上面那两条**都已直接删除**，不再是“同特异度后写覆盖”，
   文件里只剩本处这一套生效规则，避免后来的人看到两套 max-height / width 打架。
   修法：
   1) 高度上限改为视口相对值 70vh/70dvh —— 常规手机照片（3:4、4:3、9:16）的高度都
      落在 70vh 之内，宽度重新由可用宽度驱动；只有超过 70vh 的超长截图才会触顶
      （触顶时按比例缩宽、不失真，也不会把气泡撑爆）。
      实测依据：390×844 下 3:4 需 388px、9:16 需 517px；60vh=506px 会让 9:16 只得
      284.8px 宽（比满宽 291px 小 2%），70vh=590.8px 时两者都满宽。375×667 矮屏上
      60vh 会把 9:16 压到 81% 宽（225px），70vh 提到 95%（263px）；代价只是超长
      截图的封顶高度由 400px 变成 467px，仍然不会撑爆气泡。
   2) .image-wrap 宽度改为**视口确定单位** calc(100vw - 56px)（= 100vw 减 .messages 左右
      padding 12+12 与 .bubble 左右 padding 15+15 共 54px，留 2px 余量）。
      不能用 width:100%：.bubble 是 .message（flex column, align-items:flex-start）的
      fit-content 子项，宽度本身不确定；Chromium 会先算内在尺寸再解析百分比（得 291px，
      看起来正常），而 **WebKit 在收缩上下文里会把百分比宽度塌缩**，图片被算得很小 ——
      这正是 iOS 18.3.2 真机上"CSS 已是新版但图仍然很小"的原因（真机日志：styles.css 200/gzip）。
      vw/calc 是绝对可解析的，不依赖祖先的内在尺寸。
      同类风险点已一并排查：.bubble img 的 max-width:100% 在父级已有确定宽度后可正常解析；
      .bubble 的 max-width:85%/92% 是相对 .message（块级、宽度确定）的百分比，安全。
   注意：本文件是直接加载的静态 CSS，不是构建产物；但 public/customer/ 下的
   styles.css 由 pure-edition/customer/tools/build.mjs 从 src/styles.css 拷贝而来，
   见 artifacts/fixphase/06-visitor-image/REPORT.md §7 的同步说明。
   main.js（esbuild 产物）与 #image-preview 放大逻辑均未改动。
   =========================================================================== */
/* 聊天图宽度：集中常量（下一轮只改这一个数字即可整体调整）
   50vw ≈ 屏宽一半；再用 calc(100vw - 56px) 兜住极窄屏，不会溢出气泡。 */
:root {
  --chat-img-width: 45vw;
}
/* 客服发来的「专属入口」卡片（2026-12-05） */
.bubble .qr-card {
  appearance: none; border: 0; margin: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 210px; padding: 11px 18px; border-radius: 10px;
  background: #07c160; color: #fff; font-weight: 600; font-size: 14.5px;
  text-align: center; cursor: pointer;
}
.bubble .qr-card::after { content: "\203A"; font-size: 18px; line-height: 1; opacity: .9; }
.bubble .qr-card-title { font-weight: 600; font-size: 14px; }
.bubble .qr-card-desc { display: none; }
.bubble .qr-card-action { margin-top: 6px; font-size: 12.5px; color: #285cd5; }
.message.mine .bubble .qr-card-action { color: #fff; text-decoration: underline; }.image-wrap {
  /* 必须用视口单位：.bubble 是 fit-content，WebKit 下 width:100% 会塌缩（iOS 真机 bug 根因）。
     100vw − .messages 左右 padding(12+12) − .bubble 左右 padding(15+15) = 100vw − 54 − 2 余量 */
  width: min(var(--chat-img-width), calc(100vw - 56px));
  max-width: 100%;
}
.bubble img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  max-height: 70dvh;
}

/* --- 访客端全屏画廊（image-gallery.js，t20）--------------------------------- */
.customer-gallery{position:fixed;inset:0;z-index:2147483000;display:none;background:#000;touch-action:none;-webkit-user-select:none;user-select:none;overscroll-behavior:contain}
.customer-gallery.is-open{display:block}
.customer-gallery__img{position:absolute;inset:0;margin:auto;width:auto;height:auto;max-width:92vw;max-height:88vh;max-height:88dvh;object-fit:contain}
.customer-gallery__bar{position:absolute;left:0;right:0;bottom:0;display:flex;align-items:center;gap:10px;padding:12px 14px calc(12px + env(safe-area-inset-bottom));color:#fff;font-size:14px;background:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.78))}
.customer-gallery__counter{margin-right:auto;font-size:13px;font-variant-numeric:tabular-nums;opacity:.9}
.customer-gallery__save,.customer-gallery__close{appearance:none;border:1px solid rgba(255,255,255,.48);border-radius:999px;background:rgba(0,0,0,.38);color:#fff;padding:8px 15px;font-size:13px;line-height:1.2;text-decoration:none;white-space:nowrap}
.customer-gallery__nav{position:absolute;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:44px;height:60px;border:0;border-radius:10px;background:rgba(0,0,0,.38);color:#fff;font-size:26px;line-height:1}
.customer-gallery__nav[data-dir="prev"]{left:8px}
.customer-gallery__nav[data-dir="next"]{right:8px}
html.customer-gallery-open,html.customer-gallery-open body{overflow:hidden}