/* =============================================================
   CET-4 备考工作台 —— 样式
   ============================================================= */
:root {
  --bg:            #f4f5f7;
  --bg-elev:       #ffffff;
  --bg-soft:       #fafbfc;
  --line:          #e3e6ea;
  --line-strong:   #cfd5dc;
  --text:          #1c2024;
  --text-2:        #5b6570;
  --text-3:        #8b949e;
  --accent:        #2f6feb;
  --accent-soft:   #e8f0fe;
  --accent-text:   #1f56c4;
  --ok:            #1a7f4b;
  --ok-soft:       #e5f5ec;
  --warn:          #a8690b;
  --warn-soft:     #fdf3e0;
  --danger:        #c0392b;
  --danger-soft:   #fbeae8;
  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 1px 2px rgba(16,24,40,.05), 0 4px 12px rgba(16,24,40,.05);
  --shadow-lg:     0 8px 32px rgba(16,24,40,.16);
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
html[data-theme="dark"] {
  --bg:            #14171a;
  --bg-elev:       #1c2126;
  --bg-soft:       #22272d;
  --line:          #2c333a;
  --line-strong:   #3d454e;
  --text:          #e8ebee;
  --text-2:        #a8b1ba;
  --text-3:        #7b858f;
  --accent:        #5b93f7;
  --accent-soft:   #1c2c4a;
  --accent-text:   #8db4fa;
  --ok:            #4ec98a;
  --ok-soft:       #17352a;
  --warn:          #e0a83e;
  --warn-soft:     #3a2f16;
  --danger:        #f0776a;
  --danger-soft:   #3d1f1c;
  --shadow:        0 1px 2px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.25);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
/* 作者样式中的 display 会覆盖 UA 的 [hidden]{display:none}，必须显式兜住 */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1360px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font: 700 11px/1 var(--mono); letter-spacing: .06em;
  background: var(--accent); color: #fff;
  padding: 5px 7px; border-radius: 5px;
}
.brand-text { font-size: 15px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 6px 13px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px; border: 1px solid var(--line); background: var(--bg-elev);
  border-radius: var(--radius-sm); color: var(--text-2); display: grid; place-items: center;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

/* ---------------- 布局 ---------------- */
main { max-width: 1360px; margin: 0 auto; padding: 22px 20px 120px; }
main.wide { max-width: none; padding: 0; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 21px; }
.page-head .sub { color: var(--text-3); font-size: 13px; margin-left: auto; }

/* ---------------- 通用卡片 ---------------- */
.card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 16px 18px; }
.section-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 26px 0 10px; display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------------- 统计条 ---------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .k { font-size: 12px; color: var(--text-3); }
.stat .v { font-size: 24px; font-weight: 650; margin-top: 2px; letter-spacing: -.02em; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 3px; }

/* ---------------- 筛选条 ---------------- */
.filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 14px; margin-bottom: 6px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text-2); font-size: 13px;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.search {
  flex: 1; min-width: 170px; padding: 6px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft); outline: none;
}
.search:focus { border-color: var(--accent); background: var(--bg-elev); }
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); }

/* ---------------- 试卷卡片 ---------------- */
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.paper {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px 12px; display: flex; flex-direction: column; gap: 9px;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.paper:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.paper.done { border-left: 3px solid var(--ok); }
.paper.doing { border-left: 3px solid var(--warn); }
.paper-top { display: flex; align-items: flex-start; gap: 8px; }
.paper h3 { font-size: 15px; line-height: 1.35; }
.paper .setno { color: var(--text-3); font-weight: 400; }
.paper-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.tag.ok    { background: var(--ok-soft);    color: var(--ok);    border-color: transparent; }
.tag.warn  { background: var(--warn-soft);  color: var(--warn);  border-color: transparent; }
.tag.muted { color: var(--text-3); }
.paper-status { font-size: 12px; color: var(--text-3); margin-top: auto; }
.paper-status b { color: var(--text); font-weight: 600; }
.paper-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.paper-actions .btn { flex: 1; min-width: 0; }

/* ---------------- 按钮 ---------------- */
.btn {
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--text);
  font-size: 13px; text-align: center; white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; color: var(--text-2); background: transparent; }
