.post-content .highlighter-rouge > .highlight,
.post-content .highlight:not(pre) {
    display: block !important;
    background-color: rgb(24 24 27) !important;
    border: 1px solid rgb(39 39 42) !important;
    border-radius: 0.75rem !important;
    padding: 1rem !important;
    margin: 1.5rem 0 !important;
    overflow-x: auto !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}

.post-content .highlight pre,
.post-content pre.highlight {
    display: block !important;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace !important;
    font-size: 0.875rem !important;
    line-height: 1.75 !important;
    color: rgb(228 228 231) !important;
    white-space: pre !important;
    word-wrap: normal !important;
    word-break: normal !important;
}

.post-content .highlight code {
    display: block !important;
    background-color: transparent !important;
    color: rgb(228 228 231) !important;
    padding: 0 !important;
    border: none !important;
    font-family: inherit !important;
    font-size: inherit !important;
    white-space: pre !important;
    word-wrap: normal !important;
    word-break: normal !important;
}

.post-content .highlight .k,
.post-content .highlight .kd,
.post-content .highlight .kn,
.post-content .highlight .kp,
.post-content .highlight .kr,
.post-content .highlight .kt,
.post-content .highlight .kc {
    color: rgb(255 87 34) !important;
}

.post-content .highlight .s,
.post-content .highlight .s1,
.post-content .highlight .s2,
.post-content .highlight .sb,
.post-content .highlight .sc,
.post-content .highlight .sd,
.post-content .highlight .se,
.post-content .highlight .sh,
.post-content .highlight .si,
.post-content .highlight .sx,
.post-content .highlight .sr,
.post-content .highlight .ss,
.post-content .highlight .dl {
    color: rgb(129 140 248) !important;
}

.post-content .highlight .c,
.post-content .highlight .cm,
.post-content .highlight .c1,
.post-content .highlight .cs,
.post-content .highlight .cp {
    color: rgb(113 113 122) !important;
    font-style: italic !important;
}

.post-content .highlight .n,
.post-content .highlight .na,
.post-content .highlight .nc,
.post-content .highlight .nd,
.post-content .highlight .ne,
.post-content .highlight .nn,
.post-content .highlight .nx,
.post-content .highlight .nl {
    color: rgb(228 228 231) !important;
}

.post-content .highlight .nf,
.post-content .highlight .fm {
    color: rgb(96 165 250) !important;
}

.post-content .highlight .nt {
    color: rgb(255 87 34) !important;
}

.post-content .highlight .nv,
.post-content .highlight .vc,
.post-content .highlight .vg,
.post-content .highlight .vi {
    color: rgb(34 197 94) !important;
}

.post-content .highlight .o,
.post-content .highlight .ow {
    color: rgb(251 191 36) !important;
}

.post-content .highlight .p {
    color: rgb(161 161 170) !important;
}

.post-content .highlight .nb,
.post-content .highlight .bp,
.post-content .highlight .no {
    color: rgb(139 92 246) !important;
}

.post-content .highlight .mi,
.post-content .highlight .mf,
.post-content .highlight .mh,
.post-content .highlight .il,
.post-content .highlight .m,
.post-content .highlight .mb,
.post-content .highlight .mx {
    color: rgb(251 146 60) !important;
}

.post-content .highlight .nd,
.post-content .highlight .ni {
    color: rgb(168 85 247) !important;
}

.post-content .highlight .gd {
    color: rgb(239 68 68) !important;
    background-color: rgb(127 29 29 / 0.15) !important;
}

.post-content .highlight .ge {
    font-style: italic !important;
}

.post-content .highlight .gr {
    color: rgb(239 68 68) !important;
}

.post-content .highlight .gh {
    color: rgb(96 165 250) !important;
    font-weight: 600 !important;
}

.post-content .highlight .gi {
    color: rgb(34 197 94) !important;
    background-color: rgb(20 83 45 / 0.15) !important;
}

