/* ============================================================
   故事阅读页 · Aurora Glass 的「纸质留白」变体
   ------------------------------------------------------------
   和相册页的区别：
     相册 = 网格陈列，信息密度高，玻璃浮层
     故事 = 线性阅读，留白优先，弱化装饰、强化文字节奏
   所有类名以 story- 前缀隔离，不改动 style.css 任何既有选择器。
   ============================================================ */

/* 故事阅读页隐藏相册页的极光背景（阅读场景要干净） */
body.story-mode .bg-deco { display: none; }
body.story-mode #shareModal,
body.story-mode #actionSheet { display: none !important; }

.story-page {
  --st-bg: #FBFAFF;
  --st-ink: #2A2440;
  --st-ink-soft: #57506F;
  --st-ink-mute: #918AA8;
  --st-line: rgba(124, 92, 255, .12);
  --st-card: #FFFFFF;
  --st-accent: #7C5CFF;
  --st-quote: #7C5CFF;
  --st-font-title: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --st-font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;

  min-height: 100vh;
  background: var(--st-bg);
  color: var(--st-ink);
  font-family: var(--st-font-body);
  padding-bottom: 80px;
  overflow-x: hidden;
}

.story-page[data-theme="dark"] {
  --st-bg: #14121C;
  --st-ink: #EFEBFA;
  --st-ink-soft: #B9B2D0;
  --st-ink-mute: #7C7597;
  --st-line: rgba(168, 140, 255, .18);
  --st-card: #1D1A28;
  --st-accent: #A98CFF;
  --st-quote: #B79BFF;
}

.story-page[data-theme="film"] {
  --st-bg: #17161A;
  --st-ink: #EDE9E3;
  --st-ink-soft: #B5AFA6;
  --st-ink-mute: #7E7871;
  --st-line: rgba(237, 233, 227, .14);
  --st-card: #1F1E23;
  --st-accent: #D9C48F;
  --st-quote: #D9C48F;
}

.story-page[data-theme="warm"] {
  --st-bg: #FFF9F2;
  --st-ink: #3A2A1E;
  --st-ink-soft: #6B5644;
  --st-ink-mute: #A08B76;
  --st-line: rgba(214, 150, 80, .18);
  --st-card: #FFFDF9;
  --st-accent: #D8823C;
  --st-quote: #C9743A;
}

/* ---------- 顶部进度条 ---------- */
.story-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, #7C5CFF, #A855F7 55%, #FF6FA5);
  z-index: 90;
  transition: width .12s linear;
  pointer-events: none;
}

/* ---------- 返回按钮 ---------- */
.story-back {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .82);
  color: #2A2440;
  box-shadow: 0 6px 18px -6px rgba(60, 40, 120, .28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 80;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .25s var(--ease, ease), transform .25s var(--ease, ease);
  pointer-events: none;
}
.story-back.is-on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ---------- 封面 ---------- */
.story-cover {
  position: relative;
  width: 100%;
  height: 62vh;
  min-height: 300px;
  max-height: 560px;
  overflow: hidden;
  background: linear-gradient(150deg, #EDE9FC, #F7F5FF);
}
.story-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.04);
  transition: transform .6s var(--ease, ease);
}
.story-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(251, 250, 255, 0) 46%,
    rgba(251, 250, 255, .72) 76%,
    var(--st-bg) 100%);
}
.story-page[data-theme="dark"] .story-cover::after,
.story-page[data-theme="film"] .story-cover::after {
  background: linear-gradient(180deg,
    rgba(20, 18, 28, 0) 42%,
    rgba(20, 18, 28, .7) 76%,
    var(--st-bg) 100%);
}

/* ---------- 头部文字 ---------- */
.story-head {
  position: relative;
  max-width: 680px;
  margin: -58px auto 0;
  padding: 0 22px;
  z-index: 2;
}
.story-title {
  font-family: var(--st-font-title);
  font-size: 27px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: .3px;
  margin: 0 0 12px;
  color: var(--st-ink);
}
.story-summary {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--st-ink-mute);
  margin: 0 0 16px;
}
.story-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--st-ink-mute);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--st-line);
}
.story-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #E7E1FF, #FFE9F4);
  flex: none;
}
.story-meta-dot::before { content: "·"; margin: 0 2px; }

/* ---------- 正文 ---------- */
.story-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 26px 22px 0;
}

.story-block {
  margin: 0 0 22px;
  animation: storyRise .5s var(--ease, ease) backwards;
}
@keyframes storyRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* 小标题 */
.story-block--heading {
  font-family: var(--st-font-title);
  font-size: 19.5px;
  font-weight: 700;
  line-height: 1.5;
  margin-top: 34px;
  margin-bottom: 14px;
  letter-spacing: .2px;
}
.story-block--heading::before {
  content: "";
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--st-accent);
  opacity: .65;
  margin-bottom: 12px;
}

/* 正文段落 */
.story-block--text {
  font-size: 16.5px;
  line-height: 1.95;
  color: var(--st-ink-soft);
  letter-spacing: .35px;
  text-align: justify;
  text-justify: inter-ideograph;
  word-break: break-word;
}

/* 日期标签 */
.story-block--date {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--st-accent);
  font-weight: 600;
  padding: 5px 0 3px;
  margin-bottom: 4px;
  opacity: .9;
}

