/* ===================================================
   泉城小课堂 · 手机版（App 化布局）
   - 底部 Tab 导航（首页 / 语文 / 数学 / 工具 / 试卷）
   - 顶部精简导航 + 错题本快捷入口
   - 大按钮、大点击区、单列卡片
   - 适配刘海屏（safe-area）
   =================================================== */

/* ---------- 底部 Tab（默认隐藏，手机端显示） ---------- */
.m-tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(255, 255, 255, .95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(34, 48, 60, .07);
}
.m-tab {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 7px 2px; border-radius: 14px; border: 0; background: transparent;
  color: var(--ink-3); font-size: 11px; font-weight: 700; line-height: 1.2;
  transition: .16s; text-align: center;
}
.m-tab .mi { font-size: 19px; line-height: 1; }
.m-tab:active { transform: scale(.94); }
.m-tab.on { color: var(--spring-dark); background: var(--spring-light); }

/* ---------- 顶部快捷按钮 ---------- */
.m-quick { display: none; margin-left: auto; gap: 8px; align-items: center; }
.m-quick a {
  position: relative; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 18px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-s);
}
.m-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--lotus); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; line-height: 1;
}
.m-quick a.on { background: var(--spring-light); border-color: var(--spring); }

/* ---------- 添加到主屏幕提示 ---------- */
.m-tip { display: none; }
@media (max-width: 720px) {
  .m-tip {
    display: flex; align-items: flex-start; gap: 10px;
    width: min(1160px, 92vw); margin: 12px auto 0;
    background: var(--sky-light); border: 1px solid #cfe0fb; color: #1a5fbf;
    border-radius: 14px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6;
  }
  .m-tip button {
    margin-left: auto; border: 0; background: transparent; color: #1a5fbf;
    font-size: 18px; line-height: 1; padding: 0 2px;
  }
}

