@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0c0c0b;
  --panel: #11110f;
  --panel-2: #171713;
  --panel-3: #1c1b17;
  --text: #eeeadd;
  --muted: #918e83;
  --faint: #5d5b54;
  --line: #2b2a24;
  --line-soft: #1f1f1b;
  --accent: #f1ad38;
  --accent-2: #ffca68;
  --accent-soft: rgba(241, 173, 56, .1);
  --green: #7fcf75;
  --red: #ef776f;
  --blue: #78a9e6;
  --shadow: 0 24px 80px rgba(0,0,0,.42);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "DM Sans", Inter, system-ui, sans-serif;
}

html[data-theme="light"] {
  --bg: #f4f0e5;
  --panel: #fbf8ef;
  --panel-2: #eee9dc;
  --panel-3: #e5ded0;
  --text: #222119;
  --muted: #6f6b60;
  --faint: #969184;
  --line: #d5cebf;
  --line-soft: #e4ddd0;
  --accent: #b66a09;
  --accent-2: #8c4f00;
  --accent-soft: rgba(182, 106, 9, .09);
  --shadow: 0 24px 80px rgba(64,50,20,.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .035; z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.topbar {
  position: fixed; inset: 0 0 auto 0; height: 64px; z-index: 15;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font: 700 15px var(--mono); letter-spacing: -.03em; }
.brand > span:last-child span { color: var(--accent); }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; background: var(--accent); color: #17120b; border-radius: 7px; transform: rotate(-2deg); }
.brand-mark svg { width: 23px; fill: currentColor; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.hub-back { color: var(--muted); text-decoration: none; font: 600 9px var(--mono); letter-spacing: .08em; }
.hub-back:hover { color: var(--accent); }
.search-trigger { width: 330px; height: 38px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--panel); display: flex; align-items: center; gap: 9px; cursor: pointer; text-align: left; }
.search-trigger:hover { border-color: var(--faint); color: var(--text); }
.search-trigger svg, .search-input-wrap svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.search-trigger span { flex: 1; }
kbd { font: 500 10px var(--mono); border: 1px solid var(--line); border-bottom-color: var(--faint); border-radius: 4px; padding: 2px 5px; color: var(--muted); background: var(--panel-2); }
.system-pill { height: 30px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; font: 500 9px var(--mono); letter-spacing: .09em; color: var(--muted); }
.system-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--panel); cursor: pointer; }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.menu-toggle { display: none; font: 500 15px var(--mono); }

