.post-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease, cubic-bezier(.2,.7,.2,1));
}

.post-modal[hidden] {
    display: none !important;
}

.post-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.post-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 7, .82);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.post-modal-panel {
    position: relative;
    width: 100%;
    max-width: 760px;
    max-height: min(92vh, 860px);
    display: flex;
    flex-direction: column;
    background: var(--bg-2, #171717);
    border: 1px solid var(--line-2, rgba(255,255,255,.22));
    overflow: hidden;
    transform: translateY(16px) scale(.98);
    opacity: 0;
    transition: transform .4s var(--ease, cubic-bezier(.2,.7,.2,1)),
                opacity .4s var(--ease, cubic-bezier(.2,.7,.2,1));
}

.post-modal.is-open .post-modal-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.post-modal-close {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    z-index: 4;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
    transition: background .2s var(--ease, cubic-bezier(.2,.7,.2,1)),
                border-color .2s var(--ease, cubic-bezier(.2,.7,.2,1)),
                transform .25s var(--ease, cubic-bezier(.2,.7,.2,1));
}

.post-modal-close:hover {
    background: var(--red, #e10600);
    border-color: var(--red, #e10600);
    transform: rotate(90deg);
}

.post-modal-close svg {
    width: 18px;
    height: 18px;
}

.post-modal-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-3, #1c1c1c);
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 1px solid var(--line, rgba(255,255,255,.11));
}

.post-modal-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-modal-media::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, .18) 0%,
        rgba(0, 0, 0, 0) 30%,
        rgba(0, 0, 0, .6) 100%);
}

.post-modal-media-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, .16);
}

.post-modal-media-empty svg {
    width: 60px;
    height: 60px;
}

.post-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 28px 32px 24px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.post-modal-body::-webkit-scrollbar {
    width: 6px;
}

.post-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .15);
}

.post-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line, rgba(255,255,255,.11));
}

.post-modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.3;
    color: #fff;
}

.post-modal-views {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-top: 4px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--muted, #9a9a9a);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

.post-modal-views svg {
    width: 15px;
    height: 15px;
    opacity: .75;
}

.post-modal-desc {
    font-size: .98rem;
    line-height: 2;
    color: #c8c8c8;
    white-space: pre-line;
    word-break: break-word;
    flex: 1 1 auto;
}

.post-modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 20px;
    margin-top: auto;
    border-top: 1px solid var(--line, rgba(255,255,255,.11));
    flex-wrap: wrap;
}

.vote-group {
    display: inline-flex;
    border: 1px solid var(--line-2, rgba(255,255,255,.22));
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: .86rem;
    font-weight: 700;
    color: #c8c8c8;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color .2s var(--ease, cubic-bezier(.2,.7,.2,1)),
                background .2s var(--ease, cubic-bezier(.2,.7,.2,1));
    font-variant-numeric: tabular-nums;
    -webkit-tap-highlight-color: transparent;
}

.vote-btn + .vote-btn {
    border-inline-start: 1px solid var(--line-2, rgba(255,255,255,.22));
}

.vote-btn svg {
    width: 18px;
    height: 18px;
    transition: transform .25s var(--ease, cubic-bezier(.2,.7,.2,1));
}

.vote-btn:hover:not(:disabled) {
    color: #fff;
    background: rgba(255, 255, 255, .04);
}

.vote-btn:disabled {
    opacity: .5;
    cursor: wait;
}

.vote-like.is-active {
    color: #fff;
    background: rgba(225, 6, 0, .14);
}

.vote-like.is-active svg {
    color: var(--red, #e10600);
    transform: scale(1.08);
}

.vote-dislike.is-active {
    color: #fff;
    background: rgba(120, 120, 120, .22);
}

.vote-dislike.is-active svg {
    transform: scale(1.08);
}

.post-modal-close-btn {
    padding: 10px 20px;
    font-family: inherit;
    font-size: .86rem;
    font-weight: 700;
    color: #c8c8c8;
    background: transparent;
    border: 1px solid var(--line-2, rgba(255,255,255,.22));
    cursor: pointer;
    transition: color .2s var(--ease, cubic-bezier(.2,.7,.2,1)),
                border-color .2s var(--ease, cubic-bezier(.2,.7,.2,1)),
                background .2s var(--ease, cubic-bezier(.2,.7,.2,1));
}

.post-modal-close-btn:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255, 255, 255, .05);
}

@media (max-width: 900px) {
    .post-modal {
        padding: 0;
        align-items: stretch;
    }

    .post-modal-panel {
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100vh;
        height: 100dvh;
        border: 0;
        transform: none;
        opacity: 0;
        transition: opacity .25s var(--ease, cubic-bezier(.2,.7,.2,1));
    }

    .post-modal.is-open .post-modal-panel {
        transform: none;
        opacity: 1;
    }

    .post-modal-body {
        padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    }

    .post-modal-title {
        font-size: 1.05rem;
        line-height: 1.4;
    }

    .post-modal-media {
        aspect-ratio: 16 / 10;
    }

    .post-modal-close {
        top: calc(12px + env(safe-area-inset-top, 0px));
        inset-inline-end: 12px;
        width: 36px;
        height: 36px;
    }

    .post-modal-foot {
        gap: 10px;
    }

    .vote-btn {
        padding: 9px 14px;
        font-size: .82rem;
    }

    .post-modal-close-btn {
        padding: 9px 16px;
        font-size: .82rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .post-modal,
    .post-modal-panel,
    .post-modal-close,
    .post-modal-close svg,
    .vote-btn,
    .vote-btn svg {
        transition: none !important;
    }
}