/* 字造集 - 主样式（最终版：开场 H5 + 六书造字主程序） */
/* 1. 字体  2. 开场变量  3. 主程序样式  4. 增强  5. 情绪动效  6. 开场 H5 层 */

/* 字造集：内置字体，避免手机预览因系统字体不同造成字形/排版跳变。 */
/* font-display: swap：文本先用回退字体显示，字体加载完成后无缝替换，避免手机端文字长时间空白/阻塞渲染 */
@font-face {
  font-family: "Zizaoji-Serif";
  src: url("../fonts/zizaoji-serif.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Zizaoji-Sans";
  src: url("../fonts/zizaoji-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Honglei-Banshu";
  /* woff2 无损压缩版（约原 ttf 一半体积），旧浏览器回退 ttf */
  src: url("../fonts/hongleibanshu.woff2") format("woff2"), url("../fonts/hongleibanshu.ttf") format("truetype");
  font-style: normal;
  font-weight: normal;
  font-display: swap;
}

:root {
  --font-ancient: "Zizaoji-Serif", serif;
  --font-modern: "Zizaoji-Sans", sans-serif;
  --font-minimal: "Zizaoji-Sans", "Helvetica Neue", Arial, sans-serif;
  --font-banshu: "Honglei-Banshu", "Zizaoji-Serif", serif;
}

/* ===== 开场 H5 CSS 变量 ===== */
:root {
--font-banshu: "Honglei-Banshu", "Songti SC", "STSong", "SimSun", serif;
      --ink-900: #000000;
      --paper-100: #f5f0e6;
      --paper-200: #e8e0d0;
      --paper-300: #9a9486;
      --seal: #a83f39;
      --seal-light: #c45c52;
      --gold: #b89b4a;
      --perspective: 1500px;
}

/* ===== 主程序样式 ===== */
/* 字造集 - 主样式 style.css */
/* 基于汉字构形美学与六书逻辑的汉字文化互动共创H5 */

/* ===== CSS变量 ===== */
:root {
  --color-paper: #f5f0e6;
  --color-paper-dark: #e8e0d0;
  --color-ink: #1a1a1a;
  --color-ink-light: #3a3a3a;
  --color-ink-muted: #6a6a6a;
  --color-seal: #b43232;
  --color-seal-dark: #8b2525;
  --color-gold: #c9a962;
  --color-border: #d4c9b5;
  --font-ancient: "STKaiti", "KaiTi", "楷体", "Songti SC", serif;
  --font-modern: "PingFang SC", "Microsoft YaHei", "微软雅黑", sans-serif;
  --font-minimal: "Helvetica Neue", "Arial", sans-serif;
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-ink: 0 2px 10px rgba(26, 26, 26, 0.15);
}

/* ===== 重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-modern);
  background: var(--color-paper);
  color: var(--color-ink);
  user-select: none;
  -webkit-user-select: none;
}

/* 宣纸纹理背景 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(201, 169, 98, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(180, 50, 50, 0.03) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ===== 应用容器 ===== */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
  overflow: hidden;
  z-index: 1;
}

/* ===== 页面通用 ===== */
.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-paper);
  z-index: 1;
}
.page.active {
  display: flex;
  animation: pageEnter 0.5s ease forwards;
  z-index: 10;
}

/* 顶部导航 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 5px;
  margin-bottom: 10px;
}
.top-bar .brand {
  font-family: var(--font-ancient);
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 4px;
  color: var(--color-ink);
}
.top-bar .brand-en {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--color-ink-muted);
  margin-top: 2px;
}
.top-bar .actions {
  display: flex;
  gap: 12px;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 16px;
}
.icon-btn:active {
  transform: scale(0.92);
  background: var(--color-paper-dark);
}

/* ===== P00 加载页 ===== */
/* ===== 加载页 Loading Page ===== */
.loading-page {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  background:
    radial-gradient(
      ellipse at center,
      rgba(255,255,255,.55) 0%,
      rgba(244,239,226,.8) 60%,
      rgba(226,219,201,.95) 100%
    );
  font-family: "Zizaoji-Serif", serif;
}
.loading-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/paper-bg.jpg");
  background-size: cover;
  background-position: center;
  opacity: .45;
  pointer-events: none;
}
.loading-word-wrap {
  position: relative;
  z-index: 1;
}
.loading-word {
  font-family: "Zizaoji-Serif", serif;
  font-size: 120px;
  color: #171614;
  margin-bottom: 30px;
  opacity: 0;
  filter: blur(5px);
  transform: translateY(10px) scale(.97);
  animation: inkReveal 1.2s ease forwards;
}
.loading-meaning {
  font-family: "Zizaoji-Serif", serif;
  font-size: 14px;
  color: #756c5d;
  line-height: 1.8;
  max-width: 280px;
  padding: 0 20px;
  opacity: 0;
  transform: translateY(8px);
  animation: meaningReveal 1s ease .35s forwards;
}
@keyframes inkReveal {
  0% { opacity: 0; filter: blur(5px); transform: translateY(10px) scale(.97); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
}
@keyframes meaningReveal {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== P01 开场页 ===== */
/* ===== 开场页 Opening Page ===== */
.opening-page {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(
      ellipse at center,
      rgba(255,255,255,.55) 0%,
      rgba(244,239,226,.8) 60%,
      rgba(226,219,201,.95) 100%
    );
  color: #211f1b;
  font-family: "Zizaoji-Serif", serif;
}
.opening-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/paper-bg.jpg");
  background-size: cover;
  background-position: center;
  opacity: .45;
  pointer-events: none;
  z-index: 0;
}

/* 顶部导航 */
.topbar {
  position: absolute;
  top: 42px;
  left: 48px;
  right: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-cn {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #211f1b;
}
.brand-en {
  font-family: Georgia, serif;
  font-size: 14px;
  letter-spacing: .5px;
  color: #777166;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.sound-btn,
.collection-btn {
  width: 44px;
  height: 44px;
  border: 1px solid #292723;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #222;
  cursor: pointer;
  transition: all 0.3s;
}
.sound-btn:hover,
.collection-btn:hover {
  background: rgba(0,0,0,0.06);
}
.collection-btn {
  font-family: "Zizaoji-Serif", serif;
  font-size: 18px;
}
.sound-icon-img {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

/* 水墨背景 */
.ink {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("../images/ink.png");
  opacity: 0;
  animation: inkAppear 2.5s ease 1.2s forwards;
  filter: blur(.3px);
}
.ink-left {
  left: -60px;
  bottom: 10%;
  width: 280px;
  height: 480px;
  transform: rotate(-15deg);
  opacity: 0;
  animation: inkAppearLeft 2.5s ease 1.2s forwards;
}
.ink-right {
  right: -50px;
  bottom: -60px;
  width: 420px;
  height: 480px;
  transform: rotate(20deg) scaleX(-1);
  opacity: 0;
  animation: inkAppearRight 2.5s ease 1.4s forwards;
}
.ink-bottom {
  left: 25%;
  bottom: -80px;
  width: 460px;
  height: 200px;
  opacity: 0;
  animation: inkAppearBottom 2.5s ease 1.6s forwards;
}
@keyframes inkAppearLeft {
  from { opacity: 0; transform: rotate(-15deg) scale(.96); }
  to { opacity: .42; transform: rotate(-15deg) scale(1); }
}
@keyframes inkAppearRight {
  from { opacity: 0; transform: rotate(20deg) scaleX(-1) scale(.96); }
  to { opacity: .38; transform: rotate(20deg) scaleX(-1) scale(1); }
}
@keyframes inkAppearBottom {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: .2; transform: scale(1); }
}

/* 第一阶段：问号 */
.question-intro {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}
.question-mark {
  width: 160px;
  height: auto;
  display: block;
  opacity: 0;
  transform: translateY(20px) scale(.95);
  filter: blur(5px);
  animation: questionShow 1.2s ease forwards;
}
.question-mark.hide {
  animation: questionHide 1s ease forwards;
}
@keyframes questionShow {
  0% { opacity: 0; transform: translateY(20px) scale(.95); filter: blur(5px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes questionHide {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

/* 第二阶段：正文内容 */
.hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 5;
  padding: 0 40px;
  opacity: 0;
  transform: translateY(18px);
  animation: heroAppear 1.2s ease 2.2s forwards;
}
@keyframes heroAppear {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 造字印章 */
.creation-seal {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
  background: url("../images/seal-zao.png") center / contain no-repeat;
  transform: rotate(-3deg);
  opacity: .95;
  filter: drop-shadow(0 2px 6px rgba(168,50,43,0.3));
}

/* 正文排版 */
.intro-text {
  font-size: 18px;
  line-height: 2;
  letter-spacing: 2px;
  color: #555048;
  margin-bottom: 28px;
}
.intro-text p {
  margin: 0;
}
.main-text {
  font-size: 24px;
  line-height: 1.9;
  letter-spacing: 2px;
  color: #211f1b;
  max-width: 600px;
  margin: 0 auto 0 auto;
}
.main-text span {
  color: #a8322b;
}

/* 开始造字按钮 */
.start-btn {
  margin-top: 44px;
  width: 220px;
  height: 54px;
  padding: 0;
  border: none;
  border-radius: 27px;
  background: #1b1b1b;
  color: #f5f0e6;
  font-family: "Zizaoji-Serif", serif;
  font-size: 17px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0,0,0,.12);
  transition: transform .25s ease, box-shadow .25s ease;
  opacity: 0;
  animation: btnAppear 0.8s ease 3.2s forwards;
}
.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,.16);
}
.start-btn .arrow {
  margin-left: 12px;
}
@keyframes btnAppear {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 底部墨滴提示 */
.ink-tip {
  margin-top: 36px;
  font-size: 14px;
  letter-spacing: 5px;
  color: #777166;
  opacity: 0;
  animation: tipAppear 0.8s ease 3.8s forwards;
}
@keyframes tipAppear {
  from { opacity: 0; }
  to { opacity: .8; }
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 40px;
  background: var(--color-ink);
  color: var(--color-paper);
  border: none;
  border-radius: 30px;
  font-family: var(--font-ancient);
  font-size: 17px;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.3s;
  animation: fadeInUp 1s ease 1.1s both;
  box-shadow: var(--shadow-soft);
}
.btn-primary:active {
  transform: scale(0.96);
  background: var(--color-ink-light);
}
.btn-primary .arrow {
  transition: transform 0.3s;
}
.btn-primary:active .arrow {
  transform: translateX(5px);
}

/* ===== P02 六书实验室 ===== */
#page-lab {
  padding-bottom: 20px;
}
.lab-header {
  text-align: center;
  margin-bottom: 20px;
}
.lab-title {
  font-family: var(--font-ancient);
  font-size: 24px;
  letter-spacing: 6px;
  margin-bottom: 8px;
}
.lab-subtitle {
  font-size: 13px;
  color: var(--color-ink-muted);
}
.lab-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 15px 0 25px;
}
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  transition: all 0.3s;
}
.progress-dot.active {
  background: var(--color-seal);
  width: 24px;
  border-radius: 4px;
}
.progress-dot.done {
  background: var(--color-ink);
}

.lab-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}
.lab-level-title {
  font-family: var(--font-ancient);
  font-size: 20px;
  color: var(--color-seal);
  margin-bottom: 5px;
}
.lab-level-hint {
  font-size: 13px;
  color: var(--color-ink-muted);
  margin-bottom: 25px;
  text-align: center;
  padding: 0 20px;
}

/* 象形关卡 - 演变时间轴 */
.evolution-box {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sun-image {
  width: 140px;
  height: 140px;
  margin-top: 20px;
  transition: opacity .3s ease, transform .3s ease;
}
.sun-image.change {
  animation: inkChange .6s ease;
}
@keyframes inkChange {
  0% { opacity: .3; transform: scale(.8); filter: blur(5px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
#stageText {
  margin-top: 20px;
  font-size: 14px;
  color: #756c5d;
  letter-spacing: 1px;
  min-height: 24px;
}
#timeline {
  width: 75%;
  margin-top: 40px;
  accent-color: #b83b32;
  cursor: pointer;
}
.timeline-label {
  display: flex;
  justify-content: space-between;
  width: 75%;
  margin: 12px auto 0 auto;
  color: #8a8174;
  font-size: 13px;
  text-align: center;
}
.timeline-label span {
  flex: 1;
  transition: color 0.3s;
}
.timeline-label span small {
  display: block;
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.7;
}
.timeline-label .active {
  color: #b83b32;
  font-weight: 600;
}
.stage-thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
  margin: 0 auto 4px;
  opacity: 0.7;
  transition: all 0.3s;
}
.timeline-label .active .stage-thumb {
  opacity: 1;
  transform: scale(1.15);
}

/* 会意关卡 - 拖拽组合 */
.huiyi-area {
  position: relative;
  width: 280px;
  height: 200px;
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  margin-bottom: 20px;
}
.huiyi-component {
  position: absolute;
  width: 70px;
  height: 70px;
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ancient);
  font-size: 40px;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  transition: box-shadow 0.2s;
  touch-action: none;
}
.huiyi-component:active {
  cursor: grabbing;
  box-shadow: var(--shadow-ink);
}
.huiyi-result {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-ancient);
  font-size: 80px;
  opacity: 0;
  transition: opacity 0.5s;
}
.huiyi-result.show {
  opacity: 1;
  animation: scaleIn 0.5s ease;
}

/* 指事关卡 */
.knife-area {
  position: relative;
  width: 200px;
  height: 160px;
  margin-bottom: 10px;
  transform: skew(30deg);
}
.zhishi-knife {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.mark-point {
  position: absolute;
  left: 40px;
  top: 120px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #b83232;
  cursor: pointer;
  touch-action: none;
  z-index: 10;
  box-shadow: 0 0 10px rgba(184,50,50,0.5);
  transition: transform 0.2s;
}
.mark-point:active {
  transform: scale(1.2);
}
.mark-success {
  animation: success 0.8s;
}
@keyframes success {
  0% { transform: scale(1); }
  50% { transform: scale(1.8); }
  100% { transform: scale(1); }
}
.drag-tip {
  font-size: 12px;
  color: var(--color-ink-muted);
  margin: 0 0 10px 0;
}
#knifeResult {
  font-family: var(--font-ancient);
  font-size: 48px;
  color: var(--color-seal);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 关卡成功提示 */
.level-success {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(245,240,230,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 30px 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: var(--shadow-ink);
  z-index: 100;
  display: none;
  animation: scaleIn 0.4s ease;
}
.level-success.show {
  display: block;
}
.level-success .check {
  font-size: 40px;
  color: #4a7c59;
  margin-bottom: 10px;
}
.level-success .text {
  font-family: var(--font-ancient);
  font-size: 15px;
  line-height: 1.8;
  color: var(--color-ink-light);
}
.level-success .badge {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 16px;
  background: var(--color-seal);
  color: #fff;
  border-radius: 12px;
  font-size: 13px;
}

/* ===== P03 能力值 ===== */
#page-ability {
  justify-content: center;
  align-items: center;
}
.ability-card {
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 35px 30px;
  width: 85%;
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow-soft);
}
.ability-title {
  font-family: var(--font-ancient);
  font-size: 22px;
  letter-spacing: 4px;
  margin-bottom: 25px;
}
.ability-item {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
}
.ability-label {
  width: 70px;
  font-size: 14px;
  color: var(--color-ink-light);
  text-align: right;
}
.ability-bar {
  flex: 1;
  height: 8px;
  background: var(--color-paper-dark);
  border-radius: 4px;
  overflow: hidden;
}
.ability-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-ink), var(--color-ink-light));
  border-radius: 4px;
  width: 0%;
  transition: width 1.5s ease;
}
.ability-value {
  width: 35px;
  font-size: 16px;
  font-weight: bold;
  color: var(--color-seal);
}

/* ===== P04 造字工坊 ===== */
#page-workshop {
  padding: 15px;
  display: flex;
  flex-direction: column;
}
.workshop-header {
  text-align: center;
  margin-bottom: 10px;
}
.workshop-title {
  font-family: var(--font-ancient);
  font-size: 20px;
  letter-spacing: 4px;
}
.workshop-subtitle {
  font-size: 12px;
  color: var(--color-ink-muted);
  margin-top: 4px;
}

/* 画布区域 */
.canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  position: relative;
}
.char-canvas {
  width: 220px;
  height: 220px;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  background: rgba(255,255,255,0.4);
  position: relative;
  overflow: hidden;
}

.char-canvas::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--color-border) 0, var(--color-border) 5px, transparent 5px, transparent 10px);
}
.char-canvas::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(0deg, var(--color-border) 0, var(--color-border) 5px, transparent 5px, transparent 10px);
}
.canvas-component {
  position: absolute;
  cursor: move;
  touch-action: none;
  transition: box-shadow 0.2s;
  transform-origin: center center;
  font-family: var(--font-banshu);
}
.canvas-component.selected {
  outline: 2px dashed var(--color-seal);
  outline-offset: 4px;
}
.canvas-component svg {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.canvas-empty-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-ancient);
  font-size: 16px;
  color: var(--color-ink-muted);
  text-align: center;
  pointer-events: none;
}