/* ---------- 手机端样式 ---------- */
@media (max-width: 720px) {

  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  .m-tabbar { display: flex; }
  .m-quick { display: flex; }

  /* 顶部导航精简 */
  .nav-inner { height: 56px; gap: 8px; }
  .nav-links { display: none !important; }
  .brand { font-size: 17px; letter-spacing: 0; }
  .brand-badge { width: 32px; height: 32px; border-radius: 10px; font-size: 17px; }
  .brand small { display: none; }

  /* 首页 Hero */
  .hero { padding: 26px 0 22px; }
  .hero h1 { font-size: 27px; letter-spacing: -.3px; margin: 10px 0 10px; }
  .hero p.lead { font-size: 14.5px; margin-bottom: 18px; }
  .pill { font-size: 12px; padding: 6px 12px; }
  .hero-cta { gap: 10px; }
  .hero-cta .btn { flex: 1 1 46%; padding: 13px 12px; font-size: 14.5px; }
  .hero-card { padding: 16px; border-radius: 18px; }
  .hero-card .mini-row { padding: 9px 0; }

  .section { padding: 28px 0; }
  .section-head { margin-bottom: 16px; }
  .section-head h2 { font-size: 21px; }
  .section-head p { font-size: 13px; }

  .subject-grid { gap: 14px; }
  .subject-card { padding: 20px; border-radius: 18px; }
  .subject-card h3 { font-size: 19px; margin-top: 12px; }
  .subject-card .sc-sub { font-size: 12.5px; margin-bottom: 14px; }
  .subject-card .sc-ico { width: 46px; height: 46px; font-size: 23px; border-radius: 14px; }
  .chip { font-size: 11.5px; padding: 4px 9px; }

  .stat-bar { grid-template-columns: 1fr 1fr; padding: 18px 14px; gap: 16px 10px; }
  .stat-bar b { font-size: 22px; }

  .feature-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 14px; }
  .feature { padding: 18px; }
  .feature h4 { font-size: 15.5px; }

  /* 卡片与文字 */
  .card { padding: 16px; border-radius: 18px; margin-bottom: 14px; }
  .card > h3 { font-size: 17px; }
  .point-list li { padding: 11px 12px 11px 38px; font-size: 14px; border-radius: 13px; }
  .point-list li::before { left: 10px; top: 11px; width: 19px; height: 19px; font-size: 11px; }
  .lesson-item { padding: 11px 12px; }
  .lesson-item .li-body b { font-size: 14.5px; }

  /* 学科页 */
  .sub-hero { padding: 16px 0 12px; }
  .sub-hero-top { gap: 10px; }
  .sub-hero-top .sc-ico { width: 44px; height: 44px; font-size: 22px; border-radius: 14px; }
  .sub-hero h1 { font-size: 18.5px; }
  .sub-hero .sub-note { font-size: 12px; }
  .term-switch { margin-left: 0; width: 100%; justify-content: space-between; }
  .term-switch button { flex: 1; padding: 9px 0; }

  /* 单元导航横向滑动 */
  .unit-nav {
    flex-wrap: nowrap; overflow-x: auto; gap: 8px;
    margin: 10px 0 4px; padding-bottom: 6px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .unit-nav::-webkit-scrollbar { display: none; }
  .unit-nav button { flex: 0 0 auto; width: 44px; height: 44px; font-size: 15px; }

  /* 标签页（吸顶、可横滑） */
  .tabs {
    top: 56px; gap: 6px; padding: 10px 0 12px;
    margin-bottom: 4px; scroll-snap-type: x proximity;
  }
  .tabs button { padding: 9px 14px; font-size: 13px; scroll-snap-align: start; }

  /* 生字卡 */
  .word-grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
  .word-card { padding: 10px 6px 8px; border-radius: 13px; }
  .word-card .zi { font-size: 28px; }
  .word-card .py { opacity: 1; font-size: 11.5px; }   /* 手机上直接显示拼音，少点一次 */

  /* 乘法口诀表 */
  .mul-table { gap: 3px; }
  .mul-cell { font-size: 8px; border-radius: 6px; }

  /* 题目 */
  .q-toolbar { gap: 8px; }
  .q-toolbar .score { margin-left: 0; width: 100%; text-align: center; }
  .q-item { padding: 14px; border-radius: 14px; }
  .q-item .q-head { font-size: 14.5px; gap: 8px; }
  .q-opt { padding: 13px 12px; font-size: 15px; border-radius: 12px; min-height: 48px; }
  .q-opt .k { width: 24px; height: 24px; }
  .q-fill { flex-direction: column; align-items: stretch; }
  .q-fill input { flex: 1 1 auto; font-size: 16px; padding: 13px 14px; }
  .q-fill .btn { width: 100%; }
  .q-feedback { font-size: 13px; }

  /* 小工具 */
  .tool-tabs { gap: 8px; margin-bottom: 16px; }
  .tool-tabs button { flex: 1 1 46%; justify-content: center; padding: 11px 10px; font-size: 13.5px; }
  .tool-stage { padding: 20px 14px; border-radius: 18px; }
  .big-q { font-size: clamp(34px, 11vw, 46px); letter-spacing: 2px; margin: 10px 0 4px; }
  .answer-row { gap: 10px; }
  .answer-row input { width: 100%; max-width: 220px; font-size: 22px; padding: 12px; }
  .answer-row .btn { flex: 1 1 auto; padding: 13px 16px; }
  .tool-stat { gap: 8px; margin-top: 18px; padding-top: 16px; }
  .tool-stat div { min-width: 68px; }
  .tool-stat b { font-size: 20px; }
  .tool-stat span { font-size: 11px; }
  .clock-svg { width: min(260px, 78vw); }
  .time-inputs { gap: 8px; }
  .time-inputs input { width: 74px; font-size: 19px; }
  .time-inputs .btn { flex: 1 1 40%; padding: 12px 10px; }

  /* 模拟卷 */
  .setup-grid { grid-template-columns: 1fr; gap: 12px; }
  .setup-cell { padding: 14px; }
  .opt-row button { padding: 10px 14px; font-size: 13.5px; }
  .paper-head {
    position: sticky; top: 56px; padding: 12px 14px; gap: 8px;
    border-radius: 16px; margin-bottom: 12px;
  }
  .paper-head .ph-title { font-size: 15px; }
  .paper-head .ph-sub { font-size: 11.5px; }
  .paper-head .ph-right { width: 100%; gap: 8px; }
  .paper-head .ph-right .btn { flex: 1 1 auto; }
  .timer-pill { font-size: 13.5px; padding: 7px 12px; }
  .result-hero { padding: 18px; gap: 10px; border-radius: 18px; }
  .result-hero .rh-score { font-size: 38px; }
  .result-hero .rh-info { font-size: 12.5px; line-height: 1.7; }
  .result-hero div:last-child { margin-left: 0 !important; width: 100%; }

  /* 错题复习卡 */
  .flash-card { padding: 15px; border-radius: 14px; }
  .flash-card .fc-q { font-size: 14.5px; }
  .flash-card .fc-actions .btn { flex: 1 1 46%; }

  /* 进度条 */
  .progress-row { gap: 8px; }
  .progress-row .p-label { min-width: 76px; font-size: 12.5px; }
  .progress-row .p-val { min-width: 38px; font-size: 11.5px; }

  /* 页脚让位给底部 Tab */
  footer { padding: 22px 0 26px; font-size: 12px; }
  footer .foot-inner { flex-direction: column; gap: 6px; }

  /* 隐藏返顶部多余的装饰 */
  .hero::after { height: 34px; background-size: 32px 34px; }
}

/* 超窄屏（iPhone SE 等） */
@media (max-width: 360px) {
  .m-tab { font-size: 10px; }
  .m-tab .mi { font-size: 17px; }
  .hero h1 { font-size: 24px; }
  .tool-tabs button { flex: 1 1 100%; }
}

/* 横屏时不要固定底部栏挡住内容 */
@media (max-height: 460px) and (orientation: landscape) {
  .m-tabbar { position: static; }
  body { padding-bottom: 0; }
}
