@font-face {
  font-family: 'HongyiHaierTi';
  src: url('fonts/hongyi-haier.ttf') format('truetype');
  font-display: swap;
}

/* ============ 全局 ============ */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: #d9d4cc;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

view, text { display: block; }
text { display: inline; }

.app {
  position: relative;
  width: 100%;
  max-width: 375px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f6f6f6;
  overflow-x: hidden;
}

.hidden { display: none !important; }

button {
  background: initial;
  outline: 0;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
button:focus { outline: 0; }

/* ============ 导航栏 / tab 栏 ============ */
.navbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 375px;
  height: 44px;
  background: #F8F5F0;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.navbar-back {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  color: #000;
  cursor: pointer;
}
.navbar-title {
  font-family: 'HongyiHaierTi', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  font-weight: normal;
  color: #000;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 375px;
  height: 50px;
  background: #fff;
  display: flex;
  border-top: 1px solid #eee;
  z-index: 300;
}
.tabbar-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #999;
  cursor: pointer;
}
.tabbar-item.active { color: #333; }

/* ============ 页面容器 ============ */
.page { display: none; }
.page.active { display: block; }

#page-launch { padding: 0; }
#page-index { padding-bottom: 50px; }
#page-jinnang { padding-bottom: 50px; }
#page-module { padding-top: 44px; }

/* ============ 启动页 ============ */
.launch-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 80px 15px 10px;
  box-sizing: border-box;
  background-color: #f5f0e8;
}

.calligraphy-section {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 1;
}
.calligraphy-img { width: 40%; height: auto; }

.illustration-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 5px;
  margin-top: 250px;
  cursor: pointer;
}
.illustration-img { width: 100%; height: auto; }

.footprints-section {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: -10px;
  box-sizing: border-box;
}
.footprints-reveal { width: 140px; }
.footprints-img {
  width: 140px;
  height: auto;
  display: block;
  clip-path: inset(100% 0 0 0);
  animation: revealBottomUp 2s ease-out forwards;
}
@keyframes revealBottomUp {
  0%   { clip-path: inset(100% 0 0 0); opacity: 0; }
  100% { clip-path: inset(0 0 0 0); opacity: 1; }
}

.launch-disclaimer {
  font-size: 10px;
  color: #bbb;
  text-align: center;
  line-height: 1.6;
  margin-top: 15px;
  padding: 0 10px;
}

/* ============ 首页 ============ */
#page-index .page-wrapper {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 50px);
  background-color: #f5f0e8;
}
.main-bg { width: 100%; height: auto; display: block; }