.btn.ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------- 考试工作台 ---------------- */
.exam { display: flex; flex-direction: column; height: calc(100vh - 56px); }
/* 听力播放条出现时，为底部留出空间，避免遮住答题卡底栏 */
body.has-audiobar .exam { height: calc(100vh - 120px); }
.exam-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 16px; background: var(--bg-elev); border-bottom: 1px solid var(--line);
}
.exam-title { font-weight: 600; font-size: 14px; }
.stages { display: flex; gap: 4px; margin-left: 4px; }
.stage {
  padding: 5px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text-2); font-size: 13px; display: flex; gap: 6px; align-items: center;
}
.stage small { color: var(--text-3); font-size: 11px; }
.stage:hover { border-color: var(--line-strong); }
.stage.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.stage.on small { color: rgba(255,255,255,.8); }
.stage.done { border-color: var(--ok); color: var(--ok); }
.clock {
  font: 600 17px/1 var(--mono); letter-spacing: .02em;
  padding: 5px 11px; border-radius: var(--radius-sm); background: var(--bg-soft); border: 1px solid var(--line);
}
.clock.low { color: var(--danger); border-color: var(--danger); }
.exam-bar .spacer { margin-left: auto; }

.exam-body { flex: 1; display: flex; min-height: 0; }
.pane-paper { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-soft); }
.pdf-tools {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-bottom: 1px solid var(--line); background: var(--bg-elev); flex-wrap: wrap;
}
.pdf-tools .sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.pdf-frame { flex: 1; width: 100%; border: 0; background: #525659; min-height: 0; }
.pdf-fallback { padding: 40px 24px; text-align: center; color: var(--text-2); }

.pane-card {
  width: 392px; flex: none; border-left: 1px solid var(--line);
  background: var(--bg-elev); display: flex; flex-direction: column; min-height: 0;
}
.pane-card.collapsed { display: none; }
.card-scroll { flex: 1; overflow-y: auto; padding: 14px 16px 20px; }
.card-foot {
  border-top: 1px solid var(--line); padding: 10px 16px;
  display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2);
  background: var(--bg-elev);
}

.sec { margin-bottom: 20px; }
.sec-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 9px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.sec-head h4 { font-size: 13px; }
.sec-head .ratio { font-size: 11px; color: var(--text-3); margin-left: auto; }
.q-row { display: flex; align-items: center; gap: 9px; padding: 4px 0; }
.q-no {
  width: 30px; flex: none; font: 600 12px/1 var(--mono); color: var(--text-3);
  text-align: right;
}
.q-no.flagged { color: var(--warn); }
.q-opts { display: flex; gap: 4px; flex-wrap: wrap; }
.opt {
  width: 30px; height: 27px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text-2); font: 600 12px/1 var(--mono);
}
.opt:hover { border-color: var(--accent); color: var(--accent-text); }
.opt.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt.right { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.opt.wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.q-flag {
  margin-left: auto; width: 22px; height: 22px; border-radius: 4px;
  border: 1px solid var(--line); background: transparent; color: var(--text-3);
  font-size: 11px; display: grid; place-items: center;
}
.q-flag.on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }

.blank-legend { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.blank-legend span {
  font: 600 11px/1 var(--mono); padding: 3px 6px; border-radius: 4px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text-2);
}
.essay-box { width: 100%; min-height: 190px; resize: vertical; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft);
  line-height: 1.7; outline: none; }
.essay-box:focus { border-color: var(--accent); background: var(--bg-elev); }
.wordcount { font: 12px/1 var(--mono); color: var(--text-3); margin-top: 6px; display: flex; gap: 10px; }
.wordcount .hit { color: var(--ok); font-weight: 600; }

/* 判分结果着色 */
.q-row .verdict { font-size: 11px; font-weight: 600; margin-left: 6px; }
.verdict.ok { color: var(--ok); }
.verdict.no { color: var(--danger); }

