/* 采血科学习考试系统 样式 */
:root {
  --primary: #c62828;
  --primary-dark: #b71c1c;
  --primary-light: #ef5350;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #e65100;
  --info: #1565c0;
  --font-size: 15px;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
}
[data-theme="dark"] {
  --bg: #121417;
  --card: #1c1f24;
  --text: #e8eaed;
  --text-sub: #9aa0a6;
  --border: #2a2e34;
  --shadow: 0 1px 4px rgba(0,0,0,.4);
  --primary-light: #ef5350;
}
[data-theme="sepia"] {
  --bg: #f3ead8;
  --card: #faf3e3;
  --text: #3b3224;
  --text-sub: #7a6f5c;
  --border: #e0d5bf;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: var(--font-size); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============ 登录 ============ */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #c62828 0%, #8e0000 100%); }
.login-box { width: 100%; max-width: 380px; background: var(--card); border-radius: 20px; padding: 32px 24px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-logo { font-size: 52px; text-align: center; }
.login-title { text-align: center; font-size: 1.3rem; color: var(--text); margin-top: 8px; }
.login-sub { text-align: center; color: var(--text-sub); font-size: .85rem; margin-bottom: 24px; }
.login-form label { display: block; font-size: .85rem; color: var(--text-sub); margin: 12px 0 4px; }
.login-form input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 1rem; background: var(--bg); color: var(--text); }
.login-form input:focus { outline: none; border-color: var(--primary); }
.login-tip { text-align: center; color: var(--text-sub); font-size: .78rem; margin-top: 16px; }

/* ============ 按钮 ============ */
.btn { display: inline-block; padding: 10px 16px; border: none; border-radius: 10px; font-size: .95rem; cursor: pointer; transition: all .15s; text-align: center; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { background: transparent; color: var(--text-sub); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-block { display: block; width: 100%; margin-top: 12px; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.icon-btn { background: none; border: none; font-size: 1.1rem; cursor: pointer; padding: 4px 6px; }

/* ============ 主框架 ============ */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; background: var(--card); border-bottom: 1px solid var(--border); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.topbar-title { font-weight: 700; font-size: 1.05rem; }
.topbar-right { display: flex; gap: 2px; }
.content { flex: 1; padding: 16px; padding-bottom: 80px; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--card); border-top: 1px solid var(--border); display: flex; max-width: 560px; margin: 0 auto; }
.tab { flex: 1; text-align: center; padding: 8px 0 6px; cursor: pointer; color: var(--text-sub); font-size: .72rem; }
.tab .tab-ico { display: block; font-size: 1.35rem; line-height: 1.3; }
.tab.active { color: var(--primary); font-weight: 600; }

/* ============ 卡片 ============ */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-title { font-weight: 700; font-size: .98rem; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.card-title .more { color: var(--text-sub); font-size: .8rem; font-weight: 400; cursor: pointer; }
.row { display: flex; align-items: center; justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.muted { color: var(--text-sub); font-size: .82rem; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .72rem; margin-right: 6px; }
.tag-red { background: #fdecea; color: #c62828; }
.tag-blue { background: #e3f2fd; color: #1565c0; }
.tag-green { background: #e8f5e9; color: #2e7d32; }
.tag-orange { background: #fff3e0; color: #e65100; }
.tag-gray { background: #f0f0f0; color: #616161; }
[data-theme="dark"] .tag-red { background: #3a1f1f; color: #ef5350; }
[data-theme="dark"] .tag-blue { background: #1a2c40; color: #64b5f6; }
[data-theme="dark"] .tag-green { background: #1f3321; color: #66bb6a; }
[data-theme="dark"] .tag-orange { background: #3a2a1a; color: #ffa726; }
[data-theme="dark"] .tag-gray { background: #2a2a2a; color: #9e9e9e; }

/* ============ 进度环 ============ */
.ring-wrap { display: flex; align-items: center; justify-content: center; gap: 24px; }
.ring { position: relative; width: 120px; height: 120px; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .ring-num { font-size: 1.6rem; font-weight: 700; }
.ring .ring-label { font-size: .72rem; color: var(--text-sub); }

/* ============ 题目 ============ */
.q-body { font-size: 1.02rem; line-height: 1.7; margin: 10px 0; }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1.5px solid var(--border); border-radius: 10px; margin-bottom: 10px; cursor: pointer; transition: all .12s; }
.opt:active { background: var(--bg); }
.opt .opt-letter { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; font-size: .85rem; }
.opt.selected { border-color: var(--info); background: #eef4fb; }
.opt.picked { border-color: var(--info); background: #eef4fb; }
[data-theme="dark"] .opt.picked { background: #1a2c40; }
[data-theme="dark"] .opt.selected { background: #1a2c40; }
.opt.correct { border-color: var(--success); background: #f0f7f0; }
.opt.wrong { border-color: var(--danger); background: #fdf0f0; }
.opt.miss-correct { border: 2px solid var(--danger); background: #f0f7f0; }
[data-theme="dark"] .opt.correct { background: #1f3321; }
[data-theme="dark"] .opt.wrong { background: #3a1f1f; }
[data-theme="dark"] .opt.miss-correct { background: #1f3321; }
.opt-flag { margin-left: auto; font-size: .72rem; color: var(--danger); border: 1px solid var(--danger); border-radius: 6px; padding: 1px 6px; flex-shrink: 0; }
.opt .opt-letter.selected { background: var(--info); color: #fff; border-color: var(--info); }
.opt .opt-letter.picked { background: var(--info); color: #fff; border-color: var(--info); }
.opt .opt-letter.correct { background: var(--success); color: #fff; border-color: var(--success); }
.opt .opt-letter.wrong { background: var(--danger); color: #fff; border-color: var(--danger); }

.analysis-box { background: #f7f8fa; border-left: 3px solid var(--info); padding: 12px; border-radius: 8px; margin-top: 12px; font-size: .9rem; }
[data-theme="dark"] .analysis-box { background: #1a232e; }
.analysis-box .ref { color: var(--primary); font-weight: 600; }

/* ============ 答题卡 ============ */
.answer-sheet { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sheet-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); cursor: pointer; font-size: .85rem; }
.sheet-cell.done { background: var(--text-sub); color: #fff; border-color: var(--text-sub); }
.sheet-cell.done-correct { background: var(--success); color: #fff; border-color: var(--success); }
.sheet-cell.done-wrong { background: var(--danger); color: #fff; border-color: var(--danger); }
.sheet-cell.current { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(198,40,40,.25); }
.sheet-cell.mark { border-color: var(--warning); }

/* ============ 表单 ============ */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .85rem; color: var(--text-sub); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: .95rem; background: var(--bg); color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px; cursor: pointer; font-size: .82rem; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal-box { background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 440px; max-height: 85vh; overflow-y: auto; }
.modal-box h3 { margin-bottom: 14px; font-size: 1.05rem; }
.modal-btns { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }
.modal-btns .btn { flex: 1; }

/* ============ 排行榜 ============ */
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: none; }
.rank-no { width: 28px; text-align: center; font-weight: 700; font-size: .9rem; }
.rank-no.top1 { color: #f9a825; font-size: 1.2rem; }
.rank-no.top2 { color: #90a4ae; font-size: 1.15rem; }
.rank-no.top3 { color: #bf8970; font-size: 1.1rem; }
.rank-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 600; font-size: .9rem; }
.rank-grp { font-size: .75rem; color: var(--text-sub); }
.rank-val { font-weight: 700; font-size: .95rem; color: var(--primary); }

/* ============ Toast ============ */
.toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: .88rem; z-index: 200; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: 80%; text-align: center; }
.toast.show { opacity: 1; }

/* ============ 列表 ============ */
.list-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.empty { text-align: center; color: var(--text-sub); padding: 40px 16px; font-size: .9rem; }
.empty .empty-ico { font-size: 3rem; display: block; margin-bottom: 10px; }

/* ============ 桌面端 ============ */
@media (min-width: 900px) {
  .app { max-width: 960px; display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
  .topbar { grid-column: 1 / -1; grid-row: 1; }
  .content { grid-column: 2; grid-row: 2; padding-bottom: 16px; }
  .tabbar { grid-column: 1; grid-row: 2; position: sticky; top: 53px; bottom: auto; left: 0; max-width: none; height: calc(100vh - 53px); flex-direction: column; justify-content: flex-start; border-top: none; border-right: 1px solid var(--border); padding-top: 16px; }
  .tab { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 20px; text-align: left; font-size: .9rem; }
  .tab .tab-ico { font-size: 1.2rem; }
}

/* 无操作高亮按钮 */
.danger-text { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
