:root {
  --ink: #293b3a;
  --muted: #5f6b66;
  --cream: #fff8eb;
  --paper: #fffef9;
  --coral: #f47760;
  --coral-dark: #dc5d49;
  --yellow: #f6c854;
  --teal: #4cae9c;
  --teal-soft: #e2f4ed;
  --purple: #8b79cf;
  --purple-dark: #6e5cae;
  --line: #eee5d6;
  --shadow: 0 14px 40px rgba(91, 72, 43, 0.09);
  --font-rounded: 'Nunito', 'Arial Rounded MT Bold', 'Trebuchet MS', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(246, 200, 84, 0.16), transparent 22rem),
    radial-gradient(circle at 96% 92%, rgba(76, 174, 156, 0.14), transparent 24rem),
    var(--cream);
  font-family: var(--font-rounded);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 儿童操作时避免误触文字选择、复制菜单和图片拖拽；manipulation 禁用双击缩放但保留双指缩放 */
body,
body * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body input,
body textarea,
body [contenteditable='true'] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

img {
  -webkit-user-drag: none;
}

a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid #286d8d;
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 12px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- 屏幕容器 ---------- */

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

.screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px 6px;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #fff;
  background: var(--coral);
  border: 3px solid #fff;
  border-radius: 13px 13px 13px 5px;
  font-size: 22px;
  font-weight: 900;
  transform: rotate(-3deg);
}

.brand-name {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.8px;
  line-height: 1.1;
}

.brand-name span {
  color: var(--coral);
}

.brand-text p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.learned-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 7px 11px;
  color: #7b6218;
  background: #fff4cd;
  border: 1px solid #f0dfa9;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.learned-chip svg {
  width: 17px;
  height: 17px;
  color: var(--yellow);
  filter: drop-shadow(0 0 1px #c49a2c);
}

.learned-chip strong {
  font-size: 15px;
  font-weight: 900;
}

.learned-chip small {
  font-size: 10px;
  opacity: 0.75;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #5f6c66;
  background: rgba(255, 254, 249, 0.9);
  border: 1.5px solid var(--line);
  border-radius: 14px;
}

.icon-button:active {
  transform: scale(0.95);
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

/* 学单词 / 说短语 顶部右侧：静态模式标识（不可点击），避免误以为是听音选图入口 */
.topbar-title {
  display: flex;
  flex: 1;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.topbar-title span {
  overflow: hidden;
  font-size: 15px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

/* ---------- 分类选择页 ---------- */

.category-body {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 2px 16px calc(env(safe-area-inset-bottom, 0px) + 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.progress-wrap {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255, 254, 249, 0.85);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  background: #eceade;
  border-radius: 20px;
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #7cc9a6);
  border-radius: inherit;
  transition: width 350ms ease;
}

.progress-wrap p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

/* 阶段切换：两枚胶囊，未解锁时带锁并置灰 */
.stage-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-width: 820px;
  margin: 0 0 8px;
  padding: 5px;
  background: #eee9dc;
  border-radius: 17px;
}

.stage-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 10px;
  color: #6d7873;
  background: transparent;
  border: 0;
  border-radius: 13px;
  font: inherit;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.stage-tab strong {
  font-size: 14px;
  font-weight: 900;
}

.stage-tab small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.3px;
  opacity: 0.65;
}

.stage-tab.is-active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 4px 12px rgba(80, 67, 42, 0.09);
}

.stage-tab.is-locked {
  color: #9aa39e;
}

.stage-tab.is-locked strong {
  opacity: 0.75;
}

.stage-lock {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.stage-tab.is-unlocked .stage-lock {
  display: none;
}

.mode-switch {
  display: grid;
  /* 两排四个按钮 */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 820px;
  margin-top: 6px;
  gap: 6px;
  padding: 5px;
  background: #eee9dc;
  border-radius: 17px;
}

.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  gap: 8px;
  padding: 6px 10px;
  color: #6d7873;
  background: transparent;
  border: 0;
  border-radius: 13px;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.mode-button svg {
  width: 21px;
  height: 21px;
}

.mode-button > span {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mode-button strong {
  font-size: 14px;
  font-weight: 900;
}

.mode-button small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.4px;
  opacity: 0.65;
  white-space: nowrap;
}

.mode-button.is-active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 4px 12px rgba(80, 67, 42, 0.09);
}

#learnMode.is-active svg {
  color: var(--coral);
}

#quizMode.is-active svg {
  color: var(--purple);
}

#phraseMode.is-active svg {
  color: var(--teal);
}

