:root {
    --bg-body: #111318;
    --bg-card: #1c1f26;
    --bg-sidebar: #16191f;
    --border-color: #2a2e38;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --font-main: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: radial-gradient(ellipse at 50% -20%, rgba(59, 130, 246, .11), transparent 42%),
                radial-gradient(ellipse at 100% 75%, rgba(59, 130, 246, .035), transparent 34%),
                var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: var(--accent-blue);
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-blue-hover);
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    white-space: nowrap;
}

.logo img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 3px 8px rgba(59, 130, 246, .22));
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 36px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-main);
    transition: all .2s;
}

.btn-header:hover {
    background: rgba(255, 255, 255, .05);
}

.btn-header.primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.btn-header.primary:hover {
    background: var(--accent-blue-hover);
}

.btn-header svg {
    width: 16px;
    height: 16px;
}

.app-container > nav {
    display: flex;
    align-items: center;
    gap: 24px;
    border: 1px solid rgba(255, 255, 255, .055);
    border-radius: 12px;
    background: rgba(25, 28, 35, .72);
    padding: 12px 16px;
    margin-bottom: 30px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding-bottom: 12px;
    margin-bottom: -13px;
    border-bottom: 2px solid transparent;
    transition: all .2s;
}

.nav-item:hover {
    color: var(--text-main);
}

.nav-item.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.nav-item svg {
    width: 14px;
    height: 14px;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-item-dropdown {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 0 12px;
    margin-bottom: -13px;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    font-weight: 500;
}

.nav-item-dropdown:hover {
    color: var(--text-main);
}

.nav-item-dropdown.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.nav-item-dropdown svg {
    width: 14px;
    height: 14px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 14px;
    min-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all .2s ease;
    z-index: 100;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    transition: background .15s;
    color: var(--text-main);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, .05);
}

.dropdown-item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}

.dropdown-item:hover .dropdown-item-icon {
    background: rgba(59, 130, 246, .15);
    border-color: rgba(59, 130, 246, .3);
}

.dropdown-item-icon svg {
    width: 18px;
    height: 18px;
    color: var(--text-main);
}

.dropdown-item:hover .dropdown-item-icon svg {
    color: var(--accent-blue);
}

.dropdown-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.dropdown-item-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr) 205px;
    gap: 30px;
    flex: 1;
    min-width: 0;
}

.sidebar {
    background: linear-gradient(145deg, rgba(29, 33, 41, .98), rgba(22, 25, 31, .98));
    border: 1px solid #343943;
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .16), inset 0 1px rgba(255, 255, 255, .025);
    padding: 12px 8px 18px;
    overflow-y: auto;
    max-height: calc(100vh - 150px);
    position: sticky;
    top: 18px;
    scrollbar-width: thin;
    scrollbar-color: #3b414c transparent;
}

.sidebar-group {
    margin-bottom: 8px;
}

.sidebar-group-title {
    font-size: 11px;
    font-weight: 700;
    color: #aab9d2;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 12px 12px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 13.5px;
    border-left: 2px solid transparent;
    border-radius: 7px;
    transition: all 0.15s;
    cursor: pointer;
}

.sidebar-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-link.active {
    color: #8db4ff;
    background: linear-gradient(90deg, rgba(59, 130, 246, .18), rgba(59, 130, 246, .07));
    border-left-color: var(--accent-blue);
    font-weight: 600;
}

.sidebar-link .emoji {
    font-size: 15px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.content {
    padding: 12px 8px 72px;
    max-width: 920px;
    width: 100%;
    min-width: 0;
}

.content h1 {
    font-size: clamp(28px, 3vw, 34px);
    font-weight: 700;
    color: #fff;
    margin-bottom: 18px;
    line-height: 1.25;
    letter-spacing: -.035em;
    text-wrap: balance;
}

.content h2 {
    font-size: 21px;
    font-weight: 700;
    color: #fff;
    margin-top: 38px;
    margin-bottom: 16px;
    padding: 0 0 9px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    border-left: 3px solid rgba(59, 130, 246, .8);
    line-height: 1.35;
}

.content h2.section-title {
    font-size: 22px;
    margin-top: 32px;
    padding: 0;
    border: 0;
}

.content h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-top: 24px;
    margin-bottom: 10px;
}

.content h4 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-top: 18px;
    margin-bottom: 8px;
}

.content p {
    margin-bottom: 16px;
    color: #d5dbe5;
}

.content ul,
.content ol {
    margin: 12px 0 16px 24px;
}

.content li {
    margin-bottom: 6px;
}

.content blockquote {
    border: 1px solid rgba(59, 130, 246, .16);
    border-left: 3px solid var(--accent-blue);
    background: linear-gradient(100deg, rgba(59, 130, 246, .09), rgba(59, 130, 246, .025));
    padding: 14px 18px;
    border-radius: 0 10px 10px 0;
    margin: 20px 0;
    color: var(--text-muted);
}

