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

:root {
  --sidebar-w: 270px;
  --bg: #f7f6f3;
  --sidebar-bg: #1c1c1c;
  --sidebar-text: #d8d4cc;
  --sidebar-text-dim: #7a7570;
  --sidebar-hover: #2e2e2e;
  --sidebar-active: #3a3530;
  --sidebar-accent: #c8a882;
  --content-bg: #ffffff;
  --text: #2c2c2c;
  --text-light: #666;
  --accent: #b8956a;
  --accent-light: #f0e8dc;
  --border: #e8e4de;
  --tip-bg: #faf8f5;
  --tip-border: #c8a882;
  --table-header: #f5f2ee;
  --radius: 6px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #3a3530; border-radius: 2px; }

.sidebar-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid #2e2e2e;
  flex-shrink: 0;
}
.sidebar-header a {
  text-decoration: none;
  display: block;
}
.sidebar-header .brand {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-text-dim);
  margin-bottom: 6px;
}
.sidebar-header .logo-title {
  font-size: 20px;
  font-weight: 600;
  color: #f0ede8;
  line-height: 1.4;
  transition: color 0.15s;
}
.sidebar-header a:hover .logo-title { color: var(--sidebar-accent); }
.sidebar-header .subtitle {
  font-size: 11px;
  color: var(--sidebar-text-dim);
  margin-top: 4px;
}

nav { flex: 1; padding: 12px 0 0; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid #2e2e2e;
  flex-shrink: 0;
}

.sidebar-footer a {
  font-size: 12px;
  color: var(--sidebar-text-dim);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

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

/* TOP link */
.nav-top {
  display: flex;
  align-items: center;
  padding: 10px 24px;
  font-size: 13px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  gap: 8px;
}
.nav-top:hover { background: var(--sidebar-hover); color: #fff; }
.nav-top.active { background: var(--sidebar-active); color: var(--sidebar-accent); }
.nav-top .nav-icon { font-size: 12px; opacity: 0.6; }

/* Accordion group */
.nav-group { border-bottom: 1px solid #252525; }

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  gap: 8px;
}
.nav-group-toggle:hover { background: var(--sidebar-hover); color: #fff; }
.nav-group-toggle.active { color: var(--sidebar-accent); }

.nav-group-toggle .toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.nav-group-toggle .num {
  font-size: 10px;
  font-weight: 700;
  color: var(--sidebar-accent);
  background: rgba(200,168,130,0.15);
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.nav-group-toggle .arrow {
  font-size: 10px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  opacity: 0.5;
}
.nav-group.open .arrow { transform: rotate(90deg); }

.nav-sub {
  max-height: 0;
  overflow: hidden;
  background: #161616;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-group.open .nav-sub { max-height: 400px; }

.nav-sub a {
  display: block;
  padding: 7px 24px 7px 44px;
  font-size: 12px;
  color: var(--sidebar-text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1.5;
}
.nav-sub a:hover {
  color: var(--sidebar-text);
  background: rgba(255,255,255,0.03);
}
.nav-sub a.active {
  color: var(--sidebar-accent);
  border-left-color: var(--sidebar-accent);
  background: rgba(200,168,130,0.06);
}

/* ── Main content ── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Breadcrumb bar ── */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 246, 243, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 48px;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
}

.breadcrumb a {
  color: var(--text-light);
  text-decoration: none;
  border-bottom: none;
  transition: color 0.15s;
}

.breadcrumb a:hover {
  color: var(--accent);
  border-bottom: none;
}

.breadcrumb .sep {
  font-size: 10px;
  opacity: 0.4;
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 600;
}

.content-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 48px 100px;
}

/* Section wrapper */
.page-section {
  background: var(--content-bg);
  border-radius: 10px;
  padding: 48px 52px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Page navigation (prev/next) */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  gap: 12px;
}
.page-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--content-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.page-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.page-nav .spacer { flex: 1; }

/* Typography */
.page-section h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.01em;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--accent-light);
}
.page-section h1 .sec-num {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 10px;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.page-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 44px 0 16px;
  padding-top: 8px;
  scroll-margin-top: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-section h2::before {
  content: '';
  display: block;
  flex-shrink: 0;
  width: 4px;
  height: 1em;
  background: var(--accent);
  border-radius: 2px;
}

.page-section h3 {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin: 28px 0 12px;
}

.page-section p {
  margin-bottom: 14px;
  line-height: 1.85;
}

.page-section ul, .page-section ol {
  margin: 10px 0 14px 20px;
}
.page-section li { margin-bottom: 20px; }

.page-section strong { font-weight: 700; color: #1a1a1a; }

.page-section a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-light);
}
.page-section a:hover { border-bottom-color: var(--accent); }

hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }

/* Blockquote */
blockquote {
  border-left: 3px solid var(--accent);
  background: var(--tip-bg);
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-light);
  font-size: 13px;
}

/* Tip box */
.tip {
  display: flex;
  gap: 10px;
  background: var(--tip-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--tip-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.75;
}
.tip .tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.tip .tip-body { flex: 1; }
.tip .tip-body p { margin-bottom: 8px; }
.tip .tip-body p:last-child { margin-bottom: 0; }
.tip .tip-body ul { margin: 4px 0 4px 16px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  line-height: 1.75;
}
thead th {
  background: var(--table-header);
  font-weight: 700;
  font-size: 12px;
}
td:first-child {
  white-space: nowrap;
  font-weight: 600;
  color: #444;
  font-size: 12px;
  background: #fafaf8;
  min-width: 160px;
}
tr:hover td { background-color: #fdfcfa; }
tr:hover td:first-child { background-color: #f5f3ef; }

/* Images */
.page-section img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.img-caption {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
  margin-bottom: 16px;
  text-align: center;
}

/* TOP page */
.intro-hero img {
  width: 100%;
  border-radius: 8px;
  display: block;
}
.intro-desc {
  background: var(--tip-bg);
  border-left: 3px solid var(--accent);
  padding: 18px 22px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.9;
}
.demo-links ol { margin-left: 20px; margin-top: 8px; }
.notice-box {
  background: #fdf8f0;
  border: 1px solid #e8d9c0;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 13px;
}
.notice-box h3 { margin: 0 0 8px; font-size: 13px; color: #8a6840; }
.support-box {
  text-align: center;
  padding: 24px;
  background: var(--tip-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 16px;
}
.support-box p { margin: 0; }

/* Mobile toggle */
#menu-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  background: var(--sidebar-bg);
  color: #fff;
  border: none;
  width: 40px; height: 40px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* Responsive */
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
  .content-inner { padding: 40px 32px 80px; }
  .page-section { padding: 36px 32px; }
}

@media (max-width: 680px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  #sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  #menu-toggle { display: flex; }
  #main { margin-left: 0; }
  .page-header { padding: 0 16px 0 56px; }
  .content-inner { padding: 24px 16px 60px; }
  .page-section { padding: 28px 20px; border-radius: 8px; }
  .page-section h1 { font-size: 18px; }
  .page-section h2 { font-size: 15px; }
  td:first-child { min-width: 120px; }
  .page-nav { flex-wrap: wrap; }
}
