/* 连笔行书字标（Zhi Mang Xing, SIL OFL 1.1）—— 只自托管「魔法印书局」五字的子集 */
@font-face{font-family:'MB Script';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/zmx-0.woff2') format('woff2');unicode-range:U+9B54;}
@font-face{font-family:'MB Script';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/zmx-1.woff2') format('woff2');unicode-range:U+5370,U+5C40;}
@font-face{font-family:'MB Script';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/zmx-2.woff2') format('woff2');unicode-range:U+4E66;}
@font-face{font-family:'MB Script';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/zmx-3.woff2') format('woff2');unicode-range:U+6CD5;}

/* 毛笔楷书字标（Ma Shan Zheng, SIL OFL 1.1）—— 只自托管「魔法印书局」五字 */
@font-face{font-family:'MB Brush';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/msz-0.woff2') format('woff2');unicode-range:U+9B54;}
@font-face{font-family:'MB Brush';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/msz-1.woff2') format('woff2');unicode-range:U+5370,U+5C40;}
@font-face{font-family:'MB Brush';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/msz-2.woff2') format('woff2');unicode-range:U+4E66;}
@font-face{font-family:'MB Brush';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/msz-3.woff2') format('woff2');unicode-range:U+6CD5;}

/* 儿童体字标（ZCOOL KuaiLe, SIL OFL 1.0）—— 只自托管「魔法印书局」五字 */
@font-face{font-family:'MB Kid';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/zkl-0.woff2') format('woff2');unicode-range:U+9B54;}
@font-face{font-family:'MB Kid';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/zkl-1.woff2') format('woff2');unicode-range:U+5370,U+5C40;}
@font-face{font-family:'MB Kid';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/zkl-2.woff2') format('woff2');unicode-range:U+4E66;}
@font-face{font-family:'MB Kid';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/zkl-3.woff2') format('woff2');unicode-range:U+6CD5;}

/* 儿童圆体拉丁（Baloo 2, SIL OFL 1.1）—— 品牌英文 MAGICBOOK PRESS 用 */
@font-face{font-family:'MB Kid Latin';font-style:normal;font-weight:700;font-display:swap;src:url('/fonts/baloo-latin.woff2') format('woff2');}


/* ==========================================================================
   魔法印书局 magic book press — 样式表
   设计基调：复古魔法典籍（深墨绿 / 羊皮纸 / 烫金细线）
   作品皮肤：随主题的 palette 变量切换（见 theme.apply）
   布局：移动优先，375px 起；桌面端收成居中书页
   ========================================================================== */

:root {
  --paper: #f8f0de;
  --paper-2: #efe2c8;
  --paper-3: #e4d3b2;
  --ink: #2a2622;
  --ink-soft: #5b5348;
  --ink-faint: #8c8477;
  --deep: #6e1b14;
  --deep-2: #4a0f0b;
  --gold: #b08640;
  --gold-2: #d9bc7a;
  --line: rgba(42, 38, 34, 0.13);
  --line-strong: rgba(42, 38, 34, 0.24);
  --line-gold: rgba(176, 134, 64, 0.4);
  --accent: var(--gold);
  --glow: #e8c77b;
  --danger: #a63b32;
  --ok: #3f6b4a;

  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", STSong, SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --tap: 44px;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #20211d;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  background:
    radial-gradient(120% 70% at 50% 0%, #33352c 0%, #20211d 55%, #171814 100%);
}

img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; font-family: var(--serif); letter-spacing: 0.02em; }
p { margin: 0; }

/* ---------- 应用外壳 ---------- */

.app-root {
  position: relative;
  max-width: 560px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  background-image:
    radial-gradient(100% 60% at 50% -10%, rgba(217, 188, 122, 0.28) 0%, rgba(217, 188, 122, 0) 60%),
    repeating-linear-gradient(0deg, rgba(120, 96, 60, 0.028) 0 1px, transparent 1px 3px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 24px 80px rgba(0, 0, 0, 0.45);
  padding-bottom: calc(76px + var(--safe-b));
  overflow-x: hidden;
}
.app-root.no-tabbar { padding-bottom: var(--safe-b); }

@media (min-width: 600px) {
  body { padding: 0; }
  .app-root { min-height: 100vh; }
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: calc(10px + var(--safe-t)) 18px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(247, 241, 227, 0.97) 0%, rgba(247, 241, 227, 0.9) 100%);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar.dark {
  background: linear-gradient(180deg, rgba(74, 15, 11, 0.98) 0%, rgba(74, 15, 11, 0.92) 100%);
  border-bottom-color: rgba(217, 188, 122, 0.24);
  color: var(--paper);
}
.topbar__back {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: inherit;
  flex: none;
}
.topbar__title {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.06em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar__latin {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-family: var(--sans);
}
.topbar.dark .topbar__latin { color: rgba(217, 188, 122, 0.75); }

/* ---------- 底部导航 ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 50;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 8px calc(8px + var(--safe-b));
  background: rgba(252, 248, 239, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  min-height: var(--tap);
  justify-content: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  border-radius: 10px;
}
.tabbar__item.is-active { color: var(--deep); }
.tabbar__item.is-active .tabbar__dot { opacity: 1; transform: scale(1); }
.tabbar__glyph { font-family: var(--serif); font-size: 17px; line-height: 1; }
.tabbar__dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--gold);
  opacity: 0; transform: scale(0.4);
  transition: 0.25s ease;
}

/* ---------- 通用排版 ---------- */

.page { padding: 18px 18px 24px; }
.page--flush { padding: 0 0 24px; }

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  font-family: var(--sans);
  font-weight: 600;
}
.h1 { font-size: 30px; line-height: 1.25; letter-spacing: 0.03em; }
.h2 { font-size: 21px; line-height: 1.35; }
.h3 { font-size: 17px; }
.lede { color: var(--ink-soft); font-size: 14.5px; line-height: 1.75; }
.muted { color: var(--ink-faint); font-size: 13px; }
.tiny { font-size: 11.5px; line-height: 1.5; }
.center { text-align: center; }

/* 页脚（ICP 备案号占位，备案通过后由 index.html 的 ICP_BEIAN_NO 激活） */
.site-foot {
  text-align: center;
  padding: 16px 0 26px;
  font-size: 11.5px;
  color: var(--ink-faint);
}
.site-foot a { color: inherit; text-decoration: none; margin-left: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  margin: 22px 0;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform 0.12s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid transparent;
  width: 100%;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn--primary {
  background: linear-gradient(180deg, #8a2a1e 0%, var(--deep) 100%);
  color: #f8f2e2;
  box-shadow: 0 8px 22px rgba(110, 27, 20, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  border-color: rgba(217, 188, 122, 0.35);
}
.btn--gold {
  background: linear-gradient(180deg, #c9a35d 0%, var(--gold) 100%);
  color: #241f16;
  box-shadow: 0 8px 22px rgba(176, 134, 64, 0.3);
}
.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn--quiet {
  background: rgba(42, 38, 34, 0.05);
  color: var(--ink);
}
.btn--danger { background: #fff; color: var(--danger); border-color: rgba(166, 59, 50, 0.35); }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; width: auto; }
.btn--block { width: 100%; }

.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row > .btn { flex: 1; }

/* ---------- 首页 ---------- */

.hero {
  position: relative;
  padding: 36px 22px 30px;
  background: linear-gradient(170deg, #82231a 0%, #5c150f 55%, #3d0c08 100%);
  color: #f4eddb;
  overflow: hidden;
  border-bottom: 1px solid rgba(217, 188, 122, 0.28);
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 90%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(217, 188, 122, 0.22) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(217, 188, 122, 0.06) 0 1px, transparent 1px 9px);
  opacity: 0.5;
  pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; }
.hero__mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--gold-2);
  margin-bottom: 16px;
}
.hero__title {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1.08;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}
.hero__latin {
  font-size: 11px;
  letter-spacing: 0.44em;
  text-transform: uppercase;
  color: rgba(244, 237, 219, 0.55);
  margin-bottom: 20px;
}
.hero__lede {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.85;
  color: rgba(244, 237, 219, 0.9);
  margin-bottom: 26px;
}
.hero__steps {
  display: flex;
  gap: 0;
  margin-bottom: 26px;
  border-top: 1px solid rgba(217, 188, 122, 0.22);
  border-bottom: 1px solid rgba(217, 188, 122, 0.22);
}
.hero__step {
  flex: 1;
  padding: 12px 4px;
  text-align: center;
  font-size: 11.5px;
  color: rgba(244, 237, 219, 0.72);
  letter-spacing: 0.06em;
  border-right: 1px solid rgba(217, 188, 122, 0.15);
}
.hero__step:last-child { border-right: 0; }
.hero__step b {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--gold-2);
  font-weight: 500;
  margin-bottom: 2px;
}

/* ---------- 区块标题 ---------- */

.section { padding: 26px 18px 0; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  line-height: 1.2;
  margin-bottom: 10px;
}
.section__title { font-size: 19px; line-height: 1.2; letter-spacing: 0.04em; }
/* 第二组标题直接贴着上一排卡片，不留空行 */
.section__head--next { margin-top: 0; }
.section__more { font-size: 12px; color: var(--gold); letter-spacing: 0.08em; }

/* ---------- 主题卡片 ---------- */

.theme-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 18px 0;
  margin: 0 -18px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.theme-scroll::-webkit-scrollbar { display: none; }

.theme-card {
  position: relative;
  flex: none;
  width: 190px;
  scroll-snap-align: start;
  border-radius: var(--r);
  padding: 16px 15px 14px;
  min-height: 196px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.7);
  overflow: hidden;
  text-align: left;
  box-shadow: 0 6px 18px rgba(120, 74, 30, 0.13), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.theme-card:active { transform: scale(0.98); }
.theme-card__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.theme-card__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0 1px,
    transparent 1px 10px
  );
}
.theme-card > * { position: relative; z-index: 1; }
.theme-card__kind {
  display: inline-block;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  opacity: 0.72;
  align-self: flex-start;
}
.theme-card__name {
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.2;
  margin: 10px 0 4px;
  letter-spacing: 0.05em;
}
.theme-card__tag {
  font-size: 11px;
  line-height: 1.66;
  opacity: 0.88;
  font-family: var(--serif);
  text-wrap: pretty;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.theme-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.1em;
  opacity: 0.75;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid currentColor;
  border-color: color-mix(in srgb, currentColor 26%, transparent);
}
.theme-card--locked { filter: saturate(0.62); opacity: 0.96; }
.theme-card--locked .theme-card__name { opacity: 0.9; }
.lock-badge {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(60, 40, 20, 0.14);
  color: #5a3520;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(80, 50, 20, 0.12);
}

/* ---------- 通用卡片 ---------- */

.card {
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: 0 2px 10px rgba(80, 64, 40, 0.05);
}
.card + .card { margin-top: 12px; }
.card--paper {
  background: linear-gradient(180deg, #fdf8ec 0%, #f8f0dd 100%);
  border-color: var(--line-gold);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card__title { font-size: 16px; letter-spacing: 0.03em; }

/* ---------- 表单 ---------- */

.field { margin-bottom: 16px; }
.field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
.field__hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 6px; line-height: 1.55; }
.field__error { font-size: 12px; color: var(--danger); margin-top: 6px; }

.input, .textarea, .select {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: #fff;
  font-size: 15px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 134, 64, 0.14);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; font-family: var(--serif); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat; }

/* ---------- 选择芯片 ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px;
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-size: 13.5px;
  color: var(--ink-soft);
  transition: 0.16s ease;
}
.chip.is-on {
  background: var(--deep);
  border-color: var(--deep);
  color: #f6efdd;
  box-shadow: 0 4px 12px rgba(110, 27, 20, 0.22);
}
.chip--block { border-radius: var(--r-sm); text-align: left; padding: 12px 14px; width: 100%; }
/* 画风卡片：名字 + 一行特征（细墨线／赛璐璐／网点…），一眼看出区别 */
.chip--style {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  padding: 7px 12px 8px;
  border-radius: var(--r-sm);
  line-height: 1.25;
  text-align: left;
}
.chip--style b { font-weight: 600; font-size: 13.5px; }
.chip--style i {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0;
  opacity: 0.72;
  white-space: nowrap;
}
.chip--style.is-on i { opacity: 0.85; }

/* ---------- 主题场景选项（大块） ---------- */

.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scene-opt {
  position: relative;
  text-align: left;
  padding: 14px 13px;
  border-radius: var(--r);
  border: 1px solid var(--line-strong);
  background: #fff;
  min-height: 84px;
  transition: 0.18s ease;
  overflow: hidden;
}
.scene-opt.is-on {
  border-color: var(--deep);
  background: #f4f7f2;
  box-shadow: 0 6px 18px rgba(110, 27, 20, 0.12), inset 0 0 0 1px var(--deep);
}
.scene-opt__name { font-family: var(--serif); font-size: 15.5px; margin-bottom: 4px; }
.scene-opt__hint { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }

/* ---------- 上传 / 角色卡 ---------- */

.uploader {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--r);
  border: 1.5px dashed var(--line-strong);
  background: #fffdf8;
  min-height: 88px;
  width: 100%;
  text-align: left;
}
.uploader__thumb {
  width: 60px; height: 60px;
  border-radius: 10px;
  flex: none;
  object-fit: cover;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.uploader__thumb--empty {
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--gold);
}
.uploader__body { flex: 1; min-width: 0; }
.uploader__title { font-size: 14px; margin-bottom: 3px; }
.uploader__hint { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }

.character-list { display: flex; flex-direction: column; gap: 12px; }
.character {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  padding: 14px;
}
.character__top { display: flex; gap: 12px; align-items: flex-start; }
.character__img {
  width: 64px; height: 64px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--line); background: var(--paper-2); flex: none;
}
.character__meta { flex: 1; min-width: 0; }
.character__roles { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- 进度 ---------- */

.progress {
  height: 3px;
  border-radius: 999px;
  background: rgba(42, 38, 34, 0.1);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
  transition: width 0.5s ease;
}

.gen-stage {
  padding: 26px 18px;
  text-align: center;
}
.gen-stage__ring {
  width: 92px; height: 92px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 1px solid var(--line-gold);
  display: grid;
  place-items: center;
  position: relative;
}
.gen-stage__ring::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-stage__pct { font-family: var(--serif); font-size: 24px; }
.gen-stage__label { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.gen-list { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.gen-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-faint);
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
}
.gen-item.is-active { color: var(--ink); border-color: var(--line-gold); }
.gen-item.is-done { color: var(--ink-soft); }
.gen-item__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-strong);
  flex: none;
}
.gen-item.is-active .gen-item__dot { background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.gen-item.is-done .gen-item__dot { background: var(--ok); }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- 翻页书 ---------- */

.reader {
  background: linear-gradient(180deg, #e9dcc0 0%, #dccdac 100%);
  padding: 22px 18px 18px;
  min-height: 60vh;
}

.book3d {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  perspective: 1600px;
  perspective-origin: 50% 40%;
  touch-action: pan-y;
}

.leaf {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.72s cubic-bezier(0.22, 0.78, 0.24, 1);
  transform-origin: left center;
  will-change: transform;
}
.leaf.is-turning-next { transform: rotateY(-178deg); }
.leaf.is-turning-prev-start { transform: rotateY(-178deg); transition: none; }

.leaf__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4px 10px 10px 4px;
  overflow: hidden;
  background: #fdfaf2;
  box-shadow: 0 18px 40px rgba(60, 44, 20, 0.28), 0 2px 0 rgba(255, 255, 255, 0.6) inset;
}
.leaf__face--back {
  transform: rotateY(180deg);
  border-radius: 10px 4px 4px 10px;
}

.page-sheet {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(130% 60% at 50% 0%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, #fffdf7 0%, #f8f1e0 100%);
  padding: 16px 16px 30px;
}
.page-sheet::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 14px;
  background: linear-gradient(90deg, rgba(90, 70, 40, 0.16), transparent);
  pointer-events: none;
}
.page-sheet__frame {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line-gold);
  border-radius: 2px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.5);
  position: relative;
  overflow: hidden;
}
.page-sheet__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1px;
  background: var(--paper-2);
}
.page-sheet__img--placeholder {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  background:
    repeating-linear-gradient(135deg, rgba(176, 134, 64, 0.09) 0 10px, transparent 10px 20px),
    #f4ead4;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
  padding: 20px;
  line-height: 1.7;
}
/* 扉页书名：封面页旁白上方，衬线金字 */
.page-sheet__title {
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-align: center;
}
/* 扉页副标题：书名下面一行小字 */
.page-sheet__subtitle {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-align: center;
}
.page-sheet__caption {
  margin-top: 8px;
  padding: 0 6px;
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink-soft);
  text-align: center;
  min-height: 2.6em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}
.page-sheet__caption::before {
  content: "✦";
  display: block;
  font-size: 9px;
  color: rgba(176, 134, 64, 0.75);
  margin-bottom: 2px;
}
.page-sheet__caption-line { display: block; width: 100%; }

/* ---------------- 漫画分格页 ----------------
   一页 2 格，竖排为主、奇数页横排；黑描边分格 + 左上角白底对白框 */
.comic {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.comic--row { flex-direction: row; }
.comic__panel {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--paper-2);
  border: 2.5px solid #2A2622;
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(42, 38, 34, 0.25);
}
.comic__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.comic__img--ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(135deg, rgba(176, 134, 64, 0.09) 0 10px, transparent 10px 20px),
    #f4ead4;
  color: var(--ink-faint);
  font-size: 11px;
}
.comic__img.is-fresh { animation: paintReveal 1.15s ease-out both; }
.comic__line {
  position: absolute;
  top: 8px;
  left: 8px;
  max-width: 78%;
  padding: 5px 10px 6px;
  background: #FDFAF2;
  border: 1.8px solid #2A2622;
  border-radius: 3px;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: #2A2622;
  box-shadow: 2px 2px 0 rgba(42, 38, 34, 0.18);
}
/* 对话框的小尖角：指向下方的说话人，像漫画里的对白气泡 */
.comic__line--speech::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 14px;
  width: 9px;
  height: 9px;
  background: #FDFAF2;
  border-right: 1.8px solid #2A2622;
  border-bottom: 1.8px solid #2A2622;
  transform: rotate(45deg);
}
/* 旁白框：没有尖角，纸色底、细一点，和台词区分开 */
.comic__line--narration {
  background: #FFFCF3;
  border-width: 1.4px;
  border-style: solid;
  box-shadow: 1.5px 1.5px 0 rgba(42, 38, 34, 0.14);
  font-size: 11.5px;
}
.comic__line .page-sheet__caption-line { display: block; }
.page-sheet__no {
  position: absolute;
  bottom: 10px;
  left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
}
.page-sheet__lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(247, 241, 227, 0.72);
  backdrop-filter: blur(6px);
  text-align: center;
  padding: 24px;
  gap: 10px;
}
.watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    -32deg,
    rgba(120, 96, 60, 0.07) 0 1px,
    transparent 1px 44px
  );
}
.watermark::after {
  content: "试读 · 魔法印书局";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-28deg);
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.3em;
  color: rgba(120, 96, 60, 0.16);
  white-space: nowrap;
}

.reader-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}
.reader-bar__nav {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.7);
  display: grid; place-items: center;
  font-size: 17px;
}
.reader-bar__nav[disabled] { opacity: 0.3; }
.reader-bar__mid { text-align: center; flex: 1; }
.reader-bar__mid b { font-family: var(--serif); font-size: 15px; }
.reader-bar__mid span { display: block; font-size: 10.5px; letter-spacing: 0.2em; color: var(--ink-faint); }

