/* ============================================================
   知识闯关 · 样式表（移动优先 · 精致版）
   ============================================================ */

:root {
  /* ---- 主色系 ---- */
  --blue: #4F7CFF;
  --blue-deep: #3360DD;
  --blue-soft: #EEF3FF;
  --orange: #FF6B35;
  --orange-soft: #FFF1EB;
  --green: #2BC48B;
  --green-deep: #1AA36D;
  --green-soft: #E8FAF3;
  --red: #EF5350;
  --red-soft: #FFEEEE;
  --yellow-bg: #FFF9E6;
  --yellow-border: #FFE066;
  --yellow-text: #8B6914;

  /* ---- 中性 ---- */
  --bg: #F4F6FC;
  --card: #FFFFFF;
  --ink: #1A1F36;
  --muted: #8892A8;
  --line: #E8ECF4;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(26,31,54,.06);
  --shadow-md: 0 8px 28px rgba(26,31,54,.10);
  --shadow-lg: 0 16px 40px rgba(79,124,255,.14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { overflow-x: hidden; }
html { -webkit-text-size-adjust: 100%; }

/* ==================== 全局 ==================== */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.58;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px;
}

/* ==================== 屏幕切换 ==================== */
.screen { display: none; animation: screenIn .28s ease-out both; }
.screen.active { display: block; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==================== 顶部导航栏 ==================== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(232,236,244,.6);
}
.brand {
  display: flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, var(--blue), #7C5CFF);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -.3px;
}
.badges { display: flex; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--blue-soft); border-radius: 999px;
  padding: 5px 11px; font-size: 13px; color: var(--blue-deep);
  white-space: nowrap; font-weight: 600;
}
.badge b { color: var(--ink); }

/* ==================== 首页 ==================== */