.grid-heading {
  margin: 12px 2px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-card {
  --cat-color: var(--teal);
  position: relative;
  display: flex;
  align-items: center;
  min-height: 72px;
  gap: 10px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 5px 14px rgba(91, 72, 43, 0.05);
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.category-card:active {
  transform: scale(0.975);
}

.category-card:hover {
  border-color: var(--cat-color);
}

.category-card-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  color: color-mix(in srgb, var(--cat-color) 78%, #2b3a35);
  background: color-mix(in srgb, var(--cat-color) 16%, #fff);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 900;
}

.category-card-body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.category-card-body strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-card-body small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.category-card-count {
  flex: 0 0 auto;
  padding: 3px 7px;
  color: var(--muted);
  background: #f6f2e8;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 900;
}

.category-card-body .category-card-count {
  align-self: flex-start;
  margin-top: 3px;
  line-height: 1.2;
}

.category-card.is-done .category-card-count {
  color: #2f7f61;
  background: #e3f5ec;
}

.category-footnote {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

/* ---------- 单词学习页 ---------- */

.learn-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  gap: 10px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 4px 14px calc(env(safe-area-inset-bottom, 0px) + 38px);
}

.image-stage {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.image-frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 560px;
  overflow: hidden;
  background: #f6f1e6;
  border: 1px solid #eee6d7;
  border-radius: 26px;
}

/* 让图片区自动收缩为正方形，避免上下留白 */
@supports (width: 1cqh) {
  .image-stage {
    container-type: size;
  }

  .image-frame {
    width: min(100cqw, 100cqh, 560px);
    height: min(100cqw, 100cqh, 560px);
  }
}

/* 数字分类：图片右下角醒目的阿拉伯数字角标 */
.number-badge {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 54px;
  height: 54px;
  padding: 0 12px;
  color: #fff;
  background: linear-gradient(135deg, #ff8a3d, #ff5a5f);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(255, 90, 95, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.image-click-area {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: inherit;
}

.image-click-area:focus-visible {
  outline-offset: -6px;
}

#wordImage {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-loading,
.image-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  color: #7b867f;
  background: #f6f1e6;
  font-size: 12px;
  font-weight: 800;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #ded9cc;
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.image-error > svg {
  width: 40px;
  height: 40px;
  color: #aaa496;
}

.image-error strong {
  color: var(--ink);
  font-size: 13px;
}

.retry-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 14px;
  color: #fff;
  background: var(--coral);
  border: 0;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 900;
}

.retry-button svg {
  width: 16px;
  height: 16px;
}

.word-text {
  flex: 0 0 auto;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(34px, 11vw, 56px);
  font-weight: 900;
  letter-spacing: -1.8px;
  line-height: 1.02;
  text-align: center;
}

/* 短语模式：句子比单词长，缩小字号、放宽行高并允许换行 */
.word-text--phrase {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 6px;
  font-size: clamp(22px, 5.4vw, 36px);
  letter-spacing: -0.6px;
  line-height: 1.32;
}

/* 短句中高亮当前学习的单词 */
.word-text--phrase .phrase-word {
  color: var(--coral-dark);
  background: #ffe6cf;
  border-radius: 8px;
  padding: 0 5px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.speak-button {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  width: min(420px, 100%);
  min-height: 64px;
  gap: 11px;
  margin: 0 auto;
  padding: 8px 16px 8px 9px;
  color: #fff;
  background: var(--coral);
  border: 0;
  border-radius: 18px;
  box-shadow: 0 5px 0 var(--coral-dark);
  text-align: left;
  transition: transform 130ms ease, box-shadow 130ms ease;
}

.speak-button:active,
.speak-button.is-speaking {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--coral-dark);
}

.speak-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--coral);
  background: #fff;
  border-radius: 13px;
}

.speak-icon svg {
  width: 24px;
  height: 24px;
}

.speak-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.speak-copy strong {
  font-size: 16px;
  font-weight: 900;
}

.speak-copy small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.4px;
  opacity: 0.82;
}

.sound-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
}

.sound-waves i {
  display: block;
  width: 3px;
  height: 9px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 4px;
}

.sound-waves i:nth-child(2) { height: 19px; }
.sound-waves i:nth-child(3) { height: 13px; }

.is-speaking .sound-waves i {
  animation: sound-wave 600ms ease-in-out infinite alternate;
}

.is-speaking .sound-waves i:nth-child(2) { animation-delay: 150ms; }
.is-speaking .sound-waves i:nth-child(3) { animation-delay: 300ms; }

@keyframes sound-wave {
  to { height: 4px; }
}

.learn-nav {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

/* 无圆点（说短语模式）时两个翻页按钮等宽对称，避免一宽一窄、左右错位 */
.learn-nav--no-dots {
  grid-template-columns: 1fr 1fr;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  gap: 7px;
  padding: 8px 12px;
  color: #5f6c66;
  background: #fff;
  border: 1.5px solid #ded8cb;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 900;
}

.nav-button svg {
  width: 17px;
  height: 17px;
}

.nav-button-primary {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.nav-button:disabled {
  opacity: 0.36;
}

.word-dots {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
}

.word-dot {
  position: relative;
  flex: 0 0 auto;
  width: 15px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.word-dot::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  background: #d9d7cd;
  border-radius: 50%;
  content: '';
  transform: translate(-50%, -50%);
  transition: width 170ms ease, background 170ms ease;
}

.word-dot.is-seen::after {
  background: #a8d4c5;
}

.word-dot.is-active::after {
  width: 13px;
  background: var(--coral);
  border-radius: 7px;
}

/* ---------- 听音选图页 ---------- */

.score-chip {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-width: 56px;
  justify-content: center;
  padding: 7px 10px;
  color: #8c6a1c;
  background: #fff5d5;
  border: 1px solid #f0dfa9;
  border-radius: 13px;
}

.score-chip svg {
  width: 17px;
  height: 17px;
  color: var(--yellow);
  filter: drop-shadow(0 0 1px #c49a2c);
}

.score-chip strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.quiz-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 6px 16px calc(env(safe-area-inset-bottom, 0px) + 52px);
}

/* 侧栏容器：竖屏/桌面不参与布局（display:contents），顺序为 图片 → 听一听/反馈行 → 进度 */
.quiz-side {
  display: contents;
  order: 3; /* 横屏时侧栏作为整体排在选项右侧 */
}

.quiz-options {
  order: 1;
}

.quiz-footer {
  order: 2;
}

.quiz-progress {
  order: 3;
}

/* 图片下方居中的「听一听」：标题 + 喇叭按钮，高度稳定，答对后不缩放 */
.quiz-listen {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 86px;
  padding: 4px 0 0;
  text-align: center;
}

.quiz-listen-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--ink);
}

/* 窄屏时进一步压缩，避免三块挤压重叠 */
@media (max-width: 380px) {
  .quiz-footer {
    gap: 6px;
  }

  .quiz-feedback {
    font-size: 11px;
  }

  .quiz-speak-button {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .quiz-listen-title {
    font-size: 13px;
  }
}

.quiz-speak-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: #fff;
  background: var(--purple);
  border: 0;
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--purple-dark);
  transition: transform 130ms ease, box-shadow 130ms ease;
}

.quiz-speak-button > svg {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
}

.quiz-speak-button:active,
.quiz-speak-button.is-speaking {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--purple-dark);
}

.quiz-sound-ring {
  position: absolute;
  inset: -5px;
  border: 2px solid var(--purple);
  border-radius: 24px;
  opacity: 0;
}

.quiz-speak-button.is-speaking .quiz-sound-ring {
  animation: sound-ring 1s ease-out infinite;
}

@keyframes sound-ring {
  0% { opacity: 0.7; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(1.14); }
}

.quiz-options {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: 10px;
  min-height: 0;
}

