/* ============================================================
 * style.css — 口算练习 H5 全局样式
 * 视觉分区：
 *   家长端（出题器/报告）：清爽教育风 — 蓝白主调、方正、专业
 *   孩子端（闯关游戏）：明亮多彩 — 圆角大按钮、活泼、卡通感
 * 移动端优先，PC 兼容（max-width 容器居中）
 * ============================================================ */

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  /* 家长端配色 */
  --p-bg: #F0F4FA;
  --p-card: #FFFFFF;
  --p-primary: #2F6FED;
  --p-primary-dark: #1E56C8;
  --p-text: #1F2A44;
  --p-sub: #6B7A99;
  --p-border: #DCE4F0;
  --p-accent: #FFB020;

  /* 孩子端配色 */
  --k-bg1: #FFD86B;
  --k-bg2: #FF9A5C;
  --k-card: #FFFFFF;
  --k-primary: #FF6B6B;
  --k-green: #4ECB71;
  --k-blue: #4A9DFF;
  --k-purple: #9B7BFF;
  --k-text: #3D2C1E;
  --k-sub: #8A7A6A;

  --radius: 14px;
  --shadow: 0 4px 16px rgba(31, 42, 68, 0.08);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  color: var(--p-text);
  background: var(--p-bg);
  min-height: 100vh;
}

/* 通用容器：手机全宽，桌面居中限宽 */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

/* 隐藏但保留（无障碍） */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ============================================================
 * 家长端样式（出题器 maker.html / 报告 report.html）
 * ============================================================ */

.page-parent { background: var(--p-bg); }

