/* ============================================================
   mobile-app.css — 手机端（html[data-device="mobile"]）
   只在设备判定为手机时生效，桌面固定画布完全不受影响。
   ============================================================ */

html[data-device="mobile"] body { background: var(--canvas); }

/* ===== 外壳：隐藏桌面侧栏与顶栏 ===== */
html[data-device="mobile"] .app-shell {
  display: block;
  min-width: 0;
}
html[data-device="mobile"] .sidebar,
html[data-device="mobile"] .sidebar-scrim,
html[data-device="mobile"] .topbar,
html[data-device="mobile"] .shell-footer {
  display: none !important;
}
html[data-device="mobile"] .workspace { display: block; }
html[data-device="mobile"] .main-content {
  max-width: none;
  padding: 14px 16px calc(104px + env(safe-area-inset-bottom));
}

/* ===== 底部 Tab ===== */
.mobile-tabbar[hidden] { display: none; }
html[data-device="mobile"] .mobile-tabbar[hidden] { display: none; }
html[data-device="mobile"] .mobile-tabbar {
  position: fixed;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  height: 64px;
  padding: 0 4px;
  border: 1px solid var(--ag-hairline);
  border-radius: 22px;
  background: rgba(255, 255, 255, .84);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow: 0 18px 40px -26px rgba(15, 23, 42, .45);
}
html[data-device="mobile"][data-theme="dark"] .mobile-tabbar {
  background: rgba(30, 31, 36, .86);
  border-color: rgba(255, 255, 255, .08);
}
.mobile-tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 58px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--weak);
  font: 500 10px/1 var(--sans);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-tabbar button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.mobile-tabbar button.active { color: var(--ink); }
.mobile-tabbar button.is-primary { position: relative; justify-content: flex-end; padding-bottom: 6px; }
.mobile-tabbar button.is-primary svg {
  display: none;
}
.mobile-tabbar button.is-primary::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 16px 30px -18px rgba(40, 94, 150, .8);
  transform: translateX(-50%);
}
.mobile-tabbar button.is-primary::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 50%;
  width: 16px;
  height: 16px;
  background:
    linear-gradient(var(--tab-plus, #fff), var(--tab-plus, #fff)) center/16px 2px no-repeat,
    linear-gradient(var(--tab-plus, #fff), var(--tab-plus, #fff)) center/2px 16px no-repeat;
  transform: translateX(-50%);
  border-radius: 2px;
}
.mobile-tabbar button.is-primary span { margin-top: 30px; color: var(--primary); font-weight: 500; }

/* 悬浮的备忘录按钮 */
.mobile-fab[hidden] { display: none; }
html[data-device="mobile"] .mobile-fab {
  position: fixed;
  right: 20px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 61;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--ag-hairline);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 20px 40px -24px rgba(15, 23, 42, .5);
  -webkit-tap-highlight-color: transparent;
}
html[data-device="mobile"] .mobile-fab[hidden] { display: none; }
html[data-device="mobile"] .mobile-fab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ===== 手机首页 ===== */
.m-home { display: grid; gap: 16px; }

.m-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 2px;
}
.m-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font: 600 16px/1 var(--serif);
  flex: none;
}
.m-greet { display: grid; gap: 4px; min-width: 0; }
.m-greet strong {
  overflow: hidden;
  color: var(--ink);
  font: 600 17px/1.2 var(--serif);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-greet small { color: var(--weak); font-size: 11px; }
.m-head-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
}
.m-head-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.m-hero {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.m-hero-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.m-hero-value { color: var(--ink); font: 600 34px/1 var(--serif); font-variant-numeric: tabular-nums; }
.m-hero-value small { margin-left: 6px; color: var(--weak); font: 500 12px var(--sans); }
.m-hero-bar { height: 8px; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.m-hero-bar i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.m-hero-cta {
  justify-self: start;
  height: 38px;
  margin-top: 4px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font: 500 13px/1 var(--sans);
}

.m-section-pill {
  justify-self: start;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-card {
  display: grid;
  gap: 10px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow-sm);
}
.m-card-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-deep);
}
.m-card-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.m-card strong { color: var(--ink); font: 600 22px/1 var(--serif); font-variant-numeric: tabular-nums; }
.m-card span { color: var(--weak); font-size: 11px; }

