/* ==========================================================================
   信息科技教学一体化平台 · 统一设计系统
   --------------------------------------------------------------------------
   1. 设计令牌   2. 基础重置   3. 布局骨架   4. 通用组件   5. 业务组件
   6. 模态与提示 7. 工具类     8. 响应式     9. 打印
   ========================================================================== */

/* 1. 设计令牌 ------------------------------------------------------------- */
:root {
  --primary: #4361ee;
  --primary-dark: #3450c8;
  --primary-soft: #eef1fe;
  --primary-ring: rgba(67, 97, 238, 0.18);

  --success: #16a34a;
  --success-soft: #e9f9ef;
  --warning: #e8890c;
  --warning-soft: #fff5e5;
  --danger: #e24646;
  --danger-soft: #fdeeee;
  --info: #0d94d2;
  --info-soft: #e8f6fd;
  --purple: #7c3aed;
  --purple-soft: #f4efff;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef1f7;

  --text: #131a2b;
  --text-2: #4c5872;
  --text-3: #8b97ae;
  --border: #e4e8f1;
  --border-strong: #d2d9e6;

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(19, 26, 43, 0.05);
  --shadow-sm: 0 2px 8px rgba(19, 26, 43, 0.06);
  --shadow: 0 6px 20px rgba(19, 26, 43, 0.08);
  --shadow-lg: 0 18px 48px rgba(19, 26, 43, 0.16);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --sidebar-w: 234px;
  --topbar-h: 60px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. 基础重置 ------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  /* 禁止双击缩放（保留滚动与单击），兼容 iOS Safari 对 user-scalable=no 的忽略 */
  touch-action: manipulation;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 0.6em; }

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; }

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

code, pre, .mono { font-family: var(--font-mono); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd4e4;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: #adb9cd; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 3. 布局骨架 ------------------------------------------------------------- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15.5px;
  color: var(--text);
  white-space: nowrap;
}

/* 无导航模式（在线答题 / 错题练习）：不显示侧边栏与跳转入口 */
body[data-nav='locked'] .sidebar,
body[data-nav='locked'] .sidebar-toggle { display: none !important; }
body[data-nav='locked'] .main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}
.brand-static { cursor: default; }
.brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #6d8bff);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
  box-shadow: 0 4px 12px var(--primary-ring);
}

.brand-sub {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-3);
  display: block;
  line-height: 1.1;
}

.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}

/* 主体 */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 12px 40px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.nav-group + .nav-group { margin-top: 18px; }

.nav-group-title {
  padding: 0 10px 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 650;
}
.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex: 0 0 18px;
}
.nav-badge {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
}
.nav-link.active .nav-badge {
  background: #fff;
  color: var(--primary);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 22px 26px 60px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
}
.page-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-3);
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 4. 通用组件 ------------------------------------------------------------- */

/* 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
.card-head .muted { font-weight: 400; font-size: 12.5px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px; }
.card-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease), transform 0.06s var(--ease);
}
.btn:hover { background: #e5eaf3; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #12833c; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #cd790a; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c93a3a; }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #e3e8fd; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-icon {
  padding: 6px 8px;
  background: transparent;
  color: var(--text-2);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* 表单 */
.field { margin-bottom: 14px; }
.field > label,
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.field-hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-3);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13.5px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}
.input::placeholder,
.textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b97ae' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 16px;
}

.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.checkbox input,
.radio input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* 搜索框 */
.search {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.search .input { padding-left: 12px; }

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* 徽标 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.7;
  white-space: nowrap;
}
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-gray { background: var(--surface-3); color: var(--text-2); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }

/* 表格 */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--primary); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .row-danger { background: var(--danger-soft); }

/* 空状态 */
.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty-icon {
  font-size: 34px;
  margin-bottom: 10px;
  opacity: 0.65;
}
.empty-title {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text-2);
  margin-bottom: 4px;
}
.empty-desc { font-size: 12.5px; }