.post-content .highlight .go {
    color: rgb(113 113 122) !important;
}

.post-content .highlight .gp {
    color: rgb(96 165 250) !important;
    font-weight: 600 !important;
}

.post-content .highlight .gs {
    font-weight: 600 !important;
}

.post-content .highlight .gu {
    color: rgb(139 92 246) !important;
    font-weight: 600 !important;
}

.post-content .highlight .gt {
    color: rgb(239 68 68) !important;
}

.post-content .highlight .w {
    color: rgb(63 63 70) !important;
}

.post-content .highlight .err {
    color: rgb(239 68 68) !important;
    background-color: rgb(127 29 29 / 0.15) !important;
}

.post-content .highlight .l,
.post-content .highlight .ld {
    color: rgb(129 140 248) !important;
}

.post-content .highlight .sa {
    color: rgb(129 140 248) !important;
}

.post-content .highlight .se {
    color: rgb(139 92 246) !important;
}

.post-content .highlight .ss {
    color: rgb(251 146 60) !important;
}

.post-content .highlight .vm {
    color: rgb(96 165 250) !important;
}

.post-content pre:not(.highlight) {
    display: block !important;
    background-color: rgb(24 24 27) !important;
    border: 1px solid rgb(39 39 42) !important;
    border-radius: 0.75rem !important;
    padding: 1rem !important;
    margin: 1.5rem 0 !important;
    overflow-x: auto !important;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace !important;
    font-size: 0.875rem !important;
    line-height: 1.75 !important;
    color: rgb(228 228 231) !important;
    white-space: pre !important;
    word-wrap: normal !important;
    word-break: normal !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}

.post-content pre:not(.highlight) code {
    display: block !important;
    background-color: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border: none !important;
    font-family: inherit !important;
    font-size: inherit !important;
    white-space: pre !important;
}

.post-content p code,
.post-content li code,
.post-content td code,
.post-content th code {
    display: inline !important;
    background-color: rgb(24 24 27) !important;
    color: rgb(96 165 250) !important;
    padding: 0.125rem 0.375rem !important;
    border-radius: 0.25rem !important;
    font-size: 0.875rem !important;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace !important;
    white-space: normal !important;
}

.post-content {
    max-width: 50rem;
    margin: 0 auto;
    width: 100%;
}

