* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --danger: #dc2626; --success: #16a34a;
  --warn: #d97706; --bg: #f1f5f9; --card: #ffffff; --text: #1e293b; --muted: #64748b;
  --border: #e2e8f0; --radius: 12px;
}
html, body { height: 100%; overflow-x: hidden; }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; -webkit-user-select: none; -moz-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* 可编辑元素（输入框/多行/富文本）保持文字可选可编辑 */
input, textarea, select, [contenteditable="true"] { -webkit-user-select: text; -moz-user-select: text; user-select: text; }
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: 70px; }

/* ---------- 通用 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.q-card { -webkit-user-select: none; -moz-user-select: none; user-select: none; -webkit-touch-callout: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border: none; border-radius: 10px; font-size: 15px; cursor: pointer; background: var(--primary); color: #fff; width: 100%; }
.btn:active { transform: scale(.98); }
.btn.secondary { background: #e2e8f0; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; width: auto; border-radius: 8px; }
.btn:disabled { opacity: .5; }

/* 链接式按钮：与"共 x 人"同色同字号，无背景，带下划线 */
.btn-link { background: none; border: none; padding: 0; font-size: 13px; color: #c17f2e; text-decoration: underline; cursor: pointer; }
.btn-link:disabled { opacity: .5; cursor: not-allowed; }
.input { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; font-size: 15px; background: #fff; outline: none; }
.input:focus { border-color: var(--primary); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tags.center { justify-content: center; }
.tag { min-height: 36px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 18px; background: #e2e8f0; color: var(--muted); font-size: 13px; cursor: pointer; border: none; }
.tag.active { background: var(--primary); color: #fff; }
.q-no { font-weight: 600; margin-right: 8px; color: var(--muted); }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.chip.judge { background: #dbeafe; color: #1d4ed8; }
.chip.single { background: #dcfce7; color: #15803d; }
.chip.multi { background: #fef3c7; color: #b45309; }
.chip.diff { background: #f3e8ff; color: #7e22ce; }
.fav-btn { background: none; border: none; font-size: 18px; line-height: 1; color: #cbd5e1; cursor: pointer; padding: 2px 6px; }
.fav-btn.on { color: #f59e0b; }
.fav-btn:active { transform: scale(1.2); }
.muted { color: var(--muted); font-size: 13px; }
.title-lg { font-size: 20px; font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; font-size: 15px; cursor: pointer; border-bottom: 1px solid var(--border); }
.menu-item:last-child { border-bottom: none; }
.menu-item:active { opacity: .7; }
.bank-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px; }
.bank-menu-item { background: var(--card); border-radius: 14px; padding: 20px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.bank-menu-item .bmi-icon { font-size: 28px; line-height: 1; }
.bank-menu-item .bmi-icon.red { color: #dc2626; }
.bank-menu-item .bmi-icon.yellow { color: #f59e0b; }
.bank-menu-item .bmi-name { font-size: 14px; font-weight: 600; color: var(--text); }
.bank-menu-item .bmi-sub { font-size: 11.5px; color: var(--muted); margin-top: -2px; }
.bank-menu-item:active { transform: scale(.96); }
.bank-menu-item.wide { grid-column: 1 / -1; flex-direction: row; justify-content: center; padding: 14px 12px; }
.bank-menu-item.wide .bmi-icon { font-size: 20px; }
.hide { display: none !important; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-warn { color: var(--warn); }

/* ---------- 登录页 ---------- */
/* #app 限宽 640px，登录页需突破该容器铺满全屏（宽屏 PC 不再两侧露灰底） */
.login-wrap { min-height: 100vh; width: 100vw; margin-left: calc(50% - 50vw); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background:
  radial-gradient(1100px 550px at 90% -5%, rgba(255,255,255,.16), transparent 60%),
  radial-gradient(950px 520px at 0% 105%, rgba(125,211,252,.35), transparent 60%),
  radial-gradient(700px 420px at 50% 45%, rgba(255,255,255,.07), transparent 70%),
  linear-gradient(160deg, #1e40af, #2563eb 60%, #3b82f6); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 28px 22px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
@media (min-width: 768px) {
  .login-card { max-width: 420px; padding: 36px 34px; border-radius: 18px; }
  .login-title { font-size: 26px; }
  .login-sub { font-size: 14px; }
}
.login-title { font-size: 22px; font-weight: 700; text-align: center; color: var(--text); }
.login-sub { text-align: center; color: #94a3b8; font-size: 13px; margin: 6px 0 22px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0; text-align: center; }
.link { color: var(--primary); text-decoration: none; font-size: 13px; cursor: pointer; }
.link:active { opacity: .7; }
.captcha-img { height: 46px; width: 130px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #f1f5f9; flex-shrink: 0; }
.unit-drop { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: #fff; border: 1px solid var(--border); border-radius: 10px; max-height: 200px; overflow-y: auto; z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.unit-item { padding: 10px 14px; font-size: 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.unit-item:active { background: var(--bg); }
.au-row { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.au-row:last-child { border-bottom: none; }
/* 管理员行：左侧信息弹性、撤销按钮固定在右侧 */
.au-row.admin { display: flex; align-items: center; gap: 12px; }
.au-row.admin .grow { flex: 1; min-width: 0; }

/* 导出类型单选 */
.radio { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--text); cursor: pointer; }
.radio input { accent-color: var(--primary); margin: 0; }

/* ---------- 顶栏 / 底部导航 ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--primary); color: #fff; height: 54px; padding: 0 16px; display: flex; align-items: center; gap: 10px; }
.topbar .back { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 4px 8px; margin-left: -8px; }
.topbar .back:active { opacity: .7; }
.topbar .title { font-size: 17px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 640px; background: #fff; border-top: 1px solid var(--border); display: flex; z-index: 100; padding-bottom: env(safe-area-inset-bottom); }
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--muted); cursor: pointer; border: none; background: none; }
.tabbar .tab.active { color: var(--primary); font-weight: 600; }
.tabbar .tab .icon { font-size: 20px; line-height: 1; }

/* ---------- 首页 ---------- */
.hero { background: var(--card); color: var(--text); margin: 12px; border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.hero .name { font-size: 18px; font-weight: 700; }
.bank-card .bank-head { display: flex; justify-content: space-between; align-items: center; }
.bank-card .counts { display: flex; gap: 14px; margin: 10px 0; font-size: 13px; }
.bank-card .counts b { font-size: 16px; }
.bank-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.section-title { font-size: 15px; font-weight: 600; margin: 16px 12px 4px; }

/* ---------- 题目卡片 ---------- */
.q-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.q-content { line-height: 1.8; white-space: pre-wrap; }
.option { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px; margin-top: 10px; cursor: pointer; transition: all .15s; }
.option .letter { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.option .text { flex: 1; font-size: 14.5px; line-height: 1.6; }
.option.selected { border-color: var(--primary); background: #eff6ff; }
.option.selected .letter { background: var(--primary); color: #fff; }
[data-answer].selected { border: 1.5px solid var(--primary); background: #eff6ff; color: var(--primary); font-weight: 600; }
[data-answer].right { border: 1.5px solid var(--success); background: #f0fdf4; color: var(--success); font-weight: 600; }
[data-answer].wrong { border: 1.5px solid var(--danger); background: #fef2f2; color: var(--danger); }
.option.right { border-color: var(--success); background: #f0fdf4; }
.option.wrong { border-color: var(--danger); background: #fef2f2; }
.option.right.missed { border-style: dashed; position: relative; }
.miss-tag { position: absolute; top: -8px; right: 10px; z-index: 1; font-size: 12px; font-style: italic; line-height: 1; color: #dc2626; background: #fef2f2; border: 1px solid #fca5a5; border-radius: 4px; padding: 1px 6px; }
.feedback { border-radius: 10px; padding: 12px; margin-top: 14px; font-size: 14px; line-height: 1.7; }
.feedback.ok { background: #f0fdf4; color: #15803d; }
.feedback.no { background: #fef2f2; color: #b91c1c; }

/* ---------- 答题卡 ---------- */
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.grid .cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 7px; border: 1px solid var(--border); background: #f1f5f9; font-size: 14px; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; -webkit-touch-callout: none; }
.grid .cell.answered { background: var(--primary); border-color: var(--primary); color: #fff; }
.grid .cell.current { outline: 2px solid var(--primary-dark); }
.ans-sect { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 2px; }

/* ---------- 考试 ---------- */
.timer { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-weight: 700; color: var(--danger); font-variant-numeric: tabular-nums; }
.progress-track { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width .3s; }
.result-score { font-size: 42px; font-weight: 800; text-align: center; }
.result-score.ok { color: var(--success); } .result-score.mid { color: var(--warn); } .result-score.bad { color: var(--danger); }

/* ---------- 列表 ---------- */
.list-item { padding: 14px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 400px; padding: 20px; max-height: 85vh; overflow-y: auto; }
.modal .modal-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.modal .hint { background: #eff6ff; color: #1d4ed8; border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.6; margin-bottom: 14px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: rgba(15,23,42,.9); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; animation: fadeIn .2s; max-width: 80vw; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px);} to { opacity: 1; transform: translateY(0);} }

/* ---------- 骨架/加载 ---------- */
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; height: 60px; margin: 12px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- 其他 ---------- */
.seg { display: flex; background: #e2e8f0; border-radius: 10px; padding: 3px; }
.seg .seg-item { flex: 1; text-align: center; padding: 8px 0; border-radius: 8px; font-size: 13px; color: var(--muted); cursor: pointer; border: none; background: none; }
.seg .seg-item.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
select.input { appearance: none; }
@media (min-width: 641px) { #app { box-shadow: 0 0 30px rgba(0,0,0,.08); } }

/* ---------- 答案解析 ---------- */
.ans-expl { margin-top: 12px; padding: 10px 12px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; font-size: 13px; line-height: 1.7; color: #1e3a8a; }
.ans-expl b { color: var(--primary); margin-right: 6px; }