/* 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  position: relative;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  opacity: 0.85;
}
.stat.green::after { background: var(--success); }
.stat.amber::after { background: var(--warning); }
.stat.red::after { background: var(--danger); }
.stat.blue::after { background: var(--info); }
.stat.purple::after { background: var(--purple); }

.stat-value {
  font-size: 1.7rem;
  font-weight: 750;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-3);
}
.stat-icon {
  position: absolute;
  right: 14px;
  top: 12px;
  font-size: 22px;
  line-height: 1;
  opacity: 0.22;
}

/* 进度条 */
.progress {
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.4s var(--ease);
}
.progress-bar.green { background: var(--success); }
.progress-bar.amber { background: var(--warning); }
.progress-bar.red { background: var(--danger); }

/* 比率：只显示百分比数值，按 >=80 绿 / 60-79 橙 / <60 红 着色（不画进度条，数值与表头左对齐） */
.rate-text {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  white-space: nowrap;
}
.rate-text.green { color: var(--success); }
.rate-text.amber { color: var(--warning); }
.rate-text.red { color: var(--danger); }

/* 标签页 */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.tab {
  padding: 7px 15px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* 提示条 */
.alert {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-info { background: var(--info-soft); color: #0a6c99; border-color: #c9e8f7; }
.alert-success { background: var(--success-soft); color: #12703a; border-color: #c8ecd5; }
.alert-warning { background: var(--warning-soft); color: #9a5c06; border-color: #f6e0b8; }
.alert-danger { background: var(--danger-soft); color: #a92f2f; border-color: #f5cdcd; }
.alert + .alert { margin-top: 10px; }

/* 5. 业务组件 ------------------------------------------------------------- */

/* 年级切换 */
.grade-switch,
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.grade-switch button,
.segmented button {
  padding: 6px 13px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.grade-switch button:hover,
.segmented button:hover { color: var(--text); }
.grade-switch button.active,
.segmented button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* 题目卡片 */
.question {
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.question + .question { margin-top: 10px; }
.question:hover {
  border-color: #c9d4ec;
  box-shadow: var(--shadow-sm);
}
.question-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}
.question-no {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.question-id {
  padding: 1px 7px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.question-body {
  font-size: 14px;
  line-height: 1.75;
  word-break: break-word;
}
.question-options { margin: 9px 0 0; }
.question-options li {
  padding: 3px 0 3px 2px;
  font-size: 13.5px;
  color: var(--text-2);
}
.question-image {
  display: block;
  max-width: 100%;
  max-height: 260px;
  margin: 10px 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: zoom-in;
}
.question-answer {
  margin-top: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  color: #12703a;
  font-size: 13px;
}
.question-point {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-3);
}
.question-explanation {
  margin-top: 8px;
  padding: 10px 13px;
  border-left: 3px solid var(--info);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--info-soft);
  color: #0a6c99;
  font-size: 13px;
  line-height: 1.7;
}

/* 题目编辑表单中的选项行 */
.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.option-row .opt-key {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: var(--radius-xs);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 12.5px;
}

/* 单元多选 */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px;
  max-height: 250px;
  overflow-y: auto;
  padding: 3px;
}
.unit-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.unit-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.unit-item input { accent-color: var(--primary); margin: 0; }
.unit-item.checked {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.unit-item .unit-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
}

/* 试卷预览 */
.paper-meta {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.paper-meta-item .k { font-size: 12px; color: var(--text-3); }
.paper-meta-item .v {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.paper-section-title {
  margin: 22px 0 12px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  font-size: 14.5px;
  font-weight: 700;
}
.paper-unit-title {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
}

/* 已保存试卷卡片 */
.paper-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 14px;
}
.paper-card {
  display: flex;
  flex-direction: column;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all 0.16s var(--ease);
}
.paper-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.paper-card h4 {
  font-size: 14.5px;
  margin-bottom: 4px;
  word-break: break-word;
}
.paper-card .paper-id {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
}
.paper-card .paper-desc {
  margin: 8px 0;
  font-size: 12.5px;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.paper-card .paper-counts {
  display: flex;
  gap: 12px;
  margin: 6px 0 12px;
  font-size: 12px;
  color: var(--text-2);
}
.paper-card .paper-counts b { font-size: 15px; display: block; }
.paper-card .paper-actions {
  margin-top: auto;
  display: flex;
  gap: 6px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* 6. 模态与提示 ----------------------------------------------------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}
.modal-mask.open { display: flex; }

.modal {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s var(--ease);
  overflow: hidden;
}
.modal.wide { max-width: 880px; }
.modal.narrow { max-width: 440px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15.5px; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.modal-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-3);
  font-size: 20px;
  cursor: pointer;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

/* 图片放大 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.87);
  padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 88vh;
  border-radius: var(--radius-sm);
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 24px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 34px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.85;
}
.lightbox-close:hover { opacity: 1; }

/* Toast */
.toast-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 240px;
  max-width: 380px;
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toast-in 0.22s var(--ease);
  pointer-events: auto;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.out { animation: toast-out 0.2s var(--ease) forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(28px); }
}

/* 确认对话框 */
.confirm-dialog { max-width: 420px; }
.confirm-dialog .modal-body {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}
.confirm-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 19px;
}
.confirm-text h4 { font-size: 15px; margin-bottom: 4px; }
.confirm-text p { font-size: 13px; color: var(--text-2); margin: 0; }

/* 加载 */
.loading-mask {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 13px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
}
.loading-mask.open { display: flex; }

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }

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

.inline-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 28px;
  color: var(--text-3);
  font-size: 13px;
}

/* 7. 工具类 --------------------------------------------------------------- */
.muted { color: var(--text-3); }
.strong { font-weight: 700; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.text-sm { font-size: 12.5px; }
.text-lg { font-size: 15.5px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.flex-center { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.scroll-y { overflow-y: auto; }

/* 8. 响应式 --------------------------------------------------------------- */
@media (max-width: 1080px) {
  :root { --sidebar-w: 200px; }
  .main { padding: 18px 18px 50px; }
}

@media (max-width: 860px) {
  .sidebar-toggle { display: grid !important; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 55;
    height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow-lg);
    width: 250px;
    flex-basis: 250px;
  }
  .sidebar.open { transform: none; }
  .main { padding: 16px 14px 50px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .stat-value { font-size: 1.4rem; }
  .paper-list { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
}

.sidebar-toggle {
  display: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 15px;
}

@media (max-width: 560px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .brand-text { display: none; }
  .modal { max-height: 94vh; }
  .table th,
  .table td { padding: 8px 9px; font-size: 12.5px; }
}

/* 10. 兼容补充：沿用旧页面类名，统一映射到设计令牌 ---------------------------- */
.container {
  display: block;
}

/* 旧版页头 */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
}
.page-header p { margin: 4px 0 0; }

/* 旧版表单类名 */
.form-group { margin-bottom: 14px; }
.form-group > label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13.5px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b97ae' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 14px;
}
.inline-select { width: auto; display: inline-block; max-width: 100%; }
.req { color: var(--danger); margin-left: 2px; }
.exam-form { max-width: 660px; }

.exam-url {
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-2);
}

/* 旧版统计卡（等价于 .stat） */
.stat-card {
  position: relative;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  opacity: 0.85;
}
.stat-card .stat-label { margin-top: 0; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 750; line-height: 1.25; font-variant-numeric: tabular-nums; }

/* 旧版工具栏/表格辅助 */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-info { font-size: 12.5px; color: var(--text-3); }
.table-empty {
  padding: 26px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.empty-tip {
  padding: 22px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 12px 15px;
  margin-bottom: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.detail-summary b { font-variant-numeric: tabular-nums; }
.note {
  padding: 9px 13px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: #9a5c06;
  font-size: 12.5px;
}
.link { color: var(--primary); cursor: pointer; }

/* 旧版分段筛选按钮 */
.seg {
  padding: 6px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.seg:hover { border-color: var(--primary); color: var(--primary); }
.seg.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* 答题页顶部信息条 */
.exam-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.exam-bar-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.exam-bar-info strong { font-size: 15px; }
.exam-bar-timer { display: flex; align-items: center; gap: 9px; }
.timer-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}
.timer-value.danger { color: var(--danger); }
.timer-value.warning { color: var(--warning); }

/* 答题页选项 */
.option-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  transition: all 0.16s var(--ease);
}
.option-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.option-item input { margin-top: 3px; accent-color: var(--primary); }
.fill-input { max-width: 340px; margin-top: 8px; }
.question.answered-correct { border-color: #b8e6c8; background: #fbfffc; }
.question.answered-wrong { border-color: #f3c9c9; background: #fffbfb; }

@media (max-width: 860px) {
  .exam-bar { position: static; }
}

/* 11. 考试作答页 / 错题练习页：放大正文字号，保护学生视力 -------------- */
[data-page='take-exam'] .question,
[data-page='wrong-practice'] .question { padding: 18px 20px; }

[data-page='take-exam'] .question-no,
[data-page='wrong-practice'] .question-no {
  min-width: 28px;
  height: 28px;
  font-size: 14.5px;
}
[data-page='take-exam'] .question-head .badge,
[data-page='wrong-practice'] .question-head .badge { font-size: 12.5px; }

[data-page='take-exam'] .question-body,
[data-page='wrong-practice'] .question-body {
  font-size: 18px;
  line-height: 1.9;
  font-weight: 500;
}

[data-page='take-exam'] .question-options li,
[data-page='wrong-practice'] .question-options li {
  padding: 6px 0 6px 2px;
  font-size: 17px;
  line-height: 1.8;
}

[data-page='take-exam'] .option-row,
[data-page='wrong-practice'] .option-row { margin-bottom: 11px; }
[data-page='take-exam'] .option-row label,
[data-page='wrong-practice'] .option-row label {
  font-size: 17px;
  line-height: 1.7;
}
[data-page='take-exam'] .option-row input[type='radio'],
[data-page='take-exam'] .option-row input[type='checkbox'],
[data-page='wrong-practice'] .option-row input[type='radio'],
[data-page='wrong-practice'] .option-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

[data-page='take-exam'] .input,
[data-page='wrong-practice'] .input {
  font-size: 16px;
  padding: 10px 12px;
}

[data-page='take-exam'] .question-answer,
[data-page='wrong-practice'] .question-answer,
[data-page='take-exam'] .question-explanation,
[data-page='wrong-practice'] .question-explanation {
  font-size: 16px;
  line-height: 1.85;
}
[data-page='take-exam'] .question-point,
[data-page='wrong-practice'] .question-point { font-size: 14.5px; }

[data-page='take-exam'] .practice-feedback,
[data-page='wrong-practice'] .practice-feedback {
  display: inline-block;
  margin-top: 8px;
  font-size: 16px;
  font-weight: 600;
}

[data-page='take-exam'] .btn,
[data-page='wrong-practice'] .btn { font-size: 14px; }

/* 未作答题目：提交被拦下时高亮提示，作答后自动取消 */
.question.unanswered {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(226, 70, 70, 0.14);
}
.question.unanswered .question-head::after {
  content: '未作答';
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 600;
}
[data-page='take-exam'] .exam-bar-info strong { font-size: 16.5px; }
[data-page='take-exam'] .timer-value { font-size: 1.55rem; }

@media (max-width: 860px) {
  [data-page='take-exam'] .question-body,
  [data-page='wrong-practice'] .question-body { font-size: 16.5px; }
  [data-page='take-exam'] .option-row label,
  [data-page='wrong-practice'] .option-row label { font-size: 16px; }
}

/* 12. 打印 --------------------------------------------------------------- */
@media print {
  .topbar,
  .sidebar,
  .page-actions,
  .no-print,
  .toast-wrap,
  .modal-mask { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
  .card {
    border: none;
    box-shadow: none;
    break-inside: avoid;
  }
  .question {
    border: none;
    padding: 6px 0;
    break-inside: avoid;
  }
}

/* ==========================================================================
   10. 移动端 · 学生答题（考试页方案A 逐题聚焦 + 练习页适配，≤860px 生效）
   ========================================================================== */

/* 桌面端隐藏移动端专用组件（答题卡抽屉关闭态也依赖此规则） */
.m-bottom-nav,
.m-progress,
.m-sheet-mask { display: none; }

.m-sheet {
  width: 100%;
  background: var(--surface);
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
}
.m-sheet-grip {
  width: 36px; height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: 0 auto 10px;
}
.m-sheet-head { display: flex; justify-content: space-between; align-items: center; }
.m-sheet-head h3 { margin: 0; font-size: 15px; }
.m-sheet-legend { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.m-sheet-legend span { display: inline-flex; align-items: center; gap: 5px; }
.m-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.m-dot-done { background: var(--success); }
.m-dot-undone { background: var(--surface-3); border: 0.5px solid var(--border-strong); }
.m-dot-current { background: var(--surface); border: 1.5px solid var(--primary); }
.m-sheet-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-top: 10px;
}
.m-sheet-cell {
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  border: 0.5px solid var(--border-strong);
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
}
.m-sheet-cell.done { background: var(--success); border-color: var(--success); color: #fff; }
.m-sheet-cell.current { background: var(--surface); border: 1.5px solid var(--primary); color: var(--primary); }
.m-sheet-actions { display: flex; gap: 8px; margin-top: 12px; }
.m-sheet-actions .btn { flex: 1; }

/* ---------- 大触控选项块（考试页移动端 / 可复用） ---------- */
.m-opts { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.m-opts.m-opts-row { flex-direction: row; }
.m-opt {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  border: 0.5px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m-opts.m-opts-row .m-opt { flex: 1; justify-content: center; }
.m-opt input { position: absolute; opacity: 0; pointer-events: none; }
.m-opt-key {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  border: 0.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.m-opt-text { font-size: 15px; line-height: 1.5; color: var(--text-2); }
.m-opt.selected { border: 1.5px solid var(--primary); background: var(--primary-soft); }
.m-opt.selected .m-opt-key { background: var(--primary); border-color: var(--primary); color: #fff; }
.m-opt.selected .m-opt-text { color: var(--text); }
.m-fill-input { width: 100%; font-size: 16px; min-height: 46px; }

.m-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-card-no { font-size: 12px; color: var(--text-3); }
.m-card-stem { font-size: 16px; line-height: 1.7; margin-top: 10px; }
.m-progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.m-progress-bar i {
  display: block; height: 100%; width: 0;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.25s var(--ease);
}
.m-progress-text { display: block; margin-top: 4px; font-size: 12px; color: var(--text-2); }

@media (max-width: 860px) {

  /* ---------- 考试页：切换到方案A 逐题聚焦 ---------- */
  [data-page='take-exam'] .desktop-actions { display: none !important; }
  [data-page='take-exam'].exam-ended .m-bottom-nav,
  [data-page='take-exam'].exam-ended .m-progress { display: none; }
  [data-page='take-exam'].exam-ended .m-sheet-mask { display: none !important; }

  /* 顶栏吸顶并展示进度 */
  [data-page='take-exam'] .exam-bar { position: sticky; top: 0; z-index: 60; }
  [data-page='take-exam'] .m-progress { display: block; margin-top: 8px; }

  /* 底部三键导航（固定底栏，内容区预留空间） */
  [data-page='take-exam'] { padding-bottom: 78px; }
  [data-page='take-exam'] .m-bottom-nav {
    display: flex;
    gap: 8px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    background: var(--surface);
    border-top: 0.5px solid var(--border);
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(19, 26, 43, 0.06);
  }
  .m-nav-btn {
    flex: 1;
    height: 44px;
    border-radius: 10px;
    border: 0.5px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .m-nav-btn:disabled { opacity: 0.45; cursor: default; }
  .m-nav-btn.m-nav-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
  .m-nav-btn.m-nav-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
  .m-sheet-badge {
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 11px;
    padding: 1px 7px;
  }
  .m-nav-btn.m-nav-danger .m-sheet-badge { background: rgba(255, 255, 255, 0.25); color: #fff; }

  /* 答题卡抽屉：贴底弹出 */
  .m-sheet-mask { align-items: flex-end; }
  .m-sheet {
    max-width: none;
    max-height: 82vh;
    overflow: auto;
    border-radius: 18px 18px 0 0;
  }

  /* ---------- 练习页（≤860px）---------- */
  [data-page='wrong-practice'] { padding-bottom: 78px; }
  [data-page='wrong-practice'] .practice-actions {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    margin: 0;
    background: var(--surface);
    border-top: 0.5px solid var(--border);
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(19, 26, 43, 0.06);
  }
  [data-page='wrong-practice'] .practice-actions .btn { flex: 1; height: 44px; font-size: 15px; }

  /* 查询卡：输入堆叠全宽 */
  .query-card .field { width: 100%; }
  .query-card .input { width: 100% !important; min-height: 44px; font-size: 16px; }
  .query-card #searchBtn { width: 100%; height: 46px; margin-top: 4px; font-size: 15px; }
}

@media (max-width: 560px) {
  /* 统计 2×2（练习页四格） */
  [data-page='wrong-practice'] .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  [data-page='wrong-practice'] .stat { padding: 10px 12px; }
  [data-page='wrong-practice'] .stat-value { font-size: 1.35rem; }
}

/* 11. 错题练习：单题聚焦模式 + 查询摘要栏 ---------------------------------- */

/* 查询摘要栏：查询确认后替代班级/姓名信息栏 */
.query-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.query-summary.hidden { display: none !important; }
.query-summary-text {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
}

/* 单题聚焦导航（sticky，跟随滚动） */
.p-nav {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: calc(var(--topbar-h) + 10px);
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
}
.p-progress {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-nav .btn { min-width: 76px; }
.p-nav .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* 单题聚焦：当前题凸出强调，其余题隐藏 */
.p-hidden { display: none !important; }
.question.p-focus {
  border: 2px solid var(--primary);
  box-shadow: var(--shadow);
}
.question.p-focus .question-no {
  background: var(--primary);
  color: #fff;
}

@media (max-width: 860px) {
  .p-nav { top: calc(var(--topbar-h) + 6px); padding: 7px 10px; }
  .p-nav .btn { min-width: 64px; height: 36px; font-size: 14px; }
  .p-progress { font-size: 12.5px; }
  .query-summary { padding: 10px 12px; gap: 8px; }
  .query-summary-text { font-size: 13px; }
  .query-summary .btn { flex-shrink: 0; }
}

/* 12. 列表表格窄屏转卡片（通用：给 <table> 加 m-cards 类，td 加 data-label） -------- */

/* 名称/长文本列防挤压：换行而非竖排单字 */
.table td { word-break: break-word; }
.table td.row-name { min-width: 140px; }

@media (max-width: 860px) {
  /* 卡片模式：thead 隐藏，每行一张卡，无需横向滚动 */
  .table.m-cards thead { display: none; }
  .table.m-cards,
  .table.m-cards tbody { display: block; }
  .table.m-cards tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-xs);
  }
  .table.m-cards tbody tr:last-child { margin-bottom: 0; }
  .table.m-cards tbody tr:hover { background: var(--surface); }

  /* 普通字段：字段名居左灰字、值居右 */
  .table.m-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: none;
    font-size: 13.5px;
    text-align: right;
  }
  .table.m-cards td[data-label]::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 500;
    flex-shrink: 0;
  }

  /* 卡片标题行（td.row-name，配合 tr 的 column flex 用 order 提到最前） */
  .table.m-cards td.row-name {
    order: -1;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.45;
    margin-bottom: 6px;
    padding: 0;
    text-align: left;
  }

  /* 操作按钮行 */
  .table.m-cards td.actions {
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px dashed var(--border);
    margin-top: 8px;
    padding-top: 10px;
    justify-content: flex-start;
  }
  .table.m-cards td.actions .btn { flex: 1 1 auto; }

  /* 空状态 / 加载中占位 */
  .table .table-empty {
    display: block;
    text-align: center;
    color: var(--text-3);
    font-weight: 400;
    font-size: 13.5px;
    padding: 20px 0;
  }
}

/* 13. 错题练习：手机端导航固定底部（与考试页一致） -------------------------- */
@media (max-width: 860px) {
  .p-nav {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -2px 12px rgba(19, 26, 43, 0.06);
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
  }

  /* 提交按钮行抬到导航栏上方（pNav 高 54 + safe-area） */
  [data-page='wrong-practice'] .practice-actions {
    bottom: calc(54px + env(safe-area-inset-bottom));
    padding: 9px 12px;
    box-shadow: none;
  }

  /* 底部双栏总占位 ~116px + 安全区，避免最后一题被遮挡；
     min-height 撑出滚动余量：单题内容不足一屏时（maxScroll≈0）也能把题卡滚到顶部 */
  [data-page='wrong-practice'] {
    padding-bottom: calc(124px + env(safe-area-inset-bottom));
    min-height: calc(100vh + 480px);
  }
}