/* 结构选择 */
.structure-panel {
  margin: 10px 0;
}
.structure-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.structure-tab {
  flex: 1;
  padding: 6px;
  text-align: center;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.2s;
}
.structure-tab.active {
  background: var(--color-ink);
  color: var(--color-paper);
  border-color: var(--color-ink);
}
.structure-options {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.structure-option {
  padding: 5px 10px;
  font-size: 11px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.structure-option.active {
  background: var(--color-seal);
  color: #fff;
  border-color: var(--color-seal);
}

/* 构件库 */
.component-library {
  background: rgba(255,255,255,0.5);
  border-radius: 12px;
  padding: 10px;
  border: 1px solid var(--color-border);
}
.lib-categories {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.lib-cat {
  flex: 1;
  padding: 5px;
  text-align: center;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.lib-cat.active {
  background: var(--color-ink);
  color: var(--color-paper);
}
.lib-items {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}
.lib-item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-banshu);
  font-size: 22px;
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.lib-item:active {
  transform: scale(0.9);
  background: var(--color-paper-dark);
}
.lib-item.used {
  opacity: 0.4;
}

/* 操作按钮 */
.workshop-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.btn-secondary {
  flex: 1;
  padding: 12px;
  background: transparent;
  color: var(--color-ink);
  border: 1px solid var(--color-ink);
  border-radius: 25px;
  font-family: var(--font-ancient);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:active {
  background: var(--color-paper-dark);
}
.btn-generate {
  flex: 1.5;
  padding: 12px;
  background: var(--color-seal);
  color: #fff;
  border: none;
  border-radius: 25px;
  font-family: var(--font-ancient);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 10px rgba(180,50,50,0.3);
}
.btn-generate:active {
  transform: scale(0.97);
}
.btn-generate:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-free {
  flex: 1.2;
  padding: 12px;
  background: transparent;
  color: var(--color-ink);
  border: 1.5px solid var(--color-ink);
  border-radius: 25px;
  font-family: var(--font-ancient);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-free:hover:not(:disabled) {
  background: rgba(0,0,0,0.05);
}
.btn-free:active {
  transform: scale(0.97);
}
.btn-free:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 自由造字模式 */
.char-canvas.free-mode {
  cursor: default;
}
.char-canvas.free-mode .canvas-component {
  cursor: move;
  transition: none;
  user-select: none;
}
.char-canvas.free-mode .canvas-component.selected {
  outline: 2px dashed #bd3936;
  outline-offset: 4px;
}
.char-canvas.free-mode .canvas-component.selected::after {
  content: "";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 14px;
  height: 14px;
  background: #bd3936;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: nwse-resize;
  z-index: 10;
}
.char-canvas.free-mode .canvas-component.selected::before {
  content: "";
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: #bd3936;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: grab;
  z-index: 10;
}
.free-mode-tip {
  text-align: center;
  font-size: 12px;
  color: #8a8174;
  margin-top: 8px;
  padding: 6px;
  background: rgba(189,57,54,0.05);
  border-radius: 6px;
}

/* ===== P05 六书构形分析 ===== */
#page-analysis {
  justify-content: center;
  align-items: center;
  background: rgba(245, 240, 230, 0.95);
}
.analysis-ring {
  position: relative;
  width: 280px;
  height: 280px;
  margin-bottom: 30px;
}
.ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-banshu);
  font-size: 60px;
  z-index: 2;
}
.ring-outer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  animation: liushuRotate 30s linear infinite;
}
.ring-label {
  position: absolute;
  font-family: var(--font-ancient);
  font-size: 14px;
  color: var(--color-ink-muted);
  width: 50px;
  text-align: center;
}
/* 转盘停止后所有候选字保持一致，不加红/加粗/放大 */
.analysis-text {
  font-family: var(--font-ancient);
  font-size: 16px;
  color: var(--color-ink-light);
  animation: pulse 1.5s ease-in-out infinite;
}

/* ===== P06 释义页 ===== */
#page-meaning {
  justify-content: center;
}
.meaning-preview {
  text-align: center;
  margin-bottom: 25px;
}
.meaning-char {
  font-family: var(--font-banshu);
  font-size: 100px;
  margin-bottom: 10px;
}
.meaning-components {
  font-size: 14px;
  color: var(--color-ink-muted);
}
.meaning-input-area {
  margin-bottom: 25px;
}
.meaning-label {
  font-family: var(--font-ancient);
  font-size: 16px;
  margin-bottom: 10px;
  color: var(--color-ink);
}
.meaning-input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: rgba(255,255,255,0.6);
  font-family: var(--font-ancient);
  font-size: 15px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
.meaning-input:focus {
  border-color: var(--color-ink);
}
.style-selector {
  margin-bottom: 25px;
}
.style-title {
  font-family: var(--font-ancient);
  font-size: 16px;
  margin-bottom: 12px;
}
.style-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* 风格卡片：默认干净状态，只显示标题 */
.style-card {
  padding: 18px 16px;
  border: 1px solid #ded7c9;
  border-radius: 12px;
  background: rgba(255,255,255,0.38);
  color: #222;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}
.style-card:hover {
  border-color: #c9c0ad;
  background: rgba(255,255,255,0.55);
}
/* 点击后：红色描边 + 展开解释 */
.style-card.active {
  border: 2px solid #bd3936;
  background: rgba(189,57,54,0.035);
  text-align: left;
  padding: 16px;
}
.style-card-name {
  font-family: "Zizaoji-Serif", serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 2px;
  color: #222;
}
.style-card.active .style-card-name {
  color: #bd3936;
  margin-bottom: 6px;
}
/* 描述和解释：默认隐藏，active时显示 */
.style-card-desc,
.style-card-preview {
  display: none;
}
.style-card.active .style-card-desc {
  display: block;
  font-size: 13px;
  color: #8a8174;
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.style-card.active .style-card-preview {
  display: block;
  font-family: "Zizaoji-Serif", serif;
  font-size: 15px;
  line-height: 1.8;
  color: #211f1b;
  padding-top: 8px;
  border-top: 1px solid rgba(189,57,54,0.15);
}

/* 释义弹窗 */
.meaning-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 20, 0.12);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.meaning-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}
.meaning-modal {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 42px 30px 30px;
  background: rgba(248,245,237,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(216,205,187,0.5);
  border-radius: 16px;
  box-shadow: 0 15px 45px rgba(40, 30, 20, 0.12);
  text-align: center;
  animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.modal-close:hover {
  color: #333;
}
.modal-character {
  font-family: "Zizaoji-Serif", serif;
  font-size: 56px;
  color: #171717;
  margin-bottom: 10px;
  line-height: 1.2;
}
.modal-style {
  color: #c43b35;
  font-size: 16px;
  margin-bottom: 20px;
  letter-spacing: 2px;
}
.modal-meaning {
  font-family: "Zizaoji-Serif", serif;
  font-size: 16px;
  line-height: 2;
  color: #333;
  margin-bottom: 26px;
  padding: 0 10px;
}
.meaning-button {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 24px;
  background: #1c1c1c;
  color: white;
  font-family: "Zizaoji-Serif", serif;
  font-size: 16px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
}
.meaning-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

/* 风格选择古典弹窗 */
.style-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 30px;
}
.style-modal-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}
.style-modal {
  background: rgba(247,242,232,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(201,192,173,0.5);
  border-radius: 8px;
  padding: 36px 30px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.style-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/paper-bg.jpg");
  background-size: cover;
  opacity: 0.3;
  pointer-events: none;
  border-radius: 8px;
}
.style-modal > * {
  position: relative;
  z-index: 1;
}
.style-modal-title {
  font-family: "Zizaoji-Serif", serif;
  font-size: 22px;
  font-weight: 600;
  color: #a8322b;
  letter-spacing: 3px;
  margin-bottom: 6px;
}
.style-modal-desc {
  font-size: 13px;
  color: #8a8174;
  margin-bottom: 24px;
  letter-spacing: 1px;
}
.style-modal-text {
  font-family: "Zizaoji-Serif", serif;
  font-size: 17px;
  line-height: 1.9;
  color: #211f1b;
  margin-bottom: 30px;
  padding: 0 10px;
}
.style-modal-btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 26px;
  background: #191816;
  color: #f7f2e8;
  font-family: "Zizaoji-Serif", serif;
  font-size: 17px;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.25s;
}
.style-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.style-modal-btn .arrow {
  margin-left: 10px;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== 古籍字卡 ===== */
#page-charcard {
  justify-content: center;
  align-items: center;
}
.charcard-container {
  width: 85%;
  max-width: 320px;
}
.charcard {
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid #c9c0ad;
  border-radius: 6px;
  padding: 30px 24px 24px;
  text-align: center;
  position: relative;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  overflow: hidden;
}
.charcard::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/paper-bg.jpg");
  background-size: cover;
  opacity: 0.25;
  pointer-events: none;
  border-radius: 6px;
}
.charcard > * {
  position: relative;
  z-index: 2;
}
.charcard-header {
  margin-bottom: 16px;
  padding-right: 60px;
}
.charcard-brand {
  font-family: "Zizaoji-Serif", serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #211f1b;
}
.charcard-subtitle {
  font-size: 11px;
  color: #8a8174;
  letter-spacing: 2px;
  margin-top: 2px;
}
.charcard-char {
  font-family: var(--font-banshu);
  font-size: 64px;
  font-weight: 600;
  color: #171614;
  margin: 10px 0 6px;
  line-height: 1.2;
}
.charcard-components {
  font-size: 14px;
  color: #756c5d;
  letter-spacing: 2px;
  margin-bottom: 16px;
}
.charcard-divider {
  width: 60%;
  height: 1px;
  background: #d4ccba;
  margin: 14px auto;
}
.charcard-style {
  font-size: 15px;
  color: #a8322b;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.charcard-meaning {
  font-family: "Zizaoji-Serif", serif;
  font-size: 15px;
  line-height: 1.8;
  color: #211f1b;
  padding: 0 10px;
}
.charcard-footer {
  font-size: 11px;
  color: #a09888;
  letter-spacing: 2px;
  margin-top: 16px;
}

/* ===== P07 认证页 ===== */
#page-certify {
  justify-content: safe center;
  align-items: center;
}
.certify-personality {
  text-align: center;
  margin-bottom: 20px;
}
.personality-badge {
  display: inline-block;
  padding: 6px 20px;
  background: var(--color-seal);
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 15px;
}
.personality-name {
  font-family: var(--font-ancient);
  font-size: 32px;
  letter-spacing: 4px;
  margin-bottom: 8px;
}
.personality-desc {
  font-size: 14px;
  color: var(--color-ink-muted);
}
.certify-card {
  width: 85%;
  max-width: 320px;
  background: rgba(255,255,255,0.7);
  border: 2px solid var(--color-ink);
  border-radius: 8px;
  padding: 25px 20px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
/* 写实古籍印章 */
.forge-seal {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 56px;
  height: 56px;
  object-fit: contain;
  z-index: 1;
  opacity: 0.88;
  transform: rotate(-3deg);
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(168,50,43,0.3));
}
.certify-title {
  font-family: var(--font-ancient);
  font-size: 17px;
  letter-spacing: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
  padding-right: 56px;
  position: relative;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.certify-row,
.certify-declaration {
  position: relative;
  z-index: 2;
}
.certify-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}
.certify-row .label {
  color: var(--color-ink-muted);
}
.certify-row .value {
  font-weight: bold;
}
.certify-stars {
  color: var(--color-gold);
  letter-spacing: 2px;
}
.certify-declaration {
  margin-top: 20px;
  font-family: var(--font-ancient);
  font-size: 14px;
  color: var(--color-ink-light);
  font-style: italic;
}

/* ===== 造字人格 · 吊牌（Lanyard 原生等效效果） ===== */
/* React Bits 的 Lanyard 是 3D 吊牌：卡片从挂带垂下、受“重力”摆动、随指针倾斜、
   正面/背面可换图。本项目为原生 H5，用 CSS 3D + 指针视差等效实现。 */
.lanyard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 88%;
  max-width: 340px;
  margin: 0 auto;
  perspective: 1100px;
}
.lanyard-swing {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: top center;            /* 吊点：挂带顶端 */
  transform-style: preserve-3d;
  animation: lanyardSwing 4.6s ease-in-out infinite;
}
.lanyard-tilt {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .25s ease-out;
}
/* 挂带：自顶部向上延伸的织带 */
.lanyard-strap {
  width: 16px;
  height: 56px;
  margin-bottom: -3px;                     /* 与卡片轻微交叠，模拟穿过扣具 */
  background: repeating-linear-gradient(45deg, #b23a2e 0 7px, #922c22 7px 14px);
  border-radius: 5px 5px 0 0;
  box-shadow: inset 0 0 5px rgba(0,0,0,.28);
  transform-origin: top center;
}
/* 金属扣具 */
.lanyard-clip {
  width: 30px;
  height: 12px;
  background: linear-gradient(180deg, #ecd9a2, #b89a4f);
  border: 1px solid #9c7e34;
  border-radius: 3px;
  margin-bottom: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
/* 卡片翻面（对应 frontImage / backImage） */
.lanyard .certify-card {
  width: 100%;
  max-width: none;
  overflow: visible;                        /* preserve-3d 翻转需去掉裁剪 */
}
.certify-card {
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.4,.2,.2,1);
}
.certify-card.flipped { transform: rotateY(180deg); }
.certify-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.certify-face-front { position: relative; }
.certify-face-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(160deg, #fff8ec, #f3e6cf);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}
.certify-back-emblem {
  width: 78px; height: 78px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ancient);
  font-size: 38px;
  color: #fff;
  background: radial-gradient(circle at 40% 36%, #c0432f, #8f2c22);
  box-shadow: 0 4px 12px rgba(143,44,34,.4), inset 0 0 0 3px rgba(255,255,255,.18);
}
.certify-back-title {
  font-family: var(--font-ancient);
  font-size: 16px; letter-spacing: 2px;
  color: var(--color-ink);
}
.certify-back-name {
  font-size: 15px; font-weight: bold;
  color: var(--color-seal);
}
.certify-back-hint {
  font-size: 12px; color: var(--color-ink-muted);
}
@keyframes lanyardSwing {
  0%, 100% { transform: rotateZ(-2.4deg); }
  50%      { transform: rotateZ(2.4deg); }
}
@media (prefers-reduced-motion: reduce) {
  .lanyard-swing { animation: none; }
  .lanyard-tilt { transition: none; transform: none; }
  .certify-card { transition: none; }
}

/* ===== P09 海报页 ===== */
#page-poster {
  justify-content: flex-start;
  align-items: center;
  padding: 12px 18px 14px;
}
.poster-container {
  height: calc(100vh - 230px);
  max-height: 540px;
  aspect-ratio: 9/16;
  width: auto;
  max-width: 92vw;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-ink);
  margin-bottom: 20px;
  position: relative;
}
.poster-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}
/* 海报生成加载态：脚本懒加载 / html2canvas 渲染期间覆盖提示，避免空白被误认为「没跳转」 */
.poster-loading {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(10, 9, 8, 0.62);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  color: var(--paper-100, #f5f0e6);
  font-family: var(--font-kai, "弘磊板书", "STKaiti", "KaiTi", serif);
  font-size: 1.05rem;
  letter-spacing: 3px;
}
.poster-loading.hidden { display: none; }
.poster-spinner {
  width: 30px; height: 30px;
  border: 2px solid rgba(245, 240, 230, 0.25);
  border-top-color: var(--paper-100, #f5f0e6);
  border-radius: 50%;
  animation: posterSpin 0.9s linear infinite;
}
@keyframes posterSpin { to { transform: rotate(360deg); } }
.poster-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin-top: auto;
}
.poster-actions-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.poster-actions-row .btn-secondary,
.poster-actions-row .btn-generate {
  flex: 1;
}
.poster-bg-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  width: 100%;
  max-width: 300px;
  padding-bottom: 4px;
}
.bg-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.bg-dot.active {
  border-color: var(--color-seal);
  transform: scale(1.15);
}

/* 海报页按钮统一尺寸，三个按钮大小一致 */
#page-poster .poster-actions .btn-secondary,
#page-poster .poster-actions .btn-generate,
#page-poster .poster-actions #btn-new-char {
  padding: 10px 20px;
  font-size: 13px;
  border-radius: 22px;
  min-width: 120px;
  width: 100%;
  text-align: center;
}

/* ===== P10 字造集 ===== */
#page-collection {
  padding: 15px;
  display: flex;
  flex-direction: column;
}
.collection-header {
  text-align: center;
  margin-bottom: 20px;
}
.collection-title {
  font-family: var(--font-ancient);
  font-size: 22px;
  letter-spacing: 5px;
}
.collection-subtitle {
  font-size: 12px;
  color: var(--color-ink-muted);
  margin-top: 4px;
}
/* ===== 我的字造集 · Reel Gallery（倾斜胶片卷轴） ===== */
.reel-gallery {
  --reel-rh: 84px;
  --reel-tilt: 7deg;
  --reel-gap: 14px;
  --reel-radius: 12px;
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  perspective: 1100px;
  touch-action: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}
.collection-empty-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
}
.reel-stack {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-50%) rotateX(var(--reel-tilt));
  transform-style: preserve-3d;
}
.reel {
  display: flex;
  align-items: center;
  gap: var(--reel-gap);
  height: var(--reel-rh);
  margin-bottom: 14px;
  will-change: transform;
  transform-style: preserve-3d;
}
.reel-plate {
  flex: 0 0 auto;
  width: calc(var(--reel-rh) * 0.92);
  height: var(--reel-rh);
  border-radius: var(--reel-radius);
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--color-border);
  box-shadow: 0 6px 16px rgba(60,40,20,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  filter: grayscale(0.5) brightness(0.92);
  transition: filter 0.3s ease, transform 0.25s ease;
  transform-style: preserve-3d;
}
.reel-plate.focus { filter: grayscale(0) brightness(1.06); }
.reel-plate:active { transform: scale(0.94); }
.reel-glyph {
  font-family: var(--font-banshu);
  transform: scale(0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  pointer-events: none;
}
.reel-name {
  font-size: 11px;
  font-weight: bold;
  margin-top: 2px;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.reel-tag {
  font-size: 9px;
  color: var(--color-ink-muted);
  background: var(--color-paper-dark);
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 2px;
  pointer-events: none;
}
.collection-card {
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.collection-card:active {
  transform: scale(0.97);
}
.collection-card .char {
  font-family: var(--font-banshu);
  font-size: 48px;
  margin-bottom: 8px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.collection-card .glyph-result {
  position: relative;
}
.collection-glyph-image {
  width: 78px;
  height: 78px;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.collection-glyph-composite {
  position: relative;
  display: block;
  width: 92px;
  height: 82px;
  font-family: var(--font-banshu);
  line-height: 1;
}
.collection-glyph-part {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  width: 58px;
  height: 72px;
}
.collection-glyph-part.part-a { left: 0; top: 5px; }
.collection-glyph-part.part-b { right: 0; top: 5px; }
.collection-glyph-part.tb.part-a { left: 17px; top: -2px; }
.collection-glyph-part.tb.part-b { right: 17px; top: 31px; }
.collection-glyph-part.en.part-a { left: 0; top: 3px; font-size: 62px; }
.collection-glyph-part.en.part-b { left: 23px; top: 20px; font-size: 46px; }
.collection-glyph-fallback.single { font-size: 58px; }
.collection-card .name {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 4px;
}
.collection-card .style-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-paper-dark);
  border-radius: 8px;
  font-size: 10px;
  color: var(--color-ink-muted);
}
.collection-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-ink-muted);
}
.collection-empty .icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.3;
}

