:root {
  --bg: #0b0f17;
  --panel: #121824;
  --panel-2: #151d2b;
  --panel-3: #0f1520;
  --line: rgba(177, 193, 221, 0.14);
  --line-strong: rgba(177, 193, 221, 0.25);
  --text: #f4f7fb;
  --muted: #a6b1c5;
  --muted-2: #77849b;
  --cyan: #8ee8dc;
  --cyan-strong: #49cdbc;
  --violet: #bca8ff;
  --amber: #ffd69b;
  --red: #ff9f9f;
  --green: #92e9b1;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 18px;
  --max: 1540px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.site-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 76% 4%, rgba(77, 204, 190, 0.11), transparent 26rem),
    radial-gradient(circle at 4% 80%, rgba(129, 107, 255, 0.08), transparent 32rem),
    linear-gradient(180deg, #0c1018 0%, #0b0f17 65%, #0b0f17 100%);
}

.site-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, black, transparent 76%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 30px;
  background: rgba(11, 15, 23, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 220px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(142, 232, 220, 0.48);
  border-radius: 10px;
  color: var(--bg);
  font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), #b4f8db);
  box-shadow: 0 8px 28px rgba(73, 205, 188, 0.22);
}
.brand strong { display: block; letter-spacing: 0.18em; font-size: 0.9rem; }
.brand small { display: block; margin-top: -2px; color: var(--muted-2); font-size: 0.7rem; letter-spacing: 0.03em; }
.topbar-actions { display: flex; align-items: center; gap: 22px; }
.top-link { color: var(--muted); font-size: 0.82rem; transition: color 160ms ease; }
.top-link:hover { color: var(--text); }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 290px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted-2);
  text-align: left;
  background: rgba(21, 29, 43, 0.76);
  cursor: pointer;
  transition: border 160ms ease, color 160ms ease, background 160ms ease;
}
.search-trigger:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-2); }
.search-icon { color: var(--cyan); font-size: 1.1rem; line-height: 1; }
kbd {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted-2);
  font-size: 0.68rem;
  background: rgba(0, 0, 0, 0.16);
}

.layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 220px;
  gap: 32px;
  width: min(var(--max), calc(100% - 56px));
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 32px 0 26px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sidebar-intro { padding: 0 11px 18px; border-bottom: 1px solid var(--line); }
.sidebar-intro p { margin: 11px 0 0; color: var(--muted-2); font-size: 0.77rem; line-height: 1.55; }
.eyebrow { display: inline-block; color: var(--cyan); font-size: 0.67rem; font-weight: 800; letter-spacing: 0.13em; line-height: 1.3; text-transform: uppercase; }
.nav-tree { padding: 18px 0; }
.nav-section { margin-bottom: 16px; }
.nav-section-title { display: block; margin: 0 11px 6px; color: var(--muted-2); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.nav-link { display: block; padding: 5px 11px; border-left: 1px solid transparent; border-radius: 0 8px 8px 0; color: var(--muted); font-size: 0.78rem; line-height: 1.35; transition: all 150ms ease; }
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-link.active { border-left-color: var(--cyan); color: var(--text); background: linear-gradient(90deg, rgba(142,232,220,0.13), transparent); }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 13px 11px; color: var(--muted-2); font-size: 0.67rem; border-top: 1px solid var(--line); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(146,233,177,0.1); }

.content { min-width: 0; padding: 60px 0 100px; }
.content:focus { outline: none; }
.article { max-width: 900px; margin: 0 auto; }
.article-header { padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.article-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 17px; color: var(--muted-2); font-size: 0.76rem; }
.article-kicker::after { content: ""; width: 24px; height: 1px; background: var(--cyan-strong); }
.article h1 { max-width: 820px; margin: 0; font-size: clamp(2.3rem, 5vw, 4.8rem); line-height: 0.99; letter-spacing: -0.055em; }
.article-summary { max-width: 720px; margin: 23px 0 0; color: var(--muted); font-size: 1.1rem; line-height: 1.55; }
.meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 26px; color: var(--muted-2); font-size: 0.72rem; }
.meta-pill { padding: 4px 9px; border: 1px solid rgba(142,232,220,0.25); border-radius: 99px; color: var(--cyan); background: rgba(142,232,220,0.06); }
.article-tools { display: flex; gap: 8px; margin-left: auto; }
.tool-button, .icon-button { border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(255,255,255,0.03); cursor: pointer; transition: all 150ms ease; }
.tool-button { padding: 6px 10px; font-size: 0.72rem; }
.tool-button:hover, .icon-button:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,0.07); }

