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

:root {
  --pink-light: #FFF0F5;
  --pink-mid: #FFD6E7;
  --pink-deep: #FF9ECB;
  --purple: #B0A8FF;
  --blue: #8EC5FF;
  --green: #A8E6A3;
  --yellow: #FFE5A0;
  --orange: #FFC48C;
  --text: #5A4A6B;
  --text-light: #9B8BA8;
  --white: #FFFFFF;
  --shadow: 0 8px 30px rgba(255, 158, 203, 0.25);
  --shadow-sm: 0 4px 15px rgba(255, 158, 203, 0.18);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Comic Sans MS', sans-serif;
  font-weight: 700;
  background: linear-gradient(160deg, #FFF0F8 0%, #FEE 30%, #F0E6FF 60%, #E6F0FF 100%);
  background-attachment: fixed;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ========== 页面切换 ========== */
.page {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: calc(100% - 80px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 20px;
  opacity: 0;
  transform: translateX(30px);
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
.page.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
.page::-webkit-scrollbar { display:none; }

/* ========== 顶部栏 ========== */
.top-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}
.btn-mini {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  background: rgba(255,255,255,0.85);
  border: 2px solid rgba(255,182,193,0.5);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s;
  white-space: nowrap;
}
.btn-mini:active { transform: scale(0.92); }

/* ========== 欢迎卡片 ========== */
.welcome-card {
  position: relative;
  background: linear-gradient(135deg, #FFB6C1, #FF9ECB);
  border-radius: 28px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.welcome-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
}
.welcome-emoji { font-size: 40px; margin-bottom: 4px; }
.welcome-text {
  font-size: 22px;
  color: #fff;
  line-height: 1.5;
  text-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 10px;
}
.date-text {
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
}
.checkin-badge {
  display: inline-block;
  margin-top: 10px;
  background: rgba(255,255,255,0.3);
  backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 13px;
  color: #fff;
}

/* ========== 数据行 ========== */
.stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.stat-item {
  flex: 1;
  background: rgba(255,255,255,0.9);
  border-radius: 22px;
  padding: 14px 6px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .15s;
}
.stat-item:active { transform: scale(0.95); }
.stat-icon { font-size: 26px; }
.stat-num {
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(135deg, #FF6B9D, #C06CFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 2px 0;
}
.stat-label { font-size: 11px; color: var(--text-light); font-weight: 600; }

/* ========== 功能卡片 ========== */
.section-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
  margin: 4px 0 12px;
  padding-left: 4px;
}
.func-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.func-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  border-radius: 24px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s;
}
.func-card:active { transform: scale(0.97); }
.func-emoji { font-size: 38px; }
.func-name { font-size: 17px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.func-desc { font-size: 11px; color: rgba(255,255,255,0.85); font-weight: 600; margin-top: 2px; }

/* ========== 徽章墙 ========== */
.badge-wall {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.badge-item {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  box-shadow: var(--shadow-sm);
  transition: transform .2s;
  position: relative;
}
.badge-item:active { transform: scale(0.92); }
.badge-item.unlocked {
  background: linear-gradient(135deg, var(--by, #FFD700), var(--by2, #FFA500));
  box-shadow: 0 4px 15px rgba(255, 200, 0, 0.35);
}
.badge-item.locked .badge-emoji { filter: grayscale(1) opacity(0.35); }
.badge-emoji { font-size: 28px; }
.badge-name { font-size: 9px; color: var(--text-light); font-weight: 600; margin-top: 2px; }
.badge-item.unlocked .badge-name { color: #fff; }

/* ========== 页面头部 ========== */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.page-header-emoji { font-size: 36px; }
.page-header h2 {
  font-size: 24px;
  background: linear-gradient(135deg, #FF6B9D, #C06CFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ========== 标签列表 ========== */
.tag-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  margin-bottom: 4px;
}
.tag-list::-webkit-scrollbar { display:none; }
.tag {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  background: rgba(255,255,255,0.8);
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.tag.active {
  color: #fff;
  background: linear-gradient(135deg, #FF9ECB, #C06CFF);
  box-shadow: var(--shadow-sm);
}

/* ========== 游戏卡片 ========== */
.game-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.game-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--gc1), var(--gc2));
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s;
}
.game-card:active { transform: scale(0.97); }
.game-icon { font-size: 36px; flex-shrink: 0; }
.game-info { flex: 1; }
.game-title { font-size: 17px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.game-tip { font-size: 11px; color: rgba(255,255,255,0.85); font-weight: 600; margin-top: 2px; }
.game-arrow { font-size: 18px; color: rgba(255,255,255,0.8); }

/* ========== 切换标签 ========== */
.toggle-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.6);
  border-radius: 20px;
  padding: 4px;
}
.toggle-tab {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-light);
  padding: 10px 0;
  border-radius: 16px;
  cursor: pointer;
  transition: all .25s;
}
.toggle-tab.active {
  background: linear-gradient(135deg, #FF9ECB, #C06CFF);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ========== 汉字网格 ========== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.char-card {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s;
  position: relative;
  overflow: hidden;
}
.char-card:active { transform: scale(0.92); }
.char-card .char-zi {
  font-size: 42px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.15);
  line-height: 1;
}
.char-card .char-py {
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  margin-top: 6px;
}
.char-card .char-speak {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 14px;
  opacity: 0.7;
}

/* ========== 底部导航 ========== */
.bottom-nav {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  height: 80px;
  display: flex;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-top: 2px solid rgba(255,182,193,0.3);
  box-shadow: 0 -4px 20px rgba(255,158,203,0.12);
  z-index: 100;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}
.nav-icon { font-size: 22px; transition: transform .2s; }
.nav-label { font-size: 9px; font-weight: 600; color: var(--text-light); }
.nav-item.active .nav-icon { transform: scale(1.25) translateY(-2px); }
.nav-item.active .nav-label { color: #FF6B9D; font-weight: 800; }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 40px; height: 4px;
  background: linear-gradient(90deg, #FF9ECB, #C06CFF);
  border-radius: 0 0 4px 4px;
}

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(90,74,107,0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  width: 100%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  background: #FFF5FA;
  border-radius: 30px;
  padding: 24px 20px 20px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: popIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-box::-webkit-scrollbar { display:none; }
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,182,193,0.3);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  z-index: 10;
}
.modal-title {
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, #FF6B9D, #C06CFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}

/* 游戏内容 */
.game-progress {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
}
.game-prompt {
  text-align: center;
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text);
}
.game-big-char {
  text-align: center;
  font-size: 64px;
  font-weight: 900;
  margin: 10px 0;
  color: #FF6B9D;
  text-shadow: 0 3px 10px rgba(255,107,157,0.3);
}
.game-big-pinyin {
  text-align: center;
  font-size: 22px;
  color: var(--purple);
  margin-bottom: 16px;
  font-weight: 800;
}
.option-btn {
  display: block;
  width: 100%;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  background: #fff;
  border: 3px solid rgba(255,182,193,0.4);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .15s;
}
.option-btn:active { transform: scale(0.95); }
.option-btn.correct {
  background: linear-gradient(135deg, #A8E6A3, #2ECC71);
  color: #fff;
  border-color: transparent;
}
.option-btn.wrong {
  background: linear-gradient(135deg, #FFB3B3, #FF6B6B);
  color: #fff;
  border-color: transparent;
}
.game-result {
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  margin: 12px 0;
  min-height: 28px;
}
.btn-primary {
  display: block;
  width: 100%;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #FF9ECB, #C06CFF);
  border: none;
  border-radius: 20px;
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s;
}
.btn-primary:active { transform: scale(0.96); }

/* ========== 建设中 ========== */
.coming-soon {
  text-align: center;
  padding: 80px 20px;
}
.coming-emoji { font-size: 70px; margin-bottom: 16px; }
.coming-soon p {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 6px;
}
.coming-sub { font-size: 13px !important; color: var(--text-light) !important; }

/* ========== 庆祝动画 ========== */
.celebrate-layer {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 300;
  overflow: hidden;
}
.confetti {
  position: absolute;
  top: -20px;
  font-size: 24px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ========== 浮动提示 ========== */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(0);
  background: rgba(90,74,107,0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 24px;
  z-index: 400;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
}
.toast.show { transform: translate(-50%,-50%) scale(1); }

/* 响应式 */
@media (min-width: 480px) {
  .char-grid { grid-template-columns: repeat(4, 1fr); }
}