/* 金句 */
.story-block--quote {
  position: relative;
  padding: 6px 0 6px 18px;
  margin: 30px 0;
  font-family: var(--st-font-title);
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--st-quote);
  font-style: italic;
  opacity: .95;
}
.story-block--quote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--st-quote);
  opacity: .45;
}

/* 分隔 */
.story-block--divider {
  height: 1px;
  margin: 32px auto;
  width: 56px;
  background: var(--st-line);
  border: 0;
}

/* ---------- 图片 ---------- */
.story-fig {
  margin: 0 0 24px;
  cursor: zoom-in;
}
.story-fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: rgba(124, 92, 255, .06);
  transition: opacity .35s ease;
}
.story-fig img.is-loading { opacity: 0; }

/* 版式：圆角 */
.story-fig--round img { border-radius: 20px; }

/* 版式：拍立得 */
.story-fig--polaroid {
  padding: 10px 10px 34px;
  background: var(--st-card);
  border-radius: 6px;
  box-shadow: 0 12px 30px -14px rgba(60, 40, 120, .35);
  transform: rotate(-.8deg);
  width: calc(100% - 16px);
  margin-left: 8px;
}
.story-fig--polaroid img { border-radius: 3px; }
.story-fig--polaroid .story-caption {
  text-align: center;
  padding-top: 10px;
  font-family: var(--st-font-title);
}

.story-caption {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--st-ink-mute);
  padding: 8px 4px 0;
  text-align: center;
}

/* 图组 */
.story-gallery {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
}
.story-gallery--g2 { grid-template-columns: 1fr 1fr; }
.story-gallery--g3 { grid-template-columns: repeat(3, 1fr); }
.story-gallery--g4 { grid-template-columns: 1fr 1fr; }
.story-gallery--scroll {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.story-gallery--scroll::-webkit-scrollbar { display: none; }
.story-gallery--scroll .story-gallery-item {
  flex: none;
  width: 72%;
  scroll-snap-align: center;
}
.story-gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(124, 92, 255, .06);
  aspect-ratio: 1;
  cursor: zoom-in;
}
.story-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 图片缺失占位 */
.story-missing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  background: rgba(124, 92, 255, .05);
  border: 1px dashed var(--st-line);
  color: var(--st-ink-mute);
  font-size: 12.5px;
  letter-spacing: .5px;
}
.story-missing span:first-child { font-size: 20px; opacity: .55; }

/* ---------- 结尾 ---------- */
.story-end {
  text-align: center;
  padding: 44px 22px 26px;
  color: var(--st-ink-mute);
  font-size: 12.5px;
  letter-spacing: 2px;
}
.story-end::before {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: var(--st-line);
  margin: 0 auto 18px;
}

/* ---------- BGM 芯片 ---------- */
.story-bgm {
  position: fixed;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 8px 22px -8px rgba(60, 40, 120, .35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 85;
  cursor: pointer;
  color: #7C5CFF;
  opacity: .72;
  transition: opacity .2s, transform .2s;
}
.story-bgm.is-on { opacity: 1; }
.story-bgm.is-on::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 92, 255, .35);
  animation: bgmPulse 2.4s ease-out infinite;
}
@keyframes bgmPulse {
  0%   { transform: scale(.92); opacity: .8; }
  100% { transform: scale(1.18); opacity: 0; }
}

/* ---------- 灯箱 ---------- */
.story-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100%;
  background: rgba(12, 10, 20, .96);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.story-lightbox.is-on { opacity: 1; pointer-events: auto; }
.story-lightbox img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  transition: transform .25s var(--ease, ease);
}
.story-lightbox-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}
.story-lightbox-tip {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, .45);
  font-size: 12px;
  letter-spacing: 1px;
}

/* ---------- 密码页 ---------- */
.story-pwd {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 30px;
  text-align: center;
}
.story-pwd-icon { font-size: 34px; opacity: .8; }
.story-pwd h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--st-ink);
  margin: 0;
}
.story-pwd p { font-size: 13px; color: var(--st-ink-mute); margin: 0; }
.story-pwd input {
  width: 100%;
  max-width: 260px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--st-line);
  background: var(--st-card);
  padding: 0 16px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 3px;
  color: var(--st-ink);
  outline: none;
}
.story-pwd input:focus { border-color: rgba(124, 92, 255, .5); }
.story-pwd button {
  width: 100%;
  max-width: 260px;
  height: 46px;
  border-radius: 14px;
  border: 0;
  background: linear-gradient(135deg, #7C5CFF, #A855F7 55%, #FF6FA5);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
}
.story-pwd .err { color: #FF4D6D; font-size: 12.5px; min-height: 16px; }

/* ---------- 加载骨架 ---------- */
.story-skeleton {
  max-width: 680px;
  margin: 0 auto;
  padding: 80px 22px;
}
.story-skeleton span {
  display: block;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(124,92,255,.07), rgba(124,92,255,.14), rgba(124,92,255,.07));
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
  margin-bottom: 14px;
}
.story-skeleton span:nth-child(1) { height: 26px; width: 68%; margin-bottom: 22px; }
.story-skeleton span:nth-child(3) { width: 88%; }
.story-skeleton span:nth-child(4) { width: 54%; }
@keyframes skel {
  0%   { background-position: 0% 0; }
  100% { background-position: -200% 0; }
}

/* 桌面端：正文两侧留白更大 */
@media (min-width: 720px) {
  .story-head, .story-body { padding-left: 0; padding-right: 0; }
  .story-cover { height: 56vh; }
  .story-title { font-size: 32px; }
}
