/* ============================================================
   岐黄拾遗 · Web 版专用样式
   手机画框 420x880，1rem = 56px（对应设计稿 100rpx）
   整体用 transform: scale() 适配窗口，投屏大屏也不会变形
   ============================================================ */

html {
  font-size: 56px;   /* 420 / 7.5 = 56，即 100rpx */
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #16110b;
  background-image: radial-gradient(circle at 50% 0%, rgba(90, 70, 40, 0.55), rgba(22, 17, 11, 0) 60%);
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  color: #2b2118;
  overflow: hidden;
}

/* 手机画框 */
#phone {
  width: 420px;
  height: 880px;
  position: relative;
  overflow: hidden;
  transform-origin: center center;
  background-color: #f2e7d0;
  background-image:
    repeating-linear-gradient(0deg, rgba(150, 120, 80, 0.05) 0px, rgba(150, 120, 80, 0.05) 1px, transparent 1px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(150, 120, 80, 0.035) 0px, rgba(150, 120, 80, 0.035) 1px, transparent 1px, transparent 6px),
    radial-gradient(circle at 20% 10%, rgba(255, 252, 240, 0.9), rgba(242, 231, 208, 0) 60%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 240, 200, 0.12);
  border-radius: 6px;
}

#view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* 页面内滚动容器：把小程序里 scroll-view 的行为还原 */
#view::-webkit-scrollbar { width: 0; }

/* fixed 元素改为相对画框定位 */
.qh-mask {
  position: absolute !important;
}

.hidden-canvas {
  position: absolute !important;
  left: -9999px !important;
  top: 0 !important;
}

/* 对话页 / 剧本页需要撑满画框 */
.chat-page,
.story-page {
  height: 880px;
}

/* ============ 轻提示 ============ */
.qh-toast {
  position: fixed;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(43, 33, 24, 0.92);
  color: #f7f0dd;
  font-size: 15px;
  letter-spacing: 1px;
  padding: 10px 20px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 9999;
  max-width: 70%;
  text-align: center;
}

.qh-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ 通用弹层 ============ */
.qh-dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 10, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.qh-dialog {
  width: 300px;
  background: #f7f0dd;
  border-radius: 10px;
  padding: 22px 20px 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.qh-dialog-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #2b2118;
  text-align: center;
}

.qh-dialog-text {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
  color: #4a3d2e;
  text-align: center;
}

.qh-dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.qh-dialog-actions button {
  flex: 1;
  height: 40px;
  border: 1px solid #2b2118;
  border-radius: 6px;
  background: transparent;
  color: #2b2118;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.qh-dialog-actions button.primary {
  background: #a8321e;
  border-color: #8d2716;
  color: #fdf8ec;
}

.qh-dialog-actions button:active {
  opacity: 0.75;
}

/* ============ 顶部提示条（Web 说明用）============ */
.qh-web-hint {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(255, 240, 210, 0.45);
  letter-spacing: 1px;
  user-select: none;
  pointer-events: none;
}
/* ============ 画框内悬浮返回按钮 ============ */
.qh-back {
  position: absolute;
  left: 0.24rem;
  top: 0.24rem;
  width: 0.68rem;
  height: 0.68rem;
  border: none;
  border-radius: 50%;
  background: rgba(43, 33, 24, 0.72);
  color: #f7f0dd;
  font-size: 0.34rem;
  line-height: 1;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 500;
  box-shadow: 0 0.04rem 0.16rem rgba(0, 0, 0, 0.25);
}

.qh-back:active {
  opacity: 0.7;
}

.qh-back[hidden] {
  display: none;
}

/* ============ 按钮在 Web 上的复位（浏览器默认样式很重） ============ */
#phone button {
  font-family: inherit;
  cursor: pointer;
}

/* 让 qh-btn 这种原本是 view 的元素，在 Web 上换成 button 后外观一致 */
#phone button.qh-btn {
  width: 100%;
  background: transparent;
  border: 0.02rem solid #2b2118;
  color: #2b2118;
  font-size: 0.32rem;
  letter-spacing: 0.04rem;
  padding: 0;
}

#phone button.qh-btn--primary {
  background: #2b2118;
  color: #f7f0dd;
}

#phone button.qh-btn--seal {
  background: #a8321e;
  border-color: #8d2716;
  color: #fdf8ec;
}
/* ============ 立绘 canvas 适配（保持 460:660 比例，不被拉伸） ============ */
#phone canvas.portrait {
  width: auto;
  height: 66%;
  aspect-ratio: 460 / 660;
  bottom: 1.5rem;
  display: block;
}

/* ============ 分享卡预览图 ============ */
.qh-share-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 620 / 496;
  object-fit: contain;
}
/* ============ 滚动容器：Web 上 scroll-view 的行为 ============ */
#phone .stage,
#phone .msg-scroll {
  overflow-y: auto;
  overflow-x: hidden;
}

#phone .stage::-webkit-scrollbar,
#phone .msg-scroll::-webkit-scrollbar,
#phone .quick-bar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* 快捷提问横排 */
#phone .quick-bar {
  display: flex;
  overflow-x: auto;
  gap: 0.12rem;
}

#phone .quick-bar .quick-item {
  flex: 0 0 auto;
  margin-right: 0;
}

/* 剧本页操作区按钮组 */
#phone .finish-bar .qh-btn {
  flex: 1;
}