:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #5a5a5a;
  --accent: #ff6f3c;
  --accent-soft: #ffe4d6;
  --ok: #2f9e44;
  --warn: #f59e0b;
  --lapsed: #e03131;
  --line: #e5e5e0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; }
body { max-width: 1100px; margin: 0 auto; padding: 24px; }

h1 { font-size: 1.8rem; margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 24px 0 8px; }
h3 { font-size: 1.05rem; margin: 16px 0 6px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.topbar .actions { display: flex; gap: 8px; }

.grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2 { margin-top: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: white;
  border: none; border-radius: var(--radius);
  padding: 8px 14px; cursor: pointer; font-size: 0.95rem;
}
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn:hover { filter: brightness(1.05); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.8rem; }
.badge.ok { background: #e6f4ea; color: var(--ok); }
.badge.lapsed { background: #fde0e0; color: var(--lapsed); }
.badge.box { background: var(--accent-soft); color: var(--accent); }

.progress {
  height: 8px; background: var(--line); border-radius: 999px; overflow: hidden;
}
.progress > div { height: 100%; background: var(--accent); transition: width 200ms; }

.mark-btn {
  background: none; border: 1px dashed var(--line);
  border-radius: 6px; padding: 2px 6px;
  font-size: 0.85rem; cursor: pointer;
  vertical-align: middle; margin-left: 6px;
}
.mark-btn.marked { background: var(--accent-soft); border-style: solid; }

.question-list { list-style: none; padding: 0; margin: 0; }
.question-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.question-list li:last-child { border-bottom: none; }

.muted { color: var(--ink-soft); font-size: 0.9rem; }
.copy-out { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; white-space: pre-wrap; background: #fafaf7; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }

.roadmap-domain { padding: 12px; border-left: 4px solid var(--accent); margin: 12px 0; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.roadmap-domain.done { border-left-color: var(--ok); }
.roadmap-domain .weight { color: var(--accent); font-weight: 600; }

/* Chapter page components (used by chapters/*.html) */
.question { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; background: var(--surface); }
.question .answer { display: none; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.question.revealed .answer { display: block; }

.option-pill {
  display: block; width: 100%; text-align: left;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px;
  margin: 6px 0; cursor: pointer; font-size: 0.95rem;
}
.option-pill:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.option-pill.chosen-correct { background: #e6f4ea; border-color: var(--ok); }
.option-pill.chosen-wrong { background: #fde0e0; border-color: var(--lapsed); }
.question.revealed .option-pill { cursor: default; }
.question.revealed .option-pill[data-correct="true"]:not(.chosen-wrong) { background: #e6f4ea; border-color: var(--ok); }

.flashcard { border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; }
.flashcard summary { padding: 10px 14px; cursor: pointer; font-weight: 500; }
.flashcard > div { padding: 10px 14px; border-top: 1px solid var(--line); background: #fafaf7; border-radius: 0 0 var(--radius) var(--radius); }