/* 作品详情弹窗 */
.detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.detail-modal.show {
  display: flex;
}
.detail-content {
  background: rgba(245,240,230,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(245,240,230,0.5);
  border-radius: 16px;
  padding: 25px;
  width: 100%;
  max-width: 360px;
  max-height: none;
  overflow: hidden;
  position: relative;
}
.detail-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-paper-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}
.transform-hint {
  margin-top: 7px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-ink-muted);
  text-align: center;
}

.detail-char img {
  display: block;
  width: 180px;
  height: 180px;
  object-fit: contain;
  margin: 0 auto;
}

.detail-char {
  font-family: var(--font-banshu);
  font-size: 80px;
  text-align: center;
  margin-bottom: 15px;
}
.detail-section {
  margin-bottom: 15px;
}
.detail-label {
  font-size: 12px;
  color: var(--color-ink-muted);
  margin-bottom: 4px;
}
.detail-value {
  font-family: var(--font-ancient);
  font-size: 15px;
  line-height: 1.6;
}
.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.detail-action-btn {
  flex: 1;
  min-width: 80px;
  padding: 8px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.detail-action-btn.danger {
  color: var(--color-seal);
  border-color: var(--color-seal);
}

/* ===== 通用组件 ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(26,26,26,0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  display: none;
  animation: fadeIn 0.3s ease;
}
.toast.show {
  display: block;
}

.disclaimer {
  font-size: 10px;
  color: var(--color-ink-muted);
  text-align: center;
  padding: 8px;
  line-height: 1.5;
}

/* 用户名输入 */
.name-input-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.name-input-modal.show {
  display: flex;
}
.name-input-box {
  background: var(--color-paper);
  border-radius: 16px;
  padding: 30px 25px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.name-input-box h3 {
  font-family: var(--font-ancient);
  font-size: 18px;
  margin-bottom: 20px;
}
.name-input-box input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
  outline: none;
  margin-bottom: 15px;
  font-family: var(--font-ancient);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

/* 响应式 */
@media (max-height: 600px) {
  .intro-question { font-size: 100px; }
  .meaning-char { font-size: 70px; }
  .char-canvas { width: 180px; height: 180px; }
}

/* 音乐开关状态：关闭时在图标上显示细斜杠，并保留原有圆形按钮视觉。 */
.sound-btn,
#btn-sound {
  position: relative;
}
.sound-btn.is-muted::after,
#btn-sound.is-muted::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 1.5px;
  background: #2c2c2c;
  transform: rotate(-45deg);
  border-radius: 2px;
  pointer-events: none;
}
.sound-btn.is-muted .sound-icon-img {
  opacity: 0.38;
}
#btn-sound.is-muted {
  opacity: 0.62;
}


/* ===== 手机预览稳定性修复 =====
   统一使用可用的中文系统字体栈，并避免窄屏下品牌/标题意外换行。 */
html, body, button, input, textarea, select {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root {
  --font-ancient: "Zizaoji-Serif", serif;
  --font-modern: "Zizaoji-Sans", sans-serif;
}

/* 构件库只有一行自然部件时不再出现浏览器横向滚动条/灰色横线。 */
.lib-items {
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.lib-items::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

@media (max-width: 430px) {
  #app {
    max-width: 100%;
  }

  .opening-page {
    min-height: 100dvh;
  }
  .opening-page .topbar {
    top: max(18px, env(safe-area-inset-top));
    left: 22px;
    right: 22px;
    gap: 12px;
  }
  .opening-page .brand {
    min-width: 0;
    gap: 7px;
    white-space: nowrap;
  }
  .opening-page .brand-cn {
    font-size: clamp(22px, 6vw, 25px);
    letter-spacing: 1px;
    white-space: nowrap;
  }
  .opening-page .brand-en {
    font-size: clamp(11px, 3.2vw, 14px);
    letter-spacing: .25px;
    white-space: nowrap;
  }
  .opening-page .top-actions {
    gap: 10px;
    flex: none;
  }
  .opening-page .sound-btn,
  .opening-page .collection-btn {
    width: 42px;
    height: 42px;
  }
  .opening-page .hero-content {
    padding: 0 24px;
    justify-content: center;
  }
  .opening-page .creation-seal {
    width: 58px;
    height: 58px;
    margin-bottom: 18px;
  }
  .opening-page .intro-text {
    font-size: clamp(16px, 4.6vw, 18px);
    line-height: 1.9;
    letter-spacing: 1px;
    margin-bottom: 20px;
  }
  .opening-page .main-text {
    width: 100%;
    max-width: 360px;
    font-size: clamp(21px, 6.2vw, 24px);
    line-height: 1.85;
    letter-spacing: 1px;
  }
  .opening-page .start-btn {
    width: min(220px, 70vw);
    height: 52px;
    margin-top: 30px;
    font-size: 16px;
  }
  .opening-page .ink-tip {
    margin-top: 24px;
    font-size: 12px;
    letter-spacing: 3px;
  }

  #page-workshop {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .canvas-area {
    flex: 1;
    min-height: 220px;
    padding: 0;
  }
  .char-canvas {
    width: 220px;
    height: 220px;
  }
}

@media (max-width: 360px) {
  .opening-page .topbar {
    left: 16px;
    right: 16px;
  }
  .opening-page .brand-en {
    display: none;
  }
  .opening-page .main-text {
    font-size: 20px;
  }
  .structure-tab {
    font-size: 12px;
  }
}

/* ===== 造字之旅情景引入页 ===== */
.story-page {
  background: radial-gradient(circle at center, #15120d 0%, #0a0a0a 45%, #050505 100%) !important;
  color: #eee;
  justify-content: center;
  align-items: center;
  font-family: "Noto Serif SC", "Songti SC", serif;
}
#storyParticles {
  position:absolute; inset:0; width:100%; height:100%;
}
.story-glow{
  position:absolute; width:55vw;height:55vw; border-radius:50%;
  background:radial-gradient(circle,rgba(201,169,98,.16),rgba(201,169,98,.04) 25%,transparent 68%);
  animation:lampBreath 5s ease-in-out infinite;
}
@keyframes lampBreath{0%,100%{opacity:.55;transform:scale(.96)}50%{opacity:1;transform:scale(1.04)}}
.story-content{position:relative;text-align:center;z-index:2;max-width:90%}
/* 隐藏旁白入口 */
.hidden-voice-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  margin:0 auto 18px;
  padding:7px 15px;
  border:1px solid rgba(197,157,94,.35);
  border-radius:22px;
  background:rgba(0,0,0,.18);
  color:#c59d5e;
  font-family:inherit;
  font-size:13px;
  letter-spacing:1px;
  cursor:pointer;
  opacity:.9;
  transition:opacity .35s ease,transform .35s ease,border-color .35s ease,background .35s ease;
}
.hidden-voice-btn:hover{
  opacity:1;
  transform:translateY(-1px);
  border-color:rgba(197,157,94,.65);
  background:rgba(197,157,94,.08);
}
.hidden-voice-btn:disabled{
  cursor:default;
}
.hidden-voice-btn.is-playing{
  opacity:1;
  border-color:rgba(197,157,94,.7);
}
.hidden-voice-icon{
  width:17px;
  height:17px;
  object-fit:contain;
  filter:sepia(.15) saturate(.7);
}
.hidden-voice-btn.is-playing .hidden-voice-icon{
  animation:hiddenVoiceStarPulse 1.4s ease-in-out infinite;
}
@keyframes hiddenVoiceStarPulse{
  0%,100%{transform:scale(1);opacity:.7}
  50%{transform:scale(1.16);opacity:1}
}

