:root {
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --surface: #ffffff;
  --surface-elevated: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --radius: 4px;
  --header: #4f46e5;
  --header-dark: #3f3fc4;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--surface-elevated);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 48px;
}

.page-header {
  background: var(--header);
  color: #ffffff;
  padding: 0 20px 44px;
  border-bottom: 3px solid var(--header-dark);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 7px 13px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  transition: background 0.15s ease;
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.24);
}

.btn-back i {
  font-size: 0.8rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
}

.page-header h1 {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 26px;
  font-size: 1.95rem;
  line-height: 1.3;
  font-weight: 800;
}

.page-header .lead {
  max-width: 1100px;
  margin: 8px auto 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
}

.updated {
  max-width: 1100px;
  margin: 18px auto 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.layout {
  max-width: 1100px;
  margin: -24px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius);
}

.sidebar-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 6px;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 9px 10px;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.toc-link i {
  width: 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.toc-link:hover,
.toc-link.active {
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
  border-left-color: var(--primary);
}

.toc-link:hover i,
.toc-link.active i {
  color: var(--primary);
}

.content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 32px 34px;
}

.content section {
  margin-bottom: 44px;
  scroll-margin-top: 20px;
}

.content section:last-of-type {
  margin-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  padding: 0 0 12px 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--primary);
}

.section-title i {
  color: var(--primary);
  font-size: 1rem;
}

.content h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 24px 0 8px;
  padding-left: 11px;
  border-left: 2px solid var(--border-strong);
}

.content p {
  color: var(--text-secondary);
  margin-bottom: 13px;
  text-align: justify;
}

.content ul {
  margin: 0 0 14px 18px;
  color: var(--text-secondary);
}

.content ul li {
  margin-bottom: 7px;
}

.content strong {
  color: var(--text-primary);
}

.content a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(79, 70, 229, 0.3);
}

.content a:hover {
  border-bottom-color: var(--primary);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 6px;
  color: var(--primary);
  word-break: break-word;
}

.content-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
}

.content-footer p {
  text-align: center;
  margin-bottom: 3px;
}

.content-footer .muted {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .sidebar {
    position: static;
  }

  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 560px) {
  body {
    padding-bottom: 32px;
  }

  .page-header {
    padding: 0 14px 34px;
  }

  .page-header h1 {
    font-size: 1.4rem;
    padding-top: 20px;
  }

  .page-header .lead {
    font-size: 0.87rem;
  }

  .header-inner {
    padding: 12px 0;
  }

  .btn-back {
    padding: 7px 10px;
  }

  .btn-back span {
    display: none;
  }

  .layout {
    padding: 0 14px;
    margin-top: -20px;
  }

  .content {
    padding: 22px 16px;
  }

  .section-title {
    font-size: 1.12rem;
    padding-left: 10px;
  }

  .content h3 {
    font-size: 0.98rem;
  }

  .content p {
    text-align: left;
    font-size: 0.93rem;
  }

  .content ul {
    margin-left: 16px;
    font-size: 0.93rem;
  }

  .toc-link {
    font-size: 0.85rem;
    padding: 8px;
  }
}

@media (max-width: 400px) {
  .sidebar nav {
    grid-template-columns: 1fr;
  }

  .header-brand .brand-text {
    display: none;
  }
}
