/* ============================================
   易考通(AI 智能刷题系统) — 全局样式(手机优先)
   ============================================ */
:root {
  --primary: #07c160;          /* 微信绿 */
  --primary-dark: #06ad56;
  --primary-bg: rgba(7, 193, 96, 0.08);
  --danger: #fa5151;
  --danger-bg: rgba(250, 81, 81, 0.07);
  --warn: #ff9f0a;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #ebedf0;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  --tabbar-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* 页面整体容器:手机优先,桌面限宽居中 */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  background: var(--bg);
  position: relative;
}
#page {
  padding-bottom: calc(var(--tabbar-h) + 24px);
  padding-top: env(safe-area-inset-top);
}

/* ============ 通用卡片 / 按钮 ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); opacity: 0.9; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-block { width: 100%; }
.btn-ghost { background: #f2f3f5; color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }

.page-title {
  padding: 16px 18px 4px;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-sub { padding: 0 18px 6px; color: var(--text-2); font-size: 13px; }

/* ============ 登录页 ============ */
#view-login {
  min-height: 100vh;
  background: linear-gradient(160deg, #e8f9ef 0%, var(--bg) 45%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box { width: 100%; max-width: 420px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon {
  width: 68px; height: 68px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, #07c160, #0aa05a);
  color: #fff;
  font-size: 26px; font-weight: 800;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(7, 193, 96, 0.3);
}
.login-logo h1 { font-size: 24px; margin-bottom: 6px; }
.login-logo p { color: var(--text-2); font-size: 14px; line-height: 1.7; }
.login-card { margin: 0; }
.input-row {
  display: flex;
  align-items: center;
  background: #f7f8fa;
  border-radius: 12px;
  padding: 4px 14px;
  margin-bottom: 12px;
}
.input-row input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  padding: 12px 0;
  outline: none;
  font-family: inherit;
}
.btn-code { background: none; border: none; color: var(--primary); font-size: 14px; cursor: pointer; white-space: nowrap; padding: 8px 0 8px 12px; }
.login-card .btn { margin-top: 6px; font-size: 16px; padding: 13px; }
.login-tip { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 12px; }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--tabbar-h);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.2s;
}
.tab-icon { font-size: 20px; line-height: 1; filter: grayscale(0.6); opacity: 0.7; transition: all 0.2s; }
.tab-item.active { color: var(--primary); }
.tab-item.active .tab-icon { filter: none; opacity: 1; }

