* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(160deg, #fff7e6 0%, #ffeef5 45%, #e8f7ff 100%);
  min-height: 100vh;
  color: #333;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.brand { font-size: 1.35rem; font-weight: 800; }
.brand span { color: #e0503c; }
.brand-pic { width: 32px; height: 32px; border-radius: 50%; vertical-align: -7px; object-fit: cover; }

.mode-switch button {
  border: 2px solid #ffd166;
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.15s;
}
.mode-switch button.active {
  background: #ffd166;
  font-weight: 700;
}

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}
.category-nav button {
  border: none;
  background: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.12s;
}
.category-nav button:hover { transform: translateY(-2px); }
.category-nav button.active {
  background: #ef476f;
  color: #fff;
  font-weight: 700;
}
.nav-pic {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -6px;
  margin-right: 2px;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.word-card {
  background: #fff;
  border-radius: 20px;
  padding: 18px 10px 14px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
  transition: transform 0.12s;
  position: relative;
}
.word-card:hover { transform: translateY(-3px) scale(1.02); }
.word-card .pic img {
  width: 88px; height: 88px;
  object-fit: contain;
  animation: floaty 3s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.word-card .hanzi { font-size: 2rem; font-weight: 800; margin: 6px 0 2px; }
.word-card .pinyin { color: #e0503c; font-size: 0.95rem; }
.word-card .english { color: #888; font-size: 0.85rem; margin-top: 2px; }
.speak-btn {
  border: none;
  background: #e8f7ff;
  border-radius: 50%;
  width: 38px; height: 38px;
  font-size: 1.15rem;
  cursor: pointer;
  margin-top: 8px;
}
.speak-btn:hover { background: #bfe9ff; }
.speak-btn svg { vertical-align: middle; }
.speak-btn.big { width: 64px; height: 64px; }

.quiz-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 560px;
  margin: 10px auto;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.quiz-card h2 { margin-bottom: 12px; }
.quiz-card p { color: #666; margin-bottom: 18px; }
.quiz-card select {
  font-size: 1rem; padding: 8px 12px; border-radius: 12px;
  border: 2px solid #ffd166; margin-left: 6px;
}
button.primary {
  display: inline-block;
  margin-top: 18px;
  background: #06d6a0;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 32px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
button.primary:hover { background: #05b98a; }

.quiz-progress {
  display: flex;
  justify-content: space-between;
  color: #888;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.quiz-prompt { min-height: 170px; }
.quiz-hint { color: #888; font-size: 1rem; margin-bottom: 12px; }
.quiz-pic {
  width: 132px; height: 132px;
  object-fit: contain;
  animation: floaty 3s ease-in-out infinite;
}
.quiz-word-big { font-size: 3rem; font-weight: 800; margin: 4px 0; }
.quiz-pinyin-big { font-size: 1.2rem; color: #e0503c; }
.quiz-prompt .speak-btn { width: 52px; height: 52px; }
.opt-hanzi { font-size: 1.5rem; font-weight: 800; }
.opt-pinyin { color: #e0503c; font-size: 0.95rem; margin-top: 2px; }
.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.quiz-options button {
  border: 2px solid #eee;
  background: #fafafa;
  border-radius: 16px;
  padding: 14px 8px;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.15s;
}
.quiz-options button:hover { border-color: #ffd166; background: #fffbeF; }
.quiz-options button.correct { background: #d8f8e8; border-color: #06d6a0; animation: pop 0.35s ease; }
.quiz-options button.wrong { background: #ffe3e3; border-color: #ef476f; animation: wiggle 0.4s ease; }
.quiz-options button:disabled { cursor: default; opacity: 0.9; }
.quiz-options.img-options button { padding: 10px; display: flex; align-items: center; justify-content: center; }
.quiz-options.img-options img { width: 100%; max-width: 110px; height: 92px; object-fit: contain; }

/* 小动画：答对弹一下、答错晃一下、按钮按压缩放 */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes wiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
button.primary:active, .speak-btn:active,
.mode-switch button:active, .category-nav button:active,
.quiz-options button:active { transform: scale(0.94); }

footer {
  text-align: center;
  padding: 24px;
  color: #aaa;
  font-size: 0.9rem;
}

@media (max-width: 560px) {
  .word-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .word-card .hanzi { font-size: 1.6rem; }
  .site-header { flex-direction: column; gap: 10px; }
}

/* 英文引导小字：零基础无障碍，中文为主、英文为辅 */
.en-sub {
  font-size: 0.72em;
  color: #9aa0a6;
  font-weight: 400;
}
button .en-sub { display: block; line-height: 1.3; margin-top: 2px; }
.category-nav button.active .en-sub { color: #ffe0ea; }
button.primary .en-sub { color: rgba(255, 255, 255, 0.88); }
.quiz-hint-en { color: #a8adb3; font-size: 0.85rem; margin-bottom: 12px; }
#result-title .en-sub, h2 .en-sub { display: block; margin-top: 6px; }

/* v2.3.0 字→词→句：学字视图、例句、进度 */
.level-pill {
  background: linear-gradient(135deg, #ffd76e, #ffb63d);
  color: #6b4a00;
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
}
.level-pill .en-sub { color: rgba(107, 74, 0, 0.65); }
.batch-bar {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.batch-info { font-weight: 700; margin-bottom: 8px; }
.pbar { height: 10px; background: #f0e8d8; border-radius: 5px; overflow: hidden; }
.pfill { height: 100%; background: linear-gradient(90deg, #ffd76e, #ff9d3d); border-radius: 5px; transition: width 0.3s; }
.batch-count { margin-top: 6px; color: #888; font-size: 0.85rem; }
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.char-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 12px 6px 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.12s;
}
.char-card:hover { transform: translateY(-2px); }
.char-hanzi { font-size: 2.1rem; font-weight: 800; line-height: 1.2; }
.char-pinyin { color: #e0503c; font-size: 0.8rem; margin-top: 2px; }
.char-en { color: #999; font-size: 0.7rem; margin-top: 1px; }
.char-words { margin-top: 8px; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.char-word {
  font-size: 0.72rem;
  background: #fff3d6;
  border: 1px solid #f0d488;
  color: #8a6d1a;
  border-radius: 8px;
  padding: 2px 7px;
  cursor: pointer;
}
.master-tick {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #d8d8d8;
  background: #fff;
  color: transparent;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}
.char-card.mastered { outline: 2px solid #57b26a; background: #f4fbf4; }
.char-card.mastered .master-tick { opacity: 1; background: #57b26a; border-color: #57b26a; color: #fff; }
.speak-btn.small { width: 30px; height: 30px; margin-top: 6px; }
.speak-btn.small svg { width: 15px; height: 15px; }
.example {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #4a6b8a;
  background: #f0f6fc;
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
  line-height: 1.5;
}
.ex-label {
  display: inline-block;
  background: #9ec7e8;
  color: #fff;
  font-size: 0.65rem;
  border-radius: 4px;
  padding: 0 4px;
  margin-right: 4px;
}
.word-card.flash { animation: flash 1.5s; }
@keyframes flash {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
  30%, 70% { box-shadow: 0 0 0 3px #ffb63d; }
}
.load-error {
  background: #fff;
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  color: #c00;
}
@media (max-width: 560px) {
  .char-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .char-hanzi { font-size: 1.8rem; }
  .level-pill { font-size: 0.78rem; }
}
