:root {
  color-scheme: light;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --paper: #ffffff;
  --bg: #f7f8fb;
  --bg-subtle: #f1f5f9;
  --accent: #0b5fff;
  --accent-hover: #0847c4;
  --accent-bg: #eef4ff;
  --accent-ring: rgba(11, 95, 255, 0.24);
  --emerald: #0f766e;
  --emerald-bg: #ecfdf5;
  --code-bg: #0f172a;
  --code-ink: #e2e8f0;
  --inline-code-bg: #eef2f7;
  --quote-bg: #f4f8ff;
  --header-bg: rgba(255, 255, 255, 0.88);
  --hero-grad: radial-gradient(120% 100% at 100% 0%, rgba(11, 95, 255, 0.12) 0%, rgba(15, 118, 110, 0.05) 45%, rgba(255, 255, 255, 0) 75%), linear-gradient(155deg, #ffffff 30%, #f3f7ff 100%);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
  --mark-bg: #fef08a;
  --mark-ink: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eef2f9;
  --ink-soft: #cbd5e1;
  --muted: #94a3b8;
  --line: #1e293b;
  --line-strong: #334155;
  --paper: #111827;
  --bg: #0b101b;
  --bg-subtle: #162033;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-bg: rgba(96, 165, 250, 0.14);
  --accent-ring: rgba(96, 165, 250, 0.35);
  --emerald: #34d399;
  --emerald-bg: rgba(52, 211, 153, 0.12);
  --code-bg: #070b14;
  --code-ink: #e2e8f0;
  --inline-code-bg: #1c273d;
  --quote-bg: rgba(96, 165, 250, 0.08);
  --header-bg: rgba(11, 16, 27, 0.86);
  --hero-grad: radial-gradient(120% 100% at 100% 0%, rgba(96, 165, 250, 0.18) 0%, rgba(52, 211, 153, 0.08) 45%, rgba(17, 24, 39, 0) 75%), linear-gradient(155deg, #111827 30%, #0f172a 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.36);
  --mark-bg: rgba(250, 204, 21, 0.26);
  --mark-ink: #fef08a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.48rem 0.85rem;
  font-weight: 500;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

button:hover {
  border-color: var(--line-strong);
  background: var(--bg-subtle);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 2px;
}

/* Reading Progress Bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #10b981);
  z-index: 40;
  pointer-events: none;
  transition: width 0.08s linear;
}

.skip {
  position: absolute;
  top: -100px;
  left: 1rem;
  padding: 0.7rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  z-index: 50;
}

.skip:focus {
  top: 1rem;
}

/* Header */
.top {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem clamp(1rem, 3.5vw, 2.6rem);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.wordmark:hover {
  color: var(--ink);
}

.brand-mark {
  color: var(--accent);
  flex-shrink: 0;
}

.wordmark b {
  display: block;
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.wordmark small {
  display: block;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.25;
}

.top nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.86rem;
  flex-wrap: wrap;
}

.top nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  padding: 0.32rem 0.55rem;
  border-radius: 8px;
}

.top nav a:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

.wechat-btn {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: transparent;
  font-size: 0.84rem;
  font-weight: 600;
}

.wechat-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.theme-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

/* Main 2/3-Column Shell */
.shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  max-width: 1460px;
  margin: 0 auto;
  gap: 1.5rem;
  padding: 1.4rem clamp(0.9rem, 3vw, 2.4rem) 3rem;
  align-items: start;
}

.shell.has-toc {
  grid-template-columns: 260px minmax(0, 1fr) 216px;
}

/* Left Sidebar */
.sidebar {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.sidebar summary {
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar summary::-webkit-details-marker {
  display: none;
}

.sidebar summary::after {
  content: "▾";
  font-size: 0.82rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.sidebar details:not([open]) summary::after {
  transform: rotate(-90deg);
}

.nav-group h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 1.25rem 0 0.4rem;
  padding-left: 0.5rem;
}

.navlinks ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.navlinks a {
  display: block;
  padding: 0.36rem 0.6rem;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.42;
  border-radius: 8px;
  margin-bottom: 1px;
}

.navlinks a:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.navlinks a[aria-current="page"] {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* Right Sticky TOC */
.toc-rail {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-left: 0.25rem;
}

.toc-inner {
  border-left: 1px solid var(--line);
  padding: 0.2rem 0 0.2rem 0.9rem;
}

.toc-inner h2 {
  margin: 0 0 0.65rem;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.toc-inner ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-inner li {
  margin-bottom: 0.35rem;
}

.toc-inner li.toc-h3 {
  padding-left: 0.75rem;
}

.toc-inner a {
  display: block;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 0.55rem;
  margin-left: -0.95rem;
}

.toc-inner a:hover,
.toc-inner a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* Main Column */
main {
  min-width: 0;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

/* Search Box */
.searchbox {
  padding: 0.85rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.38rem;
}

.searchbox label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.kbd-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.kbd-hint kbd {
  display: inline-block;
  padding: 0.08rem 0.38rem;
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-subtle);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink-soft);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="search"] {
  width: 100%;
  padding: 0.68rem 2.2rem 0.68rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--bg);
  font-size: 0.94rem;
}

input[type="search"]:focus {
  border-color: var(--accent);
  background: var(--paper);
}

.search-clear {
  position: absolute;
  right: 0.45rem;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  border-radius: 7px;
}

.search-clear:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

#fn-results:empty {
  display: none;
}

#fn-results {
  margin-top: 0.65rem;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-meta {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 0.25rem 0.2rem;
}

.search-hit {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
}

.search-hit:hover,
.search-hit.is-active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.search-hit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.search-hit-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
}

.search-hit-cat {
  font-size: 0.72rem;
  padding: 0.12rem 0.48rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.search-hit-snippet {
  margin: 0.25rem 0 0;
  font-size: 0.81rem;
  color: var(--muted);
  line-height: 1.5;
}

.search-hit mark {
  background: var(--mark-bg);
  color: var(--mark-ink);
  padding: 0 0.16rem;
  border-radius: 3px;
}

/* Homepage Hero */
.hero {
  border: 1px solid var(--line);
  background: var(--hero-grad);
  padding: clamp(1.6rem, 4.5vw, 3.2rem);
  border-radius: 22px;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  font-weight: 700;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.hero h1 {
  font-size: clamp(2.15rem, 4.8vw, 3.45rem);
  line-height: 1.12;
  letter-spacing: -0.05em;
  margin: 0.85rem 0 0.7rem;
  color: var(--ink);
}

.hero-lead {
  max-width: 620px;
  font-size: 1.06rem;
  line-height: 1.72;
  color: var(--ink-soft);
  margin: 0;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 1.35rem 0 0;
}

.actions a {
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  padding: 0.62rem 1.05rem;
  font-size: 0.92rem;
}

.primary {
  background: var(--accent);
  color: #fff !important;
  border: 1px solid var(--accent);
  box-shadow: 0 4px 14px rgba(11, 95, 255, 0.25);
}

.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}

.secondary {
  background: var(--paper);
  color: var(--ink) !important;
  border: 1px solid var(--line-strong);
}

.secondary:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
}

.ghost {
  background: transparent;
  color: var(--ink-soft) !important;
  border: 1px solid var(--line);
}

.ghost:hover {
  background: var(--bg-subtle);
  color: var(--ink) !important;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  border-top: 1px solid var(--line);
  margin-top: 1.8rem;
  padding-top: 1.25rem;
}

.metric b {
  display: block;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.metric span {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Route Cards */
.routes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.route {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 1.1rem 1.15rem;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.route:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.route-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-bg);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.route-icon svg {
  width: 18px;
  height: 18px;
}

.route strong {
  font-size: 1rem;
  line-height: 1.35;
}

.route span {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.52;
}

.route .arrow {
  color: var(--accent);
  font-weight: 600;
  margin-top: auto;
  padding-top: 0.4rem;
}

/* Platform Strip */
.platform-strip {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.05rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.strip-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.strip-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.platform-pill {
  display: inline-block;
  padding: 0.26rem 0.68rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--bg-subtle);
  border: 1px solid transparent;
}

.platform-pill:hover {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent);
}

/* Inner Page Meta & Breadcrumbs */
.doc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding: 0 0.2rem;
  font-size: 0.83rem;
}

.breadcrumbs {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.doc-stats {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.stat-pill {
  padding: 0.16rem 0.58rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 0.78rem;
}

.edit-link {
  text-decoration: none;
  font-size: 0.8rem;
  color: var(--muted);
}

.edit-link:hover {
  color: var(--accent);
}

/* Article Typography */
.doc-article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(1.25rem, 3.2vw, 2.5rem);
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-sm);
}

.doc-article h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.25rem);
  line-height: 1.28;
  letter-spacing: -0.03em;
  margin-top: 0;
  margin-bottom: 1rem;
}

