.post-page {
    width: min(1260px, 96%);
}

.post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    align-items: start;
}

.post-modern {
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.1);
    border-radius: 18px;
    padding: 30px;
    background:
        radial-gradient(900px 280px at 10% -20%, rgba(99, 102, 241, 0.1), transparent 60%),
        #ffffff;
}

.post-title {
    margin-bottom: 12px;
    font-size: 36px;
    line-height: 1.25;
    color: #0f172a;
}

.post-modern .meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.post-modern .meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 5px 9px;
}

.post-modern .attr-button {
    border-radius: 999px;
    margin-top: 12px;
}

.post-modern .content {
    margin-top: 22px;
    font-size: 16px;
    line-height: 1.92;
    color: #1e293b;
}

.post-subscribe-form {
    margin: 0;
}

.post-subscribe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 9px 16px;
    border: 1px solid rgba(153, 246, 228, 0.72);
    background: linear-gradient(90deg, rgba(13, 148, 136, 0.96), rgba(20, 184, 166, 0.86));
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    min-width: 124px;
    min-height: 42px;
    letter-spacing: 0.2px;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, border-color 0.16s ease;
    box-shadow: 0 14px 28px rgba(15, 118, 110, 0.24), inset 0 1px 0 rgba(255,255,255,0.22);
}

.post-subscribe-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(13, 148, 136, 0.30), inset 0 1px 0 rgba(255,255,255,0.24);
    filter: saturate(1.06);
}

.post-subscribe-btn.is-unsubscribe {
    border-color: rgba(254, 202, 202, 0.62);
    background: linear-gradient(90deg, rgba(225, 29, 72, 0.92), rgba(251, 113, 133, 0.82));
    color: #fff;
    box-shadow: 0 14px 28px rgba(225, 29, 72, 0.18), inset 0 1px 0 rgba(255,255,255,0.22);
}

.post-modern .post-nav {
    margin-top: 30px;
}

.post-modern .comment-box {
    margin-top: 28px;
    border-top: 1px solid #e2e8f0;
    padding-top: 24px;
    position: relative;
}

.post-modern .comment-box h3 {
    margin: 0 0 14px;
    font-size: 26px;
    color: #0f172a;
    letter-spacing: 0.2px;
}

.post-modern .comment-box h3::after {
    content: "";
    display: block;
    width: 72px;
    height: 3px;
    margin-top: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #9333ea);
}

.post-modern .comment-box > p {
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #dbeafe;
    background: linear-gradient(180deg, #f8fbff, #eff6ff);
    color: #334155;
}

.comment-form textarea.auth-input {
    border-radius: 14px;
}

.comment-form.main-comment-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(219, 234, 254, 0.8);
    background: linear-gradient(180deg, rgba(248,250,252,0.96), rgba(239,246,255,0.92));
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.comment-form.main-comment-form textarea.auth-input {
    margin: 0;
    min-height: 92px;
    resize: vertical;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(255,255,255,0.98);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}

.comment-form.main-comment-form .attr-button {
    margin: 0;
    height: 44px;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 800;
    background: linear-gradient(135deg, rgba(124,58,237,0.98), rgba(147,51,234,0.92));
    box-shadow: 0 14px 26px rgba(124, 58, 237, 0.22);
    white-space: nowrap;
}

.comment-form.main-comment-form .attr-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(124, 58, 237, 0.28);
}

.comment-form.main-comment-form .attr-button:active {
    transform: translateY(0);
}

@media (max-width: 700px) {
    .comment-form.main-comment-form {
        grid-template-columns: 1fr;
    }
    .comment-form.main-comment-form .attr-button {
        justify-self: end;
    }
}

.comment-list {
    margin-top: 14px;
    display: grid;
    gap: 12px;
}

.comment-list > p {
    margin: 0;
    padding: 18px 16px;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    background: linear-gradient(180deg, rgba(248,250,252,0.9), rgba(241,245,249,0.9));
    color: #475569;
}

.comment-item {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.92));
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.comment-body {
    position: relative;
    padding-bottom: 38px; /* reserve for right-bottom actions */
}

