* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #fdf8f0;
  background-image:
    radial-gradient(circle at 15% 12%, rgba(217,119,6,.07), transparent 45%),
    radial-gradient(circle at 85% 88%, rgba(180,83,9,.06), transparent 45%);
  background-attachment: fixed;
  color: #3f2d1a;
  overscroll-behavior: none;
}

body { display: flex; justify-content: center; }

#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  position: relative;
  padding-bottom: 76px;
  background: rgba(255,253,248,.72);
  box-shadow: 0 0 60px rgba(180,83,9,.08);
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: flex-end;
  padding: 10px 16px 6px;
  pointer-events: none;
}
.coin-pill {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.92);
  border: 1.5px solid #fcd34d;
  border-radius: 99px;
  padding: 5px 13px 5px 9px;
  font-size: 15px; font-weight: 800;
  color: #b45309;
  box-shadow: 0 2px 10px rgba(180,83,9,.12);
  pointer-events: auto;
}
.coin-pill span { font-size: 16px; }

/* ---------- 屏幕 ---------- */
.screen {
  display: none;
  padding: 4px 16px 20px;
  flex: 1;
  animation: fadeUp .28s ease;
}
.screen.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 首页 ---------- */
.home-hero {
  text-align: center;
  padding: 10px 0 18px;
}
.hero-title {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #b45309, #d97706, #92400e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-indent: 6px;
}
.hero-sub {
  font-size: 12.5px;
  color: #a8a29e;
  letter-spacing: 2px;
  margin-top: 6px;
}

.figure-stage {
  background: linear-gradient(160deg, #fffbeb, #fef3c7);
  border: 2px solid #fde68a;
  border-radius: 22px;
  padding: 20px 16px 16px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 6px 22px rgba(217,119,6,.13);
  position: relative;
  overflow: hidden;
}
.figure-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,.75), transparent 60%);
  pointer-events: none;
}
.fig-emoji {
  font-size: 62px;
  line-height: 1;
  animation: floaty 3.2s ease-in-out infinite;
  position: relative;
}
@keyframes floaty {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.fig-name {
  font-size: 18px;
  font-weight: 900;
  color: #92400e;
  margin-top: 10px;
  position: relative;
}
.fig-title {
  font-size: 12.5px;
  color: #a16207;
  margin-top: 4px;
  position: relative;
}

/* ---------- 模块卡片 ---------- */
.module-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.module-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px 20px;
  border: none;
  border-radius: 20px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.module-card:active { transform: scale(.975); }

.module-card.shape {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 2px solid #fed7aa;
  box-shadow: 0 5px 18px rgba(234,88,12,.14);
}
.module-card.pinyin {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 2px solid #bfdbfe;
  box-shadow: 0 5px 18px rgba(37,99,235,.13);
}
.module-card.poem {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border: 2px solid #ddd6fe;
  box-shadow: 0 5px 18px rgba(124,58,237,.13);
}

.mc-emoji { font-size: 34px; flex-shrink: 0; }
.mc-name {
  font-size: 17px;
  font-weight: 900;
  color: #3f2d1a;
  margin-bottom: 3px;
}
.mc-desc { font-size: 12px; color: #a8a29e; }

/* ---------- 答题页 ---------- */
.quiz-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 14px;
}
.back-btn {
  width: 38px; height: 38px;
  border: none; border-radius: 12px;
  background: #fff;
  color: #a16207;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(180,83,9,.1);
  flex-shrink: 0;
}
.q-progress { flex: 1; }
.q-count {
  font-size: 12px;
  font-weight: 800;
  color: #a8a29e;
  margin-bottom: 5px;
}
.q-bar {
  height: 8px;
  border-radius: 99px;
  background: #f5f0e8;
  overflow: hidden;
}
.q-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  transition: width .3s ease;
}
.combo {
  font-size: 14px;
  font-weight: 900;
  color: #dc2626;
  opacity: 0;
  transition: opacity .2s;
  white-space: nowrap;
}
.combo.show { opacity: 1; }