.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px; min-height: 100vh; padding-top: 64px; }
.sidebar, .toc { position: fixed; top: 64px; bottom: 0; background: var(--panel); }
.sidebar { left: 0; width: 250px; border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 10; }
.sidebar-scroll { padding: 24px 13px; overflow-y: auto; flex: 1; }
.side-label { padding: 0 11px 9px; font: 600 9px var(--mono); letter-spacing: .15em; color: var(--faint); }
.curriculum-label { margin-top: 25px; }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px; margin: 2px 0; color: var(--muted); border: 1px solid transparent; border-radius: 7px; text-decoration: none; font-size: 13px; line-height: 1.3; transition: .15s ease; }
.nav-link:hover { color: var(--text); background: var(--panel-2); }
.nav-link.active { color: var(--text); border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); background: var(--accent-soft); }
.nav-icon { width: 21px; height: 21px; flex: 0 0 21px; display: grid; place-items: center; color: var(--faint); font: 500 10px var(--mono); border: 1px solid var(--line); border-radius: 5px; }
.active .nav-icon { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.nav-link.done .nav-icon { color: var(--green); }
.nav-link small { color: var(--faint); display: block; font: 400 10px var(--mono); margin-top: 2px; }
.sidebar-foot { padding: 16px 18px 19px; border-top: 1px solid var(--line); background: var(--panel-2); }
.progress-meta { display: flex; justify-content: space-between; font: 500 9px var(--mono); letter-spacing: .08em; color: var(--muted); }
.progress-meta strong { color: var(--accent); }
.progress-track { height: 4px; background: var(--line); border-radius: 8px; margin: 10px 0 8px; overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.sidebar-foot small { color: var(--faint); font: 400 10px var(--mono); }

.main { grid-column: 2; width: min(920px, calc(100vw - 510px)); min-height: calc(100vh - 64px); margin: 0 auto; padding: 58px 54px 100px; outline: none; }
.toc { right: 0; width: 220px; padding: 28px 18px; border-left: 1px solid var(--line); }
.toc nav button { display: block; width: 100%; padding: 5px 10px; color: var(--faint); border: 0; border-left: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; font-size: 11px; line-height: 1.45; }
.toc nav button:hover, .toc nav button.active { color: var(--accent); border-left-color: var(--accent); }
.toc-card { position: absolute; left: 18px; right: 18px; bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.toc-card strong, .toc-card small { display: block; }
.toc-card strong { margin: 5px 0; font: 600 12px var(--mono); }
.toc-card small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.eyebrow { color: var(--accent); font: 600 9px var(--mono); letter-spacing: .12em; }

.hero { position: relative; padding: 14px 0 48px; border-bottom: 1px solid var(--line); }
.hero::before { content: ""; position: absolute; right: -30px; top: -45px; width: 340px; height: 250px; opacity: .55; background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px); background-size: 22px 22px; mask-image: radial-gradient(circle at center, black, transparent 72%); z-index: -1; }
.hero-status { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px; color: var(--accent); font: 500 10px var(--mono); letter-spacing: .1em; }
.hero-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
h1, h2, h3 { line-height: 1.12; letter-spacing: -.035em; }
h1 { max-width: 770px; margin: 0 0 20px; font-size: clamp(42px, 5vw, 68px); font-weight: 600; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero > p { max-width: 650px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.hero-actions { display: flex; gap: 10px; margin-top: 28px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 17px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-2); text-decoration: none; font: 600 11px var(--mono); cursor: pointer; }
.button:hover { transform: translateY(-1px); border-color: var(--faint); }
.button.primary { color: #1a140b; background: var(--accent); border-color: var(--accent); }
.button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 32px 0 68px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.stat { padding: 19px; border-right: 1px solid var(--line); }
.stat:last-child { border: 0; }
.stat strong { display: block; font: 600 22px var(--mono); color: var(--text); }
.stat span { color: var(--faint); font: 500 9px var(--mono); letter-spacing: .09em; }
.section-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--accent); font: 600 10px var(--mono); letter-spacing: .11em; }
.section-kicker::before { content: "//"; color: var(--faint); }
.section-title { margin: 0 0 12px; font-size: 30px; font-weight: 600; }
.section-copy { max-width: 660px; margin: 0 0 28px; color: var(--muted); }

.path-grid { display: grid; gap: 11px; margin-bottom: 66px; }
.path-card { position: relative; display: grid; grid-template-columns: 58px 1fr auto; gap: 17px; align-items: center; min-height: 104px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); text-decoration: none; overflow: hidden; transition: .18s ease; }
.path-card::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: .25s ease; }
.path-card:hover { transform: translateX(3px); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--panel-2); }
.path-card:hover::after { transform: scaleX(1); }
.path-num { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--accent); background: var(--panel-2); font: 600 12px var(--mono); }
.path-card h3 { margin: 0 0 5px; font-size: 16px; letter-spacing: -.01em; }
.path-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.path-meta { text-align: right; color: var(--faint); font: 500 9px var(--mono); white-space: nowrap; }
.path-meta span { display: block; margin-top: 5px; }