/* ===== 手机端占位（尚未适配的页面） ===== */
.m-placeholder {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 64px 24px;
  text-align: center;
}
.m-placeholder h2 { margin: 0; font: 600 20px/1.3 var(--serif); color: var(--ink); }
.m-placeholder p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.m-placeholder .m-actions { display: flex; gap: 10px; margin-top: 6px; }
.m-placeholder button {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: 500 13px/1 var(--sans);
}
.m-placeholder button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }

/* ===== 手机登录 ===== */
html[data-device="mobile"] .auth-login {
  display: block;
  min-height: 100dvh;
}
html[data-device="mobile"] .auth-login[hidden] { display: none; }
html[data-device="mobile"] .auth-visual { display: none; }
html[data-device="mobile"] .auth-form-side {
  width: auto;
  justify-self: stretch;
  min-height: 100dvh;
  padding: calc(18vh + env(safe-area-inset-top)) 24px calc(48px + env(safe-area-inset-bottom));
  border-left: 0;
}
html[data-device="mobile"] .auth-glass { max-width: 420px; margin: 0 auto; }
html[data-device="mobile"] .auth-icp { padding: 0 16px; }

/* 移动端输入不缩放 */
html[data-device="mobile"] .auth-field input,
html[data-device="mobile"] .auth-field select { font-size: 16px; height: 50px; }

/* ===== 手机端知识点 ===== */
.m-page-head { display: grid; gap: 12px; margin-bottom: 14px; }
.m-page-head h1 { margin: 0; color: var(--ink); font: 600 24px/1.2 var(--serif); }
.m-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--weak);
}
.m-search svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; flex: none; }
.m-search input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: 400 16px/1 var(--sans);
}
.m-chapter-list { display: grid; gap: 12px; padding-bottom: 8px; }
.m-chapter {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.m-chapter-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  text-align: left;
}
.m-chapter-copy { display: grid; gap: 4px; min-width: 0; flex: 1; }
.m-chapter-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-chapter-copy small { color: var(--weak); font-size: 11px; }
.m-chapter-progress { width: 64px; height: 5px; overflow: hidden; border-radius: 3px; background: var(--surface-2); flex: none; }
.m-chapter-progress i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.m-chapter-arrow { width: 14px; height: 14px; color: var(--weak); stroke: currentColor; fill: none; stroke-width: 1.8; transform: rotate(90deg); transition: transform .2s var(--ag-out); }
.m-chapter.open .m-chapter-arrow { transform: rotate(-90deg); }
.m-sections { display: none; border-top: 1px solid var(--border); }
.m-chapter.open .m-sections { display: block; }
.m-section-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: 400 13px/1.5 var(--sans);
  text-align: left;
}
.m-section-row:last-child { border-bottom: 0; }
.m-section-row span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-section-dot {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--weak);
  flex: none;
}
.m-section-row.done .m-section-dot { border-color: transparent; background: var(--primary-soft); color: var(--primary-deep); }
.m-section-dot svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.m-section-row.done span:last-child { color: var(--ink); }

