/* styles.css
 * 马卡龙浅粉＋浅紫柔和配色 · 大圆角 · 移动端优先
 */
:root {
  --pink-50: #fff5fa;
  --pink-100: #ffeaf3;
  --pink-200: #ffd6ec;
  --pink-300: #ffb6cf;
  --pink-400: #ff8aa8;
  --pink-500: #d97aa6;

  --lilac-50: #f8f3ff;
  --lilac-100: #efe4ff;
  --lilac-200: #e0c8ff;
  --lilac-300: #cba2ff;
  --lilac-400: #a78ad9;
  --lilac-500: #7b4f8c;

  --mint: #b8e6d2;
  --peach: #ffd0a8;
  --lemon: #fff1a8;
  --sky: #cfe5ff;
  --cream: #fff8ef;

  --text: #6a4f7a;
  --text-soft: #9b80aa;
  --text-muted: #b39fc4;

  --shadow-sm: 0 2px 6px rgba(180, 130, 175, 0.10);
  --shadow-md: 0 8px 22px rgba(180, 130, 175, 0.14);
  --shadow-lg: 0 16px 36px rgba(180, 130, 175, 0.18);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 36px;

  --bg-grad: radial-gradient(circle at 10% 0%, #fff0f8 0%, transparent 40%),
             radial-gradient(circle at 90% 10%, #f4ecff 0%, transparent 40%),
             radial-gradient(circle at 50% 90%, #fff5ec 0%, transparent 50%),
             linear-gradient(180deg, #fff7fb 0%, #faf3ff 100%);
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

button { font-family: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

/* 启动屏 */
.splash {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg-grad); z-index: 100; transition: opacity 0.5s;
}
.splash-card {
  background: #fff; border-radius: var(--radius-xl); padding: 32px 40px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.splash-art {
  width: 84px; height: 84px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink-300), var(--lilac-300));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 38px; box-shadow: var(--shadow-md);
}
.splash-title { font-size: 24px; font-weight: 700; color: var(--pink-500); }
.splash-sub { color: var(--text-soft); font-size: 14px; }

/* 主壳 */
.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 110px;
  min-height: 100vh;
}

/* ─── 顶栏 ─── */
.topbar {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 8px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 8px; flex: 1; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink-300), var(--lilac-300));
  box-shadow: var(--shadow-sm);
}
.brand .title { font-weight: 700; color: var(--pink-500); font-size: 16px; }

.grade-pick { display: flex; align-items: center; gap: 6px; }
.grade-pick label { font-size: 12px; color: var(--text-soft); }
.pill {
  border: none; border-radius: 999px; padding: 6px 14px; font-size: 14px;
  background: var(--pink-100); color: var(--pink-500); font-weight: 600;
  outline: none; -webkit-appearance: none; appearance: none;
}
.pill:focus { box-shadow: 0 0 0 3px var(--pink-200); }
.points-pill {
  background: linear-gradient(135deg, var(--lemon), #ffe27a);
  color: #b07a18; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  display: flex; align-items: center; gap: 4px;
  box-shadow: var(--shadow-sm);
}
.points-pill .star { color: #f0a45a; }
.points-pill b { font-size: 14px; }

/* ─── 横幅 ─── */
.backup-banner {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #fff7d8, #ffe4e1);
  color: #a8696b;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  margin-top: 12px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.backup-banner .ico { font-size: 18px; }
.backup-banner .link {
  background: none; border: none; color: var(--pink-500); font-weight: 600;
  text-decoration: underline; padding: 0; font-size: 13px;
}

/* ─── 学习计时 ─── */
.timer-row {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 4px 6px;
}
.timer-chip {
  font-size: 13px; color: var(--text-soft);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px; padding: 6px 12px;
  display: flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-sm);
}
.timer-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); display: inline-block; }
.timer-chip em.warn { color: var(--pink-500); font-style: normal; font-weight: 600; margin-left: 4px; }
.timer-track {
  flex: 1; height: 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.6); overflow: hidden;
}
.timer-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--pink-300), var(--lilac-300));
  transition: width 0.5s;
}

