:root {
  --primary: #2d5af0;
  --primary-dark: #1e42c4;
  --primary-light: #eaf0ff;
  --success: #00b578;
  --success-light: #e6f9f2;
  --danger: #f5222d;
  --danger-light: #fff1f0;
  --warning: #ff8f1f;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --bg: #f5f7fb;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 8px 28px rgba(17, 24, 39, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 40px;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--primary) 0%, #4a7bff 100%);
  color: #fff;
  padding: 20px 16px;
}

.topbar-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 600;
}

.topbar .sub {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 2px;
}

.topbar a {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  white-space: nowrap;
  transition: background 0.2s;
}

.topbar a:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title .hint {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-sub);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
}

.btn-ghost {
  background: var(--card);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--primary-light);
}

.btn-gray {
  background: #f3f4f6;
  color: var(--text);
}

.btn-gray:hover:not(:disabled) {
  background: #e5e7eb;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #cf1322;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn {
  flex: 1;
}

/* ---------- 表单 ---------- */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.input,
select.input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--primary);
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row .field {
  flex: 1;
}

/* ---------- 模式选择 ---------- */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.mode-item {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  text-align: left;
  font-family: inherit;
}

.mode-item:hover {
  border-color: #c7d3f7;
}

.mode-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.mode-item .name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.mode-item .desc {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}

/* ---------- 题目 ---------- */
.q-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.tag-gray {
  background: #f3f4f6;
  color: var(--text-sub);
}

.tag-success {
  background: var(--success-light);
  color: var(--success);
}

.tag-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.q-content {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 18px;
  white-space: pre-wrap;
  word-break: break-word;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border: 2px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
  text-align: left;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  width: 100%;
}

.option:hover:not(.disabled) {
  border-color: #c7d3f7;
  background: #fafbff;
}

.option .letter {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f3f4f6;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}

.option .text {
  flex: 1;
  line-height: 1.55;
  padding-top: 1px;
  white-space: pre-wrap;
  word-break: break-word;
}

.option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option.selected .letter {
  background: var(--primary);
  color: #fff;
}

.option.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.option.correct .letter {
  background: var(--success);
  color: #fff;
}

.option.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
}

.option.wrong .letter {
  background: var(--danger);
  color: #fff;
}

.option.disabled {
  cursor: default;
}

/* ---------- 判定结果 ---------- */
.verdict {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 11px;
  font-size: 14px;
  line-height: 1.65;
}

.verdict.ok {
  background: var(--success-light);
  color: #00814f;
}

.verdict.no {
  background: var(--danger-light);
  color: #a8071a;
}

.verdict .vt {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.verdict .analysis {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
  color: var(--text);
  white-space: pre-wrap;
}

/* ---------- 进度 ---------- */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.progress-bar {
  flex: 1;
  height: 7px;
  background: #e8ebf2;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #5b86ff);
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-text {
  font-size: 13px;
  color: var(--text-sub);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- 统计数字 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}

.stat-item .num {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-item .lbl {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

.num-primary {
  color: var(--primary);
}

.num-success {
  color: var(--success);
}

.num-danger {
  color: var(--danger);
}

/* ---------- 列表 ---------- */
.list-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:first-child {
  padding-top: 0;
}

/* ---------- 状态提示 ---------- */
.empty,
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 14px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  padding: 11px 20px;
  border-radius: 22px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  max-width: 80vw;
  text-align: center;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 底部固定操作栏 ---------- */
.footer-bar {
  position: sticky;
  bottom: 0;
  background: rgba(245, 247, 251, 0.95);
  backdrop-filter: blur(8px);
  padding: 12px 0;
  margin-top: 4px;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 520px) {
  .container {
    padding: 12px;
  }

  .card {
    padding: 15px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }

  .q-content {
    font-size: 16px;
  }

  .topbar h1 {
    font-size: 18px;
  }
}