.story-small{font-size:18px;color:#c9bfae;opacity:0;transform:translateY(20px);transition:opacity .8s ease,transform .8s ease}
.story-small.visible{opacity:1;transform:translateY(0)}
.story-line{margin:22px 0;font-size:17px;line-height:2.2;color:#d7d0c4;opacity:0;transform:translateY(20px);transition:opacity .8s ease,transform .8s ease}
.story-line.visible{opacity:1;transform:translateY(0)}
.story-title{margin:55px 0 35px;font-size:38px;letter-spacing:10px;font-weight:500;color:#fff;opacity:0;transform:translateY(20px);transition:opacity 1s ease,transform 1s ease}
.story-title.visible{opacity:1;transform:translateY(0)}
.story-btn{
 margin-top:45px;padding:15px 55px;border:1px solid rgba(255,255,255,.25);
 background:rgba(0,0,0,.35);color:#eee;border-radius:30px;font-family:inherit;
 opacity:0;transform:translateY(20px);transition:opacity .8s ease,transform .8s ease;
 pointer-events:none;
}
.story-btn.visible{opacity:1;transform:translateY(0);pointer-events:auto}
.mouse-light{position:absolute;width:260px;height:260px;border-radius:50%;background:radial-gradient(circle,rgba(255,220,140,.22) 0%,rgba(255,200,100,.10) 35%,transparent 70%);pointer-events:none;transition:width .3s,height .3s;mix-blend-mode:screen}

/* 1.0 情景引入增强效果 */
.intro-char{opacity:0;filter:blur(8px);transition:opacity .8s ease,filter .8s ease,text-shadow .8s ease;color:#d6c3a0;display:inline-block}
.intro-char.visible{opacity:1;filter:blur(0);color:#fff;text-shadow:0 0 12px rgba(197,157,94,.7),0 0 30px rgba(197,157,94,.25)}
.story-btn{position:relative;overflow:hidden;border-color:rgba(197,157,94,.4);color:#c59d5e;backdrop-filter:blur(5px);transition:.6s}
.story-btn:before{content:"";position:absolute;inset:0;background:radial-gradient(circle,rgba(197,157,94,.35),transparent 70%);transform:scale(0);transition:.8s}
.story-btn:hover:before{transform:scale(2)}
.story-btn:hover{border-color:#c59d5e;box-shadow:0 0 30px rgba(197,157,94,.25)}


/* 沉浸式固定屏与点击微光 */
html,body,#app{width:100%;height:100%;overflow:hidden;position:fixed;inset:0;}
.story-page{overflow:hidden;}
.story-line .red-em{color:#e84c3d;font-weight:700;}
.light-ripple{position:fixed;width:160px;height:160px;border-radius:50%;pointer-events:none;transform:translate(-50%,-50%) scale(0);background:radial-gradient(circle,rgba(255,220,140,.45) 0%,rgba(255,190,100,.18) 35%,transparent 70%);animation:rippleLight 1s ease-out forwards;z-index:10;mix-blend-mode:screen}
@keyframes rippleLight{0%{opacity:1;transform:translate(-50%,-50%) scale(.2)}100%{opacity:0;transform:translate(-50%,-50%) scale(3.2)}}

/* 情景引入页声音按钮 */
.story-sound-control{position:fixed;top:22px;right:22px;z-index:30}
.story-sound-btn{width:42px;height:42px;border:0;background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer}
.story-sound-btn .sound-icon-img{width:28px;height:28px}

/* 情景页右上角声音与跳过按钮 */
.story-sound-control{
 position:absolute;
 right:24px;
 top:24px;
 z-index:30;
}
.story-sound-btn{
 width:38px;
 height:38px;
 border-color:rgba(255,255,255,.6);
}
.story-sound-btn .sound-icon-img{
 filter: brightness(0) saturate(100%) invert(78%) sepia(55%) saturate(450%) hue-rotate(-5deg);
 transition: filter 0.3s ease, opacity 0.3s ease;
}
.story-sound-btn.is-muted .sound-icon-img{
 filter: brightness(0) saturate(100%) invert(35%) sepia(0%) saturate(0%);
 opacity: 0.45;
}
.story-skip-btn{
 position:absolute;
 right:72px;
 top:24px;
 z-index:30;
 padding:5px 12px;
 border:1px solid rgba(255,255,255,.65);
 border-radius:16px;
 background:rgba(0,0,0,.25);
 color:#fff;
 font-size:12px;
 letter-spacing:1px;
}

/* ===== 增强样式 ===== */
/* ============================================================
   字造集 · 视觉与交互增强层 (enhance.css)
   说明：本文件在 style.css 之后加载，仅做"锦上添花"——
   不改动任何 DOM 结构与 JS 逻辑，功能 100% 保持不变。
   目标：更高级（玻璃拟态 / 金线描边 / 层次光影）+
        更好玩（悬浮微光 / 入场动画 / 关卡庆祝 / 进度流动）+
        自适应（手机 / 平板 / 桌面统一优雅呈现）。
   ============================================================ */

/* ===== 1. 设计令牌补充 ===== */
:root {
  --ink-grad: linear-gradient(135deg, #2b2722 0%, #1a1a1a 58%, #0e0d0b 100%);
  --gold-grad: linear-gradient(135deg, #f3dd9c 0%, #c9a962 48%, #a9863c 100%);
  --seal-grad: linear-gradient(135deg, #cf433c 0%, #a8302b 100%);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --hair-gold: rgba(201, 169, 98, 0.55);
  --shadow-premium: 0 18px 50px rgba(40, 28, 12, 0.16);
  --shadow-card: 0 10px 34px rgba(40, 28, 12, 0.12);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== 2. 通用入场动画 ===== */
@keyframes enhanceRise {
  0%   { opacity: 0; transform: translateY(22px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes enhancePop {
  0%   { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes goldShimmer {
  0%   { transform: translateX(-120%) skewX(-18deg); }
  100% { transform: translateX(220%)  skewX(-18deg); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(201, 169, 98, 0.45); }
  70%  { box-shadow: 0 0 0 12px rgba(201, 169, 98, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 169, 98, 0); }
}
@keyframes sealSpin {
  to { transform: rotate(360deg); }
}

/* ===== 3. 顶部导航升级 ===== */
.top-bar {
  padding: 14px 6px 6px;
  margin-bottom: 6px;
}
.top-bar .brand {
  font-size: 20px;
  letter-spacing: 5px;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 1px rgba(120, 90, 30, 0.18));
}
.top-bar .brand-en {
  letter-spacing: 3px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--hair-gold);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-card);
  font-size: 18px;
  color: var(--color-ink);
  transition: transform 0.3s var(--ease-soft), box-shadow 0.3s, background 0.3s;
}
.icon-btn:hover {
  background: var(--glass-strong);
  box-shadow: 0 8px 22px rgba(201, 169, 98, 0.3);
}
.icon-btn:active { transform: scale(0.9); }

/* ===== 4. 页面通用：纸张叠加 + 入场 ===== */
.page {
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(255, 252, 244, 0.7), transparent 60%),
    var(--color-paper);
}
#page-lab > * ,
#page-ability .ability-card,
#page-charcard .charcard,
#page-certify .certify-card {
  animation: enhanceRise 0.6s var(--ease-soft) both;
}
#page-lab .lab-stage { animation-delay: 0.05s; }
#page-lab .lab-header { animation-delay: 0s; }

/* ===== 造字结果卡片 P06.5 · 图案动效（墨字落定 / 印章盖下 / 金线横生 / 释义逐字浮现 / 暖光呼吸）===== */
/* 古风极简、克制暖金（环境点缀 ≤10%），不破坏留白与意境 */
#page-charcard .charcard-char {
  animation: ccInk 1.0s cubic-bezier(.22,.61,.36,1) both;
}
#page-charcard .forge-seal {
  animation: ccSeal .5s .42s cubic-bezier(.34,1.56,.64,1) both;
}
#page-charcard .charcard-header    { animation: ccRise .6s .15s ease both; }
#page-charcard .charcard-components { animation: ccRise .6s .50s ease both; }
#page-charcard .charcard-style     { animation: ccRise .6s .62s ease both; }
#page-charcard .charcard-footer     { animation: ccRise .6s .82s ease both; }
#page-charcard .charcard-divider {
  transform: scaleX(0);
  transform-origin: center;
  animation: ccLine .55s cubic-bezier(.22,.61,.36,1) both;
}
#page-charcard .cc-div1 { animation-delay: .55s; }
#page-charcard .cc-div2 { animation-delay: .76s; }
#page-charcard .charcard-meaning .cc-inkch {
  display: inline-block;
  opacity: 0;
  animation: ccCharIn .5s ease both;
}
#page-charcard .charcard-container > .btn-primary {
  animation: ccRise .6s .92s ease both;
}
/* 身后暖光呼吸：让「字」像落在被灯照暖的宣纸上 */
#page-charcard .charcard::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  pointer-events: none;
  background: radial-gradient(62% 48% at 50% 36%, rgba(255,206,148,0.18), transparent 72%);
  opacity: 0;
  z-index: 1;
  animation: ccGlow 4.6s ease-in-out 1.1s infinite;
}
@keyframes ccInk {
  0%   { opacity: 0; filter: blur(12px); transform: translateY(6px) scale(1.05); clip-path: inset(0 0 100% 0); }
  55%  { opacity: 1; }
  100% { opacity: 1; filter: blur(0); transform: none; clip-path: inset(0 0 0% 0); }
}
@keyframes ccSeal {
  0%   { opacity: 0; transform: rotate(-3deg) scale(1.5); }
  70%  { opacity: .95; }
  100% { opacity: .88; transform: rotate(-3deg) scale(1); }
}
@keyframes ccRise {
  0%   { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes ccLine {
  0%   { transform: scaleX(0); opacity: .2; }
  100% { transform: scaleX(1); opacity: 1; }
}
@keyframes ccCharIn {
  0%   { opacity: 0; filter: blur(6px); transform: translateY(5px); }
  100% { opacity: 1; filter: blur(0); transform: none; }
}
@keyframes ccGlow {
  0%, 100% { opacity: .12; }
  50%      { opacity: .34; }
}

/* ===== 5. 六书实验室 ===== */
#page-lab { padding: 22px 20px 26px; }

.lab-header { margin-bottom: 14px; }
.lab-title {
  font-size: clamp(22px, 6vw, 28px);
  letter-spacing: 8px;
  position: relative;
  display: inline-block;
  background: var(--ink-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lab-title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 46px;
  height: 2px;
  transform: translateX(-50%);
  background: var(--gold-grad);
  border-radius: 2px;
}
.lab-subtitle { font-size: 13px; letter-spacing: 1px; }

/* 进度点：流动金线 */
.lab-progress { gap: 10px; margin: 18px 0 22px; }
.progress-dot {
  width: 9px;
  height: 9px;
  background: var(--color-border);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
  transition: all 0.45s var(--ease-soft);
}
.progress-dot.active {
  background: var(--seal-grad);
  width: 30px;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(184, 50, 50, 0.45);
}
.progress-dot.done {
  background: var(--gold-grad);
  width: 9px;
  box-shadow: 0 0 8px rgba(201, 169, 98, 0.5);
}

/* 关卡舞台：玻璃面板 + 金色顶饰 */
.lab-stage {
  width: 100%;
  margin: 0 auto;
  padding: 26px 18px 30px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-premium);
  position: relative;
  overflow: hidden;
  min-height: 320px;
  justify-content: flex-start;
  padding-top: 30px;
}
.lab-stage::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gold-grad);
  opacity: 0.85;
}
.lab-level-title {
  font-size: clamp(18px, 5vw, 22px);
  letter-spacing: 3px;
  color: var(--color-seal);
  margin-bottom: 4px;
}
.lab-level-hint {
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 22px;
}

/* 象形：太阳演变 */
.sun-image {
  width: clamp(120px, 34vw, 150px);
  height: clamp(120px, 34vw, 150px);
  margin-top: 12px;
  filter: drop-shadow(0 10px 22px rgba(40, 30, 12, 0.18));
  animation: floatY 5s ease-in-out infinite;
}
.sun-image.change { animation: inkChange 0.6s ease, floatY 5s ease-in-out infinite; }
#timeline {
  width: min(78%, 360px);
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--color-paper-dark), var(--color-border));
  accent-color: #b83b32;
  cursor: pointer;
}
.timeline-label {
  width: min(78%, 360px);
  margin: 14px auto 0;
  font-size: 13px;
}
.stage-thumb {
  width: clamp(32px, 9vw, 40px);
  height: clamp(32px, 9vw, 40px);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}
.timeline-label .active .stage-thumb {
  transform: scale(1.18);
  animation: pulseRing 2s ease-out infinite;
}

/* 会意：拖拽组合 */
.huiyi-area {
  width: min(300px, 82vw);
  height: 210px;
  border: 2px dashed var(--hair-gold);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 2px 12px rgba(40,30,12,0.05);
  margin-bottom: 18px;
}
.huiyi-component {
  width: 74px;
  height: 74px;
  font-size: 42px;
  font-family: var(--font-ancient);
  background: var(--glass-strong);
  border: 1px solid var(--hair-gold);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(40, 30, 12, 0.14);
  transition: box-shadow 0.2s, transform 0.25s var(--ease-soft);
}
.huiyi-component:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(201, 169, 98, 0.35);
}
.huiyi-component:active {
  cursor: grabbing;
  box-shadow: 0 14px 30px rgba(40, 30, 12, 0.25);
}
.huiyi-result {
  font-size: clamp(72px, 22vw, 92px);
  color: var(--color-seal);
  text-shadow: 0 6px 20px rgba(184, 50, 50, 0.3);
}

/* 指事：红点拖拽 */
.knife-area {
  filter: drop-shadow(0 10px 20px rgba(40, 30, 12, 0.12));
}
.mark-point {
  width: 24px;
  height: 24px;
  background: radial-gradient(circle at 35% 35%, #e0584f, #b83232);
  box-shadow: 0 0 0 0 rgba(184, 50, 50, 0.55);
  animation: pulseRing 2.2s ease-out infinite;
}
.mark-point:active { transform: scale(1.25); }
#knifeResult {
  font-size: clamp(44px, 14vw, 56px);
  color: var(--color-seal);
  text-shadow: 0 6px 18px rgba(184, 50, 50, 0.28);
}

/* 关卡成功：庆祝弹出 */
.level-success {
  padding: 34px 46px;
  border-radius: 20px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(40, 28, 12, 0.28);
  animation: enhancePop 0.45s var(--ease-soft);
}
.level-success::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 22px;
  padding: 2px;
  background: var(--gold-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.7;
  pointer-events: none;
}
.level-success .check {
  font-size: 46px;
  color: #4a7c59;
  animation: sealSpin 0.9s var(--ease-soft);
}
.level-success .text {
  font-size: 15px;
  line-height: 1.9;
}
.level-success .badge {
  background: var(--seal-grad);
  box-shadow: 0 4px 12px rgba(184, 50, 50, 0.35);
  letter-spacing: 1px;
}

/* ===== 6. 能力值 ===== */
.ability-card {
  width: 88%;
  max-width: 380px;
  padding: 38px 32px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-premium);
  position: relative;
  overflow: hidden;
}
.ability-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gold-grad);
}
.ability-title {
  font-size: clamp(20px, 5.5vw, 24px);
  letter-spacing: 5px;
  background: var(--ink-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ability-label { width: 76px; font-size: 14px; color: var(--color-ink-light); }
.ability-bar {
  height: 10px;
  background: var(--color-paper-dark);
  border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}
.ability-fill {
  background: linear-gradient(90deg, #2b2722, #4a4036 60%, var(--color-gold));
  box-shadow: 0 0 10px rgba(201, 169, 98, 0.5);
}
.ability-value { color: var(--color-seal); font-size: 18px; }

/* ===== 能力值 · 雷达图（图案动效） ===== */
.ability-radar {
  width: 100%;
  max-width: 250px;
  margin: 6px auto 2px;
  animation: radarIn 0.7s ease both;
}
@keyframes radarIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.radar-svg { width: 100%; height: auto; overflow: visible; display: block; }
.radar-ring { fill: none; stroke: rgba(43,39,34,0.12); stroke-width: 1; }
.radar-ring-outer { stroke: rgba(43,39,34,0.20); }
.radar-axis { stroke: rgba(43,39,34,0.18); stroke-width: 1; }
.radar-poly {
  fill: rgba(201,169,98,0.9);
  stroke: var(--color-gold, #c9a962);
  stroke-width: 2;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(201,169,98,0.45));
  animation: radarBreathe 3.4s ease-in-out infinite;
}
@keyframes radarBreathe {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(201,169,98,0.35)); }
  50%      { filter: drop-shadow(0 0 13px rgba(201,169,98,0.62)); }
}
.radar-dot { fill: var(--color-seal, #9e2b25); stroke: #fff; stroke-width: 1; }
.radar-val { font-size: 13px; font-weight: 700; fill: var(--color-seal, #9e2b25); }
.radar-axisname { font-size: 11px; letter-spacing: 1px; fill: var(--color-ink-light, #6b6155); }

/* ===== 7. 造字工坊 ===== */
.workshop-header { margin-bottom: 8px; }
.workshop-title {
  font-size: clamp(20px, 5.5vw, 24px);
  letter-spacing: 5px;
  background: var(--ink-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.workshop-subtitle { font-size: 12px; letter-spacing: 1px; }

.canvas-area {
  flex: 1;
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.char-canvas {
  width: clamp(200px, 56vw, 260px);
  height: clamp(200px, 56vw, 260px);
  border: 2px solid var(--hair-gold);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255,255,255,0.65), rgba(255,255,255,0.32));
  box-shadow: inset 0 0 22px rgba(201, 169, 98, 0.12), var(--shadow-card);
}
.canvas-empty-hint { font-size: 16px; letter-spacing: 1px; }
.canvas-component.selected {
  outline: 2px dashed var(--color-seal);
  outline-offset: 5px;
  filter: drop-shadow(0 6px 14px rgba(184, 50, 50, 0.25));
}

/* 结构面板 */
.structure-tab {
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--glass-bg);
  transition: all 0.25s var(--ease-soft);
}
.structure-tab.active {
  background: var(--ink-grad);
  color: var(--color-paper);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(40, 30, 12, 0.25);
}
.structure-option {
  font-size: 11px;
  border-radius: 14px;
  background: var(--glass-bg);
  transition: all 0.25s var(--ease-soft);
}
.structure-option:hover { transform: translateY(-1px); }
.structure-option.active {
  background: var(--seal-grad);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(184, 50, 50, 0.3);
}

/* 构件库：玻璃芯片 */
.component-library {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.lib-cat {
  font-size: 12px;
  border-radius: 8px;
  transition: all 0.25s var(--ease-soft);
}
.lib-cat.active {
  background: var(--ink-grad);
  color: var(--color-paper);
  box-shadow: 0 4px 12px rgba(40, 30, 12, 0.2);
}
.lib-item {
  font-size: clamp(18px, 5.5vw, 24px);
  background: var(--glass-strong);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  transition: all 0.22s var(--ease-soft);
}
.lib-item:hover {
  transform: translateY(-3px);
  border-color: var(--hair-gold);
  box-shadow: 0 8px 18px rgba(201, 169, 98, 0.3);
}
.lib-item:active { transform: scale(0.92); }
.lib-item.used { opacity: 0.38; }

/* ===== 8. 六书构形分析 ===== */
.analysis-ring { width: clamp(240px, 64vw, 300px); height: clamp(240px, 64vw, 300px); }
.ring-center {
  font-size: clamp(52px, 16vw, 64px);
  text-shadow: 0 6px 18px rgba(40, 30, 12, 0.2);
}
.ring-outer {
  border: 2px solid var(--hair-gold);
  box-shadow: 0 0 30px rgba(201, 169, 98, 0.25), inset 0 0 30px rgba(201, 169, 98, 0.12);
}
.analysis-text { font-size: 16px; letter-spacing: 1px; }

/* ===== 9. 释义页 ===== */
.meaning-char {
  font-size: clamp(80px, 26vw, 110px);
  text-shadow: 0 8px 24px rgba(40, 30, 12, 0.18);
}
.meaning-label { letter-spacing: 1px; }
.meaning-input {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--glass-bg);
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.05);
}
.meaning-input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.18);
}
.style-title { letter-spacing: 1px; }
.style-card {
  padding: 18px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  box-shadow: var(--shadow-card);
  transition: all 0.28s var(--ease-soft);
}
.style-card:hover {
  transform: translateY(-2px);
  border-color: var(--hair-gold);
  box-shadow: 0 12px 28px rgba(201, 169, 98, 0.22);
}
.style-card.active {
  border: 2px solid var(--color-seal);
  background: rgba(189, 57, 54, 0.05);
  box-shadow: 0 10px 30px rgba(184, 50, 50, 0.18);
}

/* ===== 10. 古籍字卡 / 认证（统一高级卡片） ===== */
.charcard, .certify-card {
  width: 88%;
  max-width: 360px;
  padding: 34px 26px 28px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-premium);
}
.charcard::before, .certify-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/paper-bg.jpg");
  background-size: cover;
  opacity: 0.22;
  pointer-events: none;
  border-radius: inherit;
}
.charcard { box-shadow: var(--shadow-premium), 0 0 0 1px var(--hair-gold); }
.charcard-char {
  font-size: clamp(58px, 18vw, 72px);
  text-shadow: 0 6px 18px rgba(40, 30, 12, 0.18);
}
.charcard-style { color: var(--color-seal); }
.charcard-divider, .certify-row { border-color: rgba(201, 169, 98, 0.3); }
.certify-card {
  border: 2px solid rgba(40, 30, 12, 0.85);
  box-shadow: var(--shadow-premium);
}
.certify-title { letter-spacing: 2px; }
.certify-stars { color: var(--color-gold); text-shadow: 0 1px 2px rgba(169, 134, 60, 0.4); }
.personality-name {
  font-size: clamp(28px, 8vw, 34px);
  letter-spacing: 5px;
  background: var(--ink-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.personality-badge {
  background: var(--seal-grad);
  box-shadow: 0 6px 16px rgba(184, 50, 50, 0.35);
  letter-spacing: 1px;
}


/* ===== 11. 海报页 ===== */
.poster-container {
  height: calc(100vh - 230px);
  max-height: 540px;
  aspect-ratio: 9/16;
  width: auto;
  max-width: 92vw;
  border-radius: 16px;
  box-shadow: 0 22px 56px rgba(40, 28, 12, 0.28), 0 0 0 1px var(--hair-gold);
}
.poster-bg-switch { max-width: clamp(280px, 78vw, 340px); }
.poster-actions,
.poster-actions-row { max-width: clamp(280px, 78vw, 340px); }
.poster-actions .btn-secondary,
.poster-actions .btn-generate,
.poster-actions #btn-new-char {
  padding: 10px 18px;
  font-size: 13px;
  border-radius: 22px;
  min-width: 0;
  width: 100%;
}
.bg-dot { border: 2px solid var(--color-border); transition: all 0.25s var(--ease-soft); }
.bg-dot:hover { transform: scale(1.1); }
.bg-dot.active {
  border-color: var(--color-seal);
  box-shadow: 0 0 0 3px rgba(184, 50, 50, 0.2);
}

/* ===== 12. 我的字造集 ===== */
.collection-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.collection-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: all 0.28s var(--ease-soft);
}
.collection-card:hover {
  transform: translateY(-4px);
  border-color: var(--hair-gold);
  box-shadow: 0 16px 34px rgba(201, 169, 98, 0.28);
}
.collection-card:active { transform: scale(0.97); }
.collection-card .char {
  font-size: clamp(42px, 13vw, 52px);
  text-shadow: 0 4px 12px rgba(40, 30, 12, 0.15);
}
.collection-card .style-tag {
  background: rgba(201, 169, 98, 0.16);
  color: #8a6f33;
}

/* ===== 13. 按钮：高级渐变 + 悬浮 + 微光 ===== */
.btn-primary,
.btn-secondary,
.btn-generate,
.btn-free,
.meaning-button,
.style-modal-btn,
.name-input-box .btn-primary {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  transition: transform 0.3s var(--ease-soft), box-shadow 0.3s, background 0.3s;
  letter-spacing: 3px;
}
/* 微光扫过 */
.btn-primary::after,
.btn-generate::after,
.meaning-button::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: translateX(-120%) skewX(-18deg);
  pointer-events: none;
}
.btn-primary,
.meaning-button,
.style-modal-btn,
.name-input-box .btn-primary {
  background: var(--ink-grad);
  color: var(--color-paper);
  box-shadow: 0 10px 28px rgba(40, 30, 12, 0.28);
  border: none;
}
.btn-primary .arrow { transition: transform 0.3s; }
.btn-primary:hover .arrow { transform: translateX(6px); }

.btn-generate {
  background: var(--seal-grad);
  box-shadow: 0 10px 28px rgba(184, 50, 50, 0.35);
  border: none;
}
.btn-generate:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--color-ink);
  color: var(--color-ink);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.btn-secondary:hover { background: rgba(255,255,255,0.8); }
.btn-free {
  background: transparent;
  border: 1.5px solid var(--color-ink);
}

@media (hover: hover) {
  .btn-primary:hover,
  .meaning-button:hover,
  .style-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(40, 30, 12, 0.34);
  }
  .btn-primary:hover::after,
  .btn-generate:hover::after,
  .meaning-button:hover::after {
    animation: goldShimmer 0.9s var(--ease-soft);
  }
  .btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px rgba(184, 50, 50, 0.42);
  }
  .btn-secondary:hover { transform: translateY(-2px); }
  .btn-free:hover { transform: translateY(-2px); background: rgba(0,0,0,0.05); }
}
.btn-primary:active,
.btn-generate:active,
.btn-secondary:active,
.btn-free:active,
.meaning-button:active,
.style-modal-btn:active {
  transform: scale(0.96);
}

/* ===== 14. 弹窗升级 ===== */
.meaning-modal,
.style-modal,
.name-input-box {
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 26px 64px rgba(40, 28, 12, 0.28);
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.modal-character { text-shadow: 0 6px 16px rgba(40,30,12,0.18); }
.modal-style { color: var(--color-seal); letter-spacing: 2px; }
.meaning-button { height: 50px; letter-spacing: 2px; }
.detail-content { border-radius: var(--radius-lg); }
/* 情绪卡片详情弹窗：去掉白色玻璃遮罩（通用 .detail-content 在上面被设为玻璃白，此处用更高优先级覆盖），仅保留文字内容 */
#detailOverlay .detail-content {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  border-color: transparent;
}
.detail-action-btn {
  border-radius: 10px;
  transition: all 0.25s var(--ease-soft);
}
.detail-action-btn:hover { background: rgba(201,169,98,0.14); border-color: var(--hair-gold); }
.detail-action-btn.danger:hover { background: rgba(184,50,50,0.1); }
.name-input-box h3 { letter-spacing: 2px; }
.name-input-box input {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--glass-bg);
}
.name-input-box input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.18);
}

