:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #edf2f4;
  --ink: #17232c;
  --muted: #62717b;
  --line: #d7dfe3;
  --docker: #147d9b;
  --docker-soft: #e5f3f7;
  --ollama: #d85d3f;
  --ollama-soft: #faece7;
  --accent: var(--docker);
  --accent-soft: var(--docker-soft);
  --green: #287a55;
  --warning: #9a6712;
  --danger: #a33b35;
  --shadow: 0 18px 50px rgba(24, 44, 56, .12);
  --sidebar: 288px;
  --rail: 220px;
}

body[data-active-course="ollama"] { --accent: var(--ollama); --accent-soft: var(--ollama-soft); }

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111719;
  --surface: #182124;
  --surface-2: #202c30;
  --ink: #edf5f6;
  --muted: #a8b6ba;
  --line: #334247;
  --docker-soft: #17333d;
  --ollama-soft: #3a2520;
  --shadow: 0 20px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif; letter-spacing: 0; }
button, input { font: inherit; letter-spacing: 0; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

.topbar { position: fixed; z-index: 30; inset: 0 0 auto 0; height: 64px; display: grid; grid-template-columns: var(--sidebar) 1fr auto; align-items: center; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); }
.brand { height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 20px; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line); }
.brand-mark { display: grid; place-items: center; width: 32px; aspect-ratio: 1; background: var(--ink); color: var(--surface); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.topnav { display: flex; height: 100%; align-items: stretch; padding-left: 18px; }
.topnav button { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 0 16px; color: var(--muted); cursor: pointer; font-size: 13px; }
.topnav button:hover, .topnav button.active { color: var(--ink); border-bottom-color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 8px; padding-right: 18px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.search-button { height: 38px; display: flex; gap: 8px; align-items: center; padding: 0 13px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--muted); }
.search-button span:first-child { color: var(--ink); font-size: 19px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--rail); padding-top: 64px; }
.sidebar { position: fixed; z-index: 20; top: 64px; bottom: 0; left: 0; width: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.course-switch { display: grid; grid-template-columns: 1fr 1fr; margin: 16px; background: var(--surface-2); padding: 3px; }
.course-switch button { min-width: 0; height: 40px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700; }
.course-switch button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(20, 40, 50, .08); }
.course-switch img { width: 20px; height: 20px; object-fit: contain; }
.sidebar-progress { padding: 0 18px 14px; border-bottom: 1px solid var(--line); }
.sidebar-progress > div:first-child { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.sidebar-progress strong { color: var(--ink); }
.progress-track { height: 4px; margin-top: 8px; background: var(--surface-2); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .25s ease; }
.chapter-nav { flex: 1; overflow: auto; padding: 8px; scrollbar-width: thin; }
.chapter-nav button { width: 100%; min-height: 44px; display: grid; grid-template-columns: 30px 1fr 16px; align-items: center; gap: 6px; border: 0; border-left: 3px solid transparent; background: transparent; padding: 8px 9px; color: var(--muted); text-align: left; cursor: pointer; font-size: 12px; line-height: 1.4; }
.chapter-nav button:hover { background: var(--surface-2); color: var(--ink); }
.chapter-nav button.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--ink); }
.chapter-nav .chapter-index { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 10px; }
.chapter-nav .done-dot { width: 8px; height: 8px; border: 1px solid var(--line); border-radius: 50%; }
.chapter-nav button.done .done-dot { border-color: var(--green); background: var(--green); }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--line); }
.sidebar-footer button { border: 0; padding: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.sidebar-footer span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { grid-column: 2; min-width: 0; padding: 36px clamp(24px, 4vw, 70px) 80px; }
.context-rail { grid-column: 3; border-left: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.context-sticky { position: sticky; top: 96px; padding: 0 22px; }
.rail-label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
#sectionNav { display: grid; gap: 3px; }
#sectionNav button { width: 100%; display: block; padding: 6px 0 6px 10px; border: 0; border-left: 2px solid var(--line); background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: 11px; line-height: 1.45; }
#sectionNav button:hover { color: var(--ink); border-left-color: var(--accent); }
.complete-button { width: 100%; margin-top: 24px; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 11px; }
.complete-button.completed { border-color: var(--green); color: var(--green); background: color-mix(in srgb, var(--green) 8%, var(--surface)); }

.overview { max-width: 1180px; margin: 0 auto; }
.overview-hero { min-height: 430px; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: clamp(30px, 5vw, 80px); border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.overview h1 { max-width: 680px; margin: 12px 0 16px; font-size: clamp(36px, 5vw, 64px); line-height: 1.02; letter-spacing: 0; }
.overview-copy > p { max-width: 650px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.hero-actions { display: flex; gap: 10px; margin-top: 28px; }
.primary-button, .secondary-button { min-height: 42px; padding: 0 18px; cursor: pointer; font-weight: 700; border: 1px solid var(--ink); }
.primary-button { background: var(--ink); color: var(--surface); }
.secondary-button { background: transparent; }
.system-scene { min-height: 300px; display: grid; grid-template-columns: 1fr 72px 1fr; align-items: center; background: #14262d; color: #f5fbfc; padding: 30px; box-shadow: var(--shadow); overflow: hidden; }
.scene-node { min-width: 0; display: grid; align-content: center; justify-items: center; gap: 8px; text-align: center; }
.scene-node img { width: 80px; height: 80px; object-fit: contain; background: #fff; padding: 12px; }
.docker-node img { filter: none; }
.scene-node strong { font-size: 15px; }
.scene-node span { color: #aebfc5; font-size: 10px; }
.scene-link { min-width: 0; text-align: center; }
.scene-link span { display: block; height: 1px; background: #67808a; position: relative; }
.scene-link span::after { content: ""; position: absolute; right: -1px; top: -3px; border-left: 6px solid #67808a; border-top: 3px solid transparent; border-bottom: 3px solid transparent; }
.scene-link b { display: block; margin-top: 8px; color: #9db0b7; font-size: 8px; font-weight: 500; }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.course-summary { min-height: 245px; padding: 34px 34px 30px 0; display: grid; grid-template-columns: 64px 1fr; gap: 20px; align-content: start; }
.course-summary + .course-summary { border-left: 1px solid var(--line); padding-left: 34px; }
.course-summary > img { width: 58px; height: 58px; object-fit: contain; background: #fff; padding: 8px; }
.course-summary h2 { margin: 0; font-size: 24px; }
.course-summary p { color: var(--muted); line-height: 1.7; font-size: 12px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 16px; margin: 18px 0; }
.stat-row span { color: var(--muted); font-size: 10px; }
.stat-row strong { display: block; color: var(--ink); font-size: 17px; }
.text-button { border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: 0; font-weight: 800; font-size: 11px; }
.resume-band { padding: 34px 0; display: grid; grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid var(--line); }
.resume-band h2 { margin: 0 0 8px; font-size: 20px; }
.resume-band p { margin: 0; color: var(--muted); font-size: 12px; }
.principles-band { display: grid; grid-template-columns: repeat(3, 1fr); padding-top: 36px; }
.principles-band > div { padding: 0 30px; border-left: 1px solid var(--line); }
.principles-band > div:first-child { padding-left: 0; border-left: 0; }
.principles-band span { color: var(--accent); font-size: 10px; font-weight: 800; }
.principles-band strong { display: block; margin-top: 10px; font-size: 15px; }
.principles-band p { color: var(--muted); font-size: 11px; line-height: 1.7; }

.chapter { max-width: 900px; margin: 0 auto; }
.chapter-head { padding: 18px 0 30px; border-bottom: 1px solid var(--line); }
.chapter-kicker { color: var(--accent); font-size: 10px; font-weight: 800; }
.chapter h1 { margin: 9px 0 14px; font-size: clamp(28px, 4vw, 46px); line-height: 1.15; letter-spacing: 0; }
.chapter-meta { display: flex; gap: 18px; color: var(--muted); font-size: 10px; }
.chapter-body { padding-top: 10px; }
.chapter-body p { margin: 14px 0; font-size: 14px; line-height: 1.9; }
.chapter-body h2 { scroll-margin-top: 90px; margin: 38px 0 16px; font-size: 20px; letter-spacing: 0; }
.content-list { margin: 16px 0; padding-left: 24px; }
.content-list li { margin: 8px 0; padding-left: 4px; font-size: 13px; line-height: 1.75; }
.content-list.ordered li::marker { color: var(--accent); font-weight: 800; }
.callout { margin: 22px 0; padding: 16px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.callout.tip { border-left-color: var(--green); background: color-mix(in srgb, var(--green) 8%, var(--surface)); }
.callout.danger { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.callout strong { display: block; margin-bottom: 5px; font-size: 11px; }
.callout p { margin: 0; font-size: 12px; line-height: 1.7; }
.table-wrap { margin: 22px 0; overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 11px; line-height: 1.55; }
th { background: var(--surface-2); color: var(--ink); font-weight: 800; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { border-right: 0; }
.code-block { margin: 22px 0; border: 1px solid var(--line); background: #11191d; color: #e9f1f3; }
.code-head { height: 36px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid #314047; color: #91a6ae; font-size: 9px; font-weight: 800; }
.copy-button { border: 0; background: transparent; color: #c9d6da; cursor: pointer; font-size: 10px; }
pre { margin: 0; padding: 16px; overflow: auto; font-family: Consolas, "SFMono-Regular", monospace; font-size: 11px; line-height: 1.6; tab-size: 2; }
.chapter-footer { margin-top: 50px; padding-top: 24px; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.chapter-footer button { min-height: 42px; max-width: 46%; border: 1px solid var(--line); background: var(--surface); padding: 8px 13px; cursor: pointer; font-size: 11px; text-align: left; }

.page-title { max-width: 1050px; margin: 0 auto 32px; }
.page-title h1 { margin: 8px 0 10px; font-size: 40px; }
.page-title p { color: var(--muted); line-height: 1.7; }
.roadmap { max-width: 1050px; margin: 0 auto; }
.roadmap-stage { display: grid; grid-template-columns: 110px 1fr; border-top: 1px solid var(--line); padding: 26px 0; }
.stage-number { color: var(--accent); font-size: 11px; font-weight: 800; }
.stage-content h2 { margin: 0 0 6px; font-size: 18px; }
.stage-content > p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.stage-links { display: flex; flex-wrap: wrap; gap: 8px; }
.stage-links button { border: 1px solid var(--line); background: var(--surface); padding: 8px 10px; cursor: pointer; font-size: 10px; }
.stage-links button:hover { border-color: var(--accent); color: var(--accent); }
.compare-layout { max-width: 1050px; margin: 0 auto; }
.compare-table td:first-child { font-weight: 800; color: var(--docker); }
.compare-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 34px; }
.compare-notes section { border-top: 3px solid var(--docker); padding-top: 18px; }
.compare-notes section:last-child { border-color: var(--ollama); }
.compare-notes h2 { font-size: 17px; }
.compare-notes li { color: var(--muted); font-size: 12px; line-height: 1.7; margin-bottom: 6px; }

.search-dialog { width: min(760px, calc(100vw - 30px)); max-height: min(760px, calc(100vh - 40px)); border: 1px solid var(--line); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.search-dialog::backdrop { background: rgba(10, 18, 22, .56); }
.search-head { height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); }
.search-head label { font-size: 12px; font-weight: 800; }
.search-dialog > input { width: calc(100% - 32px); height: 46px; margin: 16px; padding: 0 13px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.search-meta { padding: 0 16px 10px; color: var(--muted); font-size: 10px; }
.search-results { max-height: 560px; overflow: auto; border-top: 1px solid var(--line); }
.search-result { width: 100%; display: grid; grid-template-columns: 72px 1fr; gap: 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 14px 16px; text-align: left; cursor: pointer; }
.search-result:hover { background: var(--surface-2); }
.search-result .result-course { color: var(--docker); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.search-result strong { display: block; margin-bottom: 5px; font-size: 12px; }
.search-result p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.scrim { display: none; }
.mobile-only { display: none; }

@media (max-width: 1120px) {
  :root { --rail: 0px; }
  .context-rail { display: none; }
  .topbar { grid-template-columns: var(--sidebar) 1fr auto; }
}

@media (max-width: 820px) {
  :root { --sidebar: 280px; }
  .mobile-only { display: grid; }
  .topbar { grid-template-columns: 48px 1fr auto; }
  .brand { border-right: 0; padding: 0 8px; }
  .brand-mark { display: none; }
  .brand small { display: none; }
  .topnav { display: none; }
  .search-button span:last-child { display: none; }
  .search-button { width: 38px; padding: 0; justify-content: center; }
  .top-actions { padding-right: 8px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .scrim { position: fixed; z-index: 15; inset: 64px 0 0 var(--sidebar); background: rgba(10, 18, 22, .5); }
  body.sidebar-open .scrim { display: block; }
  .main { padding: 22px 18px 64px; }
  .overview-hero { grid-template-columns: 1fr; min-height: auto; padding: 30px 0 42px; }
  .overview h1 { font-size: 39px; }
  .system-scene { min-height: 250px; }
  .overview-grid { grid-template-columns: 1fr; }
  .course-summary, .course-summary + .course-summary { min-height: 0; border-left: 0; border-top: 1px solid var(--line); padding: 26px 0; }
  .principles-band { grid-template-columns: 1fr; gap: 24px; }
  .principles-band > div, .principles-band > div:first-child { padding: 0 0 0 18px; border-left: 1px solid var(--line); }
  .resume-band { grid-template-columns: 1fr; gap: 18px; }
  .chapter h1 { font-size: 32px; }
  .roadmap-stage { grid-template-columns: 62px 1fr; }
  .compare-notes { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .system-scene { grid-template-columns: 1fr; gap: 18px; }
  .scene-link { transform: rotate(90deg); width: 48px; margin: 0 auto; }
  .scene-link b { display: none; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .course-summary { grid-template-columns: 50px 1fr; gap: 14px; }
  .course-summary > img { width: 46px; height: 46px; }
  .chapter-footer { flex-direction: column; }
  .chapter-footer button { max-width: none; width: 100%; }
  .search-result { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .sidebar, .context-rail, .chapter-footer, .copy-button { display: none !important; }
  .app-shell { display: block; padding: 0; }
  .main { padding: 0; }
  .chapter { max-width: none; }
  .code-block { break-inside: avoid; }
}
