* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f7fa; color: #1f2937; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea { font-family: inherit; }

.view { min-height: 100vh; }

/* ===== 激活页 ===== */
#view-activate { display: flex; align-items: center; justify-content: center; padding: 24px; }
.act-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 40px 32px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.act-icon { font-size: 56px; margin-bottom: 12px; }
.act-card h2 { font-size: 24px; font-weight: 600; margin-bottom: 12px; }
.act-sub { color: #6b7280; font-size: 14px; line-height: 1.6; margin-bottom: 24px; }
.act-input { width: 100%; padding: 14px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: 18px; text-align: center; letter-spacing: 3px; font-family: monospace; }
.act-input:focus { outline: none; border-color: #2563eb; }
.act-err { color: #dc2626; font-size: 14px; margin-top: 12px; min-height: 20px; }
.act-divider { color: #9ca3af; font-size: 13px; margin: 16px 0 12px; }
.act-user { margin-top: 16px; font-size: 13px; color: #6b7280; }
.act-user a { color: #2563eb; }
.auth-tabs { display: flex; background: #f3f4f6; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 10px 0; border-radius: 8px; font-size: 15px; color: #6b7280; }
.auth-tab.active { background: #fff; color: #2563eb; font-weight: 500; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.act-input { margin-bottom: 12px; }
#act-trial { margin-top: 20px; }

/* ===== 按钮 ===== */
.btn-primary { background: #2563eb; color: #fff; padding: 12px 28px; border-radius: 10px; font-size: 16px; font-weight: 500; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-lg { width: 100%; margin-top: 16px; padding: 14px; font-size: 18px; }
.btn-ghost { color: #2563eb; background: #eff6ff; padding: 10px 20px; border-radius: 10px; font-size: 14px; }
.btn-ghost:hover { background: #dbeafe; }
.btn-danger { background: #dc2626; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 14px; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-outline { border: 1px solid #d1d5db; color: #374151; padding: 6px 14px; border-radius: 8px; font-size: 13px; }
.btn-outline:hover { background: #f3f4f6; }

/* ===== 主界面 ===== */
.app-header { background: #2563eb; color: #fff; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.header-title { font-size: 18px; font-weight: 600; }
.header-act { font-size: 13px; background: rgba(255,255,255,.15); padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.tabbar { display: flex; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 10; }
.tab-item { flex: 1; padding: 14px 0; font-size: 15px; color: #6b7280; border-bottom: 2px solid transparent; }
.tab-item.active { color: #2563eb; font-weight: 500; border-bottom-color: #2563eb; }
.app-main { max-width: 720px; margin: 0 auto; padding: 16px; }
.tab { display: none; }
.tab.active { display: block; }

/* ===== 卡片 ===== */
.card { background: #fff; border-radius: 14px; padding: 20px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }

/* ===== 首页 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 14px; padding: 18px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.stat-num { font-size: 28px; font-weight: 600; color: #2563eb; }
.stat-label { font-size: 13px; color: #6b7280; margin-top: 4px; }
.entry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.entry { background: #fff; border-radius: 14px; padding: 22px 16px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.04); transition: transform .1s; }
.entry:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(37,99,235,.12); }
.entry-icon { font-size: 34px; }
.entry-name { font-size: 15px; font-weight: 500; margin-top: 8px; }
.entry-desc { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.rule-line { color: #6b7280; font-size: 14px; line-height: 1.8; }

/* ===== 练习 ===== */
.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.ch-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.ch-row:last-child { border-bottom: none; }
.ch-name { font-size: 15px; flex: 1; }
.ch-btns { display: flex; gap: 8px; flex-shrink: 0; }
.chip { padding: 8px 16px; border-radius: 999px; background: #f0f0f0; font-size: 14px; color: #6b7280; }
.chip.active { background: #2563eb; color: #fff; }
.chip.selected { background: #bfdbfe; color: #1e40af; border: 2px solid #2563eb; font-weight: 500; }
.q-tag { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 12px; color: #fff; margin-right: 8px; }
.tag-judge { background: #7c3aed; } .tag-single { background: #2563eb; } .tag-multi { background: #0891b2; } .tag-fill { background: #d97706; } .tag-brief { background: #059669; }
.q-stem { font-size: 16px; line-height: 1.8; margin: 14px 0; }
.opt-item { display: flex; align-items: flex-start; padding: 14px 16px; margin-bottom: 10px; border-radius: 10px; background: #f8f9fa; border: 2px solid transparent; cursor: pointer; transition: all .15s; }
.opt-item:hover { background: #eef2ff; }
.opt-item.selected { background: #bfdbfe; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.18); }
.opt-item.correct { background: #a7f3d0; border-color: #16a34a; }
.opt-item.wrong { background: #fecaca; border-color: #dc2626; }
.opt-key { width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 50%; background: #2563eb; color: #fff; font-size: 13px; margin-right: 12px; flex-shrink: 0; }
.opt-text { flex: 1; line-height: 1.6; }
.opt-check { margin-left: auto; align-self: center; color: #2563eb; font-size: 18px; font-weight: bold; visibility: hidden; }
.opt-check.show { visibility: visible; }
.judge-row { display: flex; gap: 12px; }
.judge-btn { flex: 1; text-align: center; padding: 16px; border-radius: 10px; background: #f8f9fa; border: 2px solid transparent; font-size: 16px; cursor: pointer; }
.judge-btn.selected { background: #bfdbfe; border-color: #2563eb; }
.judge-btn.correct { background: #a7f3d0; border-color: #16a34a; }
.judge-btn.wrong { background: #fecaca; border-color: #dc2626; }
.q-input { width: 100%; min-height: 90px; padding: 12px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: 15px; resize: vertical; }
.q-input:focus { outline: none; border-color: #2563eb; }
.feedback { margin-top: 14px; padding: 14px; border-radius: 10px; font-size: 14px; line-height: 1.7; }
.feedback.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.feedback.no { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.answer-line { margin-top: 10px; font-size: 14px; }
.answer-correct { color: #16a34a; font-weight: 500; }
.answer-wrong { color: #dc2626; font-weight: 500; }
.action-row { display: flex; gap: 12px; margin-top: 16px; }
.action-row .btn-primary, .action-row .btn-ghost { flex: 1; }
.q-count { color: #9ca3af; font-size: 13px; }

/* ===== 考试 ===== */
.exam-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.exam-timer { font-size: 18px; font-weight: 600; color: #2563eb; font-family: monospace; }
.exam-timer.danger { color: #dc2626; }
.exam-progress { font-size: 14px; color: #6b7280; }
.exam-nav { display: flex; gap: 12px; margin-top: 16px; }
.exam-nav button { flex: 1; padding: 12px; border-radius: 10px; font-size: 15px; background: #fff; border: 1px solid #e5e7eb; }
.exam-nav button:hover { background: #f3f4f6; }
.result-score-card { text-align: center; padding: 30px 20px; }
.result-score { font-size: 56px; font-weight: 700; }
.result-score.pass { color: #16a34a; }
.result-score.fail { color: #dc2626; }
.result-label { font-size: 18px; margin-top: 8px; font-weight: 500; }
.result-rate { color: #6b7280; font-size: 14px; margin-top: 8px; }
.rd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.rd-item .rd-num { font-size: 22px; font-weight: 600; }
.rd-item .rd-label { font-size: 12px; color: #9ca3af; }
.text-success { color: #16a34a; } .text-danger { color: #dc2626; } .text-warning { color: #d97706; }

/* ===== 弹层 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-panel { background: #fff; border-radius: 16px; width: 90%; max-width: 420px; max-height: 80vh; overflow-y: auto; padding: 24px; }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.ac-legend { display: flex; gap: 16px; font-size: 13px; color: #6b7280; margin-bottom: 14px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.dot-answered { background: #16a34a; } .dot-unanswered { background: #e5e7eb; }
.ac-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-bottom: 16px; }
.ac-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: #e5e7eb; font-size: 13px; cursor: pointer; }
.ac-cell.answered { background: #bbf7d0; color: #166534; font-weight: 600; }
.ac-cell.current { border: 2px solid #2563eb; }
.ac-count { color: #6b7280; font-size: 13px; font-weight: 400; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions button { flex: 1; padding: 12px; border-radius: 10px; font-size: 15px; }

/* ===== 错题本 ===== */
.w-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid #f0f0f0; }
.w-item:last-child { border-bottom: none; }
.w-stem { font-size: 15px; line-height: 1.6; flex: 1; cursor: pointer; }
.w-count { font-size: 12px; color: #d97706; background: #fef3c7; padding: 2px 8px; border-radius: 6px; margin-left: 8px; white-space: nowrap; }
.w-actions { display: flex; gap: 6px; margin-top: 8px; }
.empty-tip { text-align: center; color: #9ca3af; padding: 40px 0; }

/* ===== 统计 ===== */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar { width: 100%; max-width: 28px; background: #2563eb; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-label { font-size: 11px; color: #9ca3af; }
.stat-list { font-size: 14px; color: #374151; line-height: 2; }
.stat-list b { color: #2563eb; }

@media (max-width: 480px) {
  .stat-grid, .entry-grid { grid-template-columns: repeat(2, 1fr); }
  .rd-grid { grid-template-columns: repeat(2, 1fr); }
}
