/* ===== 手机端适配（≤640px）===== */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .header-inner { padding: 10px 14px; gap: 8px; }
  .brand-mark { font-size: 0.7rem; padding: 3px 6px; }
  .brand-text { font-size: 0.88rem; }
  .header-stats { font-size: 0.74rem; }

  #mainContent { padding: 14px 12px calc(48px + env(safe-area-inset-bottom, 0px)); }

  .list-header { margin-bottom: 16px; }
  .list-title { font-size: 1.32rem; }
  .list-subtitle { font-size: 0.8rem; line-height: 1.5; }

  .lesson-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .lesson-card { padding: 10px 12px; min-width: 0; overflow: hidden; }
  .lesson-num { font-size: 0.72rem; }
  .lesson-title-en { font-size: 0.86rem; line-height: 1.3; overflow-wrap: anywhere; word-break: break-word; }
  .lesson-title-cn { font-size: 0.76rem; overflow-wrap: anywhere; }
  .lesson-type-tag { font-size: 0.66rem; padding: 1px 7px; }

  .list-subtitle { overflow-wrap: anywhere; word-break: break-word; }

  .lesson-header { margin-bottom: 14px; }
  .lesson-header h1 { font-size: 1.18rem; line-height: 1.4; }
  .subtitle { font-size: 0.9rem; }
  .back-link { font-size: 0.86rem; }

  /* 三个主 Tab：平分、不横向滚动 */
  .tab-nav { gap: 3px; margin-bottom: 14px; padding: 3px; }
  .tab-btn { min-width: 0; padding: 10px 4px; font-size: 0.86rem; }

  .reading-intro { font-size: 0.84rem; padding: 10px 12px; line-height: 1.6; }

  /* 语音工具条 */
  .tts-bar { gap: 8px 10px; padding: 10px 12px; }
  #ttsPlayAll { width: 100%; justify-content: center; min-height: 44px; }
  .tts-group { gap: 6px; }
  .tts-label { font-size: 0.8rem; }
  .tts-chip { padding: 8px 14px; font-size: 0.84rem; min-height: 38px; }

  .reading-list { margin: 0 -2px; }
  .reading-item { grid-template-columns: 24px 1fr; gap: 8px; padding: 13px 2px; }
  .reading-num { font-size: 0.78rem; }
  .reading-en { font-size: 1rem; }
  .reading-cn { font-size: 0.85rem; }
  .reading-note { font-size: 0.76rem; padding: 4px 8px; }
  .speak-btn { width: 36px; height: 36px; }

  .vocab-title { font-size: 0.95rem; }
  .vocab-grid { grid-template-columns: 1fr; gap: 6px; }
  .vocab-item { padding: 8px 10px; font-size: 0.88rem; }

  /* 练习模式切换条 */
  .mode-bar { gap: 6px; margin-bottom: 14px; }
  .mode-chip { flex: 1 1 0; padding: 10px 4px; font-size: 0.78rem; text-align: center; min-height: 42px;
    display: flex; align-items: center; justify-content: center; line-height: 1.25; }

  .quiz-info { gap: 8px; margin-bottom: 14px; font-size: 0.82rem; }
  .question-card { padding: 14px 13px; margin-bottom: 12px; }
  .question-head { gap: 9px; }
  .question-num { width: 24px; height: 24px; font-size: 0.8rem; }
  .question-text { font-size: 0.95rem; }

  /* 输入框 16px 防止 iOS 聚焦自动放大 */
  .fill-input { max-width: 100%; font-size: 16px; padding: 11px 13px; min-height: 44px; }

  .option-item { padding: 12px; min-height: 46px; gap: 9px; font-size: 0.92rem; }
  .option-letter { width: 26px; height: 26px; font-size: 0.82rem; flex: none; }

  .quiz-actions { flex-direction: column; gap: 8px; margin-top: 18px; }
  .quiz-actions .btn { width: 100%; padding: 13px; font-size: 0.95rem; min-height: 46px; }

  /* 听写工具条：按钮不再显示成大方块 */
  .dict-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .dict-toolbar .btn { width: 100%; min-height: 46px; justify-content: center; gap: 8px; }
  .dict-toolbar .btn svg { width: 18px; height: 18px; flex: none; }
  .dict-tip { font-size: 0.76rem; line-height: 1.5; }
  .dict-prompt { flex-wrap: wrap; }
  .dict-slow { min-height: 34px; }

  .mcq-part-title { font-size: 0.92rem; margin: 18px 0 10px; }

  /* 结果弹窗 */
  .quiz-result { width: calc(100% - 28px); padding: 26px 18px calc(22px + env(safe-area-inset-bottom, 0px)); }
  .quiz-score { font-size: 2rem; }

  /* 单词详解弹窗：接近全屏 */
  .word-modal-overlay { padding: 0; align-items: flex-end; }
  .word-modal { max-width: 100%; width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0;
    padding: 22px 18px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .wm-emoji { flex-basis: 62px; width: 62px; height: 62px; font-size: 32px; border-radius: 14px; }
  .wm-emoji-fallback { font-size: 28px; }
  .wm-word { font-size: 22px; }
  .wm-video-box iframe { height: 200px; }
  .wm-media-actions .btn-sm { flex: 1 1 auto; justify-content: center; text-align: center; min-height: 40px; }

  .progress-label { font-size: 0.8rem; }
}

/* 超窄屏（≤360px）：课程卡片单列 */
@media (max-width: 360px) {
  .lesson-grid { grid-template-columns: 1fr; }
  .mode-chip { font-size: 0.72rem; padding: 9px 2px; }
}

/* ===== 微信内置浏览器提示条 ===== */
.wx-tip {
  display: none;
  position: sticky;
  top: 0;
  z-index: 200;
  background: #2D6A8F;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 9px 38px 9px 14px;
}
.wx-tip.show { display: block; }
.wx-tip b { color: #FFE39E; }
.wx-tip-close {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: 0; background: transparent; color: #fff;
  font-size: 20px; line-height: 1; cursor: pointer;
}
@media (max-width: 640px) {
  .wx-tip { font-size: 0.76rem; padding: 8px 34px 8px 12px; }
}
