:root {
  --accent: #1F4E79;
  --accent2: #2E75B6;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #262626;
  --muted: #8a8f98;
  --line: #e8ebf0;
  --ok: #27ae60;
  --warn: #e67e22;
  --danger: #e74c3c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
.top {
  background: linear-gradient(135deg, #1F4E79 0%, #2E75B6 100%);
  color: #fff; padding: 14px 16px 46px; position: relative;
}
.top-inner { max-width: 760px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
h1 { font-size: 20px; }
.sub { font-size: 12px; opacity: .85; margin-top: 4px; }
.top-right { display: flex; gap: 10px; align-items: center; }
.streak {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.35);
  border-radius: 20px; padding: 6px 12px; font-size: 13px; white-space: nowrap;
}
.streak b { font-size: 16px; }
.btn-ghost {
  background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px;
}
main { max-width: 760px; margin: 30px auto 40px; padding: 0 12px; }
.card {
  background: var(--card); border-radius: 14px; padding: 16px;
  box-shadow: 0 2px 10px rgba(31,78,121,.07); margin-bottom: 14px;
}
.card-head { font-weight: 600; margin-bottom: 12px; font-size: 15px; }
.hint { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.loading { text-align: center; padding: 60px 20px; color: var(--muted); }

/* 标签页 */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1; padding: 10px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 总览 */
.overview { display: flex; gap: 18px; align-items: center; }
.ring-wrap { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.ring { width: 96px; height: 96px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.ring-fg {
  fill: none; stroke: var(--accent2); stroke-width: 9; stroke-linecap: round;
  transition: stroke-dashoffset .5s ease;
}
.ring-text {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 20px;
}
.ring-text small { font-size: 11px; color: var(--muted); }
.day-title { font-size: 17px; font-weight: 700; }
.day-sub { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11px; padding: 3px 8px; border-radius: 10px;
  background: #fff7e6; color: #ad6800; border: 1px solid #ffd591;
}
.badge.got { background: #e8f8ee; color: #1a7f46; border-color: #95de64; }
.celebrate { margin-top: 6px; font-size: 13px; color: var(--ok); font-weight: 600; min-height: 18px; }

/* 热力图 */
.heatmap { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.hcell {
  aspect-ratio: 1; border-radius: 5px; background: #eef1f5; position: relative;
  cursor: default; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff;
}
.hcell.lv1 { background: #cfe3f7; color: #1F4E79; }
.hcell.lv2 { background: #9ec8ee; color: #10314e; }
.hcell.lv3 { background: #5d9cd4; color: #fff; }
.hcell.lv4 { background: #1F4E79; color: #fff; }
.hcell.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.hcell.future { opacity: .45; }

/* 任务卡 */
.task { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.task-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.task-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c9cfd8;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; transition: all .15s; cursor: pointer;
}
.task.done .task-check { background: var(--ok); border-color: var(--ok); }
.task.done .task-name { color: var(--muted); text-decoration: line-through; }
.task-name { font-weight: 600; flex: 1; }
.task-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.task-meta.deadline { color: var(--warn); }
.task-meta.deadline.over { color: var(--danger); font-weight: 700; }
.task-meta.game { color: #7b61ff; }
.task-body { display: none; padding: 0 14px 12px 46px; }
.task.open .task-body { display: block; }
.task-body li {
  font-size: 13.5px; line-height: 1.65; margin-bottom: 6px; color: #4a4f57;
  list-style: none; position: relative; padding-left: 16px;
}
.task-body li::before { content: "▸"; position: absolute; left: 0; color: var(--accent2); }
.game-timer { margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.game-timer .time { font-size: 18px; font-weight: 700; color: #7b61ff; font-variant-numeric: tabular-nums; }
.btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; cursor: pointer; font-size: 13px;
}
.btn:active { opacity: .85; }
.btn.sec { background: #eef1f5; color: var(--text); }

/* 复盘 */
textarea {
  width: 100%; min-height: 72px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 13.5px; font-family: inherit; resize: vertical; outline: none;
}
textarea:focus { border-color: var(--accent2); }
.saved-tip { margin-left: 10px; font-size: 12px; color: var(--ok); }

/* 周报统计 */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi {
  background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; text-align: center;
}
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--accent); margin: 4px 0; }
.kpi-sub { font-size: 11px; color: var(--muted); }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-card {
  background: var(--card); border-radius: 14px; padding: 16px;
  box-shadow: 0 2px 10px rgba(31,78,121,.07);
}
.chart-card h3 { font-size: 14px; margin-bottom: 10px; }
.chart-box { width: 100%; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 400px;
}
.modal h2 { font-size: 16px; margin-bottom: 14px; }
.modal label { display: block; font-size: 13px; margin-bottom: 10px; color: #4a4f57; }
.modal input {
  display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; font-size: 14px; outline: none;
}
.modal input:focus { border-color: var(--accent2); }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal .hint { margin-top: 12px; line-height: 1.6; margin-left: 0; }

@media (max-width: 640px) {
  .heatmap { grid-template-columns: repeat(7, 1fr); }
  .report-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 17px; }
}

/* ---- 关卡模式新增 ---- */
.progress-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.progress-bar {
  flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, #1F4E79, #5d9cd4); border-radius: 4px; transition: width .5s ease; }
.progress-text { font-size: 11px; color: var(--muted); white-space: nowrap; }

.advance-btn { margin-left: auto; font-size: 12px; padding: 5px 10px; }

.leftover-box {
  border: 1px dashed #ffd591; background: #fffbe6; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px;
}
.leftover-head { font-size: 13px; font-weight: 600; color: #ad6800; margin-bottom: 6px; }
.leftover-row {
  display: flex; align-items: center; gap: 8px; padding: 4px 0;
  font-size: 13px; color: #4a4f57;
}
.leftover-day {
  background: #fff1cc; color: #ad6800; border-radius: 6px; padding: 1px 6px;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.leftover-label { flex: 1; }
.makeup-btn { font-size: 12px; padding: 3px 10px; background: #ad6800; flex-shrink: 0; }

.hcell { position: relative; }
.leftover-dot {
  position: absolute; top: 1px; right: 3px; font-size: 9px; font-weight: 700; color: #fff;
  background: var(--warn); border-radius: 50%; width: 12px; height: 12px;
  display: flex; align-items: center; justify-content: center;
}

.modal-sec {
  font-size: 12px; font-weight: 700; color: var(--accent);
  margin: 12px 0 8px; border-top: 1px solid var(--line); padding-top: 10px;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { display: inline-block; width: auto; margin-top: 0; }

/* 页面内通知横幅 */
.notify-banner {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%) translateY(-80px);
  background: rgba(31,78,121,.95); color: #fff; padding: 10px 18px; border-radius: 12px;
  font-size: 13px; max-width: 86vw; z-index: 98; transition: transform .3s; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.notify-banner.show { transform: translateX(-50%) translateY(0); }

/* 轻量 toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 22px;
  font-size: 13px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- 背八股卡片 ---- */
.go-cards { margin-top: 8px; font-size: 12px; padding: 6px 12px; }
.study-stats { margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.study-bar { display: flex; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.study-fill.good { background: var(--ok); }
.study-fill.mid { background: var(--warn); }
.study-link { color: var(--accent2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 14px; padding: 4px 12px; font-size: 12px; cursor: pointer;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.mode-switch { display: flex; gap: 8px; margin-bottom: 12px; }
.mode-btn {
  flex: 1; padding: 8px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.mode-btn.active { background: #eaf2fa; color: var(--accent); border-color: var(--accent2); }

.trainer { display: flex; flex-direction: column; gap: 10px; }
.trainer-meta { font-size: 12px; color: var(--muted); text-align: center; }

.flip-scene { perspective: 1200px; cursor: pointer; }
.flip-inner {
  position: relative; width: 100%; min-height: 300px;
  transform-style: preserve-3d; transition: transform .45s;
}
.flip-scene.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border: 1px solid var(--line); border-radius: 14px;
  background: #fff; box-shadow: 0 2px 12px rgba(31,78,121,.08);
  display: flex; flex-direction: column; padding: 18px;
}
.flip-back { transform: rotateY(180deg); overflow-y: auto; }
.flip-cat { font-size: 12px; color: var(--accent2); font-weight: 600; }
.flip-title { font-size: 16px; font-weight: 700; margin-top: 10px; line-height: 1.6; }
.flip-tip { margin-top: auto; padding-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.flip-answer { font-size: 13px; line-height: 1.75; color: #3d424b; }
.flip-answer h3, .flip-answer h4 { font-size: 14px; margin: 10px 0 4px; color: var(--accent); }
.flip-answer pre { background: #f6f8fa; border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12px; }
.flip-answer code { background: #f0f2f5; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.flip-answer pre code { background: none; padding: 0; }
.flip-answer table { border-collapse: collapse; width: 100%; font-size: 12px; margin: 8px 0; display: block; overflow-x: auto; }
.flip-answer th, .flip-answer td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.flip-answer th { background: #f6f8fa; }
.flip-answer li { margin: 3px 0; }

.answer-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.answer-btn {
  border: none; border-radius: 10px; padding: 9px 14px; font-size: 13px;
  font-weight: 600; color: #fff; cursor: pointer; flex: 1; min-width: 76px;
}
.answer-btn.lv-bad { background: #e74c3c; }
.answer-btn.lv-mid { background: #e67e22; }
.answer-btn.lv-good { background: #27ae60; }
.answer-btn.current { outline: 3px solid rgba(255,255,255,.5); outline-offset: -5px; }

.card-list { display: flex; flex-direction: column; gap: 8px; }
.list-item { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer;
}
.list-id {
  background: #eaf2fa; color: var(--accent); border-radius: 6px; padding: 1px 6px;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.list-title { flex: 1; font-size: 13px; font-weight: 600; }
.list-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; flex-shrink: 0; }
.list-badge.ok { background: #e8f8ee; color: #1a7f46; }
.list-badge.mid { background: #fff4e6; color: #ad6800; }
.list-badge.bad { background: #fdeaea; color: #c0392b; }
.list-body { padding: 10px 14px 14px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.75; }
.list-body pre { background: #f6f8fa; border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12px; }
.list-body code { background: #f0f2f5; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.list-body pre code { background: none; padding: 0; }
.list-body table { border-collapse: collapse; width: 100%; font-size: 12px; margin: 8px 0; display: block; overflow-x: auto; }
.list-body th, .list-body td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.list-body th { background: #f6f8fa; }

/* ---- 登录页 ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1F4E79 0%, #2E75B6 100%); padding: 16px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 20px; text-align: center; }
.login-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 15px; outline: none; margin-bottom: 12px;
}
.login-card input:focus { border-color: var(--accent2); }
.login-btn { width: 100%; padding: 12px; font-size: 15px; }
.login-error { color: var(--danger); font-size: 13px; text-align: center; margin-top: 10px; }

/* ---- 费曼复述训练器 ---- */
.feyn-strict {
  margin-left: auto; font-size: 12px; border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 6px; color: var(--muted); background: #fff; outline: none;
}
.feyn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.chip-count {
  margin-left: 6px; font-size: 10px; background: rgba(0,0,0,.08); border-radius: 8px; padding: 0 5px;
}
.feyn-hint {
  font-size: 12.5px; color: var(--muted); background: #f7f9fc; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; margin: 8px 0; line-height: 1.6;
}
.feyn-hint.warn { background: #fffbe6; border-color: #ffd591; color: #ad6800; }
.feyn-hint code { background: #eef1f5; border-radius: 4px; padding: 1px 6px; font-size: 11.5px; }
.feyn-progress { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

.feyn-question {
  border: 1px solid var(--line); border-radius: 12px; background: #f7f9fc;
  padding: 14px 16px; margin-bottom: 12px;
}
.feyn-qcat { font-size: 12px; color: var(--accent2); font-weight: 600; }
.feyn-qtitle { font-size: 16px; font-weight: 700; margin-top: 6px; line-height: 1.6; }

.feyn-mic-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.feyn-mic {
  border: none; border-radius: 26px; padding: 12px 26px; font-size: 15px; font-weight: 700;
  background: var(--accent); color: #fff; cursor: pointer; box-shadow: 0 3px 10px rgba(31,78,121,.25);
}
.feyn-mic.recording { background: #e74c3c; animation: feyn-pulse 1.2s infinite; }
@keyframes feyn-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(231,76,60,.4); } 50% { box-shadow: 0 0 0 8px rgba(231,76,60,0); } }
.feyn-rec-tip { font-size: 12.5px; color: var(--muted); }

.feyn-transcript {
  width: 100%; min-height: 120px; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 14px; line-height: 1.7; font-family: inherit; resize: vertical; outline: none;
}
.feyn-transcript:focus { border-color: var(--accent2); }
.feyn-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.feyn-actions .btn { padding: 10px 18px; font-size: 14px; }

.feyn-feedback { display: flex; flex-direction: column; gap: 10px; }
.feyn-fb-head { display: flex; align-items: center; gap: 16px; }
.feyn-score { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.feyn-ring { width: 76px; height: 76px; }
.feyn-score-num {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
}
.feyn-fb-comment { font-size: 14px; font-weight: 600; line-height: 1.5; }
.feyn-fb-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.feyn-fb-block { border-radius: 12px; padding: 10px 14px; font-size: 13.5px; line-height: 1.6; }
.feyn-fb-block.ok { background: #e8f8ee; border: 1px solid #b7ebc5; }
.feyn-fb-block.miss { background: #fdeaea; border: 1px solid #f5b5b5; }
.feyn-fb-block.wrong { background: #fff4e6; border: 1px solid #ffd591; }
.feyn-fb-block.fu { background: #eef3fb; border: 1px solid #c6d9f2; }
.feyn-fb-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.feyn-fb-item { margin: 3px 0; }
.feyn-evidence { color: #1a7f46; font-size: 12.5px; }
.feyn-correct { color: #ad6800; font-size: 12.5px; margin-top: 2px; }
.feyn-core {
  margin-left: 6px; font-size: 10px; background: #e74c3c; color: #fff;
  border-radius: 8px; padding: 0 6px; vertical-align: 1px;
}

.feyn-answer {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: #f7f9fc; margin-top: 4px;
}
.feyn-answer-body {
  font-size: 13px; line-height: 1.75; color: #3d424b; white-space: pre-wrap; word-break: break-word;
}

/* ---- 三线总览 ---- */
.line-stats { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.line-stat { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.line-badge { width: 24px; text-align: center; }
.line-name { color: var(--muted); width: 64px; }
.line-val { font-weight: 600; }

/* ---- 科学复习 ---- */
.srs-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 12px; }
.srs-stat { background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.srs-stat b { display: block; font-size: 18px; color: var(--accent); }
.srs-stat span { font-size: 11px; color: var(--muted); }
.srs-done { text-align: center; padding: 30px 10px; color: var(--ok); font-size: 15px; }

/* ---- 科学复习专题栏 ---- */
.srs-topic { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.srs-topic select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 13px; color: var(--text); background: #fff; outline: none; }
.srs-topic-info { font-size: 12px; color: var(--muted); }