.quiz-option {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 5px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid #e9e2d4;
  border-radius: 18px;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.quiz-option:active:not(:disabled) {
  transform: scale(0.97);
}

.quiz-option:disabled {
  opacity: 1;
}

.quiz-option-image {
  position: relative;
  display: block;
  width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f3eee2;
  border-radius: 13px;
}

.quiz-option-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.option-number {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #66736d;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(50, 45, 35, 0.1);
  font-size: 10px;
  font-weight: 900;
}

.option-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  background: #f3eee2;
  font-size: 10px;
  font-weight: 800;
}

.option-loading .loading-spinner {
  width: 24px;
  height: 24px;
  border-width: 3px;
  border-top-color: var(--purple);
}

/* 拼写标签始终占位：答对前隐藏但保留高度，答对后显示，避免图片变大或布局跳动 */
.option-word {
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  min-height: 30px;
  padding: 6px 2px 2px;
  font-size: clamp(14px, 4.6vw, 21px);
  font-weight: 900;
  letter-spacing: -0.4px;
}

.quiz-option.is-correct .option-word {
  visibility: visible;
  color: #38834a;
}

.quiz-option.is-correct {
  background: #f0faf2;
  border-color: #62ae72;
  box-shadow: 0 0 0 3px rgba(98, 174, 114, 0.13);
}

.quiz-option.is-wrong {
  background: #fff6f3;
  border-color: #e79b88;
  opacity: 0.6 !important;
}

.option-result {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: none;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #fff;
  background: #62ae72;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(50, 100, 60, 0.2);
}

.option-result svg {
  width: 18px;
  height: 18px;
}

.is-correct .option-result,
.is-wrong .option-result {
  display: grid;
}

.is-wrong .option-result {
  background: #dc7b65;
}

.quiz-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
}

/* 左右两侧等宽占位：反馈固定在左下，听一听按钮始终居中，长提示在左半区自动两行 */
.quiz-footer-side {
  display: flex;
  flex: 1 1 0;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
}

.quiz-footer-side--end {
  justify-content: flex-end;
}

.quiz-feedback {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
}

.feedback-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 31px;
  height: 31px;
  color: var(--purple);
  background: #eee9fa;
  border-radius: 10px;
}

.feedback-icon svg {
  width: 17px;
  height: 17px;
}

.quiz-feedback.is-success {
  color: #38834a;
}

.quiz-feedback.is-success .feedback-icon {
  color: #38834a;
  background: #e2f4e5;
}

.quiz-feedback.is-try-again {
  color: #a05e45;
}

.quiz-feedback.is-try-again .feedback-icon {
  color: #b66b51;
  background: #fff0e8;
}

.small-action-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  gap: 6px;
  padding: 9px 15px;
  color: #62548e;
  background: #f0ebfb;
  border: 1px solid #d9cfef;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 900;
}

.small-action-button svg {
  width: 17px;
  height: 17px;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  left: 14px;
  max-width: 420px;
  margin: 0 auto;
  padding: 13px 16px;
  color: #fff;
  background: #344844;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(30, 40, 35, 0.22);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

/* ---------- 护眼倒计时 ---------- */

.eye-timer {
  position: fixed;
  /* 所有页面倒计时统一放在左下方 */
  left: calc(env(safe-area-inset-left, 0px) + 10px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  color: #6b7a72;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(72, 60, 40, 0.08);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(50, 45, 35, 0.1);
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.eye-timer svg {
  width: 13px;
  height: 13px;
}

.eye-timer.is-warning {
  color: #c07a15;
}

.eye-timer.is-danger {
  color: #d1493c;
}

.time-up {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(38, 33, 26, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.time-up[hidden] {
  display: none;
}

.time-up-card {
  width: min(360px, 100%);
  padding: 26px 22px 24px;
  text-align: center;
  background: var(--paper);
  border-radius: 26px;
  box-shadow: 0 18px 40px rgba(30, 40, 35, 0.25);
}

.time-up-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  color: var(--purple);
  background: #f0ecfb;
  border-radius: 20px;
}

.time-up-icon svg {
  width: 30px;
  height: 30px;
}

.time-up-card h2 {
  margin: 0 0 8px;
  font-size: 21px;
}

.time-up-card p {
  margin: 0 0 18px;
  color: #7b8378;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
}

.time-up-button {
  width: 100%;
  padding: 13px 16px;
  color: #fff;
  background: var(--purple);
  border: 0;
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--purple-dark);
  font-size: 15px;
  font-weight: 900;
}

.time-up-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--purple-dark);
}

body.is-time-up {
  overflow: hidden;
}

/* ---------- 大屏适配 ---------- */

@media (min-width: 700px) {
  .topbar {
    padding: 14px 20px 8px;
  }

  .category-body,
  .learn-body,
  .quiz-body {
    padding-left: 20px;
    padding-right: 20px;
  }

  .category-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .quiz-body {
    max-width: 920px;
  }

  /* 桌面端 4 列横排：卡片高度由正方形图片决定，不撑满剩余空间，整体垂直居中 */
  .quiz-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: auto;
    flex: 0 1 auto;
    margin-top: auto;
    margin-bottom: auto;
  }

  .category-card {
    min-height: 84px;
  }
}

@media (min-width: 700px) and (min-height: 760px) {
  .category-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* 内容高于屏幕时（留言板加入后），safe center 避免顶部内容被裁掉且无法滚动到 */
    justify-content: safe center;
    padding-bottom: 24px;
  }
}

@media (min-width: 1000px) {
  .category-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .image-frame {
    max-width: 560px;
  }
}

/* 手机端：隐藏上一张/下一张按钮，改为左右滑动切换（桌面端保持按钮） */
@media (max-width: 699px) {
  .learn-body {
    touch-action: pan-y pinch-zoom;
  }

  .learn-nav {
    grid-template-columns: 1fr;
    row-gap: 2px;
    justify-items: center;
  }

  .learn-nav .nav-button {
    display: none;
  }

  .learn-nav::after {
    content: '← 左右滑动切换 →';
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
  }
}

/* 横屏或很矮的屏幕：压缩非关键元素 */
@media (max-height: 560px) {
  .brand-text p,
  .learn-nav {
    display: none;
  }

  .word-text {
    font-size: clamp(28px, 7vh, 44px);
  }

  .word-text--phrase {
    font-size: clamp(19px, 4.4vh, 28px);
  }

  .speak-button {
    min-height: 54px;
  }

  .quiz-listen {
    padding: 0;
  }
}