/* --- Hero 区域 --- */
.hero {
  text-align: center;
  padding: 28px 4px 8px;
}
.hero h1 {
  font-size: 27px; font-weight: 900;
  margin: 0 0 8px;
  background: linear-gradient(135deg, var(--ink) 40%, var(--blue));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -.5px;
}
.hero p {
  color: var(--muted);
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

/* --- 学段选择器 --- */
.stage-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0;
}
.stage-card {
  border: 1.5px solid transparent;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 18px 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  overflow: hidden;
}
.stage-card::before {
  content: '';
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity .18s;
}
.stage-card:active { transform: scale(.96); }
.stage-card[data-stage="小学"] {
  background: linear-gradient(165deg, #FFF 0%, #E8F5FD 100%);
  box-shadow: 0 4px 16px rgba(79,124,255,.10);
}
.stage-card[data-stage="小学"]:hover,
.stage-card[data-stage="小学"].sel {
  border-color: #7CB8FF;
  box-shadow: 0 6px 22px rgba(79,124,255,.18);
}
.stage-card[data-stage="初中"] {
  background: linear-gradient(165deg, #FFF 0%, #FFF4ED 100%);
  box-shadow: 0 4px 16px rgba(255,107,53,.10);
}
.stage-card[data-stage="初中"]:hover,
.stage-card[data-stage="初中"].sel {
  border-color: #FFB08E;
  box-shadow: 0 6px 22px rgba(255,107,53,.18);
}
.stage-card[data-stage="高中"] {
  background: linear-gradient(165deg, #FFF 0%, #F3EEFF 100%);
  box-shadow: 0 4px 16px rgba(124,92,255,.10);
}
.stage-card[data-stage="高中"]:hover,
.stage-card[data-stage="高中"].sel {
  border-color: #C4ADFF;
  box-shadow: 0 6px 22px rgba(124,92,255,.18);
}
.stage-card .emo { font-size: 38px; line-height: 1; }
.stage-card .t {
  font-weight: 800; font-size: 17px;
  color: var(--ink);
}

/* --- 模式按钮列表 --- */
.mode-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1.5px solid var(--line);
  background: var(--card);
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 15px 18px;
  text-align: left;
  transition: all .18s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.mode-btn:hover {
  border-color: #C8D0E8;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.mode-btn:active { transform: scale(.98); }

.mode-btn .mode-icon {
  flex: 0 0 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}
.mode-btn small {
  display: block;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* 各按钮独立配色 */
.mode-btn.primary {
  /* 统一风格：与其它菜单卡片一致 */
  color: var(--ink);
}
.mode-btn.primary .mode-icon {
  background: var(--blue-soft);
}
.mode-btn[data-mode="free"] .mode-icon {
  background: var(--orange-soft);
}
.mode-btn[data-mode="wrong"] .mode-icon {
  background: var(--red-soft);
}
.mode-btn[data-mode="profile"] .mode-icon {
  background: var(--green-soft);
}
.mode-btn[data-mode="overview"] .mode-icon {
  background: #F0EAFF;
}
.mode-btn[data-mode="eng"] .mode-icon {
  background: #E3F0FF;
}

/* --- 题库统计条 --- */
.bank-stat {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 18px 0 4px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #F8FAFE, #F0F4FF);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  letter-spacing: .2px;
}
.bank-stat b { color: var(--blue-deep); font-weight: 700; }

/* ==================== 通用组件 ==================== */
.screen-title {
  font-size: 23px;
  font-weight: 900;
  margin: 8px 0 18px;
  color: var(--ink);
  letter-spacing: -.3px;
}
.sub {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--muted);
}
.back {
  border: none; background: transparent; color: var(--blue);
  cursor: pointer; font-size: 16px; font-weight: 600;
  padding: 4px 0; display: inline-flex; align-items: center; gap: 2px;
}
.back:hover { color: var(--blue-deep); }

.big-btn {
  width: 100%; border: none; cursor: pointer; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--orange), #E84A1A);
  color: #fff; font-size: 17px; font-weight: 800;
  padding: 15px; margin-top: 14px;
  box-shadow: 0 6px 20px rgba(255,107,53,.30);
  letter-spacing: .3px;
  transition: transform .15s, box-shadow .15s;
}
.big-btn:active { transform: scale(.98); box-shadow: 0 3px 10px rgba(255,107,53,.25); }
.big-btn:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.big-btn.ghost {
  background: var(--card); color: var(--blue);
  border: 1.5px solid var(--blue); box-shadow: none;
  font-weight: 700;
}

/* ==================== 自由闯关设置 ==================== */
.setup-box { display: flex; flex-direction: column; gap: 20px; }
.setup-group h4 {
  margin: 0 0 10px; font-size: 14px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer;
  border-radius: 999px; padding: 9px 16px; font-size: 15px; font-weight: 600;
  color: var(--ink); transition: all .15s ease;
  user-select: none;
}
.chip.sel {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff; border-color: transparent;
  box-shadow: 0 3px 12px rgba(79,124,255,.25);
}
.chip:active { transform: scale(.95); }

/* ==================== 答题布局 ==================== */
.quiz-layout { display: block; }
.quiz-main { width: 100%; }
.quiz-side { display: none; }

@media (min-width: 900px) {
  .quiz-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 20px;
    align-items: start;
  }
  .quiz-side {
    display: block;
    position: sticky;
    top: 80px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-md);
  }
  .quiz-side h4 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
  .side-row {
    display: flex; justify-content: space-between; padding: 9px 0;
    border-bottom: 1px dashed var(--line); font-size: 15px;
  }
  .side-row b { color: var(--blue-deep); font-weight: 700; }
  .side-tip {
    margin-top: 14px; font-size: 13px; color: var(--muted);
    background: var(--blue-soft); padding: 12px; border-radius: var(--radius-sm);
    line-height: 1.55;
  }
}

/* ==================== 答题卡头部 ==================== */
.quiz-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 14px;
}
.quiz-head .back { margin: 0; }
.progress {
  flex: 1;
  height: 8px;
  background: #DFE4F0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), #7C5CFF, var(--orange));
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width .35s cubic-bezier(.25,1,.35,1);
  animation: shimmer 2s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.qcount {
  font-weight: 700; font-size: 14px; color: var(--muted);
  white-space: nowrap; min-width: 36px; text-align: right;
}

/* --- 题目标签行 --- */
.quiz-meta {
  display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px;
}
.tag {
  font-size: 12px; font-weight: 700; padding: 4px 11px;
  border-radius: 999px; background: var(--blue-soft);
  color: var(--blue-deep); border: 1px solid rgba(79,124,255,.15);
  letter-spacing: .2px;
}
.tag.diff {
  background: var(--orange-soft);
  color: #D94A00;
  border-color: rgba(255,107,53,.18);
}

/* ==================== 答题卡片主体 ==================== */
.question-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 22px 20px 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(232,236,244,.7);
  position: relative;
  overflow: hidden;
}
.question-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), #7C5CFF, var(--orange));
  opacity: 0;
  transition: opacity .3s;
}
.question-card.active-q::before { opacity: 1; }