/* ============ 首页 ============ */
.home-header {
  background: linear-gradient(150deg, #07c160, #06ad56);
  color: #fff;
  padding: 28px 20px 60px;
  border-radius: 0 0 28px 28px;
}
.home-header .hi { font-size: 17px; opacity: 0.9; }
.home-header .date { font-size: 13px; opacity: 0.75; margin-top: 2px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: -38px 14px 0;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.stat-card .num.green { color: var(--primary); }
.stat-card .num.red { color: var(--danger); }
.stat-card .num.orange { color: var(--warn); }
.stat-card .label { color: var(--text-2); font-size: 13px; margin-top: 4px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px 8px;
  font-size: 16px;
  font-weight: 700;
}
.section-title .more { font-size: 13px; color: var(--primary); font-weight: 400; cursor: pointer; }

/* AI 推荐复习 */
.review-list { margin: 0 14px; }
.review-item {
  background: #fff;
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}
.review-item .tag {
  flex-shrink: 0;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}
.review-item .content { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-item .mastery { flex-shrink: 0; font-size: 12px; color: var(--text-3); }

/* 薄弱知识点 */
.weak-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 20px;
  margin: 0 0 8px 14px;
}
.weak-chip .bar { width: 44px; height: 5px; border-radius: 3px; background: rgba(250,81,81,0.2); overflow: hidden; }
.weak-chip .bar i { display: block; height: 100%; background: var(--danger); border-radius: 3px; }
.weak-chip.warn { background: rgba(255,159,10,0.12); color: #b26a00; }
.weak-chip.warn .bar { background: rgba(255,159,10,0.25); }
.weak-chip.warn .bar i { background: var(--warn); }

/* ============ 题型统计卡片(首页) ============ */
.type-stat-grid { display: grid; gap: 10px; margin: 4px 14px 14px; }
.type-stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.1s;
  border-left: 4px solid var(--primary);
}
.type-stat-card.multiple { border-left-color: var(--warn); }
.type-stat-card.judge { border-left-color: #94a3b8; }
.type-stat-card:active { transform: scale(0.98); }
.type-stat-card .t-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.type-stat-card .t-name { font-weight: 800; font-size: 15px; }
.type-stat-card .t-acc { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 12px; }
.type-stat-card .t-acc.ok { background: rgba(7,193,96,0.12); color: #07c160; }
.type-stat-card .t-acc.mid { background: rgba(255,159,10,0.12); color: #b26a00; }
.type-stat-card .t-acc.bad { background: rgba(250,81,81,0.12); color: var(--danger); }
.type-stat-card .t-row { display: flex; justify-content: space-between; color: var(--text-2); font-size: 12px; }
.type-stat-card .t-row b { color: var(--text-1); font-size: 14px; }
.type-stat-card .t-row b.ok { color: #07c160; }
.type-stat-card .t-row b.bad { color: var(--danger); }

/* ============ 题型筛选 chips ============ */
.type-chips { display: flex; gap: 8px; padding: 10px 14px 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.type-chips .chip {
  flex-shrink: 0;
  padding: 6px 16px;
  font-size: 13px;
  border-radius: 18px;
  background: #f1f2f5;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.type-chips .chip.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ============ 刷题 ============ */
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 12px 14px; }
.mode-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  cursor: pointer;
  transition: transform 0.1s;
}
.mode-card:active { transform: scale(0.97); }
.mode-card .emoji { font-size: 26px; }
.mode-card .name { font-weight: 700; margin-top: 8px; font-size: 15px; }
.mode-card .desc { color: var(--text-2); font-size: 12px; margin-top: 4px; line-height: 1.5; }
.mode-card.ai { border: 1.5px solid var(--primary); background: linear-gradient(150deg, #fff, #f0fbf4); }
.mode-card.ai .name { color: var(--primary); }

/* 练习页 */
.practice-top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: 14px 18px 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.practice-top .back { cursor: pointer; color: var(--text); font-size: 22px; width: 34px; }
.practice-top .mid { text-align: center; }
.practice-top .mid .mode-name { font-size: 16px; font-weight: 700; }
.practice-top .mid .progress { font-size: 12px; color: var(--text-3); }
.ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-bg); color: var(--primary);
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.ai-reason {
  background: #fff7e8;
  color: #b26a00;
  font-size: 12.5px;
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0 14px 10px;
  display: flex; align-items: center; gap: 6px;
}
.question-card { padding: 18px 16px; margin: 0 14px 12px; }
.question-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.q-type {
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
}
.q-type.single { background: var(--primary-bg); color: var(--primary); }
.q-type.multiple { background: rgba(255,159,10,0.12); color: #b26a00; }
.q-type.judge { background: rgba(100,116,139,0.12); color: #475569; }
.q-category { font-size: 12px; color: var(--text-3); }
.question-content { font-size: 16px; font-weight: 600; line-height: 1.6; }
.option-list { margin-top: 14px; }
.option-item {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 15px;
}
.option-item .key {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: #f2f3f5;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--text-2);
}
.option-item.selected { border-color: var(--primary); background: var(--primary-bg); }
.option-item.selected .key { background: var(--primary); color: #fff; }
.option-item.correct { border-color: var(--primary); background: var(--primary-bg); }
.option-item.correct .key { background: var(--primary); color: #fff; }
.option-item.wrong { border-color: var(--danger); background: var(--danger-bg); }
.option-item.wrong .key { background: var(--danger); color: #fff; }
.option-item.disabled { pointer-events: none; }

/* 判断题:对/错 大按钮 */
.judge-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.option-item.judge-item {
  flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 26px 10px; margin-bottom: 0; border-radius: 14px; border-width: 1.5px;
  text-align: center; user-select: none;
}
.judge-item .j-icon { font-size: 38px; font-weight: 800; line-height: 1; }
.judge-item .j-text { font-size: 17px; font-weight: 700; }
.judge-item.j-yes { border-color: rgba(7, 193, 96, 0.45); background: linear-gradient(165deg, #f6fff9, #edfff4); }
.judge-item.j-no { border-color: rgba(250, 81, 81, 0.4); background: linear-gradient(165deg, #fff8f8, #fff1f1); }
.judge-item.j-yes .j-icon { color: var(--primary); }
.judge-item.j-no .j-icon { color: var(--danger); }
.judge-item.j-yes.selected,
.judge-item.j-yes.correct { border-color: var(--primary); border-width: 2px; background: var(--primary-bg); box-shadow: 0 4px 14px rgba(7, 193, 96, 0.18); }
.judge-item.j-no.selected { border-color: var(--danger); border-width: 2px; background: var(--danger-bg); box-shadow: 0 4px 14px rgba(250, 81, 81, 0.15); }
.judge-item.wrong { border-color: var(--danger); border-width: 2px; background: var(--danger-bg); }
.judge-item.correct .j-icon { color: var(--primary); }
.judge-item.wrong .j-icon { color: var(--danger); }
.judge-item:active { transform: scale(0.96); }

/* 答题结果 */
.result-banner { margin: 0 14px 12px; border-radius: var(--radius); padding: 16px; color: #fff; text-align: center; }
.result-banner.right { background: linear-gradient(135deg, #07c160, #06ad56); }
.result-banner.wrong { background: linear-gradient(135deg, #fa5151, #e24040); }
.result-banner .big { font-size: 22px; font-weight: 800; }
.result-banner .sub { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.analysis-box {
  background: #f7f8fa;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
}
.analysis-box .a-title { font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 13px; }
.mastery-bar { margin-top: 12px; }
.mastery-bar .m-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.mastery-bar .track { height: 8px; border-radius: 4px; background: #eef0f2; overflow: hidden; }
.mastery-bar .track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #07c160, #0aa05a); transition: width 0.5s; }

.action-row { display: flex; gap: 10px; margin: 14px; }
.action-row .btn { flex: 1; padding: 13px; font-size: 15px; }

/* 模拟考试 */
.exam-config .field { margin-bottom: 14px; }
.exam-config .field label { font-size: 13px; color: var(--text-2); display: block; margin-bottom: 6px; }
.exam-config select, .exam-config input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
  font-family: inherit;
  outline: none;
}
.exam-progress { text-align: center; font-size: 13px; color: var(--text-2); padding: 10px; }
.exam-result-score { text-align: center; padding: 24px 0 8px; }
.exam-result-score .score { font-size: 52px; font-weight: 800; color: var(--primary); }
.exam-result-score .score.danger { color: var(--danger); }
.exam-result-score .score.warn { color: var(--warn); }
.exam-result-score .label { color: var(--text-2); margin-top: 4px; }

/* 错题本 / 收藏 列表 */
.question-list-item {
  background: #fff;
  border-radius: 14px;
  margin: 0 14px 10px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.question-list-item .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.question-list-item .content { font-size: 14.5px; line-height: 1.6; }
.question-list-item .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.question-list-item .meta { font-size: 12px; color: var(--text-3); }
.empty-state { text-align: center; color: var(--text-3); padding: 60px 20px; }
.empty-state .icon { font-size: 44px; margin-bottom: 10px; }

/* 题目详情弹层(错题本/收藏查看) */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--bg);
  width: 100%; max-width: 480px;
  border-radius: 20px 20px 0 0;
  max-height: 86vh;
  overflow-y: auto;
  padding: 18px 0 30px;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .question-card { margin: 0 14px 12px; }
.modal .modal-actions { display: flex; gap: 10px; margin: 0 14px; }
.modal .modal-actions .btn { flex: 1; }

/* ============ 我的 ============ */
.mine-header {
  background: linear-gradient(150deg, #07c160, #06ad56);
  color: #fff;
  padding: 34px 20px 26px;
  border-radius: 0 0 28px 28px;
  display: flex; align-items: center; gap: 14px;
}
.avatar {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  border: 2px solid rgba(255,255,255,0.6);
}
.mine-header .name { font-size: 18px; font-weight: 700; }
.mine-header .phone { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.mine-menu { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin: 16px 14px; overflow: hidden; }
.mine-menu .menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 15px;
}
.mine-menu .menu-item:last-child { border-bottom: none; }
.mine-menu .menu-item .mi-icon { font-size: 19px; }
.mine-menu .menu-item .arrow { margin-left: auto; color: var(--text-3); font-size: 13px; }

/* 题库管理 */
.admin-toolbar { display: flex; gap: 10px; margin: 8px 14px; }
.admin-toolbar .btn { flex: 1; font-size: 13px; padding: 10px 6px; }
.q-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.q-table th, .q-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.q-table th { color: var(--text-2); font-weight: 600; }
.q-table .del { color: var(--danger); cursor: pointer; font-size: 12px; }
.import-tip { font-size: 12.5px; color: var(--text-2); line-height: 1.7; background: #f7f8fa; border-radius: 10px; padding: 10px 12px; margin: 10px 14px; }
textarea.import-area {
  width: calc(100% - 28px);
  margin: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  font-family: inherit;
  min-height: 180px;
  outline: none;
  resize: vertical;
  background: #fff;
}
.file-btn {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  border-radius: 12px;
  padding: 20px;
  margin: 0 14px;
  cursor: pointer;
  font-size: 14px;
  background: var(--primary-bg);
}
.file-btn input { display: none; }
.import-result { margin: 12px 14px; }
.import-result .ok { color: var(--primary); font-weight: 600; }
.import-result .err { color: var(--danger); font-size: 12.5px; margin-top: 6px; white-space: pre-wrap; }

/* Toast */
#toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  max-width: 78%;
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* 加载提示 */
.loading { text-align: center; color: var(--text-3); padding: 30px; font-size: 14px; }

/* 通用进度条(考试进度等) */
.track-bar { height: 6px; border-radius: 3px; background: #eef0f2; overflow: hidden; margin: 0 14px; }
.track-bar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }

@media (min-width: 480px) {
  .app { box-shadow: 0 0 30px rgba(0,0,0,0.06); min-height: 100vh; }
}
