/* ===== 考试系统 全局样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
}
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 20px; }

/* ===== 顶部导航 ===== */
.topbar {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: var(--shadow);
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.brand small { font-size: 13px; font-weight: 400; opacity: .9; margin-left: 8px; }
.topbar nav a {
  color: #fff; margin-left: 18px; font-weight: 500; opacity: .92;
}
.topbar nav a:hover { opacity: 1; text-decoration: none; }
.topbar .user-chip { margin-left: 18px; padding: 4px 12px; background: rgba(255,255,255,.16);
  border-radius: 20px; font-size: 13px; }

/* ===== 卡片 ===== */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 24px;
  margin-bottom: 18px;
}
.card h2 { margin-bottom: 14px; font-size: 18px; }
.card h3 { margin-bottom: 10px; font-size: 16px; }

/* ===== 表单 ===== */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; min-height: 120px; }
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn {
  display: inline-block; padding: 10px 20px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .05s; text-decoration: none;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-green { background: var(--green); }
.btn-green:hover { background: #15803d; }
.btn-red { background: var(--red); }
.btn-red:hover { background: #b91c1c; }
.btn-gray { background: #64748b; }
.btn-gray:hover { background: #475569; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #eff6ff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 30px; font-size: 16px; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ===== 提示 ===== */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; font-size: 14px; }
.flash:empty { display: none; }

/* ===== 统计卡片 ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; box-shadow: var(--shadow); }
.stat .num { font-size: 30px; font-weight: 800; color: var(--primary); }
.stat .num.green { color: var(--green); }
.stat .num.red { color: var(--red); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 700; color: #475569; white-space: nowrap; }
tr:hover td { background: #f8fafc; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-ok { background: #dcfce7; color: var(--green); }
.badge-no { background: #fee2e2; color: var(--red); }
.badge-run { background: #fef3c7; color: #b45309; }
.badge-type { background: #e0f2fe; color: #0369a1; }

/* ===== 登录 / 注册框 ===== */
.auth { max-width: 420px; margin: 50px auto; }
.auth .card { padding: 32px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; text-align: center; }
.auth .sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.auth .alt { text-align: center; font-size: 14px; margin-top: 16px; color: var(--muted); }

/* ===== 考试页 ===== */
.exam-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.exam-head .info { font-size: 14px; color: var(--muted); }
.timer {
  background: #0f172a; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 2px;
}
.timer.warn { background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .7; } }

.qitem { border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; background: #fff; }
.qitem .qtext { font-weight: 600; margin-bottom: 12px; }
.qitem .qtag { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px; }
.tag-single { background: #dbeafe; color: #1d4ed8; }
.tag-multiple { background: #dcfce7; color: #15803d; }
.tag-judge { background: #fef3c7; color: #b45309; }
.qitem .opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; transition: background .12s, border-color .12s; }
.opt:hover { background: #f8fafc; }
.opt input { width: auto; }
.opt .key { font-weight: 700; color: var(--primary); min-width: 18px; }

/* 结果页 */
.pass-banner { text-align: center; padding: 30px 20px; border-radius: 12px; color: #fff; margin-bottom: 18px; }
.pass-banner.ok { background: linear-gradient(135deg, #16a34a, #15803d); }
.pass-banner.no { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.pass-banner .big { font-size: 34px; font-weight: 800; }
.pass-banner .score { font-size: 20px; margin-top: 6px; opacity: .95; }
.cert-box { text-align: center; }
.cert-box img { max-width: 100%; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }

/* 详情对错 */
.detail-item { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.detail-item .qtext { font-weight: 600; }
.detail-item .ans { font-size: 13px; margin-top: 6px; }
.ans.right { color: var(--green); }
.ans.wrong { color: var(--red); }

.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.code { background: #0f172a; color: #e2e8f0; padding: 12px 16px; border-radius: 8px;
  font-size: 13px; line-height: 1.7; overflow-x: auto; white-space: pre; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar .wrap { flex-direction: column; gap: 8px; }
  .timer { font-size: 20px; }
}