.question-text {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.56;
  margin: 0 0 18px;
  color: var(--ink);
}

/* --- 选项 --- */
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 13px; width: 100%;
  border: 1.8px solid var(--line); background: var(--card); cursor: pointer;
  border-radius: var(--radius-md); padding: 14px 16px;
  font-size: 16.5px; font-weight: 500; text-align: left; color: var(--ink);
  min-height: 52px;
  transition: all .18s ease;
  position: relative;
  box-shadow: 0 1px 3px rgba(26,31,54,.04);
}
.option:hover:not(:disabled):not(.correct):not(.wrong) {
  border-color: #C0C8DC;
  box-shadow: 0 4px 12px rgba(26,31,54,.07);
  transform: translateY(-1px);
  background: #FBFCFF;
}
.option:active { transform: scale(.985); }

.option .lab {
  flex: 0 0 30px; height: 30px; border-radius: 9px;
  background: var(--bg);
  display: grid; place-items: center;
  font-weight: 800; color: var(--blue); font-size: 15px;
  border: 1.5px solid transparent;
  transition: all .18s ease;
}

.option.correct {
  border-color: var(--green); background: var(--green-soft);
  box-shadow: 0 4px 16px rgba(43,196,139,.18);
  animation: popIn .3s ease;
}
.option.correct .lab {
  background: var(--green); color: #fff;
  box-shadow: 0 2px 8px rgba(43,196,139,.25);
}