.book-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px 12px 12px 6px;
  overflow: hidden;
  position: relative;
  background: var(--deep);
  box-shadow: 0 22px 46px rgba(60, 12, 8, 0.42);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover__spine {
  position: absolute; left: 0; top: 0; bottom: 0; width: 16px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.06));
}
.book-cover__label {
  position: absolute;
  left: 16px; right: 16px; bottom: 0;
  padding: 40px 16px 18px;
  background: linear-gradient(0deg, rgba(12, 20, 16, 0.9) 10%, transparent 100%);
  color: #f5eedd;
}
.book-cover__label h3 { font-size: 20px; letter-spacing: 0.06em; }
.book-cover__label p { font-size: 11px; letter-spacing: 0.2em; color: var(--gold-2); margin-top: 3px; }

/* ---------- 书架 ---------- */

.shelf-list { display: flex; flex-direction: column; gap: 12px; }
.shelf-item {
  display: flex;
  gap: 14px;
  padding: 13px;
  border-radius: var(--r);
  background: #fffdf7;
  border: 1px solid var(--line);
  text-align: left;
  align-items: stretch;
  position: relative;
}
.shelf-item__del {
  margin-left: auto;
  flex: none;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
}
.shelf-item__del:hover { color: #6e1b14; border-color: rgba(110, 27, 20, 0.35); }
.shelf-item__thumb {
  width: 66px; flex: none;
  aspect-ratio: 3 / 4;
  border-radius: 4px 7px 7px 4px;
  overflow: hidden;
  background: var(--paper-2);
  position: relative;
  box-shadow: 0 4px 10px rgba(60, 44, 20, 0.18);
}
.shelf-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.shelf-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.shelf-item__title { font-family: var(--serif); font-size: 16px; margin-bottom: 3px; }
.shelf-item__sub { font-size: 11.5px; color: var(--ink-faint); }
.shelf-item__row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.tag {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
}
.tag--ok { color: var(--ok); border-color: rgba(63, 107, 74, 0.35); background: rgba(63, 107, 74, 0.07); }
.tag--wait { color: #8a6a1f; border-color: rgba(176, 134, 64, 0.4); background: rgba(176, 134, 64, 0.1); }
.tag--bad { color: var(--danger); border-color: rgba(166, 59, 50, 0.35); background: rgba(166, 59, 50, 0.07); }

/* ---------- 底部操作条 ---------- */

.actionbar {
  position: sticky;
  bottom: 0;
  z-index: 45;
  padding: 12px 18px calc(12px + var(--safe-b));
  background: rgba(252, 248, 239, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
}
.actionbar__price { flex: none; }
.actionbar__price b { font-family: var(--serif); font-size: 22px; color: var(--deep); }
.actionbar__price span { display: block; font-size: 10.5px; color: var(--ink-faint); letter-spacing: 0.1em; }
.actionbar .btn { flex: 1; }

/* ---------- 弹层 ---------- */

.sheet-host { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.sheet-host.is-open { pointer-events: auto; }
.sheet__mask {
  position: absolute; inset: 0;
  background: rgba(20, 18, 14, 0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.sheet-host.is-open .sheet__mask { opacity: 1; }
.sheet__panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + var(--safe-b));
  transform: translateY(102%);
  transition: transform 0.3s cubic-bezier(0.22, 0.78, 0.24, 1);
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.28);
}
.sheet-host.is-open .sheet__panel { transform: translateY(0); }
.sheet__grip {
  width: 38px; height: 4px; border-radius: 999px;
  background: var(--line-strong);
  margin: 0 auto 14px;
}
.sheet__title { font-size: 18px; margin-bottom: 6px; }

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 86vw;
}
.toast {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(26, 24, 20, 0.92);
  color: #f6efdd;
  font-size: 13px;
  line-height: 1.5;
  animation: toast-in 0.24s ease;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}
.toast--bad { background: rgba(140, 46, 38, 0.95); }
.toast--ok { background: rgba(34, 74, 52, 0.95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 登录 ---------- */

.auth-wrap {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px calc(32px + var(--safe-b));
  background:
    radial-gradient(118% 96% at 50% 2%, #7d2418 0%, #4f1024 40%, #280b28 74%, #150519 100%);
  color: #f4eddb;
}
.auth-wrap .hero__galaxy { opacity: 0.62; }
.auth-wrap__inner {
  position: relative;
  z-index: 3;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}
.auth-wrap .input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(217, 188, 122, 0.3);
  color: #f6efdd;
}
.auth-wrap .input::placeholder { color: rgba(246, 239, 221, 0.4); }
.auth-wrap .field__label { color: rgba(246, 239, 221, 0.7); }

/* ---------- 后台 ---------- */

.admin-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; gap: 4px;
  overflow-x: auto;
  padding: 10px 14px;
  background: #4a0f0b;
  scrollbar-width: none;
}
.admin-bar::-webkit-scrollbar { display: none; }
.admin-tab {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  color: rgba(246, 239, 221, 0.6);
  border: 1px solid transparent;
  white-space: nowrap;
}
.admin-tab.is-on {
  color: #f6efdd;
  background: rgba(217, 188, 122, 0.16);
  border-color: rgba(217, 188, 122, 0.4);
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}
.stat__n { font-family: var(--serif); font-size: 26px; line-height: 1.1; }
.stat__k { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.1em; margin-top: 4px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fffdf7; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th, table.grid td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.grid th { font-weight: 600; color: var(--ink-faint); font-size: 11px; letter-spacing: 0.08em; background: rgba(42, 38, 34, 0.03); }
table.grid td.wrap { white-space: normal; min-width: 180px; }
table.grid tr:last-child td { border-bottom: 0; }

.admin-row {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fffdf7;
  padding: 12px;
  margin-bottom: 10px;
}
.admin-row__top { display: flex; gap: 12px; }
.admin-row__thumb {
  width: 54px; aspect-ratio: 3/4; border-radius: 4px; overflow: hidden;
  background: var(--paper-2); flex: none;
}
.admin-row__thumb img { width: 100%; height: 100%; object-fit: cover; }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; flex: 1; min-width: 110px; }

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-faint);
}
.empty__glyph { font-family: var(--serif); font-size: 34px; color: var(--gold-2); margin-bottom: 10px; }

.notice {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.65;
  border: 1px solid rgba(176, 134, 64, 0.35);
  background: rgba(176, 134, 64, 0.08);
  color: #6d5320;
}
.notice--bad { border-color: rgba(166, 59, 50, 0.3); background: rgba(166, 59, 50, 0.06); color: #8c322a; }
.notice--ok { border-color: rgba(63, 107, 74, 0.3); background: rgba(63, 107, 74, 0.07); color: #2f5138; }

.skeleton {
  background: linear-gradient(90deg, rgba(42, 38, 34, 0.06) 25%, rgba(42, 38, 34, 0.11) 37%, rgba(42, 38, 34, 0.06) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.fade-in { animation: fade-in 0.32s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

.step-dots { display: flex; gap: 6px; justify-content: center; margin: 0 0 18px; }
.step-dots span {
  width: 26px; height: 3px; border-radius: 999px;
  background: var(--line-strong);
}
.step-dots span.is-on { background: var(--gold); }

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--line);
}
.summary-row:last-child { border-bottom: 0; }
.summary-row b { font-family: var(--serif); }
.summary-row--total { font-size: 15px; padding-top: 12px; }
.summary-row--total b { font-size: 20px; color: var(--deep); }

/* ==========================================================================
   魔法细节：星形光标 / 光晕 / 星尘 / 切页 / 高光 / 悬浮
   ========================================================================== */

@media (hover: hover) and (pointer: fine) {
  html {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M5.5 23 L15.5 12.6' stroke='%23B8863B' stroke-width='2.6' stroke-linecap='round'/%3E%3Cpath d='M17.5 3.5 L19.2 8.2 L23.9 9.9 L19.2 11.6 L17.5 16.3 L15.8 11.6 L11.1 9.9 L15.8 8.2 Z' fill='%23E9C87C' stroke='%236E1B14' stroke-width='1.1' stroke-linejoin='round'/%3E%3C/svg%3E") 17 10, auto;
  }
  button, a, .chip, .theme-card, .scene-opt, .shelf-item, label {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M5.5 23 L15.5 12.6' stroke='%236E1B14' stroke-width='2.6' stroke-linecap='round'/%3E%3Cpath d='M17.5 3.5 L19.2 8.2 L23.9 9.9 L19.2 11.6 L17.5 16.3 L15.8 11.6 L11.1 9.9 L15.8 8.2 Z' fill='%23E9C87C' stroke='%236E1B14' stroke-width='1.1' stroke-linejoin='round'/%3E%3C/svg%3E") 17 10, pointer;
  }
}

.magic-dust {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
}

.magic-halo {
  position: fixed;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  z-index: 899;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, width 0.22s ease, height 0.22s ease;
  background: radial-gradient(circle, rgba(233, 200, 124, 0.55) 0%, rgba(233, 200, 124, 0) 72%);
  mix-blend-mode: screen;
}
.magic-halo.is-on { opacity: 1; }
.magic-halo.is-big { width: 46px; height: 46px; }

/* 切页：一道纸光扫过，像翻过一页 */
.page-turn {
  position: absolute;
  inset: 0;
  z-index: 800;
  pointer-events: none;
  background: linear-gradient(
    104deg,
    rgba(248, 240, 222, 0) 18%,
    rgba(252, 246, 232, 0.92) 46%,
    rgba(233, 200, 124, 0.42) 52%,
    rgba(248, 240, 222, 0) 78%
  );
  animation: page-turn 0.6s cubic-bezier(0.4, 0.05, 0.2, 1) forwards;
}
.page-turn--back { animation-direction: reverse; }
@keyframes page-turn {
  0% { transform: translateX(-112%) skewX(-8deg); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translateX(112%) skewX(-8deg); opacity: 0; }
}

/* 收款码展示（解锁弹窗 + 后台设置）：大而清晰，允许长按识别 / 保存 */
.pay-qr {
  display: block;
  width: 240px;
  max-width: 78vw;
  margin: 6px auto 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  -webkit-touch-callout: default;   /* iOS 长按菜单：识别 / 保存 */
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
}

/* 在线客服悬浮按钮 */
#support-fab {
  position: fixed;
  right: 14px;
  bottom: 72px;
  z-index: 700;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(166, 59, 50, 0.35);
  background: #FFF8EC;
  color: #A63B32;
  box-shadow: 0 4px 14px rgba(90, 45, 25, 0.18);
  cursor: pointer;
  display: grid;
  place-items: center;
}
#support-fab svg { display: block; }
#app.no-tabbar ~ #support-fab,
body.no-tabbar #support-fab { bottom: 20px; }

/* 保存成功反馈 */
.btn.is-saved {
  background: var(--ok, #3E8E5A) !important;
  color: #fff !important;
  border-color: var(--ok, #3E8E5A) !important;
}

/* 绘制失败项：原因展示 */
.gen-item.is-failed { color: var(--danger, #A63B32); border-color: rgba(166, 59, 50, 0.4); }
.gen-item.is-failed .gen-item__dot { background: var(--danger, #A63B32); }

/* 整页翻页：一张纸从右侧掀起转过去，露出新界面 */
.book-flip {
  position: absolute;
  inset: 0;
  z-index: 800;
  pointer-events: none;
  perspective: 1400px;
  overflow: hidden;
}
.book-flip__sheet {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background:
    linear-gradient(102deg, rgba(120, 90, 40, 0.05) 0%, rgba(255, 255, 255, 0) 8%),
    linear-gradient(to bottom, #fcf5e4 0%, #f8efd8 55%, #f1e5c6 100%);
  box-shadow:
    -10px 0 28px rgba(60, 44, 20, 0.16),
    inset -14px 0 22px rgba(120, 90, 40, 0.14);
  animation: book-flip 0.72s cubic-bezier(0.55, 0.06, 0.35, 1) forwards;
}
/* 纸背（转过 90° 后短暂可见的一面）：稍暗，像纸张背面 */
.book-flip--back .book-flip__sheet {
  transform-origin: right center;
  animation-name: book-flip-back;
}
@keyframes book-flip {
  0%   { transform: rotateY(-16deg); }
  55%  { transform: rotateY(-88deg); }
  100% { transform: rotateY(-178deg); }
}
@keyframes book-flip-back {
  0%   { transform: rotateY(16deg); }
  55%  { transform: rotateY(88deg); }
  100% { transform: rotateY(178deg); }
}
@media (prefers-reduced-motion: reduce) {
  .book-flip { display: none; }
}

/* 卡片高光扫过 *//* 卡片高光扫过 */
.theme-card { position: relative; }
.theme-card::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -80%;
  width: 60%;
  height: 220%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: rotate(12deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
@media (hover: hover) and (pointer: fine) {
  .theme-card:hover::after {
    opacity: 1;
    animation: glint 0.9s ease forwards;
  }
}
@keyframes glint {
  from { left: -80%; }
  to { left: 130%; }
}

/* 书封轻轻浮动 */
.book-cover { animation: floaty 7s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50% { transform: translateY(-7px) rotate(0.4deg); }
}

/* 首页底部的小装饰 */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--gold);
  opacity: 0.55;
  margin: 26px 0 6px;
}
.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  width: 54px;
  background: linear-gradient(90deg, transparent, var(--line-gold), transparent);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* 首页：留白与小步骤 */
.hero__note {
  margin-top: 16px;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: rgba(246, 239, 221, 0.55);
}

/* ---------- 品牌标识 ---------- */

.brand { text-align: center; }

.brand__seal {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.32));
  animation: sealIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.brand__seal svg { display: block; }

@keyframes sealIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

/* 花体字标：魔法阵衬底 + 烫金渐变 + 逐字大幅倾斜 */
.wordmark {
  position: relative;
  display: inline-block;
  margin: 6px 0 0;
  padding: 12px 30px 7px;
  font-weight: 400;
  text-align: center;
}
.wordmark::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2%;
  right: 2%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217, 188, 122, 0.6), transparent);
}

.wordmark__halo {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  opacity: 0.6;
  animation: haloSpin 90s linear infinite;
  pointer-events: none;
}
@keyframes haloSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.wordmark__text {
  position: relative;
  display: inline-block;
  font-family: "MB Kid", "MB Brush", "MB Script", "STXingkai", "华文行楷", "STKaiti", "KaiTi", serif;
  /* 5 个字（魔法印书局）：字号随屏宽流动，保证永远单行
     宽度 ≈ (5×1.12 − 0.12)em = 5.48em，留出内边距后不超屏 */
  font-size: min(66px, calc((100vw - 84px) / 5.48));
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  white-space: nowrap;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(58, 22, 8, 0.45)) drop-shadow(0 12px 26px rgba(0, 0, 0, 0.45));
}

/* 儿童笔触书写效果：逐字从左往右写出，笔尖是一颗会跑的小星星。
   动画挂在 html.mb-write 下 —— 进入动画播完才开写，否则会被 intro 盖住看不见 */
.wordmark__text .wc {
  display: inline-block;
  color: #F0DCA6;
  text-shadow: 0 1px 0 #B08B45, 0 3px 0 rgba(124, 90, 37, 0.55), 0 10px 22px rgba(0, 0, 0, 0.4);
  opacity: 0;
}
html.mb-write .wordmark__text .wc {
  opacity: 1;
  animation: writeChar 0.38s ease-out both;
  animation-delay: calc(var(--i) * 0.15s + 0.2s);
}
@keyframes writeChar {
  from { clip-path: inset(-18% 100% -18% -6%); transform: rotate(var(--tilt, 0deg)) translateY(calc(var(--dip, 0px) + 4px)); opacity: 0.35; }
  60% { opacity: 1; }
  to { clip-path: inset(-18% -10% -18% -6%); transform: rotate(var(--tilt, 0deg)) translateY(var(--dip, 0px)); opacity: 1; }
}
.wordmark__pen {
  position: absolute;
  top: 26%;
  left: 4%;
  width: 15px;
  height: 15px;
  background: linear-gradient(180deg, #fff8e2 0%, #e6c98c 55%, #b08b45 100%);
  clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
  filter: drop-shadow(0 0 8px rgba(255, 226, 160, 0.85));
  pointer-events: none;
  opacity: 0;
  animation: penTravel calc(var(--wc-n, 3) * 0.3s + 0.25s) linear both;
}
html.mb-write .wordmark__pen { opacity: 1; animation-delay: 0.25s; }
@keyframes penTravel {
  0% { left: 4%; opacity: 0; transform: rotate(0deg); }
  8% { opacity: 1; }
  86% { opacity: 1; }
  100% { left: 86%; opacity: 0; transform: rotate(40deg); }
}

/* 拉丁字 Magicbook Press：儿童体逐字母手写，中文写完后按字母顺序落笔，笔尖星星跟着跑 */
.brand__latin { position: relative; }
.latin-run { position: relative; display: inline-block; }
.brand__latin .wl { display: inline-block; opacity: 0; }
.brand__latin .wl-gap { display: inline-block; width: 0.3em; }
.brand__latin.go .wl {
  opacity: 1;
  animation: writeLatin 0.3s ease-out both;
  animation-delay: calc(var(--li, 0) * 0.045s);
}
@keyframes writeLatin {
  from { clip-path: inset(-18% 100% -18% -6%); opacity: 0.3; transform: rotate(-3deg) translateY(2px); }
  70% { opacity: 1; }
  to { clip-path: inset(-18% -8% -18% -6%); opacity: 1; transform: none; }
}
.latin-pen {
  position: absolute;
  top: -10px;
  left: 2%;
  width: 11px;
  height: 11px;
  background: linear-gradient(180deg, #fff8e2 0%, #e6c98c 55%, #b08b45 100%);
  clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
  filter: drop-shadow(0 0 6px rgba(255, 226, 160, 0.9));
  pointer-events: none;
  opacity: 0;
}
.brand__latin.go .latin-pen {
  animation: latinPen calc(var(--wl-n, 10) * 0.045s + 0.3s) linear both;
}
@keyframes latinPen {
  0% { left: 2%; opacity: 0; transform: rotate(0deg); }
  8% { opacity: 1; }
  86% { opacity: 1; }
  100% { left: 93%; opacity: 0; transform: rotate(36deg); }
}

/* 笔顺书写（Hanzi Writer）：字标切换为逐字 SVG，按笔画顺序写 */
.wordmark__text.is-stroke {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.12em;
  color: initial;
}
/* 每字容器随字号缩放（原固定 60px，5 字会撑爆手机屏） */
.wordmark__text.is-stroke .hz { width: 0.85em; height: 0.85em; }
.wordmark__text.is-stroke .hz svg { display: block; }
.wordmark__text.is-stroke .wordmark__pen { display: none; }
/* 字与字错峰落笔 */
.wordmark__text.is-stroke .hz { opacity: 0; animation: hzIn 0.3s ease-out both; animation-delay: calc(var(--ci) * 0.55s); }
@keyframes hzIn { from { opacity: 0; } to { opacity: 1; } }
/* 笔顺写完切回儿童体：静态定稿，不再重播显影 */
.wordmark__text.is-done .wc {
  animation: none !important;
  opacity: 1 !important;
  clip-path: none !important;
  transform: rotate(var(--tilt, 0deg)) translateY(var(--dip, 0px)) !important;
}
.wordmark__text.is-done .wordmark__pen { display: none !important; }

.wordmark__flourish {
  position: absolute;
  top: 48%;
  width: 58px;
  height: 38px;
  transform: translateY(-50%);
  opacity: 0.9;
  pointer-events: none;
}
.wordmark__flourish--l { right: calc(100% - 2px); }
.wordmark__flourish--r { left: calc(100% - 2px); }

@media (max-width: 400px) {
  /* 字号已由 .wordmark__text 的 min() 流式计算，这里只收内边距 */
  .wordmark { padding: 13px 18px; }
  /* 窄屏收紧左右金线与拉丁字距，保证 Magicbook Press 单行 */
  .brand__rule { gap: 7px; }
  .brand__rule i { flex-basis: 16px; width: 16px; }
  .brand__latin { font-size: 12.5px; letter-spacing: 0.16em; }
}

.wordmark__swoosh {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 92%;
  height: 18px;
  transform: translateX(-50%);
  pointer-events: none;
}

.wordmark__star {
  position: absolute;
  display: block;
  background: linear-gradient(180deg, #fff8e2 0%, #e6c98c 55%, #b08b45 100%);
  clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
  animation: twinkle 3.4s ease-in-out infinite;
  animation-delay: var(--d, 0s);
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(255, 226, 160, 0.8));
}
@keyframes twinkle {
  0%, 100% { opacity: 0.4; transform: scale(0.78) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.12) rotate(14deg); }
}

.brand__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 5px;
  color: var(--gold-2);
}
.brand__rule i {
  display: block;
  width: 30px;
  height: 1px;
  flex: 0 1 30px;
  background: linear-gradient(90deg, transparent, rgba(217, 188, 122, 0.7));
}
.brand__rule i:last-child {
  background: linear-gradient(270deg, transparent, rgba(217, 188, 122, 0.7));
}
/* 拉丁字标是逐字母 inline-block，被 flex 挤压会从词中间折行 → 不允许收缩/换行 */
.brand__latin { flex: 0 0 auto; white-space: nowrap; }
.brand__latin {
  font-family: "MB Kid Latin", "Snell Roundhand", "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.22em;
  opacity: 0.92;
  transform: translateY(1px);
}

.brand__slogan {
  margin: 14px auto 0;
  max-width: 300px;
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: #f8eed6;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.32);
}

.hero--brand { text-align: center; padding-top: 38px; padding-bottom: 34px; }
.hero--brand .btn--cta {
  width: auto;
  min-width: 186px;
  padding: 0 30px;
  margin-top: 24px;
}

/* 深底页面（登录）上的选择芯片：默认深红会让选中项糊掉，单独换一套 */
.auth-wrap .chips { justify-content: center; }
.auth-wrap .chip {
  background: rgba(246, 239, 221, 0.07);
  border-color: rgba(217, 188, 122, 0.3);
  color: rgba(246, 239, 221, 0.7);
}
.auth-wrap .chip.is-on {
  background: linear-gradient(180deg, #f1dfb2 0%, var(--gold-2) 100%);
  border-color: rgba(217, 188, 122, 0.6);
  color: #3d2015;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.auth-wrap .wordmark__text { font-size: 36px; }
.auth-wrap .brand__latin { font-size: 13.5px; }
.auth-wrap .brand__slogan { font-size: 14px; margin-top: 12px; max-width: 280px; }

.steps-row { display: flex; gap: 8px; }
.step-chip {
  flex: 1;
  text-align: center;
  padding: 13px 6px;
  border-radius: 12px;
  border: 1px dashed var(--line-gold);
  background: rgba(255, 255, 255, 0.45);
  transition: transform 0.18s ease, background 0.18s ease;
}
.step-chip:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.8); }
.step-chip b {
  display: block;
  font-family: var(--serif);
  color: var(--gold);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2px;
}
.step-chip span { font-size: 11.5px; color: var(--ink-soft); letter-spacing: 0.06em; }

/* 声音开关 */
.switch {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(42, 38, 34, 0.08);
  position: relative;
  flex: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch.is-on { background: var(--deep); border-color: var(--deep); }
.switch.is-on::after { transform: translateX(20px); }

/* ---------- 主题卡片：标志小图做底 ---------- */

.theme-card__field {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: 68px 68px;
  background-repeat: repeat;
  opacity: 1;
  pointer-events: none;
  /* 图案整张卡都在，只是文字区淡一点，右边更密 */
  -webkit-mask-image: linear-gradient(102deg, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.6) 34%, rgba(0, 0, 0, 0.96) 68%, #000 100%);
  mask-image: linear-gradient(102deg, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.6) 34%, rgba(0, 0, 0, 0.96) 68%, #000 100%);
}

.theme-card__ghost {
  position: absolute;
  right: -24px;
  top: 54%;
  z-index: 0;
  pointer-events: none;
  transform: translateY(-50%) rotate(-9deg);
}

.step-chip span {
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* 步骤条：中文下配小写英文 */
.step-chip em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 8.5px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  opacity: 0.7;
}

/* 语言切换 */
.lang-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.lang-pill {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.lang-pill.is-on {
  background: var(--deep);
  border-color: var(--deep);
  color: #f6efdd;
}

/* ---------- 阅读器：全书缩略图带 ---------- */

.reader-strip {
  display: flex;
  gap: 7px;
  margin-top: 14px;
  padding: 4px 2px 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.reader-strip::-webkit-scrollbar { display: none; }

.thumb {
  position: relative;
  flex: 0 0 52px;
  height: 70px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  scroll-snap-align: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb__ph {
  display: block;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(135deg, rgba(110, 27, 20, 0.06) 0 6px, transparent 6px 12px);
}
.thumb i {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-style: normal;
  font-size: 9px;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 3px;
  color: #f6efdd;
  background: rgba(60, 18, 12, 0.6);
}
.thumb__lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: rgba(60, 18, 12, 0.34);
  backdrop-filter: blur(1.5px);
}
.thumb.is-on {
  transform: translateY(-2px);
  border-color: var(--gold-2);
  box-shadow: 0 4px 12px rgba(80, 24, 16, 0.28), 0 0 0 1.5px var(--gold-2) inset;
}
.thumb.is-locked { opacity: 0.82; }

/* ---------- 首页：收费方式说明（不写金额） ---------- */

.promise {
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px dashed var(--line-gold);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.3));
}
.promise__row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
}
.promise__row + .promise__row { border-top: 1px solid rgba(150, 120, 70, 0.12); }
.promise__row span {
  flex: none;
  font-size: 8px;
  color: var(--gold);
  transform: translateY(-1px);
}

/* ---------- 试读结束：弹层里的价格卡 ---------- */

.paywall {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 22px 18px 18px;
  text-align: center;
  color: #f8eed6;
  background:
    radial-gradient(120% 90% at 50% -12%, #8d2d20 0%, #61160f 46%, #3d0c08 100%);
  border: 1px solid rgba(217, 188, 122, 0.34);
  box-shadow: 0 12px 30px rgba(60, 16, 10, 0.26);
}
.paywall__glow {
  position: absolute;
  left: 50%;
  top: -70px;
  width: 230px;
  height: 230px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(240, 208, 138, 0.42) 0%, transparent 66%);
  pointer-events: none;
}
.paywall__eyebrow {
  position: relative;
  font-size: 9px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  color: rgba(240, 208, 138, 0.74);
}
.paywall__book {
  position: relative;
  font-family: var(--serif);
  font-size: 19px;
  margin-top: 9px;
  letter-spacing: 0.04em;
}
.paywall__meta {
  position: relative;
  margin-top: 5px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: rgba(246, 239, 221, 0.62);
}
.paywall__price {
  position: relative;
  margin: 14px 0 2px;
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1.08;
  background: linear-gradient(180deg, #fff5da 0%, #e6c286 52%, #b08b45 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.3));
}
.paywall__unit {
  position: relative;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: rgba(246, 239, 221, 0.6);
}
.paywall__list {
  position: relative;
  list-style: none;
  margin: 16px 0 4px;
  padding: 14px 0 2px;
  border-top: 1px solid rgba(217, 188, 122, 0.22);
  text-align: left;
}
.paywall__list li {
  display: flex;
  gap: 9px;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(246, 239, 221, 0.86);
}
.paywall__list span {
  flex: none;
  font-size: 8.5px;
  line-height: 2.4;
  color: var(--gold-2);
}

/* ---------- 试读到最后一页露出的书签页 ---------- */

.page-sheet--end .page-sheet__frame {
  background:
    repeating-linear-gradient(135deg, rgba(176, 134, 64, 0.06) 0 9px, transparent 9px 18px),
    linear-gradient(168deg, #fdf7e8 0%, #f4e5c8 100%);
}
.preview-end {
  text-align: center;
  padding: 0 16px;
  color: #4a2a18;
}
.preview-end__stars {
  font-size: 11px;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: #c99a48;
  opacity: 0.85;
  margin-bottom: 14px;
}
.preview-end .eyebrow { color: #a9782f; }
.preview-end__title {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: 0.08em;
  margin: 10px 0 8px;
}
.preview-end p { color: #7a5535; }
.preview-end__cue {
  display: inline-block;
  margin-top: 18px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px dashed rgba(169, 120, 47, 0.5);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #8a5a2a;
}

/* ---------- 阅读底栏：只报试读进度，不报价格 ---------- */

.actionbar__trial { flex: 1; min-width: 0; }
.actionbar__trial b {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--deep);
}
.actionbar__trial span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.actionbar .actionbar__trial + .btn {
  flex: 0 0 auto;
  padding: 0 18px;
  min-width: 96px;
}

/* ---------- 首页 hero：会转的星系 ---------- */

.hero--brand {
  overflow: hidden;
  background:
    radial-gradient(118% 96% at 50% 4%, #7d2418 0%, #4f1024 38%, #280b28 70%, #150519 100%);
}

.hero__galaxy {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero--brand > .hero__inner { position: relative; z-index: 3; }

.galaxy__layer {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 178%;
  aspect-ratio: 1 / 1;
  margin-left: -89%;
  margin-top: -89%;
  opacity: 0.92;
  will-change: transform;
}
.galaxy__layer--a { animation: galaxySpin 150s linear infinite; }
.galaxy__layer--a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 16deg at 50% 50%,
      transparent 0deg,
      rgba(255, 198, 158, 0.10) 34deg,
      transparent 86deg,
      rgba(198, 150, 255, 0.08) 148deg,
      transparent 210deg,
      rgba(255, 176, 170, 0.09) 276deg,
      transparent 340deg);
  filter: blur(16px);
}
.galaxy__layer--b::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(60% 46% at 50% 50%, rgba(255, 214, 170, 0.1) 0%, transparent 70%);
  filter: blur(14px);
}
.galaxy__layer--b {
  animation: galaxySpin 260s linear infinite reverse;
  opacity: 0.6;
}
@keyframes galaxySpin {
  to { transform: rotate(360deg); }
}

.galaxy__core {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 66%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 222, 166, 0.34) 0%, rgba(214, 122, 92, 0.2) 34%, transparent 68%);
  filter: blur(6px);
}

.galaxy__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(18, 4, 18, 0.34) 72%, rgba(248, 240, 222, 0.96) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .galaxy__layer { animation: none !important; }
}

/* ==========================================================================
   写故事的三张「儿童涂鸦卡」：蜡笔边框 + 荧光打底 + 节日小涂鸦
   ========================================================================== */

/* 主题卡 · 荧光涂鸦版：蜡笔边框 + 歪斜 + 节日贴纸排 */
.theme-card--doodle {
  overflow: visible;
  min-height: 168px;
  border: 2.5px solid #2A2622;
  border-radius: 20px 26px 16px 26px / 26px 16px 26px 20px;
  transform: rotate(var(--tilt, -0.5deg));
  box-shadow: 4px 5px 0 rgba(42, 38, 34, 0.72);
  color: #2A2622;
}
/* 整卡铺满手绘小图案：文字区渐隐，右下角最密，不挡字 */
.theme-card--doodle .theme-card__field {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: 62px 62px;
  background-repeat: repeat;
  pointer-events: none;
  opacity: 1;
  -webkit-mask-image: linear-gradient(158deg, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.16) 52%, rgba(0, 0, 0, 0.9) 100%);
  mask-image: linear-gradient(158deg, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.16) 52%, rgba(0, 0, 0, 0.9) 100%);
}
.theme-card--doodle:active { transform: rotate(var(--tilt, -0.5deg)) scale(0.98); }
.theme-card--doodle .theme-card__kind {
  display: inline-block;
  background: #2A2622;
  color: #FFFDF4;
  border-radius: 10px 14px 10px 14px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.theme-card--doodle .theme-card__name {
  display: inline-block;
  font-size: 21px;
  font-weight: 800;
  color: #2A2622;
  background: linear-gradient(0deg, transparent 58%, rgba(255, 255, 255, 0.85) 58%);
}
.theme-card--doodle .theme-card__tag { color: rgba(42, 38, 34, 0.82); font-weight: 600; }
.theme-card--doodle .theme-card__foot {
  color: rgba(42, 38, 34, 0.78);
  border-top: 2px dashed rgba(42, 38, 34, 0.35);
  padding-top: 8px;
}
.doodle-stickers {
  position: absolute;
  right: 9px;
  bottom: 46px;
  display: flex;
  gap: 5px;
  pointer-events: none;
  z-index: 2;
}
.doodle-sticker {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  background: #FFFDF4;
  border: 2px solid #2A2622;
  border-radius: 10px 14px 10px 14px;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 2px 3px 0 rgba(42, 38, 34, 0.5);
}
.doodle-sticker svg { width: 20px; height: 20px; }
/* 散布在卡片上的手绘小图案：避开左上文字区，低透明度当纹理 */
.doodle-scatter {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  opacity: var(--o, 0.35);
  transform: rotate(var(--r, 0deg));
  pointer-events: none;
  z-index: 0;
}
.doodle-scatter svg { width: 100%; height: 100%; display: block; }
/* 铺满卡片的淡淡点阵/星点纹理（纯背景层，不会压到文字） */
.theme-card--doodle::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image:
    radial-gradient(rgba(42, 38, 34, 0.16) 1.5px, transparent 1.6px),
    radial-gradient(rgba(255, 253, 244, 0.55) 1.3px, transparent 1.4px);
  background-size: 17px 17px, 27px 27px;
  background-position: 0 0, 9px 12px;
  opacity: 0.75;
}
.theme-card--doodle > div:not(.doodle-stickers) { position: relative; z-index: 1; }
/* 「更多待解锁」小锁条 */
.more-locked {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 14px auto 0;
  max-width: 240px;
  padding: 7px 16px;
  border: 2px dashed rgba(42, 38, 34, 0.4);
  border-radius: 14px 18px 14px 18px;
  color: rgba(42, 38, 34, 0.65);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
}
.theme-card--doodle .theme-card__kind { margin-bottom: 6px; }
.theme-card--doodle .lock-badge {
  background: rgba(255, 253, 244, 0.92);
  border: 2px solid #2A2622;
  color: #2A2622;
  border-radius: 12px 16px 12px 16px;
  box-shadow: 2px 3px 0 rgba(42, 38, 34, 0.5);
  position: absolute;
  z-index: 3;
}

.doodle-card {
  position: relative;
  margin-bottom: 20px;
  padding: 14px 14px 12px;
  border: 1.5px solid #8a5a3a;
  border-radius: 20px 26px 16px 26px / 26px 16px 26px 20px;
  transform: rotate(var(--tilt, -0.6deg));
  box-shadow: 3px 4px 0 rgba(166, 59, 50, 0.12), 0 1px 0 rgba(255, 253, 244, 0.8) inset;
}
/* 与全站红色魔法书同调的羊皮纸打底，替代原先的荧光色 */
.doodle-card--season   { background: linear-gradient(160deg, #FFF8E9 0%, #FFEBC9 100%); }
.doodle-card--place    { background: linear-gradient(160deg, #FFF3ED 0%, #FFDFD2 100%); }
.doodle-card--activity { background: linear-gradient(160deg, #FBF3E3 0%, #F2E3C4 100%); }

.doodle-card__title {
  display: inline-block;
  margin-bottom: 10px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: #5A3E2B;
  background: linear-gradient(0deg, transparent 62%, rgba(255, 255, 255, 0.85) 62%);
}
.doodle-card__doodle { position: absolute; opacity: 0.9; pointer-events: none; }
.doodle-card__doodle--a { top: 8px; right: 10px; }
.doodle-card__doodle--b { top: 44px; right: 16px; }

.doodle-card .chips { gap: 8px; }
.doodle-card .chip {
  background: #FFFDF6;
  border: 1.5px solid #8a5a3a;
  border-radius: 16px 22px 14px 24px;
  color: #5A3E2B;
  font-weight: 700;
  box-shadow: 1.5px 2px 0 rgba(166, 59, 50, 0.14);
}
.doodle-card .chip:nth-child(4n+1) { background: #FFF6E3; }
.doodle-card .chip:nth-child(4n+2) { background: #FDF0E4; }
.doodle-card .chip:nth-child(4n+3) { background: #FFF3F0; }
.doodle-card .chip:nth-child(4n+4) { background: #FAF4E6; }
.doodle-card .chip.is-on {
  background: #A63B32 !important;
  border-color: #A63B32;
  color: #FFF8EC;
  transform: rotate(-1.5deg);
}

/* 第二页：只呈现当前这一步（01 传照片），完成后自动进入下一项 */
.homebook__page--steps { padding-top: 46px; }
.steps-center {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 10px 4px 30px;
}
.step-now {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
}
.step-now b {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  color: var(--accent);
}
.step-now span {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--ink);
}
.step-now em {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: var(--ink-faint);
}
.step-now p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-soft); }

/* ==========================================================================
   AI 生成等待动画：魔法书上翻动的书页 + 环绕的小星星
   ========================================================================== */

.casting { position: relative; width: 190px; height: 128px; margin: 0 auto 14px; }
.casting__page {
  position: absolute;
  top: 36px;
  width: 70px;
  height: 84px;
  border: 2px solid rgba(169, 134, 63, 0.85);
  background: linear-gradient(160deg, rgba(244, 224, 174, 0.35), rgba(169, 134, 63, 0.16));
}
.casting__page--l { left: 24px; border-radius: 9px 4px 4px 9px; }
.casting__page--r { right: 24px; border-radius: 4px 9px 9px 4px; }
.casting__leaf {
  position: absolute;
  top: 38px;
  left: 50%;
  width: 56px;
  height: 80px;
  margin-left: -28px;
  border: 2px solid rgba(217, 188, 122, 0.95);
  border-radius: 6px;
  background: linear-gradient(160deg, #FBF2DA 0%, #E8D5A8 100%);
  box-shadow: 0 4px 12px rgba(60, 20, 10, 0.25);
  animation: leafFlip 1.6s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}
@keyframes leafFlip {
  0% { transform: translateX(-30px) scaleX(1); }
  50% { transform: translateX(0) scaleX(0.12); }
  100% { transform: translateX(30px) scaleX(1); }
}
.casting__star {
  position: absolute;
  color: #E8C98A;
  text-shadow: 0 0 10px rgba(255, 226, 160, 0.85);
  animation: castTwinkle 1.8s ease-in-out infinite;
}
.casting__star--1 { top: 4px; left: 50%; margin-left: -9px; font-size: 18px; }
.casting__star--2 { top: 24px; left: 14px; font-size: 12px; animation-delay: 0.4s; }
.casting__star--3 { top: 28px; right: 16px; font-size: 14px; animation-delay: 0.9s; }
@keyframes castTwinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.2) rotate(18deg); }
}
.casting__glow {
  position: absolute;
  left: 50%;
  top: 74px;
  width: 150px;
  height: 46px;
  margin-left: -75px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 222, 166, 0.4), transparent);
  filter: blur(8px);
  animation: castGlow 2.4s ease-in-out infinite;
}
@keyframes castGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ==========================================================================
   进入动画：书页左右翻开 + 星子升起
   ========================================================================== */

.intro {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(130% 100% at 50% 0%, #7A2418 0%, #5C150F 52%, #380B06 100%);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.intro.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
html.no-intro .intro { display: none; }

.intro__stage { text-align: center; }

.intro__book {
  position: relative;
  width: 204px;
  height: 138px;
  margin: 0 auto 26px;
  perspective: 900px;
}
.intro__page {
  position: absolute;
  top: 10px;
  width: 92px;
  height: 114px;
  border: 2px solid rgba(217, 188, 122, 0.9);
  background: linear-gradient(160deg, rgba(244, 224, 174, 0.26), rgba(169, 134, 63, 0.14));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35), inset 0 0 24px rgba(255, 237, 194, 0.12);
}
.intro__page--l {
  left: 10px;
  border-radius: 12px 3px 3px 12px;
  transform-origin: right center;
  animation: introPageL 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}
.intro__page--r {
  right: 10px;
  border-radius: 3px 12px 12px 3px;
  transform-origin: left center;
  animation: introPageR 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}
@keyframes introPageL {
  from { transform: rotateY(86deg); opacity: 0; }
  to { transform: rotateY(0); opacity: 1; }
}
@keyframes introPageR {
  from { transform: rotateY(-86deg); opacity: 0; }
  to { transform: rotateY(0); opacity: 1; }
}
.intro__spine {
  position: absolute;
  left: 50%;
  top: 2px;
  bottom: 2px;
  width: 2px;
  transform: translateX(-50%) scaleY(0);
  background: linear-gradient(180deg, transparent, #D9BC7A 28%, #D9BC7A 72%, transparent);
  animation: introSpine 0.8s ease-out both;
}
@keyframes introSpine {
  from { transform: translateX(-50%) scaleY(0); }
  to { transform: translateX(-50%) scaleY(1); }
}
.intro__star {
  position: absolute;
  left: 50%;
  top: -26px;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  animation: introStar 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.95s both;
}
@keyframes introStar {
  from { transform: scale(0) rotate(-40deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}
.intro__word {
  font-family: "MB Kid", "MB Brush", "STKaiti", "KaiTi", serif;
  font-size: 46px;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  background: linear-gradient(168deg, #fffaea 0%, #f8e4b4 30%, #dcb470 55%, #e8c887 78%, #fff6d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(58, 22, 8, 0.45));
  animation: introWord 0.8s ease-out 1.2s both;
}
.intro__latin {
  margin-top: 8px;
  font-family: "MB Kid Latin", cursive;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: rgba(244, 224, 174, 0.8);
  animation: introWord 0.8s ease-out 1.5s both;
}
@keyframes introWord {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   首页：一本厚厚的魔法书（一页一页翻）
   ========================================================================== */

.homebook { position: relative; padding: 12px 14px 16px; }

/* 语言切换：常驻首页右上角 */
.homebook__lang {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 8;
  display: flex;
  gap: 6px;
}
.homebook__lang .lang-pill {
  background: rgba(255, 251, 240, 0.88);
  border: 1px solid rgba(169, 134, 63, 0.55);
  color: #5C150F;
  box-shadow: 0 2px 8px rgba(30, 6, 3, 0.18);
}
.homebook__lang .lang-pill.is-on {
  background: #D9BC7A;
  border-color: #D9BC7A;
  color: #4A2A14;
}

/* 书的外壳：深红皮面 + 双层金框 + 左书脊 + 右侧页叠边，做出厚度 */
.homebook__stage {
  position: relative;
  min-height: calc(100dvh - 200px);
  border-radius: 16px;
  overflow: hidden;
  perspective: 1300px;
  touch-action: pan-y;
  background:
    radial-gradient(120% 90% at 22% -10%, rgba(255, 196, 160, 0.16) 0%, transparent 55%),
    radial-gradient(130% 110% at 50% 0%, #7A2418 0%, #5C150F 55%, #3E0C07 100%);
  box-shadow:
    inset 0 0 0 1px rgba(217, 188, 122, 0.55),
    inset 0 0 0 5px rgba(92, 21, 15, 0.9),
    inset 0 0 0 6px rgba(217, 188, 122, 0.28),
    0 18px 44px rgba(40, 8, 4, 0.4);
}
/* 左书脊：深色皮革条 + 双缝线 */
.homebook__stage::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  z-index: 5;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, transparent 0 10px, rgba(217, 188, 122, 0.4) 10px 12px),
    linear-gradient(90deg, #3E0C07 0%, #5C150F 70%, rgba(92, 21, 15, 0) 100%);
  box-shadow: inset -2px 0 5px rgba(0, 0, 0, 0.4);
}
/* 右侧页叠边：一叠纸的细纹，暗示这是一本厚书 */
.homebook__stage::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 10px;
  bottom: 10px;
  width: 9px;
  z-index: 5;
  pointer-events: none;
  border-radius: 0 4px 4px 0;
  background: repeating-linear-gradient(90deg, #EFE3C4 0 2px, #D9C9A2 2px 3px, #F3E8CB 3px 5px);
  box-shadow: -3px 0 8px rgba(0, 0, 0, 0.28);
}

.homebook__page {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 20px 96px;
}
.homebook__page.is-active { display: block; }

/* 翻页：一张薄羊皮纸快速横扫（无透视）——盖住旧页再卷走露出新页。
   单层、轻阴影，节奏快，不拖沓。 */
.homebook__sweep {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 2px;
  right: 2px;
  z-index: 30;
  display: none;
  pointer-events: none;
  border-radius: 4px 10px 10px 4px;
  background:
    linear-gradient(90deg, rgba(46, 9, 5, 0.22) 0%, rgba(46, 9, 5, 0) 8%),
    linear-gradient(-90deg, rgba(46, 9, 5, 0.22) 0%, rgba(46, 9, 5, 0) 8%),
    repeating-linear-gradient(0deg, rgba(178, 146, 96, 0.06) 0 2px, transparent 2px 6px),
    linear-gradient(90deg, #EFE2BE 0%, #FBF2DA 42%, #F5E9C6 78%, #EDDCB2 100%);
  box-shadow:
    inset 0 0 0 2px rgba(217, 188, 122, 0.35),
    inset 0 0 24px rgba(120, 80, 30, 0.16),
    0 6px 16px rgba(30, 6, 3, 0.3);
}
.homebook__sweep.is-run { display: block; will-change: transform; backface-visibility: hidden; }
.homebook__sweep.sweep-next  { animation: sweepNext 0.42s cubic-bezier(0.5, 0, 0.4, 1) both; }
.homebook__sweep.sweep-prev  { animation: sweepPrev 0.42s cubic-bezier(0.5, 0, 0.4, 1) both; }
@keyframes sweepNext {
  0% { transform: translateX(108%); }
  50% { transform: translateX(0); }
  100% { transform: translateX(-108%); }
}
@keyframes sweepPrev {
  0% { transform: translateX(-108%); }
  50% { transform: translateX(0); }
  100% { transform: translateX(108%); }
}

/* 内页：羊皮纸，靠近书脊处有凹陷阴影 */
.homebook__page--paper {
  background:
    /* 羊皮褶皱：斜向折痕 + 高光鼓包 + 压痕阴影 */
    repeating-linear-gradient(94deg, transparent 0 41px, rgba(120, 74, 30, 0.028) 41px 44px, transparent 44px 96px),
    repeating-linear-gradient(167deg, transparent 0 63px, rgba(120, 74, 30, 0.024) 63px 66px, transparent 66px 134px),
    repeating-linear-gradient(128deg, transparent 0 109px, rgba(255, 252, 240, 0.3) 109px 112px, transparent 112px 221px),
    radial-gradient(42% 28% at 80% 16%, rgba(120, 74, 30, 0.05) 0%, transparent 72%),
    radial-gradient(48% 32% at 10% 62%, rgba(255, 252, 240, 0.4) 0%, transparent 74%),
    radial-gradient(56% 38% at 88% 84%, rgba(120, 74, 30, 0.055) 0%, transparent 74%),
    linear-gradient(90deg, rgba(62, 12, 7, 0.14) 0%, rgba(62, 12, 7, 0) 26px),
    radial-gradient(120% 90% at 12% -8%, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(158deg, #FBF3DF 0%, #F4E8CB 60%, #EDDDB6 100%);
}
/* 封面（深红底）也铺褶皱：暗色折痕 + 微弱金光 */
.homebook__page--cover {
  background:
    repeating-linear-gradient(96deg, transparent 0 38px, rgba(0, 0, 0, 0.14) 38px 40px, transparent 40px 84px),
    repeating-linear-gradient(171deg, transparent 0 57px, rgba(0, 0, 0, 0.12) 57px 59px, transparent 59px 118px),
    repeating-linear-gradient(126deg, transparent 0 97px, rgba(255, 214, 150, 0.045) 97px 99px, transparent 99px 191px),
    radial-gradient(42% 28% at 82% 20%, rgba(0, 0, 0, 0.16) 0%, transparent 70%),
    radial-gradient(48% 32% at 14% 58%, rgba(255, 196, 130, 0.05) 0%, transparent 72%),
    radial-gradient(56% 38% at 86% 86%, rgba(0, 0, 0, 0.2) 0%, transparent 72%);
}
.homebook__page--cover { color: #F6EFDD; }
/* 星系图自带的米色渐隐是给旧版整页 hero 用的，装进书页后会把下半页刷白 */
.homebook__page--cover .galaxy__veil { display: none; }
.homebook__page--cover .hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 18px 6px 8px;
}
/* 封面空间紧，徽章与字标按比例收一点，保证「开始制作」和三个步骤一屏可见 */
.homebook__page--cover .brand__seal svg { width: 74px; height: 74px; }
.homebook__page--cover .wordmark__text { font-size: min(54px, calc((100vw - 132px) / 5.5)); letter-spacing: 0.1em; text-indent: 0.1em; }
.homebook__page--cover .wordmark { padding: 8px 22px; }
.homebook__page--cover .brand__slogan { margin-top: 10px; font-size: 16px; }
.homebook__page--cover .btn--cta { margin-top: 16px; }
.homebook__page--cover .steps-row { margin-top: 12px; }
.homebook__page--cover .step-chip {
  border: 1px dashed rgba(217, 188, 122, 0.55);
  background: rgba(255, 255, 255, 0.08);
}
.homebook__page--cover .step-chip b { color: #E8C98A; }
.homebook__page--cover .step-chip span { color: #F6EFDD; }
.homebook__page--cover .step-chip em { color: rgba(246, 239, 221, 0.6); }
.homebook__page--cover .promise { margin-top: 22px; }
/* 主题页顶部给语言按钮让出位置 */
.homebook__page--paper { padding-top: 46px; }
.homebook__page--cover .step-chip {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(217, 188, 122, 0.4);
  color: #F6EFDD;
}
.homebook__page--cover .step-chip em { color: rgba(246, 239, 221, 0.55); }
/* 封面上的三条承诺与隐私小字：从浅色卡换成深底金线的夜读版 */
.homebook__page--cover .promise {
  margin-top: 26px;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(217, 188, 122, 0.4);
}
.homebook__page--cover .promise__row { color: #F6EFDD; }
.homebook__page--cover .promise__row span { color: #E8C98A; }

.homebook__hint,
.homebook__pagefoot {
  margin-top: 10px;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: rgba(92, 45, 20, 0.55);
}
.homebook__page--cover .homebook__hint { color: rgba(246, 239, 221, 0.6); }

.homebook__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
}
.homebook__arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(92, 21, 15, 0.35);
  background: rgba(92, 21, 15, 0.06);
  color: #5C150F;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.homebook__arrow:active { transform: scale(0.92); }
.homebook__arrow:disabled { opacity: 0.28; cursor: default; }
.homebook__dots { display: flex; gap: 8px; }
.homebook__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(92, 21, 15, 0.22);
  transition: background 0.3s ease, transform 0.3s ease;
}
.homebook__dot.is-on { background: #B0863F; transform: scale(1.3); }

/* ==========================================================================
   成书后的「绘制浮现」特效：刚画好的页像被画笔显影一样浮现
   ========================================================================== */

.page-sheet__frame { position: relative; }

.page-sheet__img.is-fresh { animation: paintReveal 1.15s ease-out both; }
@keyframes paintReveal {
  0% { opacity: 0.12; filter: grayscale(1) brightness(1.5) blur(7px); transform: scale(1.05); }
  40% { opacity: 0.7; filter: grayscale(0.75) brightness(1.15) blur(3px); }
  100% { opacity: 1; filter: none; transform: none; }
}
.page-sheet--fresh .page-sheet__frame::after {
  content: "✦";
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 26px;
  color: #E8C77B;
  text-shadow: 0 0 14px rgba(255, 226, 160, 0.9);
  pointer-events: none;
  animation: paintSpark 1s ease-out both;
}
@keyframes paintSpark {
  0% { transform: scale(0) rotate(-60deg); opacity: 0; }
  55% { transform: scale(1.3) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 0.85; }
}
.book-cover--fresh img { animation: paintReveal 1.2s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .wc,
  .wordmark__pen,
  .page-sheet__img.is-fresh,
  .page-sheet--fresh .page-sheet__frame::after,
  .book-cover--fresh img,
  .intro__page--l,
  .intro__page--r,
  .intro__spine,
  .intro__star,
  .intro__word,
  .intro__latin,
  .homebook__page.is-leaving-l,
  .homebook__page.is-leaving-r,
  .homebook__page.is-entering-l,
  .homebook__page.is-entering-r,
  .homebook__sweep.is-run,
  .homebook__sweep2.is-run,
  .casting__leaf,
  .casting__star,
  .casting__glow { animation: none !important; }
  .is-leaving-l .homebook__shade,
  .is-leaving-r .homebook__shade { animation: none !important; opacity: 0 !important; }
  .homebook__sweep.is-run,
  .homebook__sweep2.is-run { display: none !important; }
  .wc { clip-path: none !important; transform: none !important; opacity: 1 !important; }
  .brand__latin .wl { opacity: 1 !important; clip-path: none !important; animation: none !important; }
  .wordmark__text.is-stroke .hz { opacity: 1 !important; animation: none !important; }
  .wordmark__pen { display: none !important; }
}


/* ---------------- 创作向导 · 形象预览 ---------------- */

.preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

.preview-card {
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid rgba(120, 95, 60, 0.18);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(60, 40, 20, 0.08);
}

.preview-card__frame {
  aspect-ratio: 3 / 4;
  background: rgba(120, 95, 60, 0.06);
}

.preview-card__frame img { display: block; }

.preview-card__meta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 10px 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.preview-card__meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
}

.preview-card__meta .tag {
  border: 1px solid rgba(120, 95, 60, 0.28);
  background: transparent;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11.5px;
  line-height: 1.2;
  color: var(--ink-soft);
  white-space: nowrap;
  text-align: center;
}

.preview-card__meta .tag[disabled] { opacity: 0.45; }

.preview-card { position: relative; }
.preview-card__frame { position: relative; overflow: hidden; }
.preview-card__frame img { width: 100%; height: 100%; object-fit: cover; }

.preview-card.is-busy .preview-card__frame img { opacity: 0.55; }

.preview-card__busy {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(42, 38, 34, 0.72);
  color: #FFF7E8;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.preview-card__thumbs {
  display: flex;
  gap: 6px;
  padding: 8px 10px 0;
  overflow-x: auto;
}

.preview-card__thumb {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(120, 95, 60, 0.24);
  background: none;
  cursor: pointer;
  opacity: 0.62;
  transition: opacity 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.preview-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.preview-card__thumb.is-on {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(176, 134, 64, 0.28);
}

/* ---------------- 首页：单页铺满屏幕 ---------------- */
.homebook--single {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.homebook--single .homebook__stage {
  flex: 1 1 auto;
  min-height: 0;
}

.homebook--single .homebook__page--cover {
  padding: 0;
  overflow: hidden;
}

.homebook--single .homebook__page--cover .hero__inner {
  min-height: 100%;
  justify-content: center;
  padding: 24px 18px calc(28px + env(safe-area-inset-bottom));
}

.homebook--single .homebook__page--cover .brand__seal svg { width: 84px; height: 84px; }
.homebook--single .homebook__page--cover .wordmark__text { font-size: min(58px, calc((100vw - 132px) / 5.5)); }
.homebook--single .homebook__page--cover .promise { margin-top: 26px; }

/* ---------------- 魔法棒书写（儿童体 + 笔顺蒙版） ---------------- */
.wordmark { position: relative; }

.wordmark .wand {
  position: absolute;
  left: 0;
  top: 0;
  width: 52px;
  height: 52px;
  opacity: 0;
  z-index: 6;
  pointer-events: none;
  transition: opacity 0.28s ease;
  filter: drop-shadow(0 3px 8px rgba(24, 6, 3, 0.45));
  transform-origin: 14.5px 12px;
  will-change: transform;
}
.wordmark .wand.is-on { opacity: 1; }
.wordmark .wand svg { display: block; }

.wand__spark {
  position: absolute;
  width: 7px;
  height: 7px;
  z-index: 5;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, #FFF9E6 0%, #F0DCA6 42%, rgba(240, 220, 166, 0) 72%);
  animation: wandSpark 0.72s ease-out forwards;
}
@keyframes wandSpark {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--sx, 0px)), calc(-50% + var(--sy, -14px))) scale(0.2); }
}

.wordmark__text.is-wand .wc {
  animation: none !important;
  opacity: 1;
  clip-path: none !important;
  -webkit-mask-image: radial-gradient(circle var(--wr, 0px) at var(--wx, 50%) var(--wy, 50%),
    #000 0%, #000 64%, rgba(0, 0, 0, 0.55) 80%, rgba(0, 0, 0, 0) 96%);
  mask-image: radial-gradient(circle var(--wr, 0px) at var(--wx, 50%) var(--wy, 50%),
    #000 0%, #000 64%, rgba(0, 0, 0, 0.55) 80%, rgba(0, 0, 0, 0) 96%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.wordmark__text.is-wand .wordmark__pen { display: none; }
