:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --line: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --green: #15803d;
  --red: #b91c1c;
  --amber: #b45309;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
button, input, textarea { font-family: inherit; font-size: inherit; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; min-height: 56px;
}
.topbar .brand { font-weight: 600; color: var(--brand); margin-right: auto; }
.topbar .who { color: var(--muted); font-size: 13px; }
.topbar a, .topbar button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 10px; cursor: pointer; border-radius: 8px; font-size: 14px;
}
.topbar a:hover, .topbar button:hover { background: #f3f4f6; color: var(--text); }
.topbar a.active { color: var(--brand); background: #eff6ff; }
.page { max-width: 960px; margin: 0 auto; padding: 20px 16px 60px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.card.tight { padding: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.h1 { font-size: 24px; font-weight: 600; margin: 4px 0 12px; }
.h2 { font-size: 18px; font-weight: 600; margin: 0 0 10px; }
.h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.block { margin-bottom: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 9px; cursor: pointer; font-size: 14px;
}
.btn:hover { border-color: #c7cbd1; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--red); border-color: #fecaca; background: #fff5f5; }
.btn-danger:hover { border-color: var(--red); }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.input, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; background: #fff; color: var(--text); outline: none;
}
.input:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.textarea { min-height: 88px; resize: vertical; }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; margin-bottom: 5px; font-size: 13px; color: var(--muted); }
.error { color: var(--red); font-size: 13px; margin-top: 6px; }
.notice { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; padding: 10px 12px; border-radius: 9px; font-size: 13px; }
.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.danger-note { background: #fff5f5; border: 1px dashed #fca5a5; color: var(--red); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 600; color: var(--brand); }
.stat span { font-size: 12px; color: var(--muted); }
.bar { height: 7px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; font-size: 12px; color: var(--muted); margin: 2px 4px 2px 0; }
.tag-green { color: var(--green); border-color: #bbf7d0; background: #f0fdf4; }
.tag-red { color: var(--red); border-color: #fecaca; background: #fff5f5; }
.tag-orange { color: var(--amber); border-color: #fed7aa; background: #fff7ed; }
.mode-card { display: block; width: 100%; text-align: left; margin-bottom: 10px; cursor: pointer; }
.mode-card b { display: block; font-weight: 600; }
.mode-card small { color: var(--muted); }
.question-stem { font-size: 17px; line-height: 1.7; margin: 6px 0 16px; white-space: pre-wrap; }
.option {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 11px 13px; margin-bottom: 9px; cursor: pointer;
}
.option:hover { border-color: #93c5fd; }
.option.selected { border-color: var(--brand); background: #eff6ff; }
.option.correct { border-color: #86efac; background: #f0fdf4; }
.option.wrong { border-color: #fca5a5; background: #fff5f5; }
.answer-box { border-radius: 10px; padding: 12px 14px; margin-top: 12px; background: #f9fafb; border: 1px solid var(--line); white-space: pre-wrap; }
.answer-box.right { background: #f0fdf4; border-color: #bbf7d0; }
.answer-box.wrong { background: #fff5f5; border-color: #fecaca; }
.watermark { position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden; }
.watermark span { position: absolute; transform: rotate(-28deg); color: rgba(0,0,0,.055); font-size: 15px; white-space: nowrap; }
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.4);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 460px;
  padding: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.15);
}
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.picker { display: flex; flex-wrap: wrap; gap: 8px; }
.picker button {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 13px;
}
.picker button.st-correct { background: #dcfce7; border-color: #86efac; color: #166534; }
.picker button.st-wrong { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.picker button.st-pending { background: #ffedd5; border-color: #fed7aa; color: #9a3412; }
.picker button.st-active { outline: 2px solid var(--brand); outline-offset: 1px; }
.sheet-group { margin-bottom: 14px; }
.sheet-group h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.timer { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; color: var(--brand); }
.detail-item { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.login-wrap { max-width: 400px; margin: 60px auto; }
.login-wrap .h1 { text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 200; background: #111827; color: #fff; padding: 10px 18px;
  border-radius: 9px; font-size: 14px; max-width: 86vw; text-align: center;
}
@media (max-width: 600px) {
  .page { padding: 14px 12px 48px; }
  .topbar { padding: 10px 12px; }
  .topbar .who { display: none; }
  .h1 { font-size: 20px; }
}