.prose { padding-top: 34px; }
.prose h2 { margin: 46px 0 14px; color: var(--text); font-size: clamp(1.35rem, 2vw, 1.75rem); line-height: 1.15; letter-spacing: -0.025em; scroll-margin-top: 100px; }
.prose h3 { margin: 32px 0 10px; color: var(--cyan); font-size: 1rem; line-height: 1.25; scroll-margin-top: 100px; }
.prose p { max-width: 760px; margin: 0 0 17px; color: #c4ccda; }
.prose strong { color: var(--text); font-weight: 700; }
.prose em { color: var(--amber); }
.prose ul, .prose ol { max-width: 760px; margin: 0 0 20px; padding-left: 21px; color: #c4ccda; }
.prose li { margin: 6px 0; padding-left: 4px; }
.prose li::marker { color: var(--cyan-strong); }
.prose a { color: var(--cyan); text-decoration: underline; text-decoration-color: rgba(142,232,220,0.35); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--cyan); }
.prose blockquote { max-width: 760px; margin: 24px 0; padding: 19px 22px; border-left: 2px solid var(--cyan); border-radius: 0 12px 12px 0; color: var(--text); font-size: 1.12rem; background: rgba(142,232,220,0.055); }
.prose pre { max-width: 820px; overflow: auto; margin: 21px 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; color: #d5f7eb; font: 0.8rem/1.7 "SFMono-Regular", Consolas, monospace; background: #0a1018; box-shadow: inset 0 1px rgba(255,255,255,0.03); }
.prose code { padding: 2px 5px; border-radius: 5px; color: #d5f7eb; font: 0.86em "SFMono-Regular", Consolas, monospace; background: rgba(142,232,220,0.09); }
.prose pre code { padding: 0; background: transparent; }
.prose table { width: 100%; max-width: 820px; margin: 22px 0; border-collapse: collapse; border: 1px solid var(--line); overflow: hidden; border-radius: 12px; font-size: 0.85rem; }
.prose th, .prose td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { color: var(--cyan); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(255,255,255,0.035); }
.prose tr:last-child td { border-bottom: 0; }
.callout { max-width: 820px; margin: 28px 0; padding: 20px 21px; border: 1px solid rgba(188,168,255,0.24); border-radius: 15px; background: linear-gradient(135deg, rgba(188,168,255,0.10), rgba(142,232,220,0.035)); }
.callout .eyebrow { color: var(--violet); }
.callout p:last-child { margin-bottom: 0; }
.numbered-card { display: grid; grid-template-columns: 36px 1fr; gap: 14px; max-width: 780px; margin: 13px 0; padding: 16px 16px 16px 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,0.025); }
.numbered-card .number { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; color: var(--bg); font-weight: 900; background: var(--cyan); }
.numbered-card p { margin-bottom: 0; }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 820px; margin: 22px 0; }
.mini-card { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.025); }
.mini-card h3 { margin-top: 0; }
.mini-card p { margin-bottom: 0; font-size: 0.9rem; }
.article-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 55px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 0.72rem; }
.article-footer a { color: var(--cyan); }

.right-rail { padding-top: 66px; }
.rail-card { margin-bottom: 18px; padding: 16px 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(18,24,36,0.56); }
.rail-card p { margin: 10px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.accent-card { border-color: rgba(142,232,220,0.19); background: linear-gradient(180deg, rgba(142,232,220,0.09), rgba(18,24,36,0.58)); }
.toc { margin-top: 11px; }
.toc a { display: block; padding: 4px 0 4px 10px; border-left: 1px solid var(--line); color: var(--muted-2); font-size: 0.72rem; line-height: 1.4; }
.toc a:hover { border-left-color: var(--cyan); color: var(--text); }
.toc a.level-3 { padding-left: 21px; font-size: 0.68rem; }
.related-links a { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; line-height: 1.35; }
.related-links a:last-child { border-bottom: 0; }
.related-links a:hover { color: var(--cyan); }

.hero { position: relative; overflow: hidden; margin-bottom: 26px; padding: 31px; border: 1px solid rgba(142,232,220,0.2); border-radius: 21px; background: linear-gradient(135deg, rgba(142,232,220,0.1), rgba(188,168,255,0.075) 50%, rgba(18,24,36,0.65)); }
.hero::after { content: ""; position: absolute; right: -70px; bottom: -90px; width: 260px; height: 260px; border: 1px solid rgba(142,232,220,0.25); border-radius: 50%; box-shadow: 0 0 0 22px rgba(142,232,220,0.03), 0 0 0 44px rgba(142,232,220,0.03), 0 0 0 66px rgba(142,232,220,0.03); }
.hero p { max-width: 600px; margin: 14px 0 0; color: #d9e6ee; font-size: 1.05rem; }
.hero h2 { max-width: 680px; margin: 10px 0 0; font-size: clamp(2rem, 4vw, 3.8rem); line-height: 1; letter-spacing: -0.055em; }
.hero-actions { position: relative; z-index: 1; display: flex; gap: 9px; flex-wrap: wrap; margin-top: 23px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 37px; padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); font-size: 0.76rem; background: rgba(255,255,255,0.07); transition: all 150ms ease; }
.button.primary { border-color: var(--cyan); color: var(--bg); font-weight: 800; background: var(--cyan); }
.button:hover { transform: translateY(-1px); border-color: var(--cyan); }
.button.primary:hover { box-shadow: 0 9px 24px rgba(73,205,188,0.22); }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 25px 0 36px; }
.section-card { display: block; min-height: 145px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,0.025); transition: border 150ms ease, transform 150ms ease, background 150ms ease; }
.section-card:hover { transform: translateY(-2px); border-color: rgba(142,232,220,0.36); background: rgba(142,232,220,0.055); }
.section-card h3 { margin: 6px 0 8px; color: var(--text); font-size: 1.03rem; }
.section-card p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.section-card .card-count { display: inline-block; margin-top: 15px; color: var(--cyan); font-size: 0.68rem; }
.quote-panel { margin: 30px 0; padding: 26px; border-top: 1px solid rgba(255,255,255,0.13); border-bottom: 1px solid rgba(255,255,255,0.13); }
.quote-panel p { margin: 0; color: var(--text); font-size: clamp(1.4rem, 3vw, 2.5rem); letter-spacing: -0.04em; line-height: 1.08; }
.quote-panel small { display: block; margin-top: 13px; color: var(--cyan); font-size: 0.73rem; }