.terminal-card { margin: 25px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #090a09; box-shadow: var(--shadow); }
.terminal-head { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; color: #8e9089; background: #161714; border-bottom: 1px solid #292a25; font: 500 9px var(--mono); }
.terminal-head i { width: 7px; height: 7px; border-radius: 50%; background: #5c5e58; }
.terminal-head i:first-child { background: #e66b5d; }.terminal-head i:nth-child(2) { background: #d8ad4c; }.terminal-head i:nth-child(3) { background: #65b76a; }
.terminal-head span { margin-left: 6px; }
.terminal-body { padding: 17px 19px; color: #dadbd4; font: 400 12px/1.8 var(--mono); white-space: pre-wrap; overflow-x: auto; }
.terminal-body .prompt { color: #eeb14e; }.terminal-body .comment { color: #70746b; }.terminal-body .ok { color: #74c67b; }

.page-head { padding-bottom: 30px; border-bottom: 1px solid var(--line); margin-bottom: 42px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; margin-bottom: 20px; color: var(--faint); font: 500 10px var(--mono); }
.breadcrumb a { color: var(--muted); text-decoration: none; }.breadcrumb a:hover { color: var(--accent); }
.page-head h1 { font-size: clamp(36px, 4.5vw, 56px); }
.page-head p { max-width: 720px; margin: 0; color: var(--muted); font-size: 16px; }
.module-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.meta-chip { display: inline-flex; gap: 6px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font: 500 9px var(--mono); letter-spacing: .04em; background: var(--panel); }
.meta-chip b { color: var(--text); font-weight: 500; }
.article { max-width: 760px; }
.article section { scroll-margin-top: 90px; margin: 0 0 48px; }
.article h2 { margin: 0 0 16px; font-size: 25px; font-weight: 600; }
.article h3 { margin: 27px 0 10px; font-size: 17px; letter-spacing: -.015em; }
.article p, .article li { color: var(--muted); }
.article strong { color: var(--text); font-weight: 600; }
.article ul, .article ol { padding-left: 21px; }
.article li { margin: 7px 0; padding-left: 4px; }
.article code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--accent-2); background: var(--panel-2); font: 500 .84em var(--mono); }
.article pre { position: relative; padding: 19px; border: 1px solid var(--line); border-radius: 8px; color: #d7d9d2; background: #0a0b0a; overflow-x: auto; font: 400 12px/1.75 var(--mono); }
.copy-code { position: absolute; right: 9px; top: 9px; padding: 4px 7px; border: 1px solid #32342f; border-radius: 4px; color: #8e9188; background: #171815; cursor: pointer; font: 500 9px var(--mono); }
.callout { margin: 22px 0; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--accent-soft); }
.callout.danger { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); border-left-color: var(--red); background: color-mix(in srgb, var(--red) 7%, transparent); }
.callout-title { display: block; margin-bottom: 5px; color: var(--text); font: 600 10px var(--mono); letter-spacing: .08em; }
.callout p { margin: 0; font-size: 13px; }
.concept-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0; }
.concept { padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.concept span { color: var(--accent); font: 600 9px var(--mono); letter-spacing: .08em; }
.concept h3 { margin: 7px 0 5px; font-size: 14px; }
.concept p { margin: 0; font-size: 12px; line-height: 1.5; }

.lesson-list { margin: 26px 0 45px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.lesson-row { display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 12px; min-height: 64px; padding: 12px 15px; border-bottom: 1px solid var(--line); background: var(--panel); text-decoration: none; }
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover { background: var(--panel-2); }
.lesson-check { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: transparent; font-size: 11px; }
.lesson-row.done .lesson-check { color: #14200f; border-color: var(--green); background: var(--green); }
.lesson-row strong { display: block; font-size: 13px; }
.lesson-row small { color: var(--faint); font: 400 10px var(--mono); }
.lesson-row > span:last-child { color: var(--faint); font: 500 9px var(--mono); }

.checklist { display: grid; gap: 8px; margin: 20px 0; }
.check-item { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; }
.check-item input { margin-top: 5px; accent-color: var(--accent); }
.check-item span { color: var(--muted); font-size: 13px; }
.quiz { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.quiz p { margin-top: 0; color: var(--text); }
.quiz-options { display: grid; gap: 7px; }
.quiz-option { padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel-2); cursor: pointer; text-align: left; font-size: 12px; }
.quiz-option:hover { border-color: var(--faint); color: var(--text); }
.quiz-option.correct { color: var(--green); border-color: var(--green); }.quiz-option.wrong { color: var(--red); border-color: var(--red); }
.lesson-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-top: 26px; margin-top: 50px; border-top: 1px solid var(--line); }
.complete-button.done { color: #0d160b; background: var(--green); border-color: var(--green); }

.architecture { display: grid; gap: 8px; margin: 24px 0 60px; }
.arch-row { display: grid; grid-template-columns: 120px 1fr; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.arch-label { display: grid; place-items: center; min-height: 62px; padding: 10px; color: var(--accent); background: var(--panel-2); font: 600 9px var(--mono); letter-spacing: .08em; border-right: 1px solid var(--line); }
.arch-items { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 12px; background: var(--panel); }
.arch-items span { padding: 5px 8px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; font: 500 10px var(--mono); }
.resource-list { display: grid; gap: 8px; }
.resource { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); text-decoration: none; }
.resource:hover { border-color: var(--accent); }
.resource strong { font-size: 13px; }.resource p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.resource span { color: var(--accent); font: 500 9px var(--mono); }

.search-dialog { width: min(680px, calc(100vw - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
.search-dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.search-box { margin: 0; }
.search-input-wrap { height: 58px; display: flex; align-items: center; gap: 11px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.search-input-wrap input { flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-input-wrap button { border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--panel-2); font: 500 9px var(--mono); cursor: pointer; }
.search-results { max-height: 410px; padding: 8px; overflow-y: auto; }
.search-result { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; padding: 10px; border-radius: 6px; text-decoration: none; }
.search-result:hover, .search-result.selected { background: var(--panel-2); }
.search-result i { width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); border: 1px solid var(--line); border-radius: 5px; font: normal 600 10px var(--mono); }
.search-result strong { display: block; font-size: 12px; }.search-result small { color: var(--faint); font: 400 9px var(--mono); }
.search-result > span { color: var(--faint); font: 500 9px var(--mono); }
.empty-search { padding: 35px; text-align: center; color: var(--muted); font-size: 13px; }
.search-hint { display: flex; gap: 17px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--panel-2); box-shadow: var(--shadow); font: 500 10px var(--mono); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 230px 1fr; }
  .sidebar { width: 230px; }
  .toc { display: none; }
  .main { grid-column: 2; width: calc(100vw - 230px); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .menu-toggle { display: grid; }
  .brand { margin-right: auto; margin-left: 9px; }
  .search-trigger { width: 38px; justify-content: center; padding: 0; }.search-trigger span, .search-trigger kbd, .system-pill { display: none; }
  .hub-back { display: none; }
  .app-shell { display: block; }
  .sidebar { position: fixed; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main { width: 100%; padding: 40px 22px 80px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }.stat:nth-child(2) { border-right: 0; }.stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .concept-grid { grid-template-columns: 1fr; }
  .path-card { grid-template-columns: 48px 1fr; }.path-meta { display: none; }
  h1 { font-size: 40px; }
}