/* 窄屏：四列保留，只降按钮 padding */
@media (max-width: 460px) {
  .mode-switch {
    gap: 5px;
    padding: 4px;
  }

  .mode-button {
    gap: 5px;
    padding: 6px 6px;
    min-height: 48px;
  }

  .mode-button svg {
    width: 18px;
    height: 18px;
  }

  .mode-button strong {
    font-size: 12px;
  }

  .mode-button small {
    font-size: 8px;
    letter-spacing: 0;
  }
}

/* 极窄屏（iPhone SE 375px）才降到 2 列 */
@media (max-width: 374px) {
  .mode-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 4px;
  }

  .mode-button {
    gap: 6px;
    padding: 7px 8px;
    min-height: 50px;
  }
}

@media (max-width: 379px) {
  .nav-label {
    display: none;
  }

  .nav-button {
    padding-left: 0;
    padding-right: 0;
  }

  /* 四个模式按钮在超窄屏上隐藏英文副标题，保证中文标签点得中 */
  .mode-button small {
    display: none;
  }
}

/* 手机横屏：图片在左、文字与按钮在右，避免图片被竖向布局压小 */
@media (orientation: landscape) and (max-height: 560px) {
  .topbar {
    padding: 8px 16px 2px;
  }

  .learn-body {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr auto auto;
    gap: 6px 16px;
    padding:
      0
      calc(env(safe-area-inset-right, 0px) + 14px)
      calc(env(safe-area-inset-bottom, 0px) + 30px)
      calc(env(safe-area-inset-left, 0px) + 14px);
  }

  .image-stage {
    grid-column: 1;
    grid-row: 1 / -1;
    height: 100%;
    min-height: 0;
  }

  .image-frame {
    border-radius: 20px;
  }

  .phrase-block {
    /* 引导标签 + 英文 + 中文作为一个整体参与横屏排位，避免中文被挤到底部 */
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    justify-self: center;
    min-height: 0;
  }

  .word-text {
    font-size: clamp(23px, 6vh, 34px);
  }

  .word-text--phrase {
    font-size: clamp(17px, 4.6vh, 26px);
  }

  .phrase-zh {
    margin-top: 2px;
    font-size: 0.85rem;
  }

  .speak-button {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    min-height: 46px;
  }

  .learn-nav {
    display: grid;
    grid-column: 2;
    grid-row: 4;
    grid-template-columns: 1fr;
    justify-items: center;
    max-width: none;
    margin: 0;
  }

  /* 横屏使用左右滑动切换，隐藏翻页按钮 */
  .learn-nav .nav-button {
    display: none;
  }

  .learn-nav::after {
    content: '← 左右滑动切换 →';
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
  }

  .say-panel {
    grid-column: 2;
    grid-row: 3;
    justify-self: center;
    align-self: center;
    margin-top: 0;
  }
}

/* ---------- 测验进度与结算页 ---------- */

/* 句型引导卡：中文释义与引导标签 */
.phrase-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.phrase-guide {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 700;
}

.phrase-guide[hidden],
.phrase-zh[hidden] {
  display: none;
}

.phrase-zh {
  margin: 4px 0 0;
  /* 与上方英文短句保持同样的居中对齐 */
  width: 100%;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}

/* 听音选图顶栏右侧占位（替代原计数器），保持标题居中 */
.topbar-spacer {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
}

.quiz-progress {
  /* 固定在底部正中间，与左下角的护眼倒计时同一行 */
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 41;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 254, 249, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.result-view {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.result-view[hidden] {
  display: none;
}

.fireworks-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 300;
}

.result-card {
  position: relative;
  width: min(480px, 100%);
  padding: 26px 24px;
  border-radius: 28px;
  background: rgba(255, 254, 249, 0.95);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.result-badge {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--yellow), var(--coral));
  color: #fff;
}

.result-badge svg {
  width: 34px;
  height: 34px;
}

.result-category {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.result-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--coral-dark);
}

.result-score strong {
  font-size: 4rem;
  line-height: 1;
  font-weight: 800;
}

.result-score span {
  font-size: 1.2rem;
  font-weight: 700;
}

.result-detail {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.result-message {
  margin: 6px 0 10px;
  font-size: 1.3rem;
  line-height: 1.5;
}

.result-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.result-button {
  flex: 1;
  min-height: 52px;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.result-button-primary {
  background: var(--coral);
  color: #fff;
}

.result-button-accent {
  background: linear-gradient(135deg, #a78bfa, #7c5cfc);
  color: #fff;
}

.result-button-secondary {
  background: var(--teal-soft);
  color: var(--ink);
}

/* ---------- 手机横屏：听音选图改为「左图右听」 ---------- */

@media (orientation: landscape) and (max-height: 560px) and (max-width: 999px) {
  .quiz-view .topbar {
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
    padding-bottom: 6px;
  }

  .quiz-body {
    /* 横屏：左侧图片 + 右侧整体侧栏，底部只留「进度 + 倒计时」一行 */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 18px;
    min-height: 0;
    overflow: hidden;
    max-width: none;
    padding: 2px 14px 42px;
  }

  .quiz-options {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 0;
    min-height: 0;
    min-width: 0;
  }

  .quiz-option {
    flex: 0 1 auto;
    width: auto;
    align-items: center;
  }

  /* 图片略放大并垂直居中，不会上溢遮住标题、下溢遮住进度 */
  .quiz-option-image {
    flex: 0 0 auto;
    width: auto;
    height: min(42dvh, 160px);
    max-width: 20vw;
    aspect-ratio: 1 / 1;
  }

  /* 右侧整体：听一听 → 答对反馈，竖排同轴居中并整体上移 */
  .quiz-side {
    display: flex;
    flex: 0 0 168px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: center;
    gap: 12px;
    text-align: center;
  }

  .quiz-listen {
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-height: 0;
    margin: 0;
    padding: 0;
  }

  .quiz-speak-button {
    width: 64px;
    height: 64px;
  }

  .quiz-footer {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 0;
    padding: 0;
    text-align: center;
  }

  .quiz-feedback {
    flex: 0 0 auto;
    justify-content: center;
    text-align: center;
  }

  /* 横屏：侧栏内竖排 反馈 → 听一听 */
  .quiz-footer-side {
    flex: 0 0 auto;
    justify-content: center;
    width: 100%;
  }

  .quiz-footer-side--end {
    justify-content: center;
  }

  .quiz-progress {
    padding: 4px 12px;
    font-size: 11px;
  }

  /* 倒计时同样固定在左下角，与底部居中的进度同一行、互不重叠 */
  .eye-timer {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    right: auto;
    padding: 4px 10px;
    font-size: 11px;
  }
}

/* ---------- 家长登录 / 账号 ---------- */

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  padding: 8px 14px;
  border: 2px solid #ffd9a8;
  border-radius: 999px;
  background: #fff;
  color: #b45f16;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.account-button svg {
  width: 18px;
  height: 18px;
}

.account-button:hover {
  background: #fff3e2;
}

.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(60, 40, 20, 0.45);
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 90dvh;
  overflow: auto;
  padding: 26px 24px 22px;
  border-radius: 22px;
  background: #fffdf8;
  box-shadow: 0 24px 60px rgba(80, 50, 20, 0.25);
}

.auth-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: #4a2f18;
}

