/* ========== 全局 ========== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2d3d; -webkit-tap-highlight-color: transparent; }
body { font-size: 14px; background: #f4f7fa; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ========== 通用容器 ========== */
.page { min-height: 100vh; width: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; }
.page--login { background-image: url("../img/1.png"); display: flex; align-items: center; justify-content: center; padding: 24px; }
.page--exam { background-image: url("../img/2.png"); background-attachment: fixed; padding: 12px 12px 110px; }
.page--result { background-image: url("../img/2.png"); background-attachment: fixed; padding: 16px 12px 32px; }

/* ========== 登录卡片 ========== */
.login-card { width: 100%; max-width: 360px; background: rgba(255,255,255,0.92); backdrop-filter: blur(6px); border-radius: 14px; padding: 28px 24px; box-shadow: 0 8px 32px rgba(0,0,0,0.12); }
.login-card h1 { margin: 0 0 6px; font-size: 22px; color: #2c7a4d; text-align: center; font-weight: 600; }
.login-card .subtitle { text-align: center; color: #6b7c93; font-size: 13px; margin-bottom: 22px; }

.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-size: 13px; color: #4a5568; margin-bottom: 6px; }
.form-item input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #d0d7de; border-radius: 8px; font-size: 15px; background: #fff; outline: none; transition: border-color .2s; }
.form-item input:focus { border-color: #2c7a4d; }

.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.btn-code { flex: 0 0 110px; height: 42px; border: 1px solid #2c7a4d; background: #fff; color: #2c7a4d; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all .2s; }
.btn-code:disabled { color: #9aa5b1; border-color: #d0d7de; cursor: not-allowed; background: #f4f7fa; }

.btn-primary { width: 100%; height: 44px; margin-top: 8px; background: linear-gradient(135deg, #2c7a4d, #3aa471); color: #fff; border: 0; border-radius: 8px; font-size: 16px; font-weight: 500; cursor: pointer; transition: opacity .2s; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,0.78); color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 14px; z-index: 9999; max-width: 80%; text-align: center; }

/* ========== 答题页 ========== */
.exam-header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.96); border-radius: 10px; padding: 0; margin-bottom: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); overflow: hidden; }
.exam-header .hd-title { display: flex; align-items: center; padding: 10px 12px; background: linear-gradient(to right, rgba(44,122,77,0.08), transparent); }
.exam-header .hd-label { display: inline-block; padding: 5px 12px; background: #1f2d3d; color: #fff; font-size: 14px; font-weight: 600; border-radius: 4px; position: relative; }
.exam-header .hd-label::after { content: ""; position: absolute; right: -6px; top: 50%; transform: translateY(-50%) rotate(45deg); width: 10px; height: 10px; background: #1f2d3d; }
.exam-header .hd-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.exam-header .timer { font-size: 16px; font-weight: 600; color: #c0392b; font-variant-numeric: tabular-nums; }
.exam-header .timer.safe { color: #2c7a4d; }
.btn-logout { height: 28px; padding: 0 10px; font-size: 12px; border: 1px solid #d0d7de; background: #fff; color: #4a5568; border-radius: 6px; cursor: pointer; }
.btn-logout:hover { color: #c0392b; border-color: #c0392b; }

.exam-header .hd-tip { padding: 4px 12px 10px; font-size: 13px; color: #4a5568; line-height: 1.5; }
.exam-header .hd-prog { padding: 0 12px 12px; }
.exam-header .hd-prog-text { font-size: 12px; color: #4a5568; margin-bottom: 6px; font-weight: 500; }
.exam-header .hd-prog-bar { height: 6px; background: #e6ecf0; border-radius: 3px; overflow: hidden; }
.exam-header .hd-prog-bar > i { display: block; height: 100%; background: linear-gradient(to right, #2c7a4d, #3aa471); border-radius: 3px; transition: width .3s; }

.q-card { background: rgba(255,255,255,0.96); border-radius: 10px; padding: 14px 14px 16px; margin-bottom: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.q-card .q-title { font-size: 15px; font-weight: 500; margin-bottom: 12px; line-height: 1.5; }
.q-card .q-title .tag { display: inline-block; padding: 1px 8px; font-size: 11px; border-radius: 4px; margin-right: 6px; background: #e6f4ec; color: #2c7a4d; font-weight: 500; }
.q-card .q-title .tag.multi { background: #fef3e6; color: #b56e1b; }
.q-card .q-title .idx { color: #6b7c93; margin-right: 4px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: flex-start; padding: 10px 12px; border: 1px solid #d0d7de; border-radius: 8px; cursor: pointer; user-select: none; transition: all .15s; background: #fff; }
.opt input { margin: 3px 8px 0 0; transform: scale(1.1); accent-color: #2c7a4d; }
.opt .label { flex: 1; font-size: 14px; line-height: 1.4; }
.opt.active { border-color: #2c7a4d; background: #f0f9f4; }

/* 结果页中的对/错 */
.opt.right { border-color: #2c7a4d; background: #e6f4ec; }
.opt.wrong { border-color: #c0392b; background: #fdecea; }
.opt .mark { font-size: 12px; margin-left: 6px; font-weight: 600; }
.opt .mark.right { color: #2c7a4d; }
.opt .mark.wrong { color: #c0392b; }

.exam-footer { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,0.96); box-shadow: 0 -2px 12px rgba(0,0,0,0.08); display: flex; gap: 10px; align-items: center; }
.exam-footer .progress { flex: 1; text-align: center; font-size: 13px; color: #4a5568; }
.exam-footer .btn-primary,
.exam-footer .btn-ghost { width: auto; flex: 0 0 110px; margin: 0; height: 42px; font-size: 15px; }
.btn-ghost { background: #fff; color: #2c7a4d; border: 1px solid #2c7a4d; border-radius: 8px; cursor: pointer; transition: opacity .2s; }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }
.btn-submit { background: linear-gradient(135deg, #c0392b, #e0533f) !important; }

/* 结果页 */
.result-card { background: rgba(255,255,255,0.96); border-radius: 12px; padding: 22px 18px; text-align: center; margin-bottom: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.result-card .score { font-size: 56px; font-weight: 700; color: #2c7a4d; line-height: 1; }
.result-card .score.fail { color: #c0392b; }
.result-card .label { font-size: 14px; color: #6b7c93; margin: 8px 0 4px; }
.result-card .status-text { font-size: 16px; font-weight: 500; margin-top: 6px; }
.result-card .actions { margin-top: 18px; display: flex; gap: 10px; }
.result-card .actions .btn-primary { flex: 1; margin: 0; height: 42px; font-size: 15px; }

/* loading 蒙层 */
.loading-mask { position: fixed; inset: 0; background: rgba(255,255,255,0.5); display: flex; align-items: center; justify-content: center; z-index: 9000; }
.loading-mask .spinner { width: 36px; height: 36px; border: 3px solid #d0d7de; border-top-color: #2c7a4d; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
