:root {
    --primary: #67ea94;
    --sidebar-w: 280px;
    --text: #24292e;
    --bg: #ffffff;
    --sidebar-bg: #f6f8fa;
    --border: #e1e4e8;
}

body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; display: flex; height: 100vh; color: var(--text); overflow: hidden; }

aside { width: var(--sidebar-w); background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 1rem; background: #fff; border-bottom: 1px solid var(--border); }
.home-link { text-decoration: none; font-weight: bold; color: #0366d6; display: block; margin-bottom: 10px; }
.search-wrapper { position: relative; }
#search-input { width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: 4px; box-sizing: border-box; }

.nav-tree { overflow-y: auto; flex-grow: 1; padding: 1rem; }
.nav-ul { list-style: none; padding: 0; margin: 0; }
.nav-section-header { font-weight: 800; color: #333; margin-top: 20px; margin-bottom: 10px; font-size: 0.9em; letter-spacing: 1px; border-bottom: 2px solid #ddd; padding-bottom: 5px; }
.nav-section strong { display: block; margin-top: 10px; font-size: 0.85em; color: #6a737d; text-transform: uppercase; letter-spacing: 0.5px; }
.nav-section ul { list-style: none; padding-left: 15px; margin-top: 5px; border-left: 1px solid #e1e4e8; }
.nav-tree a { text-decoration: none; color: #586069; font-size: 0.9em; display: block; padding: 3px 0; }
.nav-tree a:hover { color: #0366d6; }
.nav-tree a.active { color: #24292e; font-weight: bold; }

main { flex-grow: 1; overflow-y: auto; padding: 2rem 4rem; position: relative; }
.top-bar { display: flex; justify-content: flex-end; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.btn-lang { text-decoration: none; background: #0366d6; color: white; padding: 5px 10px; border-radius: 4px; font-size: 0.8em; }

.markdown-body { max-width: 900px; margin: 0 auto; line-height: 1.6; }
.markdown-body img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; display: block; margin: 1rem 0; }
.markdown-body pre { background: #f6f8fa; padding: 16px; border-radius: 6px; overflow-x: auto; }
.markdown-body code { background: rgba(27,31,35,0.05); padding: 0.2em 0.4em; border-radius: 3px; font-family: monospace; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 15px 0; display: block; overflow-x: auto; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 13px; }
.markdown-body th { background: #f6f8fa; }
.markdown-body blockquote { border-left: 4px solid var(--primary); color: #6a737d; margin: 0; padding-left: 1em; }

/* Section Grid (Main Menu) */
.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.section-card { display: block; background: #f8f9fa; border: 1px solid #e1e4e8; border-radius: 8px; padding: 20px; text-decoration: none; color: inherit; transition: transform 0.2s, box-shadow 0.2s; }
.section-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); border-color: var(--primary); }
.section-card h2 { margin-top: 0; color: #0366d6; font-size: 1.5em; }
.section-card p { color: #586069; margin-bottom: 0; }

/* Table of Contents */
.toc-container h2 { border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-top: 2rem; font-size: 1.5rem; color: #333; }
.toc-container h3 { margin-top: 1.5rem; font-size: 1.1rem; color: #555; }
.toc-section-title { font-size: 2rem; border-bottom: 3px solid var(--primary); padding-bottom: 10px; margin-top: 40px; }
.toc-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.toc-list li a { display: block; padding: 10px; background: #fff; border: 1px solid #eee; border-radius: 6px; text-decoration: none; color: #0366d6; transition: all 0.2s; }
.toc-list li a:hover { background: #f0f8ff; border-color: #0366d6; }

#search-results { display: none; position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 100; max-height: 300px; overflow-y: auto; border-radius: 4px; margin-top: 5px; }
.res-item { padding: 8px; border-bottom: 1px solid #eee; cursor: pointer; }
.res-item:hover { background: #f6f8fa; }
.res-item a { text-decoration: none; color: #0366d6; font-weight: bold; display: block; font-size: 0.9em; }
.res-item p { margin: 2px 0 0; font-size: 0.8em; color: #586069; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 768px) {
    body { flex-direction: column; overflow: auto; }
    aside { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
    main { padding: 1rem; }
}