.auth-subtitle {
  margin: 0 0 16px;
  font-size: 14px;
  color: #8a6a4a;
  line-height: 1.6;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: #b08a63;
  cursor: pointer;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 2px solid #f0dcc2;
  background: #fff;
  color: #7a5a35;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.is-active {
  border-color: #ff9d45;
  background: #fff1df;
  color: #9a4d11;
}

.auth-field {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #6b4a2c;
}

.auth-field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 2px solid #f0dcc2;
  border-radius: 12px;
  font: inherit;
  font-weight: 500;
  background: #fff;
  color: #4a2f18;
  box-sizing: border-box;
}

.auth-field input:focus {
  outline: none;
  border-color: #ff9d45;
}

.auth-error {
  margin: 0 0 10px;
  color: #d2413a;
  font-size: 13px;
}

.auth-submit {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff9d45, #ff7b6b);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: #a58a6b;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .account-button {
    padding: 6px 10px;
    font-size: 12px;
    margin-right: 6px;
  }
}

/* 各页右上角的当前用户标识（访客 / 用户名） */
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff4e3;
  color: #a06a2c;
  font-size: 13px;
  font-weight: 700;
  max-width: 38vw;
  overflow: hidden;
  white-space: nowrap;
}

.account-chip svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.account-chip .account-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-view {
  position: relative;
}

.result-account {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.85);
}

/* ---------- 每日打卡 ---------- */

.checkin-card {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(91, 72, 43, 0.05);
}

.checkin-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkin-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--coral);
  background: #ffece6;
  border-radius: 10px;
  transition: color 180ms ease, background 180ms ease;
}

.checkin-icon svg {
  width: 17px;
  height: 17px;
}

.checkin-card.is-checked .checkin-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--coral), #f6a08d);
}

.checkin-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.checkin-copy h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
}

.checkin-copy p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkin-stats {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.checkin-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.checkin-stat strong {
  color: var(--coral-dark);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.checkin-stat small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.checkin-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 100%;
  max-width: 440px;
  gap: 4px;
  margin: 8px auto 0;
}

.checkin-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 3px 0;
  background: #fdf7ec;
  border-radius: 9px;
}

.checkin-day-label {
  color: #9a8f7c;
  font-size: 8px;
  font-weight: 800;
}

.checkin-dot {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #ad9f86;
  background: #efe8da;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
}

.checkin-day.is-done .checkin-dot {
  color: #fff;
  background: linear-gradient(135deg, var(--coral), #f6a08d);
}

.checkin-dot svg {
  width: 12px;
  height: 12px;
}

.checkin-day.is-today {
  background: #fff3d6;
  box-shadow: inset 0 0 0 1.5px var(--yellow);
}

.checkin-day.is-today .checkin-day-label {
  color: #b48508;
}

.checkin-day.is-future {
  opacity: 0.55;
}

@media (max-width: 480px) {
  .checkin-card {
    padding: 9px 10px;
  }

  .checkin-copy p {
    font-size: 9px;
  }

  .checkin-stats {
    gap: 8px;
  }

  .checkin-stat strong {
    font-size: 15px;
  }

  .checkin-dot {
    width: 17px;
    height: 17px;
  }
}

/* 主页底部的综合测试卡片 */
.mixed-quiz-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-top: 18px;
  padding: 16px 18px;
  border: 2px solid #ffd9a8;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff6e8, #ffeef0);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mixed-quiz-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 157, 69, 0.18);
}

.mixed-quiz-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff9d45, #ff7b6b);
  color: #fff;
}

.mixed-quiz-icon svg {
  width: 26px;
  height: 26px;
}

.mixed-quiz-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.mixed-quiz-body strong {
  font-size: 18px;
  color: #4a2f18;
}

.mixed-quiz-body small {
  font-size: 13px;
  color: #a07a52;
}

.mixed-quiz-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 0 auto;
}

.mixed-quiz-score small {
  font-size: 11px;
  color: #b08a63;
}

.mixed-quiz-score .category-card-count {
  font-size: 18px;
  font-weight: 800;
  color: #b45f16;
}

@media (max-width: 480px) {
  .mixed-quiz-card {
    gap: 10px;
    padding: 14px;
  }

  .mixed-quiz-body small {
    font-size: 12px;
  }

  .mixed-quiz-icon {
    width: 44px;
    height: 44px;
  }
}

/* ---------- 成就 / 勋章 ---------- */

.achievement-card {
  width: 100%;
  margin: 12px 0 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fffdf4, #fff3d8);
  border: 1.5px solid #f0dfb3;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(91, 72, 43, 0.06);
}

.achievement-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.achievement-card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.achievement-card-head p {
  margin: 2px 0 0;
  color: #8b7954;
  font-size: 10px;
  font-weight: 800;
}

.achievement-open {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 12px;
  color: #826012;
  background: #fff;
  border: 1px solid #ead49a;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.achievement-open:active {
  transform: scale(0.96);
}