.btn-group {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.nav-btn {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 5px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  writing-mode: vertical-lr;
  pointer-events: auto;
  cursor: pointer;
}
.btn-text {
  font-family: 'HanyiBtn', sans-serif;
  font-size: 20px;
  color: #3a3a3a;
  letter-spacing: -0.5px;
}
.btn-chan { left: 40px; top: 150px; }
.btn-yi   { right: 10px; top: 175px; }
.btn-wu   { right: 125px; bottom: 225px; }
.btn-gu   { right: 30px; bottom: 30px; }

.icon-img {
  position: absolute;
  width: 60px;
  height: auto;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.icon-img.show { opacity: 1; }
.icon-chan { left: 87px; top: 160px; }
.icon-yi   { right: 60px; top: 95px; }
.icon-wu   { right: 25px; top: 330px; width: 100px; }
.icon-gu   { right: 70px; bottom: 60px; }

.character {
  position: absolute;
  width: 120px;
  height: auto;
  z-index: 50;
  pointer-events: none;
}
.character.fly-in { animation: charFly 2s ease-out forwards; }
@keyframes charFly {
  0%   { opacity: 1; transform: scale(0.4) translate(-150px, -200px); }
  85%  { opacity: 1; transform: scale(1) translate(0, 0); }
  95%  { opacity: 0.5; transform: scale(1) translate(0, 0); }
  100% { opacity: 0; transform: scale(1) translate(0, 0); }
}

/* ============ 锦囊页 ============ */
#page-jinnang .page-wrapper {
  font-family: PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif;
  padding: 15px 20px 30px;
  background-color: #f8f5f0;
  min-height: calc(100vh - 50px);
}

.header { text-align: center; margin-bottom: 20px; }
.header-title { font-size: 22px; font-weight: 700; color: #3a3a3a; margin-bottom: 5px; }
.header-sub { font-size: 13px; color: #999; }

.checkbox-section {
  background: #fff;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.section-label { font-size: 14px; color: #666; margin-bottom: 12px; font-weight: 500; }

.checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item { flex: 0 0 calc(50% - 4px); }
.checkbox-label { display: flex; align-items: center; padding: 8px 5px; cursor: pointer; }
.checkbox-label input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: #333; flex-shrink: 0;
}
.checkbox-text { font-size: 14px; color: #444; margin-left: 6px; }

.action-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}
.btn-generate {
  width: 100%;
  background: transparent;
  color: #333;
  font-size: 15px;
  font-weight: 600;
  padding: 6px 0;
  border-radius: 25px;
  border: 1px solid #333;
}
.btn-generate[disabled] {
  background: #ccc;
  color: #999;
  border-color: #ccc;
}
.selected-hint { display: block; margin-top: 8px; font-size: 12px; color: #333; }

.poster-section { display: flex; flex-direction: column; align-items: center; }
.poster-canvas {
  display: block;
  margin: 0 auto;
  width: 315px;
  height: 450px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  background: #fff;
}
.poster-actions { display: flex; gap: 12px; margin-top: 15px; width: 100%; }
.btn-save, .btn-redo {
  flex: 1;
  background: transparent;
  color: #333;
  font-size: 14px;
  padding: 5px 0;
  border-radius: 25px;
  border: 1px solid #333;
}

.empty-guide { display: flex; flex-direction: column; align-items: center; padding: 50px 0; }
.guide-icon { font-size: 50px; margin-bottom: 12px; }
.guide-text { font-size: 14px; color: #bbb; }

/* ============ 功能模块页 ============ */
.module-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
  min-height: calc(100vh - 44px);
  background: #f5f0e8;
  position: relative;
  box-sizing: border-box;
}
.module-sub { width: 100%; }

/* 禅：呼吸 */
.chan-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  object-fit: cover;
}
.breathe-container { padding: 67px 0 40px; position: relative; z-index: 1; display: flex; justify-content: center; }
.breathe-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: pointer;
}
.breathe-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  z-index: 1;
}
.breathe-anim { animation: breathe 10s ease-in-out infinite; }
@keyframes breathe {
  0%   { transform: scale(0.85); }
  40%  { transform: scale(1.25); }
  100% { transform: scale(0.85); }
}
.breathe-timer { position: relative; z-index: 2; font-size: 36px; color: #666; font-weight: 700; }

.breathe-hint { display: block; font-size: 12px; color: #999; margin-top: 50px; text-align: center; }
.breathe-sub { display: block; color: #999; margin-top: 2px; text-align: center; }

/* 医：脊柱 */
.spine-row { display: flex; flex-direction: row; align-items: center; width: 100%; }
.spine-img { width: 30%; height: auto; border-radius: 6px; flex-shrink: 0; margin-top: 55px; }
.spine-spacer { flex: 1; }
.spine-diagram { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.spine-part {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #333;
  font-size: 13px;
  border: 1px solid #333;
  position: absolute;
  cursor: pointer;
  background: transparent;
}
.cervical { width: 50px; height: 30px; top: 107px; }
.thoracic { width: 60px; height: 30px; top: 250px; }
.lumbar   { width: 65px; height: 30px; bottom: 325px; }
.sacral   { width: 75px; height: 30px; bottom: 225px; }
.coccyx   { width: 60px; height: 30px; bottom: 175px; }

.modal-mask {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 375px;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  z-index: 400;
}
.modal-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  z-index: 401;
}
.modal-head { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.modal-body { font-size: 14px; color: #555; line-height: 1.8; margin-bottom: 10px; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: #eef4f8; color: #4a7fb5; font-size: 12px; padding: 4px 9px; border-radius: 4px; }

/* 武/骨：功法跟练 */
.img-gallery {
  width: 100%;
  height: 625px;
  overflow: hidden;
  position: relative;
  margin-top: -10px;
}
.gallery-track { animation: slowSlide 386s linear infinite; }
#track-gu { animation-duration: 379.5s; }
.gallery-track.paused { animation-play-state: paused; }
.gallery-img { width: 100%; height: auto; border-radius: 6px; display: block; }
@keyframes slowSlide {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}
.gongfa-area { display: flex; flex-direction: column; align-items: center; width: 100%; }
.gongfa-btns { display: flex; gap: 10px; margin-top: 10px; }
.btn {
  margin-top: 5px;
  background: transparent;
  color: #333;
  border-radius: 25px;
  padding: 4px 30px;
  font-size: 15px;
  border: 1px solid #333;
}
.complete-text { font-size: 16px; color: #5b8c5a; font-weight: 700; margin-top: 15px; }
.disclaimer {
  font-size: 10px;
  color: #bbb;
  text-align: center;
  line-height: 1.6;
  margin-top: 40px;
  padding: 0 10px;
}

/* ============ toast / loading ============ */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 500;
  max-width: 260px;
  text-align: center;
  white-space: nowrap;
}
.loading-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
