:root {
  --bg: #ffffff; --bg-soft: #f6f7f9; --text: #1f2328; --muted: #59636e; --border: #d8dee4;
  --accent: #0b6e4f; --accent-soft: #e6f4ee; --code-bg: #f6f8fa;
  --note: #0969da; --tip: #1a7f37; --important: #8250df; --warning: #9a6700; --caution: #cf222e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419; --bg-soft: #161b22; --text: #e6edf3; --muted: #9198a1; --border: #30363d;
    --accent: #3fb68b; --accent-soft: #12261e; --code-bg: #161b22;
    --note: #4493f8; --tip: #3fb950; --important: #ab7df8; --warning: #d29922; --caution: #f85149;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--bg-soft); border-right: 1px solid var(--border); padding: 1.25rem 1rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; font-size: 0.93rem; }
.menu > summary { display: none; }
.sidebar a { text-decoration: none; color: var(--text); }
.sidebar a:hover { color: var(--accent); }
.sidebar a.active { color: var(--accent); font-weight: 600; }
.nav-course { display: block; font-weight: 700; font-size: 1.05rem; line-height: 1.35; margin-bottom: 0.75rem; }
.download { display: block; margin-bottom: 1rem; padding: 0.45rem 0.7rem; border: 1px solid var(--accent);
  border-radius: 6px; color: var(--accent) !important; text-align: center; }
.nav-module { margin: 0.35rem 0; }
.nav-module > summary { cursor: pointer; font-weight: 600; padding: 0.25rem 0; }
.nav-module ul { list-style: none; margin: 0.2rem 0 0.6rem; padding-left: 0.9rem; border-left: 2px solid var(--border); }
.nav-module li { margin: 0.25rem 0; }
.nav-exercises, .nav-quiz, .nav-solutions { font-size: 0.88rem; }
main { padding: 2.5rem 3rem 2rem; }
article { max-width: 46rem; }
h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 1rem; }
h2 { font-size: 1.45rem; margin: 2.4rem 0 0.8rem; padding-top: 0.4rem; border-top: 1px solid var(--border); }
h3 { font-size: 1.15rem; margin: 1.8rem 0 0.6rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em;
  background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem 1rem;
  overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; font-size: 0.84rem; }
pre code.hljs { padding: 0; background: none; }
.code-title { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem;
  color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0; padding: 0.35rem 1rem; margin-top: 1rem; }
.code-title + pre, .code-title + .highlight pre { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
table { border-collapse: collapse; display: block; overflow-x: auto; margin: 1rem 0; font-size: 0.92rem; }
th, td { border: 1px solid var(--border); padding: 0.4rem 0.7rem; text-align: left; }
th { background: var(--bg-soft); }
.callout { border-left: 4px solid var(--note); background: var(--bg-soft); border-radius: 0 8px 8px 0;
  padding: 0.2rem 1rem; margin: 1.2rem 0; }
.callout-title { font-weight: 700; margin-bottom: 0.2rem; color: var(--note); }
.callout-tip { border-color: var(--tip); } .callout-tip .callout-title { color: var(--tip); }
.callout-important { border-color: var(--important); } .callout-important .callout-title { color: var(--important); }
.callout-warning { border-color: var(--warning); } .callout-warning .callout-title { color: var(--warning); }
.callout-caution { border-color: var(--caution); } .callout-caution .callout-title { color: var(--caution); }
details { margin: 0.6rem 0; }
article details { border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0.9rem; }
article details > summary { cursor: pointer; font-weight: 600; }
.mermaid { margin: 1.2rem 0; text-align: center; }
.download-box, .module-links { background: var(--accent-soft); border-radius: 8px; padding: 0.7rem 1rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem;
  padding-top: 1rem; border-top: 1px solid var(--border); }
.pager .next { margin-left: auto; }
footer { max-width: 46rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.85rem; }
footer a { color: var(--muted); }
.lead { color: var(--muted); }
.quiz-question { border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 1.2rem 1.1rem; margin: 1.2rem 0; }
.quiz-question h2 { border: none; margin: 0.8rem 0 0.2rem; font-size: 1rem; color: var(--muted); }
.quiz-prompt { font-weight: 600; }
.quiz-hint { color: var(--muted); font-size: 0.9rem; margin-top: -0.5rem; }
.quiz-options { display: grid; gap: 0.45rem; margin: 0.8rem 0; }
.quiz-option { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem 0.7rem;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.quiz-option input { margin-top: 0.35rem; }
.quiz-option.is-answer { border-color: var(--tip); background: color-mix(in srgb, var(--tip) 12%, transparent); }
.quiz-option.is-wrong { border-color: var(--caution); background: color-mix(in srgb, var(--caution) 12%, transparent); }
.quiz-check { font: inherit; padding: 0.45rem 1.1rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; }
.quiz-feedback { margin-top: 0.8rem; padding: 0.6rem 0.9rem; border-radius: 8px; background: var(--bg-soft); }
.quiz-feedback.correct { border-left: 4px solid var(--tip); }
.quiz-feedback.incorrect { border-left: 4px solid var(--caution); }
.quiz-score { font-weight: 700; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .menu > summary { display: block; cursor: pointer; font-weight: 700; }
  main { padding: 1.5rem 1.1rem; }
  h1 { font-size: 1.7rem; }
}