.option.wrong {
  border-color: var(--red); background: var(--red-soft);
  box-shadow: 0 4px 16px rgba(239,83,80,.15);
  animation: shake .35s ease;
}
.option.wrong .lab { background: var(--red); color: #fff; }

.option.dim { opacity: .42; pointer-events: none; }

/* 多选题：选中态（提交前） */
.option.multi.sel {
  border-color: var(--blue); background: var(--blue-soft);
  box-shadow: 0 4px 12px rgba(58,120,168,.16);
}
.option.multi.sel .lab { background: var(--blue); color: #fff; }

@keyframes popIn {
  0% { transform: scale(.96); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* --- 判分反馈 --- */
.feedback {
  margin-top: 14px; font-weight: 800; font-size: 17px;
  min-height: 24px; display: flex; align-items: center; gap: 6px;
}
.feedback.ok { color: var(--green-deep); }
.feedback.no { color: var(--red); }

/* --- 知识点讲解区 --- */
.knowledge {
  margin-top: 16px;
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  animation: slideDown .3s ease;
}
.k-title {
  font-weight: 800; font-size: 14px; color: var(--orange);
  margin-bottom: 6px; letter-spacing: .3px;
}
.k-body {
  color: var(--yellow-text); font-size: 15px; line-height: 1.62;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- 下一题按钮 --- */
.next-btn {
  margin-top: 18px; width: 100%; border: none; cursor: pointer;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--blue), var(--blue-deep)); color: #fff;
  font-size: 17px; font-weight: 800; padding: 14px;
  box-shadow: 0 5px 18px rgba(79,124,255,.28);
  transition: transform .15s, box-shadow .15s;
  letter-spacing: .3px;
}
.next-btn:active { transform: scale(.97); }

/* ==================== 成绩单 ==================== */
.score-card {
  background: linear-gradient(165deg, #FFF, #F5F8FF);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 28px 20px;
  text-align: center; box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.score-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--blue), #7C5CFF, var(--orange));
}
.score-card .big {
  font-size: 52px; font-weight: 900;
  background: linear-gradient(135deg, var(--blue), #7C5CFF);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin: 8px 0;
  line-height: 1.1;
}
.score-card .row {
  display: flex; justify-content: space-around;
  margin-top: 18px;
}
.score-card .row div { font-size: 13px; color: var(--muted); }
.score-card .row div b {
  display: block; font-size: 24px; font-weight: 800;
  color: var(--ink); margin-top: 4px;
}
.score-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score-actions .big-btn { margin-top: 0; }
.rest-hint {
  margin-top: 16px; background: var(--green-soft);
  border: 1px solid rgba(43,196,139,.3);
  color: var(--green-deep);
  border-radius: var(--radius-md); padding: 14px;
  font-weight: 700; font-size: 15px; text-align: center;
}

/* ==================== 错题本 ==================== */
.wrong-list { display: flex; flex-direction: column; gap: 12px; }
.wrong-item {
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-md); padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s;
}
.wrong-item:hover { box-shadow: var(--shadow-md); }
.wrong-item .wq { font-weight: 700; font-size: 16px; margin-bottom: 6px; color: var(--ink); }
.wrong-item .wk {
  font-size: 14px; color: var(--yellow-text); line-height: 1.55;
  background: var(--yellow-bg); padding: 10px 12px;
  border-radius: var(--radius-sm); margin-top: 8px;
  border-left: 3px solid var(--yellow-border);
}
.wrong-item .wmeta { font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 500; }
.empty {
  text-align: center; color: var(--muted); padding: 48px 0;
  font-size: 15px;
}
.empty .emo { font-size: 48px; display: block; margin-bottom: 10px; }

/* ==================== 我的（个人中心） ==================== */
.profile-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pstat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 16px 12px;
  text-align: center; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.pstat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.pstat b {
  display: block; font-size: 28px; font-weight: 900;
  background: linear-gradient(135deg, var(--blue), #7C5CFF);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-top: 4px; line-height: 1.2;
}
.pstat span { color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------- 设置区 ---------- */
.settings-box {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
}
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.set-desc { font-size: 12px; color: var(--muted); }

/* iOS 风格开关 */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #D5DBEA; border-radius: 30px; transition: background .2s;
}
.slider::before {
  content: ""; position: absolute; height: 24px; width: 24px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform .2s;
}
.switch input:checked + .slider { background: linear-gradient(135deg, var(--green), var(--green-deep)); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 分段选择器 */
.seg { display: flex; gap: 6px; flex: none; }
.seg button {
  padding: 7px 12px; font-size: 13px; font-weight: 700;
  border: 1.5px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: var(--radius-sm); cursor: pointer; transition: all .15s;
}
.seg button.on {
  border-color: var(--blue); color: var(--blue);
  background: var(--blue-soft); box-shadow: var(--shadow-sm);
}

/* 题型标签（紫蓝渐变） */
.tag.type {
  background: linear-gradient(135deg, #7C5CFF, var(--blue));
  color: #fff; border-color: transparent;
}

/* 判断题选项：居中、字号更大 */
.option.tf { justify-content: center; font-size: 18px; font-weight: 700; }
.option.tf .tfopt { font-size: 18px; }

/* 填空题 */
.blank-wrap { display: flex; gap: 10px; margin-top: 4px; }
.blank-input {
  flex: 1; min-width: 0; padding: 14px 16px; font-size: 17px;
  border: 2px solid var(--line); border-radius: var(--radius-md);
  background: #fff; color: var(--ink); outline: none;
  -webkit-appearance: none; transition: border-color .15s, box-shadow .15s;
}
.blank-input::placeholder { color: #B6BECE; }
.blank-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.blank-input.correct { border-color: var(--green); background: var(--green-soft); color: var(--green-deep); }
.blank-input.wrong { border-color: var(--red); background: var(--red-soft); color: #C0392B; }
.blank-submit {
  flex: none; padding: 0 22px; min-height: 52px;
  font-size: 16px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  border: none; border-radius: var(--radius-md); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s;
}
.blank-submit:active { transform: scale(.97); }
.blank-submit:disabled { opacity: .6; cursor: default; }

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 10px;
}
.cal-cell {
  aspect-ratio: 1; border-radius: 6px;
  background: #E8ECF4; font-size: 10px;
  display: grid; place-items: center; color: #B0BAC8;
  font-weight: 600;
}
.cal-cell.has { background: var(--blue); color: #fff; box-shadow: 0 2px 6px rgba(79,124,255,.25); }
.cal-cell.has2 { background: var(--green); color: #fff; box-shadow: 0 2px 6px rgba(43,196,139,.25); }
.cal-cell.today { outline: 2.5px solid var(--orange); outline-offset: -1px; }

/* ==================== 休息卡（全屏） ==================== */
.rest-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,35,25,.55);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  display: grid; place-items: center; padding: 18px;
  animation: restIn .3s ease;
}
@keyframes restIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.rest-card {
  background: linear-gradient(175deg, #F0FAF5 0%, #E0F5EA 50%, #D5F0E3 100%);
  border-radius: 24px; padding: 28px 22px;
  width: 100%; max-width: 420px; text-align: center;
  color: #156B44;
  box-shadow:
    0 24px 60px rgba(0,0,0,.22),
    0 0 0 1px rgba(43,196,139,.15),
    inset 0 1px 0 rgba(255,255,255,.6);
  max-height: 92vh; overflow-y: auto;
  position: relative;
}
.rest-card::after {
  content: '';
  position: absolute; top: -1px; left: 20%; right: 20%;
  height: 3px; background: linear-gradient(90deg, transparent, var(--green), transparent);
  border-radius: 99px;
}
.rest-emo { font-size: 44px; line-height: 1; margin-bottom: 4px; }
.rest-card h2 {
  margin: 4px 0 6px; color: var(--green-deep);
  font-size: 24px; font-weight: 900; letter-spacing: -.3px;
}
.rest-tip { color: #2A8A5C; margin: 0 0 16px; font-size: 15px; }
.rest-steps { display: flex; flex-direction: column; gap: 9px; text-align: left; margin-bottom: 18px; }
.rest-step {
  background: rgba(255,255,255,.75); border-radius: 13px; padding: 12px 14px;
  border: 1px solid rgba(43,196,139,.12);
  transition: transform .15s;
}
.rest-step:active { transform: scale(.98); }
.rest-step b { display: block; color: var(--green-deep); margin-bottom: 2px; font-size: 15px; }
.rest-step span { font-size: 14px; color: #338A5E; line-height: 1.45; }

.timer {
  font-size: 64px; font-weight: 900; color: var(--green-deep);
  margin: 10px 0 18px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 16px rgba(43,196,139,.2);
  line-height: 1;
}
.rest-card .big-btn {
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  box-shadow: 0 6px 22px rgba(43,196,139,.35);
  font-size: 16px;
}
.rest-card .big-btn:disabled { background: #B8DEC9; box-shadow: none; color: #666; }

/* ==================== 轻提示 ==================== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(26,31,54,.90); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600; z-index: 200;
  box-shadow: 0 8px 28px rgba(0,0,0,.2);
  animation: toastUp .3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@keyframes toastUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==================== 题库总览页 ==================== */
.ov-total {
  background: linear-gradient(135deg, #EEF2FA, #F3EDFA);
  color: var(--ink); border-radius: var(--radius-lg);
  padding: 18px 18px; font-size: 14.5px; margin-bottom: 18px;
  line-height: 1.65;
  box-shadow: 0 1px 6px rgba(60,80,140,.08);
  position: relative; overflow: hidden;
  border: 1px solid rgba(79,124,255,.12);
}
.ov-total::before {
  content: '';
  position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(79,124,255,.04);
}
.ov-total b { font-size: 26px; font-weight: 900; color: var(--blue-deep); }
.ov-total small { opacity: .65; }

.ov-section { margin-bottom: 18px; }
.ov-section-title {
  font-size: 18px; font-weight: 900; color: var(--ink);
  margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
  letter-spacing: -.2px;
}
.ov-section-title span {
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--blue-soft); padding: 3px 10px; border-radius: 999px;
}

/* 学科卡片（移动端：每学科一张卡片） */
.ov-subj-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 13px 15px;
  margin-bottom: 9px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .15s, box-shadow .15s;
  cursor: default;
}
.ov-subj-card:hover { box-shadow: var(--shadow-md); }
.ov-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ov-subj-name {
  font-weight: 800; font-size: 16px; color: var(--blue-deep);
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
}
.ov-subj-name:hover { text-decoration: underline; }
.ov-subj-name::before { content: '📖'; font-size: 15px; }

/* 难度占比堆叠条 */
.ov-chart { display: flex; align-items: center; gap: 12px; }
.ov-stack {
  flex: 1; height: 14px; border-radius: 99px; overflow: hidden;
  display: flex; background: var(--bg);
}
.ov-stack .seg { height: 100%; transition: width .5s cubic-bezier(.25,1,.35,1); }
.ov-stack .seg.d1 { background: linear-gradient(90deg, #74D76D, #3CC973); }
.ov-stack .seg.d2 { background: linear-gradient(90deg, #FFB74D, #FF9800); }
.ov-stack .seg.d3 { background: linear-gradient(90deg, #FF7043, #E64A19); }
.ov-total {
  flex: 0 0 auto; font-weight: 800; font-size: 14px; color: var(--orange);
  cursor: pointer; white-space: nowrap;
}
.ov-total:hover { text-decoration: underline; }

/* 难度图例（横向对齐） */
.ov-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.ov-legend .lg {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--ink);
  cursor: pointer; padding: 2px 4px; border-radius: 6px;
}
.ov-legend .lg:hover { background: var(--bg); }
.ov-legend .lg i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.ov-legend .lg.d1 i { background: #3CC973; }
.ov-legend .lg.d2 i { background: #FF9800; }
.ov-legend .lg.d3 i { background: #E64A19; }

.ov-cat-row {
  display: flex; gap: 8px; margin-top: 6px;
  font-size: 12px; font-weight: 600;
}
.ov-cat-chip {
  padding: 3px 10px; border-radius: 999px;
  cursor: pointer; transition: all .15s;
}
.ov-cat-chip.inside { background: var(--blue-soft); color: var(--blue-deep); }
.ov-cat-chip.outside { background: var(--green-soft); color: var(--green-deep); }
.ov-cat-chip:hover { transform: scale(1.05); }

.ov-note { color: var(--muted); font-size: 13px; line-height: 1.65; margin-top: 14px; padding: 12px; background: var(--bg); border-radius: var(--radius-sm); }

/* 数据来源标注（题库总览页脚） */
.data-source { margin-top: 16px; padding: 16px 16px 14px; background: var(--blue-soft); border: 1px solid var(--line); border-radius: var(--radius-md); }
.data-source h4 { margin: 0 0 10px; font-size: 14px; color: var(--blue-deep); }
.data-source ul { margin: 0; padding-left: 20px; }
.data-source li { font-size: 12.5px; line-height: 1.7; color: var(--ink); margin-bottom: 5px; }
.data-source li b { color: var(--blue-deep); }
.data-source a { color: var(--blue); text-decoration: none; border-bottom: 1px dashed var(--blue); }
.data-source a:hover { color: var(--blue-deep); }
.data-source .ds-tip { margin: 10px 0 0; font-size: 12px; color: var(--muted); line-height: 1.65; }

/* 桌面端总览：统一卡片布局，仅加宽堆叠条 */
@media (min-width: 720px) {
  .ov-subj-card { padding: 12px 16px; margin-bottom: 7px; }
  .ov-stack { height: 16px; }
}

/* ==================== 响应式：手机端精调 ==================== */
@media (max-width: 720px) {
  #app { padding: 14px; }

  .hero { padding: 24px 2px 6px; }
  .hero h1 { font-size: 24px; }

  .stage-cards { gap: 9px; }
  .stage-card { padding: 16px 6px 12px; }
  .stage-card .emo { font-size: 34px; }
  .stage-card .t { font-size: 16px; }

  .mode-btn { padding: 14px 16px; gap: 12px; }
  .mode-btn .mode-icon { flex: 0 0 38px; height: 38px; font-size: 20px; border-radius: 10px; }

  .question-text { font-size: 17.5px; }
  .option { padding: 13px 14px; font-size: 16px; min-height: 52px; border-radius: var(--radius-md); }
  .option .lab { flex: 0 0 28px; height: 28px; border-radius: 8px; font-size: 14px; }

  .score-actions { grid-template-columns: 1fr; gap: 10px; }
  .profile-stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .pstat { padding: 14px 10px; }
  .pstat b { font-size: 24px; }

  .rest-card { border-radius: 20px; padding: 24px 18px; }
  .timer { font-size: 58px; }

  .calendar { grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .cal-cell { font-size: 9px; border-radius: 5px; }

  .screen-title { font-size: 21px; }
  .score-card .big { font-size: 46px; }
  .score-card .row div b { font-size: 21px; }
}