/* ---------------- 听力播放条 ---------------- */
.audiobar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: flex; align-items: center; gap: 14px;
  padding: 9px 18px; background: var(--bg-elev);
  border-top: 1px solid var(--line); box-shadow: 0 -2px 14px rgba(16,24,40,.07);
}
.audiobar-left, .audiobar-right { display: flex; align-items: center; gap: 7px; }
.audiobar-mid { flex: 1; min-width: 0; }
.play-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; font-size: 13px; display: grid; place-items: center;
}
.play-btn:hover { filter: brightness(1.08); }
.mini-btn {
  padding: 5px 9px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text-2); font: 600 11px/1.2 var(--mono);
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.mini-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ab-time { font: 12px/1 var(--mono); color: var(--text-2); min-width: 88px; }
#abSeek { width: 100%; accent-color: var(--accent); }
.ab-tags { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); margin-top: -2px; }
.ab-borrow { color: var(--warn); }
.ab-marks { display: flex; gap: 4px; flex-wrap: wrap; min-height: 18px; margin-top: 1px; }
.ab-marks button {
  font: 600 10px/1 var(--mono); padding: 3px 6px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text-2);
}
.ab-marks button:hover { border-color: var(--accent); color: var(--accent-text); }
#abRate { padding: 5px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-elev); font: 600 11px var(--mono); }

/* ---------------- 方法论 ---------------- */
.guide-layout { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
.guide-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
.guide-nav button {
  text-align: left; padding: 8px 11px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); font-size: 13px;
}
.guide-nav button:hover { background: var(--bg-soft); color: var(--text); }
.guide-nav button.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.guide-body h2 { font-size: 19px; margin-bottom: 14px; }
.guide-body h3 { font-size: 15px; margin: 20px 0 8px; }
.guide-body p { color: var(--text-2); margin: 10px 0; }
.guide-body ul { margin: 8px 0; padding-left: 20px; color: var(--text-2); }
.guide-body li { margin: 5px 0; }
.guide-body pre {
  background: var(--bg-soft); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 13px 15px; overflow-x: auto;
  font: 12.5px/1.75 var(--mono); color: var(--text);
}
.guide-body .tip {
  background: var(--accent-soft); border-radius: var(--radius-sm);
  padding: 11px 14px; margin: 14px 0; font-size: 13px; color: var(--accent-text);
}
.table-wrap { overflow-x: auto; margin: 12px 0; }
table.gt { border-collapse: collapse; width: 100%; font-size: 13px; }
table.gt th, table.gt td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; vertical-align: top; }
table.gt th { background: var(--bg-soft); font-weight: 600; color: var(--text-2); white-space: nowrap; }
table.gt td { color: var(--text-2); }

/* ---------------- 列表（错题本 / 词汇本）---------------- */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px;
}
.row-item .grow { flex: 1; min-width: 0; }
.row-item .ttl { font-weight: 600; font-size: 14px; }
.row-item .meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.row-item.mastered { opacity: .5; }
.pill { font: 600 12px/1 var(--mono); padding: 4px 8px; border-radius: 4px; }
.pill.no  { background: var(--danger-soft); color: var(--danger); }
.pill.ok  { background: var(--ok-soft); color: var(--ok); }
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .big { font-size: 34px; margin-bottom: 10px; }

/* ---------------- 弹层 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(16,24,40,.45);
  display: grid; place-items: center; padding: 24px;
}
.modal {
  background: var(--bg-elev); border-radius: 12px; box-shadow: var(--shadow-lg);
  width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; }
.modal textarea, .modal input[type=text] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg-soft); outline: none;
  font: 13px/1.6 var(--mono);
}
.modal textarea:focus, .modal input[type=text]:focus { border-color: var(--accent); background: var(--bg-elev); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.hint code { background: var(--bg-soft); padding: 1px 5px; border-radius: 3px; font-family: var(--mono); }

/* ---------------- 成绩报告 ---------------- */
.score-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.score-num { font: 700 42px/1 var(--mono); letter-spacing: -.03em; }
.score-num small { font-size: 14px; font-weight: 400; color: var(--text-3); }
.bar { height: 7px; border-radius: 4px; background: var(--bg-soft); overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--accent); }
.secscore { display: grid; grid-template-columns: 132px 1fr 78px; gap: 10px; align-items: center; margin: 9px 0; font-size: 13px; }
.secscore .n { color: var(--text-2); }
.secscore .v { font: 600 12px/1 var(--mono); color: var(--text-2); text-align: right; }