/* ─── 学习卡片网格 ─── */
.study-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin-top: 12px;
}
.card {
  background: #fff; border-radius: var(--radius-lg); padding: 16px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform 0.2s;
}
.card.word-card {
  display: grid; grid-template-columns: 96px 1fr; gap: 14px;
  align-items: start;
}
.card.word-card .card-art {
  width: 96px; height: 96px; border-radius: var(--radius-md);
  background: var(--pink-50);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.card.word-card .card-art svg { width: 84px; height: 84px; }
.card.hanzi-card { display: block; }

.card-main { display: flex; flex-direction: column; }
.card .big-text {
  font-size: 36px; font-weight: 800; color: var(--text);
  line-height: 1.1; letter-spacing: 2px;
}
.word-card .big-text { letter-spacing: 0; }
.card .sub-text {
  font-size: 13px; color: var(--text-soft); margin-top: 2px;
  font-family: "Helvetica Neue", "Arial", sans-serif;
}
.card-mean {
  grid-column: 1 / -1; color: var(--text-soft); font-size: 13px;
  margin-top: 4px; line-height: 1.4;
}
.card-actions {
  grid-column: 1 / -1;
  display: flex; gap: 8px; margin-top: 8px;
}

.badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
}
.badge.gold { background: linear-gradient(135deg, #ffe69a, #ffc24a); color: #8a5a18; }
.badge.pink { background: var(--pink-200); color: var(--pink-500); }
.badge.grey { background: #eee2f0; color: var(--text-muted); }

/* ─── 按钮 ─── */
.btn {
  border: none; border-radius: 999px;
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

.btn.primary { background: linear-gradient(135deg, var(--pink-300), var(--pink-400)); color: #fff; }
.btn.pink    { background: linear-gradient(135deg, var(--pink-200), var(--pink-300)); color: var(--pink-500); }
.btn.peach   { background: linear-gradient(135deg, var(--peach), #ffb077); color: #8a4a18; }
.btn.lilac   { background: linear-gradient(135deg, var(--lilac-200), var(--lilac-300)); color: var(--lilac-500); }
.btn.ghost   { background: #f7eaf3; color: var(--pink-500); }
.btn.danger  { background: #ffe1e1; color: #c05050; }
.btn.xs { padding: 4px 10px; font-size: 12px; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.big { flex: 1; padding: 12px 14px; justify-content: center; }

/* ─── 备份栏 ─── */
.backup-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 18px 4px 0;
  padding: 12px 14px; background: rgba(255,255,255,0.7);
  border-radius: var(--radius-md);
}

/* ─── 宠物页 ─── */
.pet-page { padding-top: 8px; }
.pet-card {
  background: #fff; border-radius: var(--radius-xl);
  padding: 22px 18px; box-shadow: var(--shadow-md);
  text-align: center;
  background-image: radial-gradient(circle at 90% 0%, var(--lilac-100) 0%, transparent 40%),
                    radial-gradient(circle at 0% 100%, var(--pink-100) 0%, transparent 40%);
}
.pet-name {
  font-size: 22px; font-weight: 700; color: var(--pink-500);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.pet-name.bounce { animation: bounce 0.6s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
  60% { transform: translateY(2px); }
}
.pet-stage {
  display: flex; justify-content: center; margin: 6px 0 8px;
  min-height: 220px; align-items: center;
}
.pet-stage.pet-pop { animation: pop 0.6s; }
@keyframes pop {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.06); }
}

.pet-bars { margin: 6px 8px 14px; }
.bar-row {
  display: grid; grid-template-columns: 56px 1fr 36px;
  align-items: center; gap: 8px; margin: 6px 0;
}
.bar-label { font-size: 13px; color: var(--text-soft); text-align: right; }
.bar-track { height: 10px; background: #f6ecf4; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; transition: width 0.4s; }
.bar-num { font-size: 12px; color: var(--text-muted); }

.pet-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pet-hint { color: var(--text-muted); font-size: 12px; margin-top: 12px; }

/* ─── 统计页 ─── */
.stats-page > .card { padding: 16px; margin-bottom: 14px; border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); }
.stats-page h3 { margin: 0 0 10px; color: var(--pink-500); font-size: 16px; }
.stat-grid {
  display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr);
  margin: 12px 4px;
}
.stat-card {
  background: #fff; border-radius: var(--radius-md);
  padding: 14px 12px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
  border-left: 4px solid var(--accent);
}
.stat-value { font-size: 22px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--text-soft); }

.bar7 {
  display: flex; align-items: flex-end; gap: 6px;
  height: 110px; padding: 6px 0;
}
.bar7-cell {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  height: 100%;
}
.bar7-fill {
  width: 70%; max-width: 28px; min-height: 2px;
  background: linear-gradient(180deg, var(--pink-300), var(--lilac-300));
  border-radius: 999px; transition: height 0.4s;
}
.bar7-num { font-size: 11px; color: var(--text-muted); }
.bar7-label { font-size: 11px; color: var(--text-soft); }

.rank { list-style: none; padding: 0; margin: 0; }
.rank li {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 6px; align-items: center;
  padding: 8px 4px; border-bottom: 1px dashed #f0e4f0; font-size: 13px;
}
.rank li:last-child { border-bottom: none; }
.rk-key { font-weight: 700; color: var(--text); }
.rk-meta { color: var(--text-muted); font-size: 12px; }
.rk-best { color: var(--pink-500); font-weight: 600; font-size: 12px; }
.rk-attempts { color: var(--text-muted); font-size: 12px; }

.muted { color: var(--text-muted); font-size: 13px; }
.danger-card { border-left: 4px solid var(--pink-400); }
.danger-card p { color: var(--text-soft); font-size: 13px; line-height: 1.5; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── 底部导航 ─── */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  display: flex; justify-content: space-around; padding: 8px 12px;
  box-shadow: 0 -4px 16px rgba(180, 130, 175, 0.10);
  z-index: 30;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.nav-btn {
  background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; color: var(--text-soft); font-size: 11px; min-width: 64px;
  border-radius: 14px; transition: background 0.2s, color 0.2s;
}
.nav-btn .nav-ico {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
}
.nav-btn .nav-ico svg { width: 26px; height: 26px; }
.nav-btn.active {
  color: var(--pink-500);
  background: var(--pink-50);
}

/* ─── 模态 ─── */
.modal-mask {
  position: fixed; inset: 0; background: rgba(106, 79, 122, 0.32);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px; backdrop-filter: blur(4px);
  animation: fade 0.2s;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff; border-radius: var(--radius-xl); padding: 22px 22px 18px;
  max-width: 360px; width: 100%; position: relative;
  box-shadow: var(--shadow-lg); animation: zoom 0.2s;
}
@keyframes zoom { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-card .close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; font-size: 24px; color: var(--text-muted); padding: 0; line-height: 1;
}
.modal-card h3 { color: var(--pink-500); margin: 0 0 8px; }
.modal-card p { color: var(--text-soft); font-size: 14px; line-height: 1.5; margin: 6px 0; }
.modal-card .hint { font-size: 12px; color: var(--text-muted); }

/* 跟读模态 */
.prac-card { text-align: center; max-width: 380px; }
.prac-art { display: flex; justify-content: center; }
.prac-art svg { width: 130px; height: 130px; }
.prac-text {
  font-size: 56px; font-weight: 800; color: var(--text); line-height: 1;
  margin: 8px 0 0; letter-spacing: 4px;
}
.prac-sub { color: var(--text-soft); margin: 4px 0; font-family: "Helvetica Neue", "Arial", sans-serif; }
.prac-mean { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.prac-actions { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.prac-status { color: var(--text-soft); font-size: 14px; min-height: 22px; margin: 6px 0; }
.prac-status .warn { color: #c05050; }
.prac-result { margin-top: 8px; }
.prac-result .result {
  border-radius: var(--radius-md); padding: 14px;
}
.prac-result .result.ok { background: var(--pink-50); }
.prac-result .result.fail { background: #fff5f5; }
.score-num { font-size: 44px; font-weight: 800; color: var(--pink-500); line-height: 1; }
.result.fail .score-num { color: #c05050; }
.score-num span { font-size: 16px; color: var(--text-soft); font-weight: 500; }
.score-state { font-weight: 600; margin: 4px 0; color: var(--text); }
.score-meta { font-size: 13px; color: var(--text-soft); margin: 2px 0; }
.score-reward { color: var(--pink-500); font-weight: 700; margin-top: 6px; }
.score-hint { color: var(--text-muted); font-size: 12px; margin-top: 6px; }
.prac-hint .warn { color: #c05050; font-size: 12px; }

/* 撒花 */
.confetti-layer {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 80;
}
.confetti {
  position: absolute; top: -20px; width: 10px; height: 14px;
  border-radius: 2px; opacity: 0.95;
  animation: fall 1.6s linear forwards;
}
@keyframes fall {
  0% { transform: translateY(-20px) rotate(0); opacity: 1; }
  100% { transform: translateY(120vh) rotate(720deg); opacity: 0.6; }
}

/* Toast */
.toast {
  position: fixed; left: 50%; top: 80px; transform: translate(-50%, -10px);
  background: rgba(106, 79, 122, 0.92); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 70;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* doodle 通用样式 */
.doodle { display: block; }

/* 响应式微调 */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .card.word-card { grid-template-columns: 80px 1fr; }
  .card.word-card .card-art { width: 80px; height: 80px; }
  .card.word-card .card-art svg { width: 68px; height: 68px; }
  .card .big-text { font-size: 30px; }
  .prac-text { font-size: 48px; }
  .hz-art { width: 78px; height: 78px; }
  .hz-art svg { width: 66px; height: 66px; }
  .hz-write { gap: 12px; }
  .hz-grid .tianzi { width: 70px; height: 70px; }
  .hz-char { font-size: 44px; }
  .sd-cell-box { width: 42px; height: 42px; }
}

/* PWA 桌面启动时的窗口美化 */
@media (display-mode: standalone) {
  .topbar { top: calc(8px + env(safe-area-inset-top)); }
}

/* ─── 大字体释义（英语） ─── */
.card .card-mean.big-mean {
  font-size: 20px; font-weight: 700; color: var(--pink-500);
  letter-spacing: 1px; margin-top: 6px;
}
.detail-mean.big-mean { font-size: 26px; font-weight: 800; color: var(--pink-500); }

/* ─── 点读足迹 / 彩色记录 ─── */
.read-dot {
  position: absolute; top: 8px; left: 8px;
  width: 12px; height: 12px; border-radius: 50%;
  box-shadow: 0 0 0 2px #fff; z-index: 2;
}
.footprint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 12px 4px 2px; font-size: 12px; color: var(--text-soft);
}
.fp-label { font-weight: 600; color: var(--text); }
.fp-chip {
  color: #fff; font-weight: 700; font-size: 12px;
  padding: 3px 10px; border-radius: 999px;
  box-shadow: var(--shadow-sm); animation: pop .3s;
}

/* ─── 详情模态 ─── */
.detail-card { max-width: 380px; text-align: center; }
.detail-art { display: flex; justify-content: center; }
.detail-art svg { width: 120px; height: 120px; }
.detail-text { font-size: 52px; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: 4px; margin-top: 4px; }
.detail-sub { color: var(--text-soft); margin: 4px 0; font-family: "Helvetica Neue", Arial, sans-serif; }
.detail-mean { color: var(--text-muted); font-size: 14px; margin-bottom: 8px; }
.detail-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }

/* 田字格 + 笔顺演示 */
.tianzi-wrap { margin: 8px 0 4px; }
.tianzi {
  position: relative; width: 150px; height: 150px; margin: 6px auto;
  background: #fff; border: 2px solid var(--pink-300); border-radius: 14px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.tianzi .tz-char {
  font-size: 110px; line-height: 1; color: var(--text);
  font-family: "KaiTi", "STKaiti", "PingFang SC", sans-serif;
  /* 书写动画初始：从上到下揭开 */
  clip-path: inset(0 0 0 0);
}
.tianzi .tz-char.writing { animation: writeReveal 1.5s ease both; }
@keyframes writeReveal {
  0% { clip-path: inset(0 0 100% 0); }
  100% { clip-path: inset(0 0 0 0); }
}
.tianzi .tz-line { position: absolute; background: rgba(217,122,166,.35); }
.tianzi .tz-line.v { left: 50%; top: 6%; bottom: 6%; width: 1px; }
.tianzi .tz-line.h { top: 50%; left: 6%; right: 6%; height: 1px; }
.tianzi.mizi { border-style: dashed; }
.tianzi .tz-grid { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.tianzi .tz-char { position: relative; z-index: 1; }

/* 语文卡片新布局：插画在田字格左侧，拼音在田字格上方 */
.hz-body { display: flex; align-items: center; gap: 14px; }
.hz-art {
  width: 92px; height: 92px; flex: none; border-radius: var(--radius-md);
  background: var(--pink-50); display: flex; align-items: center; justify-content: center;
  position: relative;
}
.hz-art svg { width: 80px; height: 80px; }
.hz-grid { display: flex; flex-direction: column; align-items: center; }
/* 田字格与对应汉字并列、上下对齐：左侧拼音+田字格，右侧整字 */
.hz-write { display: flex; align-items: center; gap: 18px; margin-top: 2px; }
.hz-write-left { display: flex; flex-direction: column; align-items: center; }
.hz-py {
  font-size: 17px; font-weight: 700; color: var(--pink-500);
  margin-bottom: 4px; font-family: "Helvetica Neue", "Arial", sans-serif; letter-spacing: 1px;
}
.hz-grid .tianzi { width: 80px; height: 80px; margin: 0; }
.hz-char {
  font-size: 52px; line-height: 1; color: var(--text);
  font-family: "KaiTi", "STKaiti", "PingFang SC", sans-serif;
}
.hz-meta { color: var(--text-soft); font-size: 13px; margin: 8px 2px 0; }
.hz-meta b { color: var(--pink-500); }

/* 笔顺（一笔一划）演示：始终展示，依次点亮 */
.stroke-demo { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--pink-100); }
.sd-title { font-size: 13px; color: var(--pink-500); font-weight: 700; margin-bottom: 6px; }
/* 逐笔步骤卡：每步一个迷你田字格（已写笔黑、最新笔红）+ 该笔名称，替换原序号 */
.sd-cells {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-top: 10px;
}
.sd-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px; border-radius: 12px;
}
.sd-cell.cur {
  background: var(--pink-50);
  box-shadow: 0 0 0 2px var(--pink-400);
}
.sd-cell-box {
  width: 50px; height: 50px; border-radius: 10px;
  background: #fff; border: 1.5px dashed var(--pink-300);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.sd-cell-svg { width: 100%; height: 100%; display: block; }
.sd-cell-svg path { transition: none; }
.sd-cell-name {
  font-size: 13px; font-weight: 700; color: var(--pink-400);
  font-family: "KaiTi", "STKaiti", "PingFang SC", sans-serif;
  line-height: 1;
}
.sd-controls { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.sd-caption { text-align: center; font-size: 13px; color: var(--text-soft); margin-top: 8px; min-height: 18px; }
.tianzi .tz-strokes { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; }
.tianzi .tz-strokes .tz-svg { width: 100%; height: 100%; display: block; }
.tianzi .tz-strokes path { transition: none; }

.stroke-seq { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.stroke-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pink-50); color: var(--pink-500);
  font-size: 13px; font-weight: 700; border: 1.5px solid var(--pink-200);
  transition: transform .2s, background .2s;
}
.stroke-num.on { background: var(--pink-400); color: #fff; transform: scale(1.25); border-color: var(--pink-400); }
.stroke-meta { color: var(--text-soft); font-size: 13px; margin: 4px 0; }
.stroke-meta b { color: var(--pink-500); }

.words-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin-top: 8px; }
.wr-label { font-size: 13px; color: var(--text-soft); }
.wr-chip {
  background: var(--lilac-100); color: var(--lilac-500);
  padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}

/* 图文例句 */
.eg-wrap { margin: 10px 0; padding: 12px; border-radius: var(--radius-md); background: var(--lilac-50); }
.eg-en { font-size: 17px; font-weight: 700; color: var(--text); font-family: "Helvetica Neue", Arial, sans-serif; }
.eg-cn { font-size: 15px; color: var(--text-soft); margin-top: 2px; }

/* 卡片内联：笔顺演示 / 例句 / 跟读面板 */
.card-mean.cn-mean { grid-column: 1 / -1; font-size: 19px; font-weight: 700; color: var(--pink-500); margin-top: 6px; line-height: 1.4; }
.tianzi-inline, .eg-inline, .inline-practice { grid-column: 1 / -1; }
.tianzi-inline {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--pink-100);
}
.tianzi-inline .tianzi { width: 124px; height: 124px; margin: 4px auto; }
.tianzi-inline .tianzi .tz-char { font-size: 92px; }
.tianzi-inline .inline-tools { margin: 4px 0 2px; }
.words-row .wr-label { font-size: 13px; color: var(--text-muted); margin-right: 2px; }
.eg-inline {
  margin-top: 10px; padding: 10px 12px; background: var(--lilac-50);
  border-radius: var(--radius-md); border-left: 4px solid var(--lilac-300);
}
.eg-line { display: flex; align-items: center; gap: 8px; }
.eg-line .eg-en { font-size: 17px; font-weight: 700; color: var(--text); }
.spk {
  border: none; background: var(--pink-100); color: var(--pink-500);
  width: 34px; height: 34px; border-radius: 50%; font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  transition: transform .15s, background .2s;
}
.spk:hover { background: var(--pink-200); }
.spk:active { transform: scale(.9); }
.inline-practice[hidden] { display: none; }
.inline-practice:not([hidden]) { grid-column: 1 / -1; margin-top: 10px; }
.prac-panel { background: var(--pink-50); border: 1.5px solid var(--pink-100); border-radius: var(--radius-md); padding: 12px; }
.prac-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prac-status { margin-top: 8px; font-size: 13px; color: var(--text-soft); min-height: 18px; }
.prac-result { margin-top: 6px; }
.prac-hint { margin-top: 6px; }

/* ─── 宠物：形象切换 / 衣橱 / 商店 ─── */
.species-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.species-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 2px solid var(--pink-100); background: #fff; color: var(--text-soft);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600;
  transition: transform .15s, border-color .2s, background .2s;
}
.species-chip .sp-emoji { font-size: 16px; }
.species-chip.active { border-color: var(--pink-400); background: var(--pink-50); color: var(--pink-500); }
.species-chip.locked { opacity: .85; }
.species-chip:active { transform: scale(.96); }

.pet-extra { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

/* 商店 */
.shop-modal, .wd-modal { max-width: 420px; max-height: 80vh; overflow-y: auto; }
.shop-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.shop-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: #fff; border-radius: var(--radius-md); padding: 10px 12px;
  box-shadow: var(--shadow-sm); border: 1.5px solid #f3e7f1;
}
.shop-emoji { font-size: 28px; width: 40px; text-align: center; }
.shop-info { flex: 1; }
.shop-name { font-weight: 700; color: var(--text); font-size: 15px; }
.shop-desc { font-size: 12px; color: var(--text-soft); }

/* 衣橱 */
.wd-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; text-align: left; }
.wd-group h4 { margin: 0 0 6px; color: var(--pink-500); font-size: 14px; }
.wd-row { display: flex; flex-wrap: wrap; gap: 8px; }
.wd-item {
  border: 1.5px solid var(--pink-100); background: #fff; color: var(--text-soft);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600;
  transition: transform .15s, border-color .2s, background .2s;
}
.wd-item.on { border-color: var(--pink-400); background: var(--pink-50); color: var(--pink-500); }
.wd-item.no { opacity: .45; }
.wd-item:active { transform: scale(.96); }

/* ─── 波纹特效 ─── */
.btn, .card, .nav-btn, .species-chip, .shop-card, .wd-item { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, .55);
  transform: scale(0); animation: rippleAnim .6s ease-out; z-index: 5;
}
.btn .ripple { background: rgba(255, 255, 255, .45); }
@keyframes rippleAnim { to { transform: scale(2.4); opacity: 0; } }

/* fx 爱心特效 */
.fx-heart {
  position: absolute; bottom: 30%; font-size: 22px;
  animation: floatHeart 2.2s ease-in forwards; pointer-events: none;
}
@keyframes floatHeart {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-60vh) scale(1.2); opacity: 0; }
}

/* ─── 每日打卡卡片 ─── */
.checkin-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: var(--radius-lg);
  padding: 14px 16px; margin: 14px 4px 4px;
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--pink-400);
}
.ci-ring {
  width: 62px; height: 62px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  transition: background .5s;
}
.ci-ring-in {
  width: 48px; height: 48px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: var(--pink-500);
}
.ci-info { flex: 1; min-width: 0; }
.ci-title { font-size: 15px; font-weight: 700; color: var(--pink-500); }
.ci-sub { font-size: 13px; color: var(--text-soft); margin: 2px 0 6px; }
.ci-sub b { color: var(--text); }
.ci-prog {
  height: 9px; border-radius: 999px; background: #f3e7f1; overflow: hidden;
  margin-bottom: 8px;
}
.ci-prog.big { height: 12px; margin: 10px 0; }
.ci-prog-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--pink-300), var(--lilac-300));
  transition: width .5s;
}
.checkin-card .btn { flex: none; }

