* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: #111;
    background-color: #fafafa;
    font-family: "Arial", "Microsoft YaHei", "黑体", "宋体", sans-serif;
    line-height: 1.5em;
}

a { text-decoration: none; }
a:link { color: #0366d6; }
a:visited { color: #0366d6; }
a:hover { color: #ff5e2c; text-decoration: underline; }
hr { border-color: hsla(0, 0%, 100%, 0.2); }
code {
    color: #24292e;
    background-color: rgba(27, 31, 35, .05);
    border-radius: 0.2em;
    margin: 0 0.2em;
    padding: 0.2em 0.3em;
    overflow: auto;
}
pre {
    background-color: #eff0f1;
    border-radius: 0.8em;
    padding: 0.5em 0.8em;
    overflow: auto;
}
pre code {
    background-color: rgba(200, 200, 200, 0);
    padding: 0.2em 0.2em 0.2em 0;
}
img { height: auto; max-width: 90%; margin: 1em; }
p { text-indent: 2em; }
blockquote {
    border-left: .25em solid #dfe2e5;
    color: #6a737d;
    padding: 0 1em;
}
blockquote > :first-child { margin-top: 0; }
blockquote > :last-child { margin-bottom: 0; }
table { border-collapse: collapse; margin: 1em auto; }
th, td { border: 1px solid #dfe2e5; padding: 0.4em 0.8em; }
th { background-color: #f6f8fa; }

#header {
    flex-shrink: 0;
    background-color: #5ca7d4;
    color: #fff;
}
#header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 90em;
    margin: 0 auto;
    padding: 0 1em;
    height: 3em;
}
#logo {
    color: #fff;
    font-size: 1.3em;
    font-weight: bold;
    letter-spacing: 0.05em;
}
#logo:hover { color: #fff; text-decoration: none; }
#menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
}
#header-nav { display: flex; gap: 1.5em; }
#header-nav a { color: #e0ecf5; font-size: 0.9em; }
#header-nav a:hover { color: #fff; }

#layout {
    display: flex;
    flex: 1;
    max-width: 90em;
    margin: 0 auto;
    width: 100%;
}

#sidebar {
    flex-shrink: 0;
    width: 16em;
    border-right: 1px solid #e1e4e8;
    padding: 1em 0;
    overflow-y: auto;
}
#sidebar-toggle {
    display: none;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid #e1e4e8;
    padding: 0.6em 0.8em;
    font-size: 0.9em;
    color: #24292e;
    cursor: pointer;
    text-align: left;
}
#sidebar-inner { padding: 0 0.8em; }
.sidebar-category { margin-bottom: 1.2em; }
.sidebar-category-title {
    font-size: 0.8em;
    font-weight: bold;
    color: #6a737d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.4em 0;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #e1e4e8;
}
.sidebar-article-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-article-list li { margin: 0.2em 0; }
.sidebar-article-list a {
    display: block;
    padding: 0.3em 0.5em;
    font-size: 0.85em;
    border-radius: 0.3em;
    color: #24292e;
}
.sidebar-article-list a:hover {
    background-color: #f1f8ff;
    color: #0366d6;
    text-decoration: none;
}
.sidebar-article-list a.active {
    background-color: #f1f8ff;
    color: #0366d6;
    font-weight: bold;
}

#content {
    flex: 1;
    min-width: 0;
    padding: 1.5em 2em;
    line-height: 1.8em;
    word-break: break-all;
    word-wrap: break-word;
}
.article-date {
    display: block;
    text-align: right;
    font-size: 0.8em;
    color: #6a737d;
    margin-bottom: 1em;
    border-bottom: 1px solid #e1e4e8;
    padding-bottom: 1em;
}

#threads-container {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #111;
    line-height: 1.5em;
    word-break: break-all;
    word-wrap: break-word;
}
.thread {
    padding: 1em 0;
    border-bottom: 1px solid #e1e4e8;
}
.thread:last-child { border-bottom: none; }
.thread-title > a { text-decoration: none; color: #111; font-size: 1.2em; line-height: 1.6em; }
.thread-title > a:hover { color: #0366d6; }
.thread-bar { margin-top: 0.5em; text-align: right; font-size: 0.85em; color: #6a737d; }
.thread-bar > span { margin-left: 1em; }

#footer {
    flex-shrink: 0;
    background-color: #f6f8fa;
    border-top: 1px solid #e1e4e8;
    padding: 0.8em 1em;
}
#footer-list {
    text-align: center;
    font-size: 0.75em;
    color: #6a737d;
}

@media (max-width: 768px) {
    #menu-toggle { display: block; }
    #header-nav { display: none; }
    #header-nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 3em;
        right: 0;
        background-color: #5ca7d4;
        padding: 0.8em 1.2em;
        border-radius: 0 0 0 0.5em;
        z-index: 10;
    }
    #layout { flex-direction: column; }
    #sidebar-toggle { display: block; }
    #sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e1e4e8;
        padding: 0;
    }
    #sidebar-inner {
        display: none;
        padding: 0 0.8em 0.8em;
    }
    #sidebar.open #sidebar-inner { display: block; }
    #content { padding: 1em; }
}
