/*
 * HSK 真题考试站 —— 样式
 * 主站配色：纸张 #F2E7D0 / 深蓝 #143C5B / 金 #E0A93E / 赭红 #C25A34
 * 兼容 Chromium 66：flex 不用 gap（用 margin），grid 用 grid-gap；
 * 不用 aspect-ratio / inset / clamp() / min() / max() / :has() / 容器查询。
 */

:root {
  --paper: #F2E7D0;
  --paper-hi: #F8F0DF;
  --paper-lo: #E8D9BB;
  --sheet: #FFFCF5;
  --line: #DCCAA6;
  --line-2: #C7B289;

  --navy: #143C5B;
  --navy-2: #0E2C44;
  --navy-3: #1F4F75;
  --navy-tint: #E3E8EC;

  --gold: #E0A93E;
  --gold-hi: #EDC067;
  --gold-soft: #F6E2B4;

  --rust: #C25A34;
  --rust-ink: #A0401F;
  --rust-soft: #F7DCCF;

  --ok: #2B7448;
  --ok-soft: #DDEFE2;

  --text: #1B2A35;
  --muted: #53616C;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;

  --r: 8px;
  --shadow: 0 1px 2px rgba(20, 60, 91, .08), 0 6px 20px rgba(20, 60, 91, .08);
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--navy); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }

.ic { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: middle; }

/* 键盘焦点（鼠标点击不出现） */
:focus { outline: none; }
.kbd :focus { outline: 3px solid var(--gold); outline-offset: 2px; }
.kbd .topbar :focus, .kbd .mode-teacher .nav :focus { outline-color: var(--gold-hi); }