.post-content p {
    color: rgb(212 212 216);
    line-height: 1.875;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.post-content h1 {
    color: rgb(244 244 245);
    font-size: 2rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.post-content h2 {
    color: rgb(244 244 245);
    font-size: 1.625rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-content h3 {
    color: rgb(228 228 231);
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.post-content strong {
    color: rgb(244 244 245);
    font-weight: 700;
}

.post-content a {
    color: rgb(96 165 250);
    text-decoration: underline;
    text-underline-offset: 0.16em;
    text-decoration-thickness: 1px;
    transition: all 0.3s;
}

.post-content a:hover {
    text-decoration-thickness: 2px;
}

.post-content ul,
.post-content ol {
    color: rgb(212 212 216);
    line-height: 1.75;
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.post-content ul {
    list-style-type: disc;
    list-style-position: outside;
}

.post-content ol {
    list-style-type: decimal;
    list-style-position: outside;
}

.post-content li {
    margin: 0.5rem 0;
}

.post-content blockquote {
    border-left: 4px solid rgb(63 63 70);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: rgb(161 161 170);
}

.post-content img {
    border-radius: 0.75rem;
    margin: 2rem 0;
    max-width: 100%;
    height: auto;
}

.post-content .post_image {
    display: block;
    margin: 2rem auto 0.75rem;
    background-color: #ffffff;
}

.post-content .post_image_caption {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0.5rem auto 1.75rem;
    color: rgb(161 161 170);
    font-size: 0.9rem;
    font-style: italic;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.post-content .post_image_caption a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.post-content .post_image_caption a:hover {
    color: rgb(212 212 216);
}

.post-content hr {
    border: none;
    border-top: 1px solid rgb(39 39 42);
    margin: 3rem 0;
}

.post-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.post-content th {
    color: rgb(228 228 231);
    font-weight: 600;
    padding: 0.75rem;
    border-bottom: 1px solid rgb(39 39 42);
    text-align: left;
}

.post-content td {
    color: rgb(212 212 216);
    padding: 0.75rem;
    border-bottom: 1px solid rgb(24 24 27);
}

.code-block-wrapper {
    position: relative;
}

.copy-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background-color: rgb(39 39 42);
    border: 1px solid rgb(63 63 70);
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    color: rgb(228 228 231);
    font-size: 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Segoe UI', sans-serif;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.code-block-wrapper:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background-color: rgb(63 63 70);
    border-color: rgb(82 82 91);
}

.copy-button:active {
    transform: scale(0.95);
}

.copy-button.copied {
    background-color: rgb(34 197 94);
    border-color: rgb(34 197 94);
    color: rgb(255 255 255);
}

.github-button {
    display: inline-block;
    margin: 0;
}

@media (max-width: 768px) {
    .post-content h1 {
        font-size: 1.5rem;
        margin-top: 2rem;
        margin-bottom: 1rem;
    }

    .post-content h2 {
        font-size: 1.25rem;
        margin-top: 2rem;
        margin-bottom: 0.75rem;
    }

    .post-content h3 {
        font-size: 1.125rem;
        margin-top: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .post-content p {
        font-size: 1rem;
        line-height: 1.75;
        margin-bottom: 1.25rem;
    }

    .post-content .highlighter-rouge > .highlight,
    .post-content .highlight:not(pre),
    .post-content pre:not(.highlight) {
        padding: 0.75rem !important;
        margin: 1rem 0 !important;
        font-size: 0.8125rem !important;
    }

    .post-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .post-content th,
    .post-content td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .post-content blockquote {
        padding-left: 1rem;
        margin: 1rem 0;
    }

    .post-content ul,
    .post-content ol {
        padding-left: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .copy-button {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.6875rem;
    }
}

.post-main-with-toc {
    display: block;
}

.post-toc {
    display: none;
}

@media (min-width: 1280px) {
    .post-article {
        max-width: 108rem;
    }

    .post-main-with-toc {
        display: grid;
        grid-template-columns: minmax(0, 58rem) 17.5rem;
        gap: 2.5rem;
        justify-content: center;
        align-items: start;
    }

    .post-main {
        min-width: 0;
    }

    .post-main .post-content {
        max-width: none;
        margin: 0;
    }

    .post-toc {
        display: block;
        position: sticky;
        top: var(--toc-sticky-top, 6.5rem);
        align-self: start;
        margin-left: 0.75rem;
    }

    .post-toc.is-empty {
        display: none;
    }

    .post-toc-inner {
        position: relative;
        padding: 1rem 1rem 1.05rem;
        background-color: rgb(24 24 27 / 0.36);
        border: 1px solid rgb(63 63 70 / 0.45);
        border-radius: 0.9rem;
        backdrop-filter: blur(4px);
    }

    .post-toc-title {
        position: relative;
        z-index: 1;
        margin: 0 0 0.62rem 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: rgb(212 212 220);
        font-size: 0.76rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        line-height: 1.2;
    }

    .post-toc-title::after {
        content: "";
        flex: 1;
        height: 1px;
        background-color: rgb(63 63 70 / 0.45);
    }

    .post-toc-nav ul {
        margin: 0;
        padding: 0;
        list-style: none;
        position: relative;
        z-index: 1;
    }

    .post-toc-nav li + li {
        margin-top: 0.18rem;
    }

    .post-toc-nav a {
        color: rgb(186 192 204);
        font-size: 0.84rem;
        line-height: 1.46;
        text-decoration: none;
        position: relative;
        border-radius: 0.35rem;
        padding: 0.24rem 0.14rem 0.24rem 0.56rem;
        transition: color 0.22s ease, background-color 0.22s ease, transform 0.22s ease;
        word-break: keep-all;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .post-toc-nav a::before {
        content: "";
        position: absolute;
        left: 0.08rem;
        top: 50%;
        width: 2px;
        height: 0.9rem;
        border-radius: 9999px;
        background-color: rgb(96 165 250);
        opacity: 0;
        transform: translateY(-50%) scaleY(0.65);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .post-toc-nav li.toc-level-1 {
        margin-top: 0.4rem;
        padding-top: 0.2rem;
        border-top: none;
    }

    .post-toc-nav li.toc-level-1:first-child {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }

    .post-toc-nav li.toc-level-2 a {
        padding-left: 1.1rem;
        color: rgb(180 188 204);
        font-size: 0.78rem;
        font-weight: 520;
    }

    .post-toc-nav li.toc-level-2 a::after {
        content: "";
        position: absolute;
        left: 0.5rem;
        top: 50%;
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background-color: rgb(120 130 150 / 0.5);
        transform: translateY(-50%);
        transition: background-color 0.22s ease;
    }

    .post-toc-nav li.toc-level-2.is-expanded a {
        color: rgb(224 230 240);
    }

    .post-toc-nav li.toc-level-3 {
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        margin-top: 0;
        pointer-events: none;
        transform: translateY(-2px);
        transition: max-height 0.22s ease, opacity 0.22s ease, transform 0.22s ease, margin-top 0.22s ease;
    }

    .post-toc-nav li.toc-level-3.is-visible {
        max-height: 8rem;
        opacity: 1;
        margin-top: 0.06rem;
        pointer-events: auto;
        transform: translateY(0);
    }

    .post-toc-nav li.toc-level-3 a {
        padding-left: 1.8rem;
        font-size: 0.72rem;
        color: rgb(130 138 155);
        line-height: 1.34;
    }

    .post-toc-nav li.toc-level-1 a {
        color: rgb(240 244 252);
        font-size: 0.84rem;
        font-weight: 620;
        letter-spacing: -0.01em;
        padding-left: 0.5rem;
        padding-top: 0.14rem;
        padding-bottom: 0.12rem;
    }

    .post-toc-nav a:hover {
        color: rgb(234 237 244);
        background-color: transparent;
        transform: translateX(1px);
    }

    .post-toc-nav a.is-active {
        color: rgb(246 249 255);
        font-weight: 700;
        background-color: rgb(37 99 235 / 0.08);
    }

    .post-toc-nav a.is-active::before {
        opacity: 1;
        transform: translateY(-50%) scaleY(1);
    }
}

.post-content pre.mermaid {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    text-align: center;
    font-family: inherit !important;
    white-space: normal !important;
}

.post-content pre.mermaid svg {
    margin: 0 auto;
}

.post-content pre.mermaid svg .nodeLabel,
.post-content pre.mermaid svg .nodeLabel p {
    font-size: 0.9rem !important;
    margin: 0 !important;
}

.post-content pre.mermaid svg .edgeLabel,
.post-content pre.mermaid svg .edgeLabel p {
    font-size: 0.85rem !important;
    margin: 0 !important;
}

.ad-container {
    margin: 2.5rem auto;
    max-width: 50rem;
    text-align: center;
    padding: 0.5rem 0;
    min-height: 250px;
}

.ad-container-top {
    margin-top: 0;
    margin-bottom: 2rem;
}

.ad-container-bottom {
    margin-top: 3rem;
    margin-bottom: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgb(39 39 42);
}

@media (max-width: 768px) {
    .ad-container {
        min-height: 200px;
        margin: 1.5rem auto;
    }

    .ad-container-top {
        display: none;
    }
}
