* {
  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: column;
  align-items: flex-start;
  margin: 14px 0;
}
.message.mine {
  align-items: flex-end;
}
.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%;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  cursor: zoom-in;
}
.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;
}
@media (max-width: 500px) {
  .image-wrap {
    width: min(100%, 320px);
  }
}

.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; }
