* { box-sizing: border-box; }
:root {
  --fg: #1f2328;
  --fg-muted: #656d76;
  --accent: #0969da;
  --success: #1a7f37;
  --danger: #cf222e;
  --attention: #9a6700;
  --border: #d0d7de;
  --border-muted: #d8dee4;
  --bg-inset: #f6f8fa;
  --radius: 6px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  color: var(--fg); background: #fff;
  line-height: 1.7; margin: 0;
  font-size: 15px;
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px 40px; }

/* ===== GitHub 全局深色顶栏 ===== */
.gh-top { background: #24292f; padding: 12px 24px; }
.gh-top-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
}
.gh-octo { fill: #fff; flex-shrink: 0; }
.gh-search {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius); color: rgba(255,255,255,0.55);
  font-size: 13px; padding: 4px 12px; width: 280px;
  flex-grow: 0;
}
.gh-top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.gh-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(#8250df, #0969da); border: 1px solid rgba(255,255,255,0.3); }

/* ===== 仓库头 ===== */
.gh-repo { border-bottom: 1px solid var(--border-muted); background: #fff; }
.gh-repo-row {
  max-width: 1280px; margin: 0 auto; padding: 16px 24px 8px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
}
.gh-crumb { font-size: 17px; color: var(--fg-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gh-crumb .gh-octo-sm { fill: var(--fg-muted); }
.gh-crumb a { color: var(--accent); }
.gh-crumb a:hover { text-decoration: underline; }
.gh-repo-name { font-weight: 600; }
.gh-sep { color: var(--fg-muted); }
.gh-badge {
  font-size: 12px; font-weight: 500; color: var(--fg-muted);
  border: 1px solid var(--border); border-radius: 2em; padding: 0 9px;
}
.gh-actions { display: flex; gap: 8px; }
.gh-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--fg);
  background: var(--bg-inset); border: 1px solid rgba(31,35,40,0.15);
  border-radius: var(--radius); padding: 3px 12px; cursor: default;
}
.gh-counter {
  background: rgba(31,35,40,0.08); border-radius: 2em;
  padding: 0 6px; font-size: 12px;
}
/* 标签页：橙色下划线 */
.gh-tabs {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; gap: 8px; overflow-x: auto;
}
.gh-tabs a {
  font-size: 14px; color: var(--fg); text-decoration: none;
  padding: 8px 12px; border-bottom: 2px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.gh-tabs a:hover { background: #f3f4f6; text-decoration: none; }
.gh-tabs a.active { font-weight: 600; border-bottom: 2px solid #f78166; }

/* ===== 文件查看条 ===== */
.gh-filebar { border-bottom: 1px solid var(--border-muted); background: #fff; }
.gh-filebar-inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 8px; font-size: 14px;
}
.gh-filebar-inner b { font-weight: 600; }
.gh-filesize { color: var(--fg-muted); font-size: 12px; }
.gh-filebar-btns { margin-left: auto; display: flex; gap: 8px; }

/* ===== 主布局 ===== */
.gh-main {
  display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 24px;
  margin-top: 24px; align-items: start;
}
@media (max-width: 900px) { .gh-main { grid-template-columns: 1fr; } }

/* ===== 文件列表 ===== */
.file-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; border-bottom: 1px solid var(--border-muted);
  font-size: 14px;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--bg-inset); }
.file-icon { fill: var(--fg-muted); flex-shrink: 0; }
.file-name { width: 160px; flex-shrink: 0; }
.file-name a { color: var(--accent); font-weight: 500; }
.file-msg { flex: 1; color: var(--fg-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-time { color: var(--fg-muted); font-size: 13px; flex-shrink: 0; }

/* ===== README 框 ===== */
.readme { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 24px; overflow: hidden; }
.readme-header {
  padding: 9px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; background: #fff;
}
.readme-header .file-icon { fill: var(--fg-muted); }
.readme-body { padding: 16px 32px 32px; }
@media (max-width: 640px) { .readme-body { padding: 16px; } }

/* ===== About 侧栏 ===== */
.about h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.about-desc { font-size: 14px; color: var(--fg); margin: 0 0 12px; }
.topic {
  display: inline-block; font-size: 12px; font-weight: 500;
  color: var(--accent); background: #ddf4ff;
  border-radius: 2em; padding: 0 10px; margin: 0 4px 6px 0;
}
.about-meta { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--fg-muted); }
.about-meta li { padding: 6px 0; border-top: 1px solid var(--border-muted); }
.about-meta li:first-child { border-top: none; }

/* ===== markdown 正文 ===== */
.chip {
  display: inline-block; font-size: 12px; font-weight: 500;
  color: var(--accent); background: #ddf4ff;
  border: 1px solid rgba(9,105,218,0.3); border-radius: 2em;
  padding: 0 10px; margin-bottom: 8px;
}
h1 { font-size: 28px; font-weight: 600; line-height: 1.3; margin: 12px 0 4px; letter-spacing: -0.02em; }
.subtitle { color: var(--fg-muted); font-size: 15px; margin-bottom: 8px; }
h2 {
  font-size: 21px; font-weight: 600; margin-top: 44px;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 7px; letter-spacing: -0.01em;
}
h3 { font-size: 16px; font-weight: 600; margin-top: 26px; }
p { margin: 12px 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.m { font-family: Georgia, "Times New Roman", serif; font-style: italic; white-space: nowrap; }
.formula {
  font-family: Georgia, "Times New Roman", serif; font-size: 19px;
  text-align: center; margin: 20px 0; padding: 16px;
  background: var(--bg-inset); border-radius: var(--radius);
}
.frac { display: inline-flex; flex-direction: column; text-align: center; vertical-align: middle; margin: 0 3px; }
.frac > span { padding: 0 5px; }
.frac > span:first-child { border-bottom: 1.2px solid currentColor; }
.lim { white-space: nowrap; }
.lim sub { font-size: 0.7em; }

.note { background: #ddf4ff; border-radius: var(--radius); padding: 12px 16px; font-size: 14px; margin: 16px 0; color: #0a3069; }
.warn { background: #fff8c5; border-radius: var(--radius); padding: 12px 16px; font-size: 14px; margin: 16px 0; color: #4d2d00; }

/* ===== 交互卡：GitHub box（头部灰条）===== */
.card { border: 1px solid var(--border); border-radius: var(--radius); margin: 28px 0; background: #fff; padding: 0 0 16px; }
.card-tag {
  display: block; padding: 9px 16px; margin: 0 0 4px;
  background: var(--bg-inset); border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 13px; font-weight: 600; color: var(--fg);
}
.card h3 { margin: 10px 16px 8px; font-size: 16px; }
.card p { margin-left: 16px; margin-right: 16px; }
.card .controls { margin-left: 16px; margin-right: 16px; }
.card .stat { margin-left: 16px; margin-right: 16px; }
svg.board {
  width: 100%; height: auto; display: block;
  background: #fff; border-top: 1px solid var(--border-muted); border-bottom: 1px solid var(--border-muted);
  touch-action: none;
}
.controls { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; align-items: center; }
.controls label { font-size: 13.5px; color: var(--fg-muted); display: flex; align-items: center; gap: 8px; }
.controls input[type="range"] { width: 160px; accent-color: var(--accent); }
.controls select {
  font-size: 14px; padding: 5px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-inset); color: var(--fg);
}
.btn {
  font-size: 14px; font-weight: 500; padding: 5px 16px;
  border-radius: var(--radius); cursor: pointer;
  border: 1px solid rgba(31,35,40,0.15);
  background: var(--bg-inset); color: var(--fg);
  transition: background .12s;
}
.btn:hover { background: #eef1f4; border-color: rgba(31,35,40,0.25); }
.btn.primary { background: #1f883d; color: #fff; border-color: rgba(31,35,40,0.15); }
.btn.primary:hover { background: var(--success); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.stat { font-size: 14px; margin-top: 12px; color: var(--fg); }
.stat b { font-family: Georgia, serif; font-size: 16px; }
.readout {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12.5px; background: var(--bg-inset);
  border-radius: var(--radius); padding: 10px 14px;
  margin-top: 12px; overflow-x: auto; white-space: pre; color: var(--fg);
}

/* ===== 练习：issue 风格 ===== */
.quiz-q { border: 1px solid var(--border); border-radius: var(--radius); padding: 0 0 4px; margin: 18px 0; }
.quiz-q > p { padding: 12px 16px 0; margin: 0; }
.quiz-q .qn {
  display: inline-block; font-size: 12px; font-weight: 500; color: var(--danger);
  background: #ffebe9; border: 1px solid rgba(207,34,46,0.3);
  border-radius: 2em; padding: 0 10px; margin-right: 8px;
}
.opts { display: grid; gap: 8px; margin: 12px 16px 8px; }
.opts button {
  text-align: left; font-size: 14.5px; padding: 9px 14px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: #fff; cursor: pointer; color: var(--fg);
}
.opts button:hover { border-color: var(--accent); background: #f3f7fc; }
.opts button.ok { border-color: var(--success); background: #dafbe1; color: #116329; font-weight: 500; }
.opts button.bad { border-color: var(--danger); background: #ffebe9; color: #a40e26; }
.explain {
  display: none; font-size: 14px; background: var(--bg-inset);
  border-left: 4px solid var(--success);
  padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 12px 16px 12px; color: var(--fg);
}
.explain.show { display: block; }

.steps li { margin: 10px 0; }
.pager { display: flex; justify-content: space-between; margin-top: 56px; font-size: 14.5px; }
.footer-note {
  color: var(--fg-muted); font-size: 12.5px; text-align: center;
  margin-top: 56px; border-top: 1px solid var(--border-muted); padding-top: 24px;
}

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin: 24px 0; }
.roadmap {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: block;
  text-decoration: none; color: inherit; transition: background .12s, border-color .12s;
}
.roadmap:hover { text-decoration: none; background: var(--bg-inset); border-color: var(--accent); }
.roadmap.locked { opacity: 0.5; }
.roadmap .stage {
  font-size: 12px; font-weight: 500; color: var(--attention);
  background: #fff8c5; border: 1px solid rgba(154,103,0,0.3);
  border-radius: 2em; padding: 0 10px;
}
.roadmap h3 { margin: 10px 0 4px; font-size: 16px; color: var(--accent); }
.roadmap:hover h3 { text-decoration: underline; }
.roadmap p { font-size: 13.5px; color: var(--fg-muted); margin: 0; }