.achievement-preview {
  display: grid;
  grid-template-columns: repeat(12, minmax(34px, 1fr));
  gap: 4px;
  margin-top: 9px;
  padding: 2px 1px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.achievement-preview::-webkit-scrollbar {
  display: none;
}

.badge-mini {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
  border-radius: 10px;
  color: var(--ink);
  text-align: center;
}

.badge-mini > span:last-child {
  display: none;
}

.badge-mini.is-locked {
  color: #999b94;
}

.badge-mini.is-new {
  background: #fff0ad;
  box-shadow: inset 0 0 0 2px #f2c84e;
  animation: badge-unlock-pop 600ms ease both;
}

.badge-mini.is-new::after {
  position: absolute;
  top: 3px;
  right: 5px;
  width: 7px;
  height: 7px;
  background: var(--coral);
  border: 2px solid #fff;
  border-radius: 50%;
  content: '';
}

.badge-visual {
  --badge-color: #c48716;
  --badge-bg: #fff0b9;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  color: var(--badge-color);
  background: var(--badge-bg);
  border: 2px solid color-mix(in srgb, var(--badge-color) 35%, #fff);
  border-radius: 16px 16px 19px 19px;
  box-shadow: 0 5px 10px color-mix(in srgb, var(--badge-color) 16%, transparent);
}

.badge-visual svg {
  width: 25px;
  height: 25px;
}

.badge-mini .badge-visual {
  width: 34px;
  height: 34px;
  border-width: 1.5px;
  border-radius: 11px 11px 14px 14px;
  box-shadow: 0 3px 7px color-mix(in srgb, var(--badge-color) 14%, transparent);
}

.badge-mini .badge-visual svg {
  width: 21px;
  height: 21px;
}

.badge-visual--coral {
  --badge-color: #df654f;
  --badge-bg: #ffe5dc;
}

.badge-visual--teal {
  --badge-color: #328b79;
  --badge-bg: #ddf3eb;
}

.badge-visual--purple {
  --badge-color: #7862bc;
  --badge-bg: #ece6fb;
}

.badge-visual--green {
  --badge-color: #4c9660;
  --badge-bg: #e4f4df;
}

.badge-visual--orange {
  --badge-color: #d67c24;
  --badge-bg: #ffebce;
}

.badge-visual--blue {
  --badge-color: #4c86b8;
  --badge-bg: #e1eff9;
}

.badge-visual--pink {
  --badge-color: #d95f8b;
  --badge-bg: #fbe3ee;
}

.badge-visual--yellow {
  --badge-color: #a77a08;
  --badge-bg: #fff1b8;
}

.badge-visual--mint {
  --badge-color: #268b79;
  --badge-bg: #ddf6ef;
}

.badge-visual--indigo {
  --badge-color: #5d6fc0;
  --badge-bg: #e5e9fb;
}

.badge-visual--rose {
  --badge-color: #d85767;
  --badge-bg: #fbe4e8;
}

.badge-visual--cyan {
  --badge-color: #288ca1;
  --badge-bg: #def3f6;
}

.is-locked .badge-visual {
  color: #a5a69f;
  background: #efeee8;
  border-color: #deddd5;
  box-shadow: none;
  filter: grayscale(1);
}

.achievement-next {
  margin-top: 7px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(224, 196, 126, 0.55);
  border-radius: 10px;
}

.achievement-next-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #776642;
  font-size: 10px;
  font-weight: 800;
}

.achievement-next-copy strong {
  flex: 0 0 auto;
  color: #9b7118;
  font-size: 10px;
}

.achievement-progress {
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  background: #eee5cf;
  border-radius: 999px;
}

.achievement-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), #edae3e);
  border-radius: inherit;
  transition: width 300ms ease;
}

.achievement-body {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 22px;
  width: 100%;
  max-width: 900px;
  min-height: 0;
  margin: 0 auto;
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 34px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.achievement-section-title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.badge-detail {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 108px;
  align-items: center;
  gap: 13px;
  padding: 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 6px 16px rgba(91, 72, 43, 0.06);
}

.badge-detail .badge-visual {
  width: 58px;
  height: 58px;
}

.badge-detail .badge-visual svg {
  width: 29px;
  height: 29px;
}

.badge-detail-copy {
  min-width: 0;
}

.badge-detail-copy h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.badge-detail-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.badge-detail-progress {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  color: #7e6b45;
  background: #f7f1e3;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 900;
}

.badge-detail.is-locked {
  background: #faf8f1;
  box-shadow: none;
}

.badge-detail.is-locked .badge-detail-copy h3 {
  color: #737a75;
}

.badge-detail.is-new {
  background: #fff9df;
  border-color: #eac34f;
  box-shadow: 0 7px 20px rgba(204, 157, 38, 0.16);
}

.badge-detail.is-new::after {
  position: absolute;
  top: 8px;
  right: 9px;
  padding: 2px 6px;
  color: #fff;
  background: var(--coral);
  border-radius: 999px;
  content: '新解锁';
  font-size: 9px;
  font-weight: 900;
}

.badge-detail.is-new .badge-detail-copy {
  padding-right: 38px;
}

.achievement-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 20px;
  color: var(--muted);
  background: rgba(255, 254, 249, 0.75);
  border: 1px dashed var(--line);
  border-radius: 16px;
  font-size: 13px;
  text-align: center;
}

@keyframes badge-unlock-pop {
  0% { transform: scale(0.82); }
  65% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@media (max-width: 699px) {
  .achievement-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .achievement-card {
    padding: 10px 11px;
  }

  .achievement-preview {
    grid-template-columns: repeat(12, 34px);
    gap: 3px;
    margin-top: 7px;
  }

  .achievement-next-copy {
    font-size: 10px;
  }

  .achievement-body {
    gap: 18px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .badge-detail {
    min-height: 96px;
    padding: 13px;
  }

  .badge-detail .badge-visual {
    width: 50px;
    height: 50px;
  }
}

/* ---------- 看图说词 ---------- */

.say-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.say-panel[hidden] {
  display: none;
}

.say-mic-button {
  position: relative;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease;
}

.say-mic-button svg {
  width: 32px;
  height: 32px;
  position: relative;
  z-index: 1;
}

.say-mic-button:active {
  transform: scale(0.94);
}

.say-mic-button.is-listening {
  background: var(--coral);
}

.say-mic-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--coral);
  opacity: 0;
  pointer-events: none;
}

