/* ============================================================
   BOJING 博精翻页电子书 v2.83
   - 12 张 portrait 单页 1208×1410 (aspect 0.857:1)
   - 桌面 ≥720px：2 页展开（横版呈现，更宽更饱满）
   - 移动 <720px：单页呈现
   - 舞台：PLASTAR 工厂实景 + 模糊 + 暗角
   - LOGO：白底设计在暗色舞台下需要白光晕补对比度
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- 舞台与背景 ---------- */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.stage-bg {
  position: absolute;
  inset: 0;
  background: url('assets/bg_factory.webp') center/cover no-repeat;
  filter: blur(2px) brightness(0.78);
  transform: scale(1.05);
  z-index: 0;
}
.stage-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0.00) 0%, rgba(0,0,0,0.55) 100%),
    linear-gradient(180deg, rgba(8,8,8,0.20) 0%, rgba(8,8,8,0.0) 25%, rgba(8,8,8,0.0) 75%, rgba(8,8,8,0.30) 100%);
  z-index: 1;
  pointer-events: none;
}

/* ---------- 品牌 LOGO ----------
   你上传的 logo 是「红 BJ + 黑色 BOJING Mold」白底设计
   在暗色舞台背景下黑色文字看不清，需要白光补对比度
*/
.brand-logo {
  position: absolute;
  top: 28px;
  left: 40px;
  height: 56px;
  z-index: 20;
  /* 双层 drop-shadow：白色柔光让黑字"亮"起来 + 细微暗偏保轮廓 */
  filter:
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.55))
    drop-shadow(0 0 16px rgba(255, 255, 255, 0.28))
    drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

/* ---------- 书本容器 ---------- */
/* 桌面端（>=720px）：2 页展开，aspect = 2 × 0.857 = 1.714 */
.book-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: min(96vw, calc(94vh * 1.714), 1700px);
  aspect-ratio: 1.714 / 1;
  filter: drop-shadow(0 18px 48px rgba(0, 0, 0, 0.55));
}
#book {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ---------- StPageFlip 页样式 ---------- */
.page {
  position: relative;
  background: transparent;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.stf__parent, .stf__wrapper, .stf__block {
  background: transparent !important;
}
.stf__item {
  background: transparent !important;
  overflow: hidden;
}
.stf__item img {
  background: #fff;
}

/* ---------- 硬封专属 ---------- */
.page-hard::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.10),
    inset 0 0 40px rgba(0, 0, 0, 0.25),
    inset 0 -2px 14px rgba(0, 0, 0, 0.18),
    inset 0 2px 12px rgba(0, 0, 0, 0.14);
  z-index: 3;
}

/* ---------- 翻页提示角标 ---------- */
.flip-hint {
  position: absolute;
  right: max(2vw, 18px);
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 15;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease, transform 280ms ease;
}
.flip-hint svg { width: 26px; height: 26px; }
.flip-hint.visible {
  opacity: 1;
  pointer-events: auto;
  animation: hintPulse 2.4s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50%      { transform: translateY(-50%) translateX(-6px); }
}

/* ---------- 侧边热区 ---------- */
.hotzone {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  height: 140px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 200ms ease;
}
.hotzone .arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-size: 28px;
  line-height: 46px;
  text-align: center;
  user-select: none;
}
.hotzone-left  { left: 0; }
.hotzone-right { right: 0; }
.hotzone:hover { opacity: 1; }
.stage:hover .hotzone { opacity: 0.65; }

/* ---------- 底部 HUD ---------- */
.hud {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(20, 20, 20, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}
.ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, transform 120ms ease, opacity 180ms ease;
}
.ctrl-btn svg { width: 18px; height: 18px; }
.ctrl-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.18);
  transform: scale(1.06);
}
.ctrl-btn:active:not(:disabled) { transform: scale(0.94); }
.ctrl-btn:disabled { opacity: 0.30; cursor: not-allowed; }
.indicator {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.92);
  min-width: 90px;
  text-align: center;
  letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 品牌页脚 ---------- */
.brand-footer {
  position: absolute;
  bottom: 70px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.5px;
  z-index: 14;
  pointer-events: none;
}
.brand-name { color: rgba(255,255,255,0.85); font-weight: 500; }
.brand-sep { margin: 0 8px; color: rgba(255,255,255,0.30); }

/* ---------- 加载遮罩 ---------- */
.loading-mask {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: linear-gradient(180deg, #1c1c1c 0%, #0a0a0a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 480ms ease, visibility 480ms;
}
.loading-mask.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #c8102e;
  animation: spin 0.9s linear infinite;
}
.loading-text { color: rgba(255,255,255,0.75); font-size: 14px; letter-spacing: 1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 移动端：单页呈现 ---------- */
@media (max-width: 720px) {
  .book-wrap {
    width: min(97vw, calc(88vh * 0.857));
    aspect-ratio: 0.857 / 1;
  }
  .brand-logo { height: 44px; top: 18px; left: 18px; }
  .brand-footer { font-size: 10px; bottom: 60px; }
}

body { overscroll-behavior: none; touch-action: none; }
