:root {
	--brand: #2d0f57;
	--brand-2: #4c1d95;
	--accent: #7c3aed;
	--accent-soft: #f3edff;
	--bg: #f7f6fb;
	--surface: #ffffff;
	--text: #1d1a26;
	--muted: #5b5670;
	--line: #e4e0ef;
	--note: #2563eb;
	--note-bg: #eef4ff;
	--tip: #15803d;
	--tip-bg: #ecfdf3;
	--warn: #b45309;
	--warn-bg: #fff7e8;
	--danger: #b91c1c;
	--danger-bg: #fef1f1;
	--shadow: 0 1px 2px rgb(20 10 40 / 6%), 0 4px 16px rgb(20 10 40 / 6%);
	--radius: 12px;
	--font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #14111c;
		--surface: #1d1928;
		--text: #ece9f4;
		--muted: #aaa3bf;
		--line: #322b44;
		--accent: #a78bfa;
		--accent-soft: #2a2140;
		--note: #93b4ff;
		--note-bg: #172038;
		--tip: #6ee7a0;
		--tip-bg: #12271c;
		--warn: #fbbf63;
		--warn-bg: #2b2110;
		--danger: #fca5a5;
		--danger-bg: #2d1515;
		--shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
		color-scheme: dark;
	}
}
:root[data-theme="dark"] {
	--bg: #14111c;
	--surface: #1d1928;
	--text: #ece9f4;
	--muted: #aaa3bf;
	--line: #322b44;
	--accent: #a78bfa;
	--accent-soft: #2a2140;
	--note: #93b4ff;
	--note-bg: #172038;
	--tip: #6ee7a0;
	--tip-bg: #12271c;
	--warn: #fbbf63;
	--warn-bg: #2b2110;
	--danger: #fca5a5;
	--danger-bg: #2d1515;
	--shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
	color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.icon { width: 18px; height: 18px; flex: none; }
.icon.big { width: 28px; height: 28px; color: var(--accent); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 20px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; white-space: nowrap; font-size: 17px; }
.brand b { font-weight: 600; opacity: .85; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #fff; color: var(--brand); font-weight: 800; font-size: 14px; letter-spacing: -.5px; }
.menu-btn { display: none; background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; }
.menu-btn .icon { width: 24px; height: 24px; }
.search { position: relative; margin-left: auto; width: min(460px, 50vw); }
.search input, .hero-search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-size: 15px; background: rgb(255 255 255 / 14%); color: #fff; outline: none; }
.search input::placeholder { color: rgb(255 255 255 / 75%); }
.search input:focus { background: #fff; color: #1d1a26; }
.search-icon { position: absolute; left: 12px; top: 11px; pointer-events: none; opacity: .8; }
.search:focus-within .search-icon { color: #1d1a26; }
.results { position: absolute; top: 46px; right: 0; width: min(560px, 92vw); max-height: 70vh; overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
.results a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: inherit; }
.results a:hover, .results a.active { background: var(--accent-soft); }
.results .t { display: block; font-weight: 600; color: var(--accent); }
.results .c { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.results .s { display: block; font-size: 14px; color: var(--muted); }
.results .empty { padding: 12px; color: var(--muted); }
mark { background: #fde68a; color: inherit; border-radius: 2px; }

/* layout */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 32px; max-width: 1440px; margin: 0 auto; padding: 24px 24px 64px; }
.layout.has-toc { grid-template-columns: 290px minmax(0, 1fr) 220px; }
.sidebar { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 104px); overflow: auto; font-size: 14.5px; padding-right: 4px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar summary { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary:hover { background: var(--accent-soft); }
.sidebar summary .icon { color: var(--accent); }
.sidebar .count { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.sidebar details ul { margin: 2px 0 8px 19px; padding-left: 10px; border-left: 2px solid var(--line); }
.sidebar details a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; line-height: 1.35; }
.sidebar details a:hover { color: var(--text); background: var(--accent-soft); }
.sidebar a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
main { min-width: 0; }

/* article */
.crumbs { display: flex; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.article, .cat-head, .article-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.article { padding: 36px 44px 44px; }
.article h1, .cat-head h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.2; letter-spacing: -.01em; }
.lede { margin: 0 0 16px; font-size: 18px; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 12.5px; }
.article h2 { margin: 36px 0 12px; font-size: 23px; line-height: 1.3; padding-top: 8px; }
.article h3 { margin: 28px 0 8px; font-size: 18.5px; }
.article h4 { margin: 20px 0 6px; font-size: 16px; }
.article .anchor { float: left; margin-left: -22px; width: 22px; color: var(--line); text-decoration: none; font-weight: 400; opacity: 0; }
.article h2:hover .anchor, .article h3:hover .anchor { opacity: 1; color: var(--muted); }
.article p, .article li { max-width: 78ch; }
.article ol, .article ul { padding-left: 1.5em; }
.article li { margin: 6px 0; }
.article li > p { margin: 6px 0; }
.article ol > li::marker { font-weight: 700; color: var(--accent); }
.article strong { font-weight: 650; }
.article code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .9em; background: var(--accent-soft); padding: 1px 6px; border-radius: 5px; }
.article kbd { font-family: inherit; font-size: .85em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--bg); }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.shot { margin: 16px 0 22px; }
.shot a { display: inline-block; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow); cursor: zoom-in; background: #fff; }
.shot img { display: block; max-width: 100%; height: auto; }
.shot figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); }
li .shot { margin: 10px 0 14px; }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg); font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.callout { margin: 18px 0; padding: 14px 18px; border-radius: 10px; border-left: 4px solid var(--note); background: var(--note-bg); }
.callout p { margin: 4px 0; }
.callout-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--note); }
.callout-tip { border-color: var(--tip); background: var(--tip-bg); }
.callout-tip .callout-title { color: var(--tip); }
.callout-important, .callout-admin-only { border-color: var(--warn); background: var(--warn-bg); }
.callout-important .callout-title, .callout-admin-only .callout-title { color: var(--warn); }
.callout-warning { border-color: var(--danger); background: var(--danger-bg); }
.callout-warning .callout-title { color: var(--danger); }
.callout-example { border-color: var(--muted); background: var(--bg); }
.callout-example .callout-title { color: var(--muted); }
blockquote { margin: 16px 0; padding: 4px 18px; border-left: 4px solid var(--line); color: var(--muted); }
.related { margin-top: 40px; padding-top: 8px; border-top: 1px solid var(--line); }
.related ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.related li { max-width: none; }
.related a { font-weight: 600; }
.related span { display: block; font-size: 14px; color: var(--muted); }