.doc-article.is-home > h1:first-child {
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.doc-article h2 {
  font-size: 1.38rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin-top: 2.3rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.42rem;
}

.doc-article h3 {
  font-size: 1.12rem;
  margin-top: 1.6rem;
  margin-bottom: 0.55rem;
}

.doc-article h1,
.doc-article h2,
.doc-article h3 {
  scroll-margin-top: 90px;
}

.doc-article p,
.doc-article li {
  color: var(--ink-soft);
  max-width: 78ch;
}

.doc-article strong {
  color: var(--ink);
}

.doc-article ul,
.doc-article ol {
  padding-left: 1.45rem;
}

.doc-article li {
  margin-bottom: 0.35rem;
}

.doc-article hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.8rem 0;
}

/* Code Blocks */
.code-wrap {
  position: relative;
  margin: 1.15rem 0;
}

.doc-article pre {
  overflow-x: auto;
  padding: 1.1rem 1.2rem;
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--code-ink);
  white-space: pre;
  line-height: 1.58;
  font-size: 0.87rem;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.code-copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.25rem 0.62rem;
  font-size: 0.75rem;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
}

.code-copy:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.doc-article code {
  font-size: 0.87em;
  background: var(--inline-code-bg);
  color: var(--ink);
  padding: 0.12em 0.38em;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.doc-article pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

/* Blockquotes */
.doc-article blockquote {
  border-left: 3.5px solid var(--accent);
  margin: 1.15rem 0;
  padding: 0.72rem 1.1rem;
  background: var(--quote-bg);
  border-radius: 0 10px 10px 0;
  color: var(--ink-soft);
}

.doc-article blockquote p {
  margin: 0.2rem 0;
}

/* Tables */
.doc-article table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  width: 100%;
  font-size: 0.89rem;
  margin: 1.2rem 0;
}

