@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

:root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-light: #b0b0b0;
    --link-color: #4CAF50;
    --link-hover-color: #66BB6A;
    --navbar-bg: rgba(26, 26, 26, 0.85);
    --sidebar-bg: #282828;
    --sidebar-group-title-color: #9e9e9e;
    --sidebar-link-color: #e0e0e0;
    --sidebar-link-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-link-active-bg: rgba(76, 175, 80, 0.15);
    --border-color: rgba(255, 255, 255, 0.12);
    --code-bg: #2d2d2d;
    --code-text: #f0f0f0;
    --blockquote-border: #4CAF50;
    --blockquote-text: #b0b0b0;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

html.light-theme {
    --bg-color: #f0f2f5;
    --text-color: #212121;
    --text-light: #616161;
    --link-color: #1976D2;
    --link-hover-color: #42A5F5;
    --navbar-bg: rgba(255, 255, 255, 0.9);
    --sidebar-bg: #ffffff;
    --sidebar-group-title-color: #757575;
    --sidebar-link-color: #212121;
    --sidebar-link-hover-bg: rgba(0, 0, 0, 0.05);
    --sidebar-link-active-bg: rgba(25, 118, 210, 0.15);
    --border-color: rgba(0, 0, 0, 0.1);
    --code-bg: #e0e0e0;
    --code-text: #212121;
    --blockquote-border: #1976D2;
    --blockquote-text: #616161;
    --shadow-color: rgba(0, 0, 0, 0.15);
}

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

html {
    height: 100%;
    overflow-x: hidden;
    background-color: var(--bg-color);
    scroll-behavior: smooth;
    scroll-padding-top: 64px;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-grow: 1;
    min-height: 100vh;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    background-color: var(--navbar-bg);
    backdrop-filter: blur(8px) saturate(180%);
    -webkit-backdrop-filter: blur(8px) saturate(180%);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.home-link {
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500;
    gap: 0.5rem;
    transition: color 0.2s ease;
    flex-shrink: 0;
}
.home-link:hover {
    color: var(--link-color);
}
.home-link .material-icons {
    font-size: 24px;
}

.site-name {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-color);
    flex-grow: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0.5rem;
}
@media (max-width: 767px) {
    .site-name {
        font-size: 1rem;
        display: block;
        text-align: center;
        max-width: calc(100% - (2 * 38px + 2 * 0.5rem + 2 * 1.5rem));
    }
}


.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.icon-button .material-icons {
    font-size: 24px;
}
.icon-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
html.light-theme .icon-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.menu-icon-button {
    display: none;
}
@media (max-width: 767px) {
    .menu-icon-button {
        display: flex;
    }
}


.sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 280px;
    height: calc(100vh - 64px);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
    overflow-y: auto;
    z-index: 901;
    transform: translateX(-100%);
    backface-visibility: hidden;
    will-change: transform;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.sidebar.open {
    transform: translateX(0) translateZ(0);
}
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0) translateZ(0);
        position: sticky;
        top: 64px;
        left: 0;
        z-index: 1;
    }
}

.sidebar-nav {
    padding: 0 1rem;
}
.sidebar-nav p.sidebar-group-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--sidebar-group-title-color);
    padding: 0.5rem 1rem;
    margin-top: 1rem;
    user-select: none;
}
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-nav li {
    margin: 0.25rem 0;
}
.sidebar-nav .sidebar-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--sidebar-link-color);
    text-decoration: none;
    font-weight: 400;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.sidebar-nav .sidebar-link:hover {
    background-color: var(--sidebar-link-hover-bg);
    color: var(--text-color);
}
.sidebar-nav .sidebar-link.active {
    background-color: var(--sidebar-link-active-bg);
    color: var(--link-color);
    font-weight: 500;
}
html.light-theme .sidebar-nav .sidebar-link.active {
    color: var(--link-color);
}


.page {
    flex-grow: 1;
    padding: 80px 0 2rem 0;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}
@media (min-width: 768px) {
    .page {
        padding: 80px 0 2rem 0;
    }
}


.page-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 2rem;
}
@media (min-width: 768px) {
    .page-content {
        padding: 0 3rem;
    }
}
@media (min-width: 1200px) {
    .page-content {
        max-width: 1000px;
        padding: 0 4rem;
    }
}


.page-content h1, .page-content h2, .page-content h3, .page-content h4, .page-content h5, .page-content h6 {
    color: var(--text-color);
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}
.page-content h1 { font-size: 2.5rem; margin-top: 0; }
.page-content h2 { font-size: 2rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem;}
.page-content h3 { font-size: 1.75rem; }
.page-content h4 { font-size: 1.5rem; }

.page-content p {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.page-content a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid var(--link-color);
    transition: color 0.2s ease, border-color 0.2s ease;
}
.page-content a:hover {
    color: var(--link-hover-color);
    border-bottom-color: var(--link-hover-color);
}

.page-content ul, .page-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
    color: var(--text-color);
}
.page-content ul li, .page-content ol li {
    margin-bottom: 0.5rem;
}

.page-content pre {
    background-color: var(--code-bg);
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.page-content code {
    color: var(--code-text);
    white-space: pre-wrap;
    word-break: break-all;
}
.page-content p code, .page-content li code {
    background-color: rgba(128, 128, 128, 0.15);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--code-text);
    transition: background-color 0.3s ease;
}
html.light-theme .page-content p code, html.light-theme .page-content li code {
    background-color: rgba(0, 0, 0, 0.08);
}


.page-content blockquote {
    margin: 1.5rem 0;
    padding: 0.8rem 1.5rem;
    border-left: 4px solid var(--blockquote-border);
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--blockquote-text);
    border-radius: 8px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
html.light-theme .page-content blockquote {
    background-color: rgba(25, 118, 210, 0.08);
}
.page-content blockquote p {
    margin: 0;
    font-style: italic;
}

.code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.code-grid > div {
    background-color: var(--code-bg);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
}
.code-grid h4 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    color: var(--text-color);
}
.code-grid ul {
    margin: 0;
    padding-left: 1.2rem;
}
.code-grid ul li {
    margin-bottom: 0.3rem;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    color: var(--code-text);
}


a:focus-visible,
button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--link-color);
    transition: box-shadow 0.2s ease;
}
html.light-theme a:focus-visible,
html.light-theme button:focus-visible {
    box-shadow: 0 0 0 3px var(--link-color);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

body.sidebar-no-scroll {
    overflow: hidden;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.4);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.6);
}
html.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}
html.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.footer-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 3rem auto 1.5rem auto; 
    width: calc(100% - 4rem); 
    max-width: 900px;
    transition: border-color 0.3s ease;
}
@media (min-width: 768px) {
    .footer-divider {
        width: calc(100% - 6rem);
    }
}
@media (min-width: 1200px) {
    .footer-divider {
        width: calc(100% - 8rem);
        max-width: 1000px;
    }
}

.footer-copyright {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    padding: 0 2rem;
    transition: color 0.3s ease;
}
@media (min-width: 768px) {
    .footer-copyright {
        padding: 0 3rem;
    }
}
@media (min-width: 1200px) {
    .footer-copyright {
        padding: 0 4rem;
    }
}