/* ============================================================
   内部培训答题系统 · 全站样式（手机优先，宽屏自动居中）
   ============================================================ */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #d97706;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

a { color: var(--brand); }

.muted { color: var(--muted); font-size: .9rem; }
.hidden, [hidden] { display: none !important; }

/* ---------- 登录页 ---------- */
body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, .08);
}
.auth-card h1 { text-align: center; margin-bottom: .25em; }
.auth-card > .muted { text-align: center; margin-bottom: 1.5em; }

.tabs {
  display: flex;
  gap: 6px;
  background: #eef2f8;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.auth-card .tabs { margin-bottom: 20px; }
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: .95rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; min-height: 140px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f9fafb; }
.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); }
.btn.danger { color: var(--err); border-color: #fecaca; }
.btn.block { width: 100%; }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }

.msg { min-height: 1.4em; font-size: .9rem; margin: 10px 0 0; }
.msg.error { color: var(--err); }
.msg.ok { color: var(--ok); }

/* ---------- 主框架 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { font-weight: 700; font-size: 1rem; flex: 1; }
.who { font-size: .85rem; color: var(--muted); }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}

.nav {
  display: flex;
  gap: 6px;
  margin: 14px 0 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nav button {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: .9rem;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
}
.nav button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1; }

/* ---------- 题目 ---------- */
.q-card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.q-meta { font-size: .78rem; color: var(--brand); margin-bottom: 8px; }
.q-stem { font-weight: 600; margin-bottom: 12px; word-break: break-word; }
.opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #fff;
}
.opt:last-child { margin-bottom: 0; }
.opt input { margin-top: 5px; flex: none; }
.opt.picked { border-color: var(--brand); background: #eff6ff; }
.opt.correct { border-color: #86efac; background: #f0fdf4; }
.opt.wrong { border-color: #fca5a5; background: #fef2f2; }

.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: #eef2f8; color: var(--muted); }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.err { background: #fee2e2; color: #b91c1c; }

.score-big { font-size: 2.4rem; font-weight: 800; color: var(--brand); line-height: 1; }
.result-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.review-item { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 12px; }
.explain { font-size: .9rem; color: var(--muted); background: #f8fafc; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num { white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.footer-note { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 24px; }

@media (max-width: 520px) {
  .container { padding: 12px 12px 72px; }
  .card, .q-card { padding: 14px; }
  .score-big { font-size: 2rem; }
}
