* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6f9;
  color: #1f2328;
  line-height: 1.6;
  padding: 24px 16px;
}
.wrap { max-width: 760px; margin: 0 auto; }
.card {
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.sub { color: #667085; font-size: 14px; margin-bottom: 16px; }
label { display: block; font-size: 14px; font-weight: 500; margin: 12px 0 6px; }
input[type="text"], input[type="password"], input[type="datetime-local"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 14px;
}
button:hover { background: #1d4ed8; }
button.ghost { background: #fff; color: #2563eb; border: 1px solid #2563eb; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }
.msg { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-top: 12px; }
.msg.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg.ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.msg.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.q { border: 1px solid #e3e8ef; border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.q .stem { font-weight: 500; margin-bottom: 10px; }
.opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #e3e8ef; border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.opt:hover { background: #f8fafc; }
.opt input { width: 16px; height: 16px; }
.opt.correct { background: #f0fdf4; border-color: #86efac; }
.opt.wrong { background: #fef2f2; border-color: #fecaca; }
.opt.miss { border-style: dashed; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border: 1px solid #e3e8ef; padding: 8px 10px; text-align: left; }
th { background: #f8fafc; font-weight: 600; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.score-big { font-size: 48px; font-weight: 700; color: #2563eb; text-align: center; margin: 8px 0; }
.hidden { display: none; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.tag.live { background: #dcfce7; color: #15803d; }
.tag.closed { background: #fee2e2; color: #b91c1c; }
.tag.wait { background: #fef9c3; color: #854d0e; }
small { color: #667085; }
a { color: #2563eb; }

/* 后台：更宽的容器 + 紧凑按钮 + 状态徽标 */
body.admin .wrap { max-width: 1040px; }
button.small { padding: 6px 10px; font-size: 13px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.wait { background: #fef9c3; color: #854d0e; }
.badge.off { background: #fee2e2; color: #b91c1c; }
table td { vertical-align: middle; }
details summary { font-size: 14px; }
input[type="file"] { width: 100%; padding: 8px 10px; border: 1px dashed #d0d5dd; border-radius: 8px; font-size: 13px; background: #fff; }
.tpl { font-size: 14px; color: #667085; margin-bottom: 14px; }
.tpl a { display: inline-block; margin-left: 8px; padding: 6px 12px; border: 1px solid #2563eb; color: #2563eb; border-radius: 8px; text-decoration: none; font-size: 13px; }
.tpl a:hover { background: #eff6ff; }

/* 考生名单 */
.cand-box { max-height: 260px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px; background: #fff; }
.cand-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px; border-bottom: 1px dashed #f0f0f0; }
.cand-item:last-child { border-bottom: none; }
.cand-name { font-size: 14px; }
.tag.tiny { font-size: 11px; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.tag.tiny.ok { background: #dcfce7; color: #15803d; }
.tag.tiny.off { background: #fee2e2; color: #b91c1c; }
.tag.tiny.none { background: #f1f5f9; color: #475569; }

/* 成绩搜索栏 */
.search-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.search-bar > div { display: flex; flex-direction: column; gap: 4px; }
.search-bar label { font-size: 12px; color: #667085; }
.search-bar input, .search-bar select { padding: 7px 10px; border: 1px solid #d0d5dd; border-radius: 8px; font-size: 13px; min-width: 160px; }
.search-bar .search-btns { flex-direction: row; gap: 8px; }

/* 名单 / 试题 列表里的勾选框 */
.cand-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; margin: 0; }

/* 移动端适配：手机可正常查看试题并考试 */
@media (max-width: 640px) {
  body { padding: 10px 6px; }
  .wrap { max-width: 100%; }
  .card { padding: 14px; border-radius: 10px; }
  h1 { font-size: 19px; }
  h2 { font-size: 15px; }
  body.admin .wrap { max-width: 100%; }
  .row { flex-direction: column; gap: 8px; }
  .row > * { min-width: 0; }
  .q { padding: 12px; }
  .q .stem { font-size: 15px; line-height: 1.5; }
  .opt { padding: 11px 12px; font-size: 15px; }
  .opt input { width: 18px; height: 18px; }
  button { width: 100%; padding: 13px; font-size: 16px; }
  button.ghost, button.danger { width: auto; }
  .search-bar { gap: 8px; padding: 10px; }
  .search-bar input, .search-bar select { min-width: 0; width: 100%; }
  .score-big { font-size: 40px; }
  /* 表格横向滚动，避免手机上挤压变形 */
  table { display: block; width: 100%; overflow-x: auto; white-space: nowrap; }
  .cand-box { max-height: 220px; }
  .tpl a { display: block; margin: 6px 0 0; text-align: center; }
}

/* 考生试卷回看弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal.hidden { display: none; }
.modal-box { background: #fff; max-width: 720px; width: 100%; max-height: 88vh; overflow: auto; border-radius: 14px; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h3 { font-size: 17px; font-weight: 600; }

/* 成绩表分页 */
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 12px; color: #667085; font-size: 13px; }
.pager button { margin-top: 0; }
.pager button[disabled] { opacity: .45; cursor: not-allowed; background: #fff; color: #2563eb; }
.pager button[disabled]:hover { background: #fff; }
