:root {
  --qd-red: #3f51b5;
  --qd-red-hover: #303f9f;
  --qd-ink: #1a237e;
  --qd-navy: #1a237e;
  --qd-muted: #7986cb;
  --qd-muted-2: #5c6bc0;
  --qd-line: #c5cae9;
  --qd-line-2: #e8eaf6;
  --qd-soft: #f5f6fb;
  --qd-panel: #ffffff;
  --qd-code: #12163a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  color: var(--qd-ink);
  background: var(--qd-panel);
  font: 16px/1.65 Inter, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}
a { color: var(--qd-red); text-decoration: none; }
a:hover { text-decoration: underline; }

.qd-top {
  position: sticky; top: 0; z-index: 40;
  height: 72px;
  display: flex; align-items: center; gap: 20px;
  padding: 0 28px;
  background: var(--qd-panel);
  border-bottom: 1px solid var(--qd-line-2);
}
.qd-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--qd-navy); font-weight: 700; text-decoration: none;
}
.qd-brand img { height: 28px; width: auto; }
.qd-search {
  flex: 1; max-width: 420px; height: 40px;
  border: 1px solid var(--qd-line); border-radius: 10px;
  padding: 0 14px; background: var(--qd-soft); color: var(--qd-ink); font: inherit;
}
.qd-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.qd-ghost {
  border: 0; background: transparent; color: var(--qd-muted-2);
  font: inherit; cursor: pointer;
}
.qd-cloud {
  background: var(--qd-red); color: #fff; border-radius: 10px;
  padding: 8px 16px; font-weight: 600; text-decoration: none;
}
.qd-cloud:hover { background: var(--qd-red-hover); text-decoration: none; }
.qd-tabs {
  display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.qd-tabs::-webkit-scrollbar { display: none; }
.qd-tabs .tab {
  border: 0; background: transparent; color: var(--qd-navy);
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.qd-tabs .tab:hover { color: var(--qd-red); }
.qd-tabs .tab.active { color: var(--qd-red); }
.qd-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 220px;
  min-height: calc(100vh - 72px);
}
.qd-side, .qd-toc {
  position: sticky; top: 72px; height: calc(100vh - 72px);
  overflow: auto; padding: 20px 14px 48px;
}
.qd-side { border-right: 1px solid var(--qd-line-2); background: var(--qd-soft); }
.qd-toc { border-left: 1px solid var(--qd-line-2); }
.group-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--qd-muted); margin: 18px 8px 6px;
}
.nav-link {
  display: block; padding: 6px 10px; border-radius: 8px;
  color: var(--qd-ink); font-size: 14px;
}
.nav-link:hover { text-decoration: none; background: #fff; color: var(--qd-red); }
.nav-link.active { color: var(--qd-red); background: #fff; font-weight: 650; }
.qd-main { padding: 32px 48px 80px; max-width: 880px; }
.crumb { color: var(--qd-muted-2); font-size: 13px; margin-bottom: 10px; }
.page-title { font-size: 36px; line-height: 1.15; color: var(--qd-navy); margin: 0 0 10px; }
.page-desc { color: var(--qd-muted-2); margin: 0 0 20px; }
.qd-note {
  background: #e8eaf6; border: 1px solid #c5cae9; color: #1a237e;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}
.qd-note.warn { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.source-line { font-size: 13px; }
.content h2 { margin-top: 36px; color: var(--qd-navy); }
.content table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
.content th, .content td { border: 1px solid var(--qd-line); padding: 8px 10px; }
.content th { background: var(--qd-soft); }
.content .mermaid {
  background: var(--qd-soft);
  border: 1px solid var(--qd-line);
  border-radius: 10px;
  padding: 16px;
  overflow: auto;
}
.content pre, .content .code-block {
  background: var(--qd-code); color: #e8edf5; padding: 14px 16px; border-radius: 10px; overflow: auto;
}
.content :not(pre) > code { background: var(--qd-soft); padding: 1px 5px; border-radius: 4px; }
.content img { max-width: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.content img.twemoji,
.content img.lg.middle,
.content img.doc-img.twemoji,
.content .admonition img,
.content .callout img {
  display: inline-block !important;
  height: 1.35em !important;
  width: auto !important;
  max-width: 1.8em !important;
  vertical-align: middle;
  margin: 0 4px;
}
.content img.doc-figure { margin: 16px auto; }
.content .hero { text-align: center; margin: 0 0 28px; }
.content .hero img { max-width: min(100%, 420px); margin: 0 auto 8px; }
.content .hero-tagline-slides .hero-tagline + .hero-tagline { display: none; }
.content .hero-tagline { color: var(--qd-muted-2); font-size: 17px; line-height: 1.55; }
.content .md-button {
  display: inline-flex; align-items: center;
  padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--qd-red); color: var(--qd-red);
  font-weight: 650; margin: 0 8px 8px 0; text-decoration: none !important;
}
.content .md-button:hover { background: color-mix(in srgb, var(--qd-red) 8%, #fff); }
.content a.md-button--primary,
.content .md-button--primary { background: var(--qd-red); color: #fff !important; }
.content .md-button--primary:hover { background: var(--qd-red-hover); }
.content .grid.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px; margin: 16px 0;
}
.content .md-card {
  background: var(--qd-soft); border: 1px solid var(--qd-line);
  border-radius: 14px; padding: 16px 18px;
}
.content .md-card p { margin: 8px 0; }
.content .md-icon { display: inline-block; margin-right: 6px; color: var(--qd-red); }
.content .admonition { background: var(--qd-soft); }
.content .admonition-title { margin: 0 0 8px; }
.content iframe.video-container { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; }
.callout { border: 1px solid var(--qd-line); border-radius: 10px; padding: 10px 14px; margin: 14px 0; }
.callout.warning { background: #e8eaf6; }
.tabs-box { border: 1px solid var(--qd-line); border-radius: 10px; overflow: hidden; margin: 16px 0; }
.tabs-bar { display: flex; flex-wrap: wrap; background: var(--qd-soft); border-bottom: 1px solid var(--qd-line); }
.tabs-bar button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--qd-muted-2); }
.tabs-bar button.active { background: #fff; color: var(--qd-red); font-weight: 650; }
.tab-panel { display: none; padding: 14px; }
.tab-panel.active { display: block; }
.qd-toc a { display: block; color: var(--qd-muted-2); font-size: 13px; padding: 4px 0; }
.search-hits {
  position: absolute; left: 280px; top: 72px; width: 420px; max-height: 60vh; overflow: auto;
  background: #fff; border: 1px solid var(--qd-line); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(26, 35, 126, 0.12); display: none; z-index: 50;
}
.search-hits a { display: block; padding: 8px 12px; color: var(--qd-ink); }
.search-hits a:hover { background: var(--qd-soft); text-decoration: none; }
@media (max-width: 1100px) {
  .qd-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .qd-toc { display: none; }
}
@media (max-width: 800px) {
  .qd-top { height: auto; flex-wrap: wrap; padding: 10px 16px; }
  .qd-tabs { flex: 1 1 100%; order: 3; padding-top: 4px; }
  .qd-layout { grid-template-columns: 1fr; }
  .qd-side { position: relative; height: auto; }
  .qd-main { padding: 20px 16px 60px; }
}