/* toc */
.toc { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 104px); overflow: auto; font-size: 13.5px; }
.toc-title { font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li a { display: block; padding: 4px 12px; color: var(--muted); text-decoration: none; line-height: 1.35; margin-left: -2px; border-left: 2px solid transparent; }
.toc li.d3 a { padding-left: 24px; font-size: 13px; }
.toc li a:hover { color: var(--text); }
.toc li a.active { color: var(--accent); border-left-color: var(--accent); }

/* category + home */
.cat-head { display: flex; gap: 16px; align-items: flex-start; padding: 28px 32px; margin-bottom: 20px; }
.cat-head .lede { margin: 0; }
.article-list { list-style: none; margin: 0; padding: 6px; }
.article-list a { display: block; padding: 14px 18px; border-radius: 10px; text-decoration: none; color: inherit; }
.article-list a:hover { background: var(--accent-soft); }
.article-list .t { display: block; font-weight: 650; color: var(--accent); font-size: 17px; }
.article-list .s { display: block; color: var(--muted); font-size: 15px; }
.article-list .badge { margin-top: 6px; }
.hero { text-align: center; padding: 48px 16px 36px; border-radius: 18px; background: linear-gradient(135deg, var(--brand), var(--brand-2) 60%, #6d28d9); color: #fff; margin-bottom: 28px; }
.hero h1 { margin: 0 0 8px; font-size: 38px; letter-spacing: -.02em; }
.hero p { margin: 0 0 24px; opacity: .9; font-size: 18px; }
.hero-search { position: relative; max-width: 620px; margin: 0 auto; }
.hero-search input { height: 52px; font-size: 17px; background: #fff; color: #1d1a26; padding-left: 44px; box-shadow: 0 8px 30px rgb(0 0 0 / 20%); }
.hero-search .search-icon { color: #5b5670; top: 17px; left: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .t { font-weight: 700; font-size: 18px; color: var(--text); }
.card .s { color: var(--muted); font-size: 14.5px; flex: 1; }
.card .n { font-size: 13px; color: var(--accent); font-weight: 600; }
.popular { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 28px 20px; box-shadow: var(--shadow); }
.popular ul { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; padding-left: 1.2em; }
.popular li { margin: 6px 0; }
.footer { text-align: center; color: var(--muted); font-size: 14px; padding: 0 16px 40px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgb(10 5 20 / 85%); padding: 24px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; box-shadow: 0 10px 40px rgb(0 0 0 / 50%); }
.lightbox button { position: absolute; top: 12px; right: 18px; font-size: 34px; line-height: 1; background: none; border: 0; color: #fff; cursor: pointer; }

/* responsive */
@media (max-width: 1180px) {
	.layout.has-toc { grid-template-columns: 260px minmax(0, 1fr); }
	.toc { display: none; }
	.layout { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (max-width: 860px) {
	.menu-btn { display: block; }
	.brand b { display: none; }
	.search { width: auto; flex: 1; }
	.layout, .layout.has-toc { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 48px; }
	.sidebar { position: fixed; top: 64px; left: 0; bottom: 0; z-index: 15; width: min(320px, 86vw); max-height: none; padding: 16px; background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(-105%); transition: transform .18s; }
	body.nav-open .sidebar { transform: none; }
	.article { padding: 24px 18px 32px; }
	.article h1, .cat-head h1 { font-size: 26px; }
	.article .anchor { display: none; }
	.cat-head { padding: 20px; }
	.hero h1 { font-size: 28px; }
	.popular ul { grid-template-columns: 1fr; }
}
@media print {
	.topbar, .sidebar, .toc, .footer { display: none; }
	.layout { display: block; padding: 0; }
	.article { border: 0; box-shadow: none; padding: 0; }
}