/* 入场动画（弹窗出现时）已由原 modalIn 提供，这里仅增强层次 */
.meaning-overlay, .style-modal-overlay, .detail-modal, .name-input-modal {
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ===== 15. 滚动条美化（桌面） ===== */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-thumb { background: rgba(201,169,98,0.5); border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: rgba(201,169,98,0.75); }
}

/* ===== 16. 响应式：平板 / 桌面 ===== */
@media (min-width: 600px) {
  /* 桌面环境光 */
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      radial-gradient(55% 45% at 12% 18%, rgba(201,169,98,0.12), transparent 60%),
      radial-gradient(50% 50% at 88% 82%, rgba(184,50,50,0.07), transparent 60%);
  }
  /* 居中"展台"卡片 */
  #app {
    max-width: 560px;
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(40, 28, 12, 0.20), 0 0 0 1px var(--hair-gold);
    overflow: hidden;
  }
  .page { padding: 28px 26px; }
  .top-bar { padding: 18px 8px 8px; }
  .ability-card, .charcard, .certify-card { max-width: 400px; }
  .collection-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .lib-items { grid-template-columns: repeat(8, 1fr); }
  .poster-container, .poster-bg-switch, .poster-actions { max-width: 360px; }
}

@media (min-width: 900px) {
  #app { max-width: 660px; }
  .top-bar .brand { font-size: 22px; }
  .lab-stage { padding: 32px 24px 36px; min-height: 340px; }
  .collection-grid { grid-template-columns: repeat(3, 1fr); }
  .lib-items { grid-template-columns: repeat(10, 1fr); }
  .poster-container, .poster-bg-switch, .poster-actions { max-width: 400px; }
  .ability-card, .charcard, .certify-card { max-width: 440px; }
}

/* ===== 17. 响应式：小屏细化（与 style.css 互补，不冲突） ===== */
@media (max-width: 360px) {
  .page { padding: 16px 14px; }
  .lab-stage { padding: 22px 12px 26px; }
  .lib-items { grid-template-columns: repeat(5, 1fr); }
  .ability-card { padding: 30px 22px; }
  .charcard, .certify-card { padding: 28px 18px 22px; }
}

/* ===== 情绪动效 ===== */
/* =========================================================
   情绪会呼吸 + 情绪温度（emotion-fx）
   - 两层：
     · .emotion-fx      背景氛围层（z-index:-1，页面背景图之上、内容之下）
                        承载极淡的呼吸渐变 / 细雨 / 云雾等底色氛围
     · .emotion-fx-top  前景签名层（z-index 高于内容、pointer-events:none）
                        承载每种情绪的「签名视觉」（孤月/光尘/萤火/冷雾/墨晕/大光晕），
                        定位在屏幕边缘与角落，柔焦半透明笼罩页面，明显但不挡文字
   - 仅改变 5%~10% 环境色，保持古风极简
   - 两层都挂在每个 .page 上，随 navigateTo 贯穿所有页面
   ========================================================= */

.emotion-fx {
  position: absolute;
  inset: 0;
  z-index: -1;            /* 在 .page 背景之上、流内容之下 */
  pointer-events: none;
  overflow: hidden;
  background: transparent;
}
.emotion-fx::before,
.emotion-fx::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform, opacity;
}
/* 无情绪兜底：纯净 */
.fx-none { background: transparent; }

/* 前景签名层：在内容之上、不挡交互 */
.emotion-fx-top {
  position: absolute;
  inset: 0;
  z-index: 6;            /* 高于页面内容卡片(z-index 2~10 内的普通卡片) */
  pointer-events: none;
  overflow: hidden;
  background: transparent;
  will-change: transform, opacity;
}

/* ---------- 温度染色基底（极淡，约 6%~11%，仅背景层） ---------- */
.fx-anxin    { background-color: rgba(86, 176, 156, 0.10); }  /* 安心 · 青绿 */
.fx-benshang { background-color: rgba(128, 158, 198, 0.11); }  /* 悲伤 · 雾蓝 */
.fx-fennu    { background-color: rgba(198, 72, 58, 0.09); }   /* 愤怒 · 朱红 */
.fx-gudu     { background-color: rgba(92, 112, 182, 0.11); }  /* 孤独 · 靛蓝 */
.fx-kongju   { background-color: rgba(120, 140, 172, 0.11); }  /* 恐惧 · 冷灰蓝 */
.fx-qidai    { background-color: rgba(222, 190, 120, 0.09); }  /* 期待 · 米金 */
.fx-xiyue    { background-color: rgba(255, 170, 92, 0.08); }   /* 喜悦 · 暖橙 */
.fx-zhenfen  { background-color: rgba(220, 210, 182, 0.07); }  /* 振奋 · 金白 */

/* =========================================================
   ① 情绪会呼吸 —— 背景底色氛围（位于内容之下，极淡）
   ========================================================= */

/* 安心：水面缓慢荡漾 */
.fx-anxin::before {
  background: repeating-linear-gradient(0deg,
    rgba(255,255,255,0) 0 22px,
    rgba(200,240,230,0.06) 22px 24px);
  mix-blend-mode: screen;
  animation: waterRipple 8s ease-in-out infinite;
}
.fx-anxin::after {
  background: radial-gradient(60% 40% at 50% 60%, rgba(180,230,215,0.10), transparent 70%);
  animation: waterShimmer 11s ease-in-out infinite;
}
@keyframes waterRipple {
  0%, 100% { transform: translateY(0) scaleY(1.02); opacity: .45; }
  50%      { transform: translateY(-8px) scaleY(1.05); opacity: .8; }
}
@keyframes waterShimmer {
  0%, 100% { transform: translateX(-4%) scale(1); opacity: .4; }
  50%      { transform: translateX(4%) scale(1.06); opacity: .85; }
}

/* 孤独：云缓慢移动（背景层） */
.fx-gudu::before {
  background:
    radial-gradient(140px 64px at 22% 28%, rgba(200,210,240,0.10), transparent 70%),
    radial-gradient(180px 74px at 72% 62%, rgba(180,195,235,0.08), transparent 70%);
  filter: blur(6px);
  animation: cloudDrift 26s linear infinite;
}
@keyframes cloudDrift {
  0%   { transform: translateX(-12%); }
  50%  { transform: translateX(8%); }
  100% { transform: translateX(-12%); }
}

/* 恐惧：雾气偶尔闪过 + 呼吸式暗角（背景层） */
.fx-kongju::before {
  background:
    radial-gradient(220px 150px at 30% 40%, rgba(212,222,236,0.10), transparent 70%),
    radial-gradient(260px 170px at 76% 66%, rgba(190,200,220,0.08), transparent 70%);
  filter: blur(10px);
  animation: fogDrift 20s ease-in-out infinite;
}
.fx-kongju::after {
  background: radial-gradient(ellipse at center, transparent 42%, rgba(10,16,34,0.48) 100%);
  animation: darkVignette 7s ease-in-out infinite;
}
@keyframes fogDrift {
  0%   { transform: translate(-6%,0) scale(1); }
  50%  { transform: translate(8%,3%) scale(1.08); }
  100% { transform: translate(-6%,0) scale(1); }
}
@keyframes darkVignette {
  0%, 100% { opacity: .35; }
  50%      { opacity: .75; }
}

/* 悲伤：雨丝「细、长、透明」（背景层） */
.fx-benshang::before {
  background: repeating-linear-gradient(98deg,
    rgba(200,215,235,0) 0 20px,
    rgba(200,215,235,0.10) 20px 21px);
  background-size: 100% 260%;
  opacity: .42;
  animation: rainFall 1.6s linear infinite;
}
.fx-benshang::after {
  background: repeating-linear-gradient(98deg,
    rgba(180,200,225,0) 0 30px,
    rgba(180,200,225,0.07) 30px 31px);
  background-size: 100% 260%;
  opacity: .32;
  animation: rainFall 2.4s linear infinite;
}
@keyframes rainFall {
  0%   { background-position: 0 0; }
  100% { background-position: -42px 230px; }
}

/* 愤怒：红色烟雾翻涌 + 微微震动（背景层） */
.fx-fennu::before {
  background:
    radial-gradient(190px 150px at 30% 60%, rgba(200,60,45,0.22), transparent 70%),
    radial-gradient(230px 165px at 70% 35%, rgba(170,40,35,0.18), transparent 70%);
  filter: blur(14px);
  transform-origin: center;
  animation: smokeChurn 12s ease-in-out infinite;
}
.fx-fennu {
  /* 愤怒：仅入场时震几下后停，避免后续页面一直抖动 */
  animation: tremor 0.45s steps(2, end) 4;
}
@keyframes smokeChurn {
  0%   { transform: rotate(0deg) scale(1) translate(0,0); }
  33%  { transform: rotate(8deg) scale(1.1) translate(10px,-6px); }
  66%  { transform: rotate(-6deg) scale(1.05) translate(-8px,8px); }
  100% { transform: rotate(0deg) scale(1) translate(0,0); }
}
@keyframes tremor {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(0.6px,-0.4px); }
  50%  { transform: translate(-0.5px,0.4px); }
  75%  { transform: translate(0.4px,0.5px); }
  100% { transform: translate(0,0); }
}

/* 期待：太阳光一点点升起（背景层，刻意压低、不抢文字） */
.fx-qidai::before {
  background: radial-gradient(circle at 50% 100%, rgba(255,210,130,0.22), transparent 42%);
  filter: blur(10px);
  animation: sunRise 14s ease-in-out infinite;
}
@keyframes sunRise {
  0%, 100% { transform: translateY(52%) scale(0.85); opacity: .18; }
  50%      { transform: translateY(28%) scale(1.05); opacity: .34; }
}

/* 喜悦：光晕扩散（背景层）；花瓣由 JS 注入 .emotion-fx */
.fx-xiyue::before {
  background: radial-gradient(circle at 50% 45%, rgba(255,180,110,0.22), transparent 60%);
  filter: blur(6px);
  animation: glowSpread 7s ease-in-out infinite;
}
@keyframes glowSpread {
  0%, 100% { transform: scale(0.85); opacity: .35; }
  50%      { transform: scale(1.15); opacity: .7; }
}

/* 振奋：粒子上升（背景层）；飞鸟由 JS 注入 .emotion-fx */
.fx-zhenfen::before {
  background: radial-gradient(circle at 50% 60%, rgba(235,225,190,0.16), transparent 60%);
  filter: blur(8px);
  animation: particleRise 10s ease-in-out infinite;
}
@keyframes particleRise {
  0%, 100% { transform: translateY(20%) scale(1); opacity: .3; }
  50%      { transform: translateY(-10%) scale(1.08); opacity: .6; }
}

/* =========================================================
   花瓣 / 飞鸟 粒子（JS 注入到背景层 .emotion-fx，位于内容之下）
   ========================================================= */
.emotion-fx .petal {
  position: absolute;
  top: -24px;
  border-radius: 0 100% 0 100%;
  background: radial-gradient(circle at 30% 30%, rgba(255,212,182,0.92), rgba(255,150,150,0.7));
  opacity: 0;
  animation-name: petalFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes petalFall {
  0%   { transform: translate(0, -20px) rotate(0deg); opacity: 0; }
  10%  { opacity: .85; }
  85%  { opacity: .7; }
  100% { transform: translate(var(--drift, 30px), 92vh) rotate(420deg); opacity: 0; }
}

.emotion-fx .bird {
  position: absolute;
  bottom: -24px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M2 8 Q7 2 12 8 Q17 2 22 8' fill='none' stroke='%233a3a3a' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  opacity: 0;
  animation-name: birdRise;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes birdRise {
  0%   { transform: translate(0, 0) scale(0.8); opacity: 0; }
  15%  { opacity: .7; }
  85%  { opacity: .55; }
  100% { transform: translate(var(--drift, 20px), -100vh) scale(1.15); opacity: 0; }
}

/* =========================================================
   五种情绪专属「前景签名视觉」—— 注入到 .emotion-fx-top
   定位在屏幕边缘/角落，柔焦半透明笼罩页面，明显、彼此不同、贴合情绪
   ========================================================= */

/* ---------- 孤独：孤月 · 疏星 · 隔离暗角 ---------- */
.emotion-fx-top .gudu-moon {
  position: absolute;
  bottom: 18%; right: 6%;
  width: 132px; height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, rgba(238,244,255,0.98), rgba(175,190,230,0.30) 60%, transparent 74%);
  box-shadow: 0 0 90px rgba(198,212,246,0.66), 0 0 160px rgba(178,198,238,0.34);
  animation: guduMoon 28s ease-in-out infinite;
}
@keyframes guduMoon {
  0%, 100% { transform: translate(0,0); opacity: .92; }
  50%      { transform: translate(-18px, 16px); opacity: 1; }
}
.emotion-fx-top .gudu-star {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(232,240,255,0.95);
  box-shadow: 0 0 10px rgba(212,226,252,0.95);
  opacity: 0;
  animation-name: guduStar;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
@keyframes guduStar {
  0%, 100% { opacity: .25; transform: scale(0.7); }
  50%      { opacity: .95; transform: scale(1.3); }
}
.emotion-fx-top .gudu-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 28%, rgba(14,22,52,0.5) 100%);
  animation: guduVignette 13s ease-in-out infinite;
}
@keyframes guduVignette {
  0%, 100% { opacity: .42; }
  50%      { opacity: .82; }
}

/* ---------- 安心：两侧边缘上升光尘 · 边缘竹影 · 右下暖绿光池 ---------- */
/* 用户触摸哪里，哪里冒出一圈水波（JS 在触点生成，扩散后消失） */
.emotion-fx-top .anxin-ripple {
  position: absolute;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.55);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.4);
  animation: calmRipple 2.8s ease-out forwards;
}
@keyframes calmRipple {
  0%   { opacity: 0;   transform: scale(0.4); }
  12%  { opacity: .6; }
  100% { opacity: 0;   transform: scale(9); }
}
.emotion-fx-top .anxin-mote {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(208,246,226,1), rgba(150,210,190,0));
  box-shadow: 0 0 16px rgba(192,242,220,0.9);
  opacity: 0;
  animation-name: anxinMote;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes anxinMote {
  0%   { transform: translateY(0) scale(0.55); opacity: 0; }
  14%  { opacity: .95; }
  88%  { opacity: .5; }
  100% { transform: translateY(-92vh) scale(1); opacity: 0; }
}
.emotion-fx-top .anxin-bamboo {
  position: absolute;
  top: 18%; bottom: 0;
  width: 26%;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 7%,  rgba(120,150,120,0.10) 8%,  transparent 9%),
    linear-gradient(90deg, transparent 27%, rgba(120,150,120,0.08) 28%, transparent 29%),
    linear-gradient(90deg, transparent 69%, rgba(120,150,120,0.10) 70%, transparent 71%);
  background-size: 100% 100%;
  filter: blur(2px);
  transform-origin: bottom center;
  animation: bambooSway 13s ease-in-out infinite;
}
.emotion-fx-top .anxin-bamboo.left  { left: 0; }
.emotion-fx-top .anxin-bamboo.right { right: 0; transform: scaleX(-1); }
@keyframes bambooSway {
  0%, 100% { transform: rotate(-1.2deg) translateX(-4px); }
  50%      { transform: rotate(1.2deg)  translateX(4px); }
}

/* ---------- 期待：底部上升萤火 · 金线 · 顶部云雾散开 ---------- */
.emotion-fx-top .qidai-spark {
  position: absolute;
  bottom: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,234,170,1), rgba(255,210,130,0));
  box-shadow: 0 0 18px rgba(255,226,152,1);
  opacity: 0;
  animation-name: qidaiSpark;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes qidaiSpark {
  0%   { transform: translate(0,0) scale(0.5); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: .55; }
  100% { transform: translate(var(--drift,20px), -96vh) scale(1); opacity: 0; }
}
.emotion-fx-top .qidai-line {
  position: absolute;
  left: 8%; right: 8%; bottom: 5%;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,216,142,0.95), transparent);
  box-shadow: 0 0 12px rgba(255,216,142,0.8);
  animation: lineGlow 6s ease-in-out infinite;
}
@keyframes lineGlow {
  0%, 100% { opacity: .3; transform: scaleX(0.7); }
  50%      { opacity: 1;  transform: scaleX(1.05); }
}
.emotion-fx-top .qidai-cloud {
  position: absolute;
  left: 0; right: 0; top: auto; bottom: 0;
  height: 58%;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 30% 72%, rgba(255,250,240,0.26), transparent 70%),
    radial-gradient(70% 50% at 75% 84%, rgba(255,248,235,0.22), transparent 70%);
  filter: blur(12px);
  animation: cloudDisperse 17s ease-in-out infinite;
}
@keyframes cloudDisperse {
  0%, 100% { opacity: .7; transform: translateX(0) scale(1); }
  50%      { opacity: .2; transform: translateX(6%) scale(1.12); }
}

/* ---------- 恐惧：两侧边缘大冷雾 · 偶尔远处光闪 ---------- */
.emotion-fx-top .kongju-wisp {
  position: absolute;
  width: 46vw; height: 60vh;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,46,80,0.6), transparent 70%);
  filter: blur(18px);
  opacity: 0;
  animation-name: kongjuWisp;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.emotion-fx-top .kongju-wisp.left  { left: -16vw; top: 14vh; }
