:root {
  --primary: #3157ff;
  --primary-2: #7b61ff;
  --accent: #ff7a1a;
  --ink: #172033;
  --muted: #667085;
  --bg: #f6f8ff;
  --card: rgba(255, 255, 255, 0.94);
  --line: #dce4ff;
  --shadow: 0 18px 52px rgba(31, 45, 92, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.82;
  background:
    radial-gradient(circle at 8% 4%, rgba(49, 87, 255, 0.22), transparent 28%),
    radial-gradient(circle at 94% 6%, rgba(255, 122, 26, 0.18), transparent 26%),
    linear-gradient(180deg, #fbfcff, var(--bg), #eef3ff);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246, 248, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(100% - 36px, 1220px);
  min-height: 72px;
  margin: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 1000;
  white-space: nowrap;
}

.logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.navlinks {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  white-space: nowrap;
}

.navlinks a {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: #334155;
  font-size: 14px;
  font-weight: 900;
  border-radius: 999px;
}

.navlinks a:hover {
  color: var(--primary);
  background: #e8edff;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
  width: min(100% - 36px, 1220px);
  margin: auto;
  padding: 80px 0 42px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 1.03;
  letter-spacing: -0.08em;
}

.gradient-text {
  color: transparent;
  background: linear-gradient(120deg, var(--primary), var(--primary-2), var(--accent));
  background-clip: text;
  -webkit-background-clip: text;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
}

.badgebar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.badge {
  padding: 9px 13px;
  color: #334155;
  font-weight: 900;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.stats-card {
  padding: 24px;
  border: 1px solid #fff;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.stat {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 13px;
  align-items: center;
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8faff;
}

.stat:last-child {
  margin-bottom: 0;
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  font-style: normal;
  font-weight: 1000;
  border-radius: 14px;
  background: #fff;
}

.stat small {
  display: block;
  color: var(--muted);
}

.stat b {
  color: #ef4444;
  font-size: 20px;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 26px;
  width: min(100% - 36px, 1220px);
  margin: 0 auto 70px;
}

.toc {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 118px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #fff;
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.toc h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.toc a {
  display: block;
  margin: 4px 0;
  padding: 8px 10px;
  color: #475569;
  font-size: 14px;
  border-radius: 12px;
}

.toc a.level-3 {
  padding-left: 22px;
  color: #64748b;
  font-size: 13px;
}

.toc a:hover {
  color: var(--primary);
  background: #eef3ff;
}

.section-card {
  overflow: hidden;
  margin-bottom: 22px;
  padding: 30px;
  border: 1px solid #fff;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.section-card h2,
.section-card h3 {
  scroll-margin-top: 90px;
}

.section-card h2 {
  margin: 0 0 18px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.18;
  letter-spacing: -0.05em;
}

.section-card h3 {
  margin: 28px 0 12px;
  font-size: 23px;
}

.section-card h4 {
  margin: 22px 0 10px;
  padding: 10px 13px;
  font-size: 18px;
  border-left: 5px solid var(--accent);
  border-radius: 12px;
  background: #fff7ed;
}

.section-card p {
  margin: 10px 0;
  color: #344054;
}

.section-card ul,
.section-card ol {
  padding-left: 24px;
  color: #344054;
}

.section-card li {
  margin: 6px 0;
}

.section-card strong {
  color: #111827;
}

.section-card blockquote {
  margin: 14px 0;
  padding: 15px 18px;
  font-weight: 800;
  border-left: 5px solid var(--primary);
  border-radius: 16px;
  background: #f6f8ff;
}

.section-card hr {
  height: 1px;
  margin: 22px 0;
  border: 0;
  background: var(--line);
}

.code-block {
  overflow: auto;
  margin: 14px 0;
  padding: 18px;
  color: #e6edf7;
  white-space: pre-wrap;
  border: 1px solid #1f2937;
  border-radius: 18px;
  background: #101828;
}

code {
  font-family: "Cascadia Code", Consolas, monospace;
}

p code,
li code {
  padding: 2px 6px;
  color: #223dcc;
  border-radius: 7px;
  background: #eef3ff;
}

table {
  width: 100%;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-spacing: 0;
  border-collapse: separate;
  border-radius: 18px;
  background: #fff;
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  font-weight: 1000;
  background: linear-gradient(135deg, #eef3ff, #fff5ed);
}

tr:last-child td {
  border-bottom: 0;
}

.float-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  padding: 11px 15px;
  color: #fff;
  font-weight: 1000;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #ff4d4d);
  box-shadow: 0 18px 42px rgba(255, 122, 26, 0.32);
}

.menu-toggle,
.mobile-drawer,
.drawer-mask {
  display: none;
}

.menu-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(31, 45, 92, 0.08);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  border-radius: 999px;
  background: var(--ink);
}

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(82vw, 320px);
  height: 100vh;
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(15, 23, 42, 0.18);
  transform: translateX(104%);
  transition: transform 0.25s ease;
  backdrop-filter: blur(18px);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-close {
  width: 36px;
  height: 36px;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  border: 0;
  border-radius: 12px;
  background: #eef3ff;
}

.mobile-drawer a {
  display: block;
  margin-bottom: 10px;
  padding: 13px 14px;
  color: #263247;
  font-weight: 900;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff, #f7f9ff);
}

.drawer-open {
  overflow: hidden;
}

.drawer-open .drawer-mask {
  opacity: 1;
  pointer-events: auto;
}

.drawer-open .mobile-drawer {
  transform: translateX(0);
}

.footer {
  padding: 36px 0 46px;
  color: #64748b;
  text-align: center;
  border-top: 1px solid var(--line);
}

@media (max-width: 980px) {
  .navbar {
    min-height: 60px;
    align-items: center;
    flex-direction: row;
    gap: 12px;
    padding: 8px 0;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .logo {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .navlinks {
    display: none;
  }

  .menu-toggle,
  .mobile-drawer,
  .drawer-mask {
    display: block;
  }

  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 40px;
  }

  .toc {
    position: relative;
    top: auto;
    max-height: 360px;
  }
}

@media (max-width: 560px) {
  .navbar,
  .hero,
  .layout {
    width: min(100% - 24px, 1220px);
  }

  .topbar {
    background: rgba(246, 248, 255, 0.94);
  }

  .navbar {
    min-height: 54px;
  }

  .brand {
    gap: 9px;
  }

  .brand span:last-child {
    max-width: calc(100vw - 126px);
    font-size: 15px;
  }

  .logo {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 15px;
  }

  .menu-toggle {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .mobile-drawer {
    width: min(86vw, 310px);
    padding: 16px;
  }

  .hero {
    padding-top: 32px;
  }

  .section-card h2,
  .section-card h3 {
    scroll-margin-top: 66px;
  }

  .section-card {
    padding: 20px;
    border-radius: 22px;
  }

  th,
  td {
    padding: 10px;
    font-size: 14px;
  }

  .float-top {
    right: 14px;
    left: 14px;
    text-align: center;
  }
}