/* ---------------- 每日打卡 ---------------- */
.ci-today .ci-date {
  font-weight: 650; font-size: 15px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ci-today .bar { margin-bottom: 6px; }
.ci-tasks { display: flex; flex-direction: column; margin: 4px 0 6px; }
.ci-task {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: var(--radius-sm); cursor: pointer; user-select: none;
}
.ci-task:hover { background: var(--bg-soft); }
.ci-task input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; cursor: pointer; }
.ci-task .ci-body { display: flex; flex-direction: column; line-height: 1.45; min-width: 0; }
.ci-task .ci-body b { font-size: 14px; }
.ci-task .ci-body i { font-style: normal; font-size: 12px; color: var(--text-3); }
.ci-task.done .ci-body b { color: var(--text-3); text-decoration: line-through; }
.ci-note { margin-top: 12px; }
.ci-note label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.ci-note textarea {
  width: 100%; min-height: 64px; resize: vertical; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft); line-height: 1.6; outline: none;
}
.ci-note textarea:focus { border-color: var(--accent); background: var(--bg-elev); }
.ci-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.ci-day {
  text-align: center; padding: 10px 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-soft);
}
.ci-day .d { font: 600 16px/1 var(--mono); color: var(--text-2); }
.ci-day .w { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.ci-day.full { background: var(--ok-soft); border-color: var(--ok); }
.ci-day.full .d { color: var(--ok); }
.ci-day.part { background: var(--warn-soft); border-color: var(--warn); }
.ci-day.part .d { color: var(--warn); }
.ci-day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 560px) { .ci-week { gap: 5px; } .ci-day { padding: 8px 2px; } }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #1c2024; color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: 13px; z-index: 200; box-shadow: var(--shadow-lg);
}
html[data-theme="dark"] .toast { background: #e8ebee; color: #14171a; }

/* ---------------- 牛犊图 ---------------- */
.chart-wrap { padding: 8px 2px; }
canvas.chart { width: 100%; height: 220px; display: block; }

@media (max-width: 1080px) {
  .guide-layout { grid-template-columns: 1fr; }
  .guide-nav { position: static; flex-direction: row; overflow-x: auto; }
  .pane-card { width: 340px; }
}
@media (max-width: 860px) {
  .nav { display: none; }
  .exam-body { flex-direction: column; }
  .pane-card { width: auto; border-left: 0; border-top: 1px solid var(--line); height: 50%; }
  .pane-paper { height: 50%; }
}

/* =============================================================
   移动端优先适配 & PWA 新增组件
   ============================================================= */
html, body { overflow-x: hidden; }
body { overscroll-behavior-y: none; }

/* ---------------- 移动端底部导航 ---------------- */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 52px; color: var(--text-3); font-size: 11px;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a .tb-ic { font-size: 19px; line-height: 1; }
.tabbar a.active { color: var(--accent-text); font-weight: 600; }

@media (max-width: 860px) {
  .tabbar { display: flex; }
  main { padding: 14px 12px calc(150px + env(safe-area-inset-bottom)); }
  /* iOS 输入框字号小于 16px 会在聚焦时自动缩放页面 */
  input, textarea, select { font-size: 16px; }
  .btn { min-height: 36px; }
  .icon-btn { width: 36px; height: 36px; }
  /* 听力播放条让位给底部导航 */
  .audiobar { bottom: calc(52px + env(safe-area-inset-bottom)); }
  body.has-audiobar .exam { height: calc(100vh - 56px - 60px - 52px); }
  .topbar-inner { padding: 0 12px; gap: 12px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- 今日页：倒计时 ---------------- */
.cd-card {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--accent) 0%, #1f56c4 100%);
  color: #fff; border: none; border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-lg);
}
html[data-theme="dark"] .cd-card { background: linear-gradient(120deg, #1c2c4a 0%, #16233c 100%); border: 1px solid var(--line); }
.cd-days { font-size: 52px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.cd-days small { font-size: 15px; font-weight: 400; opacity: .85; margin-left: 6px; }
.cd-meta { flex: 1; min-width: 160px; }
.cd-title { font-size: 15px; font-weight: 600; }
.cd-clock { font: 600 22px/1.4 var(--mono); letter-spacing: .04em; }
.cd-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.cd-card .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; }
.cd-card .btn:hover { background: rgba(255,255,255,.26); }

/* ---------------- 今日页：快捷入口宫格 ---------------- */
.quick-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px;
}
.quick-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--text); min-height: 76px;
  -webkit-tap-highlight-color: transparent;
}
.quick-item:hover { border-color: var(--line-strong); text-decoration: none; box-shadow: var(--shadow); }
.quick-item .q-ic { font-size: 20px; }
.quick-item .q-name { font-size: 14px; font-weight: 600; }
.quick-item .q-sub { font-size: 12px; color: var(--text-3); }

/* ---------------- 练习中心 ---------------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tool-card {
  display: flex; flex-direction: column; gap: 8px; padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.tool-card:hover { border-color: var(--line-strong); text-decoration: none; box-shadow: var(--shadow); }
.tool-card .t-ic { font-size: 26px; }
.tool-card .t-name { font-size: 16px; font-weight: 600; }
.tool-card .t-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

/* ---------------- 单词卡：3D 翻转 ---------------- */
.fc-stage { perspective: 1200px; max-width: 520px; margin: 0 auto; }
.fc-card {
  position: relative; width: 100%; min-height: 260px; cursor: pointer;
  transform-style: preserve-3d; transition: transform .45s;
  -webkit-tap-highlight-color: transparent;
}
.fc-card.flip { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 28px 20px; text-align: center;
}
.fc-back { transform: rotateY(180deg); }
.fc-word { font-size: 34px; font-weight: 700; letter-spacing: -.01em; }
.fc-hint { font-size: 12px; color: var(--text-3); }
.fc-def { font-size: 18px; line-height: 1.6; }
.fc-src { font-size: 12.5px; color: var(--text-3); }
.fc-actions { display: flex; gap: 12px; max-width: 520px; margin: 16px auto 0; }
.fc-actions .btn { flex: 1; padding: 12px; font-size: 15px; min-height: 48px; }
.fc-progress { text-align: center; font-size: 13px; color: var(--text-3); margin-bottom: 10px; }
.fc-bar { height: 5px; background: var(--bg-soft); border-radius: 3px; max-width: 520px; margin: 0 auto 18px; overflow: hidden; }
.fc-bar i { display: block; height: 100%; background: var(--accent); transition: width .25s; }

/* ---------------- 阅读计时 ---------------- */
.tm-clock {
  font: 700 64px/1 var(--mono); letter-spacing: -.02em; text-align: center;
  padding: 26px 0 10px; font-variant-numeric: tabular-nums;
}
.tm-clock.over { color: var(--danger); }
.tm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding-bottom: 8px; }
.tm-actions .btn { min-width: 110px; min-height: 44px; font-size: 15px; }
.tm-mode { text-align: center; font-size: 13px; color: var(--text-2); padding-bottom: 4px; }

/* ---------------- 翻译写作模板 ---------------- */
.tpl-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tpl-card { margin-bottom: 12px; }
.tpl-card h3 { font-size: 15px; margin-bottom: 8px; }
.tpl-card pre {
  margin: 0 0 10px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: 13px/1.7 var(--mono); color: var(--text-2);
}
.tpl-card .tpl-foot { display: flex; gap: 8px; flex-wrap: wrap; }
.tpl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tpl-table th, .tpl-table td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.tpl-table th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }

/* ---------------- 听力精听 ---------------- */
.ls-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.ls-step { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); }
.ls-step b { display: block; font-size: 13px; margin-bottom: 3px; }
.ls-step i { font-style: normal; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.dict-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dict-item:last-child { border-bottom: 0; }
.dict-t { font: 600 12px/1.6 var(--mono); color: var(--accent-text); cursor: pointer; white-space: nowrap; padding-top: 2px; }
.dict-t:hover { text-decoration: underline; }
.dict-body { flex: 1; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }

/* ---------------- 弹层移动端 ---------------- */
@media (max-width: 560px) {
  .modal { width: calc(100vw - 24px); max-height: 86vh; }
  .cd-days { font-size: 42px; }
  .tm-clock { font-size: 52px; }
}