.emotion-fx-top .kongju-wisp.right { right: -16vw; top: 30vh; }
@keyframes kongjuWisp {
  0%   { transform: translate(0,0) scale(0.82); opacity: 0; }
  38%  { opacity: .7; }
  100% { transform: translate(40px,-30px) scale(1.22); opacity: 0; }
}
.emotion-fx-top .kongju-light {
  position: absolute;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220,230,250,0.25), transparent 70%);
  pointer-events: none;
  opacity: 0;
  animation: kongjuFlicker 1.5s ease-out forwards;
}
@keyframes kongjuFlicker {
  0%   { opacity: 0; transform: scale(0.6); }
  30%  { opacity: .75; }
  100% { opacity: 0; transform: scale(1.2); }
}

/* ---------- 悲伤：底部墨晕 ---------- */
.emotion-fx-top .benshang-ink {
  position: absolute;
  left: 50%; bottom: 4%;
  width: 300px; height: 240px;
  margin-left: -150px;
  background: radial-gradient(ellipse at 50% 100%, rgba(40,52,92,0.22), transparent 72%);
  filter: blur(11px);
  transform-origin: bottom center;
  animation: inkBleed 9s ease-in-out infinite;
}
@keyframes inkBleed {
  0%, 100% { transform: scaleY(0.7) scaleX(0.9);  opacity: .35; }
  50%      { transform: scaleY(1.08) scaleX(1.06); opacity: .78; }
}

/* =========================================================
   五种情绪「大环境光晕」—— 也放前景层，定位边缘，明显强化辨识度
   （平均约占 8~12% 环境色）
   ========================================================= */
.emotion-fx-top .fx-ambience {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0;
  animation: ambienceBreathe 12s ease-in-out infinite;
}
@keyframes ambienceBreathe {
  0%, 100% { opacity: .34; transform: scale(1); }
  50%      { opacity: .56; transform: scale(1.08); }
}
/* 安心：右下角暖绿光池 */
.emotion-fx-top.fx-anxin .fx-ambience {
  right: -8vw; bottom: -8vh;
  width: 52vw; height: 52vw;
  background: radial-gradient(circle, rgba(120,210,185,0.6), transparent 72%);
}
/* 悲伤：左上角灰蓝墨晕 */
.emotion-fx-top.fx-benshang .fx-ambience {
  left: -8vw; top: -8vh;
  width: 46vw; height: 46vw;
  background: radial-gradient(circle, rgba(110,140,180,0.55), transparent 70%);
  animation-duration: 15s;
}
/* 孤独：右下角冷月光晕（配合孤月，避开标题） */
.emotion-fx-top.fx-gudu .fx-ambience {
  right: -4vw; bottom: -4vh;
  width: 44vw; height: 44vw;
  background: radial-gradient(circle, rgba(180,198,240,0.55), transparent 68%);
  animation-duration: 18s;
}
/* 恐惧：两侧边缘冷雾光 */
.emotion-fx-top.fx-kongju .fx-ambience.left {
  left: -10vw; top: 16vh;
  width: 36vw; height: 58vh;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(34,46,78,0.6), transparent 72%);
  animation-name: kongjuAmbience;
}
.emotion-fx-top.fx-kongju .fx-ambience.right {
  left: auto; right: -10vw; bottom: 8vh;
  width: 36vw; height: 58vh;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(34,46,78,0.6), transparent 72%);
  animation-name: kongjuAmbience;
}
@keyframes kongjuAmbience {
  0%, 100% { opacity: .14; transform: translateX(0) scale(1); }
  50%      { opacity: .32; transform: translateX(18px) scale(1.05); }
}
/* 期待：底部中央金橙曙光 */
.emotion-fx-top.fx-qidai .fx-ambience {
  left: 50%; bottom: -14vh;
  width: 78vw; height: 44vh;
  margin-left: -39vw;
  border-radius: 50% 50% 0 0 / 80% 80% 0 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,210,130,0.55), transparent 68%);
  animation-duration: 10s;
}

/* 恐惧：汉字偶尔 1px 偏移（极克制，不要一直抖） */
.page.kongju-jitter > *:not(.emotion-fx):not(.emotion-fx-top) {
  transform: translateX(1px);
}

/* =========================================================
   尊重减弱动态偏好：动效暂停，但保留情绪视觉（静态可见）
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .emotion-fx, .emotion-fx::before, .emotion-fx::after,
  .emotion-fx-top,
  .emotion-fx-top .gudu-moon, .emotion-fx-top .gudu-star, .emotion-fx-top .gudu-vignette,
  .emotion-fx-top .anxin-mote, .emotion-fx-top .anxin-bamboo,
  .emotion-fx-top .qidai-spark, .emotion-fx-top .qidai-line, .emotion-fx-top .qidai-cloud,
  .emotion-fx-top .kongju-wisp, .emotion-fx-top .kongju-light,
  .emotion-fx-top .benshang-ink, .emotion-fx-top .fx-ambience,
  .emotion-fx .petal, .emotion-fx .bird {
    animation: none !important;
  }
  /* 粒子定格在可见状态（keyframes 以 opacity:0 起步，animation:none 会隐没，需显式赋静态 opacity） */
  .emotion-fx-top .fx-ambience { opacity: .42 !important; transform: none !important; }
  .emotion-fx-top .gudu-moon { opacity: .94 !important; transform: none !important; }
  .emotion-fx-top .gudu-star { opacity: .78 !important; transform: scale(1) !important; }
  .emotion-fx-top .gudu-vignette { opacity: .68 !important; }
  .emotion-fx-top .anxin-mote { opacity: .62 !important; transform: translateY(-40vh) scale(1) !important; }
  .emotion-fx-top .anxin-bamboo { opacity: .52 !important; transform: none !important; }
  .emotion-fx-top .qidai-spark { opacity: .72 !important; transform: translate(var(--drift,20px),-45vh) scale(1) !important; }
  .emotion-fx-top .qidai-line { opacity: .6 !important; }
  .emotion-fx-top .qidai-cloud { opacity: .5 !important; }
  .emotion-fx-top .kongju-wisp { opacity: .52 !important; transform: scale(1) !important; }
  .emotion-fx-top .kongju-light { opacity: .6 !important; }
  .emotion-fx-top .benshang-ink { opacity: .6 !important; transform: scaleY(1) scaleX(1) !important; }
  .emotion-fx .petal { opacity: .72 !important; transform: translate(var(--drift,20px),-40vh) scale(1) !important; }
  .emotion-fx .bird { opacity: .62 !important; transform: translate(var(--drift,20px),-30vh) scale(1) !important; }
  .page.kongju-jitter > *:not(.emotion-fx):not(.emotion-fx-top) { transform: none; }
  .sad-rain { display: none !important; }
}

/* =========================================================
   悲伤：贯穿全程的细雨（全局 canvas，内容之上、不挡交互）
   ========================================================= */
.sad-rain {
  position: fixed;
  inset: 0;
  width: 100vw; height: 100vh;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity .9s ease;
}
.sad-rain.on { opacity: 1; }

