/* ==========================================================================
   📱 豌豆生物特工局：独立双端 UI 架构样式表 (Desktop/Tablet UI vs Dedicated Mobile UI)
   - >= 768px : 电脑与平板宽屏工作台 UI (保持原有大屏布局)
   - <  768px : 手机端独立原生 App 级排版 (严整网格对位 · 主题鲜明 · 底部固定导航)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 电脑与平板端 (>= 768px)：隐藏所有手机专属组件，美化讲义弹窗顶栏
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .mobile-app-header,
  .mobile-mode-pills,
  .mobile-hero-only,
  .mobile-bottom-nav,
  .mob-only-lbl {
    display: none !important;
  }

  .handout-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }
  .handout-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .handout-header-top .handout-close-btn {
    order: 99;
  }
  .handout-pages-row,
  .handout-dl-row {
    display: flex;
    align-items: center;
    gap: 8px;
  }
}

/* --------------------------------------------------------------------------
   2. 手机端独立 UI (< 768px)：完全接管布局，消除一切参差不齐与折行错位
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* 隐藏电脑/平板端顶栏、大卡片导航与宽屏展台 */
  .hud-bar,
  .mode-nav,
  .desktop-hero-only,
  .desk-only-lbl {
    display: none !important;
  }

  .app-shell {
    padding: 8px 10px 84px !important;
    max-width: 100% !important;
  }

  /* ================= A. 手机专属顶部主题与特工状态栏 ================= */
  .mobile-app-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--hud-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 2px solid var(--border-strong);
    border-radius: 16px;
    padding: 10px 11px;
    box-shadow: var(--shadow-card);
    margin-bottom: 10px;
  }

  /* 第一行：鲜明主题标识 + 右侧快捷工具 */
  .m-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
  }

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

  .m-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #22c55e, #15803d);
    border: 1.5px solid var(--accent-pea);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.35);
  }

  .m-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
  }

  .m-brand-title {
    font-size: 0.98rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    white-space: nowrap;
  }

  .m-brand-sub {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--accent-cyan);
    white-space: nowrap;
  }

  .m-top-tools {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
  }

  .m-tool-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    height: 30px;
    padding: 0 8px;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
  }

  /* 第二行：左侧特工身份胶囊 + 右侧 3 等分数据舱 */
  .m-status-row {
    display: grid;
    grid-template-columns: 1.12fr 1.48fr;
    gap: 8px;
    align-items: stretch;
  }

  .m-agent-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: 12px;
    padding: 5px 8px 5px 6px;
    color: var(--text-primary);
    text-align: left;
    min-width: 0;
    width: 100%;
  }

  .m-avatar-wrap {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--accent-pea);
    flex-shrink: 0;
    background: #000;
  }

  .m-avatar-wrap img#m-hud-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }

  .m-avatar-wrap img#m-hud-pet {
    position: absolute;
    right: -4px;
    bottom: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
  }

  .m-agent-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.22;
  }

  .m-agent-name {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-agent-status {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-amber);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .m-stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.15;
    text-align: center;
  }

  .m-stat-box.coin {
    background: rgba(250, 204, 21, 0.12);
    border-color: rgba(250, 204, 21, 0.4);
  }

  .m-stat-val {
    font-family: var(--font-mono);
    font-size: 0.84rem;
    font-weight: 900;
  }

  .m-stat-box.coin .m-stat-val { color: var(--accent-amber); }
  .m-stat-box.amber .m-stat-val { color: var(--accent-sakura); }
  .m-stat-box.cyan .m-stat-val { color: var(--accent-cyan); }

  .m-stat-lbl {
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--text-secondary);
    white-space: nowrap;
  }

  /* ================= B. 手机专属顶部 4 列等宽模式切换栏 (变大 · 年轻化潮玩赛博风) ================= */
  .mobile-mode-pills {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 4px 0 14px;
    width: 100%;
  }

  .m-mode-pill {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(20, 16, 36, 0.75) 100%), var(--bg-panel);
    border: 2px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    min-height: 68px;
    padding: 9px 4px 8px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .m-mode-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.25);
  }

  .m-mode-pill:active {
    transform: translateY(1px) scale(0.97);
  }

  .m-pill-icon-wrap {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .m-pill-svg {
    width: 28px;
    height: 28px;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  }

  .m-pill-txt {
    font-size: 0.78rem;
    font-weight: 900;
    white-space: nowrap;
    letter-spacing: 0.4px;
    color: #cbd5e1;
    transition: color 0.18s ease, text-shadow 0.18s ease;
  }

  .m-pill-glow-bar {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 3px;
    border-radius: 3px;
    background: transparent;
    transition: all 0.22s ease;
  }

  /* 🎮 模式 1：闯关填空激活态 (薄荷极光绿) */
  .m-mode-pill.pill-campaign.active {
    background: linear-gradient(160deg, rgba(52, 211, 153, 0.24) 0%, rgba(6, 182, 212, 0.16) 100%), #151128;
    border-color: #34d399;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transform: translateY(-2px);
  }
  .m-mode-pill.pill-campaign.active .m-pill-txt {
    color: #34d399;
    text-shadow: 0 0 12px rgba(52, 211, 153, 0.6);
  }
  .m-mode-pill.pill-campaign.active .m-pill-icon-wrap {
    transform: scale(1.12);
  }
  .m-mode-pill.pill-campaign.active .m-pill-glow-bar {
    width: 22px;
    background: #34d399;
    box-shadow: 0 0 10px #34d399;
  }

  /* 🔬 模式 2：结构解剖激活态 (全息电光蓝紫) */
  .m-mode-pill.pill-labs.active {
    background: linear-gradient(160deg, rgba(56, 189, 248, 0.24) 0%, rgba(168, 85, 247, 0.18) 100%), #151128;
    border-color: #38bdf8;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transform: translateY(-2px);
  }
  .m-mode-pill.pill-labs.active .m-pill-txt {
    color: #38bdf8;
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
  }
  .m-mode-pill.pill-labs.active .m-pill-icon-wrap {
    transform: scale(1.12);
  }
  .m-mode-pill.pill-labs.active .m-pill-glow-bar {
    width: 22px;
    background: #38bdf8;
    box-shadow: 0 0 10px #38bdf8;
  }

  /* ⚡ 模式 3：极速风暴激活态 (电芒金橙) */
  .m-mode-pill.pill-coding.active {
    background: linear-gradient(160deg, rgba(250, 204, 21, 0.25) 0%, rgba(249, 115, 22, 0.18) 100%), #151128;
    border-color: #facc15;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transform: translateY(-2px);
  }
  .m-mode-pill.pill-coding.active .m-pill-txt {
    color: #facc15;
    text-shadow: 0 0 12px rgba(250, 204, 21, 0.6);
  }
  .m-mode-pill.pill-coding.active .m-pill-icon-wrap {
    transform: scale(1.12);
  }
  .m-mode-pill.pill-coding.active .m-pill-glow-bar {
    width: 22px;
    background: #facc15;
    box-shadow: 0 0 10px #facc15;
  }

  /* 📋 模式 4：讲义默写激活态 (星芒樱粉) */
  .m-mode-pill.pill-syllabus.active {
    background: linear-gradient(160deg, rgba(244, 114, 182, 0.25) 0%, rgba(251, 113, 133, 0.18) 100%), #151128;
    border-color: #fb7185;
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transform: translateY(-2px);
  }
  .m-mode-pill.pill-syllabus.active .m-pill-txt {
    color: #fb7185;
    text-shadow: 0 0 12px rgba(251, 113, 133, 0.6);
  }
  .m-mode-pill.pill-syllabus.active .m-pill-icon-wrap {
    transform: scale(1.12);
  }
  .m-mode-pill.pill-syllabus.active .m-pill-glow-bar {
    width: 22px;
    background: #fb7185;
    box-shadow: 0 0 10px #fb7185;
  }

  /* ================= C. 手机专属特工名片横卡 (Mobile Hero Bento Card) ================= */
  .mobile-hero-card {
    background: linear-gradient(135deg, rgba(255, 126, 182, 0.12) 0%, rgba(192, 132, 252, 0.12) 50%, rgba(56, 189, 248, 0.12) 100%),
                var(--bg-panel);
    border: 2px solid var(--border-strong);
    border-radius: 18px;
    padding: 11px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-card);
  }

  .m-hero-main {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
    align-items: stretch;
  }

  .m-hero-stage {
    position: relative;
    width: 100px;
    height: 142px;
    border-radius: 14px;
    background: radial-gradient(circle at 50% 30%, rgba(255, 126, 182, 0.28), rgba(19, 17, 38, 0.95)),
                linear-gradient(180deg, #271f4a 0%, #141129 100%);
    border: 2px solid var(--accent-sakura);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
  }

  :root[data-theme="harajuku"] .m-hero-stage {
    background: radial-gradient(circle at 50% 30%, rgba(255, 182, 219, 0.5), rgba(233, 213, 255, 0.92)),
                linear-gradient(180deg, #fce7f3 0%, #ede9fe 100%);
    border-color: #ec4899;
  }

  .m-hero-char-img {
    height: 95%;
    width: auto;
    object-fit: contain;
    object-position: bottom center;
    z-index: 2;
  }

  .m-hero-pet-img {
    position: absolute;
    right: 4px;
    bottom: 20px;
    width: 36px;
    height: 36px;
    z-index: 3;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
  }

  .m-hero-stage-pill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(19, 17, 38, 0.86);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 900;
    text-align: center;
    padding: 2px 0;
    z-index: 4;
  }

  .m-hero-right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    gap: 6px;
  }

  .m-hero-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }

  .m-hero-nick {
    font-size: 0.98rem;
    font-weight: 900;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-hero-sync {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .m-hero-sync.is-online {
    background: var(--accent-pea-dim);
    color: var(--accent-pea);
    border: 1px solid var(--accent-pea);
  }

  .m-hero-sync.is-guest {
    background: var(--accent-amber-dim);
    color: var(--accent-amber);
    border: 1px solid var(--accent-amber);
  }

  /* 2x2 严整对齐装备网格 */
  .m-equip-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }

  .m-equip-cell {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }

  .m-eq-ic {
    font-size: 0.76rem;
    flex-shrink: 0;
  }

  .m-eq-tx {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-hero-xp {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    padding: 5px 8px;
  }

  .m-hero-xp-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
  }

  .m-hero-xp-meta b {
    color: var(--accent-pea);
    font-family: var(--font-mono);
  }

  .m-hero-xp .xp-bar-track {
    height: 8px;
  }

  /* 底部 3 等宽操作按钮 */
  .m-hero-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-top: 9px;
  }

  .m-act-btn {
    width: 100%;
    padding: 8px 4px !important;
    font-size: 0.76rem !important;
    border-radius: 11px !important;
    text-align: center;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ================= D. 闯关战役列表与顶部状态条对齐 ================= */
  .campaign-top-bar {
    padding: 9px 12px !important;
    margin-bottom: 10px !important;
    border-radius: 12px !important;
  }

  /* 手机端讲义入口已在上方 3 等分按钮中，隐藏此处重复按钮保持整洁 */
  .campaign-top-bar > button.btn-secondary {
    display: none !important;
  }

  .campaign-top-bar > div {
    font-size: 0.76rem !important;
    line-height: 1.4;
    width: 100%;
  }

  .revenge-banner {
    width: 100%;
    justify-content: space-between;
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
  }

  .chapters-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .chapter-card {
    padding: 14px !important;
    border-radius: 16px !important;
    gap: 10px !important;
  }

  .chapter-title {
    font-size: 1rem !important;
    margin-top: 5px !important;
  }

  .kp-pill {
    font-size: 0.7rem !important;
    padding: 2px 7px !important;
  }

  /* ================= E. 手机端做题舱 (Battle Arena) 严整网格化 ================= */
  .battle-arena {
    padding: 12px !important;
    border-radius: 16px !important;
  }

  .arena-top {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    padding-bottom: 10px !important;
    margin-bottom: 10px !important;
  }

  .arena-top > div:first-child {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-wrap: nowrap !important;
    min-width: 0;
    flex: 1;
  }

  .arena-top > div:last-child {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .arena-top .btn-secondary {
    padding: 5px 8px !important;
    font-size: 0.72rem !important;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .q-type-tag {
    font-size: 0.68rem !important;
    padding: 3px 6px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 112px;
  }

  .combo-badge {
    font-size: 0.76rem !important;
    padding: 3px 9px !important;
    white-space: nowrap;
  }

  .hint-toggle-btn {
    font-size: 0.78rem !important;
    padding: 8px 10px !important;
    margin-bottom: 10px !important;
  }

  .question-stem {
    font-size: 0.98rem !important;
    line-height: 1.55 !important;
    padding: 11px 12px !important;
    margin-bottom: 12px !important;
  }

  .cloze-work-area {
    padding: 11px !important;
    margin-bottom: 10px !important;
  }

  /* 6列整齐矩阵键盘，告别参差不齐 */
  .char-matrix-grid {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 6px !important;
    margin-bottom: 12px !important;
  }

  .char-tile {
    width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    padding: 0 !important;
    font-size: 1.12rem !important;
    border-radius: 10px !important;
  }

  /* 单行打字直输栏：输入框与提交按钮并排对齐 */
  .direct-type-bar {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 8px !important;
    padding-top: 10px !important;
  }

  .direct-type-bar > span {
    display: none !important;
  }

  .direct-type-input {
    min-width: 0 !important;
    width: 100% !important;
    padding: 9px 11px !important;
    font-size: 0.88rem !important;
  }

  .direct-type-bar > .btn-primary {
    padding: 9px 14px !important;
    font-size: 0.84rem !important;
    white-space: nowrap;
  }

  /* 2列等宽词库网格 */
  .word-bank-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .word-tile-btn {
    width: 100% !important;
    padding: 10px 8px !important;
    font-size: 0.86rem !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1.25 !important;
  }

  /* ================= F. 结构解剖室 (#view-labs) 严整3列化 ================= */
  #view-labs .lab-subnav {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    overflow: visible !important;
    margin-bottom: 10px !important;
  }

  #view-labs .lab-tab-btn {
    width: 100% !important;
    padding: 8px 4px !important;
    font-size: 0.75rem !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  .part-buttons-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }

  .part-buttons-grid .part-btn {
    width: 100% !important;
    padding: 7px 4px !important;
    font-size: 0.74rem !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* ================= G. 极速风暴 (#view-coding) 2x2 对齐 ================= */
  #view-coding .lab-subnav {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    overflow: visible !important;
    margin-bottom: 10px !important;
  }

  #view-coding .lab-tab-btn {
    width: 100% !important;
    padding: 8px 6px !important;
    font-size: 0.76rem !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .coding-header {
    padding: 10px 12px !important;
    margin-bottom: 10px !important;
    border-radius: 14px !important;
  }

  .cipher-key-table {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  button.cipher-key-cell {
    min-height: 72px !important;
    padding: 8px !important;
  }

  .cipher-symbol {
    font-size: 1.35rem !important;
  }

  .cipher-label {
    font-size: 0.85rem !important;
  }

  /* ================= H. 4页讲义默写雷达 (#view-syllabus) 网格对齐 ================= */
  .syllabus-controls {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .page-filter-bar {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  .page-filter-bar .lab-tab-btn:first-child {
    grid-column: 1 / -1;
  }

  .page-filter-bar .lab-tab-btn {
    width: 100% !important;
    padding: 7px 4px !important;
    font-size: 0.78rem !important;
    text-align: center !important;
  }

  .syllabus-controls > .btn-primary {
    width: 100% !important;
    padding: 10px !important;
    font-size: 0.84rem !important;
  }

  .syllabus-page-block {
    padding: 12px !important;
    border-radius: 16px !important;
    margin-bottom: 12px !important;
  }

  .syllabus-page-title {
    font-size: 0.94rem !important;
  }

  /* ================= I. 手机端半屏抽屉弹窗 (Modals) 紧凑化 ================= */
  .modal-backdrop {
    padding: 8px !important;
    align-items: flex-end !important;
  }

  .modal-content {
    max-height: 92vh !important;
    border-radius: 20px 20px 14px 14px !important;
  }

  .modal-header {
    padding: 10px 12px !important;
    gap: 8px !important;
  }

  .modal-header > div > span {
    display: none !important;
  }

  .modal-header b {
    font-size: 0.98rem !important;
    white-space: nowrap !important;
  }

  .modal-header > button,
  .handout-close-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 5px 10px !important;
    font-size: 0.78rem !important;
  }

  .modal-body {
    padding: 10px 12px !important;
  }

  /* 换装试衣间：手机端顶部横向紧凑预览台，边选边看全身变化 */
  .wardrobe-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 0 !important;
  }

  .character-stage-wrapper {
    display: grid !important;
    grid-template-columns: 100px 1fr !important;
    gap: 10px !important;
    align-items: center !important;
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: 14px;
    padding: 8px;
  }

  .character-stage {
    width: 100px !important;
    max-width: 100px !important;
    height: 142px !important;
    border-radius: 11px !important;
  }

  .character-stage .stage-accessory-badge {
    display: none !important;
  }

  .stage-pet-companion {
    width: 36px !important;
    height: 36px !important;
    right: 4px !important;
    bottom: 6px !important;
  }

  .stage-character-card {
    margin-top: 0 !important;
    max-width: none !important;
    background: transparent !important;
    border: none !important;
    padding: 2px 4px !important;
    text-align: left !important;
  }

  .stage-character-name {
    font-size: 0.92rem !important;
    margin-bottom: 4px !important;
  }

  .stage-character-desc {
    font-size: 0.72rem !important;
    line-height: 1.4 !important;
  }

  .gender-switch-bar {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  .gender-btn {
    padding: 7px 6px !important;
    font-size: 0.8rem !important;
  }

  .category-tabs {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4px !important;
    padding-bottom: 6px !important;
    overflow: visible !important;
  }

  .cat-tab-btn {
    min-width: 0 !important;
    width: 100% !important;
    padding: 6px 2px !important;
    font-size: 0.68rem !important;
    text-align: center !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .outfit-series-bar:not([style*="none"]) {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 5px !important;
  }

  .series-pill-btn {
    min-width: 0 !important;
    width: 100% !important;
    padding: 5px 2px !important;
    font-size: 0.66rem !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .items-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 7px !important;
    max-height: 30vh !important;
  }

  .item-card {
    padding: 7px 4px !important;
  }

  .item-card-name {
    font-size: 0.74rem !important;
  }

  .wardrobe-action-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 10px !important;
    margin-top: 2px !important;
    gap: 8px !important;
  }

  .wallet-info {
    font-size: 0.78rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .wallet-info > span:first-child {
    display: none !important;
  }

  .wallet-info span.coins-num {
    font-size: 1rem !important;
  }

  .action-btn-group {
    flex: 1 !important;
    display: flex !important;
    justify-content: flex-end !important;
  }

  .btn-save-outfit,
  .btn-buy-item {
    width: 100% !important;
    padding: 8px 10px !important;
    font-size: 0.8rem !important;
    white-space: nowrap !important;
  }

  /* 4页讲义弹窗顶栏：3行严整网格 */
  .handout-modal-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 7px !important;
  }

  .handout-header-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .handout-pages-row {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }

  .handout-pages-row .part-btn {
    width: 100% !important;
    padding: 6px 0 !important;
    text-align: center !important;
    font-size: 0.78rem !important;
  }

  .handout-dl-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  .handout-dl-row a {
    width: 100% !important;
    font-size: 0.74rem !important;
    padding: 7px 4px !important;
    white-space: nowrap !important;
  }

  /* ================= J. 手机端底部固定五栏原生导航 (Mobile Bottom Nav) ================= */
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    background: var(--hud-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 2px solid var(--border-strong);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.45);
  }

  .m-nav-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border-radius: 10px;
    cursor: pointer;
  }

  .m-nav-icon {
    font-size: 1.15rem;
    line-height: 1;
  }

  .m-nav-lbl {
    font-size: 0.65rem;
    font-weight: 900;
    white-space: nowrap;
  }

  .m-nav-item.active {
    color: var(--accent-pea);
    background: var(--accent-pea-dim);
  }

  .m-nav-item.m-nav-shop {
    color: var(--accent-sakura);
  }

  /* ================= K. 6大游戏化新模块手机端严整适配 (< 768px) ================= */
  .daily-quests-panel {
    padding: 10px 11px !important;
    border-radius: 16px !important;
    margin-bottom: 10px !important;
  }

  .daily-quests-header {
    gap: 6px !important;
    margin-bottom: 8px !important;
  }

  .dq-title {
    font-size: 0.84rem !important;
  }

  .dq-streak-pill,
  .dq-chest-pill {
    font-size: 0.68rem !important;
    padding: 2px 8px !important;
  }

  .daily-quests-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }

  .dq-card {
    padding: 7px 6px !important;
    border-radius: 10px !important;
    gap: 4px !important;
  }

  .dq-card-top {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
  }

  .dq-name {
    font-size: 0.68rem !important;
    line-height: 1.25 !important;
  }

  .dq-reward {
    font-size: 0.66rem !important;
  }

  .dq-meta {
    font-size: 0.62rem !important;
  }

  .dq-meta > span:last-child {
    display: none !important;
  }

  .lab-stage-toolbar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  .lab-view-toggle-btn,
  .lab-quiz-toggle-btn {
    width: 100% !important;
    padding: 7px 6px !important;
    font-size: 0.72rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .arena-top .q-type-tag {
    display: none !important;
  }

  .mastery-star-badge {
    font-size: 0.66rem !important;
    padding: 2px 6px !important;
    white-space: nowrap !important;
  }
}