.comment-item.is-reply {
    margin-top: 10px;
    border-style: dashed;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(241,245,249,0.88));
}

.comment-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(191, 219, 254, 0.55);
    background: linear-gradient(120deg, #2563eb, #7c3aed);
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.comment-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
}

.comment-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.comment-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #64748b;
}

.comment-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.comment-content {
    margin-top: 8px;
    color: #0f172a;
    line-height: 1.75;
}

.comment-actions {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.comment-reply-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.comment-reply-btn:hover {
    border-color: #93c5fd;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.comment-login-link {
    font-size: 12px;
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px solid rgba(37,99,235,0.3);
}

.reply-form {
    margin-top: 10px;
    padding: 10px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    background: rgba(248,250,252,0.9);
}

.reply-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-cancel-reply {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
}

.comment-replies {
    margin-top: 10px;
    padding-left: 12px;
    border-left: 3px solid rgba(191, 219, 254, 0.7);
    display: grid;
    gap: 10px;
}

.md-inline-code {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-size: 13px;
}

.md-code {
    position: relative;
    margin: 14px 0;
    padding: 42px 16px 14px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: #0f172a;
    overflow: hidden;
}

.md-code-inner {
    overflow: auto;
    max-height: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(148,163,184,0.55) rgba(2,6,23,0.12);
}

.md-code-inner::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.md-code-inner::-webkit-scrollbar-thumb {
    background: rgba(148,163,184,0.55);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.md-code-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(148,163,184,0.75);
    background-clip: padding-box;
}

.md-code-inner::-webkit-scrollbar-track {
    background: rgba(2,6,23,0.10);
    border-radius: 999px;
}

.md-code.is-collapsed .md-code-inner {
    max-height: 220px;
}

.md-code.is-collapsed::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    background: linear-gradient(180deg, rgba(15,23,42,0), rgba(15,23,42,0.96));
    pointer-events: none;
}

.md-code-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    gap: 6px;
    z-index: 2;
}

.md-code-btn {
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.md-code-btn:hover {
    transform: translateY(-1px);
    background: rgba(15, 23, 42, 0.75);
}

.md-code-btn:active {
    transform: translateY(0);
}

.md-code code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    color: #e2e8f0;
    line-height: 1.7;
    white-space: pre;
}

.md-code code[data-lang]::before {
    content: attr(data-lang);
    position: absolute;
    top: 6px;
    left: 8px;
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.2);
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
}

.md-heading {
    margin: 1.35em 0 0.7em;
    color: #0f172a;
    line-height: 1.35;
    scroll-margin-top: 90px;
}

.md-heading.level-1 {
    font-size: 1.9em;
}

.md-heading.level-2 {
    font-size: 1.55em;
}

.md-heading.level-3 {
    font-size: 1.3em;
}

.md-heading.level-4 {
    font-size: 1.15em;
}

.md-heading.level-5 {
    font-size: 1.03em;
}

.md-heading.level-6 {
    font-size: 0.96em;
}

.markdown-content img {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.markdown-content a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.28);
}

.post-back-link {
    margin-top: 28px;
}

.post-back-link.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(239,246,255,0.95));
    color: #1e40af;
    text-decoration: none;
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.post-back-link.back-link:hover {
    transform: translateY(-1px);
    background: linear-gradient(90deg, rgba(59,130,246,0.14), rgba(99,102,241,0.14));
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.16);
}

.post-actions-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 22px auto 14px;
    width: fit-content;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(209, 250, 229, 0.9);
    background: linear-gradient(180deg, rgba(240, 253, 250, 0.98), rgba(236, 253, 245, 0.92));
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.post-like-btn {
    border-radius: 999px;
    padding: 9px 14px 9px 12px;
    min-height: 42px;
    min-width: 108px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, border-color 0.16s ease;
}

.post-like-btn:not(.is-liked) {
    border: 1px solid rgba(148, 163, 184, 0.65);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.92));
    color: #475569;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.post-like-btn:not(.is-liked) #post-likes-count {
    color: #64748b;
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(203, 213, 225, 0.95);
}