/* 顶部栏 */
.p-header {
  background: linear-gradient(135deg, #2F6FED 0%, #4A9DFF 100%);
  color: #fff;
  padding: 20px 16px 24px;
  border-radius: 0 0 20px 20px;
  margin-bottom: 16px;
}
.p-header h1 { font-size: 22px; font-weight: 700; }
.p-header p { font-size: 13px; opacity: 0.9; margin-top: 4px; }

/* 卡片 */
.p-card {
  background: var(--p-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 14px;
}
.p-card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 4px solid var(--p-primary);
}

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item label { font-size: 13px; color: var(--p-sub); font-weight: 600; }
.form-item select,
.form-item input[type="number"],
.form-item input[type="text"] {
  border: 1px solid var(--p-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  background: #FBFCFE;
  color: var(--p-text);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.form-item select:focus,
.form-item input:focus { border-color: var(--p-primary); }

/* 题型多选（chips） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--p-border);
  background: #FBFCFE;
  color: var(--p-sub);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.chip.active {
  background: var(--p-primary);
  border-color: var(--p-primary);
  color: #fff;
}

/* 开关（显示答案） */
.switch-row { display: flex; align-items: center; justify-content: space-between; }
.switch-label { font-size: 14px; font-weight: 600; }
.switch {
  position: relative; width: 48px; height: 28px;
  background: #D7DFEC; border-radius: 999px;
  cursor: pointer; transition: background .2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; background: #fff; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on { background: var(--p-primary); }
.switch.on::after { transform: translateX(20px); }

/* 主按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--p-primary); color: #fff; }
.btn-primary:hover { background: var(--p-primary-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--p-primary); color: var(--p-primary); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

/* 试卷预览（屏显模式：白纸） */
.paper-preview {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.paper-preview .paper-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid #333; padding-bottom: 8px; margin-bottom: 14px;
}
.paper-preview .paper-title { font-size: 20px; font-weight: 800; }
.paper-preview .paper-meta { font-size: 13px; color: #666; }
.paper-preview .paper-info {
  display: flex; gap: 24px; font-size: 13px; color: #444;
  margin-bottom: 14px;
}
.paper-preview .paper-info span { border-bottom: 1px solid #999; min-width: 70px; display: inline-block; }

/* 题目网格（屏显） */
.q-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 12px;
}
.q-item {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  padding: 6px 2px;
  white-space: nowrap;
}
.q-item .q-ans { display: inline-block; min-width: 34px; border-bottom: 1.5px solid #999; color: #333; }
.q-item .q-ans.show { border-color: transparent; color: var(--p-primary-dark); font-weight: 800; }

/* 竖式排版（列式） */
.q-item.column {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: top;
}
.q-item.column .col-row { text-align: right; font-size: 18px; min-height: 26px; }
.q-item.column .col-op { font-size: 15px; }
.q-item.column .col-line { border-top: 2px solid #333; width: 52px; margin: 2px 0; }
.q-item.column .col-ans { text-align: right; font-size: 18px; min-height: 26px; }

/* 操作提示 */
.hint { font-size: 12px; color: var(--p-sub); margin-top: 8px; text-align: center; }

/* 报告页 */
.report-score {
  display: flex; align-items: center; gap: 16px;
}
.report-score .score-num {
  font-size: 42px; font-weight: 800; color: var(--p-primary);
  line-height: 1;
}
.report-score .score-label { font-size: 13px; color: var(--p-sub); }

.weakness-list { display: flex; flex-direction: column; gap: 10px; }
.weakness-item {
  border: 1px solid var(--p-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.weakness-item .w-name { font-size: 14px; font-weight: 700; }
.weakness-item .w-bar {
  height: 8px; background: #EEF2F8; border-radius: 4px;
  margin: 6px 0; overflow: hidden;
}
.weakness-item .w-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #FFB020, #FF6B6B);
  border-radius: 4px;
}
.weakness-item .w-suggest { font-size: 12px; color: var(--p-sub); }

.advice-box {
  background: #F0F7FF;
  border: 1px solid #CFE3FF;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: #1F3A6E;
  white-space: pre-line;
}

/* 记录列表 */
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-item {
  border: 1px solid var(--p-border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.rec-item .r-main { font-size: 13px; }
.rec-item .r-title { font-weight: 700; font-size: 14px; }
.rec-item .r-sub { color: var(--p-sub); font-size: 12px; }
.rec-item .r-right { text-align: right; }
.rec-item .r-acc { font-size: 20px; font-weight: 800; color: var(--p-primary); }
.rec-item .r-acc.low { color: #FF6B6B; }

/* 趋势图（极简柱状） */
.trend { display: flex; align-items: flex-end; gap: 6px; height: 90px; padding: 10px 4px 0; }
.trend .t-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.trend .t-bar {
  width: 100%; max-width: 26px;
  background: linear-gradient(180deg, #4A9DFF, #2F6FED);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height .3s;
}
.trend .t-val { font-size: 10px; color: var(--p-sub); }
.trend .t-label { font-size: 10px; color: var(--p-sub); white-space: nowrap; }

/* ============================================================
 * 孩子端样式（闯关游戏 game.html）
 * ============================================================ */

.page-kid {
  background: linear-gradient(160deg, var(--k-bg1) 0%, var(--k-bg2) 100%);
  color: var(--k-text);
  min-height: 100vh;
}

/* 游戏头部 */
.k-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 6px;
}
.k-header .k-logo { font-size: 20px; font-weight: 800; }
.k-header .k-coins {
  background: rgba(255,255,255,0.9);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px; font-weight: 800;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.k-header .k-coins .coin { color: #F5A623; }

/* 关卡地图 */
.level-map { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 20px; }
.level-card {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.92);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform .1s;
}
.level-card:active { transform: scale(0.98); }
.level-card.locked { opacity: 0.55; cursor: not-allowed; }
.level-card .lv-num {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--k-primary);
  color: #fff;
  font-size: 20px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.level-card.locked .lv-num { background: #C9C2BA; }
.level-card .lv-info { flex: 1; }
.level-card .lv-name { font-size: 16px; font-weight: 800; }
.level-card .lv-desc { font-size: 12px; color: var(--k-sub); }
.level-card .lv-stars { font-size: 14px; letter-spacing: 2px; }
.level-card .lv-stars .star { color: #E5D9C5; }
.level-card .lv-stars .star.lit { color: #F5A623; }
.level-card .lv-best { font-size: 11px; color: var(--k-sub); }

/* 游戏进行中 */
.k-game {
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  padding: 20px 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  text-align: center;
}
.k-game .g-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.k-game .g-progress { font-size: 13px; font-weight: 700; color: var(--k-sub); }
.k-game .g-timer {
  font-size: 22px; font-weight: 800;
  color: var(--k-primary);
  font-variant-numeric: tabular-nums;
}
.k-game .g-combo {
  font-size: 14px; font-weight: 800; color: var(--k-purple);
  min-height: 20px; margin-bottom: 4px;
}
.k-game .g-question {
  font-size: 40px; font-weight: 800;
  margin: 14px 0 20px;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

/* 竖式大题 */
.k-game .g-question.column-q {
  font-size: 30px;
  display: inline-flex; flex-direction: column; align-items: flex-end;
}
.k-game .column-q .cq-line { border-top: 3px solid var(--k-text); width: 96px; margin: 4px 0; }

/* 答案输入（v4：div 模拟，永不弹系统键盘） */
.answer-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.ans-slot {
  width: 120px;
  min-height: 58px;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  border: 3px solid var(--k-blue);
  border-radius: 14px;
  padding: 6px 8px;
  color: var(--k-text);
  background: #fff;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, box-shadow .15s;
}
.ans-slot.active {
  border-color: var(--k-green);
  box-shadow: 0 0 0 3px rgba(78,203,113,.25);
}
.ans-slot:empty::before {
  content: '?';
  color: #C9C2BA;
  font-weight: 400;
}

/* 带余数除法：商 + 余数 双输入位 */
.divmod-row { align-items: center; }
.divmod-row .dm-label { font-size: 16px; font-weight: 800; color: var(--k-sub); }
.divmod-row .ans-slot { width: 76px; min-height: 54px; font-size: 26px; }

/* 底部常驻虚拟键盘（v4） */
.vkeypad {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  background: rgba(255,255,255,.98);
  border-top: 2px solid #F0E9E0;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
}
.vk-btn {
  border: none;
  background: #F2EEE8;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 800;
  padding: 12px 0;
  cursor: pointer;
  color: var(--k-text);
  transition: transform .08s, background .1s;
  min-height: 50px;
}
.vk-btn:active { transform: scale(0.94); background: #E4DDD3; }
.vk-btn.vk-del { background: #FFD9D9; color: #E5484D; }
.vk-btn.vk-clear { background: #FFF3D6; color: #B7791F; }
.vk-btn.vk-ok {
  grid-column: 1 / -1;
  background: var(--k-green);
  color: #fff;
  font-size: 20px;
  min-height: 48px;
}
.vk-btn.vk-ok:active { background: #3DA95C; }

/* 游戏容器给底部键盘留空间 */
.k-game { margin-bottom: 230px; }

/* 数字键盘 */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 300px;
  margin: 0 auto;
}
.keypad button {
  border: none;
  background: #F2EEE8;
  border-radius: 12px;
  font-size: 22px; font-weight: 800;
  padding: 12px 0;
  cursor: pointer;
  color: var(--k-text);
  transition: transform .08s;
}
.keypad button:active { transform: scale(0.94); background: #E4DDD3; }
.keypad button.key-ok { background: var(--k-green); color: #fff; }
.keypad button.key-del { background: #FFD9D9; color: #E5484D; }

/* 结果反馈动画 */
@keyframes pop-right { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
@keyframes float-up { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-40px); opacity: 0; } }

.feedback {
  position: fixed; top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 44px; font-weight: 800;
  pointer-events: none;
  z-index: 50;
  display: none;
}
.feedback.show { display: block; animation: pop-right .35s ease-out; }
.feedback.correct { color: #2EA043; }
.feedback.wrong { color: #E5484D; animation: shake .4s; }

.feedback-float {
  position: fixed; top: 30%;
  font-size: 20px; font-weight: 800;
  color: #F5A623;
  pointer-events: none; z-index: 51;
  display: none;
}
.feedback-float.show { display: block; animation: float-up .8s ease-out forwards; }

/* 结算弹层 */
.k-result {
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.k-result .r-stars { font-size: 40px; letter-spacing: 6px; margin-bottom: 8px; }
.k-result .r-stars .star { color: #E5D9C5; }
.k-result .r-stars .star.lit { color: #F5A623; }
.k-result .r-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.k-result .r-stats {
  display: flex; justify-content: center; gap: 20px;
  font-size: 13px; color: var(--k-sub);
  margin: 10px 0 4px;
}
.k-result .r-stats b { font-size: 18px; color: var(--k-text); display: block; }
.k-result .r-record { font-size: 13px; color: #F5A623; font-weight: 700; margin: 6px 0; }
.k-result .r-wrongs { text-align: left; margin: 10px 0; }
.k-result .r-wrongs h4 { font-size: 14px; margin-bottom: 6px; }
.k-result .r-wrongs .w-item { font-size: 13px; color: #666; padding: 2px 0; }
.k-result .btn-row { margin-top: 14px; }

/* 进度条 */
.g-progress-bar { height: 6px; background: #EFE9E0; border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.g-progress-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--k-green), var(--k-blue));
  border-radius: 3px;
  transition: width .3s;
}

/* ============================================================
 * 打印样式（出题器 A4 试卷）
 * ============================================================ */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .page-parent { background: #fff; }
  .p-header, .p-card { box-shadow: none; border-radius: 0; }
  .paper-preview { box-shadow: none; padding: 0; margin: 0; }
  .paper-preview .paper-title { font-size: 18px; }
  /* 试卷网格：A4 竖版适合 4 列 */
  .q-grid { grid-template-columns: repeat(4, 1fr); gap: 14px 16px; }
  .q-item { font-size: 16px; }
  .q-item.column .col-row, .q-item.column .col-ans { font-size: 17px; }
  @page { size: A4; margin: 14mm 12mm; }
}

/* 手机窄屏：题目 3 列 */
@media (max-width: 480px) {
  .q-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}

/* ============================================================
 * v3 在线练习（practice.html）
 * 说明：只新增类名（pz- 练习页 / pq- 打印题面），不改动上面任何既有类
 * ============================================================ */

/* ---------- 报告页分区切换（闯关 / 练习） ---------- */
.tab-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.tab-btn {
  flex: 1;
  border: 1.5px solid var(--p-border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--p-sub);
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow);
}
.tab-btn.active { background: var(--p-primary); border-color: var(--p-primary); color: #fff; }

/* ---------- 步骤条 ---------- */
.pz-steps { display: flex; gap: 6px; margin-bottom: 12px; }
.pz-step {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--p-sub);
  background: #fff;
  border-radius: 10px;
  padding: 7px 2px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  overflow: hidden;
}
.pz-step.active { background: var(--p-primary); color: #fff; }
.pz-step.done { background: #E8F0FF; color: var(--p-primary); }

.pz-tip { font-size: 13px; color: var(--p-sub); line-height: 1.7; margin-bottom: 10px; }
.pz-error { font-size: 13px; color: #E5484D; margin-top: 8px; }
.pz-sub-title { font-size: 15px; font-weight: 700; margin: 16px 0 8px; }

/* ---------- 选年级 ---------- */
.pz-grade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pz-grade-card {
  border: 1.5px solid var(--p-border);
  background: #FBFCFE;
  border-radius: 14px;
  padding: 16px 10px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  color: var(--p-text);
  transition: transform .1s, border-color .15s, background .15s;
}
.pz-grade-card:active { transform: scale(0.97); background: #F2F7FF; border-color: var(--p-primary); }
.pz-grade-card .pz-gc-title { font-size: 17px; font-weight: 800; }
.pz-grade-card .pz-gc-sub { font-size: 11px; color: var(--p-sub); margin-top: 4px; line-height: 1.5; }

/* ---------- 选主题 ---------- */
.pz-topic-list { display: flex; flex-direction: column; gap: 10px; }
.pz-topic-card {
  border: 1.5px solid var(--p-border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pz-topic-card.active { border-color: var(--p-primary); background: #F5F9FF; }
.pz-topic-card .pz-tc-name { font-size: 15px; font-weight: 800; }
.pz-topic-card .pz-tc-desc { font-size: 12px; color: var(--p-sub); margin-top: 2px; line-height: 1.6; }
.pz-topic-card .pz-tc-types { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pz-tag {
  font-size: 11px;
  background: #EAF1FF;
  color: var(--p-primary);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}
.pz-tag.warn { background: #FFF1E0; color: #C77700; }

/* ---------- 题数选择 ---------- */
.pz-count-row { display: flex; align-items: center; gap: 8px; margin: 16px 0 4px; flex-wrap: wrap; }
.pz-count-label { font-size: 13px; font-weight: 700; color: var(--p-sub); }
.pz-count-btn {
  border: 1.5px solid var(--p-border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--p-sub);
  cursor: pointer;
  font-family: inherit;
}
.pz-count-btn.active { background: var(--p-primary); border-color: var(--p-primary); color: #fff; }

/* ---------- 在线答题卡 ---------- */
.pz-quiz {
  background: var(--p-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 14px;
}
.pz-quiz-top { display: flex; justify-content: space-between; align-items: center; }
.pz-progress-text { font-size: 14px; font-weight: 700; color: var(--p-sub); }
.pz-timer { font-size: 20px; font-weight: 800; color: var(--p-primary); font-variant-numeric: tabular-nums; }
.pz-quiz-tag { font-size: 12px; color: var(--p-sub); margin: 10px 0 2px; text-align: center; }
.pz-question {
  font-size: 40px;
  font-weight: 800;
  text-align: center;
  padding: 22px 6px 18px;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
/* 答题卡里的竖式/分数：比卷面放大一些，孩子看得清 */
.pz-question .pq-col .pq-col-row { font-size: 36px; min-height: 46px; }
.pz-question .pq-col .pq-col-op { font-size: 30px; }
.pz-question .pq-col .pq-col-op .pq-num { font-size: 36px; line-height: 1.2; }
.pz-question .pq-col .pq-col-op .pq-op-symbol { font-size: 26px; margin-right: 4px; }
.pz-question .pq-col .pq-col-line { width: 108px; border-top-width: 3px; }
.pz-question .pq-col .pq-col-ans { min-height: 40px; }
.pz-question .pq-div .pq-div-q,
.pz-question .pq-div .pq-div-sor,
.pz-question .pq-div .pq-div-dd { font-size: 32px; }
.pz-question .pq-div .pq-div-q { padding-left: 46px; min-height: 38px; }
.pz-question .pq-frac { font-size: 40px; margin: 0 6px; }   /* 与 .pz-question .pq-num/.pq-word 同字号（分数数字=整数数字） */
.pz-question .pq-num, .pz-question .pq-word { font-size: 40px; }

.pz-answer-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pz-in-label { font-size: 16px; font-weight: 800; color: var(--p-sub); }
.pz-input {
  width: 152px;
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  border: 3px solid var(--p-primary);
  border-radius: 14px;
  padding: 8px 6px;
  color: var(--p-text);
  background: #fff;
  outline: none;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}
.pz-input.small { width: 96px; font-size: 26px; }
.pz-input:focus { border-color: #4ECB71; box-shadow: 0 0 0 3px rgba(78, 203, 113, .22); }
.pz-key-btn {
  border: none;
  background: #EEF2F8;
  border-radius: 12px;
  min-width: 56px;
  min-height: 52px;
  padding: 10px 12px;
  font-size: 22px;
  font-weight: 800;
  color: var(--p-text);
  cursor: pointer;
  font-family: inherit;
}
.pz-key-btn:active { transform: scale(0.94); }
.pz-answer-hint { width: 100%; text-align: center; font-size: 12px; color: var(--p-sub); margin-top: 4px; }
.pz-feedback { text-align: center; font-size: 19px; font-weight: 800; min-height: 32px; margin-top: 10px; }
.pz-feedback.ok { color: #2EA043; }
.pz-feedback.bad { color: #E5484D; }
.pz-feedback.hint { color: var(--p-accent); font-size: 15px; font-weight: 700; }
.pz-feedback .pz-fb-ans { display: block; font-size: 12px; font-weight: 600; color: var(--p-sub); margin-top: 4px; }

/* ---------- 结算 ---------- */
.pz-score-row { display: flex; align-items: center; gap: 16px; }
.pz-score-num { font-size: 46px; font-weight: 800; color: var(--p-primary); line-height: 1; }
.pz-score-label { font-size: 13px; color: var(--p-sub); line-height: 1.6; }
.pz-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.pz-stat-row > div { background: #F5F8FE; border-radius: 10px; padding: 8px 2px; }
.pz-stat-row b { display: block; font-size: 17px; }
.pz-stat-row span { font-size: 11px; color: var(--p-sub); }
.pz-wrong-list { display: flex; flex-direction: column; gap: 8px; }
.pz-wrong-item { border: 1px solid var(--p-border); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.pz-wrong-item .pz-w-q { font-weight: 800; margin-bottom: 2px; }
.pz-wrong-item .pz-w-u { color: #E5484D; font-weight: 700; }
.pz-wrong-item .pz-w-a { color: #2EA043; font-weight: 700; }
.pz-wrong-item .pz-w-meta { font-size: 11px; color: var(--p-sub); margin-top: 2px; }

/* 竖式填空（在线答题）——填空位嵌在竖式图形内，位置与手写竖式一致 */
.iq-col { display: inline-flex; flex-direction: column; align-items: flex-end; }
.iq-row { display: flex; align-items: center; }
.iq-cell { display: inline-flex; width: 1.5em; height: 1.5em; align-items: center; justify-content: center; font-size: inherit; }
.iq-num { font-weight: 700; }
.iq-dot { font-weight: 700; color: #1F2A44; }
/* a/b 行小数点：不占数位宽，紧贴数字 */
.iq-dot-mini {
  display: inline-block;
  width: 0.35em;
  text-align: center;
  font-weight: 700;
  color: #1F2A44;
  margin: 0 -0.1em;
}
/* 小数点位容圆 ○：坐在两格缝隙正中，大小清晰可见、不压两侧框 */
.iq-ans-cell { position: relative; }   /* ○ 绝对定位的参考 */
.iq-ans-cell .iq-input { width: 1.05em; }   /* 留出更大缝隙给 ○ */
.iq-dotpick {
  position: absolute;
  left: -0.2em;            /* 直径 0.4em 的圆点在缝隙中居中 */
  bottom: 0.12em;          /* 贴格下角，不侵下一行 */
  width: 0.4em;
  height: 0.4em;
  border-radius: 50%;
  border: 1.5px solid #7A93BC;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
  z-index: 2;
  padding: 0;
}
/* 扩大点击热区，不改变视觉大小 */
.iq-dotpick::before {
  content: '';
  position: absolute;
  inset: -0.28em;
}
.iq-dotpick.sel {
  background: #2F6FED;
  border-color: #2F6FED;
}
.iq-dotpick.sel::after {
  content: '';
  display: block;
  width: 0.2em;
  height: 0.2em;
  border-radius: 50%;
  background: #fff;
  margin: 0.08em auto 0;
}
.iq-dotpick.st-wrong { border-color: #E5484D; background: #E5484D; }
.iq-dotpick.st-ok { border-color: #2EA043; background: #2EA043; }
/* op 符号绝对定位到数字块左侧空白，不占列宽 → b 行与 a 行数字格严格同列 */
.iq-op-row { position: relative; }
.iq-op {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  min-width: 1.2em;
  text-align: center;
  font-weight: 400;
  padding-right: 0.2em;
  white-space: nowrap;
}
.iq-carry-row { display: flex; height: 1.7em; align-items: center; margin-bottom: 2px; }
.iq-line { border-top: 3px solid #333; width: 100%; margin: 2px 0; }
.iq-ans-row .iq-cell { font-weight: 800; }
/* 填空位 input：嵌入对应数字位，等宽、居中对齐 */
.iq-input {
  width: 1.15em;
  height: 1.5em;
  font-size: inherit;
  text-align: center;
  padding: 0;
  border: 1.5px solid #9BB3D8;
  border-radius: 4px;
  background: #F5F9FF;
  color: #1F2A44;
  font-weight: 700;
  box-sizing: border-box;   /* 防边框把框撑宽导致相邻格重叠 */
  min-width: 0;             /* flex 项默认 min-width:auto，会拒绝缩到格子内 */
}
.iq-input.iq-carry {
  /* 进位/退位点：小号，写在横线上方 */
  width: 1.2em;
  height: 1.2em;
  font-size: 0.85em;
  border-color: #B8A06B;
  background: #FFF9EC;
}
.iq-input:focus { outline: 2px solid #2F6FED; }
.iq-input.st-ok { border-color: #2EA043; background: #E8F7EE; color: #1a7f37; }
.iq-input.st-wrong { border-color: #E5484D; background: #FFF0F0; color: #c93a40; }
/* 长除法竖式 */
/* ============================================================
 * 长除法竖式（在线答题，iq-dg- 网格模型）
 * 列：除数 | 竖线 | 被除数各列（小数点占窄列）
 * ============================================================ */
.iq-div { display: inline-flex; flex-direction: column; align-items: flex-start; }
.iq-dg-row { display: flex; align-items: flex-end; }
.iq-dg-sor {
  width: 1.6em;
  min-width: 1.6em;
  text-align: right;
  font-weight: 700;
  line-height: 1.4;
}
.iq-dg-bar { width: 0.45em; min-width: 0.45em; align-self: stretch; }
.iq-dg-bar-live { border-right: 2.5px solid #333; }
.iq-dgc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.5em;
  font-weight: 700;
  flex: none;
}
.iq-dg-ddrow .iq-dg-bar-live { border-top: 2.5px solid #333; }
.iq-dg-ddrow .iq-dgc { border-top: 2.5px solid #333; }
.iq-dg-qrow .iq-dgc { height: 1.6em; }
.iq-dg-linerow .iq-dgc { height: 0.1em; }
.iq-dg-hline { border-top: 2px solid #999; }
.iq-dg-qrow .iq-div-q { width: 1.15em; height: 1.35em; font-size: 0.9em; box-sizing: border-box; min-width: 0; }
.iq-stepnum { width: 1.15em; height: 1.35em; font-size: 0.9em; box-sizing: border-box; min-width: 0; }
.iq-dot { font-weight: 700; }
/* 长除答案行：右对齐到被除数右缘，个位与被除数个位同列 */
.iq-div-ans { display: flex; justify-content: flex-end; margin-top: 2px; }
/* 分步积数字 */
.iq-partial-num { color: #4A5A78; font-weight: 700; }


/* ============================================================
 * 打印卷题面（print.js 产出，pq- 前缀）
 * 屏显与打印共用；打印时由下方 @media print 再压紧
 * ============================================================ */
.pq-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
.pq-grid.pq-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pq-grid.pq-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pq-grid.pq-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.pq-item { font-size: 17px; font-weight: 600; text-align: center; padding: 4px 2px; min-width: 0; }
.pq-item.pq-inline-item { white-space: nowrap; }

/* 字体按题数档位（print.js sizeClass，固定 3 列） */
.pq-grid.pq-size-m .pq-item { font-size: 15px; }
.pq-grid.pq-size-s .pq-item { font-size: 13px; }
.pq-grid.pq-size-xs .pq-item { font-size: 12px; }
.pq-grid.pq-size-m .pq-col .pq-col-row, .pq-grid.pq-size-m .pq-col .pq-col-ans { font-size: 16px; min-height: 22px; line-height: 1.15; }
.pq-grid.pq-size-s .pq-col .pq-col-row, .pq-grid.pq-size-s .pq-col .pq-col-ans { font-size: 14px; min-height: 19px; line-height: 1.15; }
.pq-grid.pq-size-xs .pq-col .pq-col-row, .pq-grid.pq-size-xs .pq-col .pq-col-ans { font-size: 13px; min-height: 18px; line-height: 1.15; }
.pq-grid.pq-size-m .pq-col .pq-col-op .pq-num { font-size: 16px; }
.pq-grid.pq-size-s .pq-col .pq-col-op .pq-num { font-size: 14px; }
.pq-grid.pq-size-xs .pq-col .pq-col-op .pq-num { font-size: 13px; }
/* 紧凑竖式：行高随档位收紧，保证一页放下 */
.pq-grid.pq-size-m .pq-item { padding: 2px 2px; }
.pq-grid.pq-size-s .pq-item { padding: 1px 2px; }
.pq-grid.pq-size-xs .pq-item { padding: 1px 2px; }
.pq-grid.pq-size-m .pq-col .pq-col-line { margin: 1px 0; }
.pq-grid.pq-size-s .pq-col .pq-col-line { margin: 1px 0; }
.pq-grid.pq-size-xs .pq-col .pq-col-line { margin: 0; }
.pq-grid.pq-size-m { gap: 10px 12px; }
.pq-grid.pq-size-s { gap: 8px 12px; }
.pq-grid.pq-size-xs { gap: 6px 10px; }

/* 打印预览（屏显）内题目允许换行，避免长题撑破网格列宽 */
.paper-preview .pq-item,
.paper-preview .pq-item.pq-inline-item,
.paper-preview .pq-expr { white-space: normal; }
.paper-preview .pq-item { overflow: hidden; }
.pq-expr { white-space: nowrap; }
.pq-num { display: inline-block; text-align: right; font-variant-numeric: tabular-nums; }
.pq-word { display: inline-block; }
.pq-eq { margin: 0 4px; }
.pq-blank { display: inline-block; min-width: 40px; border-bottom: 1.5px solid #999; }
.pq-blank.show { border-color: transparent; color: var(--p-primary-dark); font-weight: 800; }

/* 分数：上下结构（分子 / 横线 / 分母） */
.pq-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  position: relative;
  top: -0.095em;             /* 与运算符（+ − × ÷）墨心对齐：middle 对齐时分数线偏低（实测 3.8px @ 40px 字号 → 0.095em） */
  margin: 0 3px;
  line-height: 1.05;
  font-size: inherit;      /* 与同行整数同字号 */
}
.pq-frac .pq-fn { border-bottom: 1.5px solid currentColor; padding: 0 3px; }
.pq-frac .pq-fd { padding: 0 3px; }

/* 竖式（加减乘）：数位右对齐 → 小数点自然对齐；等宽单元格保证 a/b 右边界对齐 */
.pq-col { display: inline-flex; flex-direction: column; align-items: stretch; width: 4.2em; }
.pq-col .pq-col-row {
  text-align: right;
  min-height: 26px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.25;
  padding: 0 2px;
}
.pq-col .pq-col-op { font-size: 15px; line-height: 1.25; padding: 0 2px; }
.pq-col .pq-col-op .pq-op-symbol { font-size: 13px; margin-right: 2px; }
.pq-col .pq-col-op .pq-num { font-size: 18px; line-height: 1.25; }
.pq-col .pq-col-line { border-top: 2px solid #333; width: 100%; margin: 2px 0; }
.pq-col .pq-col-ans { min-height: 26px; text-align: right; font-size: 18px; line-height: 1.25; padding: 0 2px; }

/* 长除法：商写在上方横线上，除数在左、被除数在横线右侧 */
.pq-div { display: inline-flex; flex-direction: column; align-items: stretch; }
.pq-div .pq-div-q {
  min-height: 22px;
  padding-left: 22px;
  text-align: right;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.pq-div .pq-div-b { display: inline-flex; align-items: center; }
.pq-div .pq-div-sor { font-size: 17px; padding-right: 4px; font-variant-numeric: tabular-nums; }
.pq-div .pq-div-dd {
  font-size: 17px;
  border-top: 2px solid #333;
  border-left: 2px solid #333;
  padding: 1px 6px 0;
  font-variant-numeric: tabular-nums;
}

/* ---------- 练习页：打印时只留试卷 ---------- */
@media print {
  .pz-steps, .pz-quiz, .pz-topic-list, .pz-count-row { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; padding: 0; }
  .paper-preview { width: 100%; max-width: 100%; box-sizing: border-box; overflow: hidden; padding: 0; margin: 0; box-shadow: none; }
  .pq-grid { gap: 14px 16px; }
  .pq-item { font-size: 16px; min-width: 0; overflow: hidden; }
  .pq-item.pq-inline-item { white-space: normal; }
  .pq-expr { white-space: normal; }
  .pq-col .pq-col-row, .pq-col .pq-col-ans { font-size: 17px; }
  .pq-div .pq-div-q, .pq-div .pq-div-sor, .pq-div .pq-div-dd { font-size: 16px; }
  .pq-frac { font-size: inherit; }
  .pq-grid.pq-size-m .pq-item { font-size: 15px; }
  .pq-grid.pq-size-s .pq-item { font-size: 13px; }
  .pq-grid.pq-size-xs .pq-item { font-size: 12px; }
  .pq-grid.pq-size-m .pq-col .pq-col-row, .pq-grid.pq-size-m .pq-col .pq-col-ans { font-size: 16px; }
  .pq-grid.pq-size-s .pq-col .pq-col-row, .pq-grid.pq-size-s .pq-col .pq-col-ans { font-size: 14px; }
  .pq-grid.pq-size-xs .pq-col .pq-col-row, .pq-grid.pq-size-xs .pq-col .pq-col-ans { font-size: 13px; }
  @page { size: A4; margin: 14mm 12mm; }
}

/* ---------- 练习页：窄屏 ---------- */
@media (max-width: 480px) {
  .pz-question { font-size: 34px; }
  .pz-question .pq-num, .pz-question .pq-word { font-size: 34px; }
  .pz-question .pq-col .pq-col-row { font-size: 30px; min-height: 40px; }
  .pz-question .pq-col .pq-col-op .pq-num { font-size: 30px; }
  .pz-question .pq-col .pq-col-op .pq-op-symbol { font-size: 22px; }
  .pz-question .pq-frac { font-size: 34px; }   /* 与窄屏 .pq-num/.pq-word 同字号 */
  .pz-input { width: 128px; font-size: 26px; }
  .pq-grid.pq-cols-5 { grid-template-columns: repeat(4, 1fr); }
  .pz-step { font-size: 10px; }
}