.doc-article th,
.doc-article td {
  border: 1px solid var(--line);
  padding: 0.6rem 0.8rem;
  text-align: left;
  min-width: 100px;
  vertical-align: top;
}

.doc-article th {
  background: var(--bg-subtle);
  color: var(--ink);
  font-weight: 600;
}

.doc-article tbody tr:hover {
  background: var(--bg);
}

.doc-article img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

/* Prev / Next Pager */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1.2rem;
}

.pager-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.pager-card:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pager-card.next {
  text-align: right;
}

.pager-kicker {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

.pager-card strong {
  font-size: 0.94rem;
  line-height: 1.4;
}

/* Author Brand Footer */
.author {
  margin: 1.3rem 0 2rem;
  padding: 1.55rem 1.65rem;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.author-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.author strong {
  font-size: 1.18rem;
  color: var(--ink);
}

.author-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald);
  background: var(--emerald-bg);
  padding: 0.2rem 0.62rem;
  border-radius: 999px;
}

.author p {
  color: var(--ink-soft);
  margin: 0.65rem 0 0;
  font-size: 0.93rem;
}

.author small {
  display: block;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.author #fn-copy-status {
  margin: 0.45rem 0 0;
  color: var(--accent);
  font-size: 0.84rem;
  min-height: 1.1em;
}

/* Back-to-top & Toast */
.backtop {
  position: fixed;
  right: 1.35rem;
  bottom: 1.4rem;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  font-size: 1.1rem;
  font-weight: 700;
  z-index: 25;
}

.backtop:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  background: #0f172a;
  color: #f8fafc;
  padding: 0.62rem 1.1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

[data-theme="dark"] .toast {
  background: #f8fafc;
  color: #0f172a;
}

/* Responsive Breakpoints */
@media (max-width: 1180px) {
  .shell.has-toc {
    grid-template-columns: 250px minmax(0, 1fr);
  }
  .toc-rail {
    display: none;
  }
  .routes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .top {
    position: sticky;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
  }
  .top nav {
    gap: 0.45rem;
    font-size: 0.82rem;
  }
  .shell,
  .shell.has-toc {
    grid-template-columns: 1fr;
    gap: 0.9rem;
    padding: 0.9rem 0.85rem 2.5rem;
  }
  .sidebar {
    position: static;
    max-height: none;
  }
  .sidebar details[open] .navlinks {
    max-height: 52vh;
    overflow-y: auto;
    margin-top: 0.4rem;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .routes {
    grid-template-columns: 1fr;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .kbd-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}

@media print {
  .top,
  .sidebar,
  .toc-rail,
  .searchbox,
  .pager,
  .backtop,
  .progress-bar,
  .code-copy {
    display: none !important;
  }
  .shell,
  .shell.has-toc {
    display: block;
    padding: 0;
  }
  .doc-article {
    border: none;
    box-shadow: none;
    padding: 0;
  }
}