.search-modal[hidden] { display: none; }
.search-modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: start center; padding-top: 11vh; }
.search-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 11, 0.75); backdrop-filter: blur(10px); }
.search-dialog { position: relative; width: min(680px, calc(100% - 30px)); max-height: 78vh; overflow: auto; padding: 21px; border: 1px solid var(--line-strong); border-radius: 17px; background: #121824; box-shadow: var(--shadow); }
.search-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.search-dialog h2 { margin: 8px 0 0; font-size: 1.35rem; letter-spacing: -0.03em; }
.icon-button { width: 31px; height: 31px; font-size: 1.25rem; line-height: 1; }
.search-input-wrap { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #0d141e; }
.search-input-wrap input { width: 100%; padding: 13px 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-input-wrap input::placeholder { color: var(--muted-2); }
.search-hint { margin: 11px 0 0; color: var(--muted-2); font-size: 0.73rem; }
.search-results { margin-top: 19px; }
.search-empty { padding: 22px 0; color: var(--muted-2); font-size: 0.8rem; }
.search-result { display: block; margin: 8px 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,0.025); }
.search-result:hover { border-color: rgba(142,232,220,0.4); background: rgba(142,232,220,0.055); }
.search-result .result-section { color: var(--cyan); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.search-result h3 { margin: 4px 0 4px; color: var(--text); font-size: 0.95rem; }
.search-result p { margin: 0; color: var(--muted); font-size: 0.76rem; line-height: 1.45; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .right-rail { display: none; }
}

@media (max-width: 780px) {
  .topbar { min-height: 64px; padding: 0 15px; }
  .topbar-actions { gap: 8px; }
  .top-link { display: none; }
  .search-trigger { min-width: 0; width: 40px; height: 38px; justify-content: center; padding: 0; }
  .search-trigger span:not(.search-icon), .search-trigger kbd { display: none; }
  .layout { display: block; width: min(100% - 28px, 720px); }
  .sidebar { position: static; height: auto; padding: 18px 0 0; }
  .sidebar-intro { padding: 0 0 14px; }
  .sidebar-intro p { max-width: 530px; }
  .nav-tree { display: flex; gap: 7px; overflow-x: auto; padding: 13px 0 14px; scrollbar-width: none; }
  .nav-section { flex: 0 0 auto; margin: 0; }
  .nav-section-title { display: none; }
  .nav-section .nav-link { display: none; }
  .nav-section:first-child .nav-link:first-of-type, .nav-section:nth-child(2) .nav-link:first-of-type, .nav-section:nth-child(3) .nav-link:first-of-type, .nav-section:nth-child(4) .nav-link:first-of-type, .nav-section:nth-child(5) .nav-link:first-of-type, .nav-section:nth-child(6) .nav-link:first-of-type, .nav-section:nth-child(7) .nav-link:first-of-type, .nav-section:nth-child(8) .nav-link:first-of-type, .nav-section:nth-child(9) .nav-link:first-of-type { display: block; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; white-space: nowrap; font-size: 0.68rem; }
  .sidebar-footer { display: none; }
  .content { padding: 30px 0 70px; }
  .article h1 { font-size: clamp(2.35rem, 14vw, 4rem); }
  .article-summary { font-size: 0.98rem; }
  .article-tools { width: 100%; margin-left: 0; }
  .section-grid, .split-grid { grid-template-columns: 1fr; }
  .hero { padding: 23px; }
}

@media print {
  .topbar, .sidebar, .right-rail, .article-tools, .search-modal { display: none !important; }
  body { background: white; color: black; }
  .layout { display: block; width: auto; margin: 0; }
  .content { padding: 0; }
  .article { max-width: none; }
  .article h1, .prose h2, .prose h3, .prose p, .prose li { color: black; }
}