/* 阅读页 */
.m-reader-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -14px -16px 0;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}
html[data-device="mobile"][data-theme="dark"] .m-reader-bar { background: rgba(28, 29, 34, .9); }
.m-back {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  flex: none;
}
.m-back svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; transform: rotate(180deg); }
.m-reader-crumb { display: grid; gap: 2px; min-width: 0; flex: 1; }
.m-reader-crumb strong { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.m-reader-crumb small { overflow: hidden; color: var(--weak); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.m-learned {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font: 500 11px/1 var(--sans);
  flex: none;
}
.m-learned.done { border-color: transparent; background: var(--primary-soft); color: var(--primary-deep); }
.m-reader-progress { position: sticky; top: 54px; z-index: 19; height: 2px; margin: 0 -16px; background: transparent; }
.m-reader-progress i { display: block; width: 0; height: 100%; background: var(--primary); transition: width .1s linear; }
.m-reader-body { padding: 20px 2px 12px; }
.m-reader-body h1 { margin: 0; color: var(--ink); font: 600 22px/1.4 var(--serif); }
.m-reader-meta { margin: 6px 0 18px; color: var(--weak); font-size: 12px; }
.m-reader-body .md-body { color: var(--muted); font-size: 15px; line-height: 1.9; }
.m-reader-actions { margin: 22px 0 14px; }
.m-primary {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font: 500 14px/1 var(--sans);
}
.m-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
}
.m-next span { color: var(--weak); font-size: 11px; }
.m-next strong { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.m-next.is-end { color: var(--weak); }
.m-empty { padding: 40px 0; color: var(--weak); font-size: 13px; text-align: center; }

/* ===== 手机端做题（第一阶段：单列 + 吸底操作） ===== */
html[data-device="mobile"] .practice-layout{display:block}
html[data-device="mobile"] .practice-main{min-width:0}
html[data-device="mobile"] .practice-overview-stats{grid-template-columns:repeat(3,1fr);gap:8px;padding:14px}
html[data-device="mobile"] .custom-exam-card{display:grid;gap:14px;padding:18px}
html[data-device="mobile"] .custom-exam-rules{gap:8px}
html[data-device="mobile"] .chapter-practice-row{display:grid;gap:10px;padding:16px}
html[data-device="mobile"] .chapter-practice-progress{width:100%}
html[data-device="mobile"] .chapter-practice-accuracy{display:none}
html[data-device="mobile"] .chapter-practice-start{width:100%;height:42px}
html[data-device="mobile"] .quiz-card{padding:0 14px 14px;border-radius:16px}
html[data-device="mobile"] .question-meta{min-height:52px;padding:0 2px}
html[data-device="mobile"] .question-copy{padding:16px 0 8px;grid-template-columns:26px minmax(0,1fr);gap:0 10px}
html[data-device="mobile"] .question-number{width:26px;height:26px;font-size:12px}
html[data-device="mobile"] .question-detail>.q-stem{font-size:16px;line-height:1.75}
html[data-device="mobile"] .q-option{min-height:46px;padding:11px 12px}
html[data-device="mobile"] .quiz-nav{
  position:sticky;
  bottom:calc(78px + env(safe-area-inset-bottom));
  z-index:30;
  display:flex;
  gap:10px;
  margin-top:12px;
  padding:10px 0;
  background:var(--canvas);
}
html[data-device="mobile"] .quiz-nav .btn{flex:1;height:44px;min-width:0}
html[data-device="mobile"] .practice-nav{position:static;margin-top:16px}
html[data-device="mobile"] .question-map-card{padding:16px}
html[data-device="mobile"] .pnav-grid{grid-template-columns:repeat(6,1fr)}
html[data-device="mobile"] .pnav-item{min-height:40px;font-size:12px}
html[data-device="mobile"] .practice-tip-card{display:none}

/* 做题：右侧抽屉在手机上回归普通区块 */
html[data-device="mobile"] .practice-nav{
  position:static;
  top:auto;
  height:auto;
  display:block;
  overflow:visible;
}
html[data-device="mobile"] .pnav-clip{
  position:static;
  inset:auto;
  overflow:visible;
  width:auto;
}
html[data-device="mobile"] .practice-layout.nav-hidden .pnav-clip{
  opacity:1;
  filter:none;
  pointer-events:auto;
}
html[data-device="mobile"] .question-map-card{width:100%;height:auto}
html[data-device="mobile"] .pnav-handle,
html[data-device="mobile"] .pnav-toggle{display:none!important}

/* ===== 手机端：错题本 / 收藏 / 统计 / 个人中心 基础适配 ===== */
html[data-device="mobile"] .mistakes-layout-v2,
html[data-device="mobile"] .favorites-layout-v2{
  display:block;
  height:auto;
  min-height:0;
}
html[data-device="mobile"] .mistake-list-panel-v2,
html[data-device="mobile"] .favorites-panel-v2{height:auto;display:block}
html[data-device="mobile"] .mistake-list-v2,
html[data-device="mobile"] .favorite-list-v2{
  flex:none;
  max-height:none;
  overflow:visible;
}
html[data-device="mobile"] .mistake-toolbar-v2,
html[data-device="mobile"] .favorites-toolbar-v2{display:grid;gap:10px;padding:12px}
html[data-device="mobile"] .mistake-filter-group,
html[data-device="mobile"] .favorite-filter-group{display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%}
html[data-device="mobile"] .mistake-search,
html[data-device="mobile"] .favorite-search-v2{grid-column:1/-1}
html[data-device="mobile"] .mistake-card-v2,
html[data-device="mobile"] .favorite-item-v2{
  grid-template-columns:64px minmax(0,1fr);
  gap:10px;
  min-height:0;
  padding:14px 0;
}
html[data-device="mobile"] .mistake-actions-v2,
html[data-device="mobile"] .favorite-actions-v2{
  grid-column:2;
  flex-direction:row;
  margin-top:8px;
}
html[data-device="mobile"] .mistake-actions-v2 button,
html[data-device="mobile"] .favorite-actions-v2 button{flex:1;min-height:40px}
html[data-device="mobile"] .favorite-actions-v2 .favorite-primary{width:100%}
html[data-device="mobile"] .wrong-review-sidebar,
html[data-device="mobile"] .collections-sidebar-v2{margin-top:14px;height:auto;display:grid;gap:12px}

/* 统计 */
html[data-device="mobile"] .stat-cards-v2{grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px}
html[data-device="mobile"] .statistics-grid-v2{display:block;margin-bottom:14px}
html[data-device="mobile"] .accuracy-card-v2{margin-top:12px}
html[data-device="mobile"] .chapter-performance-v2{margin-top:12px}
html[data-device="mobile"] .chapter-table-v2{overflow-x:auto}
html[data-device="mobile"] .chapter-table-head-v2,
html[data-device="mobile"] .chapter-stat-row-v2{min-width:640px}

/* 个人中心 */
html[data-device="mobile"] .account-page{height:auto}
html[data-device="mobile"] .account-grid{display:grid;grid-template-columns:1fr;gap:12px}
html[data-device="mobile"] .account-col{display:block}
html[data-device="mobile"] .account-col + .account-col{margin-top:12px}
html[data-device="mobile"] .account-card{padding:16px}
html[data-device="mobile"] .account-hero{flex-wrap:wrap;row-gap:10px}
html[data-device="mobile"] .account-hero-side{width:100%;justify-content:space-between;margin-left:0}
html[data-device="mobile"] .account-save{height:38px}

/* 筛选条与统计卡标题在手机上的排布 */
html[data-device="mobile"] .mistake-filter-group,
html[data-device="mobile"] .favorite-filter-group{grid-template-columns:1fr}
html[data-device="mobile"] .mistake-search,
html[data-device="mobile"] .favorite-search-v2{width:100%}
html[data-device="mobile"] .mistake-select,
html[data-device="mobile"] .favorite-sort-v2{width:100%;max-width:none}
html[data-device="mobile"] .statistics-card-heading{flex-wrap:wrap;row-gap:8px}
html[data-device="mobile"] .statistics-heading-tools{width:100%;justify-content:space-between}

/* 错题/收藏题干在手机上最多两行 */
html[data-device="mobile"] .mistake-content-v2 h2,
html[data-device="mobile"] .favorite-copy-v2 h2{
  display:-webkit-box;
  overflow:hidden;
  white-space:normal;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}

/* ===== 做题：顶部条 + 题号抽屉 ===== */
html[data-device="mobile"] .practice-nav{display:none!important}

.m-practice-bar{
  position:sticky;
  top:0;
  z-index:25;
  display:flex;
  align-items:center;
  gap:10px;
  margin:-14px -16px 12px;
  padding:calc(env(safe-area-inset-top) + 6px) 12px 6px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,.9);
  -webkit-backdrop-filter:blur(18px) saturate(160%);
  backdrop-filter:blur(18px) saturate(160%);
}
html[data-device="mobile"][data-theme="dark"] .m-practice-bar{background:rgba(28,29,34,.9)}
.m-bar-btn{
  display:grid;
  place-items:center;
  width:38px;
  height:38px;
  padding:0;
  border:0;
  border-radius:10px;
  background:transparent;
  color:var(--ink);
  flex:none;
}
.m-bar-btn svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:2;transform:rotate(180deg)}
.m-bar-copy{display:grid;gap:2px;min-width:0;flex:1}
.m-bar-copy strong{overflow:hidden;color:var(--ink);font-size:13px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}
.m-bar-copy small{display:flex;align-items:center;gap:6px;color:var(--weak);font-size:10px;font-variant-numeric:tabular-nums}
.m-bar-copy small i{font-style:normal;color:var(--border-strong)}
.m-bar-map{
  height:32px;
  padding:0 12px;
  border:1px solid var(--border);
  border-radius:9px;
  background:var(--surface);
  color:var(--muted);
  font:500 12px/1 var(--sans);
  flex:none;
}