.content code {
    font-family: 'Consolas', 'Cascadia Code', monospace;
    background: rgba(107, 145, 210, .12);
    border: 1px solid rgba(125, 163, 230, .2);
    padding: 2px 7px;
    border-radius: 6px;
    font-size: .91em;
    color: #c6d8ff;
    white-space: normal;
    overflow-wrap: anywhere;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.content pre {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

.content pre code {
    background: none;
    padding: 0;
    color: var(--text-main);
}

.content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 10px;
    background: rgba(22, 25, 31, .58);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.content table th {
    background: rgba(255, 255, 255, 0.04);
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: #fff;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.content table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13.5px;
}

.content table tr:last-child td {
    border-bottom: none;
}

.content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 28px 0;
}

.content img {
    max-width: 100%;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 12px;
    margin: 16px 0;
    display: block;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}

.content figure {
    margin: 16px 0;
}

.content figcaption {
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    margin-top: 6px;
    font-style: italic;
}

.content strong {
    color: #fff;
    font-weight: 600;
}

.content .social-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 16px 0 28px;
    width: 100%;
}

.content .social-btn {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    background: linear-gradient(110deg, rgba(29, 32, 40, .96), rgba(26, 29, 36, .92));
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 13px;
    padding: 20px 24px;
    transition: all .2s ease;
    color: inherit;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .12);
}

.content .social-btn:hover {
    border-color: rgba(96, 151, 255, .55);
    background: linear-gradient(110deg, rgba(35, 43, 57, .98), rgba(27, 31, 40, .95));
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .22), 0 0 0 1px rgba(59, 130, 246, .08);
}

.content .social-btn-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    transition: all .2s ease;
}

.content .social-btn:hover .social-btn-icon {
    background: rgba(59, 130, 246, .15);
    border-color: rgba(59, 130, 246, .3);
}

.content .social-btn-icon svg {
    width: 24px;
    height: 24px;
    color: var(--text-main);
}

.content .social-btn:hover .social-btn-icon svg {
    color: var(--accent-blue);
}

.content .social-btn-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.content .social-btn-title {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.content .social-btn-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: all .2s ease;
}

.content .social-btn:hover .social-btn-arrow {
    color: var(--text-main);
    transform: translateX(4px);
}

.content .social-btn-arrow svg {
    width: 20px;
    height: 20px;
}

.content h1,
.content h2,
.content h3,
.content h4 {
    scroll-margin-top: 20px;
}

.toc {
    position: sticky;
    top: 22px;
    align-self: start;
    padding-top: 8px;
    color: var(--text-muted);
}

.toc-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
    margin-bottom: 10px;
}

.toc-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 60vh;
    overflow: auto;
}

.toc-links a {
    color: var(--text-muted);
    font-size: 12px;
    padding: 5px 9px;
    border-radius: 6px;
}

.toc-links a:hover {
    color: #8db4ff;
    background: rgba(59, 130, 246, .1);
}

.footer {
    border-top: 1px solid rgba(148, 163, 184, .16);
    padding: 48px 24px 24px;
    margin-top: 48px;
    background: linear-gradient(180deg, rgba(25, 28, 35, .35), rgba(17, 19, 24, .04));
    border-radius: 18px 18px 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h3 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 20px;
}

.footer-col ul {
    display: flex;
    flex-direction: column;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-col ul li {
    list-style: none;
}

.footer-col ul li a {
    color: var(--text-muted);
    font-size: 13px;
    transition: color .2s;
}

.footer-col ul li a:hover {
    color: var(--text-main);
}

.footer-social {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.footer-social a {
    color: var(--text-muted);
}

.footer-social a:hover {
    color: var(--text-main);
}

.footer-social svg {
    width: 24px;
    height: 24px;
}

.footer-copyright {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.footer-copyright a {
    color: var(--accent-blue);
}

.footer-copyright a:hover {
    text-decoration: underline;
}

.btn-header,
.nav-item,
.nav-item-dropdown,
.sidebar-link {
    transition-duration: .18s;
}

::selection {
    background: rgba(59, 130, 246, .35);
    color: #fff;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-muted);
    gap: 12px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-msg {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 16px;
    color: #fca5a5;
    font-size: 13px;
}

.error-msg code {
    background: rgba(255, 255, 255, 0.08);
    color: #fca5a5;
}

@media (max-width: 1250px) {
    .layout {
        grid-template-columns: 250px minmax(0, 1fr);
        gap: 24px;
    }

    .toc {
        display: none;
    }
}

@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 0 16px;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: flex-start;
    }

    .app-container > nav {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
    }

    .layout {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .sidebar {
        position: relative;
        top: 0;
        max-height: 260px;
        padding: 10px 8px;
    }

    .sidebar-group-title {
        padding: 10px 12px 4px;
    }

    .content {
        padding: 24px 2px 48px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 26px;
    }

    .content .social-btn {
        padding: 16px;
        gap: 16px;
    }

    .content .social-btn-icon {
        width: 40px;
        height: 40px;
    }

    .content .social-btn-icon svg {
        width: 20px;
        height: 20px;
    }
}
