/* 答题页 —— 视觉取自《首页答题页 UI 稿》S2/S3：
   顶部题号 + 进度条、类型胶囊、大题干、白卡片选项、底部淡猫图垫底。 */

.quiz {
  background: var(--bg-quiz);
  padding: 0 var(--pad) calc(18px + env(safe-area-inset-bottom));
}

/* ---------- 顶部进度 ---------- */
.qhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 0 10px;
  font-size: 13px;
  color: var(--faint);
  letter-spacing: .08em;
}
.qhead .no { color: var(--copper); font-weight: 700; font-size: 15px; letter-spacing: 0; }
.qhead .no em { font-style: normal; color: var(--faint); font-weight: 500; font-size: 13px; }

.pbar {
  height: 5px;
  border-radius: 3px;
  background: var(--bar-track);
  overflow: hidden;
}
.pbar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bar-fill);
  border-radius: 3px;
  transition: width .38s var(--ease);
}

/* ---------- 题干 ---------- */
.qbody {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 26px;
}

.type {
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--copper-deep);
  border: 1px solid #F2D9C2;
  border-radius: 20px;
  padding: 3px 11px;
}

.qt {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.55;
  letter-spacing: .2px;
  margin: 14px 0 26px;
  text-wrap: pretty;
}

/* ---------- 选项 ---------- */
.opts {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.opt {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px 16px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  transition: border-color .18s var(--ease), background .18s var(--ease),
              transform .18s var(--ease);
}
.opt .k {
  flex: 0 0 auto;
  color: var(--copper);
  font-weight: 800;
  font-size: 14px;
  line-height: 1.62;
}
.opt:active { transform: scale(.99); }

.opt.sel {
  border-color: var(--copper);
  background: var(--surface-sel);
  color: var(--ink);
}
.opt.sel::after {
  content: "✓";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--copper);
  font-weight: 800;
  font-size: 15px;
}
.opt.sel .k { color: var(--copper-deep); }

/* 快答题只有两个选项，做得更厚一点，点起来不费劲 */
.quiz[data-kind="快答"] .opt { padding: 19px 16px; font-size: 15.5px; }

/* ---------- 底部 ---------- */
.qfoot {
  position: relative;
  margin-top: auto;
  padding-top: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}
/* 底栏底下垫一层从页面底色淡出的渐变：猫的脚落在这一块，
   没有它，「上一题」和右边的提示会糊在猫毛上。 */
.qfoot::before {
  content: "";
  position: absolute;
  left: calc(var(--pad) * -1);
  right: calc(var(--pad) * -1);
  bottom: calc((18px + env(safe-area-inset-bottom)) * -1);
  height: 128px;
  background: linear-gradient(to top, var(--bg-quiz) 42%, rgba(255, 253, 248, 0));
  pointer-events: none;
  z-index: -1;
}

.back {
  font-size: 14px;
  color: var(--muted);
  padding: 10px 2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color .16s var(--ease), opacity .16s var(--ease);
}
.back:active { color: var(--ink); }
.back[disabled] { opacity: 0; pointer-events: none; }

.tip {
  font-size: 12px;
  color: #8A745C;
  text-align: right;
  line-height: 1.5;
}

/* ---------- 背景猫图 ---------- */
/* 24 道题轮着垫一只猫，只为让每页不一样，不干扰读题。
   用固定的取模序列，不是随机 —— 刷新后同一题还是同一只猫。
   2026-11-13 调过一次：原来是 118% 宽 + 0.15 透明度，整只猫只剩一团灰影，
   用户认不出是哪只。改成 105% + 0.18，蒙版放宽到 55% 才开始淡出，
   这样头和肩膀能完整露出来，但仍压得住，不抢题干。 */
.wm {
  position: absolute;
  left: 50%;
  bottom: -1%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  opacity: .16;
  z-index: -1;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(125% 100% at 50% 100%, #000 58%, transparent 96%);
  mask-image: radial-gradient(125% 100% at 50% 100%, #000 58%, transparent 96%);
  transition: opacity .3s var(--ease);
}
/* 快答题内容矮，把猫翻个面、收一点，避免主体被题干压住 */
.quiz[data-kind="快答"] .wm {
  bottom: 1%;
  width: 96%;
  transform: translateX(-50%) scaleX(-1);
  opacity: .16;
  -webkit-mask-image: radial-gradient(135% 125% at 50% 100%, #000 58%, transparent 98%);
  mask-image: radial-gradient(135% 125% at 50% 100%, #000 58%, transparent 98%);
}

/* ---------- 切题动效 ---------- */
.qbody.enter { animation: qIn .32s var(--ease) both; }
@keyframes qIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 最后一题后的计算态（对应 UI 稿第 4 台） ---------- */
.calc {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-calc);
  text-align: center;
  padding: 0 var(--pad) 60px;
}
.calc[hidden] { display: none; }
.calc .paw {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  box-shadow: 0 4px 14px rgba(150, 105, 65, .13);
  animation: breathe 2.2s var(--ease) infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.calc .t { font-size: 19px; font-weight: 800; margin-top: 22px; }
.calc .s { font-size: 13px; color: var(--muted); margin-top: 9px; line-height: 1.6; }

.calc .track {
  width: 210px;
  height: 5px;
  margin-top: 28px;
  border-radius: 3px;
  background: var(--bar-track);
  overflow: hidden;
}
.calc .track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--bar-fill);
}
.calc .pct {
  margin-top: 11px;
  font-size: 13px;
  font-weight: 700;
  color: var(--copper);
  font-variant-numeric: tabular-nums;
}
.calc .sub { margin-top: 8px; font-size: 11px; color: var(--faint); }

@media (prefers-reduced-motion: reduce) {
  .calc .paw { animation: none; }
}

/* 窄屏微调 */
@media (max-width: 360px) {
  :root { --pad: 18px; }
  .qt { font-size: 20px; }
  .opt { font-size: 14.5px; padding: 13px 14px; }
}