/* 题号底部抽屉 */
body.m-sheet-open{overflow:hidden}
.m-sheet-overlay{
  position:fixed;
  inset:0;
  z-index:10080;
  display:flex;
  align-items:flex-end;
  background:rgba(15,23,42,.45);
  -webkit-backdrop-filter:blur(4px);
  backdrop-filter:blur(4px);
}
.m-sheet{
  display:flex;
  flex-direction:column;
  width:100%;
  max-height:78dvh;
  padding:8px 16px calc(18px + env(safe-area-inset-bottom));
  border-radius:20px 20px 0 0;
  background:var(--surface);
  box-shadow:0 -30px 60px -40px rgba(15,23,42,.5);
  animation:mSheetIn .28s var(--ag-out);
}
@keyframes mSheetIn{from{transform:translateY(24px);opacity:.6}to{transform:none;opacity:1}}
.m-sheet-head{display:flex;align-items:center;justify-content:space-between;padding:10px 4px}
.m-sheet-head strong{color:var(--ink);font:600 16px/1.3 var(--serif)}
.m-sheet-close{
  display:grid;
  place-items:center;
  width:30px;
  height:30px;
  padding:0;
  border:0;
  border-radius:8px;
  background:transparent;
  color:var(--weak);
}
.m-sheet-close svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2}
.m-sheet-body{display:grid;gap:14px;overflow:auto;padding:4px 2px 10px}
.m-sheet-label{color:var(--weak);font-size:11px}
.m-sheet-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-top:8px}
.m-sheet-item{
  height:42px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface);
  color:var(--muted);
  font:500 12px/1 var(--sans);
}
.m-sheet-item.done{border-color:transparent;background:var(--primary-soft);color:var(--primary-deep)}
.m-sheet-item.current{border-color:var(--primary);background:var(--primary);color:#fff}
.m-sheet-item.partial{position:relative}
.m-sheet-item.partial::after{content:"";position:absolute;top:6px;right:6px;width:5px;height:5px;border-radius:50%;background:var(--amber)}
.m-sheet-legend{display:flex;flex-wrap:wrap;gap:8px 14px;padding:10px 4px 0;border-top:1px solid var(--border);color:var(--weak);font-size:10px}
.m-sheet-legend span{display:flex;align-items:center;gap:5px}
.m-sheet-legend i{width:8px;height:8px;border:1px solid var(--border);border-radius:2px}
.m-sheet-legend i.current{background:var(--primary);border-color:var(--primary)}
.m-sheet-legend i.done{background:var(--primary-soft);border-color:transparent}
.m-sheet-legend i.partial{background:var(--amber)}

/* 备忘录：底部卡片 */
html[data-device="mobile"] .memo-float{
  left:8px;
  right:8px;
  bottom:8px;
  width:auto;
  max-width:none;
  max-height:78dvh;
  border-radius:20px;
}
html[data-device="mobile"] .memo-float .memo-text{height:46dvh;min-height:220px}

/* Toast 抬到 Tab 上方 */
html[data-device="mobile"] .toast{bottom:calc(96px + env(safe-area-inset-bottom))!important}

/* 统计：章节表现改为卡片行，不再横向滚动 */
html[data-device="mobile"] .chapter-table-v2{overflow:visible}
html[data-device="mobile"] .chapter-table-head-v2{display:none}
html[data-device="mobile"] .chapter-stat-row-v2{
  display:grid;
  grid-template-columns:1fr auto auto;
  align-items:center;
  gap:6px 12px;
  width:100%;
  min-width:0;
  padding:12px 0;
  border-bottom:1px solid var(--border);
  background:transparent;
  text-align:left;
}
html[data-device="mobile"] .chapter-stat-row-v2:last-child{border-bottom:0}
html[data-device="mobile"] .chapter-stat-row-v2>strong{grid-column:1/-1;color:var(--ink);font-size:13px;font-weight:600}
html[data-device="mobile"] .chapter-stat-row-v2 .chapter-progress-v2{grid-column:1/-1;display:flex;align-items:center;gap:8px;width:100%}
html[data-device="mobile"] .chapter-stat-row-v2 .chapter-progress-track-v2{flex:1}
html[data-device="mobile"] .chapter-stat-row-v2>b{color:var(--muted);font:500 11px/1 var(--sans);font-variant-numeric:tabular-nums}
html[data-device="mobile"] .chapter-stat-row-v2>b:first-of-type::before{content:"做题 ";color:var(--weak);font-weight:400}
html[data-device="mobile"] .chapter-stat-row-v2>b+ b::before{content:"正确率 ";color:var(--weak);font-weight:400}
html[data-device="mobile"] .chapter-stat-row-v2>small{justify-self:end}

/* ===== 个人中心：设置列表 ===== */
.m-account{display:grid;gap:14px;padding-bottom:8px}
.m-account-hero{display:flex;align-items:center;gap:12px;padding:16px;border:1px solid var(--border);border-radius:18px;background:var(--surface);box-shadow:var(--shadow-sm)}
.m-account-avatar{display:grid;place-items:center;width:48px;height:48px;border-radius:50%;background:var(--primary-soft);color:var(--primary-deep);font:600 17px/1 var(--serif);flex:none}
.m-account-copy{display:grid;gap:3px;min-width:0}
.m-account-copy strong{overflow:hidden;color:var(--ink);font:600 17px/1.2 var(--serif);text-overflow:ellipsis;white-space:nowrap}
.m-account-copy small{color:var(--weak);font-size:11px}
.m-account-tags{display:flex;flex-wrap:wrap;gap:6px}
.m-account-tags span{padding:4px 9px;border-radius:6px;background:var(--primary-soft);color:var(--primary-deep);font-size:11px}
.m-list-group{overflow:hidden;border:1px solid var(--border);border-radius:16px;background:var(--surface);padding:4px 0}
.m-list-group{padding-top:10px;color:var(--weak);font-size:11px}
.m-list-row{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  min-height:50px;
  padding:10px 16px;
  border:0;
  border-top:1px solid var(--border);
  background:transparent;
  color:var(--ink);
  font:400 14px/1.4 var(--sans);
  text-align:left;
}
.m-list-group .m-list-row:first-of-type{border-top:0}
.m-list-row>span{flex:1;min-width:0;display:grid;gap:3px}
.m-list-row>span strong{font-size:14px;font-weight:500;color:var(--ink)}
.m-list-row>span small{font-size:11px;color:var(--weak)}
.m-list-row>small{color:var(--weak);font-size:12px;flex:none}
.m-list-row>svg{width:14px;height:14px;stroke:var(--border-strong);fill:none;stroke-width:1.8;flex:none}
.m-list-row.is-danger{width:calc(100% - 24px);margin:4px 12px 0;justify-content:center;border:1px solid var(--border);border-radius:14px;background:var(--surface);color:var(--red);font-size:13px}
.m-list-row.is-selected>span strong{color:var(--primary-deep)}
.m-list-row .m-check{width:16px;height:16px;stroke:var(--primary);fill:none;stroke-width:2.2}
.m-subbar{display:flex;align-items:center;gap:8px;padding:2px 2px 4px}
.m-subbar strong{color:var(--ink);font:600 20px/1.3 var(--serif)}
.m-subbar .m-back{margin-left:-8px}
.m-form{display:grid;gap:14px}
.m-form .auth-field{margin-bottom:0}
.m-form .m-primary{margin-top:4px}

/* ===== 单题详情浮层 ===== */
body.m-detail-open{overflow:hidden}
.m-detail-overlay{
  position:fixed;
  inset:0;
  z-index:10090;
  display:flex;
  flex-direction:column;
  overflow:auto;
  background:var(--canvas);
}
.m-detail-bar{
  position:sticky;
  top:0;
  z-index:5;
  display:flex;
  align-items:center;
  gap:8px;
  padding:calc(env(safe-area-inset-top) + 8px) 12px 8px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,.9);
  -webkit-backdrop-filter:blur(18px) saturate(160%);
  backdrop-filter:blur(18px) saturate(160%);
}
html[data-device="mobile"][data-theme="dark"] .m-detail-bar{background:rgba(28,29,34,.92)}
.m-detail-copy{display:grid;gap:2px;min-width:0;flex:1}
.m-detail-copy strong{overflow:hidden;color:var(--ink);font-size:13px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}
.m-detail-copy small{overflow:hidden;color:var(--weak);font-size:10px;text-overflow:ellipsis;white-space:nowrap}
.m-detail-body{display:grid;gap:14px;padding:16px 16px calc(28px + env(safe-area-inset-bottom))}
.m-detail-question .q-stem{font-size:16px;line-height:1.75}
.m-detail-note{padding:14px;border:1px solid var(--border);border-radius:14px;background:var(--surface)}
.m-detail-note span{color:var(--weak);font-size:11px}
.m-detail-note p{margin:6px 0 0;color:var(--muted);font-size:13px;line-height:1.8}
.m-detail-actions{display:grid;gap:10px}
.m-detail-actions .m-primary{height:46px}
.m-detail-secondary{
  height:44px;
  border:1px solid var(--border-strong);
  border-radius:12px;
  background:var(--surface);
  color:var(--ink);
  font:500 14px/1 var(--sans);
}
