* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: #ededed;
  color: #191919;
  overflow-x: hidden;
}

button {
  font: inherit;
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.2s ease, opacity 0.16s ease;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.97);
  filter: brightness(0.98);
}

.page {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 0 0 max(20px, env(safe-area-inset-bottom));
  min-height: 100vh;
  background: #ededed;
}

.page__inner {
  width: 100%;
  max-width: 430px;
  background: #ededed;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: max(6px, env(safe-area-inset-top)) 8px 0;
  background: #ededed;
  border-bottom: 1px solid #d9d9d9;
}

.topbar__row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 44px;
  gap: 6px;
}

.topbar__back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #191919;
}

.topbar__title {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  color: #191919;
  letter-spacing: 0;
  text-align: center;
}

.topbar__title .qa-chat__title {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__actions {
  justify-self: end;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.topbar__share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #07c160;
  font-size: 16px;
  font-weight: 500;
}

/* ========== 微信风格问答 ========== */
.qa-chat {
  margin-top: 0;
  padding: 12px 10px 96px;
}

.qa-chat__title--sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.qa-chat__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #191919;
  text-align: center;
}

.qa-chat__list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qa-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: qaMsgIn 0.3s ease;
}

.qa-msg.is-mine {
  flex-direction: row-reverse;
}

.qa-msg__avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #e8ecf4, #d4dae8);
}

.qa-msg__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qa-msg__bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.45;
  position: relative;
}

.qa-msg__bubble:has(.qa-msg__hero),
.qa-msg__bubble:has(.qa-msg__collage) {
  max-width: 92%;
}

.qa-msg__hero {
  margin: 0 0 8px;
  border-radius: 16px;
  overflow: hidden;
}

.qa-msg__hero img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.qa-msg__collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 8px 0;
  border-radius: 16px;
  overflow: hidden;
}

.qa-msg__collage img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 8px;
}

.qa-result__hero {
  display: block;
  width: 100%;
  border-radius: 16px;
  margin-bottom: 14px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.qa-msg:not(.is-mine) .qa-msg__bubble {
  background: #fff;
  color: #191919;
  border-radius: 16px;
  box-shadow: none;
}

.qa-msg.is-mine .qa-msg__bubble {
  background: #95ec69;
  color: #191919;
  border-radius: 16px;
  box-shadow: none;
}

.qa-msg__text {
  margin: 0;
}

.qa-msg__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
  color: #1a1a2e;
}

.qa-msg__eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #07c160;
}

.qa-msg__hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: #888;
}

.qa-msg__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.qa-msg__chip {
  border: 1px solid #d9d9d9;
  background: #f7f7f7;
  color: #191919;
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.qa-msg__chip.is-on {
  background: #e9f8ef;
  border-color: #07c160;
  color: #07c160;
}

.qa-msg__option.is-ghost {
  background: #f7f7f7;
  color: #576b95;
  border: 1px solid #d9d9d9;
  box-shadow: none;
}

.qa-msg__options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.qa-msg__options.is-row {
  flex-direction: row;
  flex-wrap: wrap;
}

.qa-msg__option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #07c160;
  border-radius: 999px;
  background: #07c160;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.qa-msg__options.is-row .qa-msg__option {
  flex: 1;
  min-width: 0;
  padding: 12px 10px;
}

.qa-msg__option:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.qa-chat__result {
  margin-top: 20px;
}

.qa-result {
  padding: 16px 14px;
  border-radius: 8px;
  background: #fff;
  color: #191919;
  box-shadow: none;
}

.qa-result__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: #07c160;
}

.qa-result__match {
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.55;
  color: #666;
}

.qa-result__match strong {
  color: #07c160;
  font-size: 1.15em;
}

.qa-chat__download-wrap {
  margin-top: 24px;
  text-align: center;
}

.qa-chat__download-btn {
  display: inline-block;
  padding: 12px 40px;
  border: none;
  border-radius: 8px;
  background: #07c160;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.qa-chat__download-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

@keyframes qaMsgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#wechat-mask {
  display: none;
}

.wechat-mask-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
}

.wechat-mask-pop {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 85%;
  max-width: 320px;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 20px;
  z-index: 10002;
  overflow: hidden;
  padding: 24px;
}

.wechat-mask-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.wechat-mask-logo {
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.wechat-mask-info {
  margin-left: 12px;
}

.wechat-mask-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.wechat-mask-subtitle {
  font-size: 13px;
  color: #999;
  margin-top: 4px;
}

.wechat-mask-steps {
  background: #f7f8fa;
  border-radius: 12px;
  padding: 16px;
}

.wechat-mask-steps p {
  font-size: 14px;
  color: #333;
  line-height: 2;
  display: flex;
  align-items: center;
}

.wechat-mask-steps b {
  color: #ff4081;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #ff4081;
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  margin-right: 8px;
  flex-shrink: 0;
}

.wechat-mask-divider {
  text-align: center;
  margin: 18px 0;
  position: relative;
  font-size: 12px;
  color: #ccc;
}

.wechat-mask-divider::before,
.wechat-mask-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 25%;
  height: 1px;
  background: #e5e5e5;
}

.wechat-mask-divider::before {
  left: 0;
}

.wechat-mask-divider::after {
  right: 0;
}

.wechat-mask-copy {
  position: relative;
  height: 40px;
  background: #f1f6f9;
  border-radius: 20px;
  overflow: hidden;
}

.wechat-mask-copy input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 0 80px 0 16px;
  font-size: 13px;
  color: #999;
}

.wechat-mask-copy button {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  padding: 0 18px;
  background: linear-gradient(90deg, #ff6cab, #ff4081);
  color: #fff;
  border: none;
  border-radius: 0 20px 20px 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translate(-50%, 24px);
  max-width: calc(100vw - 40px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(11, 17, 28, 0.88);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 40;
  white-space: nowrap;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-green {
  top: 50%;
  bottom: auto;
  background: #07c160;
  color: #fff;
  border-radius: 12px;
  white-space: pre-line;
  text-align: center;
  line-height: 1.45;
  font-weight: 500;
  transform: translate(-50%, calc(-50% + 12px));
}

.toast.is-green.is-visible {
  transform: translate(-50%, -50%);
}

@media (min-width: 640px) {
  .page {
    padding: 24px;
  }

  .page__inner {
    max-width: 460px;
  }
}
