/* 一建机电刷题 - 深色模式 UI */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #141416;
  --card: #1e1e22;
  --card2: #26262c;
  --line: #33333a;
  --text: #e8e8ea;
  --sub: #9a9aa2;
  --blue: #4d9fff;
  --green: #34c759;
  --orange: #ff9f0a;
  --purple: #bf5af2;
  --red: #ff453a;
}
html, body { background: var(--bg); color: var(--text); font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; min-height: 100vh; }
#app { max-width: 520px; margin: 0 auto; padding-bottom: 60px; }

/* 顶部 */
.topbar { position: sticky; top: 0; z-index: 100; background: rgba(20,20,22,.92); backdrop-filter: blur(10px); padding: 10px 0 6px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; justify-content: center; gap: 6px; }
.tab { background: none; border: none; color: var(--sub); font-size: 15px; padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.tab.active { color: #fff; background: var(--card2); font-weight: 600; }

.view { display: none; padding: 14px 16px; }
.view.active { display: block; }

.subject-title { font-size: 20px; font-weight: 700; margin: 6px 0 14px; }

/* 搜索 */
.search-box { display: flex; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 16px; }
.search-icon { width: 18px; height: 18px; color: var(--sub); flex-shrink: 0; }
.search-box input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; margin-left: 8px; }
.search-go { background: var(--blue); border: none; color: #fff; border-radius: 6px; padding: 6px 12px; font-size: 14px; cursor: pointer; }

/* 四入口 */
.quick-entries { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.entry { background: var(--card); border-radius: 12px; padding: 14px 4px; text-align: center; cursor: pointer; border: 1px solid var(--line); }
.entry:active { transform: scale(.96); }
.entry-icon { width: 40px; height: 40px; margin: 0 auto 8px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.entry-icon svg { width: 22px; height: 22px; color: #fff; }
.entry-icon.blue { background: #2a5b8f; } .entry-icon.green { background: #2d6b3f; }
.entry-icon.orange { background: #8f6427; } .entry-icon.purple { background: #5c3b75; }
.entry span { font-size: 13px; color: var(--sub); }

/* 章节列表 */
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.section-title { font-size: 16px; font-weight: 600; }
.section-count { font-size: 13px; color: var(--sub); }
.chapter-list { display: flex; flex-direction: column; gap: 8px; }
.chapter-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.chapter-item:active { background: var(--card2); }
.ch-item-left { min-width: 0; }
.ch-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-progress { font-size: 12px; color: var(--sub); margin-top: 4px; }
.ch-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ch-arrow { color: var(--sub); font-size: 14px; }
.progress-bar { width: 46px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 2px; }
.kb-status { text-align: center; color: var(--sub); font-size: 12px; margin-top: 14px; }

.hint { color: var(--sub); font-size: 13px; margin-top: 12px; line-height: 1.6; }
.placeholder-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 30px 20px; text-align: center; color: var(--sub); font-size: 14px; line-height: 1.8; }

/* 按钮 */
.btn-primary { background: var(--blue); border: none; color: #fff; border-radius: 8px; padding: 10px 22px; font-size: 15px; cursor: pointer; }
.btn-submit { width: 100%; background: var(--blue); border: none; color: #fff; border-radius: 10px; padding: 14px; font-size: 16px; font-weight: 600; margin-top: 16px; cursor: pointer; }
.btn-submit:disabled { opacity: .5; }
.btn-next { width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 14px; font-size: 16px; font-weight: 600; margin-top: 12px; cursor: pointer; }
.btn-secondary { background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px 18px; font-size: 14px; cursor: pointer; }

/* 答题页 */
.quiz-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.back-btn { background: none; border: none; color: var(--sub); cursor: pointer; padding: 4px; }
.back-btn svg { width: 26px; height: 26px; }
.quiz-mode-label { font-size: 15px; font-weight: 600; }
.quiz-nav { font-size: 13px; color: var(--sub); }
.loading-card { text-align: center; padding: 60px 20px; color: var(--sub); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; margin: 0 auto 16px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

.q-type-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.q-type { font-size: 13px; color: var(--blue); background: rgba(77,159,255,.12); padding: 4px 10px; border-radius: 6px; }
.q-chapter { font-size: 12px; color: var(--sub); }
.q-stem { font-size: 16px; line-height: 1.7; margin-bottom: 14px; white-space: pre-wrap; }

.q-options { display: flex; flex-direction: column; gap: 10px; }
.option { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; display: flex; align-items: flex-start; cursor: pointer; }
.option.selected { border-color: var(--blue); background: rgba(77,159,255,.08); }
.option-letter { width: 26px; height: 26px; border-radius: 50%; background: var(--card2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; margin-right: 10px; }
.option.selected .option-letter { background: var(--blue); color: #fff; border-color: var(--blue); }
.option-text { font-size: 15px; line-height: 1.6; }

.q-case-input textarea { width: 100%; min-height: 160px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 15px; padding: 12px; resize: vertical; outline: none; font-family: inherit; line-height: 1.7; }
.q-case-input textarea:focus { border-color: var(--blue); }

/* 结果面板 */
.result-panel { margin-top: 16px; }
.result-banner { border-radius: 10px; padding: 14px; text-align: center; font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.result-banner.correct { background: rgba(52,199,89,.15); color: var(--green); }
.result-banner.wrong { background: rgba(255,69,58,.12); color: var(--red); }
.result-banner.partial { background: rgba(255,159,10,.12); color: var(--orange); }
.result-block { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.result-label { font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.result-text { font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.comment-text { color: var(--blue); }
.result-actions { display: flex; gap: 10px; margin-top: 14px; }
.result-actions .btn-next { flex: 1; margin-top: 0; }
.result-actions .btn-secondary { flex: 1; }

/* 错题本 */
.count-badge { background: var(--red); color: #fff; font-size: 12px; border-radius: 10px; padding: 2px 8px; vertical-align: middle; }
.wrong-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 8px; cursor: pointer; }
.wrong-item-title { font-size: 14px; font-weight: 500; margin-bottom: 6px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wrong-item-meta { font-size: 12px; color: var(--sub); display: flex; gap: 12px; }
.wrong-item-meta .badge { color: var(--red); }

.footer { text-align: center; color: #55555e; font-size: 12px; padding: 30px 0 20px; }

/* 案例题小问列表 */
.q-questions {
  margin-top: 14px;
}
.sub-question {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.sub-q-head {
  color: #5b9cff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.sub-q-text {
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}