:root {
  --bg: #f8f9fa;
  --panel: #ffffff;
  --border: #a2a9b1;
  --text: #202122;
  --muted: #54595d;
  --link: #0645ad;
  --link-hover: #0b0080;
  --sidebar: #eaecf0;
  --heading: #000;
  --code-bg: #f6f6f6;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  background: linear-gradient(to bottom, #f8f9fa, var(--sidebar));
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.logo-box {
  text-align: center;
  margin-bottom: 24px;
}

.logo-img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}

.site-title {
  margin: 0;
  color: var(--heading);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  word-break: break-word;
}

.site-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.nav-group {
  margin-bottom: 22px;
}

.nav-group h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

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

.nav-group li {
  margin: 6px 0;
  font-size: 14px;
  line-height: 1.45;
}

.content-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.top-links,
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: 1 1 320px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.search-box input {
  width: 260px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
}

.search-box button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #f8f9fa;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

.main {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 56px;
  min-width: 0;
}

.hero,
.card,
.page {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
  margin-bottom: 20px;
}

.page {
  padding: 24px;
  width: 100%;
  max-width: 1200px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  padding: 18px;
}

h1 {
  margin: 0 0 18px;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  word-break: break-word;
}

h2 {
  margin: 28px 0 12px;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.3;
  word-break: break-word;
  border-bottom: 1px solid #c8ccd1;
  padding-bottom: 6px;
}

.card h2 {
  margin-top: 0;
  font-size: 22px;
  padding-bottom: 8px;
}

h3 {
  margin: 22px 0 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

p,
li {
  font-size: 15px;
  line-height: 1.7;
}

.card ul {
  margin: 0;
  padding-left: 18px;
}

.card p {
  margin: 0;
}

.notice {
  margin-top: 16px;
  background: #fff8d6;
  border: 1px solid #e2c76d;
  padding: 12px 14px;
  font-size: 14px;
}

.toc {
  width: 100%;
  max-width: 460px;
  margin: 0 0 26px;
  padding: 14px 18px;
  background: #f8f9fa;
  border: 1px solid var(--border);
}

.toc h3 {
  margin-top: 0;
  font-size: 16px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
}

.toc li {
  margin: 6px 0;
}

.code-block {
  position: relative;
  margin: 14px 0 18px;
}

pre {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid #ddd;
  padding: 14px;
  white-space: pre;
  word-break: normal;
  tab-size: 2;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
  font-family: Consolas, Monaco, monospace;
  font-size: 14px;
  line-height: 1.55;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

.copy-btn:hover {
  background: #f3f4f6;
}

.copy-btn.copied {
  color: #0a7a28;
  border-color: #8bc79b;
  background: #f1fbf3;
}

.figure {
  margin: 14px 0 18px;
}

.figure img {
  display: block;
  max-width: 100%;
  border: 1px solid #ccc;
}

.footer {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.scroll-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--link);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 999;
}

.scroll-top.is-visible {
  display: flex;
}

.scroll-top:hover {
  background: #f8f9fa;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar {
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .content-wrap {
    height: auto;
  }

  .topbar {
    align-items: stretch;
  }

  .search-box {
    width: 100%;
  }

  .search-box input {
    width: 100%;
    flex: 1 1 auto;
  }

  .main {
    height: auto;
    overflow: visible;
    padding: 18px 16px 64px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .card,
  .page {
    padding: 18px;
  }

  .scroll-top {
    right: 16px;
    bottom: 16px;
  }
}
