/* 考试系统共用样式。手机优先，桌面加宽。无框架、无外部字体。 */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2430;
  --ink-2: #5a6a7d;
  --ink-3: #8a99ab;
  --line: #dde4ec;
  --brand: #2f6db5;
  --brand-dark: #24558c;
  --brand-soft: #e8f0fa;
  --ok: #1f9254;
  --ok-soft: #e6f5ec;
  --warn: #b7791f;
  --warn-soft: #fdf3e2;
  --bad: #c0392b;
  --bad-soft: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 35, 55, .07), 0 6px 20px rgba(20, 35, 55, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.35; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p  { margin: 0 0 .8em; }
a  { color: var(--brand); }

.wrap { max-width: 780px; margin: 0 auto; padding: 16px; }
.wrap-wide { max-width: 1280px; margin: 0 auto; padding: 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--card); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(20, 35, 55, .04);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; color: var(--brand); white-space: nowrap; }
.topbar .spacer { flex: 1; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-tight { padding: 12px; }
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -4px 0 12px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span {
  display: block; font-size: 13px; color: var(--ink-2);
  margin-bottom: 5px; font-weight: 500;
}
input[type=text], input[type=password], input[type=number], input[type=search],
select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
input[readonly], input:disabled, select:disabled, textarea:disabled {
  background: #f7f9fb; color: var(--ink-2);
}
.code-input { text-transform: uppercase; letter-spacing: 3px; font-weight: 600; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 130px; }

/* ---------- 按钮 ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; font: inherit; font-weight: 500;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
button:hover, .btn:hover { background: #f2f6fa; border-color: #c3d0de; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.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(--bad); border-color: #f0c8c3; }
.btn-danger:hover { background: var(--bad-soft); border-color: #e5a9a2; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 20px; font-size: 16px; }

/* ---------- 标签 / 提示 ---------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 12px; line-height: 1.7; background: #eef2f7; color: var(--ink-2);
  white-space: nowrap;
}
.tag-brand { background: var(--brand-soft); color: var(--brand-dark); }
.tag-ok    { background: var(--ok-soft);    color: var(--ok); }
.tag-warn  { background: var(--warn-soft);  color: var(--warn); }
.tag-bad   { background: var(--bad-soft);   color: var(--bad); }

.note {
  padding: 10px 12px; border-radius: 8px; font-size: 14px;
  background: var(--brand-soft); color: var(--brand-dark); margin-bottom: 12px;
}
.note-warn { background: var(--warn-soft); color: var(--warn); }
.note-bad  { background: var(--bad-soft);  color: var(--bad); }
.note-ok   { background: var(--ok-soft);   color: var(--ok); }
.note:empty { display: none; }

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono  { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-weight: 600; color: var(--ink-2); background: #fafbfd; white-space: nowrap; }
tbody tr:hover { background: #fafcfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 加载 / 空态 ---------- */
.loading, .empty {
  padding: 36px 16px; text-align: center; color: var(--ink-3); font-size: 14px;
}
.spinner {
  display: inline-block; width: 16px; height: 16px; vertical-align: -3px;
  border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(18, 28, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--card); border-radius: 12px; width: 100%; max-width: 640px;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(10, 20, 35, .28);
}
.modal-head, .modal-foot {
  padding: 14px 18px; display: flex; align-items: center; gap: 10px;
}
.modal-head { border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-head .spacer, .modal-foot .spacer { flex: 1; }

/* ---------- 浮动提示 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
#toast div {
  background: rgba(28, 36, 48, .93); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 14px; max-width: 88vw;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  animation: toast-in .2s ease-out;
}
#toast div.bad { background: rgba(160, 45, 34, .95); }
#toast div.ok  { background: rgba(24, 110, 64, .95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 560px) {
  .wrap, .wrap-wide { padding: 12px; }
  .card { padding: 13px; }
  .row > * { min-width: 100%; }
}