.say-mic-button.is-listening .say-mic-ring {
  animation: say-pulse 1.2s ease-out infinite;
}

@keyframes say-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

.say-feedback {
  margin: 0;
  min-height: 22px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.say-feedback.is-success {
  color: #2e9e5b;
}

.say-feedback.is-retry {
  color: var(--coral);
}

.say-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.say-skip-button,
.say-manual-button,
.say-play-button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(91, 72, 43, 0.08);
}

.say-manual-button {
  background: var(--teal-soft);
  border-color: transparent;
  color: var(--teal);
}

.say-play-button {
  background: #fff;
  border-color: var(--teal);
  color: var(--teal);
}

.say-skip-button:active,
.say-manual-button:active,
.say-play-button:active {
  transform: scale(0.96);
}

.say-manual-button[hidden],
.say-play-button[hidden] {
  display: none;
}

/* ---------- 主页留言板 ---------- */

.message-board {
  /* 与上方主题卡片/综合测试卡同宽；flex 列布局下左右 auto 外边距会让卡片收缩，这里改为占满整行 */
  width: 100%;
  box-sizing: border-box;
  margin: 18px 0 0;
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.message-board-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--ink);
  text-align: center;
}

.message-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'name action'
    'text text';
  align-items: end;
  gap: 10px 12px;
}

.message-field--name {
  grid-area: name;
}

.message-field--text {
  grid-area: text;
}