.spinner {
  display: inline-block; width: 18px; height: 18px; margin-right: 10px; vertical-align: -3px;
  border: 2.5px solid rgba(20, 60, 91, .2); border-top-color: var(--navy);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 18px;
  border-radius: var(--r); border: 1.5px solid transparent;
  font-weight: 500; font-size: 15px; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn .ic + span, .btn span + .ic { margin-left: 7px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-navy:hover:not(:disabled) { background: var(--navy-3); }
.btn-gold { background: var(--gold); color: var(--navy-2); border-color: var(--gold); font-weight: 700; }
.btn-gold:hover:not(:disabled) { background: var(--gold-hi); }
.btn-rust { background: var(--rust); color: #fff; border-color: var(--rust); }
.btn-rust:hover { background: var(--rust-ink); }
.btn-line { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-line:hover:not(:disabled) { background: rgba(20, 60, 91, .07); }
.btn-dark-line { background: transparent; color: var(--paper); border-color: rgba(242, 231, 208, .45); }
.btn-dark-line:hover, .btn-dark-line[aria-pressed="true"] { background: rgba(242, 231, 208, .12); border-color: var(--paper); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 8px;
  border: 1.5px solid var(--line-2); border-radius: var(--r);
  background: var(--sheet); color: var(--navy);
  transition: background-color .15s, border-color .15s;
}
.icon-btn:hover:not(:disabled) { border-color: var(--navy); }
.icon-btn:disabled { opacity: .35; }
.icon-btn-label span { margin-left: 6px; font-size: 14px; font-weight: 500; }
.icon-btn[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* 分段切换（语言 / 模式） */
.seg {
  display: inline-flex; padding: 3px; border-radius: 10px;
  background: rgba(20, 60, 91, .08); border: 1px solid rgba(20, 60, 91, .14);
}
.seg-btn {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 11px;
  border: 0; border-radius: 7px; background: transparent; color: var(--navy);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.seg-btn + .seg-btn { margin-left: 2px; }
.seg-btn .ic { width: 17px; height: 17px; margin-right: 6px; }
.seg-btn:hover { background: rgba(20, 60, 91, .08); }
.seg-btn[aria-pressed="true"] { background: var(--navy); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.seg-dark { background: rgba(255, 255, 255, .08); border-color: rgba(242, 231, 208, .22); }
.seg-dark .seg-btn { color: var(--paper); }
.seg-dark .seg-btn:hover { background: rgba(255, 255, 255, .1); }
.seg-dark .seg-btn[aria-pressed="true"] { background: var(--paper); color: var(--navy); }

.back-btn {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px 0 8px;
  border-radius: var(--r); color: var(--navy); text-decoration: none; font-weight: 500;
  border: 1.5px solid rgba(20, 60, 91, .25); background: rgba(255, 255, 255, .35);
}
.back-btn .ic { margin-right: 4px; }
.back-btn:hover { border-color: var(--navy); }
.back-light { color: var(--paper); border-color: rgba(242, 231, 208, .35); background: transparent; }
.back-light:hover { border-color: var(--paper); background: rgba(255, 255, 255, .08); }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 90;
  max-width: 92%; padding: 12px 18px; border-radius: 10px;
  background: var(--navy-2); color: #fff; font-size: 15px; box-shadow: var(--shadow);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-warn { background: var(--rust-ink); }

/* =================================================================
 * 首页：深蓝题头（米字格底纹 + “考”字水印）→ 田字格级别 → 准考证式试卷票根
 * ================================================================= */
.page-index { min-height: 100vh; }

/* ---------- 题头 ---------- */
.ix-band {
  position: relative; overflow: hidden;
  background-color: var(--navy);
  /* 米字格：写汉字用的方格 + 虚线十字和对角线 */
  background-image:
    radial-gradient(ellipse at 78% 30%, rgba(224, 169, 62, .16), rgba(20, 60, 91, 0) 55%),
    linear-gradient(180deg, rgba(14, 44, 68, 0) 40%, rgba(14, 44, 68, .55) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88'%3E%3Cg fill='none' stroke='%23E0A93E'%3E%3Crect x='.5' y='.5' width='87' height='87' stroke-opacity='.13'/%3E%3Cpath d='M44 0v88M0 44h88M0 0l88 88M88 0L0 88' stroke-opacity='.08' stroke-dasharray='3 5'/%3E%3C/g%3E%3C/svg%3E");
  color: var(--paper);
  border-bottom: 4px solid var(--gold);
}
.ix-band::after {
  /* 大“考”字水印，只描边不填色 */
  content: "考"; position: absolute; right: -40px; bottom: -150px; z-index: 0;
  font-family: var(--serif); font-weight: 900; font-size: 460px; line-height: 1;
  color: transparent; -webkit-text-stroke: 1.5px rgba(224, 169, 62, .22);
  pointer-events: none; user-select: none;
}
.ix-top, .ix-hero { position: relative; z-index: 1; }
.ix-top-in, .ix-hero, .ix-main { max-width: 1120px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }
.ix-top-in { display: flex; align-items: center; min-height: 72px; }
.ix-top .back-btn { margin-right: 14px; background: transparent; color: var(--paper); border-color: rgba(242, 231, 208, .4); }
.ix-top .back-btn:hover { border-color: var(--paper); }
.ix-brand { display: inline-flex; align-items: center; color: var(--paper); }
.ix-brand b {
  font-family: var(--serif); font-weight: 900; font-size: 19px; letter-spacing: .14em;
  padding: 1px 9px 1px 11px; border: 1.5px solid var(--gold); border-radius: 3px; color: var(--gold-hi);
}
.ix-brand i {
  font-style: normal; margin-left: 12px; font-size: 13px; letter-spacing: .32em; color: rgba(242, 231, 208, .7);
}
.ix-top-tools { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ix-top-tools .seg { margin: 4px 0 4px 10px; }

.ix-hero { padding-top: 46px; padding-bottom: 104px; }
.ix-kicker {
  display: inline-flex; align-items: center;
  font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-hi); font-weight: 500;
}
.ix-kicker::before { content: ""; width: 34px; height: 2px; margin-right: 12px; background: var(--gold); }
.ix-title {
  font-family: var(--serif); font-weight: 900; color: #FFF8EA;
  font-size: 64px; line-height: 1.12; margin-top: 16px; letter-spacing: .03em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .12);
}
.ix-sub { max-width: 600px; margin-top: 16px; font-size: 17px; line-height: 1.7; color: rgba(242, 231, 208, .82); }

/* ---------- 级别：浮在题头上的一张“纸” ---------- */
.ix-levels {
  position: relative; z-index: 2; margin-top: -68px;
  padding: 22px 24px 24px; background: var(--sheet);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 18px 40px rgba(14, 44, 68, .16), 0 2px 6px rgba(14, 44, 68, .08);
}
.ix-h2 { display: flex; align-items: center; font-family: var(--serif); font-weight: 600; font-size: 19px; color: var(--navy); }
.ix-h2-mark { width: 10px; height: 10px; margin-right: 10px; background: var(--rust); transform: rotate(45deg); }
.level-grid { display: grid; grid-template-columns: repeat(6, 1fr); grid-gap: 14px; margin-top: 16px; }
.level-tile {
  position: relative; display: block; text-align: left;
  padding: 14px 14px 13px; min-height: 172px;
  background: var(--paper-hi); color: var(--navy);
  border: 1.5px solid var(--line); border-radius: 12px;
  transition: transform .18s, box-shadow .18s, border-color .18s, background-color .18s;
}
.level-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--navy); }
.lt-hsk { display: block; font-size: 11px; font-weight: 700; letter-spacing: .24em; color: var(--rust-ink); }
/* 田字格：外框实线，十字虚线 */
.lt-box {
  position: relative; display: block; width: 74px; height: 74px; margin: 8px 0 10px;
  border: 1.5px solid rgba(194, 90, 52, .45);
  background:
    linear-gradient(90deg, transparent calc(50% - .5px), rgba(194, 90, 52, .28) calc(50% - .5px), rgba(194, 90, 52, .28) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(0deg, transparent calc(50% - .5px), rgba(194, 90, 52, .28) calc(50% - .5px), rgba(194, 90, 52, .28) calc(50% + .5px), transparent calc(50% + .5px));
}
.lt-num {
  position: absolute; left: 0; right: 0; top: 50%; margin-top: -.55em;
  text-align: center; font-family: var(--serif); font-weight: 900; font-size: 54px; line-height: 1.1;
  font-variant-numeric: lining-nums;
}
.lt-name { display: block; font-weight: 700; font-size: 15px; }
.lt-count { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-time { margin-top: 0; opacity: .85; }
.level-tile.is-on {
  background: var(--navy); border-color: var(--navy); color: #fff;
  box-shadow: 0 10px 26px rgba(20, 60, 91, .32);
}
.level-tile.is-on::after {
  /* 选中：右上角一枚金色小印 */
  content: ""; position: absolute; top: 12px; right: 12px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(224, 169, 62, .25);
}
.level-tile.is-on .lt-hsk { color: var(--gold-hi); }
.level-tile.is-on .lt-box { border-color: rgba(224, 169, 62, .7); background:
    linear-gradient(90deg, transparent calc(50% - .5px), rgba(224, 169, 62, .35) calc(50% - .5px), rgba(224, 169, 62, .35) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(0deg, transparent calc(50% - .5px), rgba(224, 169, 62, .35) calc(50% - .5px), rgba(224, 169, 62, .35) calc(50% + .5px), transparent calc(50% + .5px)); }
.level-tile.is-on .lt-num { color: var(--gold); }
.level-tile.is-on .lt-count { color: rgba(255, 255, 255, .78); }
.level-tile.is-empty:not(.is-on) { opacity: .6; }

/* ---------- 试卷列表 ---------- */
.ix-list { padding: 40px 0 10px; min-height: 220px; }
.ix-list-head { display: flex; align-items: baseline; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line-2); }
.ix-lv-big { font-size: 30px; font-weight: 900; letter-spacing: .02em; }
.ix-meta { margin-left: 16px; color: var(--muted); font-size: 14px; }
.ix-status { padding: 40px 0; color: var(--muted); text-align: center; }
.ix-status.is-error { color: var(--rust-ink); }
.ix-status.is-error .ic { width: 36px; height: 36px; display: block; margin: 0 auto 10px; }
.ix-status.is-error p { margin-bottom: 16px; font-size: 17px; }
.ix-empty { padding: 36px 0; color: var(--muted); text-align: center; font-size: 16px; }

.paper-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 16px; }
/* 准考证票根 */
.paper-row {
  position: relative; display: flex; align-items: stretch; height: 100%; overflow: hidden;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; color: var(--text);
  box-shadow: 0 1px 2px rgba(20, 60, 91, .06);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
a.paper-row:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 12px 28px rgba(20, 60, 91, .14); }
.pr-main { position: relative; flex: 1; min-width: 0; padding: 14px 16px 12px 18px; }
.pr-main::before {
  /* 左边一道赭红竖线，像票据的装订边 */
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 2px 2px 0; background: var(--rust);
  opacity: .85;
}
.pr-no {
  display: block; font-family: var(--serif); font-weight: 600; font-size: 13px; letter-spacing: .12em;
  color: var(--rust-ink); font-variant-numeric: tabular-nums;
}
.pr-title {
  display: block; margin-top: 2px; font-family: var(--serif); font-weight: 900; font-size: 24px; letter-spacing: .04em;
  color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pr-chips { display: flex; flex-wrap: wrap; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; margin: 0 6px 4px 0; padding: 2px 9px;
  border-radius: 999px; font-size: 13px; line-height: 20px; white-space: nowrap;
  background: rgba(20, 60, 91, .07); color: var(--navy);
}
.chip .ic { width: 14px; height: 14px; margin-right: 4px; }
.chip-time { font-variant-numeric: tabular-nums; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-muted { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); }
.chip-check { background: transparent; color: var(--ok); padding-left: 2px; }
.chip-warn { background: var(--gold-soft); color: #7A4E00; }
/* 右边票根：打孔虚线隔开，上下各咬一个半圆缺口 */
.pr-go, .pr-lock {
  position: relative; flex: none; display: flex; align-items: center; justify-content: center;
  width: 64px; border-left: 2px dashed var(--line); color: var(--navy);
  transition: background-color .18s, color .18s;
  border-radius: 0 11px 11px 0;
}
.pr-go::before, .pr-go::after, .pr-lock::before, .pr-lock::after {
  content: ""; position: absolute; left: -9px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--line);
}
.pr-go::before, .pr-lock::before { top: -9px; }
.pr-go::after, .pr-lock::after { bottom: -9px; }
.pr-go .ic { width: 22px; height: 22px; transition: transform .18s; }
a.paper-row:hover .pr-go { background: var(--navy); color: var(--gold-hi); }
a.paper-row:hover .pr-go .ic { transform: translateX(3px); }
.pr-lock { width: auto; padding: 0 12px; background: var(--paper-lo); color: var(--muted); font-size: 13px; }
.paper-row.is-locked { opacity: .7; cursor: not-allowed; }

.ix-foot { display: flex; align-items: center; padding: 36px 0 48px; color: var(--muted); font-size: 13px; }
.ix-seal {
  /* 朱红小印 */
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-right: 12px;
  border: 2px solid var(--rust); border-radius: 6px; color: var(--rust);
  font-family: var(--serif); font-weight: 900; font-size: 13px; line-height: 1.05; letter-spacing: .1em;
  writing-mode: vertical-rl; transform: rotate(-6deg); opacity: .85;
}

/* ---------- 载入动效：依次浮现（减少动效时整段关掉） ---------- */
@keyframes ixRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: ixRise .6s cubic-bezier(.2, .7, .2, 1) both; }
.ix-kicker.rise { animation-delay: .05s; }
.ix-title.rise { animation-delay: .12s; }
.ix-sub.rise { animation-delay: .2s; }
.ix-levels.rise { animation-delay: .34s; }
.pr-li { animation: ixRise .45s cubic-bezier(.2, .7, .2, 1) both; }

@media (max-width: 1000px) {
  .level-grid { grid-template-columns: repeat(3, 1fr); }
  .level-tile { min-height: 0; }
  .paper-list { grid-template-columns: repeat(2, 1fr); }
  .ix-band::after { font-size: 360px; bottom: -120px; }
}
@media (max-width: 760px) {
  .ix-top-in, .ix-hero, .ix-main { padding-left: 16px; padding-right: 16px; }
  .ix-top-in { flex-wrap: wrap; padding-top: 10px; padding-bottom: 6px; min-height: 0; }
  .ix-brand { margin-right: auto; }
  .ix-brand i { display: none; }
  .ix-top-tools { width: 100%; justify-content: flex-start; margin-top: 8px; }
  .ix-top-tools .seg { margin: 4px 8px 4px 0; }
  .ix-hero { padding-top: 22px; padding-bottom: 84px; }
  .ix-title { font-size: 38px; margin-top: 10px; }
  .ix-sub { font-size: 15px; }
  .ix-band::after { font-size: 260px; right: -30px; bottom: -80px; }
  .ix-levels { margin-top: -60px; padding: 16px 14px 16px; border-radius: 14px; }
  .level-grid { grid-gap: 10px; margin-top: 12px; }
  .level-tile { padding: 10px 10px 10px; }
  .lt-box { width: 58px; height: 58px; margin: 6px 0 8px; }
  .lt-num { font-size: 42px; }
  .lt-name { font-size: 13px; }
  .lt-count { font-size: 11.5px; }
  .level-tile.is-on::after { top: 10px; right: 10px; }
  .ix-list { padding-top: 28px; }
  .ix-lv-big { font-size: 24px; }
  .ix-meta { margin-left: 0; width: 100%; margin-top: 2px; }
  .paper-list { grid-template-columns: 1fr; grid-gap: 12px; }
  .pr-title { font-size: 21px; }
  .pr-go { width: 56px; }
}

/* =================================================================
 * 考试页：整体框架
 * ================================================================= */
.page-exam { overflow: hidden; }
.app { display: flex; flex-direction: column; height: 100vh; height: var(--app-h, 100vh); }

/* 顶栏 */
.topbar { flex: none; background: var(--navy); color: var(--paper); border-bottom: 3px solid var(--gold); }
.tb-row { display: flex; align-items: center; flex-wrap: wrap; padding: 8px 16px; min-height: 60px; }
.tb-row .back-btn { margin-right: 14px; }
.tb-title { flex: 1; min-width: 0; display: flex; align-items: baseline; }
.tb-level {
  flex: none; margin-right: 10px; padding: 1px 8px; border-radius: 4px;
  border: 1.5px solid var(--gold); color: var(--gold); text-decoration: none;
  font-size: 13px; font-weight: 700; letter-spacing: .06em; white-space: nowrap;
}
.tb-level:hover { background: var(--gold); color: var(--navy); }
.tb-title h1 {
  font-family: var(--serif); font-weight: 600; font-size: 21px; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-tools { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tb-tools > * { margin: 3px 0 3px 10px; }

.timer {
  flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1;
  margin-left: 12px; padding: 3px 12px; border-left: 1px solid rgba(242, 231, 208, .25);
}
.timer-label { font-size: 11px; letter-spacing: .08em; opacity: .75; }
.timer-val { font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.timer-val b { font-size: 20px; font-weight: 700; color: #fff; }
.timer-limit { opacity: .7; }
.timer.is-over b { color: #FFB38F; }
.timer.is-over .timer-label::after { content: " !"; color: #FFB38F; }

/* 提示条 */
.notice { flex: none; background: var(--gold-soft); border-bottom: 1px solid var(--line-2); }
.notice-item { display: flex; align-items: center; padding: 8px 16px; font-size: 14px; color: var(--navy-2); }
.notice-item + .notice-item { border-top: 1px solid rgba(20, 60, 91, .1); }
.notice-item .ic { margin-right: 8px; color: var(--navy); }
.notice-item.is-warn { background: var(--rust-soft); color: #5C2410; }
.notice-item.is-warn .ic { color: var(--rust-ink); }

/* 整页错误 */
.fatal { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.is-fatal .player, .is-fatal .main, .is-fatal .tabbar { display: none !important; }
.fatal-card {
  max-width: 460px; width: 100%; padding: 32px 28px; text-align: center;
  background: var(--sheet); border: 1.5px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow);
}
.fatal-ic { width: 44px; height: 44px; color: var(--rust); }
.fatal-msg { margin: 14px 0 22px; font-size: 18px; color: var(--navy); font-weight: 500; }
.fatal-actions .btn { margin: 4px; }

/* =================================================================
 * 听力播放器（大按钮，便于投影）
 * ================================================================= */
.player {
  flex: none; display: flex; align-items: center; flex-wrap: wrap;
  padding: 10px 16px; background: var(--paper-hi); border-bottom: 1px solid var(--line);
  position: relative;
}
.pl-main { display: flex; align-items: center; flex: none; }
.pl-play {
  display: inline-flex; align-items: center; justify-content: center;
  height: 52px; min-width: 52px; padding: 0 20px 0 16px; border-radius: 26px;
  border: 0; background: var(--navy); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 2px 0 var(--navy-2); transition: background-color .15s, transform .1s;
}
.pl-play .ic { width: 26px; height: 26px; }
.pl-play-txt { margin-left: 6px; }
.pl-play:hover:not(:disabled) { background: var(--navy-3); }
.pl-play:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.pl-play[aria-pressed="true"] { background: var(--gold); color: var(--navy-2); box-shadow: 0 2px 0 #B8862A; }
.pl-play:disabled { opacity: .45; }
.is-wait .pl-play .ic { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.pl-skip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; min-width: 56px; margin-left: 8px; padding: 0 10px;
  border-radius: 22px; border: 1.5px solid var(--navy); background: transparent; color: var(--navy);
  font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
}
.pl-skip .ic { width: 20px; height: 20px; }
.pl-skip span { margin: 0 3px; }
.pl-skip:hover:not(:disabled) { background: rgba(20, 60, 91, .08); }
.pl-skip:disabled { opacity: .4; }
.pl-time {
  margin-left: 14px; font-variant-numeric: tabular-nums; font-size: 15px; color: var(--muted); white-space: nowrap;
}
.pl-time b { font-size: 20px; color: var(--navy); }
.pl-sep { margin: 0 4px; }

/* 进度条：自绘轨道 + 题目刻度 + 透明 range 覆盖其上 */
.pl-track { position: relative; flex: 1; min-width: 160px; height: 44px; margin: 0 18px; }
.pl-ticks { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; }
.pl-bar {
  position: absolute; left: 0; right: 0; top: 50%; height: 8px; margin-top: -4px;
  border-radius: 4px; background: var(--paper-lo); overflow: hidden;
}
.pl-buf { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--line-2); opacity: .5; }
.pl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--navy); }
.pl-tick {
  position: absolute; top: 50%; width: 2px; height: 16px; margin: -8px 0 0 -1px;
  background: var(--gold); border-radius: 1px; opacity: .9;
}
.pl-track input[type="range"] {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 0;
  background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.pl-track input[type="range"]::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.pl-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: 11px; border-radius: 50%;
  background: #fff; border: 3px solid var(--navy); box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.pl-track input[type="range"]::-moz-range-track { height: 44px; background: transparent; }
.pl-track input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--navy);
}
.pl-track input[type="range"]:disabled { cursor: not-allowed; opacity: .4; }

.pl-jump { display: flex; align-items: center; flex: none; font-size: 15px; color: var(--navy); }
.pl-jump label { white-space: nowrap; font-weight: 500; }
.pl-jump input {
  width: 68px; height: 42px; margin: 0 6px; padding: 0 8px; text-align: center;
  border: 1.5px solid var(--line-2); border-radius: var(--r); background: #fff;
  font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.pl-jump input::-webkit-outer-spin-button, .pl-jump input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pl-jump input:focus { border-color: var(--navy); }
.pl-jump .btn { margin-left: 6px; padding: 0 14px; }
.pl-jump .btn .ic { width: 16px; height: 16px; }
.pl-state { width: 100%; font-size: 13px; color: var(--muted); }
.pl-retry { margin-left: 10px; }
.pl-retry .ic { width: 16px; height: 16px; }
.player.is-failed .pl-retry { opacity: 1; }
.player.is-failed .pl-main, .player.is-failed .pl-track { opacity: .55; }

/* =================================================================
 * 主体：电子题区 + 题号导航
 * ================================================================= */
.main { flex: 1; min-height: 0; display: flex; position: relative; }

/* ---------- 电子题区 ---------- */
.paper {
  flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; position: relative;
  background: #E4D5B6; -webkit-overflow-scrolling: touch;
  --qfs: 19px; --imgk: 1.15; --tools-h: 52px;
}
.paper:focus { outline: none; }
.pp-tools {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--tools-h); padding: 0 16px;
  background: rgba(232, 217, 187, .96); border-bottom: 1px solid var(--line-2);
}
.pp-group { display: flex; align-items: center; }
.pp-group > * + * { margin-left: 8px; }
.tool-btn {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 12px;
  border: 1.5px solid var(--line-2); border-radius: var(--r); background: var(--sheet); color: var(--navy);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.tool-btn .ic { width: 18px; height: 18px; }
.tool-btn .ic + span, .tool-btn span + .ic { margin-left: 4px; }
.tool-btn:hover:not(:disabled) { border-color: var(--navy); }
.tool-btn[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.py-ic { font-style: italic; font-family: var(--serif); margin-right: 6px; opacity: .85; }
.fs-ic { font-family: var(--serif); font-weight: 900; line-height: 1; }
.fs-sm { font-size: 14px; }
.fs-lg { font-size: 21px; }

.paper-in {
  position: relative; max-width: 900px; margin: 20px auto 60px; padding: 8px 44px 60px;
  background: var(--sheet); color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 12px 32px rgba(20, 40, 60, .12);
  font-size: var(--qfs); line-height: 1.8;
}
.pp-empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 16px; }

/* 分部标题（听力 / 阅读 / 书写） */
.sec-h {
  display: flex; align-items: baseline; flex-wrap: wrap; margin: 34px 0 4px; padding-bottom: 8px;
  border-bottom: 3px double var(--navy); color: var(--navy); line-height: 1.3;
}
.sec-h:first-child { margin-top: 26px; }
.sec-name { font-family: var(--serif); font-weight: 900; font-size: 1.4em; letter-spacing: .06em; }
:lang(zh-CN) .sec-name { letter-spacing: .12em; }
.sec-zh { margin-left: 10px; font-family: var(--serif); font-size: .8em; color: var(--muted); font-weight: 600; }
.sec-range { margin-left: auto; white-space: nowrap; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sec-note { display: flex; align-items: center; margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--rust-ink); }
.sec-note .ic { width: 16px; height: 16px; margin-right: 6px; }

/* 一个部分（按 layout） */
.blk { margin-top: 26px; }
.blk-h { display: flex; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; line-height: 1.5; }
.blk-part { font-size: 15px; font-weight: 700; color: var(--rust-ink); letter-spacing: .06em; margin-right: 8px; }
.blk-range { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 12px; }
.blk-title { font-family: var(--serif); font-weight: 600; font-size: .95em; color: var(--navy); }
.blk-intro { font-size: .9em; color: var(--muted); }

/* 共用选项（部分开头的 bank：粘在顶部，可收起；一组题的 gbank） */
.bank { margin: 10px 0 14px; border: 1.5px solid var(--line-2); border-radius: 10px; background: #FBF6EA; }
.bank-sticky {
  position: -webkit-sticky; position: sticky; top: var(--tools-h); z-index: 6;
  box-shadow: 0 6px 16px rgba(20, 40, 60, .12);
}
.bank-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 6px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent;
  color: var(--navy); font-size: 14px; font-weight: 700; text-align: left; line-height: 1.4;
}
.bank-tg-txt { font-weight: 500; color: var(--muted); margin-left: 10px; white-space: nowrap; }
.bank.is-collapsed .bank-items { display: none; }
.bank.is-collapsed .bank-toggle { border-bottom: 0; }
.bank-items { display: grid; grid-gap: 8px; padding: 10px; max-height: 40vh; overflow-y: auto; }
.bank-img .bank-items { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.bank-text .bank-items { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.gbank .bank-items { max-height: none; grid-template-columns: 1fr; }
.bk-card {
  position: relative; display: flex; align-items: flex-start; padding: 6px 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; line-height: 1.6;
}
.bank-img .bk-card { flex-direction: column; align-items: center; }
.bk-k {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; margin-right: 8px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: 14px; font-weight: 700; line-height: 1;
}
.bank-img .bk-k { position: absolute; left: 6px; top: 6px; z-index: 1; margin: 0; }
.bk-b { min-width: 0; }
.bank-img .bk-b { width: 100%; text-align: center; }
.bank .imgbox { max-width: 118px !important; }

/* 一组题（共用材料） */
.grp { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.blk-h + .grp, .bank + .grp, .blk-intro + .grp { border-top: 0; }
.grp-lead { margin-top: 18px; }
.lead {
  margin: 4px 0 8px; padding: 12px 18px; background: #FBF7EE; border-left: 4px solid var(--gold);
  border-radius: 0 8px 8px 0;
}
.lead .pp { text-indent: 2em; }
.lead-tag { font-size: 13px; font-weight: 700; color: var(--rust-ink); margin-bottom: 2px; text-indent: 0 !important; }

/* 段落、拼音、填空、词卡、图片 */
.pp { margin: .25em 0; }
.pp-q { color: var(--navy); font-weight: 500; }
ruby { ruby-position: over; }
rt { font-size: .55em; color: var(--muted); font-family: var(--sans); letter-spacing: 0; }
.no-py ruby:not(.py-keep) rt { display: none; }
/* 原卷画线的文字（{{u:…}}）：用下边框画线，Chromium 66 也能控制粗细和颜色；不是填空 */
.ul { border-bottom: 2px solid var(--navy); padding-bottom: 1px; }
ruby.ul { border-bottom: 2px solid var(--navy); }
.mode-teacher .ul { border-bottom-width: 3px; }
/* 「看拼音写汉字」：括号上方的拼音是题目内容，稍加强调 */
ruby.py-keep rt { color: var(--navy); font-weight: 700; font-size: .6em; }
.blank {
  display: inline-block; min-width: 3.4em; height: 1.25em; margin: 0 .2em; vertical-align: -.2em;
  border-bottom: 2px solid var(--navy); text-align: center; line-height: 1.25em;
}
.blank b { font-size: .7em; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.blank.is-cur { background: var(--gold-soft); }
.blank.is-cur b { color: var(--navy); }
.blank.is-now { background: var(--rust-soft); border-bottom-color: var(--rust); }
.wchips { display: inline-flex; flex-wrap: wrap; vertical-align: middle; }
.wchip {
  display: inline-block; margin: 4px 8px 4px 0; padding: 2px 12px; min-height: 40px;
  border: 1.5px dashed var(--navy); border-radius: 8px; background: #fff; color: var(--navy);
  font-size: inherit; line-height: 1.6; text-indent: 0;
}
button.wchip { cursor: pointer; border-style: solid; }
button.wchip:hover { background: var(--navy-tint); }
.wchip.is-used { opacity: .4; }
.fig { margin: 8px 0; }
.imgbox { position: relative; display: inline-block; width: 100%; vertical-align: middle; background: #F4EEE2; }
.imgpad { display: block; }
.imgbox .qimg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.imgbox-free { width: auto; max-width: 100%; background: transparent; }
.imgbox-free .qimg { position: static; width: auto; height: auto; max-width: 100%; max-height: 380px; }
.imgbox.is-broken { min-height: 60px; border: 1px dashed var(--line-2); }
.imgbox.is-broken .qimg { visibility: hidden; }
.imgbox.is-broken::after { content: "\2715"; position: absolute; left: 50%; top: 50%; margin: -.6em 0 0 -.4em; color: var(--muted); }

/* 一道题 */
.qq { position: relative; padding: 12px 0 14px; scroll-margin-top: 60px; }
.qq + .qq { border-top: 1px dotted var(--line); }
.qq-h { display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.qq-num {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 34px; padding: 0 8px; margin-right: 10px; border-radius: 8px;
  background: var(--navy); color: #fff; font-family: var(--serif); font-weight: 900; font-size: 18px;
  font-variant-numeric: tabular-nums; line-height: 1;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.qq-num.can-hold { cursor: pointer; }
.qq-num.is-holding { background: var(--gold); color: var(--navy-2); transition: background-color .5s; }
.qq.is-done .qq-num { box-shadow: 0 0 0 3px var(--gold-soft); }
.qq.is-now { background: rgba(224, 169, 62, .1); box-shadow: -14px 0 0 rgba(224, 169, 62, .1), 14px 0 0 rgba(224, 169, 62, .1); }
.qq.is-now .qq-num { background: var(--rust); }
.qq-play {
  display: inline-flex; align-items: center; height: 34px; padding: 0 12px 0 8px; margin-right: 10px;
  border: 1.5px solid var(--navy); border-radius: 17px; background: transparent; color: var(--navy);
  font-size: 13px; font-weight: 700; white-space: nowrap; line-height: 1;
}
.qq-play .ic { width: 16px; height: 16px; margin-right: 4px; }
.qq-play:hover:not(:disabled) { background: var(--navy); color: #fff; }
.qq-play:disabled { color: #A99D84; border-color: #D6CAB0; }
.qq-key { margin-left: auto; display: inline-flex; align-items: baseline; line-height: 1.3; }
.qq-key em { font-style: normal; font-size: 13px; color: var(--muted); margin-right: 8px; }
.qq-key b { font-family: var(--serif); font-weight: 900; font-size: 1.35em; color: var(--ok); letter-spacing: .06em; }
.qq-key .qk-txt { font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.qq-key .qk-long { font-size: .8em; letter-spacing: 0; }
.qq-key .ic-tf { width: 1em; height: 1em; vertical-align: -.1em; }
.qq-stem { margin: 2px 0 4px; }
.qq-noitem { font-size: 14px; color: var(--muted); }
.qq-note { display: flex; align-items: flex-start; margin-top: 6px; font-size: 13px; line-height: 1.5; color: #6B4400; }
.qq-note .ic { width: 15px; height: 15px; margin: 2px 6px 0 0; flex: none; }
.qq-note b { margin-right: 4px; }

/* 作答：选项卡片 / 字母 / 对错 / 排序 / 输入 */
.ans { margin-top: 10px; }
.opts { display: grid; grid-gap: 10px; }
.opts-img { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.opts-short { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.opts-long { grid-template-columns: 1fr; }
.opt-card, .ord-card {
  display: flex; align-items: center; width: 100%; min-height: 52px; padding: 8px 14px 8px 10px;
  border: 2px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--text);
  font-size: inherit; line-height: 1.6; text-align: left; cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.opts-img .opt-card { position: relative; flex-direction: column; align-items: stretch; padding: 10px; }
.opts-img .oc-k { position: absolute; left: 8px; top: 8px; z-index: 1; }
.opts-img .oc-b { text-align: center; }
.oc-k {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin-right: 12px; border-radius: 50%;
  border: 2px solid var(--navy); color: var(--navy); background: #fff;
  font-family: var(--sans); font-size: 16px; font-weight: 700; line-height: 1;
}
.oc-b { flex: 1; min-width: 0; }
.pgap { display: inline-block; width: 1.2em; }
.opt-card:hover:not(:disabled), .ord-card:hover:not(:disabled) { border-color: var(--navy); }
.opt-card:disabled, .ord-card:disabled, .lt-btn:disabled, .tf-btn:disabled { cursor: default; opacity: 1; }
/* Chrome 默认把 disabled 按钮文字变灰；交卷后 / 教师模式要保持可读 */
.opt-card:disabled, .ord-card:disabled { color: var(--text); }
.lt-btn:disabled, .tf-btn:disabled { color: var(--navy); }
.is-mine { border-color: var(--navy) !important; background: var(--navy-tint) !important; }
.is-mine .oc-k { background: var(--navy); color: #fff; }
.is-key { border-color: var(--ok) !important; background: var(--ok-soft) !important; }
.is-key .oc-k { background: var(--ok); border-color: var(--ok); color: #fff; }
.is-wrong { border-color: var(--rust) !important; background: var(--rust-soft) !important; }
.is-wrong .oc-k { background: var(--rust); border-color: var(--rust); color: #fff; }

.letters { display: flex; flex-wrap: wrap; }
.lt-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; height: 52px; margin: 0 10px 10px 0; padding: 0 8px;
  border: 2px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--navy);
  font-family: var(--serif); font-weight: 900; font-size: 22px;
}
.lt-btn:hover:not(:disabled) { border-color: var(--navy); }
.lt-btn.is-mine { background: var(--navy) !important; color: #fff; }
.lt-btn.is-key { background: var(--ok) !important; color: #fff; }
.lt-btn.is-wrong { background: var(--rust) !important; color: #fff; text-decoration: line-through; }

.ans-tf { display: flex; }
.tf-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 92px; height: 60px; margin-right: 14px; border: 2px solid var(--line-2); border-radius: 12px;
  background: #fff; color: var(--navy);
}
.tf-btn .ic { width: 32px; height: 32px; }
.tf-btn:hover:not(:disabled) { border-color: var(--navy); }
.tf-btn.is-mine { background: var(--navy) !important; color: #fff; }
.tf-btn.is-key { background: var(--ok) !important; color: #fff; }
.tf-btn.is-wrong { background: var(--rust) !important; color: #fff; }
.ic-tf { width: 22px; height: 22px; }
.fb-ref .ic-tf { width: 18px; height: 18px; vertical-align: -3px; }

.ord-cards { display: grid; grid-gap: 10px; grid-template-columns: 1fr; }
.ord-card { position: relative; }
.ord-card .blank:not([data-bn]) { display: none; } /* 原卷排序题 C 句后面印的答题横线 */
.ord-card.is-used { border-style: dashed; background: var(--paper-hi); }
.mode-student .ord-card:disabled:not(.is-used) { opacity: .6; }
.ord-pos {
  flex: none; order: 3; margin-left: 10px; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--navy-2); font-weight: 900; font-size: 16px;
}
.ord-row { display: flex; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.ord-row > * { margin: 4px 12px 4px 0; }
.ord-slots { display: inline-flex; }
.ord-slot {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 42px; margin-right: 4px;
  border-bottom: 3px solid var(--line-2); font-family: var(--serif); font-weight: 900; font-size: 24px; color: var(--navy);
}
.ord-slot.is-filled { border-bottom-color: var(--navy); }
.qq.st-right .ord-slot.is-filled { color: var(--ok); border-bottom-color: var(--ok); }
.qq.st-wrong .ord-slot.is-filled { color: var(--rust-ink); border-bottom-color: var(--rust); text-decoration: line-through; }
.ord-hint, .chip-hint { font-size: 13px; color: var(--muted); line-height: 1.4; }

.ans-text { display: flex; align-items: center; flex-wrap: wrap; }
.ans-text .txt { flex: 1; min-width: 200px; margin: 0 10px 6px 0; }
.chip-hint { width: 100%; }
.txt {
  width: 100%; min-height: 48px; padding: 8px 12px;
  border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff;
  font-size: inherit; line-height: 1.6;
}
.txt:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(20, 60, 91, .14); }
.txt-area { display: block; resize: vertical; min-height: 140px; }
.txt[readonly] { background: var(--paper-hi); }
.qq.st-right .txt { border-color: var(--ok); }
.qq.st-wrong .txt { border-color: var(--rust); }

/* 交卷后：题号颜色与反馈 */
.qq.st-right .qq-num { background: var(--ok); }
.qq.st-wrong .qq-num { background: var(--rust); }
.qq.st-pending .qq-num { background: var(--gold); color: var(--navy-2); }
.qq.st-manual .qq-num, .qq.st-nokey .qq-num, .qq.st-off .qq-num { background: #8A97A2; }
.q-fb { display: flex; align-items: center; flex-wrap: wrap; padding: 8px 0 0; font-size: 15px; line-height: 1.5; }
.q-fb > * { margin: 2px 10px 2px 0; }
.fb-tag { padding: 1px 8px; border-radius: 4px; font-size: 13px; font-weight: 700; }
.fb-bad { background: var(--rust-soft); color: var(--rust-ink); }
.fb-pending { background: var(--gold-soft); color: #6B4400; }
.fb-manual { background: var(--navy-tint); color: var(--navy); }
.fb-muted { background: var(--paper-lo); color: var(--muted); }
.fb-ref em { font-style: normal; color: var(--muted); margin-right: 6px; font-size: 13px; }
.fb-ref b { color: var(--ok); font-size: 18px; }
.fb-ref span { color: var(--ok); font-weight: 700; font-size: 17px; }
.fb-mark { display: inline-flex; }
.fb-refblock { flex-basis: 100%; margin-top: 4px; }
.fb-refblock em { display: block; font-style: normal; color: var(--muted); font-size: 13px; }
.fb-pre {
  white-space: pre-wrap; word-wrap: break-word; padding: 8px 12px; margin-top: 2px;
  background: var(--ok-soft); border-radius: 6px; color: #1E4D31; font-size: 16px; line-height: 1.7;
}
.mini {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; margin-right: 6px;
  border-radius: 18px; border: 1.5px solid var(--line-2); background: #fff; font-size: 13px; font-weight: 700; color: var(--navy);
}
.mini .ic { width: 14px; height: 14px; margin-right: 4px; }
.mini:disabled { opacity: .4; }
.mini-ok { color: var(--ok); }
.mini-bad { color: var(--rust-ink); }
.mini-clr { color: var(--muted); }
.mini-ok[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.mini-bad[aria-pressed="true"] { background: var(--rust); border-color: var(--rust); color: #fff; }

/* 六级缩写：阅读 10 分钟 → 收起文章 → 写作 */
.rt-bar { display: flex; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.rt-bar > * { margin: 4px 12px 4px 0; }
.rt-left { font-weight: 700; color: var(--rust-ink); font-variant-numeric: tabular-nums; font-size: 18px; }
.rt-over { display: flex; align-items: center; color: var(--navy); font-size: 15px; line-height: 1.5; }
.rt-over .ic { margin-right: 6px; color: var(--rust); }
.rt-article {
  margin: 8px 0 12px; padding: 14px 20px; background: #FBF7EE; border-left: 4px solid var(--gold); border-radius: 0 8px 8px 0;
}
.rt-article .pp { text-indent: 2em; }
.rt-start, .rt-finish, .rt-left, .rt-over, .rt-toggle { display: none !important; }
[data-rstate="idle"] .rt-start { display: inline-flex !important; }
[data-rstate="idle"] .rt-article, [data-rstate="idle"] .rt-write,
[data-rstate="reading"] .rt-write, [data-rstate="done"] .rt-article { display: none; }
[data-rstate="reading"] .rt-left { display: inline !important; }
[data-rstate="reading"] .rt-finish { display: inline-flex !important; }
[data-rstate="done"] .rt-over, [data-rstate="peek"] .rt-over { display: flex !important; }
[data-rstate="done"] .rt-toggle, [data-rstate="peek"] .rt-toggle { display: inline-flex !important; }
[data-rstate="peek"] .rt-article { border-left-color: var(--rust); background: var(--rust-soft); }
[data-rstate="open"] .rt-bar { display: none; }

/* ---------- 题号导航 ---------- */
.nav {
  flex: none; width: 300px; display: flex; flex-direction: column;
  background: var(--sheet); border-left: 1px solid var(--line-2);
}
.nav-head { flex: none; padding: 14px 16px 12px; border-bottom: 2px solid var(--navy); }
.nav-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 40px; -webkit-overflow-scrolling: touch; }
.sh-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.sh-title { font-family: var(--serif); font-size: 19px; font-weight: 900; color: var(--navy); letter-spacing: .04em; }
.sh-count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sh-progress { height: 5px; margin-top: 10px; background: var(--paper-lo); border-radius: 3px; overflow: hidden; }
.sh-progress i { display: block; height: 100%; background: var(--gold); transition: width .25s; }
.sh-score { display: flex; align-items: baseline; margin-top: 8px; }
.sh-score-label { font-size: 14px; color: var(--muted); margin-right: 10px; }
.sh-score-val b { font-family: var(--serif); font-size: 36px; font-weight: 900; color: var(--navy); line-height: 1; }
.sh-score-val span { margin-left: 4px; color: var(--muted); font-size: 16px; }
.sh-actions { display: flex; flex-wrap: wrap; margin-top: 10px; }
.sh-actions .btn { margin: 0 8px 4px 0; }
.sh-maxnote { margin-top: 4px; font-size: 12px; color: var(--muted); }
.sh-notes { display: flex; align-items: flex-start; margin-top: 8px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.sh-notes .ic { width: 15px; height: 15px; margin: 2px 6px 0 0; flex: none; }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge .ic { width: 15px; height: 15px; margin-right: 4px; }
.badge-done { background: var(--ok-soft); color: var(--ok); }
.nv-tip {
  display: flex; align-items: flex-start; margin: 12px 16px 0; padding: 8px 10px;
  font-size: 13px; line-height: 1.5; color: var(--muted); background: rgba(20, 60, 91, .05); border-radius: 6px;
}
.nv-tip .ic { width: 16px; height: 16px; margin: 2px 6px 0 0; color: var(--navy); flex: none; }
.nv-sec { padding: 0 16px; }
.nv-sec-h {
  display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--navy); font-family: var(--serif); font-size: 16px; font-weight: 900; color: var(--navy);
}
.nv-range { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--muted); }
.nv-sec .sec-note { font-size: 12px; margin: 0 0 6px; }
.nv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); grid-gap: 6px; }
.nv {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 42px; padding: 0; border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--navy);
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.nv small { font-size: 11px; font-weight: 700; color: var(--ok); max-width: 100%; overflow: hidden; white-space: nowrap; }
.nv:hover { border-color: var(--navy); }
.nv.is-done { background: var(--gold-soft); border-color: var(--gold); }
.nv.is-cur { box-shadow: 0 0 0 2px var(--navy); }
.nv.is-now { background: var(--rust); border-color: var(--rust); color: #fff; }
.nv.is-now small { color: #fff; }
.nv.is-holding { background: var(--gold); transition: background-color .5s; }
.nv.st-right { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.nv.st-wrong { background: var(--rust-soft); border-color: var(--rust); color: var(--rust-ink); }
.nv.st-pending { background: var(--gold-soft); border-color: var(--gold); color: #6B4400; }
.nv.st-manual, .nv.st-nokey, .nv.st-off { border-style: dashed; color: var(--muted); }

/* 手机底部标签：桌面隐藏 */
.tabbar { display: none; }

/* 听力原文 */
.transcript {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; width: 440px; max-width: 100%;
  display: flex; flex-direction: column; background: var(--sheet);
  border-left: 3px solid var(--gold); box-shadow: -10px 0 40px rgba(20, 40, 60, .25);
}
.tx-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--navy); color: var(--paper); }
.tx-head h2 { font-family: var(--serif); font-size: 20px; }
.tx-head .icon-btn { background: transparent; color: var(--paper); border-color: rgba(242, 231, 208, .4); }
.tx-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 40px;
  white-space: pre-wrap; word-wrap: break-word; font-size: 18px; line-height: 1.9; color: var(--text);
}

/* =================================================================
 * 对话框
 * ================================================================= */
.modal-open { overflow: hidden; }
.modal-wrap { position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: rgba(14, 44, 68, .55); }
.modal {
  position: relative; width: 100%; max-width: 460px; max-height: 92%; display: flex; flex-direction: column;
  background: var(--sheet); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  border-top: 5px solid var(--gold); animation: pop .18s ease-out;
}
.modal-wide { max-width: 620px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px 22px; }
.modal-head h2 { font-family: var(--serif); font-size: 22px; color: var(--navy); }
.modal-x { border: 0; background: transparent; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 22px 10px; }
.modal-body p + p { margin-top: 10px; }
.modal-foot { flex: none; display: flex; justify-content: flex-end; flex-wrap: wrap; padding: 10px 18px 18px; }
.modal-foot .btn { margin: 6px 0 0 10px; }
.md-strong { font-weight: 700; color: var(--navy); font-size: 17px; }
.md-strong .ic { color: var(--ok); margin-right: 6px; }
.md-list { padding: 8px 12px; background: var(--rust-soft); border-radius: 8px; color: #5C2410; font-variant-numeric: tabular-nums; word-break: break-word; }
.md-muted { color: var(--muted); font-size: 14px; }

/* 成绩 */
.res-top { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 2px solid var(--navy); }
.res-label { display: block; font-size: 13px; color: var(--muted); letter-spacing: .1em; }
.res-big b { font-family: var(--serif); font-weight: 900; font-size: 56px; line-height: 1; color: var(--navy); }
.res-big span { margin-left: 6px; font-size: 20px; color: var(--muted); }
.res-meta { text-align: right; font-size: 13px; color: var(--muted); }
.res-meta span { display: block; }
.res-scroll { overflow-x: auto; }
.res-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 15px; }
.res-table th, .res-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.res-table thead th { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .05em; }
.res-table tbody th { font-family: var(--serif); font-weight: 900; color: var(--navy); font-size: 16px; white-space: nowrap; }
.res-table tbody th small { font-weight: 600; color: var(--muted); font-size: 12px; }
.res-table .num { text-align: center; font-variant-numeric: tabular-nums; width: 56px; }
.c-ok { color: var(--ok); font-weight: 700; }
.c-bad { color: var(--rust-ink); font-weight: 700; }
.c-pend { color: #7A4E00; font-weight: 700; }
.res-cell { min-width: 120px; }
.res-sc b { font-family: var(--serif); font-size: 24px; font-weight: 900; color: var(--navy); }
.res-sc small { color: var(--muted); margin-left: 2px; }
.res-bar { display: block; height: 5px; margin-top: 4px; background: var(--paper-lo); border-radius: 3px; overflow: hidden; }
.res-bar i { display: block; height: 100%; background: var(--gold); }
.res-ex { font-size: 13px; color: var(--muted); }
tr.is-ex th, tr.is-ex td.num { opacity: .55; }
.res-notes { margin: 12px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.res-notes li + li { margin-top: 4px; }

/* =================================================================
 * 教师大屏模式（16:9 投影：题目占主体，题号导航在侧，字号更大）
 * ================================================================= */
.mode-teacher .paper { background: #20384D; --imgk: 1.6; }
.mode-teacher .pp-tools { background: rgba(14, 44, 68, .97); border-bottom-color: rgba(255, 255, 255, .1); }
.mode-teacher .pp-tools .tool-btn, .mode-teacher .pp-tools .icon-btn { background: transparent; color: var(--paper); border-color: rgba(242, 231, 208, .35); }
.mode-teacher .pp-tools .tool-btn[aria-pressed="true"] { background: var(--paper); color: var(--navy); border-color: var(--paper); }
.mode-teacher #grpPrev, .mode-teacher #grpNext { min-height: 44px; padding: 0 18px; font-size: 16px; border-color: var(--gold); color: var(--gold-hi); }
.mode-teacher #grpPrev:hover, .mode-teacher #grpNext:hover { background: var(--gold); color: var(--navy-2); }
.mode-teacher .paper-in { max-width: 1100px; padding: 8px 52px 80px; }
.mode-teacher .qq-num { min-width: 48px; height: 40px; font-size: 22px; }
.mode-teacher .qq-play { height: 40px; font-size: 15px; border-radius: 20px; padding: 0 14px 0 10px; }
.mode-teacher .qq-key b { font-size: 1.5em; }
.mode-teacher .bank .imgbox { max-width: 160px !important; }
.mode-teacher .bank-img .bank-items { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.mode-teacher .q-fb { font-size: .8em; }
.mode-teacher .fb-pre { font-size: 1em; }

.mode-teacher .nav { width: 280px; background: var(--navy); border-left: 0; color: var(--paper); }
.mode-teacher .nav-head { border-bottom-color: var(--gold); }
.mode-teacher .sh-title { color: var(--gold); font-size: 22px; }
.mode-teacher .sh-count { color: rgba(242, 231, 208, .75); }
.mode-teacher .sh-notes { color: var(--gold-hi); }
.mode-teacher .nv-sec-h { color: var(--paper); border-bottom-color: rgba(242, 231, 208, .5); }
.mode-teacher .nv-range { color: rgba(242, 231, 208, .7); }
.mode-teacher .nv { height: 48px; background: rgba(255, 255, 255, .06); border-color: rgba(242, 231, 208, .25); color: var(--paper); }
.mode-teacher .nv small { color: var(--gold-hi); font-size: 12px; }
.mode-teacher .nv.is-cur { box-shadow: 0 0 0 2px var(--gold); }
.mode-teacher .nv.is-now { background: var(--gold); border-color: var(--gold); color: var(--navy-2); }
.mode-teacher .nv.is-now small { color: var(--navy-2); }
.mode-teacher .nv-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }

.mode-teacher .player { padding: 12px 20px; }
.mode-teacher .pl-play { height: 60px; min-width: 60px; border-radius: 30px; font-size: 18px; }
.mode-teacher .pl-play .ic { width: 30px; height: 30px; }
.mode-teacher .pl-skip { height: 50px; min-width: 64px; border-radius: 25px; font-size: 17px; }
.mode-teacher .pl-time b { font-size: 24px; }
.mode-teacher .pl-jump input { height: 48px; font-size: 20px; }
.mode-teacher .pl-jump .btn { min-height: 48px; }
.mode-teacher .tb-title h1 { font-size: 24px; }

/* =================================================================
 * 响应式
 * ================================================================= */
@media (max-width: 1180px) {
  .nav, .mode-teacher .nav { width: 260px; }
  .paper-in { margin: 14px 16px 50px; padding: 6px 28px 50px; }
  .pl-play-txt { display: none; }
  .pl-play { padding: 0; width: 52px; }
  .mode-teacher .pl-play { width: 60px; }
}

@media (max-width: 1000px) {
  .tb-row { padding: 6px 12px; }
  .tb-title { flex-basis: 40%; }
  .pl-track { order: 3; flex-basis: 100%; margin: 6px 0 0; height: 36px; }
  .pl-track input[type="range"]::-webkit-slider-runnable-track { height: 36px; }
  .pl-track input[type="range"]::-webkit-slider-thumb { margin-top: 7px; }
  .pl-jump { margin-left: auto; }
}

/* 手机 */
@media (max-width: 760px) {
  body { font-size: 15px; }

  /* 考试页顶栏：两行 */
  .tb-row { padding: 6px 10px; min-height: 0; }
  .tb-row .back-btn { margin-right: 8px; min-height: 36px; padding: 0 6px; }
  .tb-row .back-btn span { display: none; }
  .tb-row .back-btn .ic { margin-right: 0; }
  .tb-level { display: none; }
  .tb-title { flex: 1; flex-basis: auto; }
  .tb-title h1 { font-size: 17px; }
  .tb-level { font-size: 12px; margin-right: 6px; }
  .tb-tools { width: 100%; justify-content: flex-start; margin-top: 4px; }
  .tb-tools > * { margin: 3px 6px 3px 0; }
  .tb-tools .btn { min-height: 36px; padding: 0 12px; font-size: 14px; }
  #submitBtn { margin-left: auto; margin-right: 0; padding: 0 12px; }
  #submitBtn .ic { display: none; }
  #submitBtn .ic + span { margin-left: 0; }
  .seg-btn { min-height: 30px; padding: 0 7px; font-size: 13px; }
  .seg-mode .seg-btn span { display: none; }
  .seg-mode .seg-btn .ic { margin-right: 0; }
  .timer { padding: 0 0 0 8px; margin-left: 0; border-left: 0; flex-direction: row; align-items: baseline; }
  .timer-label { display: none; }
  .timer-val b { font-size: 17px; }
  .timer-val { font-size: 12px; }
  #txBtn span { display: none; }
  #txBtn { padding: 0 10px; }

  /* 播放器 */
  .player { padding: 8px 10px 4px; }
  .pl-play { height: 46px; width: 46px; min-width: 46px; }
  .pl-skip { height: 40px; min-width: 48px; margin-left: 6px; padding: 0 6px; font-size: 14px; }
  .pl-time { margin-left: 10px; font-size: 13px; }
  .pl-time b { font-size: 16px; }
  .pl-jump label, .pl-jump span { display: none; }
  .pl-jump input { width: 54px; height: 40px; margin: 0 0 0 6px; }
  .pl-jump .btn { min-height: 40px; padding: 0 10px; }
  .pl-jump .btn span { display: none; }
  .pl-track { height: 32px; margin-top: 2px; }
  .pl-track input[type="range"]::-webkit-slider-runnable-track { height: 32px; }
  .pl-track input[type="range"]::-webkit-slider-thumb { margin-top: 5px; }

  /* 主体：标签切换 */
  .main { display: block; }
  .paper, .nav { position: absolute; left: 0; top: 0; right: 0; bottom: 0; width: auto; }
  .nav, .mode-teacher .nav { width: auto; border-left: 0; }
  [data-tab="paper"] .nav { visibility: hidden; }
  [data-tab="nav"] .paper { visibility: hidden; }
  .paper { --tools-h: 48px; }
  .pp-tools { padding: 0 10px; }
  .pp-group > * + * { margin-left: 6px; }
  .icon-btn { min-width: 38px; height: 38px; padding: 0 6px; }
  .tool-btn { min-height: 38px; padding: 0 10px; }
  #grpPrev span, #grpNext span { display: none; }
  .mode-teacher #grpPrev, .mode-teacher #grpNext { padding: 0 12px; }
  .paper-in, .mode-teacher .paper-in { margin: 0; padding: 4px 14px 80px; box-shadow: none; }
  .sec-h { margin-top: 24px; }
  .sec-name { font-size: 1.2em; }
  .lead, .rt-article { padding: 10px 12px; }
  .qq-play span { display: none; }
  .qq-play { padding: 0 9px; }
  .qq-play .ic { margin-right: 0; }
  .opts-img, .opts-short { grid-template-columns: repeat(2, 1fr); }
  .bank-img .bank-items { grid-template-columns: repeat(3, 1fr); grid-gap: 6px; padding: 8px; }
  .bank-text .bank-items { grid-template-columns: repeat(2, 1fr); }
  .bank-items { max-height: 34vh; padding: 8px; grid-gap: 6px; }
  .bk-card { font-size: .9em; padding: 4px 6px; }
  .tf-btn { width: 84px; }
  .lt-btn { min-width: 46px; height: 50px; margin-right: 8px; font-size: 20px; }
  .bank .imgbox { max-width: 84px !important; }

  .tabbar {
    display: flex; flex: none; background: var(--navy); border-top: 3px solid var(--gold);
    padding-bottom: 0;
  }
  .tab {
    flex: 1; display: flex; align-items: center; justify-content: center; height: 54px;
    border: 0; background: transparent; color: rgba(242, 231, 208, .7); font-size: 15px; font-weight: 500;
  }
  .tab .ic { margin-right: 6px; }
  .tab[aria-pressed="true"] { color: #fff; background: rgba(255, 255, 255, .08); box-shadow: inset 0 3px 0 var(--gold); }
  .tab-count { margin-left: 8px; padding: 0 7px; border-radius: 10px; background: var(--gold); color: var(--navy-2); font-size: 12px; line-height: 20px; font-variant-numeric: tabular-nums; }
  .tab-count:empty { display: none; }

  .nav-head { padding: 10px 14px; }
  .nv-sec { padding: 0 14px; }
  .nv-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
  .nv { height: 46px; }

  .transcript { top: 30%; width: 100%; border-left: 0; border-top: 3px solid var(--gold); border-radius: 14px 14px 0 0; overflow: hidden; }
  .tx-body { font-size: 17px; }

  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal, .modal-wide { max-width: none; border-radius: 14px 14px 0 0; max-height: 90%; }
  .res-big b { font-size: 44px; }
  .res-table th, .res-table td { padding: 8px 4px; }
  .res-table .num { width: 40px; }
  .res-table tbody th { white-space: normal; font-size: 15px; }
  .res-table tbody th small { display: none; }
  .res-table thead th { font-size: 11px; letter-spacing: 0; }
  .res-cell { min-width: 84px; }
  .res-sc b { font-size: 20px; }
}

@media (max-width: 380px) {
  .pl-skip { min-width: 42px; }
  .pl-time { margin-left: 6px; }
  .lt-btn { min-width: 44px; margin-right: 7px; }
}

/* 宽屏投影（16:9，1600px 以上）再放大一些 */
@media (min-width: 1600px) {
  .mode-teacher .nav { width: 320px; }
  .mode-teacher .paper-in { max-width: 1200px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .topbar, .player, .pp-tools, .tabbar, .nav, .notice { display: none !important; }
  .app { height: auto; }
  .paper { overflow: visible; background: #fff; }
  .paper-in { box-shadow: none; margin: 0; max-width: none; }
  .bank-sticky { position: static; }
}