/* ===== 开场 H5 层（画廊 / 叙事 / 入场 / 造字之旅）===== */
body.h5-mode {
  background: var(--ink-900, #000);
  color: var(--paper-100, #f5f0e6);
  font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  -webkit-font-smoothing: antialiased;
}
body.h5-mode #h5-opening { touch-action: none; }
body.h5-mode #app { display: none; }
body:not(.h5-mode) #h5-opening { display: none; }

    /* 弘磊板书：叙事第 06 步古字汇聚成的那个「字」专用 */
    @font-face {
      font-family: "Honglei-Banshu";
      /* 内嵌「字」单字形子集（860B）：file:// 直开也生效；外部完整字体作为回退 */
      src: url("data:font/woff2;base64,d09GMgABAAAAAANcAAwAAAAABewAAAMOAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGyAcCgZgADQKg1SDJwE2AiQDCAsGAAQgBYNeByAb5AQAjsJxL5aYTIY4aOWOh+fv1XPvez+LtocgGEt0zU6WFgtWoICWcPrQb+q7g1BKUnVPS01k29/I3PxfTP7+VM3XjAk8MaBRnAuzwULzvBuwphP4VUuTqMBa9Zbfl6Cm33vpowL0mLNE5onpSvBY4P8/gABAKZ/JLHD4XEzrAct5O17gFyxA02AyHUurhZiJ6INoD2UC/93XUMrIHRBAfNMLYIqCBAWMMYioWdagDgkcNv//o1+3BYTiKa4DfXR3II4A68S9QmNEvj9mMybZ3xMkspIsIQutFhguzF+fs7jlk5T25MkikQzvKQ8pl+nPE6TYJYSIK+XnLYbKQCU+FDcq93sYzMveppxkcFGcLJfvxyR9A0wSNgSuEyRDfbl7ISGG5+KxHMIE95LnCRKRIBU8ECR/yXMBWUhqAS+KW8hWcbKZoaScly5IsYYqMl+uEreKS2uR/+79XSo7MlmQrM7ylLuws3b9mTRRsOxihRkfWW4R4fJk9VPmdl/3pNCjR1mWNUvi1WzSNJYnRNfH77iwWmZiN6BgrYaO6kfZL7CjPrJuvw6vBqu3ypXXJJOZbg7+cUyuxyoLytu2JfC8Cctycz8yMuqzW5txWEKoHnmZh+RUj8Pg212BUkr102xGc/TUHPSe69EcSn005vgdL7Ea4Tx945ldPrLMkOZohUWVEaW30zTPyaY+zsxhKjuRZcB5mMdwY4YCawtAgITZp9aDi1b4V55hAXxdZJsAHrT+v/ufp0yXKQO0UUBAOf3zBKoM7N0REPTNzEKgwh0EZLMXZoBAWeLAEwC6ujFIVQfswRcJU8UipalXZESbIrJcnRFlTL0ROa7Bieq48IYoBEYg4nToNKRbkwaNelnbvARf3oW1atVavy5cEbXgOzyLGK28a30q7In4dXtU5/fDr82GJOvQrkG6Ok1iVWmXp1GfXPgNeqpVlW6+PHnzMky+NKJMb9UKBzz6qtl61mHBG6seTad2rG/f0I32XxSNelndqUcor7ixxqKVp2E1ImEHDIRt+Fk7LwzA/374IgA=") format("woff2"),
           url("../fonts/hongleibanshu.woff2") format("woff2");
      font-style: normal;
      font-weight: normal;
      font-display: block;
    }
    

    

    

    /* ===== Global ambient starfield (behind gallery & mood-select) ===== */
    #starCanvas {
      position: fixed;
      inset: 0;
      z-index: 1;
      pointer-events: none;
    }

    /* ===== Gallery: pure black infinite void ===== */
    .stage-bg {
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      background:
        radial-gradient(ellipse 80% 70% at 50% 46%, rgba(20, 18, 16, 0.55) 0%, transparent 60%),
        radial-gradient(ellipse 120% 120% at 50% 50%, transparent 55%, rgba(0,0,0,0.85) 100%),
        #000;
    }

    header {
      position: fixed;
      top: 0; left: 0; right: 0;
      z-index: 10;
      padding: 26px 20px 16px;
      text-align: center;
      pointer-events: none;
      transition: opacity 0.9s ease;
    }
    body.focusing header { opacity: 0; }

    header h1 {
      font-size: 2rem;
      font-weight: 700;
      letter-spacing: 0.5em;
      text-indent: 0.5em;
      color: var(--paper-100);
      text-shadow: 0 4px 30px rgba(0,0,0,0.9);
    }
    header p {
      margin-top: 9px;
      font-size: 0.7rem;
      letter-spacing: 0.24em;
      color: var(--paper-300);
      opacity: 0.6;
    }

    .scene {
      position: fixed;
      inset: 0;
      z-index: 2;
      perspective: var(--perspective);
      perspective-origin: 50% 50%;
      overflow: hidden;
      cursor: grab;
    }
    .scene:active { cursor: grabbing; }

    .cloud {
      position: absolute;
      inset: 0;
      transform-style: preserve-3d;
    }

    .card {
      position: absolute;
      left: 50%;
      top: 50%;
      border-radius: 9px;
      overflow: hidden;
      box-shadow: 0 16px 46px rgba(0,0,0,0.6);
      cursor: pointer;
      will-change: transform, opacity, filter;
      transform-origin: center;
      backface-visibility: hidden;
      transition: box-shadow 0.4s ease;
      background: linear-gradient(135deg, #1a1814, #2a2620);
    }
    .card.img-missing img { display: none; }
    .card.img-missing::before {
      content: attr(data-title);
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2.4rem;
      font-weight: 700;
      color: rgba(245,240,230,0.5);
      letter-spacing: 0.2em;
    }

    .card::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, rgba(0,0,0,0) 58%, rgba(0,0,0,0.4) 100%);
      pointer-events: none;
    }

    .card img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      pointer-events: none;
    }

    .card-label {
      position: absolute;
      bottom: 9px;
      left: 11px;
      z-index: 2;
      font-size: 0.92rem;
      font-weight: 600;
      letter-spacing: 0.14em;
      text-shadow: 0 2px 12px rgba(0,0,0,0.85);
      opacity: 0;
      transform: translateY(7px);
      transition: opacity 0.35s ease, transform 0.35s ease;
      pointer-events: none;
    }
    .card.hovered .card-label { opacity: 1; transform: translateY(0); }
    body.show-labels .card-label { opacity: 0.9; transform: none; }

    .card.focused {
      box-shadow: 0 0 0 1px rgba(245,240,230,0.10),
                  0 50px 130px rgba(0,0,0,0.8),
                  0 0 150px rgba(245,240,230,0.10);
    }

    .drag-hint {
      position: relative;
      z-index: 10;
      font-size: 0.62rem;
      letter-spacing: 0.22em;
      text-indent: 0.22em;
      color: var(--paper-300);
      opacity: 0;
      pointer-events: none;
      transition: opacity 1.2s ease;
      margin-top: 10px;
      text-shadow: 0 1px 10px rgba(0,0,0,0.35);
    }
    .drag-hint.show { opacity: 0.55; }

    /* Detail / focus panel (Scroll Mask reveal) */
    .detail-overlay {
      position: fixed;
      inset: 0;
      z-index: 4000;
      pointer-events: none;
      overflow: hidden;
    }
    .detail-overlay.active { pointer-events: auto; }

    /* 情绪图片撑满全屏：与画廊缩放无关的独立图层，object-fit:cover 铺满整屏 */
    .detail-bg {
      position: absolute;
      inset: 0;
      z-index: 0;
      opacity: 0;
      transition: opacity 0.5s ease;
      background: transparent;
    }
    .detail-overlay.active .detail-bg { opacity: 1; }
    .detail-bg img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      pointer-events: none;
    }

    /* 悲伤情绪卡片：细雨滴下落动效（细、长、透明，整体极淡） */
    .rain-canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      pointer-events: none;
      opacity: 0;
      transition: opacity 1.2s ease;
    }
    .rain-canvas.on { opacity: 1; }

    .detail-panel {
      position: absolute;
      left: 0; right: 0; bottom: 0;
      z-index: 2;
      padding: 44px 24px 48px;
      background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.7) 26%, rgba(0,0,0,0.92) 100%);
      opacity: 0;
      transition: opacity 0.4s ease;
    }
    .detail-overlay.active .detail-panel {
      opacity: 1;
    }

    .detail-content { max-width: 720px; margin: 0 auto; position: relative; }

    .detail-content::before {
      content: attr(data-char);
      position: absolute;
      top: -84px;
      right: -4px;
      font-size: 7rem;
      font-weight: 700;
      color: rgba(245, 240, 230, 0.045);
      line-height: 1;
      pointer-events: none;
    }

    .detail-pinyin {
      font-size: 0.9rem;
      letter-spacing: 0.16em;
      color: var(--gold);
      margin-bottom: 7px;
    }
    .detail-title {
      font-size: 2.2rem;
      font-weight: 700;
      letter-spacing: 0.22em;
      text-indent: 0.22em;
      margin-bottom: 16px;
    }
    .detail-tag {
      display: inline-block;
      padding: 7px 16px;
      border: 1px solid var(--seal);
      color: var(--seal-light);
      font-size: 0.74rem;
      letter-spacing: 0.12em;
      margin-bottom: 22px;
      border-radius: 2px;
    }
    .detail-desc {
      font-size: 1rem;
      line-height: 2.05;
      color: var(--paper-200);
      letter-spacing: 0.04em;
      margin-bottom: 26px;
    }

    .create-btn {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 13px 30px;
      background: transparent;
      border: 1px solid var(--gold);
      color: var(--gold);
      font-family: inherit;
      font-size: 0.95rem;
      font-weight: 600;
      letter-spacing: 0.18em;
      text-indent: 0.18em;
      border-radius: 3px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      transition: color 0.4s ease, box-shadow 0.4s ease, background 0.4s ease;
    }
    .create-btn::after {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at 50% 50%, rgba(201,168,86,0.25), transparent 70%);
      opacity: 0;
      transition: opacity 0.4s ease;
    }
    .create-btn:hover {
      color: var(--paper-100);
      background: rgba(184,155,74,0.12);
      box-shadow: 0 0 30px rgba(184,155,74,0.35);
    }
    .create-btn:hover::after { opacity: 1; }
    .create-btn .arrow { font-size: 1.1rem; }


    /* ===== Narrative (replaces the 5-glyph intro with a 6-step story) ===== */
    .narrative {
      position: fixed;
      inset: 0;
      z-index: 320;
      background: #000;
      opacity: 0;
      visibility: hidden;
      transition: opacity 1.4s ease, visibility 1.4s ease;
      overflow: hidden;
      cursor: none;
    }
    .narrative.show { opacity: 1; visibility: visible; }
    .narrative.done { opacity: 0; visibility: hidden; pointer-events: none; }

    .narv-strobe {
      position: absolute;
      inset: 0;
      z-index: 1;
      opacity: 0;
      transition: opacity 2.6s ease;
      pointer-events: none;
    }
    .narv-strobe.on { opacity: 0.13; }
    .narv-glyph {
      position: absolute;
      color: rgba(245, 240, 230, 0.5);
      font-weight: 700;
      text-shadow: 0 0 30px rgba(245, 240, 230, 0.15);
      animation: glyphFloat 16s ease-in-out infinite;
    }
    

    .narv-lamp {
      position: absolute;
      left: 50%;
      bottom: 20%;
      width: 14px;
      height: 14px;
      transform: translate(-50%, 50%);
      border-radius: 50%;
      background: radial-gradient(circle, rgba(255,200,128,0.95) 0%, rgba(255,172,92,0.6) 35%, rgba(255,150,70,0) 70%);
      box-shadow: 0 0 18px 8px rgba(255,182,104,0.5);
      opacity: 0;
      z-index: 2;
    }
    .narv-lamp.on {
      opacity: 1;
      animation: lampBreathe 2.8s ease-in-out infinite;
    }
    .narv-lamp.on::after {
      content: '';
      position: absolute;
      left: 50%; top: 50%;
      width: 42vmax; height: 42vmax;
      transform: translate(-50%, -32%);
      border-radius: 50%;
      background: radial-gradient(circle, rgba(255,182,104,0.16) 0%, rgba(255,160,80,0.05) 30%, transparent 62%);
      pointer-events: none;
      animation: lampSpread 4.4s ease-out forwards;
    }
    
    
    .narv-desk {
      position: absolute;
      left: 0; right: 0; bottom: 16%;
      height: 2px;
      background: linear-gradient(90deg, transparent, rgba(255,190,120,0.28), transparent);
      opacity: 0;
      z-index: 2;
    }
    .narv-desk.on { opacity: 1; transition: opacity 1.4s ease; }

    /* ===== warmth layer: living motes + phone motif ===== */
    .narv-motes {
      position: absolute;
      inset: 0;
      z-index: 3;
      pointer-events: none;
      mix-blend-mode: screen;
      opacity: 0;
      transition: opacity 1.8s ease;
    }
    .narv-motes.on { opacity: 1; }

    .narv-phone {
      position: absolute;
      left: 50%; top: 60%;
      transform: translate(-50%, -50%) scale(0.86);
      width: 62px; height: 116px;
      border: 1.5px solid rgba(245,240,230,0.34);
      border-radius: 15px;
      background: radial-gradient(125% 78% at 50% 30%, rgba(255,210,150,0.12), rgba(255,190,120,0.04) 60%, transparent 76%);
      box-shadow: 0 0 28px 7px rgba(255,196,128,0.18), inset 0 0 18px rgba(255,200,140,0.10);
      opacity: 0;
      transition: opacity 1.3s ease, transform 1.3s ease;
      z-index: 4;
      pointer-events: none;
    }
    .narv-phone::before {
      content: '';
      position: absolute;
      left: 50%; bottom: 9px;
      width: 18px; height: 3px; border-radius: 3px;
      transform: translateX(-50%);
      background: rgba(245,240,230,0.42);
    }
    .narv-phone.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

    .narv-text {
      position: absolute;
      left: 50%; top: 42%;
      transform: translate(-50%, -50%);
      z-index: 5;
      width: min(86vw, 760px);
      text-align: center;
      font-size: clamp(1.1rem, 4.4vw, 2rem);
      letter-spacing: 0.16em;
      line-height: 1.9;
      color: var(--paper-100);
      pointer-events: none;
      text-shadow: 0 2px 24px rgba(0,0,0,0.9);
    }
    .narv-text .ch {
      display: inline-block;
      opacity: 0;
      filter: blur(10px);
      transform: translateY(10px) scale(1.06);
      text-shadow: 0 0 18px rgba(255,206,150,0.22);
      animation: inkIn 1.3s ease forwards;
    }
    .narv-text.serif { font-family: 'Songti SC', 'STSong', 'SimSun', serif; }
    .narv-text.gold { color: #B9A47A; text-shadow: 0 2px 24px rgba(185,164,122,0.25); }
    .narv-text.tremble { animation: textTremble 0.5s ease; }
    .narv-text .dissolve { animation: inkWash 2.4s ease forwards; }
    
    
    

    .narv-frag {
      position: absolute;
      z-index: 4;
      font-size: 1.1rem;
      color: rgba(185, 164, 122, 0.42);
      pointer-events: none;
      transform-origin: center;
      animation: fragLife 11s ease-in-out infinite;
    }
    

    .narv-oracle, .narv-wipe, .narv-glass {
      position: absolute;
      inset: 0;
      z-index: 6;
      width: 100%;
      height: 100%;
    }
    .narv-wipe { z-index: 7; cursor: none; touch-action: none; }
    .narv-glass { z-index: 9; pointer-events: none; }

    .narv-ripple {
      position: absolute;
      z-index: 8;
      width: 12px; height: 12px;
      margin: -6px 0 0 -6px;
      border-radius: 50%;
      border: 1px solid rgba(245, 240, 230, 0.6);
      pointer-events: none;
      animation: rippleOut 1.1s ease-out forwards;
    }
    

    .narv-hint2 {
      position: absolute;
      left: 50%; bottom: 12%;
      transform: translateX(-50%);
      z-index: 8;
      font-size: 0.84rem;
      letter-spacing: 0.28em;
      color: rgba(245, 240, 230, 0.55);
      opacity: 0;
      transition: opacity 1s ease;
      pointer-events: none;
      text-shadow: 0 2px 12px rgba(0,0,0,0.8);
    }
    .narv-hint2.show { opacity: 1; animation: hintPulse 2.4s ease-in-out infinite; }
    

    /* ===== motion-first layers: night / window / moon / phone-cursor / feeling / sub ===== */
    .narv-night {
      position: absolute; inset: 0; z-index: 0;
      opacity: 0; transition: opacity 2.2s ease; pointer-events: none;
    }
    .narv-night.on { opacity: 1; }

    .narv-window {
      position: absolute; left: 50%; top: 27%;
      transform: translate(-50%, -50%);
      width: 30vmin; height: 38vmin;
      border: 1px solid rgba(245, 240, 230, 0.12);
      border-radius: 4px; opacity: 0;
      transition: opacity 2.6s ease; z-index: 0; pointer-events: none;
      background: linear-gradient(180deg, rgba(245,240,230,0.05), rgba(245,240,230,0.012));
    }
    .narv-window.on { opacity: 1; }
    .narv-window::before { /* 竖棂 */
      content: ''; position: absolute; left: 50%; top: 6%; bottom: 6%;
      width: 1px; background: rgba(245, 240, 230, 0.10); transform: translateX(-50%);
    }
    .narv-window::after { /* 横棂 */
      content: ''; position: absolute; top: 50%; left: 6%; right: 6%;
      height: 1px; background: rgba(245, 240, 230, 0.10); transform: translateY(-50%);
    }

    .narv-moon {
      position: absolute; left: 70%; top: 9%;
      width: 7vmin; height: 7vmin; border-radius: 50%;
      background: radial-gradient(circle at 38% 38%, rgba(247,242,222,0.96), rgba(226,220,198,0.55) 58%, rgba(210,205,185,0.12) 78%);
      box-shadow: 0 0 46px 14px rgba(240,235,215,0.16);
      opacity: 0; transform: translateY(46px);
      transition: opacity 2.8s ease, transform 3.6s cubic-bezier(.2,.7,.2,1);
      z-index: 0; pointer-events: none;
    }
    .narv-moon.on { opacity: 0.82; transform: translateY(0); animation: moonBreath 7.5s ease-in-out infinite; }
    

    .narv-cursor {
      position: absolute; left: 50%; top: 46%;
      transform: translate(-50%, -50%);
      width: 2px; height: 18px;
      background: rgba(245, 240, 230, 0.82);
      opacity: 0; pointer-events: none;
    }
    .narv-cursor.on { animation: caretBlink 1.05s step-end infinite; }
    

    /* 手机虚拟打字：文字紧贴光标左侧，逐字输入又删除 */
    .narv-phone-type {
      position: absolute; right: 56%; top: 46%;
      transform: translateY(-50%);
      white-space: nowrap;
      font-size: 0.72rem; letter-spacing: 0.14em;
      color: rgba(245, 240, 230, 0.78);
      font-family: 'Songti SC', 'STSong', 'SimSun', serif;
      text-shadow: 0 0 10px rgba(255,206,150,0.35);
      pointer-events: none;
    }

    .narv-ghost {
      position: absolute; left: 50%; top: 46%;
      transform: translate(-50%, -50%);
      font-size: 0.94rem; color: rgba(245, 240, 230, 0.7);
      letter-spacing: 0.2em; opacity: 0;
      pointer-events: none; text-shadow: 0 0 14px rgba(255,206,150,0.3);
      animation: ghostFade 1.5s ease forwards;
    }
    

    .narv-feeling {
      position: absolute; left: 50%; top: 50%;
      transform: translate(-50%, -50%);
      width: 32vmin; height: 32vmin; border-radius: 50%;
      background: radial-gradient(circle, rgba(255,190,140,0.34), rgba(255,170,110,0.12) 46%, rgba(255,170,110,0) 72%);
      filter: blur(5px);
      opacity: 0; z-index: 5; pointer-events: none;
      transition: opacity 1.4s ease;
    }
    .narv-feeling.on { opacity: 1; animation: feelingPulse 3.2s ease-in-out infinite; }
    
    .narv-feeling.condense { animation: feelingCondense 1.7s ease forwards; }
    

    .narv-sub {
      position: absolute; left: 50%; bottom: 15%;
      transform: translateX(-50%);
      z-index: 6; font-size: 0.82rem; letter-spacing: 0.32em;
      color: rgba(245, 240, 230, 0.42);
      opacity: 0; transition: opacity 1.2s ease; pointer-events: none;
      text-shadow: 0 2px 12px rgba(0,0,0,0.85);
      text-align: center; width: min(88vw, 660px);
    }
    .narv-sub.show { opacity: 1; }
    .narv-sub.gold { color: rgba(185, 164, 122, 0.5); }
    .narv-sub.whisper { font-size: 0.74rem; letter-spacing: 0.26em; }
    .narv-sub.whisper.show { opacity: 0.46; }

    /* ===== breathing vignette (step 04 无名之绪：暗角呼吸，强化未命名张力) ===== */
    .narv-vignette {
      position: absolute; inset: 0; z-index: 1; pointer-events: none;
      background: radial-gradient(ellipse at 50% 46%, transparent 34%, rgba(0,0,0,0.62) 100%);
      opacity: 0; transition: opacity 1.6s ease;
    }
    .narv-vignette.on { opacity: 1; animation: vignettePulse 4.6s ease-in-out infinite; }
    

    /* ===== ghost "name" (step 04 无名之绪：一个「名」反复想成形却碎散，动效即「曾经没有名字」) ===== */
    .narv-ghost {
      position: absolute; left: 50%; top: 45%;
      transform: translate(-50%, -50%);
      z-index: 5; font-family: 'STKaiti', 'KaiTi', 'Songti SC', serif;
      font-size: 6rem; line-height: 1; font-weight: 500;
      color: rgba(185, 164, 122, 0); pointer-events: none;
      text-shadow: 0 0 34px rgba(185, 164, 122, 0);
      opacity: 0; filter: blur(10px);
    }
    .narv-ghost.try { animation: ghostTry 4.4s cubic-bezier(.4,0,.3,1) forwards; }
    

    /* ===== center light burst (step 06 造字：古字汇聚成「字」时的一束光) ===== */
    .narv-bloom {
      position: absolute; left: 50%; top: 46%;
      transform: translate(-50%, -50%) scale(0.2);
      width: 34vmin; height: 34vmin; border-radius: 50%;
      background: radial-gradient(circle, rgba(255,238,200,0.6), rgba(255,200,130,0.2) 44%, rgba(255,190,110,0) 72%);
      opacity: 0; z-index: 8; pointer-events: none; mix-blend-mode: screen;
    }
    .narv-bloom.flash { animation: bloomFlash 1.5s ease-out forwards; }
    

    /* (enhanced FX layers removed — base 6-step narrative) */

    .narv-enter {
      position: absolute;
      left: 50%; bottom: 13%;
      transform: translateX(-50%) translateY(20px);
      z-index: 10;
      padding: 14px 46px;
      font-family: inherit;
      font-size: 1rem;
      font-weight: 600;
      letter-spacing: 0.3em;
      text-indent: 0.3em;
      color: var(--paper-100);
      cursor: pointer;
      white-space: nowrap;
      opacity: 0;
      pointer-events: none;
      border: 1px solid rgba(245, 240, 230, 0.35);
      border-radius: 3px;
      background: rgba(245, 240, 230, 0.04);
      transition: opacity 0.9s ease, transform 0.9s ease, background 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease;
    }
    .narv-enter.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
    .narv-enter:hover {
      background: rgba(184, 155, 74, 0.14);
      border-color: var(--gold);
      color: #fff;
      box-shadow: 0 0 30px rgba(184, 155, 74, 0.3);
    }

    /* ===== narrative sound toggle (top-right) ===== */
    .narv-sound {
      position: absolute;
      top: 14px; right: 12px;
      z-index: 14;
      width: 34px; height: 34px;
      display: flex; align-items: center; justify-content: center;
      border-radius: 50%;
      border: 1px solid rgba(245, 240, 230, 0.22);
      background: rgba(10, 9, 8, 0.5);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      cursor: pointer;
      pointer-events: auto;
      transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
    }
    .narv-sound:hover { border-color: var(--gold); background: rgba(22, 18, 12, 0.7); transform: scale(1.06); }
    .narv-sound img { width: 16px; height: 16px; filter: invert(0.92) sepia(0.18); pointer-events: none; }
    .narv-sound .slash {
      position: absolute;
      left: 50%; top: 50%;
      width: 22px; height: 2px;
      background: rgba(245, 240, 230, 0.85);
      border-radius: 2px;
      transform: translate(-50%, -50%) rotate(-45deg);
      opacity: 0;
      transition: opacity 0.25s ease;
      pointer-events: none;
    }
    .narv-sound.muted .slash { opacity: 1; }
    .narv-sound.muted img { opacity: 0.45; }

    /* ===== narrative skip button (top-right, beside sound) ===== */
    .narv-skip {
      position: absolute;
      top: 14px; right: 54px;
      z-index: 14;
      height: 34px;
      padding: 0 14px;
      display: flex; align-items: center; justify-content: center;
      font-family: inherit;
      font-size: 0.82rem;
      letter-spacing: 0.16em;
      color: rgba(245, 240, 230, 0.85);
      border-radius: 999px;
      border: 1px solid rgba(245, 240, 230, 0.22);
      background: rgba(10, 9, 8, 0.5);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      cursor: pointer;
      pointer-events: auto;
      opacity: 0;
      transition: opacity 0.6s ease, border-color 0.3s ease, background 0.3s ease, color 0.3s ease, transform 0.3s ease;
    }
    .narv-skip.show { opacity: 1; }
    .narv-skip:hover { border-color: var(--gold); color: #fff; background: rgba(22, 18, 12, 0.7); transform: scale(1.04); }

    

    /* ===== Opening gate (kaichangbeijingtu + flowing river + stars + glass cursor) ===== */
    .opening {
      position: fixed;
      inset: 0;
      z-index: 300;
      background: #000;
      transition: opacity 1.4s ease, visibility 1.4s ease;
    }
    .opening.done { opacity: 0; visibility: hidden; pointer-events: none; }

    .opening .obg {
      position: absolute;
      inset: 0;
      background: url('../images/kaichangbeijingtu.png') center center / cover no-repeat;
      transform: scale(1.06);
      animation: obgDrift 26s ease-in-out infinite alternate;
      will-change: transform;
    }
    

    /* flowing river light + caustics */
    .opening .oriver {
      position: absolute;
      inset: -20%;
      z-index: 1;
      pointer-events: none;
      background:
        repeating-linear-gradient(105deg,
          rgba(245,240,230,0) 0px,
          rgba(245,240,230,0.05) 60px,
          rgba(201,168,86,0.04) 120px,
          rgba(245,240,230,0) 200px);
      mix-blend-mode: screen;
      opacity: 0.7;
      animation: riverFlow 14s linear infinite;
    }
    
    .opening .ocaustics {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      pointer-events: none;
      mix-blend-mode: screen;
      opacity: 0.5;
    }

    .opening #openingStars {
      position: absolute;
      inset: 0;
      z-index: 2;
      pointer-events: none;
    }

    .opening canvas {
      position: absolute;
      inset: 0;
      z-index: 3;
      touch-action: none;
      cursor: none;
    }

    .opening .oguide {
      position: absolute;
      left: 50%; top: 50%;
      transform: translate(-50%, -50%);
      z-index: 2;
      font-size: clamp(240px, 52vw, 560px);
      font-weight: 700;
      color: rgba(245, 240, 230, 0.05);
      pointer-events: none;
      letter-spacing: 0;
      text-shadow: 0 0 60px rgba(245,240,230,0.08);
      transition: opacity 0.6s ease, color 0.6s ease;
    }
    .opening .oguide.glow {
      color: rgba(245, 240, 230, 0.16);
      text-shadow: 0 0 90px rgba(201, 168, 86, 0.5);
    }

    .opening .oui {
      position: absolute;
      inset: 0;
      z-index: 4;
      pointer-events: none;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      padding: 28px 24px 34px;
    }
    .opening .otop {
      text-align: center;
      opacity: 0;
      transform: translateY(-10px);
      animation: fadeDown 1.2s ease 0.3s forwards;
    }
    .opening .otop h1 {
      font-size: clamp(1.6rem, 5vw, 2.6rem);
      letter-spacing: 0.45em;
      text-indent: 0.45em;
      font-weight: 700;
      text-shadow: 0 4px 20px rgba(0,0,0,0.9);
    }
    .opening .otop p {
      margin-top: 8px;
      font-size: 0.72rem;
      letter-spacing: 0.22em;
      color: rgba(245,240,230,0.55);
      text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    }
    .opening .ohint {
      text-align: center;
      font-size: 0.78rem;
      letter-spacing: 0.18em;
      color: rgba(245,240,230,0.5);
      text-shadow: 0 2px 12px rgba(0,0,0,0.8);
      opacity: 0;
      animation: fadeUp 1.2s ease 0.8s forwards;
    }

    .opening .ocontrols {
      position: absolute;
      right: 18px;
      top: 18px;
      z-index: 5;
      pointer-events: auto;
    }
    .opening .ocontrols button {
      background: rgba(0,0,0,0.35);
      border: 1px solid rgba(245,240,230,0.22);
      color: rgba(245,240,230,0.8);
      font-family: inherit;
      font-size: 0.7rem;
      letter-spacing: 0.12em;
      padding: 7px 12px;
      border-radius: 2px;
      cursor: pointer;
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
      transition: all 0.3s ease;
      margin-left: 8px;
    }
    .opening .ocontrols button:hover { background: rgba(0,0,0,0.55); color: var(--paper-100); }
    #enterBtn { display: none; }
    #enterBtn.show { display: inline-block; }

    .opening .osuccring {
      position: absolute;
      left: 50%; top: 50%;
      width: 120vmax; height: 120vmax;
      transform: translate(-50%, -50%) scale(0);
      z-index: 6;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(201,168,86,0.18) 0%, transparent 55%);
      pointer-events: none;
      transition: transform 1.4s cubic-bezier(0.22,1,0.36,1), opacity 1s ease;
    }
    .opening .osuccring.open {
      transform: translate(-50%, -50%) scale(1);
      opacity: 0;
    }
    .opening .osucctext {
      position: absolute;
      left: 50%; top: 50%;
      transform: translate(-50%, -50%);
      z-index: 6;
      font-size: clamp(3rem, 10vw, 6rem);
      letter-spacing: 0.3em;
      text-indent: 0.3em;
      font-weight: 700;
      color: var(--paper-100);
      text-shadow: 0 0 60px rgba(201,168,86,0.6);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.8s ease;
    }
    .opening .osucctext.show { opacity: 1; }

    /* ===== Create-journey overlay (开始造字之旅) ===== */
    .create-journey {
      position: fixed;
      inset: 0;
      z-index: 400;
      display: flex;
      align-items: center;
      justify-content: center;
      background:
        radial-gradient(ellipse 70% 60% at 50% 40%, rgba(28,24,20,0.6) 0%, transparent 60%),
        rgba(2,2,2,0.93);
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.8s ease, visibility 0.8s ease;
      overflow-y: auto;
    }
    .create-journey.show { opacity: 1; visibility: visible; }

    .cj-inner {
      position: relative;
      width: 100%;
      max-width: 560px;
      padding: 54px 26px 40px;
      text-align: center;
    }
    .cj-seed {
      font-size: 1.5rem;
      font-weight: 700;
      letter-spacing: 0.18em;
      text-indent: 0.18em;
      color: var(--paper-100);
      text-shadow: 0 0 40px rgba(245,240,230,0.12);
      opacity: 0;
      transform: translateY(16px);
      animation: msUp 0.9s ease 0.1s forwards;
    }
    .cj-sub {
      margin: 14px auto 26px;
      font-size: 0.92rem;
      line-height: 1.9;
      letter-spacing: 0.06em;
      color: rgba(232,224,208,0.7);
      max-width: 420px;
      opacity: 0;
      transform: translateY(16px);
      animation: msUp 0.9s ease 0.26s forwards;
    }
    .cj-input {
      width: 100%;
      max-width: 360px;
      padding: 13px 18px;
      background: rgba(245,240,230,0.04);
      border: 1px solid rgba(245,240,230,0.18);
      border-radius: 4px;
      color: var(--paper-100);
      font-family: inherit;
      font-size: 1.05rem;
      letter-spacing: 0.18em;
      text-align: center;
      outline: none;
      transition: border-color 0.4s ease, box-shadow 0.4s ease;
      opacity: 0;
      transform: translateY(16px);
      animation: msUp 0.9s ease 0.42s forwards;
    }
    .cj-input::placeholder { color: rgba(232,224,208,0.35); letter-spacing: 0.1em; }
    .cj-input:focus { border-color: var(--gold); box-shadow: 0 0 22px rgba(184,155,74,0.25); }

    .cj-canvas {
      display: block;
      width: 100%;
      max-width: 360px;
      height: 230px;
      margin: 22px auto 6px;
      border: 1px dashed rgba(245,240,230,0.16);
      border-radius: 8px;
      background: rgba(245,240,230,0.02);
      cursor: crosshair;
      opacity: 0;
      transform: translateY(16px);
      animation: msUp 0.9s ease 0.58s forwards;
    }
    .cj-caption {
      font-size: 0.7rem;
      letter-spacing: 0.18em;
      color: rgba(232,224,208,0.4);
      margin-bottom: 22px;
      opacity: 0;
      animation: msUp 0.9s ease 0.7s forwards;
    }

    .cj-actions {
      display: flex;
      gap: 14px;
      justify-content: center;
      opacity: 0;
      transform: translateY(16px);
      animation: msUp 0.9s ease 0.8s forwards;
    }
    .cj-btn {
      padding: 12px 28px;
      background: var(--gold);
      border: 1px solid var(--gold);
      color: #1a160e;
      font-family: inherit;
      font-size: 0.9rem;
      font-weight: 600;
      letter-spacing: 0.18em;
      text-indent: 0.18em;
      border-radius: 3px;
      cursor: pointer;
      transition: filter 0.3s ease, box-shadow 0.3s ease;
    }
    .cj-btn:hover { filter: brightness(1.12); box-shadow: 0 0 26px rgba(184,155,74,0.4); }
    .cj-btn.ghost {
      background: transparent;
      border-color: rgba(245,240,230,0.28);
      color: var(--paper-200);
    }
    .cj-btn.ghost:hover { color: var(--paper-100); border-color: rgba(245,240,230,0.55); box-shadow: none; }

    /* ===== BorderGlow 边框光晕按钮效果（开始造字之旅） ===== */
    .border-glow {
      position: relative;
      border-radius: 28px;
      background: #120F17;
      isolation: isolate;
      overflow: visible;
    }
    .border-glow::before,
    .border-glow::after {
      content: '';
      position: absolute;
      inset: 0;
      border-radius: inherit;
      padding: 2px;
      -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
      -webkit-mask-composite: xor;
              mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
              mask-composite: exclude;
      pointer-events: none;
      opacity: var(--near, 0);
      transition: opacity 0.35s ease;
    }
    .border-glow::before {
      background: conic-gradient(from var(--ang, 0deg), #c084fc, #f472b6, #38bdf8, #c084fc);
    }
    .border-glow::after {
      background: radial-gradient(circle var(--gr, 40px) at var(--mx, 50%) var(--my, 50%),
        rgba(var(--gc, 40 80 80), var(--gi, 1)) 0%, transparent 72%);
    }
    .border-glow.active::before,
    .border-glow.active::after { opacity: 1; }

    .cj-btn.border-glow {
      background: #120F17;
      border: none;
      color: var(--gold);
      box-shadow: 0 0 0 1px rgba(245,240,230,0.10);
    }
    .cj-btn.border-glow.ghost {
      color: rgba(232,224,208,0.85);
    }
    .cj-btn.border-glow:hover {
      filter: none;
      box-shadow: 0 0 0 1px rgba(245,240,230,0.10), 0 0 26px rgba(192,132,252,0.22);
    }

    .cj-close {
      position: absolute;
      top: 14px; right: 16px;
      width: 42px; height: 42px;
      border-radius: 50%;
      border: 1px solid rgba(245,240,230,0.18);
      background: rgba(10, 9, 8, 0.5);
      color: var(--paper-100);
      font-size: 1.4rem;
      line-height: 1;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 2;
    }

    .cj-result {
      margin-top: 24px;
      min-height: 10px;
    }
    .cj-seal {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 150px; height: 150px;
      border: 3px solid var(--seal);
      border-radius: 8px;
      background: rgba(168,63,57,0.06);
      color: var(--seal-light);
      font-size: 3.4rem;
      font-weight: 700;
      letter-spacing: 0;
      box-shadow: 0 0 40px rgba(168,63,57,0.35), inset 0 0 24px rgba(168,63,57,0.18);
      animation: sealStamp 0.7s cubic-bezier(0.22,1,0.36,1) both;
      overflow: hidden;
    }
    .cj-seal img { width: 78%; height: 78%; object-fit: contain; }
    
    .cj-seal-name {
      margin-top: 18px;
      font-size: 1.5rem;
      font-weight: 700;
      letter-spacing: 0.3em;
      text-indent: 0.3em;
      color: var(--paper-100);
    }
    .cj-seal-note {
      margin-top: 8px;
      font-size: 0.86rem;
      letter-spacing: 0.1em;
      color: rgba(232,224,208,0.62);
    }

    .cj-restart {
      margin-top: 22px;
      background: none;
      border: none;
      color: rgba(232,224,208,0.5);
      font-family: inherit;
      font-size: 0.78rem;
      letter-spacing: 0.2em;
      cursor: pointer;
      text-decoration: underline;
      text-underline-offset: 4px;
    }

    /* ===== Scroll Mask transition (black-out → reveal next page) ===== */
    #scrollMask {
      position: fixed;
      inset: 0;
      z-index: 9999;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #000;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity 0.7s ease, visibility 0.7s ease;
    }
    #scrollMask.active { pointer-events: auto; }
    #scrollMask.show { opacity: 1; visibility: visible; }
    #scrollMask .sm-inner {
      text-align: center;
      transform: translateY(38px);
      opacity: 0;
      transition: transform 1s cubic-bezier(0.22,1,0.36,1) 0.12s, opacity 1s ease 0.12s;
    }
    #scrollMask.show .sm-inner { transform: translateY(0); opacity: 1; }
    #scrollMask .sm-char {
      font-size: clamp(4rem, 17vw, 9rem);
      font-weight: 700;
      letter-spacing: 0.12em;
      text-indent: 0.12em;
      color: rgba(245,240,230,0.07);
      text-shadow: 0 0 60px rgba(201,168,86,0.25);
    }
    #scrollMask .sm-line {
      margin-top: 18px;
      font-size: 0.8rem;
      letter-spacing: 0.42em;
      text-indent: 0.42em;
      color: rgba(245,240,230,0.4);
      opacity: 0;
      animation: smLineIn 1s ease 0.5s forwards;
    }

    /* 实验室进入动画已撤销（过渡恢复为黑幕 opacity 淡出） */
    

    
    

    @media (max-width: 560px) {
      .narv-text { font-size: clamp(1rem, 5vw, 1.5rem); }
      .narv-enter { font-size: 0.9rem; padding: 12px 34px; letter-spacing: 0.22em; text-indent: 0.22em; }
    }
    @media (min-width: 768px) {
      :root { --perspective: 1700px; }
      header { padding-top: 38px; }
      header h1 { font-size: 2.8rem; }
      header p { font-size: 0.84rem; }
      .detail-content { max-width: 520px; }
      .detail-title { font-size: 2.8rem; }
      .detail-desc { font-size: 1.05rem; }
    }

