/* 10号线列车安全内部考核电子试卷 —— 考生端与管理后台共用样式 */
:root {
  --deep: #0e3f94;
  --mid: #1b5bbe;
  --light: #3d8fe0;
  --sky: #e8f1fd;
  --line: #d5e2f3;
  --ink: #1f2a3d;
  --grey: #5b6b85;
  --bg: #f3f6fb;
  --card: #ffffff;
  --ok: #138a4b;
  --ok-bg: #e6f6ed;
  --bad: #c62828;
  --bad-bg: #fdecec;
  --warn: #b26a00;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(14, 63, 148, .08), 0 4px 16px rgba(14, 63, 148, .06);
}
* { 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, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--mid); }
.hidden { display: none !important; }

/* ---------- 顶部 ---------- */
.brand {
  background: linear-gradient(135deg, var(--deep), var(--mid));
  color: #fff; padding: 18px 16px 20px; text-align: center;
}
.brand img { width: 72px; height: 72px; border-radius: 50%; background: #fff; display: block; margin: 0 auto 10px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: 1px; font-weight: 700; }
.brand p { margin: 4px 0 0; opacity: .85; font-size: 13px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 17px; color: var(--deep); display: flex; align-items: center; gap: 8px; }
.card h2::before { content: ""; width: 4px; height: 17px; background: var(--mid); border-radius: 2px; }

/* ---------- 须知 ---------- */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.fact { background: var(--sky); border-radius: 8px; padding: 10px 6px; text-align: center; }
.fact b { display: block; font-size: 20px; color: var(--deep); line-height: 1.3; }
.fact span { font-size: 12px; color: var(--grey); }
.rules { margin: 0; padding-left: 20px; color: #334; }
.rules li { margin: 4px 0; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field label i { color: var(--bad); font-style: normal; margin-left: 2px; }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--mid); box-shadow: 0 0 0 3px rgba(27, 91, 190, .12); }
.field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: 14px/1.6 ui-monospace, Menlo, Consolas, monospace; resize: vertical; outline: none; }
.field textarea:focus { border-color: var(--mid); box-shadow: 0 0 0 3px rgba(27, 91, 190, .12); }
.card h2 + .field, .card form h2:not(:first-child) { margin-top: 18px; }
.field .tip { font-size: 12px; color: var(--grey); margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: #334; margin: 6px 0 14px; }
.check input { width: 18px; height: 18px; margin-top: 3px; flex: none; }
.err { white-space: pre-line; color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 20px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--mid); color: #fff; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--deep); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--mid); border: 1px solid var(--mid); }
.btn.ghost:hover { background: var(--sky); }
.btn.danger { background: var(--bad); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; }

/* ---------- 答题 ---------- */
.bar {
  position: sticky; top: 0; z-index: 20; background: var(--deep); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.bar .who { font-size: 13px; opacity: .85; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .timer { font: 700 20px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 1px; }
.bar .timer.warn { color: #ffd54f; }
.bar .count { font-size: 13px; opacity: .9; }
.bar .btn { height: 34px; padding: 0 14px; font-size: 14px; background: #fff; color: var(--deep); }
.bar .btn.sheet-btn { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .6); }
.saved { font-size: 12px; color: var(--grey); text-align: right; margin: -4px 0 8px; min-height: 18px; }

.section-title { font-size: 16px; font-weight: 700; color: var(--deep); margin: 18px 0 10px; }
.section-title small { display: block; font-weight: 400; font-size: 13px; color: var(--grey); margin-top: 2px; }
.q { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; scroll-margin-top: 64px; }
.q .stem { font-weight: 600; margin-bottom: 10px; }
.q .no { color: var(--mid); margin-right: 4px; }
.q .tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 0 6px; border-radius: 4px; margin-right: 6px; background: var(--sky); color: var(--mid); vertical-align: 1px; }
.q .tag.m { background: #fff3e0; color: var(--warn); }
.opt {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 8px; cursor: pointer; transition: background .15s, border-color .15s;
}
.opt:last-child { margin-bottom: 0; }
.opt:hover { border-color: var(--light); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .k {
  flex: none; width: 24px; height: 24px; border: 1.5px solid #9fb4d3; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--grey); margin-top: 1px;
}
.opt.radio .k { border-radius: 50%; }
.opt.box .k { border-radius: 5px; }
.opt.on { background: var(--sky); border-color: var(--mid); }
.opt.on .k { background: var(--mid); border-color: var(--mid); color: #fff; }
.opt:focus-within { outline: 2px solid var(--light); outline-offset: 1px; }

/* 防作弊：答题区不可选中复制；水印覆盖全屏、不挡点击 */
#v-exam .q { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.watermark { position: fixed; inset: 0; z-index: 15; pointer-events: none; background-repeat: repeat; }

/* 答题卡 */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(10, 25, 60, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet .panel { background: #fff; width: 100%; max-width: 760px; max-height: 80vh; overflow: auto; border-radius: 14px 14px 0 0; padding: 16px; }
.sheet h3 { margin: 0 0 4px; font-size: 16px; color: var(--deep); }
.sheet .legend { font-size: 12px; color: var(--grey); margin-bottom: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin-bottom: 12px; }
.grid button { height: 36px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; }
.grid button.done { background: var(--mid); border-color: var(--mid); color: #fff; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 25, 60, .5); display: grid; place-items: center; padding: 16px; }
.modal .box { background: #fff; border-radius: 12px; padding: 20px; width: 100%; max-width: 400px; }
.modal h3 { margin: 0 0 8px; color: var(--deep); }
.modal p { margin: 0 0 16px; color: #334; }
.modal .acts { display: flex; gap: 10px; justify-content: flex-end; }

/* 成绩 */
.result { text-align: center; padding: 26px 18px; }
.result .score { font-size: 64px; font-weight: 800; line-height: 1; margin: 8px 0; }
.result .score small { font-size: 18px; font-weight: 600; color: var(--grey); margin-left: 4px; }
.result .badge { display: inline-block; padding: 4px 16px; border-radius: 99px; font-weight: 700; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.result .rows { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.result .rows div { background: var(--sky); border-radius: 8px; padding: 10px 4px; }
.result .rows b { display: block; font-size: 18px; color: var(--deep); }
.result .rows span { font-size: 12px; color: var(--grey); }
.muted { color: var(--grey); font-size: 13px; }
.center { text-align: center; }
.foot { text-align: center; color: var(--grey); font-size: 12px; padding: 8px 16px 28px; }

@media (max-width: 520px) {
  .facts { grid-template-columns: repeat(2, 1fr); }
  .brand h1 { font-size: 18px; }
  .bar { padding: 8px 10px; gap: 8px; }
  .bar .count { display: none; }
}

/* ================= 管理后台 ================= */
.admin { min-height: 100vh; }
.top {
  background: linear-gradient(135deg, var(--deep), var(--mid)); color: #fff;
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
}
.top img { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
.top h1 { margin: 0; font-size: 17px; flex: 1; }
.top h1 small { font-weight: 400; opacity: .8; margin-left: 6px; font-size: 13px; }
.top .btn { height: 32px; font-size: 13px; background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .5); }
.tabs { display: flex; gap: 4px; background: #fff; padding: 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 14px; cursor: pointer; color: var(--grey); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--deep); font-weight: 700; border-color: var(--mid); }
.main { max-width: 1240px; margin: 0 auto; padding: 18px 20px 40px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat span { color: var(--grey); font-size: 13px; }
.stat b { display: block; font-size: 26px; color: var(--deep); line-height: 1.4; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bars .row { display: grid; grid-template-columns: 150px 1fr 56px; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.bars .track { height: 14px; background: var(--sky); border-radius: 7px; overflow: hidden; }
.bars .fill { height: 100%; background: linear-gradient(90deg, var(--light), var(--mid)); border-radius: 7px; }
.bars .fill.low { background: linear-gradient(90deg, #ef9a9a, var(--bad)); }
.bars .val { text-align: right; color: var(--grey); font-variant-numeric: tabular-nums; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.filters .field { margin: 0; }
.filters .field input, .filters .field select { height: 36px; font-size: 14px; }
.filters .field label { font-size: 12px; font-weight: 400; color: var(--grey); margin-bottom: 2px; }
.filters .grow { flex: 1; min-width: 180px; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #edf2f9; text-align: left; white-space: nowrap; }
th { background: #f7faff; color: var(--grey); font-weight: 600; position: sticky; top: 0; }
tr:hover td { background: #fafcff; }
td.num { font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 280px; }
.pill { display: inline-block; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.run { background: #fff3e0; color: var(--warn); }
.pill.info { background: var(--sky); color: var(--mid); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 0; color: var(--grey); font-size: 14px; }
.linkbtn { border: 0; background: none; color: var(--mid); cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }

.drawer { position: fixed; inset: 0; z-index: 40; background: rgba(10, 25, 60, .45); display: flex; justify-content: flex-end; }
.drawer .panel { width: min(860px, 100%); height: 100%; overflow: auto; background: var(--bg); padding: 18px 20px 40px; }
.drawer .head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.drawer .head h3 { margin: 0; flex: 1; color: var(--deep); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; font-size: 14px; }
.kv div span { color: var(--grey); margin-right: 6px; }
.ans { background: #fff; border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; border-left: 4px solid var(--ok); }
.ans.wrong { border-left-color: var(--bad); }
.ans .stem { font-weight: 600; }
.ans ol { margin: 6px 0; padding-left: 0; list-style: none; }
.ans li { padding: 2px 8px; border-radius: 4px; font-size: 14px; }
.ans li.c { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.ans li.x { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
.ans .meta { font-size: 13px; color: var(--grey); }
.login { max-width: 380px; margin: 10vh auto; }
.notice { background: #fff8e1; color: #6d4c00; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.switch { display: flex; align-items: center; gap: 10px; }
.switch input { width: 20px; height: 20px; }

@media (max-width: 860px) {
  .two { grid-template-columns: 1fr; }
  .bars .row { grid-template-columns: 110px 1fr 50px; }
  .main { padding: 14px 12px 40px; }
}
