body {
    max-width: 1120px;
}

#page {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

#main {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 800px;
}

#toc {
    position: sticky;
    top: 20px;
    margin-top: 65px;
    flex: 0 0 auto;
    max-width: 260px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    font-size: 0.85em;
    line-height: 1.4em;
    white-space: nowrap;
}

#toc ul {
    list-style: none;
    margin: 0;
    padding-left: 0.9em;
}

#toc > ul {
    padding-left: 0;
}

#toc li {
    margin: 2px 0;
}

#toc a {
    display: inline-block;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 3px 10px;
    border-radius: 999px;
    background: transparent;
    color: #888;
}

#toc a:hover {
    color: #4584b6;
    text-decoration: none;
}

#toc a.active {
    background: #666;
    color: #fff;
}

@media (max-width: 1000px) {
    #toc {
        display: none;
    }
}

#content {
    border-radius: 12px;
}

#backlink {
    margin-bottom: 15px;
}

#backlink a {
    color: #4584b6;
    font-size: 14px;
}

article.post {
    background: white;
    padding: 0;
    border-radius: 10px;
    position: relative;
}

article.post strong {
    font-weight: 500;
}

article.post em {
    font-weight: 400;
    color: #695000;
}

article.post h1,
article.post h2,
article.post h3 {
    font-weight: 600;
    line-height: 1.3em;
}

article.post h1 {
    font-size: 1.7em;
    font-weight: 700;
    margin: 1.8em 0 0.6em;
}

article.post h2 {
    font-size: 1.35em;
    margin: 1.6em 0 0.5em;
}

article.post h3 {
    font-size: 1.1em;
    margin: 1.4em 0 0.4em;
}

article.post h1:first-child,
article.post h2:first-child,
article.post h3:first-child {
    margin-top: 0;
}

article.post p {
    margin-bottom: 1em;
}

article.post ul,
article.post ol {
    list-style: revert;
    margin: 0 0 1em 1.4em;
}

article.post li {
    margin: 0 0 0.4em;
}

article.post code {
    font-family: 'JetBrains Mono', monospace;
    background: #f4f5f7;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

article.post pre {
    background: #f4f5f7;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1em;
}

article.post pre code {
    background: none;
    padding: 0;
}

article.post blockquote {
    border-left: 3px solid #ddd;
    padding-left: 1em;
    color: #666;
    margin-bottom: 1em;
    font-style: italic;
}

article.post img {
    max-width: 100%;
    border-radius: 8px;
}

article.post table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    font-size: 0.9em;
}

article.post th,
article.post td {
    padding: 0.5em 0.8em;
    text-align: left;
    border-bottom: 1px solid #eee;
    /* Auto table layout shrinks every column proportionally when the table is
       too wide, which wraps short cells (dates, ids) needlessly.  A floor here
       keeps narrow columns intact and pushes the wrapping into wide columns. */
    min-width: 8ch;
}

article.post thead th {
    border-bottom: 2px solid #ddd;
    font-weight: 600;
    color: #333;
}

article.post tbody tr:last-child td {
    border-bottom: none;
}

article.post tbody tr:nth-child(even) {
    background: #f9fafb;
}


article .post-meta-right {
    position: absolute;
    top: 0; 
    right: 0;
}

article .post-meta-right .left {
    width: 8px;
    height: 8px;
    position: absolute;
    left: -7px;
    background: #e7f2ff;
}

article .post-meta-right .left:after {
    content: '';
    background: white;
    width: 8px;
    left: -1px;
    top: 0;
    height: 8px;
    position: absolute;
    border-top-right-radius: 8px;
    border-right: 1px solid #ccf;
}

article .post-meta-right .under {
    position: absolute;
    bottom: -7px;
    right: 0;
    width: 8px;
    height: 8px;
    background: #e7f2ff;
}

article .post-meta-right .under:after {
    content: '';
    background: white;
    width: 100%;
    height: 100%;
    position: absolute;
    border-top-right-radius: 8px;
    border-top: 1px solid #ccf;
}

article .post-meta-right .inner {
    padding: 6px 15px;
    border-bottom-left-radius: 8px;
    text-align: right;
    background: #e7f2ff;
    font-style: italic;
    font-size: 0.9em;
    border-top-right-radius: 11px;
    border-bottom: 1px solid #ccf;
    border-left: 1px solid #ccf;
}

article.post .content {
    margin: 20px;
}