/* ===== 玄玄 · 墨灵角色（xuanxuan.css 已合并） ===== */
#xuanxuan{
  position:absolute;
  z-index:9999;
  width:80px;
  pointer-events:none;
  transform-origin:50% 100%;
}

/* 情绪卡片详情打开期间（body.focusing）强制隐藏玄玄：纯声明式双保险，
   不依赖 JS 时序，可兜住延迟问候定时器在旧缓存下复现的情况 */
body.focusing #xuanxuan{ display:none !important; }
/* 我的字造集 · 字卡详情打开期间（body.card-detail-open）同样强制隐藏玄玄 */
body.card-detail-open #xuanxuan{ display:none !important; }

#xuanxuan img{
  width:100%;
  display:block;
  animation: xuanFloat 4.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(30,22,10,0.28));
}

.xuan-enter{
  animation: xuanEnter .85s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes xuanEnter{
  0%   { opacity:0; transform: translateY(64px) scale(.86); }
  60%  { opacity:1; }
  100% { opacity:1; transform: translateY(0) scale(1); }
}

@keyframes xuanFloat{
  0%,100%{ transform: translateY(0); }
  50%    { transform: translateY(-6px); }
}

.xuan-jump img{
  animation: xuanJump .9s cubic-bezier(.3,1.4,.5,1) both;
}
@keyframes xuanJump{
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-34px) scale(1.06,.94); }
  60%  { transform: translateY(0) scale(.96,1.05); }
  100% { transform: translateY(0) scale(1); }
}

.xuan-dialog{
  position:absolute;
  bottom:106%;
  left:50%;
  transform:translateX(-50%);
  width:max-content;
  max-width:160px;
  background:rgba(255,248,232,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border:1px solid rgba(176,143,80,.35);
  border-radius:14px;
  padding:6px 10px;
  font-size:11px;
  line-height:1.4;
  color:#4a3a18;
  box-shadow:0 6px 18px rgba(60,45,20,.14);
  display:none;
  z-index:2;
}
.xuan-dialog::after{
  content:'';
  position:absolute;
  top:100%; left:50%;
  transform:translateX(-50%);
  border:7px solid transparent;
  border-top-color:rgba(255,248,232,0.72);
}
.xuan-bubble-in{
  animation: xuanBubble .42s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes xuanBubble{
  0%{ opacity:0; transform:translateX(-50%) translateY(8px) scale(.92); }
  100%{ opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
}

.xuan-ink{
  position:absolute;
  left:50%; top:30%;
  width:0; height:0;
  pointer-events:none;
}
.xuan-ink-dot{
  position:absolute;
  left:0; top:0;
  width:6px; height:6px;
  margin:-3px 0 0 -3px;
  border-radius:50%;
  background:#2a241c;
  opacity:.85;
  animation: xuanInk 1.7s ease-in forwards;
  animation-delay:var(--d,0s);
}
@keyframes xuanInk{
  0%   { opacity:0; transform: translate(0,0) scale(.4); }
  25%  { opacity:.85; }
  100% { opacity:0; transform: translate(var(--dx,0), var(--dy,30px)) scale(1); }
}

/* 各页定位 */
.xuan-story,.xuan-intro{
  position:fixed;
  right:16px;
  bottom:72px;
}

.xuan-lab{
  position:absolute;
  right:90px;
  bottom:8px;
}
.xuan-lab .xuan-dialog{ left:auto; right:0; transform:none; }

.xuan-workshop{
  position:absolute;
  right:8px;
  top:72px;
}
.xuan-workshop .xuan-dialog{
  bottom:auto;
  top:50%;
  left:auto;
  right:106%;
  transform:translateY(-50%);
}
.xuan-workshop .xuan-dialog::after{
  top:50%; bottom:auto;
  left:auto; right:-14px;
  border-top-color:transparent;
  border-bottom-color:transparent;
  border-left-color:rgba(255,248,232,0.72);
  border-right-color:transparent;
  transform:translateY(-50%);
}

.xuan-analysis{
  position:absolute;
  right:22px;
  bottom:60px;
}
.xuan-analysis .xuan-dialog{
  left:auto;
  right:0;
  transform:none;
}

.xuan-meaning{
  position:absolute;
  right:12px;
  bottom:110px;
}

.xuan-charcard{
  position:absolute;
  right:64px;
  bottom:30px;
}

.xuan-collection{
  position:absolute;
  right:92px;
  bottom:24px;
}

.xuan-zizao{
  position:fixed;
  right:128px;
  bottom:16px;
  transform:none;
}
.xuan-zizao .xuan-dialog{
  position:fixed;
  right:96px;
  bottom:128px;
  top:auto;
  left:auto;
  width:max-content;
  max-width:160px;
  transform:none;
}
.xuan-zizao .xuan-dialog.xuan-bubble-in{ animation-name:xuanBubbleZizao; }
@keyframes xuanBubbleZizao{
  0%{opacity:0;transform:translateY(8px) scale(.92)}
  100%{opacity:1;transform:translateY(0) scale(1)}
}
.xuan-zizao .xuan-dialog::after{
  top:100%; bottom:auto;
  left:auto; right:26px;
  border:7px solid transparent;
  border-top-color:rgba(255,248,232,0.72);
  border-bottom-color:transparent;
  border-left-color:transparent;
  border-right-color:transparent;
  transform:none;
}

@media(max-width:768px){
  #xuanxuan{width:56px}
  .xuan-story,.xuan-intro{right:10px;bottom:48px}
  .xuan-lab{right:56px;bottom:6px}
  .xuan-workshop{right:6px;top:60px}
  .xuan-workshop .xuan-dialog{ right:104%; }
  .xuan-analysis{right:14px;bottom:48px}
  .xuan-meaning{right:8px;bottom:80px}
  .xuan-charcard{right:40px;bottom:24px}
  .xuan-collection{right:56px;bottom:18px}
  .xuan-zizao{right:84px;bottom:14px}
  .xuan-zizao .xuan-dialog{ right:60px; bottom:96px; position:fixed; top:auto; left:auto; transform:none; }
  .xuan-zizao .xuan-dialog::after{ right:16px; }
  .xuan-dialog{max-width:130px;font-size:10px;padding:5px 8px}
}

@media (prefers-reduced-motion: reduce){
  #xuanxuan img,
  .xuan-jump img{ animation:none !important; }
  .xuan-enter{ animation:none !important; }
  .xuan-ink-dot{ display:none !important; }
}
  