/* 统计页打卡 */
.ci-stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.ci-stat {
  flex: 1; min-width: 90px; text-align: center;
  background: var(--pink-50); border-radius: var(--radius-md); padding: 10px 6px;
}
.ci-num { display: block; font-size: 18px; font-weight: 800; color: var(--pink-500); }
.ci-lab { display: block; font-size: 12px; color: var(--text-soft); margin-top: 2px; }

/* ─── 章节导航条 ─── */
.chapter-bar {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-lg);
  padding: 10px 14px; margin: 12px 4px 0;
  box-shadow: var(--shadow-sm);
}
.chapter-bar .btn[disabled] { opacity: .4; pointer-events: none; }
.chapter-mid { flex: 1; text-align: center; min-width: 0; }
.chapter-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chapter-prog { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.chapter-prog b { color: var(--pink-500); }
.chapter-prog .ok { color: #2fa86a; font-weight: 700; }

/* 章节内小屏微调 */
@media (max-width: 380px) {
  .checkin-card { flex-wrap: wrap; }
  .chapter-bar .btn.small { padding: 7px 10px; font-size: 12px; }
  .chapter-name { font-size: 13px; }
}

/* ─── 首页 / 章节目录 ─── */
.home-page { padding-top: 8px; }

.home-hero {
  text-align: center;
  background: linear-gradient(135deg, var(--pink-100), var(--lilac-100));
  border-radius: var(--radius-xl);
  padding: 22px 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.home-hero-emoji { font-size: 38px; line-height: 1; }
.home-hero-title { font-size: 20px; font-weight: 800; color: var(--pink-500); margin-top: 6px; }
.home-hero-sub { font-size: 13px; color: var(--text-soft); margin-top: 4px; line-height: 1.5; }

.subject-card {
  background: #fff; border-radius: var(--radius-lg);
  padding: 14px 16px 16px; margin: 12px 4px;
  box-shadow: var(--shadow-sm);
}
.subject-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.subject-title { font-size: 17px; font-weight: 800; color: var(--pink-500); }
.subject-sub { font-size: 12px; color: var(--text-muted); }

.chapter-list { display: flex; flex-direction: column; gap: 10px; }

.chapter-entry {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: var(--pink-50);
  border: 1.5px solid var(--pink-100);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.chapter-entry:hover {
  background: #fff; border-color: var(--pink-300);
  box-shadow: var(--shadow-sm); transform: translateY(-1px);
}
.chapter-entry:active { transform: translateY(0) scale(.99); }
.chapter-entry.done { background: #f3fbf6; border-color: #cdeedd; }

.ce-ico {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-sm);
}
.ce-ico svg { width: 30px; height: 30px; }
.ce-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ce-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ce-prog { font-size: 12px; color: var(--text-soft); }
.ce-prog b { color: var(--pink-500); }
.chapter-entry.done .ce-prog { color: #2fa86a; }
.ce-arrow {
  font-size: 22px; color: var(--pink-300); flex: none;
  font-weight: 700; line-height: 1;
}
.chapter-entry:hover .ce-arrow { color: var(--pink-400); }

/* 底部导航 5 项时小屏微调 */
@media (max-width: 360px) {
  .nav-btn { min-width: 52px; font-size: 10px; padding: 6px 4px; }
  .nav-btn .nav-ico { width: 26px; height: 26px; }
  .nav-btn .nav-ico svg { width: 22px; height: 22px; }
}