.post-like-btn.is-liked {
    border: 1px solid rgba(253, 186, 116, 0.76);
    background:
        radial-gradient(420px 120px at 20% 0%, rgba(255, 237, 213, 0.28), transparent 62%),
        linear-gradient(90deg, rgba(234, 88, 12, 0.96), rgba(249, 115, 22, 0.88));
    color: #fff;
    box-shadow:
        0 16px 34px rgba(234, 88, 12, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.post-like-btn.is-liked:hover {
    transform: translateY(-1px);
    box-shadow:
        0 20px 44px rgba(234, 88, 12, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.20);
    border-color: rgba(254, 215, 170, 0.92);
    filter: saturate(1.04);
}

.post-like-btn:not(.is-liked):hover {
    transform: translateY(-1px);
    border-color: rgba(148, 163, 184, 0.85);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.post-like-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

.post-like-btn .like-icon {
    font-size: 18px;
    transform: translateY(-0.5px);
}

#post-likes-count {
    min-width: 30px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    color: #9a3412;
    background: rgba(255, 247, 237, 0.94);
    border: 1px solid rgba(254, 215, 170, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.post-subscribe-btn:focus,
.post-like-btn:focus {
    outline: none;
}

.post-subscribe-btn:focus-visible,
.post-like-btn:focus-visible {
    box-shadow:
        0 0 0 3px rgba(59, 130, 246, 0.22),
        0 18px 34px rgba(2, 6, 23, 0.18),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.post-nav-modern {
    gap: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    overflow: hidden;
}

.post-nav-card {
    position: relative;
    display: block;
    min-height: 120px;
    border-radius: 0;
    text-decoration: none;
    padding: 20px 24px;
    color: #fff;
    background:
        linear-gradient(135deg, #0f766e, #134e4a);
    border: 1px solid rgba(148, 163, 184, 0.22);
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.post-nav-card.next {
    background: linear-gradient(135deg, #1f2937, #111827);
    border-left: 0;
}

.post-nav-card:hover {
    filter: brightness(1.04);
}

.post-nav-card .nav-flag {
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
}

.post-nav-card .nav-title {
    margin-top: 10px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.post-nav-card.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 14px 18px;
    text-align: center;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.2px;
    background:
        radial-gradient(420px 120px at 14% 0%, rgba(59,130,246,0.10), transparent 66%),
        linear-gradient(180deg, rgba(248,250,252,0.98), rgba(241,245,249,0.96));
    border: 1px dashed rgba(148, 163, 184, 0.55);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65), 0 10px 20px rgba(15, 23, 42, 0.06);
    border-radius: 0;
}

.post-toc {
    position: sticky;
    top: 84px;
}

.post-toc-card {
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.1);
    padding: 14px;
}

.post-toc-title {
    font-weight: 800;
    color: #1e3a8a;
    margin-bottom: 10px;
}

.post-toc-list {
    display: grid;
    gap: 6px;
    max-height: calc(100vh - 180px);
    overflow: auto;
}

.post-toc-item {
    display: block;
    font-size: 13px;
    color: #334155;
    text-decoration: none;
    border-radius: 8px;
    padding: 6px 8px;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.post-toc-item.level-2 { padding-left: 14px; }
.post-toc-item.level-3 { padding-left: 20px; }
.post-toc-item.level-4 { padding-left: 26px; }
.post-toc-item.level-5 { padding-left: 32px; }
.post-toc-item.level-6 { padding-left: 38px; }

.post-toc-item:hover,
.post-toc-item.active {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.post-toc-empty {
    color: #64748b;
    font-size: 12px;
}

@media (max-width: 1080px) {
    .post-layout {
        grid-template-columns: 1fr;
    }
    .post-toc {
        position: static;
    }
}

@media (max-width: 800px) {
    .post-toc {
        display: none;
    }

    .post-modern {
        padding: 20px;
    }
    .post-title {
        font-size: 28px;
    }
    .post-nav {
        grid-template-columns: 1fr;
    }
    .post-nav-card {
        border-radius: 0;
        min-height: 100px;
    }
    .post-nav-card .nav-flag {
        font-size: 26px;
    }
    .post-nav-card .nav-title {
        font-size: 18px;
    }
}
