/* 字造集 - 主样式 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 情景引入页 ===== */
.scene-page {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #0d0c0a;
  font-family: "Zizaoji-Serif", serif;
  color: #e8e0d0;
}
.scene-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(60,50,40,.5) 0%, rgba(20,18,15,.9) 55%, #0a0908 100%);
  z-index: 0;
  transition: background 2s ease;
}
.scene-page.phase-2 .scene-bg {
  background: radial-gradient(ellipse at 50% 45%, rgba(80,60,50,.45) 0%, rgba(25,20,16,.92) 60%, #0c0a08 100%);
}
.scene-page.phase-3 .scene-bg {
  background: radial-gradient(ellipse at 50% 55%, rgba(120,95,70,.4) 0%, rgba(40,32,24,.9) 55%, #14100c 100%);
}
.scene-moon {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #f5ecd4 0%, #d8c9a0 55%, #a89870 100%);
  box-shadow: 0 0 60px rgba(245,236,212,.25), 0 0 120px rgba(245,236,212,.12);
  opacity: 0;
  z-index: 1;
  transition: opacity 1.8s ease, transform 1.8s ease;
}
.scene-page.phase-1 .scene-moon { opacity: .85; }
.scene-page.phase-2 .scene-moon { opacity: .6; transform: translateX(-50%) translateY(10px); }
.scene-page.phase-3 .scene-moon { opacity: 0; transform: translateX(-50%) translateY(30px); }
.scene-ink {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("../assets/images/ink.png");
  opacity: 0;
  filter: blur(1px);
  transition: opacity 2.5s ease;
}
.scene-ink-1 {
  left: -80px;
  bottom: 5%;
  width: 320px;
  height: 520px;
  transform: rotate(-20deg);
}
.scene-ink-2 {
  right: -70px;
  bottom: -40px;
  width: 380px;
  height: 440px;
  transform: rotate(25deg) scaleX(-1);
}
.scene-page.phase-2 .scene-ink-1 { opacity: .35; }
.scene-page.phase-2 .scene-ink-2 { opacity: .3; }
.scene-page.phase-3 .scene-ink-1 { opacity: .5; }
.scene-page.phase-3 .scene-ink-2 { opacity: .45; }

/* 开始提示 */
.scene-start {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  cursor: pointer;
  opacity: 0;
  animation: sceneStartIn 1.4s ease .4s forwards;
}
.scene-start.hidden { display: none; }
.scene-start-hint {
  font-size: 15px;
  letter-spacing: 4px;
  color: #c8bea8;
  font-family: "Zizaoji-Serif", serif;
}
.scene-start-pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e8dcc0;
  box-shadow: 0 0 0 0 rgba(232,220,192,.5);
  animation: scenePulse 2s ease-in-out infinite;
}
@keyframes sceneStartIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scenePulse {
  0% { box-shadow: 0 0 0 0 rgba(232,220,192,.5); }
  70% { box-shadow: 0 0 0 18px rgba(232,220,192,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,220,192,0); }
}

/* 旁白舞台 */
.scene-stage {
  position: relative;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 44px;
  max-width: 420px;
}
.scene-stage.show { display: flex; }
.scene-line {
  font-size: 22px;
  line-height: 2;
  letter-spacing: 3px;
  color: #ece3cf;
  font-family: "Zizaoji-Serif", serif;
  min-height: 90px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1s ease, transform 1s ease;
}
.scene-line.show { opacity: 1; transform: translateY(0); }
.scene-sub {
  margin-top: 28px;
  font-size: 13px;
  letter-spacing: 2px;
  color: #8a8270;
  font-family: Georgia, serif;
  opacity: 0;
  transition: opacity 1s ease .4s;
}
.scene-sub.show { opacity: 1; }

/* 进度点 */
.scene-progress {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 10;
  opacity: 0;
  transition: opacity .8s ease;
}
.scene-progress.show { opacity: 1; }
.scene-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(232,220,192,.25);
  transition: all .6s ease;
}
.scene-dot.active {
  background: #e8dcc0;
  width: 22px;
  border-radius: 3px;
}

/* 跳过按钮 */
.scene-skip {
  position: absolute;
  top: 44px;
  right: 40px;
  z-index: 20;
  background: transparent;
  border: 1px solid rgba(232,220,192,.3);
  color: #b8ae98;
  font-size: 12px;
  letter-spacing: 2px;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-family: "Zizaoji-Serif", serif;
  opacity: 0;
  transition: opacity .8s ease, background .3s, color .3s;
}
.scene-skip.show { opacity: 1; }
.scene-skip:hover { background: rgba(232,220,192,.1); color: #e8dcc0; }

/* ===== 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("../assets/images/paper-bg.png");
  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("../assets/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("../assets/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: var(--color-paper);
  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;
}
.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-ancient);
  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-ancient);
  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-ancient);
  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: #f8f5ed;
  border: 1px solid #d8cdbb;
  border-radius: 16px;
  box-shadow: 0 15px 45px rgba(40, 30, 20, 0.15);
  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: #f7f2e8;
  border: 1px solid #c9c0ad;
  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("../assets/images/paper-bg.png");
  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.75);
  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("../assets/images/paper-bg.png");
  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: "Zizaoji-Serif", serif;
  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: 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;
}

/* ===== P09 海报页 ===== */
#page-poster {
  justify-content: center;
  align-items: center;
  padding: 15px;
}
.poster-container {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 9/16;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-ink);
  margin-bottom: 20px;
  position: relative;
}
.poster-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.poster-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}
.poster-bg-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  width: 100%;
  max-width: 320px;
  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);
}

/* ===== P10 字造集 ===== */
#page-collection {
  padding: 15px;
}
.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;
}
.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
}
.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-ancient);
  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-ancient);
  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 {
  grid-column: 1 / -1;
  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: var(--color-paper);
  border-radius: 16px;
  padding: 25px;
  width: 100%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  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-ancient);
  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;
  }
}