.message-field {
  display: grid;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.message-field input,
.message-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.message-field input:disabled {
  background: #f3efe4;
  color: var(--muted);
}

.message-submit {
  grid-area: action;
  justify-self: end;
  border: 0;
  border-radius: 999px;
  padding: 9px 22px;
  background: var(--coral);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.message-submit:disabled {
  opacity: 0.6;
}

.message-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.message-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 10px 0;
}

.message-item {
  background: #faf6ec;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}

.message-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.message-item-head strong {
  font-size: 0.85rem;
  color: var(--ink);
}

.message-item-time {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.message-item-body {
  margin: 3px 0 0;
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.5;
  word-break: break-word;
}

.message-item-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.message-reply-toggle {
  border: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--coral);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.message-replies {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 0 0 10px;
  border-left: 2px solid var(--line);
  display: grid;
  gap: 7px;
}

.message-reply-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.message-reply-head strong {
  font-size: 0.78rem;
  color: var(--ink);
}

.message-reply-time {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.message-reply-body {
  margin: 2px 0 0;
  font-size: 0.84rem;
  color: var(--ink);
  line-height: 1.45;
  word-break: break-word;
}

.message-reply-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.message-reply-form[hidden] {
  display: none;
}

.message-reply-form input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}

.message-reply-submit {
  border: 0;
  border-radius: 999px;
  padding: 7px 16px;
  background: var(--coral);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.message-reply-submit:disabled {
  opacity: 0.6;
}

.message-board-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.message-board-note[hidden] {
  display: none;
}

/* 手机端：昵称、留言、按钮改为单列纵向排列 */
@media (max-width: 699px) {
  .message-board {
    padding: 14px;
  }

  .message-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      'name'
      'text'
      'action';
    gap: 8px;
  }

  .message-submit {
    justify-self: stretch;
    padding: 10px 22px;
  }
}

/* ---------- 学习报告 ---------- */

.report-body {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 6px 16px calc(env(safe-area-inset-bottom, 0px) + 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-card {
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.report-card-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--ink);
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.report-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 12px;
  background: #faf6ec;
  text-align: center;
}

.report-kpi strong {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--teal);
}

.report-kpi span {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.report-trend {
  margin: 10px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

.report-weeks {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-weeks li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #faf6ec;
  font-size: 0.85rem;
}

.report-week-name {
  color: var(--ink);
  font-weight: 700;
}

.report-week-value {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.report-weak {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-weak li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.report-weak-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-weak-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee9dc;
}

.report-weak-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
}

.report-weak-bar i.is-low {
  background: var(--coral);
}

.report-weak-rate {
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.report-tip {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--teal-soft);
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.5;
}

.report-empty {
  margin: 24px auto;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* iOS Safari 在聚焦字号小于 16px 的输入框时会自动放大整个页面；
   登录后页面看起来“稍微放大”通常就是这里触发的。 */
@media (max-width: 699px), (hover: none) and (pointer: coarse) {
  .auth-field input,
  .message-field input,
  .message-field textarea,
  .message-reply-form input {
    font-size: 16px;
  }
}

/* ---------- 做游戏 ---------- */

.game-view,
.parent-view {
  max-width: 980px;
  margin: 0 auto;
  padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.game-selector {
  padding: 14px 0 20px;
}

.game-selector-title {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}

.game-card-row {
  display: grid;
  gap: 12px;
}

.game-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(91, 72, 43, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.game-card:active {
  transform: scale(0.97);
}

.game-card:hover {
  box-shadow: 0 8px 20px rgba(91, 72, 43, 0.1);
}

.game-card-emoji {
  font-size: 32px;
  line-height: 1;
  flex: 0 0 auto;
}

.game-card strong {
  display: block;
  font-size: 1.1rem;
}

.game-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* --- 配对翻翻乐 --- */

.match-game {
  padding: 10px 0 20px;
}

.match-hud {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
}

.match-timer,
.match-progress {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
  padding: 5px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.match-timer.is-urgent {
  color: #d44;
  border-color: #f8b6b6;
  background: #fff3f3;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  perspective: 800px;
}

@media (max-width: 380px) {
  .match-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.match-card {
  --cat-color: var(--teal);
  aspect-ratio: 1 / 1;
  perspective: 800px;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: transparent;
}

.match-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}

.match-card.is-flipped .match-card-inner,
.match-card.is-matched .match-card-inner {
  transform: rotateY(180deg);
}

.match-card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  backface-visibility: hidden;
  border: 2px solid var(--line);
  font-weight: 900;
}

.match-card-face--back {
  background: #eee9dc;
  font-size: 28px;
  color: #b0a894;
}

.match-card-face--front {
  transform: rotateY(180deg);
  background: color-mix(in srgb, var(--cat-color) 16%, #fff);
  border-color: color-mix(in srgb, var(--cat-color) 50%, var(--line));
  color: color-mix(in srgb, var(--cat-color) 80%, #2b3a35);
  font-size: clamp(16px, 3.5vw, 22px);
  text-transform: capitalize;
  padding: 4px;
  text-align: center;
}

.match-card.is-matched .match-card-face--front {
  background: #e3f5ec;
  border-color: #72c4a0;
  color: #2f7f61;
  box-shadow: 0 0 0 2px #72c4a0 inset;
}

.match-result {
  width: min(360px, 100%);
  margin: auto auto;
  text-align: center;
  padding: 20px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 18px;
}

.match-result .result-button {
  flex: none;
  min-width: 140px;
  width: auto;
}

.match-result p {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

/* --- 元音填空拼写 --- */

.vowel-game {
  padding: 10px 0 20px;
}

.vowel-hud {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
  font-weight: 800;
  color: var(--ink);
}

.vowel-stage {
  text-align: center;
  padding: 18px 14px 12px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  margin-bottom: 16px;
}

.vowel-image {
  display: block;
  width: min(62vw, 200px);
  aspect-ratio: 1 / 1;
  margin: 0 auto 12px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(79, 140, 220, 0.18);
  background: #fff;
}

.vowel-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 8px 20px;
  border-radius: 999px;
  border: 0;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
}

.vowel-display {
  font-size: clamp(32px, 9vw, 48px);
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--ink);
  font-family: 'Comic Sans MS', 'Quicksand', system-ui, sans-serif;
}

.vowel-display .vowel-blank {
  color: #d44;
  border-bottom: 3px solid #d44;
  display: inline-block;
  min-width: 32px;
}

.vowel-display.is-correct .vowel-blank {
  color: #2f7f61;
  border-bottom-color: #2f7f61;
  animation: pop-correct 0.4s ease;
}

.vowel-display.is-wrong .vowel-blank {
  animation: shake 0.4s ease;
}

@keyframes pop-correct {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.vowel-feedback {
  margin-top: 10px;
  font-weight: 800;
  font-size: 1rem;
  min-height: 1.4em;
}

.vowel-feedback.is-success { color: #2f7f61; }
.vowel-feedback.is-wrong   { color: #d44; }

.vowel-choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 380px) {
  .vowel-choices {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
}

.vowel-choice {
  aspect-ratio: 1 / 1;
  border: 2px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  font-size: clamp(22px, 6vw, 32px);
  font-weight: 900;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
  font-family: 'Comic Sans MS', 'Quicksand', system-ui, sans-serif;
  text-transform: uppercase;
  transition: transform 0.12s ease, background 0.12s ease;
}

.vowel-choice:active {
  transform: scale(0.95);
}

.vowel-choice:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vowel-choice.is-correct {
  background: #e3f5ec;
  border-color: #72c4a0;
  color: #2f7f61;
}

.vowel-choice.is-wrong {
  background: #fff3f3;
  border-color: #f8b6b6;
  color: #d44;
}

.vowel-result {
  width: min(360px, 100%);
  margin: auto auto;
  text-align: center;
  padding: 20px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 18px;
}

.vowel-result .result-button {
  flex: none;
  min-width: 140px;
  width: auto;
}

.vowel-result p {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

/* ---------- 家长点读 ---------- */

.parent-selector {
  padding: 14px 0 20px;
}

.parent-selector-title {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}

.parent-card-row {
  display: grid;
  gap: 12px;
}

.parent-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(91, 72, 43, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.parent-card:active { transform: scale(0.97); }

.parent-card-emoji {
  font-size: 32px;
  line-height: 1;
  flex: 0 0 auto;
}

.parent-card strong {
  display: block;
  font-size: 1.05rem;
}

.parent-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.parent-hud {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
  font-weight: 800;
}

/* --- 模式 A --- */

.parent-mode {
  padding: 6px 0 20px;
}

.parent-zh-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff8eb, #fff3e2);
  border: 1.5px solid #f3dca8;
  border-radius: 18px;
}

.parent-zh-prompt p {
  margin: 0;
  font-size: 0.95rem;
}

.parent-zh-word {
  color: #b45f16;
  font-size: 1.15rem;
}

.parent-speak-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-weight: 800;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.parent-instruction {
  margin: 4px 0 12px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

.parent-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.parent-option {
  position: relative;
  border: 2px solid var(--line);
  background: var(--paper);
  border-radius: 18px;
  padding: 6px;
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.parent-option img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: #f5f2e8;
}

.parent-option[data-state="correct"] {
  border-color: #72c4a0;
  background: #e3f5ec;
}

.parent-option[data-state="wrong"] {
  border-color: #f8b6b6;
  background: #fff3f3;
}

.parent-option:disabled {
  cursor: default;
}

.parent-option:active:not(:disabled) {
  transform: scale(0.97);
}

.parent-feedback {
  margin-top: 12px;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  min-height: 1.4em;
}

.parent-feedback.is-success { color: #2f7f61; }
.parent-feedback.is-wrong   { color: #d44; }

/* --- 模式 B --- */

.parent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.parent-grid-item {
  display: block;
  width: 100%;
  border: 2px solid var(--line);
  background: var(--paper);
  border-radius: 18px;
  padding: 6px;
  font: inherit;
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: border-color 0.15s ease;
}

.parent-grid-item.is-selected {
  border-color: var(--coral);
  box-shadow: 0 0 0 2px #ffece6 inset;
}

.parent-grid-item.is-done {
  border-color: #72c4a0;
  background: #e3f5ec;
}

.parent-grid-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: #f5f2e8;
}

.parent-grid-item .play-on-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 6px;
  width: 100%;
  border: 0;
  padding: 5px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.parent-hint {
  margin: 0 0 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.parent-next-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 4px auto 0;
}

.parent-judgement {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 14px 0;
}

.parent-result {
  width: min(360px, 100%);
  margin: auto auto;
  text-align: center;
  padding: 20px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 18px;
}

.parent-result .result-button {
  flex: none;
  min-width: 140px;
  width: auto;
}

.parent-result p {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}