.q-card {
  background: #fff;
  border-radius: 22px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(180,83,9,.1);
  border: 1.5px solid #f5f0e8;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.q-poem-title {
  font-size: 12.5px;
  color: #a8a29e;
  font-weight: 700;
  margin-bottom: 12px;
}
.q-emoji {
  font-size: 56px;
  line-height: 1.2;
  font-weight: 900;
  color: #3f2d1a;
  margin-bottom: 10px;
}
.q-emoji:empty { display: none; }
.q-pre {
  font-size: 22px;
  font-weight: 800;
  color: #57534e;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.q-text {
  font-size: 17px;
  font-weight: 800;
  color: #3f2d1a;
  line-height: 1.6;
}
.q-sub {
  font-size: 15px;
  color: #a16207;
  font-weight: 700;
  margin-top: 10px;
  letter-spacing: 1px;
}
.q-hint {
  font-size: 12px;
  color: #c7bfb4;
  margin-top: 14px;
}

.opts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.opt {
  padding: 16px;
  border: 2px solid #f0e9dd;
  border-radius: 16px;
  background: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #3f2d1a;
  cursor: pointer;
  transition: all .14s;
  box-shadow: 0 2px 8px rgba(180,83,9,.05);
}
.opt:active { transform: scale(.98); }
.opt-char { font-size: 26px; font-weight: 900; padding: 13px; }
.opt.correct {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #15803d;
  animation: popIn .3s ease;
}
.opt.wrong {
  border-color: #ef4444;
  background: #fef2f2;
  color: #b91c1c;
  animation: shakeX .35s ease;
}
.opt.disabled { pointer-events: none; }
@keyframes popIn { from { transform: scale(.92); } to { transform: scale(1); } }
@keyframes shakeX {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- 结算 ---------- */
.res-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px 22px 24px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(180,83,9,.12);
  margin-top: 30px;
}
.res-title {
  font-size: 19px;
  font-weight: 900;
  color: #92400e;
}
.res-stars {
  font-size: 38px;
  letter-spacing: 6px;
  margin: 14px 0;
}
.res-rows {
  background: #fdfaf5;
  border-radius: 14px;
  padding: 6px 16px;
  margin: 8px 0 14px;
}
.res-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 14px;
  color: #78716c;
  border-bottom: 1px solid #f5f0e8;
}
.res-row:last-child { border-bottom: none; }
.res-row b { color: #b45309; font-size: 15px; }
.res-msg {
  font-size: 14px;
  color: #a16207;
  font-weight: 700;
  margin-bottom: 20px;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 15px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(217,119,6,.32);
}
.btn-primary:active { transform: scale(.97); }

/* ---------- 人物页 ---------- */
.fig-head { text-align: center; padding: 8px 0 16px; }
.fig-head-title {
  font-size: 20px;
  font-weight: 900;
  color: #92400e;
  letter-spacing: 2px;
}
.fig-head-sub {
  font-size: 12.5px;
  color: #a8a29e;
  margin-top: 5px;
}

.fig-list { display: flex; flex-direction: column; gap: 11px; }

.fig-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px;
  background: #fff;
  border-radius: 18px;
  border: 1.5px solid #f5f0e8;
  box-shadow: 0 2px 10px rgba(180,83,9,.06);
  cursor: pointer;
  transition: all .16s;
}
.fig-row.ready {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #fffbeb, #fef9c3);
  box-shadow: 0 4px 18px rgba(251,191,36,.3);
  animation: glow 2s infinite;
}
.fig-row.owned { border-color: #fde68a; }
.fig-row.locked { opacity: .78; }
@keyframes glow {
  0%,100% { box-shadow: 0 4px 18px rgba(251,191,36,.3); }
  50% { box-shadow: 0 4px 26px rgba(251,191,36,.6); }
}

.fr-emoji {
  font-size: 34px;
  width: 48px;
  text-align: center;
  flex-shrink: 0;
}
.fr-info { flex: 1; min-width: 0; }
.fr-name {
  font-size: 15.5px;
  font-weight: 900;
  color: #3f2d1a;
  display: flex;
  align-items: center;
  gap: 7px;
}
.fr-rar {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 99px;
  background: #fdf3e2;
}
.fr-era {
  font-size: 11.5px;
  color: #a8a29e;
  margin-top: 3px;
}
.fr-bond {
  font-size: 11.5px;
  color: #b45309;
  font-weight: 700;
  margin-top: 4px;
}
.fr-unlock {
  font-size: 11px;
  color: #a8a29e;
  margin-top: 4px;
}
.fr-bar {
  height: 5px;
  border-radius: 99px;
  background: #f5f0e8;
  overflow: hidden;
  margin-top: 6px;
}
.fr-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.fr-btn {
  padding: 9px 15px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(245,158,11,.4);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.fr-prog {
  font-size: 11.5px;
  font-weight: 800;
  color: #c7bfb4;
  white-space: nowrap;
}
.fr-ok { font-size: 18px; }

/* ---------- 错题本 ---------- */
.wrong-list { display: flex; flex-direction: column; gap: 10px; }
.wrong-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  background: #fff;
  border-radius: 16px;
  border: 1.5px solid #fee2e2;
  box-shadow: 0 2px 8px rgba(220,38,38,.05);
}
.wr-char {
  font-size: 26px;
  font-weight: 900;
  color: #b91c1c;
  width: 42px;
  text-align: center;
  flex-shrink: 0;
}
.wr-kind {
  font-size: 11px;
  color: #a8a29e;
  font-weight: 700;
  margin-bottom: 3px;
}
.wr-answer {
  font-size: 13px;
  color: #44403c;
}
.wr-answer b { color: #15803d; font-size: 15px; }

.empty {
  text-align: center;
  padding: 50px 20px;
  color: #c7bfb4;
  font-size: 14px;
  line-height: 1.9;
}
.empty-e { display: block; font-size: 44px; margin-bottom: 10px; }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: rgba(255,253,248,.97);
  backdrop-filter: blur(12px);
  border-top: 1.5px solid #f5f0e8;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  padding: 4px;
  color: #c7bfb4;
  transition: color .15s;
}
.nav-item span { font-size: 21px; line-height: 1; }
.nav-item em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 800;
}
.nav-item.active { color: #b45309; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(41,28,12,.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-mask.show { display: flex; animation: fadeUp .2s ease; }
.modal-box {
  width: 100%;
  max-width: 340px;
  max-height: 82vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px;
  padding: 24px 20px 20px;
  text-align: center;
  box-shadow: 0 16px 50px rgba(41,28,12,.28);
}
.modal-emoji { font-size: 42px; line-height: 1; margin-bottom: 8px; }
.modal-emoji:empty { display: none; }
.modal-title {
  font-size: 17px;
  font-weight: 900;
  color: #92400e;
  margin-bottom: 10px;
}
.modal-text {
  font-size: 14.5px;
  color: #57534e;
  line-height: 1.75;
  margin-bottom: 18px;
  text-align: left;
}
.modal-text:empty { display: none; }

/* 人物详情 */
.fig-quote {
  background: #fffbeb;
  border-left: 3px solid #fbbf24;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  color: #92400e;
  font-weight: 700;
  line-height: 1.65;
  margin-bottom: 12px;
  text-align: left;
}
.fig-bio {
  font-size: 12.5px;
  color: #78716c;
  line-height: 1.7;
  margin-bottom: 12px;
  text-align: left;
}
.fig-skill-box {
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 12.5px;
  color: #15803d;
  line-height: 1.6;
  margin-bottom: 12px;
  text-align: left;
}
.fig-bond-box {
  background: #fff1f2;
  border: 1px solid #ffe4e6;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.fb-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: #be123c;
  margin-bottom: 7px;
}
.fb-bar {
  height: 8px;
  border-radius: 99px;
  background: #ffe4e6;
  overflow: hidden;
}
.fb-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #fb7185, #e11d48);
  transition: width .4s ease;
}
.fb-tip { font-size: 11px; color: #9f1239; margin-top: 6px; }

.fig-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.fa-btn {
  padding: 12px 4px;
  border: 1.5px solid #fde68a;
  border-radius: 13px;
  background: #fffbeb;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  color: #92400e;
  cursor: pointer;
}
.fa-btn:active { transform: scale(.95); background: #fef3c7; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(41,28,12,.92);
  color: #fff;
  padding: 11px 20px;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 200;
  max-width: 88vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 小屏适配 ---------- */
@media (max-height: 680px) {
  .hero-title { font-size: 28px; }
  .fig-emoji { font-size: 48px; }
  .figure-stage { padding: 14px 12px 12px; margin-bottom: 14px; }
  .module-card { padding: 14px 16px; }
  .mc-emoji { font-size: 28px; }
  .q-card { min-height: 150px; padding: 20px 16px; }
  .q-emoji { font-size: 44px; }
}
@media (max-width: 360px) {
  .screen { padding: 4px 12px 20px; }
  .opt { padding: 14px; font-size: 15px; }
  .opt-char { font-size: 22px; }
}
